private static function ItemMetadata($itemid) { ob_start(); /* @var $item Marker */ if ($itemid instanceof Marker) { $item = $itemid; } else { $item = MapController::LoadMapItem($itemid); } Scaffold('article.mapitem', array('item' => $item, 'imageThumb' => array(250, 210), 'maxImages' => 1, 'schema' => array('link' => 'itemprop="map"'), 'showStaticMap' => false), Core::Get('Maps')->getScaffoldsPath()); $article = ob_get_contents(); ob_end_clean(); // return array( // 'html' => $article // ); $layer = null; foreach (GeoliveHelper::VisibleLayers() as $l) { if ($l->getId() == $item->getLayerId()) { $layer = $l; } } $data = AttributesRecord::Get($item->getId(), 'marker', GeoliveHelper::AttributeTableMetadata()); if (trim(strtolower($data['tentSites'])) == 'unknown') { $data['tentSites'] = '?'; } return array('html' => $article, 'details' => array('coordinates' => $item->getCoordinates(), 'layer' => $layer->getName(), 'icon' => $item->getIcon()), 'attributes' => $data); }
<h4>Post Secondary Education</h4> <section class="b"> <h4>Was this person enrolled in post-secondary education as a result of RWA for any part of this quarter?</h4> <?php Scaffold('form.switch', array('name' => 'enrolled-quarter', 'callback' => function () { ?> <hr /> <?php Scaffold('form.scheduled.enrollment'); ?> <h3>Supports for Post-Secondary Education</h3> <h4>Does this person require any supports from RWA for post-secondary education?</h4> <?php Scaffold('form.switch', array('name' => 'enrollment-supports', 'callback' => function () { ?> <hr /> <?php Scaffold('form.scheduled.enrollment.support'); })); })); ?> </section> </form>
<?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"); }); }); ');
Scaffold('cpanel.button', array('title' => 'Generate Statistics', 'className' => 'btn btn-success', 'icon' => Core::AssetsDir() . DS . 'Control Panel Icons' . DS . 'download.png?tint=rgb(255,255,255)', 'script' => ' var html=' . json_encode(file_get_contents(__DIR__ . DS . 'statistics.html')) . '; var container=new Element("div",{ html:html, styles:{ padding: "50px"} }); var buttonExecute=new Element("button", {"class":"btn btn-primary", "html":"Process"}); container.appendChild(buttonExecute); buttonExecute.addEvent("click",function(){ //TODO: this is very form specific (setting stats quarter) and will limit extendability... var currentQ = parseInt($("stats-quarter").value); container.innerHTML=html.replace("value=\\"8\\"", "value=\\""+currentQ+"\\""); container.appendChild(buttonExecute); var processPifFn=(function(){ ' . file_get_contents(__DIR__ . DS . 'statistics.js') . ' })(); var url=' . json_encode($params['url']) . '; (new AjaxControlQuery( url, "list-scheduled", { sortField: "formDate", sortOrder: "ASC" } )).addEvent("success", function(response) { response.results.forEach(function(record){ (new AjaxControlQuery( url, "list-addendums-quarterlys", {"participant-id":record.formData["participant-id"]} )).addEvent("success", function(response) { processPifFn(record, response.results); }).execute(); }); }).execute(); }); PushBoxWindow.open(container,{handler: "append", size: {x: 750, y: 450}, anchor:this, push:true}); '));
<div id="addendum-area" class="form-container"> <div id="addendum-warnings-area"></div> <?php Scaffold('cpanel.button', array('title' => 'Submit', 'className' => 'btn btn-primary pull-right submit-btn', 'icon' => Core::AssetsDir() . DS . 'Map Item Icons' . DS . 'sm_new.png?tint=rgb(255,255,255)', 'script' => ' if(!this.getAttribute("disabled")){ UIFormManager.saveForm("addendum"); } ')); Scaffold('cpanel.button', array('title' => 'Cancel', 'className' => 'btn btn-danger pull-right cancel-btn', 'icon' => Core::AssetsDir() . DS . 'Map Item Icons' . DS . 'sm_new.png?tint=rgb(255,255,255)', 'script' => ' if(!this.getAttribute("disabled")){ UIFormManager.hideForms(); } ')); ?> <div></div><?php Scaffold('form.addendum', array()); ?> <div></div><?php Scaffold('cpanel.button', array('title' => 'Submit', 'className' => 'btn btn-primary pull-right submit-btn', 'icon' => Core::AssetsDir() . DS . 'Map Item Icons' . DS . 'sm_new.png?tint=rgb(255,255,255)', 'script' => ' if(!this.getAttribute("disabled")){ UIFormManager.saveForm("addendum"); } ')); ?> <div></div><?php ?> </div>
?> Number of weeks needed <input style="width: 150px;" type="number" value="" step="any" min="0" name="enrollment-support-trans-weeks" /> </label> Other justification if applicable<textarea name="enrollment-support-trans-justification" style="resize: vertical; width: 380px; box-sizing: border-box;"></textarea> <label>Total $ needed for transportation at this request <input style="width: 50px;" type="number" value="" step="any" min="0" name="enrollment-support-trans-total" /> </label> <label>Provider <input type="text" value="" name="enrollment-support-trans-provider" /> </label> <div><?php Scaffold('form.info', array('text' => 'If these supports were funded by generic/agency supports, you do not need to complete the following fields: total $ needed for transportation at this request.')); ?> Were these supports funded by generic/agency sources?</div> <span class="inline"> <label><input type="radio" value="yes" name="job-support-<?php echo $config['n']; ?> -external-provider-enrollment-transportation" /> Yes </label> <label><input type="radio" value="no" name="job-support-<?php echo $config['n']; ?> -external-provider-enrollment-transportation" /> No </label> </span> </span><span class="right">
<?php Scaffold('cpanel.button', array('title' => 'Add Job', 'className' => 'btn btn-success pull-right', 'icon' => Core::AssetsDir() . DS . 'Map Item Icons' . DS . 'sm_new.png?tint=rgb(255,255,255)', 'script' => ' button=this; ' . $config['elementsArray'] . '.forEach(function(el){ if(!el.hasClass("two")){ el.addClass("two"); $("job-2-isactive-' . $id . '").value="yes"; }else{ if(!el.hasClass("three")){ el.addClass("three"); $("job-3-isactive-' . $id . '").value="yes"; button.removeClass("btn-success"); button.setAttribute("disabled", true); }else{ } } }); '));
$first = $callbacks; if (is_array($callbacks)) { $first = $callbacks[0]; } $first(); ?> </span> <?php if (is_array($callbacks) && count($callbacks) == 2) { $enablerArgs['elementArrayEnabled'] = '[$("_' . $id . '")]'; ?> <span id="_<?php echo $id; ?> " class="<?php echo $config['className']; ?> " style=""> <?php $second = $callbacks[1]; $second(); ?> </span><?php } else { } Scaffold('script.radiobutton.display.toggle', $enablerArgs);
UIFormManager.addEvent("hideForms",function(){ $("list-schedule-d").addClass("enabled"); }); }); '); IncludeCSS(dirname(__DIR__) . DS . 'css' . DS . 'forms.css'); IncludeCSSBlock(' section h6 { background-color: #F8EAF2; line-height: 20px; padding: 5px; width: 50%; border-radius: 4px; margin: 5px; color: rgb(235, 0, 139); border: 1px solid rgba(235, 0, 139, 0.2); position: relative; left: -100px; } section h6:before { content: "Temporary Note: "; } '); if (Core::Client()->getUsername() == 'nickolanack') { Scaffold('qunit.test'); }
$values = array(); foreach ($fieldsNames as $field) { if (key_exists($field, $form)) { $values[] = $form[$field]; } else { $values[] = ""; } } EasyCsv::AddRow($csv, $values); }); //header('Content-Type: application/csv;'); //header('Content-disposition: filename="rwa-export-scheduled-' . date('Y-m-d') . '.csv"'); echo EasyCsv::Write($csv); return; } Scaffold('user.admin.panel', array('url' => UrlFrom(__FILE__)), __DIR__ . DS . 'views'); /* @var $db ScheduleDatabase */ include_once __DIR__ . DS . 'database' . DS . 'ScheduleDatabase.php'; $db = ScheduleDatabase::GetInstance(); $total = 0; foreach ($db->tables() as $table) { $updates = $db->verifyTable($table); if (count($updates)) { array_walk($updates, function ($alter) use($db) { $db->execute($alter); $count++; }); } } echo '<!-- '; echo "<br/><br/>by the way, the database was just validated";
<?php $config = array_merge(array('n' => 1, 'class' => '', 'style' => ''), $params); $num = array('One', 'Two', 'Three'); $idsuffix = "-" . rand(00, 9999); ?> <section class="job <?php echo $config['class']; ?> h4-bar" style="<?php echo $config['style']; ?> "> <h4>Job <?php echo $num[$config['n'] - 1]; ?> </h4> <?php Scaffold('form.scheduled.job_', array('prefix' => 'job-' . $config['n'])); if ($config['n'] == 1) { Scaffold('form.scheduled.job', array('n' => 2, 'class' => 'two')); Scaffold('form.scheduled.job', array('n' => 3, 'class' => 'three')); } ?> </section>
h4-bar" style="<?php echo $config['style']; ?> "> <h4>Job <?php echo $num[$config['n'] - 1]; ?> </h4> <h4>Working This Quarter?</h4> <?php Scaffold('form.switch', array('name' => 'job-' . $config['n'] . '-working', 'className' => 'jobs qtr-jobs', 'value' => "yes", 'callback' => array(function () use($config) { ?> <hr /><?php Scaffold('form.quarterly.job.working', array('prefix' => 'job-' . $config['n'])); }, function () use($config) { ?> <hr /><?php Scaffold('form.quarterly.job.notworking', array('prefix' => 'job-' . $config['n'])); }))); ?> <?php if ($config['n'] == 1) { Scaffold('form.quarterly.job', array('n' => 2, 'class' => 'two')); Scaffold('form.quarterly.job', array('n' => 3, 'class' => 'three')); } ?> </section>
?> " type="text/css"><?php $schedButton = Scaffold('cpanel.button', array('title' => 'Show All Participant Information Form Forms', 'className' => 'btn btn-primary big', 'icon' => Core::AssetsDir() . DS . 'Map Item Icons' . DS . 'sm_table.png?tint=rgb(255,255,255)')); $authButton = Scaffold('cpanel.button', array('title' => 'Show All Participant Information Form Authors', 'className' => 'btn btn-danger big', 'icon' => Core::AssetsDir() . DS . 'Tile Icons' . DS . 'profile.png?tint=rgb(255,255,255)')); $expButton = Scaffold('cpanel.button', array('title' => 'Manage Data', 'className' => 'btn btn-success big', 'icon' => Core::AssetsDir() . DS . 'Map Item Icons' . DS . 'sm_clipboard.png?tint=rgb(255,255,255)')); IncludeJS(dirname(__DIR__) . DS . 'js' . DS . 'UIFormManager.js'); IncludeJS(dirname(__DIR__) . DS . 'js' . DS . 'UIUserList.js'); IncludeJS(dirname(__DIR__) . DS . 'js' . DS . 'UIUsersFormsList.js'); Scaffold('scheduled.workspace'); Scaffold('addendum.workspace'); Scaffold('quarterly.workspace'); Scaffold('user.workspace'); Scaffold('list.scheduled'); Scaffold('list.users'); Scaffold('list.utilities', $params); $q = (int) ((date('n') - 1) / 3); $quarters = array('1st', '2nd', '3rd', '4th'); $quarter = $quarters[$q]; IncludeJSBlock(' window.addEvent("load",function(){ var ajaxUrl=' . json_encode($params['url']) . '; UIFormManager.setAjaxUrl(ajaxUrl); UIFormManager.addForm({ name:"scheduled",
/** * @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')); }
public static function GetFormMetadata($formName) { ob_start(); Scaffold('form.' . $formName, array(), dirname(__DIR__) . '/views'); $html = ob_get_contents(); ob_end_clean(); if (empty($html) || strpos($html, 'invalid') === 0) { throw new Exception('Invalid Form form.' . $formName); } return self::_FieldMetadataArray($html); }
public static function ListAddendumsAndQuarterlies() { include_once dirname(__DIR__) . DS . 'database' . DS . 'ScheduleDatabase.php'; $db = ScheduleDatabase::GetInstance(); $countAddendums = 0; $json = json_decode(UrlVar('json')); if (!key_exists('participant-id', $json)) { throw new Exception('Expected $json->{\'participant-id\'}'); } $code = $json->{'participant-id'}; $max = 10; echo '{"results":' . "\n" . '{"addendums":[' . "\n"; $db->iterateAllAddendums(function ($record) use(&$countAddendums, $max) { if ($countAddendums > 0) { echo ", "; } $data = get_object_vars($record); $data['formData'] = json_decode($record->formData); $data['formData']->{'participant-id'} = $record->code; ob_start(); Scaffold('list.scheduled.item', $data, dirname(__DIR__) . DS . 'views'); $html = ob_get_contents(); ob_end_clean(); echo json_encode(array_merge($data, array('html' => $html)), JSON_PRETTY_PRINT); $countAddendums++; if ($countAddendums >= $max) { return false; } }, array('code' => $code, 'ORDER BY' => 'submitDate DESC')); echo '],' . "\n" . '"quarterlys":['; $countQuarterlys = 0; $db->iterateAllQuarterlys(function ($record) use(&$countQuarterlys, $max) { if ($countQuarterlys > 0) { echo ", "; } $data = get_object_vars($record); $data['formData'] = json_decode($record->formData); $data['formData']->{'participant-id'} = $record->code; ob_start(); Scaffold('list.scheduled.item', $data, dirname(__DIR__) . DS . 'views'); $html = ob_get_contents(); ob_end_clean(); echo json_encode(array_merge($data, array('html' => $html)), JSON_PRETTY_PRINT); $countQuarterlys++; if ($countQuarterlys >= $max) { return false; } }, array('code' => $code, 'ORDER BY' => 'submitDate DESC')); echo ']},' . "\n" . ' "success":true}'; return; }