public static function render($module_registry_key, $component, $parameters = null) { $module = ModuleRegistry::module($module_registry_key); $component_source = $module::model()->components->forms; $component_object = FormComponent::fetchObject($component_source, $component, $parameters == null ? array() : !is_array($parameters) ? array($parameters) : $parameters); return FormComponent::render($component_object); }
public static function search() { $module = static::$module; $context = $module::model()->context; $form_inputs = $module::model()->components->form_inputs; $_o = FormComponent::formObject(); $_o->form_inputs = FormComponent::formInputs($form_inputs, __FUNCTION__, func_get_args()); $_o->submit_xhr_call_route = FormComponent::xhrCallRoute($context, 'operations', 'search'); $_o->auto_submit_time = 1; return $_o; }
public static function password() { $module = static::$module; $context = $module::model()->context; $form_inputs = $module::model()->components->form_inputs; $_o = FormComponent::formObject(); $_o->form_inputs = FormComponent::formInputs($form_inputs, __FUNCTION__, func_get_args()); $_o->submit_xhr_call_route = FormComponent::xhrCallRoute($context, 'operations', 'updatePassword'); $_o->submit_button = 'Next'; return $_o; }
public static function signup() { $module = static::$module; $dialogs = $module::model()->components->dialogs; $dialog = forward_static_call_array(array($dialogs, __FUNCTION__), array()); if (!SessionStore::is($dialog->session_store_key)) { SessionStore::set($dialog->session_store_key, $dialog->session_store_setup); } $dialog_store = SessionStore::get($dialog->session_store_key); $step = $dialog->steps[$dialog_store->step]; $_o = (object) null; $_o->icon_background = 'users-icon-background'; $_o->size = 'small'; if ($dialog_store->step != 0 && $dialog_store->step < count($dialog->steps) - 1) { $_o->menu = (object) null; $_o->menu->items = array(); $_o->menu->items[] = CardKit::onTapEventsXHRCallMenuItem('Start Over', 'operations/account/' . __FUNCTION__, array(FormComponent::jsQuotedValue('{"reset":"1"}'))); } $_o->head = ' Create Account'; $_o->body = array(''); if (isset($step->content)) { if (isset($step->content->head)) { $_o->body[] = '<div class="subline">' . $step->content->head . '</div>'; } if (isset($step->content->head)) { $_o->body[] = $step->content->body; } } if (isset($step->forms)) { foreach ($step->forms as $form) { $_o->body = array_merge($_o->body, ModuleForm::render($module::$registry_key, $form)); } } if ($dialog_store->step != 0 && $dialog_store->step < count($dialog->steps) - 1) { $_o->body[] = CardKit::resetDialogButton('operations/register/' . __FUNCTION__); } $_o->body[] = (object) array('js' => '$(\'.focus-input\').focus(); $(\'.focus-input\').select();'); return $_o; }
public static function sequencer($_model = null) { $module = static::$module; $modeler = $module::model()->modeler; $_model = $_model == null ? forward_static_call_array(array($modeler, 'model'), array()) : forward_static_call_array(array($modeler, 'model'), array($_model)); $_o = (object) null; $_o->size = 'fullscreen'; $_o->icon_type = 'menu-icon'; $_o->icon_background = 'sequode-icon-background'; $_o->menu = (object) null; $_o->menu->items = self::modelOperationsMenuItems(); $_o->head = 'Sequode Chart > Edit > ' . $_model->name; $items = array(); $items[] = array('css_classes' => 'automagic-card-menu-item-label noSelect', 'contents' => 'Select Palette'); $dom_id = FormInputComponent::uniqueHash('', ''); $items[] = array('css_classes' => 'automagic-card-menu-item noSelect', 'id' => $dom_id, 'js_action' => 'new XHRCall({route:\'forms/sequode/selectPalette\',inputs:[' . \Sequode\Component\Form\Form::jsQuotedValue($dom_id) . ']});'); $_o->menu->items = array_merge($items, $_o->menu->items); $_o->body = array(); $dom_id = FormInputComponent::uniqueHash('', ''); $html = $js = array(); $html[] = '<div class="SequencerStageContainer" id="' . $dom_id . 'chart"></div>'; $js[] = 'var sequencer;'; $js[] = 'sequencer = new Sequencer();'; $js[] = 'sequencer.stage = shapesKit.stage({ container: \'' . $dom_id . 'chart\', width: $(window).width(), height: $(window).height() });'; $js[] = 'registry.setContext({card:\'cards/sequode/chart\',collection:\'sequodes\',node:' . $_model->id . ',tearDown:function(){ sequencer = undefined; }});'; $js[] = 'registry.subscribeToUpdates({type:\'context\', collection:\'sequodes\', key:true, call: sequencer.run});'; $js[] = 'registry.subscribeToUpdates({type:\'context\', collection:\'palette\', call: sequencer.palette.run});'; $js[] = 'registry.fetch({collection:\'sequodes\',key:' . $_model->id . '});'; $_o->body[] = (object) array('html' => implode('', $html), 'js' => implode(' ', $js)); return $_o; }
public static function selectPalette() { $module = static::$module; $modeler = $module::model()->modeler; $context = $module::model()->context; $form_inputs = $module::model()->components->form_inputs; $_model == null ? forward_static_call_array(array($modeler, 'model'), array()) : forward_static_call_array(array($modeler, 'model'), array($_model)); $_o = FormComponent::formObject(); $_o->form_inputs = FormComponent::formInputs($form_inputs, __FUNCTION__, func_get_args()); $_o->submit_xhr_call_route = FormComponent::xhrCallRoute($context, 'operations', 'selectPalette'); $_o->auto_submit_time = 1; return $_o; }
public static function resetDialogButton($route) { $dom_id = FormInputComponent::uniqueHash('', ''); $html = $js = array(); $html[] = '<span class="btn" id="' . $dom_id . '">Reset</span>'; $js[] = DOMElementKitJS::onTapEventsXHRCall($dom_id, DOMElementKitJS::xhrCallObject($route, array(Form::jsQuotedValue('{"reset":"1"}')))); return (object) array('html' => implode('', $html), 'js' => implode('', $js)); }
public static function updateName($_model = null) { $module = static::$module; $modeler = $module::model()->modeler; $context = $module::model()->context; $form_inputs = $module::model()->components->form_inputs; $_model == null ? forward_static_call_array(array($modeler, 'model'), array()) : forward_static_call_array(array($modeler, 'model'), array($_model)); $_o = FormComponent::formObject(); $_o->form_inputs = FormComponent::formInputs($form_inputs, __FUNCTION__, func_get_args()); $_o->submit_xhr_call_route = FormComponent::xhrCallRoute($context, 'operations', 'updateName'); $_o->auto_submit_time = 2000; $_o->submit_xhr_call_parameters = array(); $_o->submit_xhr_call_parameters[] = $modeler::model()->id; $_o->submit_xhr_call_parameters[] = FormComponent::$collection_replacement_hook; return $_o; }