| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466 |
- <?php return array (
- 'resourceClass' => 'modDocument',
- 'resource' =>
- array (
- 'id' => 1,
- 'type' => 'document',
- 'contentType' => 'text/html',
- 'pagetitle' => 'Australian crop management platform',
- 'longtitle' => 'Crop Management Platform',
- 'description' => 'Designed to keep all your records in one place, interfacing irrigation systems, weather data, and real-time moisture monitoring, based in Australia on local conditions.',
- 'alias' => 'index',
- 'alias_visible' => 1,
- 'link_attributes' => '',
- 'published' => 1,
- 'pub_date' => 0,
- 'unpub_date' => 0,
- 'parent' => 0,
- 'isfolder' => 1,
- 'introtext' => 'crop management, irrigation alerts, weather reporting, moisture monitoring, realtime dashboard, agricultural monitoring.',
- 'content' => 'Cloud based Soil, Plant and Water Analysis, Comprehensive Reporting based on Sustainable Agricultural Practices.',
- 'richtext' => 0,
- 'template' => 5,
- 'menuindex' => 6,
- 'searchable' => 1,
- 'cacheable' => 1,
- 'createdby' => 1,
- 'createdon' => 1510602201,
- 'editedby' => 1,
- 'editedon' => 1574162405,
- 'deleted' => 0,
- 'deletedon' => 0,
- 'deletedby' => 0,
- 'publishedon' => 0,
- 'publishedby' => 0,
- 'menutitle' => '',
- 'donthit' => 0,
- 'privateweb' => 0,
- 'privatemgr' => 0,
- 'content_dispo' => 0,
- 'hidemenu' => 0,
- 'class_key' => 'modDocument',
- 'context_key' => 'web',
- 'content_type' => 1,
- 'uri' => 'index/',
- 'uri_override' => 0,
- 'hide_children_in_tree' => 0,
- 'show_in_tree' => 1,
- 'properties' => NULL,
- 'Background' =>
- array (
- 0 => 'Background',
- 1 => '',
- 2 => 'default',
- 3 => NULL,
- 4 => 'image',
- ),
- 'mailChimpSubscribe' =>
- array (
- 0 => 'mailChimpSubscribe',
- 1 => '04e221f3bc',
- 2 => 'default',
- 3 => NULL,
- 4 => 'listbox',
- ),
- '_content' => '<!DOCTYPE html>
- <html lang="en">
- <head>
- <title>Crop Management Platform | Crop Monitor</title>
- <base href="[[!++site_url]]" />
- <meta charset="UTF-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" >
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <meta name="keywords" content="crop management, irrigation alerts, weather reporting, moisture monitoring, realtime dashboard, agricultural monitoring." />
- <meta name="description" content="Designed to keep all your records in one place, interfacing irrigation systems, weather data, and real-time moisture monitoring, based in Australia on local conditions." />
-
- <link rel="icon" href="client-assets/images/favicon.ico?v=2" type="image/x-icon" >
-
- <!-- Global site tag (gtag.js) - Google Analytics -->
- <script type="text/javascript" async src="https://www.googletagmanager.com/gtag/js?id=UA-133963301-1"></script>
- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
- <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">
- <script type="text/javascript" src="https://use.fontawesome.com/1e2844bb90.js"></script>
- <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css" integrity="sha384-gfdkjb5BdAXd+lj+gudLWI+BXq4IuLW5IT+brZEZsLFm++aCMlF1V92rMkPaX4PP" crossorigin="anonymous" />
- <link rel="stylesheet" type="text/css" href="/client-assets/weather-icons/css/weather-icons.min.css?version=1.16" />
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/magnific-popup.css" />
-
- <!-- Custom styles for this template -->
- <link rel="stylesheet" href="client-assets/css/greyscale.css" >
- <link href="https://fonts.googleapis.com/css?family=Varela+Round" rel="stylesheet">
- <link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
-
-
- </head>
- <style>
- .nav-link {
- text-align: center;
- font-weight: bold;
- }
- </style>
- <body id="page-top">
-
- <!-- Navigation -->
- <nav class="navbar navbar-expand-lg navbar-light fixed-top py-3" id="mainNav">
- <div class="container">
- <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
- <span class="navbar-toggler-icon"></span>
- </button>
-
- <div class="collapse navbar-collapse" id="navbarResponsive">
- <ul class="navbar-nav mr-auto my-2 my-lg-0">
- <li class="nav-item active">
- <a class="nav-link js-scroll-trigger" href="#page-top">Home</a>
- </li>
- <li class="nav-item">
- <a class="nav-link js-scroll-trigger" href="#about">About</a>
- </li>
- <li class="nav-item">
- <a class="nav-link js-scroll-trigger" href="#services">Services</a>
- </li>
- <li class="nav-item">
- <a class="nav-link js-scroll-trigger" href="#pricing">Pricing</a>
- </li>
- </ul>
-
- <a class="navbar-brand js-scroll-trigger" href="#page-top">
- <img src="client-assets/images/crop-monitor-logo.png" height="50" class="d-inline-block align-top" alt="">
- </a>
-
- <ul class="navbar-nav ml-auto my-2 my-lg-0">
- <li class="nav-item">
- <a class="nav-link js-scroll-trigger" href="#signup">Newsletter</a>
- </li>
- <li class="nav-item">
- <a class="nav-link js-scroll-trigger" href="#blog">Blog</a>
- </li>
- <li class="nav-item">
- <a class="nav-link js-scroll-trigger" href="#contact">Contact Us</a>
- </li>
- <li class="nav-item">
- <a class="nav-link js-scroll-trigger" href="login/">Login</a>
- </li>
- </ul>
-
-
- </div>
- </div>
- </nav>
- <!-- Header -->
- <header class="header-image masthead">
- <div class="overlay"></div>
- <!--
- <div class="background">
- <div class="layer clouds">
- <div class="cloud cloud-1">
- <img src="client-assets/images/cloud-1.png" width="1600" height="850" alt="">
- </div>
-
- <div class="cloud cloud-2">
- <img src="client-assets/images/cloud-1.png" width="1600" height="850" alt="">
- </div>
-
- <div class="cloud cloud-3">
- <img src="client-assets/images/cloud-1.png" width="1600" height="850" alt="">
- </div>
- </div>
- </div>
- -->
- <!--
- <div class="container d-flex h-100 align-items-center">
- <div class="mx-auto text-center">
- <h1 class="mx-auto my-0 text-uppercase">Cropmonitor</h1>
- <img class="img-fluid" src="client-assets/images/crop-monitor-logo.png" alt="Cropmonitor">
- <h3 class="font-weight-bolder mx-auto mt-2 mb-5">Designed to keep all your records in one place, interfacing irrigation systems, weather data, and real-time moisture monitoring, based in Australia on local conditions.</h3>
- <h4 class="mx-auto mt-2 mb-5">Cloud based Soil, Plant and Water Analysis, Comprehensive Reporting based on Sustainable Agricultural Practices.</h4>
- <a href="#register" class="btn btn-success js-scroll-trigger text-light">Get Started</a>
- </div>
- </div>
- -->
-
- <div class="container h-100">
- <div class="row h-100 align-items-center justify-content-center text-center">
- <div class="col-lg-10 align-self-end">
- <!-- <p><img src="client-assets/images/favicon.ico" height="200" class="mx-auto" alt="Cropmonitor"></p> -->
- <img class="img-fluid my-5" src="client-assets/images/crop-monitor-logo.png" alt="Cropmonitor">
- <h1 class="text-uppercase text-white font-weight-bolder">Crop Management Platform</h1>
- <h2 class="text-white font-weight-bold">Designed to keep all your records in one place, interfacing irrigation systems, weather data, and real-time moisture monitoring, based in Australia on local conditions.</h2>
- <hr class="divider light my-4">
- </div>
- <div class="col-lg-8 align-self-baseline">
- <h4 class="text-white font-weight-light mb-5">Cloud based Soil, Plant and Water Analysis, Comprehensive Reporting based on Sustainable Agricultural Practices.</h4>
- <a class="btn btn-dark btn-xl js-scroll-trigger" href="#about">Find Out More</a>
- </div>
-
-
- <div class="container">
- <div class="row align-items-center">
- <div class="col-md">
- <!-- Social links -->
- <ul class="list-group list-group-horizontal text-center text-lg-left">
- <li class="list-group-item bg-transparent border-0"><a href="#"><i class="fab fa-twitter fa-2x"></i></a></li>
- <li class="list-group-item bg-transparent border-0"><a href="#"><i class="fab fa-facebook-f fa-2x"></i></a></li>
- <li class="list-group-item bg-transparent border-0"><a href="#"><i class="fab fa-instagram fa-2x"></i></a></li>
- </ul>
- </div>
- <div class="col-md">
- <!-- Address -->
- <div class="section_welcome__footer__address text-center text-white text-lg-right">
- <i class="fas fa-map-marker-alt"></i> 34 Coplestone Street, Scottsdale, Tas, 7260
- </div>
- </div>
- </div> <!-- / .row -->
- </div>
-
- </div>
- </div>
- </header>
- <!-- About Section -->
- <section id="about" class="about-section bg-success text-center">
- <div class="container">
- <div class="row">
- <div class="col-lg-8 mx-auto">
- <h1 class="text-white mb-4">Built with Bootstrap 4</h1>
- <h2 class="text-white mb-4">Built with Bootstrap 4</h2>
- <p class="text-white">Grayscale is a free Bootstrap theme created by Start Bootstrap. It can be yours right now, simply download the template on the preview page. The theme is open source, and you can use it for any purpose, personal or commercial.</p>
- </div>
- </div>
- </div>
- </section>
-
-
- <!-- Projects Section -->
- <section id="services" class="projects-section bg-light">
- <div class="container">
- [[!getResources?
- &parents=`1`
- &level=`0`
- &includeTVs=`1`
- &processTVs=`1`
- &includeContent=`1`
- &tplFirst=`projectsSectionFIRST`
- &tpl=`projectsSectionEVEN`
- &tplOdd=`projectsSectionODD`
- &sortby=`FIELD(modResource.id, 70,20,21,19,22,68,69 )`
- &sortdir=`ASC`
- &limit=`0`
- ]]
- </div>
- </section>
- <!-- Blogs Section -->
- <section id="blog" class="blog-section bg-light">
- <div class="container">
- <div vlass="row">
- <h2>Latest Blogs</h2>
- </div>
- <div class="row">
-
- [[!getPage@blog_paging?
- &elementClass=`modSnippet`
- &element=`getResources`
- &parents=`1`
- &tpl=`Home_blogit.blog_row_tpl`
- &includeTVs=`1`
- &processTVs=`1`
- &tvPrefix=``
- &where=`[[!TaggerGetResourcesWhere]]`
- &limit=`3`
- &sortby=`RAND()`
- ]]
- </div>
- </div>
- </section>
- <!-- Signup Section -->
- <section id="signup" class="signup-section">
- <div class="container">
- <div class="row">
- <div class="col-md-10 col-lg-8 mx-auto text-center">
- <i class="far fa-paper-plane fa-2x mb-2 text-white"></i>
- <h2 class="text-white mb-5">Subscribe to receive updates!</h2>
- [[!FormIt?
- &hooks=`MailChimpSubscribe`
- &validate=`email:email:required,name:required`
- &validationErrorMessage=`true`
- &clearFieldsOnSuccess=`1`
- &submitVar=`newsletter-submit`
- &mailchimpListId=`04e221f3bc`
- &mailchimpFields=`name=FNAME,email=EMAIL`
- &mailchimpSubscribeField=`newsletter`
- &mailchimpSubscribeFieldValue=`1`
- &successMessage=`Thankyou for subscribing`
- ]]
- <span>[[!+fi.successMessage:notempty=`<h2 class="text-white mb-5">[[!+fi.successMessage]]</h2>`]]
- [[!+fi.validation_error_message:notempty=`<h2 class="text-white mb-5">[[+errors]] [[!+fi.validation_error_message]]</h2>`]]</span>
- <form action="/#signup" method="post" class="form-inline d-flex">
- <input type="hidden" name="nospam" value="" />
- <input class="form-control flex-fill mr-0 mr-sm-2 mb-3 mb-sm-0" type="email" name="email" id="email" value="[[!+fi.email]]" placeholder="Email Address" >
- <input class="form-control flex-fill mr-0 mr-sm-2 mb-3 mb-sm-0" type="text" name="name" id="name" value="[[!+fi.name]]" placeholder="Full Name">
- <input type="submit" name="newsletter-submit" class="btn btn-success mx-auto" value="Subscribe" />
- </form>
-
- </div>
- </div>
- </div>
- </section>
- <!-- Contact Section -->
- <section id="contact" class="contact-section bg-black">
- <div class="container">
- <div class="row">
- <div class="col-md-4 mb-3 mb-md-0">
- <div class="card py-4 h-100">
- <div class="card-body text-center">
- <i class="fas fa-map-marked-alt text-primary mb-2"></i>
- <h4 class="text-uppercase m-0">Address</h4>
- <hr class="my-4">
- <div class="small text-black-50">34 Coplestone Street,<br> Scottsdale, Tasmania 7260</div>
- </div>
- </div>
- </div>
-
- <div class="col-md-4 mb-3 mb-md-0">
- <div class="card py-4 h-100">
- <div class="card-body text-center">
- <i class="fas fa-envelope text-primary mb-2"></i>
- <h4 class="text-uppercase m-0">Email</h4>
- <hr class="my-4">
- <div class="small text-black-50">
- <a href="#">enquiry@cropmonitor.info</a>
- </div>
- </div>
- </div>
- </div>
-
- <div class="col-md-4 mb-3 mb-md-0">
- <div class="card py-4 h-100">
- <div class="card-body text-center">
- <i class="fas fa-mobile-alt text-primary mb-2"></i>
- <h4 class="text-uppercase m-0">Phone</h4>
- <hr class="my-4">
- <div class="small text-black-50">0417 728 061</div>
- </div>
- </div>
- </div>
- </div>
-
- <div class="row">
- <div class="col mb-3 mt-3 mb-md-0">
- <div class="card py-4 h-100">
- <div class="card-body text-center">
- <i class="fas fa-mobile-alt text-primary mb-2"></i>
- <h4 class="text-uppercase m-0">Contact Us</h4>
- <hr class="my-4">
- [[!FormIt?
- &hooks=`spam,email`
- &submitVar=`enquiry-submit`
- &emailTpl=`CMenquiryEmailTpl`
- &emailTo=`enquiries@cropmonitor.info`
- &successMessage=`Thankyou for contacting us, we will be in touch soon.`
- &validationErrorMessage=`true`
- &validate=`nospam:blank,
- name:required,
- email:email:required,
- text:required:stripTags`
- ]]
- <span>
- [[!+fi.successMessage:notempty=`<div class="small text-black-50">[[!+fi.successMessage]]</div>`]]
- [[!+fi.validation_error_message:notempty=`<div class="small text-black-50">[[+errors]] [[!+fi.validation_error_message]]</div>`]]
- </span>
- <form action="/#contact" method="post" class="form-inline d-flex">
- <input type="hidden" name="nospam" value="" />
- <input class="form-control form-control-sm flex-fill mr-0 mr-sm-2 mb-3 mb-sm-0" type="email" name="email" id="email" value="[[!+fi.email]]" placeholder="Email Address" >
- <input class="form-control form-control-sm flex-fill mr-0 mr-sm-2 mb-3 mb-sm-0" type="text" name="name" id="name" value="[[!+fi.name]]" placeholder="Full Name">
- <textarea class="form-control form-control-sm flex-fill mr-0 mr-sm-2 mb-3 mb-sm-0" name="text" id="text" rows="1" value="[[!+fi.text]]" placeholder="Your enquiry is about...." ></textarea>
- <input type="submit" name="enquiry-submit" class="btn-sm btn btn-success" value="Submit" />
- </form>
- </div>
- </div>
- </div>
- </div>
-
- <div class="social d-flex justify-content-center">
- <a href="#" class="mx-2">
- <i class="fab fa-youtube"></i>
- </a>
- <a href="#" class="mx-2">
- <i class="fab fa-facebook-f"></i>
- </a>
- <a href="#" class="mx-2">
- <i class="fab fa-linkedin"></i>
- </a>
- </div>
- </div>
- </section>
-
-
- <!-- Modal -->
- <div class="modal fade" id="soilAnalysisExample" tabindex="-1" role="dialog" aria-labelledby="soilAnalysisExample" aria-hidden="true">
- <div class="modal-dialog modal-xl modal-dialog-centered" role="document">
- <div class="modal-content">
- <div class="modal-header">
- <h5 class="modal-title" id="soilAnalysisExample">Try out our Soil Test Analysis Report</h5>
- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
- <span aria-hidden="true">×</span>
- </button>
- </div>
- <div class="modal-body">
-
- <div class="grid-form1">
- <span class="error">* required fields.</span>
-
- <form method="post" action="#" id="csvForm" class="needs-validation" novalidate >
-
- <div class="form-row">
- <div class="form-group col-12 col-md-4 mb-1">
- <label for="client_name" class="p-0 mb-0 col-form-label-sm">Client Name<span class="error">*</span></label>
- <input type="text" class="form-control form-control-sm" name="name" id="name" placeholder="Client Name" required autocomplete="on">
- </div>
- <div class="form-group col-12 col-md-4 mb-1">
- <label for="email" class="p-0 mb-0 col-form-label-sm">Email address<span class="error">*</span></label>
- <input type="email" class="form-control form-control-sm" name="email" id="email" placeholder="Email address" required autocomplete="on">
- </div>
- <div class="form-group col-12 col-md-4 mb-1">
- <label for="company_name" class="p-0 mb-0 col-form-label-sm">Company Name</label>
- <input type="text" class="form-control form-control-sm" name="company" id="company" placeholder="Company Name" autocomplete="on">
- </div>
- </div>
- <div class="form-row">
- <div class="form-group col-12 col-md-6 mb-1">
- <label for="site_address" class="p-0 mb-0 col-form-label-sm">Site Address</label>
- <input type="text" class="form-control form-control-sm" name="site_address" id="site_address" placeholder="Site Address" autocomplete="on">
- </div>
- <div class="form-group col-12 col-md-6 mb-1">
- <label for="state_postcode" class="p-0 mb-0 col-form-label-sm">Postal Address</label>
- <input type="text" class="form-control form-control-sm" name="postal_address" id="postal_address" placeholder="Postal Address" autocomplete="on">
- </div>
- </div>
-
- <hr>
-
- [[$soilAnalysisForm_bootstrap]]
-
- <button form="csvForm" type="submit" name="csvForm" class="btn btn-success">Submit</button>
- </form>
-
- [[!soilformSubmit]]
-
- <script type="text/javascript">
- // JavaScript for disabling form submission if there are invalid fields
- (function() {
- \'use strict\';
- window.addEventListener(\'load\', function() {
- // Fetch all the forms we want to apply custom Bootstrap validation styles to
- var forms = document.getElementsByClassName(\'needs-validation\');
- // Loop over them and prevent submission
- var validation = Array.prototype.filter.call(forms, function(form) {
- form.addEventListener(\'submit\', function(event) {
- if (form.checkValidity() === false) {
- event.preventDefault();
- event.stopPropagation();
- }
- form.classList.add(\'was-validated\');
- }, false);
- });
- }, false);
- })();
- </script>
- </div>
-
-
- </div>
-
- </div>
- </div>
- </div>
- <!-- Modal -->
- <div class="modal fade" id="plantAnalysisExample" tabindex="-1" role="dialog" aria-labelledby="plantAnalysisExample" aria-hidden="true">
- <div class="modal-dialog modal-xl modal-dialog-centered" role="document">
- <div class="modal-content">
- <div class="modal-header">
- <h5 class="modal-title" id="plantAnalysisExample">Try out our Plant Analysis Report</h5>
- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
- <span aria-hidden="true">×</span>
- </button>
- </div>
- <div class="modal-body">
-
- <div class="grid-form1">
- <span class="error">* required fields.</span>
- <form method="post" action="#" id="PlantcsvForm" class="needs-validation" novalidate >
-
- <div class="form-row">
- <div class="form-group col-12 col-md-4 mb-1">
- <label for="client_name" class="p-0 mb-0 col-form-label-sm">Client Name<span class="error">*</span></label>
- <input type="text" class="form-control form-control-sm" name="name" id="name" placeholder="Client Name" required autocomplete="on">
- </div>
- <div class="form-group col-12 col-md-4 mb-1">
- <label for="email" class="p-0 mb-0 col-form-label-sm">Email address<span class="error">*</span></label>
- <input type="email" class="form-control form-control-sm" name="email" id="email" placeholder="Email address" required autocomplete="on">
- </div>
- <div class="form-group col-12 col-md-4 mb-1">
- <label for="company_name" class="p-0 mb-0 col-form-label-sm">Company Name</label>
- <input type="text" class="form-control form-control-sm" name="company" id="company" placeholder="Company Name" autocomplete="on">
- </div>
- </div>
- <div class="form-row">
- <div class="form-group col-12 col-md-6 mb-1">
- <label for="site_address" class="p-0 mb-0 col-form-label-sm">Site Address</label>
- <input type="text" class="form-control form-control-sm" name="site_address" id="site_address" placeholder="Site Address" autocomplete="on">
- </div>
- <div class="form-group col-12 col-md-6 mb-1">
- <label for="state_postcode" class="p-0 mb-0 col-form-label-sm">Postal Address</label>
- <input type="text" class="form-control form-control-sm" name="postal_address" id="postal_address" placeholder="Postal Address" autocomplete="on">
- </div>
- </div>
-
- <hr>
-
- <div class="form-row">
- <div class="col-md-3 form-group">
- <small id="analysis_type" class="form-text text-muted">Analysis Type<span class="error">*</span></small>
- <div><select name="analysis_type" id="analysis_type" class="form-control form-control-sm" required>
- <option>Select the type of Analysis...</option>
- <option id="ash">Dry Ash Test</option>
- <option id="sap">Sap Analysis</option>
- <option id="field">Field Test</option>
- </select></div>
- </div>
- <div class="col-md-3 form-group">
- <small id="lab_no" class="form-text text-muted">Lab No</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="lab_no" id="lab_no" placeholder="Lab No"></input>
-
- </div>
- </div>
-
- <div class="col-md-3 form-group">
- <small id="batch_no" class="form-text text-muted">Batch No</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="batch_no" id="batch_no" placeholder="Batch No"></input>
-
- </div>
- </div>
- <div class="col-md-3 form-group">
- <small id="date_sampled" class="form-text text-muted">Date Sampled</small>
- <input data-provide="datepicker" class="form-control form-control-sm" name="date_sampled" id="datepicker" placeholder="Date Sampled" data-date-format="dd/mm/yyyy" data-date-end-date="0d" ></input>
- <script>
- $(\'#datepicker\').datepicker({
- uiLibrary: \'bootstrap4\',
- calendarWeeks: \'true\',
- todayHighlight: \'true\'
- });
- </script>
- </div>
-
- <!-- Hidden Fields for Database -->
- <input type="hidden" class="form-control form-control-sm" name="m_user" id="m_user" placeholder="0" required>
- <input type="hidden" class="form-control form-control-sm" name="client_id" id="client_id" placeholder="(anonymous)" required>
- </div>
- <div class="form-row">
- <div class="col-md-4 form-group">
- <small id="lab_no" class="form-text text-muted">Sample ID<span class="error">*</span></small>
- <input type="text" class="form-control form-control-sm" name="sample_id" id="sample_id" placeholder="Sample Id" required></input>
- </div>
-
- <div class="col-md-4 form-group">
- <small id="lab_no" class="form-text text-muted">Site ID</small>
- <input type="text" class="form-control form-control-sm" name="site_id" id="site_id" placeholder="Paddock Id"></input>
- </div>
- [[!croptypeFORM]]
- </div>
- <hr>
- <label class="col"><b>Analysis Inputs</b></label>
-
- <div class="form-row">
- <div class="form-group col-md-2">
- <small id="nSmall" class="form-text text-muted">Nitrogen</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="n" id="n" placeholder="N - Nitrogen"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="nitrogen" value="ppm" onClick="conversion(this, nitrogen, n, 10000)" ></input>
- </div>
- </div>
- </div>
- <div class="form-group col-md-2">
- <small id="p" class="form-text text-muted">Phosphorus</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="p" id="p" placeholder="P - Phosphorus"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="phosphorus" value="ppm" onClick="conversion(this, phosphorus, p, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="k" class="form-text text-muted">Postassium</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="k" id="k" placeholder="K - Postassium"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="postassium" value="ppm" onClick="conversion(this, postassium, k, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="s" class="form-text text-muted">Sulphur</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="s" id="s" placeholder="S - Sulphur"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="sulphur" value="ppm" onClick="conversion(this, sulphur, s, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="mg" class="form-text text-muted">Magnesium</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="mg" id="mg" placeholder="Mg - Magnesium"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="magnesium" value="ppm" onClick="conversion(this, magnesium, mg, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="ca" class="form-text text-muted">Calcium</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="ca" id="ca" placeholder="Ca - Calcium"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="calcium" value="ppm" onClick="conversion(this, calcium, ca, 10000)" ></input>
- </div>
- </div>
- </div>
- </div>
-
- <div class="form-row">
- <div class="form-group col-md-2">
- <small id="na" class="form-text text-muted">Soduim</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="na" id="na" placeholder="Na - Soduim"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="soduim" value="ppm" onClick="conversion(this, soduim, na, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="fe" class="form-text text-muted">Iron</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="fe" id="fe" placeholder="Fe - Iron"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="iron" value="ppm" onClick="conversion(this, iron, fe, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="mn" class="form-text text-muted">Manganese</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="mn" id="mn" placeholder="Mn - Manganese"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="manganese" value="ppm" onClick="conversion(this, manganese, mn, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="zn" class="form-text text-muted">Zinc</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="zn" id="zn" placeholder="Zn - Zinc"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="zinc" value="ppm" onClick="conversion(this, zinc, zn, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="cu" class="form-text text-muted">Copper</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="cu" id="cu" placeholder="Cu - Copper"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="copper" value="ppm" onClick="conversion(this, copper, cu, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="b" class="form-text text-muted">Boron</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="b" id="b" placeholder="B - Boron"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="boron" value="ppm" onClick="conversion(this, boron, b, 10000)" ></input>
- </div>
- </div>
- </div>
- </div>
- <div class="form-row">
- <div class="form-group col-md-2">
- <small id="m" class="form-text text-muted">Molybdenum</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="m" id="m" placeholder="M - Molybdenum"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="molybdenum" value="ppm" onClick="conversion(this, molybdenum, m, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="co" class="form-text text-muted">Cobalt</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="co" id="co" placeholder="Co - Cobalt"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="cobalt" value="ppm" onClick="conversion(this, cobalt, co, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="se" class="form-text text-muted">Selenium</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="se" id="se" placeholder="Se - Selenium"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="selenium" value="ppm" onClick="conversion(this, selenium, se, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="ch" class="form-text text-muted">Chloride</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="ch" id="ch" placeholder="Ch - Chloride"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="chloride" value="ppm" onClick="conversion(this, chloride, cg, 10000)" ></input>
- </div>
- </div>
- </div>
-
- </div>
- <script type="text/javascript">
- function conversion(value, input, element, conversion) {
- var Nvalue = document.getElementById(element.id).value;
- var el = document.getElementById(input.id);
- if ( el.value === "%" ) {
- el.value = "ppm";
- document.getElementById(element.id).value = Nvalue*conversion;
- } else {
- el.value = "%";
- document.getElementById(element.id).value = Nvalue/conversion;
- }
- }
- </script>
-
- <button form="PlantcsvForm" type="submit" name="PlantcsvForm" class="btn btn-success">Submit</button>
- </form>
- </div>
- [[!plantformSubmit]]
-
-
- <script type="text/javascript">
- // JavaScript for disabling form submission if there are invalid fields
- (function() {
- \'use strict\';
- window.addEventListener(\'load\', function() {
- // Fetch all the forms we want to apply custom Bootstrap validation styles to
- var forms = document.getElementsByClassName(\'needs-validation\');
- // Loop over them and prevent submission
- var validation = Array.prototype.filter.call(forms, function(form) {
- form.addEventListener(\'submit\', function(event) {
- if (form.checkValidity() === false) {
- event.preventDefault();
- event.stopPropagation();
- }
- form.classList.add(\'was-validated\');
- }, false);
- });
- }, false);
- })();
- </script>
-
-
- </div>
-
- </div>
- </div>
- </div>
-
-
- <!-- Footer -->
- <footer class="bg-black small text-center text-white-50">
- <div class="container">
- <span>© 2005-2019 by Crop Monitor</span>. All Rights Reserved<a href="/"></a>
- </div>
- </footer>
- <!-- jQuery first, then Popper.js, then Bootstrap JS -->
- <script type="text/javascript" src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js" integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU=" crossorigin="anonymous"></script>
- <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
- <script type="text/javascript" src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
- <script type="text/javascript">
- addEventListener("load", function() {
- setTimeout(hideURLbar, 0);
- }, false);
- function hideURLbar(){
- window.scrollTo(0,1);
- }
- </script>
- <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.bundle.min.js" integrity="sha384-xrRywqdh3PHs8keKZN+8zzc5TX0GRTLCcmivcbNJWm2rs5C8PRhcEn3czEjhAO9o" crossorigin="anonymous"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.4.1/jquery.easing.js"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/jquery.magnific-popup.js"></script>
- <!-- Custom scripts for this template -->
- <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.4.1/jquery.easing.js"></script>
- <script type="text/javascript" src="client-assets/js/greyscale.js"></script>
- <script type="text/javascript" src="client-assets/js/creative.js"></script>
- </body>
- </html> ',
- '_isForward' => false,
- ),
- 'contentType' =>
- array (
- 'id' => 1,
- 'name' => 'HTML',
- 'description' => 'HTML content',
- 'mime_type' => 'text/html',
- 'file_extensions' => '.html',
- 'headers' => NULL,
- 'binary' => 0,
- ),
- 'policyCache' =>
- array (
- ),
- 'elementCache' =>
- array (
- '[[*longtitle]]' => 'Crop Management Platform',
- '[[*introtext]]' => 'crop management, irrigation alerts, weather reporting, moisture monitoring, realtime dashboard, agricultural monitoring.',
- '[[*description]]' => 'Designed to keep all your records in one place, interfacing irrigation systems, weather data, and real-time moisture monitoring, based in Australia on local conditions.',
- '[[$dash-header]]' => '<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
- <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">
- <script type="text/javascript" src="https://use.fontawesome.com/1e2844bb90.js"></script>
- <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css" integrity="sha384-gfdkjb5BdAXd+lj+gudLWI+BXq4IuLW5IT+brZEZsLFm++aCMlF1V92rMkPaX4PP" crossorigin="anonymous" />
- <link rel="stylesheet" type="text/css" href="/client-assets/weather-icons/css/weather-icons.min.css?version=1.16" />
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/magnific-popup.css" />',
- '[[~4]]' => 'login/',
- '[[*id]]' => 1,
- '[[blogit.lexicon_load]]' => '',
- '[[~1]]' => '/',
- '[[$analysis_Clientdetails]]' => '<div class="form-row">
- <div class="form-group col-12 col-md-4 mb-1">
- <label for="client_name" class="p-0 mb-0 col-form-label-sm">Client Name<span class="error">*</span></label>
- <input type="text" class="form-control form-control-sm" name="name" id="name" placeholder="Client Name" required autocomplete="on">
- </div>
- <div class="form-group col-12 col-md-4 mb-1">
- <label for="email" class="p-0 mb-0 col-form-label-sm">Email address<span class="error">*</span></label>
- <input type="email" class="form-control form-control-sm" name="email" id="email" placeholder="Email address" required autocomplete="on">
- </div>
- <div class="form-group col-12 col-md-4 mb-1">
- <label for="company_name" class="p-0 mb-0 col-form-label-sm">Company Name</label>
- <input type="text" class="form-control form-control-sm" name="company" id="company" placeholder="Company Name" autocomplete="on">
- </div>
- </div>
- <div class="form-row">
- <div class="form-group col-12 col-md-6 mb-1">
- <label for="site_address" class="p-0 mb-0 col-form-label-sm">Site Address</label>
- <input type="text" class="form-control form-control-sm" name="site_address" id="site_address" placeholder="Site Address" autocomplete="on">
- </div>
- <div class="form-group col-12 col-md-6 mb-1">
- <label for="state_postcode" class="p-0 mb-0 col-form-label-sm">Postal Address</label>
- <input type="text" class="form-control form-control-sm" name="postal_address" id="postal_address" placeholder="Postal Address" autocomplete="on">
- </div>
- </div>',
- '[[$soilAnalysisTrialModal]]' => '<!-- Modal -->
- <div class="modal fade" id="soilAnalysisExample" tabindex="-1" role="dialog" aria-labelledby="soilAnalysisExample" aria-hidden="true">
- <div class="modal-dialog modal-xl modal-dialog-centered" role="document">
- <div class="modal-content">
- <div class="modal-header">
- <h5 class="modal-title" id="soilAnalysisExample">Try out our Soil Test Analysis Report</h5>
- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
- <span aria-hidden="true">×</span>
- </button>
- </div>
- <div class="modal-body">
-
- <div class="grid-form1">
- <span class="error">* required fields.</span>
-
- <form method="post" action="#" id="csvForm" class="needs-validation" novalidate >
-
- <div class="form-row">
- <div class="form-group col-12 col-md-4 mb-1">
- <label for="client_name" class="p-0 mb-0 col-form-label-sm">Client Name<span class="error">*</span></label>
- <input type="text" class="form-control form-control-sm" name="name" id="name" placeholder="Client Name" required autocomplete="on">
- </div>
- <div class="form-group col-12 col-md-4 mb-1">
- <label for="email" class="p-0 mb-0 col-form-label-sm">Email address<span class="error">*</span></label>
- <input type="email" class="form-control form-control-sm" name="email" id="email" placeholder="Email address" required autocomplete="on">
- </div>
- <div class="form-group col-12 col-md-4 mb-1">
- <label for="company_name" class="p-0 mb-0 col-form-label-sm">Company Name</label>
- <input type="text" class="form-control form-control-sm" name="company" id="company" placeholder="Company Name" autocomplete="on">
- </div>
- </div>
- <div class="form-row">
- <div class="form-group col-12 col-md-6 mb-1">
- <label for="site_address" class="p-0 mb-0 col-form-label-sm">Site Address</label>
- <input type="text" class="form-control form-control-sm" name="site_address" id="site_address" placeholder="Site Address" autocomplete="on">
- </div>
- <div class="form-group col-12 col-md-6 mb-1">
- <label for="state_postcode" class="p-0 mb-0 col-form-label-sm">Postal Address</label>
- <input type="text" class="form-control form-control-sm" name="postal_address" id="postal_address" placeholder="Postal Address" autocomplete="on">
- </div>
- </div>
-
- <hr>
-
- [[$soilAnalysisForm_bootstrap]]
-
- <button form="csvForm" type="submit" name="csvForm" class="btn btn-success">Submit</button>
- </form>
-
- [[!soilformSubmit]]
-
- <script type="text/javascript">
- // JavaScript for disabling form submission if there are invalid fields
- (function() {
- \'use strict\';
- window.addEventListener(\'load\', function() {
- // Fetch all the forms we want to apply custom Bootstrap validation styles to
- var forms = document.getElementsByClassName(\'needs-validation\');
- // Loop over them and prevent submission
- var validation = Array.prototype.filter.call(forms, function(form) {
- form.addEventListener(\'submit\', function(event) {
- if (form.checkValidity() === false) {
- event.preventDefault();
- event.stopPropagation();
- }
- form.classList.add(\'was-validated\');
- }, false);
- });
- }, false);
- })();
- </script>
- </div>
-
-
- </div>
-
- </div>
- </div>
- </div>',
- '[[$plantAnalysisForm]]' => '<div class="form-row">
- <div class="col-md-3 form-group">
- <small id="analysis_type" class="form-text text-muted">Analysis Type<span class="error">*</span></small>
- <div><select name="analysis_type" id="analysis_type" class="form-control form-control-sm" required>
- <option>Select the type of Analysis...</option>
- <option id="ash">Dry Ash Test</option>
- <option id="sap">Sap Analysis</option>
- <option id="field">Field Test</option>
- </select></div>
- </div>
- <div class="col-md-3 form-group">
- <small id="lab_no" class="form-text text-muted">Lab No</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="lab_no" id="lab_no" placeholder="Lab No"></input>
-
- </div>
- </div>
-
- <div class="col-md-3 form-group">
- <small id="batch_no" class="form-text text-muted">Batch No</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="batch_no" id="batch_no" placeholder="Batch No"></input>
-
- </div>
- </div>
- <div class="col-md-3 form-group">
- <small id="date_sampled" class="form-text text-muted">Date Sampled</small>
- <input data-provide="datepicker" class="form-control form-control-sm" name="date_sampled" id="datepicker" placeholder="Date Sampled" data-date-format="dd/mm/yyyy" data-date-end-date="0d" ></input>
- <script>
- $(\'#datepicker\').datepicker({
- uiLibrary: \'bootstrap4\',
- calendarWeeks: \'true\',
- todayHighlight: \'true\'
- });
- </script>
- </div>
-
- <!-- Hidden Fields for Database -->
- <input type="hidden" class="form-control form-control-sm" name="m_user" id="m_user" placeholder="0" required>
- <input type="hidden" class="form-control form-control-sm" name="client_id" id="client_id" placeholder="(anonymous)" required>
- </div>
- <div class="form-row">
- <div class="col-md-4 form-group">
- <small id="lab_no" class="form-text text-muted">Sample ID<span class="error">*</span></small>
- <input type="text" class="form-control form-control-sm" name="sample_id" id="sample_id" placeholder="Sample Id" required></input>
- </div>
-
- <div class="col-md-4 form-group">
- <small id="lab_no" class="form-text text-muted">Site ID</small>
- <input type="text" class="form-control form-control-sm" name="site_id" id="site_id" placeholder="Paddock Id"></input>
- </div>
- [[!croptypeFORM]]
- </div>
- <hr>
- <label class="col"><b>Analysis Inputs</b></label>
-
- <div class="form-row">
- <div class="form-group col-md-2">
- <small id="nSmall" class="form-text text-muted">Nitrogen</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="n" id="n" placeholder="N - Nitrogen"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="nitrogen" value="ppm" onClick="conversion(this, nitrogen, n, 10000)" ></input>
- </div>
- </div>
- </div>
- <div class="form-group col-md-2">
- <small id="p" class="form-text text-muted">Phosphorus</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="p" id="p" placeholder="P - Phosphorus"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="phosphorus" value="ppm" onClick="conversion(this, phosphorus, p, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="k" class="form-text text-muted">Postassium</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="k" id="k" placeholder="K - Postassium"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="postassium" value="ppm" onClick="conversion(this, postassium, k, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="s" class="form-text text-muted">Sulphur</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="s" id="s" placeholder="S - Sulphur"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="sulphur" value="ppm" onClick="conversion(this, sulphur, s, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="mg" class="form-text text-muted">Magnesium</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="mg" id="mg" placeholder="Mg - Magnesium"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="magnesium" value="ppm" onClick="conversion(this, magnesium, mg, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="ca" class="form-text text-muted">Calcium</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="ca" id="ca" placeholder="Ca - Calcium"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="calcium" value="ppm" onClick="conversion(this, calcium, ca, 10000)" ></input>
- </div>
- </div>
- </div>
- </div>
-
- <div class="form-row">
- <div class="form-group col-md-2">
- <small id="na" class="form-text text-muted">Soduim</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="na" id="na" placeholder="Na - Soduim"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="soduim" value="ppm" onClick="conversion(this, soduim, na, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="fe" class="form-text text-muted">Iron</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="fe" id="fe" placeholder="Fe - Iron"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="iron" value="ppm" onClick="conversion(this, iron, fe, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="mn" class="form-text text-muted">Manganese</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="mn" id="mn" placeholder="Mn - Manganese"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="manganese" value="ppm" onClick="conversion(this, manganese, mn, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="zn" class="form-text text-muted">Zinc</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="zn" id="zn" placeholder="Zn - Zinc"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="zinc" value="ppm" onClick="conversion(this, zinc, zn, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="cu" class="form-text text-muted">Copper</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="cu" id="cu" placeholder="Cu - Copper"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="copper" value="ppm" onClick="conversion(this, copper, cu, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="b" class="form-text text-muted">Boron</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="b" id="b" placeholder="B - Boron"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="boron" value="ppm" onClick="conversion(this, boron, b, 10000)" ></input>
- </div>
- </div>
- </div>
- </div>
- <div class="form-row">
- <div class="form-group col-md-2">
- <small id="m" class="form-text text-muted">Molybdenum</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="m" id="m" placeholder="M - Molybdenum"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="molybdenum" value="ppm" onClick="conversion(this, molybdenum, m, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="co" class="form-text text-muted">Cobalt</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="co" id="co" placeholder="Co - Cobalt"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="cobalt" value="ppm" onClick="conversion(this, cobalt, co, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="se" class="form-text text-muted">Selenium</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="se" id="se" placeholder="Se - Selenium"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="selenium" value="ppm" onClick="conversion(this, selenium, se, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="ch" class="form-text text-muted">Chloride</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="ch" id="ch" placeholder="Ch - Chloride"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="chloride" value="ppm" onClick="conversion(this, chloride, cg, 10000)" ></input>
- </div>
- </div>
- </div>
-
- </div>
- <script type="text/javascript">
- function conversion(value, input, element, conversion) {
- var Nvalue = document.getElementById(element.id).value;
- var el = document.getElementById(input.id);
- if ( el.value === "%" ) {
- el.value = "ppm";
- document.getElementById(element.id).value = Nvalue*conversion;
- } else {
- el.value = "%";
- document.getElementById(element.id).value = Nvalue/conversion;
- }
- }
- </script>',
- '[[$plantAnalysisTrialModal]]' => '<!-- Modal -->
- <div class="modal fade" id="plantAnalysisExample" tabindex="-1" role="dialog" aria-labelledby="plantAnalysisExample" aria-hidden="true">
- <div class="modal-dialog modal-xl modal-dialog-centered" role="document">
- <div class="modal-content">
- <div class="modal-header">
- <h5 class="modal-title" id="plantAnalysisExample">Try out our Plant Analysis Report</h5>
- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
- <span aria-hidden="true">×</span>
- </button>
- </div>
- <div class="modal-body">
-
- <div class="grid-form1">
- <span class="error">* required fields.</span>
- <form method="post" action="#" id="PlantcsvForm" class="needs-validation" novalidate >
-
- <div class="form-row">
- <div class="form-group col-12 col-md-4 mb-1">
- <label for="client_name" class="p-0 mb-0 col-form-label-sm">Client Name<span class="error">*</span></label>
- <input type="text" class="form-control form-control-sm" name="name" id="name" placeholder="Client Name" required autocomplete="on">
- </div>
- <div class="form-group col-12 col-md-4 mb-1">
- <label for="email" class="p-0 mb-0 col-form-label-sm">Email address<span class="error">*</span></label>
- <input type="email" class="form-control form-control-sm" name="email" id="email" placeholder="Email address" required autocomplete="on">
- </div>
- <div class="form-group col-12 col-md-4 mb-1">
- <label for="company_name" class="p-0 mb-0 col-form-label-sm">Company Name</label>
- <input type="text" class="form-control form-control-sm" name="company" id="company" placeholder="Company Name" autocomplete="on">
- </div>
- </div>
- <div class="form-row">
- <div class="form-group col-12 col-md-6 mb-1">
- <label for="site_address" class="p-0 mb-0 col-form-label-sm">Site Address</label>
- <input type="text" class="form-control form-control-sm" name="site_address" id="site_address" placeholder="Site Address" autocomplete="on">
- </div>
- <div class="form-group col-12 col-md-6 mb-1">
- <label for="state_postcode" class="p-0 mb-0 col-form-label-sm">Postal Address</label>
- <input type="text" class="form-control form-control-sm" name="postal_address" id="postal_address" placeholder="Postal Address" autocomplete="on">
- </div>
- </div>
-
- <hr>
-
- <div class="form-row">
- <div class="col-md-3 form-group">
- <small id="analysis_type" class="form-text text-muted">Analysis Type<span class="error">*</span></small>
- <div><select name="analysis_type" id="analysis_type" class="form-control form-control-sm" required>
- <option>Select the type of Analysis...</option>
- <option id="ash">Dry Ash Test</option>
- <option id="sap">Sap Analysis</option>
- <option id="field">Field Test</option>
- </select></div>
- </div>
- <div class="col-md-3 form-group">
- <small id="lab_no" class="form-text text-muted">Lab No</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="lab_no" id="lab_no" placeholder="Lab No"></input>
-
- </div>
- </div>
-
- <div class="col-md-3 form-group">
- <small id="batch_no" class="form-text text-muted">Batch No</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="batch_no" id="batch_no" placeholder="Batch No"></input>
-
- </div>
- </div>
- <div class="col-md-3 form-group">
- <small id="date_sampled" class="form-text text-muted">Date Sampled</small>
- <input data-provide="datepicker" class="form-control form-control-sm" name="date_sampled" id="datepicker" placeholder="Date Sampled" data-date-format="dd/mm/yyyy" data-date-end-date="0d" ></input>
- <script>
- $(\'#datepicker\').datepicker({
- uiLibrary: \'bootstrap4\',
- calendarWeeks: \'true\',
- todayHighlight: \'true\'
- });
- </script>
- </div>
-
- <!-- Hidden Fields for Database -->
- <input type="hidden" class="form-control form-control-sm" name="m_user" id="m_user" placeholder="0" required>
- <input type="hidden" class="form-control form-control-sm" name="client_id" id="client_id" placeholder="(anonymous)" required>
- </div>
- <div class="form-row">
- <div class="col-md-4 form-group">
- <small id="lab_no" class="form-text text-muted">Sample ID<span class="error">*</span></small>
- <input type="text" class="form-control form-control-sm" name="sample_id" id="sample_id" placeholder="Sample Id" required></input>
- </div>
-
- <div class="col-md-4 form-group">
- <small id="lab_no" class="form-text text-muted">Site ID</small>
- <input type="text" class="form-control form-control-sm" name="site_id" id="site_id" placeholder="Paddock Id"></input>
- </div>
- [[!croptypeFORM]]
- </div>
- <hr>
- <label class="col"><b>Analysis Inputs</b></label>
-
- <div class="form-row">
- <div class="form-group col-md-2">
- <small id="nSmall" class="form-text text-muted">Nitrogen</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="n" id="n" placeholder="N - Nitrogen"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="nitrogen" value="ppm" onClick="conversion(this, nitrogen, n, 10000)" ></input>
- </div>
- </div>
- </div>
- <div class="form-group col-md-2">
- <small id="p" class="form-text text-muted">Phosphorus</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="p" id="p" placeholder="P - Phosphorus"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="phosphorus" value="ppm" onClick="conversion(this, phosphorus, p, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="k" class="form-text text-muted">Postassium</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="k" id="k" placeholder="K - Postassium"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="postassium" value="ppm" onClick="conversion(this, postassium, k, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="s" class="form-text text-muted">Sulphur</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="s" id="s" placeholder="S - Sulphur"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="sulphur" value="ppm" onClick="conversion(this, sulphur, s, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="mg" class="form-text text-muted">Magnesium</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="mg" id="mg" placeholder="Mg - Magnesium"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="magnesium" value="ppm" onClick="conversion(this, magnesium, mg, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="ca" class="form-text text-muted">Calcium</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="ca" id="ca" placeholder="Ca - Calcium"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="calcium" value="ppm" onClick="conversion(this, calcium, ca, 10000)" ></input>
- </div>
- </div>
- </div>
- </div>
-
- <div class="form-row">
- <div class="form-group col-md-2">
- <small id="na" class="form-text text-muted">Soduim</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="na" id="na" placeholder="Na - Soduim"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="soduim" value="ppm" onClick="conversion(this, soduim, na, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="fe" class="form-text text-muted">Iron</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="fe" id="fe" placeholder="Fe - Iron"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="iron" value="ppm" onClick="conversion(this, iron, fe, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="mn" class="form-text text-muted">Manganese</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="mn" id="mn" placeholder="Mn - Manganese"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="manganese" value="ppm" onClick="conversion(this, manganese, mn, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="zn" class="form-text text-muted">Zinc</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="zn" id="zn" placeholder="Zn - Zinc"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="zinc" value="ppm" onClick="conversion(this, zinc, zn, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="cu" class="form-text text-muted">Copper</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="cu" id="cu" placeholder="Cu - Copper"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="copper" value="ppm" onClick="conversion(this, copper, cu, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="b" class="form-text text-muted">Boron</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="b" id="b" placeholder="B - Boron"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="boron" value="ppm" onClick="conversion(this, boron, b, 10000)" ></input>
- </div>
- </div>
- </div>
- </div>
- <div class="form-row">
- <div class="form-group col-md-2">
- <small id="m" class="form-text text-muted">Molybdenum</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="m" id="m" placeholder="M - Molybdenum"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="molybdenum" value="ppm" onClick="conversion(this, molybdenum, m, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="co" class="form-text text-muted">Cobalt</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="co" id="co" placeholder="Co - Cobalt"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="cobalt" value="ppm" onClick="conversion(this, cobalt, co, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="se" class="form-text text-muted">Selenium</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="se" id="se" placeholder="Se - Selenium"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="selenium" value="ppm" onClick="conversion(this, selenium, se, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="ch" class="form-text text-muted">Chloride</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="ch" id="ch" placeholder="Ch - Chloride"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="chloride" value="ppm" onClick="conversion(this, chloride, cg, 10000)" ></input>
- </div>
- </div>
- </div>
-
- </div>
- <script type="text/javascript">
- function conversion(value, input, element, conversion) {
- var Nvalue = document.getElementById(element.id).value;
- var el = document.getElementById(input.id);
- if ( el.value === "%" ) {
- el.value = "ppm";
- document.getElementById(element.id).value = Nvalue*conversion;
- } else {
- el.value = "%";
- document.getElementById(element.id).value = Nvalue/conversion;
- }
- }
- </script>
-
- <button form="PlantcsvForm" type="submit" name="PlantcsvForm" class="btn btn-success">Submit</button>
- </form>
- </div>
- [[!plantformSubmit]]
-
-
- <script type="text/javascript">
- // JavaScript for disabling form submission if there are invalid fields
- (function() {
- \'use strict\';
- window.addEventListener(\'load\', function() {
- // Fetch all the forms we want to apply custom Bootstrap validation styles to
- var forms = document.getElementsByClassName(\'needs-validation\');
- // Loop over them and prevent submission
- var validation = Array.prototype.filter.call(forms, function(form) {
- form.addEventListener(\'submit\', function(event) {
- if (form.checkValidity() === false) {
- event.preventDefault();
- event.stopPropagation();
- }
- form.classList.add(\'was-validated\');
- }, false);
- });
- }, false);
- })();
- </script>
-
-
- </div>
-
- </div>
- </div>
- </div>',
- '[[SimpleCopyright? &startYear=`2005`]]' => '<span>© 2005-2019 by Crop Monitor</span>',
- '[[$dash-footer]]' => '<!-- jQuery first, then Popper.js, then Bootstrap JS -->
- <script type="text/javascript" src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js" integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU=" crossorigin="anonymous"></script>
- <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
- <script type="text/javascript" src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
- <script type="text/javascript">
- addEventListener("load", function() {
- setTimeout(hideURLbar, 0);
- }, false);
- function hideURLbar(){
- window.scrollTo(0,1);
- }
- </script>
- <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.bundle.min.js" integrity="sha384-xrRywqdh3PHs8keKZN+8zzc5TX0GRTLCcmivcbNJWm2rs5C8PRhcEn3czEjhAO9o" crossorigin="anonymous"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.4.1/jquery.easing.js"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/jquery.magnific-popup.js"></script>',
- '[[*blogit.post_main_image:isnot=``:then=`<img class="card-img-top" src="" alt="[[+blogit.post_main_image_alt]]">`]]' => '',
- '[[~70]]' => 'admb.html',
- '[[%blogit.readmore]]' => 'Read more',
- '[[%blogit.published_on]]' => 'Published on',
- '[[~19]]' => 'home-plant-analysis.html',
- '[[~69]]' => 'moisture-monitoring.html',
- '[[$?cache=``&cache_expires=`0`&cache_handler=`xPDOFileCache`&cache_key=`resource`&elementClass=`modSnippet`&limit=`3`&namespace=``&offset=`0`&page=`1`&pageActiveTpl=`<li[[+activeClasses]]><a[[+activeClasses:default=` class="active"`]][[+title]] href="[[+href]]">[[+pageNo]]</a></li>`&pageFirstTpl=`<li class="control"><a[[+classes]][[+title]] href="[[+href]]">First</a></li>`&pageLastTpl=`<li class="control"><a[[+classes]][[+title]] href="[[+href]]">Last</a></li>`&pageLimit=`5`&pageNavOuterTpl=`[[+prev]][[+next]]`&pageNavScheme=``&pageNavTpl=`<li[[+classes]]><a[[+classes]][[+title]] href="[[+href]]">[[+pageNo]]</a></li>`&pageNavVar=`page.nav`&pageNextTpl=`<li class="page-item"><a class="page-link" [[+title]] href="[[+href]]">Newer</a></li>`&pagePrevTpl=`<li class="page-item"><a class="page-link" [[+title]] href="[[+href]]">Older</a></li>`&pageVarKey=`page`&totalVar=`total`&element=`getResources`&parents=`1`&tpl=`Home_blogit.blog_row_tpl`&includeTVs=`1`&processTVs=`1`&tvPrefix=``&where=`[]`&sortby=`RAND()`&total=`8`&pageOneLimit=`3`&actualLimit=`3`&toPlaceholder=``&qs=`ca2455807660326d4a471096588438b9`&pageCount=`3`&href=`/`&pageNo=`1`]]' => '<li[[+activeClasses]]><a class="active"[[+title]] href="/">1</a></li>',
- '[[$?cache=``&cache_expires=`0`&cache_handler=`xPDOFileCache`&cache_key=`resource`&elementClass=`modSnippet`&limit=`3`&namespace=``&offset=`0`&page=`1`&pageActiveTpl=`<li[[+activeClasses]]><a[[+activeClasses:default=` class="active"`]][[+title]] href="[[+href]]">[[+pageNo]]</a></li>`&pageFirstTpl=`<li class="control"><a[[+classes]][[+title]] href="[[+href]]">First</a></li>`&pageLastTpl=`<li class="control"><a[[+classes]][[+title]] href="[[+href]]">Last</a></li>`&pageLimit=`5`&pageNavOuterTpl=`[[+prev]][[+next]]`&pageNavScheme=``&pageNavTpl=`<li[[+classes]]><a[[+classes]][[+title]] href="[[+href]]">[[+pageNo]]</a></li>`&pageNavVar=`page.nav`&pageNextTpl=`<li class="page-item"><a class="page-link" [[+title]] href="[[+href]]">Newer</a></li>`&pagePrevTpl=`<li class="page-item"><a class="page-link" [[+title]] href="[[+href]]">Older</a></li>`&pageVarKey=`page`&totalVar=`total`&element=`getResources`&parents=`1`&tpl=`Home_blogit.blog_row_tpl`&includeTVs=`1`&processTVs=`1`&tvPrefix=``&where=`[]`&sortby=`RAND()`&total=`8`&pageOneLimit=`3`&actualLimit=`3`&toPlaceholder=``&qs=`72dee6c760d2ea65a7eec67c219e4547`&pageCount=`3`&href=`/?page=2`&pageNo=`2`]]' => '<li[[+classes]]><a[[+classes]][[+title]] href="/?page=2">2</a></li>',
- '[[$?cache=``&cache_expires=`0`&cache_handler=`xPDOFileCache`&cache_key=`resource`&elementClass=`modSnippet`&limit=`3`&namespace=``&offset=`0`&page=`1`&pageActiveTpl=`<li[[+activeClasses]]><a[[+activeClasses:default=` class="active"`]][[+title]] href="[[+href]]">[[+pageNo]]</a></li>`&pageFirstTpl=`<li class="control"><a[[+classes]][[+title]] href="[[+href]]">First</a></li>`&pageLastTpl=`<li class="control"><a[[+classes]][[+title]] href="[[+href]]">Last</a></li>`&pageLimit=`5`&pageNavOuterTpl=`[[+prev]][[+next]]`&pageNavScheme=``&pageNavTpl=`<li[[+classes]]><a[[+classes]][[+title]] href="[[+href]]">[[+pageNo]]</a></li>`&pageNavVar=`page.nav`&pageNextTpl=`<li class="page-item"><a class="page-link" [[+title]] href="[[+href]]">Newer</a></li>`&pagePrevTpl=`<li class="page-item"><a class="page-link" [[+title]] href="[[+href]]">Older</a></li>`&pageVarKey=`page`&totalVar=`total`&element=`getResources`&parents=`1`&tpl=`Home_blogit.blog_row_tpl`&includeTVs=`1`&processTVs=`1`&tvPrefix=``&where=`[]`&sortby=`RAND()`&total=`8`&pageOneLimit=`3`&actualLimit=`3`&toPlaceholder=``&qs=`9d2c8a84b5a005c1a0b8df3ecdd72b7c`&pageCount=`3`&href=`/?page=3`&pageNo=`3`]]' => '<li[[+classes]]><a[[+classes]][[+title]] href="/?page=3">3</a></li>',
- '[[$?cache=``&cache_expires=`0`&cache_handler=`xPDOFileCache`&cache_key=`resource`&elementClass=`modSnippet`&limit=`3`&namespace=``&offset=`0`&page=`1`&pageActiveTpl=`<li[[+activeClasses]]><a[[+activeClasses:default=` class="active"`]][[+title]] href="[[+href]]">[[+pageNo]]</a></li>`&pageFirstTpl=`<li class="control"><a[[+classes]][[+title]] href="[[+href]]">First</a></li>`&pageLastTpl=`<li class="control"><a[[+classes]][[+title]] href="[[+href]]">Last</a></li>`&pageLimit=`5`&pageNavOuterTpl=`[[+prev]][[+next]]`&pageNavScheme=``&pageNavTpl=`<li[[+classes]]><a[[+classes]][[+title]] href="[[+href]]">[[+pageNo]]</a></li>`&pageNavVar=`page.nav`&pageNextTpl=`<li class="page-item"><a class="page-link" [[+title]] href="[[+href]]">Newer</a></li>`&pagePrevTpl=`<li class="page-item"><a class="page-link" [[+title]] href="[[+href]]">Older</a></li>`&pageVarKey=`page`&totalVar=`total`&element=`getResources`&parents=`1`&tpl=`Home_blogit.blog_row_tpl`&includeTVs=`1`&processTVs=`1`&tvPrefix=``&where=`[]`&sortby=`RAND()`&total=`8`&pageOneLimit=`3`&actualLimit=`3`&toPlaceholder=``&qs=`c9b1d0eeb1082344a6a631e7b5e227ef`&pageCount=`3`&href=`/?page=2`&pageNo=`2`]]' => '<li class="page-item"><a class="page-link" [[+title]] href="/?page=2">Newer</a></li>',
- '[[$?cache=``&cache_expires=`0`&cache_handler=`xPDOFileCache`&cache_key=`resource`&elementClass=`modSnippet`&limit=`3`&namespace=``&offset=`0`&page=`1`&pageActiveTpl=`<li[[+activeClasses]]><a[[+activeClasses:default=` class="active"`]][[+title]] href="[[+href]]">[[+pageNo]]</a></li>`&pageFirstTpl=`<li class="control"><a[[+classes]][[+title]] href="[[+href]]">First</a></li>`&pageLastTpl=`<li class="control"><a[[+classes]][[+title]] href="[[+href]]">Last</a></li>`&pageLimit=`5`&pageNavOuterTpl=`[[+prev]][[+next]]`&pageNavScheme=``&pageNavTpl=`<li[[+classes]]><a[[+classes]][[+title]] href="[[+href]]">[[+pageNo]]</a></li>`&pageNavVar=`page.nav`&pageNextTpl=`<li class="page-item"><a class="page-link" [[+title]] href="[[+href]]">Newer</a></li>`&pagePrevTpl=`<li class="page-item"><a class="page-link" [[+title]] href="[[+href]]">Older</a></li>`&pageVarKey=`page`&totalVar=`total`&element=`getResources`&parents=`1`&tpl=`Home_blogit.blog_row_tpl`&includeTVs=`1`&processTVs=`1`&tvPrefix=``&where=`[]`&sortby=`RAND()`&total=`8`&pageOneLimit=`3`&actualLimit=`3`&toPlaceholder=``&qs=`622bb44ee27e6a89357809d83adc490e`&pageCount=`3`&href=`/?page=3`&pageNo=`3`]]' => '<li class="control"><a[[+classes]][[+title]] href="/?page=3">Last</a></li>',
- '[[$?cache=``&cache_expires=`0`&cache_handler=`xPDOFileCache`&cache_key=`resource`&elementClass=`modSnippet`&limit=`3`&namespace=``&offset=`0`&page=`1`&pageActiveTpl=`<li[[+activeClasses]]><a[[+activeClasses:default=` class="active"`]][[+title]] href="[[+href]]">[[+pageNo]]</a></li>`&pageFirstTpl=`<li class="control"><a[[+classes]][[+title]] href="[[+href]]">First</a></li>`&pageLastTpl=`<li class="control"><a[[+classes]][[+title]] href="[[+href]]">Last</a></li>`&pageLimit=`5`&pageNavOuterTpl=`[[+prev]][[+next]]`&pageNavScheme=``&pageNavTpl=`<li[[+classes]]><a[[+classes]][[+title]] href="[[+href]]">[[+pageNo]]</a></li>`&pageNavVar=`page.nav`&pageNextTpl=`<li class="page-item"><a class="page-link" [[+title]] href="[[+href]]">Newer</a></li>`&pagePrevTpl=`<li class="page-item"><a class="page-link" [[+title]] href="[[+href]]">Older</a></li>`&pageVarKey=`page`&totalVar=`total`&element=`getResources`&parents=`1`&tpl=`Home_blogit.blog_row_tpl`&includeTVs=`1`&processTVs=`1`&tvPrefix=``&where=`[]`&sortby=`RAND()`&total=`8`&pageOneLimit=`3`&actualLimit=`3`&toPlaceholder=``&qs=`e382d710b9dba083babe1672bc745a87`&pageCount=`3`&pages=`<li[[+activeClasses]]><a class="active"[[+title]] href="/">1</a></li>
- <li[[+classes]]><a[[+classes]][[+title]] href="/?page=2">2</a></li>
- <li[[+classes]]><a[[+classes]][[+title]] href="/?page=3">3</a></li>`&next=`<li class="page-item"><a class="page-link" [[+title]] href="/?page=2">Newer</a></li>`&last=`<li class="control"><a[[+classes]][[+title]] href="/?page=3">Last</a></li>`]]' => '[[+prev]]<li class="page-item"><a class="page-link" [[+title]] href="/?page=2">Newer</a></li>',
- ),
- 'sourceCache' =>
- array (
- 'modChunk' =>
- array (
- 'dash-header' =>
- array (
- 'fields' =>
- array (
- 'id' => 13,
- 'source' => 0,
- 'property_preprocess' => false,
- 'name' => 'dash-header',
- 'description' => '',
- 'editor_type' => 0,
- 'category' => 0,
- 'cache_type' => 0,
- 'snippet' => '<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
- <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">
- <script type="text/javascript" src="https://use.fontawesome.com/1e2844bb90.js"></script>
- <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css" integrity="sha384-gfdkjb5BdAXd+lj+gudLWI+BXq4IuLW5IT+brZEZsLFm++aCMlF1V92rMkPaX4PP" crossorigin="anonymous" />
- <link rel="stylesheet" type="text/css" href="/client-assets/weather-icons/css/weather-icons.min.css?version=1.16" />
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/magnific-popup.css" />',
- 'locked' => false,
- 'properties' =>
- array (
- ),
- 'static' => false,
- 'static_file' => '',
- 'content' => '<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
- <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">
- <script type="text/javascript" src="https://use.fontawesome.com/1e2844bb90.js"></script>
- <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css" integrity="sha384-gfdkjb5BdAXd+lj+gudLWI+BXq4IuLW5IT+brZEZsLFm++aCMlF1V92rMkPaX4PP" crossorigin="anonymous" />
- <link rel="stylesheet" type="text/css" href="/client-assets/weather-icons/css/weather-icons.min.css?version=1.16" />
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/magnific-popup.css" />',
- ),
- 'policies' =>
- array (
- 'web' =>
- array (
- ),
- ),
- 'source' =>
- array (
- ),
- ),
- 'soilAnalysisTrialModal' =>
- array (
- 'fields' =>
- array (
- 'id' => 132,
- 'source' => 0,
- 'property_preprocess' => false,
- 'name' => 'soilAnalysisTrialModal',
- 'description' => '',
- 'editor_type' => 0,
- 'category' => 24,
- 'cache_type' => 0,
- 'snippet' => '<!-- Modal -->
- <div class="modal fade" id="soilAnalysisExample" tabindex="-1" role="dialog" aria-labelledby="soilAnalysisExample" aria-hidden="true">
- <div class="modal-dialog modal-xl modal-dialog-centered" role="document">
- <div class="modal-content">
- <div class="modal-header">
- <h5 class="modal-title" id="soilAnalysisExample">Try out our Soil Test Analysis Report</h5>
- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
- <span aria-hidden="true">×</span>
- </button>
- </div>
- <div class="modal-body">
-
- <div class="grid-form1">
- <span class="error">* required fields.</span>
-
- <form method="post" action="#" id="csvForm" class="needs-validation" novalidate >
-
- [[$analysis_Clientdetails]]
-
- <hr>
-
- [[$soilAnalysisForm_bootstrap]]
-
- <button form="csvForm" type="submit" name="csvForm" class="btn btn-success">Submit</button>
- </form>
-
- [[!soilformSubmit]]
-
- <script type="text/javascript">
- // JavaScript for disabling form submission if there are invalid fields
- (function() {
- \'use strict\';
- window.addEventListener(\'load\', function() {
- // Fetch all the forms we want to apply custom Bootstrap validation styles to
- var forms = document.getElementsByClassName(\'needs-validation\');
- // Loop over them and prevent submission
- var validation = Array.prototype.filter.call(forms, function(form) {
- form.addEventListener(\'submit\', function(event) {
- if (form.checkValidity() === false) {
- event.preventDefault();
- event.stopPropagation();
- }
- form.classList.add(\'was-validated\');
- }, false);
- });
- }, false);
- })();
- </script>
- </div>
-
-
- </div>
-
- </div>
- </div>
- </div>',
- 'locked' => false,
- 'properties' =>
- array (
- ),
- 'static' => false,
- 'static_file' => '',
- 'content' => '<!-- Modal -->
- <div class="modal fade" id="soilAnalysisExample" tabindex="-1" role="dialog" aria-labelledby="soilAnalysisExample" aria-hidden="true">
- <div class="modal-dialog modal-xl modal-dialog-centered" role="document">
- <div class="modal-content">
- <div class="modal-header">
- <h5 class="modal-title" id="soilAnalysisExample">Try out our Soil Test Analysis Report</h5>
- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
- <span aria-hidden="true">×</span>
- </button>
- </div>
- <div class="modal-body">
-
- <div class="grid-form1">
- <span class="error">* required fields.</span>
-
- <form method="post" action="#" id="csvForm" class="needs-validation" novalidate >
-
- [[$analysis_Clientdetails]]
-
- <hr>
-
- [[$soilAnalysisForm_bootstrap]]
-
- <button form="csvForm" type="submit" name="csvForm" class="btn btn-success">Submit</button>
- </form>
-
- [[!soilformSubmit]]
-
- <script type="text/javascript">
- // JavaScript for disabling form submission if there are invalid fields
- (function() {
- \'use strict\';
- window.addEventListener(\'load\', function() {
- // Fetch all the forms we want to apply custom Bootstrap validation styles to
- var forms = document.getElementsByClassName(\'needs-validation\');
- // Loop over them and prevent submission
- var validation = Array.prototype.filter.call(forms, function(form) {
- form.addEventListener(\'submit\', function(event) {
- if (form.checkValidity() === false) {
- event.preventDefault();
- event.stopPropagation();
- }
- form.classList.add(\'was-validated\');
- }, false);
- });
- }, false);
- })();
- </script>
- </div>
-
-
- </div>
-
- </div>
- </div>
- </div>',
- ),
- 'policies' =>
- array (
- 'web' =>
- array (
- ),
- ),
- 'source' =>
- array (
- ),
- ),
- 'analysis_Clientdetails' =>
- array (
- 'fields' =>
- array (
- 'id' => 44,
- 'source' => 0,
- 'property_preprocess' => false,
- 'name' => 'analysis_Clientdetails',
- 'description' => 'Client Data Input form for Analysis',
- 'editor_type' => 0,
- 'category' => 0,
- 'cache_type' => 0,
- 'snippet' => '<div class="form-row">
- <div class="form-group col-12 col-md-4 mb-1">
- <label for="client_name" class="p-0 mb-0 col-form-label-sm">Client Name<span class="error">*</span></label>
- <input type="text" class="form-control form-control-sm" name="name" id="name" placeholder="Client Name" required autocomplete="on">
- </div>
- <div class="form-group col-12 col-md-4 mb-1">
- <label for="email" class="p-0 mb-0 col-form-label-sm">Email address<span class="error">*</span></label>
- <input type="email" class="form-control form-control-sm" name="email" id="email" placeholder="Email address" required autocomplete="on">
- </div>
- <div class="form-group col-12 col-md-4 mb-1">
- <label for="company_name" class="p-0 mb-0 col-form-label-sm">Company Name</label>
- <input type="text" class="form-control form-control-sm" name="company" id="company" placeholder="Company Name" autocomplete="on">
- </div>
- </div>
- <div class="form-row">
- <div class="form-group col-12 col-md-6 mb-1">
- <label for="site_address" class="p-0 mb-0 col-form-label-sm">Site Address</label>
- <input type="text" class="form-control form-control-sm" name="site_address" id="site_address" placeholder="Site Address" autocomplete="on">
- </div>
- <div class="form-group col-12 col-md-6 mb-1">
- <label for="state_postcode" class="p-0 mb-0 col-form-label-sm">Postal Address</label>
- <input type="text" class="form-control form-control-sm" name="postal_address" id="postal_address" placeholder="Postal Address" autocomplete="on">
- </div>
- </div>',
- 'locked' => false,
- 'properties' =>
- array (
- ),
- 'static' => false,
- 'static_file' => '',
- 'content' => '<div class="form-row">
- <div class="form-group col-12 col-md-4 mb-1">
- <label for="client_name" class="p-0 mb-0 col-form-label-sm">Client Name<span class="error">*</span></label>
- <input type="text" class="form-control form-control-sm" name="name" id="name" placeholder="Client Name" required autocomplete="on">
- </div>
- <div class="form-group col-12 col-md-4 mb-1">
- <label for="email" class="p-0 mb-0 col-form-label-sm">Email address<span class="error">*</span></label>
- <input type="email" class="form-control form-control-sm" name="email" id="email" placeholder="Email address" required autocomplete="on">
- </div>
- <div class="form-group col-12 col-md-4 mb-1">
- <label for="company_name" class="p-0 mb-0 col-form-label-sm">Company Name</label>
- <input type="text" class="form-control form-control-sm" name="company" id="company" placeholder="Company Name" autocomplete="on">
- </div>
- </div>
- <div class="form-row">
- <div class="form-group col-12 col-md-6 mb-1">
- <label for="site_address" class="p-0 mb-0 col-form-label-sm">Site Address</label>
- <input type="text" class="form-control form-control-sm" name="site_address" id="site_address" placeholder="Site Address" autocomplete="on">
- </div>
- <div class="form-group col-12 col-md-6 mb-1">
- <label for="state_postcode" class="p-0 mb-0 col-form-label-sm">Postal Address</label>
- <input type="text" class="form-control form-control-sm" name="postal_address" id="postal_address" placeholder="Postal Address" autocomplete="on">
- </div>
- </div>',
- ),
- 'policies' =>
- array (
- 'web' =>
- array (
- ),
- ),
- 'source' =>
- array (
- ),
- ),
- 'plantAnalysisTrialModal' =>
- array (
- 'fields' =>
- array (
- 'id' => 133,
- 'source' => 0,
- 'property_preprocess' => false,
- 'name' => 'plantAnalysisTrialModal',
- 'description' => '',
- 'editor_type' => 0,
- 'category' => 25,
- 'cache_type' => 0,
- 'snippet' => '<!-- Modal -->
- <div class="modal fade" id="plantAnalysisExample" tabindex="-1" role="dialog" aria-labelledby="plantAnalysisExample" aria-hidden="true">
- <div class="modal-dialog modal-xl modal-dialog-centered" role="document">
- <div class="modal-content">
- <div class="modal-header">
- <h5 class="modal-title" id="plantAnalysisExample">Try out our Plant Analysis Report</h5>
- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
- <span aria-hidden="true">×</span>
- </button>
- </div>
- <div class="modal-body">
-
- <div class="grid-form1">
- <span class="error">* required fields.</span>
- <form method="post" action="#" id="PlantcsvForm" class="needs-validation" novalidate >
-
- [[$analysis_Clientdetails]]
-
- <hr>
-
- [[$plantAnalysisForm]]
-
- <button form="PlantcsvForm" type="submit" name="PlantcsvForm" class="btn btn-success">Submit</button>
- </form>
- </div>
- [[!plantformSubmit]]
-
-
- <script type="text/javascript">
- // JavaScript for disabling form submission if there are invalid fields
- (function() {
- \'use strict\';
- window.addEventListener(\'load\', function() {
- // Fetch all the forms we want to apply custom Bootstrap validation styles to
- var forms = document.getElementsByClassName(\'needs-validation\');
- // Loop over them and prevent submission
- var validation = Array.prototype.filter.call(forms, function(form) {
- form.addEventListener(\'submit\', function(event) {
- if (form.checkValidity() === false) {
- event.preventDefault();
- event.stopPropagation();
- }
- form.classList.add(\'was-validated\');
- }, false);
- });
- }, false);
- })();
- </script>
-
-
- </div>
-
- </div>
- </div>
- </div>',
- 'locked' => false,
- 'properties' =>
- array (
- ),
- 'static' => false,
- 'static_file' => '',
- 'content' => '<!-- Modal -->
- <div class="modal fade" id="plantAnalysisExample" tabindex="-1" role="dialog" aria-labelledby="plantAnalysisExample" aria-hidden="true">
- <div class="modal-dialog modal-xl modal-dialog-centered" role="document">
- <div class="modal-content">
- <div class="modal-header">
- <h5 class="modal-title" id="plantAnalysisExample">Try out our Plant Analysis Report</h5>
- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
- <span aria-hidden="true">×</span>
- </button>
- </div>
- <div class="modal-body">
-
- <div class="grid-form1">
- <span class="error">* required fields.</span>
- <form method="post" action="#" id="PlantcsvForm" class="needs-validation" novalidate >
-
- [[$analysis_Clientdetails]]
-
- <hr>
-
- [[$plantAnalysisForm]]
-
- <button form="PlantcsvForm" type="submit" name="PlantcsvForm" class="btn btn-success">Submit</button>
- </form>
- </div>
- [[!plantformSubmit]]
-
-
- <script type="text/javascript">
- // JavaScript for disabling form submission if there are invalid fields
- (function() {
- \'use strict\';
- window.addEventListener(\'load\', function() {
- // Fetch all the forms we want to apply custom Bootstrap validation styles to
- var forms = document.getElementsByClassName(\'needs-validation\');
- // Loop over them and prevent submission
- var validation = Array.prototype.filter.call(forms, function(form) {
- form.addEventListener(\'submit\', function(event) {
- if (form.checkValidity() === false) {
- event.preventDefault();
- event.stopPropagation();
- }
- form.classList.add(\'was-validated\');
- }, false);
- });
- }, false);
- })();
- </script>
-
-
- </div>
-
- </div>
- </div>
- </div>',
- ),
- 'policies' =>
- array (
- 'web' =>
- array (
- ),
- ),
- 'source' =>
- array (
- ),
- ),
- 'plantAnalysisForm' =>
- array (
- 'fields' =>
- array (
- 'id' => 45,
- 'source' => 0,
- 'property_preprocess' => false,
- 'name' => 'plantAnalysisForm',
- 'description' => 'Input form for Plant Analysis',
- 'editor_type' => 0,
- 'category' => 25,
- 'cache_type' => 0,
- 'snippet' => '<div class="form-row">
- <div class="col-md-3 form-group">
- <small id="analysis_type" class="form-text text-muted">Analysis Type<span class="error">*</span></small>
- <div><select name="analysis_type" id="analysis_type" class="form-control form-control-sm" required>
- <option>Select the type of Analysis...</option>
- <option id="ash">Dry Ash Test</option>
- <option id="sap">Sap Analysis</option>
- <option id="field">Field Test</option>
- </select></div>
- </div>
- <div class="col-md-3 form-group">
- <small id="lab_no" class="form-text text-muted">Lab No</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="lab_no" id="lab_no" placeholder="Lab No"></input>
-
- </div>
- </div>
-
- <div class="col-md-3 form-group">
- <small id="batch_no" class="form-text text-muted">Batch No</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="batch_no" id="batch_no" placeholder="Batch No"></input>
-
- </div>
- </div>
- <div class="col-md-3 form-group">
- <small id="date_sampled" class="form-text text-muted">Date Sampled</small>
- <input data-provide="datepicker" class="form-control form-control-sm" name="date_sampled" id="datepicker" placeholder="Date Sampled" data-date-format="dd/mm/yyyy" data-date-end-date="0d" ></input>
- <script>
- $(\'#datepicker\').datepicker({
- uiLibrary: \'bootstrap4\',
- calendarWeeks: \'true\',
- todayHighlight: \'true\'
- });
- </script>
- </div>
-
- <!-- Hidden Fields for Database -->
- <input type="hidden" class="form-control form-control-sm" name="m_user" id="m_user" placeholder="[[+modx.user.id]]" required>
- <input type="hidden" class="form-control form-control-sm" name="client_id" id="client_id" placeholder="[[+modx.user.username]]" required>
- </div>
- <div class="form-row">
- <div class="col-md-4 form-group">
- <small id="lab_no" class="form-text text-muted">Sample ID<span class="error">*</span></small>
- <input type="text" class="form-control form-control-sm" name="sample_id" id="sample_id" placeholder="Sample Id" required></input>
- </div>
-
- <div class="col-md-4 form-group">
- <small id="lab_no" class="form-text text-muted">Site ID</small>
- <input type="text" class="form-control form-control-sm" name="site_id" id="site_id" placeholder="Paddock Id"></input>
- </div>
- [[!croptypeFORM]]
- </div>
- <hr>
- <label class="col"><b>Analysis Inputs</b></label>
-
- <div class="form-row">
- <div class="form-group col-md-2">
- <small id="nSmall" class="form-text text-muted">Nitrogen</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="n" id="n" placeholder="N - Nitrogen"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="nitrogen" value="ppm" onClick="conversion(this, nitrogen, n, 10000)" ></input>
- </div>
- </div>
- </div>
- <div class="form-group col-md-2">
- <small id="p" class="form-text text-muted">Phosphorus</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="p" id="p" placeholder="P - Phosphorus"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="phosphorus" value="ppm" onClick="conversion(this, phosphorus, p, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="k" class="form-text text-muted">Postassium</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="k" id="k" placeholder="K - Postassium"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="postassium" value="ppm" onClick="conversion(this, postassium, k, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="s" class="form-text text-muted">Sulphur</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="s" id="s" placeholder="S - Sulphur"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="sulphur" value="ppm" onClick="conversion(this, sulphur, s, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="mg" class="form-text text-muted">Magnesium</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="mg" id="mg" placeholder="Mg - Magnesium"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="magnesium" value="ppm" onClick="conversion(this, magnesium, mg, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="ca" class="form-text text-muted">Calcium</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="ca" id="ca" placeholder="Ca - Calcium"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="calcium" value="ppm" onClick="conversion(this, calcium, ca, 10000)" ></input>
- </div>
- </div>
- </div>
- </div>
-
- <div class="form-row">
- <div class="form-group col-md-2">
- <small id="na" class="form-text text-muted">Soduim</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="na" id="na" placeholder="Na - Soduim"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="soduim" value="ppm" onClick="conversion(this, soduim, na, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="fe" class="form-text text-muted">Iron</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="fe" id="fe" placeholder="Fe - Iron"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="iron" value="ppm" onClick="conversion(this, iron, fe, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="mn" class="form-text text-muted">Manganese</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="mn" id="mn" placeholder="Mn - Manganese"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="manganese" value="ppm" onClick="conversion(this, manganese, mn, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="zn" class="form-text text-muted">Zinc</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="zn" id="zn" placeholder="Zn - Zinc"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="zinc" value="ppm" onClick="conversion(this, zinc, zn, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="cu" class="form-text text-muted">Copper</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="cu" id="cu" placeholder="Cu - Copper"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="copper" value="ppm" onClick="conversion(this, copper, cu, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="b" class="form-text text-muted">Boron</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="b" id="b" placeholder="B - Boron"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="boron" value="ppm" onClick="conversion(this, boron, b, 10000)" ></input>
- </div>
- </div>
- </div>
- </div>
- <div class="form-row">
- <div class="form-group col-md-2">
- <small id="m" class="form-text text-muted">Molybdenum</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="m" id="m" placeholder="M - Molybdenum"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="molybdenum" value="ppm" onClick="conversion(this, molybdenum, m, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="co" class="form-text text-muted">Cobalt</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="co" id="co" placeholder="Co - Cobalt"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="cobalt" value="ppm" onClick="conversion(this, cobalt, co, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="se" class="form-text text-muted">Selenium</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="se" id="se" placeholder="Se - Selenium"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="selenium" value="ppm" onClick="conversion(this, selenium, se, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="ch" class="form-text text-muted">Chloride</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="ch" id="ch" placeholder="Ch - Chloride"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="chloride" value="ppm" onClick="conversion(this, chloride, cg, 10000)" ></input>
- </div>
- </div>
- </div>
-
- </div>
- <script type="text/javascript">
- function conversion(value, input, element, conversion) {
- var Nvalue = document.getElementById(element.id).value;
- var el = document.getElementById(input.id);
- if ( el.value === "%" ) {
- el.value = "ppm";
- document.getElementById(element.id).value = Nvalue*conversion;
- } else {
- el.value = "%";
- document.getElementById(element.id).value = Nvalue/conversion;
- }
- }
- </script>',
- 'locked' => false,
- 'properties' =>
- array (
- ),
- 'static' => false,
- 'static_file' => '',
- 'content' => '<div class="form-row">
- <div class="col-md-3 form-group">
- <small id="analysis_type" class="form-text text-muted">Analysis Type<span class="error">*</span></small>
- <div><select name="analysis_type" id="analysis_type" class="form-control form-control-sm" required>
- <option>Select the type of Analysis...</option>
- <option id="ash">Dry Ash Test</option>
- <option id="sap">Sap Analysis</option>
- <option id="field">Field Test</option>
- </select></div>
- </div>
- <div class="col-md-3 form-group">
- <small id="lab_no" class="form-text text-muted">Lab No</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="lab_no" id="lab_no" placeholder="Lab No"></input>
-
- </div>
- </div>
-
- <div class="col-md-3 form-group">
- <small id="batch_no" class="form-text text-muted">Batch No</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="batch_no" id="batch_no" placeholder="Batch No"></input>
-
- </div>
- </div>
- <div class="col-md-3 form-group">
- <small id="date_sampled" class="form-text text-muted">Date Sampled</small>
- <input data-provide="datepicker" class="form-control form-control-sm" name="date_sampled" id="datepicker" placeholder="Date Sampled" data-date-format="dd/mm/yyyy" data-date-end-date="0d" ></input>
- <script>
- $(\'#datepicker\').datepicker({
- uiLibrary: \'bootstrap4\',
- calendarWeeks: \'true\',
- todayHighlight: \'true\'
- });
- </script>
- </div>
-
- <!-- Hidden Fields for Database -->
- <input type="hidden" class="form-control form-control-sm" name="m_user" id="m_user" placeholder="[[+modx.user.id]]" required>
- <input type="hidden" class="form-control form-control-sm" name="client_id" id="client_id" placeholder="[[+modx.user.username]]" required>
- </div>
- <div class="form-row">
- <div class="col-md-4 form-group">
- <small id="lab_no" class="form-text text-muted">Sample ID<span class="error">*</span></small>
- <input type="text" class="form-control form-control-sm" name="sample_id" id="sample_id" placeholder="Sample Id" required></input>
- </div>
-
- <div class="col-md-4 form-group">
- <small id="lab_no" class="form-text text-muted">Site ID</small>
- <input type="text" class="form-control form-control-sm" name="site_id" id="site_id" placeholder="Paddock Id"></input>
- </div>
- [[!croptypeFORM]]
- </div>
- <hr>
- <label class="col"><b>Analysis Inputs</b></label>
-
- <div class="form-row">
- <div class="form-group col-md-2">
- <small id="nSmall" class="form-text text-muted">Nitrogen</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="n" id="n" placeholder="N - Nitrogen"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="nitrogen" value="ppm" onClick="conversion(this, nitrogen, n, 10000)" ></input>
- </div>
- </div>
- </div>
- <div class="form-group col-md-2">
- <small id="p" class="form-text text-muted">Phosphorus</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="p" id="p" placeholder="P - Phosphorus"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="phosphorus" value="ppm" onClick="conversion(this, phosphorus, p, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="k" class="form-text text-muted">Postassium</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="k" id="k" placeholder="K - Postassium"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="postassium" value="ppm" onClick="conversion(this, postassium, k, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="s" class="form-text text-muted">Sulphur</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="s" id="s" placeholder="S - Sulphur"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="sulphur" value="ppm" onClick="conversion(this, sulphur, s, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="mg" class="form-text text-muted">Magnesium</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="mg" id="mg" placeholder="Mg - Magnesium"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="magnesium" value="ppm" onClick="conversion(this, magnesium, mg, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="ca" class="form-text text-muted">Calcium</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="ca" id="ca" placeholder="Ca - Calcium"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="calcium" value="ppm" onClick="conversion(this, calcium, ca, 10000)" ></input>
- </div>
- </div>
- </div>
- </div>
-
- <div class="form-row">
- <div class="form-group col-md-2">
- <small id="na" class="form-text text-muted">Soduim</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="na" id="na" placeholder="Na - Soduim"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="soduim" value="ppm" onClick="conversion(this, soduim, na, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="fe" class="form-text text-muted">Iron</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="fe" id="fe" placeholder="Fe - Iron"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="iron" value="ppm" onClick="conversion(this, iron, fe, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="mn" class="form-text text-muted">Manganese</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="mn" id="mn" placeholder="Mn - Manganese"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="manganese" value="ppm" onClick="conversion(this, manganese, mn, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="zn" class="form-text text-muted">Zinc</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="zn" id="zn" placeholder="Zn - Zinc"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="zinc" value="ppm" onClick="conversion(this, zinc, zn, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="cu" class="form-text text-muted">Copper</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="cu" id="cu" placeholder="Cu - Copper"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="copper" value="ppm" onClick="conversion(this, copper, cu, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="b" class="form-text text-muted">Boron</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="b" id="b" placeholder="B - Boron"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="boron" value="ppm" onClick="conversion(this, boron, b, 10000)" ></input>
- </div>
- </div>
- </div>
- </div>
- <div class="form-row">
- <div class="form-group col-md-2">
- <small id="m" class="form-text text-muted">Molybdenum</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="m" id="m" placeholder="M - Molybdenum"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="molybdenum" value="ppm" onClick="conversion(this, molybdenum, m, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="co" class="form-text text-muted">Cobalt</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="co" id="co" placeholder="Co - Cobalt"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="cobalt" value="ppm" onClick="conversion(this, cobalt, co, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="se" class="form-text text-muted">Selenium</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="se" id="se" placeholder="Se - Selenium"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="selenium" value="ppm" onClick="conversion(this, selenium, se, 10000)" ></input>
- </div>
- </div>
- </div>
-
- <div class="form-group col-md-2">
- <small id="ch" class="form-text text-muted">Chloride</small>
- <div class="input-group input-group-sm mb-3">
- <input type="text" class="form-control form-control-sm" name="ch" id="ch" placeholder="Ch - Chloride"></input>
- <div class="input-group-append">
- <input class="btn btn-append" type="button" id="chloride" value="ppm" onClick="conversion(this, chloride, cg, 10000)" ></input>
- </div>
- </div>
- </div>
-
- </div>
- <script type="text/javascript">
- function conversion(value, input, element, conversion) {
- var Nvalue = document.getElementById(element.id).value;
- var el = document.getElementById(input.id);
- if ( el.value === "%" ) {
- el.value = "ppm";
- document.getElementById(element.id).value = Nvalue*conversion;
- } else {
- el.value = "%";
- document.getElementById(element.id).value = Nvalue/conversion;
- }
- }
- </script>',
- ),
- 'policies' =>
- array (
- 'web' =>
- array (
- ),
- ),
- 'source' =>
- array (
- ),
- ),
- 'sc_chunk' =>
- array (
- 'fields' =>
- array (
- 'id' => 24,
- 'source' => 1,
- 'property_preprocess' => false,
- 'name' => 'sc_chunk',
- 'description' => 'This chunk styles the year output',
- 'editor_type' => 0,
- 'category' => 4,
- 'cache_type' => 0,
- 'snippet' => '<span>© [[+output]] by [[++site_name]]</span>',
- 'locked' => false,
- 'properties' =>
- array (
- ),
- 'static' => false,
- 'static_file' => '',
- 'content' => '<span>© [[+output]] by [[++site_name]]</span>',
- ),
- 'policies' =>
- array (
- 'web' =>
- array (
- ),
- ),
- 'source' =>
- array (
- 'id' => 1,
- 'name' => 'Filesystem',
- 'description' => '',
- 'class_key' => 'sources.modFileMediaSource',
- 'properties' =>
- array (
- 'fred' =>
- array (
- 'name' => 'fred',
- 'desc' => '',
- 'type' => 'combo-boolean',
- 'options' =>
- array (
- ),
- 'value' => false,
- 'lexicon' => NULL,
- ),
- 'fredReadOnly' =>
- array (
- 'name' => 'fredReadOnly',
- 'desc' => '',
- 'type' => 'combo-boolean',
- 'options' =>
- array (
- ),
- 'value' => false,
- 'lexicon' => NULL,
- ),
- ),
- 'is_stream' => true,
- ),
- ),
- 'dash-footer' =>
- array (
- 'fields' =>
- array (
- 'id' => 15,
- 'source' => 0,
- 'property_preprocess' => false,
- 'name' => 'dash-footer',
- 'description' => '',
- 'editor_type' => 0,
- 'category' => 0,
- 'cache_type' => 0,
- 'snippet' => '<!-- jQuery first, then Popper.js, then Bootstrap JS -->
- <script type="text/javascript" src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js" integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU=" crossorigin="anonymous"></script>
- <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
- <script type="text/javascript" src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
- <script type="text/javascript">
- addEventListener("load", function() {
- setTimeout(hideURLbar, 0);
- }, false);
- function hideURLbar(){
- window.scrollTo(0,1);
- }
- </script>
- <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.bundle.min.js" integrity="sha384-xrRywqdh3PHs8keKZN+8zzc5TX0GRTLCcmivcbNJWm2rs5C8PRhcEn3czEjhAO9o" crossorigin="anonymous"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.4.1/jquery.easing.js"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/jquery.magnific-popup.js"></script>',
- 'locked' => false,
- 'properties' =>
- array (
- ),
- 'static' => false,
- 'static_file' => '',
- 'content' => '<!-- jQuery first, then Popper.js, then Bootstrap JS -->
- <script type="text/javascript" src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js" integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU=" crossorigin="anonymous"></script>
- <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
- <script type="text/javascript" src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
- <script type="text/javascript">
- addEventListener("load", function() {
- setTimeout(hideURLbar, 0);
- }, false);
- function hideURLbar(){
- window.scrollTo(0,1);
- }
- </script>
- <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.bundle.min.js" integrity="sha384-xrRywqdh3PHs8keKZN+8zzc5TX0GRTLCcmivcbNJWm2rs5C8PRhcEn3czEjhAO9o" crossorigin="anonymous"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.4.1/jquery.easing.js"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/jquery.magnific-popup.js"></script>',
- ),
- 'policies' =>
- array (
- 'web' =>
- array (
- ),
- ),
- 'source' =>
- array (
- ),
- ),
- ),
- 'modSnippet' =>
- array (
- 'blogit.lexicon_load' =>
- array (
- 'fields' =>
- array (
- 'id' => 103,
- 'source' => 0,
- 'property_preprocess' => false,
- 'name' => 'blogit.lexicon_load',
- 'description' => 'Blogit - Created by MPThemes http://mpthemes.com',
- 'editor_type' => 0,
- 'category' => 36,
- 'cache_type' => 0,
- 'snippet' => '$modx->lexicon->load(\'blogit:default\');
- return \'\';',
- 'locked' => false,
- 'properties' =>
- array (
- ),
- 'moduleguid' => '',
- 'static' => false,
- 'static_file' => '',
- 'content' => '$modx->lexicon->load(\'blogit:default\');
- return \'\';',
- ),
- 'policies' =>
- array (
- 'web' =>
- array (
- ),
- ),
- 'source' =>
- array (
- ),
- ),
- 'SimpleCopyright' =>
- array (
- 'fields' =>
- array (
- 'id' => 12,
- 'source' => 1,
- 'property_preprocess' => false,
- 'name' => 'SimpleCopyright',
- 'description' => 'This Snippet returns the current year and can be called with a placeholder for the start year of the website.',
- 'editor_type' => 0,
- 'category' => 4,
- 'cache_type' => 0,
- 'snippet' => '/*
- * DESCRIPTION:
- * This snippet returns the current year
- * It is then styled with a chunk to output a copyright notice which you can adapt to fit your needs.
- * You can call this snippet with a startyear for your website.
- * If you use a start year it automatically changes when the year passes.
- * i.e. 2012 turns into 2012-2013
- *
- * PARAMETERS:
- * @ &startYear (string) optional. Default: Current Year
- * @ &separator (string) optional. Default: \'-\'
- * @ &static (bool) optional. Default: 0
- * @ &tpl (string) optional. Default: \'sc_chunk\'
- *
- * PLACEHOLDERS:
- * @ [[+output]]
- *
- * The usage defines \'2012\' as the \'current\' year purely for illustration purpose only.
- * This is obviously wrong in 2013 or up...
- *
- * USAGE:
- * // Outputs: "© 2012 by [[+site_name]]"
- * [[SimpleCopyright]]
- *
- * // Outputs: "© 2007-2012 by [[+site_name]]"
- * // After newyears eve it turns into 2012-2013 automatically
- * [[SimpleCopyright? &startYear=`2007`]]
- *
- * // Outputs: "© 2004 by [[+site_name]]".
- * // Always use \'static\' in conjunction with \'startYear\'.
- * // If you use \'static\' only it will ignore it\'s setting and resolve to the current year.
- * [[SimpleCopyright? &startYear=`2004` &static=`1`]]
- *
- * You can also set the separator just for fun...
- * It defaults to "-"
- *
- * This outputs "© 2007/2012"
- * [[SimpleCopyright? &startYear=`2007` &separator=`/`]]
- *
- */
- // Get the current year
- $currentYear = date(\'Y\');
- // Check for a starting year, separator, static & chunk
- $startYear = (string) $modx->getOption(\'startYear\', $scriptProperties);
- $separator = (string) $modx->getOption(\'separator\', $scriptProperties, \'-\');
- $static = (bool) $modx->getOption(\'static\', $scriptProperties, 0);
- $tpl = (string) $modx->getOption(\'tpl\', $scriptProperties, \'sc_chunk\');
- if($static&&!empty($startYear)){
- // is static : can be the future too
- $construct = $startYear;
- } elseif(!empty($startYear)) {
- // is semi dynamic : set with a starting year that never exceeds the future
- $construct = ($startYear>=$currentYear ? $currentYear : $startYear.$separator.$currentYear);
- } else {
- // is dynamic : changes with each year
- $construct = $currentYear;
- }
- // Get a chunk to style the output & check if it exists...
- $chunk = $modx->getObject(\'modChunk\',array(
- \'name\' => $tpl
- ));
- if (!$chunk){
- // If no chunk is found return error & write to log
- $modx->log(xPDO::LOG_LEVEL_ERROR, \'No chunk found!\');
- return \'No chunk found!\';
- } else {
- $outputString = $modx->getChunk($tpl,array(
- \'output\' => $construct
- ));
- }
-
- return $outputString;',
- 'locked' => false,
- 'properties' =>
- array (
- ),
- 'moduleguid' => '',
- 'static' => false,
- 'static_file' => '',
- 'content' => '/*
- * DESCRIPTION:
- * This snippet returns the current year
- * It is then styled with a chunk to output a copyright notice which you can adapt to fit your needs.
- * You can call this snippet with a startyear for your website.
- * If you use a start year it automatically changes when the year passes.
- * i.e. 2012 turns into 2012-2013
- *
- * PARAMETERS:
- * @ &startYear (string) optional. Default: Current Year
- * @ &separator (string) optional. Default: \'-\'
- * @ &static (bool) optional. Default: 0
- * @ &tpl (string) optional. Default: \'sc_chunk\'
- *
- * PLACEHOLDERS:
- * @ [[+output]]
- *
- * The usage defines \'2012\' as the \'current\' year purely for illustration purpose only.
- * This is obviously wrong in 2013 or up...
- *
- * USAGE:
- * // Outputs: "© 2012 by [[+site_name]]"
- * [[SimpleCopyright]]
- *
- * // Outputs: "© 2007-2012 by [[+site_name]]"
- * // After newyears eve it turns into 2012-2013 automatically
- * [[SimpleCopyright? &startYear=`2007`]]
- *
- * // Outputs: "© 2004 by [[+site_name]]".
- * // Always use \'static\' in conjunction with \'startYear\'.
- * // If you use \'static\' only it will ignore it\'s setting and resolve to the current year.
- * [[SimpleCopyright? &startYear=`2004` &static=`1`]]
- *
- * You can also set the separator just for fun...
- * It defaults to "-"
- *
- * This outputs "© 2007/2012"
- * [[SimpleCopyright? &startYear=`2007` &separator=`/`]]
- *
- */
- // Get the current year
- $currentYear = date(\'Y\');
- // Check for a starting year, separator, static & chunk
- $startYear = (string) $modx->getOption(\'startYear\', $scriptProperties);
- $separator = (string) $modx->getOption(\'separator\', $scriptProperties, \'-\');
- $static = (bool) $modx->getOption(\'static\', $scriptProperties, 0);
- $tpl = (string) $modx->getOption(\'tpl\', $scriptProperties, \'sc_chunk\');
- if($static&&!empty($startYear)){
- // is static : can be the future too
- $construct = $startYear;
- } elseif(!empty($startYear)) {
- // is semi dynamic : set with a starting year that never exceeds the future
- $construct = ($startYear>=$currentYear ? $currentYear : $startYear.$separator.$currentYear);
- } else {
- // is dynamic : changes with each year
- $construct = $currentYear;
- }
- // Get a chunk to style the output & check if it exists...
- $chunk = $modx->getObject(\'modChunk\',array(
- \'name\' => $tpl
- ));
- if (!$chunk){
- // If no chunk is found return error & write to log
- $modx->log(xPDO::LOG_LEVEL_ERROR, \'No chunk found!\');
- return \'No chunk found!\';
- } else {
- $outputString = $modx->getChunk($tpl,array(
- \'output\' => $construct
- ));
- }
-
- return $outputString;',
- ),
- 'policies' =>
- array (
- 'web' =>
- array (
- ),
- ),
- 'source' =>
- array (
- 'id' => 1,
- 'name' => 'Filesystem',
- 'description' => '',
- 'class_key' => 'sources.modFileMediaSource',
- 'properties' =>
- array (
- 'fred' =>
- array (
- 'name' => 'fred',
- 'desc' => '',
- 'type' => 'combo-boolean',
- 'options' =>
- array (
- ),
- 'value' => false,
- 'lexicon' => NULL,
- ),
- 'fredReadOnly' =>
- array (
- 'name' => 'fredReadOnly',
- 'desc' => '',
- 'type' => 'combo-boolean',
- 'options' =>
- array (
- ),
- 'value' => false,
- 'lexicon' => NULL,
- ),
- ),
- 'is_stream' => true,
- ),
- ),
- 'getResources' =>
- array (
- 'fields' =>
- array (
- 'id' => 26,
- 'source' => 0,
- 'property_preprocess' => false,
- 'name' => 'getResources',
- 'description' => '<strong>1.6.1-pl</strong> A general purpose Resource listing and summarization snippet for MODX Revolution',
- 'editor_type' => 0,
- 'category' => 0,
- 'cache_type' => 0,
- 'snippet' => '/**
- * getResources
- *
- * A general purpose Resource listing and summarization snippet for MODX 2.x.
- *
- * @author Jason Coward
- * @copyright Copyright 2010-2013, Jason Coward
- *
- * TEMPLATES
- *
- * tpl - Name of a chunk serving as a resource template
- * [NOTE: if not provided, properties are dumped to output for each resource]
- *
- * tplOdd - (Opt) Name of a chunk serving as resource template for resources with an odd idx value
- * (see idx property)
- * tplFirst - (Opt) Name of a chunk serving as resource template for the first resource (see first
- * property)
- * tplLast - (Opt) Name of a chunk serving as resource template for the last resource (see last
- * property)
- * tpl_{n} - (Opt) Name of a chunk serving as resource template for the nth resource
- *
- * tplCondition - (Opt) Defines a field of the resource to evaluate against keys defined in the
- * conditionalTpls property. Must be a resource field; does not work with Template Variables.
- * conditionalTpls - (Opt) A JSON object defining a map of field values and the associated tpl to
- * use when the field defined by tplCondition matches the value. [NOTE: tplOdd, tplFirst, tplLast,
- * and tpl_{n} will take precedence over any defined conditionalTpls]
- *
- * tplWrapper - (Opt) Name of a chunk serving as a wrapper template for the output
- * [NOTE: Does not work with toSeparatePlaceholders]
- *
- * SELECTION
- *
- * parents - Comma-delimited list of ids serving as parents
- *
- * context - (Opt) Comma-delimited list of context keys to limit results by; if empty, contexts for all specified
- * parents will be used (all contexts if 0 is specified) [default=]
- *
- * depth - (Opt) Integer value indicating depth to search for resources from each parent [default=10]
- *
- * tvFilters - (Opt) Delimited-list of TemplateVar values to filter resources by. Supports two
- * delimiters and two value search formats. The first delimiter || represents a logical OR and the
- * primary grouping mechanism. Within each group you can provide a comma-delimited list of values.
- * These values can be either tied to a specific TemplateVar by name, e.g. myTV==value, or just the
- * value, indicating you are searching for the value in any TemplateVar tied to the Resource. An
- * example would be &tvFilters=`filter2==one,filter1==bar%||filter1==foo`
- * [NOTE: filtering by values uses a LIKE query and % is considered a wildcard.]
- * [NOTE: this only looks at the raw value set for specific Resource, i. e. there must be a value
- * specifically set for the Resource and it is not evaluated.]
- *
- * tvFiltersAndDelimiter - (Opt) Custom delimiter for logical AND, default \',\', in case you want to
- * match a literal comma in the tvFilters. E.g. &tvFiltersAndDelimiter=`&&`
- * &tvFilters=`filter1==foo,bar&&filter2==baz` [default=,]
- *
- * tvFiltersOrDelimiter - (Opt) Custom delimiter for logical OR, default \'||\', in case you want to
- * match a literal \'||\' in the tvFilters. E.g. &tvFiltersOrDelimiter=`|OR|`
- * &tvFilters=`filter1==foo||bar|OR|filter2==baz` [default=||]
- *
- * where - (Opt) A JSON expression of criteria to build any additional where clauses from. An example would be
- * &where=`{{"alias:LIKE":"foo%", "OR:alias:LIKE":"%bar"},{"OR:pagetitle:=":"foobar", "AND:description:=":"raboof"}}`
- *
- * sortby - (Opt) Field to sort by or a JSON array, e.g. {"publishedon":"ASC","createdon":"DESC"} [default=publishedon]
- * sortbyTV - (opt) A Template Variable name to sort by (if supplied, this precedes the sortby value) [default=]
- * sortbyTVType - (Opt) A data type to CAST a TV Value to in order to sort on it properly [default=string]
- * sortbyAlias - (Opt) Query alias for sortby field [default=]
- * sortbyEscaped - (Opt) Escapes the field name(s) specified in sortby [default=0]
- * sortdir - (Opt) Order which to sort by [default=DESC]
- * sortdirTV - (Opt) Order which to sort by a TV [default=DESC]
- * limit - (Opt) Limits the number of resources returned [default=5]
- * offset - (Opt) An offset of resources returned by the criteria to skip [default=0]
- * dbCacheFlag - (Opt) Controls caching of db queries; 0|false = do not cache result set; 1 = cache result set
- * according to cache settings, any other integer value = number of seconds to cache result set [default=0]
- *
- * OPTIONS
- *
- * includeContent - (Opt) Indicates if the content of each resource should be returned in the
- * results [default=0]
- * includeTVs - (Opt) Indicates if TemplateVar values should be included in the properties available
- * to each resource template [default=0]
- * includeTVList - (Opt) Limits the TemplateVars that are included if includeTVs is true to those specified
- * by name in a comma-delimited list [default=]
- * prepareTVs - (Opt) Prepares media-source dependent TemplateVar values [default=1]
- * prepareTVList - (Opt) Limits the TVs that are prepared to those specified by name in a comma-delimited
- * list [default=]
- * processTVs - (Opt) Indicates if TemplateVar values should be rendered as they would on the
- * resource being summarized [default=0]
- * processTVList - (opt) Limits the TemplateVars that are processed if included to those specified
- * by name in a comma-delimited list [default=]
- * tvPrefix - (Opt) The prefix for TemplateVar properties [default=tv.]
- * idx - (Opt) You can define the starting idx of the resources, which is an property that is
- * incremented as each resource is rendered [default=1]
- * first - (Opt) Define the idx which represents the first resource (see tplFirst) [default=1]
- * last - (Opt) Define the idx which represents the last resource (see tplLast) [default=# of
- * resources being summarized + first - 1]
- * outputSeparator - (Opt) An optional string to separate each tpl instance [default="\\n"]
- * wrapIfEmpty - (Opt) Indicates if the tplWrapper should be applied if the output is empty [default=0]
- *
- */
- $output = array();
- $outputSeparator = isset($outputSeparator) ? $outputSeparator : "\\n";
- /* set default properties */
- $tpl = !empty($tpl) ? $tpl : \'\';
- $includeContent = !empty($includeContent) ? true : false;
- $includeTVs = !empty($includeTVs) ? true : false;
- $includeTVList = !empty($includeTVList) ? explode(\',\', $includeTVList) : array();
- $processTVs = !empty($processTVs) ? true : false;
- $processTVList = !empty($processTVList) ? explode(\',\', $processTVList) : array();
- $prepareTVs = !empty($prepareTVs) ? true : false;
- $prepareTVList = !empty($prepareTVList) ? explode(\',\', $prepareTVList) : array();
- $tvPrefix = isset($tvPrefix) ? $tvPrefix : \'tv.\';
- $parents = (!empty($parents) || $parents === \'0\') ? explode(\',\', $parents) : array($modx->resource->get(\'id\'));
- array_walk($parents, \'trim\');
- $parents = array_unique($parents);
- $depth = isset($depth) ? (integer) $depth : 10;
- $tvFiltersOrDelimiter = isset($tvFiltersOrDelimiter) ? $tvFiltersOrDelimiter : \'||\';
- $tvFiltersAndDelimiter = isset($tvFiltersAndDelimiter) ? $tvFiltersAndDelimiter : \',\';
- $tvFilters = !empty($tvFilters) ? explode($tvFiltersOrDelimiter, $tvFilters) : array();
- $where = !empty($where) ? $modx->fromJSON($where) : array();
- $showUnpublished = !empty($showUnpublished) ? true : false;
- $showDeleted = !empty($showDeleted) ? true : false;
- $sortby = isset($sortby) ? $sortby : \'publishedon\';
- $sortbyTV = isset($sortbyTV) ? $sortbyTV : \'\';
- $sortbyAlias = isset($sortbyAlias) ? $sortbyAlias : \'modResource\';
- $sortbyEscaped = !empty($sortbyEscaped) ? true : false;
- $sortdir = isset($sortdir) ? $sortdir : \'DESC\';
- $sortdirTV = isset($sortdirTV) ? $sortdirTV : \'DESC\';
- $limit = isset($limit) ? (integer) $limit : 5;
- $offset = isset($offset) ? (integer) $offset : 0;
- $totalVar = !empty($totalVar) ? $totalVar : \'total\';
- $dbCacheFlag = !isset($dbCacheFlag) ? false : $dbCacheFlag;
- if (is_string($dbCacheFlag) || is_numeric($dbCacheFlag)) {
- if ($dbCacheFlag == \'0\') {
- $dbCacheFlag = false;
- } elseif ($dbCacheFlag == \'1\') {
- $dbCacheFlag = true;
- } else {
- $dbCacheFlag = (integer) $dbCacheFlag;
- }
- }
- /* multiple context support */
- $contextArray = array();
- $contextSpecified = false;
- if (!empty($context)) {
- $contextArray = explode(\',\',$context);
- array_walk($contextArray, \'trim\');
- $contexts = array();
- foreach ($contextArray as $ctx) {
- $contexts[] = $modx->quote($ctx);
- }
- $context = implode(\',\',$contexts);
- $contextSpecified = true;
- unset($contexts,$ctx);
- } else {
- $context = $modx->quote($modx->context->get(\'key\'));
- }
- $pcMap = array();
- $pcQuery = $modx->newQuery(\'modResource\', array(\'id:IN\' => $parents), $dbCacheFlag);
- $pcQuery->select(array(\'id\', \'context_key\'));
- if ($pcQuery->prepare() && $pcQuery->stmt->execute()) {
- foreach ($pcQuery->stmt->fetchAll(PDO::FETCH_ASSOC) as $pcRow) {
- $pcMap[(integer) $pcRow[\'id\']] = $pcRow[\'context_key\'];
- }
- }
- $children = array();
- $parentArray = array();
- foreach ($parents as $parent) {
- $parent = (integer) $parent;
- if ($parent === 0) {
- $pchildren = array();
- if ($contextSpecified) {
- foreach ($contextArray as $pCtx) {
- if (!in_array($pCtx, $contextArray)) {
- continue;
- }
- $options = $pCtx !== $modx->context->get(\'key\') ? array(\'context\' => $pCtx) : array();
- $pcchildren = $modx->getChildIds($parent, $depth, $options);
- if (!empty($pcchildren)) $pchildren = array_merge($pchildren, $pcchildren);
- }
- } else {
- $cQuery = $modx->newQuery(\'modContext\', array(\'key:!=\' => \'mgr\'));
- $cQuery->select(array(\'key\'));
- if ($cQuery->prepare() && $cQuery->stmt->execute()) {
- foreach ($cQuery->stmt->fetchAll(PDO::FETCH_COLUMN) as $pCtx) {
- $options = $pCtx !== $modx->context->get(\'key\') ? array(\'context\' => $pCtx) : array();
- $pcchildren = $modx->getChildIds($parent, $depth, $options);
- if (!empty($pcchildren)) $pchildren = array_merge($pchildren, $pcchildren);
- }
- }
- }
- $parentArray[] = $parent;
- } else {
- $pContext = array_key_exists($parent, $pcMap) ? $pcMap[$parent] : false;
- if ($debug) $modx->log(modX::LOG_LEVEL_ERROR, "context for {$parent} is {$pContext}");
- if ($pContext && $contextSpecified && !in_array($pContext, $contextArray, true)) {
- $parent = next($parents);
- continue;
- }
- $parentArray[] = $parent;
- $options = !empty($pContext) && $pContext !== $modx->context->get(\'key\') ? array(\'context\' => $pContext) : array();
- $pchildren = $modx->getChildIds($parent, $depth, $options);
- }
- if (!empty($pchildren)) $children = array_merge($children, $pchildren);
- $parent = next($parents);
- }
- $parents = array_merge($parentArray, $children);
- /* build query */
- $criteria = array("modResource.parent IN (" . implode(\',\', $parents) . ")");
- if ($contextSpecified) {
- $contextResourceTbl = $modx->getTableName(\'modContextResource\');
- $criteria[] = "(modResource.context_key IN ({$context}) OR EXISTS(SELECT 1 FROM {$contextResourceTbl} ctx WHERE ctx.resource = modResource.id AND ctx.context_key IN ({$context})))";
- }
- if (empty($showDeleted)) {
- $criteria[\'deleted\'] = \'0\';
- }
- if (empty($showUnpublished)) {
- $criteria[\'published\'] = \'1\';
- }
- if (empty($showHidden)) {
- $criteria[\'hidemenu\'] = \'0\';
- }
- if (!empty($hideContainers)) {
- $criteria[\'isfolder\'] = \'0\';
- }
- $criteria = $modx->newQuery(\'modResource\', $criteria);
- if (!empty($tvFilters)) {
- $tmplVarTbl = $modx->getTableName(\'modTemplateVar\');
- $tmplVarResourceTbl = $modx->getTableName(\'modTemplateVarResource\');
- $conditions = array();
- $operators = array(
- \'<=>\' => \'<=>\',
- \'===\' => \'=\',
- \'!==\' => \'!=\',
- \'<>\' => \'<>\',
- \'==\' => \'LIKE\',
- \'!=\' => \'NOT LIKE\',
- \'<<\' => \'<\',
- \'<=\' => \'<=\',
- \'=<\' => \'=<\',
- \'>>\' => \'>\',
- \'>=\' => \'>=\',
- \'=>\' => \'=>\'
- );
- foreach ($tvFilters as $fGroup => $tvFilter) {
- $filterGroup = array();
- $filters = explode($tvFiltersAndDelimiter, $tvFilter);
- $multiple = count($filters) > 0;
- foreach ($filters as $filter) {
- $operator = \'==\';
- $sqlOperator = \'LIKE\';
- foreach ($operators as $op => $opSymbol) {
- if (strpos($filter, $op, 1) !== false) {
- $operator = $op;
- $sqlOperator = $opSymbol;
- break;
- }
- }
- $tvValueField = \'tvr.value\';
- $tvDefaultField = \'tv.default_text\';
- $f = explode($operator, $filter);
- if (count($f) >= 2) {
- if (count($f) > 2) {
- $k = array_shift($f);
- $b = join($operator, $f);
- $f = array($k, $b);
- }
- $tvName = $modx->quote($f[0]);
- if (is_numeric($f[1]) && !in_array($sqlOperator, array(\'LIKE\', \'NOT LIKE\'))) {
- $tvValue = $f[1];
- if ($f[1] == (integer)$f[1]) {
- $tvValueField = "CAST({$tvValueField} AS SIGNED INTEGER)";
- $tvDefaultField = "CAST({$tvDefaultField} AS SIGNED INTEGER)";
- } else {
- $tvValueField = "CAST({$tvValueField} AS DECIMAL)";
- $tvDefaultField = "CAST({$tvDefaultField} AS DECIMAL)";
- }
- } else {
- $tvValue = $modx->quote($f[1]);
- }
- if ($multiple) {
- $filterGroup[] =
- "(EXISTS (SELECT 1 FROM {$tmplVarResourceTbl} tvr JOIN {$tmplVarTbl} tv ON {$tvValueField} {$sqlOperator} {$tvValue} AND tv.name = {$tvName} AND tv.id = tvr.tmplvarid WHERE tvr.contentid = modResource.id) " .
- "OR EXISTS (SELECT 1 FROM {$tmplVarTbl} tv WHERE tv.name = {$tvName} AND {$tvDefaultField} {$sqlOperator} {$tvValue} AND tv.id NOT IN (SELECT tmplvarid FROM {$tmplVarResourceTbl} WHERE contentid = modResource.id)) " .
- ")";
- } else {
- $filterGroup =
- "(EXISTS (SELECT 1 FROM {$tmplVarResourceTbl} tvr JOIN {$tmplVarTbl} tv ON {$tvValueField} {$sqlOperator} {$tvValue} AND tv.name = {$tvName} AND tv.id = tvr.tmplvarid WHERE tvr.contentid = modResource.id) " .
- "OR EXISTS (SELECT 1 FROM {$tmplVarTbl} tv WHERE tv.name = {$tvName} AND {$tvDefaultField} {$sqlOperator} {$tvValue} AND tv.id NOT IN (SELECT tmplvarid FROM {$tmplVarResourceTbl} WHERE contentid = modResource.id)) " .
- ")";
- }
- } elseif (count($f) == 1) {
- $tvValue = $modx->quote($f[0]);
- if ($multiple) {
- $filterGroup[] = "EXISTS (SELECT 1 FROM {$tmplVarResourceTbl} tvr JOIN {$tmplVarTbl} tv ON {$tvValueField} {$sqlOperator} {$tvValue} AND tv.id = tvr.tmplvarid WHERE tvr.contentid = modResource.id)";
- } else {
- $filterGroup = "EXISTS (SELECT 1 FROM {$tmplVarResourceTbl} tvr JOIN {$tmplVarTbl} tv ON {$tvValueField} {$sqlOperator} {$tvValue} AND tv.id = tvr.tmplvarid WHERE tvr.contentid = modResource.id)";
- }
- }
- }
- $conditions[] = $filterGroup;
- }
- if (!empty($conditions)) {
- $firstGroup = true;
- foreach ($conditions as $cGroup => $c) {
- if (is_array($c)) {
- $first = true;
- foreach ($c as $cond) {
- if ($first && !$firstGroup) {
- $criteria->condition($criteria->query[\'where\'][0][1], $cond, xPDOQuery::SQL_OR, null, $cGroup);
- } else {
- $criteria->condition($criteria->query[\'where\'][0][1], $cond, xPDOQuery::SQL_AND, null, $cGroup);
- }
- $first = false;
- }
- } else {
- $criteria->condition($criteria->query[\'where\'][0][1], $c, $firstGroup ? xPDOQuery::SQL_AND : xPDOQuery::SQL_OR, null, $cGroup);
- }
- $firstGroup = false;
- }
- }
- }
- /* include/exclude resources, via &resources=`123,-456` prop */
- if (!empty($resources)) {
- $resourceConditions = array();
- $resources = explode(\',\',$resources);
- $include = array();
- $exclude = array();
- foreach ($resources as $resource) {
- $resource = (int)$resource;
- if ($resource == 0) continue;
- if ($resource < 0) {
- $exclude[] = abs($resource);
- } else {
- $include[] = $resource;
- }
- }
- if (!empty($include)) {
- $criteria->where(array(\'OR:modResource.id:IN\' => $include), xPDOQuery::SQL_OR);
- }
- if (!empty($exclude)) {
- $criteria->where(array(\'modResource.id:NOT IN\' => $exclude), xPDOQuery::SQL_AND, null, 1);
- }
- }
- if (!empty($where)) {
- $criteria->where($where);
- }
- $total = $modx->getCount(\'modResource\', $criteria);
- $modx->setPlaceholder($totalVar, $total);
- $fields = array_keys($modx->getFields(\'modResource\'));
- if (empty($includeContent)) {
- $fields = array_diff($fields, array(\'content\'));
- }
- $columns = $includeContent ? $modx->getSelectColumns(\'modResource\', \'modResource\') : $modx->getSelectColumns(\'modResource\', \'modResource\', \'\', array(\'content\'), true);
- $criteria->select($columns);
- if (!empty($sortbyTV)) {
- $criteria->leftJoin(\'modTemplateVar\', \'tvDefault\', array(
- "tvDefault.name" => $sortbyTV
- ));
- $criteria->leftJoin(\'modTemplateVarResource\', \'tvSort\', array(
- "tvSort.contentid = modResource.id",
- "tvSort.tmplvarid = tvDefault.id"
- ));
- if (empty($sortbyTVType)) $sortbyTVType = \'string\';
- if ($modx->getOption(\'dbtype\') === \'mysql\') {
- switch ($sortbyTVType) {
- case \'integer\':
- $criteria->select("CAST(IFNULL(tvSort.value, tvDefault.default_text) AS SIGNED INTEGER) AS sortTV");
- break;
- case \'decimal\':
- $criteria->select("CAST(IFNULL(tvSort.value, tvDefault.default_text) AS DECIMAL) AS sortTV");
- break;
- case \'datetime\':
- $criteria->select("CAST(IFNULL(tvSort.value, tvDefault.default_text) AS DATETIME) AS sortTV");
- break;
- case \'string\':
- default:
- $criteria->select("IFNULL(tvSort.value, tvDefault.default_text) AS sortTV");
- break;
- }
- } elseif ($modx->getOption(\'dbtype\') === \'sqlsrv\') {
- switch ($sortbyTVType) {
- case \'integer\':
- $criteria->select("CAST(ISNULL(tvSort.value, tvDefault.default_text) AS BIGINT) AS sortTV");
- break;
- case \'decimal\':
- $criteria->select("CAST(ISNULL(tvSort.value, tvDefault.default_text) AS DECIMAL) AS sortTV");
- break;
- case \'datetime\':
- $criteria->select("CAST(ISNULL(tvSort.value, tvDefault.default_text) AS DATETIME) AS sortTV");
- break;
- case \'string\':
- default:
- $criteria->select("ISNULL(tvSort.value, tvDefault.default_text) AS sortTV");
- break;
- }
- }
- $criteria->sortby("sortTV", $sortdirTV);
- }
- if (!empty($sortby)) {
- if (strpos($sortby, \'{\') === 0) {
- $sorts = $modx->fromJSON($sortby);
- } else {
- $sorts = array($sortby => $sortdir);
- }
- if (is_array($sorts)) {
- while (list($sort, $dir) = each($sorts)) {
- if ($sortbyEscaped) $sort = $modx->escape($sort);
- if (!empty($sortbyAlias)) $sort = $modx->escape($sortbyAlias) . ".{$sort}";
- $criteria->sortby($sort, $dir);
- }
- }
- }
- if (!empty($limit)) $criteria->limit($limit, $offset);
- if (!empty($debug)) {
- $criteria->prepare();
- $modx->log(modX::LOG_LEVEL_ERROR, $criteria->toSQL());
- }
- $collection = $modx->getCollection(\'modResource\', $criteria, $dbCacheFlag);
- $idx = !empty($idx) || $idx === \'0\' ? (integer) $idx : 1;
- $first = empty($first) && $first !== \'0\' ? 1 : (integer) $first;
- $last = empty($last) ? (count($collection) + $idx - 1) : (integer) $last;
- /* include parseTpl */
- include_once $modx->getOption(\'getresources.core_path\',null,$modx->getOption(\'core_path\').\'components/getresources/\').\'include.parsetpl.php\';
- $templateVars = array();
- if (!empty($includeTVs) && !empty($includeTVList)) {
- $templateVars = $modx->getCollection(\'modTemplateVar\', array(\'name:IN\' => $includeTVList));
- }
- /** @var modResource $resource */
- foreach ($collection as $resourceId => $resource) {
- $tvs = array();
- if (!empty($includeTVs)) {
- if (empty($includeTVList)) {
- $templateVars = $resource->getMany(\'TemplateVars\');
- }
- /** @var modTemplateVar $templateVar */
- foreach ($templateVars as $tvId => $templateVar) {
- if (!empty($includeTVList) && !in_array($templateVar->get(\'name\'), $includeTVList)) continue;
- if ($processTVs && (empty($processTVList) || in_array($templateVar->get(\'name\'), $processTVList))) {
- $tvs[$tvPrefix . $templateVar->get(\'name\')] = $templateVar->renderOutput($resource->get(\'id\'));
- } else {
- $value = $templateVar->getValue($resource->get(\'id\'));
- if ($prepareTVs && method_exists($templateVar, \'prepareOutput\') && (empty($prepareTVList) || in_array($templateVar->get(\'name\'), $prepareTVList))) {
- $value = $templateVar->prepareOutput($value);
- }
- $tvs[$tvPrefix . $templateVar->get(\'name\')] = $value;
- }
- }
- }
- $odd = ($idx & 1);
- $properties = array_merge(
- $scriptProperties
- ,array(
- \'idx\' => $idx
- ,\'first\' => $first
- ,\'last\' => $last
- ,\'odd\' => $odd
- )
- ,$includeContent ? $resource->toArray() : $resource->get($fields)
- ,$tvs
- );
- $resourceTpl = false;
- if ($idx == $first && !empty($tplFirst)) {
- $resourceTpl = parseTpl($tplFirst, $properties);
- }
- if ($idx == $last && empty($resourceTpl) && !empty($tplLast)) {
- $resourceTpl = parseTpl($tplLast, $properties);
- }
- $tplidx = \'tpl_\' . $idx;
- if (empty($resourceTpl) && !empty($$tplidx)) {
- $resourceTpl = parseTpl($$tplidx, $properties);
- }
- if ($idx > 1 && empty($resourceTpl)) {
- $divisors = getDivisors($idx);
- if (!empty($divisors)) {
- foreach ($divisors as $divisor) {
- $tplnth = \'tpl_n\' . $divisor;
- if (!empty($$tplnth)) {
- $resourceTpl = parseTpl($$tplnth, $properties);
- if (!empty($resourceTpl)) {
- break;
- }
- }
- }
- }
- }
- if ($odd && empty($resourceTpl) && !empty($tplOdd)) {
- $resourceTpl = parseTpl($tplOdd, $properties);
- }
- if (!empty($tplCondition) && !empty($conditionalTpls) && empty($resourceTpl)) {
- $conTpls = $modx->fromJSON($conditionalTpls);
- $subject = $properties[$tplCondition];
- $tplOperator = !empty($tplOperator) ? $tplOperator : \'=\';
- $tplOperator = strtolower($tplOperator);
- $tplCon = \'\';
- foreach ($conTpls as $operand => $conditionalTpl) {
- switch ($tplOperator) {
- case \'!=\':
- case \'neq\':
- case \'not\':
- case \'isnot\':
- case \'isnt\':
- case \'unequal\':
- case \'notequal\':
- $tplCon = (($subject != $operand) ? $conditionalTpl : $tplCon);
- break;
- case \'<\':
- case \'lt\':
- case \'less\':
- case \'lessthan\':
- $tplCon = (($subject < $operand) ? $conditionalTpl : $tplCon);
- break;
- case \'>\':
- case \'gt\':
- case \'greater\':
- case \'greaterthan\':
- $tplCon = (($subject > $operand) ? $conditionalTpl : $tplCon);
- break;
- case \'<=\':
- case \'lte\':
- case \'lessthanequals\':
- case \'lessthanorequalto\':
- $tplCon = (($subject <= $operand) ? $conditionalTpl : $tplCon);
- break;
- case \'>=\':
- case \'gte\':
- case \'greaterthanequals\':
- case \'greaterthanequalto\':
- $tplCon = (($subject >= $operand) ? $conditionalTpl : $tplCon);
- break;
- case \'isempty\':
- case \'empty\':
- $tplCon = empty($subject) ? $conditionalTpl : $tplCon;
- break;
- case \'!empty\':
- case \'notempty\':
- case \'isnotempty\':
- $tplCon = !empty($subject) && $subject != \'\' ? $conditionalTpl : $tplCon;
- break;
- case \'isnull\':
- case \'null\':
- $tplCon = $subject == null || strtolower($subject) == \'null\' ? $conditionalTpl : $tplCon;
- break;
- case \'inarray\':
- case \'in_array\':
- case \'ia\':
- $operand = explode(\',\', $operand);
- $tplCon = in_array($subject, $operand) ? $conditionalTpl : $tplCon;
- break;
- case \'between\':
- case \'range\':
- case \'>=<\':
- case \'><\':
- $operand = explode(\',\', $operand);
- $tplCon = ($subject >= min($operand) && $subject <= max($operand)) ? $conditionalTpl : $tplCon;
- break;
- case \'==\':
- case \'=\':
- case \'eq\':
- case \'is\':
- case \'equal\':
- case \'equals\':
- case \'equalto\':
- default:
- $tplCon = (($subject == $operand) ? $conditionalTpl : $tplCon);
- break;
- }
- }
- if (!empty($tplCon)) {
- $resourceTpl = parseTpl($tplCon, $properties);
- }
- }
- if (!empty($tpl) && empty($resourceTpl)) {
- $resourceTpl = parseTpl($tpl, $properties);
- }
- if ($resourceTpl === false && !empty($debug)) {
- $chunk = $modx->newObject(\'modChunk\');
- $chunk->setCacheable(false);
- $output[]= $chunk->process(array(), \'<pre>\' . print_r($properties, true) .\'</pre>\');
- } else {
- $output[]= $resourceTpl;
- }
- $idx++;
- }
- /* output */
- $toSeparatePlaceholders = $modx->getOption(\'toSeparatePlaceholders\', $scriptProperties, false);
- if (!empty($toSeparatePlaceholders)) {
- $modx->setPlaceholders($output, $toSeparatePlaceholders);
- return \'\';
- }
- $output = implode($outputSeparator, $output);
- $tplWrapper = $modx->getOption(\'tplWrapper\', $scriptProperties, false);
- $wrapIfEmpty = $modx->getOption(\'wrapIfEmpty\', $scriptProperties, false);
- if (!empty($tplWrapper) && ($wrapIfEmpty || !empty($output))) {
- $output = parseTpl($tplWrapper, array_merge($scriptProperties, array(\'output\' => $output)));
- }
- $toPlaceholder = $modx->getOption(\'toPlaceholder\', $scriptProperties, false);
- if (!empty($toPlaceholder)) {
- $modx->setPlaceholder($toPlaceholder, $output);
- return \'\';
- }
- return $output;',
- 'locked' => false,
- 'properties' =>
- array (
- 'tpl' =>
- array (
- 'name' => 'tpl',
- 'desc' => 'Name of a chunk serving as a resource template. NOTE: if not provided, properties are dumped to output for each resource.',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'Name of a chunk serving as a resource template. NOTE: if not provided, properties are dumped to output for each resource.',
- 'area_trans' => '',
- ),
- 'tplOdd' =>
- array (
- 'name' => 'tplOdd',
- 'desc' => 'Name of a chunk serving as resource template for resources with an odd idx value (see idx property).',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'Name of a chunk serving as resource template for resources with an odd idx value (see idx property).',
- 'area_trans' => '',
- ),
- 'tplFirst' =>
- array (
- 'name' => 'tplFirst',
- 'desc' => 'Name of a chunk serving as resource template for the first resource (see first property).',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'Name of a chunk serving as resource template for the first resource (see first property).',
- 'area_trans' => '',
- ),
- 'tplLast' =>
- array (
- 'name' => 'tplLast',
- 'desc' => 'Name of a chunk serving as resource template for the last resource (see last property).',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'Name of a chunk serving as resource template for the last resource (see last property).',
- 'area_trans' => '',
- ),
- 'tplWrapper' =>
- array (
- 'name' => 'tplWrapper',
- 'desc' => 'Name of a chunk serving as wrapper template for the Snippet output. This does not work with toSeparatePlaceholders.',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'Name of a chunk serving as wrapper template for the Snippet output. This does not work with toSeparatePlaceholders.',
- 'area_trans' => '',
- ),
- 'wrapIfEmpty' =>
- array (
- 'name' => 'wrapIfEmpty',
- 'desc' => 'Indicates if empty output should be wrapped by the tplWrapper, if specified. Defaults to false.',
- 'type' => 'combo-boolean',
- 'options' => '',
- 'value' => false,
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'Indicates if empty output should be wrapped by the tplWrapper, if specified. Defaults to false.',
- 'area_trans' => '',
- ),
- 'sortby' =>
- array (
- 'name' => 'sortby',
- 'desc' => 'A field name to sort by or JSON object of field names and sortdir for each field, e.g. {"publishedon":"ASC","createdon":"DESC"}. Defaults to publishedon.',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => 'publishedon',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'A field name to sort by or JSON object of field names and sortdir for each field, e.g. {"publishedon":"ASC","createdon":"DESC"}. Defaults to publishedon.',
- 'area_trans' => '',
- ),
- 'sortbyTV' =>
- array (
- 'name' => 'sortbyTV',
- 'desc' => 'Name of a Template Variable to sort by. Defaults to empty string.',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'Name of a Template Variable to sort by. Defaults to empty string.',
- 'area_trans' => '',
- ),
- 'sortbyTVType' =>
- array (
- 'name' => 'sortbyTVType',
- 'desc' => 'An optional type to indicate how to sort on the Template Variable value.',
- 'type' => 'list',
- 'options' =>
- array (
- 0 =>
- array (
- 'text' => 'string',
- 'value' => 'string',
- 'name' => 'string',
- ),
- 1 =>
- array (
- 'text' => 'integer',
- 'value' => 'integer',
- 'name' => 'integer',
- ),
- 2 =>
- array (
- 'text' => 'decimal',
- 'value' => 'decimal',
- 'name' => 'decimal',
- ),
- 3 =>
- array (
- 'text' => 'datetime',
- 'value' => 'datetime',
- 'name' => 'datetime',
- ),
- ),
- 'value' => 'string',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'An optional type to indicate how to sort on the Template Variable value.',
- 'area_trans' => '',
- ),
- 'sortbyAlias' =>
- array (
- 'name' => 'sortbyAlias',
- 'desc' => 'Query alias for sortby field. Defaults to an empty string.',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'Query alias for sortby field. Defaults to an empty string.',
- 'area_trans' => '',
- ),
- 'sortbyEscaped' =>
- array (
- 'name' => 'sortbyEscaped',
- 'desc' => 'Determines if the field name specified in sortby should be escaped. Defaults to 0.',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '0',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'Determines if the field name specified in sortby should be escaped. Defaults to 0.',
- 'area_trans' => '',
- ),
- 'sortdir' =>
- array (
- 'name' => 'sortdir',
- 'desc' => 'Order which to sort by. Defaults to DESC.',
- 'type' => 'list',
- 'options' =>
- array (
- 0 =>
- array (
- 'text' => 'ASC',
- 'value' => 'ASC',
- 'name' => 'ASC',
- ),
- 1 =>
- array (
- 'text' => 'DESC',
- 'value' => 'DESC',
- 'name' => 'DESC',
- ),
- ),
- 'value' => 'DESC',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'Order which to sort by. Defaults to DESC.',
- 'area_trans' => '',
- ),
- 'sortdirTV' =>
- array (
- 'name' => 'sortdirTV',
- 'desc' => 'Order which to sort a Template Variable by. Defaults to DESC.',
- 'type' => 'list',
- 'options' =>
- array (
- 0 =>
- array (
- 'text' => 'ASC',
- 'value' => 'ASC',
- 'name' => 'ASC',
- ),
- 1 =>
- array (
- 'text' => 'DESC',
- 'value' => 'DESC',
- 'name' => 'DESC',
- ),
- ),
- 'value' => 'DESC',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'Order which to sort a Template Variable by. Defaults to DESC.',
- 'area_trans' => '',
- ),
- 'limit' =>
- array (
- 'name' => 'limit',
- 'desc' => 'Limits the number of resources returned. Defaults to 5.',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '5',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'Limits the number of resources returned. Defaults to 5.',
- 'area_trans' => '',
- ),
- 'offset' =>
- array (
- 'name' => 'offset',
- 'desc' => 'An offset of resources returned by the criteria to skip.',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '0',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'An offset of resources returned by the criteria to skip.',
- 'area_trans' => '',
- ),
- 'tvFilters' =>
- array (
- 'name' => 'tvFilters',
- 'desc' => 'Delimited-list of TemplateVar values to filter resources by. Supports two delimiters and two value search formats. THe first delimiter || represents a logical OR and the primary grouping mechanism. Within each group you can provide a comma-delimited list of values. These values can be either tied to a specific TemplateVar by name, e.g. myTV==value, or just the value, indicating you are searching for the value in any TemplateVar tied to the Resource. An example would be &tvFilters=`filter2==one,filter1==bar%||filter1==foo`. <br />NOTE: filtering by values uses a LIKE query and % is considered a wildcard. <br />ANOTHER NOTE: This only looks at the raw value set for specific Resource, i. e. there must be a value specifically set for the Resource and it is not evaluated.',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'Delimited-list of TemplateVar values to filter resources by. Supports two delimiters and two value search formats. THe first delimiter || represents a logical OR and the primary grouping mechanism. Within each group you can provide a comma-delimited list of values. These values can be either tied to a specific TemplateVar by name, e.g. myTV==value, or just the value, indicating you are searching for the value in any TemplateVar tied to the Resource. An example would be &tvFilters=`filter2==one,filter1==bar%||filter1==foo`. <br />NOTE: filtering by values uses a LIKE query and % is considered a wildcard. <br />ANOTHER NOTE: This only looks at the raw value set for specific Resource, i. e. there must be a value specifically set for the Resource and it is not evaluated.',
- 'area_trans' => '',
- ),
- 'tvFiltersAndDelimiter' =>
- array (
- 'name' => 'tvFiltersAndDelimiter',
- 'desc' => 'The delimiter to use to separate logical AND expressions in tvFilters. Default is ,',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => ',',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'The delimiter to use to separate logical AND expressions in tvFilters. Default is ,',
- 'area_trans' => '',
- ),
- 'tvFiltersOrDelimiter' =>
- array (
- 'name' => 'tvFiltersOrDelimiter',
- 'desc' => 'The delimiter to use to separate logical OR expressions in tvFilters. Default is ||',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '||',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'The delimiter to use to separate logical OR expressions in tvFilters. Default is ||',
- 'area_trans' => '',
- ),
- 'depth' =>
- array (
- 'name' => 'depth',
- 'desc' => 'Integer value indicating depth to search for resources from each parent. Defaults to 10.',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '10',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'Integer value indicating depth to search for resources from each parent. Defaults to 10.',
- 'area_trans' => '',
- ),
- 'parents' =>
- array (
- 'name' => 'parents',
- 'desc' => 'Optional. Comma-delimited list of ids serving as parents.',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'Optional. Comma-delimited list of ids serving as parents.',
- 'area_trans' => '',
- ),
- 'includeContent' =>
- array (
- 'name' => 'includeContent',
- 'desc' => 'Indicates if the content of each resource should be returned in the results. Defaults to false.',
- 'type' => 'combo-boolean',
- 'options' => '',
- 'value' => false,
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'Indicates if the content of each resource should be returned in the results. Defaults to false.',
- 'area_trans' => '',
- ),
- 'includeTVs' =>
- array (
- 'name' => 'includeTVs',
- 'desc' => 'Indicates if TemplateVar values should be included in the properties available to each resource template. Defaults to false.',
- 'type' => 'combo-boolean',
- 'options' => '',
- 'value' => false,
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'Indicates if TemplateVar values should be included in the properties available to each resource template. Defaults to false.',
- 'area_trans' => '',
- ),
- 'includeTVList' =>
- array (
- 'name' => 'includeTVList',
- 'desc' => 'Limits included TVs to those specified as a comma-delimited list of TV names. Defaults to empty.',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'Limits included TVs to those specified as a comma-delimited list of TV names. Defaults to empty.',
- 'area_trans' => '',
- ),
- 'showHidden' =>
- array (
- 'name' => 'showHidden',
- 'desc' => 'Indicates if Resources that are hidden from menus should be shown. Defaults to false.',
- 'type' => 'combo-boolean',
- 'options' => '',
- 'value' => false,
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'Indicates if Resources that are hidden from menus should be shown. Defaults to false.',
- 'area_trans' => '',
- ),
- 'showUnpublished' =>
- array (
- 'name' => 'showUnpublished',
- 'desc' => 'Indicates if Resources that are unpublished should be shown. Defaults to false.',
- 'type' => 'combo-boolean',
- 'options' => '',
- 'value' => false,
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'Indicates if Resources that are unpublished should be shown. Defaults to false.',
- 'area_trans' => '',
- ),
- 'showDeleted' =>
- array (
- 'name' => 'showDeleted',
- 'desc' => 'Indicates if Resources that are deleted should be shown. Defaults to false.',
- 'type' => 'combo-boolean',
- 'options' => '',
- 'value' => false,
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'Indicates if Resources that are deleted should be shown. Defaults to false.',
- 'area_trans' => '',
- ),
- 'resources' =>
- array (
- 'name' => 'resources',
- 'desc' => 'A comma-separated list of resource IDs to exclude or include. IDs with a - in front mean to exclude. Ex: 123,-456 means to include Resource 123, but always exclude Resource 456.',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'A comma-separated list of resource IDs to exclude or include. IDs with a - in front mean to exclude. Ex: 123,-456 means to include Resource 123, but always exclude Resource 456.',
- 'area_trans' => '',
- ),
- 'processTVs' =>
- array (
- 'name' => 'processTVs',
- 'desc' => 'Indicates if TemplateVar values should be rendered as they would on the resource being summarized. Defaults to false.',
- 'type' => 'combo-boolean',
- 'options' => '',
- 'value' => false,
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'Indicates if TemplateVar values should be rendered as they would on the resource being summarized. Defaults to false.',
- 'area_trans' => '',
- ),
- 'processTVList' =>
- array (
- 'name' => 'processTVList',
- 'desc' => 'Limits processed TVs to those specified as a comma-delimited list of TV names; note only includedTVs will be available for processing if specified. Defaults to empty.',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'Limits processed TVs to those specified as a comma-delimited list of TV names; note only includedTVs will be available for processing if specified. Defaults to empty.',
- 'area_trans' => '',
- ),
- 'prepareTVs' =>
- array (
- 'name' => 'prepareTVs',
- 'desc' => 'Indicates if TemplateVar values that are not processed fully should be prepared before being returned. Defaults to true.',
- 'type' => 'combo-boolean',
- 'options' => '',
- 'value' => true,
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'Indicates if TemplateVar values that are not processed fully should be prepared before being returned. Defaults to true.',
- 'area_trans' => '',
- ),
- 'prepareTVList' =>
- array (
- 'name' => 'prepareTVList',
- 'desc' => 'Limits prepared TVs to those specified as a comma-delimited list of TV names; note only includedTVs will be available for preparing if specified. Defaults to empty.',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'Limits prepared TVs to those specified as a comma-delimited list of TV names; note only includedTVs will be available for preparing if specified. Defaults to empty.',
- 'area_trans' => '',
- ),
- 'tvPrefix' =>
- array (
- 'name' => 'tvPrefix',
- 'desc' => 'The prefix for TemplateVar properties. Defaults to: tv.',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => 'tv.',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'The prefix for TemplateVar properties. Defaults to: tv.',
- 'area_trans' => '',
- ),
- 'idx' =>
- array (
- 'name' => 'idx',
- 'desc' => 'You can define the starting idx of the resources, which is an property that is incremented as each resource is rendered.',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'You can define the starting idx of the resources, which is an property that is incremented as each resource is rendered.',
- 'area_trans' => '',
- ),
- 'first' =>
- array (
- 'name' => 'first',
- 'desc' => 'Define the idx which represents the first resource (see tplFirst). Defaults to 1.',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'Define the idx which represents the first resource (see tplFirst). Defaults to 1.',
- 'area_trans' => '',
- ),
- 'last' =>
- array (
- 'name' => 'last',
- 'desc' => 'Define the idx which represents the last resource (see tplLast). Defaults to the number of resources being summarized + first - 1',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'Define the idx which represents the last resource (see tplLast). Defaults to the number of resources being summarized + first - 1',
- 'area_trans' => '',
- ),
- 'toPlaceholder' =>
- array (
- 'name' => 'toPlaceholder',
- 'desc' => 'If set, will assign the result to this placeholder instead of outputting it directly.',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'If set, will assign the result to this placeholder instead of outputting it directly.',
- 'area_trans' => '',
- ),
- 'toSeparatePlaceholders' =>
- array (
- 'name' => 'toSeparatePlaceholders',
- 'desc' => 'If set, will assign EACH result to a separate placeholder named by this param suffixed with a sequential number (starting from 0).',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'If set, will assign EACH result to a separate placeholder named by this param suffixed with a sequential number (starting from 0).',
- 'area_trans' => '',
- ),
- 'debug' =>
- array (
- 'name' => 'debug',
- 'desc' => 'If true, will send the SQL query to the MODX log. Defaults to false.',
- 'type' => 'combo-boolean',
- 'options' => '',
- 'value' => false,
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'If true, will send the SQL query to the MODX log. Defaults to false.',
- 'area_trans' => '',
- ),
- 'where' =>
- array (
- 'name' => 'where',
- 'desc' => 'A JSON expression of criteria to build any additional where clauses from, e.g. &where=`{{"alias:LIKE":"foo%", "OR:alias:LIKE":"%bar"},{"OR:pagetitle:=":"foobar", "AND:description:=":"raboof"}}`',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'A JSON expression of criteria to build any additional where clauses from, e.g. &where=`{{"alias:LIKE":"foo%", "OR:alias:LIKE":"%bar"},{"OR:pagetitle:=":"foobar", "AND:description:=":"raboof"}}`',
- 'area_trans' => '',
- ),
- 'dbCacheFlag' =>
- array (
- 'name' => 'dbCacheFlag',
- 'desc' => 'Determines how result sets are cached if cache_db is enabled in MODX. 0|false = do not cache result set; 1 = cache result set according to cache settings, any other integer value = number of seconds to cache result set',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '0',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'Determines how result sets are cached if cache_db is enabled in MODX. 0|false = do not cache result set; 1 = cache result set according to cache settings, any other integer value = number of seconds to cache result set',
- 'area_trans' => '',
- ),
- 'context' =>
- array (
- 'name' => 'context',
- 'desc' => 'A comma-delimited list of context keys for limiting results. Default is empty, i.e. do not limit results by context.',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'A comma-delimited list of context keys for limiting results. Default is empty, i.e. do not limit results by context.',
- 'area_trans' => '',
- ),
- 'tplCondition' =>
- array (
- 'name' => 'tplCondition',
- 'desc' => 'A condition to compare against the conditionalTpls property to map Resources to different tpls based on custom conditional logic.',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'A condition to compare against the conditionalTpls property to map Resources to different tpls based on custom conditional logic.',
- 'area_trans' => '',
- ),
- 'tplOperator' =>
- array (
- 'name' => 'tplOperator',
- 'desc' => 'An optional operator to use for the tplCondition when comparing against the conditionalTpls operands. Default is == (equals).',
- 'type' => 'list',
- 'options' =>
- array (
- 0 =>
- array (
- 'text' => 'is equal to',
- 'value' => '==',
- 'name' => 'is equal to',
- ),
- 1 =>
- array (
- 'text' => 'is not equal to',
- 'value' => '!=',
- 'name' => 'is not equal to',
- ),
- 2 =>
- array (
- 'text' => 'less than',
- 'value' => '<',
- 'name' => 'less than',
- ),
- 3 =>
- array (
- 'text' => 'less than or equal to',
- 'value' => '<=',
- 'name' => 'less than or equal to',
- ),
- 4 =>
- array (
- 'text' => 'greater than or equal to',
- 'value' => '>=',
- 'name' => 'greater than or equal to',
- ),
- 5 =>
- array (
- 'text' => 'is empty',
- 'value' => 'empty',
- 'name' => 'is empty',
- ),
- 6 =>
- array (
- 'text' => 'is not empty',
- 'value' => '!empty',
- 'name' => 'is not empty',
- ),
- 7 =>
- array (
- 'text' => 'is null',
- 'value' => 'null',
- 'name' => 'is null',
- ),
- 8 =>
- array (
- 'text' => 'is in array',
- 'value' => 'inarray',
- 'name' => 'is in array',
- ),
- 9 =>
- array (
- 'text' => 'is between',
- 'value' => 'between',
- 'name' => 'is between',
- ),
- ),
- 'value' => '==',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'An optional operator to use for the tplCondition when comparing against the conditionalTpls operands. Default is == (equals).',
- 'area_trans' => '',
- ),
- 'conditionalTpls' =>
- array (
- 'name' => 'conditionalTpls',
- 'desc' => 'A JSON map of conditional operands and tpls to compare against the tplCondition property using the specified tplOperator.',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'A JSON map of conditional operands and tpls to compare against the tplCondition property using the specified tplOperator.',
- 'area_trans' => '',
- ),
- ),
- 'moduleguid' => '',
- 'static' => false,
- 'static_file' => '',
- 'content' => '/**
- * getResources
- *
- * A general purpose Resource listing and summarization snippet for MODX 2.x.
- *
- * @author Jason Coward
- * @copyright Copyright 2010-2013, Jason Coward
- *
- * TEMPLATES
- *
- * tpl - Name of a chunk serving as a resource template
- * [NOTE: if not provided, properties are dumped to output for each resource]
- *
- * tplOdd - (Opt) Name of a chunk serving as resource template for resources with an odd idx value
- * (see idx property)
- * tplFirst - (Opt) Name of a chunk serving as resource template for the first resource (see first
- * property)
- * tplLast - (Opt) Name of a chunk serving as resource template for the last resource (see last
- * property)
- * tpl_{n} - (Opt) Name of a chunk serving as resource template for the nth resource
- *
- * tplCondition - (Opt) Defines a field of the resource to evaluate against keys defined in the
- * conditionalTpls property. Must be a resource field; does not work with Template Variables.
- * conditionalTpls - (Opt) A JSON object defining a map of field values and the associated tpl to
- * use when the field defined by tplCondition matches the value. [NOTE: tplOdd, tplFirst, tplLast,
- * and tpl_{n} will take precedence over any defined conditionalTpls]
- *
- * tplWrapper - (Opt) Name of a chunk serving as a wrapper template for the output
- * [NOTE: Does not work with toSeparatePlaceholders]
- *
- * SELECTION
- *
- * parents - Comma-delimited list of ids serving as parents
- *
- * context - (Opt) Comma-delimited list of context keys to limit results by; if empty, contexts for all specified
- * parents will be used (all contexts if 0 is specified) [default=]
- *
- * depth - (Opt) Integer value indicating depth to search for resources from each parent [default=10]
- *
- * tvFilters - (Opt) Delimited-list of TemplateVar values to filter resources by. Supports two
- * delimiters and two value search formats. The first delimiter || represents a logical OR and the
- * primary grouping mechanism. Within each group you can provide a comma-delimited list of values.
- * These values can be either tied to a specific TemplateVar by name, e.g. myTV==value, or just the
- * value, indicating you are searching for the value in any TemplateVar tied to the Resource. An
- * example would be &tvFilters=`filter2==one,filter1==bar%||filter1==foo`
- * [NOTE: filtering by values uses a LIKE query and % is considered a wildcard.]
- * [NOTE: this only looks at the raw value set for specific Resource, i. e. there must be a value
- * specifically set for the Resource and it is not evaluated.]
- *
- * tvFiltersAndDelimiter - (Opt) Custom delimiter for logical AND, default \',\', in case you want to
- * match a literal comma in the tvFilters. E.g. &tvFiltersAndDelimiter=`&&`
- * &tvFilters=`filter1==foo,bar&&filter2==baz` [default=,]
- *
- * tvFiltersOrDelimiter - (Opt) Custom delimiter for logical OR, default \'||\', in case you want to
- * match a literal \'||\' in the tvFilters. E.g. &tvFiltersOrDelimiter=`|OR|`
- * &tvFilters=`filter1==foo||bar|OR|filter2==baz` [default=||]
- *
- * where - (Opt) A JSON expression of criteria to build any additional where clauses from. An example would be
- * &where=`{{"alias:LIKE":"foo%", "OR:alias:LIKE":"%bar"},{"OR:pagetitle:=":"foobar", "AND:description:=":"raboof"}}`
- *
- * sortby - (Opt) Field to sort by or a JSON array, e.g. {"publishedon":"ASC","createdon":"DESC"} [default=publishedon]
- * sortbyTV - (opt) A Template Variable name to sort by (if supplied, this precedes the sortby value) [default=]
- * sortbyTVType - (Opt) A data type to CAST a TV Value to in order to sort on it properly [default=string]
- * sortbyAlias - (Opt) Query alias for sortby field [default=]
- * sortbyEscaped - (Opt) Escapes the field name(s) specified in sortby [default=0]
- * sortdir - (Opt) Order which to sort by [default=DESC]
- * sortdirTV - (Opt) Order which to sort by a TV [default=DESC]
- * limit - (Opt) Limits the number of resources returned [default=5]
- * offset - (Opt) An offset of resources returned by the criteria to skip [default=0]
- * dbCacheFlag - (Opt) Controls caching of db queries; 0|false = do not cache result set; 1 = cache result set
- * according to cache settings, any other integer value = number of seconds to cache result set [default=0]
- *
- * OPTIONS
- *
- * includeContent - (Opt) Indicates if the content of each resource should be returned in the
- * results [default=0]
- * includeTVs - (Opt) Indicates if TemplateVar values should be included in the properties available
- * to each resource template [default=0]
- * includeTVList - (Opt) Limits the TemplateVars that are included if includeTVs is true to those specified
- * by name in a comma-delimited list [default=]
- * prepareTVs - (Opt) Prepares media-source dependent TemplateVar values [default=1]
- * prepareTVList - (Opt) Limits the TVs that are prepared to those specified by name in a comma-delimited
- * list [default=]
- * processTVs - (Opt) Indicates if TemplateVar values should be rendered as they would on the
- * resource being summarized [default=0]
- * processTVList - (opt) Limits the TemplateVars that are processed if included to those specified
- * by name in a comma-delimited list [default=]
- * tvPrefix - (Opt) The prefix for TemplateVar properties [default=tv.]
- * idx - (Opt) You can define the starting idx of the resources, which is an property that is
- * incremented as each resource is rendered [default=1]
- * first - (Opt) Define the idx which represents the first resource (see tplFirst) [default=1]
- * last - (Opt) Define the idx which represents the last resource (see tplLast) [default=# of
- * resources being summarized + first - 1]
- * outputSeparator - (Opt) An optional string to separate each tpl instance [default="\\n"]
- * wrapIfEmpty - (Opt) Indicates if the tplWrapper should be applied if the output is empty [default=0]
- *
- */
- $output = array();
- $outputSeparator = isset($outputSeparator) ? $outputSeparator : "\\n";
- /* set default properties */
- $tpl = !empty($tpl) ? $tpl : \'\';
- $includeContent = !empty($includeContent) ? true : false;
- $includeTVs = !empty($includeTVs) ? true : false;
- $includeTVList = !empty($includeTVList) ? explode(\',\', $includeTVList) : array();
- $processTVs = !empty($processTVs) ? true : false;
- $processTVList = !empty($processTVList) ? explode(\',\', $processTVList) : array();
- $prepareTVs = !empty($prepareTVs) ? true : false;
- $prepareTVList = !empty($prepareTVList) ? explode(\',\', $prepareTVList) : array();
- $tvPrefix = isset($tvPrefix) ? $tvPrefix : \'tv.\';
- $parents = (!empty($parents) || $parents === \'0\') ? explode(\',\', $parents) : array($modx->resource->get(\'id\'));
- array_walk($parents, \'trim\');
- $parents = array_unique($parents);
- $depth = isset($depth) ? (integer) $depth : 10;
- $tvFiltersOrDelimiter = isset($tvFiltersOrDelimiter) ? $tvFiltersOrDelimiter : \'||\';
- $tvFiltersAndDelimiter = isset($tvFiltersAndDelimiter) ? $tvFiltersAndDelimiter : \',\';
- $tvFilters = !empty($tvFilters) ? explode($tvFiltersOrDelimiter, $tvFilters) : array();
- $where = !empty($where) ? $modx->fromJSON($where) : array();
- $showUnpublished = !empty($showUnpublished) ? true : false;
- $showDeleted = !empty($showDeleted) ? true : false;
- $sortby = isset($sortby) ? $sortby : \'publishedon\';
- $sortbyTV = isset($sortbyTV) ? $sortbyTV : \'\';
- $sortbyAlias = isset($sortbyAlias) ? $sortbyAlias : \'modResource\';
- $sortbyEscaped = !empty($sortbyEscaped) ? true : false;
- $sortdir = isset($sortdir) ? $sortdir : \'DESC\';
- $sortdirTV = isset($sortdirTV) ? $sortdirTV : \'DESC\';
- $limit = isset($limit) ? (integer) $limit : 5;
- $offset = isset($offset) ? (integer) $offset : 0;
- $totalVar = !empty($totalVar) ? $totalVar : \'total\';
- $dbCacheFlag = !isset($dbCacheFlag) ? false : $dbCacheFlag;
- if (is_string($dbCacheFlag) || is_numeric($dbCacheFlag)) {
- if ($dbCacheFlag == \'0\') {
- $dbCacheFlag = false;
- } elseif ($dbCacheFlag == \'1\') {
- $dbCacheFlag = true;
- } else {
- $dbCacheFlag = (integer) $dbCacheFlag;
- }
- }
- /* multiple context support */
- $contextArray = array();
- $contextSpecified = false;
- if (!empty($context)) {
- $contextArray = explode(\',\',$context);
- array_walk($contextArray, \'trim\');
- $contexts = array();
- foreach ($contextArray as $ctx) {
- $contexts[] = $modx->quote($ctx);
- }
- $context = implode(\',\',$contexts);
- $contextSpecified = true;
- unset($contexts,$ctx);
- } else {
- $context = $modx->quote($modx->context->get(\'key\'));
- }
- $pcMap = array();
- $pcQuery = $modx->newQuery(\'modResource\', array(\'id:IN\' => $parents), $dbCacheFlag);
- $pcQuery->select(array(\'id\', \'context_key\'));
- if ($pcQuery->prepare() && $pcQuery->stmt->execute()) {
- foreach ($pcQuery->stmt->fetchAll(PDO::FETCH_ASSOC) as $pcRow) {
- $pcMap[(integer) $pcRow[\'id\']] = $pcRow[\'context_key\'];
- }
- }
- $children = array();
- $parentArray = array();
- foreach ($parents as $parent) {
- $parent = (integer) $parent;
- if ($parent === 0) {
- $pchildren = array();
- if ($contextSpecified) {
- foreach ($contextArray as $pCtx) {
- if (!in_array($pCtx, $contextArray)) {
- continue;
- }
- $options = $pCtx !== $modx->context->get(\'key\') ? array(\'context\' => $pCtx) : array();
- $pcchildren = $modx->getChildIds($parent, $depth, $options);
- if (!empty($pcchildren)) $pchildren = array_merge($pchildren, $pcchildren);
- }
- } else {
- $cQuery = $modx->newQuery(\'modContext\', array(\'key:!=\' => \'mgr\'));
- $cQuery->select(array(\'key\'));
- if ($cQuery->prepare() && $cQuery->stmt->execute()) {
- foreach ($cQuery->stmt->fetchAll(PDO::FETCH_COLUMN) as $pCtx) {
- $options = $pCtx !== $modx->context->get(\'key\') ? array(\'context\' => $pCtx) : array();
- $pcchildren = $modx->getChildIds($parent, $depth, $options);
- if (!empty($pcchildren)) $pchildren = array_merge($pchildren, $pcchildren);
- }
- }
- }
- $parentArray[] = $parent;
- } else {
- $pContext = array_key_exists($parent, $pcMap) ? $pcMap[$parent] : false;
- if ($debug) $modx->log(modX::LOG_LEVEL_ERROR, "context for {$parent} is {$pContext}");
- if ($pContext && $contextSpecified && !in_array($pContext, $contextArray, true)) {
- $parent = next($parents);
- continue;
- }
- $parentArray[] = $parent;
- $options = !empty($pContext) && $pContext !== $modx->context->get(\'key\') ? array(\'context\' => $pContext) : array();
- $pchildren = $modx->getChildIds($parent, $depth, $options);
- }
- if (!empty($pchildren)) $children = array_merge($children, $pchildren);
- $parent = next($parents);
- }
- $parents = array_merge($parentArray, $children);
- /* build query */
- $criteria = array("modResource.parent IN (" . implode(\',\', $parents) . ")");
- if ($contextSpecified) {
- $contextResourceTbl = $modx->getTableName(\'modContextResource\');
- $criteria[] = "(modResource.context_key IN ({$context}) OR EXISTS(SELECT 1 FROM {$contextResourceTbl} ctx WHERE ctx.resource = modResource.id AND ctx.context_key IN ({$context})))";
- }
- if (empty($showDeleted)) {
- $criteria[\'deleted\'] = \'0\';
- }
- if (empty($showUnpublished)) {
- $criteria[\'published\'] = \'1\';
- }
- if (empty($showHidden)) {
- $criteria[\'hidemenu\'] = \'0\';
- }
- if (!empty($hideContainers)) {
- $criteria[\'isfolder\'] = \'0\';
- }
- $criteria = $modx->newQuery(\'modResource\', $criteria);
- if (!empty($tvFilters)) {
- $tmplVarTbl = $modx->getTableName(\'modTemplateVar\');
- $tmplVarResourceTbl = $modx->getTableName(\'modTemplateVarResource\');
- $conditions = array();
- $operators = array(
- \'<=>\' => \'<=>\',
- \'===\' => \'=\',
- \'!==\' => \'!=\',
- \'<>\' => \'<>\',
- \'==\' => \'LIKE\',
- \'!=\' => \'NOT LIKE\',
- \'<<\' => \'<\',
- \'<=\' => \'<=\',
- \'=<\' => \'=<\',
- \'>>\' => \'>\',
- \'>=\' => \'>=\',
- \'=>\' => \'=>\'
- );
- foreach ($tvFilters as $fGroup => $tvFilter) {
- $filterGroup = array();
- $filters = explode($tvFiltersAndDelimiter, $tvFilter);
- $multiple = count($filters) > 0;
- foreach ($filters as $filter) {
- $operator = \'==\';
- $sqlOperator = \'LIKE\';
- foreach ($operators as $op => $opSymbol) {
- if (strpos($filter, $op, 1) !== false) {
- $operator = $op;
- $sqlOperator = $opSymbol;
- break;
- }
- }
- $tvValueField = \'tvr.value\';
- $tvDefaultField = \'tv.default_text\';
- $f = explode($operator, $filter);
- if (count($f) >= 2) {
- if (count($f) > 2) {
- $k = array_shift($f);
- $b = join($operator, $f);
- $f = array($k, $b);
- }
- $tvName = $modx->quote($f[0]);
- if (is_numeric($f[1]) && !in_array($sqlOperator, array(\'LIKE\', \'NOT LIKE\'))) {
- $tvValue = $f[1];
- if ($f[1] == (integer)$f[1]) {
- $tvValueField = "CAST({$tvValueField} AS SIGNED INTEGER)";
- $tvDefaultField = "CAST({$tvDefaultField} AS SIGNED INTEGER)";
- } else {
- $tvValueField = "CAST({$tvValueField} AS DECIMAL)";
- $tvDefaultField = "CAST({$tvDefaultField} AS DECIMAL)";
- }
- } else {
- $tvValue = $modx->quote($f[1]);
- }
- if ($multiple) {
- $filterGroup[] =
- "(EXISTS (SELECT 1 FROM {$tmplVarResourceTbl} tvr JOIN {$tmplVarTbl} tv ON {$tvValueField} {$sqlOperator} {$tvValue} AND tv.name = {$tvName} AND tv.id = tvr.tmplvarid WHERE tvr.contentid = modResource.id) " .
- "OR EXISTS (SELECT 1 FROM {$tmplVarTbl} tv WHERE tv.name = {$tvName} AND {$tvDefaultField} {$sqlOperator} {$tvValue} AND tv.id NOT IN (SELECT tmplvarid FROM {$tmplVarResourceTbl} WHERE contentid = modResource.id)) " .
- ")";
- } else {
- $filterGroup =
- "(EXISTS (SELECT 1 FROM {$tmplVarResourceTbl} tvr JOIN {$tmplVarTbl} tv ON {$tvValueField} {$sqlOperator} {$tvValue} AND tv.name = {$tvName} AND tv.id = tvr.tmplvarid WHERE tvr.contentid = modResource.id) " .
- "OR EXISTS (SELECT 1 FROM {$tmplVarTbl} tv WHERE tv.name = {$tvName} AND {$tvDefaultField} {$sqlOperator} {$tvValue} AND tv.id NOT IN (SELECT tmplvarid FROM {$tmplVarResourceTbl} WHERE contentid = modResource.id)) " .
- ")";
- }
- } elseif (count($f) == 1) {
- $tvValue = $modx->quote($f[0]);
- if ($multiple) {
- $filterGroup[] = "EXISTS (SELECT 1 FROM {$tmplVarResourceTbl} tvr JOIN {$tmplVarTbl} tv ON {$tvValueField} {$sqlOperator} {$tvValue} AND tv.id = tvr.tmplvarid WHERE tvr.contentid = modResource.id)";
- } else {
- $filterGroup = "EXISTS (SELECT 1 FROM {$tmplVarResourceTbl} tvr JOIN {$tmplVarTbl} tv ON {$tvValueField} {$sqlOperator} {$tvValue} AND tv.id = tvr.tmplvarid WHERE tvr.contentid = modResource.id)";
- }
- }
- }
- $conditions[] = $filterGroup;
- }
- if (!empty($conditions)) {
- $firstGroup = true;
- foreach ($conditions as $cGroup => $c) {
- if (is_array($c)) {
- $first = true;
- foreach ($c as $cond) {
- if ($first && !$firstGroup) {
- $criteria->condition($criteria->query[\'where\'][0][1], $cond, xPDOQuery::SQL_OR, null, $cGroup);
- } else {
- $criteria->condition($criteria->query[\'where\'][0][1], $cond, xPDOQuery::SQL_AND, null, $cGroup);
- }
- $first = false;
- }
- } else {
- $criteria->condition($criteria->query[\'where\'][0][1], $c, $firstGroup ? xPDOQuery::SQL_AND : xPDOQuery::SQL_OR, null, $cGroup);
- }
- $firstGroup = false;
- }
- }
- }
- /* include/exclude resources, via &resources=`123,-456` prop */
- if (!empty($resources)) {
- $resourceConditions = array();
- $resources = explode(\',\',$resources);
- $include = array();
- $exclude = array();
- foreach ($resources as $resource) {
- $resource = (int)$resource;
- if ($resource == 0) continue;
- if ($resource < 0) {
- $exclude[] = abs($resource);
- } else {
- $include[] = $resource;
- }
- }
- if (!empty($include)) {
- $criteria->where(array(\'OR:modResource.id:IN\' => $include), xPDOQuery::SQL_OR);
- }
- if (!empty($exclude)) {
- $criteria->where(array(\'modResource.id:NOT IN\' => $exclude), xPDOQuery::SQL_AND, null, 1);
- }
- }
- if (!empty($where)) {
- $criteria->where($where);
- }
- $total = $modx->getCount(\'modResource\', $criteria);
- $modx->setPlaceholder($totalVar, $total);
- $fields = array_keys($modx->getFields(\'modResource\'));
- if (empty($includeContent)) {
- $fields = array_diff($fields, array(\'content\'));
- }
- $columns = $includeContent ? $modx->getSelectColumns(\'modResource\', \'modResource\') : $modx->getSelectColumns(\'modResource\', \'modResource\', \'\', array(\'content\'), true);
- $criteria->select($columns);
- if (!empty($sortbyTV)) {
- $criteria->leftJoin(\'modTemplateVar\', \'tvDefault\', array(
- "tvDefault.name" => $sortbyTV
- ));
- $criteria->leftJoin(\'modTemplateVarResource\', \'tvSort\', array(
- "tvSort.contentid = modResource.id",
- "tvSort.tmplvarid = tvDefault.id"
- ));
- if (empty($sortbyTVType)) $sortbyTVType = \'string\';
- if ($modx->getOption(\'dbtype\') === \'mysql\') {
- switch ($sortbyTVType) {
- case \'integer\':
- $criteria->select("CAST(IFNULL(tvSort.value, tvDefault.default_text) AS SIGNED INTEGER) AS sortTV");
- break;
- case \'decimal\':
- $criteria->select("CAST(IFNULL(tvSort.value, tvDefault.default_text) AS DECIMAL) AS sortTV");
- break;
- case \'datetime\':
- $criteria->select("CAST(IFNULL(tvSort.value, tvDefault.default_text) AS DATETIME) AS sortTV");
- break;
- case \'string\':
- default:
- $criteria->select("IFNULL(tvSort.value, tvDefault.default_text) AS sortTV");
- break;
- }
- } elseif ($modx->getOption(\'dbtype\') === \'sqlsrv\') {
- switch ($sortbyTVType) {
- case \'integer\':
- $criteria->select("CAST(ISNULL(tvSort.value, tvDefault.default_text) AS BIGINT) AS sortTV");
- break;
- case \'decimal\':
- $criteria->select("CAST(ISNULL(tvSort.value, tvDefault.default_text) AS DECIMAL) AS sortTV");
- break;
- case \'datetime\':
- $criteria->select("CAST(ISNULL(tvSort.value, tvDefault.default_text) AS DATETIME) AS sortTV");
- break;
- case \'string\':
- default:
- $criteria->select("ISNULL(tvSort.value, tvDefault.default_text) AS sortTV");
- break;
- }
- }
- $criteria->sortby("sortTV", $sortdirTV);
- }
- if (!empty($sortby)) {
- if (strpos($sortby, \'{\') === 0) {
- $sorts = $modx->fromJSON($sortby);
- } else {
- $sorts = array($sortby => $sortdir);
- }
- if (is_array($sorts)) {
- while (list($sort, $dir) = each($sorts)) {
- if ($sortbyEscaped) $sort = $modx->escape($sort);
- if (!empty($sortbyAlias)) $sort = $modx->escape($sortbyAlias) . ".{$sort}";
- $criteria->sortby($sort, $dir);
- }
- }
- }
- if (!empty($limit)) $criteria->limit($limit, $offset);
- if (!empty($debug)) {
- $criteria->prepare();
- $modx->log(modX::LOG_LEVEL_ERROR, $criteria->toSQL());
- }
- $collection = $modx->getCollection(\'modResource\', $criteria, $dbCacheFlag);
- $idx = !empty($idx) || $idx === \'0\' ? (integer) $idx : 1;
- $first = empty($first) && $first !== \'0\' ? 1 : (integer) $first;
- $last = empty($last) ? (count($collection) + $idx - 1) : (integer) $last;
- /* include parseTpl */
- include_once $modx->getOption(\'getresources.core_path\',null,$modx->getOption(\'core_path\').\'components/getresources/\').\'include.parsetpl.php\';
- $templateVars = array();
- if (!empty($includeTVs) && !empty($includeTVList)) {
- $templateVars = $modx->getCollection(\'modTemplateVar\', array(\'name:IN\' => $includeTVList));
- }
- /** @var modResource $resource */
- foreach ($collection as $resourceId => $resource) {
- $tvs = array();
- if (!empty($includeTVs)) {
- if (empty($includeTVList)) {
- $templateVars = $resource->getMany(\'TemplateVars\');
- }
- /** @var modTemplateVar $templateVar */
- foreach ($templateVars as $tvId => $templateVar) {
- if (!empty($includeTVList) && !in_array($templateVar->get(\'name\'), $includeTVList)) continue;
- if ($processTVs && (empty($processTVList) || in_array($templateVar->get(\'name\'), $processTVList))) {
- $tvs[$tvPrefix . $templateVar->get(\'name\')] = $templateVar->renderOutput($resource->get(\'id\'));
- } else {
- $value = $templateVar->getValue($resource->get(\'id\'));
- if ($prepareTVs && method_exists($templateVar, \'prepareOutput\') && (empty($prepareTVList) || in_array($templateVar->get(\'name\'), $prepareTVList))) {
- $value = $templateVar->prepareOutput($value);
- }
- $tvs[$tvPrefix . $templateVar->get(\'name\')] = $value;
- }
- }
- }
- $odd = ($idx & 1);
- $properties = array_merge(
- $scriptProperties
- ,array(
- \'idx\' => $idx
- ,\'first\' => $first
- ,\'last\' => $last
- ,\'odd\' => $odd
- )
- ,$includeContent ? $resource->toArray() : $resource->get($fields)
- ,$tvs
- );
- $resourceTpl = false;
- if ($idx == $first && !empty($tplFirst)) {
- $resourceTpl = parseTpl($tplFirst, $properties);
- }
- if ($idx == $last && empty($resourceTpl) && !empty($tplLast)) {
- $resourceTpl = parseTpl($tplLast, $properties);
- }
- $tplidx = \'tpl_\' . $idx;
- if (empty($resourceTpl) && !empty($$tplidx)) {
- $resourceTpl = parseTpl($$tplidx, $properties);
- }
- if ($idx > 1 && empty($resourceTpl)) {
- $divisors = getDivisors($idx);
- if (!empty($divisors)) {
- foreach ($divisors as $divisor) {
- $tplnth = \'tpl_n\' . $divisor;
- if (!empty($$tplnth)) {
- $resourceTpl = parseTpl($$tplnth, $properties);
- if (!empty($resourceTpl)) {
- break;
- }
- }
- }
- }
- }
- if ($odd && empty($resourceTpl) && !empty($tplOdd)) {
- $resourceTpl = parseTpl($tplOdd, $properties);
- }
- if (!empty($tplCondition) && !empty($conditionalTpls) && empty($resourceTpl)) {
- $conTpls = $modx->fromJSON($conditionalTpls);
- $subject = $properties[$tplCondition];
- $tplOperator = !empty($tplOperator) ? $tplOperator : \'=\';
- $tplOperator = strtolower($tplOperator);
- $tplCon = \'\';
- foreach ($conTpls as $operand => $conditionalTpl) {
- switch ($tplOperator) {
- case \'!=\':
- case \'neq\':
- case \'not\':
- case \'isnot\':
- case \'isnt\':
- case \'unequal\':
- case \'notequal\':
- $tplCon = (($subject != $operand) ? $conditionalTpl : $tplCon);
- break;
- case \'<\':
- case \'lt\':
- case \'less\':
- case \'lessthan\':
- $tplCon = (($subject < $operand) ? $conditionalTpl : $tplCon);
- break;
- case \'>\':
- case \'gt\':
- case \'greater\':
- case \'greaterthan\':
- $tplCon = (($subject > $operand) ? $conditionalTpl : $tplCon);
- break;
- case \'<=\':
- case \'lte\':
- case \'lessthanequals\':
- case \'lessthanorequalto\':
- $tplCon = (($subject <= $operand) ? $conditionalTpl : $tplCon);
- break;
- case \'>=\':
- case \'gte\':
- case \'greaterthanequals\':
- case \'greaterthanequalto\':
- $tplCon = (($subject >= $operand) ? $conditionalTpl : $tplCon);
- break;
- case \'isempty\':
- case \'empty\':
- $tplCon = empty($subject) ? $conditionalTpl : $tplCon;
- break;
- case \'!empty\':
- case \'notempty\':
- case \'isnotempty\':
- $tplCon = !empty($subject) && $subject != \'\' ? $conditionalTpl : $tplCon;
- break;
- case \'isnull\':
- case \'null\':
- $tplCon = $subject == null || strtolower($subject) == \'null\' ? $conditionalTpl : $tplCon;
- break;
- case \'inarray\':
- case \'in_array\':
- case \'ia\':
- $operand = explode(\',\', $operand);
- $tplCon = in_array($subject, $operand) ? $conditionalTpl : $tplCon;
- break;
- case \'between\':
- case \'range\':
- case \'>=<\':
- case \'><\':
- $operand = explode(\',\', $operand);
- $tplCon = ($subject >= min($operand) && $subject <= max($operand)) ? $conditionalTpl : $tplCon;
- break;
- case \'==\':
- case \'=\':
- case \'eq\':
- case \'is\':
- case \'equal\':
- case \'equals\':
- case \'equalto\':
- default:
- $tplCon = (($subject == $operand) ? $conditionalTpl : $tplCon);
- break;
- }
- }
- if (!empty($tplCon)) {
- $resourceTpl = parseTpl($tplCon, $properties);
- }
- }
- if (!empty($tpl) && empty($resourceTpl)) {
- $resourceTpl = parseTpl($tpl, $properties);
- }
- if ($resourceTpl === false && !empty($debug)) {
- $chunk = $modx->newObject(\'modChunk\');
- $chunk->setCacheable(false);
- $output[]= $chunk->process(array(), \'<pre>\' . print_r($properties, true) .\'</pre>\');
- } else {
- $output[]= $resourceTpl;
- }
- $idx++;
- }
- /* output */
- $toSeparatePlaceholders = $modx->getOption(\'toSeparatePlaceholders\', $scriptProperties, false);
- if (!empty($toSeparatePlaceholders)) {
- $modx->setPlaceholders($output, $toSeparatePlaceholders);
- return \'\';
- }
- $output = implode($outputSeparator, $output);
- $tplWrapper = $modx->getOption(\'tplWrapper\', $scriptProperties, false);
- $wrapIfEmpty = $modx->getOption(\'wrapIfEmpty\', $scriptProperties, false);
- if (!empty($tplWrapper) && ($wrapIfEmpty || !empty($output))) {
- $output = parseTpl($tplWrapper, array_merge($scriptProperties, array(\'output\' => $output)));
- }
- $toPlaceholder = $modx->getOption(\'toPlaceholder\', $scriptProperties, false);
- if (!empty($toPlaceholder)) {
- $modx->setPlaceholder($toPlaceholder, $output);
- return \'\';
- }
- return $output;',
- ),
- 'policies' =>
- array (
- 'web' =>
- array (
- ),
- ),
- 'source' =>
- array (
- ),
- ),
- 'TaggerGetResourcesWhere' =>
- array (
- 'fields' =>
- array (
- 'id' => 100,
- 'source' => 0,
- 'property_preprocess' => false,
- 'name' => 'TaggerGetResourcesWhere',
- 'description' => '',
- 'editor_type' => 0,
- 'category' => 35,
- 'cache_type' => 0,
- 'snippet' => '/**
- * TaggerGetResourcesWhere
- *
- * DESCRIPTION
- *
- * This snippet generate SQL Query that can be used in WHERE condition in getResources snippet
- *
- * PROPERTIES:
- *
- * &tags string optional Comma separated list of Tags for which will be generated a Resource query. By default Tags from GET param will be loaded
- * &groups string optional Comma separated list of Tagger Groups. Only from those groups will Tags be allowed
- * &where string optional Original getResources where property. If you used where property in your current getResources call, move it here
- * &likeComparison int optional If set to 1, tags will compare using LIKE
- * &tagField string optional Field that will be used to compare with given tags. Default: alias
- * &matchAll int optional If set to 1, resource must have all specified tags. Default: 0
- * &field string optional modResource field that will be used to compare with assigned resource ID
- *
- * USAGE:
- *
- * [[!getResources? &where=`[[!TaggerGetResourcesWhere? &tags=`Books,Vehicles` &where=`{"isfolder": 0}`]]`]]
- *
- */
- $tagger = $modx->getService(\'tagger\',\'Tagger\',$modx->getOption(\'tagger.core_path\',null,$modx->getOption(\'core_path\').\'components/tagger/\').\'model/tagger/\',$scriptProperties);
- if (!($tagger instanceof Tagger)) return \'\';
- $tags = $modx->getOption(\'tags\', $scriptProperties, \'\');
- $where = $modx->getOption(\'where\', $scriptProperties, \'\');
- $tagField = $modx->getOption(\'tagField\', $scriptProperties, \'alias\');
- $likeComparison = (int) $modx->getOption(\'likeComparison\', $scriptProperties, 0);
- $matchAll = (int) $modx->getOption(\'matchAll\', $scriptProperties, 0);
- $field = $modx->getOption(\'field\', $scriptProperties, \'id\');
- $where = $modx->fromJSON($where);
- if ($where == false) {
- $where = array();
- }
- $tagsCount = 0;
- if ($tags == \'\') {
- $gc = $modx->newQuery(\'TaggerGroup\');
- $gc->select($modx->getSelectColumns(\'TaggerGroup\', \'\', \'\', array(\'alias\')));
- $groups = $modx->getOption(\'groups\', $scriptProperties, \'\');
- $groups = $tagger->explodeAndClean($groups);
- if (!empty($groups)) {
- $gc->where(array(
- \'name:IN\' => $groups,
- \'OR:alias:IN\' => $groups,
- \'OR:id:IN\' => $groups,
- ));
- }
- $gc->prepare();
- $gc->stmt->execute();
- $groups = $gc->stmt->fetchAll(PDO::FETCH_COLUMN, 0);
- $conditions = array();
- foreach ($groups as $group) {
- if (isset($_GET[$group])) {
- $groupTags = $tagger->explodeAndClean($_GET[$group]);
- if (!empty($groupTags)) {
- $like = array(\'AND:alias:IN\' => $groupTags);
- if ($likeComparison == 1) {
- foreach ($groupTags as $tag) {
- $like[] = array(\'OR:alias:LIKE\' => \'%\' . $tag . \'%\');
- }
- }
- $conditions[] = array(
- \'OR:Group.alias:=\' => $group,
- $like
- );
- $tagsCount += count($groupTags);
- }
- }
- }
- if (count($conditions) == 0) {
- return $modx->toJSON($where);
- }
- $c = $modx->newQuery(\'TaggerTag\');
- $c->leftJoin(\'TaggerGroup\', \'Group\');
- $c->where($conditions);
- } else {
- $tags = $tagger->explodeAndClean($tags);
- if (empty($tags)) {
- return $modx->toJSON($where);
- }
- $tagsCount = count($tags);
- $groups = $modx->getOption(\'groups\', $scriptProperties, \'\');
- $groups = $tagger->explodeAndClean($groups);
- $c = $modx->newQuery(\'TaggerTag\');
- $c->select($modx->getSelectColumns(\'TaggerTag\', \'TaggerTag\', \'\', array(\'id\')));
- $compare = array(
- $tagField . \':IN\' => $tags
- );
- if ($likeComparison == 1) {
- foreach ($tags as $tag) {
- $compare[] = array(\'OR:\' . $tagField . \':LIKE\' => \'%\' . $tag . \'%\');
- }
- }
- $c->where($compare);
- if (!empty($groups)) {
- $c->leftJoin(\'TaggerGroup\', \'Group\');
- $c->where(array(
- \'Group.id:IN\' => $groups,
- \'OR:Group.name:IN\' => $groups,
- \'OR:Group.alias:IN\' => $groups,
- ));
- }
- }
- $c->prepare();
- $c->stmt->execute();
- $tagIDs = $c->stmt->fetchAll(PDO::FETCH_COLUMN, 0);
- if (count($tagIDs) == 0) {
- $tagIDs[] = 0;
- }
- if ($matchAll == 0) {
- $where[] = "EXISTS (SELECT 1 FROM {$modx->getTableName(\'TaggerTagResource\')} r WHERE r.tag IN (" . implode(\',\', $tagIDs) . ") AND r.resource = modResource." . $field . ")";
- } else {
- $where[] = "EXISTS (SELECT 1 as found FROM {$modx->getTableName(\'TaggerTagResource\')} r WHERE r.tag IN (" . implode(\',\', $tagIDs) . ") AND r.resource = modResource." . $field . " GROUP BY found HAVING count(found) = " . $tagsCount . ")";
- }
- return $modx->toJSON($where);',
- 'locked' => false,
- 'properties' =>
- array (
- 'tags' =>
- array (
- 'name' => 'tags',
- 'desc' => 'tagger.getresourceswhere.tags_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => 'tagger:properties',
- 'area' => '',
- 'desc_trans' => 'Comma separated list of Tags for which will be generated a Resource query. By default Tags from GET param will be loaded',
- 'area_trans' => '',
- ),
- 'groups' =>
- array (
- 'name' => 'groups',
- 'desc' => 'tagger.getresourceswhere.groups_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => 'tagger:properties',
- 'area' => '',
- 'desc_trans' => 'Comma separated list of Tagger Groups. Only from those groups will Tags be allowed',
- 'area_trans' => '',
- ),
- 'where' =>
- array (
- 'name' => 'where',
- 'desc' => 'tagger.getresourceswhere.where_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => 'tagger:properties',
- 'area' => '',
- 'desc_trans' => 'Original getResources where property. If you used where property in your current getResources call, move it here',
- 'area_trans' => '',
- ),
- 'likeComparison' =>
- array (
- 'name' => 'likeComparison',
- 'desc' => 'tagger.getresourceswhere.likeComparison_desc',
- 'type' => 'numberfield',
- 'options' => '',
- 'value' => '0',
- 'lexicon' => 'tagger:properties',
- 'area' => '',
- 'desc_trans' => 'If set to 1, tags will compare using LIKE',
- 'area_trans' => '',
- ),
- 'tagField' =>
- array (
- 'name' => 'tagField',
- 'desc' => 'tagger.getresourceswhere.tagField_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => 'alias',
- 'lexicon' => 'tagger:properties',
- 'area' => '',
- 'desc_trans' => 'Field that will be used to compare with given tags. Default: alias',
- 'area_trans' => '',
- ),
- 'matchAll' =>
- array (
- 'name' => 'matchAll',
- 'desc' => 'tagger.getresourceswhere.matchAll_desc',
- 'type' => 'numberfield',
- 'options' => '',
- 'value' => '0',
- 'lexicon' => 'tagger:properties',
- 'area' => '',
- 'desc_trans' => 'If set to 1, resource must have all specified tags. Default: 0',
- 'area_trans' => '',
- ),
- ),
- 'moduleguid' => '',
- 'static' => false,
- 'static_file' => '',
- 'content' => '/**
- * TaggerGetResourcesWhere
- *
- * DESCRIPTION
- *
- * This snippet generate SQL Query that can be used in WHERE condition in getResources snippet
- *
- * PROPERTIES:
- *
- * &tags string optional Comma separated list of Tags for which will be generated a Resource query. By default Tags from GET param will be loaded
- * &groups string optional Comma separated list of Tagger Groups. Only from those groups will Tags be allowed
- * &where string optional Original getResources where property. If you used where property in your current getResources call, move it here
- * &likeComparison int optional If set to 1, tags will compare using LIKE
- * &tagField string optional Field that will be used to compare with given tags. Default: alias
- * &matchAll int optional If set to 1, resource must have all specified tags. Default: 0
- * &field string optional modResource field that will be used to compare with assigned resource ID
- *
- * USAGE:
- *
- * [[!getResources? &where=`[[!TaggerGetResourcesWhere? &tags=`Books,Vehicles` &where=`{"isfolder": 0}`]]`]]
- *
- */
- $tagger = $modx->getService(\'tagger\',\'Tagger\',$modx->getOption(\'tagger.core_path\',null,$modx->getOption(\'core_path\').\'components/tagger/\').\'model/tagger/\',$scriptProperties);
- if (!($tagger instanceof Tagger)) return \'\';
- $tags = $modx->getOption(\'tags\', $scriptProperties, \'\');
- $where = $modx->getOption(\'where\', $scriptProperties, \'\');
- $tagField = $modx->getOption(\'tagField\', $scriptProperties, \'alias\');
- $likeComparison = (int) $modx->getOption(\'likeComparison\', $scriptProperties, 0);
- $matchAll = (int) $modx->getOption(\'matchAll\', $scriptProperties, 0);
- $field = $modx->getOption(\'field\', $scriptProperties, \'id\');
- $where = $modx->fromJSON($where);
- if ($where == false) {
- $where = array();
- }
- $tagsCount = 0;
- if ($tags == \'\') {
- $gc = $modx->newQuery(\'TaggerGroup\');
- $gc->select($modx->getSelectColumns(\'TaggerGroup\', \'\', \'\', array(\'alias\')));
- $groups = $modx->getOption(\'groups\', $scriptProperties, \'\');
- $groups = $tagger->explodeAndClean($groups);
- if (!empty($groups)) {
- $gc->where(array(
- \'name:IN\' => $groups,
- \'OR:alias:IN\' => $groups,
- \'OR:id:IN\' => $groups,
- ));
- }
- $gc->prepare();
- $gc->stmt->execute();
- $groups = $gc->stmt->fetchAll(PDO::FETCH_COLUMN, 0);
- $conditions = array();
- foreach ($groups as $group) {
- if (isset($_GET[$group])) {
- $groupTags = $tagger->explodeAndClean($_GET[$group]);
- if (!empty($groupTags)) {
- $like = array(\'AND:alias:IN\' => $groupTags);
- if ($likeComparison == 1) {
- foreach ($groupTags as $tag) {
- $like[] = array(\'OR:alias:LIKE\' => \'%\' . $tag . \'%\');
- }
- }
- $conditions[] = array(
- \'OR:Group.alias:=\' => $group,
- $like
- );
- $tagsCount += count($groupTags);
- }
- }
- }
- if (count($conditions) == 0) {
- return $modx->toJSON($where);
- }
- $c = $modx->newQuery(\'TaggerTag\');
- $c->leftJoin(\'TaggerGroup\', \'Group\');
- $c->where($conditions);
- } else {
- $tags = $tagger->explodeAndClean($tags);
- if (empty($tags)) {
- return $modx->toJSON($where);
- }
- $tagsCount = count($tags);
- $groups = $modx->getOption(\'groups\', $scriptProperties, \'\');
- $groups = $tagger->explodeAndClean($groups);
- $c = $modx->newQuery(\'TaggerTag\');
- $c->select($modx->getSelectColumns(\'TaggerTag\', \'TaggerTag\', \'\', array(\'id\')));
- $compare = array(
- $tagField . \':IN\' => $tags
- );
- if ($likeComparison == 1) {
- foreach ($tags as $tag) {
- $compare[] = array(\'OR:\' . $tagField . \':LIKE\' => \'%\' . $tag . \'%\');
- }
- }
- $c->where($compare);
- if (!empty($groups)) {
- $c->leftJoin(\'TaggerGroup\', \'Group\');
- $c->where(array(
- \'Group.id:IN\' => $groups,
- \'OR:Group.name:IN\' => $groups,
- \'OR:Group.alias:IN\' => $groups,
- ));
- }
- }
- $c->prepare();
- $c->stmt->execute();
- $tagIDs = $c->stmt->fetchAll(PDO::FETCH_COLUMN, 0);
- if (count($tagIDs) == 0) {
- $tagIDs[] = 0;
- }
- if ($matchAll == 0) {
- $where[] = "EXISTS (SELECT 1 FROM {$modx->getTableName(\'TaggerTagResource\')} r WHERE r.tag IN (" . implode(\',\', $tagIDs) . ") AND r.resource = modResource." . $field . ")";
- } else {
- $where[] = "EXISTS (SELECT 1 as found FROM {$modx->getTableName(\'TaggerTagResource\')} r WHERE r.tag IN (" . implode(\',\', $tagIDs) . ") AND r.resource = modResource." . $field . " GROUP BY found HAVING count(found) = " . $tagsCount . ")";
- }
- return $modx->toJSON($where);',
- ),
- 'policies' =>
- array (
- 'web' =>
- array (
- ),
- ),
- 'source' =>
- array (
- ),
- ),
- 'getPage' =>
- array (
- 'fields' =>
- array (
- 'id' => 109,
- 'source' => 0,
- 'property_preprocess' => false,
- 'name' => 'getPage',
- 'description' => '<b>1.2.4-pl</b> A generic wrapper snippet for returning paged results and navigation from snippets that return limitable collections.',
- 'editor_type' => 0,
- 'category' => 0,
- 'cache_type' => 0,
- 'snippet' => '/**
- * @package getpage
- */
- $output = \'\';
- $properties =& $scriptProperties;
- $properties[\'page\'] = (isset($_GET[$properties[\'pageVarKey\']]) && ($page = intval($_GET[$properties[\'pageVarKey\']]))) ? $page : null;
- if ($properties[\'page\'] === null) {
- $properties[\'page\'] = (isset($_REQUEST[$properties[\'pageVarKey\']]) && ($page = intval($_REQUEST[$properties[\'pageVarKey\']]))) ? $page : 1;
- }
- $properties[\'limit\'] = (isset($_GET[\'limit\'])) ? intval($_GET[\'limit\']) : null;
- if ($properties[\'limit\'] === null) {
- $properties[\'limit\'] = (isset($_REQUEST[\'limit\'])) ? intval($_REQUEST[\'limit\']) : intval($limit);
- }
- $properties[\'offset\'] = (!empty($properties[\'limit\']) && !empty($properties[\'page\'])) ? ($properties[\'limit\'] * ($properties[\'page\'] - 1)) : 0;
- $properties[\'totalVar\'] = empty($totalVar) ? "total" : $totalVar;
- $properties[$properties[\'totalVar\']] = !empty($properties[$properties[\'totalVar\']]) && $total = intval($properties[$properties[\'totalVar\']]) ? $total : 0;
- $properties[\'pageOneLimit\'] = (!empty($pageOneLimit) && $pageOneLimit = intval($pageOneLimit)) ? $pageOneLimit : $properties[\'limit\'];
- $properties[\'actualLimit\'] = $properties[\'limit\'];
- $properties[\'pageLimit\'] = isset($pageLimit) && is_numeric($pageLimit) ? intval($pageLimit) : 5;
- $properties[\'element\'] = empty($element) ? \'\' : $element;
- $properties[\'elementClass\'] = empty($elementClass) ? \'modChunk\' : $elementClass;
- $properties[\'pageNavVar\'] = empty($pageNavVar) ? \'page.nav\' : $pageNavVar;
- $properties[\'pageNavTpl\'] = !isset($pageNavTpl) ? "<li[[+classes]]><a[[+classes]][[+title]] href=\\"[[+href]]\\">[[+pageNo]]</a></li>" : $pageNavTpl;
- $properties[\'pageNavOuterTpl\'] = !isset($pageNavOuterTpl) ? "[[+first]][[+prev]][[+pages]][[+next]][[+last]]" : $pageNavOuterTpl;
- $properties[\'pageActiveTpl\'] = !isset($pageActiveTpl) ? "<li[[+activeClasses:default=` class=\\"active\\"`]]><a[[+activeClasses:default=` class=\\"active\\"`]][[+title]] href=\\"[[+href]]\\">[[+pageNo]]</a></li>" : $pageActiveTpl;
- $properties[\'pageFirstTpl\'] = !isset($pageFirstTpl) ? "<li class=\\"control\\"><a[[+title]] href=\\"[[+href]]\\">First</a></li>" : $pageFirstTpl;
- $properties[\'pageLastTpl\'] = !isset($pageLastTpl) ? "<li class=\\"control\\"><a[[+title]] href=\\"[[+href]]\\">Last</a></li>" : $pageLastTpl;
- $properties[\'pagePrevTpl\'] = !isset($pagePrevTpl) ? "<li class=\\"control\\"><a[[+title]] href=\\"[[+href]]\\"><<</a></li>" : $pagePrevTpl;
- $properties[\'pageNextTpl\'] = !isset($pageNextTpl) ? "<li class=\\"control\\"><a[[+title]] href=\\"[[+href]]\\">>></a></li>" : $pageNextTpl;
- $properties[\'toPlaceholder\'] = !empty($toPlaceholder) ? $toPlaceholder : \'\';
- $properties[\'cache\'] = isset($cache) ? (boolean) $cache : (boolean) $modx->getOption(\'cache_resource\', null, false);
- if (empty($cache_key)) $properties[xPDO::OPT_CACHE_KEY] = $modx->getOption(\'cache_resource_key\', null, \'resource\');
- if (empty($cache_handler)) $properties[xPDO::OPT_CACHE_HANDLER] = $modx->getOption(\'cache_resource_handler\', null, \'xPDOFileCache\');
- if (empty($cache_expires)) $properties[xPDO::OPT_CACHE_EXPIRES] = (integer) $modx->getOption(\'cache_resource_expires\', null, 0);
- if ($properties[\'page\'] == 1 && $properties[\'pageOneLimit\'] !== $properties[\'actualLimit\']) {
- $properties[\'limit\'] = $properties[\'pageOneLimit\'];
- }
- if ($properties[\'cache\']) {
- $properties[\'cachePageKey\'] = $modx->resource->getCacheKey() . \'/\' . $properties[\'page\'] . \'/\' . md5(http_build_query($modx->request->getParameters()) . http_build_query($scriptProperties));
- $properties[\'cacheOptions\'] = array(
- xPDO::OPT_CACHE_KEY => $properties[xPDO::OPT_CACHE_KEY],
- xPDO::OPT_CACHE_HANDLER => $properties[xPDO::OPT_CACHE_HANDLER],
- xPDO::OPT_CACHE_EXPIRES => $properties[xPDO::OPT_CACHE_EXPIRES],
- );
- }
- $cached = false;
- if ($properties[\'cache\']) {
- if ($modx->getCacheManager()) {
- $cached = $modx->cacheManager->get($properties[\'cachePageKey\'], $properties[\'cacheOptions\']);
- }
- }
- if (empty($cached) || !isset($cached[\'properties\']) || !isset($cached[\'output\'])) {
- $elementObj = $modx->getObject($properties[\'elementClass\'], array(\'name\' => $properties[\'element\']));
- if ($elementObj) {
- $elementObj->setCacheable(false);
- if (!empty($properties[\'toPlaceholder\'])) {
- $elementObj->process($properties);
- $output = $modx->getPlaceholder($properties[\'toPlaceholder\']);
- } else {
- $output = $elementObj->process($properties);
- }
- }
- include_once $modx->getOption(\'getpage.core_path\',$properties,$modx->getOption(\'core_path\', $properties, MODX_CORE_PATH) . \'components/getpage/\').\'include.getpage.php\';
- $qs = $modx->request->getParameters();
- $properties[\'qs\'] =& $qs;
- $totalSet = $modx->getPlaceholder($properties[\'totalVar\']);
- $properties[$properties[\'totalVar\']] = (($totalSet = intval($totalSet)) ? $totalSet : $properties[$properties[\'totalVar\']]);
- if (!empty($properties[$properties[\'totalVar\']]) && !empty($properties[\'actualLimit\'])) {
- if ($properties[\'pageOneLimit\'] !== $properties[\'actualLimit\']) {
- $adjustedTotal = $properties[$properties[\'totalVar\']] - $properties[\'pageOneLimit\'];
- $properties[\'pageCount\'] = $adjustedTotal > 0 ? ceil($adjustedTotal / $properties[\'actualLimit\']) + 1 : 1;
- } else {
- $properties[\'pageCount\'] = ceil($properties[$properties[\'totalVar\']] / $properties[\'actualLimit\']);
- }
- } else {
- $properties[\'pageCount\'] = 1;
- }
- if (empty($properties[$properties[\'totalVar\']]) || empty($properties[\'actualLimit\']) || $properties[$properties[\'totalVar\']] <= $properties[\'actualLimit\'] || ($properties[\'page\'] == 1 && $properties[$properties[\'totalVar\']] <= $properties[\'pageOneLimit\'])) {
- $properties[\'page\'] = 1;
- } else {
- $pageNav = getpage_buildControls($modx, $properties);
- $properties[$properties[\'pageNavVar\']] = $modx->newObject(\'modChunk\')->process(array_merge($properties, $pageNav), $properties[\'pageNavOuterTpl\']);
- if ($properties[\'page\'] > 1) {
- $qs[$properties[\'pageVarKey\']] = $properties[\'page\'];
- }
- }
- $properties[\'firstItem\'] = $properties[\'offset\'] + 1;
- $properties[\'lastItem\'] = ($properties[\'offset\'] + $properties[\'limit\']) < $totalSet ? ($properties[\'offset\'] + $properties[\'limit\']) : $totalSet;
- $properties[\'pageUrl\'] = $modx->makeUrl($modx->resource->get(\'id\'), \'\', $qs);
- if ($properties[\'cache\'] && $modx->getCacheManager()) {
- $cached = array(\'properties\' => $properties, \'output\' => $output);
- $modx->cacheManager->set($properties[\'cachePageKey\'], $cached, $properties[xPDO::OPT_CACHE_EXPIRES], $properties[\'cacheOptions\']);
- }
- } else {
- $properties = $cached[\'properties\'];
- $output = $cached[\'output\'];
- }
- $modx->setPlaceholders($properties, $properties[\'namespace\']);
- if (!empty($properties[\'toPlaceholder\'])) {
- $modx->setPlaceholder($properties[\'toPlaceholder\'], $output);
- $output = \'\';
- }
- return $output;',
- 'locked' => false,
- 'properties' =>
- array (
- 'cache' =>
- array (
- 'name' => 'cache',
- 'desc' => 'If true, unique page requests will be cached according to addition cache properties.',
- 'type' => 'combo-boolean',
- 'options' =>
- array (
- ),
- 'value' => false,
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'If true, unique page requests will be cached according to addition cache properties.',
- 'area_trans' => '',
- ),
- 'cache_expires' =>
- array (
- 'name' => 'cache_expires',
- 'desc' => 'The number of seconds before the cached pages expire and must be regenerated; leave empty to use the cache provider option for cache_expires.',
- 'type' => 'textfield',
- 'options' =>
- array (
- ),
- 'value' => false,
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'The number of seconds before the cached pages expire and must be regenerated; leave empty to use the cache provider option for cache_expires.',
- 'area_trans' => '',
- ),
- 'cache_handler' =>
- array (
- 'name' => 'cache_handler',
- 'desc' => 'The cache provider implementation to use; leave empty unless you are caching to a custom cache_key.',
- 'type' => 'textfield',
- 'options' =>
- array (
- ),
- 'value' => false,
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'The cache provider implementation to use; leave empty unless you are caching to a custom cache_key.',
- 'area_trans' => '',
- ),
- 'cache_key' =>
- array (
- 'name' => 'cache_key',
- 'desc' => 'The key of the cache provider to use; leave empty to use the cache_resource_key cache partition (default is "resource").',
- 'type' => 'textfield',
- 'options' =>
- array (
- ),
- 'value' => false,
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'The key of the cache provider to use; leave empty to use the cache_resource_key cache partition (default is "resource").',
- 'area_trans' => '',
- ),
- 'elementClass' =>
- array (
- 'name' => 'elementClass',
- 'desc' => 'The class of element that will be called by the getPage snippet instance.',
- 'type' => 'textfield',
- 'options' =>
- array (
- ),
- 'value' => 'modSnippet',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'The class of element that will be called by the getPage snippet instance.',
- 'area_trans' => '',
- ),
- 'limit' =>
- array (
- 'name' => 'limit',
- 'desc' => 'The result limit per page; can be overridden in the $_REQUEST.',
- 'type' => 'textfield',
- 'options' =>
- array (
- ),
- 'value' => '10',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'The result limit per page; can be overridden in the $_REQUEST.',
- 'area_trans' => '',
- ),
- 'namespace' =>
- array (
- 'name' => 'namespace',
- 'desc' => 'An execution namespace that serves as a prefix for placeholders set by a specific instance of the getPage snippet.',
- 'type' => 'textfield',
- 'options' =>
- array (
- ),
- 'value' => '',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'An execution namespace that serves as a prefix for placeholders set by a specific instance of the getPage snippet.',
- 'area_trans' => '',
- ),
- 'offset' =>
- array (
- 'name' => 'offset',
- 'desc' => 'The offset, or record position to start at within the collection for rendering results for the current page; should be calculated based on page variable set in pageVarKey.',
- 'type' => 'textfield',
- 'options' =>
- array (
- ),
- 'value' => '0',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'The offset, or record position to start at within the collection for rendering results for the current page; should be calculated based on page variable set in pageVarKey.',
- 'area_trans' => '',
- ),
- 'page' =>
- array (
- 'name' => 'page',
- 'desc' => 'The page to display; this is determined based on the value indicated by the page variable set in pageVarKey, typically in the $_REQUEST.',
- 'type' => 'textfield',
- 'options' =>
- array (
- ),
- 'value' => '0',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'The page to display; this is determined based on the value indicated by the page variable set in pageVarKey, typically in the $_REQUEST.',
- 'area_trans' => '',
- ),
- 'pageActiveTpl' =>
- array (
- 'name' => 'pageActiveTpl',
- 'desc' => 'Content representing the current page navigation control.',
- 'type' => 'textfield',
- 'options' =>
- array (
- ),
- 'value' => '<li[[+activeClasses]]><a[[+activeClasses:default=` class="active"`]][[+title]] href="[[+href]]">[[+pageNo]]</a></li>',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'Content representing the current page navigation control.',
- 'area_trans' => '',
- ),
- 'pageFirstTpl' =>
- array (
- 'name' => 'pageFirstTpl',
- 'desc' => 'Content representing the first page navigation control.',
- 'type' => 'textfield',
- 'options' =>
- array (
- ),
- 'value' => '<li class="control"><a[[+classes]][[+title]] href="[[+href]]">First</a></li>',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'Content representing the first page navigation control.',
- 'area_trans' => '',
- ),
- 'pageLastTpl' =>
- array (
- 'name' => 'pageLastTpl',
- 'desc' => 'Content representing the last page navigation control.',
- 'type' => 'textfield',
- 'options' =>
- array (
- ),
- 'value' => '<li class="control"><a[[+classes]][[+title]] href="[[+href]]">Last</a></li>',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'Content representing the last page navigation control.',
- 'area_trans' => '',
- ),
- 'pageLimit' =>
- array (
- 'name' => 'pageLimit',
- 'desc' => 'The maximum number of pages to display when rendering paging controls',
- 'type' => 'textfield',
- 'options' =>
- array (
- ),
- 'value' => '5',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'The maximum number of pages to display when rendering paging controls',
- 'area_trans' => '',
- ),
- 'pageNavOuterTpl' =>
- array (
- 'name' => 'pageNavOuterTpl',
- 'desc' => 'Content representing the layout of the page navigation controls.',
- 'type' => 'textfield',
- 'options' =>
- array (
- ),
- 'value' => '[[+first]][[+prev]][[+pages]][[+next]][[+last]]',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'Content representing the layout of the page navigation controls.',
- 'area_trans' => '',
- ),
- 'pageNavScheme' =>
- array (
- 'name' => 'pageNavScheme',
- 'desc' => 'Optionally specify a scheme for use when generating page navigation links; will use link_tag_scheme if empty or not specified (default is empty).',
- 'type' => 'textfield',
- 'options' =>
- array (
- ),
- 'value' => '',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'Optionally specify a scheme for use when generating page navigation links; will use link_tag_scheme if empty or not specified (default is empty).',
- 'area_trans' => '',
- ),
- 'pageNavTpl' =>
- array (
- 'name' => 'pageNavTpl',
- 'desc' => 'Content representing a single page navigation control.',
- 'type' => 'textfield',
- 'options' =>
- array (
- ),
- 'value' => '<li[[+classes]]><a[[+classes]][[+title]] href="[[+href]]">[[+pageNo]]</a></li>',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'Content representing a single page navigation control.',
- 'area_trans' => '',
- ),
- 'pageNavVar' =>
- array (
- 'name' => 'pageNavVar',
- 'desc' => 'The key of a placeholder to be set with the paging navigation controls.',
- 'type' => 'textfield',
- 'options' =>
- array (
- ),
- 'value' => 'page.nav',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'The key of a placeholder to be set with the paging navigation controls.',
- 'area_trans' => '',
- ),
- 'pageNextTpl' =>
- array (
- 'name' => 'pageNextTpl',
- 'desc' => 'Content representing the next page navigation control.',
- 'type' => 'textfield',
- 'options' =>
- array (
- ),
- 'value' => '<li class="control"><a[[+classes]][[+title]] href="[[+href]]">>></a></li>',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'Content representing the next page navigation control.',
- 'area_trans' => '',
- ),
- 'pagePrevTpl' =>
- array (
- 'name' => 'pagePrevTpl',
- 'desc' => 'Content representing the previous page navigation control.',
- 'type' => 'textfield',
- 'options' =>
- array (
- ),
- 'value' => '<li class="control"><a[[+classes]][[+title]] href="[[+href]]"><<</a></li>',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'Content representing the previous page navigation control.',
- 'area_trans' => '',
- ),
- 'pageVarKey' =>
- array (
- 'name' => 'pageVarKey',
- 'desc' => 'The key of a property that indicates the current page.',
- 'type' => 'textfield',
- 'options' =>
- array (
- ),
- 'value' => 'page',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'The key of a property that indicates the current page.',
- 'area_trans' => '',
- ),
- 'totalVar' =>
- array (
- 'name' => 'totalVar',
- 'desc' => 'The key of a placeholder that must contain the total records in the limitable collection being paged.',
- 'type' => 'textfield',
- 'options' =>
- array (
- ),
- 'value' => 'total',
- 'lexicon' => NULL,
- 'area' => '',
- 'desc_trans' => 'The key of a placeholder that must contain the total records in the limitable collection being paged.',
- 'area_trans' => '',
- ),
- ),
- 'moduleguid' => '',
- 'static' => false,
- 'static_file' => '',
- 'content' => '/**
- * @package getpage
- */
- $output = \'\';
- $properties =& $scriptProperties;
- $properties[\'page\'] = (isset($_GET[$properties[\'pageVarKey\']]) && ($page = intval($_GET[$properties[\'pageVarKey\']]))) ? $page : null;
- if ($properties[\'page\'] === null) {
- $properties[\'page\'] = (isset($_REQUEST[$properties[\'pageVarKey\']]) && ($page = intval($_REQUEST[$properties[\'pageVarKey\']]))) ? $page : 1;
- }
- $properties[\'limit\'] = (isset($_GET[\'limit\'])) ? intval($_GET[\'limit\']) : null;
- if ($properties[\'limit\'] === null) {
- $properties[\'limit\'] = (isset($_REQUEST[\'limit\'])) ? intval($_REQUEST[\'limit\']) : intval($limit);
- }
- $properties[\'offset\'] = (!empty($properties[\'limit\']) && !empty($properties[\'page\'])) ? ($properties[\'limit\'] * ($properties[\'page\'] - 1)) : 0;
- $properties[\'totalVar\'] = empty($totalVar) ? "total" : $totalVar;
- $properties[$properties[\'totalVar\']] = !empty($properties[$properties[\'totalVar\']]) && $total = intval($properties[$properties[\'totalVar\']]) ? $total : 0;
- $properties[\'pageOneLimit\'] = (!empty($pageOneLimit) && $pageOneLimit = intval($pageOneLimit)) ? $pageOneLimit : $properties[\'limit\'];
- $properties[\'actualLimit\'] = $properties[\'limit\'];
- $properties[\'pageLimit\'] = isset($pageLimit) && is_numeric($pageLimit) ? intval($pageLimit) : 5;
- $properties[\'element\'] = empty($element) ? \'\' : $element;
- $properties[\'elementClass\'] = empty($elementClass) ? \'modChunk\' : $elementClass;
- $properties[\'pageNavVar\'] = empty($pageNavVar) ? \'page.nav\' : $pageNavVar;
- $properties[\'pageNavTpl\'] = !isset($pageNavTpl) ? "<li[[+classes]]><a[[+classes]][[+title]] href=\\"[[+href]]\\">[[+pageNo]]</a></li>" : $pageNavTpl;
- $properties[\'pageNavOuterTpl\'] = !isset($pageNavOuterTpl) ? "[[+first]][[+prev]][[+pages]][[+next]][[+last]]" : $pageNavOuterTpl;
- $properties[\'pageActiveTpl\'] = !isset($pageActiveTpl) ? "<li[[+activeClasses:default=` class=\\"active\\"`]]><a[[+activeClasses:default=` class=\\"active\\"`]][[+title]] href=\\"[[+href]]\\">[[+pageNo]]</a></li>" : $pageActiveTpl;
- $properties[\'pageFirstTpl\'] = !isset($pageFirstTpl) ? "<li class=\\"control\\"><a[[+title]] href=\\"[[+href]]\\">First</a></li>" : $pageFirstTpl;
- $properties[\'pageLastTpl\'] = !isset($pageLastTpl) ? "<li class=\\"control\\"><a[[+title]] href=\\"[[+href]]\\">Last</a></li>" : $pageLastTpl;
- $properties[\'pagePrevTpl\'] = !isset($pagePrevTpl) ? "<li class=\\"control\\"><a[[+title]] href=\\"[[+href]]\\"><<</a></li>" : $pagePrevTpl;
- $properties[\'pageNextTpl\'] = !isset($pageNextTpl) ? "<li class=\\"control\\"><a[[+title]] href=\\"[[+href]]\\">>></a></li>" : $pageNextTpl;
- $properties[\'toPlaceholder\'] = !empty($toPlaceholder) ? $toPlaceholder : \'\';
- $properties[\'cache\'] = isset($cache) ? (boolean) $cache : (boolean) $modx->getOption(\'cache_resource\', null, false);
- if (empty($cache_key)) $properties[xPDO::OPT_CACHE_KEY] = $modx->getOption(\'cache_resource_key\', null, \'resource\');
- if (empty($cache_handler)) $properties[xPDO::OPT_CACHE_HANDLER] = $modx->getOption(\'cache_resource_handler\', null, \'xPDOFileCache\');
- if (empty($cache_expires)) $properties[xPDO::OPT_CACHE_EXPIRES] = (integer) $modx->getOption(\'cache_resource_expires\', null, 0);
- if ($properties[\'page\'] == 1 && $properties[\'pageOneLimit\'] !== $properties[\'actualLimit\']) {
- $properties[\'limit\'] = $properties[\'pageOneLimit\'];
- }
- if ($properties[\'cache\']) {
- $properties[\'cachePageKey\'] = $modx->resource->getCacheKey() . \'/\' . $properties[\'page\'] . \'/\' . md5(http_build_query($modx->request->getParameters()) . http_build_query($scriptProperties));
- $properties[\'cacheOptions\'] = array(
- xPDO::OPT_CACHE_KEY => $properties[xPDO::OPT_CACHE_KEY],
- xPDO::OPT_CACHE_HANDLER => $properties[xPDO::OPT_CACHE_HANDLER],
- xPDO::OPT_CACHE_EXPIRES => $properties[xPDO::OPT_CACHE_EXPIRES],
- );
- }
- $cached = false;
- if ($properties[\'cache\']) {
- if ($modx->getCacheManager()) {
- $cached = $modx->cacheManager->get($properties[\'cachePageKey\'], $properties[\'cacheOptions\']);
- }
- }
- if (empty($cached) || !isset($cached[\'properties\']) || !isset($cached[\'output\'])) {
- $elementObj = $modx->getObject($properties[\'elementClass\'], array(\'name\' => $properties[\'element\']));
- if ($elementObj) {
- $elementObj->setCacheable(false);
- if (!empty($properties[\'toPlaceholder\'])) {
- $elementObj->process($properties);
- $output = $modx->getPlaceholder($properties[\'toPlaceholder\']);
- } else {
- $output = $elementObj->process($properties);
- }
- }
- include_once $modx->getOption(\'getpage.core_path\',$properties,$modx->getOption(\'core_path\', $properties, MODX_CORE_PATH) . \'components/getpage/\').\'include.getpage.php\';
- $qs = $modx->request->getParameters();
- $properties[\'qs\'] =& $qs;
- $totalSet = $modx->getPlaceholder($properties[\'totalVar\']);
- $properties[$properties[\'totalVar\']] = (($totalSet = intval($totalSet)) ? $totalSet : $properties[$properties[\'totalVar\']]);
- if (!empty($properties[$properties[\'totalVar\']]) && !empty($properties[\'actualLimit\'])) {
- if ($properties[\'pageOneLimit\'] !== $properties[\'actualLimit\']) {
- $adjustedTotal = $properties[$properties[\'totalVar\']] - $properties[\'pageOneLimit\'];
- $properties[\'pageCount\'] = $adjustedTotal > 0 ? ceil($adjustedTotal / $properties[\'actualLimit\']) + 1 : 1;
- } else {
- $properties[\'pageCount\'] = ceil($properties[$properties[\'totalVar\']] / $properties[\'actualLimit\']);
- }
- } else {
- $properties[\'pageCount\'] = 1;
- }
- if (empty($properties[$properties[\'totalVar\']]) || empty($properties[\'actualLimit\']) || $properties[$properties[\'totalVar\']] <= $properties[\'actualLimit\'] || ($properties[\'page\'] == 1 && $properties[$properties[\'totalVar\']] <= $properties[\'pageOneLimit\'])) {
- $properties[\'page\'] = 1;
- } else {
- $pageNav = getpage_buildControls($modx, $properties);
- $properties[$properties[\'pageNavVar\']] = $modx->newObject(\'modChunk\')->process(array_merge($properties, $pageNav), $properties[\'pageNavOuterTpl\']);
- if ($properties[\'page\'] > 1) {
- $qs[$properties[\'pageVarKey\']] = $properties[\'page\'];
- }
- }
- $properties[\'firstItem\'] = $properties[\'offset\'] + 1;
- $properties[\'lastItem\'] = ($properties[\'offset\'] + $properties[\'limit\']) < $totalSet ? ($properties[\'offset\'] + $properties[\'limit\']) : $totalSet;
- $properties[\'pageUrl\'] = $modx->makeUrl($modx->resource->get(\'id\'), \'\', $qs);
- if ($properties[\'cache\'] && $modx->getCacheManager()) {
- $cached = array(\'properties\' => $properties, \'output\' => $output);
- $modx->cacheManager->set($properties[\'cachePageKey\'], $cached, $properties[xPDO::OPT_CACHE_EXPIRES], $properties[\'cacheOptions\']);
- }
- } else {
- $properties = $cached[\'properties\'];
- $output = $cached[\'output\'];
- }
- $modx->setPlaceholders($properties, $properties[\'namespace\']);
- if (!empty($properties[\'toPlaceholder\'])) {
- $modx->setPlaceholder($properties[\'toPlaceholder\'], $output);
- $output = \'\';
- }
- return $output;',
- ),
- 'policies' =>
- array (
- 'web' =>
- array (
- ),
- ),
- 'source' =>
- array (
- ),
- ),
- 'phpthumbof' =>
- array (
- 'fields' =>
- array (
- 'id' => 97,
- 'source' => 0,
- 'property_preprocess' => false,
- 'name' => 'phpthumbof',
- 'description' => 'Identical to pthumb. Retained for backwards compatibility.
- Documentation: https://github.com/oo12/phpThumbOf',
- 'editor_type' => 0,
- 'category' => 33,
- 'cache_type' => 0,
- 'snippet' => '/**
- * pThumb
- * Copyright 2013-2014 Jason Grant
- *
- * Please see the GitHub page for documentation or to report bugs:
- * https://github.com/oo12/phpThumbOf
- *
- * Forked from phpThumbOf 1.4.0
- * Copyright 2009-2012 by Shaun McCormick <shaun@modx.com>
- *
- * pThumb is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option) any
- * later version.
- *
- * pThumb is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * phpThumbOf; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
- /**
- *
- * @var modX $modx
- * @var array $scriptProperties
- * @var string $input
- * @var string|array $options
- *
- */
- if (empty($input)) { // Exit quietly if no file name given
- return;
- }
- $scriptProperties[\'debug\'] = isset($debug) ? $debug : false;
- static $pt_settings = array();
- if (empty($pt_settings)) {
- if (!$modx->loadClass(\'phpThumbOf\', MODX_CORE_PATH . \'components/phpthumbof/model/\', true, true)) {
- $modx->log(modX::LOG_LEVEL_ERROR, \'[pThumb] Could not load phpThumbOf class.\');
- return $input;
- }
- }
- $pThumb = new phpThumbOf($modx, $pt_settings, $scriptProperties);
- $result = $pThumb->createThumbnail($input, $options);
- if (!empty($toPlaceholder) || $result[\'outputDims\']) {
- if ($result[\'width\'] === \'\' && $result[\'file\'] && $dims = getimagesize($result[\'file\']) ) {
- $result[\'width\'] = $dims[0];
- $result[\'height\'] = $dims[1];
- }
- if (!empty($toPlaceholder)) {
- $modx->setPlaceholders(array(
- $toPlaceholder => $result[\'src\'],
- "$toPlaceholder.width" => $result[\'width\'],
- "$toPlaceholder.height" => $result[\'height\']
- ));
- $output = \'\';
- }
- if ($result[\'outputDims\']) {
- $output = "src=\\"{$result[\'src\']}\\"" . ($result[\'width\'] ? " width=\\"{$result[\'width\']}\\" height=\\"{$result[\'height\']}\\"" : \'\');
- }
- }
- else {
- $output = $result[\'src\'];
- }
- if ($debug && $result[\'success\']) { // if debugging is on and createThumbnail was successful, log the debug info
- $pThumb->debugmsg(isset($pThumb->phpThumb->debugmessages) ? \':: Processed ::\' : ":: Loaded from cache: {$result[\'src\']}", true);
- }
- return $output;',
- 'locked' => false,
- 'properties' =>
- array (
- 'debug' =>
- array (
- 'name' => 'debug',
- 'desc' => 'prop_pthumb.debug_desc',
- 'type' => 'combo-boolean',
- 'options' =>
- array (
- ),
- 'value' => false,
- 'lexicon' => 'phpthumbof:default',
- 'area' => '',
- 'desc_trans' => 'Write debug messages to the MODX error log.',
- 'area_trans' => '',
- ),
- ),
- 'moduleguid' => '',
- 'static' => false,
- 'static_file' => '',
- 'content' => '/**
- * pThumb
- * Copyright 2013-2014 Jason Grant
- *
- * Please see the GitHub page for documentation or to report bugs:
- * https://github.com/oo12/phpThumbOf
- *
- * Forked from phpThumbOf 1.4.0
- * Copyright 2009-2012 by Shaun McCormick <shaun@modx.com>
- *
- * pThumb is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option) any
- * later version.
- *
- * pThumb is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * phpThumbOf; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
- /**
- *
- * @var modX $modx
- * @var array $scriptProperties
- * @var string $input
- * @var string|array $options
- *
- */
- if (empty($input)) { // Exit quietly if no file name given
- return;
- }
- $scriptProperties[\'debug\'] = isset($debug) ? $debug : false;
- static $pt_settings = array();
- if (empty($pt_settings)) {
- if (!$modx->loadClass(\'phpThumbOf\', MODX_CORE_PATH . \'components/phpthumbof/model/\', true, true)) {
- $modx->log(modX::LOG_LEVEL_ERROR, \'[pThumb] Could not load phpThumbOf class.\');
- return $input;
- }
- }
- $pThumb = new phpThumbOf($modx, $pt_settings, $scriptProperties);
- $result = $pThumb->createThumbnail($input, $options);
- if (!empty($toPlaceholder) || $result[\'outputDims\']) {
- if ($result[\'width\'] === \'\' && $result[\'file\'] && $dims = getimagesize($result[\'file\']) ) {
- $result[\'width\'] = $dims[0];
- $result[\'height\'] = $dims[1];
- }
- if (!empty($toPlaceholder)) {
- $modx->setPlaceholders(array(
- $toPlaceholder => $result[\'src\'],
- "$toPlaceholder.width" => $result[\'width\'],
- "$toPlaceholder.height" => $result[\'height\']
- ));
- $output = \'\';
- }
- if ($result[\'outputDims\']) {
- $output = "src=\\"{$result[\'src\']}\\"" . ($result[\'width\'] ? " width=\\"{$result[\'width\']}\\" height=\\"{$result[\'height\']}\\"" : \'\');
- }
- }
- else {
- $output = $result[\'src\'];
- }
- if ($debug && $result[\'success\']) { // if debugging is on and createThumbnail was successful, log the debug info
- $pThumb->debugmsg(isset($pThumb->phpThumb->debugmessages) ? \':: Processed ::\' : ":: Loaded from cache: {$result[\'src\']}", true);
- }
- return $output;',
- ),
- 'policies' =>
- array (
- 'web' =>
- array (
- ),
- ),
- 'source' =>
- array (
- ),
- ),
- 'FormIt' =>
- array (
- 'fields' =>
- array (
- 'id' => 16,
- 'source' => 0,
- 'property_preprocess' => false,
- 'name' => 'FormIt',
- 'description' => 'A dynamic form processing snippet.',
- 'editor_type' => 0,
- 'category' => 8,
- 'cache_type' => 0,
- 'snippet' => '/**
- * FormIt
- *
- * Copyright 2009-2012 by Shaun McCormick <shaun@modx.com>
- *
- * FormIt is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option) any
- * later version.
- *
- * FormIt is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * FormIt; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
- * Suite 330, Boston, MA 02111-1307 USA
- *
- * @package formit
- */
- /**
- * FormIt
- *
- * A dynamic form processing Snippet for MODx Revolution.
- *
- * @var modX $modx
- * @var array $scriptProperties
- *
- * @package formit
- */
- $modelPath = $modx->getOption(
- \'formit.core_path\',
- null,
- $modx->getOption(\'core_path\', null, MODX_CORE_PATH) . \'components/formit/\'
- ) . \'model/formit/\';
- $modx->loadClass(\'FormIt\', $modelPath, true, true);
- $fi = new FormIt($modx, $scriptProperties);
- $fi->initialize($modx->context->get(\'key\'));
- $fi->loadRequest();
- $fields = $fi->request->prepare();
- return $fi->request->handle($fields);',
- 'locked' => false,
- 'properties' =>
- array (
- 'hooks' =>
- array (
- 'name' => 'hooks',
- 'desc' => 'prop_formit.hooks_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'What scripts to fire, if any, after the form passes validation. This can be a comma-separated list of hooks, and if the first fails, the proceeding ones will not fire. A hook can also be a Snippet name that will execute that Snippet.',
- 'area_trans' => '',
- ),
- 'preHooks' =>
- array (
- 'name' => 'preHooks',
- 'desc' => 'prop_formit.prehooks_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'What scripts to fire, if any, once the form loads. You can pre-set form fields via $scriptProperties[`hook`]->fields[`fieldname`]. This can be a comma-separated list of hooks, and if the first fails, the proceeding ones will not fire. A hook can also be a Snippet name that will execute that Snippet.',
- 'area_trans' => '',
- ),
- 'submitVar' =>
- array (
- 'name' => 'submitVar',
- 'desc' => 'prop_formit.submitvar_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'If set, will not begin form processing if this POST variable is not passed.',
- 'area_trans' => '',
- ),
- 'validate' =>
- array (
- 'name' => 'validate',
- 'desc' => 'prop_formit.validate_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'A comma-separated list of fields to validate, with each field name as name:validator (eg: username:required,email:required). Validators can also be chained, like email:email:required. This property can be specified on multiple lines.',
- 'area_trans' => '',
- ),
- 'errTpl' =>
- array (
- 'name' => 'errTpl',
- 'desc' => 'prop_formit.errtpl_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '<span class="error">[[+error]]</span>',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'The wrapper template for error messages.',
- 'area_trans' => '',
- ),
- 'validationErrorMessage' =>
- array (
- 'name' => 'validationErrorMessage',
- 'desc' => 'prop_formit.validationerrormessage_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '<p class="error">A form validation error occurred. Please check the values you have entered.</p>',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'A general error message to set to a placeholder if validation fails. Can contain [[+errors]] if you want to display a list of all errors at the top.',
- 'area_trans' => '',
- ),
- 'validationErrorBulkTpl' =>
- array (
- 'name' => 'validationErrorBulkTpl',
- 'desc' => 'prop_formit.validationerrorbulktpl_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '<li>[[+error]]</li>',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'HTML tpl that is used for each individual error in the generic validation error message value.',
- 'area_trans' => '',
- ),
- 'trimValuesBeforeValidation' =>
- array (
- 'name' => 'trimValuesBeforeValidation',
- 'desc' => 'prop_formit.trimvaluesdeforevalidation_desc',
- 'type' => 'combo-boolean',
- 'options' => '',
- 'value' => true,
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'Whether or not to trim spaces from the beginning and end of values before attempting validation. Defaults to true.',
- 'area_trans' => '',
- ),
- 'customValidators' =>
- array (
- 'name' => 'customValidators',
- 'desc' => 'prop_formit.customvalidators_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'A comma-separated list of custom validator names (snippets) you plan to use in this form. They must be explicitly stated here, or they will not be run.',
- 'area_trans' => '',
- ),
- 'clearFieldsOnSuccess' =>
- array (
- 'name' => 'clearFieldsOnSuccess',
- 'desc' => 'prop_formit.clearfieldsonsuccess_desc',
- 'type' => 'combo-boolean',
- 'options' => '',
- 'value' => true,
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'If true, will clear the fields on a successful form submission that does not redirect.',
- 'area_trans' => '',
- ),
- 'successMessage' =>
- array (
- 'name' => 'successMessage',
- 'desc' => 'prop_formit.successmessage_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'If set, will set this a placeholder with the name of the value of the property &successMessagePlaceholder, which defaults to `fi.successMessage`.',
- 'area_trans' => '',
- ),
- 'successMessagePlaceholder' =>
- array (
- 'name' => 'successMessagePlaceholder',
- 'desc' => 'prop_formit.successmessageplaceholder_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => 'fi.successMessage',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'The placeholder to set the success message to.',
- 'area_trans' => '',
- ),
- 'store' =>
- array (
- 'name' => 'store',
- 'desc' => 'prop_formit.store_desc',
- 'type' => 'combo-boolean',
- 'options' => '',
- 'value' => false,
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'If true, will store the data in the cache for retrieval using the FormItRetriever snippet.',
- 'area_trans' => '',
- ),
- 'placeholderPrefix' =>
- array (
- 'name' => 'placeholderPrefix',
- 'desc' => 'prop_formit.placeholderprefix_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => 'fi.',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'The prefix to use for all placeholders set by FormIt for fields. Defaults to `fi.`',
- 'area_trans' => '',
- ),
- 'storeTime' =>
- array (
- 'name' => 'storeTime',
- 'desc' => 'prop_formit.storetime_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '300',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'If `store` is set to true, this specifies the number of seconds to store the data from the form submission. Defaults to five minutes.',
- 'area_trans' => '',
- ),
- 'storeLocation' =>
- array (
- 'name' => 'storeLocation',
- 'desc' => 'prop_formit.storelocation_desc',
- 'type' => 'list',
- 'options' =>
- array (
- 0 =>
- array (
- 'value' => 'cache',
- 'text' => 'formit.opt_cache',
- 'name' => 'MODX Cache',
- ),
- 1 =>
- array (
- 'value' => 'session',
- 'text' => 'formit.opt_session',
- 'name' => 'Session',
- ),
- ),
- 'value' => 'cache',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'If `store` is set to true, this specifies the cache location of the data from the form submission. Defaults to MODX cache.',
- 'area_trans' => '',
- ),
- 'allowFiles' =>
- array (
- 'name' => 'allowFiles',
- 'desc' => 'prop_formit.allowfiles_desc',
- 'type' => 'combo-boolean',
- 'options' => '',
- 'value' => true,
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'If set to 0, will prevent files from being submitted on the form.',
- 'area_trans' => '',
- ),
- 'spamEmailFields' =>
- array (
- 'name' => 'spamEmailFields',
- 'desc' => 'prop_formit.spamemailfields_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => 'email',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'If `spam` is set as a hook, a comma-separated list of fields containing emails to check spam against.',
- 'area_trans' => '',
- ),
- 'spamCheckIp' =>
- array (
- 'name' => 'spamCheckIp',
- 'desc' => 'prop_formit.spamcheckip_desc',
- 'type' => 'combo-boolean',
- 'options' => '',
- 'value' => false,
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'If `spam` is set as a hook, and this is true, will check the IP as well.',
- 'area_trans' => '',
- ),
- 'recaptchaJs' =>
- array (
- 'name' => 'recaptchaJs',
- 'desc' => 'prop_formit.recaptchajs_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '{}',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'If `recaptcha` is set as a hook, this can be a JSON object that will be set to the JS RecaptchaOptions variable, which configures options for reCaptcha.',
- 'area_trans' => '',
- ),
- 'recaptchaTheme' =>
- array (
- 'name' => 'recaptchaTheme',
- 'desc' => 'prop_formit.recaptchatheme_desc',
- 'type' => 'list',
- 'options' =>
- array (
- 0 =>
- array (
- 'value' => 'red',
- 'text' => 'formit.opt_red',
- 'name' => 'Red',
- ),
- 1 =>
- array (
- 'value' => 'white',
- 'text' => 'formit.opt_white',
- 'name' => 'White',
- ),
- 2 =>
- array (
- 'value' => 'clean',
- 'text' => 'formit.opt_clean',
- 'name' => 'Clean',
- ),
- 3 =>
- array (
- 'value' => 'blackglass',
- 'text' => 'formit.opt_blackglass',
- 'name' => 'Black Glass',
- ),
- ),
- 'value' => 'clean',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'If `recaptcha` is set as a hook, this will select a theme for the reCaptcha widget.',
- 'area_trans' => '',
- ),
- 'redirectTo' =>
- array (
- 'name' => 'redirectTo',
- 'desc' => 'prop_formit.redirectto_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'If `redirect` is set as a hook, this must specify the Resource ID to redirect to.',
- 'area_trans' => '',
- ),
- 'redirectParams' =>
- array (
- 'name' => 'redirectParams',
- 'desc' => 'prop_formit.redirectparams_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'A JSON array of parameters to pass to the redirect hook that will be passed when redirecting.',
- 'area_trans' => '',
- ),
- 'emailTo' =>
- array (
- 'name' => 'emailTo',
- 'desc' => 'prop_formit.emailto_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'If `email` is set as a hook, then this specifies the email(s) to send the email to. Can be a comma-separated list of email addresses.',
- 'area_trans' => '',
- ),
- 'emailToName' =>
- array (
- 'name' => 'emailToName',
- 'desc' => 'prop_formit.emailtoname_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'Optional. If `email` is set as a hook, then this must be a parallel list of comma-separated names for the email addresses specified in the `emailTo` property.',
- 'area_trans' => '',
- ),
- 'emailFrom' =>
- array (
- 'name' => 'emailFrom',
- 'desc' => 'prop_formit.emailfrom_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'Optional. If `email` is set as a hook, and this is set, will specify the From: address for the email. If not set, will first look for an `email` form field. If none is found, will default to the `emailsender` system setting.',
- 'area_trans' => '',
- ),
- 'emailFromName' =>
- array (
- 'name' => 'emailFromName',
- 'desc' => 'prop_formit.emailfromname_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'Optional. If `email` is set as a hook, and this is set, will specify the From: name for the email.',
- 'area_trans' => '',
- ),
- 'emailReplyTo' =>
- array (
- 'name' => 'emailReplyTo',
- 'desc' => 'prop_formit.emailreplyto_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'Optional. If `email` is set as a hook, and this is set, will specify the Reply-To: address for the email.',
- 'area_trans' => '',
- ),
- 'emailReplyToName' =>
- array (
- 'name' => 'emailReplyToName',
- 'desc' => 'prop_formit.emailreplytoname_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'Optional. If `email` is set as a hook, and this is set, will specify the Reply-To: name for the email.',
- 'area_trans' => '',
- ),
- 'emailCC' =>
- array (
- 'name' => 'emailCC',
- 'desc' => 'prop_formit.emailcc_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'If `email` is set as a hook, then this specifies the email(s) to send the email to as a CC. Can be a comma-separated list of email addresses.',
- 'area_trans' => '',
- ),
- 'emailCCName' =>
- array (
- 'name' => 'emailCCName',
- 'desc' => 'prop_formit.emailccname_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'Optional. If `email` is set as a hook, then this must be a parallel list of comma-separated names for the email addresses specified in the `emailCC` property.',
- 'area_trans' => '',
- ),
- 'emailBCC' =>
- array (
- 'name' => 'emailBCC',
- 'desc' => 'prop_formit.emailbcc_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'If `email` is set as a hook, then this specifies the email(s) to send the email to as a BCC. Can be a comma-separated list of email addresses.',
- 'area_trans' => '',
- ),
- 'emailBCCName' =>
- array (
- 'name' => 'emailBCCName',
- 'desc' => 'prop_formit.emailbccname_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'Optional. If `email` is set as a hook, then this must be a parallel list of comma-separated names for the email addresses specified in the `emailBCC` property.',
- 'area_trans' => '',
- ),
- 'emailReturnPath' =>
- array (
- 'name' => 'emailReturnPath',
- 'desc' => 'prop_formit.emailreturnpath_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'Optional. If `email` is set as a hook, and this is set, will specify the Return-path: address for the email. If not set, will take the value of `emailFrom` property.',
- 'area_trans' => '',
- ),
- 'emailSubject' =>
- array (
- 'name' => 'emailSubject',
- 'desc' => 'prop_formit.emailsubject_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'If `email` is set as a hook, this is required as a subject line for the email.',
- 'area_trans' => '',
- ),
- 'emailUseFieldForSubject' =>
- array (
- 'name' => 'emailUseFieldForSubject',
- 'desc' => 'prop_formit.emailusefieldforsubject_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'If the field `subject` is passed into the form, if this is true, it will use the field content for the subject line of the email.',
- 'area_trans' => '',
- ),
- 'emailHtml' =>
- array (
- 'name' => 'emailHtml',
- 'desc' => 'prop_formit.emailhtml_desc',
- 'type' => 'combo-boolean',
- 'options' => '',
- 'value' => true,
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'Optional. If `email` is set as a hook, this toggles HTML emails or not. Defaults to true.',
- 'area_trans' => '',
- ),
- 'emailConvertNewlines' =>
- array (
- 'name' => 'emailConvertNewlines',
- 'desc' => 'prop_formit.emailconvertnewlines_desc',
- 'type' => 'combo-boolean',
- 'options' => '',
- 'value' => false,
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'If true and emailHtml is set to 1, will convert newlines to BR tags in the email.',
- 'area_trans' => '',
- ),
- 'emailMultiWrapper' =>
- array (
- 'name' => 'emailMultiWrapper',
- 'desc' => 'prop_formit.emailmultiwrapper_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '[[+value]]',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'Will wrap each item in a collection of fields sent via checkboxes/multi-selects. Defaults to just the value.',
- 'area_trans' => '',
- ),
- 'emailMultiSeparator' =>
- array (
- 'name' => 'emailMultiSeparator',
- 'desc' => 'prop_formit.emailmultiseparator_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'The default separator for collections of items sent through checkboxes/multi-selects. Defaults to a newline.',
- 'area_trans' => '',
- ),
- 'fiarTpl' =>
- array (
- 'name' => 'fiarTpl',
- 'desc' => 'prop_formit.fiartpl_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'prop_formit.fiartpl_desc',
- 'area_trans' => '',
- ),
- 'fiarToField' =>
- array (
- 'name' => 'fiarToField',
- 'desc' => 'prop_formit.fiartofield_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => 'email',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'prop_formit.fiartofield_desc',
- 'area_trans' => '',
- ),
- 'fiarSubject' =>
- array (
- 'name' => 'fiarSubject',
- 'desc' => 'prop_formit.fiarsubject_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '[[++site_name]] Auto-Responder',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'prop_formit.fiarsubject_desc',
- 'area_trans' => '',
- ),
- 'fiarFrom' =>
- array (
- 'name' => 'fiarFrom',
- 'desc' => 'prop_formit.fiarfrom_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'prop_formit.fiarfrom_desc',
- 'area_trans' => '',
- ),
- 'fiarFromName' =>
- array (
- 'name' => 'fiarFromName',
- 'desc' => 'prop_formit.fiarfromname_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'prop_formit.fiarfromname_desc',
- 'area_trans' => '',
- ),
- 'fiarReplyTo' =>
- array (
- 'name' => 'fiarReplyTo',
- 'desc' => 'prop_formit.fiarreplyto_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'prop_formit.fiarreplyto_desc',
- 'area_trans' => '',
- ),
- 'fiarReplyToName' =>
- array (
- 'name' => 'fiarReplyToName',
- 'desc' => 'prop_formit.fiarreplytoname_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'prop_formit.fiarreplytoname_desc',
- 'area_trans' => '',
- ),
- 'fiarCC' =>
- array (
- 'name' => 'fiarCC',
- 'desc' => 'prop_formit.fiarcc_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'prop_formit.fiarcc_desc',
- 'area_trans' => '',
- ),
- 'fiarCCName' =>
- array (
- 'name' => 'fiarCCName',
- 'desc' => 'prop_fiar.fiarccname_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'Optional. If `FormItAutoResponder` is set as a hook, then this must be a parallel list of comma-separated names for the email addresses specified in the `emailCC` property.',
- 'area_trans' => '',
- ),
- 'fiarBCC' =>
- array (
- 'name' => 'fiarBCC',
- 'desc' => 'prop_formit.fiarbcc_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'prop_formit.fiarbcc_desc',
- 'area_trans' => '',
- ),
- 'fiarBCCName' =>
- array (
- 'name' => 'fiarBCCName',
- 'desc' => 'prop_formit.fiarbccname_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'prop_formit.fiarbccname_desc',
- 'area_trans' => '',
- ),
- 'fiarHtml' =>
- array (
- 'name' => 'fiarHtml',
- 'desc' => 'prop_formit.fiarhtml_desc',
- 'type' => 'combo-boolean',
- 'options' => '',
- 'value' => true,
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'prop_formit.fiarhtml_desc',
- 'area_trans' => '',
- ),
- 'mathMinRange' =>
- array (
- 'name' => 'mathMinRange',
- 'desc' => 'prop_formit.mathminrange_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '10',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'prop_formit.mathminrange_desc',
- 'area_trans' => '',
- ),
- 'mathMaxRange' =>
- array (
- 'name' => 'mathMaxRange',
- 'desc' => 'prop_formit.mathmaxrange_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => '100',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'prop_formit.mathmaxrange_desc',
- 'area_trans' => '',
- ),
- 'mathField' =>
- array (
- 'name' => 'mathField',
- 'desc' => 'prop_formit.mathfield_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => 'math',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'prop_formit.mathfield_desc',
- 'area_trans' => '',
- ),
- 'mathOp1Field' =>
- array (
- 'name' => 'mathOp1Field',
- 'desc' => 'prop_formit.mathop1field_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => 'op1',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'prop_formit.mathop1field_desc',
- 'area_trans' => '',
- ),
- 'mathOp2Field' =>
- array (
- 'name' => 'mathOp2Field',
- 'desc' => 'prop_formit.mathop2field_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => 'op2',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'prop_formit.mathop2field_desc',
- 'area_trans' => '',
- ),
- 'mathOperatorField' =>
- array (
- 'name' => 'mathOperatorField',
- 'desc' => 'prop_formit.mathoperatorfield_desc',
- 'type' => 'textfield',
- 'options' => '',
- 'value' => 'operator',
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'prop_formit.mathoperatorfield_desc',
- 'area_trans' => '',
- ),
- 'saveTmpFiles' =>
- array (
- 'name' => 'saveTmpFiles',
- 'desc' => 'prop_formit.savetmpfiles_desc',
- 'type' => 'combo-boolean',
- 'options' => '',
- 'value' => false,
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'If set to 1, FormIt will store submitted files in a temporary folder.',
- 'area_trans' => '',
- ),
- 'attachFilesToEmail' =>
- array (
- 'name' => 'attachFilesToEmail',
- 'desc' => 'prop_formit.attachfiles_desc',
- 'type' => 'combo-boolean',
- 'options' => '',
- 'value' => true,
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'If true, FormIt will add all file fields as attachments in the email.',
- 'area_trans' => '',
- ),
- 'storeAttachments' =>
- array (
- 'name' => 'storeAttachments',
- 'desc' => 'prop_formit.store_attachments_desc',
- 'type' => 'combo-boolean',
- 'options' => '',
- 'value' => false,
- 'lexicon' => 'formit:properties',
- 'area' => '',
- 'desc_trans' => 'prop_formit.store_attachments_desc',
- 'area_trans' => '',
- ),
- ),
- 'moduleguid' => '',
- 'static' => false,
- 'static_file' => '',
- 'content' => '/**
- * FormIt
- *
- * Copyright 2009-2012 by Shaun McCormick <shaun@modx.com>
- *
- * FormIt is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option) any
- * later version.
- *
- * FormIt is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * FormIt; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
- * Suite 330, Boston, MA 02111-1307 USA
- *
- * @package formit
- */
- /**
- * FormIt
- *
- * A dynamic form processing Snippet for MODx Revolution.
- *
- * @var modX $modx
- * @var array $scriptProperties
- *
- * @package formit
- */
- $modelPath = $modx->getOption(
- \'formit.core_path\',
- null,
- $modx->getOption(\'core_path\', null, MODX_CORE_PATH) . \'components/formit/\'
- ) . \'model/formit/\';
- $modx->loadClass(\'FormIt\', $modelPath, true, true);
- $fi = new FormIt($modx, $scriptProperties);
- $fi->initialize($modx->context->get(\'key\'));
- $fi->loadRequest();
- $fields = $fi->request->prepare();
- return $fi->request->handle($fields);',
- ),
- 'policies' =>
- array (
- 'web' =>
- array (
- ),
- ),
- 'source' =>
- array (
- ),
- ),
- 'soilformSubmit' =>
- array (
- 'fields' =>
- array (
- 'id' => 39,
- 'source' => 0,
- 'property_preprocess' => false,
- 'name' => 'soilformSubmit',
- 'description' => '',
- 'editor_type' => 0,
- 'category' => 24,
- 'cache_type' => 0,
- 'snippet' => '//error_reporting(E_ALL);
- error_reporting(E_ALL ^ E_NOTICE);
- ini_set(\'display_errors\', 1);
- $errorLog = 1;
- if(isset($_POST[\'SoilcsvForm\'])) {
-
- if ($errorLog = "1") { error_log(print_r($_POST, true)); }
-
- $sql = null;
- $con = mysqli_connect("localhost", "root", "R3M0T31", "cropmonitor");
-
- //set todays date
- $date = date("Y-m-d H:i:s");
-
- // ****************************************************************************
- // Client Details
- $client_id = (isset($_POST["client_id"])) ? $_POST["client_id"] : "";
- $modx_id = (isset($_POST["m_user"])) ? $_POST["m_user"] : "";
- $email = (isset($_POST["email"])) ? $_POST["email"] : "";
- $client_name = (isset($_POST["name"])) ? $_POST["name"] : "";
- $site_address = (isset($_POST["site_address"])) ? $_POST["site_address"] : "";
- $state_postcode = (isset($_POST["state_postcode"])) ? $_POST["state_postcode"] : "";
-
- // Analysis Details
- $analysis_type = "Soil Test"; //for future types of Soil Analysis
- $lab_no = (isset($_POST["lab_no"])) ? $_POST["lab_no"] : "";
- $batch_no = (isset($_POST["batch_no"])) ? $_POST["batch_no"] : "";
- $sample_id = (isset($_POST["sample_id"])) ? $_POST["sample_id"] : "";
- $site_id = (isset($_POST["site_id"])) ? $_POST["site_id"] : "";
- $crop_type = (isset($_POST["crop_type"])) ? $_POST["crop_type"] : "";
- $soil_type = (isset($_POST["soil_type"])) ? $_POST["soil_type"] : "";
- $date_sampled = (isset($_POST["date_sampled"])) ? $_POST["date_sampled"] : "";
- $date_sampled = date("Y-m-d", strtotime($date_sampled));
- // Sample Details
- $texture = (isset($_POST["texture"])) ? $_POST["texture"] : "";
- $gravel = (isset($_POST["gravel"])) ? $_POST["gravel"] : "";
- $colour = (isset($_POST["colour"])) ? $_POST["colour"] : "";
- $ocarbon = (isset($_POST["ocarbon"])) ? $_POST["ocarbon"] : "";
- $omatter = (isset($_POST["omatter"])) ? $_POST["omatter"] : "";
-
- $ph_cacl2 = (isset($_POST["ph_cacl2"])) ? $_POST["ph_cacl2"] : "";
- $ph_h2o = (isset($_POST["ph_h2o"])) ? $_POST["ph_h2o"] : "";
- $paramag = (isset($_POST["paramag"])) ? $_POST["paramag"] : "";
- $ec = (isset($_POST["ec"])) ? $_POST["ec"] : "";
-
- // Nutrient Details
- $NO3_N = (isset($_POST["NO3_N"])) ? $_POST["NO3_N"] : "";
- $NH3_N = (isset($_POST["NH3_N"])) ? $_POST["NH3_N"] : "";
- $p_mehlick = (isset($_POST["p_mehlick"])) ? $_POST["p_mehlick"] : "";
- $p_bray2 = (isset($_POST["p_bray2"])) ? $_POST["p_bray2"] : "";
- $p_morgan = (isset($_POST["p_morgan"])) ? $_POST["p_morgan"] : "";
- $k_morgan = (isset($_POST["k_morgan"])) ? $_POST["k_morgan"] : "";
- $ca_morgan = (isset($_POST["ca_morgan"])) ? $_POST["ca_morgan"] : "";
- $mg_morgan = (isset($_POST["mg_morgan"])) ? $_POST["mg_morgan"] : "";
- $na_morgan = (isset($_POST["na_morgan"])) ? $_POST["na_morgan"] : "";
- $ch_h2o = (isset($_POST["ch_h2o"])) ? $_POST["ch_h2o"] : "";
- $fe = (isset($_POST["fe"])) ? $_POST["fe"] : "";
-
- $s_morgan = (isset($_POST["s_morgan"])) ? $_POST["s_morgan"] : "";
- $b_cacl2 = (isset($_POST["b_cacl2"])) ? $_POST["b_cacl2"] : "";
- $mn_dtpa = (isset($_POST["mn_dtpa"])) ? $_POST["mn_dtpa"] : "";
- $zn_dtpa = (isset($_POST["zn_dtpa"])) ? $_POST["zn_dtpa"] : "";
- $fe_dtpa = (isset($_POST["fe_dtpa"])) ? $_POST["fe_dtpa"] : "";
- $cu_dtpa = (isset($_POST["cu_dtpa"])) ? $_POST["cu_dtpa"] : "";
- $al = (isset($_POST["al"])) ? $_POST["al"] : "";
- $sl_cacl2 = (isset($_POST["sl_cacl2"])) ? $_POST["sl_cacl2"] : "";
- $m_dtpa = (isset($_POST["m_dtpa"])) ? $_POST["m_dtpa"] : "";
- $co_dtpa = (isset($_POST["co_dtpa"])) ? $_POST["co_dtpa"] : "";
- $se = (isset($_POST["se"])) ? $_POST["se"] : "";
- // Base Saturation Details
- $tec = (isset($_POST["tec"])) ? $_POST["tec"] : "";
- $cec = (isset($_POST["cec"])) ? $_POST["cec"] : "";
-
- //Base Saturation as M.E./100g
- $ca_mehlick3 = (isset($_POST["ca_mehlick3"])) ? $_POST["ca_mehlick3"] : "";
- $mg_mehlick3 = (isset($_POST["mg_mehlick3"])) ? $_POST["mg_mehlick3"] : "";
- $k_mehlick3 = (isset($_POST["k_mehlick3"])) ? $_POST["k_mehlick3"] : "";
- $na_mehlick3 = (isset($_POST["na_mehlick3"])) ? $_POST["na_mehlick3"] : "";
- $al_mehlick3 = (isset($_POST["al_mehlick3"])) ? $_POST["al_mehlick3"] : "";
-
- //Base Saturation as PPM
- if ($_POST["calcium_me3"] == "ppm") {
- $ca_mehlick3 = (isset($_POST["ca_mehlick3_ppm"])) ? ($_POST["ca_mehlick3_ppm"] / 200) : "";
- }
- if ($_POST["magnesium_me3"] == "ppm") {
- $mg_mehlick3 = (isset($_POST["mg_mehlick3_ppm"])) ? ($_POST["mg_mehlick3_ppm"] / 120) : "";
- }
- if ($_POST["postassium_me3"] == "ppm") {
- $k_mehlick = (isset($_POST["k_mehlick3_ppm"])) ? ($_POST["k_mehlick3_ppm"] / 390) : "";
- }
- if ($_POST["soduim_me3"] == "ppm") {
- $na_mehlick3 = (isset($_POST["na_mehlick3_ppm"])) ? ($_POST["na_mehlick3_ppm"] / 230) : "";
- }
- // Totals for Ratis
- $c_total = (isset($_POST["c_total"])) ? $_POST["c_total"] : "";
- $n_total = (isset($_POST["n_total"])) ? $_POST["n_total"] : "";
-
- //Create Carbon Nitrogen Ratio if not specified
- if ($_POST["c_nRatio"] = "") {
- $c_nRatio = (isset($_POST["c_nRatio"])) ? $_POST["c_nRatio"] : "";
- } else {
- $c_nRatio = ( $c_total / $n_total );
- }
-
- //Create CA MG Ratio if not specified
- if ($_POST["ca_mgRatio"] = "") {
- $ca_mgRatio = (isset($_POST["ca_mgRatio"])) ? $_POST["ca_mgRatio"] : "";
- } else {
- $ca_mgRatio = ( (int)$ca_mehlick3 / (int)$mg_mehlick3 );
- }
-
-
- //$rand = substr(md5(microtime()),rand(0,26),5);
- $rand = mt_rand(10000, 99999);
-
-
- // PH lookup table (ph*10 rounded to single decimal point for easy lookup)
- $phrange = array(
- 30 => [75.0, 11.4],
- 31 => [74.0, 11.2],
- 32 => [73.0, 11.0],
- 33 => [72.0, 10.8],
- 34 => [71.0, 10.6],
- 35 => [70.0, 10.4],
- 36 => [69.0, 10.2],
- 37 => [68.0, 10.0],
- 38 => [67.0, 9.8],
- 39 => [66.0, 9.6],
- 40 => [65.0, 9.4],
- 41 => [63.0, 9.2],
- 42 => [61.0, 9.0],
- 43 => [59.0, 8.8],
- 44 => [57.0, 8.6],
- 45 => [55.0, 8.4],
- 46 => [53.0, 8.2],
- 47 => [51.0, 8.0],
- 48 => [49.0, 7.8],
- 49 => [47.0, 7.6],
- 50 => [45.0, 7.4],
- 51 => [42.0, 7.2],
- 52 => [39.0, 7.0],
- 53 => [36.0, 6.8],
- 54 => [33.0, 6.6],
- 55 => [30.0, 6.4],
- 56 => [27.0, 6.2],
- 57 => [24.0, 6.0],
- 58 => [21.0, 5.8],
- 59 => [18.0, 5.6],
- 60 => [15.0, 5.4],
- 61 => [13.5, 5.3],
- 62 => [12.0, 5.2],
- 63 => [10.5, 5.1],
- 64 => [9.0, 5.0],
- 65 => [7.5, 4.9],
- 66 => [6.0, 4.8],
- 67 => [4.5, 4.7],
- 68 => [3.0, 4.6],
- 69 => [1.5, 4.5],
- 70 => [0.0, 4.4],
- 71 => [0.0, 4.3],
- 72 => [0.0, 4.2],
- 73 => [0.0, 4.1],
- 74 => [0.0, 4.0],
- 75 => [0.0, 3.9],
- 76 => [0.0, 3.8],
- 77 => [0.0, 3.7],
- 78 => [0.0, 3.6],
- 79 => [0.0, 3.5],
- 80 => [0.0, 3.4],
- 81 => [0.0, 3.3],
- 82 => [0.0, 3.2],
- 83 => [0.0, 3.1],
- 84 => [0.0, 3.0],
- 85 => [0.0, 2.9],
- 86 => [0.0, 2.8],
- 87 => [0.0, 2.7],
- 88 => [0.0, 2.6],
- 89 => [0.0, 2.5],
- 90 => [0.0, 2.4],
- 91 => [0.0, 2.3],
- 92 => [0.0, 2.2],
- 93 => [0.0, 2.1],
- 94 => [0.0, 2.0],
- 95 => [0.0, 1.9],
- 96 => [0.0, 1.8],
- 97 => [0.0, 1.7],
- 98 => [0.0, 1.6],
- 99 => [0.0, 1.5],
- 100 => [0.0, 1.4],
- );
-
-
-
- /* ********* START ********* */
- /* ********* ADD BASE SATURATION CALCULATION HERE ********* */
-
-
- // Calculating hydrogen and otherbases
- $ph = $ph_h2o; // $ph_h2o from above
- $aluminium = $al_mehlick3;
-
- // round the ph value to single decimal point
- $ph_lookup = round($ph, 2);
- if ($errorLog = "1") { error_log(print_r("ph_lookup: " . $ph_lookup . " ph: " . $ph, true )); }
-
- // lookup Hydrogen and Other Bases
- $hydrogen = $phrange[($ph_lookup * 10)][0];
- $otherbases = $phrange[($ph_lookup * 10)][1];
- $h_rec = round($hydrogen, 2); // recommended level added to DB
- $ob_rec = round($otherbases, 2); // recommended level added to DB
-
- if ($errorLog = "1") { error_log(print_r("Hydrogen: " . $hydrogen . " Other Bases: " . $otherbases, true)); }
- if ( $aluminium < 0 ) {
- $otherbases = 0;
- }
- $obresult = 0; // obresult == Other Bases Result
- $hresult = 0; // hresult == Hydrogen Result
-
-
- // IF ********************************************************************************
- if ( $otherbases > 0 ) {
- while ( (($obresult * 100) / $cec) <= $otherbases ) {
- $obresult += 0.001;
- $tempNo = $obresult;
- $tempNo1 = $otherbases;
- $tempNo2 = $hydrogen;
- // CAUTION: storing value in Calc:E16
- $hresult = ($tempNo * $tempNo2) / $tempNo1;
- }
- $obresult -= 0.001;
- if ( $hresult != 0 ){
- $hresult -= 0.001;
- }
- } else {
- while( (($hresult * 100) / $tec) <= $hydrogen ) {
- $hresultl += 0.001;
- }
- $hresult -= 0.001;
- }
- if ($errorLog = "1") { error_log(print_r("hresult: " . $hresult . " obresult: " . $obresult, true)); }
- // END If ********************************************************************************
-
-
- // Calculating Ca Mg K Na levels based on temp
- // *** I think that the tecTemp needs to be a sum of $tec and $hresult and $obresult ***
- // *** As far as I can see on the spreadsheet the TEC in CALC:B16 is "CEC + obresult + CALC:E16"
-
- $tecTemp = $cec + $obresult + $hresult;
- $tec = round($tecTemp, 2);
- $cec = round($cec, 2);
- if ($errorLog = "1") { error_log(print_r("tecTemp: " . $tecTemp . " cec: " . $cec . " tec: " . $tec, true)); }
-
-
- // CAUTION: for $tecTemp values below 1 and above 100000 this will not work
- if ( ( 1.0 < $tecTemp ) && ( $tecTemp >= 3.0 ) ) {
- $cabs = $CABS = 0;
- $cabsmax = $CABSMAX = 60.00;
- $mgbs = $MGBS = 0;
- $mgbsmax = $MGBSMAX = 20.00;
- $kbs = $KBS = 5.00;
- $kbsmax = $KBSMAX = 7.00;
- $nabs = $NABS = 0.50;
- $nabsmax = $NABSMAX = 1.50;
- }
- elseif ( ( 3.0 < $tecTemp ) && ( $tecTemp >= 5.0 ) ) {
- $cabs = $CABS = 0;
- $cabsmax = $CABSMAX = 62.00;
- $mgbs = $MGBS = 0;
- $mgbsmax = $MGBSMAX = 18.00;
- $kbs = $KBS = 5.00;
- $kbsmax = $KBSMAX = 7.00;
- $nabs = $NABS = 0.50;
- $nabsmax = $NABSMAX = 1.50;
- }
- elseif ( ( 5.0 < $tecTemp ) && ( $tecTemp >= 7.0 ) ) {
- $cabs = $CABS = 0;
- $cabsmax = $CABSMAX = 64.00;
- $mgbs = $MGBS = 0;
- $mgbsmax = $MGBSMAX = 16.00;
- $kbs = $KBS = 4.00;
- $kbsmax = $KBSMAX = 7.00;
- $nabs = $NABS = 0.50;
- $nabsmax = $NABSMAX = 1.50;
- }
- elseif ( ( 7.0 < $tecTemp ) && ( $tecTemp >= 9.0 ) ) {
- $cabs = $CABS = 0;
- $cabsmax = $CABSMAX = 65.00;
- $mgbs = $MGBS = 0;
- $mgbsmax = $MGBSMAX = 15.00;
- $kbs = $KBS = 4.00;
- $kbsmax = $KBSMAX = 7.00;
- $nabs = $NABS = 0.50;
- $nabsmax = $NABSMAX = 1.50;
- }
- elseif ( ( 9.0 < $tecTemp ) && ( $tecTemp >= 11.0 ) ) {
- $cabs = $CABS = 0;
- $cabsmax = $CABSMAX = 67.00;
- $mgbs = $MGBS = 0;
- $mgbsmax = $MGBSMAX = 13.00;
- $kbs = $KBS = 4.00;
- $kbsmax = $KBSMAX = 7.00;
- $nabs = $NABS = 0.50;
- $nabsmax = $NABSMAX = 1.50;
- }
- elseif ( ( 11.0 < $tecTemp ) && ( $tecTemp >= 30.0 ) ) {
- $cabs = $CABS = 0;
- $cabsmax = $CABSMAX = 68.00;
- $mgbs = $MGBS = 0;
- $mgbsmax = $MGBSMAX = 12.00;
- $kbs = $KBS = 4.00;
- $kbsmax = $KBSMAX = 7.00;
- $nabs = $NABS = 0.50;
- $nabsmax = $NABSMAX = 1.50;
- }
- elseif ( ( 30.0 < $tecTemp ) && ( $tecTemp >= 100000.0 ) ) {
- $cabs = $CABS = 0;
- $cabsmax = $CABSMAX = 70.00;
- $mgbs = $MGBS = 0;
- $mgbsmax = $MGBSMAX = 10.00;
- $kbs = $KBS = 3.00;
- $kbsmax = $KBSMAX = 6.00;
- $nabs = $NABS = 0.50;
- $nabsmax = $NABSMAX = 1.50;
- }
-
- // *** CALCULATED TEC % AND PPM MIN / MAX LEVELS
- $cabs_min = $cabs;
- $ca_ppm_min = ( $tec * $cabs_min *2 );
- $cabs_max = $cabsmax;
- $ca_ppm_max = ( $tec * $cabs_max * 2);
- $mgbs_min = $mgbs;
- $mg_ppm_min = ( $tec * $mgbs_min * 1.2 );
- $mgbs_max = $mgbsmax;
- $mg_ppm_max = ( $tec * $mgbs_max * 1.2 );
- $kbs_min = $kbs;
- $k_ppm_min = ( $tec * $kbs_min * 3.9 );
- $kbs_max = $kbsmax;
- $k_ppm_max = ( $tec * $kbs_max * 3.9 );
- $nabs_min = $nabs;
- $na_ppm_min = ( $tec * $nabs_min * 2.3 );
- $nabs_max = $nabsmax;
- $na_ppm_max = ( $tec * $nabs_max * 2.3 );
- $albs_min = "0";
- $al_ppm_min = ( $tec * $albs_min * 0.9 );
- $albs_max = "0.5";
- $al_ppm_max = ( $tec * $albs_max * 0.9 );
-
- // *** CALCULATED TEC LEVELS
- $cabs_tec = ( $ca_mehlick3 / $tec ) * 100;
- $cabs_tec = round($cabs_tec, 2);
- $mgbs_tec = ( $mg_mehlick3 / $tec ) * 100;
- $mgbs_tec = round($mgbs_tec, 2);
- $kbs_tec = ( $k_mehlick3 / $tec ) * 100;
- $kbs_tec = round($kbs_tec, 2);
- $nabs_tec = ( $na_mehlick3 / $tec ) * 100;
- $nabs_tec = round($nabs_tec, 2);
- $albs_tec = ( $al_mehlick3 / $tec ) * 100;
- $albs_tec = round($albs_tec, 2);
-
- // *** CALCULATED PPM FROM MEQ
- $BS_ca_ppm = $ca_mehlick3 * 200;
- $BS_mg_ppm = $mg_mehlick3 * 120;
- $BS_k_ppm = $k_mehlick3 * 390;
- $BS_na_ppm = $na_mehlick3 * 230;
- $BS_al_ppm = $al_mehlick3 * 90;
-
-
- /* ********* ADD BASE SATURATION CALCULATION HERE ********* */
- /* ********* END ********* */
-
- // Check connection
- if (mysqli_connect_errno())
- {
- echo "Failed to connect to MySQL: " . mysqli_connect_error();
- }
-
- $sql = mysqli_query($con, "INSERT into `soil_records`
- (
- client_records_id,
- modx_user_id,
- date,
- email,
- client_name,
- site_address,
- state_postcode,
- analysis_type,
- lab_no,
- batch_no,
- sample_id,
- site_id,
- crop_type,
- soil_type,
- date_sampled,
- tec,
- cec,
- texture,
- gravel,
- colour,
- NO3_N,
- NH3_N,
- p_mehlick,
- p_bray2,
- p_morgan,
- k_morgan,
- ca_morgan,
- mg_morgan,
- na_morgan,
- ch_h2o,
- ocarbon,
- omatter,
- fe,
- ec,
- ph_cacl2,
- ph_h2o,
- paramag,
- s_morgan,
- b_cacl2,
- mn_dtpa,
- zn_dtpa,
- fe_dtpa,
- cu_dtpa,
- al,
- sl_cacl2,
- m_dtpa,
- co_dtpa,
- se,
-
- ca_mehlick3,
- BS_ca_ppm,
- mg_mehlick3,
- BS_mg_ppm,
- k_mehlick3,
- BS_k_ppm,
- na_mehlick3,
- BS_na_ppm,
- al_mehlick3,
- BS_al_ppm,
- BS_ca2,
- BS_mg2,
- BS_k,
- BS_na,
- BS_al3,
- BS_ob,
- BS_h,
-
- cabs_min,
- ca_ppm_min,
- cabs_max,
- ca_ppm_max,
- mgbs_min,
- mg_ppm_min,
- mgbs_max,
- mg_ppm_max,
- kbs_min,
- k_ppm_min,
- kbs_max,
- k_ppm_max,
- nabs_min,
- na_ppm_min,
- nabs_max,
- na_ppm_max,
- albs_min,
- al_ppm_min,
- albs_max,
- al_ppm_max,
-
- ob_rec,
- h_rec,
-
- ca_mg_ratio,
-
- rand
- ) VALUES (
- \'" . $client_id . "\',
- \'" . $modx_id . "\',
- \'" . $date . "\',
- \'" . $email . "\',
- \'" . $client_name . "\',
- \'" . $site_address . "\',
- \'" . $state_postcode . "\',
- \'" . $analysis_type . "\',
- \'" . $lab_no . "\',
- \'" . $batch_no . "\',
- \'" . $sample_id . "\',
- \'" . $site_id . "\',
- \'" . $crop_type . "\',
- \'" . $soil_type . "\',
- \'" . $date_sampled . "\',
- \'" . $tec . "\',
- \'" . $cec . "\',
- IF(\'" . $texture . "\'=\'\',NULL,\'" . $texture . "\'),
- IF(\'" . $gravel . "\'=\'\',NULL,\'" . $gravel . "\'),
- IF(\'" . $colour . "\'=\'\',NULL,\'" . $colour . "\'),
- \'" . $NO3_N . "\',
- \'" . $NH3_N . "\',
- \'" . $p_mehlick . "\',
- \'" . $p_bray2 . "\',
- \'" . $p_morgan . "\',
- \'" . $k_morgan . "\',
- \'" . $ca_morgan . "\',
- \'" . $mg_morgan . "\',
- \'" . $na_morgan . "\',
- \'" . $ch_h2o . "\',
- \'" . $ocarbon . "\',
- \'" . $omatter . "\',
- \'" . $fe . "\',
- \'" . $ec . "\',
- \'" . $ph_cacl2 . "\',
- \'" . $ph_h2o . "\',
- IF(\'" . $paramag . "\'=\'\',NULL,\'" . $paramag . "\'),
- \'" . $s_morgan . "\',
- \'" . $b_cacl2 . "\',
- \'" . $mn_dtpa . "\',
- \'" . $zn_dtpa . "\',
- \'" . $fe_dtpa . "\',
- \'" . $cu_dtpa . "\',
- \'" . $al . "\',
- \'" . $sl_cacl2 . "\',
- \'" . $m_dtpa . "\',
- \'" . $co_dtpa . "\',
- \'" . $se . "\',
-
- \'" . $ca_mehlick3 . "\',
- \'" . $BS_ca_ppm . "\',
- \'" . $mg_mehlick3 . "\',
- \'" . $BS_mg_ppm . "\',
- \'" . $k_mehlick3 . "\',
- \'" . $BS_k_ppm . "\',
- \'" . $na_mehlick3 . "\',
- \'" . $BS_na_ppm . "\',
- \'" . $al_mehlick3 . "\',
- \'" . $BS_al_ppm . "\',
-
- \'" . $cabs_tec . "\',
- \'" . $mgbs_tec . "\',
- \'" . $kbs_tec . "\',
- \'" . $nabs_tec . "\',
- \'" . $aluminium . "\',
- \'" . $otherbases . "\',
- \'" . $hydrogen . "\',
-
- \'" . $cabs_min . "\',
- \'" . $ca_ppm_min . "\',
- \'" . $cabs_max . "\',
- \'" . $ca_ppm_max . "\',
- \'" . $mgbs_min . "\',
- \'" . $mg_ppm_min . "\',
- \'" . $mgbs_max . "\',
- \'" . $mg_ppm_max . "\',
- \'" . $kbs_min . "\',
- \'" . $k_ppm_min . "\',
- \'" . $kbs_max . "\',
- \'" . $k_ppm_max . "\',
- \'" . $nabs_min . "\',
- \'" . $na_ppm_min . "\',
- \'" . $nabs_max . "\',
- \'" . $na_ppm_max . "\',
- \'" . $albs_min . "\',
- \'" . $al_ppm_min . "\',
- \'" . $albs_max . "\',
- \'" . $al_ppm_max . "\',
-
- \'" . $ob_rec . "\',
- \'" . $h_rec . "\',
-
- \'" . $ca_mgRatio . "\',
-
- \'" . $rand . "\'
- )" );
-
- $insert_id = mysqli_insert_id($con);
-
- if ($sql === TRUE)
- {
- // forward to results page if successfully inserts to database [[~32]]
- echo "<script>location.href = \'[[~41]]?rand=" . $rand . "&cid=" . $sample_id . "&rid=" . $insert_id . "&stid=" .$crop_type . "\';</script>";
- } else {
- die(mysqli_error($con)); // TODO: better error handling
- //echo "User Profile incorrect";
- }
- }',
- 'locked' => false,
- 'properties' =>
- array (
- ),
- 'moduleguid' => '',
- 'static' => false,
- 'static_file' => '',
- 'content' => '//error_reporting(E_ALL);
- error_reporting(E_ALL ^ E_NOTICE);
- ini_set(\'display_errors\', 1);
- $errorLog = 1;
- if(isset($_POST[\'SoilcsvForm\'])) {
-
- if ($errorLog = "1") { error_log(print_r($_POST, true)); }
-
- $sql = null;
- $con = mysqli_connect("localhost", "root", "R3M0T31", "cropmonitor");
-
- //set todays date
- $date = date("Y-m-d H:i:s");
-
- // ****************************************************************************
- // Client Details
- $client_id = (isset($_POST["client_id"])) ? $_POST["client_id"] : "";
- $modx_id = (isset($_POST["m_user"])) ? $_POST["m_user"] : "";
- $email = (isset($_POST["email"])) ? $_POST["email"] : "";
- $client_name = (isset($_POST["name"])) ? $_POST["name"] : "";
- $site_address = (isset($_POST["site_address"])) ? $_POST["site_address"] : "";
- $state_postcode = (isset($_POST["state_postcode"])) ? $_POST["state_postcode"] : "";
-
- // Analysis Details
- $analysis_type = "Soil Test"; //for future types of Soil Analysis
- $lab_no = (isset($_POST["lab_no"])) ? $_POST["lab_no"] : "";
- $batch_no = (isset($_POST["batch_no"])) ? $_POST["batch_no"] : "";
- $sample_id = (isset($_POST["sample_id"])) ? $_POST["sample_id"] : "";
- $site_id = (isset($_POST["site_id"])) ? $_POST["site_id"] : "";
- $crop_type = (isset($_POST["crop_type"])) ? $_POST["crop_type"] : "";
- $soil_type = (isset($_POST["soil_type"])) ? $_POST["soil_type"] : "";
- $date_sampled = (isset($_POST["date_sampled"])) ? $_POST["date_sampled"] : "";
- $date_sampled = date("Y-m-d", strtotime($date_sampled));
- // Sample Details
- $texture = (isset($_POST["texture"])) ? $_POST["texture"] : "";
- $gravel = (isset($_POST["gravel"])) ? $_POST["gravel"] : "";
- $colour = (isset($_POST["colour"])) ? $_POST["colour"] : "";
- $ocarbon = (isset($_POST["ocarbon"])) ? $_POST["ocarbon"] : "";
- $omatter = (isset($_POST["omatter"])) ? $_POST["omatter"] : "";
-
- $ph_cacl2 = (isset($_POST["ph_cacl2"])) ? $_POST["ph_cacl2"] : "";
- $ph_h2o = (isset($_POST["ph_h2o"])) ? $_POST["ph_h2o"] : "";
- $paramag = (isset($_POST["paramag"])) ? $_POST["paramag"] : "";
- $ec = (isset($_POST["ec"])) ? $_POST["ec"] : "";
-
- // Nutrient Details
- $NO3_N = (isset($_POST["NO3_N"])) ? $_POST["NO3_N"] : "";
- $NH3_N = (isset($_POST["NH3_N"])) ? $_POST["NH3_N"] : "";
- $p_mehlick = (isset($_POST["p_mehlick"])) ? $_POST["p_mehlick"] : "";
- $p_bray2 = (isset($_POST["p_bray2"])) ? $_POST["p_bray2"] : "";
- $p_morgan = (isset($_POST["p_morgan"])) ? $_POST["p_morgan"] : "";
- $k_morgan = (isset($_POST["k_morgan"])) ? $_POST["k_morgan"] : "";
- $ca_morgan = (isset($_POST["ca_morgan"])) ? $_POST["ca_morgan"] : "";
- $mg_morgan = (isset($_POST["mg_morgan"])) ? $_POST["mg_morgan"] : "";
- $na_morgan = (isset($_POST["na_morgan"])) ? $_POST["na_morgan"] : "";
- $ch_h2o = (isset($_POST["ch_h2o"])) ? $_POST["ch_h2o"] : "";
- $fe = (isset($_POST["fe"])) ? $_POST["fe"] : "";
-
- $s_morgan = (isset($_POST["s_morgan"])) ? $_POST["s_morgan"] : "";
- $b_cacl2 = (isset($_POST["b_cacl2"])) ? $_POST["b_cacl2"] : "";
- $mn_dtpa = (isset($_POST["mn_dtpa"])) ? $_POST["mn_dtpa"] : "";
- $zn_dtpa = (isset($_POST["zn_dtpa"])) ? $_POST["zn_dtpa"] : "";
- $fe_dtpa = (isset($_POST["fe_dtpa"])) ? $_POST["fe_dtpa"] : "";
- $cu_dtpa = (isset($_POST["cu_dtpa"])) ? $_POST["cu_dtpa"] : "";
- $al = (isset($_POST["al"])) ? $_POST["al"] : "";
- $sl_cacl2 = (isset($_POST["sl_cacl2"])) ? $_POST["sl_cacl2"] : "";
- $m_dtpa = (isset($_POST["m_dtpa"])) ? $_POST["m_dtpa"] : "";
- $co_dtpa = (isset($_POST["co_dtpa"])) ? $_POST["co_dtpa"] : "";
- $se = (isset($_POST["se"])) ? $_POST["se"] : "";
- // Base Saturation Details
- $tec = (isset($_POST["tec"])) ? $_POST["tec"] : "";
- $cec = (isset($_POST["cec"])) ? $_POST["cec"] : "";
-
- //Base Saturation as M.E./100g
- $ca_mehlick3 = (isset($_POST["ca_mehlick3"])) ? $_POST["ca_mehlick3"] : "";
- $mg_mehlick3 = (isset($_POST["mg_mehlick3"])) ? $_POST["mg_mehlick3"] : "";
- $k_mehlick3 = (isset($_POST["k_mehlick3"])) ? $_POST["k_mehlick3"] : "";
- $na_mehlick3 = (isset($_POST["na_mehlick3"])) ? $_POST["na_mehlick3"] : "";
- $al_mehlick3 = (isset($_POST["al_mehlick3"])) ? $_POST["al_mehlick3"] : "";
-
- //Base Saturation as PPM
- if ($_POST["calcium_me3"] == "ppm") {
- $ca_mehlick3 = (isset($_POST["ca_mehlick3_ppm"])) ? ($_POST["ca_mehlick3_ppm"] / 200) : "";
- }
- if ($_POST["magnesium_me3"] == "ppm") {
- $mg_mehlick3 = (isset($_POST["mg_mehlick3_ppm"])) ? ($_POST["mg_mehlick3_ppm"] / 120) : "";
- }
- if ($_POST["postassium_me3"] == "ppm") {
- $k_mehlick = (isset($_POST["k_mehlick3_ppm"])) ? ($_POST["k_mehlick3_ppm"] / 390) : "";
- }
- if ($_POST["soduim_me3"] == "ppm") {
- $na_mehlick3 = (isset($_POST["na_mehlick3_ppm"])) ? ($_POST["na_mehlick3_ppm"] / 230) : "";
- }
- // Totals for Ratis
- $c_total = (isset($_POST["c_total"])) ? $_POST["c_total"] : "";
- $n_total = (isset($_POST["n_total"])) ? $_POST["n_total"] : "";
-
- //Create Carbon Nitrogen Ratio if not specified
- if ($_POST["c_nRatio"] = "") {
- $c_nRatio = (isset($_POST["c_nRatio"])) ? $_POST["c_nRatio"] : "";
- } else {
- $c_nRatio = ( $c_total / $n_total );
- }
-
- //Create CA MG Ratio if not specified
- if ($_POST["ca_mgRatio"] = "") {
- $ca_mgRatio = (isset($_POST["ca_mgRatio"])) ? $_POST["ca_mgRatio"] : "";
- } else {
- $ca_mgRatio = ( (int)$ca_mehlick3 / (int)$mg_mehlick3 );
- }
-
-
- //$rand = substr(md5(microtime()),rand(0,26),5);
- $rand = mt_rand(10000, 99999);
-
-
- // PH lookup table (ph*10 rounded to single decimal point for easy lookup)
- $phrange = array(
- 30 => [75.0, 11.4],
- 31 => [74.0, 11.2],
- 32 => [73.0, 11.0],
- 33 => [72.0, 10.8],
- 34 => [71.0, 10.6],
- 35 => [70.0, 10.4],
- 36 => [69.0, 10.2],
- 37 => [68.0, 10.0],
- 38 => [67.0, 9.8],
- 39 => [66.0, 9.6],
- 40 => [65.0, 9.4],
- 41 => [63.0, 9.2],
- 42 => [61.0, 9.0],
- 43 => [59.0, 8.8],
- 44 => [57.0, 8.6],
- 45 => [55.0, 8.4],
- 46 => [53.0, 8.2],
- 47 => [51.0, 8.0],
- 48 => [49.0, 7.8],
- 49 => [47.0, 7.6],
- 50 => [45.0, 7.4],
- 51 => [42.0, 7.2],
- 52 => [39.0, 7.0],
- 53 => [36.0, 6.8],
- 54 => [33.0, 6.6],
- 55 => [30.0, 6.4],
- 56 => [27.0, 6.2],
- 57 => [24.0, 6.0],
- 58 => [21.0, 5.8],
- 59 => [18.0, 5.6],
- 60 => [15.0, 5.4],
- 61 => [13.5, 5.3],
- 62 => [12.0, 5.2],
- 63 => [10.5, 5.1],
- 64 => [9.0, 5.0],
- 65 => [7.5, 4.9],
- 66 => [6.0, 4.8],
- 67 => [4.5, 4.7],
- 68 => [3.0, 4.6],
- 69 => [1.5, 4.5],
- 70 => [0.0, 4.4],
- 71 => [0.0, 4.3],
- 72 => [0.0, 4.2],
- 73 => [0.0, 4.1],
- 74 => [0.0, 4.0],
- 75 => [0.0, 3.9],
- 76 => [0.0, 3.8],
- 77 => [0.0, 3.7],
- 78 => [0.0, 3.6],
- 79 => [0.0, 3.5],
- 80 => [0.0, 3.4],
- 81 => [0.0, 3.3],
- 82 => [0.0, 3.2],
- 83 => [0.0, 3.1],
- 84 => [0.0, 3.0],
- 85 => [0.0, 2.9],
- 86 => [0.0, 2.8],
- 87 => [0.0, 2.7],
- 88 => [0.0, 2.6],
- 89 => [0.0, 2.5],
- 90 => [0.0, 2.4],
- 91 => [0.0, 2.3],
- 92 => [0.0, 2.2],
- 93 => [0.0, 2.1],
- 94 => [0.0, 2.0],
- 95 => [0.0, 1.9],
- 96 => [0.0, 1.8],
- 97 => [0.0, 1.7],
- 98 => [0.0, 1.6],
- 99 => [0.0, 1.5],
- 100 => [0.0, 1.4],
- );
-
-
-
- /* ********* START ********* */
- /* ********* ADD BASE SATURATION CALCULATION HERE ********* */
-
-
- // Calculating hydrogen and otherbases
- $ph = $ph_h2o; // $ph_h2o from above
- $aluminium = $al_mehlick3;
-
- // round the ph value to single decimal point
- $ph_lookup = round($ph, 2);
- if ($errorLog = "1") { error_log(print_r("ph_lookup: " . $ph_lookup . " ph: " . $ph, true )); }
-
- // lookup Hydrogen and Other Bases
- $hydrogen = $phrange[($ph_lookup * 10)][0];
- $otherbases = $phrange[($ph_lookup * 10)][1];
- $h_rec = round($hydrogen, 2); // recommended level added to DB
- $ob_rec = round($otherbases, 2); // recommended level added to DB
-
- if ($errorLog = "1") { error_log(print_r("Hydrogen: " . $hydrogen . " Other Bases: " . $otherbases, true)); }
- if ( $aluminium < 0 ) {
- $otherbases = 0;
- }
- $obresult = 0; // obresult == Other Bases Result
- $hresult = 0; // hresult == Hydrogen Result
-
-
- // IF ********************************************************************************
- if ( $otherbases > 0 ) {
- while ( (($obresult * 100) / $cec) <= $otherbases ) {
- $obresult += 0.001;
- $tempNo = $obresult;
- $tempNo1 = $otherbases;
- $tempNo2 = $hydrogen;
- // CAUTION: storing value in Calc:E16
- $hresult = ($tempNo * $tempNo2) / $tempNo1;
- }
- $obresult -= 0.001;
- if ( $hresult != 0 ){
- $hresult -= 0.001;
- }
- } else {
- while( (($hresult * 100) / $tec) <= $hydrogen ) {
- $hresultl += 0.001;
- }
- $hresult -= 0.001;
- }
- if ($errorLog = "1") { error_log(print_r("hresult: " . $hresult . " obresult: " . $obresult, true)); }
- // END If ********************************************************************************
-
-
- // Calculating Ca Mg K Na levels based on temp
- // *** I think that the tecTemp needs to be a sum of $tec and $hresult and $obresult ***
- // *** As far as I can see on the spreadsheet the TEC in CALC:B16 is "CEC + obresult + CALC:E16"
-
- $tecTemp = $cec + $obresult + $hresult;
- $tec = round($tecTemp, 2);
- $cec = round($cec, 2);
- if ($errorLog = "1") { error_log(print_r("tecTemp: " . $tecTemp . " cec: " . $cec . " tec: " . $tec, true)); }
-
-
- // CAUTION: for $tecTemp values below 1 and above 100000 this will not work
- if ( ( 1.0 < $tecTemp ) && ( $tecTemp >= 3.0 ) ) {
- $cabs = $CABS = 0;
- $cabsmax = $CABSMAX = 60.00;
- $mgbs = $MGBS = 0;
- $mgbsmax = $MGBSMAX = 20.00;
- $kbs = $KBS = 5.00;
- $kbsmax = $KBSMAX = 7.00;
- $nabs = $NABS = 0.50;
- $nabsmax = $NABSMAX = 1.50;
- }
- elseif ( ( 3.0 < $tecTemp ) && ( $tecTemp >= 5.0 ) ) {
- $cabs = $CABS = 0;
- $cabsmax = $CABSMAX = 62.00;
- $mgbs = $MGBS = 0;
- $mgbsmax = $MGBSMAX = 18.00;
- $kbs = $KBS = 5.00;
- $kbsmax = $KBSMAX = 7.00;
- $nabs = $NABS = 0.50;
- $nabsmax = $NABSMAX = 1.50;
- }
- elseif ( ( 5.0 < $tecTemp ) && ( $tecTemp >= 7.0 ) ) {
- $cabs = $CABS = 0;
- $cabsmax = $CABSMAX = 64.00;
- $mgbs = $MGBS = 0;
- $mgbsmax = $MGBSMAX = 16.00;
- $kbs = $KBS = 4.00;
- $kbsmax = $KBSMAX = 7.00;
- $nabs = $NABS = 0.50;
- $nabsmax = $NABSMAX = 1.50;
- }
- elseif ( ( 7.0 < $tecTemp ) && ( $tecTemp >= 9.0 ) ) {
- $cabs = $CABS = 0;
- $cabsmax = $CABSMAX = 65.00;
- $mgbs = $MGBS = 0;
- $mgbsmax = $MGBSMAX = 15.00;
- $kbs = $KBS = 4.00;
- $kbsmax = $KBSMAX = 7.00;
- $nabs = $NABS = 0.50;
- $nabsmax = $NABSMAX = 1.50;
- }
- elseif ( ( 9.0 < $tecTemp ) && ( $tecTemp >= 11.0 ) ) {
- $cabs = $CABS = 0;
- $cabsmax = $CABSMAX = 67.00;
- $mgbs = $MGBS = 0;
- $mgbsmax = $MGBSMAX = 13.00;
- $kbs = $KBS = 4.00;
- $kbsmax = $KBSMAX = 7.00;
- $nabs = $NABS = 0.50;
- $nabsmax = $NABSMAX = 1.50;
- }
- elseif ( ( 11.0 < $tecTemp ) && ( $tecTemp >= 30.0 ) ) {
- $cabs = $CABS = 0;
- $cabsmax = $CABSMAX = 68.00;
- $mgbs = $MGBS = 0;
- $mgbsmax = $MGBSMAX = 12.00;
- $kbs = $KBS = 4.00;
- $kbsmax = $KBSMAX = 7.00;
- $nabs = $NABS = 0.50;
- $nabsmax = $NABSMAX = 1.50;
- }
- elseif ( ( 30.0 < $tecTemp ) && ( $tecTemp >= 100000.0 ) ) {
- $cabs = $CABS = 0;
- $cabsmax = $CABSMAX = 70.00;
- $mgbs = $MGBS = 0;
- $mgbsmax = $MGBSMAX = 10.00;
- $kbs = $KBS = 3.00;
- $kbsmax = $KBSMAX = 6.00;
- $nabs = $NABS = 0.50;
- $nabsmax = $NABSMAX = 1.50;
- }
-
- // *** CALCULATED TEC % AND PPM MIN / MAX LEVELS
- $cabs_min = $cabs;
- $ca_ppm_min = ( $tec * $cabs_min *2 );
- $cabs_max = $cabsmax;
- $ca_ppm_max = ( $tec * $cabs_max * 2);
- $mgbs_min = $mgbs;
- $mg_ppm_min = ( $tec * $mgbs_min * 1.2 );
- $mgbs_max = $mgbsmax;
- $mg_ppm_max = ( $tec * $mgbs_max * 1.2 );
- $kbs_min = $kbs;
- $k_ppm_min = ( $tec * $kbs_min * 3.9 );
- $kbs_max = $kbsmax;
- $k_ppm_max = ( $tec * $kbs_max * 3.9 );
- $nabs_min = $nabs;
- $na_ppm_min = ( $tec * $nabs_min * 2.3 );
- $nabs_max = $nabsmax;
- $na_ppm_max = ( $tec * $nabs_max * 2.3 );
- $albs_min = "0";
- $al_ppm_min = ( $tec * $albs_min * 0.9 );
- $albs_max = "0.5";
- $al_ppm_max = ( $tec * $albs_max * 0.9 );
-
- // *** CALCULATED TEC LEVELS
- $cabs_tec = ( $ca_mehlick3 / $tec ) * 100;
- $cabs_tec = round($cabs_tec, 2);
- $mgbs_tec = ( $mg_mehlick3 / $tec ) * 100;
- $mgbs_tec = round($mgbs_tec, 2);
- $kbs_tec = ( $k_mehlick3 / $tec ) * 100;
- $kbs_tec = round($kbs_tec, 2);
- $nabs_tec = ( $na_mehlick3 / $tec ) * 100;
- $nabs_tec = round($nabs_tec, 2);
- $albs_tec = ( $al_mehlick3 / $tec ) * 100;
- $albs_tec = round($albs_tec, 2);
-
- // *** CALCULATED PPM FROM MEQ
- $BS_ca_ppm = $ca_mehlick3 * 200;
- $BS_mg_ppm = $mg_mehlick3 * 120;
- $BS_k_ppm = $k_mehlick3 * 390;
- $BS_na_ppm = $na_mehlick3 * 230;
- $BS_al_ppm = $al_mehlick3 * 90;
-
-
- /* ********* ADD BASE SATURATION CALCULATION HERE ********* */
- /* ********* END ********* */
-
- // Check connection
- if (mysqli_connect_errno())
- {
- echo "Failed to connect to MySQL: " . mysqli_connect_error();
- }
-
- $sql = mysqli_query($con, "INSERT into `soil_records`
- (
- client_records_id,
- modx_user_id,
- date,
- email,
- client_name,
- site_address,
- state_postcode,
- analysis_type,
- lab_no,
- batch_no,
- sample_id,
- site_id,
- crop_type,
- soil_type,
- date_sampled,
- tec,
- cec,
- texture,
- gravel,
- colour,
- NO3_N,
- NH3_N,
- p_mehlick,
- p_bray2,
- p_morgan,
- k_morgan,
- ca_morgan,
- mg_morgan,
- na_morgan,
- ch_h2o,
- ocarbon,
- omatter,
- fe,
- ec,
- ph_cacl2,
- ph_h2o,
- paramag,
- s_morgan,
- b_cacl2,
- mn_dtpa,
- zn_dtpa,
- fe_dtpa,
- cu_dtpa,
- al,
- sl_cacl2,
- m_dtpa,
- co_dtpa,
- se,
-
- ca_mehlick3,
- BS_ca_ppm,
- mg_mehlick3,
- BS_mg_ppm,
- k_mehlick3,
- BS_k_ppm,
- na_mehlick3,
- BS_na_ppm,
- al_mehlick3,
- BS_al_ppm,
- BS_ca2,
- BS_mg2,
- BS_k,
- BS_na,
- BS_al3,
- BS_ob,
- BS_h,
-
- cabs_min,
- ca_ppm_min,
- cabs_max,
- ca_ppm_max,
- mgbs_min,
- mg_ppm_min,
- mgbs_max,
- mg_ppm_max,
- kbs_min,
- k_ppm_min,
- kbs_max,
- k_ppm_max,
- nabs_min,
- na_ppm_min,
- nabs_max,
- na_ppm_max,
- albs_min,
- al_ppm_min,
- albs_max,
- al_ppm_max,
-
- ob_rec,
- h_rec,
-
- ca_mg_ratio,
-
- rand
- ) VALUES (
- \'" . $client_id . "\',
- \'" . $modx_id . "\',
- \'" . $date . "\',
- \'" . $email . "\',
- \'" . $client_name . "\',
- \'" . $site_address . "\',
- \'" . $state_postcode . "\',
- \'" . $analysis_type . "\',
- \'" . $lab_no . "\',
- \'" . $batch_no . "\',
- \'" . $sample_id . "\',
- \'" . $site_id . "\',
- \'" . $crop_type . "\',
- \'" . $soil_type . "\',
- \'" . $date_sampled . "\',
- \'" . $tec . "\',
- \'" . $cec . "\',
- IF(\'" . $texture . "\'=\'\',NULL,\'" . $texture . "\'),
- IF(\'" . $gravel . "\'=\'\',NULL,\'" . $gravel . "\'),
- IF(\'" . $colour . "\'=\'\',NULL,\'" . $colour . "\'),
- \'" . $NO3_N . "\',
- \'" . $NH3_N . "\',
- \'" . $p_mehlick . "\',
- \'" . $p_bray2 . "\',
- \'" . $p_morgan . "\',
- \'" . $k_morgan . "\',
- \'" . $ca_morgan . "\',
- \'" . $mg_morgan . "\',
- \'" . $na_morgan . "\',
- \'" . $ch_h2o . "\',
- \'" . $ocarbon . "\',
- \'" . $omatter . "\',
- \'" . $fe . "\',
- \'" . $ec . "\',
- \'" . $ph_cacl2 . "\',
- \'" . $ph_h2o . "\',
- IF(\'" . $paramag . "\'=\'\',NULL,\'" . $paramag . "\'),
- \'" . $s_morgan . "\',
- \'" . $b_cacl2 . "\',
- \'" . $mn_dtpa . "\',
- \'" . $zn_dtpa . "\',
- \'" . $fe_dtpa . "\',
- \'" . $cu_dtpa . "\',
- \'" . $al . "\',
- \'" . $sl_cacl2 . "\',
- \'" . $m_dtpa . "\',
- \'" . $co_dtpa . "\',
- \'" . $se . "\',
-
- \'" . $ca_mehlick3 . "\',
- \'" . $BS_ca_ppm . "\',
- \'" . $mg_mehlick3 . "\',
- \'" . $BS_mg_ppm . "\',
- \'" . $k_mehlick3 . "\',
- \'" . $BS_k_ppm . "\',
- \'" . $na_mehlick3 . "\',
- \'" . $BS_na_ppm . "\',
- \'" . $al_mehlick3 . "\',
- \'" . $BS_al_ppm . "\',
-
- \'" . $cabs_tec . "\',
- \'" . $mgbs_tec . "\',
- \'" . $kbs_tec . "\',
- \'" . $nabs_tec . "\',
- \'" . $aluminium . "\',
- \'" . $otherbases . "\',
- \'" . $hydrogen . "\',
-
- \'" . $cabs_min . "\',
- \'" . $ca_ppm_min . "\',
- \'" . $cabs_max . "\',
- \'" . $ca_ppm_max . "\',
- \'" . $mgbs_min . "\',
- \'" . $mg_ppm_min . "\',
- \'" . $mgbs_max . "\',
- \'" . $mg_ppm_max . "\',
- \'" . $kbs_min . "\',
- \'" . $k_ppm_min . "\',
- \'" . $kbs_max . "\',
- \'" . $k_ppm_max . "\',
- \'" . $nabs_min . "\',
- \'" . $na_ppm_min . "\',
- \'" . $nabs_max . "\',
- \'" . $na_ppm_max . "\',
- \'" . $albs_min . "\',
- \'" . $al_ppm_min . "\',
- \'" . $albs_max . "\',
- \'" . $al_ppm_max . "\',
-
- \'" . $ob_rec . "\',
- \'" . $h_rec . "\',
-
- \'" . $ca_mgRatio . "\',
-
- \'" . $rand . "\'
- )" );
-
- $insert_id = mysqli_insert_id($con);
-
- if ($sql === TRUE)
- {
- // forward to results page if successfully inserts to database [[~32]]
- echo "<script>location.href = \'[[~41]]?rand=" . $rand . "&cid=" . $sample_id . "&rid=" . $insert_id . "&stid=" .$crop_type . "\';</script>";
- } else {
- die(mysqli_error($con)); // TODO: better error handling
- //echo "User Profile incorrect";
- }
- }',
- ),
- 'policies' =>
- array (
- 'web' =>
- array (
- ),
- ),
- 'source' =>
- array (
- ),
- ),
- 'croptypeFORM' =>
- array (
- 'fields' =>
- array (
- 'id' => 30,
- 'source' => 1,
- 'property_preprocess' => false,
- 'name' => 'croptypeFORM',
- 'description' => '',
- 'editor_type' => 0,
- 'category' => 0,
- 'cache_type' => 0,
- 'snippet' => '$con = mysqli_connect("localhost", "root", "R3M0T31", "cropmonitor");
- // Check connection
- if (mysqli_connect_errno())
- {
- echo "Failed to connect to MySQL: " . mysqli_connect_error();
- }
- $result = mysqli_query($con, "SELECT * FROM `plant_specifications`");
- // mysqli_query returns false if something went wrong with the query
- if ($result === FALSE)
- {
- die(mysqli_error($con)); // TODO: better error handling
- }
- else
- {
- ?>
- <div class="col-md-4 form-group">
- <small id="lab_no" class="form-text text-muted">Crop Type <span class="error">*</span></small>
- <div><select class="form-control form-control-sm" name="crop_type" id="crop_type" required>
- <option>Select the type of Crop...</option>
- <?php
- while ($row = mysqli_fetch_array($result))
- {
- echo "<option id=" . $row[\'id\'] . ">" . $row[\'plant_type\'] . "</option>";
- }
- ?>
- </select></div>
- </div>
- <?php
- }
- mysqli_close($con);',
- 'locked' => false,
- 'properties' =>
- array (
- ),
- 'moduleguid' => '',
- 'static' => false,
- 'static_file' => '',
- 'content' => '$con = mysqli_connect("localhost", "root", "R3M0T31", "cropmonitor");
- // Check connection
- if (mysqli_connect_errno())
- {
- echo "Failed to connect to MySQL: " . mysqli_connect_error();
- }
- $result = mysqli_query($con, "SELECT * FROM `plant_specifications`");
- // mysqli_query returns false if something went wrong with the query
- if ($result === FALSE)
- {
- die(mysqli_error($con)); // TODO: better error handling
- }
- else
- {
- ?>
- <div class="col-md-4 form-group">
- <small id="lab_no" class="form-text text-muted">Crop Type <span class="error">*</span></small>
- <div><select class="form-control form-control-sm" name="crop_type" id="crop_type" required>
- <option>Select the type of Crop...</option>
- <?php
- while ($row = mysqli_fetch_array($result))
- {
- echo "<option id=" . $row[\'id\'] . ">" . $row[\'plant_type\'] . "</option>";
- }
- ?>
- </select></div>
- </div>
- <?php
- }
- mysqli_close($con);',
- ),
- 'policies' =>
- array (
- 'web' =>
- array (
- ),
- ),
- 'source' =>
- array (
- 'id' => 1,
- 'name' => 'Filesystem',
- 'description' => '',
- 'class_key' => 'sources.modFileMediaSource',
- 'properties' =>
- array (
- 'fred' =>
- array (
- 'name' => 'fred',
- 'desc' => '',
- 'type' => 'combo-boolean',
- 'options' =>
- array (
- ),
- 'value' => false,
- 'lexicon' => NULL,
- ),
- 'fredReadOnly' =>
- array (
- 'name' => 'fredReadOnly',
- 'desc' => '',
- 'type' => 'combo-boolean',
- 'options' =>
- array (
- ),
- 'value' => false,
- 'lexicon' => NULL,
- ),
- ),
- 'is_stream' => true,
- ),
- ),
- 'plantformSubmit' =>
- array (
- 'fields' =>
- array (
- 'id' => 29,
- 'source' => 0,
- 'property_preprocess' => false,
- 'name' => 'plantformSubmit',
- 'description' => '',
- 'editor_type' => 0,
- 'category' => 25,
- 'cache_type' => 0,
- 'snippet' => 'error_reporting(E_ALL);
- ini_set(\'display_errors\', 1);
- if(isset($_POST[\'PlantcsvForm\'])) {
-
- $sql = null;
- $con = mysqli_connect("localhost", "root", "R3M0T31", "cropmonitor");
-
- //set todays date
- $date = date("Y-m-d H:i:s");
-
- //Get figures
- $email = (isset($_POST["email"])) ? $_POST["email"] : "";
- $client_name = (isset($_POST["name"])) ? $_POST["name"] : "";
- $site_address = (isset($_POST["site_address"])) ? $_POST["site_address"] : "";
- $state_postcode = (isset($_POST["state_postcode"])) ? $_POST["state_postcode"] : "";
- $analysis_type = (isset($_POST["analysis_type"])) ? $_POST["analysis_type"] : "";
- $lab_no = (isset($_POST["lab_no"])) ? $_POST["lab_no"] : "";
- $batch_no = (isset($_POST["batch_no"])) ? $_POST["batch_no"] : "";
- $date_sampled = (isset($_POST["date_sampled"])) ? $_POST["date_sampled"] : "";
- $sample_id = (isset($_POST["sample_id"])) ? $_POST["sample_id"] : "";
- $site_id = (isset($_POST["site_id"])) ? $_POST["site_id"] : "";
- $crop_type = (isset($_POST["crop_type"])) ? $_POST["crop_type"] : "";
- $n = (isset($_POST["n"])) ? $_POST["n"] : "";
- $p = (isset($_POST["p"])) ? $_POST["p"] : "";
- $k = (isset($_POST["k"])) ? $_POST["k"] : "";
- $s = (isset($_POST["s"])) ? $_POST["s"] : "";
- $mg = (isset($_POST["mg"])) ? $_POST["mg"] : "";
- $ca = (isset($_POST["ca"])) ? $_POST["ca"] : "";
- $na = (isset($_POST["na"])) ? $_POST["na"] : "";
- $fe = (isset($_POST["fe"])) ? $_POST["fe"] : "";
- $mn = (isset($_POST["mn"])) ? $_POST["mn"] : "";
- $zn = (isset($_POST["zn"])) ? $_POST["zn"] : "";
- $cu = (isset($_POST["cu"])) ? $_POST["cu"] : "";
- $b = (isset($_POST["b"])) ? $_POST["b"] : "";
- $m = (isset($_POST["m"])) ? $_POST["m"] : "";
- $co = (isset($_POST["co"])) ? $_POST["co"] : "";
- $se = (isset($_POST["se"])) ? $_POST["se"] : "";
- $ch = (isset($_POST["cl"])) ? $_POST["cl"] : "";
- //$rand = substr(md5(microtime()),rand(0,26),5);
- $rand = mt_rand(10000, 99999);
-
- // Check connection
- if (mysqli_connect_errno())
- {
- echo "Failed to connect to MySQL: " . mysqli_connect_error();
- }
-
- $sql = mysqli_query($con, "INSERT into `plant_records`
- (
- date,
- email,
- client_name,
- site_address,
- state_postcode,
- analysis_type,
- lab_no,
- batch_no,
- date_sampled,
- sample_id,
- site_id,
- crop_type,
- n,
- p,
- k,
- s,
- mg,
- ca,
- na,
- fe,
- mn,
- zn,
- cu,
- b,
- m,
- co,
- se,
- cl,
- rand
- ) VALUES (
- \'" . $date . "\',
- \'" . $email . "\',
- \'" . $client_name . "\',
- \'" . $site_address . "\',
- \'" . $state_postcode . "\',
- \'" . $analysis_type . "\',
- \'" . $lab_no . "\',
- \'" . $batch_no . "\',
- \'" . $date_sampled . "\',
- \'" . $sample_id . "\',
- \'" . $site_id . "\',
- \'" . $crop_type . "\',
- \'" . $n . "\',
- \'" . $p . "\',
- \'" . $k . "\',
- \'" . $s . "\',
- \'" . $mg . "\',
- \'" . $ca . "\',
- \'" . $na . "\',
- \'" . $fe . "\',
- \'" . $mn . "\',
- \'" . $zn . "\',
- \'" . $cu . "\',
- \'" . $b . "\',
- IF(\'" . $m . "\'=\'\',NULL,\'" . $m . "\'),
- IF(\'" . $co . "\'=\'\',NULL,\'" . $co . "\'),
- IF(\'" . $se . "\'=\'\',NULL,\'" . $se . "\'),
- IF(\'" . $cl . "\'=\'\',NULL,\'" . $cl . "\'),
- \'" . $rand . "\'
- )" );
- $insert_id = mysqli_insert_id($con);
-
- if ($sql === TRUE)
- {
- //echo "success"; //CHECKING
- // forward to results page if successfully inserts to database
- echo "<script>location.href = \'[[~26]]?rand=" . $rand . "&cid=" . $sample_id . "&rid=" . $insert_id . "&stid=" .$crop_type . "\',\'_blank\';</script>";
- } else {
- die(mysqli_error($con)); // TODO: better error handling
- //echo "User Profile incorrect";
- }
- }',
- 'locked' => false,
- 'properties' =>
- array (
- ),
- 'moduleguid' => '',
- 'static' => false,
- 'static_file' => '',
- 'content' => 'error_reporting(E_ALL);
- ini_set(\'display_errors\', 1);
- if(isset($_POST[\'PlantcsvForm\'])) {
-
- $sql = null;
- $con = mysqli_connect("localhost", "root", "R3M0T31", "cropmonitor");
-
- //set todays date
- $date = date("Y-m-d H:i:s");
-
- //Get figures
- $email = (isset($_POST["email"])) ? $_POST["email"] : "";
- $client_name = (isset($_POST["name"])) ? $_POST["name"] : "";
- $site_address = (isset($_POST["site_address"])) ? $_POST["site_address"] : "";
- $state_postcode = (isset($_POST["state_postcode"])) ? $_POST["state_postcode"] : "";
- $analysis_type = (isset($_POST["analysis_type"])) ? $_POST["analysis_type"] : "";
- $lab_no = (isset($_POST["lab_no"])) ? $_POST["lab_no"] : "";
- $batch_no = (isset($_POST["batch_no"])) ? $_POST["batch_no"] : "";
- $date_sampled = (isset($_POST["date_sampled"])) ? $_POST["date_sampled"] : "";
- $sample_id = (isset($_POST["sample_id"])) ? $_POST["sample_id"] : "";
- $site_id = (isset($_POST["site_id"])) ? $_POST["site_id"] : "";
- $crop_type = (isset($_POST["crop_type"])) ? $_POST["crop_type"] : "";
- $n = (isset($_POST["n"])) ? $_POST["n"] : "";
- $p = (isset($_POST["p"])) ? $_POST["p"] : "";
- $k = (isset($_POST["k"])) ? $_POST["k"] : "";
- $s = (isset($_POST["s"])) ? $_POST["s"] : "";
- $mg = (isset($_POST["mg"])) ? $_POST["mg"] : "";
- $ca = (isset($_POST["ca"])) ? $_POST["ca"] : "";
- $na = (isset($_POST["na"])) ? $_POST["na"] : "";
- $fe = (isset($_POST["fe"])) ? $_POST["fe"] : "";
- $mn = (isset($_POST["mn"])) ? $_POST["mn"] : "";
- $zn = (isset($_POST["zn"])) ? $_POST["zn"] : "";
- $cu = (isset($_POST["cu"])) ? $_POST["cu"] : "";
- $b = (isset($_POST["b"])) ? $_POST["b"] : "";
- $m = (isset($_POST["m"])) ? $_POST["m"] : "";
- $co = (isset($_POST["co"])) ? $_POST["co"] : "";
- $se = (isset($_POST["se"])) ? $_POST["se"] : "";
- $ch = (isset($_POST["cl"])) ? $_POST["cl"] : "";
- //$rand = substr(md5(microtime()),rand(0,26),5);
- $rand = mt_rand(10000, 99999);
-
- // Check connection
- if (mysqli_connect_errno())
- {
- echo "Failed to connect to MySQL: " . mysqli_connect_error();
- }
-
- $sql = mysqli_query($con, "INSERT into `plant_records`
- (
- date,
- email,
- client_name,
- site_address,
- state_postcode,
- analysis_type,
- lab_no,
- batch_no,
- date_sampled,
- sample_id,
- site_id,
- crop_type,
- n,
- p,
- k,
- s,
- mg,
- ca,
- na,
- fe,
- mn,
- zn,
- cu,
- b,
- m,
- co,
- se,
- cl,
- rand
- ) VALUES (
- \'" . $date . "\',
- \'" . $email . "\',
- \'" . $client_name . "\',
- \'" . $site_address . "\',
- \'" . $state_postcode . "\',
- \'" . $analysis_type . "\',
- \'" . $lab_no . "\',
- \'" . $batch_no . "\',
- \'" . $date_sampled . "\',
- \'" . $sample_id . "\',
- \'" . $site_id . "\',
- \'" . $crop_type . "\',
- \'" . $n . "\',
- \'" . $p . "\',
- \'" . $k . "\',
- \'" . $s . "\',
- \'" . $mg . "\',
- \'" . $ca . "\',
- \'" . $na . "\',
- \'" . $fe . "\',
- \'" . $mn . "\',
- \'" . $zn . "\',
- \'" . $cu . "\',
- \'" . $b . "\',
- IF(\'" . $m . "\'=\'\',NULL,\'" . $m . "\'),
- IF(\'" . $co . "\'=\'\',NULL,\'" . $co . "\'),
- IF(\'" . $se . "\'=\'\',NULL,\'" . $se . "\'),
- IF(\'" . $cl . "\'=\'\',NULL,\'" . $cl . "\'),
- \'" . $rand . "\'
- )" );
- $insert_id = mysqli_insert_id($con);
-
- if ($sql === TRUE)
- {
- //echo "success"; //CHECKING
- // forward to results page if successfully inserts to database
- echo "<script>location.href = \'[[~26]]?rand=" . $rand . "&cid=" . $sample_id . "&rid=" . $insert_id . "&stid=" .$crop_type . "\',\'_blank\';</script>";
- } else {
- die(mysqli_error($con)); // TODO: better error handling
- //echo "User Profile incorrect";
- }
- }',
- ),
- 'policies' =>
- array (
- 'web' =>
- array (
- ),
- ),
- 'source' =>
- array (
- ),
- ),
- ),
- 'modTemplateVar' =>
- array (
- 'blogit.post_main_image' =>
- array (
- 'fields' =>
- array (
- 'id' => 5,
- 'source' => 0,
- 'property_preprocess' => false,
- 'type' => 'image',
- 'name' => 'blogit.post_main_image',
- 'caption' => 'Main image',
- 'description' => 'Select the main image to show with this post, leave blank for no image, a re-sized verzion will be shown on the blog post overview.',
- 'editor_type' => 0,
- 'category' => 36,
- 'locked' => false,
- 'elements' => '',
- 'rank' => 1,
- 'display' => 'default',
- 'default_text' => '',
- 'properties' =>
- array (
- ),
- 'input_properties' =>
- array (
- ),
- 'output_properties' =>
- array (
- ),
- 'static' => false,
- 'static_file' => '',
- 'content' => '',
- ),
- 'policies' =>
- array (
- 'web' =>
- array (
- ),
- ),
- 'source' =>
- array (
- ),
- ),
- ),
- ),
- );
|