static function QuickDraw($name, $vars = null) { $o = new self($name); if ($vars) { $o->import($vars); } $o->output(); }
static function transfer($ID, $entity) { global $DB; if ($ID > 0) { // Not already transfer // Search init item foreach ($DB->request('glpi_plugin_racks_racktypes', array('id' => $ID)) as $data) { $data = Toolbox::addslashes_deep($data); $input['name'] = $data['name']; $input['entities_id'] = $entity; $temp = new self(); $newID = $temp->getID($input); if ($newID < 0) { $newID = $temp->import($input); } return $newID; } } return 0; }
/** * During resource or employment transfer * * @static * @param $ID * @param $entity * @return ID|int|the */ static function transfer($ID, $entity) { global $DB; if ($ID > 0) { // Not already transfer // Search init item $query = "SELECT *\n FROM `glpi_plugin_resources_professions`\n WHERE `id` = '{$ID}'"; if ($result = $DB->query($query)) { if ($DB->numrows($result)) { $data = $DB->fetch_assoc($result); $data = Toolbox::addslashes_deep($data); $input['name'] = $data['name']; $input['entities_id'] = $entity; $temp = new self(); $newID = $temp->getID($input); if ($newID < 0) { $newID = $temp->import($input); } //transfer of the linked line $line = PluginResourcesProfessionLine::transfer($temp->fields["plugin_resources_professionlines_id"], $entity); if ($line > 0) { $values["id"] = $newID; $values["plugin_resources_professionlines_id"] = $line; $temp->update($values); } //transfer of the linked category $category = PluginResourcesProfessionCategory::transfer($temp->fields["plugin_resources_professioncategories_id"], $entity); if ($category > 0) { $values["id"] = $newID; $values["plugin_resources_professioncategories_id"] = $category; $temp->update($values); } return $newID; } } } return 0; }
static function transfer($ID, $entity) { global $DB; if ($ID > 0) { // Not already transfer // Search init item $query = "SELECT *\n FROM `glpi_plugin_webapplications_webapplicationtypes`\n WHERE `id` = '{$ID}'"; if ($result = $DB->query($query)) { if ($DB->numrows($result)) { $data = $DB->fetch_assoc($result); $data = Toolbox::addslashes_deep($data); $input['name'] = $data['name']; $input['entities_id'] = $entity; $temp = new self(); $newID = $temp->getID($input); if ($newID < 0) { $newID = $temp->import($input); } return $newID; } } } return 0; }
public function __set_state($data) { $build = new self($this->version); $build->import($data); return $build; }
static function transfer($ID, $entity) { global $DB; $simcardVoltage = new self(); if ($ID > 0) { // Not already transfer // Search init item $query = "SELECT *\n FROM `" . $simcardVoltage->getTable() . "`\n WHERE `id` = '{$ID}'"; if ($result = $DB->query($query)) { if ($DB->numrows($result)) { $data = $DB->fetch_assoc($result); $data = Toolbox::addslashes_deep($data); $input['name'] = $data['name']; $input['entities_id'] = $entity; $newID = $simcardVoltage->getID($input); if ($newID < 0) { $newID = $simcardVoltage->import($input); } return $newID; } } } return 0; }
/** * @param string $directory * @return \FlameCore\Seabreeze\Manifest\Project */ public static function fromDirectory($directory) { $configuration = self::readJson(self::makeManifestPath($directory, 'config.json')); $project = new self($directory); $project->import($configuration); $iterator = new \DirectoryIterator(self::makeManifestPath($directory, 'environments')); foreach ($iterator as $file) { if ($file->isFile() && $file->getExtension() == 'json') { $name = $file->getBasename('.json'); $settings = self::readJson($file->getRealPath()); $environment = new Environment($name, $project); $environment->import($settings); $project->addEnvironment($environment); } } return $project; }
public static function __set_state($array) { $schema = new self(); $schema->import($array); return $schema; }