/** * @param $parameters Parameters * @param $form array * @param $class_name string * @return mixed[] */ protected function getViewParameters(Parameters $parameters, $form, $class_name) { $object = $parameters->getMainObject($class_name); foreach ((new Reflection_Class($class_name))->getProperties() as $property) { $property->setValue($object, $property->getDefaultValue()); } $objects = $parameters->getObjects(); if (count($objects) > 1) { foreach (array_slice($objects, 1) as $property_name => $value) { $object->{$property_name} = $value; } } return parent::getViewParameters($parameters, $form, $class_name); }
/** * @param $parameters Parameters * @param $form array * @param $files array * @param $class_name string * @return mixed */ public function run(Parameters $parameters, $form, $files, $class_name) { $replaced = $parameters->getMainObject(); $objects = $parameters->getObjects(); if ($id_replace_with = $parameters->getRawParameter('id_replace_with')) { $objects['replace_with'] = $replacement = Dao::read($id_replace_with, $class_name); Dao::begin(); if ((new Delete_And_Replace())->deleteAndReplace($replaced, $replacement)) { Dao::commit(); $objects['done'] = true; } else { Dao::rollback(); $objects['error'] = true; } } return View::run($objects, $form, $files, $class_name, 'deleteAndReplace'); }
/** * This will be called for this controller, always. * * @param $parameters Parameters * @param $form array * @param $files array * @return mixed */ public function run(Parameters $parameters, $form, $files) { $environment = Session::current()->get(Environment::class, true); $objects = $parameters->getObjects(); $set_value = isset($objects['']) ? $objects[''] : (isset($objects[1]) ? $objects[1] : null); $name = $objects[0]; $this->property = (new Reflection_Class($environment))->getProperty($name); if ($set_value) { $type = $this->property->getType(); $environment->{$name} = $type->isClass() ? Dao::read($set_value, $type->asString()) : $set_value; $parameters->set('selected', true); return (new Output_Controller())->run($parameters, $form, $files); } else { $objects['controller'] = $this; $objects['name'] = $name; $objects = array_merge([get_class($environment) => $environment], $objects); return View::run($objects, $form, $files, get_class($environment), Feature::F_SELECT); } }
/** * @param $parameters Parameters * @param $form array * @param $files array * @return mixed */ public function runFilesToDatabase(Parameters $parameters, $form, $files) { $maintainer = new Maintainer(); $maintainer->filesToDatabase(); return View::run($parameters->getObjects(), $form, $files, Plugin::class, 'filesToDatabase'); }
/** * @param $parameters Parameters * @param $form array * @param $files array * @return mixed */ public function run(Parameters $parameters, $form, $files) { $trash = $parameters->GetUnnamedParameters(); $objects = $parameters->getObjects(); return count($trash) <= 1 ? $this->deleteObject($objects) : $this->parseAndRun($objects); }
/** * @param $parameters Parameters * @param $form array * @param $files array * @return mixed */ public function run(Parameters $parameters, $form, $files) { $parameters->unshift(Application::current()); return View::run($parameters->getObjects(), $form, $files, get_class(Application::current()), 'home'); }
/** * Run method for the class controller, when no runFeatureName() method was found in it. * * Class controllers must implement this method if you want the controller to work. * * @param $parameters Parameters * @param $form array * @param $files array * @return mixed */ public function run(Parameters $parameters, $form, $files) { echo 'check this out man'; echo '<pre>' . print_r($parameters->getObjects(), true) . '</pre>'; }
/** * Property select controller, starting from a given root class * * @param $parameters Parameters * - first : the root reference class name (ie a business object) * - second : if set, the selected property path into the root reference class name * @param $form array not used * @param $files array not used * @return mixed */ public function run(Parameters $parameters, $form, $files) { $class_name = Set::elementClassNameOf($parameters->shiftUnnamed()); $property_path = $parameters->shiftUnnamed(); if (empty($property_path)) { $top_property = new Property(); $top_property->class = $class_name; $properties = $this->getProperties(new Reflection_Class($class_name)); foreach ($properties as $property) { $property->path = $property->name; } } else { $top_property = new Reflection_Property($class_name, $property_path); $properties = $this->getProperties(new Reflection_Class($top_property->getType()->getElementTypeAsString()), $top_property->final_class); foreach ($properties as $property) { $property->path = $property_path . DOT . $property->name; } if (!$parameters->getRawParameter(Parameter::CONTAINER)) { $parameters->set(Parameter::CONTAINER, 'subtree'); } } $objects = $parameters->getObjects(); array_unshift($objects, $top_property); $objects['properties'] = $properties; $objects['class_name'] = $class_name; $objects['display_full_path'] = false; /** * Objects for the view : * first Property the property object (with selected property name, or not) * 'properties' Reflection_Property[] all properties from the reference class */ return View::run($objects, $form, $files, Property::class, 'select'); }
/** * @param $parameters Parameters * @param $form array * @param $files array * @return mixed */ public function run(Parameters $parameters, $form, $files) { $objects = $parameters->getObjects(); $objects['link'] = SL . str_replace(BS, SL, Session_File::class) . '/output/' . reset($objects); return View::run($objects, $form, $files, Session_File::class, 'image'); }