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 = 'session-icon-background'; $_o->menu = (object) null; $_o->menu->items = array(); $items[] = CardKit::onTapEventsXHRCallMenuItem('Delete Session', 'cards/session/delete', array($_model->id)); $_o->body[] = CardKit::nextInCollection((object) array('model_id' => $_model->id, 'details_route' => 'cards/session/details')); $_o->body = array(); $dom_id = FormInputComponent::uniqueHash('', ''); $html = $js = array(); $js[] = DOMElementKitJS::documentEventOff('keydown'); $js[] = '$(document).on(\'keydown\',(function(e){'; $js[] = 'if (e.keyCode == 66){'; $js[] = 'new XHRCall({route:"operations/session/blockIP",inputs:[' . $_model->id . ']});'; $js[] = '}'; $js[] = 'if(next_id != \'' . $_model->id . '\'){'; $js[] = 'if (e.keyCode == 39){'; $js[] = 'new XHRCall({route:"cards/session/details",inputs:[next_id]});'; $js[] = '}'; $js[] = 'if (e.keyCode == 46){'; $js[] = 'new XHRCall({route:\'operations/session/delete\',inputs: [' . $_model->id . '],done_callback:function(){ new XHRCall({route:\'cards/session/details\',inputs:[next_id]});} });'; $js[] = '}'; $js[] = '}else{'; $js[] = 'if (e.keyCode == 46){'; $js[] = 'new XHRCall({route:\'operations/session/delete\',inputs: [' . $_model->id . ']});'; $js[] = '}'; $js[] = '}'; $js[] = '}));'; $_o->body[] = CardKitHTML::sublineBlock('Name'); $_o->body[] = $_model->name; $_o->body[] = CardKitHTML::sublineBlock('Ip Address'); $_o->body[] = $_model->ip_address; $_o->body[] = CardKitHTML::sublineBlock('Data'); $_o->body[] = '<textarea style="width:20em; height:10em;">' . $_model->session_data . '</textarea>'; $location = geoip_record_by_name($_model->ip_address); if ($location) { $_o->body[] = CardKitHTML::sublineBlock('Geo Location'); $_o->body[] = $location['city'] . (!empty($location['region']) ? ' ' . $location['region'] : '') . ', ' . $location['country_name'] . (!empty($location['postal_code']) ? ', ' . $location['postal_code'] : ''); } $_o->body[] = CardKitHTML::sublineBlock('Session Started'); $_o->body[] = date('g:ia \\o\\n l jS F Y', $_model->session_start); $_o->body[] = CardKitHTML::sublineBlock('Last Sign In'); $_o->body[] = CardKit::deleteInCollection((object) array('route' => 'operations/session/delete', 'model_id' => $_model->id)); $_o->body[] = CardKitHTML::modelId($_model); return $_o; }
public static function favorites() { $_o = (object) null; $_o->size = 'fullscreen'; $_o->icon_type = 'menu-icon'; $_o->icon_background = 'sequode-icon-background'; $_o->menu = (object) null; $_o->menu->items = array(); $_o->head = 'Sequode Favorites'; $dom_id = FormInputComponent::uniqueHash('', ''); $_o->menu->items[] = array('css_classes' => 'automagic-card-menu-item noSelect', 'id' => $dom_id, 'contents' => 'Empty Favorites', 'js_action' => DOMElementKitJS::onTapEventsXHRCall($dom_id, DOMElementKitJS::xhrCallObject('operations/user/emptySequodeFavorites', [], 'function(){registry.fetch({collection:\'sequode_favorites\'});}'))); $_o->body = array(); $_o->body[] = CardKit::collectionCard((object) array('collection' => 'sequode_favorites', 'icon' => 'sequode', 'card_route' => 'cards/sequode/favorites', 'details_route' => 'cards/sequode/details')); return $_o; }
public static function loadComponentHere($call_object, $contents = '', $icon = 'atom') { $html = $js = array(); $dom_id = FormInputComponent::uniqueHash(); $html[] = '<span id="' . $dom_id . 'c">'; $html[] = '<span class="automagic-card-text-button" id="' . $dom_id . 'b">'; $html[] = $contents; if ($icon != null) { $html[] = ' <div class="load-here-icon ' . $icon . '-icon-background"></div>'; } $html[] = '</span>'; $html[] = '</span>'; $call_object->inputs = array_merge($call_object->inputs, array(self::jsQuotedValue($dom_id . 'c'))); $js[] = '$(\'#' . $dom_id . 'b\').on("click touchend", function(){'; $js[] = self::xhrCall($call_object); $js[] = '});'; $components_object = (object) null; $components_object->dom_id = $dom_id; $components_object->html = implode('', $html); $components_object->js = implode('', $js); return $components_object; }
public static function my() { $_o = (object) null; $_o->size = 'fullscreen'; $_o->head = 'My Packages'; $_o->icon_type = 'menu-icon'; $_o->icon_background = 'atom-icon-background'; $_o->menu = (object) null; $_o->menu->items = array(); $dom_id = FormInputComponent::uniqueHash('', ''); $_o->menu->items[] = array('css_classes' => 'automagic-card-menu-item noSelect', 'id' => $dom_id, 'contents' => 'New Package', 'js_action' => DOMElementKitJS::onTapEventsXHRCall($dom_id, DOMElementKitJS::xhrCallObject('operations/package/newPackage'))); $_o->body = array(); $_o->body[] = CardKit::collectionCard((object) array('collection' => 'packages', 'icon' => 'atom', 'card_route' => 'cards/package/my', 'details_route' => 'cards/package/details')); return $_o; }
public static function onTapEventsXHRCallButton($contents, $route, $inputs = null, $callback = null) { $dom_id = FormInputComponent::uniqueHash('', ''); $html = $js = array(); $html[] = '<span class="btn" id="' . $dom_id . '">' . $contents . '</span>'; $js[] = DOMElementKitJS::onTapEventsXHRCall($dom_id, DOMElementKitJS::xhrCallObject($route, $inputs, $callback)); return (object) array('html' => implode('', $html), 'js' => implode('', $js)); }
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; }