function saveScheme() { $response = new Response(); try { $name = $this->input->post("scheme-name"); $divisionId = $this->input->post("division"); $scheme = new Scheme(); $scheme->setCreated(new DateTime()); $scheme->setName($name); $division = $this->findById("Division", $divisionId); $scheme->setDivision($division); $this->save($scheme); } catch (Exception $e) { $response->setStatus(false); $response->setErrorMessage($e->getMessage()); } $this->output->set_content_type('application/json')->set_output(json_encode($response)); }
/** * @var string the default layout for the views. Defaults to '//layouts/column2', meaning * using two-column layout. See 'protected/views/layouts/column2.php'. */ public function loadScheme($schemid) { if ($this->_scheme === null) { $this->_scheme = Scheme::model()->findbyPk($schemid); if ($this->_scheme === null) { throw new CHttpException(404, 'The requested scheme does not exist.'); } } return $this->_scheme; }
/** * Identification by method * @param mixed $object * @return string * @throws \qtil\Exception */ function getIdentity($object) { if (!empty($this->identifyCallback)) { return parent::getIdentity($object); } $methods = get_class_methods(get_class($object)); $intersect = array_intersect($methods, $this->options); if (count($intersect) === 1) { $methodName = $intersect[0]; return $object->{$methodName}(); } else { throw new \qtil\Exception('Multiple methods found in identification scheme.'); } }
/** * Reverse the migrations. * * @return void */ public function down() { Scheme::drop('items'); }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = Scheme::model()->with('university')->findByPk((int) $id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<?php include 'src/scheme.php'; $format = 'jpg'; $dotFile = 'files' . DIRECTORY_SEPARATOR . 'dot'; $outputFile = 'images' . DIRECTORY_SEPARATOR . 'output.png'; $scheme = new Scheme(); //if you use windows //$scheme = new Schceme('C:\Program Files (x86)\Graphviz2.38\bin\dot.exe'); $scheme->addNode("start", array("shape" => "Mdiamond", "color" => "salmon2", "style" => "filled")); $scheme->addNode("finish", array("sides" => "3", "distortion" => "0", "shape" => "polygon", "style" => "filled", "color" => "greenyellow")); $scheme->addLink('start', 'finish'); $scheme->addLink('start', 'pause'); $scheme->addLink('pause', 'finish'); $scheme->writeDotFile($dotFile); // you can save graph if you want //$scheme->saveGraph($dotFile, $outputFile); //echo '<img src="'.$outputFile.'">'; // or just show it header("Content-Type: image/" . $format); echo $scheme->generateGraph($dotFile, $format);
/** * Reverse the migrations. * * @return void */ public function down() { Scheme::drop('game'); }
/** * Reverse the migrations. * * @return void */ public function down() { Scheme::drop('comments'); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::drop('tags'); Scheme::drop('articles'); }
} $code[] = $this->{$method}(empty($args) ? NULL : $args); } return count($code) == 1 ? array_shift($code) : $code; } } if (isset($argv)) { $file = array_pop($argv); if ($file == '-d') { define('D', true); $file = array_pop($argv); } if (!defined('D')) { define('D', false); } if (file_exists($file)) { $contents = file_get_contents($file); if (!empty($contents)) { $S = new Scheme(); $code = $S->parse($contents) . ';' . N; if (D) { puts($code); } eval($code); } else { echo "file was empty" . N; } } else { echo "Could not find a file to parse." . N; } }
/** * Reverse the migrations. * * @return void */ public function down() { Scheme::drop('participant'); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::drop('categories'); Scheme::drop('categories_permissions'); Schema::drop('categories_permissions_usergroup'); }
public static function getSchemeOptions() { //lists all schemes $_Schemes = Scheme::model()->findAll(); $schemesArray = CHtml::listData($_Schemes, 'id', 'name'); return $schemesArray; }
/** * Reverse the migrations. * * @return void */ public function down() { Scheme::drop('filemedia'); }
function SCM_if($s, $env) { $cond = $s->car; if (Scheme::evaluate($cond, $env) == Symbol::new_instance('#t')) { $rule = $s->cdr->car; } else { $rule = $s->cdr->cdr; } return SCM_begin($rule, $env); }
/** * Reverse the migrations. * * @return void */ public function down() { Scheme::drop('products'); }
public function jsonSerialize() { $this->__load(); return parent::jsonSerialize(); }
<?php $form = $this->beginWidget('booster.widgets.TbActiveForm', array('id' => 'scheme-assignment-form', 'enableAjaxValidation' => false, 'type' => 'horizontal')); ?> <p class="help-block">Fields with <span class="required">*</span> are required.</p> <?php echo $form->errorSummary($model); ?> <?php echo $form->dropDownListGroup($model, 'user_id', array('widgetOptions' => array('htmlOptions' => array('class' => 'span5'), 'data' => User::getUserOptions()))); ?> <?php echo $form->dropDownListGroup($model, 'scheme_id', array('widgetOptions' => array('htmlOptions' => array('class' => 'span5'), 'data' => Scheme::getSchemeOptions()))); ?> <div class="form-actions text-center"> <?php $this->widget('booster.widgets.TbButton', array('buttonType' => 'submit', 'context' => 'primary', 'label' => $model->isNewRecord ? 'Create' : 'Save')); ?> </div> <?php $this->endWidget();
<?php include_once 'scheme.php'; $scm = new Scheme(); $code = "(+ 1 2 3 (+ 18 (+ 5 6)))"; $ret = $scm->do_eval($code); var_dump($ret); $file = "test.scm"; $code = file_get_contents($file); $ret = $scm->do_eval($code); var_dump($ret); exit; /* $a = scm_tokenize($code); $rnode = STParse($a); $scope = new STScope(null); $ret = evaluate($rnode, $scope); var_dump($ret); */