public static function packageSequode($_model = null, $user_model = null) { $module = static::$module; $modeler = $module::model()->modeler; $_model = $_model == null ? forward_static_call_array(array($modeler, 'model'), array()) : $_model; $_user_model = $_user_model == null ? \Sequode\Application\Modules\Account\Modeler::model() : $_user_model; $_o = (object) null; $values = $where = array(); $values[] = '{\'value\':\'0\',\'printable\':\'Select Package Sequode\'}'; $sequodes_model = new \Sequode\Application\Modules\Sequode\Modeler::$model(); /* $where[] = array('field'=>'owner_id','operator'=>'=','value'=>5); $where[] = array('field'=>'shared','operator'=>'=','value'=>1); $where[] = array('field'=>'package','operator'=>'=','value'=>1); $sequodes_model->getAll($where); foreach( $sequodes_model->all as $object){ $values[] = '{\'value\':\''.$object->id.'\',\'printable\':\''.$object->name.'\'}'; } */ $where = array(); $where[] = array('field' => 'owner_id', 'operator' => '=', 'value' => $_user_model->id); $where[] = array('field' => 'package', 'operator' => '=', 'value' => 1); $sequodes_model->getAll($where); foreach ($sequodes_model->all as $object) { $values[] = '{\'value\':\'' . $object->id . '\',\'printable\':\'' . $object->name . '\'}'; } FormInputModeler::exists('select', 'name'); $_o->sequode = json_decode(FormInputModeler::model()->component_object); $_o->sequode->Label = ''; $_o->sequode->Values = '[' . implode(',', $values) . ']'; $_o->sequode->Value = $_model->sequode_id; $_o->sequode->Value_Key = 'value'; $_o->sequode->Printable_Key = 'printable'; return $_o; }
public static function search() { $_o = (object) null; FormInputModeler::exists('str', 'name'); $_o->search = json_decode(FormInputModeler::model()->component_object); $_o->search->Label = ''; $_o->search->Value = ''; $_o->search->Width = 200; $_o->search->CSS_Class = 'search-sequodes-input'; FormInputModeler::exists('select', 'name'); $_o->position = json_decode(FormInputModeler::model()->component_object); $_o->position->Label = ''; $_o->position->Values = "[{'value':'=%','printable':'Starts With'},{'value':'%=%','printable':'Contains'},{'value':'%=','printable':'Ends With'},{'value':'=','printable':'Exact'}]"; $_o->position->Value = '=%'; $_o->position->Value_Key = 'value'; $_o->position->Printable_Key = 'printable'; FormInputModeler::exists('select', 'name'); $_o->field = json_decode(FormInputModeler::model()->component_object); $_o->field->Label = ''; $_o->field->Values = "[{'value':'name','printable':'Search By Name'},{'value':'ip_address','printable':'Search By IP'}]"; $_o->field->Value = 'name'; $_o->field->Value_Key = 'value'; $_o->field->Printable_Key = 'printable'; return $_o; }
public static function verify() { $_o = (object) null; FormInputModeler::exists('str', 'name'); $_o->token = json_decode(FormInputModeler::model()->component_object); $_o->token->Label = ''; $_o->token->Value = ''; $_o->token->Width = 200; $_o->token->CSS_Class = 'focus-input'; return $_o; }
public static function secret() { $_o = (object) null; FormInputModeler::exists('password', 'name'); $_o->secret = json_decode(FormInputModeler::model()->component_object); $_o->secret->Label = ''; $_o->secret->Value = ''; $_o->secret->Width = 200; $_o->secret->CSS_Class = 'focus-input'; return $_o; }
public static function details($_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 = 'large'; $_o->icon_type = 'menu-icon'; $_o->icon_background = 'sequode-icon-background'; $_o->menu = (object) null; $_o->menu->items = self::modelOperationsMenuItems(); $_o->head = 'Sequode Details'; $_o->size = 'large'; $_o->body = array(''); $_o->body[] = (object) array('js' => 'registry.setContext({card:\'cards/sequode/details\',collection:\'sequodes\',node:\'' . $_model->id . '\'});'); $input_object = json_decode($_model->input_object); $property_object = json_decode($_model->property_object); $output_object = json_decode($_model->output_object); $input_object_detail = json_decode($_model->input_object_detail); $property_object_detail = json_decode($_model->property_object_detail); $output_object_detail = json_decode($_model->output_object_detail); $input_form_object = json_decode($_model->input_form_object); $property_form_object = json_decode($_model->property_form_object); $_o->body[] = CardKitHTML::sublineBlock('Name'); $text = $_model->name; $_o->body[] = \Sequode\Application\Modules\Account\Authority::canEdit() ? DOMElementKitJS::loadComponentHere(DOMElementKitJS::xhrCallObject('forms/sequode/name', array($_model->id)), $text, 'settings') : $text; $_o->body[] = CardKitHTML::sublineBlock('Description'); $text = json_decode($_model->detail)->description; $text = !empty($text) ? $text : 'Sequode needs description.'; $_o->body[] = \Sequode\Application\Modules\Account\Authority::canEdit() ? DOMElementKitJS::loadComponentHere(DOMElementKitJS::xhrCallObject('forms/sequode/description', array($_model->id)), $text, 'settings') : $text; if (\Sequode\Application\Modules\Sequode\Authority::isCode() && $_model->owner_id == 8) { $dom_id = FormInputComponent::uniqueHash('', ''); $html = $js = array(); $html = '<div class="subline" id="' . $dom_id . '">More info</div>'; $js = DOMElementKitJS::onTapEvents($dom_id, 'var win = window.open(\'http://php.net/' . $_model->name . '\', \'_blank\'); win.focus();'); $_o->body[] = (object) array('html' => $html, 'js' => $js); } if (\Sequode\Application\Modules\Sequode\Authority::isSequence() && !\Sequode\Application\Modules\Sequode\Authority::isEmptySequence()) { $_o->body[] = CardKit::onTapEventsXHRCallButton('View Chart', 'cards/sequode/chart', array($_model->id)); } if (\Sequode\Application\Modules\Sequode\Authority::isSequence() && \Sequode\Application\Modules\Account\Authority::canEdit($_model)) { $_o->body[] = CardKit::onTapEventsXHRCallButton('Edit Chart', 'cards/sequode/sequencer', array($_model->id)); } if (\Sequode\Application\Modules\Sequode\Authority::isSequence()) { $_o->body[] = CardKitHTML::sublineBlock('Sequence'); $sequence = json_decode($_model->sequence); $model_object_cache = array(); if (!\Sequode\Application\Modules\Sequode\Authority::isEmptySequence($_model)) { foreach ($sequence as $loop_sequence_key => $loop_model_id) { if (!array_key_exists($loop_model_id, $model_object_cache)) { $model_object_cache[$loop_model_id] = new \Sequode\Application\Modules\Sequode\Modeler::$model(); $model_object_cache[$loop_model_id]->exists($loop_model_id, 'id'); } $text = '(' . ($loop_sequence_key + 1) . ') ' . $model_object_cache[$loop_model_id]->name; $_o->body[] = \Sequode\Application\Modules\Account\Authority::canEdit() ? DOMElementKitJS::loadComponentHere(DOMElementKitJS::xhrCallObject('cards/sequode/internalPositionForms', array($_model->id, $loop_sequence_key)), $text, 'settings') : $text; } } else { $_o->body[] = 'Sequode is empty.'; } } if (\Sequode\Application\Modules\Account\Authority::isSystemOwner()) { $_o->body[] = CardKitHTML::sublineBlock('Use Policy'); $text = \Sequode\Application\Modules\Sequode\Authority::isShared() ? 'Public Use' : 'System Restricted Use'; $_o->body[] = DOMElementKitJS::loadComponentHere(DOMElementKitJS::xhrCallObject('forms/sequode/sharing', array($_model->id)), $text, 'atom'); } if (\Sequode\Application\Modules\Sequode\Authority::isSequence() && !\Sequode\Application\Modules\Sequode\Authority::isEmptySequence()) { $_o->body[] = CardKitHTML::sublineBlock('Palettes Menu Visibility'); $text = \Sequode\Application\Modules\Sequode\Authority::isPalette() ? 'Shown in Palettes Menu' : 'Hidden from Palettes Menu'; $_o->body[] = \Sequode\Application\Modules\Account\Authority::canEdit($_model) ? DOMElementKitJS::loadComponentHere(DOMElementKitJS::xhrCallObject('forms/sequode/updateIsPalette', array($_model->id)), $text, 'settings') : $text; } foreach (array('input', 'property') as $type) { switch ($type) { case 'input': $type_title = 'Inputs'; $type_object = $input_object; $type_object_detail = $input_object_detail; $type_form_object = $input_form_object; break; case 'property': $type_title = 'Properties'; $type_object = $property_object; $type_object_detail = $property_object_detail; $type_form_object = $property_form_object; break; } if ($type_object != (object) null) { $_o->body[] = CardKitHTML::sublineBlock($type_title); foreach ($type_object as $member => $value) { $_o->body[] = $member . ' (' . $type_object_detail->{$member}->type . ') ' . ($type_object_detail->{$member}->required == true ? 'required' : 'optional'); FormInputModeler::exists($type_form_object->{$member}->Component, 'name'); $text = 'Form Component : ' . FormInputModeler::model()->printable_name; $_o->body[] = \Sequode\Application\Modules\Account\Authority::canEdit() ? DOMElementKitJS::loadComponentHere(DOMElementKitJS::xhrCallObject('cards/sequode/componentSettings', array(\Sequode\Component\Form\Form::jsQuotedValue($type), \Sequode\Component\Form\Form::jsQuotedValue($member), $_model->id)), $text, 'settings') : $text; } } } if ($output_object != (object) null) { $_o->body[] = CardKitHTML::sublineBlock('Outputs'); foreach ($output_object as $member => $value) { $_o->body[] = $member . ' (' . $output_object_detail->{$member}->type . ')'; } $_o->body[] = ''; } $_o->body[] = CardKit::nextInCollection((object) array('model_id' => $_model->id, 'details_route' => 'cards/sequode/details')); if (\Sequode\Application\Modules\Account\Authority::isSystemOwner()) { $_o->body[] = CardKitHTML::modelId($_model); } return $_o; }
public static function selectPalette($user_model = null) { if ($user_model == null) { $user_model = \Sequode\Application\Modules\Account\Modeler::model(); } $components_object = (object) null; $values = $where = array(); $values[] = '{\'value\':\'0\',\'printable\':\'Select Sequodes Palette\'}'; //$values[] = '{\'value\':\'sequode_search\',\'printable\':\'Sequode Search Results\'}'; $values[] = '{\'value\':\'sequode_favorites\',\'printable\':\'My Sequode Favorites\'}'; $where[] = array('field' => 'owner_id', 'operator' => '=', 'value' => 5); $where[] = array('field' => 'shared', 'operator' => '=', 'value' => 1); $where[] = array('field' => 'palette', 'operator' => '=', 'value' => 1); $sequodes_model = new \Sequode\Application\Modules\Sequode\Modeler::$model(); $sequodes_model->getAll($where); foreach ($sequodes_model->all as $object) { $values[] = '{\'value\':\'' . $object->id . '\',\'printable\':\'' . $object->name . '\'}'; } $where = array(); $where[] = array('field' => 'owner_id', 'operator' => '=', 'value' => \Sequode\Application\Modules\Account\Modeler::model()->id); $where[] = array('field' => 'palette', 'operator' => '=', 'value' => 1); $sequodes_model->getAll($where); foreach ($sequodes_model->all as $object) { $values[] = '{\'value\':\'' . $object->id . '\',\'printable\':\'' . $object->name . '\'}'; } FormInputModeler::exists('select', 'name'); $components_object->palette = json_decode(FormInputModeler::model()->component_object); $components_object->palette->Label = ''; $components_object->palette->Values = '[' . implode(',', $values) . ']'; $components_object->palette->Value = '0'; $components_object->palette->Value_Key = 'value'; $components_object->palette->Printable_Key = 'printable'; return $components_object; }
public static function updateName($_model = null) { $module = static::$module; $modeler = $module::model()->modeler; $_model == null ? forward_static_call_array(array($modeler, 'model'), array()) : forward_static_call_array(array($modeler, 'model'), array($_model)); $_o = (object) null; FormInputModeler::exists('str', 'name'); $_o->name = json_decode(FormInputModeler::model()->component_object); $_o->name->Label = ''; $_o->name->Value = $_model->name; $_o->name->Width = 200; return $_o; }
public static function render($_i) { $timeout_var_name = FormInputComponent::uniqueHash(); $dom_ids = self::domIds($_i->form_inputs); $js_event = (object) null; $submit_js = ''; if ($_i->submit_js != null) { $submit_js = str_replace(static::$collection_replacement_hook, self::collectValues($_i->form_inputs, $dom_ids), $_i->submit_js); } else { $submit_js = str_replace(static::$collection_replacement_hook, self::collectValues($_i->form_inputs, $dom_ids), self::xhrCall($_i->submit_xhr_call_route, $_i->submit_xhr_call_parameters)); } $event_js = array(); if ($_i->auto_submit_time != null) { $event_js[] = self::registerTimeout($timeout_var_name, $submit_js, $_i->auto_submit_time); $js_event->Value_Changed = implode(' ', $event_js); } $event_js = array(); if ($_i->submit_on_enter == true) { $event_js[] = self::enterPressed(self::registerTimeout($timeout_var_name, $submit_js)); $js_event->On_Key_Up = implode(' ', $event_js); } $components_array = self::renderFormInputs($_i->form_inputs, $dom_ids, array($js_event)); if ($_i->submit_button != null) { FormInputModeler::exists('button', 'name'); $button_component = json_decode(FormInputModeler::model()->component_object); $button_component->Value = $_i->submit_button; $button_component->CSS_Class = 'btn'; $button_component->On_Click = self::registerTimeout($timeout_var_name, $submit_js); $components_array[] = FormInputComponent::render($button_component); } return $components_array; }