Exemple #1
0
 public static function placeForm($form, $dom_id)
 {
     $html = $js = array();
     if (count($form) == 1) {
         foreach ($form as $key => $object) {
             if (isset($object->html)) {
                 $html[] = $object->html;
             }
         }
     } else {
         $html[] = CardKitHTML::contentRowDivider();
         foreach ($form as $key => $object) {
             if (isset($object->html)) {
                 $html[] = $object->html;
                 $html[] = CardKitHTML::contentRowDivider();
             }
         }
     }
     $js[] = self::addIntoDom($dom_id, implode('', $html), 'replace');
     foreach ($form as $key => $object) {
         if (isset($object->js)) {
             $js[] = $object->js;
         }
     }
     $js[] = '$(\'.focus-input\').focus();';
     $js[] = '$(\'.focus-input\').select();';
     return implode(' ', $js);
 }
 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 = 'atom-icon-background';
     $_o->menu = (object) null;
     $_o->menu->items = self::modelOperationsMenuItems();
     $_o->head = 'Package Details';
     $_o->body = array('');
     $_o->body[] = (object) array('js' => 'registry.setContext({card:\'cards/package/details\',collection:\'packages\',node:\'' . $_model->id . '\'});');
     $_o->body[] = CardKitHTML::sublineBlock('Name');
     $_o->body[] = DOMElementKitJS::loadComponentHere(DOMElementKitJS::xhrCallObject('forms/package/name', array($_model->id)), $_model->name, 'settings');
     $_o->body[] = CardKitHTML::sublineBlock('Package Sequode');
     $_o->body[] = $_model->sequode_id != 0 && \Sequode\Application\Modules\Sequode\Modeler::exists($_model->sequode_id, 'id') ? DOMElementKitJS::loadComponentHere(DOMElementKitJS::xhrCallObject('forms/package/packageSequode', array($_model->id)), \Sequode\Application\Modules\Sequode\Modeler::model()->name, 'settings') : ModuleForm::render(static::$registry_key, 'packageSequode')[0];
     $_o->body[] = CardKitHTML::sublineBlock('Package Token');
     $_o->body[] = $_model->token;
     $_o->body[] = CardKitHTML::sublineBlock('<a target="_blank" href="/source/' . $_model->token . '">Download</a>');
     $_o->body[] = CardKit::nextInCollection((object) array('model_id' => $_model->id, 'details_route' => 'cards/package/details'));
     if (\Sequode\Application\Modules\Account\Authority::isSystemOwner()) {
         $_o->body[] = CardKitHTML::modelId($_model);
     }
     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 = '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 details()
 {
     $module = static::$module;
     $modeler = $module::model()->modeler;
     $operations = $module::model()->operations;
     $_model = forward_static_call_array(array($modeler, 'model'), array());
     $_o = (object) null;
     $_o->head = 'Account Detail';
     $_o->icon_type = 'menu-icon';
     $_o->icon_background = 'user-icon-background';
     $_o->body[] = CardKitHTML::sublineBlock('Email');
     $_o->body[] = $_model->email;
     if (\Sequode\Application\Modules\Account\Authority::isSystemOwner()) {
         $_o->body[] = CardKitHTML::modelId($_model);
     }
     return $_o;
 }
 public static function menus($dom_id = 'MenusContainer')
 {
     $modules = ModuleRegistry::modules();
     $html = $js = array();
     $i = count($modules);
     foreach ($modules as $module) {
         $model = $module::model();
         if (isset($model->components->cards)) {
             if (in_array('menu', get_class_methods($model->components->cards))) {
                 $i--;
                 $card = ModuleCard::render($module::$registry_key, 'menu');
                 $html[] = CardKitHTML::menuCardHidingContainer($card->html, $i);
                 $js[] = $card->js;
             }
         }
     }
     return DOMElementKitJS::addIntoDom($dom_id, implode('', $html), 'replace') . implode(' ', $js);
 }
Exemple #6
0
 public static function placeDeck($deck, $dom_id = 'CardsContainer', $clear = true, $divide = true, $shim = true)
 {
     $html = $js = array();
     if ($divide != false) {
         $html[] = CardKitHTML::divider($shim != false ? false : true);
     }
     foreach ($deck as $card) {
         if (isset($card->html)) {
             $html[] = $card->html;
         }
     }
     $js[] = DOMElementKitJS::addIntoDom($dom_id, implode($shim != false ? CardKitHTML::shim(false, false) : '', $html), $clear != false ? 'replace' : 'append');
     foreach ($deck as $card) {
         if (isset($card->js)) {
             $js[] = $card->js;
         }
     }
     return implode(' ', $js);
 }
 public static function details($_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;
     $_o->size = 'large';
     $_o->icon_type = 'menu-icon';
     $_o->icon_background = 'user-icon-background';
     $_o->menu = (object) null;
     $_o->menu->items = self::modelOperationsMenuItems();
     $_o->head = 'User Detail';
     $_o->body = array('');
     $_o->body[] = CardKitHTML::sublineBlock('Name');
     $_o->body[] = DOMElementKitJS::loadComponentHere(DOMElementKitJS::xhrCallObject('forms/user/updateName', array($modeler::model()->id)), $modeler::model()->name, 'settings');
     $_o->body[] = CardKitHTML::sublineBlock('Password');
     $_o->body[] = DOMElementKitJS::loadComponentHere(DOMElementKitJS::xhrCallObject('forms/user/updatePassword', array($modeler::model()->id)), 'Set Password', 'settings');
     $_o->body[] = CardKitHTML::sublineBlock('Role');
     \Sequode\Application\Modules\Role\Modeler::exists($modeler::model()->role_id, 'id');
     $_o->body[] = DOMElementKitJS::loadComponentHere(DOMElementKitJS::xhrCallObject('forms/user/updateRole', array($modeler::model()->id)), \Sequode\Application\Modules\Role\Modeler::model()->name, 'settings');
     $_o->body[] = CardKitHTML::sublineBlock('Active Status');
     $_o->body[] = DOMElementKitJS::loadComponentHere(DOMElementKitJS::xhrCallObject('forms/user/updateActive', array($modeler::model()->id)), $modeler::model()->active == 1 ? 'Active' : 'Suspended', 'settings');
     $_o->body[] = CardKitHTML::sublineBlock('Sign Up Date');
     $_o->body[] = date('g:ia \\o\\n l jS F Y', $modeler::model()->sign_up_date);
     $_o->body[] = CardKitHTML::sublineBlock('Allowed Sequode Count');
     $_o->body[] = $modeler::model()->allowed_sequode_count;
     $_o->body[] = CardKitHTML::sublineBlock('Favorite Sequodes');
     $_o->body[] = $modeler::model()->sequode_favorites;
     $_o->body[] = CardKitHTML::sublineBlock('Email');
     $_o->body[] = $modeler::model()->email;
     $_o->body[] = CardKit::ownedItemsCollectionTile('Sequode', 'Sequodes Created : ', $modeler::model());
     $_o->body[] = CardKit::ownedItemsCollectionTile('Package', 'Packages Created : ', $modeler::model());
     $_o->body[] = CardKit::ownedItemsCollectionTile('Token', 'Tokens Created : ', $modeler::model());
     $_o->body[] = CardKit::nextInCollection((object) array('model_id' => $modeler::model()->id, 'details_route' => 'cards/user/details'));
     if (\Sequode\Application\Modules\Account\Authority::isSystemOwner()) {
         $_o->body[] = CardKitHTML::modelId($modeler::model());
     }
     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 = 'atom-icon-background';
     $_o->menu = (object) null;
     $_o->menu->items = self::modelOperationsMenuItems();
     $_o->head = 'Token Details';
     $_o->body = array('');
     $_o->body[] = (object) array('js' => 'registry.setContext({card:\'cards/token/details\',collection:\'tokens\',node:\'' . $_model->id . '\'});');
     $_o->body[] = CardKitHTML::sublineBlock('Name');
     $_o->body[] = DOMElementKitJS::loadComponentHere(DOMElementKitJS::xhrCallObject('forms/token/name', array($_model->id)), $_model->name, 'settings');
     $_o->body[] = CardKitHTML::sublineBlock('Token');
     $_o->body[] = $_model->token;
     $_o->body[] = CardKit::nextInCollection((object) array('model_id' => $_model->id, 'details_route' => 'cards/token/details'));
     if (\Sequode\Application\Modules\Account\Authority::isSystemOwner()) {
         $_o->body[] = CardKitHTML::modelId($_model);
     }
     return $_o;
 }
 public static function internalPositionForms($position, $_model = null)
 {
     $position = intval($position);
     $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 = 'medium';
     $_o->icon_type = 'menu-icon';
     $_o->icon_background = 'sequode-icon-background';
     $_o->menu = (object) null;
     $input_object_map = json_decode($_model->input_object_map);
     $default_input_object_map = json_decode($_model->default_input_object_map);
     $property_object_map = json_decode($_model->property_object_map);
     $default_property_object_map = json_decode($_model->default_property_object_map);
     $sequence = json_decode($_model->sequence);
     if (!isset($sequence[$position])) {
         return;
     }
     $sequence_model_id = $sequence[$position];
     $sequence_model = new \Sequode\Application\Modules\Sequode\Modeler::$model();
     $sequence_model->exists($sequence_model_id, 'id');
     $_o->head = $sequence_model->name;
     $_o->menu->items = self::modelOperationsMenuItems('', $sequence_model);
     $_o->body = array();
     $_o->body[] = '';
     $sequence_model->input_object_detail = json_decode($sequence_model->input_object_detail);
     $sequence_model->property_object_detail = json_decode($sequence_model->property_object_detail);
     $types = array('input', 'property');
     $type_labels = array('input' => 'Inputs', 'property' => 'Properties');
     $detail_objects = array('input' => 'input_object_detail', 'property' => 'property_object_detail');
     $maps = array('input' => $input_object_map, 'property' => $property_object_map);
     $default_maps = array('input' => $default_input_object_map, 'property' => $default_property_object_map);
     $possible_components = array();
     foreach ($types as $type) {
         $map = $maps[$type];
         $default_map = $default_maps[$type];
         $detail_object_member = $detail_objects[$type];
         foreach ($default_map as $map_key => $location_object) {
             if ($map_key == 0) {
                 continue;
             }
             $sequence_key = $location_object->Key - 1;
             if ($sequence_key < $position) {
                 continue;
             }
             if ($sequence_key > $position) {
                 break;
             }
             $member = $location_object->Member;
             $component_object = (object) null;
             $component_object->map_key = $map_key;
             $component_object->type = $type;
             $component_object->sequence_key = $sequence_key;
             $component_object->member = $member;
             $component_object->required = $sequence_model->{$detail_object_member}->{$member}->required;
             $component_object->connected = !($map[$map_key]->Key == $location_object->Key && $map[$map_key]->Stack == $location_object->Stack) ? true : false;
             $component_object->value_set = $component_object->connected == false && !empty($map[$map_key]->Value) ? true : false;
             $possible_components[] = $component_object;
         }
     }
     foreach ($possible_components as $component) {
         if ($type_labels[$component->type] != false) {
             $_o->body[] = CardKitHTML::sublineBlock($type_labels[$component->type]);
             $type_labels[$component->type] = false;
         }
         if ($component->connected == true) {
             $text = $component->member;
             $_o->body[] = DOMElementKitJS::loadComponentHere(DOMElementKitJS::xhrCallObject('forms/sequode/component', array(\Sequode\Component\Form\Form::jsQuotedValue($component->type), $_model->id, $component->map_key)), $text, 'settings');
         } elseif ($component->required == false && $component->value_set == false) {
             $text = $component->member;
             $_o->body[] = DOMElementKitJS::loadComponentHere(DOMElementKitJS::xhrCallObject('forms/sequode/component', array(\Sequode\Component\Form\Form::jsQuotedValue($component->type), $_model->id, $component->map_key)), $text, 'settings');
         } else {
             $components_array = ModuleForm::render($module::$registry_key, 'component', array($component->type, $component->map_key, $_model));
             foreach ($components_array as $component_object) {
                 $_o->body[] = $component_object;
             }
         }
     }
     return $_o;
 }