echo $prefix; ?> -hours-weekly" /> </label> <label><span id="<?php echo $prefix; ?> -help" class="help-icon"><?php IncludeJSBlock(' window.addEvent("load",function(){ new UIPopover($("' . $prefix . '-help"), { description: "the sector code should reflect the sector or industry of the business/organization and not the individual position", anchor: UIPopover.AnchorTo("top") }); }); '); ?> </span>Industry sector code <!-- <input style="width: 100px;" type="text" value="" name="<?php echo $prefix; ?> -sector" />--> <select name="<?php echo $prefix; ?>
<?php $btn = Scaffold('cpanel.button', array('title' => 'Create A New Participant Information Form', 'className' => 'btn btn-primary big', 'icon' => Core::AssetsDir() . DS . 'Map Item Icons' . DS . 'sm_new.png?tint=rgb(255,255,255)', 'script' => ' UIFormManager.showForm("scheduled"); ')); IncludeJSBlock(' window.addEvent("load",function(){ UIFormManager.addEvent("showForm",function(){ ' . $btn . '.removeClass("btn-primary"); ' . $btn . '.setAttribute("disabled", true); }).addEvent("hideForms",function(){ ' . $btn . '.addClass("btn-primary"); ' . $btn . '.removeAttribute("disabled"); }); }); ');
IncludeJSBlock(' window.addEvent("load",function(){ var ajaxUrl=' . json_encode($params['url']) . '; UIFormManager.setAjaxUrl(ajaxUrl); UIFormManager.addForm({ name:"scheduled", ajaxUrl:null, ajaxTask:"create-new-scheduled", container:$("schedule-d-area"), form:$$("#schedule-d-area>form")[0], submitButtons:$$("#schedule-d-area .submit-btn"), cancelButtons:$$("#schedule-d-area .cancel-btn"), additionalFormButtons:$$("#schedule-d-area>form .btn"), warningsArea:$("sheduled-warnings-area"), defaultFormData:' . json_encode(array('id' => -1, 'admin-year' => date('Y'), 'admin-quarter' => $quarter, 'employed-quarter' => 'no', 'job-supports' => 'no', 'enrolled-quarter' => 'no', 'enrollment-supports' => 'no')) . ' }); UIFormManager.addForm({ name:"addendum", ajaxUrl:null, ajaxTask:"create-new-addendum", container:$("addendum-area"), form:$$("#addendum-area>form")[0], submitButtons:$$("#addendum-area .submit-btn"), cancelButtons:$$("#addendum-area .cancel-btn"), additionalFormButtons:$$("#addendum-area>form .btn"), warningsArea:$("addendum-warnings-area"), defaultFormData:' . json_encode(array('id' => -1, 'admin-year' => date('Y'), 'admin-quarter' => $quarter, 'employed-quarter' => 'no', 'job-supports' => 'no', 'enrolled-quarter' => 'no', 'enrollment-supports' => 'no')) . ' }); UIFormManager.addForm({ name:"quarterly", ajaxUrl:null, ajaxTask:"create-new-quarterly", container:$("quarterly-area"), form:$$("#quarterly-area>form")[0], submitButtons:$$("#quarterly-area .submit-btn"), cancelButtons:$$("#quarterly-area .cancel-btn"), additionalFormButtons:$$("#quarterly-area>form .btn"), warningsArea:$("quarterly-warnings-area"), defaultFormData:' . json_encode(array('id' => -1, 'admin-year' => date('Y'), 'admin-quarter' => $quarter, 'employed-quarter' => 'no', 'job-supports' => 'no', 'enrolled-quarter' => 'no', 'enrollment-supports' => 'no', 'job-1-working' => 'no', 'job-2-working' => 'no', 'job-3-working' => 'no', 'job-1-promoted' => 'no', 'job-2-promoted' => 'no', 'job-3-promoted' => 'no', 'job-1-wage-changed' => 'no', 'job-2-wage-changed' => 'no', 'job-3-wage-changed' => 'no', 'job-1-hours-changed' => 'no', 'job-2-hours-changed' => 'no', 'job-3-hours-changed' => 'no')) . ' }); new UIUsersFormsList({ url:ajaxUrl, formManager:UIFormManager, element:$("list-schedule-d"), endDate:"' . date('Y-') . ($q * 3 + 1) . '-01 00:00:00" }); /** * Users Form List Display Behavior */ // hide users list of completed forms whenever any form becomes visible UIFormManager.addEvent("showForm",function(){ $("list-schedule-d").removeClass("enabled"); }); // show users list of completed forms whenever all forms are hidden UIFormManager.addEvent("hideForms",function(){ $("list-schedule-d").addClass("enabled"); }); }); ');
<?php $config = array_merge(array('text' => 'info text'), $params); $id = "info-help-" . rand(10000, 99999); ?> <span id="<?php echo $id; ?> " class="help-icon"><?php IncludeJSBlock(' window.addEvent("load",function(){ new UIPopover("' . $id . '", { description: ' . json_encode($config['text']) . ', anchor: UIPopover.AnchorTo("top") }); }); '); ?> </span>
IncludeJSBlock(' window.addEvent("load",function(){ var ajaxUrl=' . json_encode($params['url']) . '; UIFormManager.setAjaxUrl(ajaxUrl); UIFormManager.addForm({ name:"scheduled", ajaxUrl:null, ajaxTask:"create-new-scheduled", container:$("schedule-d-area"), form:$$("#schedule-d-area>form")[0], submitButtons:$$("#schedule-d-area .submit-btn"), cancelButtons:$$("#schedule-d-area .cancel-btn"), additionalFormButtons:$$("#schedule-d-area>form .btn"), warningsArea:$("sheduled-warnings-area"), defaultFormData:' . json_encode(array('id' => -1, 'admin-year' => date('Y'), 'admin-quarter' => $quarter, 'employed-quarter' => 'no', 'job-supports' => 'no', 'enrolled-quarter' => 'no', 'enrollment-supports' => 'no')) . ' }); UIFormManager.addForm({ name:"addendum", ajaxUrl:null, ajaxTask:"create-new-addendum", container:$("addendum-area"), form:$$("#addendum-area>form")[0], submitButtons:$$("#addendum-area .submit-btn"), cancelButtons:$$("#addendum-area .cancel-btn"), additionalFormButtons:$$("#addendum-area>form .btn"), warningsArea:$("addendum-warnings-area"), defaultFormData:' . json_encode(array('id' => -1, 'admin-year' => date('Y'), 'admin-quarter' => $quarter, 'employed-quarter' => 'no', 'job-supports' => 'no', 'enrolled-quarter' => 'no', 'enrollment-supports' => 'no')) . ' }); UIFormManager.addForm({ name:"quarterly", ajaxUrl:null, ajaxTask:"create-new-quarterly", container:$("quarterly-area"), form:$$("#quarterly-area>form")[0], submitButtons:$$("#quarterly-area .submit-btn"), cancelButtons:$$("#quarterly-area .cancel-btn"), additionalFormButtons:$$("#quarterly-area>form .btn"), warningsArea:$("quarterly-warnings-area"), defaultFormData:' . json_encode(array('id' => -1, 'admin-year' => date('Y'), 'admin-quarter' => $quarter, 'employed-quarter' => 'no', 'job-supports' => 'no', 'enrolled-quarter' => 'no', 'enrollment-supports' => 'no', 'job-1-working' => 'no', 'job-2-working' => 'no', 'job-3-working' => 'no', 'job-1-promoted' => 'no', 'job-2-promoted' => 'no', 'job-3-promoted' => 'no', 'job-1-wage-changed' => 'no', 'job-2-wage-changed' => 'no', 'job-3-wage-changed' => 'no', 'job-1-hours-changed' => 'no', 'job-2-hours-changed' => 'no', 'job-3-hours-changed' => 'no')) . ' }); UIFormManager.addForm({ name:"user", ajaxUrl:null, ajaxTask:"save-user", container:$("user-area"), form:$$("#user-area>form")[0], submitButtons:$$("#user-area .submit-btn"), cancelButtons:$$("#user-area .cancel-btn"), additionalFormButtons:$$("#user-area>form .btn"), warningsArea:$("user-warnings-area"), defaultFormData:' . json_encode(array()) . ' }); UIFormManager.addForm({ name:"userassign", ajaxUrl:null, ajaxTask:"assiqn-user", container:$("userassign-area"), form:$$("#userassign-area>form")[0], submitButtons:$$("#userassign-area .submit-btn"), cancelButtons:$$("#userassign-area .cancel-btn"), additionalFormButtons:$$("#userassign-area>form .btn"), warningsArea:$("userassign-warnings-area"), defaultFormData:' . json_encode(array()) . ' }); var enableScheduleButton=function(){ ' . $schedButton . '.addClass("btn-primary"); ' . $schedButton . '.removeAttribute("disabled"); $("list-schedule-d").removeClass("enabled"); }; var disableScheduleButton=function(){ ' . $schedButton . '.removeClass("btn-primary"); ' . $schedButton . '.setAttribute("disabled", true); }; disableScheduleButton(); var enableAuthButton=function(){ ' . $authButton . '.addClass("btn-danger"); ' . $authButton . '.removeAttribute("disabled"); $("list-users").removeClass("enabled"); }; var disableAuthButton=function(){ ' . $authButton . '.removeClass("btn-danger"); ' . $authButton . '.setAttribute("disabled", true); }; var enableExpButton=function(){ ' . $expButton . '.addClass("btn-success"); ' . $expButton . '.removeAttribute("disabled"); $("list-utilities").removeClass("enabled"); }; var disableExpButton=function(){ ' . $expButton . '.removeClass("btn-success"); ' . $expButton . '.setAttribute("disabled", true); }; new UIUsersFormsList({ url:ajaxUrl, formManager:UIFormManager, element:$("list-schedule-d"), endDate:"' . date('Y-') . ($q * 3 + 1) . '-01 00:00:00", title:"All Previously Completed Forms (for all users)" //showCreateButtons:false }); /** * Users Form List Display Behavior */ // hide users list of completed forms whenever any form becomes visible UIFormManager.addEvent("showForm",function(){ $("list-schedule-d").removeClass("enabled"); disableScheduleButton(); disableAuthButton(); disableExpButton(); }); // show users list of completed forms whenever all forms are hidden UIFormManager.addEvent("hideForms",function(){ $("list-schedule-d").addClass("enabled"); disableScheduleButton(); enableAuthButton(); enableExpButton(); }); ' . $schedButton . '.addEvent("click", function(){ $("list-schedule-d").addClass("enabled"); disableScheduleButton(); enableAuthButton(); enableExpButton(); }); ' . $authButton . '.addEvent("click",function(){ $("list-users").addClass("enabled"); enableScheduleButton(); disableAuthButton(); enableExpButton(); }); ' . $expButton . '.addEvent("click",function(){ $("list-utilities").addClass("enabled"); enableScheduleButton(); enableAuthButton(); disableExpButton(); }); var userList=new UIUserList({ url:ajaxUrl, formManager:UIFormManager, element:$("list-users"), }); }); ');
/** * @runInSeparateProcess */ public function testWriteForms() { $this->_includeScaffolds(); $this->assertTrue(file_exists(dirname(__DIR__) . '/forms/views'), 'scaffolds directory: ' . dirname(__DIR__) . '/forms/views'); ob_start(); HTML('document', array('buffered' => true, 'header' => function () { // need a bunch of resources. ?> <base href="http://rwa.geolive.ca/index.php/forms-menu" /> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>Forms Menu</title> <link rel="stylesheet" href="http://s3-us-west-2.amazonaws.com/nickolanackbucket/pushbox/pb.css" type="text/css" /> <link rel="stylesheet" href="http://s3-us-west-2.amazonaws.com/nickolanackbucket/pushbox/pb-images.css" type="text/css" /> <link rel="stylesheet" href="http://s3-us-west-2.amazonaws.com/nickolanackbucket/spinner/spin.css" type="text/css" /> <link rel="stylesheet" href="http://s3-us-west-2.amazonaws.com/nickolanackbucket/popover/popover.css" type="text/css" /> <link rel="stylesheet" href="http://rwa.geolive.ca/forms/css/forms.css" type="text/css" /> <link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-1.19.0.css" type="text/css" /> <script src="/media/system/js/mootools-core.js" type="text/javascript"></script> <script src="/media/system/js/core.js" type="text/javascript"></script> <script src="/media/system/js/mootools-more.js" type="text/javascript"></script> <script src="http://s3-us-west-2.amazonaws.com/nickolanackbucket/mootools/mootools_compat.js" type="text/javascript"></script> <script src="http://rwa.geolive.ca/forms/php-core-app/js/JSConsole.js" type="text/javascript"></script> <script src="http://rwa.geolive.ca/forms/php-core-app/js/Ajax/AjaxControlQuery.js" type="text/javascript"></script> <script src="http://s3-us-west-2.amazonaws.com/nickolanackbucket/pushbox/PushBox.js" type="text/javascript"></script> <script src="http://rwa.geolive.ca/forms/php-core-app/js/JSUtilities.js" type="text/javascript"></script> <script src="http://s3-us-west-2.amazonaws.com/nickolanackbucket/spinner/Spinner.js" type="text/javascript"></script> <script src="http://rwa.geolive.ca/forms/js/UIFormManager.js" type="text/javascript"></script> <script src="http://s3-us-west-2.amazonaws.com/nickolanackbucket/popover/Popover.js" type="text/javascript"></script> <script src="http://rwa.geolive.ca/forms/php-core-app/js/Controls/UIPopover.js" type="text/javascript"></script> <script src="http://code.jquery.com/qunit/qunit-1.19.0.js" type="text/javascript"></script> <script type="text/javascript"> <?php global $_html; echo implode("\n\n", $_html['js']); ?> </script> <?php }, 'body' => function () { ?> <section id="schedule-d-area"><?php Scaffold('form.scheduled', array(), dirname(__DIR__) . '/forms/views'); ?> </section> <section id="quarterly-area"><?php Scaffold('form.quarterly', array(), dirname(__DIR__) . '/forms/views'); ?> </section> <section id="addendum-area"><?php Scaffold('form.addendum', array(), dirname(__DIR__) . '/forms/views'); ?> </section><?php IncludeJSBlock(' window.addEvent("load",function(){ UIFormManager.addForm({ name:"scheduled", container:$("schedule-d-area"), form:$$("#schedule-d-area>form")[0], defaultFormData:' . json_encode(array('id' => -1, 'admin-year' => 2015, 'admin-quarter' => '1st', 'employed-quarter' => 'no', 'job-supports' => 'no', 'enrolled-quarter' => 'no', 'enrollment-supports' => 'no')) . ' }); UIFormManager.addForm({ name:"addendum", container:$("addendum-area"), form:$$("#addendum-area>form")[0], defaultFormData:' . json_encode(array('id' => -1, 'admin-year' => 2015, 'admin-quarter' => '1st', 'employed-quarter' => 'no', 'job-supports' => 'no', 'enrolled-quarter' => 'no', 'enrollment-supports' => 'no')) . ' }); UIFormManager.addForm({ name:"quarterly", container:$("quarterly-area"), form:$$("#quarterly-area>form")[0], defaultFormData:' . json_encode(array('id' => -1, 'admin-year' => 2015, 'admin-quarter' => '1st', 'employed-quarter' => 'no', 'job-supports' => 'no', 'enrolled-quarter' => 'no', 'enrollment-supports' => 'no')) . ' }); }); '); Scaffold('qunit.test', array(), dirname(__DIR__) . '/forms/views'); })); $page = ob_get_contents(); ob_end_clean(); file_put_contents(__DIR__ . '/page.html', $page); // echo $page; $this->assertTrue(file_exists(__DIR__ . '/page.html')); }
IncludeJSBlock(' window.addEvent("load",function(){ var enabler=' . $config['enabler'] . '; var disabler=' . $config['disabler'] . '; if(!enabler){ throw new Error("you need to set \'enabler\' arg in "+' . json_encode(basename(__FILE__)) . '); } if(!disabler){ throw new Error("you need to set \'disabler\' arg in "+' . json_encode(basename(__FILE__)) . '); } disabler.addEvent("change",function(){ if(this.checked){ ' . $config['elementArray'] . '.forEach(function(s){ s.setStyle("display",' . $config['disable'] . '); }); ' . $config['elementArrayEnabled'] . '.forEach(function(s){ s.setStyle("display",' . $config['enable'] . '); }); } }); enabler.addEvent("change",function(){ if(this.checked){ ' . $config['elementArray'] . '.forEach(function(s){ s.setStyle("display",' . $config['enable'] . '); }); ' . $config['elementArrayEnabled'] . '.forEach(function(s){ s.setStyle("display",' . $config['disable'] . '); }); } }); }); ');