예제 #1
0
 public static function sharing($sequode_model = null)
 {
     if ($sequode_model == null) {
         $sequode_model = \Sequode\Application\Modules\Sequode\Modeler::model();
     }
     $components_object = (object) null;
     FormInputModeler::exists('checkboxSwitch', 'name');
     $components_object->sharing = json_decode(FormInputModeler::model()->component_object);
     $components_object->sharing->Label = '';
     $components_object->sharing->On_Text = 'Publicly Shared';
     $components_object->sharing->On_Value = 1;
     $components_object->sharing->Off_Text = 'Private Restricted';
     $components_object->sharing->Off_Value = 0;
     $components_object->sharing->Value = \Sequode\Application\Modules\Sequode\Authority::isShared($sequode_model) ? 1 : 0;
     return $components_object;
 }
예제 #2
0
 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;
 }
예제 #3
0
 public static function canView($test_model = null, $_model = null)
 {
     $modeler = static::$modeler;
     if ($_model == null) {
         $_model = $modeler::model();
     }
     if ($test_model == null) {
         $test_model = \Sequode\Application\Modules\Sequode\Modeler::model();
     }
     return \Sequode\Application\Modules\Sequode\Authority::isShared($test_model) || self::isOwner($test_model, $_model) || self::isSystemOwner($_model) ? true : false;
 }