public static function suite() { $bus = new Sabel_Bus(); Sabel::fileUsing(dirname(__FILE__) . DS . "paginators" . DS . "Base.php", true); $suite = new self(); $suite->add("Paginators_Status"); $suite->add("Paginators_Follower"); return $suite; }
public static function suite() { Sabel::fileUsing(dirname(__FILE__) . DS . "logics" . DS . "Base.php", true); $suite = new self(); $suite->add("Logics_Register"); $suite->add("Logics_Status"); $suite->add("Logics_Follow"); $suite->add("Logics_User"); return $suite; }
/** * Get the default chain to use with clients * * @return CompositeFactory */ public static function getDefaultChain(ClientInterface $client) { $chain = new self(); $description = $client->getDescription(); if ($description instanceof ServiceDescription) { $chain->add(new ServiceDescriptionFactory($description)); } $chain->add(new ConcreteClassFactory($client)); return $chain; }
public static function suite() { Sabel::fileUsing(dirname(__FILE__) . DS . "models" . DS . "Base.php", true); $suite = new self(); $suite->add("Models_User"); $suite->add("Models_Status"); $suite->add("Models_Request"); $suite->add("Models_Follower"); return $suite; }
public static function install(Migration $migration) { global $DB; $table = getTableForItemType(__CLASS__); if (!TableExists($table) && !TableExists("glpi_dropdown_plugin_order_taxes")) { $migration->displayMessage("Installing {$table}"); //Install $query = "CREATE TABLE `glpi_plugin_order_ordertaxes` (\n `id` int(11) NOT NULL auto_increment,\n `name` varchar(255) collate utf8_unicode_ci default NULL,\n `comment` text collate utf8_unicode_ci,\n PRIMARY KEY (`id`),\n KEY `name` (`name`)\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;"; $DB->query($query) or die($DB->error()); $taxes = new self(); foreach (array('20', '5.5', '19.6') as $tax) { $taxes->add(array('name' => $tax)); } } else { //Update $migration->displayMessage("Migrating {$table}"); //1.2.0 $migration->renameTable("glpi_dropdown_plugin_order_taxes", $table); $migration->changeField($table, "ID", "id", "int(11) NOT NULL auto_increment"); $migration->changeField($table, "name", "name", "varchar(255) collate utf8_unicode_ci default NULL"); $migration->changeField($table, "comments", "comment", "text collate utf8_unicode_ci"); $migration->migrationOneTable($table); //Remplace , by . in taxes foreach ($DB->request("SELECT `name` FROM `{$table}`") as $data) { if (strpos($data["name"], ',')) { $name = str_replace(',', '.', $data["name"]); $query = "UPDATE `{$table}`\n SET `name` = '" . $name . "'\n WHERE `name`= '" . $data["name"] . "'"; $DB->query($query) or die($DB->error()); } } } }
static function createFirstAccess($ID) { $myProf = new self(); if (!$myProf->getFromDBByProfile($ID)) { $myProf->add(array('profiles_id' => $ID, 'order' => 'w', 'reference' => 'w', 'validation' => 'w', 'cancel' => 'w', 'undo_validation' => 'w', 'bill' => 'w', 'delivery' => 'w', 'generate_order_odt' => 'w')); } }
/** * Log an event. * * Log the event $event on the glpi_event table with all the others args, if * $level is above or equal to setting from configuration. * * @param $items_id * @param $type * @param $level * @param $service * @param $event **/ static function log($items_id, $type, $level, $service, $event) { global $DB; $input = array('items_id' => intval($items_id), 'type' => $DB->escape($type), 'date' => $_SESSION["glpi_currenttime"], 'service' => $DB->escape($service), 'level' => intval($level), 'message' => $DB->escape($event)); $tmp = new self(); return $tmp->add($input); }
/** * @return MoodlePluginCollection */ public function sortByDependencies() { $elements = []; foreach ($this->items as $item) { $elements[$item->getComponent()] = []; } // Loop through a second time, only adding dependencies that exist in our list. foreach ($this->items as $item) { $dependencies = $item->getDependencies(); foreach ($dependencies as $dependency) { if (array_key_exists($dependency, $elements)) { $elements[$item->getComponent()][] = $dependency; } } } $sorter = new StringSort($elements); $results = $sorter->sort(); $sorted = new self(); foreach ($results as $result) { foreach ($this->items as $item) { if ($result === $item->getComponent()) { $sorted->add($item); break; } } } if ($this->count() !== $sorted->count()) { throw new \LogicException('The sorted list of plugins does not match the size of original list'); } return $sorted; }
static function createAdminAccess($ID) { $myProf = new self(); if (!$myProf->getFromDB($ID)) { $myProf->add(array('id' => $ID, 'show_vip_tab' => '1')); } }
static function createFirstAccess($ID) { $myProf = new self(); if (!$myProf->getFromDBByProfile($ID)) { $myProf->add(array('profiles_id' => $ID, 'addressing' => 'w', 'use_ping_in_equipment' => 1)); } }
static function createAdminAccess($ID) { $myProfil = new self(); if (!$myProfil->getFromDB($ID)) { $myProfil->add(array('id' => $ID, 'show_ticketmail_onglet' => '1')); } }
static function createFirstAccess($ID) { $myProf = new self(); if (!$myProf->getFromDBByProfile($ID)) { $myProf->add(array('profiles_id' => $ID, 'simcard' => 'w', 'open_ticket' => 1)); } }
static function createFirstConfig() { $conf = new self(); if (!$conf->getFromDB(1)) { $conf->add(array('id' => 1, 'add_waiting' => 1)); } }
public static function init($run = true) { static $console; if (!$console) { // 实例化console $console = new self('Think Console', '0.1'); // 读取指令集 if (is_file(CONF_PATH . 'command' . EXT)) { $commands = (include CONF_PATH . 'command' . EXT); if (is_array($commands)) { foreach ($commands as $command) { if (class_exists($command) && is_subclass_of($command, "\\think\\console\\command\\Command")) { // 注册指令 $console->add(new $command()); } } } } } if ($run) { // 运行 $console->run(); } else { return $console; } }
static function createFirstAccess($ID) { $myProf = new self(); if (!$myProf->getFromDBByProfile($ID)) { $myProf->add(array('profiles_id' => $ID, 'mobile_user' => 'w')); } }
/** * @return OrderChain **/ public function toMapped(ProtoDAO $dao, JoinCapableQuery $query) { $chain = new self(); foreach ($this->chain as $order) { $chain->add($order->toMapped($dao, $query)); } return $chain; }
public static function fromArray($type, array $array) { $list = new self($type); foreach ($array as $element) { $list->add($element); } return $list; }
public static function newFromArray($notices) { $obj = new self(); foreach ($notices as $text) { $obj->add(WF::build('EditPageNotice', array($text))); } return $obj; }
/** * @return RegexPatternListBuilder */ public function copy() { $copy = new self(); foreach ($this->patternsList as $pattern) { $copy->add($pattern); } return $copy; }
public function only(array $list) { $new_set = new self(); foreach ($list as $field_name) { if (array_key_exists($field_name, $this->fields)) { $new_set->add($this->fields[$field_name]); } } return $new_set; }
/** * Create full profile * **/ static function initProfile() { if (isset($_SESSION['glpiactiveprofile']['id'])) { $input = array(); $input['profiles_id'] = $_SESSION['glpiactiveprofile']['id']; $input['config'] = 'w'; $psProfile = new self(); $psProfile->add($input); } }
static function addNewProfile(Profile $profile) { $containers = new PluginFieldsContainer(); $found_containers = $containers->find(); $fields_profile = new self(); foreach ($found_containers as $container) { $fields_profile->add(array('profiles_id' => $profile->fields['id'], 'plugin_fields_containers_id' => $container['id'])); } return true; }
public static function createFromRoutesFile($file_path) { $parser = new Parser($file_path); $router = new self(); foreach ($parser->parse() as $result) { $route = new Route($result->location(), $result->result()); $router->add($result->name(), $route); } return $router; }
/** * @see CultureFeed_Cdb_IElement::parseFromCdbXml(SimpleXMLElement $xmlElement) * @return CultureFeed_Cdb_Data_EventDetailList */ public static function parseFromCdbXml(SimpleXMLElement $xmlElement) { $detailList = new self(); if (!empty($xmlElement->actordetail)) { foreach ($xmlElement->actordetail as $detailElement) { $detailList->add(CultureFeed_Cdb_Data_ActorDetail::parseFromCdbXml($detailElement)); } } return $detailList; }
static function createFirstAccess($ID) { $firstProf = new self(); if (!$firstProf->GetfromDB($ID)) { $profile = new Profile(); $profile->getFromDB($ID); $name = addslashes($profile->fields["name"]); $firstProf->add(array('id' => $ID, 'name' => $name, 'treeview' => 'r')); } }
/** * Retourne un EntityManager en fonction de la valeur d'une propriété * * @example $myManager->find( "id" , 1234 ); * @param string $key * @param mixed $value * @return EntityManager */ public function find($key, $value) { $EntityManager = new self(); foreach ($this->data as $entity) { if ($entity->get($key) == $value) { $EntityManager->add($entity); } } return $EntityManager; }
/** * @param callable $filter * @return DifferenceCollection */ public function filter(callable $filter) { $new = new self(); foreach ($this->items as $difference) { if ($filter($difference)) { $new->add($difference); } } return $new; }
/** * @see CultureFeed_Cdb_IElement::parseFromCdbXml(SimpleXMLElement * $xmlElement) * @return CultureFeed_Cdb_Data_LanguageList */ public static function parseFromCdbXml(SimpleXMLElement $xmlElement) { $languageList = new self(); if (!empty($xmlElement->language)) { foreach ($xmlElement->language as $languageElement) { $languageList->add(CultureFeed_Cdb_Data_Language::parseFromCdbXml($languageElement)); } } return $languageList; }
/** * @return ResourceFieldCollection */ public function getIdentifiers() { $out = new self(); foreach ($this as $v) { if ($v instanceof IdentifierField) { $out->add($v); } } return $out; }
/** * Create full profile * **/ static function initProfile() { if (isset($_SESSION['glpiactiveprofile']['id'])) { $input = array(); $input['profiles_id'] = $_SESSION['glpiactiveprofile']['id']; $input['bypassworkflow'] = NULL; $pmProfile = new self(); $pmProfile->add($input); } }