コード例 #1
0
ファイル: Forms.class.php プロジェクト: shawnlawyer/framework
 public static function name($_model_id, $dom_id)
 {
     $module = static::$module;
     $modeler = $module::model()->modeler;
     if (!($modeler::exists($_model_id, 'id') && (\Sequode\Application\Modules\Account\Authority::isOwner($modeler::model()) || \Sequode\Application\Modules\Account\Authority::isSystemOwner()))) {
         return;
     }
     return DOMElementKitJS::placeForm(ModuleForm::render($module::$registry_key, __FUNCTION__), $dom_id);
 }
コード例 #2
0
ファイル: Forms.class.php プロジェクト: shawnlawyer/framework
 public static function updateName($_model_id, $dom_id)
 {
     $module = static::$module;
     $modeler = $module::model()->modeler;
     if (!$modeler::exists($_model_id, 'id')) {
         return;
     }
     return DOMElementKitJS::placeForm(ModuleForm::render($module::$registry_key, __FUNCTION__), $dom_id);
 }
コード例 #3
0
 public static function search($json)
 {
     $_o = json_decode(stripslashes($json));
     $_o = !is_object($_o) || (trim($_o->search) == '' || empty(trim($_o->search))) ? (object) null : $_o;
     $collection = 'token_search';
     SessionStore::set($collection, $_o);
     $js = array();
     $js[] = DOMElementKitJS::fetchCollection($collection);
     return implode(' ', $js);
 }
コード例 #4
0
ファイル: Cards.class.php プロジェクト: shawnlawyer/framework
 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;
 }
コード例 #5
0
 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);
 }
コード例 #6
0
ファイル: JS.class.php プロジェクト: shawnlawyer/framework
 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);
 }
コード例 #7
0
ファイル: Cards.class.php プロジェクト: shawnlawyer/framework
 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;
 }
コード例 #8
0
 public static function selectPalette($json)
 {
     $module = static::$module;
     $modeler = $module::model()->modeler;
     $_o = json_decode(stripslashes($json));
     if (!is_object($_o) || (trim($_o->palette) == '' || empty(trim($_o->palette)))) {
         SessionStore::set('palette', false);
     } else {
         switch ($_o->palette) {
             case 'sequode_search':
             case 'sequode_favorites':
                 SessionStore::set('palette', $_o->palette);
                 break;
             default:
                 if ($modeler::exists($_o->palette, 'id') && \Sequode\Application\Modules\Account\Authority::canView()) {
                     SessionStore::set('palette', $_o->palette);
                 }
                 break;
         }
     }
     $js[] = DOMElementKitJS::fetchCollection('palette');
     return implode(' ', $js);
 }
コード例 #9
0
 public static function search($json)
 {
     $module = static::$module;
     $_o = json_decode(stripslashes($json));
     $_o = !is_object($_o) || (trim($_o->search) == '' || empty(trim($_o->search))) ? (object) null : $_o;
     $collection = $module::model()->context . '_' . __FUNCTION__;
     SessionStore::set($collection, $_o);
     $js = array();
     $js[] = DOMElementKitJS::fetchCollection($collection);
     return implode(' ', $js);
 }
コード例 #10
0
ファイル: Cards.class.php プロジェクト: shawnlawyer/framework
 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;
 }
コード例 #11
0
 public static function checkbox($component)
 {
     $html = $js = $class = $style = array();
     $output_component = (object) array('dom_id' => '', 'html' => '', 'js' => '');
     $dom_id = $value = '';
     if (isset($component->Dom_Id)) {
         $dom_id = $component->Dom_Id;
     }
     if (isset($component->Value)) {
         $value = self::formatValue($component->Value);
     }
     if (isset($component->On_Focus)) {
         $js[] = DOMElementKitJS::addEventListenerJS($dom_id, 'focus', $component->On_Focus);
     }
     if (isset($component->On_Blur)) {
         $js[] = DOMElementKitJS::addEventListenerJS($dom_id, 'blur', $component->On_Blur);
     }
     if (isset($component->On_Change)) {
         $js[] = DOMElementKitJS::addEventListenerJS($dom_id, 'change', $component->On_Change);
     }
     if (isset($component->On_Key_Up)) {
         $js[] = DOMElementKitJS::addEventListenerJS($dom_id, 'keyup', $component->On_Key_Up);
     }
     if (isset($component->On_Key_Down)) {
         $js[] = DOMElementKitJS::addEventListenerJS($dom_id, 'keydown', $component->On_Key_Down);
     }
     if (isset($component->On_Key_Press)) {
         $js[] = DOMElementKitJS::addEventListenerJS($dom_id, 'keypress', $component->On_Key_Press);
     }
     if (isset($component->On_Click)) {
         $js[] = DOMElementKitJS::addEventListenerJS($dom_id, 'click', $component->On_Click);
     }
     if (isset($component->Value_Changed)) {
         $js[] = DOMElementKitJS::addEventListenerJS($dom_id, 'change', $component->Value_Changed);
     }
     if (isset($component->CSS_Class)) {
         $class[] = self::formatValue($component->CSS_Class);
     }
     if (isset($component->CSS_Style)) {
         $style[] = self::formatValue($component->CSS_Style);
     }
     $class = implode(' ', $class);
     $style = implode(' ', $style);
     if (isset($component->Label) && trim($component->Label) != '') {
         $label_component = (object) null;
         $label_component->Dom_Id = $dom_id . 'Label';
         $label_component->For_Dom_Id = $dom_id;
         $label_component->Value = $component->Label;
         $output_component = self::mergeComponents($output_component, self::divLabel($label_component));
     }
     $html[] = '<input';
     $html[] = 'type="checkbox"';
     $html[] = 'class="' . $class . '"';
     $html[] = 'id="' . $dom_id . '"';
     $html[] = 'value="' . $value . '"';
     $html[] = 'style="' . $style . '"';
     if ($component->Value == $component->Checked_Value) {
         $html[] = 'checked="checked"';
     }
     $html[] = '/>';
     $label_component = (object) null;
     $label_component->Dom_Id = $dom_id . 'LabelText"';
     $label_component->For_Dom_Id = $dom_id;
     $label_component->Value = $component->Display_Value;
     $output_component = self::mergeComponents($output_component, (object) array('html' => implode(' ', $html), 'js' => implode(' ', $js)));
     $output_component = self::mergeComponents($output_component, self::label($label_component));
     return $output_component;
 }
コード例 #12
0
ファイル: Forms.class.php プロジェクト: shawnlawyer/framework
 public static function selectPalette($dom_id)
 {
     $module = static::$module;
     return DOMElementKitJS::placeForm(ModuleForm::render($module::$registry_key, __FUNCTION__), $dom_id);
 }
コード例 #13
0
ファイル: Cards.class.php プロジェクト: shawnlawyer/framework
 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;
 }
コード例 #14
0
 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));
 }