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($_i, $limit = 100)
 {
     $modeler = static::$modeler;
     $_i->position = urldecode($_i->position);
     //$_i->field = urldecode($_i->field);
     if (!in_array($_i->position, array('=%', '%=%', '%=', '='))) {
         $_i->position = '=%';
     }
     // if(!in_array($_i->field, array('name','ip_address'))){
     $_i->field = 'name';
     //}
     if (\Sequode\Application\Modules\Account\Authority::isSystemOwner()) {
         $where = array();
         if (isset($shared_where)) {
             $where[] = $shared_where;
         }
         $where[] = array('field' => $_i->field, 'operator' => $_i->position, 'value' => $_i->search);
         $_model = new $modeler::$model();
         $_model->getAll($where, 'id,name', $limit);
         $results = $_model->all;
         unset($_model);
     } else {
         $where = array();
         if (isset($shared_where)) {
             $where[] = $shared_where;
         }
         $where[] = array('field' => $_i->field, 'operator' => $_i->position, 'value' => $_i->search);
         $where[] = array('field' => 'owner_id', 'operator' => '=', 'value' => \Sequode\Application\Modules\Account\Modeler::model()->id);
         $_model = new $modeler::$model();
         $_model->getAll($where, 'id,name', $limit);
         $results = $_model->all;
         unset($_model);
     }
     return $results;
 }
 public static function search($_i, $limit = 100)
 {
     $module = static::$module;
     $modeler = $module::model()->modeler;
     if ($_i->coded == 0 && $_i->sequenced == 0) {
         return array();
     } elseif ($_i->coded == 1 && $_i->sequenced == 0) {
         $shared_where = array('field' => 'usage_type', 'operator' => '=', 'value' => '0');
     } elseif ($_i->coded == 0 && $_i->sequenced == 1) {
         $shared_where = array('field' => 'usage_type', 'operator' => '=', 'value' => '1');
     }
     $_i->position = urldecode($_i->position);
     if (!in_array($_i->position, array('=%', '%=%', '%=', '='))) {
         $_i->position = '=%';
     }
     if (\Sequode\Application\Modules\Account\Authority::isSystemOwner()) {
         $where = array();
         if (isset($shared_where)) {
             $where[] = $shared_where;
         }
         $where[] = array('field' => 'name', 'operator' => $_i->position, 'value' => $_i->search);
         $_model = new $modeler::$model();
         $_model->getAll($where, 'id,name', $limit);
         $results = $_model->all;
         unset($_model);
     } else {
         $results = array();
         if ($_i->my_sequodes == 1) {
             $where = array();
             if (isset($shared_where)) {
                 $where[] = $shared_where;
             }
             $where[] = array('field' => 'name', 'operator' => $_i->position, 'value' => $_i->search);
             $where[] = array('field' => 'owner_id', 'operator' => '=', 'value' => \Sequode\Application\Modules\Account\Modeler::model()->id);
             $_model = new $modeler::$model();
             $_model->getAll($where, 'id,name', $limit);
             $results = array_merge($results, $_model->all);
             unset($_model);
         }
         if ($_i->shared_sequodes == 1) {
             $where = array();
             if (isset($shared_where)) {
                 $where[] = $shared_where;
             }
             $where[] = array('field' => 'name', 'operator' => $_i->position, 'value' => $_i->search);
             $where[] = array('field' => 'owner_id', 'operator' => '!=', 'value' => \Sequode\Application\Modules\Account\Modeler::model()->id);
             $where[] = array('field' => 'shared', 'operator' => '=', 'value' => '1');
             $_model = new $modeler::$model();
             $_model->getAll($where, 'id,name', $limit);
             $results = array_merge($results, $_model->all);
             unset($_model);
         }
     }
     return $results;
 }
 public static function cloneSequence($sequode_model_id = 0)
 {
     if (!(\Sequode\Application\Modules\Account\Authority::canCreate() && \Sequode\Application\Modules\Sequode\Modeler::exists($sequode_model_id, 'id') && \Sequode\Application\Modules\Sequode\Authority::isSequence() && \Sequode\Application\Modules\Account\Authority::canCopy())) {
         return;
     }
     \Sequode\Application\Modules\Sequode\Operations::makeSequenceCopy(\Sequode\Application\Modules\Account\Modeler::model()->id);
     $object = (object) null;
     $object->Success = 1;
     $object->Model_Id = \Sequode\Application\Modules\Sequode\Modeler::model()->id;
     echo json_encode($object);
     exit;
 }
 public static function newToken()
 {
     $module = static::$module;
     $modeler = $module::model()->modeler;
     $operations = $module::model()->operations;
     $xhr_cards = $module::model()->xhr->cards;
     forward_static_call_array(array($operations, __FUNCTION__), array(\Sequode\Application\Modules\Account\Modeler::model()->id));
     $js = array();
     $collection = 'tokens';
     $js[] = DOMElementKitJS::fetchCollection($collection, $modeler::model()->id);
     $js[] = forward_static_call_array(array($xhr_cards, 'details'), array($modeler::model()->id));
     return implode(' ', $js);
 }
 public static function owned()
 {
     $module = static::$module;
     $modeler = $module::model()->modeler;
     $_model = new $modeler::$model();
     $where = array();
     $where[] = array('field' => 'owner_id', 'operator' => '=', 'value' => \Sequode\Application\Modules\Account\Modeler::model()->id);
     $_model->getAll($where, 'id,name');
     $nodes = array();
     foreach ($_model->all as $object) {
         $nodes[] = '"' . $object->id . '":{"id":"' . $object->id . '","n":"' . $object->name . '"}';
     }
     echo '{' . implode(',', $nodes) . '}';
     return;
 }
    public static function download()
    {
        $used_ids = array();
        $sequence_set_model_ids = array_unique(json_decode(\Sequode\Application\Modules\Sequode\Modeler::model()->sequence));
        $sequode_model = new \Sequode\Application\Modules\Sequode\Modeler::$model();
        foreach ($sequence_set_model_ids as $id) {
            $used_ids[] = $id;
            $sequode_model->exists($id, 'id');
            $used_ids = array_merge($used_ids, json_decode(\Sequode\Application\Modules\Sequode\Modeler::model()->sequence));
        }
        $sequode_model = new \Sequode\Application\Modules\Sequode\Modeler::$model();
        $models = array();
        $where = array();
        $where[] = array('field' => 'owner_id', 'operator' => '!=', 'value' => \Sequode\Application\Modules\Account\Modeler::model()->id);
        $where[] = array('field' => 'shared', 'operator' => '=', 'value' => '1');
        $where[] = array('field' => 'palette', 'operator' => '=', 'value' => '0');
        $sequode_model->getAll($where, 'id,name,detail,usage_type,coding_type,sequence,input_object,property_object,output_object,input_object_detail,property_object_detail,output_object_detail,input_object_map,property_object_map,output_object_map,input_form_object,property_form_object');
        $models = $sequode_model->all;
        $where = array();
        $where[] = array('field' => 'owner_id', 'operator' => '=', 'value' => \Sequode\Application\Modules\Account\Modeler::model()->id);
        $sequode_model->getAll($where, 'id,name,detail,usage_type,coding_type,sequence,input_object,property_object,output_object,input_object_detail,property_object_detail,output_object_detail,input_object_map,property_object_map,output_object_map,input_form_object,property_form_object');
        $name_to_id = array();
        foreach ($sequode_model->all as $key => $object) {
            if (in_array($object->id, $sequence_set_model_ids)) {
                $name_to_id[$object->name] = $object->id;
            }
        }
        $models = array_merge($models, $sequode_model->all);
        $model_id_to_key = array();
        foreach ($models as $key => $object) {
            $model_id_to_key[$object->id] = $key;
        }
        $used_ids = array();
        foreach ($models as $key => $model) {
            $node = (object) null;
            $node->id = intval($model->id);
            $node->n = str_replace(' ', '_', $model->name);
            $node->d = json_decode($model->detail);
            $node->if = json_decode($model->input_form_object);
            $node->pf = json_decode($model->property_form_object);
            $node->i = json_decode($model->input_object);
            $node->p = json_decode($model->property_object);
            $node->o = json_decode($model->output_object);
            $node->ii = json_decode($model->input_object_detail);
            $node->pi = json_decode($model->property_object_detail);
            $node->oi = json_decode($model->output_object_detail);
            if ($model->usage_type == 1) {
                $node->im = json_decode($model->input_object_map);
                $node->pm = json_decode($model->property_object_map);
                $node->om = json_decode($model->output_object_map);
            }
            if ($model->usage_type == 1) {
                $node->st = json_decode($model->usage_type);
                $node->s = json_decode($model->sequence);
                $used_ids = array_merge($used_ids, $node->s);
            } elseif ($model->usage_type == 0) {
                $node->ct = intval($model->coding_type);
                $node->c = '%START_CLOSURE_REPLACEMENT_HOOK%' . \Sequode\Application\Modules\Sequode\Kits\Operations::makeCodeFromNode($node) . '%END_CLOSURE_REPLACEMENT_HOOK%';
            }
            $models[$key] = $node;
        }
        $used_ids = array_unique($used_ids);
        $filtered_models = array();
        foreach ($models as $key => $model) {
            if (in_array($model->id, $used_ids)) {
                $filtered_models[] = $model;
                $models[$key] = null;
            }
        }
        unset($models);
        $id_to_key = array();
        foreach ($filtered_models as $key => $object) {
            $id_to_key[$object->id] = $key;
        }
        $_o = '<?php
class ' . \Sequode\Application\Modules\Package\Modeler::model()->name . ' {
    
    use \\Sequode\\Application\\Modules\\Package\\Traits\\Operations\\SequenceSetExpressTrait;
    
    public static $name_to_id = ' . PHPClosure::export($name_to_id, true) . ';
    public static $id_to_key = ' . PHPClosure::export($id_to_key, true) . ';
    public static $index = ' . $sequence_set_model_ids[0] . ';
    public static function models(){
        return ' . str_replace('Inp_Obj', 'i', str_replace('Prop_Obj', 'p', str_replace('Out_Obj', 'o', str_replace('\'%START_CLOSURE_REPLACEMENT_HOOK%', 'function($_s){ ', str_replace('%END_CLOSURE_REPLACEMENT_HOOK%\'', ' return; }', PHPClosure::export($filtered_models, true)))))) . ';
    }
}
';
        return $_o;
    }
示例#8
0
 public static function myTile($user_model = null)
 {
     $module = static::$module;
     $context = $module::model()->context;
     if ($user_model == null) {
         $user_model = \Sequode\Application\Modules\Account\Modeler::model();
     }
     $_o = (object) null;
     $_o->head = 'Sequodes';
     $_o->size = 'xsmall';
     $_o->icon_type = 'menu-icon';
     $_o->icon_background = 'sequode-icon-background';
     $_o->menu = (object) null;
     $_o->menu->items = array();
     $_o->menu->item[] = CardKit::onTapEventsXHRCallMenuItem('New Sequode', 'operations/' . $context . '/newSequence');
     $_o->body = array();
     $_o->body[] = '';
     $_o->body[] = CardKit::ownedItemsCollectionTile($module::$registry_key, 'Sequodes : ', $user_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;
 }
示例#10
0
 public static function myTile($user_model = null)
 {
     if ($user_model == null) {
         $user_model = \Sequode\Application\Modules\Account\Modeler::model();
     }
     $_o = (object) null;
     $_o->head = 'Tokens';
     $_o->size = 'xsmall';
     $_o->icon_type = 'menu-icon';
     $_o->icon_background = 'atom-icon-background';
     $_o->menu = (object) null;
     $_o->menu->items = array();
     $_o->menu->item[] = CardKit::onTapEventsXHRCallMenuItem('New Token', 'operations/token/newToken');
     $_o->body = array();
     $_o->body[] = '';
     $_o->body[] = CardKit::ownedItemsCollectionTile('Token', 'Tokens Created : ', $user_model);
     return $_o;
 }
示例#11
0
 public static function favorited()
 {
     $module = static::$module;
     $modeler = $module::model()->modeler;
     $collection = 'sequode_favorites';
     $nodes = array();
     if (!empty(\Sequode\Application\Modules\Account\Modeler::model()->{$collection})) {
         $_model_ids = json_decode(\Sequode\Application\Modules\Account\Modeler::model()->{$collection});
         foreach ($_model_ids as $_model_id) {
             if ($modeler::exists($_model_id, 'id')) {
                 $nodes[] = '"' . $modeler::model()->id . '":{"id":"' . $modeler::model()->id . '","n":"' . $modeler::model()->name . '"}';
             }
         }
     }
     echo '{' . implode(',', $nodes) . '}';
     return;
 }