Source of file FlowchartPage.php
Size: 2,962 Bytes - Last Modified: 2022-02-21T10:00:32+00:00
/var/www/docs.ssmods.com/process/src/code/pages/FlowchartPage.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 | <?php /** * Graphical interface for creating basic flowcharts * * @package flowchart * @category page */ class FlowchartPage extends Page { /** * * @var string */ private static $icon = "flowchart/images/flowchart.png"; /** * * @var string */ private static $description = 'A page for storing data and displaying flowcharts'; /** * * @var array */ private static $db = array( 'FlowchartData' => 'Text' ); /** * * @var array */ private static $has_many = array( "FlowStates" => "FlowState" ); /** * * @return FieldList */ public function getCMSFields() { $fields = parent::getCMSFields(); $states = new GridField( 'FlowStates', 'FlowState', $this->FlowStates(), $config = GridFieldConfig_RelationEditor::create()); $fields->addFieldToTab('Root.FlowStates', $states); return $fields; } } /** * Graphical interface for creating basic flowcharts * * @package silverstripe-flowchart * @category controller */ class FlowchartPage_Controller extends Page_Controller { /** * Initialises the controller and combines the script and css requirements * * @return void */ function init() { parent::init(); Requirements::combine_files('flowchart.css', $this->getCSSRequirements()); Requirements::combine_files('flowchart.js', $this->getJSRequirements()); } /** * Returns the json_encoded flowchart data * * @return string */ public function getFlowchartData() { // Strip the slashes that raw2SQL applies during saving in {@link GridFieldFlowchartDetailForm} return stripslashes($this->failover->FlowchartData); } /** * Returns an array of the CSS requirements for the form * * @return array */ public function getCSSRequirements() { return array( 'flowchart/css/jsPlumb.css', 'flowchart/css/flowchart.css' ); } /** * Returns an array of the JavaScript {@link Requirements} for displaying the {@link FlowchartPage} * * @return array */ public function getJSRequirements() { return array( FRAMEWORK_DIR . '/thirdparty/jquery-entwine/dist/jquery.entwine-dist.js', 'flowchart/js/thirdparty/jsPlumb/src/util.js', 'flowchart/js/thirdparty/jsPlumb/src/dom-adapter.js', 'flowchart/js/thirdparty/jsPlumb/src/jsPlumb.js', 'flowchart/js/thirdparty/jsPlumb/src/endpoint.js', 'flowchart/js/thirdparty/jsPlumb/src/connection.js', 'flowchart/js/thirdparty/jsPlumb/src/anchors.js', 'flowchart/js/thirdparty/jsPlumb/src/defaults.js', 'flowchart/js/thirdparty/jsPlumb/src/connectors-bezier.js', 'flowchart/js/thirdparty/jsPlumb/src/connectors-statemachine.js', 'flowchart/js/thirdparty/jsPlumb/src/connectors-flowchart.js', 'flowchart/js/thirdparty/jsPlumb/src/renderers-svg.js', 'flowchart/js/thirdparty/jsPlumb/src/renderers-canvas.js', 'flowchart/js/thirdparty/jsPlumb/src/renderers-vml.js', 'flowchart/js/thirdparty/jsPlumb/src/jquery.jsPlumb.js', 'flowchart/js/Flowchart.js' ); } } |