query
stringlengths 9
43.3k
| document
stringlengths 17
1.17M
| metadata
dict | negatives
listlengths 0
30
| negative_scores
listlengths 0
30
| document_score
stringlengths 5
10
| document_rank
stringclasses 2
values |
---|---|---|---|---|---|---|
Gets an array of external entity type permissions. | public function ExternalEntityTypePermissions() {
$perms = array();
// Generate node permissions for all node types.
foreach (ExternalEntityType::loadMultiple() as $type) {
$perms += $this->buildPermissions($type);
}
return $perms;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function entityGalleryTypePermissions() {\n $perms = array();\n // Generate entity gallery permissions for all entity gallery types.\n foreach (EntityGalleryType::loadMultiple() as $type) {\n $perms += $this->buildPermissions($type);\n }\n\n return $perms;\n }",
"public function permissions() {\n $permissions = [];\n\n foreach ($this->rhEntityPluginManager->getDefinitions() as $def) {\n $entity_type = $this->entityTypeManager\n ->getStorage($def['entityType'])\n ->getEntityType();\n $permissions += array(\n 'rabbit hole administer ' . $def['entityType'] => array(\n 'title' => $this->t(\n 'Administer Rabbit Hole settings for %entity_type',\n array('%entity_type' => $entity_type->getLabel())),\n ),\n 'rabbit hole bypass ' . $def['entityType'] => array(\n 'title' => $this->t(\n 'Bypass Rabbit Hole action for %entity_type',\n array('%entity_type' => $entity_type->getLabel())),\n ),\n );\n }\n\n return $permissions;\n }",
"public static function getPermissions(): array\n {\n return [];\n }",
"public function getAllPermissions(): array;",
"public function getAdminPermissions(): array;",
"public function getPermissions(): array {\n\t\treturn [];\n\t}",
"public function getPermissions();",
"function getPermissionTypes()\n\t{\n\t\t$extra_permissions = array();\n\n\t\t/**\n\t\t *\n\t\t */\n\t\t\t$tempEventData = new EventData_IEM_USERAPI_GETPERMISSIONTYPES();\n\t\t\t$tempEventData->extra_permissions = &$extra_permissions;\n\t\t\t$tempEventData->trigger();\n\n\t\t\tunset($tempEventData);\n\t\t/**\n\t\t * -----\n\t\t */\n\n\t\t$this->PermissionTypes['addon_permissions'] = $extra_permissions;\n\t\treturn $this->PermissionTypes;\n\t}",
"public static function permissions(): array\n {\n return [];\n }",
"public function orderTypePermissions() {\n $perms = [];\n foreach (OrderType::loadMultiple() as $type) {\n $perms += $this->buildPermissions($type);\n }\n\n return $perms;\n }",
"public function getAllPermissions();",
"public function getAllPermissions();",
"abstract public function getPermissions();",
"public function getCustomerResultPermissions(): array;",
"public function getPermissions() {}",
"public function getPermissions() {}",
"protected function getEditorPermissions() {\n // Every entity-type-specific test needs to define these.\n return [];\n }",
"protected function buildPermissions(ExternalEntityType $type) {\n $type_id = $type->id();\n $type_params = array('%type_name' => $type->label());\n\n return array(\n \"create $type_id external entity\" => array(\n 'title' => $this->t('%type_name: Create new external entity', $type_params),\n ),\n \"edit $type_id external entity\" => array(\n 'title' => $this->t('%type_name: Edit any external entity', $type_params),\n ),\n \"delete $type_id external entity\" => array(\n 'title' => $this->t('%type_name: Delete any external entity', $type_params),\n ),\n );\n }",
"protected function getPermissions()\n {\n return Permission::with('roles')->get();\n }",
"public function getObjectPermissions(): array;",
"public function permissions()\n {\n return $this->permissionModel->findAll();\n }",
"protected function getPermissions()\n {\n if (!$this->tablePermissionsExists()) {\n return [];\n }\n return Permission::with('roles')->get();\n }",
"public function getPossiblePermissions();",
"public function & GetPermissions ();",
"public function getPermissions() {\n if (!$this->cache_permissions) {\n $this->cache_permissions = array();\n //berk... legacy permission code... legacy db functions... berk!\n $sql=\"SELECT ugroup_id, permission_type \n FROM permissions \n WHERE permission_type LIKE 'PLUGIN_TRACKER_FIELD%'\n AND object_id='\". db_ei($this->getId()) .\"' \n ORDER BY ugroup_id\";\n \n $res=db_query($sql);\n if (db_numrows($res) > 0) {\n while ($row = db_fetch_array($res)) {\n $this->cache_permissions[$row['ugroup_id']][] = $row['permission_type'];\n }\n }\n }\n return $this->cache_permissions;\n }",
"private function getUserRolePermissions()\n {\n return [];\n }",
"public function getPermissions() :array\n {\n return $this->permissions;\n }",
"public function permissions(): array\n {\n $permissions = $this->getAttribute('permissions') ?: [];\n\n if ( ! is_array($permissions)) {\n $permissions = (array) $permissions;\n }\n\n return $permissions;\n }",
"public function permissions()\n {\n\n return Permission::all();\n }",
"function commerce_store_entity_access_permissions($entity_type) {\n $entity_info = entity_get_info($entity_type);\n $labels = $entity_info['permission labels'];\n\n $permissions = array();\n\n // Generic create and edit permissions.\n $permissions['view any ' . $entity_type . ' entity in own store'] = array(\n 'title' => t('View any @entity_type of any type in own store', array('@entity_type' => $labels['singular'])),\n );\n $permissions['edit any ' . $entity_type . ' entity in own store'] = array(\n 'title' => t('Edit any @entity_type of any type in own store', array('@entity_type' => $labels['singular'])),\n );\n\n // Per-bundle create and edit permissions.\n if (!empty($entity_info['entity keys']['bundle'])) {\n foreach ($entity_info['bundles'] as $bundle_name => $bundle_info) {\n $permissions['view any ' . $entity_type . ' entity of bundle ' . $bundle_name . ' in own store'] = array(\n 'title' => t('View any %bundle @entity_type in own store', array('@entity_type' => $labels['singular'], '%bundle' => $bundle_info['label'])),\n );\n $permissions['edit any ' . $entity_type . ' entity of bundle ' . $bundle_name . ' in own store'] = array(\n 'title' => t('Edit any %bundle @entity_type in own store', array('@entity_type' => $labels['singular'], '%bundle' => $bundle_info['label'])),\n );\n }\n }\n\n return $permissions;\n}"
]
| [
"0.7189829",
"0.6989495",
"0.6966285",
"0.6898314",
"0.6896353",
"0.68632835",
"0.67812526",
"0.6763675",
"0.673349",
"0.6726324",
"0.66731304",
"0.66731304",
"0.66682696",
"0.6648148",
"0.664122",
"0.664122",
"0.65730786",
"0.65605384",
"0.6505143",
"0.64764386",
"0.6433009",
"0.64078236",
"0.6401507",
"0.63938034",
"0.63689834",
"0.63399464",
"0.6335596",
"0.633502",
"0.6299692",
"0.6295508"
]
| 0.84525174 | 0 |
Builds a standard list of external entity permissions for a given type. | protected function buildPermissions(ExternalEntityType $type) {
$type_id = $type->id();
$type_params = array('%type_name' => $type->label());
return array(
"create $type_id external entity" => array(
'title' => $this->t('%type_name: Create new external entity', $type_params),
),
"edit $type_id external entity" => array(
'title' => $this->t('%type_name: Edit any external entity', $type_params),
),
"delete $type_id external entity" => array(
'title' => $this->t('%type_name: Delete any external entity', $type_params),
),
);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function buildPermissions(EntityGalleryType $type) {\n $type_id = $type->id();\n $type_params = array('%type_name' => $type->label());\n\n return array(\n \"create $type_id entity galleries\" => array(\n 'title' => $this->t('%type_name: Create new entity galleries', $type_params),\n ),\n \"edit own $type_id entity galleries\" => array(\n 'title' => $this->t('%type_name: Edit own entity galleries', $type_params),\n ),\n \"edit any $type_id entity galleries\" => array(\n 'title' => $this->t('%type_name: Edit any entity galleries', $type_params),\n ),\n \"delete own $type_id entity galleries\" => array(\n 'title' => $this->t('%type_name: Delete own entity galleries', $type_params),\n ),\n \"delete any $type_id entity galleries\" => array(\n 'title' => $this->t('%type_name: Delete any entity galleries', $type_params),\n ),\n \"view $type_id revisions\" => array(\n 'title' => $this->t('%type_name: View revisions', $type_params),\n ),\n \"revert $type_id revisions\" => array(\n 'title' => $this->t('%type_name: Revert revisions', $type_params),\n 'description' => t('Role requires permission <em>view revisions</em> and <em>edit rights</em> for entity galleries in question, or <em>administer entity galleries</em>.'),\n ),\n \"delete $type_id revisions\" => array(\n 'title' => $this->t('%type_name: Delete revisions', $type_params),\n 'description' => $this->t('Role requires permission to <em>view revisions</em> and <em>delete rights</em> for entity galleries in question, or <em>administer entity galleries</em>.'),\n ),\n );\n }",
"public function ExternalEntityTypePermissions() {\n $perms = array();\n // Generate node permissions for all node types.\n foreach (ExternalEntityType::loadMultiple() as $type) {\n $perms += $this->buildPermissions($type);\n }\n\n return $perms;\n }",
"protected function buildPermissions(OrderType $type) {\n $type_id = $type->id();\n $type_params = ['%type_name' => $type->label()];\n\n return [\n \"own store view order type $type_id\" => [\n 'title' => $this->t('[Own commerce store] %type_name: View commerce order', $type_params),\n ],\n \"own store edit order type $type_id\" => [\n 'title' => $this->t('[Own commerce store] %type_name: Edit commerce order', $type_params),\n ],\n \"own store delete order type $type_id\" => [\n 'title' => $this->t('[Own commerce store] %type_name: Delete commerce order', $type_params),\n ],\n \"own store reassign order type $type_id\" => [\n 'title' => $this->t('[Own commerce store] %type_name: Reassign commerce order', $type_params),\n ],\n ];\n }",
"function commerce_store_entity_access_permissions($entity_type) {\n $entity_info = entity_get_info($entity_type);\n $labels = $entity_info['permission labels'];\n\n $permissions = array();\n\n // Generic create and edit permissions.\n $permissions['view any ' . $entity_type . ' entity in own store'] = array(\n 'title' => t('View any @entity_type of any type in own store', array('@entity_type' => $labels['singular'])),\n );\n $permissions['edit any ' . $entity_type . ' entity in own store'] = array(\n 'title' => t('Edit any @entity_type of any type in own store', array('@entity_type' => $labels['singular'])),\n );\n\n // Per-bundle create and edit permissions.\n if (!empty($entity_info['entity keys']['bundle'])) {\n foreach ($entity_info['bundles'] as $bundle_name => $bundle_info) {\n $permissions['view any ' . $entity_type . ' entity of bundle ' . $bundle_name . ' in own store'] = array(\n 'title' => t('View any %bundle @entity_type in own store', array('@entity_type' => $labels['singular'], '%bundle' => $bundle_info['label'])),\n );\n $permissions['edit any ' . $entity_type . ' entity of bundle ' . $bundle_name . ' in own store'] = array(\n 'title' => t('Edit any %bundle @entity_type in own store', array('@entity_type' => $labels['singular'], '%bundle' => $bundle_info['label'])),\n );\n }\n }\n\n return $permissions;\n}",
"function permissions_build($entity_type) {\n $instanceArgs = array(\n 'entity_type' => $entity_type,\n );\n $factoryArgs = array(\n 'entity_type' => $entity_type,\n 'instance_args' => $instanceArgs\n );\n $builder = hook_get_builder('permissions', $factoryArgs);\n\n return $builder->build();\n}",
"protected function buildPermissions(MediaTypeInterface $type) {\n $type_id = $type->id();\n $type_params = ['%type_name' => $type->label()];\n\n return [\n \"create $type_id media\" => [\n 'title' => $this->t('%type_name: Create new media', $type_params),\n ],\n \"edit own $type_id media\" => [\n 'title' => $this->t('%type_name: Edit own media', $type_params),\n ],\n \"edit any $type_id media\" => [\n 'title' => $this->t('%type_name: Edit any media', $type_params),\n ],\n \"delete own $type_id media\" => [\n 'title' => $this->t('%type_name: Delete own media', $type_params),\n ],\n \"delete any $type_id media\" => [\n 'title' => $this->t('%type_name: Delete any media', $type_params),\n ],\n ];\n }",
"protected function buildPermissions(BlockContentTypeInterface $type) {\n $type_id = $type->id();\n $type_name = ['%type_name' => $type->label()];\n\n return [\n \"create $type_id block content\" => [\n 'title' => $this->t('%type_name: Create new block content', $type_name),\n ],\n \"delete any $type_id block content\" => [\n 'title' => $this->t('%type_name: Delete any block content', $type_name),\n ],\n \"update any $type_id block content\" => [\n 'title' => $this->t('%type_name: Edit any block content', $type_name),\n ],\n ];\n }",
"function entities_permission_build($module, $entity_type = NULL) {\n $instanceArgs = array(\n 'module' => $module,\n );\n $factoryArgs = array(\n 'instance_args' => $instanceArgs\n );\n /** @var PermissionBuilder $builder */\n $builder = hook_get_builder('permission', $factoryArgs);\n\n return $builder->buildEntitiesPermissions($entity_type);\n}",
"public function orderTypePermissions() {\n $perms = [];\n foreach (OrderType::loadMultiple() as $type) {\n $perms += $this->buildPermissions($type);\n }\n\n return $perms;\n }",
"protected function getAccessControlLists($type) {\n $acls = array();\n \n $aclStrings = array_merge(\n $this->getSiteVar($type, array(), Config::SUPRESS_ERRORS),\n $this->getModuleVar($type, array(), Config::SUPRESS_ERRORS)\n );\n \n foreach ($aclStrings as $aclString) {\n if ($acl = AccessControlList::createFromString($aclString)) {\n $acls[] = $acl;\n } else {\n throw new Exception(\"Invalid $var $aclString in $this->configModule\");\n }\n }\n \n return $acls;\n }",
"protected function buildPermissions(DiscussionType $discussion_type) {\n $type_id = $discussion_type->id();\n $type_params = ['%type' => $discussion_type->label()];\n\n return [\n \"view $type_id discussion\" => [\n 'title' => $this->t('%type: View discussion', $type_params),\n ],\n \"create $type_id discussion\" => [\n 'title' => $this->t('%type: Create new discussion', $type_params),\n ],\n \"edit own $type_id discussion\" => [\n 'title' => $this->t('%type: Edit own discussion', $type_params),\n ],\n \"edit any $type_id discussion\" => [\n 'title' => $this->t('%type: Edit any discussion', $type_params),\n ],\n \"delete own $type_id discussion\" => [\n 'title' => $this->t('%type: Delete own discussion', $type_params),\n ],\n \"delete any $type_id discussion\" => [\n 'title' => $this->t('%type: Delete any discussion', $type_params),\n ],\n \"reply to own $type_id discussion\" => [\n 'title' => $this->t('%type: Reply to own discussion', $type_params),\n ],\n \"reply to any $type_id discussion\" => [\n 'title' => $this->t('%type: Reply to any discussion', $type_params),\n ],\n ];\n }",
"public static function getSimpleList($type, $scope)\n {\n static $list = array();\n\n $key = $type.$scope;\n\n if(isset($list[$key]))\n {\n return $list[$key];\n }\n\n $projects = self::getProjectList($type);\n $list[$key] = array();\n\n foreach($projects as $project)\n {\n if($project->scope == $scope)\n {\n $list[$key][] = $project->comName;\n }\n }\n\n return $list[$key];\n }",
"public function entityGalleryTypePermissions() {\n $perms = array();\n // Generate entity gallery permissions for all entity gallery types.\n foreach (EntityGalleryType::loadMultiple() as $type) {\n $perms += $this->buildPermissions($type);\n }\n\n return $perms;\n }",
"public function permissions() {\n $permissions = [];\n\n foreach ($this->rhEntityPluginManager->getDefinitions() as $def) {\n $entity_type = $this->entityTypeManager\n ->getStorage($def['entityType'])\n ->getEntityType();\n $permissions += array(\n 'rabbit hole administer ' . $def['entityType'] => array(\n 'title' => $this->t(\n 'Administer Rabbit Hole settings for %entity_type',\n array('%entity_type' => $entity_type->getLabel())),\n ),\n 'rabbit hole bypass ' . $def['entityType'] => array(\n 'title' => $this->t(\n 'Bypass Rabbit Hole action for %entity_type',\n array('%entity_type' => $entity_type->getLabel())),\n ),\n );\n }\n\n return $permissions;\n }",
"function getPermissionTypes()\n\t{\n\t\t$extra_permissions = array();\n\n\t\t/**\n\t\t *\n\t\t */\n\t\t\t$tempEventData = new EventData_IEM_USERAPI_GETPERMISSIONTYPES();\n\t\t\t$tempEventData->extra_permissions = &$extra_permissions;\n\t\t\t$tempEventData->trigger();\n\n\t\t\tunset($tempEventData);\n\t\t/**\n\t\t * -----\n\t\t */\n\n\t\t$this->PermissionTypes['addon_permissions'] = $extra_permissions;\n\t\treturn $this->PermissionTypes;\n\t}",
"public function get_permissions($typeid) {\n $tool = lti_get_type_type_config($typeid);\n if ($tool->memberships == '1') {\n return array('ToolProxyBinding.memberships.url:get');\n } else {\n return array();\n }\n }",
"public function permissions() {\n $permissions = [];\n\n /** @var Drupal\\node\\Entity\\NodeType[] $node_types */\n $node_types = NodeType::loadMultiple();\n foreach ($node_types as $type) {\n $id = $type->id();\n $name = $type->label();\n\n $permissions[\"override $id published option\"] = [\n 'title' => $this->t(\"Override %type_name published option.\", [\"%type_name\" => $name]),\n ];\n\n $permissions[\"override $id promote to front page option\"] = [\n 'title' => $this->t(\"Override %type_name promote to front page option.\", [\"%type_name\" => $name]),\n ];\n\n $permissions[\"override $id sticky option\"] = [\n 'title' => $this->t(\"Override %type_name sticky option.\", [\"%type_name\" => $name]),\n ];\n\n $permissions[\"override $id revision option\"] = [\n 'title' => $this->t(\"Override %type_name revision option.\", [\"%type_name\" => $name]),\n ];\n\n $permissions[\"override $id revision log entry\"] = [\n 'title' => $this->t(\"Enter %type_name revision log entry.\", [\"%type_name\" => $name]),\n ];\n\n $permissions[\"override $id authored on option\"] = [\n 'title' => $this->t(\"Override %type_name authored on option.\", [\"%type_name\" => $name]),\n ];\n\n $permissions[\"override $id authored by option\"] = [\n 'title' => $this->t(\"Override %type_name authored by option.\", [\"%type_name\" => $name]),\n ];\n }\n\n return $permissions;\n }",
"function eman_roles( $type='turner' )\n{\n\tswitch ( $type )\n\t{\n\t\tcase 'owner' :\n\t\t\treturn array('owner','owners_rep','consultant');\n\t\t\tbreak;\n\t\tcase 'sub' :\n\t\t\treturn array('subcontractor');\n\t\t\tbreak;\n\t\tcase 'pending' :\n\t\t\treturn array('subscriber');\n\t\t\tbreak;\n\t\tcase 'turner' :\n\t\t\treturn array('administrator','editor');\n\t\t\tbreak;\n\t}\n}",
"public static function getList()\n {\n return collect([\n new Permission('control_panel_access', 'Control Panel Access', 'General'),\n new Permission('manage_users', 'Manage Users', 'ACL'),\n new Permission('manage_roles', 'Manage Roles', 'ACL'),\n new Permission('manage_permissions', 'Manage Permissions', 'ACL'),\n ]);\n }",
"public function getByType($type) {\n switch ($type) {\n case 'nsf': $sql = ROLETYPE_GETALL_NSF; break;\n case 'local': $sql = ROLETYPE_GETALL_LOCAL; break;\n default: throw new Exception(\"Type must be 'nsf' or 'local'\");\n }\n\n return $this->makeEntityArray('RoleType', $sql);\n }",
"protected function generatePermissionsField()\n {\n return [\n 'permissions' => [\n 'tab' => 'backend::lang.user.permissions',\n 'type' => 'Modules\\Backend\\FormWidgets\\PermissionEditor',\n 'mode' => 'checkbox'\n ]\n ];\n }",
"public function getPendingAuthorizations($type)\n {\n $authorizations = [];\n\n $privateKey = $this->loadAccountKey();\n $details = openssl_pkey_get_details($privateKey);\n\n $header = [\n \"e\" => LEFunctions::base64UrlSafeEncode($details[\"rsa\"][\"e\"]),\n \"kty\" => \"RSA\",\n \"n\" => LEFunctions::base64UrlSafeEncode($details[\"rsa\"][\"n\"])\n\n ];\n $digest = LEFunctions::base64UrlSafeEncode(hash('sha256', json_encode($header), true));\n\n foreach ($this->authorizations as $auth) {\n if ($auth->status == 'pending') {\n $challenge = $auth->getChallenge($type);\n if ($challenge['status'] == 'pending') {\n $keyAuthorization = $challenge['token'] . '.' . $digest;\n switch (strtolower($type)) {\n case LEOrder::CHALLENGE_TYPE_HTTP:\n $authorizations[] = [\n 'type' => LEOrder::CHALLENGE_TYPE_HTTP,\n 'identifier' => $auth->identifier['value'],\n 'filename' => $challenge['token'],\n 'content' => $keyAuthorization\n ];\n break;\n case LEOrder::CHALLENGE_TYPE_DNS:\n $DNSDigest = LEFunctions::base64UrlSafeEncode(\n hash('sha256', $keyAuthorization, true)\n );\n $authorizations[] = [\n 'type' => LEOrder::CHALLENGE_TYPE_DNS,\n 'identifier' => $auth->identifier['value'],\n 'DNSDigest' => $DNSDigest\n ];\n break;\n }\n }\n }\n }\n\n return count($authorizations) > 0 ? $authorizations : false;\n }",
"public function list_of($type)\n {\n }",
"public function getLinksByType($type) {\r\n $entity_manager = \\Drupal::entityTypeManager();\r\n $entity_type = $entity_manager->getDefinition($type);\r\n return $entity_type->getLinkTemplates();\r\n }",
"private function seedPermissions()\n {\n (new \\Naraki\\Permission\\Models\\Permission())->insert([\n [\n 'entity_type_id' => 4,\n 'entity_id' => \\Naraki\\Core\\Models\\Entity::USERS,\n 'permission_mask' => 0b1111\n ],\n [\n 'entity_type_id' => 4,\n 'entity_id' => \\Naraki\\Core\\Models\\Entity::GROUPS,\n 'permission_mask' => 0b1111\n ],\n [\n 'entity_type_id' => 4,\n 'entity_id' => \\Naraki\\Core\\Models\\Entity::BLOG_POSTS,\n 'permission_mask' => 0b1111\n ],\n [\n 'entity_type_id' => 4,\n 'entity_id' => \\Naraki\\Core\\Models\\Entity::MEDIA,\n 'permission_mask' => 0b1111\n ],\n [\n 'entity_type_id' => 4,\n 'entity_id' => \\Naraki\\Core\\Models\\Entity::SYSTEM,\n 'permission_mask' => 0b1111\n ],\n [\n 'entity_type_id' => 5,\n 'entity_id' => \\Naraki\\Core\\Models\\Entity::USERS,\n 'permission_mask' => 0b1111\n ],\n [\n 'entity_type_id' => 5,\n 'entity_id' => \\Naraki\\Core\\Models\\Entity::GROUPS,\n 'permission_mask' => 0b1111\n ],\n [\n 'entity_type_id' => 5,\n 'entity_id' => \\Naraki\\Core\\Models\\Entity::BLOG_POSTS,\n 'permission_mask' => 0b1111\n ],\n [\n 'entity_type_id' => 5,\n 'entity_id' => \\Naraki\\Core\\Models\\Entity::MEDIA,\n 'permission_mask' => 0b1111\n ],\n [\n 'entity_type_id' => 5,\n 'entity_id' => \\Naraki\\Core\\Models\\Entity::SYSTEM,\n 'permission_mask' => 0b1111\n ],\n [\n 'entity_type_id' => 6,\n 'entity_id' => \\Naraki\\Core\\Models\\Entity::USERS,\n 'permission_mask' => 0b1111\n ],\n [\n 'entity_type_id' => 6,\n 'entity_id' => \\Naraki\\Core\\Models\\Entity::BLOG_POSTS,\n 'permission_mask' => 0b1111\n ],\n [\n 'entity_type_id' => 6,\n 'entity_id' => \\Naraki\\Core\\Models\\Entity::MEDIA,\n 'permission_mask' => 0b1111\n ],\n [\n 'entity_type_id' => 6,\n 'entity_id' => \\Naraki\\Core\\Models\\Entity::SYSTEM,\n 'permission_mask' => 0b1111\n ],\n ]);\n\n }",
"public function mediaTypePermissions() {\n // Generate media permissions for all media types.\n $media_types = $this->entityTypeManager->getStorage('media_type')->loadMultiple();\n return $this->generatePermissions($media_types, [$this, 'buildPermissions']);\n }",
"abstract public function getPermissions();",
"function listCompaniesByType ( $type ) {\n\t\tglobal $AppUI;\n\t\t$q = new DBQuery;\n\t\t$q->addQuery('company_id, company_name');\n\t\t$q->addTable('companies');\n\t\tforeach ($type as $t) { \n\t\t\t$q->addWhere('company_type ='. $t);\n\t\t}\n\t\t$this->setAllowedSQL($AppUI->user_id, $q);\n\t\t$q->addOrder('company_name');\n\n\t\treturn $q->loadHashList();\n\t}",
"public function export(string $type)\n {\n $permission = Permission::orderBy('id', 'asc');\n\n $title = \"Relação de Permissões do Sistema\";\n\n $meta = [\n 'Ordem' => 'por ID',\n ];\n\n $columns = [\n 'ID' => 'id',\n 'Descrição da Permissão' => 'title',\n 'Slug/Chave' => 'slug',\n 'Papéis' => function ($result) {\n $list = '';\n foreach ($result->roles as $role) {\n if ($result->roles->last() == $role) {\n $list .= $role->title;\n } else {\n $list .= $role->title . ', ';\n }\n }\n return $list;\n },\n ];\n\n if ($type == \"pdf\") {\n return $this->exportPDF($permission, $title, $meta, $columns);\n } elseif ($type == \"xlsx\") {\n return $this->exportExcel($permission, $title, $meta, $columns);\n } else {\n return $this->exportCSV($permission, $title, $meta, $columns);\n }\n }",
"function legacy_list_aliases($type)\n{\n $result = array();\n\n foreach ((new \\OPNsense\\Firewall\\Alias())->aliasIterator() as $alias) {\n if ($type == \"port\" && preg_match(\"/port/i\", $alias['type'])) {\n $result[] = array('name' => $alias['name'], 'type' => $alias['type']);\n } elseif ($type != \"port\" && !preg_match(\"/port/i\", $alias['type'])) {\n $result[] = array('name' => $alias['name'], 'type' => $alias['type']);\n }\n }\n\n return $result;\n}"
]
| [
"0.6803465",
"0.6761389",
"0.6692831",
"0.6634918",
"0.6594306",
"0.64647055",
"0.64469683",
"0.6351283",
"0.586982",
"0.58554333",
"0.5835833",
"0.5782066",
"0.57617277",
"0.5740527",
"0.57039744",
"0.5545564",
"0.547719",
"0.54566735",
"0.545404",
"0.5372211",
"0.5347817",
"0.5312818",
"0.52812326",
"0.5256539",
"0.52398103",
"0.52244544",
"0.5224271",
"0.5166924",
"0.5124428",
"0.51206875"
]
| 0.81037617 | 0 |
Test for execute() method if sales representatives IDs of company and initial company are equal. | public function testExecuteIfSalesRepresentativesIdsEqual()
{
$salesRepresentativeId = 1;
$company = $this
->getMockBuilder(\Magento\Company\Api\Data\CompanyInterface::class)
->disableOriginalConstructor()
->setMethods(['getSalesRepresentativeId'])
->getMockForAbstractClass();
$initialCompany = $this
->getMockBuilder(\Magento\Company\Api\Data\CompanyInterface::class)
->disableOriginalConstructor()
->setMethods(['getSalesRepresentativeId'])
->getMockForAbstractClass();
$initialCompany->expects($this->atLeastOnce())->method('getSalesRepresentativeId')
->willReturn($salesRepresentativeId);
$company->expects($this->atLeastOnce())->method('getSalesRepresentativeId')
->willReturn($salesRepresentativeId);
$this->companyEmailSender->expects($this->never())
->method('sendSalesRepresentativeNotificationEmail')
->willReturnSelf();
$this->model->execute($company, $initialCompany);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function testExecute()\n {\n $company = $this\n ->getMockBuilder(\\Magento\\Company\\Api\\Data\\CompanyInterface::class)\n ->disableOriginalConstructor()\n ->setMethods(['getSalesRepresentativeId'])\n ->getMockForAbstractClass();\n $initialCompany = $this\n ->getMockBuilder(\\Magento\\Company\\Api\\Data\\CompanyInterface::class)\n ->disableOriginalConstructor()\n ->setMethods(['getSalesRepresentativeId'])\n ->getMockForAbstractClass();\n $initialCompany->expects($this->once())->method('getSalesRepresentativeId')->willReturn(1);\n $company->expects($this->atLeastOnce())->method('getSalesRepresentativeId')->willReturn(2);\n $this->companyEmailSender->expects($this->once())\n ->method('sendSalesRepresentativeNotificationEmail')\n ->willReturnSelf();\n $this->model->execute($company, $initialCompany);\n }",
"public function test_sync_withExistingIds_sameCountAndReturnTrue() {\n\t\t$this->repo->sync(789,91437);\n\t\t\n\t\t$expected = array(\n\t\t\t 'count'=>(integer)$this->repo->count(),\n\t\t\t 'result'=>true\n\t\t);\n\t\t\n\t\t\n\t\t//sync same numbers, count should not change\n\t\t$result = $this->repo->sync(789,91437);\n\t\t\n\t\t$actual = array(\n\t\t\t'count'=>(integer) $this->repo->count(),\n\t\t\t'result'=>$result\n\t\t);\n\t\t\n\t\t$this->assertEquals($expected,$actual);\n\t\t\n\t}",
"public function test_updateLastResult_called_returnActionResultTrue()\n {\n $regular_numbers = [1,2,3,4,5];\n $lucky_numbers = [1,2];\n $id_draw = 1;\n $draw_to_persist = new EuroMillionsDraw();\n $money = new Money(5000, new Currency('EUR'));\n $draw_to_persist->initialize([\n 'draw_date' => new \\DateTime('2015-06-02 20:00:00'),\n 'jackpot' => $money,\n 'lottery' => 1\n ]);\n $expected = new ActionResult(true);\n $this->lotteryDrawRepository_double->findOneBy(['id' => $id_draw])->willReturn($draw_to_persist);\n $entityManager_stub = $this->getEntityManagerDouble();\n $entityManager_stub->flush()->shouldBeCalled();\n $this->stubEntityManager($entityManager_stub);\n $sut = $this->getSut();\n $actual = $sut->updateLastResult($regular_numbers,$lucky_numbers,$money,$id_draw);\n $this->assertEquals($expected,$actual);\n }",
"function checkUnique( $vals ) {\n $c = new Criteria();\n \n foreach ($vals as $key =>$value) {\n $name = \"SalesStatPeer::\".strtoupper($key);\n eval(\"\\$c->add(\".$name.\",\\$value);\");\n }\n \n $c->setDistinct();\n $SalesStat = SalesStatPeer::doSelect($c);\n \n if (count($SalesStat) >= 1) {\n $this ->SalesStat = $SalesStat[0];\n return true;\n } else {\n $this ->SalesStat = new SalesStat();\n return false;\n }\n }",
"function checkUnique( $vals ) {\n $c = new Criteria();\n \n foreach ($vals as $key =>$value) {\n $name = \"CreditPeer::\".strtoupper($key);\n eval(\"\\$c->add(\".$name.\",\\$value);\");\n }\n \n $c->setDistinct();\n $Credit = CreditPeer::doSelect($c);\n \n if (count($Credit) >= 1) {\n $this ->Credit = $Credit[0];\n return true;\n } else {\n $this ->Credit = new Credit();\n return false;\n }\n }",
"public function testSyncEntitiesFromOneRemoteService()\n {\n $this->setupRemoteService();\n\n //Setup the synchonization configuration\n $this->setupConfiguration();\n\n //Setup the synchronization state\n $this->setSyncState();\n\n //Perform synchronization\n $this->manager->execute(array('product'));\n\n\n //Test if all requested entities have been synced\n $state = $this->manager->getState('product');\n\n $this->assertEquals($state->getLastValue(), 10);\n\n }",
"public function testModerationByCompany(): void\n {\n // Initial state\n $productSummaryArray = $this->getProductsSummary();\n\n static::assertSame(11, $productSummaryArray[3][ProductApprovalStatus::APPROVED()->getKey()]);\n static::assertSame(2, $productSummaryArray[3][ProductApprovalStatus::PENDING()->getKey()]);\n static::assertSame(1, $productSummaryArray[3][ProductApprovalStatus::REJECTED()->getKey()]);\n\n static::assertSame(1, $productSummaryArray[4][ProductApprovalStatus::APPROVED()->getKey()]);\n static::assertSame(1, $productSummaryArray[4][ProductApprovalStatus::PENDING()->getKey()]);\n\n // We approve all products of company 3\n $this->moderationService->moderateByCompany(3, 'approve');\n\n // Pending products of company 3 should now be approved\n $productSummaryArray = $this->getProductsSummary();\n\n static::assertSame(13, $productSummaryArray[3][ProductApprovalStatus::APPROVED()->getKey()]);\n static::assertArrayNotHasKey(ProductApprovalStatus::PENDING()->getKey(), $productSummaryArray[3]);\n static::assertSame(1, $productSummaryArray[3][ProductApprovalStatus::REJECTED()->getKey()]);\n\n static::assertSame(1, $productSummaryArray[4][ProductApprovalStatus::APPROVED()->getKey()]);\n static::assertSame(1, $productSummaryArray[4][ProductApprovalStatus::PENDING()->getKey()]);\n }",
"public function execute()\n {\n $customerIds = (array)$this->getRequest()->getParam('customer_ids');\n $result = $this->resultFactory->create(\\Magento\\Framework\\Controller\\ResultFactory::TYPE_JSON);\n try {\n foreach ($customerIds as $customerId) {\n $customer = $this->customerRepository->getById($customerId);\n $companyAttributes = $this->companyAttributes->getCompanyAttributesByCustomer($customer);\n $companyId = $companyAttributes->getCompanyId();\n if ($companyId) {\n $company = $this->companyRepository->get($companyId);\n if ($company->getSuperUserId() == $customerId) {\n return $result->setData(['deletable' => false]);\n }\n }\n }\n } catch (\\Magento\\Framework\\Exception\\NoSuchEntityException $e) {\n return $result->setData(['deletable' => false]);\n }\n return $result->setData(['deletable' => true]);\n }",
"public function testApproveFinalReport()\n {\n $mockLogger = $this->createMock(Logger::class); //create mock Logger object\n $database = new DatabaseHelper($mockLogger, $this->pdo); //initialize database helper object\n\n $approvedAppID = 1;\n $pendingAppID = 3;\n $deniedAppID = 4;\n $newAppID = 6;\n\n $database->approveFinalReport($approvedAppID, null);\n $this->assertEquals(\"Approved\", $database->getFinalReport($approvedAppID)->status);\n\n $database->approveFinalReport($deniedAppID, null);\n $this->assertEquals(\"Approved\", $database->getFinalReport($deniedAppID)->status);\n\n $database->approveFinalReport($pendingAppID, null);\n $this->assertEquals(\"Approved\", $database->getFinalReport($pendingAppID)->status);\n\n $database->approveFinalReport($newAppID, null);\n $this->assertEquals(0, $database->getApplication($newAppID)); //shouldn't exist\n $this->assertEquals(0, $database->getFinalReport($newAppID));\n }",
"function IfExists($companyid) {\r\n $conn = conn();\r\n $sql = \"SELECT * FROM deposit WHERE companyid='$companyid'\";\r\n $stmt = $conn->prepare($sql);\r\n $status = $stmt->execute();\r\n $result = $stmt->fetchAll();\r\n if (!empty($result)) {\r\n return 1;\r\n } else {\r\n return 0;\r\n }\r\n\r\n $conn = NULL;\r\n }",
"public function test_updaLastResult_called_returnActionResultFalse()\n {\n //$this->markTestSkipped();\n $regular_numbers = [1,2,3,4,5];\n $lucky_numbers = [1,2];\n $id_draw = 1;\n $draw_to_persist = new EuroMillionsDraw();\n $money = new Money(5000, new Currency('EUR'));\n $draw_to_persist->initialize([\n 'draw_date' => new \\DateTime('2015-06-02 20:00:00'),\n 'jackpot' => $money,\n 'lottery' => 1\n ]);\n $expected = new ActionResult(false);\n $this->lotteryDrawRepository_double->findOneBy(['id' => $id_draw])->willReturn($draw_to_persist);\n $entityManager_stub = $this->getEntityManagerDouble();\n $entityManager_stub->flush()->willThrow(new \\Exception());\n $this->stubEntityManager($entityManager_stub);\n $sut = $this->getSut();\n $actual = $sut->updateLastResult($regular_numbers,$lucky_numbers,$money,$id_draw);\n $this->assertEquals($expected,$actual);\n }",
"public function test_execute_success()\n {\n $STATE = \\Magento\\Sales\\Model\\Order\\Invoice::STATE_PAID;\n $mObserver = $this->_mock(\\Magento\\Framework\\Event\\Observer::class);\n /** === Setup Mocks === */\n // $invoice = $observer->getData(self::DATA_INVOICE);\n $mInvoice = $this->_mock(\\Magento\\Sales\\Model\\Order\\Invoice::class);\n $mObserver\n ->shouldReceive('getData')->once()\n ->with(SalesOrderInvoicePay::DATA_INVOICE)\n ->andReturn($mInvoice);\n // $state = $invoice->getState();\n $mInvoice->shouldReceive('getState')->once()\n ->andReturn($STATE);\n // $order = $invoice->getOrder();\n $mOrder = $this->_mock(\\Magento\\Sales\\Api\\Data\\OrderInterface::class);\n $mInvoice\n ->shouldReceive('getOrder')->once()\n ->andReturn($mOrder);\n // $this->_callReplicate->orderSave($req);\n $this->mCallReplicate\n ->shouldReceive('orderSave')->once();\n /** === Call and asserts === */\n $this->obj->execute($mObserver);\n }",
"public function testExistingIdentity() {\n\n $session = $this->getSampleProjectSession(true);\n\n $bug = $session->find('sample_Bug')->filterBy('bugId', 521152)->one();\n $project = $session->find('sample_Project')->filterBy('projectId', 12345)->one();\n $user = $session->find('sample_User')->filterBy('userId', '55566')->one();\n\n $this->assertTrue($bug->owner === $project->manager);\n $this->assertTrue($user === $bug->owner);\n $this->assertTrue($user === $project->manager);\n \n }",
"function checkClientOnBS() {\n\t\t$retval = false;\n\n\t\t$q = new DBQuery ( );\n\t\t$q->addTable ( \"company_building_solution\" );\n\t\t$q->addQuery ( \"count(*)\" );\n\t\t$q->addWhere ( \"company_bs_company_id = $this->company_id\" );\n\n\t\t$num = intval ( $q->loadResult () );\n\t\tif ($num > 0)\n\t\t\t$retval = true;\n\n\t\t$q->clear ();\n\n\t\treturn $retval;\n\t}",
"function is_valid_company($id) {\n\t\t$str = \"SELECT * FROM company WHERE Comany_ID = $id\";\n\t\t$req = mysqli_query($link,$str);\n\t\t$num = mysqli_num_rows($req);\n\t\tif($num == 1) return true;\n\t\telse return false;\n\t}",
"public function run($company = null)\n {\n Schema::connection('order')->disableForeignKeyConstraints();\n\n $Thalapakatti = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name', 'Thalapakatti')->first()->id;\n $KFC_Demo = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name', 'KFC Demo')->first()->id;\n $Lassi_Shop = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name', 'Lassi Shop')->first()->id;\n $SeaShell = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name', 'SeaShell')->first()->id;\n $AlbertSons = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name', 'AlbertSons')->first()->id;\n $Aldi = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name', 'Aldi')->first()->id;\n $Kroger_Shop = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name', 'Kroger Shop')->first()->id;\n $_Flower = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name', '1800 Flower')->first()->id;\n $Chowking_nigeria = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name', 'Chowking nigeria')->first()->id;\n $MOS_Burger = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name', 'MOS Burger')->first()->id;\n $Beer_Temple = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name', 'Beer Temple')->first()->id;\n $Bonchon_Chicken = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name', 'Bonchon Chicken')->first()->id;\n $Marrybrown = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name', 'Marrybrown')->first()->id;\n $Metisse_Restaurant = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name', 'Metisse Restaurant')->first()->id;\n $Go_Cheers = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name', 'Go Cheers')->first()->id;\n $Drinkie = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name', 'Drinkie\\'Z')->first()->id;\n $Cactus_Restaurant = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name', 'Cactus Restaurant')->first()->id;\n $Drankers_Park = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name', 'Dranker\\'s Park')->first()->id;\n $Liquor_Palace = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name', 'Liquor Palace')->first()->id;\n $Jevinik_Restaurant = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name', 'Jevinik Restaurant')->first()->id;\n $Ferns_and_Petals = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name', 'Ferns and Petals')->first()->id;\n $Fussion_Florist = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name', 'Fussion Florist')->first()->id;\n $Just_FlowerZ = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name', 'Just FlowerZ')->first()->id;\n $Royal_Blooms = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name', 'Royal Blooms')->first()->id;\n $Flora = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name', 'Flora')->first()->id;\n $MooMix = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name', 'MooMix')->first()->id;\n $Walmart = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name', 'Walmart')->first()->id;\n $Whole_Foods = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name', 'Whole Foods')->first()->id;\n $ShopRite = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name', 'ShopRite')->first()->id;\n $Sala = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name', 'Sala')->first()->id;\n $Marketside = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name', 'Marketside')->first()->id;\n $Southeastern_Grocers = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name', 'Southeastern Grocers')->first()->id;\n $Food_Stuff = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name', 'Food Stuff')->first()->id;\n $Hungry_Nation = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name', 'Hungry Nation')->first()->id; \n\n \n\n\n DB::connection('order')->table('store_addons')->insert([\n ['store_id' => $Thalapakatti, 'addon_name' => 'Onion', 'addon_status' => 1, 'company_id' => $company],\n ['store_id' => $Thalapakatti, 'addon_name' => 'Sauce', 'addon_status' => 1, 'company_id' => $company],\n ['store_id' => $Thalapakatti, 'addon_name' => 'Mayonnaise', 'addon_status' => 1, 'company_id' => $company],\n ['store_id' => $KFC_Demo, 'addon_name' => 'Onion', 'addon_status' => 1, 'company_id' => $company],\n ['store_id' => $KFC_Demo, 'addon_name' => 'Mayonnaise', 'addon_status' => 1, 'company_id' => $company],\n ['store_id' => $KFC_Demo, 'addon_name' => 'Sauce', 'addon_status' => 1, 'company_id' => $company],\n ['store_id' => $SeaShell, 'addon_name' => 'Cheese', 'addon_status' => 1, 'company_id' => $company],\n ['store_id' => $Lassi_Shop, 'addon_name' => 'Sause', 'addon_status' => 1, 'company_id' => $company],\n ['store_id' => $MOS_Burger, 'addon_name' => 'Onion', 'addon_status' => 1, 'company_id' => $company],\n ['store_id' => $MOS_Burger, 'addon_name' => 'Sauce', 'addon_status' => 1, 'company_id' => $company],\n ['store_id' => $KFC_Demo, 'addon_name' => 'Cheese', 'addon_status' => 1, 'company_id' => $company],\n ['store_id' => $KFC_Demo, 'addon_name' => 'Cheese', 'addon_status' => 1, 'company_id' => $company]\n ]);\n \n Schema::connection('order')->enableForeignKeyConstraints();\n }",
"public function testExistentRecord()\n {\n try {\n DAL::beginTransaction();\n $assetidOne = 123;\n $typeid = 'asset';\n $sql = $this->_getInsertQuery($assetidOne, $typeid).';';\n\n $assetidTwo = 124;\n $typeid = 'asset';\n $sql .= $this->_getInsertQuery($assetidTwo, $typeid);\n\n $expected = 'asset';\n DAL::executeQueries($sql);\n\n $type = TestDALSys1::dalTestExecuteOne($assetidOne);\n PHPUnit_Framework_Assert::assertEquals($expected, $type);\n\n $type = TestDALSys1::dalTestExecuteOne($assetidTwo);\n PHPUnit_Framework_Assert::assertEquals($expected, $type);\n DAL::rollBack();\n\n } catch (PDOException $e) {\n DAL::rollBack();\n PHPUnit_Framework_Assert::fail($e->getMessage().$e->getTraceAsString());\n } catch (ChannelException $e) {\n DAL::rollBack();\n PHPUnit_Framework_Assert::fail($e->getMessage().$e->getTraceAsString());\n }\n\n }",
"public function run($company = null)\n {\n Schema::connection('order')->disableForeignKeyConstraints();\n\n $Thalapakatti = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name','Thalapakatti')->first()->id;\n $KFC_Demo = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name','KFC Demo')->first()->id;\n $Lassi_Shop = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name','Lassi Shop')->first()->id;\n $SeaShell = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name','SeaShell')->first()->id;\n $AlbertSons = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name','AlbertSons')->first()->id;\n $Aldi = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name','Aldi')->first()->id;\n $Kroger_Shop = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name','Kroger Shop')->first()->id;\n $_Flower = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name','1800 Flower')->first()->id;\n $Chowking_nigeria = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name','Chowking nigeria')->first()->id;\n $MOS_Burger = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name','MOS Burger')->first()->id;\n $Beer_Temple = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name','Beer Temple')->first()->id;\n $Bonchon_Chicken = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name','Bonchon Chicken')->first()->id;\n $Marrybrown = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name','Marrybrown')->first()->id;\n $Metisse_Restaurant = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name','Metisse Restaurant')->first()->id;\n $Go_Cheers = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name','Go Cheers')->first()->id;\n $Drinkie = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name','Drinkie\\'Z')->first()->id;\n $Cactus_Restaurant = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name','Cactus Restaurant')->first()->id;\n $Drankers_Park = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name','Dranker\\'s Park')->first()->id;\n $Liquor_Palace = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name','Liquor Palace')->first()->id;\n $Jevinik_Restaurant = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name','Jevinik Restaurant')->first()->id;\n $Ferns_and_Petals = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name','Ferns and Petals')->first()->id;\n $Fussion_Florist = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name','Fussion Florist')->first()->id;\n $Just_FlowerZ = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name','Just FlowerZ')->first()->id;\n $Royal_Blooms = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name','Royal Blooms')->first()->id;\n $Flora_ = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name','Flora')->first()->id;\n $MooMix = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name','MooMix')->first()->id;\n $Walmart = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name','Walmart')->first()->id;\n $Whole_Foods = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name','Whole Foods')->first()->id;\n $ShopRite = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name','ShopRite')->first()->id;\n $Sala = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name','Sala')->first()->id;\n $Marketside = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name','Marketside')->first()->id;\n $Southeastern_Grocers = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name','Southeastern Grocers')->first()->id;\n $Food_Stuff = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name','Food Stuff')->first()->id;\n $Hungry_Nation = DB::connection('order')->table('stores')->where('company_id', $company)->where('store_name','Hungry Nation')->first()->id; \n\n \n\n DB::connection('order')->table('store_timings')->insert([\n ['store_id' => $Aldi,'store_start_time' =>'00:00:00','store_end_time' =>'12:00:00','store_day' =>'All','company_id' => $company],\n['store_id' => $Kroger_Shop,'store_start_time' =>'00:00:00','store_end_time' =>'12:00:00','store_day' =>'All','company_id' => $company],\n['store_id' => $_Flower,'store_start_time' =>'00:00:00','store_end_time' =>'12:00:00','store_day' =>'All','company_id' => $company],\n['store_id' => $AlbertSons,'store_start_time' =>'00:00:00','store_end_time' =>'23:00:00','store_day' =>'All','company_id' => $company],\n['store_id' => $Thalapakatti,'store_start_time' =>'12:00:00','store_end_time' =>'00:10:00','store_day' =>'All','company_id' => $company],\n['store_id' => $Chowking_nigeria,'store_start_time' =>'00:00:00','store_end_time' =>'23:59:00','store_day' =>'All','company_id' => $company],\n['store_id' => $MOS_Burger,'store_start_time' =>'18:00:00','store_end_time' =>'00:00:00','store_day' =>'All','company_id' => $company],\n['store_id' => $Bonchon_Chicken,'store_start_time' =>'12:00:00','store_end_time' =>'00:00:00','store_day' =>'All','company_id' => $company],\n['store_id' => $Marrybrown,'store_start_time' =>'00:00:00','store_end_time' =>'12:00:00','store_day' =>'All','company_id' => $company],\n['store_id' => $Metisse_Restaurant,'store_start_time' =>'12:00:00','store_end_time' =>'00:00:00','store_day' =>'All','company_id' => $company],\n['store_id' => $Cactus_Restaurant,'store_start_time' =>'12:00:00','store_end_time' =>'00:00:00','store_day' =>'All','company_id' => $company],\n['store_id' => $Jevinik_Restaurant,'store_start_time' =>'12:00:00','store_end_time' =>'00:00:00','store_day' =>'All','company_id' => $company],\n['store_id' => $Ferns_and_Petals,'store_start_time' =>'00:00:00','store_end_time' =>'12:00:00','store_day' =>'All','company_id' => $company],\n['store_id' => $Walmart,'store_start_time' =>'01:00:00','store_end_time' =>'12:00:00','store_day' =>'All','company_id' => $company],\n['store_id' => $Fussion_Florist,'store_start_time' =>'00:00:00','store_end_time' =>'12:00:00','store_day' =>'All','company_id' => $company],\n['store_id' => $Just_FlowerZ,'store_start_time' =>'00:00:00','store_end_time' =>'12:00:00','store_day' =>'All','company_id' => $company],\n['store_id' => $Flora_,'store_start_time' =>'00:00:00','store_end_time' =>'12:00:00','store_day' =>'All','company_id' => $company],\n['store_id' => $Royal_Blooms,'store_start_time' =>'00:00:00','store_end_time' =>'12:00:00','store_day' =>'All','company_id' => $company],\n['store_id' => $MooMix,'store_start_time' =>'00:00:00','store_end_time' =>'12:00:00','store_day' =>'All','company_id' => $company],\n['store_id' => $Go_Cheers,'store_start_time' =>'00:00:00','store_end_time' =>'12:00:00','store_day' =>'All','company_id' => $company],\n['store_id' => $Whole_Foods,'store_start_time' =>'01:00:00','store_end_time' =>'12:00:00','store_day' =>'All','company_id' => $company],\n['store_id' => $Drankers_Park,'store_start_time' =>'00:00:00','store_end_time' =>'12:00:00','store_day' =>'All','company_id' => $company],\n['store_id' => $Drinkie,'store_start_time' =>'00:00:00','store_end_time' =>'12:00:00','store_day' =>'All','company_id' => $company],\n['store_id' => $Liquor_Palace,'store_start_time' =>'00:00:00','store_end_time' =>'12:00:00','store_day' =>'All','company_id' => $company],\n['store_id' => $Beer_Temple,'store_start_time' =>'00:00:00','store_end_time' =>'12:00:00','store_day' =>'All','company_id' => $company],\n['store_id' => $ShopRite,'store_start_time' =>'01:00:00','store_end_time' =>'12:00:00','store_day' =>'All','company_id' => $company],\n['store_id' => $Sala,'store_start_time' =>'00:00:00','store_end_time' =>'12:00:00','store_day' =>'All','company_id' => $company],\n['store_id' => $Marketside,'store_start_time' =>'00:00:00','store_end_time' =>'00:00:00','store_day' =>'All','company_id' => $company],\n['store_id' => $Lassi_Shop,'store_start_time' =>'00:00:00','store_end_time' =>'23:00:00','store_day' =>'All','company_id' => $company],\n['store_id' => $Southeastern_Grocers,'store_start_time' =>'01:00:00','store_end_time' =>'12:00:00','store_day' =>'All','company_id' => $company],\n['store_id' => $KFC_Demo,'store_start_time' =>'00:00:00','store_end_time' =>'23:59:00','store_day' =>'All','company_id' => $company],\n['store_id' => $SeaShell,'store_start_time' =>'00:00:00','store_end_time' =>'12:00:00','store_day' =>'All','company_id' => $company],\n['store_id' => $Food_Stuff,'store_start_time' =>'00:00:00','store_end_time' =>'00:00:00','store_day' =>'All','company_id' => $company],\n['store_id' => $Hungry_Nation,'store_start_time' =>'08:00:00','store_end_time' =>'16:00:00','store_day' =>'SUN','company_id' => $company],\n['store_id' => $Hungry_Nation,'store_start_time' =>'08:00:00','store_end_time' =>'16:00:00','store_day' =>'MON','company_id' => $company],\n['store_id' => $Hungry_Nation,'store_start_time' =>'08:00:00','store_end_time' =>'16:00:00','store_day' =>'TUE','company_id' => $company],\n['store_id' => $Hungry_Nation,'store_start_time' =>'08:00:00','store_end_time' =>'16:00:00','store_day' =>'WED','company_id' => $company],\n['store_id' => $Hungry_Nation,'store_start_time' =>'08:00:00','store_end_time' =>'16:00:00','store_day' =>'THU','company_id' => $company],\n['store_id' => $Hungry_Nation,'store_start_time' =>'08:00:00','store_end_time' =>'16:00:00','store_day' =>'FRI','company_id' => $company],\n['store_id' => $Hungry_Nation,'store_start_time' =>'08:00:00','store_end_time' =>'16:00:00','store_day' =>'SAT','company_id' => $company]\n ]);\n \n Schema::connection('order')->enableForeignKeyConstraints();\n }",
"public function testAfterGetCompanyResultDataWithoutId()\n {\n $companyDataProvider = $this->getMockBuilder(\\Magento\\Company\\Model\\Company\\DataProvider::class)\n ->disableOriginalConstructor()\n ->getMock();\n $currency = $this->getMockBuilder(\\Magento\\Directory\\Model\\Currency::class)\n ->disableOriginalConstructor()\n ->getMock();\n $currency->expects($this->once())->method('getCurrencyCode')->willReturn('USD');\n $store = $this->getMockBuilder(\\Magento\\Store\\Model\\Store::class)\n ->disableOriginalConstructor()\n ->getMock();\n $store->expects($this->once())->method('getBaseCurrency')->willReturn($currency);\n $this->storeManager->expects($this->once())->method('getStore')->willReturn($store);\n $result = [];\n $expected = ['company_credit' => ['currency_code' => 'USD']];\n\n $this->assertEquals($expected, $this->dataProvider->afterGetCompanyResultData($companyDataProvider, $result));\n }",
"protected function beforeFind()\n {\n $uc = false;\n \n //get defined user positions in companies\n $sql = \" \n SELECT DISTINCT \n cucp_id \n FROM\n AuthItem ai \n INNER JOIN cucp_user_company_position \n ON ai.name = cucp_role \n INNER JOIN AuthAssignment aa \n ON ai.name = aa.itemname \n WHERE aa.userid = \".Yii::app()->user->id.\" \n \";\n $user_def_company_positions = Yii::app()->db->createCommand($sql)->queryAll();\n \n $criteria = false;\n if($user_def_company_positions){\n \n $udcp = array();\n foreach($user_def_company_positions as $v){\n $udcp[] = $v['cucp_id'];\n }\n //get companies, where is user positions\n $sql = \" \n SELECT DISTINCT \n ccuc_ccmp_id \n FROM\n ccuc_user_company \n WHERE ccuc_cucp_id in (\".implode(',',$udcp).\") \n AND ccuc_person_id = \".Yii::app()->getModule('user')->user()->profile->person_id.\" \n AND ccuc_status = '\".CcucUserCompany::CCUC_STATUS_PERSON.\"'\n \";\n $user_companies = Yii::app()->db->createCommand($sql)->queryAll(); \n\n //add to criteria user companies\n $uc = array();\n $uc[] = 0; //for avoiding error if empty user company list\n foreach($user_companies as $v){\n $uc[] = $v['ccuc_ccmp_id'];\n } \n\n }\n \n if(Yii::app()->getModule('d2company')->access){\n \n $user_roles = Authassignment::model()->getUserRoles(Yii::app()->user->id);\n foreach(Yii::app()->getModule('d2company')->access as $access){\n \n //validate roles\n $intersect = array_intersect($user_roles,$access['roles']);\n if(empty($intersect)){\n continue;\n } \n \n //get group companies\n $sql = \" \n SELECT \n ccxg_ccmp_id \n FROM \n ccxg_company_x_group \n WHERE \n ccxg_ccgr_id IN (\".implode(',',$access['ccgr_id']).\")\";\n \n $ccmp_id_list = Yii::app()->db->createCommand($sql)->queryAll(); \n if(!empty($ccmp_id_list)){\n if($uc === false){\n $uc = array();\n $uc[] = 0; //for avoiding error if empty user company list\n } \n foreach($ccmp_id_list as $row){\n $uc[] = $row['ccxg_ccmp_id'];\n }\n }\n }\n \n \n }\n \n if($uc !== false){\n if(!$criteria){\n $criteria = new CDbCriteria;\n } \n $criteria->compare('ccmp_id', $uc);\n }\n \n //filter by syscomapny\n \n if( Yii::app()->hasComponent('sysCompany') && Yii::app()->sysCompany->getActiveCompany()){\n if(!$criteria){\n $criteria = new CDbCriteria;\n }\n $criteria->compare('ccmp_sys_ccmp_id', Yii::app()->sysCompany->getActiveCompany());\n }\n \n if($criteria){\n $this->dbCriteria->mergeWith($criteria);\n }\n \n parent::beforeFind();\n }",
"public function return_existing_if_exists()\n {\n $author = factory( Author::class )->create();\n $data = array_add( $this->authorDataFormat, 'data.id', $author->id );\n\n $newAuthor = $this->dispatch( new StoreAuthor( $data ) );\n\n $this->assertEquals( $author->id, $newAuthor->id );\n }",
"public function testCompareOnlySelectedIndexesFromDupeCheck()\n {\n //create a bean, values, populate and save\n $focus = loadBean('Contacts');\n $focus->first_name = 'first '.date(\"YmdHis\");\n $focus->last_name = 'last '.date(\"YmdHis\");\n $focus->assigned_user_id = '1';\n $focus->save();\n\n\n //create the importDuplicateCheck object and get the list of duplicateCheckIndexes\n $idc = new ImportDuplicateCheck($focus);\n\n //we are going to test agains the first name, last name, full name, and assigned to indexes\n //to prove that only selected indexes are being used.\n\n //lets do a straight dupe check with the same bean on first name, should return true\n $this->assertTrue($idc->isADuplicateRecord(array('idx_cont_last_first::first_name')),'simulated check against first name index (idx_cont_last_first::first_name) failed (returned false instead of true).');\n\n //now lets test on full name index should also return true\n $this->assertTrue($idc->isADuplicateRecord(array('full_name::full_name')),'first simulated check against full name index (full_name::full_name) failed (returned false instead of true). This check means BOTH first AND last name must match.');\n\n //now lets remove the first name and redo the check, should return false\n $focus->first_name = '';\n $idc = new ImportDuplicateCheck($focus);\n $this->assertFalse($idc->isADuplicateRecord(array('idx_cont_last_first::first_name')),'simulated check against first name index (idx_cont_last_first::first_name) failed (returned true instead of false). This is wrong because we removed the first name so there should be no match.');\n\n //lets retest on full name index should return false now as first AND last do not match the original\n $this->assertFalse($idc->isADuplicateRecord(array('full_name::full_name')),'second simulated check against full name index (full_name::full_name) failed (returned true instead of false). This check means BOTH first AND last name must match and is wrong because we removed the first name so there should be no match.');\n\n //now lets rename the contact and test on assigned user, should return true\n $focus->first_name = 'first '.date(\"YmdHis\");\n $focus->last_name = 'last '.date(\"YmdHis\");\n $idc = new ImportDuplicateCheck($focus);\n $this->assertTrue($idc->isADuplicateRecord(array('idx_del_id_user::assigned_user_id')),'simulated check against assigned user index (idx_del_id_user::assigned_user_id) failed (returned false instead of true). This is wrong because we have not changed this field and it should remain a duplicate');\n\n //we're done, lets delete the focus bean now\n $focus->mark_deleted($focus->id);\n\n }",
"public function testEql() {\n $testUserRank = [];\n $testUserRank[0] = new UserRank();\n $testUserRank[0]->setUserID(1);\n $testUserRank[0]->setRankID(2);\n\n $testUserRank[1] = new UserRank();\n $testUserRank[1]->setUserID(1);\n $testUserRank[1]->setRankID(2);\n\n $testUserRank[2] = new UserRank();\n $testUserRank[2]->setUserID(3);\n $testUserRank[2]->setRankID(4);\n\n // Check same object is eql\n $this->assertTrue($testUserRank[0]->eql($testUserRank[0]));\n\n // Check same details are eql\n $this->assertTrue($testUserRank[0]->eql($testUserRank[0]));\n\n // Check different arent equal\n $this->assertFalse($testUserRank[0]->eql($testUserRank[0]));\n }",
"public function testFindByCustomer()\n {\n $rand_id = rand(1, 23);\n $project = $this->getRepo()->find($rand_id);\n\n $this->assertGreaterThanOrEqual(1, count($this->getRepoWithQB()->findByCustomer(\n $project->getCustomer()->getId()\n )));\n }",
"public static function syncCompanies()\n {\n $ak_company_users = self::find()->where(['space_id' => NULL])->all();\n\n foreach($ak_company_users as $ak_company_user)\n {\n $ak_copmany = new Companies();\n $ak_copmany = Json::decode($ak_copmany->view($ak_company_user->akc_id));\n\n if(!empty($ak_copmany))\n {\n $space = Space::findOne(['name' => $ak_copmany['data']['name']]);\n\n if(!empty($space))\n {\n // AkauntingCompany::linkSpace($space->id, $ak_copmany['data']['id']);\n\n $ak_company_user->space_id = $space->id;\n if(!$ak_company_user->save())\n {\n Yii::error('Error in saving record in ' . self::tableName() . ' ' . __CLASS__ . ' ' . __FUNCTION__ . \"\\n\\n\" . Json::encode($ak_company_user->getErrors()));\n }\n }\n }\n }\n }",
"public function test_getDrawByDate_calledWithValidDate_returnActionResultWithOnceDraw()\n {\n $today = new \\DateTime('2015-11-03');\n $draw_to_persist = new EuroMillionsDraw();\n $sut = $this->getSut();\n $this->lotteryDrawRepository_double->findOneBy(['draw_date' => $today])->willReturn($draw_to_persist);\n $actual = $sut->getDrawByDate($today);\n $this->assertEquals(true,$actual->success());\n }",
"public function equals($other) { return $this->obj==Sandbox::unwrap($other); }",
"public function testCorrectCanBuyWithEqualMoney(){\n\t\t\t//ARRANGE\n\t\t\t$a= new APIManager();\n\t\t\t$b= new PortfolioManager(14);\n\t\t\t$b->setBalance(100);\n\t\t\t$c= new Trader($a, $b);\n\t\t\t$stock = new Stock(\"Google\",\"GOOGL\",100,10,9);\n\t\t\t//ACT \n\t\t\t$result = $c->canBuy($stock,1);\n\t\t\t//ASSERT\n\t\t\t$this->assertEquals(True,$result);\n\n\t\t}",
"public function byPrimaryKeys()\n {\n $mockResult = $this->getMock('stubDatabaseResult');\n $this->mockConnection->expects($this->any())->method('query')->will($this->returnValue($mockResult));\n $mockResult->expects($this->exactly(2))\n ->method('fetch')\n ->will($this->onConsecutiveCalls(false, array('id' => 'mock', 'bar' => 'Here is bar.', 'default' => 'And this is default.')));\n $this->assertNull($this->dbFinder->findByPrimaryKeys($this->mockConnection, new stubReflectionClass('MockSinglePrimaryKeyEntity'), array('id' => 'mock')));\n $singlePrimaryKey = $this->dbFinder->findByPrimaryKeys($this->mockConnection, new stubReflectionClass('MockSinglePrimaryKeyEntity'), array('id' => 'mock'));\n $this->assertEquals('mock', $singlePrimaryKey->getId());\n $this->assertEquals('Here is bar.', $singlePrimaryKey->withAnnotation());\n $this->assertEquals('And this is default.', $singlePrimaryKey->withDefaultValue());\n $this->assertEquals('foo', $this->mockQueryBuilder->getSelect()->getBaseTableName());\n }",
"public function testCountQueryIsPerformedOnce()\n {\n $count = 42;\n $countSql = 'SELECT COUNT(*) FROM table';\n\n $itemsQuery = $this->createNativeQuery();\n $countQuery = $this->createNativeQuery($countSql);\n\n $this->connectionMock->expects(static::once())\n ->method('executeQuery')\n ->with($countSql)\n ->willReturn($count);\n\n $cursor = new DoctrineOrmNativeQueryCursor($itemsQuery, $countQuery);\n\n static::assertCount($count, $cursor, 'Incorrect count returned for first time');\n static::assertCount($count, $cursor, 'Incorrect count returned for second time');\n }"
]
| [
"0.59031135",
"0.5580825",
"0.5340377",
"0.52788275",
"0.5170822",
"0.51461387",
"0.51396227",
"0.5054827",
"0.5035228",
"0.500984",
"0.49981907",
"0.4992841",
"0.4984993",
"0.4982965",
"0.497837",
"0.4953366",
"0.49393314",
"0.49281672",
"0.49234185",
"0.49032775",
"0.48983607",
"0.4890796",
"0.48901322",
"0.48480162",
"0.48449555",
"0.48442838",
"0.4814573",
"0.48082832",
"0.48059148",
"0.47966707"
]
| 0.76329875 | 0 |
Sets a new uUIDIdentifikator | public function setUUIDIdentifikator($uUIDIdentifikator)
{
$this->uUIDIdentifikator = $uUIDIdentifikator;
return $this;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function setIdentifier($id)\n {\n $this->uid = (int)$id;\n }",
"function setUID($uid) {\n\t\t$this->_uid = $uid;\n\t}",
"public function setUid($uid);",
"public function set_uid($uid) {\n $this->uid = intval($uid);\n }",
"public function setUID($uid = null)\n {\n if (empty($uid))\n {\n $uid = Uuid::uuid1()->getUrn();\n }\n $this->uid = $uid;\n return $uid;\n }",
"public function setUid($value) {\n return $this->set(self::UID, $value);\n }",
"public function setUid($value)\n {\n return $this->set(self::_UID, $value);\n }",
"public function setUid($value)\n {\n return $this->set(self::_UID, $value);\n }",
"public function setUid($value)\n {\n return $this->set(self::_UID, $value);\n }",
"public function setUid($value)\n {\n return $this->set(self::_UID, $value);\n }",
"public function setUid($value)\n {\n return $this->set(self::_UID, $value);\n }",
"public function setUid($value)\n {\n return $this->set(self::_UID, $value);\n }",
"public function generateNewUid()\n {\n $this->uid = gmdate('Ymd') . 'T' . gmdate('His') . 'Z-' . uniqid('', true) . '@' . gethostname();\n\n return $this;\n }",
"function setUid($uid) {\n $this->checkChange();\n $this->uid = $uid;\n return $this;\n }",
"public function setUid($value)\n {\n $this->uid = $value;\n return $this;\n }",
"private function _setUserid($input) {\n\t\tif(!Validator::UnsignedNumber($input)) throw new Exception(lang('error_90'));\n\t\t$this->_identifier = $input;\n\t}",
"public function setUUID($uUID)\n {\n $this->uUID = $uUID;\n return $this;\n }",
"public function createUid()\n {\n $uid = uniqid();\n while (AutoEvent::where('uid', '=', $uid)->count() > 0) {\n $uid = uniqid();\n }\n $this->uid = $uid;\n }",
"public function setIduser($value)\n {\n $this->iduser = $value;\n }",
"public function setUid(?string $uid): void\n {\n $this->uid['value'] = $uid;\n }",
"public function withUid($uid);",
"public function setUid(?string $uid): void\n {\n $this->uid = $uid;\n }",
"function SetId($value) { $this->id=$value; }",
"function setIdentifier($val) {\n $this->identifier = $this->updateDB('identifier', $val);\n }",
"public function set_id_user($value = \"\")\n {\n $this->_id_user = \\helpers\\Validator::valInt('f_id_user', $value, TRUE);\n }",
"public function setID($value) {\r\n //if (!is_numeric($value)) die(\"setID() only accepts a numerical ID value\");\r\n $this->id = $value;\r\n }",
"function get_uid($uid){\n\t\t$this->uid = $uid;\n\t}",
"function setId($value){\n\t\t//echo \"setting ID to \".$value;\n\t\t$this->_id=$value;\n\t\t//echo \"ID set to \".$this->_id;\n\t\treturn $this;\n\t}",
"function setId($value) {\n $this->_id = intval($value);\n }",
"function setUniqueID($key) {\r\n\t\t$this->uniqueID = $key;\r\n\t}"
]
| [
"0.6738292",
"0.6476877",
"0.6431986",
"0.63546604",
"0.629667",
"0.625409",
"0.61927783",
"0.61927783",
"0.61927783",
"0.61927783",
"0.61927783",
"0.61927783",
"0.617899",
"0.6167011",
"0.6099815",
"0.60893697",
"0.60704887",
"0.6018466",
"0.5966381",
"0.5962146",
"0.59535563",
"0.5940549",
"0.5928941",
"0.59092355",
"0.5892838",
"0.58898705",
"0.5889172",
"0.5847066",
"0.5841068",
"0.5800131"
]
| 0.6972107 | 0 |
Sets a new virkningFraFilter | public function setVirkningFraFilter(?\Digitaliseringskataloget\Sagdok3_0_0\VirkningFraFilter $virkningFraFilter = null)
{
$this->virkningFraFilter = $virkningFraFilter;
return $this;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function setFilter($filter){ }",
"function setFilter($filter) {\n\t\t$this->_filter = $filter;\n\t}",
"public function setFilter($filter) : self\n {\n $this->initialized['filter'] = true;\n $this->filter = $filter;\n return $this;\n }",
"public function setFilter(string $filter);",
"public function setVirkningTilFilter(?\\Digitaliseringskataloget\\Sagdok3_0_0\\VirkningTilFilter $virkningTilFilter = null)\n {\n $this->virkningTilFilter = $virkningTilFilter;\n return $this;\n }",
"public function createFilter();",
"public function setFilter(Zend_Filter_Interface $filter)\n\t{\n\t\tself::$_filter = $filter;\n\t\treturn $this;\n\t}",
"public function setFilter($filter)\n {\n $validFilters = self::NO_FILTER |\n self::FILTER_NONE | self::FILTER_SUB |\n self::FILTER_UP | self::FILTER_AVG |\n self::FILTER_PAETH | self::ALL_FILTERS;\n\n $filter = $filter & $validFilters;\n\n $this->filter = (integer) $filter;\n\n return $this;\n }",
"public function setFilter(Elastica_Filter_Abstract $filter)\n {\n return $this->_setFacetParam('facet_filter', $filter->toArray());\n }",
"public function setFilter(Elastica_Filter_Abstract $filter)\n {\n return $this->_setFacetParam('filter', $filter->toArray());\n }",
"public function setFilter($arrFilter);",
"public function setFilter(\\FilterIterator $filter)\n\t{\n\t\t$this->filter = $filter;\n\t}",
"public function setFilter(bool $filter): AssetInterface\n {\n }",
"public function setFilter($filter)\n {\n $this->filter = $filter;\n\n return $this;\n }",
"protected function setFilter(callable $filter)\n {\n $this->filter = $filter;\n\n return $this;\n }",
"private function setFilter()\n\t{\n\t\t// get filter values\n\t\t$this->filter['language'] = ($this->getParameter('language', 'array') != '') ? $this->getParameter('language', 'array') : BL::getWorkingLanguage();\n\t\t$this->filter['application'] = $this->getParameter('application');\n\t\t$this->filter['module'] = $this->getParameter('module');\n\t\t$this->filter['type'] = $this->getParameter('type', 'array');\n\t\t$this->filter['name'] = $this->getParameter('name');\n\t\t$this->filter['value'] = $this->getParameter('value');\n\n\t\t// build query for filter\n\t\t$this->filterQuery = BackendLocaleModel::buildURLQueryByFilter($this->filter);\n\t}",
"public function setDataFilter($filter)\n {\n // TODO: improve logging when we finally have a central Tesseract debugging workflow\n if (TYPO3_DLOG) {\n t3lib_div::devLog('Data filters are currently not supported!', 'tagpackprovider', 2);\n }\n }",
"private function setFilter()\n {\n $this->filter['value'] = $this->getParameter('value') == null ? '' : $this->getParameter('value');\n }",
"public function setFilter($filter)\n {\n $filters = array();\n parse_str($filter, $filters);\n foreach ($filters as $key => $val) {\n $this->addFilter($key, $val);\n }\n \n return $this;\n }",
"function conf__filtro_libro(leanInicial_ei_filtro $filtro)\n\t\t{\n\t\t\tif (isset($this->s__datos_filtro)){\n\t\t\t\t$filtro->set_datos($this->s__datos_filtro);\n\t\t\t} \n\t\t}",
"public function register_filters() {\n\n\t\t}",
"function acf_set_filters($filters = array())\n{\n}",
"public function __construct(\\Shield\\Filter $filter)\n {\n $this->filter = $filter;\n $this->load();\n }",
"public function filter($filter)\n {\n $this->data['filter'] = $filter;\n\n return $this;\n }",
"public function setRegistreringFraFilter(?\\Digitaliseringskataloget\\Sagdok3_0_0\\RegistreringFraFilter $registreringFraFilter = null)\n {\n $this->registreringFraFilter = $registreringFraFilter;\n return $this;\n }",
"public function registerFilter(Chainr_Filter $filter) {\n\t\t$this->filterChain->register($filter);\n\t}",
"public function setAdditionalFilter($dataProvider, $filter);",
"function setFilter($f) {\n\t\tif (!is_subclass_of($f, \"\\Library\\Database\\LinqEquality\")) {\n\t\t\tthrow new DBException(\"Must be a LINQ Equality\");\n\t\t} else {\n\t\t\t$f->setName(trim($this->getTable(),\"`\"));\n\t\t\t$this->filter = $f;\n\t\t}\n\t\treturn $this;\n\t}",
"public function setFilter(BaseOperator $filter)\n {\n $this->filter = $filter;\n }",
"function mFILTER(){\n try {\n $_type = Erfurt_Sparql_Parser_Sparql11_Update_Tokenizer11::$FILTER;\n $_channel = Erfurt_Sparql_Parser_Sparql11_Update_Tokenizer11::$DEFAULT_TOKEN_CHANNEL;\n // Tokenizer11.g:211:3: ( 'filter' ) \n // Tokenizer11.g:212:3: 'filter' \n {\n $this->matchString(\"filter\"); \n\n\n }\n\n $this->state->type = $_type;\n $this->state->channel = $_channel;\n }\n catch(Exception $e){\n throw $e;\n }\n }"
]
| [
"0.65618676",
"0.6379019",
"0.626052",
"0.624759",
"0.60144067",
"0.5960534",
"0.59402245",
"0.59334904",
"0.59313",
"0.5901031",
"0.58806205",
"0.5840974",
"0.5840884",
"0.5825377",
"0.57891357",
"0.57356817",
"0.5718442",
"0.5674054",
"0.5647496",
"0.5639524",
"0.5626549",
"0.5606164",
"0.5572728",
"0.5560986",
"0.55578965",
"0.55123746",
"0.5509246",
"0.5493866",
"0.5479647",
"0.54675955"
]
| 0.67078674 | 0 |
Sets a new virkningTilFilter | public function setVirkningTilFilter(?\Digitaliseringskataloget\Sagdok3_0_0\VirkningTilFilter $virkningTilFilter = null)
{
$this->virkningTilFilter = $virkningTilFilter;
return $this;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function setFilter($filter){ }",
"function setFilter($filter) {\n\t\t$this->_filter = $filter;\n\t}",
"public function setFilter(string $filter);",
"public function setDataFilter($filter)\n {\n // TODO: improve logging when we finally have a central Tesseract debugging workflow\n if (TYPO3_DLOG) {\n t3lib_div::devLog('Data filters are currently not supported!', 'tagpackprovider', 2);\n }\n }",
"public function setFilter($filter) : self\n {\n $this->initialized['filter'] = true;\n $this->filter = $filter;\n return $this;\n }",
"public function setFilterNik($filterNik)\n {\n $this->filterNik = $filterNik;\n }",
"public function setRegistreringTilFilter(?\\Digitaliseringskataloget\\Sagdok3_0_0\\RegistreringTilFilter $registreringTilFilter = null)\n {\n $this->registreringTilFilter = $registreringTilFilter;\n return $this;\n }",
"public function setFilter(\\FilterIterator $filter)\n\t{\n\t\t$this->filter = $filter;\n\t}",
"public function setFilter($filter)\n {\n $validFilters = self::NO_FILTER |\n self::FILTER_NONE | self::FILTER_SUB |\n self::FILTER_UP | self::FILTER_AVG |\n self::FILTER_PAETH | self::ALL_FILTERS;\n\n $filter = $filter & $validFilters;\n\n $this->filter = (integer) $filter;\n\n return $this;\n }",
"public function setFilter(bool $filter): AssetInterface\n {\n }",
"public function setImageFilter($filter)\n {\n $this->imageFilter = $filter;\n return $this;\n }",
"public function __construct(\\Shield\\Filter $filter)\n {\n $this->filter = $filter;\n $this->load();\n }",
"public function setFilter(BaseOperator $filter)\n {\n $this->filter = $filter;\n }",
"public function setFilter($filter)\n {\n $this->filter = $filter;\n\n return $this;\n }",
"public function createFilter();",
"public function setVirkningFraFilter(?\\Digitaliseringskataloget\\Sagdok3_0_0\\VirkningFraFilter $virkningFraFilter = null)\n {\n $this->virkningFraFilter = $virkningFraFilter;\n return $this;\n }",
"public function setVyresil($vyresil)\n {\n $this->vyresil = $vyresil;\n\n return $this;\n }",
"public function __construct()\n {\n Mage_Core_Block_Template::__construct();\n $this->setTemplate('sam_layerednavigation/catalog/layer/filter.phtml');\n\n $this->_filterModelName = 'catalog/layer_filter_price';\n }",
"public function setFilter($arrFilter);",
"public function filter($filter)\n {\n }",
"public function setFilter($filter)\n {\n $filters = array();\n parse_str($filter, $filters);\n foreach ($filters as $key => $val) {\n $this->addFilter($key, $val);\n }\n \n return $this;\n }",
"public function filter($filter)\n {\n $this->data['filter'] = $filter;\n\n return $this;\n }",
"public function setFilter(Zend_Filter_Interface $filter)\n\t{\n\t\tself::$_filter = $filter;\n\t\treturn $this;\n\t}",
"public function setVilletierce(string $villetierce)\n {\n $this->villetierce = $villetierce;\n\n return $this;\n }",
"public function setFilter($filter)\n {\n if (is_array($filter)) {\n $filter = new Filter($filter);\n }\n\n if ($filter instanceof Filter) {\n $this->filter = $filter;\n\n return $this;\n }\n\n throw new InvalidArgumentException('The filter must be an instance of '.Filter::class.' or a keyed array');\n }",
"public function setVirkning(?\\Digitaliseringskataloget\\Sagdok3_0_0\\Virkning $virkning = null)\n {\n $this->virkning = $virkning;\n return $this;\n }",
"public function attachFilter($name = '', $filter) {\n $this->filters[$name] = new $filter;\n }",
"public final function setFilter($filter, $param = null)\n {\n $this->filter = $filter;\n\n if (isset($param) && is_array($param));\n $this->param = $param;\n\n return $this;\n }",
"protected function setFilter(callable $filter)\n {\n $this->filter = $filter;\n\n return $this;\n }",
"function rs_duotonefilters_init(){\n\n\tnew RsDuotoneFiltersBase();\n\t\n}"
]
| [
"0.6256199",
"0.6116941",
"0.60776716",
"0.6061939",
"0.5935819",
"0.59337145",
"0.589211",
"0.5759268",
"0.569589",
"0.5630974",
"0.5625592",
"0.5606651",
"0.55725634",
"0.5515273",
"0.5496747",
"0.5495308",
"0.54719603",
"0.547118",
"0.5464948",
"0.5416283",
"0.538264",
"0.5375642",
"0.53720003",
"0.5358083",
"0.5278262",
"0.52370864",
"0.5232144",
"0.5183938",
"0.517926",
"0.5175306"
]
| 0.7448768 | 0 |
Sets a new registreringFraFilter | public function setRegistreringFraFilter(?\Digitaliseringskataloget\Sagdok3_0_0\RegistreringFraFilter $registreringFraFilter = null)
{
$this->registreringFraFilter = $registreringFraFilter;
return $this;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function setFilter($filter){ }",
"function setFilter($filter) {\n\t\t$this->_filter = $filter;\n\t}",
"public function registerFilter(Chainr_Filter $filter) {\n\t\t$this->filterChain->register($filter);\n\t}",
"public function setFilter(string $filter);",
"public function setRegistreringTilFilter(?\\Digitaliseringskataloget\\Sagdok3_0_0\\RegistreringTilFilter $registreringTilFilter = null)\n {\n $this->registreringTilFilter = $registreringTilFilter;\n return $this;\n }",
"public function setVirkningFraFilter(?\\Digitaliseringskataloget\\Sagdok3_0_0\\VirkningFraFilter $virkningFraFilter = null)\n {\n $this->virkningFraFilter = $virkningFraFilter;\n return $this;\n }",
"public function setFilter($filter) : self\n {\n $this->initialized['filter'] = true;\n $this->filter = $filter;\n return $this;\n }",
"public function setFilter(Zend_Filter_Interface $filter)\n\t{\n\t\tself::$_filter = $filter;\n\t\treturn $this;\n\t}",
"public function register_filters() {\n\n\t\t}",
"protected function setFilter(callable $filter)\n {\n $this->filter = $filter;\n\n return $this;\n }",
"public function setFilter($arrFilter);",
"public function addFilter(callable $filter);",
"public function setFilter($filter)\n {\n $filters = array();\n parse_str($filter, $filters);\n foreach ($filters as $key => $val) {\n $this->addFilter($key, $val);\n }\n \n return $this;\n }",
"public function setFilter(\\FilterIterator $filter)\n\t{\n\t\t$this->filter = $filter;\n\t}",
"public function setFilter($filter)\n {\n $this->filter = $filter;\n\n return $this;\n }",
"public function setFilter(Elastica_Filter_Abstract $filter)\n {\n return $this->_setFacetParam('filter', $filter->toArray());\n }",
"public function setAdditionalFilter($dataProvider, $filter);",
"public function registerFilter(FilterInterface $filter)\n {\n array_unshift($this->filters, $filter);\n\n return $this;\n }",
"private function setFilter()\n\t{\n\t\t// get filter values\n\t\t$this->filter['language'] = ($this->getParameter('language', 'array') != '') ? $this->getParameter('language', 'array') : BL::getWorkingLanguage();\n\t\t$this->filter['application'] = $this->getParameter('application');\n\t\t$this->filter['module'] = $this->getParameter('module');\n\t\t$this->filter['type'] = $this->getParameter('type', 'array');\n\t\t$this->filter['name'] = $this->getParameter('name');\n\t\t$this->filter['value'] = $this->getParameter('value');\n\n\t\t// build query for filter\n\t\t$this->filterQuery = BackendLocaleModel::buildURLQueryByFilter($this->filter);\n\t}",
"public function setFilter(Elastica_Filter_Abstract $filter)\n {\n return $this->_setFacetParam('facet_filter', $filter->toArray());\n }",
"public function addFilter(DFilter $filter) {\n\t\t$this->filters[] = $filter;\n\t}",
"public function setFilterField($filterField)\n {\n $this->addFilterField($filterField);\n }",
"function acf_set_filters($filters = array())\n{\n}",
"public function addFilter($filter) {\n $this->filters[] = $filter;\n $this->rewind();\n }",
"private function setFilter()\n {\n $this->filter['value'] = $this->getParameter('value') == null ? '' : $this->getParameter('value');\n }",
"public function addFilterFactory(FilterFactoryInterface $filterFactory)\n {\n $this->factories[] = $filterFactory;\n }",
"public function register()\n {\n Filter::register();\n }",
"function setFilter($f) {\n\t\tif (!is_subclass_of($f, \"\\Library\\Database\\LinqEquality\")) {\n\t\t\tthrow new DBException(\"Must be a LINQ Equality\");\n\t\t} else {\n\t\t\t$f->setName(trim($this->getTable(),\"`\"));\n\t\t\t$this->filter = $f;\n\t\t}\n\t\treturn $this;\n\t}",
"public function setFilter($filter)\n {\n $validFilters = self::NO_FILTER |\n self::FILTER_NONE | self::FILTER_SUB |\n self::FILTER_UP | self::FILTER_AVG |\n self::FILTER_PAETH | self::ALL_FILTERS;\n\n $filter = $filter & $validFilters;\n\n $this->filter = (integer) $filter;\n\n return $this;\n }",
"public function createFilter();"
]
| [
"0.6486333",
"0.63432646",
"0.62681276",
"0.6203279",
"0.6089539",
"0.60690427",
"0.60614246",
"0.5913182",
"0.5911716",
"0.5909922",
"0.5908412",
"0.5737506",
"0.5717446",
"0.5690971",
"0.5674141",
"0.5672395",
"0.5654998",
"0.56489885",
"0.5648545",
"0.5613346",
"0.56019604",
"0.5594742",
"0.5589537",
"0.556729",
"0.55440706",
"0.55109453",
"0.54770374",
"0.5476894",
"0.5476124",
"0.54638827"
]
| 0.69844073 | 0 |
Sets a new registreringTilFilter | public function setRegistreringTilFilter(?\Digitaliseringskataloget\Sagdok3_0_0\RegistreringTilFilter $registreringTilFilter = null)
{
$this->registreringTilFilter = $registreringTilFilter;
return $this;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function setFilter($filter){ }",
"public function setFilter(string $filter);",
"function setFilter($filter) {\n\t\t$this->_filter = $filter;\n\t}",
"public function setVirkningTilFilter(?\\Digitaliseringskataloget\\Sagdok3_0_0\\VirkningTilFilter $virkningTilFilter = null)\n {\n $this->virkningTilFilter = $virkningTilFilter;\n return $this;\n }",
"public function setDataFilter($filter)\n {\n // TODO: improve logging when we finally have a central Tesseract debugging workflow\n if (TYPO3_DLOG) {\n t3lib_div::devLog('Data filters are currently not supported!', 'tagpackprovider', 2);\n }\n }",
"public function setFilter($arrFilter);",
"public function setFilter($filter) : self\n {\n $this->initialized['filter'] = true;\n $this->filter = $filter;\n return $this;\n }",
"public function setFilter(\\FilterIterator $filter)\n\t{\n\t\t$this->filter = $filter;\n\t}",
"public function setAdditionalFilter($dataProvider, $filter);",
"public function registerFilter(Chainr_Filter $filter) {\n\t\t$this->filterChain->register($filter);\n\t}",
"public function setFilter(Zend_Filter_Interface $filter)\n\t{\n\t\tself::$_filter = $filter;\n\t\treturn $this;\n\t}",
"public function setFilter($filter)\n {\n $filters = array();\n parse_str($filter, $filters);\n foreach ($filters as $key => $val) {\n $this->addFilter($key, $val);\n }\n \n return $this;\n }",
"public function attachFilter($name = '', $filter) {\n $this->filters[$name] = new $filter;\n }",
"public function setFilter(BaseOperator $filter)\n {\n $this->filter = $filter;\n }",
"public function setFilter($filter)\n {\n $this->filter = $filter;\n\n return $this;\n }",
"public function filter($filter)\n {\n }",
"protected function setFilter(array $filter) {\n $this->filter = array_flip($filter);\n }",
"protected function setFilter(callable $filter)\n {\n $this->filter = $filter;\n\n return $this;\n }",
"public function register_filters() {\n\n\t\t}",
"public function setImageFilter($filter)\n {\n $this->imageFilter = $filter;\n return $this;\n }",
"public function __construct(\\Shield\\Filter $filter)\n {\n $this->filter = $filter;\n $this->load();\n }",
"public final function setFilter($filter, $param = null)\n {\n $this->filter = $filter;\n\n if (isset($param) && is_array($param));\n $this->param = $param;\n\n return $this;\n }",
"public function setFilter(Elastica_Filter_Abstract $filter)\n {\n return $this->_setFacetParam('filter', $filter->toArray());\n }",
"public function setFilterField($filterField)\n {\n $this->addFilterField($filterField);\n }",
"public function setFilter($filter)\n {\n $validFilters = self::NO_FILTER |\n self::FILTER_NONE | self::FILTER_SUB |\n self::FILTER_UP | self::FILTER_AVG |\n self::FILTER_PAETH | self::ALL_FILTERS;\n\n $filter = $filter & $validFilters;\n\n $this->filter = (integer) $filter;\n\n return $this;\n }",
"public function addFilter(callable $filter);",
"public function setFilter(bool $filter): AssetInterface\n {\n }",
"public function setFilter($filter)\n {\n if (is_array($filter)) {\n $filter = new Filter($filter);\n }\n\n if ($filter instanceof Filter) {\n $this->filter = $filter;\n\n return $this;\n }\n\n throw new InvalidArgumentException('The filter must be an instance of '.Filter::class.' or a keyed array');\n }",
"private function setFilter()\n\t{\n\t\t// get filter values\n\t\t$this->filter['language'] = ($this->getParameter('language', 'array') != '') ? $this->getParameter('language', 'array') : BL::getWorkingLanguage();\n\t\t$this->filter['application'] = $this->getParameter('application');\n\t\t$this->filter['module'] = $this->getParameter('module');\n\t\t$this->filter['type'] = $this->getParameter('type', 'array');\n\t\t$this->filter['name'] = $this->getParameter('name');\n\t\t$this->filter['value'] = $this->getParameter('value');\n\n\t\t// build query for filter\n\t\t$this->filterQuery = BackendLocaleModel::buildURLQueryByFilter($this->filter);\n\t}",
"protected function setFilter($aFilter)\n {\n // Set filter stuff from configuration.\n if (true === isset($aFilter['Directory'])) {\n foreach ($aFilter['Directory'] as $sDirectory) {\n $this->oObjectFilter->addDirectoryToFilter($sDirectory);\n }\n }\n\n if (true === isset($aFilter['Files'])) {\n foreach ($aFilter['Files'] as $sFile) {\n $this->oObjectFilter->addFileToFilter($sFile);\n }\n }\n\n if (true === isset($aFilter['WhiteListDirectories'])) {\n foreach ($aFilter['WhiteListDirectories'] as $sDirectory) {\n $this->oObjectFilter->addDirectoryToWhiteList($sDirectory);\n }\n }\n\n if (true === isset($aFilter['WhiteListFiles'])) {\n foreach ($aFilter['WhiteListFiles'] as $sFile) {\n $this->oObjectFilter->addFileToWhiteList($sFile);\n }\n }\n }"
]
| [
"0.7077936",
"0.68532735",
"0.68118304",
"0.67019135",
"0.65534437",
"0.63818544",
"0.6334924",
"0.624136",
"0.61934924",
"0.61549014",
"0.60904306",
"0.6050619",
"0.6007504",
"0.600214",
"0.5954915",
"0.59159064",
"0.58857167",
"0.5855579",
"0.5853472",
"0.58460265",
"0.58417493",
"0.58180755",
"0.58040535",
"0.58032644",
"0.5801613",
"0.57886034",
"0.57706",
"0.57663566",
"0.57646495",
"0.5728082"
]
| 0.7234813 | 0 |
/ End of file common_helper.php / Location: ./appplication/helpers/array_helper.php Element Send push notifications to android & iphone devices Get the users device Id with the device type | function send_notification($msg, $users) {
$android_user = array();
$ios_user = array();
foreach ($users as $user) {
if ($user['DeviceType'] == 'A') {
$android_user[] = $user['DeviceId'];
}
if ($user['DeviceType'] == 'I') {
$ios_user[] = $user['DeviceId'];
}
}
if (!empty($android_user)) {
//Android connection
$url = 'https://android.googleapis.com/gcm/send';
$headers = array(
'Authorization:key=' . GOOGLE_API_KEY,
'Content-Type: application/json'
);
//End
$message = array("title" => $msg);
// Set POST variables
$fields = array(
'registration_ids' => $android_user,
'data' => $message,
);
// Open connection
$ch = curl_init();
// Set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Disabling SSL Certificate support temporarly
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
// Execute post
curl_exec($ch);
// Close connection
curl_close($ch);
//echo $result;
}
// Push Notification for IOS
if (!empty($ios_user)) {
foreach ($ios_user as $deviceToken) {
////////////////////////////////////////////////////////////////////////////////
$ctx = stream_context_create();
stream_context_set_option($ctx, 'ssl', 'local_cert', PEM_CERTIFICATE);
stream_context_set_option($ctx, 'ssl', 'passphrase', PASSPHRASE);
// Open a connection to the APNS server
$fp = stream_socket_client(
'ssl://gateway.sandbox.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT, $ctx);
if (!$fp)
exit("Failed to connect: $err $errstr" . PHP_EOL);
// Create the payload body
$body['aps'] = array(
'alert' => $msg,
'sound' => 'default'
);
// Encode the payload as JSON
$payload = json_encode($body);
// Build the binary notification
$msg = chr(0) . pack('n', 32) . pack('H*', $deviceToken) . pack('n', strlen($payload)) . $payload;
// Send it to the server
$result = fwrite($fp, $msg, strlen($msg));
// if (!$result)
// echo 'Message not delivered' . PHP_EOL;
// else
// echo 'Message successfully delivered' . PHP_EOL;
// Close the connection to the server
fclose($fp);
}
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function sendPushNotificationToAndroid($registatoin_ids , $message , $type)\n {\n\t\n\t$messages = array(\"data\" => $message);\n //$fields = array('registration_ids' => $registatoin_ids, 'data' => $messages, 'type' => $type);\n\t$fields = array('registration_ids' =>$registatoin_ids , 'data' => $messages, 'type' => $type);\n /**\n * @desc : type 1 = driver\n * type 2 = passenger\n */\n\t/* pushY API Key For Live Server */\n $key = 'cd79e72b381c3a879c62ea027b4e96c29e6517b5d9073ae941b576b6ac044f45' ;\n\t$url = 'https://api.pushy.me/push?api_key=' . $key;\n //echo $key ;\n \n\t$headers = array(\n\t 'Authorization: key=' . $key,\n 'Content-Type: application/json',\n );\n // Open connection\n $ch = curl_init();\n\t// Set the url, number of POST vars, POST data\n curl_setopt($ch, CURLOPT_URL, $url);\n curl_setopt($ch, CURLOPT_POST, true);\n curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n // Disabling SSL Certificate support temporarly\n curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);\n\tcurl_setopt($ch, CURLOPT_SSLVERSION , 1);\n curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));\n // Execute post\n $result = curl_exec($ch);\n\n\tif ($result === FALSE) {\n die('Curl failed: ' . curl_error($ch));\n }\n\t// Close connection\n curl_close($ch);\n //echo $result;\n\t$res = json_decode($result,true);\n\tif($res[\"success\"] == '1'){\n return true;\n } else {\n return false ;\n }\n }",
"function publish_pushNotification($mobile,$message){\n\t\t\n\t\t$qry\t=\t\"select *from optra_app_install_device\"; // Device Id's to be captured \n\t\t$res\t=\t$this->db->query($qry);\n\t\tif($res->result()){\n\t\t\n\t\t\tforeach($res->result() as $row){\n\t\t\t\t\n\t\t\t\t$data[]\t=\t$row->device_id;\n\t\t\t}\n\t\t}\n\t\t\n\t\ttry{\n\t\t\t$url = 'https://fcm.googleapis.com/fcm/send';\n\t\t\t/* $id = \"f6O5mIH3VME:APA91bEl0XbPgyCyr6mlYyEuKdPSR-Vry7wKr8ZverY0GSNMh2ga0ouzqYSOwhvnzruZib8dcLZvyAgmcAzYiAUa-V9l-To7XKLP56HENWYnDpgBoJoeLsHdCQ7q-wyW3xDzFOaaBEuM\";\n\t\t\t$id1 = \"c04kKXckLJI:APA91bE7TsLzB8ySAUMBsAEgtZVGlYYeqCxVGKukCsiM_a2lFEcDCR9Dj4_b-yB41sns4IkjdY-1J90cAir15zVPp6WG907gTDSqF9fwoQoDJT2LL9e-9LCvJj2iipiCuuUAcDYykDHJ\";\n\t\t\t$id2 = \"fzABBjmH63M:APA91bHTAmSI762EiZlSvrcZHa4Zbp5zke6ognv5sQBi9eSFzzdrd2vNIu79--AlA7KCO90dTxnJndbPzIWJUDpt4vCGu1lBsk16CcDqQtkdkuiq1dk703bsF1lmREwNiczTrdTbynL1\";\n\t\t\t$id3 = \"d_2TUv-VKwc:APA91bGXHt3umB7nkaiIrpEz-aeU151Q4asbadzcOwvBqZ9tkSd5qld4t0dOkOzXkJU5vSFNzgJ5jlbMNokPC4Kdpk3mX8WZOFFvDFyhXTQMo5UipOVB0QvWynVw0kkRtZ_r1OfOcDE1\";\n\t\t\t$id4 = \"eNxiF6NW0rI:APA91bHOdDuG6TEccpHqqkR69ACTJ7QwoHD3l8s2gDfY9u8OryrBmqcsxOXmTGN8S5ibIodDXzSHmwbeRkLkUU1phqwmZhqeLJCg_Shni8R9yR4qiPOfUWQ0uO9kkiYwtUnQLnsM9_5b\";\n\t\t\t$id5 = \"dxUqldK1jw0:APA91bHXrR7sgZnRhn5mB-BVamUp-gylChAODOf6mAQFIxNayjqGwUpiI2EvGPumYpyqUnd0rlyuZ8qfiZ2lYsSOHhhOnZfnfWxnfVaOOSMvhBXZHbbz9KpDSA6sdcoTvnlmI1UKNynz\";\n\t\t\t$id6 = \"eQZ6Di6fTyM:APA91bEbPGro33m5RsFXVyc4eVIqOwIre4LyHbf17BYKtMKrnrY_j3z8Ib3JBuM3z-HDc1-jRTEy_KGJxHuqa-R0VHcsRnC-QUR5ocJaR9ByRMGtCqaNa0C_JNxsj_66vwvuMCOAZc_5\"; */\n\t\t\t\n\t\t\t$fields = array(\n\t\t\t\t'registration_ids' => array(\"f6O5mIH3VME:APA91bEl0XbPgyCyr6mlYyEuKdPSR-Vry7wKr8ZverY0GSNMh2ga0ouzqYSOwhvnzruZib8dcLZvyAgmcAzYiAUa-V9l-To7XKLP56HENWYnDpgBoJoeLsHdCQ7q-wyW3xDzFOaaBEuM\"),\n\t\t\t\t'data' => array(\"body\"=>$message)\n\t\t\t);\n\t\t\t\n\t\t\t$headers = array(\n\t\t\t\t'Authorization: key=' . \"API KEY\", // API Key will be present in the console fcm. \n\t\t\t\t'Content-Type: application/json'\n\t\t\t);\n\t\t\tforeach($data as $key=>$v1){\n\t\t\t\n\t\t\t\t$fields = array (\n\t\t\t\t\t'to' => $v1,\n\t\t\t\t\t'notification' => array (\n\t\t\t\t\t\t\"body\" => $message, // Custom Message, Festival Wishes.\n\t\t\t\t\t\t\"title\" => \"Hi All\", // Title can be given based on Events ex: Happy Holi\n\t\t\t\t\t\t\"icon\" => \"myicon\" // your website fav icon\n\t\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t//Initializing curl to open a connection\n\t\t\t$ch = curl_init();\n \n\t\t\t//Setting the curl url\n\t\t\tcurl_setopt($ch, CURLOPT_URL, $url);\n\t\t\t\n\t\t\t//setting the method as post\n\t\t\tcurl_setopt($ch, CURLOPT_POST, true);\n\t \n\t\t\t//adding headers \n\t\t\tcurl_setopt($ch, CURLOPT_HTTPHEADER, $headers);\n\t\t\n\t\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n\t \n\t\t\t//disabling ssl support\n\t\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);\n\t\t\t\n\t\t\t\n\t\t\t//adding the fields in json format \n\t\t\tcurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));\n \n\t\t\t//finally executing the curl request \n\t\t\t$result = curl_exec($ch);\n\t\t\techo $result.\"<br/>\";\n\t\t\t\n\t\t\tif ($result === FALSE) {\n\t\t\t\t\n\t\t\t\techo 'Curl failed: ' . curl_error($ch);\n\t\t\t\t\n\t\t\t}\n \n\t\t\t//Now close the connection\n\t\t\tcurl_close($ch);\n\t\t\t}\n\t\t}catch (Exception $e) {\n\t\t\t\n\t\t\techo $e->getMessage();\n\t\t}\n\t}",
"function AndroidNotification($deviceToken,$message,$title,$userid,$type,$notificationid='',$appointmentid=''){\n\n $CI = & get_instance();\n if($deviceToken != '' && $deviceToken != NULL) { \n $CI->push->setTitle($title);\n $CI->push->setMessage($message); \n \n $CI->push->setIsBackground(FALSE);\n $CI->push->setPayload(array('userid' => $userid,'type'=>$type,'notificationid' => $notificationid,'appointmentid'=>$appointmentid));\n $json = $CI->push->getPush();\n $regId = isset($deviceToken) ? $deviceToken : '';\n $response = $CI->firebase->send($regId, $json);\n \n return $response;\n } \n //return false;\n}",
"protected function _sendPush($senderId, $recEntityArr, $message, $notifType, $sname, $datetime, $user_type, $aplContent, $andrContent, $user_device = NULL) {\n\n $entity_string = '';\n $aplTokenArr = array();\n $andiTokenArr = array();\n $return_arr = array();\n\n $notifications = $this->mongo->selectCollection('notifications');\n\n foreach ($recEntityArr as $entity) {\n\n $entity_string = $entity . ',';\n }\n\n $entity_comma = rtrim($entity_string, ',');\n//echo '--'.$entity_comma.'--';\n\n $device_check = '';\n if ($user_device != NULL)\n $device_check = \" and device = '\" . $user_device . \"'\";\n\n $getUserDevTypeQry = \"select distinct type,push_token from user_sessions where oid in (\" . $entity_comma . \") and loggedIn = '1' and user_type = '\" . $user_type . \"' and LENGTH(push_token) > 63\" . $device_check;\n $getUserDevTypeRes = mysql_query($getUserDevTypeQry, $this->db->conn);\n\n if (mysql_num_rows($getUserDevTypeRes) > 0) {\n\n while ($tokenArr = mysql_fetch_assoc($getUserDevTypeRes)) {\n\n if ($tokenArr['type'] == 1)\n $aplTokenArr[] = $tokenArr['push_token'];\n else if ($tokenArr['type'] == 2)\n $andiTokenArr[] = $tokenArr['push_token'];\n }\n\n $aplTokenArr = array_values(array_filter(array_unique($aplTokenArr)));\n $andiTokenArr = array_values(array_filter(array_unique($andiTokenArr)));\n// print_r($andiTokenArr);\n if (count($aplTokenArr) > 0)\n $aplResponse = $this->_sendApplePush($aplTokenArr, $aplContent, $user_type);\n\n if (count($andiTokenArr) > 0)\n $andiResponse = $this->_sendAndroidPush($andiTokenArr, $andrContent, $user_type);\n\n foreach ($recEntityArr as $entity) {\n\n $ins_arr = array('notif_type' => (int) $notifType, 'sender' => (int) $senderId, 'reciever' => (int) $entity, 'message' => $message, 'notif_dt' => $datetime, 'apl' => $aplTokenArr, 'andr' => $andiTokenArr); //'aplTokens' => $aplTokenArr, 'andiTokens' => $andiTokenArr, 'andiRes' => $andiResponse, \n\n $notifications->insert($ins_arr);\n\n $newDocID = $ins_arr['_id'];\n\n $return_arr[] = array($entity => $newDocID);\n }\n\n $return_arr[] = $aplResponse;\n $return_arr[] = $aplTokenArr;\n $return_arr[] = $recEntityArr;\n\n if ($aplResponse['errorNo'] != '')\n $errNum = $aplResponse['errorNo'];\n else if ($andiResponse['errorNo'] != '')\n $errNum = $andiResponse['errorNo'];\n else\n $errNum = 46;\n\n return array('insEnt' => $return_arr, 'errNum' => $errNum, 'andiRes' => $andiResponse);\n } else {\n return array('insEnt' => $return_arr, 'errNum' => 45, 'andiRes' => $andiResponse); //means push not sent\n }\n }",
"public function sendNotification($gcm_key,$title,$message,$mobiletype)\n\t{\n\n\t\tif ($mobiletype =='1'){\n\n\t\t require_once 'assets/notification/Firebase.php';\n require_once 'assets/notification/Push.php';\n\n $device_token = explode(\",\", $gcm_key);\n $push = null;\n\n //first check if the push has an image with it\n\t\t $push = new Push(\n\t\t\t\t\t$title,\n\t\t\t\t\t$message,\n\t\t\t\t\tnull\n\t\t\t\t);\n\n// \t\t\t//if the push don't have an image give null in place of image\n// \t\t\t $push = new Push(\n// \t\t\t \t\t'HEYLA',\n// \t\t \t\t'Hi Testing from maran',\n// \t\t\t \t\t'http://heylaapp.com/assets/notification/images/event.png'\n// \t\t\t \t);\n\n \t\t//getting the push from push object\n \t\t$mPushNotification = $push->getPush();\n\n \t\t//creating firebase class object\n \t\t$firebase = new Firebase();\n\n \tforeach($device_token as $token) {\n \t\t $firebase->send(array($token),$mPushNotification);\n \t}\n\n\t\t} else {\n\n\t\t\t$device_token = explode(\",\", $gcm_key);\n\t\t\t$passphrase = 'hs123';\n\t\t $loction ='assets/notification/happysanz.pem';\n\n\t\t\t$ctx = stream_context_create();\n\t\t\tstream_context_set_option($ctx, 'ssl', 'local_cert', $loction);\n\t\t\tstream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase);\n\n\t\t\t// Open a connection to the APNS server\n\t\t\t$fp = stream_socket_client('ssl://gateway.sandbox.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx);\n\n\t\t\tif (!$fp)\n\t\t\t\texit(\"Failed to connect: $err $errstr\" . PHP_EOL);\n\n\t\t\t$body['aps'] = array(\n\t\t\t\t'alert' => array(\n\t\t\t\t\t'body' => $message,\n\t\t\t\t\t'action-loc-key' => 'EDU App',\n\t\t\t\t),\n\t\t\t\t'badge' => 2,\n\t\t\t\t'sound' => 'assets/notification/oven.caf',\n\t\t\t\t);\n\t\t\t$payload = json_encode($body);\n\n\t\t\tforeach($device_token as $token) {\n\n\t\t\t\t// Build the binary notification\n \t\t\t$msg = chr(0) . pack(\"n\", 32) . pack(\"H*\", str_replace(\" \", \"\", $token)) . pack(\"n\", strlen($payload)) . $payload;\n \t\t$result = fwrite($fp, $msg, strlen($msg));\n\t\t\t}\n\n\t\t\t\tfclose($fp);\n\t\t}\n\n\t}",
"public function actionpushNotificationToIos($alert,$type,$survey_id) {\n $type = \"notified\";\n $sql = \"SELECT device_token FROM users where device_type = 2 and device_token != ''\";\n $deviceTokendata = $this->getAllData($sql);\n $badge_count = 0;\n\n foreach ($deviceTokendata as $key => $value) {\n $deviceToken[] = $value['device_token'];\n }\n\n\tforeach ($deviceToken as $key => $val) {\n $notis = $this->sendPushNotificationToIos($val,$alert,$type,$survey_id);\n }\n if ($notis) {\n $response = array('status' => '1', 'data' => array('message' => 'Notification send successfully'));\n } else {\n $response = array('status' => '0', 'data' => array('message' => 'Notification sending fail'));\n }\n return $response;\n }",
"function iosnoti( $registrationIdsArray, $messageData ){\n\n\t// ID del dispositivo, similar al gcm de google\n\t\t$deviceToken = $registrationIdsArray;\n\t\t// Clave de la llave con la que se genero la aplicacion\n\t\t$passphrase = 'inicio1*';\n\t\t// Mensaje\n\t\t$message = $messageData;\n\t\t////////////////////////////////////////////////////////////////////////////////\n\t\t$ctx = stream_context_create();\n\t\tstream_context_set_option($ctx, 'ssl', 'local_cert', 'JuntosSomosMas_dev.pem');\n\t\tstream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase);\n\t\t\n\t\t// Open a connection to the APNS server\n\t\t$fp = stream_socket_client(\n\t\t\t'ssl://gateway.sandbox.push.apple.com:2195', $err,\n\t\t\t$errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx);\n\t\t\n\t\tif (!$fp) { exit(\"Failed to connect: $err $errstr\" . PHP_EOL);\t}\n\t\t//echo 'Connected to APNS' . PHP_EOL;\n\t\t\n\t\t// Create the payload body\n\t\t$body['aps'] = array(\n\t\t\t'alert' => $message,\n\t\t\t'sound' => 'default'\n\t\t\t);\n\t\t\n\t\t// Encode the payload as JSON\n\t\t$payload = json_encode($body);\n\t\t\n\t\t// Build the binary notification\n\t\t$msg = chr(0) . pack('n', 32) . pack('H*', $deviceToken) . pack('n', strlen($payload)) . $payload;\n\t\t\n\t\t// Send it to the server\n\t\t$result = fwrite($fp, $msg, strlen($msg));\n\t\t\n\t\tif (!$result) {\n\t\t\t//echo 'Message not delivered' . PHP_EOL;\n\t\t}else{\n\t\t\t//echo 'Message successfully delivered' . PHP_EOL;\n\t\t}\n\t\t// Close the connection to the server\n\t\tfclose($fp);\n}",
"function guid($param = '') {\r\n\t\t$result['state'] = '000';\r\n\t\t$type = $this->input->post('type');\r\n\t\t$idt = trim($this->input->post('idt'));\r\n\t\t\r\n\t\tif ($type and $idt) {\r\n\t\t\t$idt = trim($idt);\r\n\t\t\t$idt = str_replace(' ', '', $idt);\r\n\t\t\t$idt = trim(substr($idt, 1, strlen($idt) - 2));\r\n\t\t\t$this->db->where('devicetoken', $idt);\r\n\t\t\t$this->db->from('apns_devices');\r\n\t\t\t$n = $this->db->count_all_results();\r\n\t\t\t//$result['sql'] = $this->db->last_query();\r\n\t\t\t$data['type'] = $type;\r\n\t\t\t$data['devicetoken'] = $idt;\r\n\t\t\t$data['type'] = $this->input->post('version');\r\n\t\t\t$data['appversion'] = $this->input->post('appversion');\r\n\t\t\t$data['appname'] = $this->input->post('appname');\r\n\t\t\t$data['devicename'] = $this->input->post('devicename');\r\n\t\t\t$data['pushalert'] = $this->input->post('pushalert');\r\n\t\t\t$data['pushsound'] = $this->input->post('pushsound');\r\n\t\t\t$data['status'] = $this->input->post('status');\r\n\t\t\t$data['uid'] = $this->uid;\r\n $result['dd'] = $data;\r\n\t\t\tif ($n) {\r\n\t\t\t\t$data['modified'] = time();\r\n\t\t\t\t$this->db->where('devicetoken', $idt);\r\n\t\t\t\t$this->db->update('apns_devices', $data);\r\n\t\t\t\t$result['notice'] = '成功更新设备!';\r\n\t\t\t} else {\r\n\t\t\t\t$data['created'] = $data['modified'] = time();\r\n\t\t\t\t$this->db->insert('apns_devices', $data);\r\n\t\t\t\t$result['notice'] = '成功记录设备!';\r\n\t\t\t}\r\n\t\t\t\r\n\t\t} else {\r\n\t\t\t$result['notice'] = '参数不全';\r\n\t\t\t$result['state'] = '012';\r\n\t\t}\r\n\t\techo json_encode($result);\r\n\t}",
"function push_notification($operation, $message, $sender_id, $receiver_id, $receiver_role, $sender_role, $item_id){\n\n $data = array(\n \"operation\" => $operation,\n \"message\" => $message,\n \"sender_id\" => $sender_id,\n \"sender_role\" => $sender_role,\n \"receiver_id\" => $receiver_id,\n \"receiver_role\" => $receiver_role,\n \"is_read\" => 0,\n \"created_at\" => date(\"Y-m-d h:i:s\"),\n \"updated_at\" => date(\"Y-m-d h:i:s\"),\n \"item_id\" => $item_id\n );\n\n $insert = $this->db->insert(\"notifications\", $data);\n\n\n if($insert){\n\n $user_tokens = $this->db->get_where(\"fcm_tokens\", array(\"user_id\" => $receiver_id))->result_array();\n $tokens = array_map(function($a) {\n return $a['token'];\n }, $user_tokens);\n\n\n define( 'API_ACCESS_KEY', 'AAAA9i7n8oQ:APA91bHmZPnhn6BQwUGu_Fm9tGptYA0ISIv9QP30iKVhMS4tlAxl3E3KMdsJhUCpchu3AaSQh41G-ln7IZ7yj7cN9qV9f3Cz0aD2JtlayuOhzPBcAES2mtq0sFbddwNCKh7i0Xd4LGRU' );\n /*Data object for android foreground and background / ios forground / Fields can be modified as per requirements*/\n $msg = array('title' => \"Aqualogy\",'message' => $data['message'], 'operation' => $data['operation'], 'content_id'=>$data['item_id'], \"notificationsentfrom\" => \"serverside\");\n /*Notification object for ios background / Fields except body can be modified as per requirements*/\n $notification = array('title' => \"Aqualogy\",'body' =>$data['message'],\"sound\" =>\"default\");\n /*Notification Payload*/\n $fields = array('registration_ids' => $tokens,'notification'=> $notification,'data'=> $msg,'content_available' => true);\n $headers = array('Authorization: key=' . API_ACCESS_KEY,'Content-Type: application/json');\n $ch = curl_init();\n\n curl_setopt( $ch,CURLOPT_URL, 'https://fcm.googleapis.com/fcm/send' );\n curl_setopt( $ch,CURLOPT_POST, true );\n curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers );\n curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true );\n curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, false );\n curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $fields ) );\n $result = curl_exec($ch);\n\n curl_close( $ch );\n\n }\n \n\n }",
"public function pushnotify()\n { \n $url = 'https://gcm-http.googleapis.com/gcm/send';\n\n //$appId = 'AIzaSyDNSkIhP_L_0j6X4yNiJaJJKPduAz6H7mU';\n $appId = \"AIzaSyCsP0g5eT8-FHGWb8fWfQyNALURHJO1G2Q\";\n //$device_token=\"ekV4K55W4wg:APA91bF_MQzi73GipT5Gvh8ngwvqihEfY4CwoL_uoqI4W7jwUfkTh6HSF2V85kXNaF_x36G7-RgUxJMGf_J52qVnPfiqxc91Z2IgC6Tj1HyRZ5YeCvW1IzTrcMGhocccyldsrD7YzMZC\";\n //$device_token=\"d44YB9X1G4g:APA91bH6rBmMmEE5vcccKg5d3EYJNz0rs8fN6vi3ZDBz6saFqBMXtiNxF9Cdx05wDQ7TEHP5M2rOwOolk84XBRo6rTgVmiZijK5noGnHOPh6pyy54kBnbv0UWprKTpt9VcP0XP0HSTMd\";\n $device_token=\"dtAUirYeZxg:APA91bEuVNrZTSkVsVDZ7QGHC9ol3d4SFrCK1m2x6WGYmzqnRm0Z5Vxl3c4i_9DXoi0gGGGz3bRaS0agT18IotJ1X4ZtjrbmRPWvkluwryWoL3foGh75Rfu3sJGKxZRZvMHBFnaEfIwn\";\n $push_payload = json_encode(array(\n \"data\" => array(\n \"message\" => \"testing intent from mike\",\n ),\n \"to\" => $device_token\n ));\n\n $rest = curl_init();\n curl_setopt($rest,CURLOPT_URL,$url);\n curl_setopt($rest,CURLOPT_PORT,443);\n curl_setopt($rest,CURLOPT_POST,1);\n curl_setopt($rest,CURLOPT_POSTFIELDS,$push_payload);\n curl_setopt($rest,CURLOPT_HTTPHEADER,\n array(\"Authorization:key=\" . $appId,\n \"Content-Type: application/json\"));\n\n $response = curl_exec($rest);\n echo $response;\n }",
"function send_push_notification_location($notification_array, $user_id, $device_token, $store_near = 0) {\n $CI = &get_instance();\n $can_send = TRUE;\n// if($store_near === 0){ \n// if ($this -> session -> userdata('location_notification_send_time')) {\n// $start = date_create($this -> session -> userdata('location_notification_send_time'));\n// $end = date_create(date('Y-m-d H:i:s'));\n// $diff = date_diff($end, $start);\n// if ($diff['h'] >= LOCATION_NOTIFICATION_DELAY) {\n// $can_send = TRUE;\n// }\n// }\n// else {\n// $can_send = TRUE;\n// }\n// }\n// else{\n// if ($this -> session -> userdata('nearby_notification_send_time')) {\n// $start = date_create($this -> session -> userdata('nearby_notification_send_time'));\n// $end = date_create(date('Y-m-d H:i:s'));\n// $diff = date_diff($end, $start);\n// if ($diff['i'] >= NEARBY_NOTIFICATION_DELAY) {\n// $can_send = TRUE;\n// }\n// }\n// else {\n// $can_send = TRUE;\n// }\n// }\n\n\n if ($can_send) {\n if ($store_near === 0) {\n $CI -> session -> set_userdata('location_notification_send_time', date('Y-m-d H:i:s')); //setting the time when the latest notification sent\n }\n else {\n $CI -> session -> set_userdata('nearby_notification_send_time', date('Y-m-d H:i:s')); //setting the time when the latest nearby notification sent\n }\n\n $url = FCM_ANDROID_URL;\n $priority = \"high\";\n $fields = array(\n 'registration_ids' => array($device_token),\n 'data' => $notification_array\n );\n $headers = array(\n 'Authorization:key=AIzaSyBOND37d4v7orU3XkUQBBmQvoWaR5CXf7Q',\n 'Content-Type: application/json'\n );\n $ch = curl_init();\n curl_setopt($ch, CURLOPT_URL, $url);\n curl_setopt($ch, CURLOPT_POST, true);\n curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);\n curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);\n curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));\n $result = curl_exec($ch);\n //echo curl_error($ch);\n if ($result === FALSE) {\n //die('Curl failed: ' . curl_error($ch));\n }\n else {\n remove_nonregistered_device_tokens($result, array($device_token));\n }\n curl_close($ch);\n //echo $result;\n $CI -> notificationmodel -> save_notification_history(json_encode($fields), $result, $user_id);\n }\n}",
"public function sendPushNotification($user_id, $room_name, $call_type, $caller_id)\n {\n try {\n $user = User::findOrFail($user_id);\n if ($user->device_token == null || empty($user->device_token)) {\n return false;\n }\n if ($user->platform == \"ios\") {\n $details = [\n 'room_name' => $room_name,\n 'call_type' => $call_type,\n 'caller_id' => $caller_id,\n 'type' => 'new_call',\n ];\n\n $message = PushNotification::Message(__('messages.send_push_notificatopn_title'), array(\n 'badge' => 0,\n 'sound' => 'example.aiff',\n 'title' => __('messages.send_push_notification_title'),\n 'body' => __('messages.send_push_notification_body'),\n 'actionLocKey' => __('messages.actionLocKey'),\n 'locKey' => __('messages.locKey'),\n 'locArgs' => array(\n __('messages.localized-args'),\n __('messages.localized-args'),\n ),\n 'launchImage' => '',\n 'data' => json_encode($details),\n 'custom' => array('data' => json_encode($details))\n ));\n\n PushNotification::app('YALLATALK_IOS')\n ->to($user->device_token)\n ->send($message);\n } else {\n $optionBuilder = new OptionsBuilder();\n $optionBuilder->setTimeToLive(60*20);\n $notificationBuilder = new PayloadNotificationBuilder(__('messages.send_push_notificatopn_title'));\n $notificationBuilder->setBody(__('messages.send_push_notification_body'))\n ->setSound('default');\n\n $dataBuilder = new PayloadDataBuilder();\n $dataBuilder->addData([\n 'room_name' => $room_name,\n 'call_type' => $call_type,\n 'caller_id' => $caller_id,\n 'type' => 'new_call',\n ]);\n \n $option = $optionBuilder->build();\n $notification = $notificationBuilder->build();\n $data = $dataBuilder->build();\n\n $token = $user->device_token;\n \n $downstreamResponse = FCM::sendTo($token, $option, $notification, $data);\n \n $downstreamResponse->numberSuccess();\n $downstreamResponse->numberFailure();\n $downstreamResponse->numberModification();\n }\n } catch (ModelNotFoundException $ex) {\n return response()\n ->json([\n 'error' => __('messages.no_service_provider_found')\n ]);\n }\n }",
"public function send_push_not() {\n date_default_timezone_set(\"America/New_York\");\n\n $load_number = $this->input->post('load_number');\n\n $this->load->model('driver_model');\n $drivers = $this->driver_model->get($this->input->post('driver_id'));\n $driver = $drivers[0];\n\n $driver_lat = $driver['lat'];\n $driver_lng = $driver['lng'];\n $driver_mail = $driver['email'];\n $apns_number = $driver['apns_number'];\n $app_id = $driver['app_id'];\n\n\n// $registatoin_ids[0] = $this->input->post('status');\n $title = $this->input->post('title');\n $message = $this->input->post('msg');\n $apple_msg = 'Msg load #' . $load_number . '-' . $message;\n $load_id = $this->input->post('load_id');\n $registatoin_ids[0] = $app_id;\n\n if ($apns_number || $app_id) {\n //Apple notification\n if ($apns_number) {\n $result['result'] = $this->send_apple_not($apns_number, $load_number, $apple_msg);\n }\n\n //Android notification\n if ($app_id) {\n $result['result'] = json_decode($this->send_android_not($registatoin_ids, $title, $message));\n }\n } else {\n return $this->output->set_output(json_encode(['status' => 0, 'msg' => 'Apple or Android id not found']));\n }\n\n //Save in database\n $ck = $this->save_callcheck($this->session->userdata('user_id'), $load_id, 1, 0, $message, $driver_lat, $driver_lng, 1, $driver_mail, $load_number, 1);\n $result['dbresult'] = $ck;\n\n// return $this->output->set_output(json_encode($ck));\n return $this->output->set_output(json_encode($result));\n }",
"public function get_push_notification()\n {\n $this->load->library('wsresponse');\n $this->load->library('wschecker');\n $this->wsresponse->setOptionsResponse();\n\n $this->load->model('rest_model');\n $get_arr = is_array($this->input->get(NULL, TRUE)) ? $this->input->get(NULL, TRUE) : array();\n $post_arr = is_array($this->input->post(NULL, TRUE)) ? $this->input->post(NULL, TRUE) : array();\n $post_params = array_merge($get_arr, $post_arr);\n\n try {\n if ($this->config->item('WS_RESPONSE_ENCRYPTION') == \"Y\") {\n $post_params = $this->wschecker->decrypt_params($post_params);\n }\n $verify_res = $this->wschecker->verify_webservice($post_params);\n if ($verify_res['success'] != \"1\") {\n $this->wschecker->show_error_code($verify_res);\n }\n\n $unique_id = $post_params[\"unique_id\"];\n $data = $temp = array();\n if (empty($unique_id)) {\n throw new Exception(\"Please send unique id for this notification\");\n }\n $extra_cond = $this->db->protect(\"mpn.vUniqueId\") . \" = \" . $this->db->escape($unique_id);\n $data_arr = $this->rest_model->getPushNotify($extra_cond);\n\n if (!is_array($data_arr) || count($data_arr) == 0) {\n throw new Exception(\"Data not found for this unique id\");\n }\n $variables = json_decode($data_arr[0]['tVarsJSON'], true);\n if (is_array($variables) && count($variables) > 0) {\n foreach ($variables as $vk => $vv) {\n if ($vv['key'] != \"\") {\n $temp[$vv['key']] = $vv['value'];\n }\n }\n }\n $temp['code'] = $data_arr[0]['eNotifyCode'];\n $temp['title'] = $data_arr[0]['vTitle'];\n $temp['body'] = $data_arr[0]['tMessage'];\n\n $data[0] = $temp;\n $settings_arr['success'] = 1;\n $settings_arr['message'] = \"Push notification data found\";\n } catch (Exception $e) {\n $settings_arr['success'] = 0;\n $settings_arr['message'] = $e->getMessage();\n }\n $responce_arr['settings'] = $settings_arr;\n $responce_arr['data'] = $data;\n $this->wsresponse->sendWSResponse($responce_arr);\n }",
"function create_push_message($product_id = '', $retailer_id = '', $store_type_id = '', $store_id = '', $product_name = '', $retailer_name = '', $store_name = '', $store_type_name = '', $special_count = 0, $special_price = 0, $special_name = '', $success_count = 0, $store_array = array(), $product_array = array(), $store_detail_array = array()) {\n $multiple_insert = [];\n $CI = &get_instance();\n $CI -> load -> model('admin/specialproductmodel');\n\n //Create a general message\n $message = $special_name . ', ';\n if ($success_count > 1) { //if the product count is more than one\n $product_id = '';\n $retailer_id = '';\n $store_type_id = '';\n $store_id = '';\n $message .= $success_count . ' products. From ' . $retailer_name;\n }\n else { //if only one product is addded\n $message .= $product_name . ' from: ' . $retailer_name . ', ' . $store_name . ', ';\n if ($special_count > 1) {\n $message .= $special_price . '(' . $special_count . ')';\n }\n else {\n $message .= $special_price . '.';\n }\n }\n $message .= ' Don\\'t miss it!';\n\n\n $user_ids = $CI -> specialproductmodel -> get_device_user_ids(); //Get the registered device IDs now available in DB\n $users_have_store = [];\n $user_have_price_alert = [];\n $price_change_array = [];\n $price_change_count = [];\n $retailer_special_message = [];\n $retailer_count_arr = [];\n $user_add = [];\n $comp_available_stores = [];\n $product_names = []; // Array to store product names\n $productNameMessage = \"\";\n $store_names = []; // Array to store name of the stores\n $storeNameMessage = \"\";\n\n if (!empty($user_ids)) {//If users available to send the notifications\n foreach ($user_ids as $user_id) {\n \n $comp_available_stores = [];\n if ($user_id['PrefLatitude'] && $user_id['PrefLongitude'] && $user_id['PrefDistance']) {\n $store_det = $CI -> specialproductmodel -> get_device_user_stores($user_id['PrefLatitude'], $user_id['PrefLongitude'], $user_id['PrefDistance'], $store_array, $user_id['state']);\n $store_name = isset($store_det[0]['StoreName']) ? $store_det[0]['StoreName'] : '';\n $store_get_id = isset($store_det[0]['StoreId']) ? $store_det[0]['StoreId'] : '';\n $special_notifications = $CI -> specialproductmodel -> get_special_enabled_user_store();\n $special_user_list = [];\n if ($special_notifications) {\n foreach ($special_notifications as $special_users) {\n $special_user_list[$special_users['UserId']] = array(\n 'StoreId' => $special_users['StoreId'],\n 'Specials' => $special_users['Specials'],\n 'PreferredStoreOnly' => $special_users['PreferredStoreOnly']\n );\n }\n }\n if (!empty($store_det)) {\n foreach ($store_det as $store_de) {\n if (in_array($store_de['Id'], $store_array)) {\n $comp_available_stores[] = $store_de['Id'];\n }\n }\n }\n\n if ($store_name && $store_get_id) {\n if (!in_array($user_id['UserId'], $users_have_store)) {\n //Adding the user devices, in which they have the stores added in DB\n\n if (!empty($special_user_list)) {\n if (isset($special_user_list[$user_id['UserId']])) {\n if ($special_user_list[$user_id['UserId']]['StoreId'] == $store_get_id && ($special_user_list[$user_id['UserId']]['Specials'] == 1 || $special_user_list[$user_id['UserId']]['PreferredStoreOnly'] == 1)) {\n $users_have_store[$user_id['UserId']] = array(\n 'UserId' => $user_id['UserId'],\n 'StoreName' => $store_name,\n 'StoreId' => $store_get_id\n );\n if (!in_array($user_id['UserId'], $user_add)) {\n $user_add[] = $user_id['UserId'];\n }\n }\n else {\n \n }\n }\n }\n else {\n if (!in_array($user_id['UserId'], $user_add)) {\n $user_add[] = $user_id['UserId'];\n }\n $users_have_store[$user_id['UserId']] = array(\n 'UserId' => $user_id['UserId'],\n 'StoreName' => $store_name,\n 'StoreId' => $store_get_id\n );\n }\n }\n }\n }\n if (!isset($users_have_store[$user_id['UserId']])) {\n if (!empty($comp_available_stores)) {\n $user_notification_settings = $CI -> specialproductmodel -> get_user_notification_settings($user_id['UserId']);\n $user_preferred_brands = $CI -> specialproductmodel -> get_user_preferred_brands($user_id['UserId']);\n if ($user_notification_settings) {\n if ($user_notification_settings['Specials'] == 1) {\n if ($user_notification_settings['PreferredStoreOnly'] == 1) {\n if (in_array($user_preferred_brands['StoreId'], $comp_available_stores)) {\n $users_have_store[$user_id['UserId']] = array(\n 'UserId' => $user_id['UserId'],\n 'StoreName' => '',\n 'StoreId' => $user_preferred_brands['StoreId']\n );\n }\n }\n else {\n $users_have_store[$user_id['UserId']] = array(\n 'UserId' => $user_id['UserId'],\n 'StoreName' => '',\n 'StoreId' => $comp_available_stores[0]\n );\n }\n }\n }\n }\n }\n }\n if (!empty($users_have_store)) { //if there are users with stores, then send push notification to them\n $notification_array = array(\n 'title' => 'Hurry! Specials Added',\n 'message' => $message,\n 'product_id' => $product_id,\n 'retailer_id' => $retailer_id,\n 'store_type_id' => $store_type_id,\n 'store_id' => $store_id,\n 'is_special' => '1',\n 'is_location_message' => '0',\n 'is_location_near_message' => '0'\n );\n if (!empty($product_array)) {\n //Checking for price alert enabled\n //If for a single product for single user, then will send the message with all the product details\n //If user have multiple alerts, then a general message will send\n\n foreach ($product_array as $index => $product) {\n foreach ($users_have_store as $user_get) {\n $multiple_single_insert = [];\n $is_alert_available = $CI -> specialproductmodel -> check_price_alert($product['id'], $user_get['UserId']);\n $is_alert_available = 0 ; // Temporary\n if ($is_alert_available) { \n if (!array_key_exists($user_get['UserId'], $price_change_array)) {\n # set product names according to users\n $product_names[$user_get['UserId']][] = $product['name']; \n \n $price_change_count[$user_get['UserId']] = 1;\n $price_change_array[$user_get['UserId']] = array(\n 'title' => 'Price Change Alert',\n 'message' => $product['name'] . ' from: ' . $store_detail_array[$index]['retailerName'] . ', ' . $store_detail_array[$index]['name'],\n 'product_id' => $product['id'],\n 'retailer_id' => $store_detail_array[$index]['retailer'],\n 'store_type_id' => $store_detail_array[$index]['storeType'],\n 'store_id' => $store_detail_array[$index]['id'],\n 'is_special' => '0',\n 'is_location_message' => '0',\n 'is_location_near_message' => '0'\n );\n }\n else {\n # set product names according to users\n $product_names[$user_get['UserId']][] = $product['name']; \n \n $price_change_count[$user_get['UserId']] += 1;\n $price_change_array[$user_get['UserId']] = array(\n 'title' => 'Price Change Alert',\n 'message' => $price_change_count[$user_get['UserId']] . ' products from: ' . $store_detail_array[$index]['retailerName'] . ', ' . $store_detail_array[$index]['name'],\n 'product_id' => '',\n 'retailer_id' => $store_detail_array[$index]['retailer'],\n 'store_type_id' => '',\n 'store_id' => '',\n 'is_special' => '0',\n 'is_location_message' => '0',\n 'is_location_near_message' => '0'\n );\n }\n// $notification_array1 = array(\n// 'title' => 'Price Change Alert',\n// 'message' => $product['name'] . ' from: ' . $store_detail_array[$index]['retailerName'] . ', ' . $store_detail_array[$index]['name'],\n// 'product_id' => $product['id'],\n// 'retailer_id' => $store_detail_array[$index]['retailer'],\n// 'store_type_id' => $store_detail_array[$index]['storeType'],\n// 'store_id' => $store_detail_array[$index]['id'],\n// 'is_special' => '1'\n// );\n// $multiple_single_insert[] = array(\n// 'Title' => $notification_array1['title'],\n// 'Message' => $notification_array1['message'],\n// 'UserId' => $user_get['UserId'],\n// 'CreatedOn' => date('Y-m-d H:i:s')\n// );\n// send_push_notification($notification_array1, array($user_get['UserId']), $multiple_single_insert);\n }\n else {\n \n if (!array_key_exists($store_detail_array[$index]['id'] . ':' . $user_get['UserId'], $retailer_special_message)) {\n if (!isset($retailer_count_arr[$user_get['UserId']])) {\n $retailer_count_arr[$user_get['UserId']] = 1;\n # Get stores names\n $store_names[$user_get['UserId']][]=$store_detail_array[$index]['name'];\n }\n else {\n $retailer_count_arr[$user_get['UserId']] += 1;\n \n # Get stores names\n $store_names[$user_get['UserId']][]=$store_detail_array[$index]['name'];\n }\n $retailer_special_message[$store_detail_array[$index]['id'] . ':' . $user_get['UserId']] = array(\n// 'title' => 'Special Added',\n 'title' => $store_detail_array[$index]['retailerName'].' - '.$special_name,\n 'message' => 'Specials added from: ' . $store_detail_array[$index]['retailerName'] . ', ' . $store_detail_array[$index]['name'],\n 'product_id' => $product['id'],\n 'retailer_id' => $store_detail_array[$index]['retailer'],\n 'store_type_id' => $store_detail_array[$index]['storeType'],\n 'store_id' => $store_detail_array[$index]['id'],\n 'is_special' => '0',\n 'is_location_message' => '0',\n 'is_location_near_message' => '0'\n );\n }\n \n \n \n }\n }\n }\n \n \n \n \n $retailer_count_arr['237'] = 5;\n $retailer_final_array = [];\n if (!empty($retailer_special_message) && !empty($retailer_count_arr)) {\n foreach ($retailer_special_message as $store_user_id => $val) {\n \n // Send notification from here\n $store_user_arr = explode(':', $store_user_id);\n if (isset($retailer_count_arr[$store_user_arr[1]])) {\n if ($retailer_count_arr[$store_user_arr[1]] > 1) {\n $retailer_final_array[$store_user_arr[1]] = array(\n// 'title' => 'Special Added',\n 'title' => $store_detail_array[$index]['retailerName'].' - '.$special_name,\n 'message' => 'Specials added: ' . $retailer_count_arr[$store_user_arr[1]] . ' Stores from ' . $store_detail_array[$index]['retailerName'],\n 'product_id' => '0',\n 'retailer_id' => $val['retailer_id'],\n 'store_type_id' => '0',\n 'store_id' => '0',\n 'is_special' => '0',\n 'is_location_message' => '0',\n 'is_location_near_message' => '0'\n );\n }\n }\n \n \n \n \n // Send not\n }\n }\n \n \n \n //checking the price alert array and send the notifications\n if (!empty($price_change_array)) {\n foreach ($price_change_array as $price_user_id => $price_array) {\n \n //Get product Names\n if(isset($product_names[$price_user_id])){\n $productNameMessage = implode(\",\" ,$product_names[$price_user_id]);\n }\n \n $finalMessage = \"\";\n $msg = explode(\"products from:\",$price_array['message']);\n $finalMessage = $productNameMessage.\" products from: \".$msg[1];\n \n /* \n $multiple_single_insert[] = array(\n 'Title' => $price_array['title'],\n 'Message' => $price_array['message'],\n 'UserId' => $price_user_id,\n 'CreatedOn' => date('Y-m-d H:i:s')\n ); \n */\n \n \n $multiple_single_insert[] = array(\n 'Title' => $price_array['title'],\n 'Message' => $finalMessage,\n 'UserId' => $price_user_id,\n 'CreatedOn' => date('Y-m-d H:i:s')\n );\n \n \n \n //send_push_notification($price_array, array($price_user_id), $multiple_single_insert);\n }\n }\n if (!empty($retailer_final_array)) {\n foreach ($retailer_final_array as $special_user_id => $special_array) {\n \n /*\n echo \"<pre>\";\n //echo \"retailer_final_array\";\n //print_r($retailer_final_array);\n echo \"special_array\";\n print_r($special_array);\n echo \"store_names[$special_user_id]\";\n print_r($store_names[$special_user_id]);\n */\n \n \n \n //Get Stores Names\n if(isset($store_names[$special_user_id])){\n //$storeNameMessage = implode(\",\" ,$store_names[$special_user_id]);\n $userStores = $store_names[$special_user_id];\n \n foreach($userStores as $userStore)\n {\n //echo \"<br>\".$userStore;\n }\n \n \n }\n \n $finalStoreMessage = \"\";\n $storeMsg = explode(\"Stores from\",$special_array['message']);\n $finalStoreMessage = 'Specials added: '.$storeNameMessage.\" Stores from \".$storeMsg[1]; \n \n $multiple_special_insert[] = array(\n 'Title' => $special_array['title'],\n 'Message' => $finalStoreMessage,\n 'UserId' => $special_user_id,\n 'CreatedOn' => date('Y-m-d H:i:s')\n );\n /*\n $multiple_special_insert[] = array(\n 'Title' => $special_array['title'],\n 'Message' => $special_array['message'],\n 'UserId' => $special_user_id,\n 'CreatedOn' => date('Y-m-d H:i:s')\n ); \n */\n \n echo \"<pre>\";\n echo \"retailer_final_array\";\n print_r($retailer_final_array);\n echo \"special_array\";\n print_r($special_array);\n echo \"multiple_special_insert\";\n print_r($multiple_special_insert);\n exit;\n \n send_push_notification($special_array, array($special_user_id), $multiple_special_insert);\n }\n }\n }\n foreach ($users_have_store as $us_st) {\n $multiple_insert[] = array(\n 'Title' => $notification_array['title'],\n 'Message' => $notification_array['message'],\n 'UserId' => $us_st['UserId'],\n 'CreatedOn' => date('Y-m-d H:i:s')\n );\n }\n send_push_notification($notification_array, $user_add, $multiple_insert);\n }\n }\n}",
"public function send_multiple_user_notification_iosold($deviceToken, $payload)\n {\n //print_r($deviceToken);exit();\n $passphrase = '12345'; // change this to your passphrase(password)\n\n $ctx = stream_context_create();\n\t\t//stream_context_set_option($ctx, 'ssl', 'local_cert','Production_Final.pem');\n\t\tstream_context_set_option($ctx, 'ssl', 'local_cert','UC_FINAL.pem'); \n stream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase);\n //stream_context_set_option($ctx, 'ssl', 'cafile', 'entrust_2048_ca.cer');\n\n // Open a connection to the APNS server\n // for \n\t\t$oldErrorReporting = error_reporting(); // save error reporting level\n\t\terror_reporting($oldErrorReporting ^ E_WARNING); // disable warnings\n\t\n $fp = stream_socket_client(\n 'ssl://gateway.sandbox.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT, $ctx); \n\t\t\n\t\t\n /* $fp = stream_socket_client(\n 'ssl://gateway.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT, $ctx); \n\t\t*/\n\t\t\n\t\terror_reporting($oldErrorReporting); // restore error reporting level\n\t\t//stream_set_blocking ($fp, 0);\n if (!$fp){\n\t\t\t exit(\"Failed to connect: $err $errstr\" . PHP_EOL);\n\t\t\t //echo \"Failed to connect: $err $errstr\" . PHP_EOL;exit;\n\t\t}\n \n\t\t\t\n\n foreach($deviceToken as $token)\n {\n $msg = chr(0) . pack('n',32) . pack('H*', $token) . pack('n',strlen($payload)) . $payload;\n // Build the binary notification\n //$msg = chr(0) . pack('n', 32) . pack('H*', $deviceToken) . pack('n', strlen($payload)) . $payload;\n\n // Send it to the server\n $result = fwrite($fp, $msg, strlen($msg));\n }\n\t\tusleep(500000);\n \n if (!$result){\n return false;\n //echo '<br>Message not delivered' . PHP_EOL . print_r($result);exit();\n } \n else{\n return true;\n //echo '<br>Message successfully delivered' . PHP_EOL . print_r($result);exit();\n }\n\t\tfclose($fp);\n }",
"public function sendpush() {\n define( 'API_ACCESS_KEY', 'AAAAt1-_IHo:APA91bEN-Moq4Y-SFNRGW3CTgjXl8c8ZbDCbkd5XWpPhwh3TmbIWqTyV583wIXEc-m9ZB-tY3ow28QZfMZ8Oc-fRTjftcL9_zXJzA_oTNlG7KhYzDDNzpkNrgTaYtCIaPSwcs34jTTh9' );\n //$registrationIds = $_GET['id'];\n $registrationIds = 'fKOLhxS9coQ:APA91bE13tHl61mVUwoMxT4Obt6L5N4bMCw2VvfPIOWE7JzZH1JAQ0TAWIO9R-lonBm17AVlA7X8GhyxaWyS3qhEkDeUczZE-fP_h2x8TKLvB4c0T5xyNdqpSlIiDaR86DpOn4YWq00V';\n #prep the bundle\n $msg = array\n (\n 'body' => 'Body of Alshamil Notification',\n 'title' => 'Title Of Alshamil Notification',\n 'icon' => 'myicon',/*Default Icon*/\n 'sound' => 'mySound'/*Default sound*/\n );\n $fields = array\n (\n 'to' => $registrationIds,\n 'notification' => $msg\n );\n \n \n $headers = array\n (\n 'Authorization: key=' . API_ACCESS_KEY,\n 'Content-Type: application/json'\n );\n #Send Reponse To FireBase Server \n $ch = curl_init();\n curl_setopt( $ch,CURLOPT_URL, 'https://fcm.googleapis.com/fcm/send' );\n curl_setopt( $ch,CURLOPT_POST, true );\n curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers );\n curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true );\n curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, false );\n curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $fields ) );\n $result = curl_exec($ch );\n curl_close( $ch );\n #Echo Result Of FireBase Server\n echo $result;\n }",
"public function get_app_user_id_for_ios_group_message($group_message_id)\n\t{\n\t\t$return_array=array();\n\t\t$i=0;\n\t\t\n\t\t$sql=\"SELECT * FROM app_user JOIN app_user_ios ON (app_user.app_user_id=app_user_ios.ref_app_user_ios_app_user_id) where app_user.ref_app_user_device_type_id=\".IOS_DEVICE_TYPE_ID.\" and app_user_activation=1 \";\n\t\t$query=$this->db->query($sql);\n\t\t$app_user_id_array=$query->result_array();\n\t\tforeach($app_user_id_array as $app_user_id_1)\n\t\t{\n\t\t\t$app_user_id=$app_user_id_1['app_user_id'];\n\t\t$sql_group_message_or_gate=\"SELECT * FROM (SELECT group_message_id FROM group_message where group_message_id=$group_message_id and is_condition_or_gate=1 AND (\n CASE WHEN is_condition_birth_year=1 then condition_birth_year=(SELECT YEAR(app_user_birth_date) FROM app_user_details WHERE ref_app_user_details_app_user_id=$app_user_id) \n ELSE FALSE\n END \n OR\n CASE WHEN is_condition_birth_month=1 then condition_birth_month=(SELECT MONTH(app_user_birth_date) FROM app_user_details WHERE ref_app_user_details_app_user_id=$app_user_id)\n ELSE FALSE\n END \n OR\n CASE WHEN is_condition_age_range=1 then (SELECT FLOOR(DATEDIFF (CURRENT_DATE, `app_user_birth_date`)/365) AS age FROM app_user_details WHERE ref_app_user_details_app_user_id=$app_user_id) BETWEEN condition_age_starting_range AND condition_age_ending_range\n ELSE FALSE\n END \n OR\n CASE WHEN is_condition_sex=1 then condition_sex=(SELECT app_user_sex FROM app_user_details WHERE ref_app_user_details_app_user_id=$app_user_id)\n ELSE FALSE\n END \n OR\n CASE WHEN is_condition_city=1 then LOWER(condition_city_name) LIKE (SELECT LOWER(app_user_city) FROM app_user_details WHERE ref_app_user_details_app_user_id=$app_user_id)\n ELSE FALSE\n END \n OR\n CASE WHEN is_condition_post_code=1 then condition_post_code=(SELECT app_user_post_code FROM app_user_details WHERE ref_app_user_details_app_user_id=$app_user_id)\n ELSE FALSE\n END \n )\n ) as group_message_or_gate \";\n\t\t$sql_group_message_and_gate=\"SELECT group_message_id FROM (SELECT * FROM group_message where group_message_id=$group_message_id and is_condition_and_gate=1 AND \n\t\tCASE WHEN is_condition_birth_year=1 then condition_birth_year=(SELECT YEAR(app_user_birth_date) FROM app_user_details WHERE ref_app_user_details_app_user_id=$app_user_id) \n\t\tELSE TRUE \n\t\tEND \n\t\tAND \n\t\tCASE WHEN is_condition_birth_month=1 then condition_birth_month=(SELECT MONTH(app_user_birth_date) FROM app_user_details WHERE ref_app_user_details_app_user_id=$app_user_id) \n\t\tELSE TRUE \n\t\tEND \n\t\tAND \n\t\tCASE WHEN is_condition_age_range=1 then (SELECT FLOOR(DATEDIFF (CURRENT_DATE, `app_user_birth_date`)/365) AS age FROM app_user_details WHERE ref_app_user_details_app_user_id=$app_user_id) BETWEEN condition_age_starting_range AND condition_age_ending_range \n\t\tELSE TRUE \n\t\tEND \n\t\tAND \n\t\tCASE WHEN is_condition_sex=1 then condition_sex=(SELECT app_user_sex FROM app_user_details WHERE ref_app_user_details_app_user_id=$app_user_id) \n\t\tELSE TRUE \n\t\tEND \n\t\tAND \n\t\tCASE WHEN is_condition_city=1 then LOWER(condition_city_name) LIKE (SELECT LOWER(app_user_city) FROM app_user_details WHERE ref_app_user_details_app_user_id=$app_user_id) \n\t\tELSE TRUE \n\t\tEND \n\t\tAND \n\t\tCASE WHEN is_condition_post_code=1 then condition_post_code=(SELECT app_user_post_code FROM app_user_details WHERE ref_app_user_details_app_user_id=$app_user_id) \n\t\tELSE TRUE \n\t\tEND \n\t\t) as group_message_and_gate\";\n\t\t\n\t\t\n\t\t$sql_final=\"SELECT * FROM (SELECT * FROM message JOIN \n\t\t(SELECT * FROM group_message where group_message_id in( \".$sql_group_message_or_gate.\" \n\t\tUNION \".$sql_group_message_and_gate.\" \n\t\t)) as group_message_or_and ON (message.message_id=group_message_or_and.ref_group_message_message_id) \n\t\t \n\t\t ) as final_message\n\t\tWHERE final_message.message_active=1 \";\n\t\t$query=$this->db->query($sql_final);\n\t\tif($query->num_rows()==1)\n\t\t{\n\t\t\t$return_array[$i]=$app_user_id_1['ios_device_token'];\n\t\t\t$i++;\n\t\t}\n\t\t}\n\t\treturn $return_array;\n\n\t}",
"function send_notification()\n{\nglobal $eid;\ninclude('config.php');\n$sql2 = \"SELECT s.* from sessions s, photo_user_details u Where s.user_id=u.user_id and u.id='\".$eid.\"'\"; \n$result2 = mysqli_query($conn, $sql2);\n$row2 = mysqli_fetch_assoc($result2);\n\n$token = $row2['device_token'];\n$uid = $row2['user_id'];\n\ndefine( 'API_ACCESS_KEY', 'AAAAhpZWSHM:APA91bGUOOfGGe96x5xLs_LNk63T60_0b0mwGxuSz41eyjBYh_YhfU7FnbE5rCEzILVoivooP9rc9itn9jZ9k5WXPZXVLFjKPvjzEr3lYKaCyrBijZTJIefJJUw5osGdVFq-11aAivcb');\n \n#prep the bundle\n $msg = array\n (\n\t\t'body' \t=> 'Cameraman Allocated for your Request, Check Photoshoot order! ',\n\t\t'title'\t=> 'Hoodycam',\n\t\t'sound' => 'default',\n\t\t'color' => '#23E78'\n\t\t\n \t\n );\n\t$fields = array\n\t\t\t(\n\t\t\t\t'to'\t\t=>$token,\n\t\t\t\t'notification'\t=> $msg,\n\t\t\t\t\n\t\t\t);\n\n\t\n\t$headers = array\n\t\t\t(\n\t\t\t\t'Authorization: key=' . API_ACCESS_KEY,\n\t\t\t\t'Content-Type: application/json'\n\t\t\t);\n#Send Reponse To FireBase Server\t\n\t\t$ch = curl_init();\n\t\tcurl_setopt( $ch,CURLOPT_URL, 'https://fcm.googleapis.com/fcm/send' );\n\t\tcurl_setopt( $ch,CURLOPT_POST, true );\n\t\tcurl_setopt( $ch,CURLOPT_HTTPHEADER, $headers );\n\t\tcurl_setopt( $ch,CURLOPT_RETURNTRANSFER, true );\n\t\tcurl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, false );\n\t\tcurl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $fields ) );\n\t\t$result = curl_exec($ch );\n\t\techo $result;\n\t\techo $data;\n\t\t\n\t\tcurl_close( $ch );\n}",
"function send_notification(Array $registatoin_ids,$message) {\n define(\"GOOGLE_API_KEY\", \"AIzaSyDn4B8d_y5jwSUOyc1gWo5xVHXpGbLEEFQ\");\n // Set POST request variable\n $url = 'https://android.googleapis.com/gcm/send';\n\n $fields = array(\n 'registration_ids' => $registatoin_ids,\n 'data' => array(\"pesan\"=>$message),\n );\n\n $headers = array(\n 'Authorization: key=' . GOOGLE_API_KEY,\n 'Content-Type: application/json'\n );\n // Open connection\n $ch = curl_init();\n\n // Set the url, number of POST vars, POST data\n curl_setopt($ch, CURLOPT_URL, $url);\n\n curl_setopt($ch, CURLOPT_POST, true);\n curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n\n // disable SSL certificate support\n curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);\n\n curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));\n\n // execute post\n $result = curl_exec($ch);\n if ($result === FALSE) {\n die('Curl failed: ' . curl_error($ch));\n }\n\n // Close connection\n curl_close($ch);\n echo $result;\n}",
"public static function sendAndroidNotification($deviceId, $param, $title, $type, $cat_id, $post_id)\n {\n if($type == 1){ // post\n\n $msg = array\n (\n 'title' => \"Let's Go\",\n 'message' => $title,\n 'type' => $type, \n 'cat_id' => $cat_id\n ); \n\n }else if($type == 2){ // post\n\n $msg = array\n (\n 'title' => \"Let's Go\",\n 'message' => $title,\n 'type' => $type, \n 'cat_id' => $cat_id,\n 'post_id' => $post_id,\n );\n\n }else{ // category\n $msg = array\n (\n 'title' => \"Let's Go\",\n 'message' => $title,\n 'type' => $type\n ); \n }\n\n\n $fields = array\n (\n 'to' => $deviceId,\n 'data' => array('M' => $msg),\n 'priority' => 'high'\n );\n\n $headers = array\n (\n 'Authorization: key=' . Yii::$app->params['ANDROID_API_KEY'],\n 'Content-Type: application/json'\n );\n\n $ch = curl_init();\n curl_setopt($ch, CURLOPT_URL, 'https://fcm.googleapis.com/fcm/send');\n curl_setopt($ch, CURLOPT_POST, true);\n curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);\n curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));\n $result = curl_exec($ch);\n\n curl_close($ch);\n }",
"public function pushtest()\n {\n define( 'API_ACCESS_KEY', 'YOUR-SERVER-API-ACCESS-KEY-GOES-HERE' );\n // $userinfo = Userinfo::find(9);\n $registrationIds = array( 'fK43k8Vv0JU:APA91bHVMQSzvd9jCaMId8TBlw1OaNskJ0BDvzF87zB4rHfbZUhY9CkOL_SyeEkWP01PiWsEX-C87UOv6d3_NYZhfdElrdZwEX0Ug_EcLT5YAMKnEazEaRMPvB_mMjpPH5l86pjdradV' ,\n 'fK43k8Vv0JU:APA91bHVMQSzvd9jCaMId8TBlw1OaNskJ0BDvzF87zB4rHfbZUhY9CkOL_SyeEkWP01PiWsEX-C87UOv6d3_NYZhfdElrdZwEX0Ug_EcLT5YAMKnEazEaRMPvB_mMjpPH5l86pjdradV');\n // $registrationIds = array( $userinfo->gcmid );\n #prep the bundle\n $msg = array\n (\n 'body' => 'Test Push notification',\n 'title' => 'Test Push',\n 'tag' => 'new_order_placed'\n // 'icon' => 'myicon',/*Default Icon*/\n // 'sound' => 'mySound'/*Default sound*/\n );\n\n $ttl = array('ttl' => '3s');\n $fields = array\n (\n // 'to' => $GCMID // for single device push\n 'registration_ids' => $registrationIds , // for multiple deice push\n 'data' => $msg,\n \"android\" => $ttl\n );\n\n\n $headers = array\n (\n // 'Authorization: key=' . 'AAAAdN6q8pk:APA91bFFO44qgVLfPoT3aj572-cGhkvzalAw_VYF_dl3IC3QIkzJ-b_cW2o8w78lJWDQzVuY1i1uQp2v0YnGklYtRiz0nD-U8CARSOq3ECmTAR-QZc3oQeyAOX4A95RgRB6FmCyNpF5v',\n 'Authorization: key=' . env('PUSH_NOTIFICATION_API_ACCESS_KEY'),\n 'Content-Type: application/json'\n );\n #Send Reponse To FireBase Server\n $ch = curl_init();\n // curl_setopt( $ch,CURLOPT_URL, 'https://fcm.googleapis.com/fcm/send' );\n curl_setopt( $ch,CURLOPT_URL, env('PUSH_NOTIFICATION_SEND_URL') );\n curl_setopt( $ch,CURLOPT_POST, true );\n curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers );\n curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true );\n curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, false );\n curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $fields ) );\n $result = curl_exec($ch );\n curl_close( $ch );\n #Echo Result Of FireBase Server\n // echo $result;\n $jsonResult = json_decode($result);\n // dd($jsonResult->results);\n\n // logNotification(1,$registrationIds,$msg,$jsonResult->results,'new_order_placed');\n }",
"function generateDeviceId(){\r\n $megaRandomHash = md5(number_format(microtime(true), 7, '', ''));\r\n return 'android-'.substr($megaRandomHash, 16);\r\n}",
"function host_cancle($from, $to, $togcm, $type, $message, $sender_name, $event_refrence){\n$arr = array(\"host\" => $from,\n\t \"to_id\" => $to,\n\t \"payload_type\" => $type,\n\t \"sender_name\" => $sender_name,\n\t \"event_reference\" => $event_refrence,\n \"payload_message\" => $message);\n$new_payload = json_encode($arr);\nsend_gcm_notify($togcm, $new_payload);\n}",
"function apnsNotify($device_token, $message_data,$alert){\r\n //message data will be an array\r\n // device_token will be a simple string\r\n\tinclude 'config.php';\r\n $certs_dir = $this->app_config['document_root'].'/../certs';\r\n // Apns config\r\n\t$is_production_mode = ($this->app_config['apns_mode'] == 'production')? 1 : 0;\r\n\r\n // true - use apns in production mode\r\n // false - use apns in dev mode\r\n define(\"PRODUCTION_MODE\",$is_production_mode);\r\n\r\n $serverId = 1;\r\n//\t$serverName = 'aad2.vignetcorp.com';\r\n $serverName = $this->app_config['http_host'];\r\n\r\n if(PRODUCTION_MODE) {\r\n $apnsHost = 'gateway.push.apple.com';\r\n } else {\r\n $apnsHost = 'gateway.sandbox.push.apple.com';\r\n }\r\n\r\n $apnsPort = 2195;\r\n if(PRODUCTION_MODE) {\r\n // Use a development push certificate \r\n //$apnsCert = 'path to production certificate';\r\n// $apnsCert = $certs_dir.'/apns_prod/AccessDermPUSHCertKey.pem';\r\n $apnsCert = $certs_dir.'/'.$this->app_config['apns_production_certificate'];\r\n\t\tif(!file_exists($apnsCert)){\r\n\t\t\tlogMessage(\"Certificate file - \".$apnsCert.\" is not found\");\r\n\t\t}\r\n } else {\r\n // Use a production push certificate// reversed\r\n//\t$apnsCert = $certs_dir.'/AccessDermCK.pem';\r\n $apnsCert = $certs_dir.'/'.$this->app_config['apns_development_certificate'];\r\n\t\tif(!file_exists($apnsCert)){\r\n\t\t\tlogMessage(\"Certificate file - \".$apnsCert.\" is not found\");\r\n\t\t}\r\n }\r\n\r\n // --- Sending push notification ---\r\n // Notification content\r\n $payload = array();\r\n //Basic message\r\n $payload['aps'] = array(\r\n 'alert' => $alert, \r\n 'badge' => 1, \r\n 'sound' => 'default',\r\n );\r\n\t/*\r\n $payload['server'] = array(\r\n 'serverId' => $serverId,\r\n 'name' => $serverName\r\n );\r\n // Add some custom data to notification\r\n /*$payload['data'] = array(\r\n 'foo' => \"bar\"\r\n );\r\n * *\r\n \r\n $payload['data']=$message_data;\r\n */\r\n $payload = json_encode($payload);\r\n\r\n $streamContext = stream_context_create();\r\n stream_context_set_option($streamContext, 'ssl', 'local_cert', $apnsCert);\r\n stream_context_set_option($streamContext, 'ssl', 'passphrase', $this->app_config['apns_passphrase']);\r\n\r\n//echo $this->app_config['apns_passphrase'];\r\n\r\n $apns = stream_socket_client('ssl://' . $apnsHost . ':' . $apnsPort, $error, $errorString, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $streamContext);\r\n\tif(!$apns){\r\n\t\t$this->setError('Could not connect: '. $error.' ' . $errorString);\r\n\t\tlogMessage(\"$error | $errorString\");\r\n\t}\r\n\r\n //$deviceToken = str_replace(\" \",\"\",substr($device_token,1,-1)); //this was for removing those < and >\r\n\t// we don't need that\r\n $deviceToken = str_replace(\" \",\"\",$device_token); \r\n\r\n#echo \"<!-- $deviceToken -->\";\r\n //$apnsMessage = chr(0) . chr(0) . chr(32) . pack('H*', str_replace(' ', '', $deviceToken)) . chr(0) . chr(strlen($payload)) . $payload;\r\n\t// Build the binary notification\r\n\t$msg = chr(0) . pack('n', 32) . pack('H*', $deviceToken) . pack('n', strlen($payload)) . $payload;\r\n\r\n $result = fwrite($apns, $msg);\r\n#echo \"<!-- result = $result -->\";\r\n\tif(!$result){\r\n\t\t$this->setStdError('push_failed');\r\n\t\treturn false;\r\n\t}\r\n //socket_close($apns);\r\n fclose($apns);\r\n\tlogMessage($apnsHost.' | '. $deviceToken.' | '.$alert.' | '. $result);\r\n\treturn true;\r\n }",
"public function actionpushNotificationFlashSaleToAndroid() {\n\n //$msg = \"send successfully\";\n $type = \"notified\";\n $sql = \"SELECT ufid,device_token,sale_start_from FROM user_flashsale_notification where device_type = 1 and device_token != '' and send_flag = '0'\";\n $deviceTokendata = $this->getAllData($sql);\n\t\n\t$badge_count = 0;\n\tif($deviceTokendata)\n\t{\n\t\tforeach ($deviceTokendata as $key => $value) {\n\t\t if($value['device_token'] !== NULL)\n\t\t\t//$deviceToken[] = $value['device_token'];\n\t\t\t$deviceToken[] = '6932eba7ebced6bfa1f0ce';\t\n\t\t\t$updateidarr[] = $value['ufid'];\n\t \t\t//$updateidarr[] = 2;\n\t\t}\n \n\t\t$message = \"Flash Sale begins on \".$value['sale_start_from'];\n\t\t$msg=array(\"msg\"=>$message,\"id\"=>\"\",\"type\"=>\"flash\");\n\t\t$notis = $this->sendPushNotificationToAndroid($deviceToken, $msg, $type);\n\t\t// update record for send_flag here\n\t\t$updateid = implode(',' , $updateidarr);\n\t\tif ($notis)\n\t\t{\n\t\t \t//Delete record from database as notification send to user\n\t\t\t$updatesql = \"Delete from user_flashsale_notification where ufid IN ('\".$updateid.\"')\";\n\t\t\t$this->executeQuery($updatesql);\n\t\t\t$response = array('status' => '1', 'data' => array('message' => 'Notification send successfully'));\n\n\t\t} else {\n\n\t\t $response = array('status' => '0', 'data' => array('message' => 'Notification sending fail'));\n\t\t}\n\t\t return $response;\n }\t \n }",
"public static function getDeviceInfoWithJPushWebAPI($registrationId, $appKey=null) {\n $result = array();\n $result[\"result\"] = true;\n $response = null;\n if(is_null($appKey)){\n $client = new JPush(Config::get('app.App_id'), Config::get('app.Secret_key'));\n }else{\n $appName = CommonUtil::getProjectName($appKey);\n $appId = Config::get('jpushkey.auth.'.$appName.'.app_id');\n $masterSecret = Config::get('jpushkey.auth.'.$appName.'.master_secret');\n $client = new JPush($appId, $masterSecret);\n }\n try {\n $device = $client->device();\n $result[\"info\"] = $device->getDevices($registrationId);\n } catch (APIConnectionException $e) {\n $result[\"result\"] = false;\n $result[\"info\"] = \"APIConnection Exception occurred\";\n }catch (APIRequestException $e) {\n $result[\"result\"] = false;\n $result[\"info\"] = \"APIRequest Exception occurred\";\n }catch (JPushException $e) {\n $result[\"result\"] = false;\n $result[\"info\"] = \"JPush Exception occurred\";\n }catch (\\ErrorException $e) {\n $result[\"result\"] = false;\n $result[\"info\"] = \"Error Exception occurred\";\n }catch (\\Exception $e){\n $result[\"result\"] = false;\n $result[\"info\"] = \"Exception occurred\";\n }\n return $result;\n }",
"function sendNotification($registrationIds,$heading,$subtitle){\r\n \r\n $msg = array\r\n (\r\n 'message' => $heading,\r\n 'title' => \"TITLE\",\r\n 'subtitle' => $subtitle,\r\n 'tickerText' => $subtitle,\r\n 'vibrate' => 1,\r\n 'sound' => 1,\r\n 'largeIcon' => 'large_icon',\r\n 'smallIcon' => 'small_icon',\r\n 'noti_type' => 2\r\n );\r\n\r\n $fields = array\r\n (\r\n 'registration_ids' => $registrationIds,\r\n 'data' => $msg\r\n );\r\n \r\n $headers = array\r\n (\r\n 'Authorization: key=' . API_ACCESS_KEY,\r\n 'Content-Type: application/json'\r\n );\r\n \r\n // Set POST variables\r\n $url = 'https://gcm-http.googleapis.com/gcm/send';\r\n \r\n // Open connection\r\n $ch = curl_init();\r\n // Set the url, number of POST vars, POST data\r\n curl_setopt($ch, CURLOPT_URL, $url);\r\n curl_setopt($ch, CURLOPT_POST, true);\r\n curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);\r\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\r\n // Disabling SSL Certificate support temporarly\r\n curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);\r\n curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));\r\n // Execute post\r\n $result = curl_exec($ch);\r\n if ($result === FALSE) {\r\n die('Curl failed: ' . curl_error($ch));\r\n }\r\n // Close connection\r\n curl_close($ch);\r\n return $result;\r\n }",
"function invite_check($from, $to, $togcm, $type, $message, $sender_name, $event_refrence){\n$arr = array(\"host\" => $from,\n\t \"to_id\" => $to,\n\t \"sender_name\" => $sender_name,\n\t \"event_reference\" => $event_refrence,\n\t \"payload_type\" => \"invite_check\",\n \"payload_message\" => $message);\n$new_payload = json_encode($arr);\nsend_gcm_notify($togcm, $new_payload);\n}",
"public function sendPushNotificationToGCM($registatoin_ids, $message) \n{\n $url = 'https://gcm-http.googleapis.com/gcm/send';\n $fields = array(\n 'registration_ids' => $registatoin_ids,\n 'data' => $message,\n );\n //$registatoin_ids = '/topics/global';\n //echo $registatoin_ids;\n $message = array('data1'=>$message);\n $data = array('data'=>$message,'to'=>$registatoin_ids);\n echo json_encode($data);\n //print_r($fields);\n // Google Cloud Messaging GCM API Key\n define(\"GOOGLE_API_KEY\", \"AIzaSyAF1SYN40Gf_JD2J6496-cLnfT_eX4gRt8\"); \n $headers = array(\n 'Authorization: key=' . GOOGLE_API_KEY,\n 'Content-Type: application/json'\n );\n $ch = curl_init();\n curl_setopt($ch, CURLOPT_URL, $url);\n curl_setopt($ch, CURLOPT_POST, true);\n curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); \n curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);\n curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));\n $result = curl_exec($ch); \n if ($result === FALSE) {\n die('Curl failed: ' . curl_error($ch));\n }\n curl_close($ch);\n return $result;\n //print_r($result);\n }"
]
| [
"0.6569726",
"0.65556127",
"0.6469303",
"0.6387688",
"0.6345769",
"0.6313246",
"0.63021576",
"0.62178344",
"0.619058",
"0.6180588",
"0.6152584",
"0.60970294",
"0.607752",
"0.59925437",
"0.5941866",
"0.5869452",
"0.58664685",
"0.58416784",
"0.58230835",
"0.5805175",
"0.57729244",
"0.5769459",
"0.57658505",
"0.5750979",
"0.5732819",
"0.57273567",
"0.5723149",
"0.56895125",
"0.56679195",
"0.5651569"
]
| 0.6864269 | 0 |
Function to send push notification when change price of the store | function create_change_push_message($product_id = '', $retailer_id = '', $store_type_id = '', $store_id = '', $product_name = '', $retailer_name = '', $store_name = '', $store_type_name = '', $price = 0, $success_count = 0, $store_array = array(), $product_array = array(), $store_detail_array = array()) {
/* $multiple_insert = [];
$CI = &get_instance();
$CI -> load -> model('admin/specialproductmodel');
//$message = 'Price change on ';
$message = '';
$count_str = '';
if ($success_count > 1) {
$product_id = '';
$retailer_id = '';
$store_type_id = '';
$store_id = '';
$message .= $success_count . ' products. From ' . $retailer_name;
//$count_str = $success_count;
}
else {
$message .= $product_name . ' from : ' . $retailer_name . ', ' . $store_name . ', ';
$message .= $price . '.';
}
$message .= ' Don\'t miss it!';
$user_ids = $CI -> specialproductmodel -> get_device_user_ids();
$users_have_store = [];
$user_have_price_alert = [];
if ($user_ids) {
foreach ($user_ids as $user_id) {
if ($user_id['PrefLatitude'] && $user_id['PrefLongitude'] && $user_id['PrefDistance']) {
$store_list = $CI -> specialproductmodel -> get_device_user_stores($user_id['PrefLatitude'], $user_id['PrefLongitude'], $user_id['PrefDistance'], $store_array);
if ($store_list) {
if (!in_array($user_id['UserId'], $users_have_store)) {
$users_have_store[] = array(
'UserId' => $user_id['UserId'],
'StoreName' => $store_name
);
}
}
}
}
if (!empty($users_have_store)) {
$notification_array = array(
'title' => 'Price Change Alert',
'message' => $message,
'product_id' => $product_id,
'retailer_id' => $retailer_id,
'store_type_id' => $store_type_id,
'store_id' => $store_id,
'is_special' => '0',
'is_location_message' => '0',
'is_location_near_message' => '0'
);
// if (!empty($product_array)) {
// foreach ($product_array as $index => $product) {
// foreach ($users_have_store as $user_get) {
// $multiple_single_insert = [];
// $is_alert_available = $CI -> specialproductmodel -> check_price_alert($product['id'], $user_get);
// if ($is_alert_available) {
// $notification_array1 = array(
// 'title' => 'Price change alert',
// 'message' => 'A price change is made for ' . $product['name'] . ' by store ' . $store_detail_array[$index]['name'],
// 'product_id' => $product['id'],
// 'retailer_id' => $store_detail_array[$index]['retailer'],
// 'store_type_id' => $store_detail_array[$index]['storeType'],
// 'store_id' => $store_detail_array[$index]['id']
// );
// $multiple_single_insert[] = array(
// 'Title' => $notification_array1['title'],
// 'Message' => $notification_array1['message'],
// 'UserId' => $user_get,
// 'CreatedOn' => date('Y-m-d H:i:s')
// );
// send_push_notification($notification_array1, array($user_get), $multiple_single_insert);
// }
// }
// }
// }
foreach ($users_have_store as $us_st) {
$multiple_insert[] = array(
'Title' => $notification_array['title'],
'Message' => $notification_array['message'],
'UserId' => $us_st['UserId'],
'CreatedOn' => date('Y-m-d H:i:s')
);
}
send_push_notification($notification_array, $users_have_store, $multiple_insert);
}
} */
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function on_buy()\r\n\t{\r\n\t}",
"public function hookActionProductUpdate($params)\n {\n $config = Tools::jsonDecode(Configuration::get('KB_PUSH_NOTIFICATION'), true);\n \n if (!empty($config) && isset($config['module_config']['enable'])) {\n $module_config = $config['module_config'];\n if (!empty($params) && isset($params['id_product'])) {\n $product = $params['product'];\n $id_product = $params['id_product'];\n $subscribed_products = DB::getInstance()->executeS(\n 'SELECT sm.*,s.reg_id as id_reg FROM ' . _DB_PREFIX_ . 'kb_web_push_product_subscriber_mapping sm INNER JOIN '._DB_PREFIX_.'kb_web_push_subscribers s on (s.id_subscriber=sm.id_subscriber AND s.id_shop='.(int)$this->context->shop->id.') '\n . ' where sm.id_shop='.(int)$this->context->shop->id.' AND sm.id_product=' . (int) $id_product\n );\n $stock_reg_ids = array();\n $price_reg_ids = array();\n $fcm_setting = Tools::jsonDecode(Configuration::get('KB_PUSH_FCM_SERVER_SETTING'), true);\n if (!empty($fcm_setting)) {\n $fcm_server_key = $fcm_setting['server_key'];\n $headers = array(\n 'Authorization:key=' . $fcm_server_key,\n 'Content-Type:application/json'\n );\n if (!empty($subscribed_products)) {\n foreach ($subscribed_products as $sub_product) {\n $id_lang = $sub_product['id_lang'];\n $id_shop = $sub_product['id_shop'];\n $product_list = new Product($id_product, $id_lang, $id_shop);\n \n $id_customer = Db::getInstance()->getValue('SELECT id_customer FROM ' . _DB_PREFIX_ . 'guest where id_guest=' . (int) $sub_product['id_guest']);\n $id_product_attribute = $sub_product['id_product_attribute'];\n $priceDisplay = Product::getTaxCalculationMethod($id_customer);\n $productPrice = Product::getPriceStatic($id_product, false, $id_product_attribute, 6);\n if (!$priceDisplay || $priceDisplay == 2) {\n $productPrice = Product::getPriceStatic($id_product, true, $id_product_attribute, 6);\n }\n $subscriber_usr = KbPushSubscribers::getSubscriberRegIDs($sub_product['id_guest'], $id_shop);\n if ($module_config['enable_product_stock_alert']) {\n if (($sub_product['subscribe_type'] == 'stock') && ($sub_product['is_sent'] == 0)) {\n $stock_quantity = StockAvailable::getQuantityAvailableByProduct($id_product, $id_product_attribute, $id_shop);\n if ($stock_quantity > 0) {\n $reg_id = $sub_product['id_reg'];\n// if (!empty($subscriber_usr)) {\n// $reg_id = $subscriber_usr[count($subscriber_usr)-1]['reg_id'];\n// }\n// d($reg_id);\n $kbProduct = new KbPushProductSubscribers($sub_product['id_mapping']);\n $kbProduct->is_sent = 1;\n $kbProduct->sent_at = date('Y-m-d H:i:s');\n $kbProduct->update();\n $id_template = KbPushTemplates::getNotificationTemplateIDByType(self::KBPN_BACK_IN_STOCK_ALERT);\n if (!empty($id_template)) {\n $fields = array();\n $productURL = $this->context->link->getProductLink($id_product);\n $fields = $this->getNotificationPushData($id_template, $id_lang, $id_shop, $productURL);\n if (!empty($fields) && !empty($reg_id)) {\n $message = '';\n if (isset($fields['data']['body'])) {\n $message = $fields['data']['body'];\n $message = str_replace('{{kb_item_name}}', $product_list->name, $message);\n $message = str_replace('{{kb_item_current_price}}', Tools::displayPrice($productPrice), $message);\n $fields['data']['body'] = $message;\n }\n $fields['to'] = $reg_id;\n $fields[\"data\"][\"base_url\"] = $this->getBaseUrl();\n $fields[\"data\"][\"click_url\"] = $this->context->link->getModuleLink($this->name, 'serviceworker', array('action' => 'updateClickPush'), (bool) Configuration::get('PS_SSL_ENABLED'));\n $is_sent = 1;\n $kbTemplate = new KbPushTemplates($id_template, false, $id_shop);\n if (!empty($kbTemplate) && !empty($kbTemplate->id)) {\n $push_id = $this->savePushNotification($kbTemplate, $is_sent, array($reg_id));\n if (!empty($push_id)) {\n $fields[\"data\"][\"push_id\"] = $push_id;\n $result = $this->sendPushRequestToFCM($headers, $fields);\n }\n }\n }\n }\n }\n }\n }\n if ($module_config['enable_product_price_alert']) {\n if (($sub_product['subscribe_type'] == 'price') && ($sub_product['is_sent'] == 0)) {\n if ($productPrice < $sub_product['product_price']) {\n $reg_id = $sub_product['id_reg'];\n //d($reg_id);\n// d($subscriber_usr);\n// if (!empty($subscriber_usr)) {\n// $reg_id = $subscriber_usr[count($subscriber_usr)-1]['reg_id'];\n// }\n $kbProduct = new KbPushProductSubscribers($sub_product['id_mapping']);\n $kbProduct->product_price = $productPrice;\n $kbProduct->is_sent = 0;\n $kbProduct->sent_at = date('Y-m-d H:i:s');\n $kbProduct->update();\n $id_template = KbPushTemplates::getNotificationTemplateIDByType(self::KBPN_PRICE_ALERT);\n if (!empty($id_template)) {\n $fields = array();\n $productURL = $this->context->link->getProductLink($id_product);\n $fields = $this->getNotificationPushData($id_template, $id_lang, $id_shop, $productURL);\n if (!empty($fields) && !empty($reg_id)) {\n $message = '';\n if (isset($fields['data']['body'])) {\n $message = $fields['data']['body'];\n $message = str_replace('{{kb_item_name}}', $product_list->name, $message);\n $message = str_replace('{{kb_item_current_price}}', Tools::displayPrice($productPrice), $message);\n $message = str_replace('{{kb_item_old_price}}', Tools::displayPrice($sub_product['product_price']), $message);\n $fields['data']['body'] = $message;\n }\n $fields['to'] = $reg_id;\n $fields[\"data\"][\"base_url\"] = $this->getBaseUrl();\n $fields[\"data\"][\"click_url\"] = $this->context->link->getModuleLink($this->name, 'serviceworker', array('action' => 'updateClickPush'), (bool) Configuration::get('PS_SSL_ENABLED'));\n $is_sent = 1;\n $kbTemplate = new KbPushTemplates($id_template, false, $id_shop);\n $push_id = $this->savePushNotification($kbTemplate, $is_sent, array($reg_id));\n if (!empty($push_id)) {\n $fields[\"data\"][\"push_id\"] = $push_id;\n $result = $this->sendPushRequestToFCM($headers, $fields);\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n return true;\n }",
"public function notifyPayment()\n {\n }",
"public function hookActionUpdateQuantity($params)\n {\n if ($this->CheckModuleInstaled('mailalerts') && Configuration::get('DESCOMSMS_CHECK_PRODUCT_STOCK') == 'on') {\n //Avoid entering 2 times in the hook when modifying product with combinations stock\n if (!$params['id_product_attribute']) {\n $sql = 'SELECT count(*) FROM '._DB_PREFIX_.'product_attribute where id_product = '.$params['id_product'];\n if ($this->db->getValue($sql)) {\n return false;\n }\n }\n\n $sql = 'SELECT * FROM '._DB_PREFIX_.'mailalert_customer_oos WHERE id_product = '.$params['id_product'].' AND id_product_attribute = '.$params['id_product_attribute'];\n $results = $this->db->ExecuteS($sql);\n\n foreach ($results as $row) {\n $sql = 'SELECT id_address FROM '._DB_PREFIX_.'address WHERE id_customer = '.$row['id_customer'];\n $addresses = $this->db->ExecuteS($sql);\n $sended = false;\n foreach ($addresses as $address) {\n if (!$sended || Configuration::get('DESCOMSMS_CHECK_PRODUCT_STOCK_ALL_ADDRESSES') == 'on') {\n $address = new Address($address['id_address']);\n $country = new Country($address->id_country);\n if (!empty($this->GetPhoneMobile($address, $country))) {\n $sql = 'SELECT name FROM '._DB_PREFIX_.'product_lang pl, '._DB_PREFIX_.'customer c WHERE pl.id_lang = c.id_lang AND pl.id_product = '.$params['id_product'].' AND c.id_customer = '.$row['id_customer'];\n $name = $this->db->getValue($sql);\n\n $data = [\n 'user' => Configuration::get('DESCOMSMS_USER'),\n 'pass' => $this->MyDecrypt(Configuration::get('DESCOMSMS_PASS'), Configuration::get('DESCOMSMS_KEY')),\n 'sender' => Configuration::get('DESCOMSMS_SENDER'),\n 'message' => $this->GetSMSText(Configuration::get('DESCOMSMS_TEXT_PRODUCT_STOCK'), '', $name, $params['quantity']),\n ];\n $data['mobile'] = $this->GetPhoneMobile($address, $country);\n\n $result = $this->SendSMS($data);\n $sended = true;\n //error_log(json_encode($result)); //TODO\n }\n }\n }\n }\n }\n }",
"function notify_new_income() {\n $message = new Message;\n $message\n ->setTitle('新的存款通知')\n ->setMessage('您有一笔新的收入,请查照')\n ->setUrl('/depositing_siteapi_audit.php')\n ->setDelay(5000); //顯示1sec後dismiss 不設則不會消失\n\n // get channel\n $channel = get_message_channel(\n 'backstage', // platform = [front|backstage]\n 'test' // channel\n );\n\n// send message\n mqtt_send(\n $channel,\n $message\n );\n}",
"public function api_update_price(){\n $watchlists = $this->wr->all();\n foreach($watchlists as $watchlist)\n {\n $current_price = $this->get_quotes($watchlist->id);\n\n $this->wr->update([\n 'current_price' => $current_price,\n ],$watchlist->id);\n }\n }",
"public function notificationAction() {\n global $CFG;\n\n // Full strength error logging\n error_reporting(E_ALL);\n ini_set('display_errors', 0);\n ini_set('log_errors', 1);\n\n // Library stuff\n $sagepay = new sagepayserverlib();\n $sagepay->setController($this);\n\n // POST data from SagePay\n $data = $sagepay->getNotification();\n\n // Log the notification data to debug file (in case it's interesting)\n $this->log(var_export($data, true));\n\n // Get the VendorTxCode and use it to look up the purchase\n $VendorTxCode = $data['VendorTxCode'];\n if (!$purchase = $this->bm->getPurchaseFromVendorTxCode($VendorTxCode)) {\n $url = $this->Url('booking/fail') . '/' . $VendorTxCode . '/' . urlencode('Purchase record not found');\n $this->log('SagePay notification: Purchase not found - ' . $url);\n $sagepay->notificationreceipt('INVALID', $url, 'Purchase record not found');\n die;\n }\n\n // Now that we have the purchase object, we can save whatever we got back in it\n $purchase = $this->bm->updateSagepayPurchase($purchase, $data);\n\n // Mailer\n $mail = new maillib();\n $mailpurchase = clone $purchase;\n $mail->initialise($this, $mailpurchase, $this->bm);\n $mail->setExtrarecipients($CFG->backup_email);\n\n // Check VPSSignature for validity\n if (!$sagepay->checkVPSSignature($purchase, $data)) {\n $purchase->status = 'VPSFAIL';\n $purchase->save();\n $url = $this->Url('booking/fail') . '/' . $VendorTxCode . '/' . urlencode('VPSSignature not matched');\n $this->log('SagePay notification: VPS sig no match - ' . $url);\n $sagepay->notificationreceipt('INVALID', $url, 'VPSSignature not matched');\n die;\n }\n\n // Check Status.\n // Work out what next action should be\n $status = $purchase->status;\n if ($status == 'OK' || ($status == 'OK REPEATED')) {\n\n // Send confirmation email\n $url = $this->Url('booking/complete') . '/' . $VendorTxCode;\n $mail->confirm();\n $this->log('SagePay notification: Confirm sent - ' . $url);\n $sagepay->notificationreceipt('OK', $url, '');\n } else if ($status == 'ERROR') {\n $url = $this->Url('booking/fail') . '/' . $VendorTxCode . '/' . urlencode($purchase->statusdetail);\n $this->log('SagePay notification: Booking fail - ' . $url);\n $mail->decline();\n $sagepay->notificationreceipt('OK', $url, $purchase->statusdetail);\n } else {\n $url = $this->Url('booking/decline') . '/' . $VendorTxCode;\n $this->log('SagePay notification: Booking decline - ' . $url);\n $mail->decline();\n $sagepay->notificationreceipt('OK', $url, $purchase->statusdetail);\n }\n\n $purchase->completed = 1;\n $purchase->save();\n\n die;\n }",
"function sendPushNotification($hotel)\n{\n /*here will integrate with the sdk or call api to send broadcast message\n to all users with new hotel data added\n and then call this function after successfully added new hotel*/\n}",
"function _do_price_mail()\n\t{\n\t\t$i=0;\n\t\twhile (array_key_exists('pop3_'.strval($i),$_POST))\n\t\t{\n\t\t\t$price=post_param_integer('pop3_'.strval($i));\n\t\t\t$name='pop3_'.post_param('dpop3_'.strval($i));\n\t\t\t$name2='pop3_'.post_param('ndpop3_'.strval($i));\n\t\t\tif (post_param_integer('delete_pop3_'.strval($i),0)==1)\n\t\t\t{\n\t\t\t\t$GLOBALS['SITE_DB']->query_delete('prices',array('name'=>$name),'',1);\n\t\t\t} else\n\t\t\t{\n\t\t\t\t$GLOBALS['SITE_DB']->query_update('prices',array('price'=>$price,'name'=>$name2),array('name'=>$name),'',1);\n\t\t\t}\n\n\t\t\t$i++;\n\t\t}\n\t}",
"public function customerProductTag($observer)\n{\n $settings = Mage::helper('smsnotifications/data')->getSettings();\n $customer = Mage::getSingleton('customer/session')->getCustomer();\n $fname=$customer->getFirstname();\n $lname=$customer->getLastname();\n $email= $customer->getEmail();\n\n $telephone= $customer->getAddressesCollection()->getFirstitem()->getTelephone();\n if ($telephone) {\n $text = Mage::getStoreConfig('smsnotifications/customer_notification/product_tag');\n $text = str_replace('{{firstname}}', $fname, $text);\n $text = str_replace('{{lastname}}', $lname, $text);\n $text = str_replace('{{emailid}}', $email, $text);\n // $text = str_replace('{{name}}', $customer_name, $text);\n }\n array_push($settings['order_noficication_recipients'], $telephone);\n $result = Mage::helper('smsnotifications/data')->sendSms($text, $settings['order_noficication_recipients']);\n return($result );\n}",
"public function customerProductReview($observer)\n{ \n \n $settings = Mage::helper('smsnotifications/data')->getSettings();\n $customer = Mage::getSingleton('customer/session')->getCustomer();\n $fname=$customer->getFirstname();\n $lname=$customer->getLastname();\n $email= $customer->getEmail();\n\n $telephone= $customer->getAddressesCollection()->getFirstitem()->getTelephone();\n if ($telephone){\n $text = Mage::getStoreConfig('smsnotifications/customer_notification/customer_review');\n $text = str_replace('{{firstname}}', $fname, $text);\n $text = str_replace('{{lastname}}', $lname, $text);\n $text = str_replace('{{emailid}}', $email, $text);\n // $text = str_replace('{{name}}', $customer_name, $text);\n }\n array_push($settings['order_noficication_recipients'], $telephone);\n\n $result = Mage::helper('smsnotifications/data')->sendSms($text, $settings['order_noficication_recipients']);\n return($result);\n}",
"function setSyncItemsPriceAction()\n {\n }",
"public function hookActionUpdateQuantity($params)\n\t{\n\t\t$context = Context::getContext();\n $id_shop = (int)$context->shop->id;\n $id_lang = (int)$context->language->id;\n\n $shop_name = strval(Configuration::get('PS_SHOP_NAME'));\n $shop_email = strval(Configuration::get('PS_SHOP_EMAIL'));\n $id_product = (int)$params['id_product'];\n $id_product_attribute = (int)$params['id_product_attribute'];\n $product_name = Product::getProductName($id_product, $id_product_attribute, $id_lang);\n $quantity = (int)$params['quantity'];\n\n // Prepares the variables used in the email template\n $templateVars = array(\n \t\t'{shop_name}' => $shop_name,\n \t\t'{shop_email}' => $shop_email,\n \t\t'{id_product}' => $id_product,\n \t\t'{product_name}' => $product_name,\n \t\t'{quantity}' => $quantity\n );\n\n // Checks if the module is on \n if(!Configuration::get('MYMOD_EMAILS') == false)\n {\t\n \t// Sends the email notification to '$shop_email'\n\t\t\tMail::send($id_lang,\n\t\t 'stock_notification',\n\t\t 'Stock Update',\n\t\t $templateVars,\n\t\t $shop_email,\n\t\t null,\n\t\t null,\n\t\t null,\n\t\t null,\n\t\t null,\n\t\t 'mails/'\n\t\t );\n\t\t}\n\t}",
"function fn_warehouses_update_product_amount(&$new_amount, $product_id, $cart_id, $tracking, $notify, $order_info, $amount_delta, $current_amount, $original_amount, $sign)\n{\n /** @var Tygh\\Addons\\Warehouses\\Manager $manager */\n $manager = Tygh::$app['addons.warehouses.manager'];\n /** @var Tygh\\Addons\\Warehouses\\ProductStock $product_stock */\n $product_stock = $manager->getProductWarehousesStock($product_id);\n\n if (!$product_stock->hasStockSplitByWarehouses()) {\n return;\n }\n\n // return amount that will be save to main table to its original amount\n $new_amount = $original_amount;\n\n $location = fn_warehouses_get_location_from_order($order_info);\n $pickup_point_id = fn_warehouses_get_pickup_point_id_from_order($order_info, $product_id, $cart_id);\n $destination_id = fn_warehouses_get_destination_id($location);\n\n if ($sign == '-') {\n if ($pickup_point_id && $product_stock->getWarehousesById($pickup_point_id)) {\n $product_stock->reduceStockByAmountForStore($amount_delta, $pickup_point_id);\n } elseif ($destination_id) {\n $product_stock->reduceStockByAmountForDestination($amount_delta, $destination_id);\n } else {\n $product_stock->reduceStockByAmount($amount_delta);\n }\n } else {\n $product_stock->increaseStockByAmount($amount_delta);\n }\n\n $manager->saveProductStock($product_stock);\n}",
"public function sendMailToNotifiedCustomerOk($observer) {\r\n\r\n\r\n $enableOutOfStock = Mage::getStoreConfig('Outofstocknotification/general/activate_apptha_outofstock_enable'); //backend you given module status in off then dont exe this codings\r\n $product = $observer->getProduct(); //get the current product\r\n $isInStock = $product['stock_data']['is_in_stock'];\r\n $enableOutOfStock = intval($enableOutOfStock); //if the product is out of stock val = 0 , that time dont send mails\r\n $productUrl = $product->getUrlInStore();\r\n $stockLevel = (int) Mage::getModel('cataloginventory/stock_item')->loadByProduct($product)->getQty();\r\n $status = $product->getStatus();\r\n\r\n //echo \"<pre>\"; \tprint_r($product);echo \"</pre>\";die;\r\n $product_id = $product->getId();\r\n $products = Mage::getModel('catalog/product')->load($product_id);\r\n\r\n $this->productPrice = $product->getPrice();\r\n\r\n if ($product->_isObjectNew) {\r\n return 1;\r\n }\r\n\r\n if (!$isInStock) { //if it is a out of stock product no need to do any task\r\n return 1;\r\n }\r\n if (!$enableOutOfStock) { // if out of stock is disable then dont do any task just return\r\n return 1; //if outof stock notifi status is no then dont exe all funs\r\n }\r\n $this->storeName = Mage::getStoreConfig(\"general/store_information/name\");\r\n $this->productDescr = $product->getDescription();\r\n\r\n $getProductImageList = json_decode($product->_data['media_gallery']['images']); //get images\r\n for ($i = 0; $i < count($getProductImageList); $i++) {\r\n if (!$getProductImageList[$i]->removed) {\r\n if (!$getProductImageList[$i]->disabled && $getProductImageList[$i]->position == 1 && !$getProductImageList[$i]->removed) {\r\n $prodcutImageIs = $getProductImageList[$i]->url;\r\n break;\r\n } else if (!$getProductImageList[$i]->disabled && !$getProductImageList[$i]->removed) {\r\n $prodcutImageIs = $getProductImageList[$i]->url;\r\n }\r\n }\r\n }\r\n $this->prodcutImg = $product->getImageUrl(); \r\n\t\t\r\n\t\t$product = Mage::getModel('catalog/product')->load($product_id);\r\n\t\t//echo Mage::helper('checkout/cart')->getAddUrl($product);\r\n\t\t//echo $product_id;\r\n\t\t//echo Mage::helper('checkout/cart')->getAddUrl($product_id);\r\n\t\t//echo Mage::getUrl('checkout/cart/add', array('product' => $product_id));\r\n\t\t//exit;\r\n\r\n if (!strlen($this->prodcutImg)) {\r\n\r\n $this->prodcutImg = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN) . DS . 'frontend' . DS . 'default' . DS . 'default' . DS . 'outofstocknotification' . DS . 'defaultimage.jpg';\r\n }\r\n\r\n\r\n if (trim($product->_data['type_id']) == 'grouped' || trim($product->_data['type_id']) == 'bundle') {\r\n $stockLevel = 2; //quantity is not check for grouped\r\n }\r\n\r\n if ($status && ($stockLevel > 0)) {\r\n $productId = $product->getId();\r\n $mailFunCallOrNot = $this->isProductInNotifiyList($productId); //find this product in notify list or not\r\n if ($mailFunCallOrNot) {\r\n $this->_sendNotificationEmail($this->bcc);\r\n $this->updateMailAndStatusOfNotifiy($productId); //changes the status of mailsend_status and status\r\n }\r\n } else {\r\n\r\n return false; //product is out of stock\r\n }\r\n }",
"function create_push_message($product_id = '', $retailer_id = '', $store_type_id = '', $store_id = '', $product_name = '', $retailer_name = '', $store_name = '', $store_type_name = '', $special_count = 0, $special_price = 0, $special_name = '', $success_count = 0, $store_array = array(), $product_array = array(), $store_detail_array = array()) {\n $multiple_insert = [];\n $CI = &get_instance();\n $CI -> load -> model('admin/specialproductmodel');\n\n //Create a general message\n $message = $special_name . ', ';\n if ($success_count > 1) { //if the product count is more than one\n $product_id = '';\n $retailer_id = '';\n $store_type_id = '';\n $store_id = '';\n $message .= $success_count . ' products. From ' . $retailer_name;\n }\n else { //if only one product is addded\n $message .= $product_name . ' from: ' . $retailer_name . ', ' . $store_name . ', ';\n if ($special_count > 1) {\n $message .= $special_price . '(' . $special_count . ')';\n }\n else {\n $message .= $special_price . '.';\n }\n }\n $message .= ' Don\\'t miss it!';\n\n\n $user_ids = $CI -> specialproductmodel -> get_device_user_ids(); //Get the registered device IDs now available in DB\n $users_have_store = [];\n $user_have_price_alert = [];\n $price_change_array = [];\n $price_change_count = [];\n $retailer_special_message = [];\n $retailer_count_arr = [];\n $user_add = [];\n $comp_available_stores = [];\n $product_names = []; // Array to store product names\n $productNameMessage = \"\";\n $store_names = []; // Array to store name of the stores\n $storeNameMessage = \"\";\n\n if (!empty($user_ids)) {//If users available to send the notifications\n foreach ($user_ids as $user_id) {\n \n $comp_available_stores = [];\n if ($user_id['PrefLatitude'] && $user_id['PrefLongitude'] && $user_id['PrefDistance']) {\n $store_det = $CI -> specialproductmodel -> get_device_user_stores($user_id['PrefLatitude'], $user_id['PrefLongitude'], $user_id['PrefDistance'], $store_array, $user_id['state']);\n $store_name = isset($store_det[0]['StoreName']) ? $store_det[0]['StoreName'] : '';\n $store_get_id = isset($store_det[0]['StoreId']) ? $store_det[0]['StoreId'] : '';\n $special_notifications = $CI -> specialproductmodel -> get_special_enabled_user_store();\n $special_user_list = [];\n if ($special_notifications) {\n foreach ($special_notifications as $special_users) {\n $special_user_list[$special_users['UserId']] = array(\n 'StoreId' => $special_users['StoreId'],\n 'Specials' => $special_users['Specials'],\n 'PreferredStoreOnly' => $special_users['PreferredStoreOnly']\n );\n }\n }\n if (!empty($store_det)) {\n foreach ($store_det as $store_de) {\n if (in_array($store_de['Id'], $store_array)) {\n $comp_available_stores[] = $store_de['Id'];\n }\n }\n }\n\n if ($store_name && $store_get_id) {\n if (!in_array($user_id['UserId'], $users_have_store)) {\n //Adding the user devices, in which they have the stores added in DB\n\n if (!empty($special_user_list)) {\n if (isset($special_user_list[$user_id['UserId']])) {\n if ($special_user_list[$user_id['UserId']]['StoreId'] == $store_get_id && ($special_user_list[$user_id['UserId']]['Specials'] == 1 || $special_user_list[$user_id['UserId']]['PreferredStoreOnly'] == 1)) {\n $users_have_store[$user_id['UserId']] = array(\n 'UserId' => $user_id['UserId'],\n 'StoreName' => $store_name,\n 'StoreId' => $store_get_id\n );\n if (!in_array($user_id['UserId'], $user_add)) {\n $user_add[] = $user_id['UserId'];\n }\n }\n else {\n \n }\n }\n }\n else {\n if (!in_array($user_id['UserId'], $user_add)) {\n $user_add[] = $user_id['UserId'];\n }\n $users_have_store[$user_id['UserId']] = array(\n 'UserId' => $user_id['UserId'],\n 'StoreName' => $store_name,\n 'StoreId' => $store_get_id\n );\n }\n }\n }\n }\n if (!isset($users_have_store[$user_id['UserId']])) {\n if (!empty($comp_available_stores)) {\n $user_notification_settings = $CI -> specialproductmodel -> get_user_notification_settings($user_id['UserId']);\n $user_preferred_brands = $CI -> specialproductmodel -> get_user_preferred_brands($user_id['UserId']);\n if ($user_notification_settings) {\n if ($user_notification_settings['Specials'] == 1) {\n if ($user_notification_settings['PreferredStoreOnly'] == 1) {\n if (in_array($user_preferred_brands['StoreId'], $comp_available_stores)) {\n $users_have_store[$user_id['UserId']] = array(\n 'UserId' => $user_id['UserId'],\n 'StoreName' => '',\n 'StoreId' => $user_preferred_brands['StoreId']\n );\n }\n }\n else {\n $users_have_store[$user_id['UserId']] = array(\n 'UserId' => $user_id['UserId'],\n 'StoreName' => '',\n 'StoreId' => $comp_available_stores[0]\n );\n }\n }\n }\n }\n }\n }\n if (!empty($users_have_store)) { //if there are users with stores, then send push notification to them\n $notification_array = array(\n 'title' => 'Hurry! Specials Added',\n 'message' => $message,\n 'product_id' => $product_id,\n 'retailer_id' => $retailer_id,\n 'store_type_id' => $store_type_id,\n 'store_id' => $store_id,\n 'is_special' => '1',\n 'is_location_message' => '0',\n 'is_location_near_message' => '0'\n );\n if (!empty($product_array)) {\n //Checking for price alert enabled\n //If for a single product for single user, then will send the message with all the product details\n //If user have multiple alerts, then a general message will send\n\n foreach ($product_array as $index => $product) {\n foreach ($users_have_store as $user_get) {\n $multiple_single_insert = [];\n $is_alert_available = $CI -> specialproductmodel -> check_price_alert($product['id'], $user_get['UserId']);\n $is_alert_available = 0 ; // Temporary\n if ($is_alert_available) { \n if (!array_key_exists($user_get['UserId'], $price_change_array)) {\n # set product names according to users\n $product_names[$user_get['UserId']][] = $product['name']; \n \n $price_change_count[$user_get['UserId']] = 1;\n $price_change_array[$user_get['UserId']] = array(\n 'title' => 'Price Change Alert',\n 'message' => $product['name'] . ' from: ' . $store_detail_array[$index]['retailerName'] . ', ' . $store_detail_array[$index]['name'],\n 'product_id' => $product['id'],\n 'retailer_id' => $store_detail_array[$index]['retailer'],\n 'store_type_id' => $store_detail_array[$index]['storeType'],\n 'store_id' => $store_detail_array[$index]['id'],\n 'is_special' => '0',\n 'is_location_message' => '0',\n 'is_location_near_message' => '0'\n );\n }\n else {\n # set product names according to users\n $product_names[$user_get['UserId']][] = $product['name']; \n \n $price_change_count[$user_get['UserId']] += 1;\n $price_change_array[$user_get['UserId']] = array(\n 'title' => 'Price Change Alert',\n 'message' => $price_change_count[$user_get['UserId']] . ' products from: ' . $store_detail_array[$index]['retailerName'] . ', ' . $store_detail_array[$index]['name'],\n 'product_id' => '',\n 'retailer_id' => $store_detail_array[$index]['retailer'],\n 'store_type_id' => '',\n 'store_id' => '',\n 'is_special' => '0',\n 'is_location_message' => '0',\n 'is_location_near_message' => '0'\n );\n }\n// $notification_array1 = array(\n// 'title' => 'Price Change Alert',\n// 'message' => $product['name'] . ' from: ' . $store_detail_array[$index]['retailerName'] . ', ' . $store_detail_array[$index]['name'],\n// 'product_id' => $product['id'],\n// 'retailer_id' => $store_detail_array[$index]['retailer'],\n// 'store_type_id' => $store_detail_array[$index]['storeType'],\n// 'store_id' => $store_detail_array[$index]['id'],\n// 'is_special' => '1'\n// );\n// $multiple_single_insert[] = array(\n// 'Title' => $notification_array1['title'],\n// 'Message' => $notification_array1['message'],\n// 'UserId' => $user_get['UserId'],\n// 'CreatedOn' => date('Y-m-d H:i:s')\n// );\n// send_push_notification($notification_array1, array($user_get['UserId']), $multiple_single_insert);\n }\n else {\n \n if (!array_key_exists($store_detail_array[$index]['id'] . ':' . $user_get['UserId'], $retailer_special_message)) {\n if (!isset($retailer_count_arr[$user_get['UserId']])) {\n $retailer_count_arr[$user_get['UserId']] = 1;\n # Get stores names\n $store_names[$user_get['UserId']][]=$store_detail_array[$index]['name'];\n }\n else {\n $retailer_count_arr[$user_get['UserId']] += 1;\n \n # Get stores names\n $store_names[$user_get['UserId']][]=$store_detail_array[$index]['name'];\n }\n $retailer_special_message[$store_detail_array[$index]['id'] . ':' . $user_get['UserId']] = array(\n// 'title' => 'Special Added',\n 'title' => $store_detail_array[$index]['retailerName'].' - '.$special_name,\n 'message' => 'Specials added from: ' . $store_detail_array[$index]['retailerName'] . ', ' . $store_detail_array[$index]['name'],\n 'product_id' => $product['id'],\n 'retailer_id' => $store_detail_array[$index]['retailer'],\n 'store_type_id' => $store_detail_array[$index]['storeType'],\n 'store_id' => $store_detail_array[$index]['id'],\n 'is_special' => '0',\n 'is_location_message' => '0',\n 'is_location_near_message' => '0'\n );\n }\n \n \n \n }\n }\n }\n \n \n \n \n $retailer_count_arr['237'] = 5;\n $retailer_final_array = [];\n if (!empty($retailer_special_message) && !empty($retailer_count_arr)) {\n foreach ($retailer_special_message as $store_user_id => $val) {\n \n // Send notification from here\n $store_user_arr = explode(':', $store_user_id);\n if (isset($retailer_count_arr[$store_user_arr[1]])) {\n if ($retailer_count_arr[$store_user_arr[1]] > 1) {\n $retailer_final_array[$store_user_arr[1]] = array(\n// 'title' => 'Special Added',\n 'title' => $store_detail_array[$index]['retailerName'].' - '.$special_name,\n 'message' => 'Specials added: ' . $retailer_count_arr[$store_user_arr[1]] . ' Stores from ' . $store_detail_array[$index]['retailerName'],\n 'product_id' => '0',\n 'retailer_id' => $val['retailer_id'],\n 'store_type_id' => '0',\n 'store_id' => '0',\n 'is_special' => '0',\n 'is_location_message' => '0',\n 'is_location_near_message' => '0'\n );\n }\n }\n \n \n \n \n // Send not\n }\n }\n \n \n \n //checking the price alert array and send the notifications\n if (!empty($price_change_array)) {\n foreach ($price_change_array as $price_user_id => $price_array) {\n \n //Get product Names\n if(isset($product_names[$price_user_id])){\n $productNameMessage = implode(\",\" ,$product_names[$price_user_id]);\n }\n \n $finalMessage = \"\";\n $msg = explode(\"products from:\",$price_array['message']);\n $finalMessage = $productNameMessage.\" products from: \".$msg[1];\n \n /* \n $multiple_single_insert[] = array(\n 'Title' => $price_array['title'],\n 'Message' => $price_array['message'],\n 'UserId' => $price_user_id,\n 'CreatedOn' => date('Y-m-d H:i:s')\n ); \n */\n \n \n $multiple_single_insert[] = array(\n 'Title' => $price_array['title'],\n 'Message' => $finalMessage,\n 'UserId' => $price_user_id,\n 'CreatedOn' => date('Y-m-d H:i:s')\n );\n \n \n \n //send_push_notification($price_array, array($price_user_id), $multiple_single_insert);\n }\n }\n if (!empty($retailer_final_array)) {\n foreach ($retailer_final_array as $special_user_id => $special_array) {\n \n /*\n echo \"<pre>\";\n //echo \"retailer_final_array\";\n //print_r($retailer_final_array);\n echo \"special_array\";\n print_r($special_array);\n echo \"store_names[$special_user_id]\";\n print_r($store_names[$special_user_id]);\n */\n \n \n \n //Get Stores Names\n if(isset($store_names[$special_user_id])){\n //$storeNameMessage = implode(\",\" ,$store_names[$special_user_id]);\n $userStores = $store_names[$special_user_id];\n \n foreach($userStores as $userStore)\n {\n //echo \"<br>\".$userStore;\n }\n \n \n }\n \n $finalStoreMessage = \"\";\n $storeMsg = explode(\"Stores from\",$special_array['message']);\n $finalStoreMessage = 'Specials added: '.$storeNameMessage.\" Stores from \".$storeMsg[1]; \n \n $multiple_special_insert[] = array(\n 'Title' => $special_array['title'],\n 'Message' => $finalStoreMessage,\n 'UserId' => $special_user_id,\n 'CreatedOn' => date('Y-m-d H:i:s')\n );\n /*\n $multiple_special_insert[] = array(\n 'Title' => $special_array['title'],\n 'Message' => $special_array['message'],\n 'UserId' => $special_user_id,\n 'CreatedOn' => date('Y-m-d H:i:s')\n ); \n */\n \n echo \"<pre>\";\n echo \"retailer_final_array\";\n print_r($retailer_final_array);\n echo \"special_array\";\n print_r($special_array);\n echo \"multiple_special_insert\";\n print_r($multiple_special_insert);\n exit;\n \n send_push_notification($special_array, array($special_user_id), $multiple_special_insert);\n }\n }\n }\n foreach ($users_have_store as $us_st) {\n $multiple_insert[] = array(\n 'Title' => $notification_array['title'],\n 'Message' => $notification_array['message'],\n 'UserId' => $us_st['UserId'],\n 'CreatedOn' => date('Y-m-d H:i:s')\n );\n }\n send_push_notification($notification_array, $user_add, $multiple_insert);\n }\n }\n}",
"public function updateprices()\n {\n\n $aParams = oxRegistry::getConfig()->getRequestParameter(\"updateval\");\n if (is_array($aParams)) {\n foreach ($aParams as $soxId => $aStockParams) {\n $this->addprice($soxId, $aStockParams);\n }\n }\n }",
"private function updateMailAndStatusOfNotifiy($productId) {\r\n $deleteNotify = (int) Mage::getStoreConfig('Outofstocknotification/general/delete_apptha_outofstock_mail');\r\n $write = Mage::getSingleton('core/resource')->getConnection('core_write');\r\n if ($deleteNotify) {\r\n $where = \"product_id = $productId\";\r\n $write->delete($this->stockNotifiTable, $where);\r\n } else {\r\n //$date = date(\"M d, Y\");\r\n\t\t\t//$date = date('Y-m-d H:i:s');\r\n\t\t\t$date = Mage::getModel('core/date')->date('Y-m-d H:i:s', time());\r\n $mailSend = 'YES';\r\n $deleteNotify = 1;\r\n $data = array('mailsend_status' => $mailSend, 'status' => $deleteNotify, 'update_time' => $date);\r\n $where = \"product_id = $productId\";\r\n $write->update($this->stockNotifiTable, $data, $where);\r\n }\r\n }",
"public function hookactionUpdateQuantity($params)\n {\n $id_product = (int)$params['id_product'];\n $id_product_attribute = (int)$params['id_product_attribute'];\n \n $context = Context::getContext();\n $id_shop = (int)$context->shop->id;\n $id_lang = (int)$context->language->id;\n $product = new Product($id_product, false, $id_lang, $id_shop, $context);\n \n if (empty($product)) {\n return;\n }\n \n $product_name = Product::getProductName($id_product, $id_product_attribute, $id_lang);\n $product_has_attributes = $product->hasAttributes();\n $productInfo = array(\n 'product_name' => $product_name,\n 'product_id' => $id_product\n );\n $check_oos = ($product_has_attributes && $id_product_attribute)\n || (!$product_has_attributes && !$id_product_attribute);\n $product_quantity = (int)$params['quantity'];\n if (Module::isInstalled('mailalerts')) {\n // For out of stock notification to admin\n $isActivate = $this->isRulesetActive('out_of_stock_alerts');\n if ($check_oos\n && $product->active == 1\n && $isActivate != null\n && $isActivate != ''\n && $this->smsAPI != null\n && $this->smsAPI != ''\n && $product_quantity <= $this->outStock) {\n $legendstemp = $this->replaceProductLegends(\n $isActivate[0]['template'],\n $productInfo\n );\n // Use send SMS API here\n $legendstemp = preg_replace('/<br(\\s+)?\\/?>/i', \"\\n\", $legendstemp);\n $postAPIdata = array(\n 'label' => $isActivate[0]['label'],\n 'sms_text' => $legendstemp,\n 'source' => '21000',\n 'sender_id' => $isActivate[0]['senderid'],\n 'mobile_number' => $this->adminMobile\n );\n \n $this->sendSMSByAPI($postAPIdata);\n Onehopsmsservice::onehopSaveLog('OutStock', $legendstemp, $this->adminMobile);\n }\n \n // For back in stock\n $isActivate = $this->isRulesetActive('back_of_stock_alerts');\n if ($isActivate != null\n && $isActivate != ''\n && $this->smsAPI != null\n && $this->smsAPI != ''\n && $product_quantity > 0) {\n $bosSql = 'SELECT DISTINCT adr.phone_mobile, oos.id_customer';\n $bosSql .= ' FROM '._DB_PREFIX_. 'mailalert_customer_oos as oos';\n $bosSql .= ' INNER JOIN '._DB_PREFIX_. 'address as adr ON oos.id_customer = adr.id_customer';\n $bosSql .= ' WHERE oos.id_product = \"' . (int)$id_product . '\" AND deleted = 0';\n $bosResults = Db::getInstance()->ExecuteS($bosSql);\n \n if ($bosResults) {\n foreach ($bosResults as $customerVal) {\n $customerInfo = array(\n 'id_customer' => $customerVal['id_customer'],\n 'phone_mobile' => $customerVal['phone_mobile']\n );\n $legendstemp = $this->replaceProductCustomerLegends(\n $isActivate[0]['template'],\n $customerInfo,\n $productInfo\n );\n $legendstemp = preg_replace('/<br(\\s+)?\\/?>/i', \"\\n\", $legendstemp);\n // Use send SMS API here\n $postAPIdata = array(\n 'label' => $isActivate[0]['label'],\n 'sms_text' => $legendstemp,\n 'source' => '21000',\n 'sender_id' => $isActivate[0]['senderid'],\n 'mobile_number' => $customerVal['phone_mobile']\n );\n $this->sendSMSByAPI($postAPIdata);\n $delQuery = 'DELETE FROM ' . _DB_PREFIX_ . 'mailalert_customer_oos';\n $delQuery .= ' WHERE id_customer = \"' . (int)$customerVal['id_customer'] . '\"';\n Db::getInstance()->execute($delQuery);\n Onehopsmsservice::onehopSaveLog('BackStock', $legendstemp, $customerVal['phone_mobile']);\n }\n }\n }\n }\n }",
"public function sendMailToNotifiyMerchant($observer) {\r\n\r\n //check if Enable out of stock \r\n $enableOutOfStock = Mage::getStoreConfig('Outofstocknotification/general/activate_apptha_outofstock_enable');\r\n\r\n //check if Enable out of stock threshod qty of product stock\r\n $enableOutOfStockAdminNotify = Mage::getStoreConfig('Outofstocknotification/general/merchant_apptha_outofstock_mail');\r\n\r\n // store currency code eg. USD, INR\r\n $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();\r\n\r\n // store currency symbol eg. $ \r\n $currency_symbol = Mage::app()->getLocale()->currency($currency_code)->getSymbol();\r\n\r\n if (intval($enableOutOfStockAdminNotify) > 0 && intval($enableOutOfStock) > 0) {\r\n\r\n // get threshold qty as mentioned by Merchant\r\n $thresholdQty = Mage::getStoreConfig('Outofstocknotification/general/stocklimit_apptha_outofstock_mail');\r\n\r\n $orderIds = $observer->getData('order_ids');\r\n foreach ($orderIds as $_orderId) {\r\n $order = Mage::getModel('sales/order')->load($_orderId);\r\n $items = $order->getAllItems();\r\n foreach ($items as $itemId => $item) {\r\n $ids[] = $item->getProductId();\r\n }\r\n }\r\n\r\n foreach ($ids as $pid) {\r\n\r\n $products = Mage::getModel('catalog/product')->load($pid);\r\n\r\n $producttype = $products->getTypeId();\r\n\r\n if ($producttype == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) { // check if product is configurable\r\n $flag = 1;\r\n } else {\r\n $flag = 0;\r\n }\r\n\r\n\r\n $qty = $products->getStockItem()->getQty();\r\n\r\n if ($thresholdQty >= $qty && $flag != 1) {\r\n\r\n $emailTemplateVariables = array();\r\n\r\n $emailTemplateVariables['productName'] = $products->getName();\r\n $emailTemplateVariables['productPrice'] = $currency_symbol . $products->getPrice();\r\n $emailTemplateVariables['productUrl'] = $products->getProductUrl();\r\n $emailTemplateVariables['productImg'] = $products->getImageUrl();\r\n $emailTemplateVariables['productQty'] = $qty;\r\n $emailTemplateVariables['thresholdQty'] = $thresholdQty;\r\n $emailTemplateVariables['productDesc'] = $products->getDescription();\r\n $marchentNotificationMailId = Mage::getStoreConfig('Outofstocknotification/outofstock_email/outofstock_sender_email_identity');\r\n $senderMailId = Mage::getStoreConfig(\"trans_email/ident_$marchentNotificationMailId/email\");\r\n $senderName = Mage::getStoreConfig(\"trans_email/ident_$marchentNotificationMailId/name\");\r\n $templeId = (int) Mage::getStoreConfig('Outofstocknotification/general/outofstock_admin_template');\r\n\r\n //if it is user template then this process is continue\r\n if ($templeId) {\r\n $emailTemplate = Mage::getModel('core/email_template')->load($templeId);\r\n } else { // we are calling default template\r\n $emailTemplate = Mage::getModel('core/email_template')\r\n ->loadDefault('Outofstocknotification_general_outofstock_admin_template');\r\n }\r\n\r\n $emailTemplateVariables['storeName'] = Mage::getStoreConfig(\"general/store_information/name\");\r\n $emailTemplateVariables['siteLink'] = Mage::getBaseUrl();\r\n\r\n $toMailId = $senderMailId;\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\r\n $emailTemplate->setSenderName($senderName); //mail sender name\r\n $emailTemplate->setSenderEmail($senderMailId); //mail sender email id\r\n $emailTemplate->setTemplateSubject('Out of stock Notification from ' . $emailTemplateVariables['storeName']);\r\n $emailTemplate->setDesignConfig(array('area' => 'frontend'));\r\n $processedTemplate = $emailTemplate->getProcessedTemplate($emailTemplateVariables); //it return the temp body\r\n\t\t\t\t\t\r\n $emailTemplate->send($toMailId, $senderName, $emailTemplateVariables); //send mail to admin email ids\r\n }\r\n }\r\n }\r\n }",
"function update_price($symbol = null) {\n\n $whereCondition = \"WHERE user_id = \".$this->user->user_id.\" AND symbol = '\".$symbol.\"';\";\n DB::instance(DB_NAME)->update(\"transactions\", $_POST, $whereCondition);\n\n }",
"protected function sendOrderChangeNotification()\n {\n if ($this->getSendNotificationFlag()) {\n \\XLite\\Core\\Mailer::getInstance()->sendOrderAdvancedChangedCustomer($this->getOrder());\n }\n }",
"function save_config()\n\t{\n\t\t$pop3=post_param_integer('pop3',-1);\n\t\tif ($pop3!=-1)\n\t\t{\n\t\t\t$dpop3=post_param('dpop3');\n\t\t\t$GLOBALS['SITE_DB']->query_insert('prices',array('name'=>'pop3_'.$dpop3,'price'=>$pop3));\n\t\t\tlog_it('POINTSTORE_ADD_MAIL_POP3',$dpop3);\n\t\t}\n\t\t$this->_do_price_mail();\n\t}",
"function update_portfolio_event_handler($values, $action) {\n $portfolio = load_portfolio_array();\n $existing_record = portfolio_record_lookup($portfolio, $values[\"lookupSymbol\"]);\n \n switch ($action){\n case \"buy\":\n if(isset($existing_record)) {\n // Update existing record in portfolio\n $existing_record[\"quantity\"] = $existing_record[\"quantity\"] + $values[\"quantity\"];\n $existing_record[\"price_paid\"] = $values[\"lookupAsk\"];\n save_portfolio($portfolio, $existing_record, $values[\"lookupSymbol\"]);\n } else {\n // Set new record to portfolio\n $portfolio_record = array('symbol' => $values[\"lookupSymbol\"],\n 'name' => $values[\"lookupName\"],\n 'quantity' => $values[\"quantity\"],\n 'price_paid' => $values[\"lookupAsk\"]);\n save_portfolio($portfolio, $portfolio_record);\n }\n\t set_message(AlertType::Success, \"You successfuly bought \" . $values[\"quantity\"] . \" \" . $values[\"lookupName\"] .\" shares.\");\n break;\n case \"sell\":\n // Update existing record in portfolio\n $existing_record[\"quantity\"] = $existing_record[\"quantity\"] - $values[\"quantity\"];\n save_portfolio($portfolio, $existing_record, $values[\"lookupSymbol\"]);\n\t set_message(AlertType::Success, \"You successfuly sold \" . $values[\"quantity\"] . \" \" . $values[\"lookupName\"] .\" shares.\");\n break;\n }\n}",
"public function notifyTransferedPlayers(){\n \n Service::loadModels('rally', 'rally');\n $peopleService = parent::getService('people','people');\n $carService = parent::getService('car','car');\n $teamService = parent::getService('team','team');\n $marketService = parent::getService('market','market');\n $notificationService = parent::getService('user','notification');\n \n /*\n * Players\n */\n $offersNoBid = $marketService->getFinishedOffersNotNotifiedNoBid();\n foreach($offersNoBid as $offerNoBid):\n $notificationService->addNotification($offerNoBid['Player']['first_name'].\" \".$offerNoBid['Player']['last_name'].\" was not sold. Player will return to your team tomorrow\",3,$offerNoBid['Team']['User']['id']);\n $offerNoBid->set('notified',1);\n $offerNoBid->save();\n endforeach;\n \n $offers = $marketService->getFinishedOffersNotNotified();\n // 1. Zaplacenie za transfer przez kupujacego\n \n foreach($offers as $offer): \n foreach($offer['Bids'] as $key => $bid){\n if($key==0){\n $notificationService->addNotification($offer['Player']['first_name'].\" \".$offer['Player']['last_name'].\" was successfully sold. Player will leave your team tomorrow\",3,$offer['Team']['User']['id']);\n $notificationService->addNotification($offer['Player']['first_name'].\" \".$offer['Player']['last_name'].\" has been bought. Player will join your team tomorrow\",3,$bid['Team']['User']['id']);\n }\n else{\n $notificationService->addNotification($offer['Player']['first_name'].\" \".$offer['Player']['last_name'].\" has not been bought.\",3,$bid['Team']['User']['id']);\n }\n } \n \n \n $offer->set('notified',1);\n $offer->save();\n endforeach;\n /*\n * Cars\n */\n \n $caroffersNoBid = $marketService->getFinishedCarOffersNotMovedNoBid();\n foreach($caroffersNoBid as $offerNoBid):\n $notificationService->addNotification($offerNoBid['Car']['name'].\" was not sold. The car will return to your team tomorrow\",3,$offerNoBid['Team']['User']['id']);\n $offerNoBid->set('notified',1);\n $offerNoBid->save();\n endforeach;\n \n $caroffers = $marketService->getFinishedCarOffersNotMoved();\n // 1. Zaplacenie za transfer przez kupujacego\n // 2. OTrzymanie kasy przez sprzedajacego\n // 3. Zmiana teamu przez kupujacego\n // 4. Ustawienie oferty na player_moved\n foreach($caroffers as $offer):\n foreach($offer['Bids'] as $key => $bid){\n if($key==0){\n $notificationService->addNotification($offer['Car']['name'].\" was successfully sold. The car will leave your team tomorrow\",3,$offer['Team']['User']['id']);\n $notificationService->addNotification($offer['Car']['name'].\" has been bought. The car will join your team tomorrow\",3,$bid['Team']['User']['id']);\n }\n else{\n $notificationService->addNotification($offer['Car']['name'].\" has not been bought.\",3,$bid['Team']['User']['id']);\n }\n }\n $offer->set('notified',1);\n $offer->save();\n endforeach;\n \n echo \"done\";exit;\n }",
"public function executeAdminNotify()\n {\n if ( in_array( $this->getParameter( 'option_name' ), array( 'bookly_sms_notify_low_balance', 'bookly_sms_notify_weekly_summary' ) ) ) {\n update_option( $this->getParameter( 'option_name' ), $this->getParameter( 'value' ) );\n }\n wp_send_json_success();\n }",
"function shipPriceAccepted($id,$logisticportalid,$prepriceid) {\n global $objGeneral;\n global $objCore;\n $arrColumnUpdate = array('pricestatus' => 1);\n $varUsersWhere = \" pkpriceid ='\" . $id . \"'\";\n $this->update(TABLE_ZONEPRICE, $arrColumnUpdate, $varUsersWhere);\n // pre($logisticportalid);\n $arrLogisticdetails = $objGeneral->GetCompleteDetailsofLogisticPortalbyid($logisticportalid);\n $logistictitle = $arrLogisticdetails[0]['logisticTitle'];\n $logisticmailid = $arrLogisticdetails[0]['logisticEmail'];\n if($prepriceid==0)\n {\n $editedmessage='';\n }\n else\n {\n $editedmessage='This value will be applied after 24 hours'; \n }\n \n if ($_SERVER[HTTP_HOST] != '192.168.100.97') {\n //Send Mail To User\n $varPath = '<img src=\"' . SITE_ROOT_URL . 'common/images/logo.png' . '\"/>';\n $varToUser = $logisticmailid;\n $varFromUser = SITE_EMAIL_ADDRESS;\n $sitelink = SITE_ROOT_URL . 'logistic/';\n $varSubject = SITE_NAME . ':Price Apporval';\n $varBody = '\n \t\t<table width=\"700\" cellspacing=\"0\" cellpadding=\"5\" border=\"0\">\n\t\t\t\t\t\t\t <tbody>\n\t\t\t\t\t\t\t <tr>\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t <td width=\"600\" style=\"padding-left:10px;\">\n\t\t\t\t\t\t\t <p>\n\t\t\t\t\t\t\tWelcome! <br/><br/>\n\t\t\t\t\t\t\t<strong>Dear ' . $logistictitle . ',</strong>\n\t\t\t\t\t\t\t <br />\n\t\t\t\t\t\t\t <br />\n\t\t\t\t\t\t\tWe are pleased to inform about your Zone Price Apporval. '.$editedmessage.' \n\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t <br /><br />\n\t\t\t\t\t\t\tIf there is anything that we can do to enhance your Tela Mela experience, please feel free to <a href=\"{CONTACT_US_LINK}\">contact us</a>.\n\t\t\t\t\t\t\t<br/><br/>\n\t\t\t\t\t\t\t </p>\n\t\t\t\t\t\t\t </td>\n\t\t\t\t\t\t\t </tr>\n\t\t\t\t\t\t\t </tbody>\n\t\t\t\t\t\t\t </table>\n \t\t';\n// $varOutput = file_get_contents(SITE_ROOT_URL . 'common/email_template/html/admin_user_registration.html');\n// $varUnsubscribeLink = 'Click <a href=\"' . SITE_ROOT_URL . 'unsubscribe.php?user=' . md5($argArrPost['frmUserEmail']) . '\" target=\"_blank\">here</a> to unsubscribe.';\n// $varActivationLink = '';\n// $arrBodyKeywords = array('{USER}', '{USER_NAME}', '{PASSWORD}', '{EMAIL}', '{ROLE}', '{SITE_NAME}', '{ACTIVATION_LINK}', '{IMAGE_PATH}', '{UNSUBSCRIBE_LINK}');\n// $arrBodyKeywordsValues = array(trim(stripslashes($argArrPost['frmName'])), trim(stripslashes($argArrPost['frmName'])), trim($argArrPost['frmPassword']), trim(stripslashes($argArrPost['frmUserEmail'])), 'Country Portal', SITE_NAME, $varActivationLink, $varPath); //,$varUnsubscribeLink\n// $varBody = str_replace($arrBodyKeywords, $arrBodyKeywordsValues, $varOutput);\n $objCore->sendMail($varToUser, $varFromUser, $varSubject, $varBody);\n $_SESSION['sessArrUsers'] = '';\n }\n //return all record\n return 1;\n }",
"function setPrice($new_price)\n {\n $this->price = $new_price;\n }",
"public function actionUpdateProductBuyBoxPrice()\n {\n $userData = User::find()->andWhere(['IS NOT', 'u_mws_seller_id', null])->all();\n\n foreach ($userData as $user) {\n $productData = FbaAllListingData::find()->andWhere(['created_by' => $user->u_id])->all();\n $skuData = AppliedRepriserRule::find()->select(['arr_sku'])->where(['arr_user_id' => $userData->u_id])->column();\n\n foreach ($productData as $product) {\n $productBuyBox = \\Yii::$app->api->getProductCompetitivePrice($product->seller_sku);\n $product->buybox_price = $productBuyBox;\n\n if(in_array($product->seller_sku, $skuData)) {\n $magicPrice = \\Yii::$app->api->getMagicRepricerPrice($product->seller_sku, $productBuyBox, $product->repricing_min_price, $product->repricing_max_price, $product->repricing_rule_id);\n if($magicPrice) {\n $product->repricing_cost_price = $magicPrice;\n }\n }\n\n if ($product->save(false)) {\n echo $product->asin1 . \" is Updated.\";\n }\n sleep(2);\n }\n sleep(1);\n }\n }",
"private function sendNotification(Application $app){\n }"
]
| [
"0.6518792",
"0.6212048",
"0.61338615",
"0.6123155",
"0.60680443",
"0.6008338",
"0.58618057",
"0.5824372",
"0.5818815",
"0.5778821",
"0.5776055",
"0.57625306",
"0.5730447",
"0.57062584",
"0.570339",
"0.5668887",
"0.5643146",
"0.5637972",
"0.56082284",
"0.5594886",
"0.559207",
"0.55642056",
"0.554976",
"0.5531105",
"0.55169594",
"0.55025125",
"0.5494754",
"0.54946995",
"0.54929066",
"0.54719514"
]
| 0.66332924 | 0 |
Create location change notification message | function create_location_change_message($user_id, $device_token, $latitude, $longitude, $distance) {
$notification_array = array(
'title' => 'Location Change Alert',
'message' => 'You are out of the preferred location. Please change the location to get more alerts.',
'latitude' => $latitude,
'longitude' => $longitude,
'distance' => $distance,
'is_special' => '0',
'is_location_message' => '1',
'is_location_near_message' => '0',
'store_id' => '',
'product_id' => '',
'retailer_id' => '',
'store_type_id' => ''
);
send_push_notification_location($notification_array, $user_id, $device_token);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function showNoticeLocation()\n {\n $id = $this->notice->id;\n\n $location = $this->notice->getLocation();\n\n if (empty($location)) {\n return;\n }\n\n $name = $location->getName();\n\n $lat = $this->notice->lat;\n $lon = $this->notice->lon;\n $latlon = (!empty($lat) && !empty($lon)) ? $lat.';'.$lon : '';\n\n if (empty($name)) {\n $latdms = $this->decimalDegreesToDMS(abs($lat));\n $londms = $this->decimalDegreesToDMS(abs($lon));\n // TRANS: Used in coordinates as abbreviation of north.\n $north = _('N');\n // TRANS: Used in coordinates as abbreviation of south.\n $south = _('S');\n // TRANS: Used in coordinates as abbreviation of east.\n $east = _('E');\n // TRANS: Used in coordinates as abbreviation of west.\n $west = _('W');\n $name = sprintf(\n // TRANS: Coordinates message.\n // TRANS: %1$s is lattitude degrees, %2$s is lattitude minutes,\n // TRANS: %3$s is lattitude seconds, %4$s is N (north) or S (south) depending on lattitude,\n // TRANS: %5$s is longitude degrees, %6$s is longitude minutes,\n // TRANS: %7$s is longitude seconds, %8$s is E (east) or W (west) depending on longitude,\n _('%1$u°%2$u\\'%3$u\"%4$s %5$u°%6$u\\'%7$u\"%8$s'),\n $latdms['deg'],$latdms['min'], $latdms['sec'],($lat>0? $north:$south),\n $londms['deg'],$londms['min'], $londms['sec'],($lon>0? $east:$west));\n }\n\n $url = $location->getUrl();\n\n $this->out->text(' ');\n $this->out->elementStart('span', array('class' => 'location'));\n // TRANS: Followed by geo location.\n $this->out->text(_('at'));\n $this->out->text(' ');\n if (empty($url)) {\n $this->out->element('abbr', array('class' => 'geo',\n 'title' => $latlon),\n $name);\n } else {\n $xstr = new XMLStringer(false);\n $xstr->elementStart('a', array('href' => $url,\n 'rel' => 'external'));\n $xstr->element('abbr', array('class' => 'geo',\n 'title' => $latlon),\n $name);\n $xstr->elementEnd('a');\n $this->out->raw($xstr->getString());\n }\n $this->out->elementEnd('span');\n }",
"function create_location_nearby_message($user_id, $device_token, $nearby_store_data) {\n\n $notification_array = array(\n 'title' => 'Nearby Store Alert',\n 'message' => 'You are near to store: ' . $nearby_store_data['StoreName'] . '. ' . $nearby_store_data['SpecialCount'] . ' specials are available here.',\n 'latitude' => $nearby_store_data['Latitude'],\n 'longitude' => $nearby_store_data['Longitude'],\n 'distance' => $nearby_store_data['CurrentDistance'],\n 'is_special' => '0',\n 'is_location_message' => '0',\n 'is_location_near_message' => '1',\n 'store_id' => '',\n 'product_id' => '',\n 'retailer_id' => '',\n 'store_type_id' => ''\n );\n send_push_notification_location($notification_array, $user_id, $device_token, 1); //final attr is to identify that the request is for near by store\n}",
"private function notify_on_update($meet, $location)\n {\n $subject = 'Shackmeet Updated - ' . $meet->title;\n $body = $this->build_update_message($meet, $location);\n \n $this->notify_attendees($meet, 2, $subject, $body);\n }",
"function makePayload($lat, $lng, $from_number, $error) {\n // Create the payload body\n $body['aps'] = array(\n 'type' => 'deviceupdate',\n 'alert' => 'You have received a location update in Phonar',\n 'sound' => 'default',\n 'location' => array($lat, $lng),\n 'device' => $from_number,\n 'error' => $error\n );\n return json_encode($body);\n}",
"public function updated_message() {\n\t\t$tab = Template::current_tab();\n\n\t\t// Show updated notice.\n\t\tadd_action( 'beehive_admin_top_notices', function () use ( $tab ) {\n\t\t\tswitch ( $tab ) {\n\t\t\t\tcase 'tracking':\n\t\t\t\t\t$this->notice( __( 'Tracking ID updated successfully.', 'ga_trans' ), 'success', true );\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\t$this->notice( __( 'Changes were saved successfully.', 'ga_trans' ), 'success', true );\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t} );\n\t}",
"function wp_site_admin_email_change_notification($old_email, $new_email, $option_name)\n {\n }",
"function wp_network_admin_email_change_notification($option_name, $new_email, $old_email, $network_id)\n {\n }",
"public function notification();",
"public function notification();",
"private function _sendLocationCreateEmail ($location, $data)\n {\n $subject = \"Location #\" . $location->id . ' ( ' . $data['name'] . ' ) was added from API';\n $msg = <<<TEXT\n<div>\n Location {$location->id} was just added/modified on the\n MDM using the API with the following info:\n</div>\n<ul>\n <li>Location Name: {$data['name']}</li> \n <li>Address : {$data['address1']}</li> \n <li>City : {$data['city']}</li> \n <li>Country : {$data['country']}</li>\n <li>ZipCode : {$data['zipcode']}</li>\n</ul>\nTEXT;\n EmailQueueComponent::queueEmail('[email protected]', 'Info', '[email protected]', 'AM', $subject, $msg);\n }",
"public function showUpdateNotification(){\n\t\techo $this->getUpdateNotification();\n\t}",
"public function getCustomerNoteNotify();",
"public function testAPIUpdateMonitoredAddress() {\n $sample_user = $this->app->make('\\UserHelper')->createSampleUser();\n\n $helper = $this->app->make('\\MonitoredAddressHelper');\n $created_address = $helper->createSampleMonitoredAddress($sample_user);\n $update_vars = [\n 'monitorType' => 'send',\n 'active' => false,\n ];\n $api_tester = $this->getAPITester();\n $loaded_address_from_api = $api_tester->testUpdateResource($created_address, $update_vars);\n PHPUnit::assertEquals(false, $loaded_address_from_api['active']);\n\n $update_vars = [\n 'webhookEndpoint' => 'http://xchain.tokenly.dev/notifyme2',\n ];\n $api_tester = $this->getAPITester();\n $loaded_address_from_api = $api_tester->testUpdateResource($created_address, $update_vars);\n PHPUnit::assertEquals('http://xchain.tokenly.dev/notifyme2', $loaded_address_from_api['webhookEndpoint']);\n }",
"private function add_timezone_notice() {\n\t\tif ( ! class_exists( 'Yoast_Notification_Center' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t$notification_message = sprintf(\n\t\t\t/* translators: %1$s resolves to the opening tag of the link to the general settings page, %1$s resolves to the closing tag for the link */\n\t\t\t__( 'Your timezone settings should reflect your real timezone, not a UTC offset, please change this on the %1$sGeneral Settings page%2$s.', 'wordpress-seo-news' ),\n\t\t\t'<a href=\"' . esc_url( admin_url( 'options-general.php' ) ) . '\">',\n\t\t\t'</a>'\n\t\t);\n\n\t\t$notification_options = array(\n\t\t\t'type' => Yoast_Notification::ERROR,\n\t\t\t'id' => 'wpseo-news_timezone_format_empty',\n\t\t);\n\n\t\t$timezone_notification = new Yoast_Notification( $notification_message, $notification_options );\n\n\t\t$notification_center = Yoast_Notification_Center::get();\n\n\t\tif ( get_option( 'timezone_string' ) === '' ) {\n\t\t\t$notification_center->add_notification( $timezone_notification );\n\t\t}\n\t\telse {\n\t\t\t$notification_center->remove_notification( $timezone_notification );\n\t\t}\n\t}",
"public function buildChangedMessage() {\n\t\t\tvar_dump(array_diff($this->data, $this->original_data));\n\t\t\t$message = array();\n\t\t\t$this->changed_message = implode(' ', $message);\n\t\t}",
"public function editMessageLiveLocation($chat_id=null,$message_id=null,$inline_message_id=null,$latitude,$longitude,$reply_markup=null){\n return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());\n }",
"public function sendLocation($chat_id,$latitude,$longitude,$reply_to_message_id=null,$reply_markup=null,$live_period=null,$disable_notification=null){\n return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());\n }",
"private function notify_on_add($meet, $location)\n { \n $subject = 'Shackmeet Announcement - ' . $meet->title;\n $body = $this->build_create_message($meet, $location);\n \n $notification_users = $this->load_users_to_notify();\n \n foreach ($notification_users as $user)\n {\n // Prevent shackmessages from being sent to yourself. Unless you're me. I get all the shackmessages.\n if ($user['username'] == $this->current_user->username && $user['username'] != 'omnova') \n continue;\n \n if ($user['notify_option'] == 2 || ($user['notify_option'] == 1 && $this->eligible_for_notification($user['latitude'], $user['longitude'], $location->latitude, $location->longitude, $user['notify_max_distance'])))\n { \n // Insert SM message into the queue\n if ($user['notify_shackmessage'] == 1)\n {\n $message = Model::factory('message_queue');\n $message->message_type_id = 1;\n $message->message_recipients = $user['username'];\n $message->message_subject = $subject;\n $message->message_body = $body;\n $message->meet_id = $meet->meet_id;\n $message->notification_reason_id = 1;\n $message->insert(); \n }\n \n // Insert email message into the queue\n if ($user['notify_email'] == 1)\n {\n $message = Model::factory('message_queue');\n $message->message_type_id = 2;\n $message->message_recipients = $user['email_address'];\n $message->message_subject = $subject;\n $message->message_body = $body;\n $message->meet_id = $meet->meet_id;\n $message->notification_reason_id = 1;\n $message->insert();\n }\n }\n }\n }",
"function addNameChange($from, $to)\r\n{\r\n\tglobal $A; // Activity object\r\n\t$A->changeName($from, $to);\r\n\r\n\tif (LACE_SHOW_NAME_CHANGE)\r\n\t{\r\n\t\t$message = array\r\n\t\t(\r\n\t\t\t'action' => true,\r\n\t\t\t'time' => time(),\r\n\t\t\t'name' => 'Lace',\r\n\t\t\t'text' => '<strong>'.$from.'</strong> is now <strong>'.$to.'</strong>',\r\n\t\t);\r\n\r\n\t\taddMessage($message);\r\n\t}\r\n}",
"function update_right_now_message()\n {\n }",
"function update_messages( $event_messages ) {\n\t\tglobal $post, $post_ID;\n\t\t\n\t\t/* Set some simple messages for editing slides, no post previews needed. */\n\t\t$event_messages['event'] = array( \n\t\t\t0\t=> '',\n\t\t\t1\t=> 'Event updated.',\n\t\t\t2\t=> 'Custom field updated.',\n\t\t\t2\t=> 'Custom field deleted.',\n\t\t\t4\t=> 'Event updated.',\n\t\t\t5\t=> isset($_GET['revision']) ? sprintf( 'Event restored to revision from %s', wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,\n\t\t\t6\t=> 'Event added to calendar.',\n\t\t\t7\t=> 'Event saved.',\n\t\t\t8\t=> 'Event added to calendar.',\n\t\t\t9\t=> sprintf( 'Event scheduled for: <strong>%1$s</strong>.' , strtotime( $post->post_date ) ),\n\t\t\t10\t=> 'Event draft updated.',\n\t\t);\n\t\treturn $event_messages;\n\t}",
"public static function getNewNotificationURL() {\n return admin_url().'admin.php?page=set-notification';\n }",
"private function notifyORS() {\r\n require_once('classes/tracking/notifications/Notifications.php');\r\n require_once('classes/tracking/notifications/ORSNotification.php');\r\n\r\n $piDetails = $this->getPIDisplayDetails();\r\n $piName = $piDetails['firstName'] . \" \" . $piDetails['lastName'];\r\n\r\n $subject = sprintf('[TID-%s] Tracking form submitted online [%s]', $this->trackingFormId, $piName);\r\n $emailBody = sprintf('A tracking form was submitted online :\r\n\r\nTracking ID : %s\r\nTitle : \"%s\"\r\nPrincipal Investigator : %s\r\nDepartment : %s\r\n\r\n', $this->trackingFormId, $this->projectTitle, $piName, $piDetails['departmentName']);\r\n\r\n $ORSNotification = new ORSNotification($subject, $emailBody);\r\n try {\r\n $ORSNotification->send();\r\n } catch(Exception $e) {\r\n printf('Error: Unable to send email notification to ORS : '. $e);\r\n }\r\n }",
"public function toString()\n {\n return 'Mapping Locations - Success message is displayed.';\n }",
"public function passwordChange($observer)\n{\n\n $settings = Mage::helper('smsnotifications/data')->getSettings();\n $customer = $observer->getEvent()->getCustomer();\n $fname=$customer->getFirstname();\n $lname=$customer->getLastname();\n $email= $customer->getEmail();\n $telephone= $customer->getAddressesCollection()->getFirstitem()->getTelephone();\n if ($telephone) {\n $text = Mage::getStoreConfig('smsnotifications/customer_notification/change_password');\n $text = str_replace('{{firstname}}', $fname, $text);\n $text = str_replace('{{lastname}}', $lname, $text);\n $text = str_replace('{{emailid}}', $email, $text);\n // $text = str_replace('{{name}}', $customer_name, $text);\n }\n array_push($settings['order_noficication_recipients'], $telephone);\n $result = Mage::helper('smsnotifications/data')->sendSms($text, $settings['order_noficication_recipients']);\n return $this;\n}",
"function send_push_notification_location($notification_array, $user_id, $device_token, $store_near = 0) {\n $CI = &get_instance();\n $can_send = TRUE;\n// if($store_near === 0){ \n// if ($this -> session -> userdata('location_notification_send_time')) {\n// $start = date_create($this -> session -> userdata('location_notification_send_time'));\n// $end = date_create(date('Y-m-d H:i:s'));\n// $diff = date_diff($end, $start);\n// if ($diff['h'] >= LOCATION_NOTIFICATION_DELAY) {\n// $can_send = TRUE;\n// }\n// }\n// else {\n// $can_send = TRUE;\n// }\n// }\n// else{\n// if ($this -> session -> userdata('nearby_notification_send_time')) {\n// $start = date_create($this -> session -> userdata('nearby_notification_send_time'));\n// $end = date_create(date('Y-m-d H:i:s'));\n// $diff = date_diff($end, $start);\n// if ($diff['i'] >= NEARBY_NOTIFICATION_DELAY) {\n// $can_send = TRUE;\n// }\n// }\n// else {\n// $can_send = TRUE;\n// }\n// }\n\n\n if ($can_send) {\n if ($store_near === 0) {\n $CI -> session -> set_userdata('location_notification_send_time', date('Y-m-d H:i:s')); //setting the time when the latest notification sent\n }\n else {\n $CI -> session -> set_userdata('nearby_notification_send_time', date('Y-m-d H:i:s')); //setting the time when the latest nearby notification sent\n }\n\n $url = FCM_ANDROID_URL;\n $priority = \"high\";\n $fields = array(\n 'registration_ids' => array($device_token),\n 'data' => $notification_array\n );\n $headers = array(\n 'Authorization:key=AIzaSyBOND37d4v7orU3XkUQBBmQvoWaR5CXf7Q',\n 'Content-Type: application/json'\n );\n $ch = curl_init();\n curl_setopt($ch, CURLOPT_URL, $url);\n curl_setopt($ch, CURLOPT_POST, true);\n curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);\n curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);\n curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));\n $result = curl_exec($ch);\n //echo curl_error($ch);\n if ($result === FALSE) {\n //die('Curl failed: ' . curl_error($ch));\n }\n else {\n remove_nonregistered_device_tokens($result, array($device_token));\n }\n curl_close($ch);\n //echo $result;\n $CI -> notificationmodel -> save_notification_history(json_encode($fields), $result, $user_id);\n }\n}",
"public function welcome_save_message() {\n global $OUTPUT;\n\n $a = get_string('sharinglevel', 'mod_surveypro');\n $message = get_string('welcome_utemplatesave', 'mod_surveypro', $a);\n echo $OUTPUT->notification($message, 'notifymessage');\n }",
"function setDetailsUpdatedMessage($appointmentData)\n\t{\n\t\t$stylistName = $appointmentData[0]['stylistName'];\n\t\t$serviceName = $appointmentData[0]['serviceName'];\n\t\t$appointmentDate = $appointmentData[0]['appointmentDate'];\n\t\t$startTime = $appointmentData[0]['startTime'];\n\t\t$this->email = $appointmentData[0]['email'];\n\t\t\n\t\t$this->message = JText::sprintf('COM_SALONBOOK_EMAIL_BODY_DETAILS_UPDATED', $serviceName, $stylistName, $appointmentDate, date('g:i a', $startTime));\n\t\t$this->mailer->setBody($this->message);\t\t\n\t}",
"function my_updated_registration_messages( $coz_registry_messages ) {\n\tglobal $post, $post_ID;\n\t$review_messages['coz_registry'] = array(\n\t\t0 => '', \n\t\t1 => sprintf( 'Registration updated. <a href=\"%s\">View Registration</a>', esc_url( get_permalink($post_ID) ) ),\n\t\t2 => 'Custom field updated.',\n\t\t3 => 'Custom field deleted.',\n\t\t4 => 'Registration updated.',\n\t\t5 => isset($_GET['revision']) ? sprintf( 'Registration restored to revision from %s', wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,\n\t\t6 => sprintf( 'Registration published. <a href=\"%s\">View Registration</a>', esc_url( get_permalink($post_ID) ) ),\n\t\t7 => 'Registration saved.',\n\t\t8 => sprintf( 'Registration submitted. <a target=\"_blank\" href=\"%s\">Preview Registration</a>', esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),\n\t\t9 => sprintf( 'Registration scheduled for: <strong>%1$s</strong>. <a target=\"_blank\" href=\"%2$s\">Preview Registration</a>', date_i18n( 'M j, Y @ G:i' , strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ),\n\t\t10 => sprintf( 'Registration draft updated. <a target=\"_blank\" href=\"%s\">Preview Registration</a>', esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),\n\t);\n\treturn $review_messages; \n}",
"function rh_gmw_fl_update_location() {\n global $wpdb;\n parse_str($_POST['formValues'], $location);\n $usergetid = (!empty($_POST['usergetid'])) ? $_POST['usergetid'] : '';\n $userid = ($usergetid) ? $usergetid : get_current_user_id();\n $location['gmw_map_icon'] = ( isset($location['gmw_map_icon']) ) ? $location['gmw_map_icon'] : '_default.png';\n $location = apply_filters('gmw_fl_location_before_updated', $location, $userid);\n if ( $wpdb->replace('wppl_friends_locator', array(\n 'member_id' => $userid,\n 'street_number' => $location['gmw_street_number'],\n 'street_name' => $location['gmw_street_name'],\n 'street' => $location['gmw_street'],\n 'apt' => $location['gmw_apt'],\n 'city' => $location['gmw_city'],\n 'state' => $location['gmw_state'],\n 'state_long' => $location['gmw_state_long'],\n 'zipcode' => $location['gmw_zipcode'],\n 'country' => $location['gmw_country'],\n 'country_long' => $location['gmw_country_long'],\n 'address' => $location['gmw_address'],\n 'formatted_address' => $location['gmw_formatted_address'],\n 'lat' => $location['gmw_lat'],\n 'long' => $location['gmw_long'],\n 'map_icon' => $location['gmw_map_icon']\n ) ) === FALSE ) :\n echo __( 'There was a problem saving your location.', 'rehub_framework' );\n else :\n echo __( 'Location successfully saved!', 'rehub_framework' );\n do_action( 'gmw_fl_after_location_saved', $userid, $location );\n endif;\n die();\n}"
]
| [
"0.58110785",
"0.5752141",
"0.5654719",
"0.54998213",
"0.53405035",
"0.53264284",
"0.5291446",
"0.52883244",
"0.52883244",
"0.5213636",
"0.518438",
"0.51799464",
"0.517806",
"0.51536566",
"0.51158094",
"0.50687534",
"0.5055135",
"0.5051269",
"0.50446486",
"0.501496",
"0.49730375",
"0.49255887",
"0.49213278",
"0.4918223",
"0.49128637",
"0.48797303",
"0.4879269",
"0.48760393",
"0.4872085",
"0.48667186"
]
| 0.7608566 | 0 |
Function to send the notification if the user is near to the store | function create_location_nearby_message($user_id, $device_token, $nearby_store_data) {
$notification_array = array(
'title' => 'Nearby Store Alert',
'message' => 'You are near to store: ' . $nearby_store_data['StoreName'] . '. ' . $nearby_store_data['SpecialCount'] . ' specials are available here.',
'latitude' => $nearby_store_data['Latitude'],
'longitude' => $nearby_store_data['Longitude'],
'distance' => $nearby_store_data['CurrentDistance'],
'is_special' => '0',
'is_location_message' => '0',
'is_location_near_message' => '1',
'store_id' => '',
'product_id' => '',
'retailer_id' => '',
'store_type_id' => ''
);
send_push_notification_location($notification_array, $user_id, $device_token, 1); //final attr is to identify that the request is for near by store
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function send_push_notification_location($notification_array, $user_id, $device_token, $store_near = 0) {\n $CI = &get_instance();\n $can_send = TRUE;\n// if($store_near === 0){ \n// if ($this -> session -> userdata('location_notification_send_time')) {\n// $start = date_create($this -> session -> userdata('location_notification_send_time'));\n// $end = date_create(date('Y-m-d H:i:s'));\n// $diff = date_diff($end, $start);\n// if ($diff['h'] >= LOCATION_NOTIFICATION_DELAY) {\n// $can_send = TRUE;\n// }\n// }\n// else {\n// $can_send = TRUE;\n// }\n// }\n// else{\n// if ($this -> session -> userdata('nearby_notification_send_time')) {\n// $start = date_create($this -> session -> userdata('nearby_notification_send_time'));\n// $end = date_create(date('Y-m-d H:i:s'));\n// $diff = date_diff($end, $start);\n// if ($diff['i'] >= NEARBY_NOTIFICATION_DELAY) {\n// $can_send = TRUE;\n// }\n// }\n// else {\n// $can_send = TRUE;\n// }\n// }\n\n\n if ($can_send) {\n if ($store_near === 0) {\n $CI -> session -> set_userdata('location_notification_send_time', date('Y-m-d H:i:s')); //setting the time when the latest notification sent\n }\n else {\n $CI -> session -> set_userdata('nearby_notification_send_time', date('Y-m-d H:i:s')); //setting the time when the latest nearby notification sent\n }\n\n $url = FCM_ANDROID_URL;\n $priority = \"high\";\n $fields = array(\n 'registration_ids' => array($device_token),\n 'data' => $notification_array\n );\n $headers = array(\n 'Authorization:key=AIzaSyBOND37d4v7orU3XkUQBBmQvoWaR5CXf7Q',\n 'Content-Type: application/json'\n );\n $ch = curl_init();\n curl_setopt($ch, CURLOPT_URL, $url);\n curl_setopt($ch, CURLOPT_POST, true);\n curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);\n curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);\n curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));\n $result = curl_exec($ch);\n //echo curl_error($ch);\n if ($result === FALSE) {\n //die('Curl failed: ' . curl_error($ch));\n }\n else {\n remove_nonregistered_device_tokens($result, array($device_token));\n }\n curl_close($ch);\n //echo $result;\n $CI -> notificationmodel -> save_notification_history(json_encode($fields), $result, $user_id);\n }\n}",
"function create_location_change_message($user_id, $device_token, $latitude, $longitude, $distance) {\n\n $notification_array = array(\n 'title' => 'Location Change Alert',\n 'message' => 'You are out of the preferred location. Please change the location to get more alerts.',\n 'latitude' => $latitude,\n 'longitude' => $longitude,\n 'distance' => $distance,\n 'is_special' => '0',\n 'is_location_message' => '1',\n 'is_location_near_message' => '0',\n 'store_id' => '',\n 'product_id' => '',\n 'retailer_id' => '',\n 'store_type_id' => ''\n );\n send_push_notification_location($notification_array, $user_id, $device_token);\n}",
"function mark_notification() {\n\t\tif ( check_ajax_referer( 'ht-dms', 'nonce' ) ) {\n\t\t\t$nID = pods_v_sanitized( 'nID', $_REQUEST );\n\t\t\t$value = ( pods_v( 'mark', $_REQUEST ) );\n\n\t\t\tif ( $nID && in_array( $value, array( 1, 0 ) ) ) {\n\t\t\t\t$id = ht_dms_notification_class()->viewed( $nID, null, $value );\n\n\t\t\t\tif ( $id == $nID ) {\n\t\t\t\t\twp_die( 1 );\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\twp_die( 0 );\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\t}",
"public static function checkForNearProductsAPI() {\n $request = app('request');\n $postCode = $request->header('user-pincode', '');\n $lat = $request->header('user-lat', '');\n $lng = $request->header('user-lng', '');\n if (!empty($postCode)\n && !empty($lat)\n && !empty($lng)\n ) {\n return true;\n }\n return false;\n }",
"public function linkNotification() {\n\n\n /*\n * \tWithin this function you should request the status of the transaction to get all transaction details, based on that information you should update the order and respond with a link\t\n */\n\n $return_url = substr(BASE_URL, 0, -12) . 'index.php';\n\n echo '<a href=\"' . $return_url . '\">Click here to return to the store.</a>';\n }",
"public static function checkForNearProducts() {\n $cartDeliveryPostcodeSessionKey = \\Config::get('appConstants.user_delivery_postcode_session_key');\n $landingPagePostcodeSessionKey = \\Config::get('appConstants.user_landing_postcode_session_key');\n $landingPostcode = session()->get($landingPagePostcodeSessionKey, '');\n $cartPostcode = session()->get($cartDeliveryPostcodeSessionKey, '');\n if (!empty($landingPostcode)\n || !empty($cartPostcode)\n ) {\n return true;\n }\n return false;\n }",
"public function isStoreOpen($store)\n {\n $now = Carbon::now();\n $day = $now->format('N');\n $storeDay = RestaurantWrokingDay::where('restaurant_id', $store->id)\n ->where('day_id', $day)\n ->where('available', 1)\n ->first();\n\n\n//if not available today\n if (!$storeDay) {\n $store->is_open =0;\n $open_days = $this->isOpenAt($store->id,$day);\n if($open_days != 'Permanently closed')\n { $store->day_id =$open_days[0]['day_id'];\n $store->open_time =$open_days[0]['open_time'];\n $store->close_time =$open_days[0]['close_time'];\n $store->open_at_time =$open_days[0]['open_text'];\n } else {\n $store->open_at_time = 'Permanently closed';\n \n }\n }\nelse {\n // Check store hours\n $store_open = Carbon::createFromFormat('H:i', $storeDay->open_time);\n $store_close = Carbon::createFromFormat('H:i', $storeDay->close_time);\n $when_open_day = $storeDay->day_id;\n $open_day_string = date('D', strtotime(\"Sunday +$when_open_day days\"));\n $store_open_time = $store_open->format('h:i a'); \n $open_time = $store_open->format('H:i'); \n $close_time = $store_close->format('H:i'); \n\n if ($now >= $store_open && $now <= $store_close) {\n $store->is_open=1;\n $store->open_at_time = $store_open_time;\n $store->day_id =$day;\n $store->open_time =$open_time;\n $store->close_time =$close_time;\n $store->open_at_time =$store_open_time;\n } \n \n else if($now < $store_open) // will open soon today\n\n {\n $store->is_open=0;\n $store->open_at_time = $store_open_time;\n $store->day_id =$day;\n $store->open_time =$open_time;\n $store->close_time =$close_time;\n $store->open_at_time =$store_open_time;\n\n } else\n\n {\n $store->is_open=0;\n $open_days = $this->isOpenAt($store->id,$day);\n $store->day_id =$open_days[0]['day_id'];\n $store->open_time =$open_days[0]['open_time'];\n $store->close_time =$open_days[0]['close_time'];\n $store->open_at_time =$open_days[0]['open_text'];\n }\n }\n\nreturn $store;\n }",
"public function isNeedToDelayPush($user_id);",
"function sendPushNotification($hotel)\n{\n /*here will integrate with the sdk or call api to send broadcast message\n to all users with new hotel data added\n and then call this function after successfully added new hotel*/\n}",
"function notify($fave, $notice, $user)\n {\n $other = User::staticGet('id', $notice->user_id);\n if ($other && $other->id != $user->id) {\n \t$otherProfile = $other->getProfile();\n if ($otherProfile->email && $otherProfile->emailnotifyfav) {\n mail_notify_fave($otherProfile, $user->getProfile(), $notice);\n }\n // XXX: notify by IM\n // XXX: notify by SMS\n }\n }",
"public function notifyUser()\n { \n $message = trim(Input::get('message'));\n $apiType = trim(Input::get('apiType'));\n $mobileNotificationService = App::make('MobileNotificationService');\n $mobileNotificationService->notifyMobileAppUser($message, $apiType, App::environment('production')); \n }",
"public function requestAcceptAction() {\r\n $notification = $this->_getParam('notification', 0);\r\n\t\t$is_suggestionExist = Engine_Api::_()->getItem('user', $notification->object_id);\r\n\t\tif( empty($is_suggestionExist) ) {\r\n\t\t\t// If user are not exist then we are deleting the \"User Request\" which loggden user are gettig.\r\n\t\t\tEngine_Api::_()->getDbtable('notifications', 'activity')->delete(array('notification_id = ?' => $notification->notification_id));\r\n\t\t\t$this->_helper->redirector->gotoRoute(array('route' => 'default'));\r\n\t\t}else {\r\n\t\t\t$this->view->notification = $notification;\r\n\t\t}\r\n }",
"public function notifyOwner()\n {\n global $config, $reefless, $account_info;\n\n $reefless->loadClass('Mail');\n\n $mail_tpl = $GLOBALS['rlMail']->getEmailTemplate(\n $config['listing_auto_approval']\n ? 'free_active_listing_created'\n : 'free_approval_listing_created'\n );\n\n if ($config['listing_auto_approval']) {\n $link = $reefless->getListingUrl(intval($this->listingID));\n } else {\n $myPageKey = $config['one_my_listings_page'] ? 'my_all_ads' : 'my_' . $this->listingType['Key'];\n $link = $reefless->getPageUrl($myPageKey);\n }\n\n $mail_tpl['body'] = str_replace(\n array('{username}', '{link}'),\n array(\n $account_info['Username'],\n '<a href=\"' . $link . '\">' . $link . '</a>',\n ),\n $mail_tpl['body']\n );\n $GLOBALS['rlMail']->send($mail_tpl, $account_info['Mail']);\n }",
"function sendNotificationToUsers($userTokens, $notification){\n $notification->sendNotification($userTokens, \"Answer some questions\", \"Don't forget to check out the new questionnaire today\");\n}",
"private function alertUsers()\n {\n User::query()->update(['is_sales_unread' => 1]);\n return true;\n }",
"public static function updateWhoIsOnline()\n {\n $users = User::all();\n foreach($users as $u)\n {\n $lastPing = $u->last_ping;\n $twoMinAgo = Carbon::now()->subMinutes(2);\n $result = Carbon::createFromFormat('Y-m-d H:i:s', $lastPing);\n\n if($twoMinAgo->lt($result))\n {\n $u->is_online = 1;\n $u->save();\n }\n else\n {\n $u->is_online = 0;\n $u->save();\n }\n }\n }",
"public function getNotifyAction() {\r\n $this->view->notification = $notification = $this->_getParam('notification', 0);\r\n $suggObj = Engine_Api::_()->getItem('suggestion', $notification->object_id);\r\n if (!empty($suggObj)) {\r\n\t\t\t$this->view->suggObj = $suggObj;\r\n\r\n if( strstr($suggObj->entity, \"sitereview\") ) {\r\n $getListingTypeId = Engine_Api::_()->getItem('sitereview_listing', $suggObj->entity_id)->listingtype_id;\r\n $getModId = Engine_Api::_()->suggestion()->getReviewModInfo($getListingTypeId);\r\n $modInfoArray = Engine_Api::_()->getApi('modInfo', 'suggestion')->getPluginDetailed(\"sitereview_\" . $getModId);\r\n $this->view->modInfoArray = $modInfoArray = $modInfoArray[\"sitereview_\" . $getModId];\r\n }else {\r\n $modInfoArray = Engine_Api::_()->getApi('modInfo', 'suggestion')->getPluginDetailed($suggObj->entity);\r\n $this->view->modInfoArray = $modInfoArray = $modInfoArray[$suggObj->entity];\r\n }\r\n \r\n if ($this->isModuleEnabled($modInfoArray['pluginName'])) {\r\n if ( $suggObj->entity == 'photo' ) {\r\n $modItemId = $suggObj->sender_id;\r\n } else {\r\n $modItemId = $suggObj->entity_id;\r\n }\r\n $modObj = Engine_Api::_()->getItem($modInfoArray['itemType'], $modItemId);\r\n\r\n\t// Check Sender exist on site or not.\r\n\t$isSenderExist= Engine_Api::_()->getItem('user', $suggObj->sender_id)->getIdentity();\r\n\tif( empty($isSenderExist) ) {\r\n\t Engine_Api::_()->getDbtable('suggestions', 'suggestion')->removeSuggestion($suggObj->entity, $suggObj->entity_id, $modInfoArray['notificationType']);\r\n\t $this->_helper->redirector->gotoRoute(array('route' => 'default'));\r\n\t $this->view->modObj = null;\r\n\t}\r\n\r\n\t// If Loggden user have \"Friend Suggestion\" Which already his friend then that friend suggestion should be delete.\r\n\tif( empty($modObj) || (( $suggObj->entity != 'photo' ) && ($modInfoArray['itemType'] == 'user') && !empty($modItemId)) ) {\r\n\t\t$is_user = Engine_Api::_()->getItem('user', $suggObj->entity_id)->getIdentity();\r\n\t\t$isFriend = Engine_Api::_()->getApi('coreFun', 'suggestion')->isMember($modItemId);\r\n\t\tif( empty($is_user) || !empty($isFriend) || empty($modObj) ) {\r\n\t\t Engine_Api::_()->getDbtable('suggestions', 'suggestion')->removeSuggestion($suggObj->entity, $suggObj->entity_id, $modInfoArray['notificationType']);\r\n\t\t $this->_helper->redirector->gotoRoute(array('route' => 'default'));\r\n\t\t $this->view->modObj = null;\r\n\t\t}\r\n\t}\r\n\r\n // It would be \"NULL\", If that entry already deleteed from the table.\r\n if (empty($modObj)) {\r\n Engine_Api::_()->getDbtable('suggestions', 'suggestion')->removeSuggestion($suggObj->entity, $suggObj->entity_id, $modInfoArray['notificationType']);\r\n $this->_helper->redirector->gotoRoute(array('route' => 'default'));\r\n $this->view->modObj = null;\r\n } else {\r\n\t\t\t\t\t$this->view->modObj = $modObj;\r\n $this->view->senderObj = $senderObj = Engine_Api::_()->getItem('user', $suggObj->sender_id);\r\n $this->view->sender_name = $this->view->htmlLink($senderObj->getHref(), $senderObj->displayname);\r\n }\r\n }else {\r\n\t$this->view->modNotEnable = true;\r\n }\r\n }else {\r\n\t\t\t// If suggestion are not available in \"Suggestion\" table but available in \"Notifications table\" then we are deleting from \"Notifications Table\".\r\n\t\t\tEngine_Api::_()->getDbtable('notifications', 'activity')->delete(array('notification_id = ?' => $notification->notification_id));\r\n\t\t\t$this->_helper->redirector->gotoRoute(array('route' => 'default'));\r\n\t\t}\r\n }",
"public function isNeedToSendPush($user_id);",
"public function trigger_notification()\n\t{\n \t\t\n\t\t $result=$this->Fb_common_func->send_notification($this->facebook,'Skywards meet me here!',array('100001187318347','1220631499','1268065008','1347427052','566769531'),'467450859982651|cf5YXgYRZZDJuvBF1_ZOyDyRJHM','100001187318347');\n\n\t echo $result;\n\t}",
"protected function gate()\n {\n Gate::define('viewNova', function ($user) {\n return in_array($user->email, [\n //\n ]);\n });\n }",
"public function checkobsolete()\n {\n $end_of_today = date(\"Y-m-d\");\n //count\n $server_obsolete_count = Serveros::where('notification', $end_of_today)->count();\n\n\n if ($server_obsolete_count >=1)\n {\n\n //if old auto send notification\n $servers_obsolete = Serveros::where('notification', $end_of_today)->get();\n foreach($servers_obsolete as $server_obsolete)\n {\n $server_os = $server_obsolete->server_os_id;\n $this->mailer($server_os);\n }\n }\n \n }",
"public function near(Address $address);",
"function wcfm_dokan_order_mark_shipped() {\r\n\t\tglobal $WCFM, $WCFMu, $woocommerce, $wpdb;\r\n\t\t\r\n\t\t$user_id = apply_filters( 'wcfm_current_vendor_id', get_current_user_id() );\r\n\t\t\r\n\t\tif ( !empty( $_POST['orderid'] ) ) {\r\n\t\t\t$order_id = $_POST['orderid']; \r\n\t\t\t$order = wc_get_order( $order_id );\r\n\t\t\t$product_id = $_POST['productid'];\r\n\t\t\t$tracking_url = $_POST['tracking_url'];\r\n\t\t\t$tracking_code = $_POST['tracking_code'];\r\n $order_item_id = $_POST['orderitemid'];\r\n \r\n $tracking_url = apply_filters( 'wcfm_tracking_url', $tracking_url, $tracking_code, $order_id );\r\n\t\t\t\r\n if( wcfm_is_vendor() ) {\r\n \t$shop_name = $WCFM->wcfm_vendor_support->wcfm_get_vendor_store_by_vendor( absint($user_id) );\r\n \t$wcfm_messages = sprintf( __( 'Vendor <b>%s</b> has shipped <b>%s</b> to customer.<br/>Tracking Code : %s <br/>Tracking URL : <a class=\"wcfm_dashboard_item_title\" target=\"_blank\" href=\"%s\">%s</a>', 'wc-frontend-manager-ultimate' ), $shop_name, get_the_title( $product_id ), $tracking_code, $tracking_url, $tracking_url );\r\n \t$WCFM->wcfm_notification->wcfm_send_direct_message( $user_id, 0, 0, 1, $wcfm_messages, 'shipment_tracking' );\r\n \t$comment_id = $order->add_order_note( $wcfm_messages, '1');\r\n } else {\r\n \t$comment_id = $order->add_order_note( sprintf( __( 'Product <b>%s</b> has been shipped to customer.<br/>Tracking Code : %s <br/>Tracking URL : <a href=\"%s\">%s</a>', 'wc-frontend-manager-ultimate' ), get_the_title( $product_id ), $tracking_code, $tracking_url, $tracking_url ), '1');\r\n }\r\n\t\t\t\r\n\t\t\t// Update Shipping Tracking Info\r\n\t\t\t$this->updateShippingTrackingInfo( $order_id, $order_item_id, $tracking_code, $tracking_url, $product_id );\r\n\t\t\t\r\n\t\t\tdo_action( 'wcfm_after_order_mark_shipped', $order_id, $order_item_id, $tracking_code, $tracking_url, $product_id );\r\n\t\t}\r\n\t\tdie;\r\n\t}",
"private function GatewayPing()\n\t{\n\t\tif(!isset($_REQUEST['provider'])) {\n\t\t\texit;\n\t\t}\n\n\t\t// Invalid checkout provider passed\n\t\tif(!GetModuleById('checkout', $provider, $_REQUEST['provider'])) {\n\t\t\texit;\n\t\t}\n\n\t\t// This gateway doesn't support a ping back/notification\n\t\tif(!method_exists($provider, 'ProcessGatewayPing')) {\n\t\t\texit;\n\t\t}\n\n\t\t// Call the process method\n\t\t$provider->ProcessGatewayPing();\n\t\texit;\n\t}",
"function backorders_require_notification() {\n\t\tif ($this->data['backorders']=='notify') return true;\n\t\treturn false;\n\t}",
"public function isTrackingAllowed() {\n\t $data = Mage::getStoreConfig('rublon_allow_tracking');\n\t \t\t\n\t return !empty($data)?true:false;\n\t}",
"protected function doActionSendTracking()\n {\n \\XLite\\Core\\Mailer::sendOrderTrackingInformationCustomer($this->getOrder());\n\n \\XLite\\Core\\TopMessage::addInfo('Tracking information has been sent');\n }",
"function wp_send_new_user_notifications($user_id, $notify = 'both')\n {\n }",
"public function sendMailToNotifiyMerchant($observer) {\r\n\r\n //check if Enable out of stock \r\n $enableOutOfStock = Mage::getStoreConfig('Outofstocknotification/general/activate_apptha_outofstock_enable');\r\n\r\n //check if Enable out of stock threshod qty of product stock\r\n $enableOutOfStockAdminNotify = Mage::getStoreConfig('Outofstocknotification/general/merchant_apptha_outofstock_mail');\r\n\r\n // store currency code eg. USD, INR\r\n $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();\r\n\r\n // store currency symbol eg. $ \r\n $currency_symbol = Mage::app()->getLocale()->currency($currency_code)->getSymbol();\r\n\r\n if (intval($enableOutOfStockAdminNotify) > 0 && intval($enableOutOfStock) > 0) {\r\n\r\n // get threshold qty as mentioned by Merchant\r\n $thresholdQty = Mage::getStoreConfig('Outofstocknotification/general/stocklimit_apptha_outofstock_mail');\r\n\r\n $orderIds = $observer->getData('order_ids');\r\n foreach ($orderIds as $_orderId) {\r\n $order = Mage::getModel('sales/order')->load($_orderId);\r\n $items = $order->getAllItems();\r\n foreach ($items as $itemId => $item) {\r\n $ids[] = $item->getProductId();\r\n }\r\n }\r\n\r\n foreach ($ids as $pid) {\r\n\r\n $products = Mage::getModel('catalog/product')->load($pid);\r\n\r\n $producttype = $products->getTypeId();\r\n\r\n if ($producttype == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) { // check if product is configurable\r\n $flag = 1;\r\n } else {\r\n $flag = 0;\r\n }\r\n\r\n\r\n $qty = $products->getStockItem()->getQty();\r\n\r\n if ($thresholdQty >= $qty && $flag != 1) {\r\n\r\n $emailTemplateVariables = array();\r\n\r\n $emailTemplateVariables['productName'] = $products->getName();\r\n $emailTemplateVariables['productPrice'] = $currency_symbol . $products->getPrice();\r\n $emailTemplateVariables['productUrl'] = $products->getProductUrl();\r\n $emailTemplateVariables['productImg'] = $products->getImageUrl();\r\n $emailTemplateVariables['productQty'] = $qty;\r\n $emailTemplateVariables['thresholdQty'] = $thresholdQty;\r\n $emailTemplateVariables['productDesc'] = $products->getDescription();\r\n $marchentNotificationMailId = Mage::getStoreConfig('Outofstocknotification/outofstock_email/outofstock_sender_email_identity');\r\n $senderMailId = Mage::getStoreConfig(\"trans_email/ident_$marchentNotificationMailId/email\");\r\n $senderName = Mage::getStoreConfig(\"trans_email/ident_$marchentNotificationMailId/name\");\r\n $templeId = (int) Mage::getStoreConfig('Outofstocknotification/general/outofstock_admin_template');\r\n\r\n //if it is user template then this process is continue\r\n if ($templeId) {\r\n $emailTemplate = Mage::getModel('core/email_template')->load($templeId);\r\n } else { // we are calling default template\r\n $emailTemplate = Mage::getModel('core/email_template')\r\n ->loadDefault('Outofstocknotification_general_outofstock_admin_template');\r\n }\r\n\r\n $emailTemplateVariables['storeName'] = Mage::getStoreConfig(\"general/store_information/name\");\r\n $emailTemplateVariables['siteLink'] = Mage::getBaseUrl();\r\n\r\n $toMailId = $senderMailId;\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\r\n $emailTemplate->setSenderName($senderName); //mail sender name\r\n $emailTemplate->setSenderEmail($senderMailId); //mail sender email id\r\n $emailTemplate->setTemplateSubject('Out of stock Notification from ' . $emailTemplateVariables['storeName']);\r\n $emailTemplate->setDesignConfig(array('area' => 'frontend'));\r\n $processedTemplate = $emailTemplate->getProcessedTemplate($emailTemplateVariables); //it return the temp body\r\n\t\t\t\t\t\r\n $emailTemplate->send($toMailId, $senderName, $emailTemplateVariables); //send mail to admin email ids\r\n }\r\n }\r\n }\r\n }",
"function wcfm_mark_as_recived() {\r\n\t\tglobal $WCFM, $WCFMu, $woocommerce, $wpdb;\r\n\t\t\r\n\t\tif ( !empty( $_POST['orderitemid'] ) ) {\r\n $order_id = $_POST['orderid']; \r\n\t\t\t$order = wc_get_order( $order_id );\r\n\t\t\t$product_id = $_POST['productid'];\r\n $order_item_id = $_POST['orderitemid'];\r\n \r\n //$comment_id = $order->add_order_note( sprintf( __( 'Item(s) <b>%s</b> received by customer.', 'wc-frontend-manager-ultimate' ), get_the_title( $product_id ) ), '1');\r\n \r\n // Keep Tracking URL as Order Item Meta\r\n\t\t\t$sql = \"INSERT INTO {$wpdb->prefix}woocommerce_order_itemmeta\";\r\n\t\t\t$sql .= ' ( `meta_key`, `meta_value`, `order_item_id` )';\r\n\t\t\t$sql .= ' VALUES ( %s, %s, %s )';\r\n\t\t\t\r\n\t\t\t$confirm_message = __( 'YES', 'wc-frontend-manager-ultimate' );\r\n\t\r\n\t\t\t$wpdb->get_var( $wpdb->prepare( $sql, 'wcfm_mark_as_recived', $confirm_message, $order_item_id ) );\r\n\t\t\t\r\n\t\t\t$vendor_id = $WCFM->wcfm_vendor_support->wcfm_get_vendor_id_from_product( $product_id );\r\n\t\t\t\r\n\t\t\t// WCfM Marketplace Table Update\r\n\t\t\tif( $vendor_id && (wcfm_is_marketplace() == 'wcfmmarketplace') ) {\r\n\t\t\t\t$wpdb->query(\"UPDATE {$wpdb->prefix}wcfm_marketplace_orders SET shipping_status = 'completed' WHERE order_id = $order_id and vendor_id = $vendor_id and item_id = $order_item_id\");\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Notification\r\n\t\t\t$wcfm_messages = sprintf( __( 'Customer marked <b>%s</b> received.', 'wc-frontend-manager-ultimate' ), get_the_title( $product_id ) );\r\n\t\t\t$WCFM->wcfm_notification->wcfm_send_direct_message( -1, 0, 0, 1, $wcfm_messages, 'shipment_received' );\r\n\t\t\t\r\n\t\t\t// Vendor Notification\r\n\t\t\tif( $vendor_id ) {\r\n\t\t\t\t$WCFM->wcfm_notification->wcfm_send_direct_message( -2, $vendor_id, 0, 1, $wcfm_messages, 'shipment_received' );\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// WC Order Note\r\n\t\t\t$comment_id = $order->add_order_note( $wcfm_messages, '1');\r\n\t\t\t\r\n\t\t\tdo_action( 'wcfm_after_order_mark_received', $order_id, $order_item_id, $product_id );\r\n }\r\n die;\r\n\t}"
]
| [
"0.6043288",
"0.57348716",
"0.53542256",
"0.5348562",
"0.5305889",
"0.5199681",
"0.51625484",
"0.51314044",
"0.5063772",
"0.5049372",
"0.50391716",
"0.5036657",
"0.50204957",
"0.50019825",
"0.49854276",
"0.4969458",
"0.49552038",
"0.49531442",
"0.4949317",
"0.49484727",
"0.49173895",
"0.49146715",
"0.49134237",
"0.4893632",
"0.4887321",
"0.4882139",
"0.48727524",
"0.48560715",
"0.48482287",
"0.48421195"
]
| 0.70245343 | 0 |
Adds an array of column ids to skip | public function skip($skipIds = null) {
if (empty($skipIds)) {
$skipIds = [];
} else if (!is_array($skipIds)) {
$skipIds = [$skipIds];
}
$this->skip = $skipIds;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function incrementRowsSkipped(): void\n {\n $this->rowsSkipped++;\n }",
"public function skip($howMany);",
"public function setSkipSql($skip)\n {\n $this->skipSql = (Boolean)$skip;\n }",
"function rhd_excluded_category_columns( $columns ) {\n\treturn array_merge( $columns, array( 'excluded' => __( 'Excluded from Dropdown' ) ) );\n}",
"protected function loadColumns(){\n\t\t\t$this->columns = array_diff(\n\t\t\t\tarray_keys(get_class_vars($this->class)),\n\t\t\t\t$this->getIgnoreAttributes()\n\t\t\t);\n\t\t}",
"public function excludes(...$columns)\n {\n // code...\n $this->__EXCLUDES__ = array_unique(array_merge($this->__EXCLUDES__ ?? [], $this->flatten($columns)));\n\n return $this;\n }",
"function TS_VCSC_Testimonials_Sort_CustomColumns($columns) {\r\n\t\t$columns['ids'] = 'ids'; \r\n\t\treturn $columns;\r\n\t}",
"private function getColumnNames($skipKeys = null, $skipIdentity = true, $applyTicks = true)\n\t\t{\n\t\t\t$cols = array();\n\t\t\tforeach($this->_columns as $col)\n\t\t\t{\n\t\t\t\t// Always skip 'Id' column, if told\n\t\t\t\tif(($skipIdentity && strcasecmp($col->getName(), self::IgnoreColumnIdentity) == 0) ||\n\t\t\t\t ($skipKeys != null && array_search($col->getName(), $skipKeys) !== false))\n\t\t\t\t\tcontinue; // skip if specified in keys array\n\t\t\t\tif($applyTicks)\n\t\t\t\t\t$cols[] = sprintf('`%s`', $col->getName()); // surround in back ticks for safety\n\t\t\t\telse\n\t\t\t\t\t$cols[] = $col->getName();\n\t\t\t}\n\t\t\treturn $cols;\n\t\t}",
"public function exclude($arrayofuserids) {\n $this->exclude = array_unique(array_merge($this->exclude, $arrayofuserids));\n }",
"function rd_user_id_column( $columns ) {\n\t$columns[ 'user_id' ] = 'ID';\n\treturn $columns;\n}",
"public function setHiddenCols($cols){\n\t\t$this->hiddenCols=explode(\",\",$cols);\n\t}",
"public function getExcludedIds();",
"public function select_except($columns)\r\n {\r\n $exceptions = array_values_recursive(func_get_args());\r\n\r\n $all_columns = $this->get_column_names();\r\n\r\n $columns = array_except($all_columns, $exceptions);\r\n\r\n return $this->select($columns);\r\n }",
"public function setSkip($skip) {\n\t$this->parseQuery->setSkip($skip);\n }",
"function skipField($fieldName){\n\n\t\t$this->skip[$fieldName] = true;\n\n\t}",
"public function skip($_count=1) {\n\t\tif ($this->dry()) {\n\t\t\ttrigger_error(self::TEXT_AxonEmpty);\n\t\t\treturn;\n\t\t}\n\t\t$this->load($this->criteria,$this->order,$this->offset+$_count);\n\t}",
"public function setSkip(array $skip)\n {\n $this->skip = $skip;\n return $this;\n }",
"public function skip($offset = 0);",
"function get_all_not_in($ignore, $limit = false, $offset = false ) {\n\t\t// where clause\n\t\t//$this->custom_conds();\n\n\t\t$this->db->where_not_in('id', $ignore);\n\t\t//$this->db->where('status', 1);\n\n\t\t// from table\n\t\t$this->db->from($this->table_name);\n\n\t\tif ( $limit ) {\n\t\t// if there is limit, set the limit\n\t\t\t\n\t\t\t$this->db->limit($limit);\n\t\t}\n\t\t\n\t\tif ( $offset ) {\n\t\t// if there is offset, set the offset,\n\t\t\t\n\t\t\t$this->db->offset($offset);\n\t\t}\n\n\t\t//$this->db->order_by(\"added_date\", \"DESC\");\n\t\t\n\t\treturn $this->db->get();\n\t}",
"public function skipOperation($skip) {}",
"public function filterIds(int ...$ids): self;",
"public function ignoreColumn ($column) {\n\t\t#coopy/CompareFlags.hx:368: characters 9-77\n\t\tif ($this->columns_to_ignore === null) {\n\t\t\t#coopy/CompareFlags.hx:368: characters 38-77\n\t\t\t$this->columns_to_ignore = new \\Array_hx();\n\t\t}\n\t\t#coopy/CompareFlags.hx:369: characters 9-39\n\t\t$_this = $this->columns_to_ignore;\n\t\t$_this->arr[$_this->length++] = $column;\n\t}",
"public function setIds($arrIds);",
"function spr_exclude_column_found($column) {\nglobal $spr_exclude_db_debug;\n\n\t$rs = safe_query('SELECT * FROM '.safe_pfx('txp_section'),$spr_exclude_db_debug);\n\t$a = nextRow($rs);\n\treturn array_key_exists($column, $a);\n}",
"public function skip($amount);",
"function skip($count);",
"public function set_columns($cols) { $this->cols = $cols + 0; }",
"function eddenvato_add_id($columns) {\n //$columns['user_id'] = 'User ID';\n $columns['purchase_codes'] = 'Purchase Codes';\n return $columns;\n}",
"public function getExcluded(): array\n {\n $arr = [];\n foreach ($this->columns as $name => $column) {\n if ($column->isExcluded()) {\n $arr[] = $name;\n }\n }\n\n return $arr;\n }",
"protected function selectIds($select)\n {\n $select->from(array('REF_METADATA'), array('METAID'))->order('METAID');\n }"
]
| [
"0.57554615",
"0.55121887",
"0.54373646",
"0.5428507",
"0.52916044",
"0.5289146",
"0.5173901",
"0.5170893",
"0.5125032",
"0.5100623",
"0.5087158",
"0.50806713",
"0.50612485",
"0.50451773",
"0.50147396",
"0.49736094",
"0.4972109",
"0.49627617",
"0.4953597",
"0.49471533",
"0.49339235",
"0.49086642",
"0.48845664",
"0.48784477",
"0.48743236",
"0.48571584",
"0.48307922",
"0.48238257",
"0.4764209",
"0.4764062"
]
| 0.62259763 | 0 |
Creates the navigation options for the table, including the pagination and sorting options If wrap is set to true, it return an array of the top and bottom navigation menus | public function tableNav($options = [], $wrap = false) {
$return = $wrap ? ['',''] : '';
$out = '';
if (!empty($options['sort'])) {
$out .= $this->tableSortMenu($options['sort'], ['class' => 'pull-right']);
}
$model = !empty($options['model']) ? $options['model'] : $this->Paginator->defaultModel();
if (
(!isset($options['paginate']) || $options['paginate'] !== false) &&
!empty($this->request->params['paging'][$model])
) {
$out .= $this->Layout->paginateNav(compact('model'));
//$out .= $this->Paginator->pagination(['ul' => 'pagination', 'div' => 'text-center']);
}
if (!empty($out)) {
if ($wrap) {
//Returns both top and bottom
$return = array(
$this->Html->div('row table-nav table-nav-top', $out),
$this->Html->div('row table-nav table-nav-bottom', $out),
);
} else {
$return = $this->Html->div('row table-nav', $out);
}
}
return $return;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getPagesLinks()\n\t{\n\t\tglobal $mainframe;\n\n\t\t$lang =& JFactory::getLanguage();\n\n\t\t// Build the page navigation list\n\t\t$data = $this->_buildDataObject();\n\n\t\t$list = array();\n\n\t\t$itemOverride = false;\n\t\t$listOverride = false;\n\n\t\t$chromePath = JPATH_THEMES.DS.$mainframe->getTemplate().DS.'html'.DS.'pagination.php';\n\t\tif (file_exists($chromePath))\n\t\t{\n\t\t\trequire_once ($chromePath);\n\t\t\tif (function_exists('pagination_item_active') && function_exists('pagination_item_inactive')) {\n\t\t\t\t$itemOverride = true;\n\t\t\t}\n\t\t\tif (function_exists('pagination_list_render')) {\n\t\t\t\t$listOverride = true;\n\t\t\t}\n\t\t}\n\n\t\t// Build the select list\n\t\tif ($data->all->base !== null) {\n\t\t\t$list['all']['active'] = true;\n\t\t\t$list['all']['data'] = ($itemOverride) ? pagination_item_active($data->all) : $this->_item_active($data->all);\n\t\t} else {\n\t\t\t$list['all']['active'] = false;\n\t\t\t$list['all']['data'] = ($itemOverride) ? pagination_item_inactive($data->all) : $this->_item_inactive($data->all);\n\t\t}\n\n\t\tif ($data->start->base !== null) {\n\t\t\t$list['start']['active'] = true;\n\t\t\t$list['start']['data'] = ($itemOverride) ? pagination_item_active($data->start) : $this->_item_active($data->start);\n\t\t} else {\n\t\t\t$list['start']['active'] = false;\n\t\t\t$list['start']['data'] = ($itemOverride) ? pagination_item_inactive($data->start) : $this->_item_inactive($data->start);\n\t\t}\n\t\tif ($data->previous->base !== null) {\n\t\t\t$list['previous']['active'] = true;\n\t\t\t$list['previous']['data'] = ($itemOverride) ? pagination_item_active($data->previous) : $this->_item_active($data->previous);\n\t\t} else {\n\t\t\t$list['previous']['active'] = false;\n\t\t\t$list['previous']['data'] = ($itemOverride) ? pagination_item_inactive($data->previous) : $this->_item_inactive($data->previous);\n\t\t}\n\n\t\t$list['pages'] = array(); //make sure it exists\n\t\tforeach ($data->pages as $i => $page)\n\t\t{\n\t\t\tif ($page->base !== null) {\n\t\t\t\t$list['pages'][$i]['active'] = true;\n\t\t\t\t$list['pages'][$i]['data'] = ($itemOverride) ? pagination_item_active($page) : $this->_item_active($page);\n\t\t\t} else {\n\t\t\t\t$list['pages'][$i]['active'] = false;\n\t\t\t\t$list['pages'][$i]['data'] = ($itemOverride) ? pagination_item_inactive($page) : $this->_item_inactive($page);\n\t\t\t}\n\t\t}\n\n\t\tif ($data->next->base !== null) {\n\t\t\t$list['next']['active'] = true;\n\t\t\t$list['next']['data'] = ($itemOverride) ? pagination_item_active($data->next) : $this->_item_active($data->next);\n\t\t} else {\n\t\t\t$list['next']['active'] = false;\n\t\t\t$list['next']['data'] = ($itemOverride) ? pagination_item_inactive($data->next) : $this->_item_inactive($data->next);\n\t\t}\n\t\tif ($data->end->base !== null) {\n\t\t\t$list['end']['active'] = true;\n\t\t\t$list['end']['data'] = ($itemOverride) ? pagination_item_active($data->end) : $this->_item_active($data->end);\n\t\t} else {\n\t\t\t$list['end']['active'] = false;\n\t\t\t$list['end']['data'] = ($itemOverride) ? pagination_item_inactive($data->end) : $this->_item_inactive($data->end);\n\t\t}\n\n\t\tif($this->total > $this->limit){\n\t\t\treturn ($listOverride) ? pagination_list_render($list) : $this->_list_render($list);\n\t\t}\n\t\telse{\n\t\t\treturn '';\n\t\t}\n\t}",
"public function buildNavigation()\r\n\t{\r\n\t\t$uri\t=\tDunUri :: getInstance( 'SERVER', true );\r\n\t\t$uri->delVars();\r\n\t\t$uri->setVar( 'module', 'intouch' );\r\n\t\t\r\n\t\t$data\t\t=\t'<ul class=\"nav nav-pills\">';\r\n\t\t$actions\t=\tarray( 'default', 'syscheck', 'groups', 'configure', 'updates', 'license' );\r\n\t\t\r\n\t\tforeach( $actions as $item ) {\r\n\t\t\tif ( $item == $this->action && in_array( $this->task, array( 'default', 'save' ) ) ) {\r\n\t\t\t\t$data .= '<li class=\"active\"><a href=\"#\">' . t( 'intouch.admin.navbar.' . $item ) . '</a></li>';\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t$uri->setVar( 'action', $item );\r\n\t\t\t\t$data .= '<li><a href=\"' . $uri->toString() . '\">' . t( 'intouch.admin.navbar.' . $item ) . '</a></li>';\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t$data\t.= '</ul>';\r\n\t\treturn $data;\r\n\t}",
"public function getAdminNavigation ()\n\t{\n\t\t// Navigation Menu Array\n\t\t$navigation = array(\n\t\t\t//1 => array('icon' => 'cus-house', 'text' => __('Dashboard', true), 'path' => '/admin/admin_top/'),\t\n\t\t\t2 => array('icon' => 'cus-cart', 'text' => __('Orders', true), 'path' => '/admin/admin_top/2', \n\t\t\t\t'children' => array(\n\t\t\t\t\t1 => array('icon' => 'cus-cart-go', 'text' => __('All Orders', true), 'path' => '/orders/admin/'),\n\t\t\t\t\t2 => array('icon' => 'cus-user', 'text' => __('Customers', true), 'path' => '/customers/admin/'),\n\t\t\t\t\t3 => array('icon' => 'cus-group', 'text' => __('Customers Groups', true), 'path' => '/groups_customers/admin/')\n\t\t\t\t)\t\t\t\n\t\t\t),\t\t\t\t\n\t\t\t3 => array('icon' => 'cus-table', 'text' => __('Contents', true), 'path' => '/admin/admin_top/3',\n\t\t\t\t'children' => array(\n\t\t\t\t\t1 => array('icon' => 'cus-book-add', 'text' => __('Categories/Products', true), 'path' => '/contents/admin/'),\n\t\t\t\t\t2 => array('icon' => 'cus-database-refresh', 'text' => __('Import/Export', true), 'path' => '/import_export/admin/'),\n\t\t\t\t\t3 => array('icon' => 'cus-page', 'text' => __('Pages', true), 'path' => '/contents/admin_core_pages/'),\n\t\t\t\t\t4 => array('icon' => 'cus-application-cascade', 'text' => __('Content Blocks', true), 'path' => '/global_content_blocks/admin/')\n\t\t\t\t)\n\t\t\t),\n\t\t\t4 => array('icon' => 'cus-paintbrush', 'text' => __('Layout', true), 'path' => '/admin/admin_top/4',\n\t\t\t\t'children' => array(\n\t\t\t\t\t1 => array('icon' => 'cus-layout', 'text' => __('Templates', true), 'path' => '/templates/admin/'),\n\t\t\t\t\t2 => array('icon' => 'cus-palette', 'text' => __('Stylesheets', true), 'path' => '/stylesheets/admin/'),\n\t\t\t\t\t3 => array('icon' => 'cus-layout-content', 'text' => __('Micro Templates', true), 'path' => '/micro_templates/admin/')\t\t\t\t\t\t\t\t\t\n\t\t\t\t)\n\t\t\t),\n\t\t\t5 => array('icon' => 'cus-cog', 'text' => __('Configurations', true), 'path' => '/admin/admin_top/5',\n\t\t\t\t'children' => array(\n\t\t\t\t\t1 => array('icon' => 'cus-cog-edit', 'text' => __('Store Settings', true), 'path' => '/configuration/admin/'),\n\t\t\t\t\t2 => array('icon' => 'cus-lock', 'text' => __('License', true), 'path' => '/license/admin/'),\n\t\t\t\t\t3 => array('icon' => 'cus-arrow-refresh', 'text' => __('Update', true), 'path' => '/update/admin/'),\n\t\t\t\t\t4 => array('icon' => 'cus-cart-edit', 'text' => __('Order status', true), 'path' => '/order_status/admin/'),\n\t\t\t\t\t5 => array('icon' => 'cus-report', 'text' => __('Payment Methods', true), 'path' => '/payment_methods/admin/'),\n\t\t\t\t\t6 => array('icon' => 'cus-box', 'text' => __('Shipping Methods', true), 'path' => '/shipping_methods/admin/'),\n\t\t\t\t\t7 => array('icon' => 'cus-calculator-add', 'text' => __('Tax Classes', true), 'path' => '/taxes/admin/'),\n\t\t\t\t\t8 => array('icon' => 'cus-calculator-edit', 'text' => __('Tax Rates', true), 'path' => '/tax_country_zone_rates/admin/0'),\n\t\t\t\t\t9 => array('icon' => 'cus-email-open', 'text' => __('Email Templates', true), 'path' => '/email_template/admin/'),\n\t\t\t\t\t10 => array('icon' => 'cus-comment-edit', 'text' => __('Answer Templates', true), 'path' => '/answer_template/admin/'),\n\t\t\t\t\t11 => array('icon' => 'cus-tag-blue-edit', 'text' => __('Attribute Templates', true), 'path' => '/attribute_templates/admin/'),\n\t\t\t\t\t12 => array('icon' => 'cus-tag-blue', 'text' => __('Product Labels', true), 'path' => '/labels/admin/')\n\t\t\t\t)\n\t\t\t),\t\n\t\t\t6 => array('icon' => 'cus-world', 'text' => __('Locale', true), 'path' => '/admin/admin_top/6',\n\t\t\t\t'children' => array(\n\t\t\t\t\t1 => array('icon' => 'cus-table-edit', 'text' => __('Currencies', true), 'path' => '/currencies/admin/'),\n\t\t\t\t\t2 => array('icon' => 'cus-flag-green', 'text' => __('Languages', true), 'path' => '/languages/admin/'),\n\t\t\t\t\t3 => array('icon' => 'cus-world-add', 'text' => __('Countries', true), 'path' => '/countries/admin/'),\n\t\t\t\t\t4 => array('icon' => 'cus-page-white-world', 'text' => __('Geo Zones', true), 'path' => '/geo_zones/admin/')\n\t\t\t\t)\n\t\t\t),\t\t\t\t\t\n\t\t\t7 => array('icon' => 'cus-plugin', 'text' => __('Extensions', true), 'path' => '/admin/admin_top/7',\n\t\t\t\t'children' => array(\n\t\t\t\t\t1 => array('icon' => 'cus-plugin-add', 'text' => __('Modules', true), 'path' => '/modules/admin/'),\n\t\t\t\t\t2 => array('icon' => 'cus-tag-blue', 'text' => __('Tags', true), 'path' => '/tags/admin/'),\n\t\t\t\t\t3 => array('icon' => 'cus-tag-blue-add', 'text' => __('User Tags', true), 'path' => '/user_tags/admin/'),\n\t\t\t\t\t4 => array('icon' => 'cus-page-gear', 'text' => __('Events', true), 'path' => '/events/admin/'),\n\t\t\t\t)\n\t\t\t),\t\t\t\t\t\t\t\t\t\n\t\t\t8 => array('icon' => 'cus-group', 'text' => __('Account', true), 'path' => '/admin/admin_top/8',\n\t\t\t\t'children' => array(\n\t\t\t\t\t1 => array('icon' => 'cus-group-add', 'text' => __('Manage Accounts', true), 'path' => '/users/admin/'),\n\t\t\t\t\t2 => array('icon' => 'cus-group-edit', 'text' => __('My Account', true), 'path' => '/users/admin_user_account/'),\n\t\t\t\t\t3 => array('icon' => 'cus-group-key', 'text' => __('Prefences', true), 'path' => '/users/admin_user_preferences/'),\t\t\t\t\t\n\t\t\t\t\t4 => array('icon' => 'cus-group-go', 'text' => __('Logout', true), 'path' => '/users/admin_logout/')\t\t\t\t\t\n\t\t\t\t)\n\t\t\t),\t\t\t\t\t\t\n\t\t\t9 => array('icon' => 'cus-wrench', 'text' => __('Tools', true), 'path' => '/admin/admin_top/9',\n\t\t\t\t'children' => array(\n\t\t\t\t\t1 => array('icon' => 'cus-database-save', 'text' => __('Database Backup', true), 'path' => '/tools/admin_backup/'),\n\t\t\t\t\t2 => array('icon' => 'cus-chart-curve', 'text' => __('Sales Report', true), 'path' => '/reports/admin/'),\n\t\t\t\t\t3 => array('icon' => 'cus-comments', 'text' => __('Contact Us Messages', true), 'path' => '/contact_us/admin/'),\n\t\t\t\t\t4 => array('icon' => 'cus-zoom', 'text' => __('Search Log', true), 'path' => '/search_log/admin/')\n\t\t\t\t)\n\t\t\t),\n\t\t\t//10 => array('icon' => 'cus-application-go', 'text' => __('Launch Site', true), 'path' => '/', 'attributes' => array('target' => 'blank'))\n\t\t);\n\t\t\n\t\t// Add module navigation elements\n\t\tApp::import('Model', 'Module');\n\t\t$Module = new Module();\n\t\t\n\t\t$modules = $Module->find('all');\n\t\t\n\t\tforeach($modules AS $module)\n\t\t{\n\t\t\t$nav_level = $module['Module']['nav_level'];\n\t\t\tif ($nav_level > 0) {\n\t\t\t$navigation[$nav_level]['children'][] = array('icon' => $module['Module']['icon'], 'text' => ucfirst($module['Module']['name']), 'path' => '/module_' . $module['Module']['alias'] . '/admin/admin_index/', 'attributes' => array('class' => 'module'));\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn($navigation);\n\t}",
"function buildNavigation($pageNum_Recordset1,$totalPages_Recordset1,$prev_Recordset1,$next_Recordset1,$separator=\" | \",$max_links=10, $show_page=true)\n{\n GLOBAL $maxRows_rs_novinky,$totalRows_rs_novinky;\n\t$pagesArray = \"\"; $firstArray = \"\"; $lastArray = \"\";\n\tif($max_links<2)$max_links=2;\n\tif($pageNum_Recordset1<=$totalPages_Recordset1 && $pageNum_Recordset1>=0)\n\t{\n\t\tif ($pageNum_Recordset1 > ceil($max_links/2))\n\t\t{\n\t\t\t$fgp = $pageNum_Recordset1 - ceil($max_links/2) > 0 ? $pageNum_Recordset1 - ceil($max_links/2) : 1;\n\t\t\t$egp = $pageNum_Recordset1 + ceil($max_links/2);\n\t\t\tif ($egp >= $totalPages_Recordset1)\n\t\t\t{\n\t\t\t\t$egp = $totalPages_Recordset1+1;\n\t\t\t\t$fgp = $totalPages_Recordset1 - ($max_links-1) > 0 ? $totalPages_Recordset1 - ($max_links-1) : 1;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t$fgp = 0;\n\t\t\t$egp = $totalPages_Recordset1 >= $max_links ? $max_links : $totalPages_Recordset1+1;\n\t\t}\n\t\tif($totalPages_Recordset1 >= 1) {\n\t\t\t#\t------------------------\n\t\t\t#\tSearching for $_GET vars\n\t\t\t#\t------------------------\n\t\t\t$_get_vars = '';\t\t\t\n\t\t\tif(!empty($_GET) || !empty($_GET)){\n\t\t\t\t$_GET = empty($_GET) ? $_GET : $_GET;\n\t\t\t\tforeach ($_GET as $_get_name => $_get_value) {\n\t\t\t\t\tif ($_get_name != \"pageNum_rs_novinky\") {\n\t\t\t\t\t\t$_get_vars .= \"&$_get_name=$_get_value\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t$successivo = $pageNum_Recordset1+1;\n\t\t\t$precedente = $pageNum_Recordset1-1;\n\t\t\t$firstArray = ($pageNum_Recordset1 > 0) ? \"<a href=\\\"$_SERVER[PHP_SELF]?pageNum_rs_novinky=$precedente$_get_vars\\\">$prev_Recordset1</a>\" : \"$prev_Recordset1\";\n\t\t\t# ----------------------\n\t\t\t# page numbers\n\t\t\t# ----------------------\n\t\t\tfor($a = $fgp+1; $a <= $egp; $a++){\n\t\t\t\t$theNext = $a-1;\n\t\t\t\tif($show_page)\n\t\t\t\t{\n\t\t\t\t\t$textLink = $a;\n\t\t\t\t} else {\n\t\t\t\t\t$min_l = (($a-1)*$maxRows_rs_novinky) + 1;\n\t\t\t\t\t$max_l = ($a*$maxRows_rs_novinky >= $totalRows_rs_novinky) ? $totalRows_rs_novinky : ($a*$maxRows_rs_novinky);\n\t\t\t\t\t$textLink = \"$min_l - $max_l\";\n\t\t\t\t}\n\t\t\t\t$_ss_k = floor($theNext/26);\n\t\t\t\tif ($theNext != $pageNum_Recordset1)\n\t\t\t\t{\n\t\t\t\t\t$pagesArray .= \"<a href=\\\"$_SERVER[PHP_SELF]?pageNum_rs_novinky=$theNext$_get_vars\\\">\";\n\t\t\t\t\t$pagesArray .= \"$textLink</a>\" . ($theNext < $egp-1 ? $separator : \"\");\n\t\t\t\t} else {\n\t\t\t\t\t$pagesArray .= \"$textLink\" . ($theNext < $egp-1 ? $separator : \"\");\n\t\t\t\t}\n\t\t\t}\n\t\t\t$theNext = $pageNum_Recordset1+1;\n\t\t\t$offset_end = $totalPages_Recordset1;\n\t\t\t$lastArray = ($pageNum_Recordset1 < $totalPages_Recordset1) ? \"<a href=\\\"$_SERVER[PHP_SELF]?pageNum_rs_novinky=$successivo$_get_vars\\\">$next_Recordset1</a>\" : \"$next_Recordset1\";\n\t\t}\n\t}\n\treturn array($firstArray,$pagesArray,$lastArray);\n}",
"function buildNavigation($pageNum_Recordset1,$totalPages_Recordset1,$prev_Recordset1,$next_Recordset1,$separator=\" | \",$max_links=10, $show_page=true)\n{\n GLOBAL $maxRows_rs_forn,$totalRows_rs_forn;\n\t$pagesArray = \"\"; $firstArray = \"\"; $lastArray = \"\";\n\tif($max_links<2)$max_links=2;\n\tif($pageNum_Recordset1<=$totalPages_Recordset1 && $pageNum_Recordset1>=0)\n\t{\n\t\tif ($pageNum_Recordset1 > ceil($max_links/2))\n\t\t{\n\t\t\t$fgp = $pageNum_Recordset1 - ceil($max_links/2) > 0 ? $pageNum_Recordset1 - ceil($max_links/2) : 1;\n\t\t\t$egp = $pageNum_Recordset1 + ceil($max_links/2);\n\t\t\tif ($egp >= $totalPages_Recordset1)\n\t\t\t{\n\t\t\t\t$egp = $totalPages_Recordset1+1;\n\t\t\t\t$fgp = $totalPages_Recordset1 - ($max_links-1) > 0 ? $totalPages_Recordset1 - ($max_links-1) : 1;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t$fgp = 0;\n\t\t\t$egp = $totalPages_Recordset1 >= $max_links ? $max_links : $totalPages_Recordset1+1;\n\t\t}\n\t\tif($totalPages_Recordset1 >= 1) {\n\t\t\t#\t------------------------\n\t\t\t#\tSearching for $_GET vars\n\t\t\t#\t------------------------\n\t\t\t$_get_vars = '';\t\t\t\n\t\t\tif(!empty($_GET) || !empty($HTTP_GET_VARS)){\n\t\t\t\t$_GET = empty($_GET) ? $HTTP_GET_VARS : $_GET;\n\t\t\t\tforeach ($_GET as $_get_name => $_get_value) {\n\t\t\t\t\tif ($_get_name != \"pageNum_rs_forn\") {\n\t\t\t\t\t\t$_get_vars .= \"&$_get_name=$_get_value\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t$successivo = $pageNum_Recordset1+1;\n\t\t\t$precedente = $pageNum_Recordset1-1;\n\t\t\t$firstArray = ($pageNum_Recordset1 > 0) ? \"<a href=\\\"$_SERVER[PHP_SELF]?pageNum_rs_forn=$precedente$_get_vars\\\">$prev_Recordset1</a>\" : \"$prev_Recordset1\";\n\t\t\t# ----------------------\n\t\t\t# page numbers\n\t\t\t# ----------------------\n\t\t\tfor($a = $fgp+1; $a <= $egp; $a++){\n\t\t\t\t$theNext = $a-1;\n\t\t\t\tif($show_page)\n\t\t\t\t{\n\t\t\t\t\t$textLink = $a;\n\t\t\t\t} else {\n\t\t\t\t\t$min_l = (($a-1)*$maxRows_rs_forn) + 1;\n\t\t\t\t\t$max_l = ($a*$maxRows_rs_forn >= $totalRows_rs_forn) ? $totalRows_rs_forn : ($a*$maxRows_rs_forn);\n\t\t\t\t\t$textLink = \"$min_l - $max_l\";\n\t\t\t\t}\n\t\t\t\t$_ss_k = floor($theNext/26);\n\t\t\t\tif ($theNext != $pageNum_Recordset1)\n\t\t\t\t{\n\t\t\t\t\t$pagesArray .= \"<a href=\\\"$_SERVER[PHP_SELF]?pageNum_rs_forn=$theNext$_get_vars\\\">\";\n\t\t\t\t\t$pagesArray .= \"$textLink</a>\" . ($theNext < $egp-1 ? $separator : \"\");\n\t\t\t\t} else {\n\t\t\t\t\t$pagesArray .= \"$textLink\" . ($theNext < $egp-1 ? $separator : \"\");\n\t\t\t\t}\n\t\t\t}\n\t\t\t$theNext = $pageNum_Recordset1+1;\n\t\t\t$offset_end = $totalPages_Recordset1;\n\t\t\t$lastArray = ($pageNum_Recordset1 < $totalPages_Recordset1) ? \"<a href=\\\"$_SERVER[PHP_SELF]?pageNum_rs_forn=$successivo$_get_vars\\\">$next_Recordset1</a>\" : \"$next_Recordset1\";\n\t\t}\n\t}\n\treturn array($firstArray,$pagesArray,$lastArray);\n}",
"public function get_navs()\n\t{\n\t\t return $this->db->get($this->_table['navigation'])->result();\n\n\t}",
"function getNavs() {\n\t$pageData = getPageData();\n\t$li = '';\n\tforeach($pageData as $k => $v) {\n\t\t$li .= '<li><a href=\"' . COVER_PAGE . '?show=' . $k .'\">' . $k . '</a></li>' . \"\\n\";\n\t}\n\treturn $li;\n}",
"function navi_array()\n\t{\n\t\t$navifromdb = $this->connection->db_assoc(\"SELECT * FROM `$this->navi_table` ORDER BY `id` ASC\");\n\n\t\t$navi = array();\n\t\tfor ($i=0;$i<count($navifromdb);$i++)\n\t\t{\n\t\t\t$rubrik_key = $navifromdb[$i]['Rubrik_key'];\n\t\t\tif ($navifromdb[$i]['Hierarchy']==0)\n\t\t\t{\n\t\t\t\t$navi[$rubrik_key]['Rubrik'] = $navifromdb[$i]['Rubrik'];\n\t\t\t\t$navi[$rubrik_key]['Show'] = $navifromdb[$i]['Show'];\n\t\t\t\t$navi[$rubrik_key]['Show_to'] = ($navifromdb[$i]['Show_to'] != '') ? explode(',',$navifromdb[$i]['Show_to']):'';\n\t\t\t\t$navi[$rubrik_key]['Modul'] = $navifromdb[$i]['Modul'];\n\t\t\t\t$navi[$rubrik_key]['ext_link'] = $navifromdb[$i]['ext_link'];\n\n\n\t\t\t\t$navi[$rubrik_key]['Subnavi'] = array();\n\t\t\t}\n\t\t\telse if ($navifromdb[$i]['Hierarchy']==1)\n\t\t\t{\n\t\t\t\t$page_key = $navifromdb[$i]['Page_key'];\n\t\t\t\t$navi[$rubrik_key]['Subnavi'][$page_key]['Seite'] = $navifromdb[$i]['Seite'];\n\t\t\t\t$navi[$rubrik_key]['Subnavi'][$page_key]['Show'] = $navifromdb[$i]['Show'];\n\t\t\t\t$navi[$rubrik_key]['Subnavi'][$page_key]['Show_to'] = ($navifromdb[$i]['Show_to'] != '') ? explode(',',$navifromdb[$i]['Show_to']):'';\n\t\t\t\t$navi[$rubrik_key]['Subnavi'][$page_key]['Modul'] = $navifromdb[$i]['Modul'];\n\t\t\t\t$navi[$rubrik_key]['Subnavi'][$page_key]['ext_link'] = $navifromdb[$i]['ext_link'];\n\n\t\t\t}\n\n\t\t}\n\t\treturn $navi;\n\t}",
"function getListNavi()\n\t{\n\t\t$ret = \"\";\n\n\t\t$ret = $this->oMgr->makeListNavi($this->list_cnt, $this->list_max, $this->cur_page);\n\n\t\treturn $ret;\n\t}",
"private function _getNavigation()\r\n\t{\r\n\t\t$input\t= dunloader( 'input', true );\r\n\t\t$action\t= $input->getVar( 'action', 'themes' );\r\n\t\t$task\t= $input->getVar( 'task', null );\r\n\t\t\r\n\t\t$uri\t= DunUri :: getInstance('SERVER', true );\r\n\t\t$uri->delVars();\r\n\t\t$uri->setVar( 'module', 'themer' );\r\n\t\t\r\n\t\t$html\t= '<ul class=\"nav nav-pills\">';\r\n\t\t\r\n\t\tforeach( array( 'themes', 'config', 'license' ) as $item ) {\r\n\t\t\t\r\n\t\t\tif ( $item == $action && $task != 'edittheme' ) {\r\n\t\t\t\t$html .= '<li class=\"active\"><a href=\"#\">' . t( 'themer.admin.module.navbar.' . $item ) . '</a></li>';\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t$uri->setVar( 'action', $item );\r\n\t\t\t$html .= '<li><a href=\"' . $uri->toString() . '\">' . t( 'themer.admin.module.navbar.' . $item ) . '</a></li>';\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t\t$html\t.= '</ul>';\r\n\t\treturn $html;\r\n\t}",
"public function getNav() \n {\n //@return : $stri_html : affichage du html de la navigation\n \n\t\t$stri_html =\"\";\n \n //**** START - navigation previous\n //si la page précédente > 1 alors affichage du lien sinon affichage du label (if previous page > 1 then put link else label)\n\t\t$stri_html .= ($this->int_page_prev > 0) ? $this->obj_a_prev->htmlValue() : $this->obj_lb_prev->htmlValue(); \n\t\t$stri_html .= \" | \";\n\t\t//**** END - navigation previous\n\t\t\n\t\t\n //**** DEBUT corps navigator\n\n // calcule le milieu pour les liens de page dans le but d'avoir la page courante au centre de la navigation (determine the middle of link to post courant page in middle)\n\t\t$int_middle = floor($this->int_limit_page / 2);\n\n\t\t// calcule la page minimum à afficher dans les liens (determine the min page)\n $minpage = (($this->int_page - $int_middle)<1) ? 1 : $this->int_page - $int_middle;\t\t\n\n // calcule la page maximum à afficher dans les liens (determine the max page)\n\t\t$maxpage = (($this->int_page + $int_middle)> $this->int_pages)? $this->int_pages : ($this->int_page + $int_middle);\n\n // pour chaque lien de navigation (post each page)\n\t\tforeach (range($minpage, $maxpage) as $i) \n {\n\t\t\tif ($i == $this->int_page) \n { \n // selected page\n $this->obj_lb_courant_page->setValue($i);\n\t\t\t\t$stri_html .= $this->obj_lb_courant_page->htmlValue(); \n\t\t\t} \n else \n {\n // other page\n $this->obj_a_page->setValue($i);\n $this->obj_a_page->setOnClick(\"document.form_page.start.value=\".$i.\";document.form_page.submit();\");\n \n\t\t\t\t$stri_html.=\" \".$this->obj_a_page->htmlValue().\" \";\n\t\t\t}\n\t\t}\n\n //**** END corps navigation\n \n \n //**** START - navigation next\n //si la page suivante <= nb de pages alors affichage du lien sinon affichage du label (if next page <= number of page then put link else label)\n\t\t$stri_html .= \" | \";\n\t\t$stri_html .= ($this->int_page_next <= $this->int_pages) ? $this->obj_a_next->htmlValue() : $this->obj_lb_next->htmlValue(); \n //**** END - navigation next\n\n\t\treturn $stri_html;\n\t}",
"function add_navigation($tp, $page, $npages, $order, $mode, $extra_params)\n{\n #\n # Display links to change mode or ordering\n #\n $params = [\n 'page' => 1,\n 'order' => $order,\n ];\n $params = array_merge($params, $extra_params);\n\n if ($mode == \"thumbnail\") {\n $params[\"mode\"] = \"listing\";\n $tp['alt_display_label'] = 'Listing';\n } else {\n $params[\"mode\"] = \"thumbnail\";\n $tp['alt_display_label'] = 'Thumbnails';\n }\n $tp['ne_alt_display_url'] = encode_argv_url($params);\n\n $params = [\n 'page' => 1,\n 'mode' => $mode,\n ];\n $params = array_merge($params, $extra_params);\n\n if ($order == \"location\") {\n $params[\"order\"] = \"year\";\n $tp['alt_order_label'] = 'Year';\n } else {\n $params[\"order\"] = \"location\";\n $tp['alt_order_label'] = 'Location';\n }\n $tp['ne_alt_order_url'] = encode_argv_url($params);\n\n if ($npages <= 1) {\n return $tp;\n }\n\n if ($mode == \"thumbnail\") {\n #\n # Instantiate the page navigation templates for the top and bottom of\n # the page\n #\n $tp['page'] = $page;\n $tp['npages'] = $npages;\n\n $params = [\n 'mode' => $mode,\n 'order' => $order,\n ];\n $params = array_merge($params, $extra_params);\n\n if ($page > 1) {\n $params['page'] = 1;\n $tp['ne_nav_first_page_url'] = encode_argv_url($params);\n $params['page'] = $page - 1;\n $tp['ne_nav_prev_page_url'] = encode_argv_url($params);\n }\n\n if ($page < $npages) {\n $params['page'] = $page + 1;\n $tp['ne_nav_next_page_url'] = encode_argv_url($params);\n $params['page'] = $npages;\n $tp['ne_nav_last_page_url'] = encode_argv_url($params);\n }\n }\n\n return $tp;\n}",
"function app_template_navigation() {\n global $Auth, $App;\n $user = $Auth->get_user_data();\n $navigation = NULL;\n\n if ( ! empty($user) ) {\n $user_id = $user['is_super'] ? false : $user['user_id'];\n $Menu = new AdminMenu($user_id, $user['is_super']);\n $nav = $Menu->generate();\n $navigation = array(\n 'selector' \t=> $App->config('page_content_id'),\n 'pos_func' \t=> 'insertAfter',\n 'html'\t\t=> $nav['navigation'].$nav['search']\n );\n }\n return $navigation;\n}",
"public function getPagesLinks()\r\n\t{\r\n\t\t$app = JFactory::getApplication();\r\n\t\t// Yjsg instance\r\n\t\t$yjsg = Yjsg::getInstance(); \r\n\t\t\r\n\t\t// Build the page navigation list.\r\n\t\t$data = $this->_buildDataObject();\r\n\r\n\t\t$list = array();\r\n\t\t$list['prefix'] = $this->prefix;\r\n\r\n\t\t$itemOverride = false;\r\n\t\t$listOverride = false;\r\n\r\n\t\t$chromePath \t= JPATH_THEMES . '/' . $app->getTemplate() . '/html/pagination.php';\r\n\t\t//yjsg start\r\n\t\tif (!file_exists($chromePath)){\r\n\t\t\tif($yjsg->preplugin()){\r\n\t\t\t\r\n\t\t\t\t$chromePath = YJSGPATH . 'legacy' . YJDS . 'html' . YJDS . 'pagination.php';\r\n\t\t\t\t\r\n\t\t\t}else{\r\n\t\t\t\t\r\n\t\t\t\t$chromePath = YJSGPATH . 'includes' . YJDS . 'html' . YJDS . 'pagination.php';\t\t\t\t\r\n\t\t\t}\r\n\t\t}\r\n\t\t//yjsg end\r\n\t\tif (file_exists($chromePath))\r\n\t\t{\r\n\t\t\tinclude_once $chromePath;\r\n\t\t\tif (function_exists('pagination_item_active') && function_exists('pagination_item_inactive'))\r\n\t\t\t{\r\n\t\t\t\t$itemOverride = true;\r\n\t\t\t}\r\n\t\t\tif (function_exists('pagination_list_render'))\r\n\t\t\t{\r\n\t\t\t\t$listOverride = true;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Build the select list\r\n\t\tif ($data->all->base !== null)\r\n\t\t{\r\n\t\t\t$list['all']['active'] = true;\r\n\t\t\t$list['all']['data'] = ($itemOverride) ? pagination_item_active($data->all) : $this->_item_active($data->all);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t$list['all']['active'] = false;\r\n\t\t\t$list['all']['data'] = ($itemOverride) ? pagination_item_inactive($data->all) : $this->_item_inactive($data->all);\r\n\t\t}\r\n\r\n\t\tif ($data->start->base !== null)\r\n\t\t{\r\n\t\t\t$list['start']['active'] = true;\r\n\t\t\t$list['start']['data'] = ($itemOverride) ? pagination_item_active($data->start) : $this->_item_active($data->start);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t$list['start']['active'] = false;\r\n\t\t\t$list['start']['data'] = ($itemOverride) ? pagination_item_inactive($data->start) : $this->_item_inactive($data->start);\r\n\t\t}\r\n\t\tif ($data->previous->base !== null)\r\n\t\t{\r\n\t\t\t$list['previous']['active'] = true;\r\n\t\t\t$list['previous']['data'] = ($itemOverride) ? pagination_item_active($data->previous) : $this->_item_active($data->previous);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t$list['previous']['active'] = false;\r\n\t\t\t$list['previous']['data'] = ($itemOverride) ? pagination_item_inactive($data->previous) : $this->_item_inactive($data->previous);\r\n\t\t}\r\n\r\n\t\t$list['pages'] = array(); //make sure it exists\r\n\t\tforeach ($data->pages as $i => $page)\r\n\t\t{\r\n\t\t\tif ($page->base !== null)\r\n\t\t\t{\r\n\t\t\t\t$list['pages'][$i]['active'] = true;\r\n\t\t\t\t$list['pages'][$i]['data'] = ($itemOverride) ? pagination_item_active($page) : $this->_item_active($page);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t$list['pages'][$i]['active'] = false;\r\n\t\t\t\t$list['pages'][$i]['data'] = ($itemOverride) ? pagination_item_inactive($page) : $this->_item_inactive($page);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif ($data->next->base !== null)\r\n\t\t{\r\n\t\t\t$list['next']['active'] = true;\r\n\t\t\t$list['next']['data'] = ($itemOverride) ? pagination_item_active($data->next) : $this->_item_active($data->next);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t$list['next']['active'] = false;\r\n\t\t\t$list['next']['data'] = ($itemOverride) ? pagination_item_inactive($data->next) : $this->_item_inactive($data->next);\r\n\t\t}\r\n\r\n\t\tif ($data->end->base !== null)\r\n\t\t{\r\n\t\t\t$list['end']['active'] = true;\r\n\t\t\t$list['end']['data'] = ($itemOverride) ? pagination_item_active($data->end) : $this->_item_active($data->end);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t$list['end']['active'] = false;\r\n\t\t\t$list['end']['data'] = ($itemOverride) ? pagination_item_inactive($data->end) : $this->_item_inactive($data->end);\r\n\t\t}\r\n\r\n\t\tif ($this->total > $this->limit)\r\n\t\t{\r\n\t\t\treturn ($listOverride) ? pagination_list_render($list) : $this->_list_render($list);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\treturn '';\r\n\t\t}\r\n\t}",
"private function _getNavigation()\r\n\t{\r\n\t\tglobal $action, $whmcs;\r\n\t\t\r\n\t\t$uri\t= DunUri :: getInstance('SERVER', true );\r\n\t\t$uri->delVar( 'task' );\r\n\t\t$uri->delVar( 'submit' );\r\n\t\t\r\n\t\t$html\t= '<ul class=\"nav nav-pills\">';\r\n\t\t\r\n\t\tforeach( array( 'themes', 'config', 'license' ) as $item ) {\r\n\t\t\t\r\n\t\t\tif ( $item == $action ) {\r\n\t\t\t\tif ( array_key_exists( 'task', $whmcs->input ) ) {\r\n\t\t\t\t\tif ( $whmcs->input['task'] != 'edittheme' ) {\r\n\t\t\t\t\t\t$html .= '<li class=\"active\"><a href=\"#\">' . t( 'themer.admin.module.navbar.' . $item ) . '</a></li>';\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\t$html .= '<li class=\"active\"><a href=\"#\">' . t( 'themer.admin.module.navbar.' . $item ) . '</a></li>';\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t$uri->setVar( 'action', $item );\r\n\t\t\t$html .= '<li><a href=\"' . $uri->toString() . '\">' . t( 'themer.admin.module.navbar.' . $item ) . '</a></li>';\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t\t$html\t.= '</ul>';\r\n\t\treturn $html;\r\n\t}",
"function getNavigation()\n\t{\n\n\n\t\treturn;\n\n\t\tglobal $gMysql;\n\t\tglobal $member_id;\n\t\t# grab these items\n\t\t$num_views\t\t\t=\t$gMysql->queryItem(\"select count(*) from sm_views where member_id='$member_id'\",__FILE__,__LINE__);\n\t\t$num_winks\t\t\t=\t$gMysql->queryItem(\"select count(*) from sm_winks where member_id='$member_id'\",__FILE__,__LINE__);\n\t\t$num_favs\t\t\t=\t$gMysql->queryItem(\"select count(*) from sm_fav where member_id='$member_id'\",__FILE__,__LINE__);\n\t\t$num_messages\t\t=\t$gMysql->queryItem(\"select count(*) from sm_messages where member_id='$member_id'\",__FILE__,__LINE__);\n\n\n\n\t\t$menuArray\t=\tarray(\n\t\tarray(\n\t\t\"title\"\t\t\t=>\t\"Profile\",\n\t\t\"bShowNumber\"\t=>\tfalse,\n\t\t\"number\"\t\t=>\t0,\n\t\t\"bHeader\"\t\t=>\ttrue,\n\t\t\"className\"\t\t=>\t\"icon-user\",\n\t\t\"link\" \t\t\t=>\t\"http://bbc.co.uk\",\n\t\t),\n\t\tarray(\n\t\t\"title\"\t\t\t =>\t\"Search\",\n\t\t\"bShowNumber\"\t =>\tfalse,\n\t\t\"number\"\t\t =>\t0,\n\t\t\"bHeader\"\t\t =>\ttrue,\n\t\t\"className\"\t\t =>\t\"icon-search\",\n\t\t\"link\" \t\t\t =>\t\"search\",\n\t\t),\n\t\tarray(\n\t\t\"title\"\t\t\t =>\t\"Messages\",\n\t\t\"bShowNumber\"\t =>\ttrue,\n\t\t\"number\"\t\t =>\t$num_messages,\n\t\t\"bHeader\"\t\t =>\ttrue,\n\t\t\"className\"\t\t =>\t\"icon-mail\",\n\t\t\"link\" \t\t\t =>\t\"inbox\",\n\t\t),\n\t\tarray(\n\t\t\"title\"\t\t\t =>\t\"Views\",\n\t\t\"bShowNumber\"\t =>\ttrue,\n\t\t\"number\"\t\t =>\t$num_views,\n\t\t\"bHeader\"\t\t =>\ttrue,\n\t\t\"className\"\t\t =>\t\"icon-binoculars\",\n\t\t\"link\" \t\t\t =>\t\"views\",\n\t\t),\n\t\tarray(\n\t\t\"title\"\t\t\t =>\t\"Winks\",\n\t\t\"bShowNumber\"\t =>\ttrue,\n\t\t\"number\"\t\t =>\t$num_winks,\n\t\t\"bHeader\"\t\t =>\ttrue,\n\t\t\"className\"\t\t =>\t\"icon-eye\",\n\t\t\"link\" \t\t\t =>\t\"winks\",\n\t\t),\n\t\tarray(\n\t\t\"title\"\t\t\t =>\t\"Favourites\",\n\t\t\"bShowNumber\"\t =>\ttrue,\n\t\t\"number\"\t\t =>\t$num_favs,\n\t\t\"bHeader\"\t\t =>\ttrue,\n\t\t\"className\"\t\t =>\t\"icon-bookmarks\",\n\t\t\"link\" \t\t\t =>\t\"favourites\",\n\t\t),\n\t\tarray(\n\t\t\"title\"\t\t\t =>\t\"Matches\",\n\t\t\"bShowNumber\"\t =>\tfalse,\n\t\t\"number\"\t\t =>\t0,\n\t\t\"bHeader\"\t\t =>\ttrue,\n\t\t\"className\"\t\t =>\t\"icon-heart\",\n\t\t\"link\" \t\t\t =>\t\"matches\",\n\t\t),\n\t\tarray(\n\t\t\"title\"\t\t\t =>\t\"Membership\",\n\t\t\"bShowNumber\"\t =>\tfalse,\n\t\t\"number\"\t\t =>\t0,\n\t\t\"bHeader\"\t\t =>\ttrue,\n\t\t\"className\"\t\t =>\t\"icon-unlocked\",\n\t\t\"link\" \t\t\t =>\t\"membership\",\n\t\t),\n\t\tarray(\n\t\t\"title\"\t\t\t =>\t\"Profile\",\n\t\t\"bShowNumber\"\t =>\tfalse,\n\t\t\"number\"\t\t =>\t0,\n\t\t\"bHeader\"\t\t =>\ttrue,\n\t\t\"className\"\t\t =>\t\"icon-user\",\n\t\t\"link\" \t\t\t =>\t\"profile\",\n\t\t),\n\t\tarray(\n\t\t\"title\"\t\t\t\t=>\t\"Logout\",\n\t\t\"bShowNumber\"\t\t=>\tfalse,\n\t\t\"number\"\t\t\t=>\t0,\n\t\t\"bHeader\"\t\t\t=>\ttrue,\n\t\t\"className\"\t\t\t=>\t\"icon-switch\",\n\t\t\"link\"\t\t\t\t=>\t\"javacript:confirm('app/m/login/logout');\",\n\t\t),\n\t\t);\n\n\t\t$selectedItem\t=\t3;\n\t\t$index\t\t\t=\t0;\n\n\n\t\t$menuString\t=\t' <ul> ';\n\n\n\t\tforeach ($menuArray as $menuItem)\n\t\t{\n\t\t\t# build html of menu\n\t\t\tif\t($selectedItem == $index)\n\t\t\t{\n\t\t\t\t$menu_line\t=\t'<li class=\"selected\">';\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$menu_line\t=\t'<li>';\n\t\t\t}\n\n\n\t\t\t$menu_line\t.=\t'<a href=\"' . $menuItem['link'] . '\" class=\"' . $menuItem['className'] . '\" >' . $menuItem['title'];\n\t\t\t# numerics?\n\t\t\tif\t($menuItem['bShowNumber'] == true)\n\t\t\t{\n\t\t\t\t$menu_line\t.=\t\t' <span class=\"pip\">' . $menuItem['number'] . '</span>';\n\t\t\t}\n\t\t\t$menu_line .= \"</a></li>\\r\\n\";\n\n\t\t\t$menuString\t.=\t$menu_line;\n\n\t\t\t$index++;\n\t\t}\n\t\t$menuString\t.=\t\"</ul>\";\n\n\t\treturn\t$menuString;\n\t}",
"public function getSortMenu();",
"public function registerNavigation()\n {\n return [\n 'iklan' => [\n 'label' => 'Iklan',\n 'url' => Backend::url('panatausolusindo/iklan/iklan'),\n 'icon' => 'icon-diamond',\n 'permissions' => ['panatausolusindo.iklan.kelola_iklan'],\n 'order' => 500,\n 'sideMenu' => [\n 'iklan' => [\n 'label' => 'Daftar Iklan',\n 'icon' => 'icon-list',\n 'url' => Backend::url('panatausolusindo/iklan/iklan'),\n 'permissions' => ['panatausolusindo.iklan.kelola_iklan']\n ],\n 'client' => [\n 'label' => 'Client',\n 'icon' => 'icon-user',\n 'url' => Backend::url('panatausolusindo/iklan/clientiklan'),\n 'permissions' => ['panatausolusindo.iklan.kelola_iklan']\n ],\n 'tempat' => [\n 'label' => 'Tempat',\n 'icon' => 'icon-anchor',\n 'url' => Backend::url('panatausolusindo/iklan/tempatiklan'),\n 'permissions' => ['panatausolusindo.iklan.kelola_iklan']\n ]\n ]\n ],\n ];\n }",
"public function appendNavigation(){\n\t\t\t$nav = $this->getNavigationArray();\n\n\t\t\t/**\n\t\t\t * Immediately before displaying the admin navigation. Provided with the\n\t\t\t * navigation array. Manipulating it will alter the navigation for all pages.\n\t\t\t *\n\t\t\t * @delegate NavigationPreRender\n\t\t\t * @param string $context\n\t\t\t * '/backend/'\n\t\t\t * @param array $nav\n\t\t\t * An associative array of the current navigation, passed by reference\n\t\t\t */\n\t\t\tSymphony::ExtensionManager()->notifyMembers('NavigationPreRender', '/backend/', array('navigation' => &$nav));\n\n\t\t\t$xNav = new XMLElement('ul');\n\t\t\t$xNav->setAttribute('id', 'nav');\n\n\t\t\tforeach($nav as $n){\n\t\t\t\tif($n['visible'] == 'no') continue;\n\n\t\t\t\t$can_access = false;\n\n\t\t\t\tif(!isset($n['limit']) || $n['limit'] == 'author')\n\t\t\t\t\t$can_access = true;\n\n\t\t\t\telseif($n['limit'] == 'developer' && Administration::instance()->Author->isDeveloper())\n\t\t\t\t\t$can_access = true;\n\n\t\t\t\telseif($n['limit'] == 'primary' && Administration::instance()->Author->isPrimaryAccount())\n\t\t\t\t\t$can_access = true;\n\n\t\t\t\tif($can_access) {\n\t\t\t\t\t$xGroup = new XMLElement('li', $n['name']);\n\t\t\t\t\tif(isset($n['class']) && trim($n['name']) != '') $xGroup->setAttribute('class', $n['class']);\n\n\t\t\t\t\t$hasChildren = false;\n\t\t\t\t\t$xChildren = new XMLElement('ul');\n\n\t\t\t\t\tif(is_array($n['children']) && !empty($n['children'])){\n\t\t\t\t\t\tforeach($n['children'] as $c){\n\t\t\t\t\t\t\tif($c['visible'] == 'no') continue;\n\n\t\t\t\t\t\t\t$can_access_child = false;\n\n\t\t\t\t\t\t\tif(!isset($c['limit']) || $c['limit'] == 'author')\n\t\t\t\t\t\t\t\t$can_access_child = true;\n\n\t\t\t\t\t\t\telseif($c['limit'] == 'developer' && Administration::instance()->Author->isDeveloper())\n\t\t\t\t\t\t\t\t$can_access_child = true;\n\n\t\t\t\t\t\t\telseif($c['limit'] == 'primary' && Administration::instance()->Author->isPrimaryAccount())\n\t\t\t\t\t\t\t\t$can_access_child = true;\n\n\t\t\t\t\t\t\tif($can_access_child) {\n\t\t\t\t\t\t\t\t$xChild = new XMLElement('li');\n\t\t\t\t\t\t\t\t$xChild->appendChild(\n\t\t\t\t\t\t\t\t\tWidget::Anchor($c['name'], SYMPHONY_URL . $c['link'])\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\t$xChildren->appendChild($xChild);\n\t\t\t\t\t\t\t\t$hasChildren = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif($hasChildren){\n\t\t\t\t\t\t\t$xGroup->appendChild($xChildren);\n\t\t\t\t\t\t\t$xNav->appendChild($xGroup);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$this->Header->appendChild($xNav);\n\t\t\tAdministration::instance()->Profiler->sample('Navigation Built', PROFILE_LAP);\n\t\t}",
"public function getNavigation() {\n \n $search = $this->search();\n $menuObjects = $search->getRecords();\n $result = array();\n $fields = $this->definition->fields();\n $menuItemField = FieldService::instance()->getFieldByName($fields, \"menuItems\");\n \n //$search->getRelationsForObjects(\"menuItems\", $menuObjects);\n \n foreach($menuObjects as $menuObject) {\n $result[$menuObject->name] = $search->getRelations($menuItemField, $menuObject->id);\n }\n \n return $result;\n }",
"protected function _getTableOptions(){ }",
"protected function buildPagination()\n {\n $this->calculateDisplayRange();\n $pages = [];\n for ($i = $this->displayRangeStart; $i <= $this->displayRangeEnd; $i++) {\n $pages[] = [\n 'number' => $i,\n 'offset' => ($i - 1) * $this->itemsPerPage,\n 'isCurrent' => $i === $this->currentPage\n ];\n }\n $pagination = [\n 'linkConfiguration' => $this->linkConfiguration,\n 'pages' => $pages,\n 'current' => $this->currentPage,\n 'numberOfPages' => $this->numberOfPages,\n 'lastPageOffset' => ($this->numberOfPages - 1) * $this->itemsPerPage,\n 'displayRangeStart' => $this->displayRangeStart,\n 'displayRangeEnd' => $this->displayRangeEnd,\n 'hasLessPages' => $this->displayRangeStart > 2,\n 'hasMorePages' => $this->displayRangeEnd + 1 < $this->numberOfPages\n ];\n if ($this->currentPage < $this->numberOfPages) {\n $pagination['nextPage'] = $this->currentPage + 1;\n $pagination['nextPageOffset'] = $this->currentPage * $this->itemsPerPage;\n }\n if ($this->currentPage > 1) {\n $pagination['previousPage'] = $this->currentPage - 1;\n $pagination['previousPageOffset'] = ($this->currentPage - 2) * $this->itemsPerPage;\n }\n return $pagination;\n }",
"public function getNavigation() {\n\t\t$plugins = Admin::getModels();\n\t\t$navigation = array();\n\n\t\tforeach ($plugins as $plugin) {\n\t\t\t$models = array();\n\n\t\t\tforeach ($plugin['models'] as $model) {\n\t\t\t\tif ($model['installed']) {\n\t\t\t\t\t$models[Inflector::humanize($model['group'])][] = $model;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$navigation[$plugin['title']] = $models;\n\t\t}\n\n\t\treturn $navigation;\n\t}",
"public function registerNavigation()\n {\n\n return [\n 'food' => [\n 'label' => 'Food',\n 'url' => Backend::url('milo/food/foods'),\n 'icon' => 'icon-cutlery',\n 'permissions' => ['milo.food.*'],\n 'order' => 400,\n\n\t 'sideMenu' => [\n 'food' => [\n 'label' => 'Food',\n 'url' => Backend::url('milo/food/foods'),\n 'icon' => 'icon-cutlery',\n 'permissions' => ['milo.food.*'],\n ],\n\t \t'categories' => [\n\t\t\t 'label' => 'Food Categories',\n\t\t\t 'url' => Backend::url('milo/food/foodcategories'),\n\t\t\t 'icon' => 'icon-tags',\n\t\t\t 'permissions' => ['milo.food.*'],\n\t\t ],\n 'lunchoffer' => [\n 'label' => 'Lunch Offer',\n 'url' => Backend::url('milo/food/lunchoffers'),\n 'icon' => 'icon-bullhorn',\n 'permissions' => ['milo.food.*'],\n ]\n\t ]\n ],\n ];\n }",
"public function renderNav() {\n if($this->renderNav['onoff']) {\n \n if(isset($this->renderNav['html']) && $this->renderNav['html']) {\n $content = $this->renderNav['html'];\n unset($this->renderNav['html']);\n } else {\n $ct['btnAddNav'] = $this->btnAddNav;\n $ct['btnAddMultiNav'] = $this->btnAddMultiNav;\n $ct['btnDeleteNav'] = $this->btnDeleteNav;\n $ct['btnCopyNav'] = $this->btnCopyNav;\n $result = '';\n $get = r()->get();\n foreach($ct as $key => $item) {\n if($item && isset($item['onoff']) && $item['onoff']) {\n unset($item['onoff']);\n if(isset($item['href'])) {\n $href = $item['href'];\n unset($item['href']);\n } else {\n $params = isset($get['SettingsGridSearch']['table_id']) ? $get : [];\n $params['menu_admin_id'] = $this->menu_admin_id;\n $href = UtilityUrl::createUrl($item['link_children'],$params);\n }\n $html = $item['icon'].$item['html'];unset($item['html']);unset($item['icon']);unset($item['link_children']);\n $result .= Html::a($html, $href, $item).' ';\n }\n }\n $content = '<div class=\"fr\">'.$result.'</div>';\n }\n unset($this->renderNav['onoff']);\n $html = Html::tag('div',$content.$this->renderNavLeft, $this->renderNav);\n return $html;\n } else {\n return '';\n }\n }",
"function create_links() {\n $total_rows = $this->total_rows;\n if ($total_rows == 0) {\n return '';\n }\n\n // Calculate the total number of pages\n $CI = & get_instance();\n $_quantity = $CI->_quantity;\n $per_page = $this->per_page;\n $num_pages = ceil($total_rows / $per_page);\n\n // Is there only one page? Hm... nothing more to do here then.\n if ($num_pages == 1) {\n return '';\n }\n\n // Determine the current page number.\n $_offset = $CI->_offset;\n $cur_page = $_quantity == -1 ? -1 : floor($CI->_offset / $per_page) + 1;\n\n // And here we go...\n $output = '';\n\n // Render the \"First\" link\n if ($cur_page != 1) {\n $i = 0;\n $output .= $this->first_tag_open . $i . $this->first_tag_close;\n } else {\n $output .= \"<li class='null'></li>\";\n }\n\n // Render the \"previous\" link\n if ($cur_page != 1 && $_quantity != -1) {\n $i = $_offset - $per_page;\n $output .= $this->prev_tag_open . $i . $this->prev_tag_close;\n } else {\n $output .= \"<li class='null'></li>\";\n }\n\n // Write the digit links\n $output .= \"<select tabindex='-1'>\";\n $start = 1;\n $end = $per_page;\n if ($_quantity == -1)\n $output .= '<option selected=\"selected\" > - </option>';\n for ($loop = 1; $loop <= $num_pages; $loop++) {\n if ($end > $total_rows)\n $end = $total_rows;\n $output .= '<option value=\"' . (($loop - 1) * $per_page) . '\" ' . ($loop == $cur_page ? \"selected='selected'\" : \"\") . ' >Trang ' . $loop . '/' . $num_pages . ' ' . $start . \"-\" . $end . '/' . $total_rows . '</option>';\n $start+=$per_page;\n $end+=$per_page;\n }\n $output .= \"</select>\";\n\n // Render the \"next\" link\n if ($cur_page != $num_pages && $_quantity != -1) {\n $i = $_offset + $per_page;\n $output .= $this->next_tag_open . $i . $this->next_tag_close;\n } else {\n $output .= \"<li class='null'></li>\";\n }\n\n // Render the \"Last\" link\n if ($cur_page != $num_pages) {\n $i = ($num_pages - 1) * $per_page;\n $output .= $this->last_tag_open . $i . $this->last_tag_close;\n } else {\n $output .= \"<li class='null'></li>\";\n }\n\n // Add the wrapper HTML if exists\n $output = $this->full_tag_open . $output . str_replace(array(\"{class}\", \"{style}\"), array(($_quantity == -1 ? \"ui-state-hover\" : \"icon\"), ($_quantity == -1 ? \"cursor:default\" : \"\")), $this->full_tag_close);\n\n return $output;\n }",
"function nav_pages_struct(&$result, $q_string, $count, $REC_PER_PAGE) {\n \n\tglobal $label;\n\tglobal $list_mode;\n\t\n\tif ($list_mode=='PREMIUM') {\n\t\t$page = 'hot.php';\t\t\n\t} else {\n\t\t$page = $_SERVER[PHP_SELF];\n\t}\n\t$offset = $_REQUEST[\"offset\"];\n\t$show_emp = $_REQUEST[\"show_emp\"];\n\t\n\tif ($show_emp != '') {\n\t $show_emp = (\"&show_emp=$show_emp\");\n\t}\n\t$cat = $_REQUEST[\"cat\"];\n\tif ($cat != '') {\n\t $cat = (\"&cat=$cat\");\n\t}\n\t$order_by = $_REQUEST[\"order_by\"];\n\tif ($order_by != '') {\n\t $order_by = (\"&order_by=$order_by\");\n\t}\n\n\t$cur_page = $offset / $REC_PER_PAGE;\n\t$cur_page++;\n\t// estimate number of pages.\n\t$pages = ceil($count / $REC_PER_PAGE);\n\tif ($pages == 1) {\n\t return;\n\t}\n\t$off = 0;\n\t$p=1;\n\t$prev = $offset-$REC_PER_PAGE;\n\t$next = $offset+$REC_PER_PAGE;\n\n\tif ($prev===0) {\n\t\t$prev='';\n\t}\n\n\tif ($prev > -1) {\n\t $nav['prev'] = \"<a href='\".$page.\"?offset=\".$prev.$q_string.$show_emp.$cat.$order_by.\"'>\".$label[\"navigation_prev\"] .\"</a> \";\n\t \n\t}\n\tfor ($i=0; $i < $count; $i=$i+$REC_PER_PAGE) {\n\t if ($p == $cur_page) {\n\t\t $nav['cur_page'] = $p;\n\t\t \n\t\t \n\t } else {\n\t\t if ($off===0) {\n\t\t\t$off='';\n\t\t}\n\t\t if ($nav['cur_page'] !='') {\n\t\t\t $nav['pages_after'][$p] = $off;\n\t\t } else {\n\t\t\t$nav['pages_before'][$p] = $off;\n\t\t }\n\t }\n\t $p++;\n\t $off = $off + $REC_PER_PAGE;\n\t}\n\tif ($next < $count ) \n\t\t$nav['next'] = \" | <a href='\".$page.\"?offset=\".$next.$q_string.$show_emp.$cat.$order_by.\"'> \".$label[\"navigation_next\"].\"</a>\";\n\n\treturn $nav;\n}",
"private function build_navigation() {\n\t\t$content = \"<nav id='formlift-header' class='formlift-nav'>\";\n\t\tforeach ( $this->sections as $section ) {\n\t\t\t$content .= $section->get_header();\n\t\t}\n\n\t\treturn $content . \"<button type='submit' style='margin: 45px' class='button button-large'>SAVE CHANGES</button></nav>\";\n\t}",
"function build_pagelinks($data)\n\t{\n\t\t$data['leave_out'] = isset($data['leave_out']) ? $data['leave_out'] : '';\n\t\t$data['no_dropdown'] = isset($data['no_dropdown']) ? intval( $data['no_dropdown'] ) : 0;\n\t\t$data['USE_ST']\t\t = isset($data['USE_ST'])\t? $data['USE_ST']\t : '';\n\t\t$work = array( 'pages' => 0, 'page_span' => '', 'st_dots' => '', 'end_dots' => '' );\n\t\t\n\t\t$section = !$data['leave_out'] ? 2 : $data['leave_out']; // Number of pages to show per section( either side of current), IE: 1 ... 4 5 [6] 7 8 ... 10\n\t\t\n\t\t$use_st = !$data['USE_ST'] ? 'st' : $data['USE_ST'];\n\t\t\n\t\t//-----------------------------------------\n\t\t// Get the number of pages\n\t\t//-----------------------------------------\n\t\t\n\t\tif ( $data['TOTAL_POSS'] > 0 )\n\t\t{\n\t\t\t$work['pages'] = ceil( $data['TOTAL_POSS'] / $data['PER_PAGE'] );\n\t\t}\n\t\t\n\t\t$work['pages'] = $work['pages'] ? $work['pages'] : 1;\n\t\t\n\t\t//-----------------------------------------\n\t\t// Set up\n\t\t//-----------------------------------------\n\t\t\n\t\t$work['total_page'] = $work['pages'];\n\t\t$work['current_page'] = $data['CUR_ST_VAL'] > 0 ? ($data['CUR_ST_VAL'] / $data['PER_PAGE']) + 1 : 1;\n\t\t\n\t\t//-----------------------------------------\n\t\t// Next / Previous page linkie poos\n\t\t//-----------------------------------------\n\t\t\n\t\t$previous_link = \"\";\n\t\t$next_link = \"\";\n\t\t\n\t\tif ( $work['current_page'] > 1 )\n\t\t{\n\t\t\t$start = $data['CUR_ST_VAL'] - $data['PER_PAGE'];\n\t\t\t$previous_link = $this->compiled_templates['skin_global']->pagination_previous_link(\"{$data['BASE_URL']}&$use_st=$start\");\n\t\t}\n\t\t\n\t\tif ( $work['current_page'] < $work['pages'] )\n\t\t{\n\t\t\t$start = $data['CUR_ST_VAL'] + $data['PER_PAGE'];\n\t\t\t$next_link = $this->compiled_templates['skin_global']->pagination_next_link(\"{$data['BASE_URL']}&$use_st=$start\");\n\t\t}\n\t\t\n\t\t//-----------------------------------------\n\t\t// Loppy loo\n\t\t//-----------------------------------------\n\t\t\n\t\tif ($work['pages'] > 1)\n\t\t{\n\t\t\t$work['first_page'] = $this->compiled_templates['skin_global']->pagination_make_jump($work['pages'], $data['no_dropdown']);\n\t\t\t\n\t\t\tif ( 1 < ($work['current_page'] - $section))\n\t\t\t{\n\t\t\t\t$work['st_dots'] = $this->compiled_templates['skin_global']->pagination_start_dots($data['BASE_URL']);\n\t\t\t}\n\t\t\t\n\t\t\tfor( $i = 0, $j= $work['pages'] - 1; $i <= $j; ++$i )\n\t\t\t{\n\t\t\t\t$RealNo = $i * $data['PER_PAGE'];\n\t\t\t\t$PageNo = $i+1;\n\t\t\t\t\n\t\t\t\tif ($RealNo == $data['CUR_ST_VAL'])\n\t\t\t\t{\n\t\t\t\t\t$work['page_span'] .= $this->compiled_templates['skin_global']->pagination_current_page( ceil( $PageNo ) );\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif ($PageNo < ($work['current_page'] - $section))\n\t\t\t\t\t{\n\t\t\t\t\t\t// Instead of just looping as many times as necessary doing nothing to get to the next appropriate number, let's just skip there now\n\t\t\t\t\t\t$i = $work['current_page'] - $section - 2;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t// If the next page is out of our section range, add some dotty dots!\n\t\t\t\t\t\n\t\t\t\t\tif ($PageNo > ($work['current_page'] + $section))\n\t\t\t\t\t{\n\t\t\t\t\t\t$work['end_dots'] = $this->compiled_templates['skin_global']->pagination_end_dots(\"{$data['BASE_URL']}&$use_st=\".($work['pages']-1) * $data['PER_PAGE']);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t$work['page_span'] .= $this->compiled_templates['skin_global']->pagination_page_link(\"{$data['BASE_URL']}&$use_st={$RealNo}\", ceil( $PageNo ) );\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t$work['return'] = $this->compiled_templates['skin_global']->pagination_compile($work['first_page'],$previous_link,$work['st_dots'],$work['page_span'],$work['end_dots'],$next_link,$data['TOTAL_POSS'],$data['PER_PAGE'], $data['BASE_URL'], $data['no_dropdown'], $use_st);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$work['return'] = $data['L_SINGLE'];\n\t\t}\n\t\n\t\treturn $work['return'];\n\t}",
"public function getNavigation ($showAll = false)\n\t{\n\t\t$text = Core_Text::__getInstance ();\n\t\t\n\t\t$o = array ();\n\t\t$o['main'] = new Logic_NavContainer ($this->objCMS, 'main', $text->get ('navigation', 'admin', 'navigation'));\n\t\t\n\t\t// Navigation\n\t\t$o['main']->appendChild\n\t\t(\n\t\t\tnew Logic_Navigation\n\t\t\t(\n\t\t\t\tarray\n\t\t\t\t(\n\t\t\t\t\t'id' => 'nav',\n\t\t\t\t\t'sName' => 'Navigation',\n\t\t\t\t\t'sUrl' => $this->objCMS->getAdminUrl ('navigation')\n\t\t\t\t)\n\t\t\t)\n\t\t);\n\t\t\n\t\tforeach ($this->objCMS->getAllModules () as $item => $module)\n\t\t{\n\t\t\tif ($module->showAdminTab ())\n\t\t\t{\n\t\t\t\t$o['main']->appendChild\n\t\t\t\t(\n\t\t\t\t\tnew Logic_Navigation\n\t\t\t\t\t(\n\t\t\t\t\t\tarray\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\t'id' => $item,\n\t\t\t\t\t\t\t'sName' => $text->get ($item, 'navigation', 'admin'),\n\t\t\t\t\t\t\t'sUrl' => $this->objCMS->getAdminUrl ($item)\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\t\n\t\t// Logout\t\t\n\t\t$o['main']->appendChild\n\t\t(\n\t\t\tnew Logic_Navigation\n\t\t\t(\n\t\t\t\tarray\n\t\t\t\t(\n\t\t\t\t\t'id' => 'logout',\n\t\t\t\t\t'sName' => 'Logout',\n\t\t\t\t\t'sUrl' => $this->objCMS->getAdminUrl ('logout', null, null, 'logout=yes')\n\t\t\t\t)\n\t\t\t)\n\t\t);\n\t\t\n\t\t// Settings\n\t\t$o['main']->appendChild\n\t\t(\n\t\t\tnew Logic_Navigation\n\t\t\t(\n\t\t\t\tarray\n\t\t\t\t(\n\t\t\t\t\t'id' => 'settings',\n\t\t\t\t\t'sName' => 'Settings',\n\t\t\t\t\t'sUrl' => $this->objCMS->getAdminUrl ('settings')\n\t\t\t\t)\n\t\t\t)\n\t\t);\n\t\t\n\t\treturn $o;\n\t}"
]
| [
"0.6120339",
"0.5898749",
"0.5884466",
"0.58527035",
"0.5819622",
"0.5768236",
"0.57286805",
"0.56696594",
"0.56555665",
"0.5626478",
"0.56094486",
"0.5602402",
"0.55946827",
"0.5591048",
"0.5585551",
"0.557883",
"0.5568153",
"0.5538077",
"0.5525394",
"0.552008",
"0.5502185",
"0.54979426",
"0.5487648",
"0.5485243",
"0.5467218",
"0.54581517",
"0.5444262",
"0.54437464",
"0.54365927",
"0.5435887"
]
| 0.7501029 | 0 |
this is the function that processes the signup | public function p_signup() {
$q= 'Select email
From users
WHERE email="'.$_POST['email'].'"';
# see if the email exists
$emailexists= DB::instance(DB_NAME)->select_field($q);
# email exists, throw an error
if($emailexists){
Router::redirect("/users/signup/error");
}
#requires all fields to be entered if java script is disabled, otherwise thow a different error
elseif (!$_POST['email'] OR !$_POST['last_name'] OR !$_POST['first_name'] OR !$_POST['password']) {
Router::redirect("/users/signup/error2");
}
# all is well , proceed with signup
else{
$_POST['created']= Time::now();
$_POST['password']= sha1(PASSWORD_SALT.$_POST['password']);
$_POST['token']= sha1(TOKEN_SALT.$_POST['email'].Utils::generate_random_string());
# add user to the database and redirect to users login page
$user_id=DB::instance(DB_NAME)->insert_row('users',$_POST);
# Create users first Notebook
$notebook['name']= $_POST['first_name'].' Notebook';
$notebook['user_id']= $user_id;
$notebook['created']= Time::now();
$notebook['modified']= Time::now();
DB::instance(DB_NAME)->insert_row('notebooks',$notebook);
Router::redirect('/users/login');
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function p_signup(){\n\t\tforeach($_POST as $field => $value){\n\t\t\tif(empty($value)){\n\t\t\t\tRouter::redirect('/users/signup/empty-fields');\n\t\t\t}\n\t\t}\n\n\t\t#check for duplicate email\n\t\tif ($this->userObj->confirm_unique_email($_POST['email']) == false){\n\t\t\t#send back to signup page\n\t\t\tRouter::redirect(\"/users/signup/duplicate\");\n\t\t}\n\n\t\t#adding data to the user\n\t\t$_POST['created'] = Time::now();\n\t\t$_POST['modified'] = Time::now();\n\n\t\t#encrypt password\n\t\t$_POST['password'] = sha1(PASSWORD_SALT.$_POST['password']);\n\n\t\t#create encrypted token via email and a random string\n\t\t$_POST['token'] = sha1(TOKEN_SALT.$_POST['email'].Utils::generate_random_string());\n\n\t\t#Insert into the db\n\t\t$user_id = DB::instance(DB_NAME)->insert('users', $_POST);\n\n\t\t# log in the new user\n\n\t\tsetcookie(\"token\", $_POST['token'], strtotime('+2 weeks'), '/');\n\n\t\t# redirect to home\n\t\tRouter::redirect('/users/home');\n\t\t\n\t}",
"public function sign_up()\n {\n\n }",
"public function p_signup() {\n\t#print_r($_POST);\n\n\t# Prevent SQL injection attacks by sanitizing user entered data\n\t$_POST = DB::instance(DB_NAME)->sanitize($_POST);\n\n\t#encrypt\n\t$_POST['password'] = sha1(PASSWORD_SALT.$_POST['password']);\n\t#can override password salt in application version in core config\n\n\t$_POST['token'] = sha1(TOKEN_SALT.$_POST['email'].Utils::generate_random_string());\n\t#token salt, users email, random string then hashed\n\n\t$_POST['created'] = Time::now(); #could mimic different time\n\t$_POST['modified'] = Time::now(); #time stamp\n\n\t#check if the address is not in use in the system\n\t$q = \"SELECT email\n\tFROM users WHERE email = '\".$_POST['email'].\"'\";\n\n\t$email = DB::instance(DB_NAME)->select_field($q);\n\n\tif($email == $_POST['email'] && $_POST['email' != \"\"]){\t\n\n\t\t$address_in_use = \"The email address you have entered is already in use. Please pick another.\";\n\t\tRouter::redirect(\"/users/signup/error=$address_in_use\");\n\t}\n\n\tif($_POST['email'] == \"\" || $_POST['first_name'] == \"\" || $_POST['last_name'] == \"\" || $_POST['password'] == \"\" ){\n\n\t\t$required = \"All fields on this form are required.\";\n\t\tRouter::redirect(\"/users/signup/error: $required\");\n\t}\n\telse{\n\n\t\t$user_id = DB::instance(DB_NAME)->insert(\"users\", $_POST);\n\n\n\t\t# For now, just confirm they've signed up - we can make this fancier later\n\t\techo \"You're registered! Now go <a href='/users/login'>add issue</a>\";\n\t\tRouter::redirect(\"/users/login\");\n\t}\t\n}",
"function process_signup()\n\t{\n\t\t$parameter = file_get_contents(\"php://input\");\n\t\t\n\t\t// Decode data\n\t\t$decode_param = json_decode($parameter);\n\t\t\n\t\t// Validation format parameter\n\t\tif(! isset($decode_param->Name) ||\n\t\t\t! isset($decode_param->Username) ||\n\t\t\t! isset($decode_param->Password)\n\t\t){\n\t\t\techo json_encode(array('Status' => 500, 'Message' => 'Your format parameter is wrong')); // 500 = Internal Server Error\n\t\t\texit;\n\t\t}\n\t\t\n\t\t// Validation of null value\n\t\tif($decode_param->Name == '' ||\n\t\t\t$decode_param->Username == '' ||\n\t\t\t$decode_param->Password == ''\n\t\t){\n\t\t\techo json_encode(array('Status' => 500, 'Message' => 'Your format parameter must be filled')); // 500 = Internal Server Error\n\t\t\texit;\n\t\t}\n\t\t\n\t\t// Set variable\n\t\t$name = $decode_param->Name;\n\t\t$username = $decode_param->Username;\n\t\t$password = $decode_param->Password;\n\t\t\n\t\t// Check to database\n\t\t// Duplicate email or not\n\t\t$duplicate_email = $this->db->query(\"SELECT COUNT(*) AS count_data FROM tbl_user WHERE username = '\". $username .\"'\")->row()->count_data;\n\t\tif($duplicate_email > 0){\n\t\t\techo json_encode(array('Status' => 500, 'Message' => 'Your email have exist at database. Please, choose another email or recover your password.')); // 500 = Internal Server Error\n\t\t\texit;\n\t\t}\n\t\t\n\t\t// Save data\n\t\t$date_now = date('Y-m-d H:i:s', strtotime(\"now\"));\n\t\t$data = array(\n\t\t\t'username' => $username,\n\t\t\t'password' => md5($password),\n\t\t\t'name' => $name,\n\t\t\t'email' => $username,\n\t\t\t'last_login_time' => '0000-00-00 00:00:00',\n\t\t\t'created_on' => $date_now,\n\t\t\t'last_modified_on' => $date_now\n\t\t);\n\t\tif($this->db->insert('tbl_user', $data)){\n\t\t\t// 200 = OK - Save success\n\t\t\techo json_encode(array('Status' => 200, 'Message' => 'Save Success. You can login now'));\n\t\t} else {\n\t\t\t// 500 = Internal Server Error - Save failed\n\t\t\techo json_encode(array('Status' => 500, 'Message' => 'Save Failed. Please try again'));\n\t\t}\n\t\t\n\t}",
"public function handleSignUp()\n {\n $data = \\Request::all();\n $result = \\DB::transaction(function() use($data) {\n $data['type'] = Member::USER_TYPE_ID;\n // honeypot checking for valid submission\n $this->companyService->honeypotCheck($data);\n // get the plan\n $plan = Plan::findOrFail($data['plan_id']);\n // create the company\n list($company, $role) = $this->companyService->create($data);\n // create the user\n $data['company_id'] = $company->id;\n $data['roles'] = [$role->id];\n $data['is_owner'] = true;\n $user = $this->userService->create($data);\n // send confirmation email\n $mail_data = [\n 'plan' => $plan->name,\n 'price_month' => \\Format::currency($plan->price_month),\n 'price_year' => \\Format::currency($plan->price_year),\n 'trial_end_date' => \\Carbon::now()->addDays(14)->toFormattedDateString()\n ];\n \\Mail::to($company->email)->send(new SignUpConfirmation($mail_data));\n // find the user and log them in\n $auth_user = \\Auth::findById($user->id);\n \\Auth::login($auth_user, true);\n // set message and redirect\n \\Msg::success('Thank you for signing up with Tellerr!');\n return [\n 'route' => 'account'\n ];\n });\n return redir($result['route']);\n }",
"public function process_signup_form($txn) {\n\n\t}",
"public function signup()\n {\n if (isset($_POST['signUp'])) {\n $userExist = $this->checkIfUserExist($_POST['login']);\n $userPassword = $_POST['password'];\n \n if ($userExist === false) {\n if ($userPassword === $_POST['passwordConfirm']) {\n $hashPassword = password_hash($userPassword, PASSWORD_DEFAULT);\n \n $affectedUser = $this->usersManager->setNewUser($_POST['firstName'], $_POST['lastName'], $_POST['login'], $hashPassword, $_POST['email'], 'reader');\n \n if ($affectedUser === false) {\n header('Location: auth&alert=signup');\n exit();\n } else {\n header('Location: auth&alert=success');\n exit();\n }\n } else {\n header('Location: auth&alert=passwords');\n exit();\n }\n } else {\n header('Location: auth&alert=userSignup');\n exit();\n }\n } else {\n throw new Exception($this->datasError);\n }\n\n }",
"function process_signup_params($db)\n{\n // Check if we should login the user\n if (isset($_POST['signup'])) {\n create_account($db, $_POST['signup_name'], $_POST['signup_username'], $_POST['signup_password'], $_POST['signup_confirm_password']);\n }\n}",
"public function sign_up()\n\t{\n\t\t$post = $this->input->post();\n\t\t$return = $this->accounts->register($post, 'settings'); /*this will redirect to settings page */\n\t\t// debug($this->session);\n\t\t// debug($return, 1);\n\t}",
"public function p_signup() {\n\t\t$email_a = $_POST['email'];\n\n\t\t//check to ensure there is not already a user with that email (a duplicate)\n\t\t$q = \"SELECT users.email\n\t\t\t\tFROM users \n\t \tWHERE users.email = '\".$_POST['email'].\"'\n\t \t\";\n\t\t\t\n\t\t$email_validation = DB::instance(DB_NAME)->select_field($q);\n\n\t\t//validation of empty fields\n\n\t\tif (empty($_POST['first_name'])) {\n\t\t\tRouter::redirect(\"/users/signup/signup_error\");\n\n \t} elseif (empty($_POST['last_name'])) {\n \t\tRouter::redirect(\"/users/signup/signup_error\");\n \t\n \t} elseif (empty($_POST['email'])) {\n \tRouter::redirect(\"/users/signup/signuperror\");\n \t\n \t} elseif (empty($_POST['password'])) {\n \tRouter::redirect(\"/users/signup/signup_error\");\n \n //check for valid email syntax\t\n \t} elseif (!filter_var($email_a, FILTER_VALIDATE_EMAIL)) {\n \t\n\t\t\tRouter::redirect(\"/users/signup_invalid/signup_invalid\");\n\t\t\n \t} \n \t//check duplicate\n \telseif ($email_validation) {\n\t\t\t\t\n\t\t\tRouter::redirect(\"/users/signup_duplicate/signup_duplicate\");\n\t\t\n\t\t//signup the user and send info to DB\t\n\t\t} else {\n\n\t\t\t\t//1. insert the data into the DB\n\n\t\t\t\t$_POST['created'] = Time::now();\n\t\t\t\t$_POST['modified'] = Time::now();\n\t\t\t\t$_POST['password'] = sha1(PASSWORD_SALT.$_POST['password']);\n\t\t\t\t$_POST['token'] = sha1(TOKEN_SALT.$_POST['email'].Utils::generate_random_string());\n\n\t\t\t\t$user_id = DB::instance(DB_NAME)->insert('users', $_POST);\n\n\t\t\t\t//2. get the user id in order to upload the default photo for the user\n\t\t\t\t//(Currently this is not working. Please see the open items and review items explanation in github readme).\n\n\t\t\t\t\t$q_userID = \"SELECT users.user_id\n\t\t\t\t\tFROM users \n\t\t \tWHERE users.email = '\".$_POST['email'].\"'\n\t\t \t\";\n\t\t\t\t\n\t\t\t\t\t$user_validation = DB::instance(DB_NAME)->select_field($q_userID);\n\t\t\t\t\n\t\t\t\t//2a. Insert a default pic for user. See error note in item 2 above.\n\t\t\t\t//This uploads a \"broken link. Since INNER JOIN is used on posts, \n\t\t\t\t//a profile picture is needed (even if the link is broken in the view).\n\n\t\t\t\t\t$data = Array('pic_id' => $user_validation,\n\t\t\t\t\t\t\t'user_id' => $user_validation,\n\t\t\t\t\t\t\t'created' => Time::now(),\n\t\t\t\t\t\t\t'picture' => \"/uploads/profiles/blank_profile.jpg\");\n\n\t\t\t\t\t$user_id = DB::instance(DB_NAME)->update_or_insert_row('profilePics', $data);\n\n\t\t\t\t\n\t\t\t\t//3. upon signup, give the user a token to continue directly to their page\n\n\t\t\t\t$q2 = \"SELECT token\n\t\t\t\t\tFROM users \n\t\t \tWHERE email = '\".$_POST['email'].\"'\n\t\t \tAND password = '\".$_POST['password'].\"'\";\n\n\t\t\t\t$token = DB::instance(DB_NAME)->select_field($q2);\n\n\t\t\t\tsetcookie(\"token\", $token, strtotime('+1 year'), '/');\n\n\t\t\t\tRouter::redirect(\"/users/profile\");\n\t\t}\t\t\n\t\n\t}",
"public function signup()\n\t{\n\t\t$data = $this->check($this->as_array());\n\t\t\n\t\t$user = Sprig::factory('user');\n\t\t$user->values($data);\n\t\treturn $user->signup();\n\t}",
"private static function signup() {\r\n\t\t$user = new User($_POST);\r\n\t\t$_SESSION['badUser'] = new User($user->getParameters()); // used by view to temporarily store signup form input\r\n\t\t$_SESSION['badUser']->setErrors($user->getErrors());\r\n\t\t$_SESSION['badUser']->clearPassword();\r\n\r\n\t\t// check for validation errors\r\n\t\tif ($user->getErrorCount() > 0) {\r\n\t\t\tself::alertMessage('danger', 'One or more fields contained errors. Check below for details. Make any needed corrections and try again.');\r\n\t\t\tSignupView::show();\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// make sure user name is not already taken\r\n\t\tif (UsersDB::userExists($user->getUserName())) {\r\n\t\t\tself::alertMessage('danger', 'User name already exists. You must choose another.');\r\n\t\t\tSignupView::show();\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// make sure main character name is not already taken\r\n\t\tif (UsersDB::mainExists($user->getMainName())) {\r\n\t\t\tself::alertMessage('danger', 'The main character name is already associated with another user.');\r\n\t\t\tSignupView::show();\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// user name available. send add request to database and check for success\r\n\t\tUsersDB::addUser($user);\r\n\t\tif ($user->getErrorCount() > 0) {\r\n\t\t\tself::alertMessage('danger', 'Failed to add user to database. Contact support.');\r\n\t\t\tSignupView::show();\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// user is valid and should be logged in at this point\r\n\t\tunset($_SESSION['badUser']);\r\n\t\t$_SESSION['user'] = $user;\r\n\r\n\t\t// create a random verification code, text it to the user's phone, and display verification page\r\n\t\tTextMessageController::sendVerificationCode();\r\n\t\tVerificationView::show();\r\n\t}",
"function handleSignUpRequest() {\n if (connectToDB()) {\n if (array_key_exists('signUp', $_POST)) {\n signUpRequest();\n }\n disconnectFromDB();\n }\n}",
"public function signup()\n {\n $id = (int) Input::get(\"id\");\n $md5 = Input::get(\"secret\");\n if (!$id || !$md5) {\n Redirect::autolink(URLROOT, Lang::T(\"INVALID_ID\"));\n }\n $row = Users::getPasswordSecretStatus($id);\n if (!$row) {\n $mgs = sprintf(Lang::T(\"CONFIRM_EXPIRE\"), Config::TT()['SIGNUPTIMEOUT'] / 86400);\n Redirect::autolink(URLROOT, $mgs);\n }\n if ($row['status'] != \"pending\") {\n Redirect::autolink(URLROOT, Lang::T(\"ACCOUNT_ACTIVATED\"));\n die;\n }\n if ($md5 != $row['secret']) {\n Redirect::autolink(URLROOT, Lang::T(\"SIGNUP_ACTIVATE_LINK\"));\n }\n $secret = Helper::mksecret();\n $upd = Users::updatesecret($secret, $id, $row['secret']);\n if ($upd == 0) {\n Redirect::autolink(URLROOT, Lang::T(\"SIGNUP_UNABLE\"));\n }\n Redirect::autolink(URLROOT . '/login', Lang::T(\"ACCOUNT_ACTIVATED\"));\n }",
"public function post_register() {\n try {\n $i = Input::post();\n $validation = \\Fuel\\Core\\Validation::forge();\n $validation->add('email', 'Email')\n ->add_rule('required')\n ->add_rule('valid_email');\n $validation->add('username', 'Username')\n ->add_rule('required')\n ->add_rule('min_length', 6)\n ->add_rule('max_length', 18);\n $validation->add('password', 'Password')\n ->add_rule('required')\n ->add_rule('min_length', 6)\n ->add_rule('max_length', 18);\n\n if ($validation->run()) {\n $email = $i['email'];\n if (\\Utils::isDisposableEmail($email)) throw new \\Craftpip\\Exception(\"$email is a disposable Email, please use a genuine Email-id to signup.\");\n\n $auth = new \\Craftpip\\OAuth\\Auth();\n\n $user = $auth->getByUsernameEmail($i['email']);\n if ($user) throw new \\Craftpip\\Exception('This Email-ID is already registered.');\n\n $user_id = $auth->create_user($i['username'], $i['password'], $i['email'], 1, array());\n $auth->setId($user_id);\n $auth->setAttr('verified', false);\n $auth->setAttr('project_limit', 2);\n\n\n $mail = new \\Craftpip\\Mail($user_id);\n $mail->template_signup();\n if (!$mail->send()) {\n $auth->removeUser($user_id);\n }\n }\n else {\n throw new \\Craftpip\\Exception('Something is not right. Please try again');\n }\n $response = array(\n 'status' => true\n );\n } catch (Exception $e) {\n $e = new \\Craftpip\\Exception($e->getMessage(), $e->getCode());\n $response = array(\n 'status' => false,\n 'reason' => $e->getMessage()\n );\n }\n\n echo json_encode($response);\n }",
"public function onSignUp()\n {\n $data = post();\n $data['requires_confirmation'] = $this->requiresConfirmation;\n\n if (app(SignUpHandler::class)->handle($data, (bool)post('as_guest'))) {\n if ($this->requiresConfirmation) {\n return ['.mall-signup-form' => $this->renderPartial($this->alias . '::confirm.htm')];\n }\n\n return $this->redirect();\n }\n }",
"public function p_signup() \n {\n $_POST = DB::instance(DB_NAME)->sanitize($_POST);\n $q = 'SELECT user_id\n FROM users \n WHERE email = \"'.$_POST['email'].'\"';\n $user_id = DB::instance(DB_NAME)->select_field($q);\n if ($user_id!=NULL)\n {\n $error=\"User account already exists.\";\n $this->template->content = View::instance('v_users_signup');\n $this->template->content->error=$error;\n echo $this->template;\n }\n else\n {\n\t\t\n //Inserting the user into the database\n\t\t\t$_POST['created']=Time::now();\n\t\t\t$_POST['modified']=Time::now();\n\t\t\t$_POST['password']=sha1(PASSWORD_SALT.$_POST['password']);\n\t\t\t$_POST['token']=sha1(TOKEN_SALT.$_POST['email'].Utils::generate_random_string());\n\t\t\t$_POST['activation_key']=str_shuffle($_POST['password'].$POST['token']);\n\t\t\t$activation_link=\"http://\".$_SERVER['SERVER_NAME'].\"/users/p_activate/\".$_POST['activation_key'];\n\t\t\t$name=$_POST['first_name'];\n\t\t\t$name.=\" \";\n\t\t\t$name.=$_POST['last_name'];\n\t\t\t$user_id = DB::instance(DB_NAME)->insert('users', $_POST);\n\t\t\t\n\t\t//Sending the confirmation mail\n\t\t\t$to[]=Array(\"name\"=>$name, \"email\"=>$_POST['email']);\n\t\t\t$subject=\"Confirmation letter\";\n\t\t\t$from=Array(\"name\"=>APP_NAME, \"email\"=>APP_EMAIL); \n $body = View::instance('signup_email');\n $body->name=$name;\n $body->activation_link=$activation_link;\n\n\n\t\t\t$email = Email::send($to, $from, $subject, $body, false, $cc, $bcc);\n\t\t\t\n\t\t\tRouter::redirect('/');\n } \n }",
"function signUp() {\n if ($this->getRequestMethod() != 'POST') {\n $this->response('', 406);\n }\n \n $user = json_decode(file_get_contents('php://input'),true);\n if (!self::validateUser($user['username'], $user['password'])) {\n $this->response('', 406);\n }\n\t \n\t // check if user already exists\n\t $username_to_check = $user['username'];\n\t $query = \"select * from users where username='$username_to_check'\";\n\t $r = $this->conn->query($query) or die($this->conn->error.__LINE__);\t\n\t if ($r->num_rows > 0) {\n\t \t$this->response('', 406);\n\t }\t\n\t\n $user['password'] = self::getHash($user['username'], $user['password']);\n $keys = array_keys($user);\n $columns = 'username, password';\n $values = \"'\" . $user['username'] . \"','\" . $user['password'] . \"'\"; \n $query = 'insert into users (' . $columns . ') values ('. $values . ');';\n \n if(!empty($user)) {\n $r = $this->conn->query($query) or die($this->conn->error.__LINE__);\n $success = array('status' => 'Success', 'msg' => 'User Created Successfully.', 'data' => $user);\n $this->response(json_encode($success),200);\n } else {\n $this->response('',204);\n }\n }",
"function userSignUp ( $_email ) {\n\t\t$_sql_statement = '';\n\t\t$_bind_parameters = array ();\n\t\t$_duplicateEmailCheck;\n\t\t$_createUserInfo;\n\t\t$_resultVerification ;\n\t\t$_emailVerificationKey = '';\n\t\t$_accountPassword = '';\n\t\t\n\t\t$this->gframeDatabase = new GframeDatabase($this->db_info);\n\t\t\n\t\t$_query_request = array();\n\t\t$_query_result = array();\n\n\t\tif ( ($connection_result = $this->gframeDatabase->connect_database ()) !== TRUE ) {\n\t\t\treturn $this->gframeDatabase->returnAjaxResponseArray(false,'Failed @ connect_database',$connection_result);\n\t\t} else {\n\t\t\t// duplicate email check\n\t\t\t$_duplicateEmailCheck = $this->duplicateEmailCheck( $_email );\n\t\t\tif ($_duplicateEmailCheck['response']===FALSE) {\n\t\t\t\t$this->gframeDatabase->close_database_connection();\n\t\t\t\treturn $_duplicateEmailCheck; // error then exit\n\t\t\t}\n\n\t\t\t// generate account password \n\t\t\t$_accountPassword = $this->returnGeneratedPassword(8);\n\t\t\t\n\t\t\t// create user record\n\t\t\t$_createUserInfo = $this->createUserInfo( $_email,$_accountPassword );\n\t\t\t\n\t\t\t$_resultVerification = $this->queryResultVerification ($_createUserInfo,'createUserInfo');\n\t\t\tif($_resultVerification['response'] === FALSE) {\n\t\t\t\t$this->gframeDatabase->close_database_connection();\n\t\t\t\treturn $_resultVerification; // error then exit\n\t\t\t}\n\t\t\t\n\t\t\t// generate e mail verification key\n\t\t\t$_emailVerificationKey = $this->returnGeneratedPassword(32);\n\n\t\t\t// create user meta and email verification key\n\t\t\t// $_createUserInfo['result']['result'] has the last insert ID\n\t\t\t$_createUserInfoMeta = $this->createUserRecordMeta( $_createUserInfo['result']['result'],$_emailVerificationKey);\n\t\t\t$_resultVerification = $this->queryResultVerification ($_createUserInfoMeta,'createUserRecordMeta');\n\t\t\tif($_resultVerification['response'] === FALSE) {\n\t\t\t\t$this->gframeDatabase->close_database_connection();\n\t\t\t\treturn $_resultVerification; // error then exit\n\t\t\t}\n\t\t\t\n\t\t\t// closing the connection\n\t\t\t$this->gframeDatabase->close_database_connection();\n\t\t\t\n\t\t\t// send out \n\t\t\tif($this->sendOutVerificationEmail ( $_email,$_accountPassword,$_emailVerificationKey )) {\n\t\t\t\treturn $this->gframeDatabase->returnAjaxResponseArray(true,'OK',null);\n\t\t\t} else {\n\t\t\t\treturn $this->gframeDatabase->returnAjaxResponseArray(false,'failedAtSendingEmail',null);\n\t\t\t}\t\t\t\n\t\t}\n\t}",
"public function do_register_user() {\n\t\tif( $_SERVER['REQUEST_METHOD'] == 'POST' ) {\n\t\t\t$redirect_url = home_url( 'member-register' );\n\t\t\t\n\t\t\tif( !get_option( 'users_can_register' ) ) {\n\t\t\t\t// Reg closed\n\t\t\t\t$redirect_url = add_query_arg( 'register-errors', 'closed', $redirect_url );\n\t\t\t} else {\n\t\t\t\t$email = sanitize_email($_POST['email']);\n\t\t\t\t$company_name = sanitize_text_field( $_POST['company_name'] );\n\t\t\t\t$first_name = sanitize_text_field( $_POST['first_name'] );\n\t\t\t\t$last_name = sanitize_text_field( $_POST['last_name'] );\n\t\t\t\t$contact_phone = sanitize_text_field( $_POST['contact_phone'] );\n\t\t\t\t$mobile_phone = sanitize_text_field( $_POST['mobile_phone'] );\n\t\t\t\t$job_title = sanitize_text_field( $_POST['job_title'] );\n\t\t\t\t$sector = sanitize_text_field( $_POST['sector'] );\n\t\t\t\t$ftseIndex = sanitize_text_field( $_POST['ftseIndex'] );\n\t\t\t\t$invTrust = sanitize_text_field( $_POST['invTrust'] );\n\t\t\t\t$sec_name = sanitize_text_field( $_POST['sec_name'] );\n\t\t\t\t$sec_email = sanitize_text_field( $_POST['sec_email'] );\n\t\t\t\t\n\t\t\t\t$result = $this->register_user( $email, $company_name, $first_name, $last_name, $contact_phone, $mobile_phone, $job_title, $sector, $ftseIndex, $invTrust, $sec_name, $sec_email );\n\t\t\t\t\n\t\t\t\tif( is_wp_error( $result ) ) {\n\t\t\t\t\t// Parse errors into string and append as parameter to redirect\n\t\t\t\t\t$errors = join( ',', $result->get_error_codes() );\n\t\t\t\t\t$redirect_url = add_query_arg( 'register-errors', $errors, $redirect_url );\n\t\t\t\t} else {\n\t\t\t\t\t// Success\n\t\t\t\t\t$redirect_url = home_url( 'thank-you-for-registering' );\n//\t\t\t\t\t$redirect_url = add_query_arg( 'registered', $email, $redirect_url );\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\twp_redirect( $redirect_url );\n\t\t\texit;\n\t\t}\n\t}",
"public function signup_post() {\n\n\n $post_data = $this->post();\n $final_user_array = array();\n $insert = array();\n $return_arr = array();\n\n /*\n * Mandatory fields for sign up as look into the config signup_key file to add mandatory fields \n */\n $required_fields_arr = array(\n array(\n 'field' => 'email',\n 'label' => 'Email',\n 'rules' => 'trim|required|valid_email|is_unique[ai_user.email]'\n ),\n array(\n 'field' => 'password',\n 'label' => 'Password',\n 'rules' => 'trim|required'\n ),\n array(\n 'field' => 'first_name',\n 'label' => 'First Name',\n 'rules' => 'trim|required'\n ),\n array(\n 'field' => 'device_id',\n 'label' => 'Device ID',\n 'rules' => 'required'\n ),\n array(\n 'field' => 'phone',\n 'label' => 'Phone Number',\n 'rules' => 'callback_validate_phone'\n ),\n array(\n 'field' => 'dob',\n 'label' => 'Dob',\n 'rules' => 'callback_validate_dob'\n ),\n );\n\n $this->form_validation->set_rules($required_fields_arr);\n $this->form_validation->set_message('regex_match[/^[0-9]{10}$/]', 'The %s is not valid');\n $this->form_validation->set_message('is_unique', 'The %s is already registered with us');\n $this->form_validation->set_message('required', 'Please enter the %s');\n\n\n if ($this->form_validation->run()) {\n\n $pArray = $this->config->item('sign_keys');\n /*\n * load possible sign-up data from the configuration sign_key file\n */\n $data = $this->defineDefaultValue($pArray, $post_data);\n /*\n * empty unnecessay fields \n */\n try {\n /*\n * upload profile pic option \n */\n if (isset($_FILES['profile_image']) && !empty($_FILES['profile_image'])) {\n\n $this->load->library('commonfn');\n $config = [];\n $config['upload_path'] = UPLOAD_IMAGE_PATH;\n $config['allowed_types'] = 'jpeg|jpg|png';\n $config['max_size'] = 3000;\n $config['max_width'] = 1024;\n $config['max_height'] = 768;\n $config['encrypt_name'] = TRUE;\n\n $this->load->library('upload', $config);\n\n if ($this->upload->do_upload('profile_image')) {\n\n $upload_data = $this->upload->data();\n\n $insert['image'] = $upload_data['file_name'];\n $filename = $upload_data['file_name'];\n $filesource = UPLOAD_IMAGE_PATH . $filename;\n $targetpath = UPLOAD_THUMB_IMAGE_PATH;\n $isSuccess = $this->commonfn->thumb_create($filename, $filesource, $targetpath);\n if ($isSuccess) {\n $insert['image_thumb'] = $upload_data['file_name'];\n }\n } else {\n $this->response_data([], ERROR_UPLOAD_FILE, '', strip_tags($this->upload->display_errors()));\n }\n }\n\n // fetch db user key and map data with it \n $this->db->trans_begin();\n $final_user_array = $this->GET_user_arr($insert, $data);\n\n $session_arr = $this->GET_session_arr($data);\n $return_arr = $this->User_model->Insert_userData($final_user_array, $session_arr);\n\n if ($this->db->trans_status() === TRUE) {\n $this->db->trans_commit();\n } else {\n $this->db->trans_rollback();\n throw new Exception(\"account_creation_unsuccessful || \" . ERROR_INSERTION);\n }\n } catch (Exception $e) {\n\n $error = $e->getMessage();\n list($msg, $code) = explode(\" || \", $error);\n $this->response_data([], $code, $msg);\n }\n\n $this->response_data($return_arr, SUCCESS_REGISTRATION, 'account_creation_successful');\n // pass data,code,extrainfo and language key\n } else {\n $err = $this->form_validation->error_array();\n $arr = array_values($err);\n $this->response_data([], PARAM_REQ, '', $arr[0]);\n }\n }",
"public function signup (){\n\t\t\n\t\t$re = '/^(?=.*\\d)(?=.*[a-zA-Z])(?!.* )(?=.*^[a-zA-Z0-9]).{6,16}$/';\n\n\n\t\t\n\t\t$errors = [];\n\t\tif (!empty($_POST)){\n\t\t\t\n\t\t\t$data['user'] = jobject($_POST);\n\t\t\t\n\t\t\t\n\t\t\tif(trim($_POST['firstname'])==''){\n\t\t\t\t$errors['firstname'] = 'First name is required';\n\t\t\t}\n\t\t\tif(trim($_POST['lastname'])==''){\n\t\t\t\t$errors['lastname'] = 'Last name is required';\n\t\t\t}\n\t\t\t\n\t\t\tif(trim($_POST['username'])==''){\n\t\t\t\t$errors['username'] = 'Username is required';\n\t\t\t}elseif($this->UserModel->userExist($_POST['username'])){\n\t\t\t\t$errors['username'] = 'Username already exists.';\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tif($_POST['email'] == ''){\n\t\t\t\t$errors['email'] = 'Email is required.'; \t\t\n\t\t\t}elseif(!filter_var($_POST['email'],FILTER_VALIDATE_EMAIL)){\n\t\t\t\t$errors['email'] = 'Email is not valid.'; \t\t\n\t\t\t}elseif(strpos($_POST['email'],'@algomau.ca') === false ){\n\t\t\t\t$errors['email'] = 'Email should have @algomau.ca'; \t\t\n\t\t\t}\n\t\t\t\n\t\t\tif($_POST['password'] == ''){\n\t\t\t\t\n\t\t\t\t$errors['password'] = 'Password name is required';\n\t\t\t}else if(!preg_match($re,$_POST['password'])){\n\t\t\t\t$errors['password']= 'please use both numbers and alphabits and a min of 6 letters';\n\t\t\t}\n\t\t\t\n\t\t\tif($_POST['password'] != $_POST['confirmPassword']){\n\t\t\t\t$errors['confirmPassword']= 'Confirm password must match.';\n\t\t\t}\n\t\t\t\n\t\t\tif(empty($errors)){\n\t\t\t\t$mydata['username'] = $_POST['username']; \n\t\t\t\t$mydata['password'] = password_hash(trim($_POST['password']), PASSWORD_DEFAULT); \n\t\t\t\t$id = $this->UserModel->userSignup($mydata);\n\t\t\t\t\n\t\t\t\tif($id){\n\t\t\t\t\t$pdata['user_id'] = $id ;\n\t\t\t\t\t$pdata['firstname'] = $_POST['firstname'];\n\t\t\t\t\t$pdata['lastname'] = $_POST['lastname'];\n\t\t\t\t\t$pdata['email'] = $_POST['email'];\n\t\t\t\t\t$profile_id = $this->ProfileModel->insert($pdata);\n\t\t\t\t}\n\t\t\t\tflash('You have been register successfully with username \"'.$_POST['username'].'\" .');\n\t\t\t\tredirect('home');\n\t\t\t}\n\t\t\t\n\t\t\n\t\t}\n\t\t\n\t\t$data['errors'] = $errors;\n\t\t\t$this->view('signup', $data);\n\t\t\n\t}",
"public function doRegister()\n {\n\n //check if all the fields are filled\n if (!Request::checkVars(Request::postData(), array('username', 'password'))) {\n echo json_encode(array(\"swal\" => array(\"title\" => \"Oops!\", \"text\" => \"Complete all the fields!\", \"type\" => \"error\")));\n exit;\n }\n\n //create the user entity based on filled data\n $userEntity = new User(Request::postData());\n\n //check if the user exists and get it as entity if exists\n if ($this->repository->findUser($userEntity)) {\n echo json_encode(array(\"swal\" => array(\"title\" => \"Oops!\", \"text\" => \"The username/email already exists!\", \"type\" => \"error\")));\n exit;\n }\n\n //add the user into DB\n $this->repository->addUser($userEntity);\n\n echo json_encode(\n array(\n \"swal\" => array(\"title\" => \"Success!\", \"text\" => \"Your account has been created!\", \"type\" => \"success\", \"hideConfirmButton\" => true),\n \"redirect\" => array(\"url\" => BASE_URL . '/index.php?page=home', 'time' => 1)\n )\n );\n }",
"function validate_user_signup()\n {\n }",
"function signup() {\n\n $results = array();\n $results['errorReturnAction'] = \"signup\";\n\n if ( isset( $_POST['signup'] ) ) {\n\n // User has posted the signup form: attempt to register the user\n $emailAddress = isset( $_POST['emailAddress'] ) ? $_POST['emailAddress'] : \"\";\n $password = isset( $_POST['password'] ) ? $_POST['password'] : \"\";\n $passwordConfirm = isset( $_POST['passwordConfirm'] ) ? $_POST['passwordConfirm'] : \"\";\n\n if ( !$emailAddress || !$password || !$passwordConfirm ) {\n $results['errorMessage'] = \"Please fill in all the fields in the form.\";\n require( TEMPLATE_PATH . \"/errorDialog.php\" );\n return;\n }\n\n if ( $password != $passwordConfirm ) {\n $results['errorMessage'] = \"The two passwords you entered didn't match. Please try again.\";\n require( TEMPLATE_PATH . \"/errorDialog.php\" );\n return;\n }\n\n if ( User::getByEmailAddress( $emailAddress ) ) {\n $results['errorMessage'] = \"You've already signed up using that email address!\";\n require( TEMPLATE_PATH . \"/errorDialog.php\" );\n return;\n }\n\n $user = new User( array( 'emailAddress' => $emailAddress, 'plaintextPassword' => $password ) );\n $user->encryptPassword();\n $user->insert();\n $user->createLoginSession();\n header( \"Location: \" . APP_URL );\n\n } else {\n\n // User has not posted the signup form yet: display the form\n require( TEMPLATE_PATH . \"/signupForm.php\" );\n }\n}",
"function doSignup(){\n\t\t$data = $_POST;\n\t\t//Stop sign-up if the user does not check the chebox\n\t\tif(!isset($data['Agreement']))\n\t\t\treturn \"inlineMsg5\";\n\t\tif($this->isCCUsedForTrial(\"{$data['CreditCardNumber']}\") && ($data['SubscriptionType'] == 1))\n\t\t\treturn \"inlineMsg1\";\n\t\t$currentYear = date('Y');\n\t\t$currentMonth = date('n');\n\t\t//Stop sign-up when the credit card is expired\n\t\tif($data['ExpirationYear'] < $currentYear){\n\t\t\treturn \"inlineMsg4\";\n\t\t}\n\t\tif ($data['ExpirationYear'] == $currentYear){\n\t\t\tif($data['ExpirationMonth'] < $currentMonth)\n\t\t\t\treturn \"inlineMsg4\";\n\t\t}\n\t\t//Get InfusionSoft Api\n\t\t$app = $this->getInfusionSoftApi();\n\t\t//Get current date\n\t\t$curdate = $app->infuDate(date('j-n-Y'));\n\t\t//Get the registration form from session\n\t\t$regFormData = Session::get('RegistrationFormData');\n\t\t// Get country text from code\n\t\t$country = Geoip::countryCode2name($data['Country']);\n\t\t// Get InfusionSoft Contact ID\n\t\t$returnFields = array('Id','Leadsource');\n\t\t$conInfo = $app->findByEmail($regFormData['Email'], $returnFields);\n\t\tif(empty($conInfo)){\n\t\t\t// If IS contact doesn't exist create one\n\t\t\t$conDat = array(\n\t\t\t\t\t'FirstName' => $data['FirstName'],\n\t\t\t\t\t'LastName' => $data['LastName'],\n\t\t\t\t\t'Company' => $data['Company'],\n\t\t\t\t\t'StreetAddress1' => $data['StreetAddress1'],\n\t\t\t\t\t'StreetAddress2' => $data['StreetAddress2'],\n\t\t\t\t\t'City' => $data['City'],\n\t\t\t\t\t'State' => $data['State'],\n\t\t\t\t\t'PostalCode' => $data['PostalCode'],\n\t\t\t\t\t'Country' => $country,\n\t\t\t\t\t'Email' => $regFormData['Email']\n\t\t\t);\n\t\t\tif(empty($conInfo))\n\t\t\t\t$conDat['Leadsource'] = 'AttentionWizard';\n\t\t\t$isConID = $app->addCon($conDat);\n\t\t}else{\n\t\t\t$isConID = $conInfo[0]['Id'];\n\t\t}\n\t\t// Locate existing credit card\n\t\t$ccID = $app->locateCard($isConID,substr($data['CreditCardNumber'],-4,4));\n\t\t$creditCardType = $this->getISCreditCardType($data['CreditCardType']);\n\t\tif(!$ccID){\n\t\t\t//Validate the credit card\n\t\t\t$card = array(\n\t\t\t\t'CardType' => $creditCardType,\n\t\t\t\t'ContactId' => $isConID,\n\t\t\t\t'CardNumber' => $data['CreditCardNumber'],\n\t\t\t\t'ExpirationMonth' => sprintf(\"%02s\", $data['ExpirationMonth']),\n\t\t\t\t'ExpirationYear' => $data['ExpirationYear'],\n\t\t\t\t'CVV2' => $data['CVVCode']\n\t\t\t);\n\t\t\t$result = $app->validateCard($card);\n\t\t\tif($result['Valid'] == 'false')\n\t\t\t\treturn \"inlineMsg3\";\n\t\t\t$ccData = array(\n\t\t\t\t\t'ContactId' => $isConID,\n\t\t\t\t\t'FirstName' => $data['FirstName'],\n\t\t\t\t\t'LastName' => $data['LastName'],\n\t\t\t\t\t'BillAddress1' => $data['StreetAddress1'],\n\t\t\t\t\t'BillAddress2' => $data['StreetAddress2'],\n\t\t\t\t\t'BillCity' => $data['City'],\n\t\t\t\t\t'BillState' => $data['State'],\n\t\t\t\t\t'BillZip' => $data['PostalCode'],\n\t\t\t\t\t'BillCountry' => $country,\n\t\t\t\t\t'CardType' => $creditCardType,\n\t\t\t\t\t'NameOnCard' => $data['NameOnCard'],\n\t\t\t\t\t'CardNumber' => $data['CreditCardNumber'],\n\t\t\t\t\t'CVV2' => $data['CVVCode'],\n\t\t\t\t\t'ExpirationMonth' => sprintf(\"%02s\", $data['ExpirationMonth']),\n\t\t\t\t\t'ExpirationYear' => $data['ExpirationYear']\n\t\t\t);\n\t\t\t$ccID = $app->dsAdd(\"CreditCard\", $ccData);\n\t\t}\n\t\t// Create AttentionWizard member\n\t\t$member = new Member();\n\t\t$member->FirstName = $data['FirstName'];\n\t\t$member->Surname = $data['LastName'];\n\t\t$member->Email = $regFormData['Email'];\n\t\t$member->Password = $regFormData['Password']['_Password'];\n\t\t$member->ISContactID = $isConID;\n\t\t$memberID = $member->write();\n\t\t//Find or create the 'user' group and add the member to the group\n\t\tif(!$userGroup = DataObject::get_one('Group', \"Code = 'customers'\")){\n\t\t\t$userGroup = new Group();\n\t\t\t$userGroup->Code = \"customers\";\n\t\t\t$userGroup->Title = \"Customers\";\n\t\t\t$userGroup->Write();\n\t\t\t$userGroup->Members()->add($member);\n\t\t}else{\n\t\t\t$userGroup->Members()->add($member);\n\t\t}\n\t\t//Get product details\n\t\t$product = Product::get()->byID($data['SubscriptionType']);\n\t\t$credits = $product->Credits;\n\t\tif($data['SubscriptionType'] == 1){\n\t\t\t$orderAmount = $product->TrialPrice;\n\t\t\t$productName = \"30 days 1-dollar Trial\";\n\t\t\t$isProductID = 38;\n\t\t}else{\n\t\t\t$productName = $product->Name;\n\t\t\t$orderAmount = $product->RecurringPrice;\n\t\t\t$isProductID = $product->ISInitialProductID;\n\t\t}\n\t\t// Store credit card info\n\t\t$creditCard = new CreditCard();\n\t\t$creditCard->CreditCardType = $data['CreditCardType'];\n\t\t$creditCard->CreditCardNumber = $data['CreditCardNumber'];\n\t\t$creditCard->NameOnCard = $data['NameOnCard'];\n\t\t$creditCard->CreditCardCVV = $data['CVVCode'];\n\t\t$creditCard->ExpiryMonth = $data['ExpirationMonth'];\n\t\t$creditCard->ExpiryYear = $data['ExpirationYear'];\n\t\t$creditCard->Company = $data['Company'];\n\t\t$creditCard->StreetAddress1 = $data['StreetAddress1'];\n\t\t$creditCard->StreetAddress2 = $data['StreetAddress2'];\n\t\t$creditCard->City = $data['City'];\n\t\t$creditCard->State = $data['State'];\n\t\t$creditCard->PostalCode = $data['PostalCode'];\n\t\t$creditCard->Country = $data['Country'];\n\t\t$creditCard->Current = 1;\n\t\t$creditCard->ISCCID = $ccID;\n\t\t$creditCard->MemberID = $memberID;\n\t\t$creditCardID = $creditCard->write();\n\t\t// Create an order\n\t\t$order = new Order();\n\t\t$order->OrderStatus = 'P';\n\t\t$order->Amount = $orderAmount;\n\t\t$order->MemberID = $memberID;\n\t\t$order->ProductID = $data['SubscriptionType'];\n\t\t$order->CreditCardID = $creditCardID;\n\t\t$orderID = $order->write();\n\t\t//Create the Infusionsoft subscription\n\t\t$subscriptionID = $this->createISSubscription($isConID, $product->ISProductID, $product->RecurringPrice, $ccID, 30);\n\t\tif($subscriptionID && is_int($subscriptionID)){\n\t\t\t//Create an infusionsoft order\n\t\t\t$config = SiteConfig::current_site_config();\n\t\t\t$invoiceId = $app->blankOrder($isConID,$productName, $curdate, 0, 0);\n\t\t\t$orderItem = $app->addOrderItem($invoiceId, $isProductID, 9, floatval($orderAmount), 1, $productName, $productName);\n\t\t\t$result = $app->chargeInvoice($invoiceId,$productName,$ccID,$config->MerchantAccount,false);\n\t\t\tif($result['Successful']){\n\t\t\t\t// Create a Subscription record\n\t\t\t\t$nextBillDate = $this->getSubscriptionNextBillDate($subscriptionID);\n\t\t\t\t$expireDate= date('Y-m-d H:i:s', strtotime($nextBillDate));\n\t\t\t\t$startDate= date('Y-m-d H:i:s', strtotime($expireDate. \"-30 days\"));\n\t\t\t\t$subscription = new Subscription();\n\t\t\t\t$subscription->StartDate = $startDate;\n\t\t\t\t$subscription->ExpireDate = $expireDate;\n\t\t\t\t$subscription->MemberID = $memberID;\n\t\t\t\t$subscription->ProductID = $data['SubscriptionType'];\n\t\t\t\t$subscription->OrderID = $orderID;\n\t\t\t\t$subscription->Status = 1;\n\t\t\t\t$subscription->SubscriptionID = $subscriptionID;\n\t\t\t\t$subscription->write();\n\t\t\t\t// Create a MemberCredits record\n\t\t\t\t$memberCredits = new MemberCredits();\n\t\t\t\t$memberCredits->Credits = $credits;\n\t\t\t\t$memberCredits->ExpireDate = $expireDate;\n\t\t\t\t$memberCredits->MemberID = $memberID;\n\t\t\t\t$memberCredits->ProductID = $data['SubscriptionType'];\n\t\t\t\t$memberCredits->SubscriptionID = $subscription->ID;\n\t\t\t\t$memberCredits->write();\n\t\t\t\t// Update order\n\t\t\t\t$order->OrderStatus = 'c';\n\t\t\t\t$order->write();\n\t\t\t\t// If product selected is bronze do a trial signup\n\t\t\t\tif($data['SubscriptionType'] == 1){\n\t\t\t\t\t//Add the InfusionSoft tag\n\t\t\t\t\t$app->grpAssign($isConID, 2216);\n\t\t\t\t\t//Update the InfusionSoft contact details\n\t\t\t\t\t$conDat = array(\n\t\t\t\t\t\t\t'ContactType' => 'AW Customer',\n\t\t\t\t\t\t\t'_AWstartdate' => $curdate,\n\t\t\t\t\t\t\t'_AttentionWizard' => 'Free'\n\t\t\t\t\t);\n\t\t\t\t\t$app->updateCon($isConID, $conDat);\n\t\t\t\t\t// Update Subscription\n\t\t\t\t\t$subscription->IsTrial = 1;\n\t\t\t\t\t$subscription->SubscriptionCount = 0;\n\t\t\t\t\t$subscription->write();\n\t\t\t\t\t// Update Member\n\t\t\t\t\t$member->SignUpTrial = 1;\n\t\t\t\t\t$member->write();\n\t\t\t\t\t// Update Order\n\t\t\t\t\t$order->IsTrial = 1;\n\t\t\t\t\t$order->write();\n\t\t\t\t\t// Update credit card\n\t\t\t\t\t$creditCard->UsedForTrial = 1;\n\t\t\t\t\t$creditCard->write();\n\t\t\t\t}else{\n\t\t\t\t\t// Update Subscription\n\t\t\t\t\t$subscription->SubscriptionCount = 1;\n\t\t\t\t\t$subscription->write();\n\t\t\t\t\t// Add the InfusionSoft tag\n\t\t\t\t\t$isTagId = $this->getISTagIdByProduct($data['SubscriptionType']);\n\t\t\t\t\t$app->grpAssign($isConID, $isTagId);\n\t\t\t\t\t//Update the InfusionSoft contact details\n\t\t\t\t\t$returnFields = array('_AWofmonths');\n\t\t\t\t\t$conDat1 = $app->loadCon($isConID,$returnFields);\n\t\t\t\t\tif(!isset($conDat1['_AWofmonths']))\n\t\t\t\t\t\t$conDat1['_AWofmonths'] = 0;\n\t\t\t\t\t$conDat = array(\n\t\t\t\t\t\t\t'_AWofmonths' => $conDat1['_AWofmonths']+1,\n\t\t\t\t\t\t\t'ContactType' => 'AW Customer',\n\t\t\t\t\t\t\t'_AttentionWizard' => 'Paid and Current',\n\t\t\t\t\t\t\t'_AWstartdate' => $curdate\n\t\t\t\t\t);\n\t\t\t\t\t$app->updateCon($isConID, $conDat);\n\t\t\t\t\t//Add a note\n\t\t\t\t\t$conActionDat = array('ContactId' => $isConID,\n\t\t\t\t\t\t\t'ActionType' => 'UPDATE',\n\t\t\t\t\t\t\t'ActionDescription' => \"Payment made for AW service\",\n\t\t\t\t\t\t\t'CreationDate' => $curdate,\n\t\t\t\t\t\t\t'ActionDate' => $curdate,\n\t\t\t\t\t\t\t'CompletionDate' => $curdate,\n\t\t\t\t\t\t\t'CreationNotes' => \"{$product->Name} Subscription\",\n\t\t\t\t\t\t\t'UserID' => 1\n\t\t\t\t\t);\n\t\t\t\t\t$app->dsAdd(\"ContactAction\", $conActionDat);\n\t\t\t\t}\n\t\t\t\t$member->logIn();\n\t\t\t\t$this->setMessage('Success', 'You have signed-up & the Subscription is created successfully');\n\t\t\t\treturn 'url1';\n\t\t\t}else{\n\t\t\t\t//Set the subscription to Inactive\n\t\t\t\t$this->setSubscriptionStatus($subscriptionID, 'Inactive');\n\t\t\t\t//Update InfusionSoft contact\n\t\t\t\tif($data['SubscriptionType'] == 1){\n\t\t\t\t\t$aw = 'Unsuccessful trial sign-up';\n\t\t\t\t}else{\n\t\t\t\t\t$aw = 'Unsuccessful paid sign-up';\n\t\t\t\t}\n\t\t\t\t$conDat = array(\n\t\t\t\t\t\t'ContactType' => 'AW Prospect',\n\t\t\t\t\t\t'_AttentionWizard' => $aw\n\t\t\t\t);\n\t\t\t\t\n\t\t\t\t$app->updateCon($isConID, $conDat);\n\t\t\t\t// Add an AW prospect tag\n\t\t\t\t//$app->grpAssign($isConID, $this->getISTagIdByPaymentCode(strtoupper($result['Code'])));\n\t\t\t\t$app->grpAssign($isConID, $this->getISTagIdByPaymentCode('DECLINED'));\n\t\t\t\t// Add a note\n\t\t\t\t$conActionDat = array('ContactId' => $isConID,\n\t\t\t\t\t\t'ActionType' => 'UPDATE',\n\t\t\t\t\t\t'ActionDescription' => \"Unsuccessful attempt to sign-up for AW\",\n\t\t\t\t\t\t'CreationDate' => $curdate,\n\t\t\t\t\t\t'ActionDate' => $curdate,\n\t\t\t\t\t\t'CompletionDate' => $curdate,\n\t\t\t\t\t\t'UserID' => 1\n\t\t\t\t);\n\t\t\t\t$conActionID = $app->dsAdd(\"ContactAction\", $conActionDat);\n\t\t\t\t$member->logIn();\n\t\t\t\t$this->setMessage('Error', 'Sorry,the payment failed due to some reason.please update your credit card');\n\t\t\t\treturn \"url2\";\n\t\t\t}\n\t\t}else{\n\t\t\t$member->logIn();\n\t\t\t// Add an AW prospect tag\n\t\t\t$app->grpAssign($isConID, 3097);\n\t\t\t//Update InfusionSoft contact\n\t\t\tif($data['SubscriptionType'] == 1){\n\t\t\t\t$aw = 'Unsuccessful trial sign-up';\n\t\t\t}else{\n\t\t\t\t$aw = 'Unsuccessful paid sign-up';\n\t\t\t}\n\t\t\t$conDat = array(\n\t\t\t\t\t'ContactType' => 'AW Prospect',\n\t\t\t\t\t'_AttentionWizard' => $aw\n\t\t\t);\n\t\t\t$app->updateCon($isConID, $conDat);\n\t\t\t// Add a note\n\t\t\t$conActionDat = array('ContactId' => $isConID,\n\t\t\t\t\t'ActionType' => 'UPDATE',\n\t\t\t\t\t'ActionDescription' => \"Unsuccessful attempt to sign-up for AW\",\n\t\t\t\t\t'CreationDate' => $curdate,\n\t\t\t\t\t'ActionDate' => $curdate,\n\t\t\t\t\t'CompletionDate' => $curdate,\n\t\t\t\t\t'UserID' => 1\n\t\t\t);\n\t\t\t$conActionID = $app->dsAdd(\"ContactAction\", $conActionDat);\n\t\t\t$this->setMessage('Error', 'You have signed-up successfully but the Subscription is not created,please try again.');\n\t\t\treturn \"url3\";\n\t\t}\n\t}",
"function signUp() {\n\t\tif (isset($_REQUEST['username'])) {\n\t\t\t$username = $_REQUEST['username'];\n\t\t\t$password = $_REQUEST['password'];\n\t\t\t$email = $_REQUEST['email'];\n\t\t\t$phone = $_REQUEST['phone'];\n\t\t\t\n\t\t\tinclude_once(\"users.php\");\n\n\t\t\t$userObj=new users();\n\t\t\t$r=$userObj->addUser($username,$password,$email,$phone);\n\t\t\t\n\t\t\tif(!$r){\n\t\t\t\techo '{\"result\":0, \"message\":\"Error signing up\"}';\n\t\t\t\treturn;\n\t\t\t} else {\n\t\t\t\techo '{\"result\":1,\"message\": \"You have successfully signed up for Proximity\"}'; \n\t\t\t}\n\t\t}\n\t}",
"function signup($fname,$lname,$phone,$email,$pwd){\n\t\tif(isset($_SESSION['user'])){\n\t\t\t$encrypted_pass = $pwd;\n\t\t}else{\n\t\t\t$encrypted_pass = md5($pwd);\n\t\t}\n\t\t//end\n\n\t\t//this is to check if email already exists\n\t\t$checkifemailexists = $this->getdetailswithemail($email,'vendors');\n\n\t\tif(!empty($checkifemailexists)){\n\n\t\t\t$_SESSION['emailalreadyexists'] = \"emailalreadyexists\";\n\t\t\t$_SESSION['fname'] = $fname;\n\t\t\t$_SESSION['lname'] = $lname;\n\t\t\t$_SESSION['phone'] = $phone;\n\t\t\t$_SESSION['email'] = $email;\n\n\t\t\theader(\"location: becomeavendor.php\");\n\n\t\t\treturn;\n\t\t}\n\t\t//end\n\n\t\t$sql = \" INSERT INTO vendors SET v_fname = '$fname', v_lname = '$lname', v_phone = '$phone', v_email = '$email', v_password = '$encrypted_pass' \";\n\n\t\t$this->conn->query($sql);\n\n\t\t$id = $this->conn->insert_id;\n\n\t\tif($id > 0){\n\t\t\t\n\t\t\t$reg_id = \"VEN/\".date(\"Y.m.d\").\"/\".$id;\n\n\t\t\t$this->conn->query(\" UPDATE vendors SET v_user_id = '$reg_id' WHERE vendor_id = '$id' \");\n\n\t\t\t\n\t\t\tif(isset($_SESSION['user'])){\n\n\t\t\t$_SESSION['user'] = $id;\n\n\t\t\t$_SESSION['route'] = 'vendor';\n\n\t\t\t}else{\n\n\t\t\t$_SESSION['user'] = $id;\n\n\t\t\t$_SESSION['route'] = 'vendor';\n\n\t\t\t//this is to fetch email and assign to session\n\t\t\t$emailfetch = $this->getdetails($_SESSION['user'],'vendors');\n\n\t\t\t$_SESSION['useremail'] = $emailfetch['v_email'];\n\t\t\t//end\n\n\t\t\theader(\"location: complete_registration.php\");\n\n\t\t\t}\n\n\n\t\t}else{\n\n\t\t\t$_SESSION['error'] = \"failedsignup\";\n\n\t\t\theader(\"location: signup.php\");\n\t\t}\n\n\n\t}",
"abstract protected function _queueSignup($signup);",
"public function p_signup() {\n $duplicate = DB::instance(DB_NAME)->select_field(\"SELECT email FROM users WHERE email = '\" . $_POST['email'] . \"'\");\n \n //If email already exists \n if($duplicate){ \n //Redirect to error page \n Router::redirect('/users/login/?duplicate=true');\n }\n\n // Encrypt the password \n $_POST['password'] = sha1(PASSWORD_SALT.$_POST['password']); \n\n // Create an encrypted token via their email address and a random string\n $_POST['token'] = sha1(TOKEN_SALT.$_POST['email'].Utils::generate_random_string()); \n\n // Insert this user into the database\n $user_id = DB::instance(DB_NAME)->insert('users', $_POST);\n\n\n\n //Image Upload\n Upload::upload($_FILES, \"/uploads/avatars/\", array(\"JPG\", \"JPEG\", \"jpg\", \"jpeg\", \"gif\", \"GIF\", \"png\", \"PNG\"), $user_id);\n \n $filename = $_FILES['avatar']['name']; // original filename (i.e. picture.jpg)\n $extension = substr($filename, strrpos($filename, '.')); // filename format extension (i.e. .jpg)\n $avatar = $user_id.$extension; // user id + .jpg or .png or .gif (i.e. 26.png)\n\n // Add Image to DB in \"avatar\" column\n $data = Array(\"avatar\" => $avatar);\n DB::instance(DB_NAME)->update(\"users\", $data, \"WHERE id = '\".$user_id.\"'\"); \n\n // Send them back to the login page with a success message\n Router::redirect(\"/users/login/?success=true\"); \n\n \n }"
]
| [
"0.79888904",
"0.7733975",
"0.7696055",
"0.76869136",
"0.7677835",
"0.7580091",
"0.7570841",
"0.753299",
"0.7530093",
"0.7511039",
"0.7456928",
"0.7436119",
"0.7405426",
"0.7391708",
"0.7373141",
"0.7359808",
"0.7333507",
"0.73007435",
"0.72976786",
"0.7270636",
"0.72257054",
"0.71915245",
"0.71804833",
"0.7178533",
"0.71710646",
"0.7167439",
"0.71555483",
"0.71547306",
"0.7152947",
"0.7134952"
]
| 0.7936471 | 1 |
this sets up email password view and displays error if any | public function emailpassword($error = NULL) {
$this->template->content3=View::instance('v_users_emailpassword');
$this->template->title= APP_NAME. " :: Login";
// add required js and css files to be used in the form
$client_files_head=Array('/js/languages/jquery.validationEngine-en.js',
'/js/jquery.validationEngine.js',
'/css/validationEngine.jquery.css'
);
$this->template->client_files_head=Utils::load_client_files($client_files_head);
# Pass data to the view
$this->template->content3->error = $error;
echo $this->template;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function forgotPassword(){\n\t\t// Set the Page Title ('pageName', 'pageSection', 'areaName')\n\t\t$this->_view->pageTitle = array('Forgot Your Password', 'Login');\n\t\t// Set Page Description\n\t\t$this->_view->pageDescription = 'You can reset your password.';\n\t\t// Set Page Section\n\t\t$this->_view->pageSection = 'Login';\n\n\t\t// Define expected and required\n\t\t$this->_view->expected = array('email');\n\t\t$this->_view->required = array('email');\n\n\t\t// Set default variables\n\t\t$this->_view->missing = array();\n\t\t$this->_view->error = array();\n\t\t$this->_view->postData = array();\n\n // If Form has been submitted process it\n\t\tif(!empty($_POST)){\t\t\t\n\t\t\t// Send $_POST to validate function\n\t\t\t$post = Form::ValidatePost($_POST, $this->_view->expected, $this->_view->required);\n\n\t\t\t// If true return array of formatted $_POST data\n\t\t\tif($post[0] == true){\n\t\t\t\t$this->_view->postData = $post[1];\n\t\t\t}\n\t\t\t// else return array of missing required fields\n\t\t\telse{\n\t\t\t\t$this->_view->missing = $post[1];\n\t\t\t}\n\n\t\t\tif(empty($this->_view->missing)){\n\n\t\t\t\t$email = $this->_view->postData['email'];\n\t\t\t\t\n\t\t\t\t// Fetch array of user details\n//\t\t\t\t$userDetails = $this->_model->getUserByEmail($email);\n//\t\t\t\t$this->_view->userDetails = $userDetails[0];\n\n\t\t\t\t// Validate Email\n\t\t\t\t$validateEmail = Form::ValidateEmail($email);\n\t\t\t\t// If true do nothing\n\t\t\t\tif($validateEmail[0] == true){}\n\t\t\t\t// else return error message\n\t\t\t\telse{\n\t\t\t\t\t$this->_view->error[] = $validateEmail[1];\n\t\t\t\t}\n\n\t\t\t\t// If no errors yet continue\n\t\t\t\tif(empty($this->_view->error)){\n\n\t\t\t\t\t// Get User ID for given Email Address\n\t\t\t\t\t$checkUser = $this->_model->checkUserLogin($email);\n\n\t\t\t\t\tif(!empty($checkUser)){\n\t\t\t\t\t\t$userID = $checkUser[0]['id'];\n\n\t\t\t\t\t\t// Create Unique string\n\t\t\t\t\t\t$security_key = hash('sha256', $email.time());\n\t\t\t\t\t\t$exp_date = date(\"Y-m-d H:i:s\", strtotime('+2 hours'));\n\n\t\t\t\t\t\t// Create array of data to post to the model\n\t\t\t\t\t\t$data = array();\n\t\t\t\t\t\t$data['user_id'] = $userID;\n\t\t\t\t\t\t$data['security_key'] = $security_key;\n\t\t\t\t\t\t$data['exp_date'] = $exp_date;\n\n\t\t\t\t\t\t// Send the Data to the Model\n\t\t\t\t\t\t$insertPasswordRecovery = $this->_model->insertPasswordRecovery($data);\n\t\t\t\t\t\tif($insertPasswordRecovery > 0){\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Send confirmation email\n\t\t\t\t\t\t\t$to = $checkUser[0]['email'];\n\t\t\t\t\t\t\t$this->_view->email_name = $checkUser[0]['firstname'];\n\t\t\t\t\t\t\t$this->_view->email_message = \"We have received a request to reset your account password. If you wish to reset your password click the button below and follow the steps listed. If you have not requested a password reset then ignore this email.\";\n $this->_view->email_button_link = $_SERVER['REDIRECT_proto'].'://'.$_SERVER['SERVER_NAME'].'/users/reset-password/'.$userID.'/'.$security_key.'/';\n\t\t\t\t\t\t\t$this->_view->email_button_text = \"Reset Password\";\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$subject = \"Reset account email\";\n $message = $this->_view->renderToString('email-templates/general-message-with-button', 'blank-layout');\n\n\t\t\t\t\t\t\t$sendEmail = Html::sendEmail($to, $subject, SITE_EMAIL, $message);\n\n\t\t\t\t\t\t\t$this->_view->success[] = \"We have sent you a link to reset your password. Please check your inbox for further instructions.\";\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t// Error Message\n\t\t\t\t\t\t\t$this->_view->error[] = 'There was a problem trying to create new reset password.';\n\t\t\t\t\t\t}\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$this->_view->error[] = 'No user found with this email. Please try different email.';\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}else{\n\t\t\t\t// Error Message\n\t\t\t\t$this->_view->error[] = 'Please complete the missing required fields.';\n\t\t\t}\n\t\t}\n\n\t\t// Render the view ($renderBody, $layout, $area)\n\t\t$this->_view->render('users/forgot-password', 'login-layout');\n\t}",
"public function p_emailpassword(){\n\n # if javascript is disabled this checks if user entered email and password to login\n if (!$_POST['email']) {\n Router::redirect(\"/users/emailpassword/error\"); \n }\n # proceed with checking if email exists\n else { \n $q= 'Select user_id \n From users \n WHERE email=\"'.$_POST['email'].'\"';\n \n $user_id= DB::instance(DB_NAME)->select_field($q);\n \n #email doesnt exists\n if(!$user_id){ \n \n Router::redirect(\"/users/emailpassword/error1\"); \n }\n # email exists , email the password that is generated using generate_random_string\n else{\n $password=Utils::generate_random_string(8); \n $new_password=sha1(PASSWORD_SALT.$password);\n $new_modified= Time::now();\n\n $data=Array('modified'=>$new_modified,\n 'password'=>$new_password \n );\n $success= DB::instance(DB_NAME)->update('users',$data,'WHERE user_id=' .$user_id); \n \n \n $to[] = Array(\"name\" => $_POST['email'], \"email\" => $_POST['email']);\n $from = Array(\"name\" => APP_NAME, \"email\" => APP_EMAIL);\n $subject = \"Password reset message from \".APP_NAME; \n \n $body = \"This is the password: \".$password ;\n # Send email\n $sent = Email::send($to, $from, $subject, $body, FALSE, '');\n # IF EMAIL IS SENT and password update is successful proceed to login \n if($sent AND $success)\n Router::redirect('/users/login');\n # else error out, either send email failed or couldnt update database \n else\n Router::redirect('/users/emailpassword/error2');\n }\n } # end of first else \n }",
"public function passwordEmailForm()\n {\n return view('turtle::auth.password.email');\n }",
"public function passwordForgotAction()\n {\n // get the view vars\n $errors = $this->view->errors;\n\n $this->processInput( null, null, $errors );\n\n // check if there were any errors\n if ( $errors->hasErrors() ) {\n return $this->renderPage( 'errors' );\n }\n\n return $this->renderPage( 'authPasswordForgot' );\n }",
"public function forgotPassword()\n\t{\n\t\t$this->layout->content = View::make('login.password');\n\t}",
"public function mail_varify(){\n \t$return = $this->login_model->mail_varify(); \t\n \tif($return){ \n \t$data['email'] = $return;\n \t$this->load->view('admin/set_password', $data); \n \t} else { \n\t \t\t$data['email'] = 'allredyUsed';\n \t$this->load->view('admin/set_password', $data);\n \t} \n }",
"public function forgotpassword() {\n\n\t\t$login_box_visiblity = '';\n\t\t$forgot_box_visiblity = 'visible';\n\n\t\t$this->JQValidator->addValidation('User', $this->User->validate, 'UserLoginForm');\n\t\t$this->JQValidator->addValidation('ForgotPasswordForm', $this->ForgotPasswordForm->validate, 'ForgotPasswordForm');\n\n\t\t$this->set(compact('login_box_visiblity', 'forgot_box_visiblity'));\n\n\t\tif (array_key_exists('ForgotPasswordForm', $this->data)) {\n\t\t\t$flag = $this->ForgotPassword->sendMail($this->data['ForgotPasswordForm'], 'admin');\n\n\t\t\tif ($flag) {\n\t\t\t\t$this->redirect('login');\n\t\t\t}\n\t\t} else {\n\t\t\t$this->login();\n\t\t}\n\t}",
"public function showpassword()\n\t\t{\n\t\t\tif(Auth::check()) {\n\t\t\t\treturn View::make('updatepassword');\n\t\t\t} else {\n\t\t\t\tApp::abort(403);\n\t\t\t}\n\t\t}",
"function forgotpass() {\r\n load_admin_view('forgot_password_view');\r\n }",
"public function forgot_password(){\n\n $this->data[\"title_tag\"]=\"Lobster | Accounts | Forgot Password\";\n\n $this->view(\"accounts/forgot_password\",$this->data);\n }",
"function forgot_password() {\r\n\r\n $this->layout = 'default';\r\n\r\n if(!empty($this->data))\r\n {\r\n\r\n\r\n $errorarray = array();\r\n if (isset($this->data['User']['email']) && (trim($this->data['User']['email']) == '' || trim($this->data['User']['email'])=='Type here')) {\r\n $errorarray['enter_email'] = ENTER_EMAIL;\r\n }\r\n else\r\n {\r\n // For check valid email or not\r\n if($this->IsEmail($this->data['User']['email'])==0)\r\n $errorarray['valid_email'] = ENTER_VALIDEMAIL;\r\n else\r\n {\r\n $check_email = $this->User->find('all', array('conditions' => array('email like'=>$this->data['User']['email'],'user_type like'=>'user','status LIKE'=>0)));\r\n\r\n if(empty($check_email))\r\n {\r\n $errorarray['email_not_match'] = EMAIL_NOTFOUND;\r\n }\r\n }\r\n }\r\n\r\n $this->set('errorarray',$errorarray);\r\n\r\n if(empty($errorarray))\r\n {\r\n $new_pass = $this->generatePassword(PASSWORD_LIMIT);\r\n\r\n $name = trim($check_email[0]['User']['name']);\r\n $email = trim($check_email[0]['User']['email']);\r\n\r\n //$this->email_client_forgetpass($name,$email,$new_pass);\r\n\r\n $update_user['User']['password'] = md5($new_pass);\r\n $update_user['User']['encrypt_password'] = $this->encrypt_pass($new_pass);\r\n $update_user['User']['id'] = $check_email[0]['User']['id'];\r\n\r\n// $this->pre($update_user);\r\n// $this->pre($this->data);\r\n// exit;\r\n\r\n $this->User->save($update_user);\r\n //$this->redirect(DEFAULT_ADMINURL . 'users/forgot_password/succhange');\r\n }\r\n }\r\n }",
"static function password_forgot() {\n parent::password_forgot();\n view_var('user', globals('user'));\n }",
"static function password_expired_email() {\n $model = \\Auth::$model;\n $user = $model::requested();\n\n if (!$user->nil()) {\n if ($user->validate()) {\n\n password_expired_email($user) ?\n flash(\"Enviamos um e-mail para <small><b>$user->email</b></small> com as instruções para você criar uma nova senha.\") :\n flash('Não foi possível lhe enviar o e-mail. Por favor, tente novamente mais tarde.', 'error');\n\n go('/');\n } else {\n flash('Verifique os dados do formulário.', 'error');\n }\n }\n\n globals('user', $user);\n }",
"public function displayForgotPassword()\n {\n $this->render('forgot-password', ['head'=>['title'=>'Mot de passe oublié', 'meta_description'=>'']]);\n }",
"public function passwordEmail()\n {\n $this->shellshock(request(), [\n 'email' => 'required|email',\n 'g-recaptcha-response' => 'sometimes|recaptcha',\n ]);\n\n if (($user = app(config('turtle.models.user'))->where('email', request()->input('email'))->first())) {\n $token = Password::getRepository()->create($user);\n\n Mail::send(['text' => 'turtle::emails.password'], ['token' => $token], function (Message $message) use ($user) {\n $message->subject(config('app.name') . ' Password Reset Link');\n $message->to($user->email);\n });\n\n flash('success', 'Password reset link emailed!');\n\n return response()->json(['reload_page' => true]);\n }\n else {\n return response()->json(['errors' => ['email' => [trans('auth.failed')]]], 422);\n }\n }",
"function edituseremail()\n {\n // Auth::handleLogin() makes sure that only logged in users can use this action/method and see that page\n Auth::handleLogin();\n $this->view->render('login/edituseremail');\n }",
"public function send_password(){\n\t\t$tmpUsername = $_POST[\"txtUsername\"];\n\t\t$tmpEmail = $_POST[\"txtEmail\"];\n\t\t$inRepository = new InterfacePersonRepo;\n\t\t$tmpUser = $inRepository->getRepositoryByUsername($tmpUsername);\n\t\tif(count($tmpUser)>1){\n\t\t\texit();\n\t\t}\n\t\tif($tmpUser[0]->Email == $tmpEmail){\n\t\t\t$fgUser = new Person;\n\t\t\t$fgUser->setUsername($tmpUsername);\n\t\t\t$fgUser->setEmail($tmpEmail);\n\t\t\t$email = $inRepository->sendmailRepository($fgUser);\n\t\t\treturn View::make('alert/authen/alertEmail')->with('Email',$email);\n\t\t}else{\n\t\t\treturn View::make('alert/authen/alertEmail2');\n\t\t}\n\t}",
"function forgot_password() {\n $datos['titulo'] = \"Restablecer Contraseña\";\n $this->render_page('usuarios/forgot_password', $datos);\n }",
"public function getEmail()\r\n\t{\r\n\t\t$errors = [];\r\n\t\treturn view('core::users.reset-password', compact('errors'));\r\n\t}",
"public function showForgetPassword(){\n $input = Input::all();\n\n //check email, token\n if(!empty($input) && !empty($input['email']) && !empty($input['token'])){\n $user = User::where('email', '=', $input['email'])\n ->where('account_token', '=', $input['token'])\n ->first();\n\n if(!empty($user)) {\n // Check expire account token\n\t\t if(User::checkExpiredTime($user) == true){\n\t return View::make('user.reset_password')->with(array('email'=>$input['email'], 'account_token'=>$user->account_token));\n\t\t } else {\n\t\t \treturn Redirect::to('/')->with('forgetPassword', 1);\n\t\t }\n } else {\n \treturn Redirect::to('/')->with('forgetPassword', 1);\n\n }\n }\n return View::make('user.forgot_password');\n }",
"public function forgetpassword()\n \t{\n \t\t$this->data['title'] = 'Forgot Password';\n\t\t$this->show_viewFrontInner('forget-password', $this->data);\n \t}",
"function forgotten_password()\n {\t\n \t$data['heading'] = $this->lang->line('FAL_forgotten_password_label');\n \t$data['fal'] = $this->fal_front->forgotten_password();\n\t\t$this->load->view($this->_container, $data); \n\t\t$this->output->enable_profiler(TRUE);\n }",
"function forgot_password()\n\t{\n\t\tif ($this->tank_auth->is_logged_in()) {\t\t\t\t\t\t\t\t\t// logged in\n\t\t\tredirect('');\n\n\t\t} elseif ($this->tank_auth->is_logged_in(FALSE)) {\t\t\t\t\t\t// logged in, not activated\n\t\t\tredirect('/auth/send_again/');\n\n\t\t} else {\n\t\t\t$this->form_validation->set_rules('email', 'Email', 'trim|required|xss_clean|valid_email');\n\n\t\t\t$data['errors'] = array();\n\n\t\t\tif ($this->form_validation->run()) {\t\t\t\t\t\t\t\t// validation ok\n\t\t\t\tif (!is_null($data = $this->tank_auth->forgot_password(\n\t\t\t\t\t\t$this->form_validation->set_value('email')))) {\n\n\t\t\t\t\t$data['site_name'] = $this->config->item('website_name', 'tank_auth');\n\n\t\t\t\t\t// Send email with password activation link\n\t\t\t\t\t$this->_send_email('forgot_password', $data['email'], $data);\n\n\t\t\t\t\t$this->_show_message($this->lang->line('auth_message_new_password_sent'));\n\n\t\t\t\t} else {\n\t\t\t\t\t$errors = $this->tank_auth->get_error_message();\n\t\t\t\t\tforeach ($errors as $k => $v)\t$data['errors'][$k] = $this->lang->line($v);\n\t\t\t\t}\n\t\t\t}\n\t\t\t//$this->load->view('auth/forgot_password_form', $data);\n\t\t\tdisplay('forgot_password', $data);\n\t\t}\n\t}",
"public function forgot_password()\n\t{\n\t\t$email = Input::get('email');\n\n\t\t//Get reset code and send email\n\t\tif($resetCode = $this->repo->getResetCode($email))\n\t\t{\n\t\t\treturn View::make('authentication.confirm_reset_code_sent')->with('email',$email)->with('resetCode',$resetCode);\n\t\t}\n\t\treturn View::make('authentication.forgot_password')->withInput(Input::all()); \n\t}",
"public function successPassword() {\n $this->loadFrontView('profile/after_password_reset');\n }",
"public function passwordAction(){\r\n $this->view->password = '';\r\n }",
"public function forgotPasswordAction ()\n {\n $this->view->setRenderLevel (View::LEVEL_ACTION_VIEW);\n }",
"public function admin_forgot_password_form() {\n if ($this->checkLogin('A') == '') {\n\t\t\t\t$this->load->view(ADMIN_ENC_URL.'/templates/forgot_password.php', $this->data);\n } else {\n redirect(ADMIN_ENC_URL.'/dashboard');\n }\n }",
"public function forgotPassword()\n {\n if ($this->issetPostSperglobal('email') && !empty($this->getPostSuperglobal('email'))) {\n if ($this->users_manager->resetToken($this->getPostSuperglobal('email'))) {\n $this->session->writeFlash('success', \"Les instructions pour réinitialiser votre mot de passe vous ont été envoyées par email, vous avez 30 minutes pour le faire.\");\n } else {\n $this->session->writeFlash('danger', \"Aucun compte ne correspond à cet adresse mail : {$this->getPostSuperglobal('email')}.\");\n }\n } else {\n $this->session->writeFlash('danger', \"L'adresse mail n'est pas ou est mal renseignée.\");\n }\n $this->render('forgot-password', ['head'=>['title'=>'Mot de passe oublié', 'meta_description'=>'']]);\n }",
"public function getPasswordEmail()\n {\n $this->nav('navbar.logged.out.login');\n $this->title('auth.reset.title');\n\n return $this->view('auth.password.email');\n }"
]
| [
"0.73582804",
"0.7041275",
"0.7005018",
"0.693003",
"0.6710612",
"0.6689102",
"0.66279",
"0.6622148",
"0.6612885",
"0.6609213",
"0.6575785",
"0.6553878",
"0.655179",
"0.65469784",
"0.6537619",
"0.65359753",
"0.6494458",
"0.64927274",
"0.6472844",
"0.6464832",
"0.6445919",
"0.6441305",
"0.64390737",
"0.64317626",
"0.6425628",
"0.6416311",
"0.6412163",
"0.64053637",
"0.64044785",
"0.6399131"
]
| 0.7696021 | 0 |
Indicate that the model's phone number should be public. | public function publicPhoneNumber()
{
return $this->state(function (array $attributes) {
return [
'phone_number' => 1,
];
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function hasVerifiedPhone();",
"public function hasTelephone(): bool;",
"public function isPublic()\n {\n return $this->_public;\n }",
"public function isPublic()\n {\n return $this->public;\n }",
"public function isPublic() {\n\t\treturn $this->public;\n\t}",
"public function is_public(): bool;",
"public function isPublic() {}",
"public function isPublic() {\n return $this->privacyState == 'public';\n }",
"public function isPublic()\n\t{\n\t\tif ($this->isNew())\n\t\t{\n\t\t\treturn false;\n\t\t}\n\n\t\tif ($this->isPrivate())\n\t\t{\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}",
"public function markPhoneAsVerified();",
"public function isPublic()\n\t{\n\t\treturn $this->property->isPublic();\n\t}",
"public function has_phone() {\r\n return ! empty( $this->phone );\r\n }",
"public function set_public($value) {\r\n $this->public = $value;\r\n data::add(\"public\", $this->public == \"\" ? 1 : $this->public, $this->table_fields);\r\n }",
"public function setPublic()\n {\n $this->private = false;\n }",
"public function hasPhone() {\n return $this->_has(5);\n }",
"private function isTelephoneRequired()\n {\n return $this->eavConfig->getAttribute('customer_address', 'telephone')->getIsRequired();\n }",
"public function isPublic()\n {\n if ($this->getAccessType() === self::ACCESS_PUBLIC) {\n return true;\n }\n\n return false;\n }",
"public function isLabelPublic()\n {\n return ($this->label == 'public');\n }",
"public function isPublic()\n {\n $allowsAllHosts = false;\n $allowsRListings = false;\n foreach ($this->rules as $rule) {\n if (self::READ & $rule['mask']) {\n if (!empty($rule['rlistings'])) {\n $allowsRListings = true;\n } elseif (!empty($rule['host']) && trim($rule['host']) == '*') {\n $allowsAllHosts = true;\n }\n }\n }\n\n return $allowsAllHosts && $allowsRListings;\n }",
"public function isPublic()\n {\n\n if ($this->visibility == self::VISIBILITY_PUBLIC) {\n return true;\n }\n\n return false;\n }",
"function isPublic();",
"public function hasPublicUrl() {\n return $this->_has(4);\n }",
"function getPhone() {\n return $this->phone;\n }",
"public function hasPhone()\n {\n return $this->get(self::PHONE) !== null;\n }",
"public function getPhone()\n {\n return $this->phone;\n }",
"public function getPhone();",
"public function setPublic( $public = true ){\n\t\t$this->public = $public;\n\t}",
"public function phone($phone = null);",
"public function is_public_allowed( $entry ) {\n\t\treturn false;\n\t}",
"public function getPhoneNumber()\n {\n return $this->phoneNumber;\n }"
]
| [
"0.64898306",
"0.6386569",
"0.62377524",
"0.6222127",
"0.61937845",
"0.61648995",
"0.6156399",
"0.6105732",
"0.6048553",
"0.6012007",
"0.5998215",
"0.5993098",
"0.598791",
"0.5946367",
"0.59402263",
"0.59071314",
"0.58636206",
"0.5858392",
"0.5768897",
"0.5765944",
"0.5764303",
"0.57346654",
"0.57149893",
"0.57121027",
"0.5706711",
"0.57056034",
"0.5702155",
"0.56643456",
"0.563171",
"0.5614737"
]
| 0.6472975 | 1 |
Get the cards that are available for the given request. | public function availableCards(AdminRequest $request)
{
return $this->resolveCards($request)->filter->authorize($request)->values();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function index(CardRequest $request)\n {\n return $request->availableCards();\n }",
"public function cards(Request $request)\n {\n return [\n\n ];\n }",
"public function cards(Request $request)\n {\n return [\n new Bookings,\n new BookingsPerDay,\n new BookingPerStatus\n ];\n }",
"public function cards(Request $request) {\n return [];\n }",
"public function cards(Request $request)\n {\n return [];\n }",
"public function cards(Request $request)\n {\n return [];\n }",
"public function cards(Request $request)\n {\n return [];\n }",
"public function cards(Request $request)\n {\n return [];\n }",
"public function cards(Request $request)\n {\n return [];\n }",
"public function cards(Request $request)\n {\n return [];\n }",
"public function cards(Request $request)\n {\n return [];\n }",
"public function cards(Request $request)\n {\n return [];\n }",
"public function cards(Request $request)\n {\n return [];\n }",
"public function cards(Request $request)\n {\n return [];\n }",
"public function cards(Request $request)\n {\n return [];\n }",
"public function cards(Request $request)\n {\n return [];\n }",
"public function cards(Request $request)\n {\n return [];\n }",
"public function cards(Request $request)\n {\n return [];\n }",
"public function cards(Request $request)\n {\n return [];\n }",
"public function cards(Request $request)\n {\n return [];\n }",
"public function cards(Request $request)\n {\n return [];\n }",
"public function cards(Request $request)\n {\n return [];\n }",
"public function cards(Request $request)\n {\n return [];\n }",
"public function cards(Request $request)\n {\n return [];\n }",
"public function cards(Request $request)\n {\n return [];\n }",
"public function cards(Request $request)\n {\n return [];\n }",
"public function cards(Request $request)\n {\n return [];\n }",
"public function cards(Request $request)\n {\n return [];\n }",
"public function cards(Request $request)\n {\n return [];\n }",
"public function cards(Request $request)\n {\n return [];\n }"
]
| [
"0.79891163",
"0.7243225",
"0.71895236",
"0.71414095",
"0.7123965",
"0.7123965",
"0.7116729",
"0.7116729",
"0.7116729",
"0.7116729",
"0.7116729",
"0.7116729",
"0.7116729",
"0.7116729",
"0.7116729",
"0.7116729",
"0.7116729",
"0.7116729",
"0.7116729",
"0.7116729",
"0.7116729",
"0.7116729",
"0.7116729",
"0.7116729",
"0.7116729",
"0.7116729",
"0.7116729",
"0.7116729",
"0.7116729",
"0.7116729"
]
| 0.726391 | 1 |
converter endereco em um objeto com latitude e longitude | protected function getLongLat($endereco){
$end = str_replace(" ", "+", $endereco);
$url = "http://maps.googleapis.com/maps/api/geocode/json?address=".$end."&sensor=false";
$json = file_get_contents($url);
$data = json_decode($json, TRUE);
return json_encode($data['results'][0]['geometry']['location']);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getCoordinates(Address $address)\n {\n $type = NULL;\n\n //set latitude and longitude of new user\n //remove bis, ter from address street for localization research because it makes the research inaccurate \n $base = strtolower(trim($address->getStreet1().' '.$address->getZipCity()->getZipCode().' '.$address->getZipCity()->getCity())) ; \n \n if(preg_match('/^\\d+/',$base)){\n $type = 'housenumber';\n }elseif(preg_match('/^hameau/',$base)){\n $type = 'locality';\n }elseif(preg_match('/^(allée|allee|rue|impasse|square|avenue)/',$base)){\n $type = 'street';\n }\n\n //replace strings for better score\n $base = preg_replace('/\\s(bis|ter)\\s/',' ',$base);\n $base = preg_replace('/^(\\d+)(bis|ter)\\s/','${1} ',$base);\n $base = preg_replace('/\\,/',' ',$base);\n $base = preg_replace('/\\s(st)e?\\s/',' saint ',$base);\n $base = preg_replace('/\\s(dr)\\s/',' docteur ',$base);\n $base = preg_replace('/\\s(jo|j\\.o)\\s/',' jeux olympiques ',$base);\n\n $arrayParams = array( \n 'q' => $base,\n //'postcode' => $address->getZipCity()->getZipCode(),\n 'lat'=>'45.19251',\n 'lon'=>'5.72756',\n 'limit' => 2 \n ); \n if($type){\n $arrayParams['type'] = $type;\n }\n\n $res = $this->api->get('https://api-adresse.data.gouv.fr/','search/',$arrayParams);\n\n if($res['code'] == 200){ \n $features = $res['results']['features']; \n\n if( count($features) > 1){ \n if($features[0]['properties']['score'] > $features[1]['properties']['score'] ){\n $location = $features[0]; \n }else{\n $location = $features[1]; \n }\n }elseif(count($features) == 1){ \n $location = $features[0]; \n }else{\n return array('latitude'=>NULL ,'longitude'=>NULL, 'closest'=>array('label'=>'Aucune'));\n } \n\n $score = $location['properties']['score'];\n if($score <= 0.67){ \n if($score >= 0.60 && isset($location['properties']['oldcity'])){// if the address matches a former deprecated city name\n return array('latitude'=>$location['geometry']['coordinates'][1] ,'longitude'=>$location['geometry']['coordinates'][0]);\n }\n if($score >= 0.58){\n $similarityStreet = similar_text(strtolower($address->getStreet1()),strtolower($location['properties']['name']),$prec);\n if(! ($location['properties']['type'] == 'municipality')){//if municipality, name is city\n if($prec >= 50){\n return array('latitude'=>$location['geometry']['coordinates'][1] ,'longitude'=>$location['geometry']['coordinates'][0]);\n }\n }\n }\n return array('latitude'=>NULL ,'longitude'=>NULL,'closest' => $location['properties']);\n }else{\n return array('latitude'=>$location['geometry']['coordinates'][1] ,'longitude'=>$location['geometry']['coordinates'][0]);\n }\n }else{\n throw new \\Exception('geolocalization_api_failed : '.$res['results']['description']);\n }\n\n }",
"function getCoordination($address){\r\n $address = str_replace(\" \", \"+\", $address); // replace all the white space with \"+\" sign to match with google search pattern\r\n \r\n $url = \"http://maps.google.com/maps/api/geocode/json?sensor=false&address=$address\";\r\n \r\n $response = file_get_contents($url);\r\n \r\n $json = json_decode($response,TRUE); //generate array object from the response from the web\r\n\r\n $latitude = ($json[\"results\"][0][\"geometry\"][\"location\"][\"lat\"]);\r\n $longitude = ($json[\"results\"][0][\"geometry\"][\"location\"][\"lng\"]);\r\n\r\n return array(\"latitude\" => $latitude, \"longitude\" => $longitude);\r\n }",
"public function itShouldConvertAddressToCoordinates()\n {\n $address = '2711 Parkview Drive, Denton, Texas, 76210';\n $latLong = '33.136763, -97.056222';\n\n $listing = new Listing();\n $listing->setAddress($address);\n $listing->save();\n\n $listings = Listing::distance(1, $latLong);\n $listings = $listings->get();\n\n $this->assertEquals($address, $listings[0]->address);\n\n //Assert on the get by distance for now.\n // @TODO: We should have a coord accessor, I think.\n // $this->assertEquals($coords, $listing->coords);\n }",
"function get_lat_long($address){\r\n\t$API_KEY = 'AIzaSyC70LnMBiqyXcmpnQeryzq0VK12o6P5pnw';\r\n\t$address = str_replace(\" \", \"+\", $address);\r\n\t$url = \"https://maps.googleapis.com/maps/api/geocode/json?address=\".$address.\"&key=\".$API_KEY.\"\";\r\n\t$json = file_get_contents($url);\r\n\t$json = json_decode($json);\r\n\tif($json->status == 'ZERO_RESULTS'){\r\n\t\t$lat = 0;\r\n\t\t$long = 0; \t\r\n\t}else{\r\n\t\t$lat = $json->{'results'}[0]->{'geometry'}->{'location'}->{'lat'};\r\n\t\t$long = $json->{'results'}[0]->{'geometry'}->{'location'}->{'lng'};\t\r\n\t}\r\n\t\r\n\t$location = [$lat,$long];\r\n\treturn $location;\r\n}",
"function lat_long_conversion_to_numbers($originalSref) {\n $splitOriginalSref = explode(' ', $originalSref);\n //if the last character of the latitude is S (south) then the latitude is negative.\n if (substr($splitOriginalSref[0], -1)==='S')\n $splitOriginalSref[0] = '-'.$splitOriginalSref[0];\n //always chop off the N or S from the end of the latitude.\n $splitOriginalSref[0] = substr_replace($splitOriginalSref[0],\"\",-1);\n //convert from string to a number for actual use.\n $convertedSref['lat'] = floatval($splitOriginalSref[0]);\n //if the last character of the latitude is W (west) then the longitude is negative.\n if (substr($splitOriginalSref[1], -1)==='W')\n $splitOriginalSref[1] = '-'.$splitOriginalSref[1];\n //always chop off the E or W from the end of the longitude.\n $splitOriginalSref[1] = substr_replace($splitOriginalSref[1],\"\",-1);\n //convert from string to a number for actual use.\n $convertedSref['long'] = floatval($splitOriginalSref[1]);\n return $convertedSref;\n }",
"public function get_adresse();",
"public function getPostalCodeFromCoords() {\r\n\t\t$this->autoRender = false;\r\n\r\n\t\t$this->layout = 'ajax';\r\n\r\n\t\t$this->response->type('json');\r\n\r\n\t\t$response = $this->StreetAddress->getPostalCodeFromCoords(\r\n\t\t\t$this->request->data('latitude'),\r\n\t\t\t$this->request->data('longitude')\r\n\t\t);\r\n\r\n\t\tif ($response) {\r\n\t\t\t$this->response->body(json_encode($response));\r\n\t\t} else {\r\n\t\t\t$this->response->body(false);\r\n\t\t}\r\n\r\n\r\n\t}",
"function getCoordonnees($adresse){\n $apiKey = \"000824788445984525451:fkamkqgo6se\";//Indiquez ici votre clé Google maps !\n $url = \"http://maps.google.com/maps/geo?q=\".urlencode($adresse).\"&output=csv&key=\".$apiKey;\n\n $csv = file($url);\n $donnees = explode(\",\",$csv[0]); \n\t$t = array($donnees[2],$donnees[3]);\n\t\n return $t;\n\t}",
"function getCoordonnees($adresse){\n $apiKey = \"000824788445984525451:fkamkqgo6se\";//Indiquez ici votre clé Google maps !\n $url = \"http://maps.google.com/maps/geo?q=\".urlencode($adresse).\"&output=csv&key=\".$apiKey;\n\n $csv = file($url);\n $donnees = explode(\",\",$csv[0]); \n\t$t = array($donnees[2],$donnees[3]);\n\t\n return $t;\n\t}",
"function getLatLong($address, $city, $postalCode) {\n $combinedAddress = $address . \", \" . $postalCode . \" \" . $city;\n\n $url = \"https://maps.googleapis.com/maps/api/geocode/json?address=\" . urlencode($combinedAddress) . \"&key=\" . Config::GOOGLE_API_KEY;\n $context = stream_context_create();\n $result = file_get_contents($url, false, $context);\n\n if (isset($result)) {\n $parsedResult = json_decode($result, true);\n\n if (isset($parsedResult[\"results\"])) {\n $results = $parsedResult[\"results\"];\n $firstLocation = $results[0];\n return $firstLocation[\"geometry\"][\"location\"];\n } else {\n echo($result);\n }\n } else {\n echo \"HELP\";\n }\n}",
"private function getLatLng() {\n\t\tif( $this->getAutomaticLocation() && ( $this->isChanged() || ( !$this->getLat() && !$this->getLng() ) ) ) {\n\t\t\t$addressStr = $this->getAddLine1() . ' ' . $this->getStreetName() . ',' . $this->getTown();\n\t\t\t$addressStr.= ( $this->getCity() ) ? ',' . $this->getCity() : '';\n\t\t\t$addressStr.= ( $this->getRegion() ) ? ',' . $this->getRegion() : '';\n\t\t\t$addressStr.= ',' . $this->getPostalCode() . ',' . $this->getCountryCode();\n\t\t\t$req = sprintf( 'http://maps.googleapis.com/maps/api/geocode/json?address=%s&sensor=false', urlencode( $addressStr ) );\n\t\t\tif( !( $response = @file_get_contents( $req ) ) ) {\n\t\t\t\tthrow new Exception( sprintf( 'Unable to contact (%s)', $req ) );\n\t\t\t}\n\t\t\t$geoCode = json_decode( $response );\n// Do a switch here based on the possible status messages returned\n\t\t\tif( is_object( $geoCode ) ) {\n\t\t\t\tswitch( $geoCode->status ) {\n\t\t\t\t\tcase static::API_RESPONSE_ZERO_RESULTS:\n\t\t\t\t\t\t// ZERO RESULTS\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase static::API_RESPONSE_OK:\n\t\t\t\t\t\t$o = new StdClass();\n\t\t\t\t\t\t$o->Lat = $geoCode->results[0]->geometry->location->lat;\n\t\t\t\t\t\t$o->Lng = $geoCode->results[0]->geometry->location->lng;\n\t\t\t\t\t\treturn $o;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthrow new Exception( sprintf( 'Invalid response (%s) from (%s)', $response, $req ) );\n\t\t\t}\n\t\t} else {\n\t\t\t$o = new StdClass();\n\t\t\t$o->Lat = $this->getLat();\n\t\t\t$o->Lng = $this->getLng();\n\t\t\treturn $o;\n\t\t}\n\t}",
"public function getLng();",
"private function convertAddressToGeodata($orga, $address) {\n $apiKey = $this->getContainer()->getParameter('googleMapsApiKey');\n $api = self::googleApiUrl . \"?key=$apiKey\";\n $geo = file_get_contents(\"$api&address=\".urlencode($address) . '&sensor=false');\n\n // Convert the JSON to an array\n $geo = json_decode($geo, true);\n //die(var_dump($geo['status']));\n if ($geo['status'] == 'OK') {\n // Get Lat & Long\n $latitude = $geo['results'][0]['geometry']['location']['lat'];\n $longitude = $geo['results'][0]['geometry']['location']['lng'];\n \n $orga->setGeolocation($latitude .','.$longitude);\n }\n }",
"function helperGeocodeAddress($address='', $zip='', $city='', $country='') {\n\t\t$geocode\t= array();\n\t\t$coords\t\t= array();\n\t\t$search\t\t= false;\n\n\t\tif ($address != '') {\n\t\t\t$geocode[] = $address;\n\t\t\t$search = true;\n\t\t}\n\t\tif ($zip != '') {\n\t\t\t$geocode[] = $zip;\n\t\t\t$search = true;\n\t\t}\n\t\tif ($city != '') {\n\t\t\t$geocode[] = $city;\n\t\t\t$search = true;\n\t\t}\n\t\tif ($country != '') {\n\t\t\t$geocode[] = $country;\n\t\t} else {\n\t\t\t$geocode[] = $this->config['defaultCountry'];\n\t\t}\n\n\t\t// just if there are some values additional to the country\n\t\tif ($search) {\n\t\t\t$geocode = implode(',', $geocode);\n\n\t\t\t// call google service\n\t\t\t$url = 'http://maps.google.com/maps/geo?q='.urlencode($geocode).'&output=csv&key='.$this->config['mapKey'];\n\t\t\t$response=stripslashes(t3lib_div::getURL($url));\n\n\t\t\t// determain the result\n\t\t\t$response = explode(',', $response);\n\n\t\t\t// if there is a result\n\t\t\t$coords['status'] \t= $response[0];\n\t\t\t$coords['accuracy']\t= $response[1];\n\t\t\t$coords['lat']\t\t\t= $response[2];\n\t\t\t$coords['lng']\t\t\t= $response[3];\n\t\t} else {\n\t\t\t\t$coords['status']\t= 601;\n\t\t}\n\n\t\treturn $coords;\n\t}",
"public function getTipoEnderecoCobranca();",
"function helperReverseGeocode($lat, $lng) {\n\t\t$addressData = array();\n\t\t$lng = floatval($lat);\n\t\t$lng = floatval($lat);\n\n\t\tif ($key == '' || $lng == 0 || $lat == 0 ) {\n\t\t\treturn $addressData;\n\t\t}\n\n\t\t$coords\t\t= $lat . ',' . $lng;\n\t\t$url\t\t\t= 'http://maps.google.com/maps/geo?q='.$coords.'&output=json&oe=utf8&sensor=false&key='.$this->config['mapKey'];\n\t\t$address\t= json_decode(t3lib_div::getURL($url));\n\n\t\t// get the response\n\t\tif ($address->Status->code == '200' && count($address->Placemark) > 0) {\n\t\t\t$addressObj = $address->Placemark[0];\n\n\t\t\t$addressData['all']\t\t\t\t\t= $addressObj->address;\n\t\t\t$addressData['country']\t\t\t= $addressObj->AddressDetails->Country->CountryName;\n\t\t\t$addressData['countryshort']= $addressObj->AddressDetails->Country->CountryNameCode;\n\t\t\t$addressData['region']\t\t\t= $addressObj->AddressDetails->Country->AdministrativeArea->AdministrativeAreaName;\n\t\t\t$addressData['subarea']\t\t\t= $addressObj->AddressDetails->Country->AdministrativeArea->SubAdministrativeArea->SubAdministrativeAreaName;\n\t\t\t$addressData['city']\t\t\t\t= $addressObj->AddressDetails->Country->AdministrativeArea->SubAdministrativeArea->Locality->LocalityName;\n\t\t\t$addressData['zip']\t\t\t\t\t= $addressObj->AddressDetails->Country->AdministrativeArea->SubAdministrativeArea->Locality->PostalCode->PostalCodeNumber;\n\t\t\t$addressData['address']\t\t\t= $addressObj->AddressDetails->Country->AdministrativeArea->SubAdministrativeArea->Locality->Thoroughfare->ThoroughfareName;\n\t\t}\n\n\t\treturn $addressData;\n\t}",
"function geocode($address) {\n\t\t// http://maps.google.com/maps/api/geocode/json?address=\n\n\t\t// encodage de l'adresse pour la soumettre par url (remplacer les espaces présents dans l'adresse par des %20)\n\t\t$address = urlencode($address);\n\n\t\t// url de l'API pour géocoder \n\t\t$urlApi = \"http://maps.google.com/maps/api/geocode/json?address=$address\";\n\n\t\t// appel à l'api gmap decode (en GET - réponse en JSON)\n\t\t$responseJson = file_get_contents($urlApi);\n\n\t\t// décodage du json pour le transformer en array php associatif (-> 2ème paramètre : true)\n\t\t$responseArray = json_decode($responseJson, true);\n\n/*\t\techo '<pre>';\n\t\tprint_r($responseArray);\n\t\techo '</pre>';*/\n\n\t\t// on prépare un tableau associatif de retour pcq on 2 infos (lat et lng à retourner alors \n\t\t// qu'une fonction ne peut avoir qu'un seul retour)\n\t\t$response = [];\n\n\t\t// je teste le status de réponse de l'api -> OK (sinon, cela signifie qu'il n'y a pas de correspondance -> 'zero résult')\n\t\tif($responseArray['status'] == 'OK') {\n\t\t\t$lat = $responseArray['results']['0']['geometry']['location']['lat'];\n\t\t\t$lng = $responseArray['results']['0']['geometry']['location']['lng'];\n\n/*\t\t\techo $lat.'</br>';\n\t\t\techo $lng.'</br>';*/\n\n\t\t\t// test facultatif - on vérifie seulement que lat et lng sont bien présentes \n\t\t\tif($lat && $lng) {\n\t\t\t\t$response['lat'] = $lat;\n\t\t\t\t$response['lng'] = $lng;\n\t\t\t}\n\t\t}\n\t\treturn $response;\n\t}",
"function location_cmn($lat, $long, $usegeolocation, $customerno = null) {\n $address = NULL;\n $customerno = (!isset($customerno)) ? $_SESSION['customerno'] : $customerno;\n if (isset($lat) && isset($long)) {\n $GeoCoder_Obj = new GeoCoder($customerno);\n $address = $GeoCoder_Obj->get_location_bylatlong($lat, $long);\n }\n return $address;\n}",
"public function getLat();",
"function getGeocodeData($address) {\n $address = urlencode($address);\n $googleMapUrl = \"https://maps.googleapis.com/maps/api/geocode/json?address={$address}&key=AIzaSyCXB6yLq41R_CSfl2saDa1pqqOutnamespace OCFram\\Blog\\Model;PwVNnI\";\n $geocodeResponseData = file_get_contents($googleMapUrl);\n $responseData = json_decode($geocodeResponseData, true);\n if($responseData['status']=='OK') {\n $latitude = isset($responseData['results'][0]['geometry']['location']['lat']) ? $responseData['results'][0]['geometry']['location']['lat'] : \"\";\n $longitude = isset($responseData['results'][0]['geometry']['location']['lng']) ? $responseData['results'][0]['geometry']['location']['lng'] : \"\";\n $formattedAddress = isset($responseData['results'][0]['formatted_address']) ? $responseData['results'][0]['formatted_address'] : \"\";\n if($latitude && $longitude && $formattedAddress) {\n $geocodeData = $latitude . \";\" . $longitude;\n return $geocodeData;\n } else {\n return false;\n }\n } else {\n echo \"ERROR: {$responseData['status']}\";\n return false;\n }\n }",
"function getAddressComponentsFromLatLng($args){\r\n\t\t$requvired = [\t['latitude','latitude'] ,['longitude','longitude'] ];\t\r\n\t\tif(! $this->checkAruguments($requvired,$args)){ return $this->_getStatusMessage(1, 1); }\r\n\t\t$lat = $args['latitude'];\r\n\t\t$lng = $args['longitude'];\r\n\t\t$geocode = file_get_contents('http://maps.googleapis.com/maps/api/geocode/json?latlng='.$lat.','.$lng.'&sensor=false');\r\n\t\t\r\n\t\t$api_response = array();\r\n\t\t$output= json_decode($geocode);\r\n\t\tfor($j=0;$j<count($output->results[0]->address_components);$j++){\r\n\t\t\t$api_response[$output->results[0]->address_components[$j]->types[0]] = $output->results[0]->address_components[$j]->long_name;\r\n\t\t}\r\n\t\t$response = array('errNum'=>200,'errFlag'=>0,'errMsg'=>'ok','data'=>$api_response);\r\n\t\t\r\n\t\treturn $response;\r\n\t}",
"function reverse_geocode_data($data,$lat=0,$lng=0)\n{\n $data = @json_decode($data, 1);\n\n $_locale = [\"lat\"=>$lat,\"lng\"=>$lng,\"city\" => \"\", \"state\" => \"\", \"country\" => \"\", \"success\" => false];\n\n if (!isset($data['status']) || $data['status'] != \"OK\") {\n return $_locale;\n }\n\n foreach ($data['results'] as $localities) {\n\n foreach ($localities as $locality) {\n if(is_array($locality)) {\n foreach ($locality as $key => $locale) {\n\n if (isset($locale['types'])) {\n $types = $locale['types'];\n\n if ($types[0] == \"locality\") {\n $_locale['city'] = $locale['long_name'];\n }\n\n if ($types[0] == \"administrative_area_level_1\") {\n $_locale['state'] = $locale['long_name'];\n }\n\n if ($types[0] == \"country\") {\n $_locale['country'] = $locale['long_name'];\n }\n\n }\n }\n }\n }\n\n }\n\n $_locale['success'] = true;\n\n return $_locale;\n}",
"function getCoordinatesFromAddress( $sQuery)\n{\n\t$sURL = 'http://maps.googleapis.com/maps/api/geocode/json?address='.urlencode($sQuery).'&sensor=false';\n\t$sData = file_get_contents($sURL);\n\t\n\treturn json_decode($sData);\n}",
"function get_lat_long($address)\r\n{\t\r\n\t//sleep(1);\r\n $address = str_replace(\" \", \"+\", $address);\r\n $json = file_get_contents(\"http://maps.google.com/maps/api/geocode/json?address=$address&sensor=false®ion=$region\");\r\n $json = json_decode($json);\r\n\t// echo \"<pre>\"; print_r($json); \r\n\r\n $lat = $json->{'results'}[0]->{'geometry'}->{'location'}->{'lat'};\r\n $long = $json->{'results'}[0]->{'geometry'}->{'location'}->{'lng'};\r\n return $lat.','.$long;\r\n}",
"public function getAddress();",
"public function getAddress();",
"public function getAddress() {}",
"public function encodeAddress($casilla) {\n\n $casilla = trim($casilla);\n // Si la casilla no trae name, no le hace nada\n if (preg_match('/^<?[_\\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\\.)+[a-zA-Z]{2,6}>?$/', $casilla)) {\n return $casilla;\n };\n\n // Si trae name, ve si hay que encodificarlo\n $matches = array();\n if (preg_match('/(.+)(<[_\\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\\.)+[a-zA-Z]{2,6}>)$/', $casilla, $matches)) {\n $name = $matches[1];\n $email = $matches[2];\n\n // Si el nombre tiene tildes o ()<>@,;\\:\". lo encodifica\n if (preg_match('/([\\x80-\\xFF\\(\\)\\<\\>\\@\\,\\;\\\\\\:\\\"\\.]){1}/', $name)) {\n $preferences = array(\n 'input-charset' => 'UTF-8',\n 'output-charset' => 'UTF-8', // ISO-8859-1 o UTF-8\n 'line-length' => 255,\n 'scheme' => 'B', // o Q\n 'line-break-chars' => \"\\n\"\n );\n $name = iconv_mime_encode('Reply-to', $name, $preferences);\n $name = preg_replace(\"#^Reply-to\\:\\ #\", '', $name);\n $casilla = $name . $email;\n };\n };\n return $casilla;\n }",
"function getAddressCoordinates($address, City $city=null);",
"function get_coordinates($object, $field_name, $request) {\n\tglobal $wpdb;\n\t$location = $wpdb->get_row('SELECT wp_geo_mashup_locations.lat, wp_geo_mashup_locations.lng FROM wp_geo_mashup_locations INNER JOIN wp_geo_mashup_location_relationships ON wp_geo_mashup_locations.id = wp_geo_mashup_location_relationships.location_id\nWHERE wp_geo_mashup_location_relationships.object_id = ' . $object[\"id\"]);\n\tif ($location) {\n\t\treturn $location->lat . \",\" . $location->lng;\n\t} else {\n\t\treturn null;\n\t}\n}"
]
| [
"0.5961505",
"0.5891433",
"0.57869726",
"0.570382",
"0.5678855",
"0.5677647",
"0.5670468",
"0.56352973",
"0.56352973",
"0.5623706",
"0.56191015",
"0.5542514",
"0.55292034",
"0.5516571",
"0.5505411",
"0.5469877",
"0.5433283",
"0.5406255",
"0.5387065",
"0.5348505",
"0.5340457",
"0.5326267",
"0.5316958",
"0.5306826",
"0.5306781",
"0.5306781",
"0.5298995",
"0.5293492",
"0.5278914",
"0.5270464"
]
| 0.60305923 | 0 |
Create exception instance for accesstokenfetchfailed. | public static function accessTokenFetchFailed(Response $response)
{
return new static(sprintf(
"Fetching access token from Procountor failed. '%s'",
$response->body()
));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function testInvalidAccessTokenThrowsException(): void\n {\n $apiKey = $this->createValidFakeApiKey();\n $this->expectException(InvalidAccessTokenException::class);\n $this->tryTestWithCredentials($apiKey);\n }",
"public function toException()\n {\n if ($this->failed()) {\n return new RequestException($this);\n }\n }",
"public function testAccessTokenCannotBeCreatedWithAnExistentToken(): void\n {\n // Creates expectation.\n $this->expectException(QueryException::class);\n\n // Get a random AccessToken.\n $accessToken = $this->model->newQuery()->inRandomOrder()->first();\n\n // Perform test.\n $this->repository->create(\n new AccessToken([\n 'token_id' => $accessToken->token_id,\n 'user_id' => $accessToken->user_id,\n 'expires_at' => $this->faker->dateTimeBetween('+10 days', '+20 days')->format('Y-m-d H:i:s')\n ])\n );\n }",
"public function getAuthenticationException();",
"public function getException();",
"public function testFetchingResourceWithInvalidAthorizationType()\n {\n $client = new OAuth2\\Client(CLIENT_ID, CLIENT_SECRET, OAuth2\\Client::AUTH_TYPE_URI);\n\n // Here you can define any other params that you want to pass.\n $params = array();\n\n // It will throw an Exception(InvalidArgumentException)\n $tokenResponse = $client->getAccessToken(TOKEN_URI, OAuth2\\Client::GRANT_TYPE_PASSWORD, $params);\n }",
"protected function requestExceptionWithResponse()\n {\n $exception = function ($request) {\n return new RequestException(\n 'test',\n $request,\n Litecoin\\LitecoindResponse::createFrom($this->rawTransactionError())\n );\n };\n\n return $exception;\n }",
"public function makeException()\n {\n $this->thrownException = ResponseException::create($this);\n }",
"public function testInvalidApiKeyThrowsException(): void\n {\n $accessToken = $this->createValidFakeAccessToken();\n $this->expectException(InvalidApiKeyException::class);\n $this->tryTestWithCredentials('', $accessToken);\n }",
"public function testGetByTokenFailsIfDoesntExist(): void\n {\n // Creates expectation.\n $this->expectException(AccessTokenNotFoundException::class);\n\n // Performs test.\n $this->repository->getByToken('DummyTokenIdThatDoesntExistsInTheDatabase');\n }",
"private function throwException()\n {\n throw new CacheException(\\odbc_errormsg(), (int) \\odbc_error());\n }",
"public function throwAuthenticationException()\n {\n $user = new User();\n try {\n $user->generateResetPasswordToken($this->valid_test_email_2);\n $this->fail(\"Token generated successfully even when the account is an inactive one\");\n } catch (Exception $e) {\n $this->assertInstanceOf('UserAuth\\Exceptions\\UserAuthenticationException', $e);\n }\n }",
"public function testAccessTokenCannotBeCreatedWithInexistentUser(): void\n {\n // Creates expectation.\n $this->expectException(QueryException::class);\n\n // Perform test.\n $this->repository->create(\n new AccessToken([\n 'token_id' => $this->faker->randomAscii,\n 'user_id' => 2147483647,\n 'expires_at' => $this->faker->dateTimeBetween('+10 days', '+20 days')->format('Y-m-d H:i:s')\n ])\n );\n }",
"public function testFetchingResourceWithInvalidAccessTokenBearer()\n {\n $client = new OAuth2\\Client(CLIENT_ID, CLIENT_SECRET, OAuth2\\Client::AUTH_TYPE_AUTHORIZATION_BASIC);\n\n // Here you can define any other params that you want to pass.\n $params = array();\n\n // Generating Token\n $tokenResponse = $client->getAccessToken(TOKEN_URI, OAuth2\\Client::GRANT_TYPE_CLIENT_CREDENTIALS, $params);\n $httpCode = $tokenResponse['code'];\n \n $client->setAccessToken($tokenResponse['result']['access_token']);\n // Setting Up the access Token Type to client Object\n $client->setAccessTokenType(OAuth2\\Client::ACCESS_TOKEN_OAUTH);\n\n // Finally fetching resource from Resource URL using access token\n $resourceResponse = $client->fetch('https://api.fronter.com/clients/'.CLIENT_ID);\n\n $resourceURLResponseHttpCode = $resourceResponse['code'];\n\n $this->assertEquals(401, $resourceURLResponseHttpCode);\n }",
"public static function oauthException(ResponseInterface $response, $data): IdentityProviderException\n {\n return static::fromResponse(\n $response,\n $data['error'] ?? $response->getReasonPhrase()\n );\n }",
"public static function reflectionFailure(string $entity, ReflectionException $previousException): self\n {\n return new self(sprintf('An error occurred in %s', $entity), 0, $previousException);\n }",
"protected function createToken()\n {\n if ($this->client->getRefreshToken()) {\n $this->client->fetchAccessTokenWithRefreshToken($this->client->getRefreshToken());\n } else {\n // Request authorization from the user.\n $authUrl = $this->client->createAuthUrl();\n printf(\"Open the following link in your browser:\\n%s\\n\", $authUrl);\n print 'Enter verification code: ';\n $authCode = trim(fgets(STDIN));\n\n // Exchange authorization code for an access token.\n $accessToken = $this->client->fetchAccessTokenWithAuthCode($authCode);\n $this->client->setAccessToken($accessToken);\n\n // Check to see if there was an error.\n if (array_key_exists('error', $accessToken)) {\n throw new Exception(join(', ', $accessToken));\n }\n }\n // Save the token to a file.\n if (!file_exists(dirname($this->token))) {\n mkdir(dirname($this->token), 0700, true);\n }\n file_put_contents($this->token, json_encode($this->client->getAccessToken()));\n }",
"public function throwException() {\n throw new FPCAuthentication_Exception(\"Invalid login and/or password\", $this->_login);\n }",
"public function shouldRaiseExceptionWhenInvalidToken(): void\n {\n $station = $this->faker->city;\n\n $this->waqi->shouldReceive('getObservationByStation')\n ->once()\n ->with($station)\n ->andThrow(InvalidAccessTokenException::class);\n\n $this->waqi->getObservationByStation($station);\n }",
"public function testFetchingResourceWithInvalidGrantType()\n {\n $client = new OAuth2\\Client(CLIENT_ID, CLIENT_SECRET, OAuth2\\Client::AUTH_TYPE_AUTHORIZATION_BASIC);\n\n // Here you can define any other params that you want to pass.\n $params = array();\n\n // It will throw an Exception(InvalidArgumentException)\n $tokenResponse = $client->getAccessToken(TOKEN_URI, OAuth2\\Client::GRANT_TYPE_PASSWORD, $params);\n }",
"public function exchangeCodeForAccessToken(string $code, string $state = null) : AccessTokenInterface\n {\n $request = new Curl();\n $request->timeout(4);\n $response = $request->process(\n $this->getAccessTokenUrl() .\n '?client_id=' . $this->getId() .\n '&redirect_uri=' . $this->getRedirectUrl() .\n '&client_secret=' . $this->getSecret() .\n '&code=' . $code\n );\n\n $responsVars = get_object_vars($response);\n\n if (!$response || isset($responsVars['error'])) {\n throw new Exception(\n 'En feil oppsto ved innlogging. Prøv igjen eller kontakt [email protected]'\n );\n }\n\n $accessToken = new AccessToken($response->access_token);\n $accessToken->setData($response);\n\n return $accessToken;\n }",
"public static function occurred(array $context): self\n {\n return new RequestException(\n \"There was an error requesting the Model\",\n 500,\n null,\n $context\n );\n }",
"protected function setErrorException(\\Exception $e) {\n\t\t$this->lastException = $e;\n\t\treturn $this;\n\t}",
"protected function prepareException(Exception $e)\n {\n if ($e instanceof AuthorizationException) {\n $e = new HttpException(403, $e->getMessage());\n }\n\n return $e;\n }",
"public function testInvalidTokenException(): void\n {\n $this->expectException(InvalidArgumentException::class);\n\n (new ApiKeyAsBasicAuthUsernameEncoder())->encode(new JwtApiToken([]));\n }",
"public function failed(Exception $exception)\n {\n Log::error('[BigCommerce API Request]', ['message' => $exception->getMessage()]);\n }",
"public function testAccessTokenCannotBeCreatedIfAccessTokenHasId(): void\n {\n // Creates expectation.\n $this->expectException(AccessTokenAlreadyCreatedException::class);\n\n // Perform test.\n $this->repository->create(\n new AccessToken([\n 'id' => 1,\n 'token_id' => $this->faker->randomAscii,\n 'user_id' => 2147483647,\n 'expires_at' => $this->faker->dateTimeBetween('+10 days', '+20 days')->format('Y-m-d H:i:s')\n ])\n );\n }",
"protected function getExceptionError(Exception $exception)\n {\n $status = 500;\n $error = null;\n if ($exception instanceof TokenMismatchException) {\n $status = 406;\n $error = Helper::makeJsonapiObject($this->jsonapiVersion, 'error', [\n 'status' => \"$status\",\n 'title' => Helper::trans('lalu-jdr::messages.token_mismatch.title'),\n 'detail' => Helper::trans('lalu-jdr::messages.token_mismatch.detail'),\n ]);\n } elseif ($exception instanceof ValidationException) {\n $status = 406;\n $error = [];\n $messages = $exception->validator->messages();\n foreach ($messages->toArray() as $field => $messageArr) {\n foreach ($messageArr as $message) {\n $error[] = Helper::makeJsonapiObject($this->jsonapiVersion, 'error', [\n 'title' => Helper::trans('lalu-jdr::messages.validation_error.title'),\n 'detail' => $message,\n 'source' => Helper::makeJsonapiObject($this->jsonapiVersion, 'source', [\n 'pointer' => $field,\n ]),\n ]);\n }\n }\n } elseif ($exception instanceof AuthorizationException) {\n $status = 401;\n $error = Helper::makeJsonapiObject($this->jsonapiVersion, 'error', [\n 'status' => \"$status\",\n 'title' => Helper::trans('lalu-jdr::messages.authorization_error.title'),\n 'detail' => Helper::trans('lalu-jdr::messages.authorization_error.detail'),\n ]);\n } else {\n $status = method_exists($exception, 'getStatusCode') ? $exception->getStatusCode() : (method_exists($exception, 'getCode') ? $exception->getCode() : 500);\n if (!in_array($status, JsonResponse::$HTTP_ERROR_STATUS_CODES)) {\n $status = 500;\n }\n $message = $exception->getMessage();\n $error = Helper::makeJsonapiObject($this->jsonapiVersion, 'error', [\n 'status' => \"$status\",\n 'title' => Helper::trans(\"lalu-jdr::messages.$status.title\"),\n 'detail' => empty($message) ? Helper::trans(\"lalu-jdr::messages.$status.detail\") : $message,\n ]);\n }\n\n return [$status, $error];\n }",
"protected function createExceptionFromLastError(string $function): ConnectionException\n {\n $this->close();\n\n return new ConnectionException($function.' failed');\n }",
"private function tokenNotFoundError() {\n return response()->json([\n 'error' => 'Either your email or token is wrong.'\n ], Response::HTTP_UNPROCESSABLE_ENTITY);\n }"
]
| [
"0.572985",
"0.555491",
"0.5300718",
"0.52597654",
"0.5165469",
"0.5097996",
"0.5053184",
"0.5026039",
"0.49861214",
"0.49824154",
"0.49411005",
"0.49185032",
"0.4861722",
"0.4860134",
"0.4855615",
"0.48008066",
"0.47991243",
"0.47854894",
"0.47608408",
"0.4750715",
"0.47275013",
"0.47234726",
"0.47186592",
"0.47183728",
"0.4716798",
"0.4713854",
"0.47064933",
"0.46975562",
"0.46971166",
"0.4680519"
]
| 0.6176644 | 0 |
Method to retrieve all Programmes | public function getAllProgrammes() {
try {
$programes = $this->em->getRepository(Entity\Programme::class)->findAll();
$this->em->flush();
} catch (\Doctrine\ORM\OptimisticLockException $e) {
$this->em->rollback();
}
return $programes === null ? 0 : $programes;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getProgrammes()\r\n {\r\n $sql=\"SELECT * FROM programmes\";\r\n $query=$this->db->query($sql);\r\n return $query->result_array();\r\n }",
"public static function getPrograms()\n {\n $s = self::$_db->prepare('SELECT * FROM emission');\n $s->execute();\n $res = array();\n while ($data = $s->fetch(PDO::FETCH_ASSOC)) {\n $res[] = new Program($data['id_ems'], $data['prog_name'], $data['image'], $data['description']);\n }\n return $res;\n }",
"public static function getProgramsList()\n\t{\n\t\t$db = Db::getConnection();\n\n\t\t$result = $db->query('SELECT * FROM `programs` ORDER BY `id` DESC');\n\t\t$programs = $result->fetchAll();\n\t\t\n\t\treturn $programs;\n\t}",
"protected function GetPrograms()\n {\n return $this->GetUser()->OptionsForEntitiesWithPrivilege(\"Program\", \\Ability::ADMIN, \"allow_teams = ?\", array(true));\n }",
"public function getPrograms()\n {\n return $this->programs;\n }",
"public function index()\n {\n $programs = Program::all();\n return $this->showAll($programs);\n }",
"public function queryAll()\n {\n $sql = <<<SQL\n SELECT s.*, p.title as program_name \n FROM ec_shows s, ec_programs p\n WHERE s.program_id = p.id\nSQL;\n $sqlQuery = new SqlQuery($sql);\n return $this->getList($sqlQuery);\n }",
"public function fetchProgramById(){\n $query = $this->connection->query(\"select * from programs where id='$this->id'\");\n return $query;\n }",
"function getAllApplications()\r\n {\r\n //Connect to the DB, build query\r\n $db = db_connect();\r\n $sql = \"SELECT * FROM account WHERE role = :role: ORDER BY accountID DESC\";\r\n\r\n //Send query then store the results\r\n $results = $db->query($sql, [\r\n 'role' => 0\r\n ]);\r\n return $results;\r\n }",
"public function showAll() {\n $sql = \"SELECT * FROM \" . applicationTable::TABLE_NAME;\n\n $stmt = $this->mConnection->prepare($sql);\n $status = $stmt->execute();\n\n if ($status != true) {\n $errorInfo = $stmt->errorInfo();\n throw new Exception(\"Could not display applications: \" . $errorInfo[2]);\n }\n\n $jobs = array();\n $row = $stmt->fetch();\n while ($row != null) {\n $id = $row[applicationTable::COLUMN_ID];\n $seekerId = $row[applicationTable::COLUMN_SEEKERID];\n $empId = $row[applicationTable::COLUMN_EMPID];\n $jobId = $row[applicationTable::COLUMN_JOBID];\n $status = $row[applicationTable::COLUMN_STATUS];\n\n $application = new Application($id, $seekerId, $empId, $jobId, $status);\n $applications[$id] = $application;\n\n $row = $stmt->fetch();\n }\n\n return $applications;\n }",
"public function getProgramsList()\n {\n $programs = array();\n \n foreach( $this->getSystemUserGroups() as $group )\n {\n foreach( $group->getSystemPrograms() as $prog )\n {\n $programs[$prog->controller] = $prog->name;\n }\n }\n \n foreach( $this->getSystemUserPrograms() as $prog )\n {\n $programs[$prog->controller] = $prog->name;\n }\n \n asort($programs);\n return $programs;\n }",
"public function programs()\n {\n return $this->hasMany('Acme\\Program');\n }",
"public function programs()\n\t\t{\n\t\t\t$this->is_login();\n\t\t\t$this->load->model('programs_model', 'p');\n\t\t\t$data['programs'] = $this->p->get_all();\n\t\t\t$this->load->view('programs-admin', $data);\n\t\t}",
"public function getProgramList()\n {\n $query = \"SELECT name FROM bolt_custom_programs\";\n\n $rows = $this->app['db']->executeQuery($query)->fetchall();\n\n $values = array('Select');\n\n foreach($rows as $x=>$y) {\n $values[$y[\"name\"]] = $y[\"name\"];\n }\n\n return($values);\n }",
"public function getApplications()\n\t{\n\t}",
"public function getApplications()\n {\n $res = $this->getEntity()->getApplications();\n\t\tif($res === null)\n\t\t{\n\t\t\t$this->setApplications(SDIS62_Model_DAO_Abstract::getInstance($this::$type_objet)->findAllByCriteria('Application', array('primary' => $this::getPrimary())));\n\t\t\treturn $this->getEntity()->getApplications();\n\t\t}\n return $res;\n }",
"function getProgramAll(){\n\tinclude('conf.php');\n \t$conn=mysql_connect($host,$cuser,$cpass) or die ('Unable to connect');\n \tmysql_select_db($db) or die ('Unable to connect to database');\n\t$query=\"select prCode,prDesc from program Order by prCode\";\n\t$result = mysql_query($query) or die (\"Error in query: $query. \" . mysql_error());\n\twhile ($row = mysql_fetch_object($result)){\n\t\t$prCode[]=$row->prCode;\n\t\t$prDesc[]=$row->prDesc;\n\t}\n\tmysql_free_result($result);\n \tmysql_close($conn);\n \treturn array($prCode,$prDesc);\n}",
"public function index()\n {\n return Profesion::all();\n }",
"public function index()\n {\n $programs = Program::where('id_user', auth()->user()->id)->orderByDesc('id')->get();\n\n return view('pages.relawan.programs', compact('programs'));\n }",
"public function getPrograms()\n {\n $programs = array();\n \n \n foreach( $this->getSystemUserGroups() as $group )\n {\n foreach( $group->getSystemPrograms() as $prog )\n {\n $programs[$prog->controller] = true;\n }\n }\n \n foreach( $this->getSystemUserPrograms() as $prog )\n {\n $programs[$prog->controller] = true;\n }\n \n return $programs;\n }",
"public function index()\n {\n $programs = Program::with('translate', 'media')->paginate();\n return view('admin.programs.index', compact('programs'));\n }",
"public function getAllApp()\n {\n $sql = \"SELECT * FROM appointment\";\n $values=array();\n \n $ap=$this->getInfo($sql,$values);\n\n return $ap;\n }",
"public function getSystemUserPrograms()\n {\n $system_user_programs = array();\n return $system_user_programs;\n }",
"public static function retrieveAllProjects() {\n return R::getAll('SELECT * FROM project');\n }",
"public function index()\n { \n $programs = Program::OrderBy('id', 'ASC')->paginate(10);\n return view('programs.index')\n ->with('programs', $programs);\n }",
"public function index()\n {\n return view('admin.programs.index')->with('programs', Programs::orderBy('id','DESC')->paginate(5));\n }",
"public function acceso_programas_computacionales(){\n\t\treturn $this->hasMany('App\\AccesoProgramaComputacion', 'Prog_ID_Asp');\n\t}",
"public function index()\n {\n $applications = Application::all();\n return $applications;\n }",
"public function get_catalogos() {\n $this->db->flush_cache();\n $this->db->reset_query();\n $resutado = $this->db->get('catalogos.programas_proyecto');\n return $resutado->result_array();\n }",
"public function index()\n {\n $data_program = Program::all();\n\n return view('program.program', compact('data_program'));\n }"
]
| [
"0.7603743",
"0.7042983",
"0.67120755",
"0.6561479",
"0.63808376",
"0.6342765",
"0.6267164",
"0.60983896",
"0.6052791",
"0.5973888",
"0.5926106",
"0.5925172",
"0.59239125",
"0.59002656",
"0.5872258",
"0.5838603",
"0.58146966",
"0.57869637",
"0.5783099",
"0.57418656",
"0.5720219",
"0.5719315",
"0.5701034",
"0.5685497",
"0.5662734",
"0.56450397",
"0.560958",
"0.5608456",
"0.55921227",
"0.5575041"
]
| 0.7481882 | 1 |
Store a newly created Problem in storage. | public function store(Request $request)
{
$problems = $request->input('problems');
$topicId = $request->input('topicId');
// if requests includes Problem information, store in database
// attach created Problem object to the specified Topic
if (!empty($problems)){
foreach ($problems as $prob){
$problem = new Problem;
$problem->problem_name = $prob['problem_name'];
$problem->url = $prob['url'];
$problem->save();
$problem->topics()->attach($topicId);
}
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function store(Request $request, Problem $problem)\n {\n $rules = [\n 'file' => 'file'\n ];\n\n $this->validate($request, $rules);\n\n $uploadedFile = $request->file;\n $run = new Run();\n $run->file_name = $uploadedFile->getClientOriginalName();\n $run->student_id = Auth::guard('api')->user()->id;\n\n $problem->runs()->save($run);\n\n Storage::putFileAs(\"problems/$problem->id/runs/$run->id\", $request->file, $uploadedFile->getClientOriginalName());\n\n return response()->json($run);\n }",
"public function store(Request $request)\n {\n $this->validate($request, [\n 'content' => 'required|max:255',\n ]);\n $request->user()->problems()->create([\n 'content' => $request->content,\n ]);\n return redirect('/problems');\n }",
"public function storeOrUpdate(Issue $issue = null)\n {\n $data = request()->validate([\n 'name' => 'required|string|max:255',\n ]);\n\n if ($issue) {\n $issue->update($data);\n\n return redirect()->route('admin.issues.index')->with([\n 'alertType' => 'success',\n 'alertMessage' => 'Le problème a bien été édité.',\n ]);\n }\n\n Issue::create($data);\n\n return redirect()->route('admin.issues.index')->with([\n 'alertType' => 'success',\n 'alertMessage' => 'Le nouveau problème a bien été ajouté.',\n ]);\n }",
"public function store(Request $request, $id)\n {\n $this->validate (\n $request,\n [\n 'question' => 'required',\n 'choices' => 'required',\n 'answer' => 'required'\n ]\n );\n\n $problem = new Problem();\n $problem->question = request('question');\n $problem->choices = json_encode(request('choices'));\n $problem->answer = request('answer');\n $problem->test_id = $id;\n\n //Save\n $problem->save();\n\n return redirect(\"/tests/$id\")->with('success', 'Problem Added');\n }",
"public function store()\r\n\t{\r\n\t\t//\r\n\t}",
"public function store()\r\n\t{\r\n\t\t//\r\n\t}",
"public function store()\r\n\t{\r\n\t\t//\r\n\t}",
"public function store()\n\t{\n\t\t$step = new Step;\n\n\t\t$step->task_id = 1;\n\t\t$step->user_id = 1;\n\t\t$step->title = Input::get('step_title');\n\t\t$step->report = Input::get('step_report');\n\t\t$step->duration = Input::get('step_duration');\n\n\t\t$step->save();\n\n\t\treturn Redirect::route('step.index')->withMessage('Étapes créée avec succès !');\n\t}",
"public function store()\n\t{\n\t\t\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}"
]
| [
"0.64421576",
"0.61969244",
"0.5901603",
"0.5874045",
"0.5816447",
"0.5816447",
"0.5816447",
"0.5792641",
"0.57516456",
"0.5748392",
"0.5748392",
"0.5748392",
"0.5748392",
"0.5748392",
"0.5748392",
"0.5748392",
"0.5748392",
"0.5748392",
"0.5748392",
"0.5748392",
"0.5748392",
"0.5748392",
"0.5748392",
"0.5748392",
"0.5748392",
"0.5748392",
"0.5748392",
"0.5748392",
"0.5748392",
"0.5748392"
]
| 0.63180965 | 1 |
checkOnlineList Checks users online | private function checkOnlineList()
{
$this->online->checkOnlineList($this->loginTime);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getUsersOnline()\r\n {\r\n $result = $this->getBitrixApi(array(\r\n 'FILTER' => array('IS_ONLINE' => 'Y',),\r\n ), 'user.get');\r\n\r\n if ($result) {\r\n if (isset($result['total']) && $result['total'] > 0) {\r\n return $result['result'];\r\n } else {\r\n return false;\r\n }\r\n } else {\r\n return false;\r\n }\r\n\r\n }",
"public function get_users_online()\n {\n $logged_in_users = get_transient('agents_online'); //Get the active users from the transient.\n $count = 0;\n\n if($logged_in_users) {\n foreach ($logged_in_users as $logged_in_user) {\n if (isset($logged_in_user['last']) && ($logged_in_user['last'] > (time()-60) )) {\n $count++;\n }\n }\n } \n \n echo $count;\n die();\n }",
"function onlineUsers() {\n\n\tif (isset($_GET['onlineusers'])) {\n\n\t\tglobal $connection;\n\n\t\tif (!$connection) {\n\t\t\tsession_start();\n\t\t\tinclude '../include/db.php';\n\n\t\t\t$session = session_id();\n\t\t\t$time = time();\n\t\t\t$time_out_secs = 10;\n\t\t\t$time_out = $time - $time_out_secs;\n\n\t\t\t$query = \"SELECT * FROM users_online WHERE session = '$session'\";\n\t\t\t$send_query = mysqli_query($connection, $query);\n\t\t\t$count = mysqli_num_rows($send_query);\n\n\t\t\tif ($count == NULL) {\n\t\t\t\tmysqli_query($connection, \"INSERT INTO users_online(session, time) VALUES('$session', '$time')\");\n\t\t\t} else {\n\t\t\t\tmysqli_query($connection, \"UPDATE users_online SET time = '$time' WHERE session = '$session'\");\n\t\t\t}\n\n\t\t\t$users_online = mysqli_query($connection, \"SELECT * FROM users_online WHERE time > '$time_out'\");\n\t\t\techo $count_users = mysqli_num_rows($users_online);\n\t\t}\n\t}\n}",
"public function isOnline($me, $isOnline){\r\n $poll = $this->pdo->query(\"UPDATE users SET user_isOnline = '$isOnline' WHERE user_id = '$me'\");\r\n }",
"function d4os_io_db_070_os_users_online_users_count() {\n d4os_io_db_070_set_active('os_robust');\n $now_online = db_result(db_query(\"SELECT COUNT(*) FROM {GridUser}\"\n . \" WHERE Online = 'true'\"\n . \" AND Login < (UNIX_TIMESTAMP(FROM_UNIXTIME(UNIX_TIMESTAMP(now()))))\"\n . \" AND Logout < (UNIX_TIMESTAMP(FROM_UNIXTIME(UNIX_TIMESTAMP(now()))))\"));\n d4os_io_db_070_set_active('default');\n return $now_online;\n}",
"public function isOnline() {}",
"function check_users_online() {\n global $DOCUMENT_ROOT;\n global $config;\n global $shop;\n \n // odczytaj pliki z sesji i sprawdz ich ostatni czas dostepu\n $i=0;\n if ($shop->home!=1) {\n $dir_sess=\"$DOCUMENT_ROOT/../sessions/$config->salt/\";\n } else {\n $dir_sess=\"/base/sessions/$config->salt/\";\n }\n if ($handle = opendir($dir_sess)) {\n \n while (false != ($file = readdir($handle))) {\n if (ereg(\"^sess\",$file)) {\n $test=$this->check_file($file);\n if ($test>0) {\n $i++;\n }\n }\n } // end while\n closedir($handle);\n } // end if\n \n return $i;\n }",
"public static function listOnlineUsers() \n\t{\n\t\t$array = array(); \n\n\t\t$rst = \\Main\\DB::select(\"accounts_online\", \"user\");\n\t\twhile($row = $rst->fetch_object())\n\t\t{\n\t\t\t$accId = $row->user; \n\t\t\t$array[$accId] = self::getUserData($accId); \n\t\t}\n\t\t\n\t\treturn $array; \n\t}",
"public function getOnlineList()\n {\n $online = [];\n if ( $this->online )\n {\n $id = 0;\n $pack = pack( 'N*', -1, 1, $id ) . $this->gamed->packString( '1' );\n $pack = $this->gamed->createHeader( 352, $pack );\n $send = $this->gamed->SendToDelivery( $pack );\n $data = $this->gamed->deleteHeader($send);\n $data = $this->gamed->unmarshal( $data, $this->data['RoleList'] );\n\n if ( isset( $data['users'] ) )\n {\n foreach ( $data['users'] as $user )\n {\n $online[] = $user;\n //$id = $this->gamed->MaxOnlineUserID( $data['users'] );\n }\n }\n }\n return $online;\n }",
"public function isOnline()\n {\n return Cache::has('user-is-online-' . $this->id);\n }",
"public function isOnline()\n {\n return Cache::has('user-is-online-' . $this->id);\n }",
"public static function updateWhoIsOnline()\n {\n $users = User::all();\n foreach($users as $u)\n {\n $lastPing = $u->last_ping;\n $twoMinAgo = Carbon::now()->subMinutes(2);\n $result = Carbon::createFromFormat('Y-m-d H:i:s', $lastPing);\n\n if($twoMinAgo->lt($result))\n {\n $u->is_online = 1;\n $u->save();\n }\n else\n {\n $u->is_online = 0;\n $u->save();\n }\n }\n }",
"public function isOnline() {\n\t\tif(check($this->_username)) {\n\t\t\t$result = $this->db->queryFetchSingle(\"SELECT \"._CLMN_CONNSTAT_.\" FROM \"._TBL_MS_.\" WHERE \"._CLMN_USERNM_.\" = ? AND \"._CLMN_CONNSTAT_.\" = ?\", array($this->_username, 1));\n\t\t\tif(!is_array($result)) return;\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\t$accountData = $this->getAccountData();\n\t\tif(is_array($accountData)) {\n\t\t\t$result = $this->db->queryFetchSingle(\"SELECT \"._CLMN_CONNSTAT_.\" FROM \"._TBL_MS_.\" WHERE \"._CLMN_USERNM_.\" = ? AND \"._CLMN_CONNSTAT_.\" = ?\", array($accountData[_CLMN_USERNM_], 1));\n\t\t\tif(!is_array($result)) return;\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\treturn;\n\t}",
"function getUsersOnline() {\n\t//session_start();\n\t$session=session_id();\n\t$time=time();\n\t$time_check=$time-600; //SET TIME 10 Minute\n\t\n\t$tbl_name=\"useronline\"; // Table name\n\t$sql=\"SELECT * FROM $tbl_name WHERE session='$session'\";\n\t$result=mysql_query($sql);\n\t\n\t$count=mysql_num_rows($result);\n\tif($count==\"0\"){\n\t\t$sql1=\"INSERT INTO $tbl_name(session, time) VALUES ('$session', '$time')\";\n\t\t$result1=mysql_query($sql1);\n\t}\n\telse {\n\t\t$sql2=\"UPDATE $tbl_name SET time='$time' WHERE session = '$session'\";\n\t\t$result2=mysql_query($sql2);\n\t}\n\t\n\t$sql3=\"SELECT * FROM $tbl_name\";\n\t$result3=mysql_query($sql3);\n\t$count_user_online=mysql_num_rows($result3);\n\t\n\t//echo \"User online : $count_user_online \";\n\t\n\t// if over 10 minute, delete session \n\t$sql4=\"DELETE FROM $tbl_name WHERE time<$time_check\";\n\t$result4=mysql_query($sql4);\n\t\n\tmysql_free_result($result);\n\t//mysql_free_result($result1);\n\t//mysql_free_result($result2);\n\tmysql_free_result($result3);\n\t//mysql_free_result($result4);\n return $count_user_online;\n}",
"public function getOnlineUserList(){\n $query = \"select * from $this->onlineUser_tableName\";\n $result = $this->dbh->query($query);\n if($result->rowCount() > 0 ){\n return $result->fetchAll();\n }\n return null;\n }",
"public function isOnline() {\n }",
"public function check()\n {\n if(!empty($this->user)) {\n // If you need to check users online list in every page load, check this TRUE in config file\n if($this->config->item('check_users_on_page_load', 'online')) {\n $this->checkOnlineList();\n }\n\n $this->addUser();\n }\n }",
"function getOnlineUserCount()\n\t{\n\t\treturn $this->DB->database_count('users', array('online' => '1'));\n\t}",
"public function isOnline(): bool\n {\n return Cache::has('user-is-online-' . $this->id);\n }",
"private function isOnline()\n {\n return $this->online;\n }",
"public function getOnlineAccountList() {\n\t\t$result = $this->db->queryFetch(\"SELECT * FROM \"._TBL_MS_.\" WHERE \"._CLMN_CONNSTAT_.\" = ?\", array(1));\n\t\tif(!is_array($result)) return;\n\t\treturn $result;\n\t}",
"public function getNumberOfOnlineUser(){\n if(($result = $this->getOnlineUserList())!= null){\n return count($result);\n }\n return 0;\n }",
"public function isOnline(): bool\n {\n return Cache::has('user-is-online-'.$this->id);\n }",
"public function isOnline($uname,$pass){\n\t\t$user = $this->find('first',array('user_name'=>$uname,'password'=>$pass));\n\t\tif(!empty($user)){\n\t\t\treturn $user['User']['online_flag']== 1;\n\t\t}\t\t\n\t}",
"function isOnline()\n {\n if ( !isset( $this->_isOnline ) ) {\n $onlinehandler = &zarilia_gethandler( 'online' );\n $this->_isOnline = ( $onlinehandler->getCount( new Criteria( 'online_uid', $this->getVar( 'uid' ) ) ) > 0 ) ? true : false;\n }\n return $this->_isOnline;\n }",
"public function isOnline(): bool\n {\n return app(UserActivityService::class)->isOnline($this);\n }",
"public function obtenerUsuariosOnline(){\n return $this->obtenerUsuarios(\" uid_usuario IN ( SELECT uid_usuario FROM \". TABLE_USUARIO .\" u WHERE u.uid_usuario = uid_usuario AND conexion = 1 ) \");\n }",
"function addonline($uid,$place,$plclink)\n{\n $hidden=mysql_fetch_array(mysql_query(\"SELECT hidden FROM ibwf_users WHERE id='\".$uid.\"'\"));\n if($hidden[0]==0)\n {\n /////delete inactive users\n $tm = time();\n $timeout = $tm - 420; //time out = 5 minutes\n $deloff = mysql_query(\"DELETE FROM ibwf_online WHERE actvtime <'\".$timeout.\"'\");\n ///now try to add user to online list\n $res = mysql_query(\"UPDATE ibwf_users SET lastact='\".time().\"' WHERE id='\".$uid.\"'\");\n $res = mysql_query(\"INSERT INTO ibwf_online SET userid='\".$uid.\"', actvtime='\".$tm.\"', place='\".$place.\"', placedet='\".$plclink.\"'\");\n if(!$res)\n {\n //most probably userid already in the online list\n //so just update the place and time\n $res = mysql_query(\"UPDATE ibwf_online SET actvtime='\".$tm.\"', place='\".$place.\"', placedet='\".$plclink.\"' WHERE userid='\".$uid.\"'\");\n \n \n }\n }\n $maxmem=mysql_fetch_array(mysql_query(\"SELECT value FROM ibwf_settings WHERE id='2'\"));\n \n $result = mysql_fetch_array(mysql_query(\"SELECT COUNT(*) FROM ibwf_online\"));\n\n if($result[0]>=$maxmem[0])\n {\n $tnow = date(\"D d M Y - H:i\");\n mysql_query(\"UPDATE ibwf_settings set name='\".$tnow.\"', value='\".$result[0].\"' WHERE id='2'\");\n }\n $maxtoday = mysql_fetch_array(mysql_query(\"SELECT ppl FROM ibwf_mpot WHERE ddt='\".date(\"d m y\").\"'\"));\n if($maxtoday[0]==0||$maxtoday==\"\")\n {\n mysql_query(\"INSERT INTO ibwf_mpot SET ddt='\".date(\"d m y\").\"', ppl='1', dtm='\".date(\"H:i:s\").\"'\");\n $maxtoday[0]=1;\n }\n if($result[0]>=$maxtoday[0])\n {\n mysql_query(\"UPDATE ibwf_mpot SET ppl='\".$result[0].\"', dtm='\".date(\"H:i:s\").\"' WHERE ddt='\".date(\"d m y\").\"'\");\n }\n}",
"public function isOnline(): bool\n {\n return $this->pluck('presences.0.onlineStatus') === 'online';\n }",
"public function isOnline(): bool\n {\n return $this->pluck('presences.0.onlineStatus') === 'online';\n }"
]
| [
"0.7345724",
"0.7073978",
"0.70617306",
"0.68892986",
"0.6867892",
"0.6864916",
"0.6840707",
"0.6835407",
"0.67512155",
"0.6697396",
"0.6697396",
"0.6685548",
"0.66441566",
"0.6642902",
"0.66096693",
"0.6605822",
"0.6593062",
"0.65782773",
"0.65550184",
"0.65521514",
"0.65440756",
"0.6534214",
"0.65188164",
"0.64561266",
"0.6446673",
"0.644129",
"0.64333695",
"0.6428233",
"0.64148635",
"0.64148635"
]
| 0.88326967 | 0 |
addUser Add user to online list | private function addUser()
{
$this->online->addUser($this->user, $this->place, $this->loginTime);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function addUser(){}",
"public static function addUser()\n {\n // ADD NEW DATA TO A TABLE\n // MAKE SURE TO SEND USERS TO THE /users page when a user is added\n }",
"public function addUser(){\n\t}",
"public function addUser($user){\n\t\t\tif(!in_array($user, $this->lobby)){\n\t\t\t\tarray_push($this->lobby, $user);\n\t\t\t}\n\t\t}",
"function add_user(MJKMH_User $user): void {\r\n\t\t$this->users[$user->id()] = $user;\r\n\t}",
"public function on_user_add(&$user) {\r\n\t\t$this->socket_array[(int)$user->socket] = $user;\r\n\t}",
"function addUser($data){\n\t$username = secure($data['username']);\n\t$password = secure($data['password']);\n\t$level = secure($data['level']);\n\t$users = getJSON(USERS);\n\t$id = getId($users);\n\t$callback = \"LOGIN_CHECKCHAR_FAILED\";\n\tif(!checkChar($username)){\n\t\n\t\t$salt = \"bb764938100a6ee139c04a52613bd7c1\";\n\t\t//password encryption\t\t\n\t\t$password= md5($password.$salt);\n\t\t$newUser= array(\n\t\t\t\"id\" => $id,\n\t\t\t\"username\" => $username,\n\t\t\t\"password\" => $password,\n\t\t\t\"level\" => $level\n\t\t);\n\t\tarray_push($users,$newUser);\n\t\texport($users, USERS);\n\t\t$callback=\"\";\n\t}\n\treturn $callback; \n}",
"public function addMultipleUsers() {\n $this->addUser();\n\n while ( true ) {\n echo \"\\033[32m\".\"Želite li unjeti novog zaposlenika? da/ne \".\"\\033[0m\";\n if ( readline() !== 'da' ) {\n break;\n } else {\n $this->addUser();\n\n }\n\n }\n }",
"function addnewuser() {\n \t\t\t$this->set('GetUserQ', $this->Users->GetUsers(0));\n \t\t\t$this->set('GetLevelsQ', $this->AccessLevels->index());\n \t\t}",
"public function add()\n\t{\n\t\tif (! $this->is_admin) {\n\t\t\t$this->redirect('admin/error/deny');\n\t\t}\n\n\t\t$authModel = M('auth');\n\t\t$userModel = M('user');\n\n\t\t$authArr = $authModel->field('user_id')->where(array('level' => 1))->select();\n\t\t$leaderUids = makeImplode($authArr, 'user_id');\n\n\t\t$userArr = $userModel\n\t\t\t->field('id, truename')\n\t\t\t->where(array('id' => array('IN', \"$leaderUids\")))\n\t\t\t->select();\n\n\t\t$leaderIdsList = makeIndex($userArr, 'id');\n\n\t\t$this->assign('leader_list', $userArr);\n\t\t$this->display();\n\t}",
"protected function addUsers(){\n\t\t\n\t\t$users = $this->getOption('users');\n\t\tif (!$users) $this->setError('noUsers');\n\t\tforeach ($users as $userid)\n\t\t\tif (!is_numeric($userid) || !$this->doesUserExists($userid,$this->isDebug())) throw new ForumMException('user id ('.$userid.') is invalid');\t\t\n\t\t\n\t\tif ($this->isError()) return;\n\t\t\n\t\t$name = $this->getName();\n\t\tif (!$name){\n\t\t\t$this->retrieveForumInfo($this->getId(),$this->isDebug());\n\t\t\t$name = $this->getName();\n\t\t} \n\t\t\n\t\t$this->retrieveForumPermissions($name,$this->isDebug());\n\t\t\n\t\t$this->setUsers($users,$this->isDebug());\t\t\n\t}",
"public function add() {\n\t\t$user = $this->User->read(null, $this->Auth->user('id'));\n\t\tif ($this->request->is('post')) {\n\t\t\t$this->User->create();\n\t\t\t$this->request->data['User']['password'] = AuthComponent::password($this->request->data['User']['password']);\n\t\t\tif ($this->User->save($this->request->data)) {\n\t\t\t\t$this->Session->setFlash(__('The user has been saved'));\n\t\t\t\t$this->redirect(array('action' => 'index'));\n\t\t\t} else {\n\t\t\t\t$this->Session->setFlash(__('The user could not be saved. Please, try again.'));\n\t\t\t}\n\t\t} else {\n\t\t\t$mintURL = $this->Configuration->findByName('Mint URL');\r\n\t\t\t$queryURL = $mintURL['Configuration']['value'];\r\n\t\t\t$lookupSupported = isset($queryURL) && \"\" <> $queryURL;\r\n\t\t\t$this->set('lookupSupported', $lookupSupported);\n\t\t\t$this->set('userType', $user['User']['type']);\n\t\t}\n\t}",
"function user_add($data, $data1) {\n $id = $data['uid'];\n $name = $data['first_name'].' '.$data['last_name'];\n $email = $data['email'];\n $phone = $data['mobile_phone'].' '.$data['home_phone'];\n\n //add id and name of user to sesstion\n $this->add_session($id, $name);\n\n if (!$this->user_is($id)) {\n $query =\"INSERT INTO users VALUES('$id', '$name', '$email', '$phone');\";\n $result = $this->conn->query($query);\n if (!$result) die (\"Database access failed: \" . $this->conn->error);\n //add friends of current user\n for ($j = 0 ; $j < count($data1) ; ++$j) {\n $this->addFriend($data1[$j], $id);\n }\n }\n }",
"public function addUser(User $user)\n\t{\n\t\t$this->_users[$user->getNick()] = $user;\n\t\t$this->_usersCount++;\n\t}",
"public function addUser($name, UserConfig $user);",
"function addUser($userid) {\n $users = $this->getUsers();\n if (!is_array($users)) {\n $users = array();\n }\n array_push($users, $userid);\n $this->setUsers($users);\n }",
"public function addUser(\\Models\\User $user) {\n $this->users[] = $user;\n }",
"private function addUser($conn){\t\n\t\t\t$postdata = file_get_contents(\"php://input\");\n\t\t\t$request = json_decode($postdata);\n\t\t\t@$user_email = $request->email;\n\t\t\t@$user_name = $request->username;\n\t\t\t\n\t\t\t$query = 'INSERT INTO `users`(`user_name`, `user_email`, `user_status`) VALUES (\"'.$user_name.'\", \"'.$user_email.'\",0)';\n\t\t\t$sql = $conn->query($query); \n\t\t\n\t\t\t$query2 = \"SELECT MAX(user_id) as user_id FROM users\";\n\t\t\t$sql2 = $conn->query($query2);\n\t\t\tif($sql2->num_rows > 0){\n\t\t\t\t$result = $sql2->fetch_assoc();\n\t\t\t\t$query3 = 'INSERT INTO `playlist`(`user_id`, `playlist_status`) VALUES ('.$result['user_id'].', 0)';\n\t\t\t\t$sql3 = $conn->query($query3);\n\t\t\t\t\n\t\t\t\t$query4 = 'SELECT playlist_id FROM playlist where user_id = '.$result['user_id'];\n\t\t\t\t$sql4 = $conn->query($query4);\n\t\t\t\tif($sql4->num_rows > 0){\n\t\t\t\t\t$this->response('',200);\n\t\t\t\t}\n\t\t\t}\n\t\t\t$this->response('',204);\n\t\t}",
"function add_user ($User_name, $User_password, $User_email, $user_type)\n\t{\n\t\tglobal $conn;\n\n $sql_i = \"INSERT INTO login_db(user_name, user_password, user_email, user_type) VALUES \" .\n \"('$User_name', '$User_password', '$User_email', '$user_type')\";\n\n run_update($sql_i);\n\t}",
"function add_newuser($user) {\n global $DB;\n $DB->insert_record('report_user_statistics', $user, false);\n}",
"public function addusers() {\r\n \tif (isset($_SESSION['userid'])) {\n \t\t$notusers=$this->model->getnotusersprojects($_GET['p']);\n \t\t$this->view->set('users',$notusers);\n \t\t$project=$this->model->getproject($_GET['p']);\n $this->view->set('project',$project[0]);\n \t\t$this->view->addusers();\r\n \t} else {\r\n \t\t$this->redirect('?v=index&a=show');\r\n \t}\r\n }",
"public function addUser($data) {\n\t\tglobal $db;\n\t\t$db->type = 'site';\n\t\t\n\t\tforeach ($data as $key=>$val) {\n\t\t\tif ($key != 'password') {\n\t\t\t\t$values[$key] = $db->sqlify($val);\n\t\t\t} else {\n\t\t\t\t$values[$key] = $db->sqlify(crypt($val)); \n\t\t\t}\n\t\t}\n\t\t$values['date_created'] = $db->sqlify(date('Y-m-d H:i:s')); \n\t\t\n\t\t$check = false;\n\t\tif (!empty($data['email'])) {\n\t\t\t$check = $this->getUserByEmail($data['email']);\n\t\t} elseif (!empty($data['twitter_id'])) {\n\t\t\t$check = $this->getUserByTwitterId($data['twitter_id']);\n\t\t}\n\t\t\n\t\tif (!$check) {\n\t\t\t$db->insert('users', $values);\n\t\t\t$db->doCommit();\n\t\t}\n\t}",
"private function add_user_to_existing_game()\n {\n\n $number_of_existing_players = intval($this->gameUserCanPlay[\"number_of_players\"]) + 1;\n $this->number_of_players_in_current_user_game = $number_of_existing_players;\n $this->update_multiple_fields($this->games_table_name, [\"number_of_players\" => $number_of_existing_players], \"game_id ='{$this->gameIDUserCanPlay}'\");\n $this->update_multiple_fields($this->users_table_name, [\"game_id_about_to_play\" => $this->gameIDUserCanPlay], \"user_id='{$this->userID}'\");\n $this->game_10_words = $this->fetch_data_from_table($this->games_table_name , 'game_id' , $this->gameIDUserCanPlay)[0][\"words\"];\n $this->game_10_words = json_decode($this->game_10_words);\n\n /* if players are complete game should start */\n if ($number_of_existing_players == $this->config->MaximumNumberOfPlayers) {\n /* tell javascript that the game has started */\n $this->update_record($this->games_table_name, 'started', '1', 'game_id', $this->gameIDUserCanPlay);\n /* update current_game_id for all users in game */\n $this->update_record($this->users_table_name , 'current_game_id' , $this->gameIDUserCanPlay , 'game_id_about_to_play' , $this->gameIDUserCanPlay );\n /* Subtract the amount for all players */\n //$this->update_multiple_fields($this->users_table_name , ['account_balance' => \" account_balance - {$this->amount}\"] , \"game_id_about_to_play = '{$this->gameIDUserCanPlay}'\");\n /* Make sure all users point is set to 0 immediately game starts and ends*/\n // $this->executeSQL(\"UPDATE {$this->users_table_name} SET account_balance = cast(account_balance as int) - {$this->amount} WHERE game_id_about_to_play = '{$this->gameIDUserCanPlay}'\");\n $this->update_record($this->users_table_name , 'current_point' , 0 , 'game_id_about_to_play' , $this->gameIDUserCanPlay);\n $this->start_time = time() * 1000;\n $this->update_record($this->games_table_name , 'start_time' , $this->start_time , 'game_id' , $this->gameIDUserCanPlay);\n\n $this->showGameChat = true;\n\n }\n\n return true;\n }",
"function admin_add() {\n\n\t\tif (!empty($this->data)) {\n\n\t\t\t$this->User->create();\n\n\t\t\t/**\n\t\t\t * Save new user.\n\t\t\t */\n\t\t\tif ($this->User->save($this->data)) {\n\n\t\t\t\t/**\n\t\t\t\t * If the new user is saved, a success message is displayed.\n\t\t\t\t * Redirect to the index page.\n\t\t\t\t */\n\t\t\t\t$this->Session->setFlash(__d('core', 'The user has been saved.', true));\n\t\t\t\t$this->redirect(array('action' => 'index'));\n\n\t\t\t} else {\n\t\t\t\t/**\n\t\t\t\t * If the user is not saved, an error message is displayed.\n\t\t\t\t */\n\t\t\t\t$this->Session->setFlash(__d('core', 'The user has not been saved.', true), 'default', array('class' => 'error'));\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Select all profiles (Administrator or Member).\n\t\t * @var array\n\t\t */\n\t\t$profiles = $this->User->Profile->find('list');\n\n\t\t/**\n\t\t * Select all offers enabled.\n\t\t * @var array\n\t\t */\n\t\t$offers = $this->User->Offer->find('list');\n\n\t\t/**\n\t\t * Put all profiles in \"profiles\" and offers in \"offers\".\n\t\t * $profiles and $offers will be available in the view.\n\t\t */\n\t\t$this->set(compact('profiles', 'offers'));\n\n\t}",
"public function admin_add()\n {\n if ($this->request->is('post')) {\n $this->User->create();\n\n $this->request->data['Impi']['auth_scheme'] = 127;\n\n if ($this->User->saveAll($this->request->data)) {\n $this->Session->setFlash(__('The user has been saved'));\n $this->redirect(array('action' => 'index'));\n } else {\n $this->Session->setFlash(__('The user could not be saved. Please, try again.'));\n }\n }\n $utilityFunctions = $this->User->UtilityFunction->find('list');\n\n $this->set(compact('utilityFunctions', 'utilityFunctionsParameters'));\n }",
"public function addUser()\n {\n\n foreach ($this->employeeStorage->getEmployeeScheme() as $key => $singleUser) {\n\n $userInput = readline(\"$singleUser : \");\n $validate = $this->validateInput($userInput, $key); // Each input is sent for validation using validateInput method\n\n while (!$validate) // loop that forces user to enter valid input\n {\n $userInput = readline(\"Unesite ispravan format : \");\n $validate = $this->validateInput($userInput, $key);\n\n }\n if ($key === 'income'){\n $userInput = number_format((float)$userInput, 2, '.', ''); // formats income input so it always has 2 decimal points\n }\n\n $data[$key] = $userInput;\n\n }\n\n $this->employeeStorage->setEmployee( $data ); // After every input is validated data is stored using setEmployee method\n\n echo \"\\033[32m\". \"## Novi zaposlenik \". $data['name'].\" \". $data['lastname'].\" je dodan! \\n\\n\".\"\\033[0m\";\n\n\n }",
"public function addUser($userdata) { // $email, $nick, $new_passwd\n\t\t$username = LDAP_ADMIN_USER;\n\t\t$password = LDAP_ADMIN_PASS;\n\n\t\t$ldap_handle = $this->connect();\n\n\t\tldap_bind($ldap_handle, 'cn='.$username.',dc=chalmers,dc=it', $password);\n\n\t\t$base_dn = \"ou=people,\" . $this->dn;\n\n\t\t$sr = ldap_search($ldap_handle, $base_dn, \"uidnumber=*\", array(\"uidnumber\"));\n\n\t\t$users = ldap_get_entries($ldap_handle, $sr);\n\n\t\t# FIXME: RACE CONDITIONS!\n\t\t$max = 0;\n\t\tforeach($users as $user) {\n\t\t\tif ($user[\"uidnumber\"][0] > $max)\n\t\t\t\t$max = $user[\"uidnumber\"][0];\n\t\t}\n\n\t\t$ldap_data = $this->userArray($userdata, $max+1);\n\t\t$dn = \"uid=$this->user,$base_dn\";\n\n\t\tldap_add($ldap_handle, $dn, $ldap_data);\n\n\t\t$error = ldap_error($ldap_handle);\n\t\tldap_unbind($ldap_handle);\n\t\treturn $error === 0;\n\t}",
"function __addUser()\n {\n\n //profiling\n $this->data['controller_profiling'][] = __function__;\n\n //flow control\n $next = true;\n\n if (!isset($_POST['submit'])) {\n //redirect to 'view' url instead\n $this_url = uri_string();\n $redirect = str_replace('add-user', 'view', $this_url);\n redirect($redirect);\n }\n\n //validate form & display any errors\n $validation = $this->__flmFormValidation('add_user');\n if (!$validation) {\n //show error\n $this->notices('error', $this->form_processor->error_message, 'html');\n //halt\n $next = false;\n }\n\n //add to database\n if ($next) {\n $new_users_id = $this->users_model->addUser($this->client_id);\n $this->data['debug'][] = $this->users_model->debug_data;\n\n //was adding successful\n if (!$new_users_id) {\n //show error\n $this->notices('error', $this->data['lang']['lang_request_could_not_be_completed'], 'html');\n //halt\n $next = false;\n }\n }\n\n //update primary contact if selected\n if ($next) {\n if ($this->input->post('client_users_main_contact') == 'on') {\n $this->users_model->updatePrimaryContact($this->client_id, $new_users_id);\n $this->data['debug'][] = $this->users_model->debug_data;\n }\n }\n\n //all is ok\n if ($next) {\n //success\n $this->notices('success', $this->data['lang']['lang_request_has_been_completed'], 'noty');\n\n /*EMAIL - send user an email*/\n $this->__emailer('new_user');\n\n /*EMAIL - send admin notifications*/\n $this->__emailer('admin_notification_new_user');\n\n } else {\n $this->notices('error', $this->data['lang']['lang_request_could_not_be_completed'], 'html');\n }\n\n //load user page\n $this->__clientUsers();\n }",
"public function add(array $user);",
"public function _friendadd() {\n\t\t$this->history = false;\n\n\t\t// for authenticated only\n\t\tif ($this->user && csrf::valid()) {\n\n\t\t\t// require valid user\n\t\t\t$this->member = new User_Model($username);\n\t\t\tif ($this->member->id) {\n\t\t\t\t$this->user->add_friend($this->member);\n\n\t\t\t\t// News feed event\n\t\t\t\tnewsfeeditem_user::friend($this->user, $this->member);\n\n\t\t\t}\n\t\t}\n\n\t\turl::back('members');\n\t}"
]
| [
"0.7489906",
"0.7341624",
"0.7284498",
"0.721324",
"0.71765566",
"0.6925692",
"0.6894491",
"0.68279076",
"0.6794994",
"0.675266",
"0.6662102",
"0.66595215",
"0.6651458",
"0.6646068",
"0.6542056",
"0.65294284",
"0.6526403",
"0.6525425",
"0.6522657",
"0.6520463",
"0.65165466",
"0.6515511",
"0.6502704",
"0.64811325",
"0.6476621",
"0.64743733",
"0.6444887",
"0.64432025",
"0.64271873",
"0.642669"
]
| 0.8508977 | 0 |
Build the classifications select list | function buildClassificationList($classifications){
$classificationList = '<select name="classificationId" id="classificationList">';
$classificationList .= "<option>Choose a Classification</option>";
foreach ($classifications as $classification) {
$classificationList .= "<option value='$classification[classificationId]'>$classification[classificationName]</option>";
}
$classificationList .= '</select>';
return $classificationList;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function buildClassificationList($classifications)\n{\n $classificationList = '<select name=\"classificationId\" id=\"classificationList\">';\n $classificationList .= \"<option>Choose a Classification</option>\";\n foreach ($classifications as $classification) {\n $classificationList .= \"<option value='$classification[classificationId]'>$classification[classificationName]</option>\";\n }\n $classificationList .= '</select>';\n return $classificationList;\n}",
"protected function generateProfList() {\n $classData = getClassData(Main::getSemester(), Main::isTraditional());\n\t\t\tMain::$CAMPUS_MASK = array_pop($classData);\n\t\t\t$this->setCampusMask();\n\t\t\t//generate select option values for display later\n $data = array_filter($classData, create_function('Course $class', 'return $class->getCampus() & \"'.$this->campusMask.'\";'));\n foreach($data as $class) {\n $list = $class->getProfClassList();\n foreach($list as $prof=>$class2) {\n $this->profClassList[$prof][] = $class2;\n }\n }\n ksort($this->profClassList);\n }",
"protected function buildOptionsList() {\n }",
"public function showClassNames() {\n\t\ttry {\n\t\t\t$resultShow = new ResultShow();\n\t\t\t/*all constant are declared here **/\n\n\t\t\t$categories = $resultShow->showCategories();\n\t\t\tforeach ($categories as $category) {\n\t\t\t\tif ($category->{'categoryId'} < CLASS_START_ID) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif ($category->{'categoryId'} > CLASS_END_ID) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tprintf(\" <option value =\" . $category->{'categoryId'} . \">\" . $category->{'categoryName'} . \"</option>\");\n\t\t\t}\n\n\t\t} catch (\\Exception $ex) {\n\t\t\tprint_r($ex->getMessage());\n\n\t\t}\n\t}",
"function buildClassificationDropdown($navArray, $optionalMessage = 'None', $currentValue = NULL)\n{\n $classificationList = \"\";\n $classificationList .= \"<select id='classificationId' name='classificationId'>\";\n $selected = \" selected \";\n $notSelected = \"\";\n if ($optionalMessage !== 'None')\n $classificationList .= \"<option value=''>$optionalMessage</option>\";\n if ($currentValue != NULL) {\n foreach ($navArray as $classification) {\n $classificationList .= \"<option value='$classification[classificationId]'\";\n $classificationList .= $currentValue == $classification['classificationId'] ? $selected : $notSelected;\n $classificationList .= \">$classification[classificationName]</option>\";\n }\n } else {\n foreach ($navArray as $classification) {\n $classificationList .= \"<option value='$classification[classificationId]'>$classification[classificationName]</option>\";\n }\n }\n $classificationList .= \"</select>\";\n return $classificationList;\n}",
"public function classification()\n {\n\t\t$output = '<option selected=\"true\" disabled=\"disabled\">Select Classification</option>';\n\t\tif($this->request->id!=''){\n\t\t\t$classification = DB::table('embaseindex_classifications')->where('section_id', $this->request->id)->get();\n\t\t\tforeach($classification as $classval){\n\t\t\t\t$output .=\t'<option value=\"'.$classval->id.'\">'.$classval->classvalue.'</option>';\n\t\t\t}\n\t\t}\n\t\t\n /*$indexing = $this->indexing->findOrFail($id);\n $comments = new CommentsResource($indexing->comments()->orderBy('id', 'desc')->paginate(50));\n return response($comments, Response::HTTP_OK);*/\n\t\treturn response($output, Response::HTTP_OK);\n }",
"protected function createUserAndGroupListForSelectOptions() {}",
"public function build_products_type_selector($_class, $_active = \"\") {\r\n \t$ptypes = wcff()->dao->load_product_types();\r\n \t$html = '<select class=\"' . esc_attr($_class) . ' select\">';\r\n \t$html .= '<option value=\"-1\">'. __(\"All Types\", \"wc-fields-factory\") .'</option>';\r\n \tif (count($ptypes) > 0) {\r\n \t\tforeach ($ptypes as $ptype) {\r\n \t\t\t$selected = ($ptype[\"id\"] == $_active) ? 'selected=\"selected\"' : '';\r\n \t\t\t$html .= '<option value=\"' . esc_attr($ptype[\"id\"]) . '\" ' . $selected . '>' . esc_html($ptype[\"title\"]) . '</option>';\r\n \t\t}\r\n \t}\r\n \t$html .= '</select>';\r\n \treturn $html;\r\n }",
"function build_selection_dropdown() {\n\t$output = array();\n\t$output[] = array('id' => '', 'text' => TEXT_SELECT);\n\t$output[] = array('id' => 'wo_journal_main.id', 'text' => 'Record ID');\n\t$output[] = array('id' => 'wo_journal_main.wo_id', 'text' => 'Work Order Num');\n\t$output[] = array('id' => 'wo_journal_main.wo_title', 'text' => 'Work Order Title');\n\t$output[] = array('id' => 'wo_journal_main.priority', 'text' => 'Priority');\n\t$output[] = array('id' => 'wo_journal_main.sku', 'text' => 'SKU');\n\t$output[] = array('id' => 'wo_journal_main.qty', 'text' => 'Quantity');\n\t$output[] = array('id' => 'wo_journal_main.post_date', 'text' => 'Post Date');\n\t$output[] = array('id' => 'wo_journal_main.closed', 'text' => 'Closed');\n\t$output[] = array('id' => 'wo_journal_main.closed_date', 'text' => 'Closed Date');\n\t$output[] = array('id' => 'wo_journal_main.notes', 'text' => 'Notes');\n\t$output[] = array('id' => 'wo_journal_main.bom_list', 'text' => 'BOM List');\n\t$output[] = array('id' => 'wo_journal_main.ref_specs', 'text' => 'Reference Specs');\n\t$output[] = array('id' => 'wo_journal_main.ref_docs', 'text' => 'Reference Docs');\n\t$output[] = array('id' => 'bar_code', 'text' => 'SKU Bar Code');\n\t$output[] = array('id' => 'image_with_path', 'text' => 'SKU Image');\n\treturn $output;\n }",
"public function buildSelect()\n {\n $this->query->select(\"DISTINCT(p.id),p.*,\n u.first_name as owner_first_name,u.last_name as owner_last_name,\n c.id as company_id,c.name as company_name,IF(p.id=d2.primary_contact_id, 1, 0) AS is_primary_contact\");\n\n $this->query->from(\"#__people AS p\");\n $this->query->leftJoin(\"#__people_cf as cf ON cf.person_id = p.id\");\n $this->query->leftJoin(\"#__users AS u ON u.id = p.owner_id\");\n $this->query->leftJoin(\"#__companies AS c ON c.id = p.company_id\");\n $this->query->leftJoin(\"#__deals AS d ON d.id = cf.association_id AND cf.association_type = 'deal'\");\n $this->query->leftJoin(\"#__deals AS d2 ON d2.primary_contact_id = p.id\");\n\n }",
"public function build_products_selector($_class, $_active = \"\") {\r\n \t$products = wcff()->dao->load_all_products();\r\n \t$html = '<select class=\"' . esc_attr($_class) . ' select\">';\r\n \t$html .= '<option value=\"-1\">'. __( \"All Products\", \"wc-fields-factory\" ) .'</option>';\r\n \tif (count($products) > 0) {\r\n \t\tforeach ($products as $product) {\r\n \t\t\t$selected = ($product[\"id\"] == $_active) ? 'selected=\"selected\"' : '';\r\n \t\t\t$html .= '<option value=\"' . esc_attr($product[\"id\"]) . '\" ' . $selected . '>' . esc_html($product[\"title\"]) . '</option>';\r\n \t\t}\r\n \t}\r\n \t$html .= '</select>';\r\n \treturn $html;\r\n }",
"public function build_products_category_selector($_class, $_active = \"\") {\r\n \t$pcats = wcff()->dao->load_product_categories();\r\n \t$html = '<select class=\"' . esc_attr($_class) . ' select\">';\r\n \t$html .= '<option value=\"-1\">'. __(\"All Categories\", \"wc-fields-factory\") .'</option>';\r\n \tif (count($pcats) > 0) {\r\n \t\tforeach ($pcats as $pcat) {\r\n \t\t\t$selected = ($pcat[\"id\"] == $_active) ? 'selected=\"selected\"' : '';\r\n \t\t\t$html .= '<option value=\"' . esc_attr($pcat[\"id\"]) . '\" ' . $selected . '>' . esc_html($pcat[\"title\"]) . '</option>';\r\n \t\t}\r\n \t}\r\n \t$html .= '</select>';\r\n \treturn $html;\r\n }",
"function get_classes($class_id)\n\t\t{\n\t\t\t$get_student_list = $this->db->get_where('student' , array('class_id' => $class_id))->result_array();\n\t\t\techo '<option value=\"\">Select student</option>';\n\t\t\tforeach ($get_student_list as $row_value){\n\t\t\t\techo '<option value=\"'.$row_value['student_id'].'\">'.$row_value['name'].'</option>';\n\t\t\t}\n\t\t}",
"public function build_forms()\n {\n // Get list of categories to populate the category selector\n $em = EntityManagerSingleton::getInstance();\n\n $category_options = [];\n $category_listings = $em->getRepository('Library\\Model\\Category\\Category')->findAllWithHierarchy();\n\n // Get list of categories that are theme categories so that they are are not included\n $criteria = new Criteria();\n $criteria->where($criteria->expr()->eq('id', Category::THEME_CATEGORY_ID))->orWhere($criteria->expr()->eq('parent_category', $em->getReference('Library\\Model\\Category\\Category', Category::THEME_CATEGORY_ID)));\n $theme_categories = $em->getRepository('Library\\Model\\Category\\Category')->matching($criteria);\n $all_theme_category_ids = [];\n if ($theme_categories->count() > 0)\n {\n /** @var Category $theme_category */\n foreach ($theme_categories as $theme_category)\n $all_theme_category_ids[] = $theme_category->getId();\n }\n\n if (!empty($category_listings))\n {\n foreach($category_listings as $listing)\n {\n // Don't include theme categories in the list\n if (in_array($listing['id'], $all_theme_category_ids))\n continue;\n\n // Construct listing name\n $listing_name = \"\";\n if (count($listing['ancestors']) > 0)\n {\n foreach ($listing['ancestors'] as $ancestor)\n {\n $listing_name .= $ancestor['name'] . \" >> \";\n }\n }\n\n $listing_name .= $listing['name'];\n $category_options[$listing['id']] = $listing_name;\n }\n }\n\n // Get list of statuses to list for products\n $this->status_options = [];\n $status_listings = $em->getRepository('Library\\Model\\Product\\Status')->findAll();\n $this->status_options[0] = \"None\";\n\n if (count($status_listings) > 0)\n {\n foreach ($status_listings as $staus_listing)\n {\n $this->status_options[$staus_listing->getId()] = $staus_listing->getName();\n }\n }\n\n // Get list of options for skus form\n $option_list = [];\n $options = $em->getRepository('Library\\Model\\Product\\Option')->findAll();\n if (!empty($options))\n {\n foreach ($options as $option)\n {\n $option_list[$option->getId()] = $option->getName();\n }\n }\n\n // Add content to forms\n $this->create_update_form->get('category')->setAttribute('options', $category_options);\n $this->create_update_form->get('status_override')->setAttribute('options', $this->status_options);\n $this->create_update_form->get('status')->setAttribute('options', $this->status_options);\n $this->add_skus_form->get('options')->setAttribute('options', $option_list);\n }",
"function osa_webform_options_class_list($component, $flat, $arguments) {\r\n // Only include classes whos type is equal to the name (form_key) of the dropdown\r\n $cid = $_GET['cid'];\r\n $nodes = &_osa_get_class_nodes($cid, $component['form_key']);\r\n \r\n civicrm_initialize();\r\n $options = array();\r\n foreach ($nodes as $class) {\r\n $event_id = $class->field_event_master['und'][0]['civicrm_reference_id'];\r\n $results = civicrm_api('event', 'get', array('id' => $event_id, 'version' => 3));\r\n $event = $results['values'][$event_id];\r\n $options[$event_id] = $event['title'];\r\n }\r\n\r\n asort($options);\r\n return $options;\r\n}",
"function vcn_get_career_names_select_list () {\r\n\t$data = vcn_rest_wrapper('vcnoccupationsvc', 'vcncareer', 'listcareers', array('industry' => vcn_get_industry()), 'json');\r\n\t$select_list_array = array('' => 'Select a Career');\r\n\r\n\tif (count($data) > 0) {\r\n\t\tforeach ($data as $value) {\r\n\t\t\t$select_list_array[$value->onetcode] = $value->title;\r\n\t\t}\r\n\t}\r\n\treturn $select_list_array;\r\n}",
"public function build_metabox_priority_selector($_class, $_active = \"\") {\r\n \t$mpriorities = wcff()->dao->load_metabox_priorities();\r\n \t$html = '<select class=\"' . esc_attr($_class) . ' select\">';\r\n \tif (count($mpriorities) > 0) {\r\n \t\tforeach ($mpriorities as $mpkey => $mpvalue) {\r\n \t\t\t$selected = ($mpkey == $_active) ? 'selected=\"selected\"' : '';\r\n \t\t\t$html .= '<option value=\"' . esc_attr($mpkey) . '\" ' . $selected . '>' . esc_html($mpvalue) . '</option>';\r\n \t\t}\r\n \t}\r\n \t$html .= '</select>';\r\n \treturn $html;\r\n }",
"public function renderCategoriesSelectHTML()\n {\n static $categories;\n\n if (! is_array($categories)) {\n $categories = Category::all();\n }\n\n $list_items = [];\n\n foreach ($categories as $category) {\n // always start only from the top parent categories in the tree\n if (0 === $category->category_parent_id) {\n $list_items[] = $this->renderCategorySelectHTML($category);\n }\n }\n\n $list_items = implode('', $list_items);\n\n if ('' === trim($list_items)) {\n return '';\n }\n\n return '<select id=\"select21\" class=\"form-control\" name=\"parent_category\">' . $list_items . '</select>';\n }",
"public static function selectOptions()\n {\n $options = (new static())->withQuery(function ($model){\n return $model->where('channel', self::$channel);\n })->buildSelectOptions();\n\n return collect($options)->prepend('请选择分类', 0)->all();\n }",
"function build_category_html($selected)\n\t{\n\t\tglobal $template, $db;\n\n\t $html = '<select name=\"category_id\" class=\"forminput\">';\n\t\n\t $sql = \"SELECT * FROM \" . GARAGE_CATEGORIES_TABLE . \" ORDER BY title ASC\";\n\t\n\t \tif ( !($result = $db->sql_query($sql)) )\n\t \t{\n\t \tmessage_die(GENERAL_ERROR, 'Could not category of mods for vehicle', '', __LINE__, __FILE__, $sql);\n\t \t}\n\t\n\t while ( $row = $db->sql_fetchrow($result) ) \n\t\t{\n\t\t\t$select = ( $selected == $row['id'] ) ? ' selected=\"selected\"' : '';\n\t\t\t$html .= '<option value=\"' . $row['id'] . '\"' . $select . '>' . $row['title'] . '</option>';\n\t }\n\t\n\t $html .= '</select>';\n\t\n\t\t$template->assign_vars(array(\n\t\t\t'CATEGORY_LIST' => $html)\n\t\t);\n\t\n\t\treturn ;\n\t}",
"function mfcs_get_reviewer_classification_list_options($option = NULL, $hidden = FALSE, $disabled = FALSE) {\n if (!is_bool($hidden)) {\n $hidden = FALSE;\n }\n\n $options = array();\n $options_all = array();\n\n if ($hidden) {\n $options_all[MFCS_REVIEWER_CLASSIFICATION_NONE] = 'None';\n }\n\n $options_all[MFCS_REVIEWER_CLASSIFICATION_SYSTEM_ADMINISTRATOR] = 'System Administrator';\n $options_all[MFCS_REVIEWER_CLASSIFICATION_MANAGER] = 'Manager';\n $options_all[MFCS_REVIEWER_CLASSIFICATION_REQUESTER] = 'Requester';\n $options_all[MFCS_REVIEWER_CLASSIFICATION_SYSTEM] = 'System';\n $options_all[MFCS_REVIEWER_CLASSIFICATION_VENUE_COORDINATOR] = 'Venue Coordinator';\n $options_all[MFCS_REVIEWER_CLASSIFICATION_VENUE_COORDINATOR_PROXY] = 'Venue Coordinator Proxy';\n $options_all[MFCS_REVIEWER_CLASSIFICATION_ADMINISTRATIVE_ACCOUNTING] = 'Administrative Accounting';\n $options_all[MFCS_REVIEWER_CLASSIFICATION_CUSTODIAL] = 'Custodial';\n $options_all[MFCS_REVIEWER_CLASSIFICATION_UNIVERSITY_EVENTS] = 'University Events';\n $options_all[MFCS_REVIEWER_CLASSIFICATION_FACILITIES_CUSTODIAL] = 'Facilities / Custodial Services';\n $options_all[MFCS_REVIEWER_CLASSIFICATION_FACILITIES] = 'Facilities';\n $options_all[MFCS_REVIEWER_CLASSIFICATION_FACULTY_ADVISER] = 'Faculty Adviser';\n $options_all[MFCS_REVIEWER_CLASSIFICATION_FOOD_SERVICES] = 'Food Services';\n $options_all[MFCS_REVIEWER_CLASSIFICATION_HOUSING] = 'Housing';\n $options_all[MFCS_REVIEWER_CLASSIFICATION_MAINTENANCE] = 'Maintenance';\n $options_all[MFCS_REVIEWER_CLASSIFICATION_PURCHASING] = 'Purchasing / Insurance';\n $options_all[MFCS_REVIEWER_CLASSIFICATION_SECURITY] = 'Security / University Police';\n $options_all[MFCS_REVIEWER_CLASSIFICATION_STUDENT_ACTIVITIES_ADMINISTRATION] = 'Student Activities Administration';\n $options_all[MFCS_REVIEWER_CLASSIFICATION_UNIVERSITY_SERVICES] = 'University Services';\n $options_all[MFCS_REVIEWER_CLASSIFICATION_GROUNDS] = 'Grounds';\n $options_all[MFCS_REVIEWER_CLASSIFICATION_FINANCIAL] = 'Financial';\n $options_all[MFCS_REVIEWER_CLASSIFICATION_INSURANCE] = 'Insurance';\n\n\n\n if ($option == 'select') {\n $options[''] = '- Select -';\n }\n\n foreach ($options_all as $option_id => $option_name) {\n $options[$option_id] = $option_name;\n }\n\n if (!$hidden) {\n unset($options[MFCS_REVIEWER_CLASSIFICATION_VENUE_COORDINATOR]);\n unset($options[MFCS_REVIEWER_CLASSIFICATION_VENUE_COORDINATOR_PROXY]);\n unset($options[MFCS_REVIEWER_CLASSIFICATION_SYSTEM_ADMINISTRATOR]);\n unset($options[MFCS_REVIEWER_CLASSIFICATION_MANAGER]);\n unset($options[MFCS_REVIEWER_CLASSIFICATION_REQUESTER]);\n unset($options[MFCS_REVIEWER_CLASSIFICATION_SYSTEM]);\n }\n\n if (!$disabled) {\n unset($options[MFCS_REVIEWER_CLASSIFICATION_FACILITIES_CUSTODIAL]);\n }\n\n asort($options);\n\n return $options;\n}",
"private function buildselectforwatches() {\n $this->isirdb->join('spis2users_watches', 'users_watches.id = spis2users_watches.watched_id', 'left');\n $this->isirdb->join('spis', 'spis2users_watches.spis_id = spis.id', 'left');\n\n $this->isirdb->select('\n users_watches.id AS id, \n users_watches.name AS name, \n users_watches.ic AS ic, \n users_watches.rc AS rc, \n users_watches.birthdate AS birthdate, \n users_watches.firstname AS firstname, \n users_watches.note AS note,\n users_watches.clientname AS clientname,\n has_likvidace AS likvidace,\n has_vat_debtor AS vatdebtor,\n has_account_change AS account_change,\n GROUP_CONCAT(spis.id, \"|\", spis.status_id SEPARATOR \",\") AS spises,\n users_watches.official_name AS official_name'\n , false);\t\t\t\t\t\t\n }",
"function BBClassesList($type = 'text')\n {\n $lists = Classes::where('type', $type)->lists('name', 'id');\n $lists->prepend('Select Class', '');\n\n return $lists;\n }",
"private function renderSelection() {\n\t\t$selection = $this->getSelection();\n\t\tif ($selection === false) {\n\t\t\treturn '';\n\t\t}\n\t\t$itemList = '';\n\t\tforeach ($selection as $item) {\n\t\t\t$itemList .= '\n\t\t\t\t<div class=\"catelem\" id=\"y_'.$item['SKU'].'\">\n\t\t\t\t\t<span class=\"toggle leaf\" id=\"y_toggle_'.$item['SKU'].'\"> </span>\n\t\t\t\t\t<div class=\"catname\" id=\"y_select_'.$item['SKU'].'\">\n\t\t\t\t\t\t<span class=\"catname\">'.fixHTMLUTF8Entities($item['products_name'].' ('.$item['SKU'].')').'</span>\n\t\t\t\t\t</div>\n\t\t\t\t</div>';\n\t\t}\n\t\treturn $itemList;\n\n\t}",
"function generateHTMLcboCompanies($selected=\"\", $class=\"\"){\n\t\t\t\treturn arraySelect($this->Companies(), \"idcompany_todo\", \"class=\\\"$class\\\" tabindex=\\\"8\\\" onchange=\\\"javascript:changeProject_todo();\\\" \", $selected, true, false);\n\t\t\t\t\n\t\t\t}",
"public function getNewChildSelectOptions()\n {\n $productCondition = Mage::getModel('smile_virtualcategories/rule_condition_product');\n $productAttributes = $productCondition->loadAttributeOptions()->getAttributeOption();\n $attributes = array();\n\n foreach ($productAttributes as $code=>$label) {\n $attributes[] = array('value' => 'smile_virtualcategories/rule_condition_product|'.$code, 'label' => $label);\n }\n\n $conditions = array(\n array(\n 'value' => '',\n 'label' => Mage::helper('rule')->__('Please choose a condition to add...')\n ),\n array(\n 'value' => 'smile_virtualcategories/rule_condition_combine',\n 'label' => Mage::helper('catalogrule')->__('Conditions Combination')\n ),\n array(\n 'value' => $attributes,\n 'label' => Mage::helper('catalogrule')->__('Product Attribute')\n )\n );\n\n return $conditions;\n }",
"private function getSelectOptions() {\n $result = \"\";\n if($this->pleaseSelectEnabled) {\n $result .= '<option value=\"null\"> -- Please Select --</option>';\n }\n foreach($this->itemList as $key => $val) {\n $selectedText = \"\";\n if(in_array($key, $this->selectedItems)) {\n $selectedText = 'selected=\"selected\"';\n }\n $result .= '<option value=\"'.$key.'\" '.$selectedText.'>'.$val.'</option>'.\"\\n \\t\";\n }\n return $result;\n }",
"public function getNewChildSelectOptions()\n {\n $hlr = Mage::helper('amsegments');\n \n $conditions = array(\n array(\n 'label' => $hlr->__(Amasty_Segments_Model_Segment_Condition_Customer_Subscriber::getDefaultLabel()),\n 'value' => 'amsegments/segment_condition_customer_subscriber',\n ),\n array(\n 'label' => $hlr->__(Amasty_Segments_Model_Segment_Condition_Customer_Days_Visit::getDefaultLabel()),\n 'value' => 'amsegments/segment_condition_customer_days_visit',\n ),\n array(\n 'label' => $hlr->__(Amasty_Segments_Model_Segment_Condition_Customer_Days_Registration::getDefaultLabel()),\n 'value' => 'amsegments/segment_condition_customer_days_registration',\n ),\n array(\n 'label' => $hlr->__(Amasty_Segments_Model_Segment_Condition_Customer_Days_Birthday::getDefaultLabel()),\n 'value' => 'amsegments/segment_condition_customer_days_birthday',\n )\n );\n \n \n $prefix = 'amsegments/segment_condition_customer_';\n $conditions = array_merge_recursive($conditions, Mage::getModel($prefix.'attributes')->getNewChildSelectOptions());\n\n return array(\n 'value' => $conditions,\n 'label'=>Mage::helper('amsegments')->__('Registered Customers')\n );\n }",
"public function build()\n\t{\n\t\tparent::build();\n\n\t\t$options = $this->suppliedOptions;\n\n\t\t$dataOptions = $options['options'];\n\n\t\t// Check if function\n\t\tif(\\is_callable($dataOptions)){\n\t\t\t$dataOptions = \\call_user_func($dataOptions);\n\t\t}\n\n\t\t$options['options'] = array();\n\n\t\t//iterate over the options to create the options assoc array\n\t\tforeach ($dataOptions as $val => $text)\n\t\t{\n\t\t\t$options['options'][] = array(\n\t\t\t\t'id' => is_numeric($val) && (!array_key_exists('enum_numeric_keys', $options) || $options['enum_numeric_keys'] == false) ? $text : $val,\n\t\t\t\t'text' => $text,\n\t\t\t);\n\t\t}\n\n\t\t$this->suppliedOptions = $options;\n\t}",
"public function initOptions() {\n\t\t$this->loadModel( 'RiskClassificationType' );\n\n\t\t$bcps = $this->BusinessContinuity->BusinessContinuityPlan->find('list', array(\n\t\t\t'conditions' => array(\n\t\t\t\t'BusinessContinuityPlan.security_service_type_id !=' => SECURITY_SERVICE_DESIGN\n\t\t\t),\n\t\t\t'order' => array('BusinessContinuityPlan.title' => 'ASC'),\n\t\t\t'recursive' => -1\n\t\t));\n\n\t\t$mitigate_id = RISK_MITIGATION_MITIGATE;\n\n\t\t$accept_id = RISK_MITIGATION_ACCEPT;\n\n\t\t$transfer_id = RISK_MITIGATION_TRANSFER;\n\n\t\t$this->set('classifications', $this->BusinessContinuity->getFormClassifications());\n\t\t$this->set('bcps', $bcps);\n\t\t$this->set('mitigate_id', $mitigate_id);\n\t\t$this->set('accept_id', $accept_id);\n\t\t$this->set('transfer_id', $transfer_id);\n\t\t$this->set('calculationMethod', $this->BusinessContinuity->getMethod());\n\t}"
]
| [
"0.78847694",
"0.6640465",
"0.62988997",
"0.62259257",
"0.616417",
"0.60691726",
"0.6025562",
"0.5884363",
"0.58370405",
"0.5767028",
"0.5751865",
"0.5743982",
"0.57101256",
"0.5708095",
"0.56958336",
"0.5680058",
"0.56152344",
"0.5586126",
"0.55670166",
"0.55496097",
"0.5511127",
"0.5497985",
"0.5497837",
"0.5497603",
"0.5487764",
"0.54773563",
"0.54669976",
"0.5463859",
"0.54573834",
"0.54527855"
]
| 0.80517733 | 0 |
/ Functions for working with images Adds "tn" designation to file name | function makeThumbnailName($image) {
$i = strrpos($image, '.');
$image_name = substr($image, 0, $i);
$ext = substr($image, $i);
$image = $image_name . '-tn' . $ext;
return $image;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function makeThumbnailName($image)\n{\n $i = strrpos($image, '.');\n $image_name = substr($image, 0, $i);\n $ext = substr($image, $i);\n $image = $image_name . '-tn' . $ext;\n return $image;\n}",
"protected function imageName() {}",
"public function getImageName();",
"private function createImageName($imageInfo, $shopName, $imageTypeName)\n {\t\n \t$folderName = $this->createFolderName($shopName);\n \t//get Image Mine Type\n $logoType =$imageInfo->getClientMimeType();\n $ext = substr($logoType, strrpos($logoType, '/') +1);\n //get Current Date time String\n $date = $this->currentTime();\n //concrite a new logo Name\n $newName = $date.'_'.$folderName.$imageTypeName.'.'.$ext;\n\n //return logo name\n return $newName;\n }",
"private function getPlainFileName(){\r\n return str_replace(\"https://images.pond5.com/\",\"\",$this->fileName); \r\n }",
"function thumbnail($image , $type)\n{\n $ext = pathinfo($image, PATHINFO_EXTENSION);\n // We remove extension from file name so we can append thumbnail type\n $num = strlen($ext)*(-1)-1;\n $name = substr($image, 0, $num);\n // We merge original name + type + extension\n return $name . '-' . $type . '.' . $ext;\n}",
"private function getThumbFilename() {\n\t\t$info = pathInfo( $this->filename );\n\n\t\t// add dirname as postfix (if exists)\n\t\t$postfix = '';\n\n\t\t$dirname = UniteFunctionsRev::getVal( $info, 'dirname' );\n\t\tif ( ! empty( $dirname ) ) {\n\t\t\t$postfix = str_replace( '/', '-', $dirname );\n\t\t}\n\n\t\t$ext = $info['extension'];\n\t\t$name = $info['filename'];\n\t\t$width = ceil( $this->maxWidth );\n\t\t$height = ceil( $this->maxHeight );\n\t\t$thumbFilename = $name . '_' . $width . 'x' . $height;\n\n\t\tif ( ! empty( $this->type ) ) {\n\t\t\t$thumbFilename .= '_' . $this->type; }\n\n\t\tif ( ! empty( $this->effect ) ) {\n\t\t\t$thumbFilename .= '_e' . $this->effect;\n\t\t\tif ( ! empty( $this->effect_arg1 ) ) {\n\t\t\t\t$thumbFilename .= 'x' . $this->effect_arg1;\n\t\t\t}\n\t\t}\n\n\t\t// add postfix\n\t\tif ( ! empty( $postfix ) ) {\n\t\t\t$thumbFilename .= '_' . $postfix; }\n\n\t\t$thumbFilename .= '.' . $ext;\n\n\t\treturn($thumbFilename);\n\t}",
"function getName() \t\t { return 'NP_ImageCreateThumbnail'; }",
"protected function buildFileName()\n\t{\n\t\t$upscale = $this->upscale ? 'upscale' : 'noupscale';\n\t\treturn $this->namePrefix . '-' . $this->width . 'x' . $this->height . '-' . $upscale . '-' . $this->quality . '-' . $this->imageName;\n\t}",
"protected function imageName() {\n\n\t\treturn NULL;\n\t}",
"function imagecustom($im, $text) {\n}",
"public function genFilename()\n {\n $filename = $this->getAssetableType().$this->assetable_id.'_';\n $filename .= uniqid();\n if(!empty($this->getThumbnailType())) $filename .= '_'.$this->getThumbnailType();\n $filename .= '.'.$this->uploadedFile->extension;\n $this->filename = $filename;\n }",
"private function getImageName(SplFileInfo $dir, $imageSetName)\n {\n return $imageSetName.'-'.$dir->getFileName().':latest';\n }",
"function display_file($file) {\n\n return \"images\" . DS . $file;\n\n}",
"public function get_thumb_name(){\n\t\treturn \"{$this->id}_thumb.png\";\n\t}",
"function getThumbnailName($file){\n $parts = explode('.',$file);\n $ext = array_pop($parts);\n //return implode('.',$parts).'_thumb.'.$ext;\n return 'thumb_'.$file;\n }",
"function _showname($img,$data){\n global $ID;\n\n if(!$data['showname'] ) { return ''; }\n\n //prepare link\n $lnk = ml($img['id'],array('id'=>$ID),false);\n\n // prepare output\n $ret = '';\n $ret .= '<br /><a href=\"'.$lnk.'\">';\n $ret .= hsc($img['file']);\n $ret .= '</a>';\n return $ret;\n }",
"function createImage($idName) { //TODO: Add parameter for passing image files to use instead \n echo '<img src=\"/php/cms-img/file2.png\" id=\"' . $idName . '\" class=\"nested\"/>';\n }",
"public function setFileName() {\n\t\t$name = 'color_' . $this->width . 'x' . $this->height;\n\t\tforeach ($this->colors as $color) {\n\t\t\t$name .= '_' . strtolower(preg_replace('/^#/', '', $color));\n\t\t}\n\t\t$name .= '.png';\n\t\t$this->fileName = $this->tempDir . $name;\n\t}",
"static function getImageExtension(string $image): string {\n return (\\strpos($image, 'a_') === 0 ? 'gif' : 'png');\n }",
"public function getNameFile($image): string\n {\n \t$image_name = uniqid(time()) . '.' . explode('/', explode(':', substr($image, 0, strpos($image, ';')))[1])[1];\n \treturn $image_name;\n }",
"public function thumbnailPath() {\n return $this->baseDir() . '/tn-' . $this->fileName();\n }",
"static function thumbnail($filename , $disk='local'){\n return pathinfo( $filename , PATHINFO_FILENAME ) . '.jpg';\n\n }",
"private function getFileName($raw = false){\n $raw_string = $this->surah . '|' . $this->verses . '|' . $this->translation;\n return $raw ? $raw_string : md5($raw_string).'.png';\n }",
"private function genereteFilename(){\n return strtolower(md5(uniqid($this->document->baseName)) . '.' . $this->document->extension);\n }",
"protected function getImageName() {\n\n\t\treturn NULL;\n\t}",
"function logo($tp) {\n\tglobal $LANG;\n\tswitch ($tp) {\n\t\tcase '1' :\n\t\t\t$file = 'document/proethos_logo_1.jpg';\n\t\t\tif (file_exists($file))\n\t\t\t\t{\n\t\t\t\t\treturn($file);\n\t\t\t\t} else {\n\t\t\t\t\t$file = 'img/logo_dictamen.jpg';\n\t\t\t\t\treturn($file);\n\t\t\t\t}\n\t\t\tbreak;\n\t\tcase '2' :\n\t\t\t$file = 'document/proethos_logo_1.png';\t\t\t\t\t\n\t\t\tif (file_exists($file))\n\t\t\t\t{\n\t\t\t\t\treturn($file);\n\t\t\t\t} else {\n\t\t\t\t\t$file = 'img/proethos_logo_1.png';\n\t\t\t\t\t$file = 'img/logo_inst_mini_'.$LANG.'.png';\n\t\t\t\t\treturn($file);\n\t\t\t\t}\n\t\t\tbreak;\n\t\tcase '3' :\n\t\t\t$file = 'document/proethos_logo_2.png';\t\t\t\n\t\t\tif (file_exists($file))\n\t\t\t\t{\n\t\t\t\t\treturn($file);\n\t\t\t\t} else {\n\t\t\t\t\t$file = 'img/proethos_logo_2.png';\n\t\t\t\t\treturn($file);\n\t\t\t\t}\n\t\t\tbreak;\t\t\n\t}\n}",
"private function formatFilename() {\n return $this->prefix . $this->name . \".\" . $this->extension;\n }",
"function image($file_name,$title,$class='',$id) {\n \tif ($id) $id = \"id = '\".$id.\"'\"; \n \t$data = '<img src=\"'.BASE_PATH.'/img/'.$file_name.'\" title = \"'.$title.'\" border=\"0\" align=\"absmiddle\" '.$id.' class=\"'.$class.'\" />';\n return $data;\n }",
"function minorite_image($variables) {\n $attributes = $variables['attributes'];\n $attributes['src'] = file_create_url($variables['path']);\n\n foreach (array('alt', 'title') as $key) {\n\n if (isset($variables[$key])) {\n $attributes[$key] = $variables[$key];\n }\n }\n\n return '<img' . drupal_attributes($attributes) . ' />';\n}"
]
| [
"0.76361454",
"0.74944025",
"0.68055826",
"0.66019374",
"0.6599242",
"0.6576761",
"0.65444136",
"0.6507727",
"0.6493835",
"0.64035404",
"0.64034975",
"0.6264035",
"0.6226564",
"0.621767",
"0.62126434",
"0.61867845",
"0.615337",
"0.61518663",
"0.6137972",
"0.613783",
"0.61376846",
"0.6107577",
"0.60900956",
"0.6054957",
"0.6028583",
"0.60219336",
"0.60181934",
"0.60165644",
"0.60154635",
"0.6001129"
]
| 0.764747 | 0 |
Build images display for image management view | function buildImageDisplay($imageArray) {
$id = '<ul id="image-display">';
foreach ($imageArray as $image) {
$id .= '<li>';
$id .= "<img src='$image[imgPath]' title='$image[invMake] $image[invModel] image on PHP Motors.com' alt='$image[invMake] $image[invModel] image on PHP Motors.com'>";
$id .= "<p><a href='/phpmotors/uploads?action=delete&imgId=$image[imgId]&filename=$image[imgName]' title='Delete the image'>Delete $image[imgName]</a></p>";
$id .= '</li>';
}
$id .= '</ul>';
return $id;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function combineImages() {}",
"function buildImageDisplay($imageArray)\n{\n $id = '<ul id=\"image-display\">';\n foreach ($imageArray as $image) {\n $id .= '<li>';\n $id .= \"<img src='$image[imgPath]' title='$image[invMake] $image[invModel] image on PHP Motors.com' alt='$image[invMake] $image[invModel] image on PHP Motors.com'>\";\n $id .= \"<p><a href='/phpmotors/uploads?action=delete&imgId=$image[imgId]&filename=$image[imgName]' title='Delete the image'>Delete $image[imgName]</a></p>\";\n $id .= '</li>';\n }\n $id .= '</ul>';\n return $id;\n}",
"public static function theme_images() {\r\n add_image_size('slideshow-980', 980, 420, true);\r\n add_image_size('slideshow-1200', 1180, 550, true);\r\n add_image_size('slideshow-1560', 1540, 550, true);\r\n add_image_size('slideshow-720', 600, 550, true);\r\n add_image_size('grid-thumbnail', 370, 270, true);\r\n add_image_size('icon-60', 60, 60, true);\r\n add_image_size('icon-100', 100, 100, true);\r\n add_image_size('icon-40', 40, 40, true);\r\n }",
"private function buildImagesFields()\n {\n $groupName = Translate::getAdminTranslation(\"Images\", \"AdminProducts\");\n\n //====================================================================//\n // PRODUCT IMAGES\n //====================================================================//\n\n //====================================================================//\n // Product Images List\n $this->fieldsFactory()->create(SPL_T_IMG)\n ->Identifier(\"image\")\n ->InList(\"images\")\n ->Name(Translate::getAdminTranslation(\"Images\", \"AdminProducts\"))\n ->Group($groupName)\n ->MicroData(\"http://schema.org/Product\", \"image\");\n\n //====================================================================//\n // Product Images => Position\n $this->fieldsFactory()->create(SPL_T_INT)\n ->Identifier(\"position\")\n ->InList(\"images\")\n ->Name(Translate::getAdminTranslation(\"Position\", \"AdminProducts\"))\n ->MicroData(\"http://schema.org/Product\", \"positionImage\")\n ->Group($groupName)\n ->isNotTested();\n\n //====================================================================//\n // Product Images => Is Cover\n $this->fieldsFactory()->create(SPL_T_BOOL)\n ->Identifier(\"cover\")\n ->InList(\"images\")\n ->Name(Translate::getAdminTranslation(\"Cover\", \"AdminProducts\"))\n ->MicroData(\"http://schema.org/Product\", \"isCover\")\n ->Group($groupName)\n ->isNotTested();\n\n //====================================================================//\n // Product Images => Is Visible Image\n $this->fieldsFactory()->create(SPL_T_BOOL)\n ->Identifier(\"visible\")\n ->InList(\"images\")\n ->Name(Translate::getAdminTranslation(\"Visible\", \"AdminProducts\"))\n ->MicroData(\"http://schema.org/Product\", \"isVisibleImage\")\n ->Group($groupName)\n ->isNotTested();\n }",
"public function presentation_images()\n\t\t{\n\t\t\t$this->is_login();\n\t\t\t$this->load->model('presentation_images_model', 'pim');\n\t\t\t$data['presentation_images'] = $this->pim->get_all();\n $data['presentation_act'] = $this->pim->get_link();\n\t\t\t$this->load->view('presentation_images-admin', $data);\n\t\t}",
"public function view_images()\n {\n $data['images'] = $this->Image_model->get_images();\n $this->load->view('student/index', $data);\n }",
"public function index()\n {\n return view('admin.list.images', [\n 'pageImages' => Image::where('imageType', '=', 'page')->get(),\n 'backgroundImages' => Image::where('imageType', '=', 'background')->get()\n ]);\n }",
"public function show_images(){\n\t\t\t$dir = '../pictures/';\n\t\t\t//checks if is an actual directory, opens it and reads each and returns filename.ext\n\t\t\tif (is_dir($dir)) {\n\t\t\t if ($dh = opendir($dir)) {\n\t\t\t while (($file = readdir($dh)) !== false) {\n\t\t\t \tif( $file == '.' || $file == '..'){//readdir returns ., .. before actual filenames\n \t\tcontinue;//they are ignored\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t//href value is to a include file showlarge.inc.php\n\t\t\t\t\t\techo \"<a href=?value=showlarge&value={$file}>\";\n\t\t\t\t\t\techo \"<img class = 'picture' src='{$dir}{$file}'></a>\";\n\t\t\t }\n\t\t\t closedir($dh);\n\t\t\t }\n\t\t\t}\n\t\t}",
"function buildGallery ()\t{\n\t\t\t// Get the needed Information\n\t\t\t\n\t\t}",
"protected function buildImagesFields()\n {\n $groupName = Translate::getAdminTranslation(\"Images\", \"AdminProducts\");\n\n //====================================================================//\n // PRODUCT IMAGES\n //====================================================================//\n\n //====================================================================//\n // Product Images List\n $this->fieldsFactory()->create(SPL_T_IMG)\n ->identifier(\"image\")\n ->inList(\"images\")\n ->name(Translate::getAdminTranslation(\"Images\", \"AdminProducts\"))\n ->group($groupName)\n ->microData(\"http://schema.org/Product\", \"image\")\n ->isReadOnly(self::isSourceCatalogMode())\n ->addOption(\"shop\", MSM::MODE_ALL)\n ;\n\n //====================================================================//\n // Product Images => Position\n $this->fieldsFactory()->create(SPL_T_INT)\n ->identifier(\"position\")\n ->inList(\"images\")\n ->name(Translate::getAdminTranslation(\"Position\", \"AdminProducts\"))\n ->microData(\"http://schema.org/Product\", \"positionImage\")\n ->group($groupName)\n ->isReadOnly(self::isSourceCatalogMode())\n ->addOption(\"shop\", MSM::MODE_ALL)\n ->isNotTested()\n ;\n\n //====================================================================//\n // Product Images => Is Cover\n $this->fieldsFactory()->create(SPL_T_BOOL)\n ->identifier(\"cover\")\n ->inList(\"images\")\n ->name(Translate::getAdminTranslation(\"Cover\", \"AdminProducts\"))\n ->microData(\"http://schema.org/Product\", \"isCover\")\n ->group($groupName)\n ->isReadOnly(self::isSourceCatalogMode())\n ->addOption(\"shop\", MSM::MODE_ALL)\n ->isNotTested()\n ;\n\n //====================================================================//\n // Product Images => Is Visible Image\n $this->fieldsFactory()->create(SPL_T_BOOL)\n ->identifier(\"visible\")\n ->inList(\"images\")\n ->name(Translate::getAdminTranslation(\"Visible\", \"AdminProducts\"))\n ->microData(\"http://schema.org/Product\", \"isVisibleImage\")\n ->group($groupName)\n ->isReadOnly(self::isSourceCatalogMode())\n ->addOption(\"shop\", MSM::MODE_ALL)\n ->isNotTested()\n ;\n }",
"public function getImages()\n\t\t{\n\t\t\t$this->createDir();\n\t\t\t//sacamos la lista de ficheros de la carpeta photos\n\t\t\t$files = $this->getFileList();\n\t\t\t//array de salida\n\t\t\t$image_List = array();\n\t\t\t\n\t\t\t//recorremos el contenido de esa carpeta\n\t\t\tforeach($files as $file)\n\t\t\t{\n\t\t\t\t//tiene que ser jpg, gif o png para que muestre las imagenes y que no sea . o ..\n\t\t\t\tif($file!=\".\" && $file!=\"..\" && $this->validatePhoto($file))\n\t\t\t\t{\t\t\t\t\n\t\t\t\t\t//guardo en el array la lista de imagenes\n\t\t\t\t\tarray_push($image_List, $file);\n\t\t\t\t\t\n\t\t\t\t\t//miro si existe la imagen en el thumbs si no lo creo\n\t\t\t\t\tif(!$this->checkIfFileExistes($file))\n\t\t\t\t\t{\n\t\t\t\t\t\t//como NO existe la minituara la creamos\n\t\t\t\t\t\t$this->createThumb(\"$file\");\n\t\t\t\t\t}\n\t\t\t\t\t//mostramos la miniatura y al hacer clic mostramos original \n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\techo \"<a href='\".$this->ruta.\"/$file' target='_blank' ><img src='\".$this->rutaMini.\"/$file'/></a>\";\t\n\t\t\t\t}\t\t\n\t\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t}",
"public function imagesAction()\n {\n $logedUser = $this->getServiceLocator()\n ->get('user')\n ->getUserSession();\n $permission = $this->getServiceLocator()\n ->get('permissions')\n ->havePermission($logedUser[\"idUser\"], $logedUser[\"idWebsite\"], $this->moduleId);\n if ($this->getServiceLocator()\n ->get('user')\n ->checkPermission($permission, \"edit\")) {\n \n \n if ($this->getServiceLocator()\n ->get('user')\n ->checkPermission($permission, \"edit\") || $logedUser[\"idCompany\"] == 1) {\n $request = $this->getRequest();\n }\n \n $images = $this->getImageTable()->fetchAll($logedUser[\"idWebsite\"]);\n $this->layout(\"layout/images.phtml\");\n return array(\n \"images\" => $images,\n \"idWebsite\" => $logedUser[\"idWebsite\"]\n );\n } else {\n return $this->redirect()->toRoute(\"noPermission\");\n }\n }",
"private function loadImages(): void\n {\n if (count($this->images) == 1) {\n $this->addMeta('image', $this->images[0]);\n\n return;\n }\n\n foreach ($this->images as $number => $url) {\n $this->addMeta(\"image{$number}\", $url);\n }\n }",
"protected function generateImages() {\n if ($this->buildNamespace($this->imageFolder) && $this->createShortUrl()) {\n foreach ($this->inputs as $input) {\n $this->generate($input);\n }\n }\n\n return $this->responseJSON();\n }",
"private function generateThumbnailImagick(){\n\t}",
"function mob_images() {\n\tupdate_option( 'thumbnail_size_w', 360 );\n\tupdate_option( 'thumbnail_size_h', 220 );\n\tupdate_option( 'thumbnail_crop', 1 );\n\n\tupdate_option( 'medium_size_w', 654 );\n\tupdate_option( 'medium_size_h', 9999 );\n\tupdate_option( 'medium_crop', 0 );\n\n\tupdate_option( 'medium_large_size_w', 0 );\n\tupdate_option( 'medium_large_size_h', 0 );\n\n\tupdate_option( 'large_size_w', 850 );\n\tupdate_option( 'large_size_h', 400 );\n\tupdate_option( 'large_crop', 1 );\n\n\tadd_image_size( 'archive-blog', 360, 170, true );\t\n}",
"function _putimages() {\n parent::_putimages();\n $this->_putformxobjects();\n }",
"protected function _build() {\n $alt_title = $this->isXhtml ? tep_output_string_protected( str_replace ( '&', '&', $this->attributes['alt'] ) ) : tep_output_string( $this->attributes['alt'] );\n $parameters = tep_not_null( $this->parameters ) ? tep_output_string( $this->parameters ) : false;\n $width = (int)$this->_calculated_width;\n $height = (int)$this->_calculated_height;\n $this->_html = '<img width=\"' . $width . '\" height=\"' . $height . '\" src=\"' . $this->src . '\" title=\"' . $alt_title . '\" alt=\"' . $alt_title . '\"';\n if ( false !== $parameters ) $this->_html .= ' ' . html_entity_decode(tep_output_string( $parameters ));\n $this->_html .= $this->isXhtml ? ' />' : '>'; \n }",
"public function addImagesSizes() {\n\t\t// add_image_size( 'small', 225, 9999 );\n\t\t// add_image_size( 'hero', 1600, 9999 );\n\t}",
"public function providerBuildImage()\n {\n\n return [\n [\n ['action' => 'scale_and_crop', 'width' => 40, 'height' => '25%'],\n ['action' => 'scale_and_crop', 'width' => 40, 'height' => 125],\n ],\n [\n ['action' => 'scale', 'width' => 40],\n ['action' => 'scale', 'width' => 40],\n ],\n [\n ['action' => 'scale', 'width' => '50%'],\n ['action' => 'scale', 'width' => 250],\n ],\n [\n ['action' => 'crop', 'height' => '50%', 'yoffset' => 20],\n ['action' => 'crop', 'height' => 250, 'yoffset' => 20],\n ],\n [\n ['action' => 'crop', 'height' => 20, 'yoffset' => 'bottom'],\n ['action' => 'crop', 'height' => 20, 'yoffset' => 480],\n ],\n [\n ['action' => 'crop', 'width' => '50%', 'xoffset' => 'center'],\n ['action' => 'crop', 'width' => '250', 'xoffset' => 125],\n ],\n [\n ['action' => 'crop', 'width' => '20', 'xoffset' => 'left'],\n ['action' => 'crop', 'width' => '20', 'xoffset' => 0],\n ],\n ];\n }",
"function print_images()\n {\n $images = $this->service->imageList();\n $image_choice = 0;\n foreach ($images as $image) {\n printf(\"%d) %s: Image %s requires min. %dMB of RAM and %dGB of disk\\n\",\n $image_choice, $image->id, $image->name, $image->minRam,\n $image->minDisk);\n $image_choice += 1;\n }\n }",
"function show_images() {\n global $app;\n $images = new entities\\Image();\n $cursor = $images->getRange($app, 0);\n $posts = array();\n \n foreach ($cursor->toArray() as $post) {\n $posts[] = $post;\n }\n return $app['twig']->render('admin/admin_images.twig', array('images' => $posts));\n}",
"function generate_image_sizes() {\n\t$display_options = get_customizer_settings()[ WPM_PREFIX . 'collection_style' ];\n\n\tadd_image_size(\n\t\tWPM_PREFIX . 'list_thumb',\n\t\t$display_options['list_image_max_width'],\n\t\t$display_options['list_image_max_height']\n\t);\n}",
"public function setImages(){\n\t\t// imagen destacada\n $this->thumbail_img = $this->getThumbnailImg();\n // imagenes\n $this->images = $this->getImages();\n\t}",
"public function showThumbnails() {\n $this->generateHead();\n $thumbnailsArray = $this->getThumbnailsArray();\n for($i = 0; $i < $this->rowsCount * 2; $i ++){\n echo '<div class=\"col-xs-6\">';\n echo '<a href=\"big_img.php?img_id=' . $thumbnailsArray[$i]['id'] . '\" class=\"thumbnail\">';\n echo '<img src=\"images/thumbnails/' . $thumbnailsArray[$i]['filename'] . '\" alt=\"\">';\n echo '</a>';\n echo '</div>';\n }\n $this->generateFoot();\n }",
"public function build()\n {\n if ($this->_inline) {\n $encoded_image = base64_encode(file_get_contents($this->_attributes['src']));\n $mime_type = image_type_to_mime_type($this->_image_type);\n $this->_attributes['src'] = \"data:{$mime_type};base64,{$encoded_image}\";\n\n if (isset($this->_attributes['async'])) {\n unset($this->_attributes['async']);\n }\n }\n\n $attributes = join(' ', $this->_makeAttributesArr());\n if (!empty($attributes)) {\n $attributes = ' ' . $attributes;\n }\n return \"<img{$attributes}>\";\n }",
"public function displayImgTag() {\n $urlimg = \"/plugins/graphontrackers/reportgraphic.php?_jpg_csimd=1&group_id=\".(int)$this->graphic_report->getGroupId().\"&atid=\". $this->graphic_report->getAtid();\n $urlimg .= \"&report_graphic_id=\".$this->graphic_report->getId().\"&id=\".$this->getId();\n \n \n echo '<img src=\"'. $urlimg .'\" ismap usemap=\"#map'. $this->getId() .'\" ';\n if ($this->width) {\n echo ' width=\"'. $this->width .'\" ';\n }\n if ($this->height) {\n echo ' height=\"'. $this->height .'\" ';\n }\n echo ' alt=\"'. $this->title .'\" border=\"0\">';\n }",
"function outputImages($collectionObject) {\r\n\t$results = $collectionObject->getArray();\r\n\r\n\tfor($i=0;$i<$collectionObject->getCount();$i++){\r\n\t\techo '<div class=\"col-md-3\">';\r\n\t\techo '<a href=\"single-image.php?id=' . $results[$i]->getImageID() . '\">';\r\n\t\techo '<img src=\"travel-images/square-medium/'. $results[$i]->getPath() . '\" title=\"\" class=\"thumbnail\" />';\r\n\t\techo '</a>';\r\n\t\techo \"</div>\";\r\n\t}\r\n}",
"public function display() { ImageLib::serve($this->source_image, $this->source_image_mimetype); }",
"public function images(){\n $images = DB::table('images')->simplePaginate(15);\n return view('admin.images')->with('images', $images);\n }"
]
| [
"0.66767216",
"0.6653933",
"0.662097",
"0.6508861",
"0.6464377",
"0.64505446",
"0.64118344",
"0.6403195",
"0.6401963",
"0.6396919",
"0.63388807",
"0.6326887",
"0.63045967",
"0.629498",
"0.62719315",
"0.6271095",
"0.6270881",
"0.6254747",
"0.62450004",
"0.62233055",
"0.6221337",
"0.6201638",
"0.61989343",
"0.61772436",
"0.6155237",
"0.61302716",
"0.6128164",
"0.6101356",
"0.60996497",
"0.6092298"
]
| 0.6767184 | 0 |
Build the vehicles select list | function buildVehiclesSelect($vehicles) {
$prodList = '<select name="invId" id="invId">';
$prodList .= "<option>Choose a Vehicle</option>";
foreach ($vehicles as $vehicle) {
$prodList .= "<option value='$vehicle[invId]'>$vehicle[invMake] $vehicle[invModel]</option>";
}
$prodList .= '</select>';
return $prodList;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function buildVehiclesSelect($vehicles)\n{\n $prodList = '<select name=\"invId\" id=\"invId\">';\n $prodList .= \"<option>Choose a Vehicle</option>\";\n foreach ($vehicles as $vehicle) {\n $prodList .= \"<option value='$vehicle[invId]'>$vehicle[invMake] $vehicle[invModel]</option>\";\n }\n $prodList .= '</select>';\n return $prodList;\n}",
"protected function buildOptionsList() {\n }",
"private function getSelectOptions() {\n $result = \"\";\n if($this->pleaseSelectEnabled) {\n $result .= '<option value=\"null\"> -- Please Select --</option>';\n }\n foreach($this->itemList as $key => $val) {\n $selectedText = \"\";\n if(in_array($key, $this->selectedItems)) {\n $selectedText = 'selected=\"selected\"';\n }\n $result .= '<option value=\"'.$key.'\" '.$selectedText.'>'.$val.'</option>'.\"\\n \\t\";\n }\n return $result;\n }",
"function buildClassificationList($classifications)\n{\n $classificationList = '<select name=\"classificationId\" id=\"classificationList\">';\n $classificationList .= \"<option>Choose a Classification</option>\";\n foreach ($classifications as $classification) {\n $classificationList .= \"<option value='$classification[classificationId]'>$classification[classificationName]</option>\";\n }\n $classificationList .= '</select>';\n return $classificationList;\n}",
"function vcn_get_career_names_select_list () {\r\n\t$data = vcn_rest_wrapper('vcnoccupationsvc', 'vcncareer', 'listcareers', array('industry' => vcn_get_industry()), 'json');\r\n\t$select_list_array = array('' => 'Select a Career');\r\n\r\n\tif (count($data) > 0) {\r\n\t\tforeach ($data as $value) {\r\n\t\t\t$select_list_array[$value->onetcode] = $value->title;\r\n\t\t}\r\n\t}\r\n\treturn $select_list_array;\r\n}",
"function buildClassificationList($classifications){ \r\n $classificationList = '<select name=\"classificationId\" id=\"classificationList\">'; \r\n $classificationList .= \"<option>Choose a Classification</option>\"; \r\n foreach ($classifications as $classification) { \r\n $classificationList .= \"<option value='$classification[classificationId]'>$classification[classificationName]</option>\"; \r\n } \r\n $classificationList .= '</select>'; \r\n return $classificationList; \r\n }",
"static function get_dropdown_options()\n {\n $rows = ORM::factory('actor')->where('parent_id=0')->orderby('actor')->find_all();\n \n foreach ($rows as $row){\n $hijos = array();\n $_t = ORM::factory('actor')->where('parent_id',$row->id)->orderby('actor')->select_list('id','actor');\n\n foreach($_t as $_id => $_n) {\n\n $_hijos = ORM::factory('actor')->where('parent_id',$_id)->orderby('actor')->select_list('id','actor');\n $hijos[] = array('id' => $_id, 'n' => $_n, 'h' => $_hijos);\n \n /* \n foreach($_hijos as $_idn => $_nn) {\n $_h[] = array('id' => $_idn, 'n' => $_nn, 'h' => ORM::factory('actor')->where('parent_id',$_idn)->select_list('id','actor'));\n }\n \n $hijos[] = array('id' => $_id, 'n' => $_n, 'h' => $_h);\n */\n }\n \n $opts[] = array('id' => $row->id, 'n' => $row->actor, 'h' => $hijos);\n }\n return $opts;\n }",
"protected function createUserAndGroupListForSelectOptions() {}",
"function vList() {\n $vlist=$this->getListVars();\n //need database,table,varname,tableinfo for variable =\n // browse=varname;ctrl=whatever;titl=something;whatever other options\n $postStrng=\"method=useQonFly\".\n '&db='.$this->dbName.\n '&tabl='.$this->tabl.\n '&index='.$this->indx;\n if ($vlist) {\n $postStrng.=\"&cmnd=qlist\";\n $chStrng=\"document.getElementById('updBrowse').style.visibility='visible';\";\n $chStrng.=\"jtAjaxLibSelect('$postStrng','varinfo','jtSpecs','1');\";\n echo \"<p><strong>Filter by</strong>\\n<select id=\\\"varinfo\\\" name=\\\"varinfo\\\"\";\n echo \" />\\n\";\n echo \"<option value=\\\"0\\\"> -- </option>\\n\";\n foreach ($vlist as $item) {\n $a=$this->xQueryInfo[\"$item\"];\n $code=\"$item;ctrl=\".$a->getSize().';titl='.$a->getLabel().';'.\n $this->implodeAllOpts($a);\n echo \"<option value=\\\"$code\\\">\",$a->getLabel(),\"</option>\\n\";\n }\n echo \"</select>\\n\";\n addButton('myChoice','Choose',$chStrng); \n //echo \"</p>\\n\";\n } //vlist not empty\n }",
"function LUPE_option_combo_vet($Vet, $NomeCombo, $PreSelect, $LinhaFixa = ' ', $JS = '', $Style = '')\r\n{\r\n\r\n $numrows = count($Vet);\r\n\r\n $html = \"<select id='$NomeCombo' name='$NomeCombo' $JS style='$Style'>\\n\";\r\n\r\n\tif ($LinhaFixa != '')\r\n\t\t$html .= \"<option value=''>$LinhaFixa</option>\\n\";\r\n\r\n if ($numrows == 0) {\r\n\t\t$html .= \"<option value=''>Não há informação no sistema</option>\\n\";\r\n } else {\r\n\t ForEach($Vet as $Chave => $Valor ){\r\n \t\t $html .= \"<option value='$Chave'\";\r\n\r\n\t\t if ($PreSelect == $Chave)\r\n\t\t\t$html .= 'selected >';\r\n \t\t else\r\n\t\t\t$html .= '>';\r\n\r\n\t \t $html .= \"$Valor</option>\\n\";\r\n }\r\n }\r\n\r\n $html .= '</select>';\r\n\r\n return $html;\r\n}",
"function build_selection_dropdown() {\n\t$output = array();\n\t$output[] = array('id' => '', 'text' => TEXT_SELECT);\n\t$output[] = array('id' => 'wo_journal_main.id', 'text' => 'Record ID');\n\t$output[] = array('id' => 'wo_journal_main.wo_id', 'text' => 'Work Order Num');\n\t$output[] = array('id' => 'wo_journal_main.wo_title', 'text' => 'Work Order Title');\n\t$output[] = array('id' => 'wo_journal_main.priority', 'text' => 'Priority');\n\t$output[] = array('id' => 'wo_journal_main.sku', 'text' => 'SKU');\n\t$output[] = array('id' => 'wo_journal_main.qty', 'text' => 'Quantity');\n\t$output[] = array('id' => 'wo_journal_main.post_date', 'text' => 'Post Date');\n\t$output[] = array('id' => 'wo_journal_main.closed', 'text' => 'Closed');\n\t$output[] = array('id' => 'wo_journal_main.closed_date', 'text' => 'Closed Date');\n\t$output[] = array('id' => 'wo_journal_main.notes', 'text' => 'Notes');\n\t$output[] = array('id' => 'wo_journal_main.bom_list', 'text' => 'BOM List');\n\t$output[] = array('id' => 'wo_journal_main.ref_specs', 'text' => 'Reference Specs');\n\t$output[] = array('id' => 'wo_journal_main.ref_docs', 'text' => 'Reference Docs');\n\t$output[] = array('id' => 'bar_code', 'text' => 'SKU Bar Code');\n\t$output[] = array('id' => 'image_with_path', 'text' => 'SKU Image');\n\treturn $output;\n }",
"public function ctlBuscaCompras(){\n\n\t\t$respuesta = Datos::mdlCompras(\"entradas\");\n\n\t\tforeach ($respuesta as $row => $item){\n\t\t\techo '<option value=\"'.$item[\"codProducto\"].'\">'.$item[\"noOperacion\"].' - '.$item[\"proveedor\"].' - '.$item[\"kg\"].' - '.$item[\"precio\"].'</option>';\n\t\t}\n\t}",
"function build_machine_options( $mode )\n{\n // build a drop down list of special interests\n // mode can be 'ADD' or 'DISPLAY'\n\n // get access to a global stack of objects\n\n \n global $machines ;\n\n // reset the variable spave where we are going \n // to build the menu choice structure\n \n $pull_down = '<option value = \"\">MACHINES</option>' ;\n\n // dope how namy objects in the array\n \n $size = count( $machines ) ;\n // and process each one\n \n for ( $counter = 0 ;\n $counter < $size ;\n $counter++ )\n {\n if ( $machines[ $counter ]->active )\n // no sense offering de-activated options\n {\n $pull_down = $pull_down . '<option value = \"'\n . $machines[ $counter ]->short_name \n . '\">'\n . $machines[ $counter ]->name \n . '</option>' ;\n\n\n } // if\n } // for\n\n $pull_down = $pull_down . '<option value = \"Mark Addinall\">Mark Addinall</option>' ;\n\n return $pull_down ;\n\n}",
"private function buildControls(){\n\n\t\t//create key - label pairs for this dropdown:\n\n\t\t$name = '_column_type_'.$this->fullId;\n\t\t$types = $this->getTypes();\n\n\t\tif( $this->referenceMode )\n\t\t\t$name = 'reference_'.$this->fullId;\n\n\n\t\tif( sizeof( $types ) > 1 ){\n\t\t\t\n\t\t\t$typeSelector = Field::select(\n\t\t\t\t$name,\n\t\t\t\t'',\n\t\t\t\t$types,\n\t\t\t\tarray(\n\t\t\t\t\t'defaultValue' => $this->type\n\t\t\t\t)\n\t\t\t);\n\t\t\t\n\t\t\t$class = 'column-controls column-choices-available';\n\n\t\t}else{\n\t\t\t$class = 'column-controls';\n\t\t\t$key = array_keys( $types );\n\t\t\t$typeSelector = Field::hidden( \n\t\t\t\t$name, \n\t\t\t\t[ \n\t\t\t\t\t'defaultValue' => $this->type, \n\t\t\t\t\t'class' => 'type-select'\n\t\t\t\t]\n\t\t\t);\n\t\t}\n\n\t\techo '<div class=\"'.$class.'\">';\n\n\t\t\t//render the dropdown:\n\t\t\t$typeSelector->render();\n\t\t\techo '<h3 class=\"column-type\">'.$types[ $this->type ].'</h3>';\n\n\t\t\t//sorter\n\t\t\techo '<span class=\"sort dashicons dashicons-leftright\"></span>';\n\n\t\techo '</div>';\n\n\t}",
"public function getNewChildSelectOptions()\n {\n $hlr = Mage::helper('amsegments');\n \n $conditions = array(\n array(\n 'label' => $hlr->__(Amasty_Segments_Model_Segment_Condition_Customer_Subscriber::getDefaultLabel()),\n 'value' => 'amsegments/segment_condition_customer_subscriber',\n ),\n array(\n 'label' => $hlr->__(Amasty_Segments_Model_Segment_Condition_Customer_Days_Visit::getDefaultLabel()),\n 'value' => 'amsegments/segment_condition_customer_days_visit',\n ),\n array(\n 'label' => $hlr->__(Amasty_Segments_Model_Segment_Condition_Customer_Days_Registration::getDefaultLabel()),\n 'value' => 'amsegments/segment_condition_customer_days_registration',\n ),\n array(\n 'label' => $hlr->__(Amasty_Segments_Model_Segment_Condition_Customer_Days_Birthday::getDefaultLabel()),\n 'value' => 'amsegments/segment_condition_customer_days_birthday',\n )\n );\n \n \n $prefix = 'amsegments/segment_condition_customer_';\n $conditions = array_merge_recursive($conditions, Mage::getModel($prefix.'attributes')->getNewChildSelectOptions());\n\n return array(\n 'value' => $conditions,\n 'label'=>Mage::helper('amsegments')->__('Registered Customers')\n );\n }",
"public function getRegistros()\n {\n if($this->input->post('id_cliente'))\n {\n $id_cliente = $this->input->post('id_cliente'); \n $contratos = $this->m_contratos->getRegistros($id_cliente, 'id_cliente');\n \n echo '<option value=\"\" disabled selected style=\"display:none;\">Seleccione una opcion...</option>';\n foreach ($contratos as $row) \n {\n echo '<option value=\"'.$row->id_vehiculo.'\">'.$row->vehiculo.'</option>';\n }\n }\n }",
"function create_dropdown($list_of_objs, $selected_item ){\n\t\t$return_val=\"\";\n\t\tfor ($i=0;$i<sizeof($list_of_objs);$i=$i+1){\n\t\t\t$next_obj=$list_of_objs[$i];\n\t\t\t$return_val=$return_val.\"<option value=\\\"\";\n\t\t\t$return_val=$return_val.$next_obj->get_id();\n\t\t\t$return_val=$return_val.\"\\\"\";\n\t\t\tif ($selected_item==$next_obj->get_id()){\n\t\t\t\t$return_val=$return_val.\" selected=\\\"selected\\\" \";\n\t\t\t}\n\t\t\t$return_val=$return_val.\">\".$next_obj->get_name();\n\t\t\t$return_val=$return_val.\"</option>\";\n\t\t}\n\t\treturn $return_val;\n\t}",
"public function brandForm(){\n $table = \"brands\";\n $cresults = $this->getAllrecords($table);\n foreach($cresults as $brand){\n echo('<option value=\"'.$brand[\"brand_id\"].'\">'.$brand[\"brand_name\"].'</option>');\n }\n\n\n }",
"function build_vehicle_javascript()\n\t{\n\t\tglobal $db;\n\n\t\t$make_q_id = \"SELECT id, make FROM \" . GARAGE_MAKES_TABLE . \" ORDER BY make ASC\";\n\t\n\t\tif( !($make_result = $db->sql_query($make_q_id)) )\n\t\t{\n\t\t\tmessage_die(GENERAL_ERROR, 'Could not query users', '', __LINE__, __FILE__, $sql);\n\t\t}\n\n\t\twhile ( $make_row = $db->sql_fetchrow($make_result) )\n\t\t{\n\t\t\t// Start this makes row in the output, this is where it gets confusing!\n\t\t\t$return .= 'cars[\"'.$make_row['make'].'\"] = new Array(\"'.$make_row['id'].'\", new Array(';\n\n\t\t\t$make_row_id = $make_row['id'];\n \t\t$model_q_id = \"SELECT id, model FROM \" . GARAGE_MODELS_TABLE . \" \n \t\t WHERE make_id = $make_row_id ORDER BY model ASC\";\n\n\t\t\tif( !($model_result = $db->sql_query($model_q_id)) )\n\t\t\t{\n\t\t\t\tmessage_die(GENERAL_ERROR, 'Could not query users', '', __LINE__, __FILE__, $sql);\n\t\t\t} \n\n\t \t$model_string = '';\n\t\t\t$model_id_string = '';\n\n\t\t\t// Loop through all the models of this make\n\t\t\twhile ( $model_row = $db->sql_fetchrow($model_result) )\n\t\t\t{\n\t\t\t\t// Create the arrays that we will use in the output\n\t\t\t\t$model_string .= '\"'.$model_row['model'].'\",';\n\t\t\t\t$model_id_string .= '\"'.$model_row['id'] .'\",';\n\t\t\t}\n\t\t\t$db->sql_freeresult($model_result);\n\n\t\t\t// Strip off the last comma\n\t\t\t$model_string = substr($model_string, 0, -1);\n\t\t\t$model_id_string = substr($model_id_string, 0, -1);\n\n\t\t\t// Finish off this makes' row in the output\n\t\t\t$return .= $model_string .\"), new Array(\". $model_id_string .\"));\\n\";\n\t }\n\t\t$db->sql_freeresult($make_result);\n\n\t return $return;\n\t}",
"function LUPE_criar_combo_vet($Vet, $NomeCombo, $PreSelect, $LinhaFixa = ' ', $JS = '', $Style = '')\r\n{\r\n\r\n $numrows = count($Vet);\r\n\r\n echo \"<select id='$NomeCombo' name='$NomeCombo' $JS style='$Style'>\\n\";\r\n\r\n\tif ($LinhaFixa != '')\r\n\t\techo \"<option value=''>$LinhaFixa</option>\\n\";\r\n\r\n if ($numrows == 0) {\r\n\t\techo \"<option value=''>Não há informação no sistema</option>\\n\";\r\n } else {\r\n\t ForEach($Vet as $Chave => $Valor ){\r\n \t\t echo \"<option value='$Chave'\";\r\n\r\n\t\t if ($PreSelect == $Chave)\r\n\t\t\techo 'selected >';\r\n \t\t else\r\n\t\t\techo '>';\r\n\r\n\t \t echo \"$Valor</option>\\n\";\r\n }\r\n }\r\n\r\n echo '</select>';\r\n\r\n return 0;\r\n}",
"function make_regions_dropdown($search_name='',$cat_id=0){\n\t\t$locations\t\t\t\t=$this->get_locations();\n\t\t$home_location\t\t\t=$_SESSION['home_location'];\n\t\t$available_locations\t=array($home_location->location_id=>\"All \".$home_location->name);\n\t\t//---------------------------------------------------\n\t\tswitch($search_name){\n\t\t\tcase 'businesses':\n\t\t\tcase 'categories':\n\t\t\t\t$business=$this->cls('admin/class/business','external');\n\t\t\t\t$s=query(\"SELECT * FROM business_tbl WHERE failte <> -1\");\n\t\t\t\twhile($one=fetch_object($s)){\n\t\t\t\t\t$continue=true;\n\t\t\t\t\t$one->categories\t=$business->load_business_categories($one->business_id);\n\t\t\t\t\t$one->locations\t\t=$business->load_business_locations($one->business_id);\n\t\t\t\t\tif($cat_id){ //if category specified, then filter\n\t\t\t\t\t\tif(isset($one->categories[$cat_id])){\n\t\t\t\t\t\t\t$continue=true;\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t$continue=false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif($continue){\n\t\t\t\t\t\tforeach($one->locations as $location_id=>$loc){\n\t\t\t\t\t\t\t$available_locations[$location_id]=$locations[$location_id];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\t//$this->debug($search_name.\" = \".$cat_id);\n\t\t//$this->writelog();\n\t\t//---------------------------------------------------\n\t\t$form=$this->mod(\"form\")->form_style('block');\n\t\t$form->element(\"location_id\",array(\"db\"=>1,\"type\"=>\"SELECT\",\"label\"=>\"Location\",\"style\"=>\"width:230px;\",\"data\"=>$available_locations));\n\t\t$form->draw();\n\t\t$html=$form->elements[\"location_id\"]->elem;\n\t\t$html=str_replace(\"<br/>\",\"\",$html);\n\t\t//---------------------------------------------------\n\t\treturn $html;\n\t}",
"function build_rr_list_html($selected,$selected_name,$cid)\n\t{\n\t\tglobal $userdata, $template, $db, $SID, $lang, $phpEx, $phpbb_root_path, $garage_config, $board_config;\n\t\n\t\t$rr_list = \"<select name='rr_id' class='forminput'>\";\n\t\n\t\tif (!empty($selected) )\n\t\t{\n\t\t\t$rr_list .= \"<option value='$selected' selected='selected'>$selected_name</option>\";\n\t\t\t$rr_list .= \"<option value=''>------</option>\";\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$rr_list .= \"<option value=''>\".$lang['Select_A_Option'].\"</option>\";\n\t\t}\n\t\n\t\t$sql = \"SELECT id, bhp, bhp_unit FROM \" . GARAGE_ROLLINGROAD_TABLE . \" WHERE garage_id = $cid\";\n\t\n\t\tif( !($result = $db->sql_query($sql)) )\n\t\t{\n\t\t\tmessage_die(GENERAL_ERROR, 'Could not query rollingroad', '', __LINE__, __FILE__, $sql);\n\t\t}\n\t\n\t\twhile ( $rollingroad = $db->sql_fetchrow($result) )\n\t\t{\n\t\t\t$rr_list .= \"<option value='\".$rollingroad['id'].\"'>\".$rollingroad['bhp'].\" BHP @ \".$rollingroad['bhp_unit'].\"</option>\";\n\t\t}\n\t\t$db->sql_freeresult($result);\n\t\t\n\t\t$rr_list .= \"</select>\";\n\t\n\t\t$template->assign_vars(array(\n\t\t\t'RR_LIST' => $rr_list)\n\t\t);\n\t\n\t\treturn;\n\t}",
"function comboNiveles() {\n $opciones = \"\";\n $nvS = new Servicio();\n $niveles = $nvS->listarNivel(); //RETORNA UN ARREGLO\n\n while ($nivel = array_shift($niveles)) {\n $opciones .=\" <option value='\" . $nivel->getId_nivel() . \"'>\" . $nivel->getNombre() . \"</option>\";\n }\n return $opciones;\n}",
"public function buildSelect()\n {\n $this->query->select(\"DISTINCT(p.id),p.*,\n u.first_name as owner_first_name,u.last_name as owner_last_name,\n c.id as company_id,c.name as company_name,IF(p.id=d2.primary_contact_id, 1, 0) AS is_primary_contact\");\n\n $this->query->from(\"#__people AS p\");\n $this->query->leftJoin(\"#__people_cf as cf ON cf.person_id = p.id\");\n $this->query->leftJoin(\"#__users AS u ON u.id = p.owner_id\");\n $this->query->leftJoin(\"#__companies AS c ON c.id = p.company_id\");\n $this->query->leftJoin(\"#__deals AS d ON d.id = cf.association_id AND cf.association_type = 'deal'\");\n $this->query->leftJoin(\"#__deals AS d2 ON d2.primary_contact_id = p.id\");\n\n }",
"function get_name_select_list()\n\t{\n\t\treturn $this->get_name_select_edit();\n\t}",
"protected function _buildListSelect($options)\n\t{\n\t\t$select = array();\n\n\t\t// get options\n\t\t$select[] = ' select *';\n\n\t\t// add from clause\n\t\t$select[] = 'from ' . $this->_getTableName();\n\n\t\t// aggregate clauses\n\t\t$select = (count($select) ? implode(' ', $select) : '');\n\n\t\treturn $select;\n\t}",
"protected function _buildListSelect($options)\n\t{\n\t\t$select = array();\n\n\t\t// get the layout option from params\n\t\t$layout = $this->_getOption('layout', $options);\n\t\t$getMetaData = $this->_getOption('getMetaData', $options, false);\n\t\t$getPageId = $this->_getOption('getPageId', $options, false);\n\n\t\t// in some case, we only need a simple list of urls, with no\n\t\t// counting of additionnal date, pageids, aliases, etc\n\t\t$simpleUrlList = $this->_getOption('simpleUrlList', $options, false);\n\t\tif ($simpleUrlList)\n\t\t{\n\t\t\t$s = ' select distinct u1.*';\n\t\t\t$s .= $getMetaData ? ', m.newurl as nonsefurl, m.id as metaid, m.metatitle as metatitle, m.metadesc as metadesc, m.metakey as metakey, m.metalang as metalang, m.metarobots as metarobots, m.canonical as canonical' : '';\n\t\t\t$s .= $getPageId ? ', p.newurl as nonsefurl, p.pageid as pageid, p.id as pageidid, p.type as pageidtype, p.hits as pageidhits' : '';\n\t\t\t$select[] = $s;\n\t\t\t// add from clause\n\t\t\tif ($getPageId)\n\t\t\t{\n\t\t\t\t$select[] = 'from ' . $this->_db->quoteName('#__sh404sef_pageids') . ' as p';\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$select[] = 'from ' . $this->_db->quoteName('#__sh404sef_urls') . ' as u1';\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// regular query, with all bells and whistles\n\t\t\tswitch ($layout)\n\t\t\t{\n\t\t\t\tcase 'export' :\n\t\t\t\t\t$s = ' select distinct u1.*';\n\t\t\t\t\t$s .= $getMetaData ? ',m.newurl as nonsefurl, m.id as metaid, m.metatitle as metatitle, m.metadesc as metadesc, m.metakey as metakey, m.metalang as metalang, m.metarobots as metarobots, m.canonical as canonical' : '';\n\t\t\t\t\t$select[] = $s;\n\t\t\t\t\t// add from clause\n\t\t\t\t\t$select[] = 'from ' . $this->_getTableName() . ' as d, ' . $this->_getTableName() . ' as u1 ';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'view404':\n\t\t\t\t\t$select[] = ' select distinct u1.*';\n\t\t\t\t\t// add from clause\n\t\t\t\t\t$select[] = 'from ' . $this->_getTableName() . ' as u1 ';\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\t$s = ' select distinct u1.*, count(d.`id`)-1 as duplicates, count(m.`id`) as metas';\n\t\t\t\t\t$s .= $getMetaData ? ', m.newurl as nonsefurl, m.id as metaid, m.metatitle as metatitle, m.metadesc as metadesc, m.metakey as metakey, m.metalang as metalang, m.metarobots as metarobots, m.canonical as canonical' : '';\n\t\t\t\t\t$select[] = $s;\n\t\t\t\t\t// add from clause\n\t\t\t\t\t$select[] = 'from ' . $this->_getTableName() . ' as d, ' . $this->_getTableName() . ' as u1 ';\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// aggregate clauses\n\t\t$select = (count($select) ? implode(' ', $select) : '');\n\n\t\treturn $select;\n\t}",
"function getNameOptions(){\n $db = JFactory::getDBO();\n $query = $db->getQuery(true);\n \n // Select some fields\n //$query->select('DISTINCT name');\n $query->select('name');\n // From the hello table\n $query->from('#__helloworld_message');\n\t\t\t\t\n\t\t\t\t$db->setQuery($query);\n\t\t\t\t$result = $db->loadObjectList();\n\t\t\t\n\t\t\tforeach($result as $item){\n\t\t\t\t$name = $item->name;\n\t\t\t\t$filter_name_options[] = JHTML::_('select.option', $name , $name);\n\t\t\t\t}\n\t\t\treturn $filter_name_options;\n\t\t\t\n\t\t\t}",
"public function getNewChildSelectOptions()\n {\n $prefix = 'enterprise_customersegment/segment_condition_customer_address_';\n $result = array_merge_recursive(parent::getNewChildSelectOptions(), array(\n array(\n 'value' => $this->getType(),\n 'label' => Mage::helper('enterprise_customersegment')->__('Conditions Combination')\n ),\n Mage::getModel($prefix.'default')->getNewChildSelectOptions(),\n Mage::getModel($prefix.'attributes')->getNewChildSelectOptions(),\n ));\n return $result;\n }",
"public function vehicles(){\n\n\t\t\t$vehicles = DB::table('logistics_vehicles')\n\t\t\t\t->join('vehicle_types','logistics_vehicles.type', '=', 'vehicle_types.id')\n\t\t\t\t//->where('logistics_vehicles.tenant_id', Auth::user()->tenant_id)\n\t\t\t\t->where('logistics_vehicles.status', '=', 1)\n\t\t\t\t->orderBy('logistics_vehicles.status', 'DESC')\n\t\t\t\t->orderBy('logistics_vehicles.id', 'DESC')\n\t\t\t\t->get();\n\n\t\t\treturn view('backend.logistics.vehicles', ['vehicles' => $vehicles]);\n\t\t}"
]
| [
"0.7584048",
"0.66605157",
"0.605245",
"0.6036802",
"0.5951677",
"0.5943212",
"0.5908782",
"0.5883085",
"0.5868457",
"0.5715422",
"0.570622",
"0.5702444",
"0.5682596",
"0.5668327",
"0.5666378",
"0.5661099",
"0.56583834",
"0.5655364",
"0.5651713",
"0.5647812",
"0.56468326",
"0.56376475",
"0.56355315",
"0.56230426",
"0.5617502",
"0.5606371",
"0.55912465",
"0.55887365",
"0.5585344",
"0.5561287"
]
| 0.78088266 | 0 |
Get the colPos from a content element in the database | protected function getColPosFromDatabase($contentElementUid)
{
$queryResult = $this->getDatabaseConnection()->sql_query(
'SELECT colPos FROM tt_content WHERE uid =' . $contentElementUid
);
/** @var array $contentElement */
$contentElement = $this->getDatabaseConnection()->sql_fetch_assoc($queryResult);
$this->getDatabaseConnection()->sql_free_result($queryResult);
return (int)$contentElement['colPos'];
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getPositionColumn();",
"public function columnOffset();",
"protected function getPositionColumn()\n {\n return $this->positionColumn ?? 'position';\n }",
"public function getColumn(){\n\n $part = substr($this->input, 0, $this->index);\n $pos = strrpos($part,\"\\n\");\n return $this->index - $pos;\n }",
"protected function getLayoutColPosVals()\n {\n $select_fields = 'uid, config';\n $where = 'deleted = 0';\n $orderBy = 'uid';\n $table = 'tx_gridelements_backend_layout';\n $resource = $this->execSelect($select_fields, $where, $orderBy, $table);\n if ($resource === false) {\n $this->results['error'] = 'error_no_ge_config';\n return 0;\n }\n\n $layoutColPosVals = array();\n while ($row = $GLOBALS[\"TYPO3_DB\"]->sql_fetch_assoc($resource)) {\n $pattern = '/colPos\\s*=\\s*\\d+/';\n $matches = array();\n preg_match_all($pattern, $row['config'], $matches);\n\n $colPosVals = preg_replace('/colPos\\s*=\\s*/', '', $matches[0]);\n $layoutColPosVals[$row['uid']] = $colPosVals;\n }\n return $layoutColPosVals;\n }",
"function getColumnIndex($colName){\n\t\tfor ($i = 0; $i < count($this->m_descs); $i++){\n\t\t\t$desc = $this->m_descs[$i];\n\t\t\tif (0 == strcmp($colName, $desc->getColName())){\n\t\t\t\treturn $i;\n\t\t\t}\n\t\t}\n return -1;\n\t}",
"public function getStartColumn()\n {\n return $this->start_column;\n }",
"public function position()\n\t{\n\t\treturn $this->getField('position');\n\t}",
"public function column() : int\n {\n return $this->column;\n }",
"public function getFirstCol() : int\n {\n\n // Convert A1:D3 to A1.\n list($startRef,) = explode(':', $this->getTableNode()->getAttribute('ref'));\n\n // Convert A1 to 1.\n $startCol = preg_replace('/([0-9])/', '', $startRef);\n\n return XlsxTools::convRefToNumber($startCol);\n }",
"public function getColumn(): string;",
"private function getPositionSubSql() {\n\t\t$table = $this->query->getTableMap()::TABLE_NAME;\n\t\t$col = Model::aliasproperty('id');\n\t\t$sql = \"SELECT $col, @rownum := @rownum + 1 AS position FROM $table\";\n\t\t$whereClause = $this->getWhereClauseString();\n\n\t\tif (empty($whereClause) === false) {\n\t\t\t$sql .= ' WHERE ' . $whereClause;\n\t\t}\n\t\treturn $sql;\n\t}",
"protected function loadDocCommentPos(): ?int\n {\n $docHelper = $this->getDocHelper();\n\n return $docHelper->hasDocBlock() ? $docHelper->getBlockStartPosition() : null;\n }",
"public function _getColPos($colname, $cols)\n {\n /* Make sure array is not empty, and the parameter is an array */\n if (empty($cols) || !is_array($cols) || !array_key_exists($colname, $cols)) {\n return false;\n }\n\n unset($cols['primary']);\n\n /* Get the index for the column */\n if (($position = array_search($colname, array_keys($cols))) === false) {\n return false;\n }\n\n return $position;\n }",
"public function getPosition() : int\n {\n $rtn = $this->data['position'];\n\n return $rtn;\n }",
"public function ColCount() {\n return $this->_coln;\n }",
"protected function transferNestedColumnPosition()\n {\n $select_fields = 'tx_multicolumn_parentid, colPos';\n $where = 'tx_multicolumn_parentid > 0 AND deleted = 0';\n $resource = $this->execSelect($select_fields, $where);\n if ($resource === false) {\n $this->results['error'] = 'error_no_mc_contents';\n return false;\n }\n\n // Find colPos values used for elements in multicolum containers\n $mcColPosValsPerParent = array();\n while ($row = $GLOBALS[\"TYPO3_DB\"]->sql_fetch_assoc($resource)) {\n $mcpid = $row['tx_multicolumn_parentid'];\n if (!isset($mcColPosValsPerParent[$mcpid])) {\n $mcColPosValsPerParent[$mcpid] = array(\n 'colPosVals' => array(),\n 'geLayout' => '',\n );\n }\n $mcColPosValsPerParent[$mcpid]['colPosVals'][] = $row['colPos'];\n }\n $GLOBALS[\"TYPO3_DB\"]->sql_free_result($resource);\n\n // Update colPos values\n foreach ($mcColPosValsPerParent as $mcpid => &$array) {\n $array['colPosVals'] = array_unique($array['colPosVals']);\n $select_fields = 'uid, tx_gridelements_backend_layout';\n $where = 'uid = ' . $mcpid;\n $resource = $this->execSelect($select_fields, $where);\n if ($resource === false) {\n continue; // Parent container doesn't exist anymore.\n }\n\n while ($row = $GLOBALS[\"TYPO3_DB\"]->sql_fetch_assoc($resource)) {\n $array['geLayout'] = $row['tx_gridelements_backend_layout'];\n }\n $GLOBALS[\"TYPO3_DB\"]->sql_free_result($resource);\n }\n\n $layoutColPosVals = $this->getLayoutColPosVals();\n foreach ($mcColPosValsPerParent as $mcpid => $array) {\n $i = 0;\n foreach ($array['colPosVals'] as $colPos) {\n $where = 'tx_multicolumn_parentid = ' . $mcpid\n . ' AND colPos = ' . $colPos;\n $geColumn = $i + 100;\n $geColPos = -2; // Column NOT available in GE layout\n if (isset($layoutColPosVals[$array['geLayout']][$i])) {\n $geColumn = $layoutColPosVals[$array['geLayout']][$i];\n $geColPos = -1; // Column available in GE layout\n }\n $fields_values = array(\n 'colPos' => $geColPos,\n 'backupColPos' => $colPos,\n 'tx_gridelements_columns' => $geColumn,\n );\n $this->execUpdate($where, $fields_values);\n ++$i;\n }\n }\n $this->results['transferNestedColumnPosition'] = true;\n return true;\n }",
"public function getCol()\n {\n return $this->col;\n }",
"public function getCurrentSortedColumn()\n {\n return $this->_currentSortedColumn;\n }",
"public static function columnNumber($col) {\n $col = str_pad($col,2,'0',STR_PAD_LEFT);\n $i = ($col{0} == '0') ? 0 : (ord($col{0}) - 64) * 26;\n $i += ord($col{1}) - 64;\n return $i;\n }",
"protected function getDocCommentPos()\n {\n if ($this->docCommentPos === false) {\n $this->docCommentPos = $this->loadDocCommentPos();\n }\n\n return $this->docCommentPos;\n }",
"public function fetchColumn($columnIndex = 0);",
"public function getColumn()\n {\n return $this->column;\n }",
"public function getColumn()\n {\n return $this->column;\n }",
"public function getRowOffset();",
"public function getPosition() {\n return $this->getValue('position');\n }",
"function getCol($sql){\n\t\t$res_array = $this->query($sql);\n\t\tif (array_key_exists(0, $res_array) AND array_key_exists(0, $res_array[0])){\n\t\t\treturn $res_array[0][0];\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}",
"public function getLastCol() : int\n {\n\n // Convert A1:D3 to D3.\n list(,$endRef) = explode(':', $this->getTableNode()->getAttribute('ref'));\n\n // Convert D3 to 4.\n $endCol = preg_replace('/([0-9])/', '', $endRef);\n\n return XlsxTools::convRefToNumber($endCol);\n }",
"public function getLastColumnPosition($project_id)\n {\n return (int) $this->db\n ->table(self::TABLE)\n ->eq('project_id', $project_id)\n ->desc('position')\n ->findOneColumn('position');\n }",
"public function getColumn() { return $this->column; }"
]
| [
"0.76174587",
"0.7289113",
"0.68652093",
"0.66942096",
"0.6408288",
"0.6118814",
"0.6085125",
"0.6034319",
"0.5988009",
"0.5843853",
"0.58199114",
"0.5746704",
"0.5730189",
"0.57267284",
"0.57145965",
"0.56802636",
"0.5676263",
"0.5662575",
"0.5657394",
"0.56508076",
"0.5646389",
"0.5615805",
"0.5587596",
"0.5587596",
"0.5579404",
"0.5562944",
"0.55618596",
"0.55523014",
"0.55472046",
"0.5541698"
]
| 0.73617625 | 1 |
Retrieves the Role manager to use. | public static function get() {
static $manager = null;
if ( $manager === null ) {
if ( function_exists( 'wpcom_vip_add_role' ) ) {
$manager = RoleManagerVIP::get_instance();
}
if ( ! function_exists( 'wpcom_vip_add_role' ) ) {
$manager = RoleManagerWP::get_instance();
}
}
return $manager;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getRole()\n {\n return $this->hasOne(Role::className(), ['id' => 'role_id']);\n }",
"public function getManager()\n {\n return $this->manager;\n }",
"public function getManager()\n {\n return $this->manager;\n }",
"public function getManager()\n {\n return $this->manager;\n }",
"protected function getManager()\n {\n return $this->manager;\n }",
"public function getManager() {\n return $this->manager;\n }",
"public function getROLE()\n {\n return $this->hasOne(Role::className(), ['id' => 'ROLE']);\n }",
"public function getRoleModel()\n\t{\n\t\treturn $this->roleModel = new RoleModel();\n\t}",
"public static function getRoleModel()\n {\n return static::getModel('Roles');\n }",
"protected function getObjectManager()\n {\n return $this->managerRegistry->getManager($this->managerName);\n }",
"public function getRole(){\n\t\tif (current_user_can('editor')) {\n\t\t\t$this->role_object = get_role('editor');\n\t\t}\n\t}",
"public function getRole()\n {\n $res = $this->getEntity()->getRole();\n\t\tif($res === null)\n\t\t{\n\t\t\tSDIS62_Model_DAO_Abstract::getInstance($this::$type_objet)->create($this);\n\t\t\treturn $this->getEntity()->getRole();\n\t\t}\n return $res;\n }",
"public function getRole() {\n $user = new Pas_User_Details();\n $person = $user->getPerson();\n if ($person) {\n $this->_role = $person->role;\n } \n return $this->_role;\n }",
"public function getRole()\n\t{\n\t\tif ($this->roles->count())\n\t\t\treturn $this->roles[0]->name;\n\n\t\treturn null;\n\t}",
"function getRole()\n\t{\n\t\tif (($role = $this->getState('__role')) !== null)\n\t\t\treturn $this->role;\n\t\telse\n\t\t\treturn 0;\n\t}",
"public function role()\n {\n return $this->hasOne('Role', 'id', 'role_id');\n }",
"public function role()\n {\n return $this->hasOne('App\\Models\\Role');\n }",
"public function getRole()\n {\n return $this->role;\n }",
"public function getRole()\n {\n return $this->role;\n }",
"public function getRole()\n {\n return $this->role;\n }",
"public function getRole()\n {\n return $this->role;\n }",
"public function getRole()\n {\n return $this->role;\n }",
"public function getRole()\n {\n return $this->role;\n }",
"public function getRole()\n {\n return $this->role;\n }",
"public function getRole()\n {\n return $this->role;\n }",
"public function getRole()\n {\n return $this->role;\n }",
"public function getRole()\n {\n return $this->role;\n }",
"public function getRole() {\n return($this->role);\n }",
"public function role()\n {\n return $this->hasOne('App\\Models\\Role', 'id', 'role_id');\n }",
"function getRole()\n {\n return $this->role;\n }"
]
| [
"0.6890441",
"0.68621635",
"0.68621635",
"0.68621635",
"0.6841516",
"0.6753865",
"0.6740957",
"0.66282755",
"0.65834385",
"0.64943206",
"0.6446718",
"0.6436054",
"0.6425184",
"0.64227283",
"0.6413139",
"0.63930273",
"0.6382889",
"0.6354982",
"0.6354982",
"0.6354982",
"0.6354982",
"0.6354982",
"0.6354982",
"0.6354982",
"0.6354982",
"0.6354982",
"0.6354982",
"0.6347689",
"0.63311684",
"0.6319472"
]
| 0.8018739 | 0 |
Composes and returns mail object | function getMail() {
if ($this->_mail === false) {
$rcpt = $this->getRecipients();
if ($rcpt) {
$this->_mail = new Ac_Mail_Message(false, $rcpt, $this->subject, $this->from);
Ac_Util::simpleBind($this->mailExtraSettings, $this->_mail);
if ($this->replyTo) $this->_mail->replyTo = $this->replyTo;
$this->_template->currentSendout = $this;
$this->_mail->htmlBody = $this->_template->fetch($this->templatePart);
} else $this->_mail = null;
}
return $this->_mail;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function createMailMessage();",
"private function clone_mail()\n {\n return clone $this->mail_transport;\n }",
"public static function createInstance()\n {\n return new MailMessage('[email protected]');\n }",
"function get () {\n $this->_build_mail();\n\n $mail = 'To: '.$this->xheaders['To'].\"\\n\";\n $mail .= 'Subject: '.$this->xheaders['Subject'].\"\\n\";\n $mail .= $this->headers . \"\\n\";\n $mail .= $this->full_body;\n return $mail;\n }",
"function _instanceMail($smtp) {\n\n require_once 'Mail.php';\n\n/*\n $params = array(\n 'sendmail_path' => '/usr/lib/sendmail',\n 'host' => 'localhost'\n );\n\n $mail_obj = Mail::factory('sendmail', $params);\n*/\n // seteo del smtp\n $params = array(\n 'host' => $smtp\n );\n\n $mail_obj = Mail::factory('smtp', $params);\n\n return $mail_obj;\n }",
"public function toMail(): MailMessage\n {\n return tap(static::makeMailMessage(), function (MailMessage $message) {\n $message->subject(__('Successful new backup of :application_name', [\n 'application_name' => $this->applicationName(),\n ]));\n\n $this->getBackupDestinations()->each(function (BackupDestination $destination) use ($message) {\n $message->line(__('Great news, a new backup of :application_name was successfully created on the disk named :disk_name.', [\n 'application_name' => $this->applicationName(),\n 'disk_name' => $destination->diskName(),\n ]));\n\n $this->backupDestinationProperties($destination)->each(function ($value, $name) use ($message) {\n $message->line(\"{$name}: $value\");\n });\n });\n });\n }",
"public static function factory()\n\t\t{\n\t\t\t// crea la nuova istanza della classe Mail e la ritorna\n\t\t\treturn new Mailer();\n\t\t}",
"protected function prepare_mail()\n {\n // Subject\n $subject_text = $this->subject;\n $subject = '=?UTF-8?B?' . base64_encode($subject_text) . '?=';\n\n // Message\n $message = ($this->message);\n\n // To\n $to = '';\n\n foreach($this->to as $item){\n if(empty($item[1])){\n $to .= $item[0];\n }else {\n $to .= '=?UTF-8?B?' . base64_encode($item[1]) . '?= <'.$item[0].'>';\n }\n }\n\n // From\n $from = '';\n\n if(empty($this->from[1])){\n $from .= $this->from[0];\n }else {\n $from .= '=?UTF-8?B?' . base64_encode($this->from[1]) . '?= <'.$this->from[0].'>';\n }\n\n // Reply\n $reply = '';\n\n foreach($this->reply as $item){\n if(empty($item[1])){\n $reply .= $item[0];\n }else {\n $reply .= '=?UTF-8?B?' . base64_encode($item[1]) . '?= <'.$item[0].'>';\n }\n }\n\n if(!empty($reply)){\n $header_reply = 'Reply-To: ' . $reply . \"\\r\\n\"; // Reply-To\n }else{\n $header_reply='';\n }\n\n // CC\n $cc = '';\n\n foreach($this->cc as $item){\n if(empty($item[1])){\n $cc .= $item[0];\n }else {\n $cc .= '=?UTF-8?B?' . base64_encode($item[1]) . '?= <'.$item[0].'>';\n }\n }\n\n if(!empty($cc)){\n $header_cc = 'Cc: ' . $cc . \"\\r\\n\"; // Cc\n }else{\n $header_cc='';\n }\n\n // BCC\n $bcc = '';\n\n foreach($this->bcc as $item){\n if(empty($item[1])){\n $bcc .= $item[0];\n }else {\n $bcc .= '=?UTF-8?B?' . base64_encode($item[1]) . '?= <'.$item[0].'>';\n }\n }\n\n if(!empty($cc)){\n $header_bcc = 'Bcc: ' . $bcc . \"\\r\\n\"; // Bcc\n }else{\n $header_bcc = '';\n }\n\n // Type\n if($this->isHtml){\n $type = \"text/html\";\n }else{\n $type = \"text/plain\";\n }\n\n // Headers\n $headers = '';\n $headers .= 'From: ' . $from . \"\\r\\n\"; // From\n $headers .= 'MIME-Version: 1.0' . \"\\r\\n\"; // MIME\n $headers .= $header_reply; // Reply-To\n $headers .= $header_cc; // CC\n $headers .= $header_bcc; // BCC\n $headers .= 'X-Mailer: PHP/' . phpversion(); // Mailer\n\n // Attachments \n $files = $this->attachment; \n\n // Boundary \n $semi_rand = md5(time()); \n $mime_boundary = \"==Multipart_Boundary_x{$semi_rand}x\"; \n \n // Headers for attachment \n $headers .= \"\\nContent-Type: multipart/mixed;\\n\" . \" boundary=\\\"{$mime_boundary}\\\"\"; \n \n // Multipart boundary \n $message = \"--{$mime_boundary}\\n\" . \"Content-Type: $type; charset=\\\"UTF-8\\\"\\n\" . \n \"Content-Transfer-Encoding: 7bit\\n\\n\" . $message . \"\\n\\n\"; \n \n // Preparing attachment \n if(!empty($files)){ \n for($i=0;$i<count($files);$i++){ \n if(is_file($files[$i])){ \n $file_name = basename($files[$i]); \n $file_size = filesize($files[$i]); \n \n $message .= \"--{$mime_boundary}\\n\"; \n $fp = @fopen($files[$i], \"rb\"); \n $data = @fread($fp, $file_size); \n @fclose($fp); \n $data = chunk_split(base64_encode($data)); \n $message .= \"Content-Type: application/octet-stream; name=\\\"\".$file_name.\"\\\"\\n\" . \n \"Content-Description: \".$file_name.\"\\n\" . \n \"Content-Disposition: attachment;\\n\" . \" filename=\\\"\".$file_name.\"\\\"; size=\".$file_size.\";\\n\" . \n \"Content-Transfer-Encoding: base64\\n\\n\" . $data . \"\\n\\n\"; \n } \n } \n } \n \n $message .= \"--{$mime_boundary}--\"; \n\n return compact(\"subject\", \"message\", \"to\", \"headers\");\n }",
"protected function createMailDriver()\n {\n return MailTransport::newInstance();\n }",
"public function getMail()\n {\n if (null === $this->_transport) {\n\n $options = $this->getOptions();\n\n foreach ($options as $key => $option) {\n $options[strtolower($key)] = $option;\n }\n\n $this->setOptions($options);\n\n if (isset($options['transport']) &&\n !is_numeric($options['transport'])\n ) {\n $this->_transport = $this->_setupTransport(\n $options['transport']\n );\n\n if (!isset($options['transport']['register']) ||\n $options['transport']['register'] == '1' ||\n (isset($options['transport']['register']) &&\n !is_numeric($options['transport']['register']) &&\n (bool) $options['transport']['register'] == true)\n ) {\n Xulub_Mail::setDefaultTransport($this->_transport);\n }\n }\n\n $this->_setDefaults('from');\n $this->_setDefaults('replyTo');\n $this->_setDefaults('bcc');\n }\n\n return $this->_transport;\n }",
"public function toMail(): MailMessage\n {\n return (new MailMessage())\n ->subject('There is created an login for u on '.config('app.name'))\n ->greeting('Hello,')\n ->line('A administrator has created an login for u on '.config('app.name'))\n ->line('You can login with the following password: '.$this->input['password'])\n ->action('login', route('login'));\n }",
"public function getContent(): MailingContent\n {\n return new MailingContent();\n }",
"public function prepareEmail($message)\n {\n $fromEmail = array_keys($message->getFrom())[0];\n $fromName = (is_null($message->getFrom())) ? null : array_values($message->getFrom())[0];\n $toEmail = array_keys($message->getTo())[0];\n $toName = (is_null($message->getTo())) ? null : array_values($message->getTo())[0];\n $replyToEmail = (is_null($message->getReplyTo())) ? null : array_keys($message->getReplyTo())[0];\n\n // Following RFC 1341, section 7.2, if either text/html or text/plain are to be sent in your email: text/plain needs to be first\n // So, use array_shift instead of array_pop\n $parts = array_map(function ($part) {\n return new Content($part->getContentType(), $part->getBody());\n }, $message->getChildren());\n\n $mail = new Mail(\n new Email($fromName, $fromEmail),\n $message->getSubject(),\n new Email($toName, $toEmail),\n array_shift($parts)\n );\n\n // set Reply-To header\n $mail->setReplyTo(['email' => $replyToEmail]);\n\n foreach($parts as $part) {\n $mail->addContent($part);\n }\n\n $preserved = [\n \"Content-Transfer-Encoding\",\n \"Content-Type\",\n \"MIME-Version\",\n \"Date\",\n \"Message-ID\",\n \"From\",\n \"Subject\",\n \"To\",\n \"Reply-To\",\n \"Subject\",\n \"From\"\n ];\n\n foreach($message->getHeaders()->getAll() as $header) {\n if (!in_array($header->getFieldName(), $preserved)) {\n $mail->addHeader($header->getFieldName(), $header->getFieldBody());\n }\n }\n\n // to track bounce/feedback notification\n $mail->addCustomArg(\"runtime_message_id\", $message->getHeaders()->get('X-Acelle-Message-Id')->getFieldBody());\n\n return $mail;\n }",
"private function _build_mail () {\n if (empty($this->sendto) && (empty($this->body) && empty($this->htmlbody))) {\n throw new Exception(\"Cannot send, need more information\");\n }\n\n // build the headers\n $this->headers = \"\";\n\n $this->xheaders['To'] = implode(',', $this->sendto);\n\n $cc_header_name = ($this->apply_windows_bugfix) ? 'cc': 'Cc';\n if (!empty($this->sendcc)) $this->xheaders[$cc_header_name] = implode(',', $this->sendcc);\n if (!empty($this->sendbcc)) $this->xheaders['Bcc'] = implode(',', $this->sendbcc);\n\n if($this->receipt) {\n if(isset($this->xheaders['Reply-To'])) {\n $this->xheaders['Disposition-Notification-To'] = $this->xheaders['Reply-To'];\n }\n elseif (isset($this->xheaders['From'])) {\n $this->xheaders['Disposition-Notification-To'] = $this->xheaders['From'];\n }\n }\n\n if($this->charset != '') {\n $this->xheaders['Mime-Version'] = '1.0';\n $this->xheaders['Content-Type'] = 'text/plain; charset='.$this->charset;\n $this->xheaders['Content-Transfer-Encoding'] = $this->ctencoding;\n }\n\n if (!$this->xheaders['X-Mailer']) {\n $this->xheaders['X-Mailer'] = 'King-Fu MimeMail';\n }\n\n // setup the body ready for sending\n $this->_set_body();\n\n foreach ($this->xheaders as $head => $value) {\n $rgx = ($this->apply_windows_bugfix) ? 'Subject' : 'Subject|To'; // don't strip out To header for bugfix\n if (!preg_match('/^'.$rgx.'$/i', $head)) $this->headers .= $head.': '.strtr($value, \"\\r\\n\", ' ').\"\\n\";\n }\n }",
"function Get()\r\n\t\t{\r\n\t\t$this->_build_headers();\r\n\t\tif( sizeof( $this->aattach ) > 0 )\r\n\t\t\t{\r\n\t\t\t$this->_build_attachement();\r\n\t\t\t$this->body= $this->body . $this->attachment;\r\n \t}\r\n\t\t$mail = $this->headers;\r\n\t\t$mail .= \"\\n$this->body\";\r\n\t\treturn $mail;\r\n\t\t}",
"public function compose() {\n return $this->createMessage();\n }",
"function enviarEmail($assunto, $descrição, $emailDe, $nomeDe, $emailPara, $nomePara)\n {\n $mail = new PHPMailer();\n // Define os dados do servidor e tipo de conexão\n // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n $mail->IsSMTP(); // Define que a mensagem será SMTP\n $mail->Host = \"mail.codeboys.pt\"; // Endereço do servidor SMTP\n $mail->SMTPAuth = true; // Autenticação\n $mail->Username = '[email protected]'; // Usuário do servidor SMTP\n $mail->Password = 'codeboys2016'; // Senha da caixa postal utilizada\n // Define o remetente\n // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n $mail->From = $emailDe; // Seu e-mail\n $mail->FromName = $nomeDe; // Seu nome\n // Define os destinatário(s)\n // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n //$mail->AddAddress('[email protected]', 'Luis Filipe');\n $mail->AddAddress($emailPara, $nomePara);\n /* $sql1 = \"select email from utilizador where id='$idMaterial' and hospital='$hospital' and utilizado=0\";\n $resultado1=$this->bd->executarSQL($sql1);\n while ($row = $resultado1->fetch(PDO::FETCH_ASSOC)) {\n\n }*/\n// $mail->AddAddress('[email protected]');\n //$mail->AddCC('[email protected]', 'Ciclano'); // Copia\n //$mail->AddBCC('[email protected]', 'Fulano da Silva'); // Cópia Oculta\n // Define os dados técnicos da Mensagem\n // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n $mail->IsHTML(true); // Define que o e-mail será enviado como HTML\n //$mail->CharSet = 'iso-8859-1'; // Charset da mensagem (opcional)\n // Define a mensagem (Texto e Assunto)\n // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n $mail->Subject = utf8_decode($assunto); // Assunto da mensagem\n $mail->Body = utf8_decode($descrição);\n $mail->AltBody = utf8_decode($assunto);\n // Define os anexos (opcional)\n // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n //$mail->AddAttachment(\"c:/temp/documento.pdf\", \"novo_nome.pdf\"); // Insere um anexo\n // Envi a o e-mail\n $enviado = $mail->Send();\n // Limpa os destinatários e os anexos\n $mail->ClearAllRecipients();\n $mail->ClearAttachments();\n // Exibe uma mensagem de resultado\n if ($enviado) {\n// echo \"E-mail enviado com sucesso!\";\n return true;\n } else {\n// echo \"Não foi possível enviar o e-mail.\";\n// echo \"<b>Informações do erro:</b> \" . $mail->ErrorInfo;\n return $mail->ErrorInfo;\n }\n }",
"public function createMimeMessage();",
"protected function create_notification_email_object()\n\t{\n\t\t$category = $this->category();\n\n\t\t$email = new Charcoal_Email;\n\t\t$email->to = $this->get_notified_email_address();\n\t\t$email->reply_to = $this->get_lead_email_address();\n\n\t\tif ( $category ) {\n\t\t\t$email->subject = $category->p('confirmation_email_subject')->text();\n\t\t\t$email->from = $category->p('confirmation_email_from')->text();\n\t\t\t$email->cc = $category->v('confirmation_email_cc');\n\t\t\t$email->bcc = $category->v('confirmation_email_bcc');\n\t\t}\n\n\t\treturn $email;\n\t}",
"public function build() {\n\n //validate\n if (!$this->data instanceof \\App\\Models\\EmailQueue) {\n return;\n }\n\n //[attachement] send emil with an attahments\n if (is_array($this->attachment)) {\n return $this->from(config('system.settings_email_from_address'), config('system.settings_email_from_name'))\n ->subject($this->data->emailqueue_subject)\n ->with([\n 'content' => $this->data->emailqueue_message,\n ])\n ->view('pages.emails.template')\n ->attach($this->attachment['filepath'], [\n 'as' => $this->attachment['filename'],\n 'mime' => 'application/pdf',\n ]);\n } else {\n //[no attachment] send email without any attahments\n return $this->from(config('system.settings_email_from_address'), config('system.settings_email_from_name'))\n ->subject($this->data->emailqueue_subject)\n ->with([\n 'content' => $this->data->emailqueue_message,\n ])\n ->view('pages.emails.template');\n }\n }",
"public function build()\n {\n return $this->from($this->mailData [\"from_address\"])->subject($this->mailData[\"subject\"])->view('emails.rappel-rdv');\n }",
"public function compose_mail_modal()\n {\n $str = '<div class=\"modal fade\" id=\"newmail-modal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\">';\n $str .= '<div class=\"credential-panel\" id=\"newmail-panel\">';\n $str .= '<div class=\"credential-form\" id=\"newmail-form\">';\n $str .= '<h2 class=\"sign-in font-24 modal-header mail_subject\" id = \"modal-header\">New Message</h2>';\n $str .= '</br>';\n\n $str .= '<label class=\"credential-label\" style=\"margin-top: 0px\">To:</label>';\n $str .= '<input class=\"newmail-credential\" id=\"newmail_receiver\" type=\"text\">';\n\n $str .= '<label class=\"credential-label\">Subject:</label>';\n $str .= '<input class=\"newmail-credential\" id=\"newmail_subject\" type=\"text\">';\n\n $str .= '<label class=\"credential-label\">Message:</label>';\n $str .= '<textarea class=\"newmail-textarea\" rows=\"8\" cols=\"50\" id=\"newmail_body\"></textarea>';\n\n $str .= '<input type=\"submit\" class=\"btn-default register-button\" id=\"newmail_send\" value=\"Send\" onclick=\"sendMail();\">';\n $str .= '</div>';\n $str .= '</div>';\n $str .= '</div>';\n return $str;\n }",
"public function getMailInterface()\n {\n return $this->getInnerInterface();\n }",
"public function mail()\n\t{\n\t\treturn $this->_mail;\n\t}",
"public function getMail();",
"function Email($from=\"\", $to=\"\", $cc=\"\", $bcc=\"\", $subject=\"\", $smtp_server=EMAIL_SMTP_SERVER, $smtp_port=EMAIL_SMTP_PORT, $pop3_user=EMAIL_POP3_USER, $pop3_pass=EMAIL_POP3_PASS, $pop3_server=EMAIL_POP3_SERVER, $pop3_port=EMAIL_POP3_PORT, $socket_timeout=EMAIL_CONNECTION_TIMEOUT) {\n\t\t\n\t\t$this->smtp_server \t= $smtp_server;\n\t\t$this->smtp_port \t= $smtp_port;\n\t\t$this->smtp_fp\t\t= 0;\n\t\t\n\t\t$this->email_from \t= $from;\n\t\t$this->email_to\t\t= $to;\n\t\t$this->email_cc\t\t= $cc;\n\t\t$this->email_bcc\t= $bcc;\n\t\t\n\t\t$this->email_rcptlist\t= array();\n\t\t\n\t\t$this->email_subject\t= $subject;\n\n\t\t$this->email_messages = array();\n\t\t$this->email_attachments = array();\n\t\t\n\t\t$this->email_boundry_message = '_-_Message-Boundry_-_';\n\t\t$this->email_boundry_parts = '_-_Message-Parts_-_';\n\t\t\n\t\t$this->pop3_authenticate = false;\n\t\t\n\t\t$this->pop3_user\t= $pop3_user;\n\t\t$this->pop3_pass\t= $pop3_pass;\n\t\t$this->pop3_server\t= $pop3_server;\n\t\t$this->pop3_port\t= $pop3_port;\n\t\t\n\t\t$this->socket_timeout = $socket_timeout;\n\t\n\t\t$this->debug_mode\t= false;\n\t\t$this->debug_data\t= '';\n\t\t\n\t}",
"public function withTemplate(string $template): TemplatedMailInterface;",
"public static function buildFromContent( $subject, $htmlContent='', $plaintextContent=NULL, $type = 'transactional', $useWrapper=TRUE )\n\t{\n\t\t$email = static::factory( $type );\n\t\t$email->type = $type;\n\t\t$email->subject = $subject;\n\t\t$email->htmlContent = $htmlContent;\n\t\t$email->plaintextContent = ( $plaintextContent === NULL ) ? static::buildPlaintextBody( $htmlContent ) : $plaintextContent;\n\t\t$email->useWrapper = $useWrapper;\n\t\treturn $email;\n\t}",
"abstract protected function _sendMail ( );",
"public function send() {\n $mail = $this->initializeMail();\n $mail->subject = $this->subject; \n $mail->MsgHTML($this->body);\n if($this->is_admin) {\n //send email to the admin\n $mail->setFrom($this->sender->email, $this->sender->name);\n $mail->addAddress(Config::get('app.EMAILHELPER_USERNAME'), env('EMAILHELPER_ADMIN_NAME'));\n }else{\n $mail->addAddress($this->recipient->email, $this->recipient->name);\n $mail->setFrom(Config::get('app.EMAILHELPER_USERNAME'), env('EMAILHELPER_ADMIN_NAME'));\n \n }\n $mail->send();\n return $mail;\n }"
]
| [
"0.6905763",
"0.61797136",
"0.6173315",
"0.6156689",
"0.6069785",
"0.6041911",
"0.59983474",
"0.5963014",
"0.5960338",
"0.5936944",
"0.5922275",
"0.5894485",
"0.58692044",
"0.58519435",
"0.58277094",
"0.5685993",
"0.5683205",
"0.56743014",
"0.56663007",
"0.565762",
"0.5621353",
"0.5606857",
"0.5599704",
"0.5587734",
"0.55584556",
"0.5541277",
"0.55386513",
"0.5533924",
"0.5503622",
"0.54809725"
]
| 0.65684193 | 1 |
process_vb_data, get the VB data to save it in the ra_group_product table | public function process_vb_data ($feed)
{
print $feed; exit;
//Read the data sent from VB
$xml_vb = simplexml_load_string($feed);
$task_id = $xml_vb->attributes()->task_id;
//Create return xml string
$xml = array();
$xml[] = '<?xml version="1.0" encoding="UTF-8"?>';
$xml[] = '<ra_group_products task_id="' . $task_id . '">';
$c = count($xml_vb->ra_group_product);
foreach($xml_vb->ra_group_product as $ra_group_product)
{
$c--;
try
{
//Get the master sku to search the corresponding sku in atomv2 database
$master_sku = $ra_group_product->master_sku;
$master_sku = strtoupper($master_sku);
$sku = $this->sku_mapping_service->get_local_sku($master_sku);
$fail_reason = "";
if ($master_sku == "" || $master_sku == null) $fail_reason .= "No master SKU mapped, ";
if ($sku == "" || $sku == null) $fail_reason .= "SKU not specified, ";
if ($fail_reason == "")
{
$is_delete = $ra_group_product->is_delete;
//Get the external (VB) ra_group_id to search the corresponding row in atomv2 database
if($ra_group_product_ext_atomv2 = $this->get_dao()->get(array("ra_group_id"=>$ra_group_product->ra_group_id, "sku"=>$sku)))
{
$id = $ra_group_product->ra_group_id;
}
//if id exists, update
if ($id != "" && $id != null)
{
if ($is_delete)
{
$d_where["ra_group_id"] = $id;
$d_where["sku"] = $sku;
$this->get_dao()->q_delete($d_where);
$xml[] = '<ra_group_product>';
$xml[] = '<id>' . $ra_group_product->ra_group_id . '</id>';
$xml[] = '<sku>' . $ra_group_product->sku . '</sku>';
$xml[] = '<master_sku>' . $ra_group_product->master_sku . '</master_sku>';
$xml[] = '<status>5</status>'; //updated
$xml[] = '<is_error>' . $ra_group_product->is_error . '</is_error>';
$xml[] = '</ra_group_product>';
}
else
{
//Update the AtomV2 ra_group_product extend data
$where = array("ra_group_id"=>$id, "sku"=>$sku);
$new_ra_group_products_obj = array();
$new_ra_group_products_obj["name"] = $ra_group_product->name;
$this->get_dao()->q_update($where, $new_ra_group_products_obj);
$xml[] = '<ra_group_product>';
$xml[] = '<id>' . $ra_group_product->ra_group_id . '</id>';
$xml[] = '<sku>' . $ra_group_product->sku . '</sku>';
$xml[] = '<master_sku>' . $ra_group_product->master_sku . '</master_sku>';
$xml[] = '<status>5</status>'; //updated
$xml[] = '<is_error>' . $ra_group_product->is_error . '</is_error>';
$xml[] = '</ra_group_product>';
}
}
//if not exists, insert
else
{
$new_ra_group_products_obj = array();
$new_ra_group_products_obj = $this->get_dao()->get();
$new_ra_group_products_obj->set_ra_group_id($ra_group_product->ra_group_id);
$new_ra_group_products_obj->set_sku($sku);
$new_ra_group_products_obj->set_name($ra_group_product->name);
$this->get_dao()->insert($new_ra_group_products_obj);
$xml[] = '<ra_group_product>';
$xml[] = '<id>' . $ra_group_product->ra_group_id . '</id>';
$xml[] = '<sku>' . $ra_group_product->sku . '</sku>';
$xml[] = '<master_sku>' . $ra_group_product->master_sku . '</master_sku>';
$xml[] = '<status>5</status>'; //updated
$xml[] = '<is_error>' . $ra_group_product->is_error . '</is_error>';
$xml[] = '</ra_group_product>';
}
}
elseif ($sku == "" || $sku == null)
{
//if the master_sku is not found in atomv2, we have to store that sku in an xml string to send it to VB
$xml[] = '<ra_group_product>';
$xml[] = '<id>' . $ra_group_product->ra_group_id . '</id>';
$xml[] = '<sku>' . $ra_group_product->sku . '</sku>';
$xml[] = '<master_sku>' . $ra_group_product->master_sku . '</master_sku>';
$xml[] = '<status>2</status>'; //sku not found
$xml[] = '<is_error>' . $ra_group_product->is_error . '</is_error>';
$xml[] = '</ra_group_product>';
}
else
{
$xml[] = '<ra_group_product>';
$xml[] = '<id>' . $ra_group_product->ra_group_id . '</id>';
$xml[] = '<sku>' . $ra_group_product->sku . '</sku>';
$xml[] = '<master_sku>' . $ra_group_product->master_sku . '</master_sku>';
$xml[] = '<status>3</status>'; //not updated
$xml[] = '<is_error>' . $ra_group_product->is_error . '</is_error>';
$xml[] = '</ra_group_product>';
}
}
catch(Exception $e)
{
$xml[] = '<ra_group_product>';
$xml[] = '<id>' . $ra_group_product->ra_group_id . '</id>';
$xml[] = '<sku>' . $ra_group_product->sku . '</sku>';
$xml[] = '<master_sku>' . $ra_group_product->master_sku . '</master_sku>';
$xml[] = '<status>4</status>'; //error
$xml[] = '<is_error>' . $ra_group_product->is_error . '</is_error>';
$xml[] = '</ra_group_product>';
}
}
$xml[] = '</ra_group_products>';
$return_feed = implode("\n", $xml);
return $return_feed;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function processVbData ($feed)\n\t{\n\t\t//print $feed; exit;\n\t\t//Read the data sent from VB\n\t\t$xml_vb = simplexml_load_string($feed);\n\n\t\t$task_id = $xml_vb->attributes()->task_id;\n\n\t\t//Create return xml string\n\t\t$xml = array();\n\t\t$xml[] = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>';\n\t\t$xml[] = '<ra_prod_cats task_id=\"' . $task_id . '\">';\n\n\t\tforeach($xml_vb->ra_prod_cat as $ra_prod_cat)\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tif($ra_prod_cat_obj =$this->getDao('RaProdCat')->get(['ss_cat_id'=>$ra_prod_cat->ss_cat_id]))\n\t\t\t\t{\n\t\t\t\t\t//Update the AtomV2 ra_prod_cat data\n\t\t\t\t\t$ra_prod_cat_obj->setRcmSsCatId1($ra_prod_cat->rcm_ss_cat_id_1);\n\t\t\t\t\t$ra_prod_cat_obj->setRcmSsCatId2($ra_prod_cat->rcm_ss_cat_id_2);\n\t\t\t\t\t$ra_prod_cat_obj->setRcmSsCatId3($ra_prod_cat->rcm_ss_cat_id_3);\n\t\t\t\t\t$ra_prod_cat_obj->setRcmSsCatId4($ra_prod_cat->rcm_ss_cat_id_4);\n\t\t\t\t\t$ra_prod_cat_obj->setRcmSsCatId5($ra_prod_cat->rcm_ss_cat_id_5);\n\t\t\t\t\t$ra_prod_cat_obj->setRcmSsCatId6($ra_prod_cat->rcm_ss_cat_id_6);\n\t\t\t\t\t$ra_prod_cat_obj->setRcmSsCatId7($ra_prod_cat->rcm_ss_cat_id_7);\n\t\t\t\t\t$ra_prod_cat_obj->setRcmSsCatId8($ra_prod_cat->rcm_ss_cat_id_8);\n\t\t\t\t\t$ra_prod_cat_obj->setWarrantyCat($ra_prod_cat->warranty_cat);\n\t\t\t\t\t$ra_prod_cat_obj->setStatus($ra_prod_cat->status);\n\n\t\t\t\t\t$this->getDao('RaProdCat')->update($ra_prod_cat_obj);\n\n\t\t\t\t\t$reason = 'update';\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t//insert ra_prod_cat\n\t\t\t\t\t$ra_prod_cat_obj = new \\RaProdCatVo();//$this->getDao()->get();\n\t\t\t\t\t$ra_prod_cat_obj->setSsCatId($ra_prod_cat->ss_cat_id);\n\t\t\t\t\t$ra_prod_cat_obj->setRcmSsCatId1($ra_prod_cat->rcm_ss_cat_id_1);\n\t\t\t\t\t$ra_prod_cat_obj->setRcmSsCatId2($ra_prod_cat->rcm_ss_cat_id_2);\n\t\t\t\t\t$ra_prod_cat_obj->setRcmSsCatId3($ra_prod_cat->rcm_ss_cat_id_3);\n\t\t\t\t\t$ra_prod_cat_obj->setRcmSsCatId4($ra_prod_cat->rcm_ss_cat_id_4);\n\t\t\t\t\t$ra_prod_cat_obj->setRcmSsCatId5($ra_prod_cat->rcm_ss_cat_id_5);\n\t\t\t\t\t$ra_prod_cat_obj->setRcmSsCatId6($ra_prod_cat->rcm_ss_cat_id_6);\n\t\t\t\t\t$ra_prod_cat_obj->setRcmSsCatId7($ra_prod_cat->rcm_ss_cat_id_7);\n\t\t\t\t\t$ra_prod_cat_obj->setRcmSsCatId8($ra_prod_cat->rcm_ss_cat_id_8);\n\t\t\t\t\t$ra_prod_cat_obj->setWarrantyCat($ra_prod_cat->warranty_cat);\n\t\t\t\t\t$ra_prod_cat_obj->setStatus($ra_prod_cat->status);\n\n\t\t\t\t\t$this->getDao('RaProdCat')->insert($ra_prod_cat_obj);\n\n\t\t\t\t\t$reason = 'insert';\n\t\t\t\t}\n\n\n\t\t\t\t$xml[] = '<ra_prod_cat>';\n\t\t\t\t$xml[] = '<ss_cat_id>' . $ra_prod_cat->ss_cat_id . '</ss_cat_id>';\n\t\t\t\t$xml[] = '<status>5</status>'; //updated\n\t\t\t\t$xml[] = '<is_error>' . $ra_prod_cat->is_error . '</is_error>';\n\t\t\t\t$xml[] = '<reason>'.$reason.'</reason>';\n\t\t\t\t$xml[] = '</ra_prod_cat>';\n\t\t\t}\n\t\t\tcatch(Exception $e)\n\t\t\t{\n\t\t\t\t$xml[] = '<ra_prod_cat>';\n\t\t\t\t$xml[] = '<ss_cat_id>' . $ra_prod_cat->ss_cat_id . '</ss_cat_id>';\n\t\t\t\t$xml[] = '<status>4</status>'; //error\n\t\t\t\t$xml[] = '<is_error>' . $ra_prod_cat->is_error . '</is_error>';\n\t\t\t\t$xml[] = '<reason>' . $e->getMessage() . '</reason>';\n\t\t\t\t$xml[] = '</ra_prod_cat>';\n\t\t\t}\n\t\t }\n\n\t\t$xml[] = '</ra_prod_cats>';\n\n\n\t\t$return_feed = implode(\"\", $xml);\n\n\t\treturn $return_feed;\n\t}",
"function insertPB()\n {\n\n $productos = $this->Import_model->get_productos();\n\n $valores = array();\n\n foreach ($productos as $key => $producto) {\n\n $detalle_pivote = $this->Import_model->get_detalle_pivote($producto->codigo_producto);\n\n $this->crearPresentacion($producto->id_entidad, $detalle_pivote);\n //$this->Import_model->insertProductoBodega($producto->id_entidad);\n //$this->Import_model->insertCategoriaProducto($producto->id_entidad, $producto->id_familia, $producto->id_grupo );\n\n }\n }",
"public function getProcessRecord() {\n\t\t$db = JFactory::getDBO();\n\t\t$csvilog = JRequest::getVar('csvilog');\n\t\t$csv_fields = JRequest::getVar('csv_fields');\n\t\t$template = JRequest::getVar('template');\n\t\t\n\t\tif (!$template->overwrite_existing_data) {\n\t\t $csvilog->AddMessage('debug', str_ireplace('{product_sku}', $this->product_sku, JText::_('DATA_EXISTS_PRODUCT_SKU')));\n\t\t $csvilog->AddStats('skipped', str_ireplace('{product_sku}', $this->product_sku, JText::_('DATA_EXISTS_PRODUCT_SKU')), true);\n\t\t}\n\t\telse {\n\t\t\tif (empty($this->product_sku) && empty($this->product_id)) {\n\t\t\t\t$csvilog->AddStats('incorrect', JText::_('DEBUG_NO_SKU'), true);\n\t\t\t\t$csvilog->AddMessage('debug', JText::_('DEBUG_NO_SKU_OR_ID'));\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$csvilog->AddMessage('debug', JText::_('DEBUG_PROCESS_SKU').$this->record_identity);\n\t\t\t}\n\t\t\t\n\t\t\t$csvilog->AddMessage('debug', JText::_('DEBUG_NORMAL_UPLOAD_EXPERT'));\n\t\t \n\t\t\t/* Load the tables that will contain the data */\n\t\t\t$this->getTables();\n\t\t\t\n\t\t\tif (!isset($this->product_id) && $template->ignore_non_exist) {\n\t\t\t\t/* Do nothing for new products when user chooses to ignore new products */\n\t\t\t\t$csvilog->AddStats('skipped', str_ireplace('{product_sku}', $this->record_identity, JText::_('DATA_EXISTS_IGNORE_NEW')), true);\n\t\t\t}\n\t\t\t/* User wants to add or update the product */\n\t\t\telse {\n\t\t\t\t/* Process product info */\n\t\t\t\tif (!$this->ProductQuery()) {\n\t\t\t\t\t$csvilog->AddStats('incorrect', str_ireplace('{product_sku}', $this->product_sku, JText::_('NO_UPDATE_PRODUCT_SKU')), true);\n\t\t\t\t}\n\t\t\t}\n\t\t\t/* Now that all is done, we need to clean the table objects */\n\t\t\t$this->getCleanTables();\n\t\t}\n\t}",
"public function getUpdateProductData();",
"public function processVbData($feed)\n {\n //Read the data sent from VB\n $xml_vb = simplexml_load_string($feed);\n unset($feed);\n $task_id = $xml_vb->attributes()->task_id;\n\n //Create return xml string\n $xml = array();\n $xml[] = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>';\n $xml[] = '<categories task_id=\"'.$task_id.'\">';\n $error_message = '';\n foreach ($xml_vb->category as $category) {\n try {\n $cat_ext_obj = $this->getDao('CategoryExtend')->get(['cat_id' => (string) $category->cat_id, 'lang_id' => (string) $category->lang_id]);\n\n $reason = 'insert_or_update';\n if ($cat_ext_obj) {\n //we need to check the stop_sync_name value to stop the update when needed (only for update)\n $stop_sync_name = $cat_ext_obj->getStopSyncName();\n if ($stop_sync_name != 1)\n {\n $this->getService('Category')->updateCategoryExtend($cat_ext_obj, $category);\n $this->getDao('CategoryExtend')->update($cat_ext_obj);\n }\n else\n {\n $reason = 'stop_sync_name';\n }\n } else {\n $cat_ext_obj = $this->getService('Category')->createNewCategoryExtend((string) $category->cat_id, $category);\n $this->getDao('CategoryExtend')->insert($cat_ext_obj);\n }\n\n\n $xml[] = '<category>';\n $xml[] = '<id>'.$category->cat_id.'</id>';\n $xml[] = '<lang_id>'.$category->lang_id.'</lang_id>';\n $xml[] = '<status>5</status>'; //insert\n $xml[] = '<is_error>'.$category->is_error.'</is_error>';\n $xml[] = '<reason>'.$reason.'</reason>';\n $xml[] = '</category>';\n\n } catch (Exception $e) {\n $xml[] = '<category>';\n $xml[] = '<id>'.$category->cat_id.'</id>';\n $xml[] = '<lang_id>'.$category->lang_id.'</lang_id>';\n $xml[] = '<status>4</status>'; //error\n $xml[] = '<is_error>'.$category->is_error.'</is_error>';\n $xml[] = '<reason>'.$e->getMessage().'</reason>';\n $xml[] = '</category>';\n $error_message .= $category->cat_id .'-'. $category->lang_id .'-'. $category->is_error .'-'. $e->getMessage().\"\\r\\n\";\n }\n }\n\n $xml[] = '</categories>';\n\n $return_feed = implode(\"\", $xml);\n\n if ($error_message) {\n mail('[email protected]', 'CategoryExtend Transfer Failed', \"Error Message :\".$error_message);\n }\n unset($xml);\n unset($xml_vb);\n return $return_feed;\n }",
"public function doProcessData() {}",
"public static function saveGroup() { \n $result = array();\n $saved = lC_Product_variants_Admin::save($_GET['pvid'], $_GET);\n if ($saved) {\n $result['rpcStatus'] = RPC_STATUS_SUCCESS;\n }\n\n echo json_encode($result);\n }",
"public function upload()\n {\n JSession::checkToken('request') or jexit(JText::_('JINVALID_TOKEN'));\n $params = JComponentHelper::getParams('com_vmimport');\n // Get some data from the request\n $file = JRequest::getVar('Filedata', '', 'files');\n //var_dump($file);\n \n // The request is valid\n $err = null;\n require_once JPATH_ADMINISTRATOR. '/components/com_media/helpers/media.php';\n if (!MediaHelper::canUpload($file, $err)) {\n // The file can't be upload\n JError::raiseNotice(100, JText::_($err));\n return false;\n }\n\n //Upload\n \n $file['filepath'] = JPath::clean(implode(DIRECTORY_SEPARATOR, array(JPATH_ROOT.'/'.$params->get('upload_path', 'tmp'), $file['name']) ));\n if (!JFile::upload($file['tmp_name'], $file['filepath'])) {\n // Error in upload\n JError::raiseWarning(100, JText::_('COM_VMIMPORT_ERROR_UNABLE_TO_UPLOAD_FILE'));\n return false;\n } \n\n //Process data \n //echo 'start process <br/>';\n $productSeparator = 'EndOfProduct'; \n $priceTableKey = 'Price Table';\n require_once JPATH_COMPONENT.'/helpers/vmimport.php';\n //$keys = array('Product ID','Product Name','VM Categories','Product Category','Image File');\n if (($handle = fopen($file['filepath'], \"r\")) !== FALSE) {\n \n $productList = array();\n $product = new stdClass();\n while (($data = fgetcsv($handle, 1000, \",\")) !== FALSE) { \n if($data[0]==$productSeparator) {\n $product->product_desc = VmimportHelper::formatDescription($descRows,$priceTable); \n $product->product_name = str_replace( '\"' , \"\", $product->product_name) ;\n $productList[] = $product;\n \n //Init new Product\n $product = new stdClass(); \n $descRows = array();\n $endDescription = false;\n $priceTable = array();\n $startPriceTable = false;\n }else {\n switch ($data[0]) {\n case 'Product ID':\n $product->virtuemart_product_id = trim($data[1]);\n break;\n case 'Product Name':\n $product->product_name = trim($data[1]);\n $product->product_alias = trim($data[1]); \n break;\n case 'Rate':\n if(!empty($data[1])) { \n $product->product_name .= \"|From \" . trim($data[1]);\n\t\t\t\t\t\t\t\t$product->raten = trim($data[1]);\n }\n break;\n case 'VM Categories':\n $product->categories = trim($data[1]);\n break;\n case 'Image File':\n $endDescription = true;\n $product->imageFile = trim($data[1]);\n break; \n case 'Price Table':\n $startPriceTable = true;\n break; \n default:\n if(!$endDescription) { \n $descRows[] = array_slice($data, 0, 2) ; \n }else if($startPriceTable) {\n $priceTable[]= $data;\n }\n break;\n }\n \n }\n \n }\n fclose($handle);\n }\n //var_dump($productList);\n \n //Import to database\n //echo 'start importing <br/>';\n $model = $this->getModel('import');\n $model->importData($productList);\n \n $msg = \"Import successfully\" ;\n $this->setRedirect( 'index.php?option=com_vmimport' , $msg);\n // echo 'upload validated'; die();\n }",
"function processData() \n {\n \n // store values in table manager object.\n $moduleID = $this->dataManager->getModuleID();\n $moduleCreator = new ModuleCreator( $moduleID, $this->pathModuleRoot);\n $moduleCreator->createModule();\n \n }",
"public function get_vb_data ($vars = array());",
"function processData() ;",
"public function setModuleData(){\n\t\t/* variable initialization */\n\t\t$this->_strSchemaName\t.= \"_\".$this->getCompanyCode();\n\t\t$intRespone\t\t\t\t= \"\";\n\t\t\n\t\t/* Setting the Pokicy filed */\n\t\tif((isset($this->_strDataSet['policy'])) && (!empty($this->_strDataSet['policy']))){\n\t\t\t/* Iterating the loop */\n\t\t\tforeach($this->_strDataSet['policy'] as $strPlicyKey => $strPolicyValue){\n\t\t\t\t/* Decoding the value */\n\t\t\t\t$this->_strDataSet['policy'][$strPlicyKey]\t= getDecyptionValue($strPolicyValue);\n\t\t\t}\n\t\t\t/* Imploding the value */\n\t\t\t$this->_strDataSet['policy']\t\t= implode(\",\",$this->_strDataSet['policy']);\n\t\t}else{\n\t\t\t/* Setting the value */\n\t\t\t$this->_strDataSet['policy']\t= \"\";\n\t\t}\n\t\t\n\t\t/* Set the operation filter array */\n\t\t$strEventFilterArr \t= array(\n\t\t\t\t\t\t\t\t\t\t'table' \t=> $this->_strSchemaName,\n\t\t\t\t\t\t\t\t\t\t'data' \t\t=> $this->_strDataSet,\n\t\t\t\t\t\t\t\t\t\t'where' \t=> array('id' => $this->_strDataSet['foreign']),\n\t\t\t\t\t\t\t\t\t);\n\t\t/* removed unwanted variables */\n\t\tunset($strEventFilterArr['data']['foreign']);\n\t\t\n\t\t/* Perfomaning the addition operation */\n\t\tif($this->_strDataSet['foreign'] == 0){\n\t\t\t/* add new records */\n\t\t\t$intResultStatus = $this->_objDataOperation->setDataInTable($strEventFilterArr);\n\t\t/* Perfomaning the update operation */\n\t\t}else{\n\t\t\t/* update the existing records */\n\t\t\t$intResultStatus = $this->_objDataOperation->setUpdateData($strEventFilterArr);\n\t\t}\n\t\t/* removed used variables */\n\t\tunset($strResultArr);\n\t\t\n\t\t/* return the operation status */\n\t\treturn $intResultStatus;\n\t}",
"public function fetch_all_product_and_marketSelection_data() {\r\n \r\n $dataHelpers = array();\r\n if (!empty($this->settingVars->pageArray[$this->settingVars->pageName][\"DH\"]))\r\n $dataHelpers = explode(\"-\", $this->settingVars->pageArray[$this->settingVars->pageName][\"DH\"]); //COLLECT REQUIRED PRODUCT FILTERS DATA FROM PROJECT SETTING \r\n\r\n if (!empty($dataHelpers)) {\r\n\r\n $selectPart = $resultData = $helperTables = $helperLinks = $tagNames = $includeIdInLabels = $groupByPart = array();\r\n $filterDataProductInlineConfig = $dataProductInlineFields = [];\r\n \r\n foreach ($dataHelpers as $key => $account) {\r\n if($account != \"\")\r\n {\r\n //IN RARE CASES WE NEED TO ADD ADITIONAL FIELDS IN GROUP BY CLUAUSE AND ALSO AS LABEL WITH THE ORIGINAL ACCOUNT\r\n //E.G: FOR RUBICON LCL - SKU DATA HELPER IS SHOWN AS 'SKU #UPC'\r\n //IN ABOVE CASE WE SEND DH VALUE = F1#F2 [ASSUMING F1 AND F2 ARE SKU AND UPC'S INDEX IN DATAARRAY]\r\n $combineAccounts = explode(\"#\", $account);\r\n \r\n foreach ($combineAccounts as $accountKey => $singleAccount) {\r\n $tempId = key_exists('ID', $this->settingVars->dataArray[$singleAccount]) ? $this->settingVars->dataArray[$singleAccount]['ID'] : \"\";\r\n if ($tempId != \"\") {\r\n $selectPart[$this->settingVars->dataArray[$singleAccount]['TYPE']][] = $tempId . \" AS \" . $this->settingVars->dataArray[$singleAccount]['ID_ALIASE'];\r\n $groupByPart[$this->settingVars->dataArray[$singleAccount]['TYPE']][] = $this->settingVars->dataArray[$singleAccount]['ID_ALIASE'];\r\n\r\n /*[START] GETTING DATA FOR THE PRODUCT AND MARKET INLINE SELECTION FILTER*/\r\n $filterDataProductInlineConfig[] = $tempId . \" AS \" . $this->settingVars->dataArray[$singleAccount]['ID_ALIASE_WITH_TABLE'];\r\n $dataProductInlineFields[] = $tempId;\r\n /*[END] GETTING DATA FOR THE PRODUCT AND MARKET INLINE SELECTION FILTER*/\r\n }\r\n \r\n $tempName = $this->settingVars->dataArray[$singleAccount]['NAME'];\r\n $selectPart[$this->settingVars->dataArray[$singleAccount]['TYPE']][] = $tempName . \" AS \" . $this->settingVars->dataArray[$singleAccount]['NAME_ALIASE'];\r\n $groupByPart[$this->settingVars->dataArray[$singleAccount]['TYPE']][] = $this->settingVars->dataArray[$singleAccount]['NAME_ALIASE'];\r\n\r\n /*[START] GETTING DATA FOR THE PRODUCT AND MARKET INLINE SELECTION FILTER*/\r\n $filterDataProductInlineConfig[] = $tempName . \" AS \" . $this->settingVars->dataArray[$singleAccount]['NAME_ALIASE'];\r\n $dataProductInlineFields[] = $tempName;\r\n /*[END] GETTING DATA FOR THE PRODUCT AND MARKET INLINE SELECTION FILTER*/\r\n }\r\n \r\n $helperTables[$this->settingVars->dataArray[$combineAccounts[0]]['TYPE']] = $this->settingVars->dataArray[$combineAccounts[0]]['tablename'];\r\n $helperLinks[$this->settingVars->dataArray[$combineAccounts[0]]['TYPE']] = $this->settingVars->dataArray[$combineAccounts[0]]['link'];\r\n \r\n //datahelper\\Product_And_Market_Filter_DataCollector::collect_Filter_Data($selectPart, $groupByPart, $tagName, $helperTableName, $helperLink, $this->jsonOutput, $includeIdInLabel, $account);\r\n }\r\n }\r\n\r\n if(isset($this->queryVars->projectConfiguration) && isset($this->queryVars->projectConfiguration['has_product_market_filter_disp_type']) && $this->queryVars->projectConfiguration['has_product_market_filter_disp_type']==1 && count($filterDataProductInlineConfig) >0){\r\n $this->settingVars->filterDataProductInlineConfig = $filterDataProductInlineConfig;\r\n $this->settingVars->dataProductInlineFields = $dataProductInlineFields;\r\n }\r\n \r\n if(is_array($selectPart) && !empty($selectPart)){\r\n foreach ($selectPart as $type => $sPart) {\r\n $resultData[$type] = datahelper\\Product_And_Market_Filter_DataCollector::collect_Filter_Query_Data($sPart, $groupByPart[$type], $helperTables[$type], $helperLinks[$type]);\r\n }\r\n $redisCache = new utils\\RedisCache($this->queryVars);\r\n $redisCache->requestHash = 'productAndMarketFilterData';\r\n $redisCache->setDataForStaticHash($selectPart);\r\n }\r\n\r\n foreach ($dataHelpers as $key => $account) {\r\n if($account != \"\")\r\n {\r\n $combineAccounts = explode(\"#\", $account);\r\n\r\n $tagNameAccountName = $this->settingVars->dataArray[$combineAccounts[0]]['NAME'];\r\n\r\n //IF 'NAME' FIELD CONTAINS SOME SYMBOLS THAT CAN'T PASS AS A VALID XML TAG , WE USE 'NAME_ALIASE' INSTEAD AS XML TAG\r\n //AND FOR THAT PARTICULAR REASON, WE ALWAYS SET 'NAME_ALIASE' SO THAT IT IS A VALID XML TAG\r\n $tagName = preg_match('/(,|\\)|\\()|\\./', $tagNameAccountName) == 1 ? $this->settingVars->dataArray[$combineAccounts[0]]['NAME_ALIASE'] : strtoupper($tagNameAccountName);\r\n\r\n if (isset($this->settingVars->dataArray[$combineAccounts[0]]['use_alias_as_tag']))\r\n {\r\n $tagName = ($this->settingVars->dataArray[$combineAccounts[0]]['use_alias_as_tag']) ? strtoupper($this->settingVars->dataArray[$combineAccounts[0]]['NAME_ALIASE']) : $tagName;\r\n \r\n if(isset($this->settingVars->dataArray[$combineAccounts[0]]['ID_ALIASE']) && !empty($this->settingVars->dataArray[$combineAccounts[0]]['ID_ALIASE']))\r\n $tagName .= \"_\". $this->settingVars->dataArray[$combineAccounts[0]]['ID_ALIASE'];\r\n }\r\n\r\n $includeIdInLabel = false;\r\n if (isset($this->settingVars->dataArray[$combineAccounts[0]]['include_id_in_label']))\r\n $includeIdInLabel = ($this->settingVars->dataArray[$combineAccounts[0]]['include_id_in_label']) ? true : false;\r\n\r\n $tempId = key_exists('ID', $this->settingVars->dataArray[$combineAccounts[0]]) ? $this->settingVars->dataArray[$combineAccounts[0]]['ID'] : \"\";\r\n \r\n $nameAliase = $this->settingVars->dataArray[$combineAccounts[0]]['NAME_ALIASE'];\r\n $idAliase = isset($this->settingVars->dataArray[$combineAccounts[0]]['ID_ALIASE']) ? $this->settingVars->dataArray[$combineAccounts[0]]['ID_ALIASE'] : \"\";\r\n\r\n $type = $this->settingVars->dataArray[$combineAccounts[0]]['TYPE'];\r\n\r\n if( !isset($this->jsonOutput['filters']) || !array_key_exists($tagName, $this->jsonOutput['filters']) )\r\n datahelper\\Product_And_Market_Filter_DataCollector::getFilterData( $nameAliase, $idAliase, $tempId, $resultData[$type], $tagName , $this->jsonOutput, $includeIdInLabel, $account);\r\n }\r\n }\r\n\r\n // NOTE: THIS IS FOR FETCHING PRODUCT AND MARKET WHEN USER CLICKS TAB. \r\n // TO FETCH TAB DATA SERVER BASED. TO AVOID BROWSER HANG. \r\n // WE FACE ISSUE IN MJN AS MANY FILTERS ENABLED FOR ITS PROJECTS\r\n if ($this->settingVars->fetchProductAndMarketFilterOnTabClick) {\r\n $redisCache = new utils\\RedisCache($this->queryVars);\r\n $redisCache->requestHash = 'productAndMarketFilterTabData';\r\n $redisCache->setDataForStaticHash($this->jsonOutput['filters']);\r\n }\r\n }\r\n }",
"function processTransaction($data){\n\n\t\t$bmtProducts = array( // todo add more products \n\t\t\t91390007 => '50',\n\t\t\t91390006 => '10',\n\t\t\t91390005 => '25',\n\t\t\t91390009 => '100',\n\t\t\t91390008 => '75',\n\t\t\t\n\t\t);\n\t \n\t $sessionId = $data['ccom'];\n\t $pid = $data['productid'];\n\t \n\t $value = $bmtProducts[$pid];\n\t \n\t \t$file = 'people.log';\n\t\t$person = \"\".json_encode($data).\"\\n\";\n\n\t\tfile_put_contents($file, $person, FILE_APPEND | LOCK_EX);\n\t\t\n\t\t/** get member info by session ID **/\n\t\t$rows = getMemberInfoBySessionId($sessionId);\n\t\taddPoints($data, $rows, $value);\n\n\t\t\n\t}",
"public static function getFormData() {\n $result = lC_Product_variants_Admin::getFormData($_GET['pvid']);\n if (!isset($result['rpcStatus'])) {\n $result['rpcStatus'] = RPC_STATUS_SUCCESS;\n }\n\n echo json_encode($result);\n }",
"function fn_warehouses_get_product_data_post(&$product_data, $auth, $preview, $lang_code)\n{\n if (empty($product_data['product_id'])) {\n return;\n }\n\n /** @var Tygh\\Addons\\Warehouses\\Manager $manager */\n $manager = Tygh::$app['addons.warehouses.manager'];\n /** @var Tygh\\Addons\\Warehouses\\ProductStock $product_stock */\n $product_stock = $manager->getProductWarehousesStock($product_data['product_id']);\n\n if (!$product_stock->hasStockSplitByWarehouses()) {\n return;\n }\n\n if (AREA == 'C') {\n /** @var \\Tygh\\Location\\Manager $manager */\n $manager = Tygh::$app['location'];\n $destination_id = $manager->getDestinationId();\n\n $product_data['amount'] = $product_stock->getAmountForDestination($destination_id);\n } else {\n $product_data['amount'] = $product_stock->getAmount();\n }\n}",
"function handle(&$params){\r\n $this->app =& Dataface_Application::getInstance(); // reference to Dataface_Application object\r\n\t //$this->app =& Dataface_RecordGrid::getInstance(); \r\n // Custom query\r\n $result = mysqli_query($this->app->db(),\"select inventoryreq.*,workref.RefID,inventory_parts.invreq_id,inventory_parts.part_id, \r\n\t\twarehouse_inv.1111XXXXPN,warehouse_inv.DESCRIPTION,warehouse_inv.QTY,employee.EmployeeName,inventory_parts.kitted FROM inventoryreq \r\n\t\tLEFT JOIN workref ON inventoryreq.WO=workref.ID \r\n\t\tLEFT JOIN inventory_parts ON inventoryreq.ID=inventory_parts.invreq_id \r\n\t\tLEFT JOIN employee ON inventoryreq.ReqBy=employee.idEmployee \r\n\t\tLEFT JOIN warehouse_inv ON inventory_parts.part_id=warehouse_inv.ID \r\n\t\tORDER BY ID ASC\");\r\n $body = \"<br /><br />\";\r\n \r\n\r\n\t\tDataface_JavascriptTool::getInstance()\r\n\t\t ->import('editable_nav.js');\r\n\t \r\n\t\t \r\n\t\t \r\n\t /*currID = $record->val('ID');\r\n\t\t$currVal = $record->val('Quantity');\r\n\t\t$out = array();\r\n\t\t$out[] = ' <input type=\"button\" value=\"–\" class=\"qtyminus\" field=\"'.$currID.'\" style=\"font-weight: bold;\" /><input type=\"text\" class=\"status-drop-down\" \r\n\t\t data-record-id=\"'.htmlspecialchars($record->getId()).'\" name=\"'.$currID.'\" value=\"'.$currVal.'\" size=\"4\">';\r\n\r\n\t\t \r\n\t\t \r\n\t\t$out[] = '<input type=\"button\" value=\"+\" class=\"qtyplus\" field=\"'.$currID.'\" style=\"font-weight: bold;\" />';\r\n\t\treturn implode(\"\\n\", $out);\r\n\t\t\r\n\t\t\r\n*/\r\n\r\n \r\n if(!$result)\r\n {\r\n // Error handling\r\n $body .= \"MySQL Error ...\";\r\n }else\r\n {\r\n while($row = mysqli_fetch_assoc($result)) // Fetch all rows\r\n {\r\n // Maybe do something with the single rows\r\n\t\t\t\t\r\n $row['<input type=\"text\" class=\"barcodee\" name=\"'.$row['part_id'].'\">'] = '<input type=\"text\" class=\"barcodee\" name=\"'.$row['part_id'].'\">';\r\n $data[] = $row; // Add singe row to the data\r\n }\r\n mysqli_free_result($result); // Frees the result after finnished using it\r\n\r\n $grid = new Dataface_RecordGrid($data, // Create new RecordGrid with the data\r\n array('<input type=\"text\" class=\"barcodee\" name=\"barcodee\">', 'invreq_id', 'RefID', 'part_id', '1111XXXXPN', 'DESCRIPTION', 'QTY', 'EmployeeName', 'kitted'), \r\n //Order and selection of the colums\r\n null); // No other labels defined -> it uses keys of the associative array\r\n \r\n $body .= $grid->toHTML(); // Get the HTML of the RecordGrid\r\n }\r\n\r\n // Shows the content (RecordGrid or error message) in the Main Template\r\n df_display(array('body' => $body), 'Dataface_Main_Template.html');\r\n }",
"public function saveData()\n {\n $newSku = $this->_entityModel->getNewSku();\n while ($bunch = $this->_entityModel->getNextBunch()) {\n foreach ($bunch as $rowNum => $rowData) {\n if (!$this->_entityModel->isRowAllowedToImport($rowData, $rowNum)) {\n continue;\n }\n\n if (version_compare($this->_entityModel->getProductMetadata()->getVersion(), '2.2.0', '>=')) {\n $rowSku = strtolower($rowData[ImportProduct::COL_SKU]);\n } else {\n $rowSku = $rowData[ImportProduct::COL_SKU];\n }\n $productData = $newSku[$rowSku];\n $this->parseOptions($rowData, $productData[$this->getProductEntityLinkField()]);\n }\n if (!empty($this->cachedOptions['sample']) || !empty($this->cachedOptions['link'])) {\n $this->saveOptions();\n $this->clear();\n }\n }\n return $this;\n }",
"function _storeHellaspayInternalData($method, $hellaspay_data, $virtuemart_order_id) {\r\n\r\n\t\t// get all know columns of the table\r\n\t\t$db = JFactory::getDBO();\r\n\t\t$query = 'SHOW COLUMNS FROM `' . $this->_tablename . '` ';\r\n\t\t$db->setQuery($query);\r\n\t\t$columns = $db->loadColumn(0);\r\n\t\t$post_msg = '';\r\n\t\tforeach ($hellaspay_data as $key => $value) {\r\n\t\t\t$post_msg .= $key . \"=\" . $value . \"<br />\";\r\n\t\t\t$table_key = 'hellaspay_response_' . $key;\r\n\t\t\tif (in_array($table_key, $columns)) {\r\n\t\t\t\t$response_fields[$table_key] = $value;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//$response_fields[$this->_tablepkey] = $this->_getTablepkeyValue($virtuemart_order_id);\r\n\t\t$response_fields['payment_name'] = $this->renderPluginName($method);\r\n\t\t$response_fields['hellaspayresponse_raw'] = $post_msg;\r\n\t\t$return_context = $hellaspay_data['custom'];\r\n\t\t$response_fields['order_number'] = $hellaspay_data['invoice'];\r\n\t\t$response_fields['virtuemart_order_id'] = $virtuemart_order_id;\r\n\t\t//$preload=true preload the data here too preserve not updated data\r\n\t\t$this->storePSPluginInternalData($response_fields, 'virtuemart_order_id', true);\r\n\t}",
"public function synchronizePrestashopToGestimum(){\n\t\t$products = $this->getProductsFromPrestashop();\n\t\t\n\t\t// stored procedure fields.\n\t\t$idProduct = 'NULL';\n\t\t$idSupplier = 'NULL';\n\t\t$idManufacturer = 'NULL';\n\t\t$idManufacturer = 'NULL';\n\t\t$idCategoryDefault = '0';\n\t\t$idShopDefault = 'NULL';\n\t\t$idTaxRulesGroup = 'NULL';\n\t\t$onSale = 'NULL';\n\t\t$onlineOnly = 'NULL';\n\t\t$ean13 = 'NULL';\n\t\t$upc = 'NULL';\n\t\t$ecotax = 'NULL';\n\t\t$quantity = 'NULL';\n\t\t$minimalQuantit = '0';\n\t\t$price = 'NULL';\n\t\t$wholesalePrice = 'NULL';\n\t\t$unity = 'NULL';\n\t\t$unitPriceRatio = 'NULL';\n\t\t$additionalShippingCost = 'NULL';\n\t\t$reference;\n\t\t$supplierReference = 'NULL';\n\t\t$location = 'NULL';\n\t\t$width = '0';\n\t\t$height = '0';\n\t\t$depth = 'NULL';\n\t\t$weight = '0';\n\t\t$outOfStock = 'NULL';\n\t\t$quantityDiscount = 'NULL';\n\t\t$customizable = 'NULL';\n\t\t$uploadableFiles = 'NULL';\n\t\t$textFields = 'NULL';\n\t\t$active = 'NULL';\n\t\t$availableForOrder = 'NULL';\n\t\t$availableDate = 'NULL';\n\t\t$condition = 'NULL';\n\t\t$showPrice = 'NULL';\n\t\t$indexed = 'NULL';\n\t\t$visibility = 'NULL';\n\t\t$cacheIsPack = 'NULL';\n\t\t$cacheHasAttachments = 'NULL';\n\t\t$isVirtual = 'NULL';\n\t\t$cacheDefaultAttribute = 'NULL';\n\t\t$dateAdd = 'NULL';\n\t\t$dateUpd = NULL;\n\t\t$advancedStockManagement = 'NULL';\n\t\t$productOptionValues = array();\n\t\t$categories = 'NULL';\n\n\t\tforeach ($products as $idProduct => $productArray) {\n\t\t\tforeach ($productArray as $attribute => $value) {\n\t\t\t\tswitch ($attribute) {\n\t\t\t\t\tcase 'id':\n\t\t\t\t\t\t$idProduct = $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'id_supplier':\n\t\t\t\t\t\tif($value) $idSupplier = $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'id_manufacturer':\n\t\t\t\t\t\tif ($value) $idManufacturer = $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'id_category_default':\n\t\t\t\t\t\tif( $value) $idCategoryDefault = $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'id_shop_default':\n\t\t\t\t\t\t$idShopDefault = $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'id_tax_rules_group':\n\t\t\t\t\t\t$idTaxRulesGroup = $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'on_sale':\n\t\t\t\t\t\t$onSale = (int) $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'online_only':\n\t\t\t\t\t\t$onlineOnly = (int) $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'ean13':\n\t\t\t\t\t\tif($value) $ean13 = (string) $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'upc':\n\t\t\t\t\t\tif($value) $upc = (string) $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'ecotax':\n\t\t\t\t\t\t$ecotax = $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'quantity':\n\t\t\t\t\t\t$quantity = $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'minimal_quantity':\n\t\t\t\t\t\t$minimalQuantity = $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'price':\n\t\t\t\t\t\t$price = (int)$value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'wholesale_price':\n\t\t\t\t\t\t$wholesalePrice = $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'unity':\n\t\t\t\t\t\tif($value) $unity= (string) $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'unit_price_ratio':\n\t\t\t\t\t\t$unitPriceRatio = $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'additional_shipping_cost':\n\t\t\t\t\t\tif($value) $additionalShippingCost = $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'reference':\n\t\t\t\t\t\t$reference = (string) $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'supplier_reference':\n\t\t\t\t\t\tif($value) $supplierReference = $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'location':\n\t\t\t\t\t\tif($value) $location = (string) $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'width':\n\t\t\t\t\t\t$width = $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'height':\n\t\t\t\t\t\t$height = $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'depth':\n\t\t\t\t\t\t$depth = $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'weight':\n\t\t\t\t\t\t$weight = $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'out_of_stock':\n\t\t\t\t\t\t$outOfStock = $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'quantity_discount':\n\t\t\t\t\t\t$quantityDiscount = (int) $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'customizable':\n\t\t\t\t\t\t$customizable = (int) $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'uploadable_files':\n\t\t\t\t\t\t$uploadableFiles = (int) $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'text_fields':\n\t\t\t\t\t\t$textFields = (int) $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'active':\n\t\t\t\t\t\t$active = (int) $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'available_for_order':\n\t\t\t\t\t\t$availableForOrder = (int) $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'available_date':\n\t\t\t\t\t\t$availableDate = (string) $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'condition':\n\t\t\t\t\t\t$condition = (string) $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'show_price':\n\t\t\t\t\t\t$showPrice = (int) $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'indexed':\n\t\t\t\t\t\t$indexed = (int) $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'visibility':\n\t\t\t\t\t\t$visibility = (string) $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'cache_is_pack':\n\t\t\t\t\t\t$cacheIsPack = (int) $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'cache_has_attachments':\n\t\t\t\t\t\t$cacheHasAttachments = (int) $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'is_virtual':\n\t\t\t\t\t\t$isVirtual = (int) $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'cache_default_attribute':\n\t\t\t\t\t\tif($value) $cacheDefaultAttribute = $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'date_add':\n\t\t\t\t\t\t$dateAdd = (string) $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'date_upd':\n\t\t\t\t\t\t$dateUpd = (string) $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'advanced_stock_management':\n\t\t\t\t\t\t$advancedStockManagement = (int) $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'product_option_values':\n\t\t\t\t\t\t$productOptionValues = $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'categories':\n\t\t\t\t\t\t$categories = $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ($reference == '') {\n\t\t\t\tthrow new ProductWithoutReferenceException(\"Merci de donner une référence valide à votre produit\", 1);\n\t\t\t}\n\n\t\t\tif(sizeof($productOptionValues) == 0){\n\t\t\t\t// The product has no declension (option value)\n\t\t\t\t$productOptionValues[] = '';\n\t\t\t}\n\t\t\t$originInt = (int) $this->origin;\n\t\t\t\n\t\t\t$dateUpd = new DateTime($dateUpd);\n\t\t\t$dateUpd = $dateUpd->format('Y-m-d H:i:s');\n\n\t\t\tforeach ($productOptionValues as $key => $declension) {\n\n\t\t\t\t$IdDeclinaison = substr(strtoupper(str_replace(' ','',$key)),-5);\n\t\t\t\t$CodeArticle = $reference . $IdDeclinaison;\n\n\t\t\t\tif (Constants::existsInDB(\n\t\t\t\t\tProductsConstants::getSelectARTCODEString($this->origin, $idProduct, $IdDeclinaison),\n\t\t\t\t\t$this->sqlServerConnection\n\t\t\t\t\t)){\n\t\t\t\t\t$updateProductSqlQuery = ProductsConstants::getProductUpdatingString(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$productArray['name'],\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$declension,\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$minimalQuantit,\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$weight,\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$width,\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$height,\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$dateUpd,\n\t\t\t\t\t\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$IdDeclinaison,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\t$CodeArticle,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\t$this->origin,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\t$idProduct,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\t$categories);\n\t\t\t\t\todbc_exec($this->sqlServerConnection, $updateProductSqlQuery) or die (\"<p>\" . odbc_errormsg() . \"</p>\");\t\n\t\t\t\t}\n\t\t\t\telseif (Constants::existsInDB(\n\t\t\t\t\tProductsConstants::getSelectArticleByPrestashopReference($reference),\n\t\t\t\t\t$this->sqlServerConnection\n\t\t\t\t\t)) {\n\t\t\t\t\t$updateProductSqlQuery = ProductsConstants::getProductUpdatingByReferenceString($productArray['name'],\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$declension,\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$minimalQuantit,\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$weight,\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$width,\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$height,\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$dateUpd,\n\t\t\t\t\t\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$IdDeclinaison,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\t$CodeArticle,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\t$this->origin,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\t$idProduct,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\t$categories,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\t$reference);\n\t\t\t\todbc_exec($this->sqlServerConnection, $updateProductSqlQuery) or die (\"<p>\" . odbc_errormsg() . \"</p>\");\n\t\t\t\t}else{\n\t\t\t\t\t$insertProductQuery = ProductsConstants::getProductInsertingString(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$CodeArticle,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$productArray['name'],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$declension,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$reference,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$minimalQuantit,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$weight,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$width,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$height,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$dateUpd,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$idCategoryDefault,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$idProduct,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$IdDeclinaison,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$this->origin,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$categories);\n\t\t\t\t\todbc_exec($this->sqlServerConnection, $insertProductQuery) or die (\"<p>\" . odbc_errormsg() . \"</p>\");\n\t\t\t\t} \n\t\t\t}\n\t\t}\n\t}",
"public function save($data)\n {\n /* Prices */\n $data['price_low'] = preg_replace(\"/[^0-9\\.]/\", \"\", $data['price_low']);\n $data['special_price_low'] = preg_replace(\"/[^0-9\\.]/\", \"\", $data['special_price_low']);\n\n /* Attributes */\n $attributes = array();\n foreach ($data['attributes']['title'] as $key => $title) {\n $attributes[] = array(\n 'title' => str_replace('\"', '\\\"', $title),\n 'value' => str_replace('\"', '\\\"', $data['attributes']['value'][$key]),\n 'is_variation' => ($data['attributes']['is_variation'][$key] === 'on')\n );\n }\n\n $data['attributes'] = $attributes;\n\n /* Variations */\n if (!empty($data['variations'])) {\n $variations = array();\n foreach ($data['variations']['name'] as $key => $name) {\n $variations[] = array(\n 'name' => str_replace('\"', '\\\"', $name),\n 'available_quantity' => $data['variations']['available_quantity'][$key],\n 'price' => $data['variations']['price'][$key],\n 'special_price' => $data['variations']['special_price'][$key],\n 'advertised' => $data['variations']['advertised'][$key],\n 'final_price' => $data['variations']['final_price'][$key],\n 'image' => $data['variations']['image'][$key]\n );\n }\n\n $data['variations'] = $variations;\n }\n \n $data['short_description'] = str_replace('\"', '\\\"', $data['short_description']);\n $data['description'] = str_replace('\"', '\\\"', $data['description']);\n $data['short_description'] = str_replace(PHP_EOL, '<br />', $data['short_description']);\n $data['description'] = str_replace(PHP_EOL, '<br />', $data['description']);\n \n $productId = $data['product_id'];\n $dataJson = str_replace(\"'\", \"\\'\", json_encode($data));\n \n $query = \"UPDATE products SET processed_data = '{$dataJson}', last_status_change = NOW() WHERE id = {$productId}\";\n $this->query($query);\n\n $errors = $this->getLastError();\n if ($errors) {\n die($errors);\n }\n \n return $this;\n }",
"function getprodproclist($bid)\r\n\t{\r\n\t\t$sql = \"select p.product_name as product,p.product_id,(pl.qty*o.quantity) as qty \r\nfrom proforma_invoices i \r\njoin king_orders o on o.id=i.order_id \r\njoin m_product_deal_link pl on pl.itemid=o.itemid \r\njoin m_product_info p on p.product_id=pl.product_id \r\njoin (select distinct p_invoice_no from shipment_batch_process_invoice_link where batch_id = ? and packed=0) as h on h.p_invoice_no = i.p_invoice_no\r\nwhere i.invoice_status=1 \r\norder by p.product_name asc \r\n\t\t\";\r\n\t\t$raw=$this->db->query($sql,$bid)->result_array();\r\n\t\t$prods=array();\r\n\t\t$pids=array();\r\n\t\tforeach($raw as $r)\r\n\t\t{\r\n\t\t\tif(!isset($prods[$r['product_id']]))\r\n\t\t\t\t$prods[$r['product_id']]=array(\"product_id\"=>$r['product_id'],\"product\"=>$r['product'],\"qty\"=>0,\"location\"=>\"\");\r\n\t\t\t$prods[$r['product_id']]['qty']+=$r['qty'];\r\n\t\t\t$pids[]=$r['product_id'];\r\n\t\t}\r\n\t\t$pids=array_unique($pids);\r\n\t\t$raw_locs=$this->db->query(\"select s.mrp,s.product_id,rb.rack_name,rb.bin_name from t_stock_info s join m_rack_bin_info rb on rb.id=s.rack_bin_id where s.product_id in ('\".implode(\"','\",$pids).\"') order by s.stock_id asc\")->result_array();\r\n\t\t$ret=array();\r\n\t\tforeach($prods as $i=>$p)\r\n\t\t{\r\n\t\t\t$q=$p['qty'];\r\n\t\t\t$locations=array();\r\n\t\t\t$mrps=array();\r\n\t\t\tforeach($raw_locs as $s)\r\n\t\t\t{\r\n\t\t\t\tif($s['product_id']!=$i)\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t$q-=$s['available_qty'];\r\n\t\t\t\t$locations[]=$s['rack_name'].$s['bin_name'];\r\n\t\t\t\t$mrps[]=\"Rs \".$s['mrp'];\r\n\t\t\t\tif($q<=0)\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\t$prods[$i]['location']=$loc=implode(\", \",array_unique($locations));\r\n\t\t\t$prods[$i]['mrp']=implode(\", \",array_unique($mrps));\r\n\t\t\t$assoc_loc=$loc.substr($p['product'],0,10).rand(110,9999);\r\n\t\t\t$ret[$assoc_loc]=$prods[$i];\r\n\t\t}\r\n\t\tksort($ret);\r\n\t\treturn $ret;\r\n\t}",
"public static function update_product_details($data)\n {\n try{\n \n $session = Yii::$app->session;\n foreach($data as $key=>$val) \n {\n \n if($key == 'life_tax_details')\n {\n if(sizeof($val)>0){\n\n $val=implode(\",\",$val);\n }\n }\n if($key == 'exact_location')\n {\n if(sizeof($val)>0){\n\n $val=implode(\",\",$val);\n }\n }\n $$key=get_magic_quotes_gpc()?$val:addslashes($val);\n $insertdata[$key] = $$key;\n\n }\n\n $capacity = $insertdata['capacity'];\n $insertdata['capacity'] = $insertdata['capacity'].' '.$insertdata['capacity_metric']; \n unset($insertdata['capacity_metric']);\n\n if(!isset($model_other)) $insertdata['model_other']=''; \n \n \n //save equipment current location to productloaction array\n $productlocation = array();\n $current_location_keys = ['latitude','longitude','city','state','country','google_place_id','location_type']; \n foreach($current_location_keys as $key)\n {\n if($key == 'location_type')\n {\n $location[$key] = 1;\n }\n else\n {\n $location[$key] = $insertdata[$key];\n unset($insertdata[$key]);\n }\n }\n $productlocation[] = $location;\n unset($insertdata['street']);\n unset($insertdata['route']);\n unset($insertdata['zipcode']);\n\n //save equipment serving location to productloaction array\n if(isset($insertdata['exact_location']))\n {\n $exact_locations = explode(',',$insertdata['exact_location']);\n foreach($exact_locations as $exact_location)\n {\n $get_url_data=file_get_contents(\"http://maps.google.com/maps/api/geocode/json?address=\".urlencode($exact_location).\"&sensor=false\");\n $url_data=(array)json_decode($get_url_data);\n $url_data=$url_data['results'];\n $components=array_reverse($url_data[0]->address_components);\n $country\t=@$components[0]->long_name;\n $state\t\t=@$components[1]->long_name;\n $city\t\t=@$components[2]->long_name;\n $place_id=$url_data[0]->place_id;\n $lat=$url_data[0]->geometry->location->lat;\n $lng=$url_data[0]->geometry->location->lng;\n $location['latitude'] = $lat;\n $location['longitude'] = $lng;\n $location['city'] = $city;\n $location['state'] = $state;\n $location['country'] = $country;\n $location['google_place_id'] = $place_id;\n $location['location_type'] = 2;\n $productlocation[] = $location;\n }\n }\n unset($insertdata['exact_location']);\n unset($insertdata['_csrf']);\n //unset($insertdata['product_type_check']);\n \n $product_id = $insertdata['product_id'];\n unset($insertdata['product_id']); \n\n\n //get current user id\n //$insertdata['user_id']=Yii::$app->user->getId(); \n $insertdata['updated_by'] = Yii::$app->user->id;\n $insertdata['date_updated'] = date('Y-m-d H:i:s');\n \n //insert data into database core_prodcuts table and get inserted product id\n Yii::$app->db->createCommand()->update('core_products', $insertdata,\"product_id = $product_id\")->execute();\n \n \n Yii::$app->db->createCommand()->delete('core_product_locations', \"product_id = $product_id\")->execute();\n \n //save product current and serving locations using product id \n foreach($productlocation as $location)\n {\n $location['product_id'] = $product_id;\n Yii::$app->db->createCommand()->insert('core_product_locations', $location)->execute();\n }\n\n //get category name by id to get full path of the images & load charts upload for product\n $category_id = $insertdata['category_id'];\n $category_names = Productcategory::select_fields_by_category_id($category_id);\n $category_name= str_replace(' ', '_', $category_names[0]['category_name']);\n\n //save product images\n if(is_array($session->get('product_images')))\n {\n $product_images = $session->get('product_images');\n $original_image_name=$session->get('product_images_names');\n foreach($product_images as $index=>$product_image)\n {\n $images_data['product_id'] = $product_id;\n $images_data['image_name'] = $original_image_name[$index];\n $images_data['image_url'] = Yii::$app->params['SITE_URL'].'uploads/'.date('Y').'/'.$category_name.'/'.$product_image;\n $images_data['image_type'] = 1;\n $images_data['image_status'] = 1;\n \n //insert image details to database table.\n Yii::$app->db->createCommand()->insert('core_product_images', $images_data)->execute();\n\n }\n $session->remove('product_images');\n $session->remove('product_images_names');\n }\n //save product load_charts\n if(is_array($session->get('product_loadcharts')))\n {\n $product_load_charts = $session->get('product_loadcharts');\n $original_load_chart_name=$session->get('product_loadcharts_names');\n foreach($product_load_charts as $index=>$load_chart)\n {\n $load_charts_data['product_id'] = $product_id;\n $load_charts_data['image_name'] = $original_load_chart_name[$index];\n $load_charts_data['image_url'] = Yii::$app->params['SITE_URL'].'uploads/'.date('Y').'/'.$category_name.'/'.$load_chart;\n $load_charts_data['image_type'] = 2;\n $load_charts_data['image_status'] = 1;\n //insert load_charts details to database table.\n Yii::$app->db->createCommand()->insert('core_product_images', $load_charts_data)->execute();\n }\n $session->remove('product_loadcharts');\n $session->remove('product_loadcharts_names');\n }\n\n $response ['status'] = 200;\n $response ['message'] = \"Product updated successfully\";\n\n \n /*//get current user email\n $email = User::select_user_email_by_id();\n $subject=\"Big Equipments India | Registration Of Equipment\";\n //get what message to send after creating product\n $message = Mail_settings::get_product_add_message($manual_product_code,$product_id);\n \n //send email to current user\n Mail_settings::send_email_notification($email,$subject,$message);*/\n\n return $response;\n \n } catch (ErrorException $ex) {\n Yii::warning('Error while updating new product.');\n Yii::warning($ex->getMessage());\n \n $response ['status'] = 400;\n $response ['message'] = \"Error while updating product details\";\n return $response;\n }\n \n }",
"public function processData() {\n\t\t$GLOBALS['TCA'] = \\BusyNoggin\\BnBackend\\BackendLibrary::removeExcludeFields($GLOBALS['TCA']);\n\t}",
"public function processData() {}",
"protected function _saveProducts()\n {\n $priceIsGlobal = $this->_catalogData->isPriceGlobal();\n $productLimit = null;\n $productsQty = null;\n $entityLinkField = $this->getProductEntityLinkField();\n\n while ($bunch = $this->_dataSourceModel->getNextBunch()) {\n $entityRowsIn = [];\n $entityRowsUp = [];\n $attributes = [];\n $this->websitesCache = [];\n $this->categoriesCache = [];\n $tierPrices = [];\n $mediaGallery = [];\n $labelsForUpdate = [];\n $imagesForChangeVisibility = [];\n $uploadedImages = [];\n $previousType = null;\n $prevAttributeSet = null;\n $existingImages = $this->getExistingImages($bunch);\n\n foreach ($bunch as $rowNum => $rowData) {\n // reset category processor's failed categories array\n $this->categoryProcessor->clearFailedCategories();\n\n if (!$this->validateRow($rowData, $rowNum)) {\n continue;\n }\n if ($this->getErrorAggregator()->hasToBeTerminated()) {\n $this->getErrorAggregator()->addRowToSkip($rowNum);\n continue;\n }\n $rowScope = $this->getRowScope($rowData);\n\n $rowData[self::URL_KEY] = $this->getUrlKey($rowData);\n\n $rowSku = $rowData[self::COL_SKU];\n\n if (null === $rowSku) {\n $this->getErrorAggregator()->addRowToSkip($rowNum);\n continue;\n } elseif (self::SCOPE_STORE == $rowScope) {\n // set necessary data from SCOPE_DEFAULT row\n $rowData[self::COL_TYPE] = $this->skuProcessor->getNewSku($rowSku)['type_id'];\n $rowData['attribute_set_id'] = $this->skuProcessor->getNewSku($rowSku)['attr_set_id'];\n $rowData[self::COL_ATTR_SET] = $this->skuProcessor->getNewSku($rowSku)['attr_set_code'];\n }\n\n // 1. Entity phase\n if ($this->isSkuExist($rowSku)) {\n // existing row\n if (isset($rowData['attribute_set_code'])) {\n $attributeSetId = $this->catalogConfig->getAttributeSetId(\n $this->getEntityTypeId(),\n $rowData['attribute_set_code']\n );\n\n // wrong attribute_set_code was received\n if (!$attributeSetId) {\n throw new LocalizedException(\n __(\n 'Wrong attribute set code \"%1\", please correct it and try again.',\n $rowData['attribute_set_code']\n )\n );\n }\n } else {\n $attributeSetId = $this->skuProcessor->getNewSku($rowSku)['attr_set_id'];\n }\n\n $entityRowsUp[] = [\n 'updated_at' => (new \\DateTime())->format(DateTime::DATETIME_PHP_FORMAT),\n 'attribute_set_id' => $attributeSetId,\n $entityLinkField => $this->getExistingSku($rowSku)[$entityLinkField]\n ];\n } else {\n if (!$productLimit || $productsQty < $productLimit) {\n $entityRowsIn[strtolower($rowSku)] = [\n 'attribute_set_id' => $this->skuProcessor->getNewSku($rowSku)['attr_set_id'],\n 'type_id' => $this->skuProcessor->getNewSku($rowSku)['type_id'],\n 'sku' => $rowSku,\n 'has_options' => isset($rowData['has_options']) ? $rowData['has_options'] : 0,\n 'created_at' => (new \\DateTime())->format(DateTime::DATETIME_PHP_FORMAT),\n 'updated_at' => (new \\DateTime())->format(DateTime::DATETIME_PHP_FORMAT),\n ];\n $productsQty++;\n } else {\n $rowSku = null;\n // sign for child rows to be skipped\n $this->getErrorAggregator()->addRowToSkip($rowNum);\n continue;\n }\n }\n\n if (!array_key_exists($rowSku, $this->websitesCache)) {\n $this->websitesCache[$rowSku] = [];\n }\n // 2. Product-to-Website phase\n if (!empty($rowData[self::COL_PRODUCT_WEBSITES])) {\n $websiteCodes = explode($this->getMultipleValueSeparator(), $rowData[self::COL_PRODUCT_WEBSITES]);\n foreach ($websiteCodes as $websiteCode) {\n $websiteId = $this->storeResolver->getWebsiteCodeToId($websiteCode);\n $this->websitesCache[$rowSku][$websiteId] = true;\n }\n }\n\n // 3. Categories phase\n if (!array_key_exists($rowSku, $this->categoriesCache)) {\n $this->categoriesCache[$rowSku] = [];\n }\n $rowData['rowNum'] = $rowNum;\n $categoryIds = $this->processRowCategories($rowData);\n foreach ($categoryIds as $id) {\n $this->categoriesCache[$rowSku][$id] = true;\n }\n unset($rowData['rowNum']);\n\n // 4.1. Tier prices phase\n if (!empty($rowData['_tier_price_website'])) {\n $tierPrices[$rowSku][] = [\n 'all_groups' => $rowData['_tier_price_customer_group'] == self::VALUE_ALL,\n 'customer_group_id' => $rowData['_tier_price_customer_group'] ==\n self::VALUE_ALL ? 0 : $rowData['_tier_price_customer_group'],\n 'qty' => $rowData['_tier_price_qty'],\n 'value' => $rowData['_tier_price_price'],\n 'website_id' => self::VALUE_ALL == $rowData['_tier_price_website'] ||\n $priceIsGlobal ? 0 : $this->storeResolver->getWebsiteCodeToId($rowData['_tier_price_website']),\n ];\n }\n\n if (!$this->validateRow($rowData, $rowNum)) {\n continue;\n }\n\n // 5. Media gallery phase\n list($rowImages, $rowLabels) = $this->getImagesFromRow($rowData);\n $storeId = !empty($rowData[self::COL_STORE])\n ? $this->getStoreIdByCode($rowData[self::COL_STORE])\n : Store::DEFAULT_STORE_ID;\n $imageHiddenStates = $this->getImagesHiddenStates($rowData);\n foreach (array_keys($imageHiddenStates) as $image) {\n if (array_key_exists($rowSku, $existingImages)\n && array_key_exists($image, $existingImages[$rowSku])\n ) {\n $rowImages[self::COL_MEDIA_IMAGE][] = $image;\n $uploadedImages[$image] = $image;\n }\n\n if (empty($rowImages)) {\n $rowImages[self::COL_MEDIA_IMAGE][] = $image;\n }\n }\n\n $rowData[self::COL_MEDIA_IMAGE] = [];\n\n /*\n * Note: to avoid problems with undefined sorting, the value of media gallery items positions\n * must be unique in scope of one product.\n */\n $position = 0;\n foreach ($rowImages as $column => $columnImages) {\n foreach ($columnImages as $columnImageKey => $columnImage) {\n if (!isset($uploadedImages[$columnImage])) {\n $uploadedFile = $this->uploadMediaFiles($columnImage);\n $uploadedFile = $uploadedFile ?: $this->getSystemFile($columnImage);\n if ($uploadedFile) {\n $uploadedImages[$columnImage] = $uploadedFile;\n } else {\n $this->addRowError(\n ValidatorInterface::ERROR_MEDIA_URL_NOT_ACCESSIBLE,\n $rowNum,\n null,\n null,\n ProcessingError::ERROR_LEVEL_NOT_CRITICAL\n );\n }\n } else {\n $uploadedFile = $uploadedImages[$columnImage];\n }\n\n if ($uploadedFile && $column !== self::COL_MEDIA_IMAGE) {\n $rowData[$column] = $uploadedFile;\n }\n\n if ($uploadedFile && !isset($mediaGallery[$storeId][$rowSku][$uploadedFile])) {\n if (isset($existingImages[$rowSku][$uploadedFile])) {\n $currentFileData = $existingImages[$rowSku][$uploadedFile];\n if (isset($rowLabels[$column][$columnImageKey])\n && $rowLabels[$column][$columnImageKey] !=\n $currentFileData['label']\n ) {\n $labelsForUpdate[] = [\n 'label' => $rowLabels[$column][$columnImageKey],\n 'imageData' => $currentFileData\n ];\n }\n\n if (array_key_exists($uploadedFile, $imageHiddenStates)\n && $currentFileData['disabled'] != $imageHiddenStates[$uploadedFile]\n ) {\n $imagesForChangeVisibility[] = [\n 'disabled' => $imageHiddenStates[$uploadedFile],\n 'imageData' => $currentFileData\n ];\n }\n } else {\n if ($column == self::COL_MEDIA_IMAGE) {\n $rowData[$column][] = $uploadedFile;\n }\n $mediaGallery[$storeId][$rowSku][$uploadedFile] = [\n 'attribute_id' => $this->getMediaGalleryAttributeId(),\n 'label' => isset($rowLabels[$column][$columnImageKey])\n ? $rowLabels[$column][$columnImageKey]\n : '',\n 'position' => ++$position,\n 'disabled' => isset($imageHiddenStates[$columnImage])\n ? $imageHiddenStates[$columnImage] : '0',\n 'value' => $uploadedFile,\n ];\n }\n }\n }\n }\n\n // 6. Attributes phase\n $rowStore = (self::SCOPE_STORE == $rowScope)\n ? $this->storeResolver->getStoreCodeToId($rowData[self::COL_STORE])\n : 0;\n $productType = isset($rowData[self::COL_TYPE]) ? $rowData[self::COL_TYPE] : null;\n if ($productType !== null) {\n $previousType = $productType;\n }\n if (isset($rowData[self::COL_ATTR_SET])) {\n $prevAttributeSet = $rowData[self::COL_ATTR_SET];\n }\n if (self::SCOPE_NULL == $rowScope) {\n // for multiselect attributes only\n if ($prevAttributeSet !== null) {\n $rowData[self::COL_ATTR_SET] = $prevAttributeSet;\n }\n if ($productType === null && $previousType !== null) {\n $productType = $previousType;\n }\n if ($productType === null) {\n continue;\n }\n }\n\n $productTypeModel = $this->_productTypeModels[$productType];\n if (!empty($rowData['tax_class_name'])) {\n $rowData['tax_class_id'] =\n $this->taxClassProcessor->upsertTaxClass($rowData['tax_class_name'], $productTypeModel);\n }\n\n if ($this->getBehavior() == Import::BEHAVIOR_APPEND ||\n empty($rowData[self::COL_SKU])\n ) {\n $rowData = $productTypeModel->clearEmptyData($rowData);\n }\n\n $rowData = $productTypeModel->prepareAttributesWithDefaultValueForSave(\n $rowData,\n !$this->isSkuExist($rowSku)\n );\n $product = $this->_proxyProdFactory->create(['data' => $rowData]);\n\n foreach ($rowData as $attrCode => $attrValue) {\n $attribute = $this->retrieveAttributeByCode($attrCode);\n\n if ('multiselect' != $attribute->getFrontendInput() && self::SCOPE_NULL == $rowScope) {\n // skip attribute processing for SCOPE_NULL rows\n continue;\n }\n $attrId = $attribute->getId();\n $backModel = $attribute->getBackendModel();\n $attrTable = $attribute->getBackend()->getTable();\n $storeIds = [0];\n\n if ('datetime' == $attribute->getBackendType()\n && (\n in_array($attribute->getAttributeCode(), $this->dateAttrCodes)\n || $attribute->getIsUserDefined()\n )\n ) {\n $attrValue = $this->dateTime->formatDate($attrValue, false);\n } elseif ('datetime' == $attribute->getBackendType() && strtotime($attrValue)) {\n $attrValue = gmdate(\n 'Y-m-d H:i:s',\n $this->_localeDate->date($attrValue)->getTimestamp()\n );\n } elseif ($backModel) {\n $attribute->getBackend()->beforeSave($product);\n $attrValue = $product->getData($attribute->getAttributeCode());\n }\n if (self::SCOPE_STORE == $rowScope) {\n if (self::SCOPE_WEBSITE == $attribute->getIsGlobal()) {\n // check website defaults already set\n if (!isset($attributes[$attrTable][$rowSku][$attrId][$rowStore])) {\n $storeIds = $this->storeResolver->getStoreIdToWebsiteStoreIds($rowStore);\n }\n } elseif (self::SCOPE_STORE == $attribute->getIsGlobal()) {\n $storeIds = [$rowStore];\n }\n if (!$this->isSkuExist($rowSku)) {\n $storeIds[] = 0;\n }\n }\n foreach ($storeIds as $storeId) {\n if (!isset($attributes[$attrTable][$rowSku][$attrId][$storeId])) {\n $attributes[$attrTable][$rowSku][$attrId][$storeId] = $attrValue;\n }\n }\n // restore 'backend_model' to avoid 'default' setting\n $attribute->setBackendModel($backModel);\n }\n }\n\n foreach ($bunch as $rowNum => $rowData) {\n if ($this->getErrorAggregator()->isRowInvalid($rowNum)) {\n unset($bunch[$rowNum]);\n }\n }\n\n $this->saveProductEntity(\n $entityRowsIn,\n $entityRowsUp\n )->_saveProductWebsites(\n $this->websitesCache\n )->_saveProductCategories(\n $this->categoriesCache\n )->_saveProductTierPrices(\n $tierPrices\n )->_saveMediaGallery(\n $mediaGallery\n )->_saveProductAttributes(\n $attributes\n )->updateMediaGalleryVisibility(\n $imagesForChangeVisibility\n )->updateMediaGalleryLabels(\n $labelsForUpdate\n );\n\n $this->_eventManager->dispatch(\n 'catalog_product_import_bunch_save_after',\n ['adapter' => $this, 'bunch' => $bunch]\n );\n }\n\n return $this;\n }",
"public function process($data)\n {\n // Delete previous entries\n $this->deleteWhere('serial_number=?', $this->serial_number);\n \n // Translate printer strings to db fields\n $translate = array(\n 'Channel: ' => 'channel',\n 'Model: ' => 'model',\n 'Port State: ' => 'port_state',\n 'Port Address: ' => 'port_address',\n 'Driver Version: ' => 'driver_version',\n 'Firmware Version: ' => 'firmware_version',\n 'Flash Version: ' => 'flash_version');\n\n //clear any previous data we had\n foreach ($translate as $search => $field) {\n $this->$field = '';\n }\n // Parse data\n foreach (explode(\"\\n\", $data) as $line) {\n // Translate standard entries\n foreach ($translate as $search => $field) {\n if (strpos($line, $search) === 0) {\n $value = substr($line, strlen($search));\n \n $this->$field = $value;\n\n # Check if this is the last field\n if ($field == 'flash_version') {\n $this->id = '';\n $this->save();\n }\n break;\n }\n }\n } //end foreach explode lines\n \n }",
"private function process_input()\n\t{\n\t//\t$report_end_datetime = OurTime::js_to_datetime($this->f_report_end, 1);\n\t\t\n\t\t$this->m_product_info_arr = DB::get_all_rows_fq ('\n\t\t\tSELECT products.*\n\t\t\tFROM products\n\t\t');\n\t\t\n\t\t//TESTING: show how many rows we got:\n\t\t//echo count($this->m_obj_info_arr);*/\n\n\t}",
"protected function _getProductData() {\n\n\n $cat_id = Mage::getModel('catalog/layer')->getCurrentCategory()->getId();\n $category = Mage::getModel('catalog/category')->load($cat_id);\n $data['event'] = 'product';\n\n $finalPrice = $this->getFinalPriceDiscount();\n if($finalPrice):\n $google_tag_params = array();\n $google_tag_params['ecomm_prodid'] = $this->getProduct()->getSku();\n $google_tag_params['name'] = $this->getProduct()->getName();\n $google_tag_params['brand'] = $this->getProduct()->getBrand();\n $google_tag_params['ecomm_pagetype'] = 'product';\n $google_tag_params['ecomm_category'] = $category->getName();\n $google_tag_params['ecomm_totalvalue'] = (float)$this->formatNumber($finalPrice);\n \n $customer = Mage::getSingleton('customer/session');\n if ($customer->getCustomerId()){\n $google_tag_params['user_id'] = (string) $customer->getCustomerId(); \n }\n if($this->IsReturnedCustomer()){\n $google_tag_params['returnCustomer'] = 'true';\n }\n else {\n $google_tag_params['returnCustomer'] = 'false';\n }\n\n $data['google_tag_params'] = $google_tag_params;\n\n /* Facebook Conversion API Code */\n $custom_data = array(\n \"content_name\" => $this->getProduct()->getName(),\n \"content_ids\" => [$this->getProduct()->getSku()],\n \"content_category\" => $category->getName(),\n \"content_type\" => \"product\",\n \"value\" => (float)$this->formatNumber($finalPrice),\n \"currency\" => \"BRL\"\n );\n $this->createFacebookRequest(\"ViewContent\", [], [], $custom_data);\n /* End Facebook Conversion API Code */\n\n endif;\n\n return $data;\n }",
"public function parse()\n {\n $tblProductdata = new Tblproductdata();\n if (isset($this->product['Product Name'])) {\n $tblProductdata->setStrproductname($this->product['Product Name']);\n }\n if (isset($this->product['Product Description'])) {\n $tblProductdata->setStrproductdesc($this->product['Product Description']);\n }\n if (isset($this->product['Product Code'])) {\n $tblProductdata->setStrproductcode($this->product['Product Code']);\n }\n $tblProductdata->setDtmadded(new \\DateTime);\n if (isset($this->product['Discontinued'])\n && $this->product['Discontinued'] == strtolower('yes')\n ) {\n $tblProductdata->setDtmdiscontinued(new \\DateTime);\n }\n $tblProductdata->setStmtimestamp(\n new \\DateTime('@' . strtotime('now'))\n );\n if (isset($this->product['Stock'])) {\n $tblProductdata->setIntstocklevel($this->product['Stock']);\n }\n if (isset($this->product['Discontinued'])) {\n $tblProductdata->setDecPrice($this->product['Cost in GBP']);\n }\n return $tblProductdata;\n }"
]
| [
"0.5839891",
"0.5706544",
"0.568808",
"0.563969",
"0.5520001",
"0.54985833",
"0.5443457",
"0.5417065",
"0.53986895",
"0.5354572",
"0.5347832",
"0.53006446",
"0.52670217",
"0.5250371",
"0.52405167",
"0.52275676",
"0.52121246",
"0.5193366",
"0.5173578",
"0.51589",
"0.51460457",
"0.51302195",
"0.51262236",
"0.5114744",
"0.5095838",
"0.50671756",
"0.50571805",
"0.5055636",
"0.50508755",
"0.5050815"
]
| 0.653533 | 0 |
List of Laravel model events that should be recorded public static $logModelEvents = ['created','updated']; | public static function bootLogsModelEvents()
{
if (property_exists(self::class, 'logModelEvents')) {
foreach (self::$logModelEvents as $eventName) {
static::$eventName(function ($model) use ($eventName) {
$description = $eventName;
if ($eventName == 'updating' || $eventName == 'updated') {
if ($dirty = $model->getDirty()) {
$changed = [];
foreach ($dirty as $key => $value) {
if (!self::shouldHideKey($key)) {
if (self::shouldSanitizeKey($key)) {
$changed[] = "'$key': ***";
} else {
$changed[] = "'$key': [" . ($model->original[$key] ?? '-') . "]→[$value]";
}
}
}
if ($changed) {
$description .= ':' . implode(', ', $changed);
}
}
}
$model->logModelEvent($description);
});
}
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected static function getModelEventsToRecord()\n {\n if (isset(static::$modelEventsToRecord)) {\n return static::$modelEventsToRecord;\n }\n\n return ['created', 'updated', 'deleted'];\n }",
"protected static function recordableEvents()\n {\n if (isset(static::$recordableEvents)) {\n return static::$recordableEvents;\n }\n\n return ['created', 'updated', 'deleted'];\n }",
"protected static function getHasAuditColumnModelEvents()\n {\n if (isset(static::$auditColumnEvents)) {\n return static::$auditColumnEvents;\n }\n\n return collect([\n 'creating',\n 'updating',\n 'deleting',\n ]);\n }",
"public static function boot()\n {\n parent::boot();\n\n self::created(function($model) {\n $name = $model[self::$name];\n\n ActivityLog::create([\n 'log_by' => auth()->id(),\n 'activity_type' => 'insert',\n 'dashboard_activity' => 'created a new '. self::$tableTitle,\n 'activity_desc' => 'created the '. self::$tableTitle .' '. $name,\n 'activity_date' => date(\"Y-m-d H:i:s\"),\n 'db_table' => $model->getTable(),\n 'old_value' => '',\n 'new_value' => $name,\n 'reference' => $model->id\n ]);\n });\n\n self::updating(function($model) {\n self::$oldModel = $model->fresh();\n });\n\n self::updated(function($model) {\n $name = $model[self::$name];\n $oldModel = self::$oldModel->toArray();\n foreach ($oldModel as $fieldName => $value) {\n if (in_array($fieldName, self::$unrelatedFields)) {\n continue;\n }\n\n $oldValue = $model[$fieldName];\n if ($oldValue != $value) {\n ActivityLog::create([\n 'log_by' => auth()->id(),\n 'activity_type' => 'update',\n 'dashboard_activity' => 'updated the '. self::$tableTitle .' '. self::$logName[$fieldName],\n 'activity_desc' => 'updated the '. self::$tableTitle .' '. self::$logName[$fieldName] .' of '. $name .' from '. $oldValue .' to '. $value,\n 'activity_date' => date(\"Y-m-d H:i:s\"),\n 'db_table' => $model->getTable(),\n 'old_value' => $oldValue,\n 'new_value' => $value,\n 'reference' => $model->id\n ]);\n }\n }\n });\n\n self::deleted(function($model){\n $name = $model[self::$name];\n ActivityLog::create([\n 'log_by' => auth()->id(),\n 'activity_type' => 'delete',\n 'dashboard_activity' => 'deleted a '. self::$tableTitle,\n 'activity_desc' => 'deleted the '. self::$tableTitle .' '. $name,\n 'activity_date' => date(\"Y-m-d H:i:s\"),\n 'db_table' => $model->getTable(),\n 'old_value' => '',\n 'new_value' => '',\n 'reference' => $model->id\n ]);\n });\n\n // self::restored(function($model){\n // $name = $model[self::$name];\n // ActivityLog::create([\n // 'log_by' => auth()->id(),\n // 'activity_type' => 'restore',\n // 'dashboard_activity' => 'restore a '. self::$tableTitle,\n // 'activity_desc' => 'restore the '. self::$tableTitle .' '. $name,\n // 'activity_date' => date(\"Y-m-d H:i:s\"),\n // 'db_table' => $model->getTable(),\n // 'old_value' => '',\n // 'new_value' => '',\n // 'reference' => $model->id\n // ]);\n // });\n }",
"public static function boot()\n {\n parent::boot();\n\n self::created(function($model) {\n $name = $model[self::$name];\n\n ActivityLog::create([\n 'log_by' => auth()->id(),\n 'activity_type' => 'insert',\n 'dashboard_activity' => 'created a new '. self::$tableTitle,\n 'activity_desc' => 'created the '. self::$tableTitle .' '. $name,\n 'activity_date' => date(\"Y-m-d H:i:s\"),\n 'db_table' => $model->getTable(),\n 'old_value' => '',\n 'new_value' => $name,\n 'reference' => $model->id\n ]);\n });\n\n self::updating(function($model) {\n self::$oldModel = $model->fresh();\n });\n\n self::updated(function($model) {\n $name = $model[self::$name];\n $oldModel = self::$oldModel->toArray();\n foreach ($oldModel as $fieldName => $value) {\n if (in_array($fieldName, self::$unrelatedFields)) {\n continue;\n }\n\n $oldValue = $model[$fieldName];\n if ($oldValue != $value) {\n ActivityLog::create([\n 'log_by' => auth()->id(),\n 'activity_type' => 'update',\n 'dashboard_activity' => 'updated the '. self::$tableTitle .' '. self::$logName[$fieldName],\n 'activity_desc' => 'updated the '. self::$tableTitle .' '. self::$logName[$fieldName] .' of '. $name .' from '. $oldValue .' to '. $value,\n 'activity_date' => date(\"Y-m-d H:i:s\"),\n 'db_table' => $model->getTable(),\n 'old_value' => $oldValue,\n 'new_value' => $value,\n 'reference' => $model->id\n ]);\n }\n }\n });\n\n self::deleted(function($model){\n $name = $model[self::$name];\n ActivityLog::create([\n 'log_by' => auth()->id(),\n 'activity_type' => 'delete',\n 'dashboard_activity' => 'deleted a '. self::$tableTitle,\n 'activity_desc' => 'deleted the '. self::$tableTitle .' '. $name,\n 'activity_date' => date(\"Y-m-d H:i:s\"),\n 'db_table' => $model->getTable(),\n 'old_value' => '',\n 'new_value' => '',\n 'reference' => $model->id\n ]);\n });\n\n // self::restored(function($model){\n // $name = $model[self::$name];\n // ActivityLog::create([\n // 'log_by' => auth()->id(),\n // 'activity_type' => 'restore',\n // 'dashboard_activity' => 'restore a '. self::$tableTitle,\n // 'activity_desc' => 'restore the '. self::$tableTitle .' '. $name,\n // 'activity_date' => date(\"Y-m-d H:i:s\"),\n // 'db_table' => $model->getTable(),\n // 'old_value' => '',\n // 'new_value' => '',\n // 'reference' => $model->id\n // ]);\n // });\n }",
"public function getModelEvents();",
"public function getCompatibleEvents()\n {\n return [\n TaskLinkModel::EVENT_CREATE_UPDATE\n ];\n }",
"protected static function getRecordActivityEvents() {\n if (isset(static::$recordEvents)) {\n return static::$recordEvents;\n }\n\n //events by default if recordEvents is not set\n return [\n 'updating',\n// 'deleted',\n ];\n }",
"function Logging_model()\r\n {\r\n parent::Model();\r\n }",
"public function model()\n {\n return ActivityLog::class;\n }",
"public function model()\n {\n return 'App\\Log';\n }",
"public function broadcastOn()\n {\n return ['RecordChanges'];\n }",
"public function boot()\n {\n parent::boot();\n\n //INI eventos de eloquent para registrar actividad de los modelos\n Event::listen('eloquent.created: *', function($model){\n $arr_class = array(\"Logdb\",\"Loginout\");\n $class = class_basename($model);\n if(in_array($class, $arr_class) || empty(isset(auth()->user()->id)))\n return null;\n $log = Logdb::record('created', $class); \n });\n Event::listen('eloquent.updated: *', function($model){\n $arr_class = array(\"Logdb\",\"Loginout\");\n $class = class_basename($model);\n if(in_array($class, $arr_class) || empty(isset(auth()->user()->id)))\n return null;\n $log = Logdb::record('updated', $class); \n });\n Event::listen('eloquent.deleted: *', function($model){\n $arr_class = array(\"Logdb\",\"Loginout\");\n $class = class_basename($model);\n if(in_array($class, $arr_class) || empty(isset(auth()->user()->id)))\n return null;\n $log = Logdb::record('deleted', $class); \n });\n Event::listen('eloquent.restored: *', function($model){\n $arr_class = array(\"Logdb\",\"Loginout\");\n $class = class_basename($model);\n if(in_array($class, $arr_class) || empty(isset(auth()->user()->id)))\n return null;\n $log = Logdb::record('restored', $class); \n });\n //FIN eventos de eloquent para registrar actividad de los modelos\n }",
"public static function events($models, $events = array(), $options = array()) {\n\t\t$logmodel = '\\\\'.get_called_class();\n\t\tif (empty($events)) {\n\t\t\t$events = array('create','update','delete');\n\t\t}\n\t\tif (in_array('save',$events)) {\n\t\t\tforeach ($events as $i => $v) {\n\t\t\t\tif ($v == 'save') {\n\t\t\t\t\tunset($events[$i]);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$events[] = 'create';\n\t\t\t$events[] = 'update';\n\t\t}\n\t\tforeach ($models as $model) {\n\t\t\tforeach ($events as $event) {\n\t\t\t\t$filter = $event;\n\t\t\t\tif ($event == 'create' || $event == 'update') {\n\t\t\t\t\t$filter = 'save';\n\t\t\t\t\tif ($event == 'create' && in_array('update', $events)) {\n\t\t\t\t\t\tcontinue; // so save filter is only added once.\n\t\t\t\t\t}\n\t\t\t\t} elseif($event == 'read') {\n\t\t\t\t\t$filter = 'find';\n\t\t\t\t}\n\n\t\t\t\t$model::applyFilter($filter, function($self, $params, $chain) use ($logmodel, $events) {\n\t\t\t\t\t$filteredMethod = $chain->method();\n\t\t\t\t\t$action = (isset($params['record']->id)) ? 'update' : 'create';\n\t\t\t\t\t$result = $chain->next($self, $params, $chain);\n\t\t\t\t\tswitch ($filteredMethod) {\n\t\t\t\t\t\tcase 'find' :\n\t\t\t\t\t\t\tif ($params['type'] != 'first') {\n\t\t\t\t\t\t\t\treturn $result;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t$action = 'read';\n\t\t\t\t\t\t\tif ($result) {\n\t\t\t\t\t\t\t\t$pk = $result->id;\n\t\t\t\t\t\t\t\t$title = $result->{$self::meta('title')};\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'save' :\n\t\t\t\t\t\t\tif (!in_array($action, $events)) {\n\t\t\t\t\t\t\t\treturn $result;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t$pk = $params['record']->id;\n\t\t\t\t\t\t\t$title = $params['record']->{$self::meta('title')};\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t$action = $filteredMethod;\n\t\t\t\t\t\t\t$pk = $params['record']->id;\n\t\t\t\t\t\t\t$title = $params['record']->{$self::meta('title')};\n\t\t\t\t\t}\n\t\t\t\t\tif ($result) {\n\t\t\t\t\t\t$logData = array(\n\t\t\t\t\t\t\t'model' => $self::invokeMethod('_name'),\n\t\t\t\t\t\t\t'action' => $action,\n\t\t\t\t\t\t\t'pk' => $pk,\n\t\t\t\t\t\t\t'title' => $title\n\t\t\t\t\t\t);\n\t\t\t\t\t\t$logmodel::create($logData)->save();\n\t\t\t\t\t}\n\t\t\t\t\treturn $result;\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}",
"public function definition(): array\n {\n return [\n 'message' => new CustomEventMessage(new TestModel(), 'testEvent')\n ];\n }",
"public static function bootHistoryTrait() {\n// parent::boot();\n\n foreach (static::getRecordActivityEvents() as $eventName) {\n static::$eventName(function ($model) use ($eventName) {\n try {\n $modelRevisionObj = self::getRevisionObject($model);\n \n $diff = static::getDiff($model);\n\n if (!$diff['before'] && !$diff['after']) {\n return true;\n }\n\n $relations = $model->getRelations();\n \n foreach ($diff['before'] as $key => $value) {\n\n if (static::isRelated($key)) {\n $relatedModel = static::getRelatedModel($model, $key);\n \n //check related model need to be logged\n if(!$relatedModel)\n continue;\n \n //load related model and get old value\n $relatedModelObj = new $relatedModel;\n $relModel = $relatedModelObj::find($value);\n\n $relations = static::getRelatedModelRelations($model, $key);\n\n $modelBefore = $relModel->load($relations);\n\n //get new value\n $relModel = $relatedModelObj::find($diff['after'][$key]);\n $modelAfter = $relModel->load($relations);\n\n $accessColumnValue = static::getRelatedModelColumn($model, $key);\n\n $row['old_value'] = array_get($modelBefore->toArray(), $accessColumnValue);\n $row['new_value'] = array_get($modelAfter->toArray(), $accessColumnValue);\n } else {\n $row['old_value'] = $value;\n $row['new_value'] = $diff['after'][$key];\n }\n\n $mutator = 'get' . studly_case($key) . 'Attribute';\n \n if (method_exists($model, $mutator)) {\n $key = $model->$mutator($key);\n }\n \n $row['column'] = $key;\n\n $foreign_key = $model->foreign_key;\n// \n// //set history relation col to appropriate value\n $row['revisionable_id'] = $model->$foreign_key;\n $row['user_id'] = \\Auth::user()->id;\n\n $modelRevisionObj::create($row);\n }\n } catch (\\Exception $e) {\n return $e->getMessage();\n }\n });\n \n return true;\n }\n }",
"public function trackModel(TrackModelRequest $request)\n {\n $model = $request->input('model');\n $revisions = Revision::where(['revisionable_type' => $model])\n ->orderBy('created_at','desv')->get();\n\n $result = [];\n $lastDate = '';\n foreach ($revisions as $revision) {\n $date = $revision->created_at->toDateString();\n if ($lastDate != $date) {\n $result[] = [\n 'time' => $revision->created_at->toDateString(),\n 'type' => 'time-label'\n ];\n }\n $result[] = [\n 'time' => $revision->created_at->toTimeString(),\n 'icon' => 'fa-user',\n 'iconBackground' => $this->getIconBackground($revision),\n 'header' => $this->getMessage($revision)\n\n ];\n $lastDate = $date;\n }\n\n return $result;\n\n\n }",
"public function events() {\n return array_merge(parent::events(), array(\n 'onBeforeSave' => 'beforeSave',\n 'onAfterSave' => 'afterSave',\n 'onBeforeDelete' => 'beforeDelete',\n 'onAfterDelete' => 'afterDelete',\n 'onBeforeFind' => 'beforeFind',\n 'onAfterFind' => 'afterFind',\n ));\n }",
"function userLogs() { \n $model = config('app.AuditTrails');\n return new $model;\n }",
"protected function _getLog() {\n return $this->_model;\n }",
"public function logging()\n\t{\n\t\treturn $this->neoeloquent->logging();\n\t}",
"public static function bootBroadcastChanges()\n {\n static::created(function ($model) {\n $channel = strtolower(class_basename(get_class($model)));\n event(new ModelCreated($model, $channel));\n });\n\n static::updated(function ($model) {\n $channel = strtolower(class_basename(get_class($model)));\n event(new ModelChanged($model, $channel));\n });\n\n static::deleted(function ($model) {\n $channel = strtolower(class_basename(get_class($model)));\n event(new ModelTrashed($model, $channel));\n });\n }",
"public function events()\n {\n return [Controller::EVENT_AFTER_ACTION => 'afterAction'];\n }",
"public function eventLog() {\n\t\treturn $this->_eventLog;\n\t}",
"public function boot()\n {\n parent::boot();\n\n // $request = request();\n // dd($request);\n\n //INI eventos de eloquent para registrar actividad de los modelos\n Event::listen('eloquent.created: *', function($model){\n $class = class_basename($model);\n if($class=='Activity' || empty(isset(auth()->user()->id)))\n return null;\n $log = Activity::record('created', $class); \n });\n Event::listen('eloquent.updated: *', function($model){\n $class = class_basename($model);\n if($class=='Activity' || empty(isset(auth()->user()->id)))\n return null;\n $log = Activity::record('updated', $class); \n });\n Event::listen('eloquent.deleted: *', function($model){\n $class = class_basename($model);\n if($class=='Activity' || empty(isset(auth()->user()->id)))\n return null;\n $log = Activity::record('deleted', $class); \n });\n Event::listen('eloquent.restored: *', function($model){\n $class = class_basename($model);\n if($class=='Activity' || empty(isset(auth()->user()->id)))\n return null;\n $log = Activity::record('restored', $class); \n });\n //FIN eventos de eloquent para registrar actividad de los modelos\n\n\n }",
"public function logs() {\n return $this->hasMany('EAMES\\Models\\Log');\n }",
"public function event()\r\n {\r\n\r\n $event = new Event();\r\n $event->afterDelete = function (EyufScholar $model) {\r\n //User::deleteAll(['id' => $model->user_id]);\r\n };\r\n\r\n\r\n $event->beforeSave = function (EyufScholar $model) {\r\n /// Az::$app->App->eyuf->scholar->sendNotifyToAdmin($model);\r\n };\r\n /*\r\n $event->beforeDelete = function (EyufScholar $model) {\r\n return null;\r\n };\r\n\r\n $event->afterDelete = function (EyufScholar $model) {\r\n return null;\r\n };\r\n\r\n $event->beforeSave = function (EyufScholar $model) {\r\n return null;\r\n };\r\n\r\n $event->afterSave = function (EyufScholar $model) {\r\n return null;\r\n };\r\n\r\n $event->beforeValidate = function (EyufScholar $model) {\r\n return null;\r\n };\r\n\r\n $event->afterValidate = function (EyufScholar $model) {\r\n return null;\r\n };\r\n\r\n $event->afterRefresh = function (EyufScholar $model) {\r\n return null;\r\n };\r\n\r\n $event->afterFind = function (EyufScholar $model) {\r\n return null;\r\n };\r\n */\r\n return $event;\r\n\r\n }",
"public function eventsLog()\n\t{\n\t\tif ($this->_eventsLog === false) {\n\t\t\t$this->_eventsLog = self::mergeHandlers($this->events());\n\t\t}\n\t\treturn $this->_eventsLog;\n\t}",
"public function getObservableEvents()\n {\n return array_merge(\n [\n 'creating', 'created', 'updating', 'updated',\n 'deleting', 'deleted', 'saving', 'saved',\n 'fetching', 'fetched'\n ],\n $this->observables\n );\n }",
"public function getCompatibleEvents()\r\n {\r\n return array(\r\n TaskModel::EVENT_DAILY_CRONJOB,\r\n );\r\n }"
]
| [
"0.75341773",
"0.6896052",
"0.6525554",
"0.6388823",
"0.6388823",
"0.6228684",
"0.621511",
"0.61946315",
"0.61371857",
"0.6107221",
"0.6067984",
"0.60408044",
"0.59189606",
"0.58752406",
"0.58464116",
"0.5836131",
"0.57916987",
"0.577985",
"0.5735789",
"0.5732192",
"0.5731368",
"0.57241756",
"0.57175",
"0.57163686",
"0.5681277",
"0.5673092",
"0.566659",
"0.56623596",
"0.5661321",
"0.55972344"
]
| 0.76568913 | 0 |
/ Query a time server (C) 19990929, Ralf D. Kloth (QRQ.software) | function query_time_server($timeserver, $socket)
{
$fp = fsockopen($timeserver, $socket, $err, $errstr, 5);
# parameters: server, socket, error code, error text, timeout
if ($fp) {
fputs($fp, "\n");
$timevalue = fread($fp, 49);
fclose($fp); # close the connection
} else {
$timevalue = " ";
}
$ret = [];
$ret[] = $timevalue;
$ret[] = $err; # error code
$ret[] = $errstr; # error text
return $ret;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function retrieveServerTime(){\n //http://www.thetvdb.com/api/Updates.php?type=none\n\t \n\t if(!$this->t_mirrors){\n\t\t$this->retrieveMirrors;\n\t }\n\t \n $url = $this->t_mirrors[0].'/api/Updates.php?type=none';\n \n //$xmlStr=$this->curl_get_file_contents($url);\n\t $c = curl_init();\n curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);\n curl_setopt($c, CURLOPT_URL, $url);\n $xmlStr = curl_exec($c);\n curl_close($c);\n \n $xmlServerTime = new SimpleXMLElement($xmlStr);\n return $xmlServerTime->Time;\n }",
"public function getServerHour(){\n\t\t$stmt = Conexion::conectar()->prepare(\"SELECT DATE_FORMAT(NOW(), '%k:%i:%s') AS hora\");\n\t\t$stmt->execute();\n\t\treturn $stmt->fetch()[0]; //respuesta\n\t}",
"function serverTime() {\n\t\tdate_default_timezone_set('Europe/Oslo');\n\t\treturn \"Server time is: \".date(\"H:i:s\");\n\t}",
"public function setServerTime();",
"function timequery() {\n static $querytime_begin;\n list($usec, $sec) = explode(' ', microtime());\n\n if (!isset($querytime_begin)) {\n $querytime_begin = ((float) $usec + (float) $sec);\n } else {\n $querytime = (((float) $usec + (float) $sec)) - $querytime_begin;\n echo sprintf('<br />La consulta tardó %01.5f segundos.- <br />', $querytime);\n }\n}",
"public function getQuery($time);",
"public function servertime() {\n\t\tif(is_null($this->sync))\n\t\t\t$this->synchronize();\n\t\treturn (int) (microtime(true) * 1000) + $this->sync;\n\t}",
"public function time($number = '')\n\t{\n\t\tif (empty($number) || $number == \"?\")\n\t\t{\n\t\t\treturn $this->CLI->stringQuery($this->SqueezePlyrID.\" time ?\");\n\t\t}\n\t\treturn $this->CLI->pingQuery($this->SqueezePlyrID.\" time \".((string) $number));\n\t}",
"public function query_trading_clock(){\n\t\t$response = $this->execute($this->query_clock_url);\n\t\tif(!$response){\n\t\t\tthrow new Exception(\"error in connecting to server\");\n\t\t}\n\t\treturn json_decode($response,true);\n\t}",
"function getRecordTime() {\n\treturn db_query(\"SELECT recordtime FROM RecordTime\");\n}",
"public function updateNewTimeClient() {\n\t\treturn $this->Db->query(\"UPDATE `yp_sessions` \n\t\t\tSET `last_time` = {$this->Request->time} \n\t\t\tWHERE `hash` = '{$this->_thisClientHash()}'\");\n\t}",
"function getQueryTime($time_start,$time_end) {\n\t\treturn round($time_end - $time_start,4).'sec';\n\t}",
"function GetLocationTimeFromServer($intLocationID, $servertime,$path){\n\n\t$jsonurl = API.$path.\"/api/getlocationtime_daylightsaving.php?intLocationID=\".$intLocationID.\"&server_time=\".urlencode($servertime);\n\t$json = @file_get_contents($jsonurl,0,null,null); \n\t$datetimenow= json_decode($json);\n\t$datetimenowk1 = $datetimenow->servertolocation_datetime; \n\t$ldatetitme = date('Y-m-d H:i:s',strtotime($datetimenowk1));\n\treturn $ldatetitme;\n}",
"function get_remote_time($location, $switch){\n//get_remote_time use a remote database (from http://twiki.org) to provide remote local time; the database is up to date.\n//to use this service without buying an api is necessary to trick the file get operation by identify as Mozilla; curl will do this trick... ;-) \n\n//format: \tget_remote_time(\"Region/City\", switch);\n//examples:\n//\t\t\tget_remote_time(\"Europe/Bucharest\", 5);\n//\t\t\tget_remote_time(\"Europe/London\", 4);\n//\t\t\tget_remote_time(\"America/Toronto\", 7);\n\n//switches:\n//\t\t\t0 return current remote location day in week (ex: Sun for Sunday)\n//\t\t\t1 return current remote location day in a month (ex: 27)\n//\t\t\t2 return current remote location month (ex: May)\n//\t\t\t3 return current remote location year (ex: 2012)\n//\t\t\t4 return current remote location time (23:20:12 - HH:MM:SS)\n//\t\t\t5 return current remote location time shift related to GMT(+4:00 for GMT+4:00)\n//\t\t\t6 return current remote location zone abbreviation (ex: EEST stands for EEST – Eastern European Summer Time)\n//\t\t\t7 return remote location unprocessed string (ex: \"Sun, 13 May 2012, 16:57:10 -0400 (EDT)\" for America/Toronto)\n\n\t$link = \"http://twiki.org/cgi-bin/xtra/tzdate?tz=\".$location;\n\t$string = str_between(g_file($link), \"<!--tzdate:date-->\", \"<!--/tzdate:date-->\");\n\tif ($switch < 7) {\n\t $stk = explode(\" \",$string);\n\t $stk[0] = trim($stk[0], ',');\n\t $stk[5] = substr($stk[5],0,3).\":\".substr($stk[5],3);\n\t $stk[6] = trim($stk[6], '(,)');\n\treturn $stk[$switch];\n\t}\n\treturn $string;\n}",
"public function getServerTime(Classes\\GetServerTimeRequest $arg) {\n\t\treturn $this->makeSoapCall(\"getServerTime\", $arg);\n\t}",
"function reply_time() {\n\tglobal $reply;\n\treturn $reply['time'];\n}",
"public function getQueryTime()\n {\n return $this->query_time;\n }",
"public function time() {\n return $this->returnCommand(['TIME'], null, null, ResponseParser::PARSE_TIME);\n }",
"function getSimilarTime($obj, $socket_id, $channel_id, $_DATA)\n {\n $dp=$this->dp;\n \n $start = $_DATA['start'];\n $stop = $_DATA['stop'];\n $isin = $_DATA['isin'];\n $fdate = $_DATA['fdate'];\n\n\t$q=\"SELECT OASIS_TIME\"\n \t\t\t.\t\" FROM imk_IT WHERE TRADE_DATE='$fdate' AND SECURITY_ISIN='$isin' AND OASIS_TIME >= \\\"$start\\\" ORDER BY ORDER_ID,OASIS_TIME LIMIT 0,1\" ;\n\n\t$dp->setQuery($q);\n\t$js_start=$dp->loadResult();\n\tif ($dp->getErrorNum()){\n \t$obj->write($socket_id, $channel_id, $dp->stderr());\n\t\treturn;\n\t\t}\n\t\n\t$q=\"SELECT OASIS_TIME\"\n \t\t\t.\t\" FROM imk_IT WHERE TRADE_DATE='$fdate' AND SECURITY_ISIN='$isin' AND OASIS_TIME >= \\\"$stop\\\" ORDER BY ORDER_ID,OASIS_TIME LIMIT 0,1\" ;\n \t\n\t$dp->setQuery($q);\n\t$js_stop=$dp->loadResult();\n\tif ($dp->getErrorNum()){\n \t$obj->write($socket_id, $channel_id, $dp->stderr());\t\t\n\t\treturn;\n\t\t}\n\t\t\t\n $script .= \"custom_start='\".$js_start.\"';\";\n $script .= \"custom_end='\".$js_stop.\"';\";\n \n $obj->write($socket_id, $channel_id, $script);\n }",
"function timnsx($ten)\r\n\t{\r\n\t\t$arr = array(\":T\"=> $ten);\r\n\t\t$sql =\"select * from SANPHAM where nsx like :T \";\r\n\t\t\r\n\t\treturn $this->query($sql, $arr);\t\r\n\t}",
"function getFechaServer() {\n\t\t$fecha_actual=date('Y').'-'.date('m').'-'.date('d');\n\t\t$hora_actual=date('H').':'.date('i').':'.date('s');\n\n\t\tprint $fecha_actual.'|'.$hora_actual;\n\t}",
"function mysqlTime()\r\n {\r\n $hour = $this->addZero( $this->hour() );\r\n $minute = $this->addZero( $this->minute() );\r\n $second = $this->addZero( $this->second() );\r\n\r\n return $hour . \":\" . $minute . \":\" . $second;\r\n }",
"public function getQueryTime()\n {\n return $this->queryTime;\n }",
"public function getQueryTime()\n {\n return $this->queryTime;\n }",
"public function getServerTimestamp();",
"function Sytem_Time(){\r\n\r\n// system date and time\r\n\t\t\t$query1=\"Select NOW();\";\r\n\t\t\t$result = mysql_query($query1) or die (mysql_error());\r\n\t\t\t$num1 = mysql_num_rows($result);\r\n\t\t\t\r\n\t\t\tfor($i=0; $i<$num1; $i++) {\r\n\t\t\r\n\t\t\t\t$row = mysql_fetch_array($result);\r\n\t\t\t\t$datePosted = $row[$i];\r\n\t\t\t}\r\n\t\t\t// end system date\r\n\treturn $datePosted;\r\n}",
"public function return_queryDateTimeStamp(){\n\n //$ts = date(\"Y-m-d H:i:s\", time());\n\n return date(\"Y-m-d H:i:s\", time());\n\n }",
"function query_info($ip=NULL) {\r\n\tif (!$ip) $ip = $this->ipaddr();\r\n\tif (!$ip) return FALSE;\r\n\t$start = $this->_getmicrotime();\r\n\t$res = $this->_sendquery($ip, 'getstatus');\r\n\t$end = $this->_getmicrotime();\r\n\tif (!$res) return FALSE;\r\n\t$this->data = array();\t\t\t\t\t// query_info always resets the data array (so call this before other queries)\r\n\t$code = '';\r\n\tif ($this->raw != '') {\r\n\t\t$this->data['ping'] = ceil(($end - $start) * 1000);\t// return the time (ms) it took for the packet to return (ping)\r\n\t\t$this->data['ipport'] = $ip;\r\n\t\tlist($this->data['ip'], $this->data['port']) = explode(':', $this->data['ipport']);\r\n\r\n\t\t$this->raw = substr($this->raw, 18);\t\t// strip off response header bytes\r\n\t\t$code = $this->_getchar();\t\t\t// get EOT character: 0x0A\r\n\t\t$this->_getchar();\t\t\t\t// clear trailing slash \\\r\n\t\t$block = \"\";\r\n\r\n\t\t$pos = strpos($this->raw, $code);\t\t// extract the status block from the raw input (0x0A . . . 0x0A)\r\n\t\t$block = substr($this->raw, 0, $pos);\r\n\t\t$block = str_replace(\"\\\\\", \"\\0\", $block);\t// replace \\ with nulls to make parsing in a loop easier\r\n\t\t$this->raw = substr($this->raw, $pos+1);\t// cut the status block out of our raw buffer\r\n\r\n\t\t$old = $this->raw;\r\n\t\t$this->raw = $block . \"\\0\";\r\n\t\twhile ($this->raw != '') {\r\n\t\t\t$key = $this->_getnullstr();\r\n\t\t\t$value = $this->_getnullstr();\r\n\t\t\t$key = str_replace(' ', '_', $key);\t// do not allow spaces in key names\r\n\t\t\t$this->data[strtolower($key)] = $value;\r\n#\t\t\tif ($key{0} == '.') {\t\t\t// some keys have a leading dot. record a 2nd key w/o the dot.\r\n#\t\t\t\t$key = substr($key, 1);\r\n#\t\t\t\t$this->data[strtolower($key)] = $value;\r\n#\t\t\t}\r\n\r\n\t\t\tif ($key == 'sv_maxclients') $this->data['maxplayers'] = $value;\r\n\t\t\tif ($key == 'sv_hostname') $this->data['name'] = $value;\r\n\t\t}\r\n\t\t$this->raw = $old;\r\n\t\t// gather player information ...\r\n\t\tif ($this->raw != '') {\r\n\t\t\t$this->raw = substr($this->raw, 0, -1);\t\t// ignore trailing newline (0x0A)\r\n\t\t\t$plrs = explode(chr(0x0A), $this->raw);\r\n\t\t\t$this->raw = '';\r\n\t\t\t$this->data['players'] = array();\r\n\t\t\tforeach ($plrs as $p) {\r\n\t\t\t\tlist($kills, $ping, $name) = explode(\" \", $p, 3);\r\n\t\t\t\t$this->data['players'][] = array(\r\n\t\t\t\t\t'name'\t=> substr($name, 1, -1),\t// ignore surrounding quotes\r\n\t\t\t\t\t'kills' => $kills,\r\n\t\t\t\t\t'ping'\t=> $ping\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn $this->data;\r\n\t}\r\n\treturn FALSE;\r\n}",
"public function getQueryTime()\n {\n return $this->result->getQueryTime();\n }",
"public function getAnswerTime();"
]
| [
"0.6596131",
"0.64093447",
"0.6295277",
"0.62776715",
"0.62247115",
"0.6191721",
"0.60731685",
"0.5970149",
"0.5952864",
"0.5924523",
"0.5846608",
"0.58172303",
"0.5806068",
"0.5734254",
"0.5654907",
"0.5619656",
"0.5562991",
"0.5517565",
"0.55126476",
"0.5507908",
"0.5472556",
"0.54536813",
"0.54518056",
"0.54518056",
"0.5447174",
"0.5445296",
"0.5428423",
"0.54206157",
"0.5406099",
"0.5399998"
]
| 0.7619637 | 0 |
If we didn't receive the command NTP ... | function doNTP($text = null)
{
if (strtolower($this->input) != "ntp") {
$this->ntp_message = $this->ntp_response;
$this->response = $this->ntp_response;
return;
}
// "None" agent command received.
if ($this->agent_input == null) {
$token_thing = new Tokenlimiter($this->thing, "ntp");
$dev_overide = null;
if (
$token_thing->thing_report["token"] == "ntp" or
$dev_overide == true
) {
// From example
$timeserver = "ntp.pads.ufrj.br";
// Dev neither of these two are working.
$timeserver = "time.nrc.ca";
$timeserver = "time.chu.nrc.ca";
// This is an older protocol version.
$timeserver = "time4.nrc.ca";
$timercvd = $this->query_time_server($timeserver, 37);
$this->time_zone = "America/Vancouver";
//if no error from query_time_server
if (!$timercvd[1]) {
$timevalue = bin2hex($timercvd[0]);
$timevalue = abs(
HexDec("7fffffff") -
HexDec($timevalue) -
HexDec("7fffffff")
);
$tmestamp = $timevalue - 2208988800; # convert to UNIX epoch time stamp
$epoch = $tmestamp;
// $datum = date("Y-m-d H:i:s",$tmestamp - date("Z",$tmestamp)); /* incl time zone offset */
// $d = date("Y-m-d H:i:s",$tmestamp - date("Z",$tmestamp)); /* incl time zone offset */
//$datum = $dt = new \DateTime($tmestamp, new \DateTimeZone("UTC"));
$datum = new \DateTime("@$epoch", new \DateTimeZone("UTC"));
//$datum->setTimezone($tz);
// $dt = new \DateTime($prediction['date'], new \DateTimeZone("UTC"));
$datum->setTimezone(new \DateTimeZone($this->time_zone));
$m = "Time check from time server " . $timeserver . ". ";
$m =
"In the timezone " .
$this->time_zone .
", it is " .
$datum->format("l") .
" " .
$datum->format("d/m/Y, H:i:s") .
". ";
} else {
$m = "Unfortunately, the time server $timeserver could not be reached at this time. ";
$m .= "$timercvd[1] $timercvd[2].\n";
}
$this->response = $m;
// Bear goes back to sleep.
$this->bear_message = $this->response;
}
} else {
$this->bear_message = $this->agent_input;
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function send_cntdwn_msg()\n{\n $current = new DateTime();\n $current->Sub(new Dateinterval(\"PT1H\"));\n\t$sqldate = $current->format(\"Y-m-d H:i:s\");\n $ipAddress = false;\n $stopparam = new TempPredictionStopParam($this->connector);\n $stopparam->build_id = $this->stopBuild->build_id;\n $send_count = 0;\n\n\n // Get IP to send message to - either last GPRS address in last hour or hard coded UDP receiver\n if ( $this->display_type == \"B\" )\n {\n $gprsStatus = new UnitStatus($this->connector);\n $gprsStatus->build_id = $this->stopBuild->build_id;\n $status = $gprsStatus->load(false, \" and message_time > '$sqldate'\");\n $status = $gprsStatus->load();\n if ( $status )\n {\n $ipAddress = $gprsStatus->ip_address;\n $connectTime = $gprsStatus->message_time;\n }\n }\n else\n {\n $stopparam->param_desc = \"ipAddress\";\n $status = $stopparam->load();\n if ( $status )\n {\n $ipAddress = $stopparam->ipAddress;\n $connectTime = $current->format(\"Y-m-d H:i:s\");\n }\n }\n\n if ( !$ipAddress )\n {\n $this->text .= \" - no current ip address for \".$this->stopBuild->build_code.\"\\n\";\n\t return false;\n }\n\n // Dont send if ip address has been assigned to unit more recently\n\tif ( $this->display_type == \"B\" ) \n {\n $gprsStatusDup = new UnitStatus($this->connector);\n $gprsStatusDup->ip_address = $ipAddress;\n $status = $gprsStatusDup->count(array(\"ip_address\"), \" and build_id != \".$this->stopBuild->build_id.\" AND message_time > '\".$connectTime.\"'\");\n //echo \" build_id != \".$this->stopBuild->build_id.\" AND message_time > '\".$connectTime.\"'\\n\";\n if ( $gprsStatusDup->selectCount > 0 )\n {\n $this->text .= \" sedncntdown: \".$this->stopBuild->build_code.\" ip $ipAddress / $connectTime is in use by another unit\";\n return false;\n }\n }\n\n\t$delivery = new PredictionDelivery($this->connector);\n\t$delivery->messageType = 0;\n\t$delivery->addressId = $this->stopBuild->build_code;\n\t$delivery->serviceCode = $this->service_code;\n\t$delivery->bay_no = $this->bay_no;\n\n\t$l_vehicle_code = $this->vehicle->vehicle_code;\n\t$l_build_code = $this->vehicleBuild->build_code;\n\t$l_build_id = $this->vehicleBuild->build_id;\n\n \n\n // Send unitId of 0 if ( $this is an autoroute\n\t// || $if ( $this is a CONT && $the vehicle is already expected at the stop for a REAL route.\n if ( $l_vehicle_code == \"AUT\" || $this->sch_rtpi_last_sent == \"P\" ) \n\t\t\t$delivery->unitId = 0;\n\telse\n {\n if ( !$this->vehicleBuild->build_code )\n {\n\t\t $this->text .= \"\tsend_cntdwn_msg: Failed to get build_code for vehicle_id \". $this->vehicle->vehice_code;\n\t\t\treturn false;\n }\n\t\telse \n {\n $delivery->unitId = $this->vehicleBuild->build_code;\n\t\t}\n\t}\n\n\t$delivery->journeyId = $this->pub_ttb_id;\n\n if ( $this->predictionParameters->countdown_dep_arr == \"A\" ) \n $time_string = $this->eta_last_sent;\n else\n $time_string = $this->etd_last_sent;\n\n $countdown_time_dt = DateTime::createFromFormat(\"Y-m-d H:i:s\", $time_string);\n\t$delivery->countdownTime = $countdown_time_dt->getTimestamp();\n\n\n $stopparam->param_desc = \"countdownMsgType\";\n\t$countdownType = 470;\n if ( $stopparam->load() && $stopparam->param_value )\n $countdownType = $stopparam->param_value;\n\n $stopparam->param_desc = \"destinationType\";\n\t$destinationColumn = \"dest_short1\";\n if ( $stopparam->load() && $stopparam->param_value )\n {\n if ( $stopparam->param_value == \"DEST50\" )\n $destinationColumn = \"dest_long\";\n }\n\n $destination = new Destination($this->connector);\n $destination->dest_id = $this->dest_id;\n if ( !$destination->load() )\n {\n $this->text .= \" Unable to fetch destination for id $this->dest_id\";\n }\n if ( !$destination->dest_short1 && $destination->dest_long ) $destination->dest_short1 = $destination->dest_long;\n if ( !$destination->dest_short1 && $destination->terminal_text ) $destination->dest_short1 = $destination->terminal_text;\n if ( !$destination->dest_long && $destination->dest_short1 ) $destination->dest_long = $destination->dest_short1;\n \n $destinationText = $destination->$destinationColumn;\n if ( $countdownType == 450 )\n $destinationText = substr($destinationText, 0, 15);\n\n $delivery->cntdwn_msg_ver = $countdownType;\n\n // Get vehicle and operator details\n $delivery->wheelchairAccess = 0;\n $delivery->operatorId = 0;\n if ( $this->vehicle->vehicle_id != 0 && $this->vehicle->vehicle_code != \"AUT\" )\n {\n // We have a rela vehicle tracking the prediction trip, get missing vehicle and operator details\n // so we can get operator loc_prefix - not sure why?\n if ( !$this->vehicle->load() )\n {\n $this->text .= \" Cant load vehicle for prediction\";\n return false;\n }\n\n $operator = new Operator($this->connector);\n $operator->operator_id = $this->vehicle->operator_id;\n if ( !$operator->load() )\n {\n $this->text .= \" Cant load operator for prediction\";\n return false;\n }\n $delivery->wheelchairAccess = $this->vehicle->wheelchair_access;\n $delivery->operatorId = $operator->loc_prefix;\n }\n\n\t// Get whether || $not an acknowledgment is currently required for\n\t// countdown messages.\n //echo \"TODO ackreqd\\n\";\n\t//$l_ack_reqd = $get_ack_reqd(450);\n\n $now = new DateTime();\n $delivery->id = 0;\n $delivery->messageType = $countdownType;\n $delivery->journey_fact_id = $this->journey_fact_id;\n $delivery->sequence = $this->sequencsequence;\n $delivery->send_time = $now->format(\"Y-m-d H:i:s\"); \n $delivery->pred_type = \"C\";\n $delivery->display_mode = $this->predictionParameters->countdown_dep_arr;\n $delivery->rtpi_eta_sent = $this->rtpi_eta_sent;\n $delivery->rtpi_etd_sent = $this->rtpi_etd_sent;\n $delivery->pub_eta_sent = $this->pub_eta_sent;\n $delivery->pub_eta_sent = $this->pub_etd_sent;\n $delivery->prediction = $time_string;\n\n \t$this->setOutboundQueue();\n\n\t$this->text = $this->text. \": >>> \".\n\t\t\t$ipAddress. \" \". \n\t\t\t\t$this->sch_rtpi_last_sent. \" \". \n\t\t\t\t$delivery->serviceCode. \" \". \n\t\t\t\tsubstr($destinationText, 0, 15). \" \".\n\t\t\t\tsubstr($time_string,11,8);\n\n\t//$m_status = $set_c_countdown_message();\n\tif ( true )\n {\n\t\t\tswitch($this->display_type)\n {\n\t\t\t\tcase \"U\" :\n\t\t\t\t\t//$m_status = $message_to_queue(m_external_sys_id,w_ip_address,LENGTH(w_ip_address),0,w_stop_build,l_ack_reqd)\n break;\n \t \tcase \"B\" :\n $junk1 = 0;\n $terminatingZero = 0;\n $send_count++;\n $destlen=strlen($destinationText);\n // I RL T\n if ( $delivery->messageType == 518 )\n {\n $msg = pack(\"A3Sa18SSSSSIA6SIIiCa10A${destlen}I\",\n \"PHP \",\n 3, // message type\n\n $ipAddress, // destination\n 1, // repeats\n $destlen + 48, // message length\n 0, // portNumber\n\n $delivery->messageType,\n $junk1,\n $delivery->addressId,\n substr($delivery->serviceCode, 0, 6),\n $delivery->operatorId,\n $delivery->unitId,\n $delivery->journeyId,\n $delivery->countdownTime,\n $delivery->wheelchairAccess,\n $delivery->bay_no,\n $destinationText,\n $terminatingZero\n );\n }\n else\n $msg = pack(\"A3Sa18SSSSSIA6SIIiCA${destlen}I\",\n \"PHP \",\n 3, // message type\n\n $ipAddress, // destination\n 1, // repeats\n $destlen + 38, // message length\n 0, // portNumber\n\n $delivery->messageType,\n $junk1,\n $delivery->addressId,\n substr($delivery->serviceCode, 0, 6),\n $delivery->operatorId,\n $delivery->unitId,\n $delivery->journeyId,\n $delivery->countdownTime,\n $delivery->wheelchairAccess,\n $destinationText,\n $terminatingZero\n );\necho \" Tid $delivery->bay_no, $delivery->messageType, $delivery->addressId, $delivery->serviceCode, $delivery->operatorId, $delivery->unitId, $delivery->journeyId, $delivery->countdownTime, $delivery->wheelchairAccess, $destinationText\\n\";\n if ( $this->outboundQueue )\n {\n if (!msg_send ($this->outboundQueue, 1, $msg ) )\n {\n $this->text .= \"Failed to send event to route tracker message queue\";\n echo $this->text.\"\\n\";\n }\n }\n\t\t\t}\n\t}\n\n if ( $send_count == 0 ) \n {\n $this->text = $this->text. \" UNSENT OUT OF DATE\";\n }\n\n //echo \"sent $send_count <BR>\";\n\treturn $send_count;\n\n}",
"private function detectServerRepair()\n {\n $h = date(\"H\", time());\n if ($h == \"03\") {\n Log::write(\"Server Repair Time,\", 2, \"spider\");\n sleep(3600);\n }\n }",
"function etherpadlite_cron () {\n return true;\n}",
"private function checkStatus()\n {\n $res = $this->parseBoolean(\n json_encode($this->getStatus()[\"timed_out\"])\n );\n\n if ($this->getStatus() == null)\n $this->setOnline(false);\n else if ($res)\n $this->setOnline(false);\n else\n $this->setOnline(true);\n }",
"private function refresh() {\r\n\r\n // try & catch wär zwar besser, funktioniert aber bei fsockopen leider nicht.. deshalb das unschöne @\r\n $this->socket = @fsockopen($this->ts3_host, $this->ts3_query, $errno, $errstr, $this->socket_timeout);\r\n\r\n if ($errno > 0 && $errstr != '') {\r\n $this->errors[] = 'fsockopen connect error: ' . $errno;\r\n return false;\r\n }\r\n\r\n if (!is_resource($this->socket)) {\r\n $this->errors[] = 'socket recource not exists';\r\n return false;\r\n }\r\n\r\n stream_set_timeout($this->socket, $this->socket_timeout);\r\n\r\n if (!empty($this->serverlogin) && !$this->sendCmd('login', $this->serverlogin['login'] . ' ' . $this->serverlogin['password'])) {\r\n $this->errors[] = 'serverlogin as \"' . $this->serverlogin['login'] . '\" failed';\r\n return false;\r\n }\r\n\r\n if (!$this->sendCmd(\"use \" . ( $this->ts3_sid ? \"sid=\" . $this->ts3_sid : \"port=\" . $this->ts3_port ))) {\r\n $this->errors[] = 'server select by ' . ( $this->ts3_sid ? \"ID \" . $this->ts3_sid : \"UDP Port \" . $this->ts3_port ) . ' failed';\r\n return false;\r\n }\r\n\r\n if (!$sinfo = $this->sendCmd('serverinfo')) {\r\n return false;\r\n }\r\n else {\r\n $this->sinfo = $this->splitInfo($sinfo);\r\n $this->sinfo['cachetime'] = time();\r\n\r\n if (substr($this->sinfo['virtualserver_version'], strpos($this->sinfo['virtualserver_version'], 'Build:') + 8, -1) < 11239) { // beta23 build is required\r\n $this->errors[] = 'your TS3Server build is to low..';\r\n return false;\r\n }\r\n }\r\n\r\n if (!$clist = $this->sendCmd('channellist', '-topic -flags -voice -limits')) {\r\n return false;\r\n }\r\n else {\r\n $clist = $this->splitInfo2($clist);\r\n foreach ($clist as $var) {\r\n $this->clist[] = $this->splitInfo($var);\r\n }\r\n }\r\n\r\n if (!$plist = $this->sendCmd('clientlist', '-away -voice -groups')) {\r\n $this->errors[] = 'playerlist not readable';\r\n return false;\r\n }\r\n else {\r\n $plist = $this->splitInfo2($plist);\r\n foreach ($plist as $var) {\r\n if (strpos($var, 'client_type=0') !== FALSE) {\r\n $this->plist[] = $this->splitInfo($var);\r\n }\r\n }\r\n\r\n if (!empty($this->plist)) {\r\n foreach ($this->plist as $key => $var) {\r\n $temp = '';\r\n if (strpos($var['client_servergroups'], ',') !== FALSE) {\r\n $temp = explode(',', $var['client_servergroups']);\r\n }\r\n else {\r\n $temp[0] = $var['client_servergroups'];\r\n }\r\n $t = '0';\r\n foreach ($temp as $t_var) {\r\n if ($t_var == '6') {\r\n $t = '1';\r\n }\r\n }\r\n if ($t == '1') {\r\n $this->plist[$key]['s_admin'] = '1';\r\n }\r\n else {\r\n $this->plist[$key]['s_admin'] = '0';\r\n }\r\n }\r\n\r\n usort($this->plist, array($this, \"cmp2\"));\r\n usort($this->plist, array($this, \"cmp1\"));\r\n }\r\n }\r\n\r\n fputs($this->socket, \"quit\\n\");\r\n\r\n $this->close();\r\n\r\n return true;\r\n }",
"function should_send($trip_type)\n{\n\n // --------------------------------------------------------------------\n\t// Is the sign not enabled?\n // --------------------------------------------------------------------\n if ( $this->predictionParameters->disabled == \"X\" ) \n {\n $this->text = $this->text. \"DIS\";\n\t\treturn false;\n }\n\n // --------------------------------------------------------------------\n // Surtronic communications protocol displays (TCP)\n // --------------------------------------------------------------------\n if ( $this->display_type == \"S\" ) \n {\n // Is the Surtronic sign registered && $ready?\n $sql = \n \"SELECT update_status, channel_number\n INTO l_update_status, l_channel\n FROM unit_status_sign\n WHERE build_id = \". $this->predictionParameters->build_id; \n $row = $this->connector->fetch1($sql);\n if ( $this->connector->errorCode != 0 || $row[\"channel_number\"] || $row[\"update_status\"] != \"T\" )\n {\n $this->text = $this->text. \"NOT_REGISTERED\";\n return false;\n }\n }\n\n // --------------------------------------------------------------------\n\t// Is the arrival unsuitable for the delivery mode\n // --------------------------------------------------------------------\n\tif ( $this->predictionParameters->delivery_mode && $this->predictionParameters->delivery_mode != \"RCA\" ) {\n\t\t$l_delivery_code = substr($trip_type, 0, 1);\n\t\tif ( !strstr($this->predictionParameters->delivery_mode, $l_delivery_code) ) {\n $this->text = $this->text. \"DIS\";\n return false;\n\t\t}\n\t}\n\n $currtime = new Datetime();\n $eta_last_sent = DateTime::createFromFormat(\"Y-m-d H:i:s\", $this->eta_last_sent);\n $etd_last_sent = DateTime::createFromFormat(\"Y-m-d H:i:s\", $this->etd_last_sent);\n\n // --------------------------------------------------------------------\n\t// Is arrival time is within echo window || $has passed\n // --------------------------------_------------------------------------\n if ( $this->predictionParameters->countdown_dep_arr == \"A\" ) {\n\t $l_comp_secs = $eta_last_sent->getTimestamp() - $currtime->getTimestamp();\n } else {\n\t $l_comp_secs = $etd_last_sent->getTimestamp() - $currtime->getTimestamp();\n }\n\n //echo \"HC WIN \";\n $this->predictionParameters->display_window = 7200;\n\tif ( $l_comp_secs > $this->predictionParameters->display_window || $l_comp_secs < -60 ) {\n if ( $l_comp_secs < -60 ) \n {\n $this->text = $this->text. \" ASSUME COUNTED_DOWN\";\n $w_display_line = true;\n return false;\n } else {\n if ( $l_comp_secs < -60 ) {\n $w_display_line = false;\n }\n\t\t $this->text = $this->text. \"WIN\". $l_comp_secs . \"/\". $this->predictionParameters->display_window;\n\t\t return false;\n }\n\t}\n\n // --------------------------------------------------------------------\n\t// Has vehicle already arrived/departed, if ( $so clear it down\n // --------------------------------------------------------------------\n if ( \n ( $this->predictionParameters->countdown_dep_arr == \"A\" && $this->arrival_status == \"A\" ) ||\n ( $this->predictionParameters->countdown_dep_arr == \"D\" && $this->departure_status == \"A\" ) \n ) {\n $this->text = $this->text. \" Already there Force Clear\";\n return false;\n }\n\n $this->prediction_stop_info->vehicle_id = $this->vehicle_id;\n $this->prediction_stop_info->dest_id = $this->dest_id;\n $this->prediction_stop_info->route_id = $this->route_id;\n $this->prediction_stop_info->build_id = $this->stopBuild->build_id;\n\n // --------------------------------------------------------------------\n\t// Does sign already have enough arrivals\n // --------------------------------------------------------------------\n if ( $this->prediction_stop_info->checkPrediction (\"NUMARRS\", $this->predictionParameters, $this->initialValues, $this ) != \"OK\" ) {\n if ( $this->time_last_sent ) {\n $this->text = $this->text. \" AA MA\";\n } else {\n $this->text = $this->text. \"TOO_MANY_ARRS\";\n return false;\n }\n }\n\n\t// ------------------------------------------------------------------------\n\t// Does sign already have enough arrivals for this destination\n\t// ------------------------------------------------------------------------\n if ( $this->prediction_stop_info->checkPrediction (\"NUMARRSPERDEST\", $this->predictionParameters, $this->initialValues, $this ) != \"OK\" ) {\n if ( $this->time_last_sent ) {\n $this->text = $this->text. \" AA MAD\";\n } else {\n $this->text = $this->text. \"TOO_MANY_ARRS_FOR_RT_DEST\";\n $w_display_line = false;\n return false;\n }\n }\n\n\t// ------------------------------------------------------------------------\n\t// As the bus stop is only able to handle one set of RTPI info \n\t// if ( $this arrival is the second || $more arrival of this vehicle at the\n // sign ) convert it to show published time\n\t// ------------------------------------------------------------------------\n if ( $this->prediction_stop_info->checkPrediction(\"DUPVEH\", $this->predictionParameters, $this->initialValues, $this ) != \"OK\" ) {\n $this->text = $this->text. \" DUPV->P\";\n $this->vehicle->vehicle_code = \"AUT\";\n $this->vehicle->vehicle_id = 0;\n }\n\n\t// ------------------------------------------------------------------------\n // Ensure arrival \n\t// For sequence/autoroute countdowns ensure resent every 5 minutes\n\t// ------------------------------------------------------------------------\n\tif ( $this->time_last_sent ) {\n if ( $this->sch_rtpi_last_sent != $this->initialValues->sch_rtpi_last_sent ) {\n $this->text = $this->text. \" \". $this->initialValues->sch_rtpi_last_sent. \"->\". $this->sch_rtpi_last_sent;\n } else {\n\t if ( $trip_type == \"AUT\" ) {\n $curr = new DateTime();\n $tls = DateTime::createFromFormat(\"Y-m-d H:i:s\", $this->time_last_sent);\n\t\t $l_sincelast_int = $curr->getTimestamp() - $tls->getTimestamp();\n\t\t $l_at_least_every = 180;\n if ( $l_sincelast_int > $l_at_least_every ) {\n $this->text = $this->text. \" $l_sincelast_int $l_at_least_every PFRC\";\n } else {\n $stat = $this->prediction_stop_info->checkPrediction(\"DELIVER\", $this->predictionParameters, $this->initialValues, $this );\n\n $this->prediction_stop_info->arr_no = 0;\n $this->prediction_stop_info->add();\n\t\t $this->text = $this->text. \" AUTlast \". $this->time_last_sent;\n $w_display_line = false;\n return false;\n\t\t }\n } else {\n // --------------------------------------------------------------------\n\t // Does prediction deviate enough from previous prediction\n // --------------------------------------------------------------------\n if ( $this->prediction_stop_info->checkPrediction (\"HASCHANGEDENOUGH\", $this->predictionParameters, $this->initialValues, $this ) != \"OK\" ) {\n // Force every x seconds\n $curr = new DateTime();\n $tls = DateTime::createFromFormat(\"Y-m-d H:i:s\", $this->time_last_sent);\n\t\t $l_sincelast_int = $curr->getTimestamp() - $tls->getTimestamp();\n\t\t $l_at_least_every = 120;\n if ($this->display_type == \"S\" ) {\n $this->text = $this->text. \" SNO_CHANGE\";;\n return false;;\n } else {\n\t\t if ( $l_sincelast_int > $l_at_least_every ) {\n $this->text = $this->text. \" FRC\";\n } else {\n $this->text = $this->text. \" NO_CHANGE\";\n return false;\n }\n }\n } else {\n $this->text = $this->text. \" \";\n }\n \n //this->prediction_stop_info->checkPrediction(\"DELIVER\", $this->predictionParameters, $this->initialValues, $this ) != \"OK\" ) \n\t\t //$this->text = $this->text. \" RTPlast \", UtilityDateTime::dateExtract($this->time_last_sent, \"hour to second\")\n //return false\n\t }\n }\n\t}\n $this->prediction_stop_info->vehicle_id = $this->vehicle_id;\n $this->prediction_stop_info->build_id = $this->build_id;\n $this->prediction_stop_info->route_id = $this->route_id;\n $this->prediction_stop_info->dest_id = $this->dest_id;\n\n $stat = $this->prediction_stop_info->checkPrediction(\"DELIVER\", $this->predictionParameters, $this->initialValues, $this );\n\n $this->prediction_stop_info->arr_no = 0;\n $this->prediction_stop_info->add();\n\n\treturn 1;\n}",
"protected function Ping()\n\t{\n\t\theader(BITS_HEADER_ACK);\n\t}",
"protected function checkTimeout()\n {\n $timestamp = time();\n if (($timestamp - $this->connectionTime) > $this->reconnectTimeout) {\n $this->disconnect();\n }\n }",
"function is_ok_smtp ($cmd = \"\"){\n\t\tif(empty($cmd))\t\t\t\t{ return false; }\n\t\tif (ereg (\"^220\", $cmd))\t{ return true; }\n\t\tif (ereg (\"^250\", $cmd))\t{ return true; }\n\t\treturn false;\n\t}",
"private function onPing()\n {\n $this->send($this->replyEvent());\n }",
"function get_remote_time($location, $switch){\n//get_remote_time use a remote database (from http://twiki.org) to provide remote local time; the database is up to date.\n//to use this service without buying an api is necessary to trick the file get operation by identify as Mozilla; curl will do this trick... ;-) \n\n//format: \tget_remote_time(\"Region/City\", switch);\n//examples:\n//\t\t\tget_remote_time(\"Europe/Bucharest\", 5);\n//\t\t\tget_remote_time(\"Europe/London\", 4);\n//\t\t\tget_remote_time(\"America/Toronto\", 7);\n\n//switches:\n//\t\t\t0 return current remote location day in week (ex: Sun for Sunday)\n//\t\t\t1 return current remote location day in a month (ex: 27)\n//\t\t\t2 return current remote location month (ex: May)\n//\t\t\t3 return current remote location year (ex: 2012)\n//\t\t\t4 return current remote location time (23:20:12 - HH:MM:SS)\n//\t\t\t5 return current remote location time shift related to GMT(+4:00 for GMT+4:00)\n//\t\t\t6 return current remote location zone abbreviation (ex: EEST stands for EEST – Eastern European Summer Time)\n//\t\t\t7 return remote location unprocessed string (ex: \"Sun, 13 May 2012, 16:57:10 -0400 (EDT)\" for America/Toronto)\n\n\t$link = \"http://twiki.org/cgi-bin/xtra/tzdate?tz=\".$location;\n\t$string = str_between(g_file($link), \"<!--tzdate:date-->\", \"<!--/tzdate:date-->\");\n\tif ($switch < 7) {\n\t $stk = explode(\" \",$string);\n\t $stk[0] = trim($stk[0], ',');\n\t $stk[5] = substr($stk[5],0,3).\":\".substr($stk[5],3);\n\t $stk[6] = trim($stk[6], '(,)');\n\treturn $stk[$switch];\n\t}\n\treturn $string;\n}",
"function _check_timeout($fp)\n\t{\n\t\tif ($this->read_timeout > 0) {\n\t\t\t$fp_status = socket_get_status($fp);\n\t\t\tif ($fp_status[\"timed_out\"]) {\n\t\t\t\t$this->timed_out = true;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}",
"public function hasServerTvBroadcastTime()\n {\n return $this->server_tv_broadcast_time !== null;\n }",
"public function isInTimeout();",
"function wp_refresh_heartbeat_nonces($response)\n {\n }",
"function timeoutHeartBeat()\n {\n if (3 == mt_rand(1, 7) && FALSE !== ($env = $this->getEnvironment())) {\n $env->tell($this->mChat[mt_rand(0, sizeof($this->mChat) - 1)]);\n }\n\n DpNpc::timeoutHeartBeat();\n }",
"function generic_ping($post_id = 0)\n {\n }",
"public function getTimeEnabled()\n {\n return !empty($_GET['t']) ? $_GET['t'] : false;\n }",
"function sub_cycle_event_func_wptc($request_type = null) {\r\n\r\n\t$options = WPTC_Factory::get('config');\r\n\r\n\twptc_reset_restore_if_long_time_no_ping();\r\n\r\n\t$tt = time();\r\n\t$usertime_full_stamp = $options->cnvt_UTC_to_usrTime($tt);\r\n\t$usertime_full = date('j M, g:ia', $usertime_full_stamp);\r\n\r\n\t$cur_time = date('Y-m-d H:i:s');\r\n\r\n\t$options->set_option('last_cron_triggered_time', $usertime_full);\r\n\t$first_backup_started_atleast_once = $options->get_option('first_backup_started_atleast_once');\r\n\r\n\r\n\tif (is_any_ongoing_wptc_restore_process() || is_any_ongoing_wptc_backup_process() || is_any_other_wptc_process_going_on() || !$options->get_option('default_repo') || !$options->get_option('main_account_email') || !$options->get_option('is_user_logged_in')) {\r\n\r\n\t\tif (is_any_ongoing_wptc_restore_process()) {\r\n\t\t\t$options->set_option('recent_restore_ping', time());\r\n\t\t\tsend_response_wptc('declined_restore_in_progress', WPTC_DEFAULT_CRON_TYPE);\r\n\t\t} else if (is_any_ongoing_wptc_backup_process()) {\r\n\t\t\t$options->set_option('recent_backup_ping', time());\r\n\t\t\twptc_set_backup_in_progress_server(true);\r\n\t\t\tsend_response_wptc('declined_backup_in_progress_and_retried', WPTC_DEFAULT_CRON_TYPE);\r\n\t\t} else if (is_any_other_wptc_process_going_on()) {\r\n\t\t\t// do_action('init_staging_wptc_h', time());\r\n\t\t\tsend_response_wptc('declined_staging_processes_in_progress', WPTC_DEFAULT_CRON_TYPE);\r\n\t\t} else if(!$options->get_option('default_repo')) {\r\n\t\t\tsend_response_wptc('declined_default_repo_empty', WPTC_DEFAULT_CRON_TYPE);\r\n\t\t} else if(!$options->get_option('main_account_email')) {\r\n\t\t\tsend_response_wptc('declined_main_account_email_empty', WPTC_DEFAULT_CRON_TYPE);\r\n\t\t} else if(!$options->get_option('is_user_logged_in')) {\r\n\t\t\tsend_response_wptc('declined_user_logged_out', WPTC_DEFAULT_CRON_TYPE);\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\t}\r\n\r\n\t$first_backup_started_but_not_completed = $options->get_option('starting_first_backup'); // true first backup started but not completed\r\n\r\n\t$timestamp_plus_secs = time() + ADVANCED_SECONDS_FOR_TIME_CALCULATION;\r\n\t$usertime = $options->get_wptc_user_today_date_time('Y-m-d', $timestamp_plus_secs);\r\n\t$wptc_today_main_cycle = $options->get_option('wptc_today_main_cycle');\r\n\r\n\tstorage_quota_check_wptc();\r\n\r\n\tif ($wptc_today_main_cycle == $usertime && !$first_backup_started_but_not_completed) {\r\n\r\n\t\tif( !apply_filters('validate_auto_backup_wptc', true) ){\r\n\r\n\t\t\twptc_log('', \"--------missed_backup_3--------\");\r\n\r\n\t\t\tsend_response_wptc('Scheduled backup is completed ', WPTC_DEFAULT_CRON_TYPE);\r\n\t\t}\r\n\r\n\t\tdo_action('start_auto_backup_wptc', time());\r\n\r\n\t} else {\r\n\r\n\t\tif ($wptc_today_main_cycle == $usertime) {\r\n\r\n\t\t\twptc_log('', \"--------missed_backup_4--------\");\r\n\r\n\t\t\tsend_response_wptc('Scheduled backup is completed', WPTC_DEFAULT_CRON_TYPE);\r\n\t\t}\r\n\r\n\t\twptc_main_cycle();\r\n\t}\r\n}",
"public function retrieveServerTime(){\n //http://www.thetvdb.com/api/Updates.php?type=none\n\t \n\t if(!$this->t_mirrors){\n\t\t$this->retrieveMirrors;\n\t }\n\t \n $url = $this->t_mirrors[0].'/api/Updates.php?type=none';\n \n //$xmlStr=$this->curl_get_file_contents($url);\n\t $c = curl_init();\n curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);\n curl_setopt($c, CURLOPT_URL, $url);\n $xmlStr = curl_exec($c);\n curl_close($c);\n \n $xmlServerTime = new SimpleXMLElement($xmlStr);\n return $xmlServerTime->Time;\n }",
"public function ping() {\n\t\t# Stub. Not essential to override.\n\t\treturn true;\n\t}",
"function reply_time() {\n\tglobal $reply;\n\treturn $reply['time'];\n}",
"private function _uptime()\n {\n if (CommonFunctions::executeProgram('uptime', '', $buf)) {\n if (preg_match(\"/up (\\d+) days,\\s*(\\d+):(\\d+),/\", $buf, $ar_buf) || preg_match(\"/up (\\d+) day,\\s*(\\d+):(\\d+),/\", $buf, $ar_buf)) {\n $min = $ar_buf[3];\n $hours = $ar_buf[2];\n $days = $ar_buf[1];\n $this->sys->setUptime($days * 86400 + $hours * 3600 + $min * 60);\n }\n }\n }",
"function ntp_no_canon() {\n return '';\n}",
"protected function _prepare()\n {\n $frac = microtime();\n $fracba = ($frac & 0xff000000) >> 24;\n $fracbb = ($frac & 0x00ff0000) >> 16;\n $fracbc = ($frac & 0x0000ff00) >> 8;\n $fracbd = ($frac & 0x000000ff);\n\n $sec = (time() + 2208988800);\n $secba = ($sec & 0xff000000) >> 24;\n $secbb = ($sec & 0x00ff0000) >> 16;\n $secbc = ($sec & 0x0000ff00) >> 8;\n $secbd = ($sec & 0x000000ff);\n\n // Flags\n $nul = chr(0x00);\n $nulbyte = $nul . $nul . $nul . $nul;\n $ntppacket = chr(0xd9) . $nul . chr(0x0a) . chr(0xfa);\n\n /*\n * Root delay\n *\n * Indicates the total roundtrip delay to the primary reference\n * source at the root of the synchronization subnet, in seconds\n */\n $ntppacket .= $nul . $nul . chr(0x1c) . chr(0x9b);\n\n /*\n * Clock Dispersion\n *\n * Indicates the maximum error relative to the primary reference source at the\n * root of the synchronization subnet, in seconds\n */\n $ntppacket .= $nul . chr(0x08) . chr(0xd7) . chr(0xff);\n\n /*\n * ReferenceClockID\n *\n * Identifying the particular reference clock\n */\n $ntppacket .= $nulbyte;\n\n /*\n * The local time, in timestamp format, at the peer when its latest NTP message\n * was sent. Contanis an integer and a fractional part\n */\n $ntppacket .= chr($secba) . chr($secbb) . chr($secbc) . chr($secbd);\n $ntppacket .= chr($fracba) . chr($fracbb) . chr($fracbc) . chr($fracbd);\n\n /*\n * The local time, in timestamp format, at the peer. Contains an integer\n * and a fractional part.\n */\n $ntppacket .= $nulbyte;\n $ntppacket .= $nulbyte;\n\n /*\n * This is the local time, in timestamp format, when the latest NTP message from\n * the peer arrived. Contanis an integer and a fractional part.\n */\n $ntppacket .= $nulbyte;\n $ntppacket .= $nulbyte;\n\n /*\n * The local time, in timestamp format, at which the\n * NTP message departed the sender. Contanis an integer\n * and a fractional part.\n */\n $ntppacket .= chr($secba) . chr($secbb) . chr($secbc) . chr($secbd);\n $ntppacket .= chr($fracba) . chr($fracbb) . chr($fracbc) . chr($fracbd);\n\n return $ntppacket;\n }",
"function om13_wait_for_going_live() {\n\tif (time() < 1365447600 && !is_user_logged_in()) {\n\t\twp_die('Die Website der #om13 ist demnächst verfügbar. Bei Fragen kannst du gern den Twitteraccount <a href=\"https://twitter.com/openmindkonf\">@openmindkonf</a> kontaktieren. Wir freuen uns auf dich!'); // TODO: __\n\t}\n}",
"public function test_get_pw_changed_time__0() {\n\t\t$actual = self::$lss->get_pw_changed_time($this->user->ID);\n\t\t$this->assertSame(0, $actual);\n\t}",
"public function should_run()\n\t{\n\t\treturn $this->config['delete_pms_last_gc'] < time() - $this->config['delete_pms_gc'];\n\t}",
"public function ping(): bool\n {\n $ping = $this->send(\"PING\");\n\n if($ping == \"PONG\") {\n return true;\n }\n\n $this->message = trans('clamavfileupload::clamav.not_running');\n ClamavIsNotRunning::dispatch();\n\n return false;\n }",
"function get_to_ping($post)\n {\n }"
]
| [
"0.5358862",
"0.52541333",
"0.52417123",
"0.52409226",
"0.5150787",
"0.5086303",
"0.5082719",
"0.50663257",
"0.5056325",
"0.5010953",
"0.49747655",
"0.49531448",
"0.49449086",
"0.49419537",
"0.4931662",
"0.49180624",
"0.49171072",
"0.4916608",
"0.4885348",
"0.4872519",
"0.48656029",
"0.48604712",
"0.4858124",
"0.48470798",
"0.484485",
"0.48374858",
"0.4836784",
"0.48162705",
"0.4809662",
"0.48094246"
]
| 0.7596663 | 0 |
Persists model form and returns the created/updated `ScreenComment` model. | public function save(): ?ScreenComment
{
if ($this->validate()) {
$user = $this->getUser();
$comment = $this->getScreenComment() ?: (new ScreenComment);
$isNewRecord = $comment->isNewRecord;
$comment->from = $isNewRecord ? $user->email : $comment->from;
$comment->message = $this->message;
if (
$this->replyTo &&
($replyToComment = ScreenComment::findById($this->replyTo))
) {
$comment->screenId = $replyToComment->screenId;
$comment->replyTo = $replyToComment->id;
$comment->status = ScreenComment::STATUS['PENDING'];
$comment->left = 0.0;
$comment->top = 0.0;
} else {
$comment->screenId = $this->screenId;
$comment->replyTo = null;
$comment->status = $this->status;
$comment->left = (float) $this->left;
$comment->top = (float) $this->top;
}
if ($comment->save()) {
if ($isNewRecord) {
$comment->createNotifications();
}
$comment->refresh();
return $comment;
}
}
return null;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function save(): ?ScreenComment\n {\n if ($this->validate()) {\n $comment = new ScreenComment;\n $comment->from = $this->from;\n $comment->message = $this->message;\n $comment->status = ScreenComment::STATUS['PENDING'];\n\n if (\n $this->replyTo &&\n ($replyToComment = ScreenComment::findById($this->replyTo))\n ) {\n $comment->screenId = $replyToComment->screenId;\n $comment->replyTo = $replyToComment->id;\n $comment->left = 0.0;\n $comment->top = 0.0;\n } else {\n $comment->screenId = $this->screenId;\n $comment->replyTo = null;\n $comment->left = (float) $this->left;\n $comment->top = (float) $this->top;\n }\n\n if ($comment->save()) {\n $comment->createNotifications();\n\n $comment->refresh();\n\n return $comment;\n }\n }\n\n return null;\n }",
"public function saveAction()\n {\n\n if (!$this->request->isPost()) {\n return $this->dispatcher->forward(array(\n \"controller\" => \"comments\",\n \"action\" => \"index\"\n ));\n }\n\n $id = $this->request->getPost(\"id\");\n\n $comment = Comments::findFirstByid($id);\n if (!$comment) {\n $this->flash->error(\"comment does not exist \" . $id);\n\n return $this->dispatcher->forward(array(\n \"controller\" => \"comments\",\n \"action\" => \"index\"\n ));\n }\n\n $comment->model = $this->request->getPost(\"model\");\n $comment->model_id = $this->request->getPost(\"model_id\");\n $comment->body = $this->request->getPost(\"body\");\n \n\n if (!$comment->save()) {\n\n foreach ($comment->getMessages() as $message) {\n $this->flash->error($message);\n }\n\n return $this->dispatcher->forward(array(\n \"controller\" => \"comments\",\n \"action\" => \"edit\",\n \"params\" => array($comment->id)\n ));\n }\n\n $this->flash->success(\"comment was updated successfully\");\n\n return $this->dispatcher->forward(array(\n \"controller\" => \"comments\",\n \"action\" => \"index\"\n ));\n\n }",
"public function save()\n\t{\n\t\t// Check for request forgeries.\n\t\tFoundry::checkToken();\n\n\t\t// Only registered users are allowed here.\n\t\tFoundry::requireLogin();\n\n\t\t// Get the view\n\t\t$view \t= $this->getCurrentView();\n\n\t\t// Check for permission first\n\t\t$access = Foundry::access();\n\n\t\tif( !$access->allowed( 'comments.add' ) )\n\t\t{\n\t\t\t$view->setMessage( 'ACL: Not allowed to add comments', SOCIAL_MSG_ERROR );\n\t\t\treturn $view->call( __FUNCTION__ );\n\t\t}\n\n\t\t$element\t= JRequest::getString( 'element', '' );\n\t\t$group\t\t= JRequest::getString( 'group', SOCIAL_APPS_GROUP_USER );\n\t\t$uid\t\t= JRequest::getInt( 'uid', 0 );\n\t\t$input\t\t= JRequest::getVar( 'input', '' , 'post' , 'none' , JREQUEST_ALLOWRAW );\n\t\t$data\t\t= JRequest::getVar( 'data', array() );\n\t\t$streamid\t= JRequest::getVar( 'streamid', '' );\n\t\t$parent\t\t= JRequest::getInt( 'parent', 0 );\n\n\t\t$compositeElement = $element . '.' . $group;\n\n\t\t$table\t\t= Foundry::table( 'comments' );\n\n\t\t$table->element = $compositeElement;\n\t\t$table->uid = $uid;\n\t\t$table->comment = $input;\n\t\t$table->created_by = Foundry::user()->id;\n\t\t$table->created = Foundry::date()->toSQL();\n\t\t$table->parent = $parent;\n\t\t$table->params = $data;\n\n\t\t$state\t\t= $table->store();\n\n\t\tif( !$state )\n\t\t{\n\t\t\t$view->setMessage( $table->getError(), SOCIAL_MSG_ERROR );\n\t\t}\n\n\t\tif( $streamid )\n\t\t{\n\t\t\t$stream = Foundry::stream();\n\t\t\t$stream->updateModified( $streamid );\n\t\t}\n\n\t\t// Process mentions for this comment\n\t\tif( isset( $data['mentions']) && !empty( $data[ 'mentions' ] ) )\n\t\t{\n\t\t\tforeach( $data[ 'mentions' ] as $row )\n\t\t\t{\n\t\t\t\t$mention \t\t= (object) $row;\n\n\t\t\t\t$tag \t\t\t= Foundry::table( 'Tag' );\n\t\t\t\t$tag->offset\t= $mention->start;\n\t\t\t\t$tag->length\t= $mention->length;\n\t\t\t\t$tag->type \t\t= $mention->type;\n\n\t\t\t\tif( $tag->type == 'hashtag' )\n\t\t\t\t{\n\t\t\t\t\t$tag->title = $mention->value;\n\t\t\t\t}\n\n\t\t\t\tif( $tag->type == 'entity' )\n\t\t\t\t{\n\t\t\t\t\t$value \t\t\t\t= (object) $mention->value;\n\t\t\t\t\t$tag->item_id \t\t= $value->id;\n\t\t\t\t\t$tag->item_type \t= SOCIAL_TYPE_USER;\n\t\t\t\t}\n\n\t\t\t\t$tag->creator_id \t= Foundry::user()->id;\n\t\t\t\t$tag->creator_type \t= SOCIAL_TYPE_USER;\n\n\t\t\t\t$tag->target_id \t= $table->id;\n\t\t\t\t$tag->target_type \t= 'comments';\n\n\t\t\t\t$tag->store();\n\t\t\t}\n\t\t}\n\n\t\t$dispatcher = Foundry::dispatcher();\n\n\t\t$comments \t= array( &$table );\n\t\t$args \t\t= array( &$comments );\n\n\t\t// @trigger: onPrepareComments\n\t\t$dispatcher->trigger( $group , 'onPrepareComments' , $args );\n\n\t\treturn $view->call( __FUNCTION__, $table );\n\t}",
"public function save() {\r\n if ($this->model->getId()) {\r\n return $this->model->update();\r\n }\r\n return $this->create();\r\n }",
"public function store()\n {\n if (Validate::commentForm()) {\n $comment = $this->Model->store();\n\n if ($comment) {\n Session::set('comment_added', true);\n }else Session::set('db_error_comment', true);\n }else Session::set('validate_error', true);\n\n Session::set('posted_data', Input::getAll());\n Session::setMany(Validate::getErrors());\n Redirect::to('post/show/' . Input::get('post_id'));\n }",
"public function store(StoreCommentRequest $request)\n {\n return auth()->user()->comments()->create($request->validated());\n }",
"public function store(Requests\\StoreCommentFormRequest $request) {\n Comment::create($request->all());\n\n return back()->with('message', 'Commentaire en attente de validation');\n }",
"public function store(CommentFormRequest $request){\n $input = $request->all();\n $this->comment->store($input, Auth::user());\n return redirect('home');\n }",
"public function store(Request $request)\n {\n $this->validate($request, [\n 'comment' => 'required'\n ]);\n\n $request->merge([\n 'first_name' => Auth::user()->first_name,\n 'last_name' => Auth::user()->last_name\n ]);\n\n $comment = Comment::create($request->all());\n\n $room = Room::find($request->get('room_id'));\n $room->comments()->associate($comment);\n $room->save();\n\n Auth::user()->comments()->associate($comment);\n Auth::user()->save();\n\n $comment->user()->associate(Auth::user());\n $comment->room()->associate($room);\n $comment->save();\n\n return redirect()->route('room', ['id' => $room->_id]);\n }",
"function saveComment(){\n\t\t$this->layout = 'ajax';\n\t\t$user_id = $_POST['user_id'];\n\t\t$feeds_id = $_POST['business_feeds_id'];\n\t\t$comment = $_POST['comment'];\n\t\t$membership_id = $_POST['membershipPlan'];\n\n\t\t$saveData['user_id'] = $user_id;\n\t\t$saveData['feed_id'] = $feeds_id;\n\t\t$saveData['comment'] = $comment;\n\t\tif($membership_id != 1){\n\t\t\t$saveData['status'] = 1;\n\t\t} else {\n\t\t\t$saveData['status'] = 2;\n\t\t}\n\n\t\t$this->Comment->save($saveData);\n\n\t\t$this->set('comment', $comment);\n\n\t\t$last_id = $this->Comment->id;\n\t\t$commentArr = $this->Comment->find('first', array('conditions'=>array('Comment.id'=>$last_id, 'Comment.status'=>'1')));\n\t\t$this->set('commentArr', $commentArr);\n\t\tif(!empty($commentArr)){\n\t\t$userr_id = $commentArr['Comment']['user_id'];\n\t\t$this->set('userr_id', $userr_id);\n\t\t}\t\n\t\t$this->set('last_id', $last_id);\n\t}",
"public function storeAction()\n {\n $comment = new Comment();\n\n $comment->create($_POST);\n\n return redirect('');\n }",
"public function save(Identifiable $model);",
"public function store() {\r\n //\r\n if (!Sentry::check()) {\r\n $input = Input::except('slug', 'parent_id');\r\n $validation = Validator::make($input, Comment::$rules);\r\n if ($validation->fails()) {\r\n return Redirect::to('artikel/' . Input::get('slug'))->withInput($input)->withErrors($validation);\r\n }\r\n $telo = new Comment();\r\n $telo->fill($input);\r\n $post = Artikel::find(Input::get('post_id'));\r\n $telo->artikel()->associate($post);\r\n if ($telo->save()) {\r\n $root = Comment::find(Input::get('parent_id'));\r\n $telo->makeChildOf($root);\r\n return Redirect::to('artikel/' . Input::get('slug'));\r\n }\r\n } else {\r\n $user = Sentry::getUser();\r\n $input = array(\r\n 'nama' => ucfirst($user->first_name) . ' ' . ucfirst($user->last_name),\r\n 'url' => 'arnosa.net',\r\n 'email' => $user->email,\r\n 'komentar' => strip_tags(Input::get('komentar')),\r\n );\r\n }\r\n $com = new Comment();\r\n $com->fill($input);\r\n $post = Artikel::find(Input::get('post_id'));\r\n $com->artikel()->associate($post);\r\n if ($com->save()) {\r\n if (Input::get('parent_id')) {\r\n $root = Comment::find(Input::get('parent_id'));\r\n $com->makeChildOf($root);\r\n }\r\n return Redirect::route('admin.comments.index');\r\n }\r\n }",
"protected function newComment($model)\n {\n $comment=new Comment;\n if(isset($_POST['Comment']))\n {\n $comment->attributes=$_POST['Comment'];\n if(!Yii::app()->user->isGuest)\n\t{\n\t\t$comment->authorName=Yii::app()->user->username;\n\t\t$comment->email=Yii::app()->user->email;\n\t\t$comment->authorId=Yii::app()->user->id;\n\t}\n\telse\n\t{\t //MFM\n\t\t$comment->authorName=$comment->attributes['authorName'];\n\t\t$comment->email=$comment->attributes['email'];\n\t}\n\t$comment->content=$comment->attributes['content'];\n\t$comment->url=$comment->attributes['url'];\n\n if(Yii::app()->user->isGuest && Yii::app()->params['commentNeedApproval'])\n $comment->status=Comment::STATUS_PENDING;\n else\n $comment->status=Comment::STATUS_APPROVED;\n\n $comment->postId=$model->id;\n\n if(isset($_POST['previewComment']))\n $comment->validate();\n else\n if(isset($_POST['submitComment']) && $comment->save())\n {\n if($comment->status==Comment::STATUS_PENDING)\n {\n Yii::app()->user->setFlash('commentSubmittedMessage',Yii::t('lan','Thank you for your comment. Your comment will be posted once it is approved.'));\n $this->refresh();\n }\n else\n $this->redirect(array('show','slug'=>$model->slug,'#'=>'c'.$comment->id));\n }\n }\n return $comment;\n }",
"public function store()\n {\n $attrs = $this->validateComment();\n\n Comment::create($attrs);\n\n return redirect('/posts');\n }",
"public function commentStore() {\n\t\t$post_id = $_POST['post_id'];\n\t\t$text = $_POST['text'];\n\t\t$comment = new Comment([$post_id, $text]);\n\t\t$comment->save();\n\t}",
"public function save($model);",
"public function save(Authenticatable $model);",
"public function store(Comment $comment)\n {\n // validate incoming data with validation rules\n $this->validate(request(), [\n 'new_reply' => 'required|min:1|max:255'\n ]);\n\n /**\n store the new reply through relationship,\n through this way you don't have to\n provide `comment_id` field inside create() method\n */\n $comment->replies()->create([\n 'user_id' => auth()->id(),\n 'body' => request()->new_reply\n ]);\n\n // redirect to the previous URL\n return redirect()->back();\n }",
"public function save()\n {\n $this->checkForNecessaryProperties();\n\n $this->update($this->getCurrentId(), $this->data);\n }",
"public function store()\n\t{\n\t\t$input = Input::all();\n\t\t$this->commentary->commentary = $input['commentary'];\n\t\t$this->commentary->mid = $input['mid'];\n\t\t$this->commentary->time = $input['time'];\n\t\tif($this->commentary->save()){\n\t\t\t\\Session::flash('notice','Successfully added');\n\t\t\treturn redirect()->back();\n\t\t}\n\t}",
"public function store()\n {\n $this->validate([\n 'body' => 'required|min:5'\n ]);\n /* Almacenamos los campos en la DB */\n Comment::create([\n 'body' => $this->body,\n 'user_id' => Auth::user()->id,\n ]);\n $this->default();\n }",
"public function save($model) {\n return parent::save($model);\n }",
"public function save()\n {\n $this->checkModel();\n if (!is_null($this->profile)) $this->saved = $this->profile->save();\n }",
"public function saveAction()\n {\n $form = $this->getForm();\n $form->setData($_POST);\n try {\n $valid = $form->isValid();\n } catch (\\Exception $e) {\n $valid = false;\n }\n if (!$valid)\n {\n $this->getSessionStorage()->fromArray(['form' => $form]);\n return $this->redirect()->toRoute($this->routeName, ['action' => 'edit']);\n }\n $modelName = $this->modelName;\n $model = new $modelName();\n $model->exchangeArray($this->getDataFromRequest());\n $this->sm->get($this->mainTableFactory)->save($model);\n return $this->redirect()->toRoute($this->routeName);\n }",
"public function save() {\n\n return isset($this->id) ? $this->update() : $this->create();\n }",
"public function store(Request $request)\n {\n $request->validate([\n 'comment' => ['required'],\n 'film_id' => ['required']\n ]);\n\n $comment = new Comment([\n 'comment' => $request->input('comment'),\n 'film_id' => $request->input('film_id'),\n 'user_id' => Auth::id()\n ]);\n $comment->save();\n\n return $comment;\n }",
"public function store(Request $request)\n {\n // return $request->all();\n $comment = new DirectComment;\n $comment->comment = $request->comment;\n $comment->post_id = 1;\n $comment->user_id = Auth::id();\n $comment->save();\n return $comment;\n }",
"public function save() {\n return isset($this->id) ? $this->update() : $this->create();\n }",
"public function takeModel()\n {\n return Comment::class;\n }"
]
| [
"0.6792862",
"0.5931886",
"0.58542407",
"0.56830025",
"0.55532944",
"0.5527788",
"0.5524882",
"0.53696376",
"0.5351451",
"0.53174573",
"0.5296563",
"0.52663326",
"0.52244365",
"0.5157345",
"0.51543283",
"0.5149078",
"0.5124249",
"0.51101196",
"0.5106191",
"0.5103197",
"0.5100721",
"0.5096333",
"0.5092071",
"0.5053963",
"0.50491124",
"0.50380296",
"0.503391",
"0.5021985",
"0.4987899",
"0.49852064"
]
| 0.6901158 | 0 |
Form validation handler for mongo_node_type_create_form(). | function mongo_node_type_create_form_validate($form, $form_state) {
$set = mongo_node_settings();
$machine_name = $form_state['values']['name'];
if (isset($set[$machine_name])) {
form_set_error('name', t('Machine name @machine_name already exists', array('@machine_name' => $machine_name)));
return FALSE;
}
return TRUE;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function mongo_node_form_validate(&$form, &$form_state) {\n $entity_type = $form_state['entity_type'];\n $entity = $form_state[$entity_type];\n field_attach_form_validate($entity_type, $entity, $form, $form_state);\n}",
"function mongo_node_form($form, &$form_state, $entity, $entity_type) {\n $form = array();\n\n $form_state['entity_type'] = $entity_type;\n if (!isset($form_state[$entity_type])) {\n $form_state[$entity_type] = $entity;\n }\n else {\n $entity = $form_state[$entity_type];\n }\n\n // Get title label name from properties if exists\n static $settings = array();\n if(empty($settings)) {\n $settings = mongo_node_settings();\n }\n $title = isset($settings[$entity_type]['properties']['title']['label']) ? $settings[$entity_type]['properties']['title']['label'] : t('Title');\n\n $form['title'] = array(\n '#type' => 'textfield',\n '#title' => $title,\n '#required' => TRUE,\n '#default_value' => isset($entity->title) ? $entity->title : '',\n );\n\n $form['#attributes']['class'][] = 'mongo-node-form';\n if (!empty($entity->type)) {\n // TODO -- add entity type with bundle.\n $form['#attributes']['class'][] = 'mongo-node-' . $entity->type . '-form';\n }\n\n $form['actions'] = array('#type' => 'actions');\n $form['actions']['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save'),\n '#weight' => 5,\n '#submit' => array('mongo_node_form_submit'),\n );\n\n $form['#validate'][] = 'mongo_node_form_validate';\n field_attach_form($entity_type, $entity, $form, $form_state);\n\n return $form;\n}",
"function mongo_node_bundle_create_form_validate($form, $form_state) {\n if (empty($form_state['values']['name'])) {\n form_set_error('name', t('Machine name @machine_name already exists', array('@machine_name' => $machine_name)));\n return FALSE;\n }\n\n $machine_name = $form_state['values']['name'];\n $entity_type = $form_state['values']['entity_type'];\n\n $set = mongo_node_settings();\n\n if (isset($set[$entity_type]['bundles'][$machine_name])) {\n form_set_error('name', t('Machine name @machine_name already exists', array('@machine_name' => $machine_name)));\n return FALSE;\n }\n return TRUE;\n}",
"function mongo_node_type_create_form_submit($form, $form_state) {\n $label = $form_state['values']['label'];\n $machine_name = $form_state['values']['name'];\n\n $set = mongo_node_settings();\n $set += mongo_node_type_default_settings($label, $machine_name);\n\n // @todo - redirect to entity type page\n mongo_node_settings_save($set);\n}",
"protected function type_validation()\n {\n if (is_superadmin_loggedin()) {\n $this->form_validation->set_rules('branch_id', translate('branch'), 'required');\n }\n $this->form_validation->set_rules('type_name', translate('name'), 'trim|required|callback_unique_type');\n }",
"function mongo_node_bundle_create_form($form, $form_state, $entity_type) {\n $form = array();\n\n $form['label'] = array(\n '#type' => 'textfield',\n '#title' => t('Entity type'),\n '#description' => t('The human readable name of the entity.'),\n );\n\n $form['name'] = array(\n '#type' => 'machine_name',\n '#required' => FALSE,\n '#machine_name' => array(\n 'exists' => '_mongo_node_bundle_exists',\n 'source' => array('label'),\n ),\n );\n\n $form['description'] = array(\n '#type' => 'textarea',\n '#title' => t('Description'),\n '#description' => t('Describe this bundle.'),\n );\n\n $form['entity_type'] = array(\n '#type' => 'value',\n '#value' => $entity_type,\n );\n\n $form['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save'),\n );\n\n return $form;\n}",
"function mongo_node_type_edit_form($form, $form_state, $entity_type) {\n $set = mongo_node_settings();\n $form = array();\n\n $form['label'] = array(\n '#type' => 'textfield',\n '#title' => t('Entity type'),\n '#default_value' => $set[$entity_type]['label'],\n '#description' => t('The human readable name of the entity.'),\n );\n\n $form['name'] = array(\n '#type' => 'machine_name',\n '#required' => FALSE,\n '#default_value' => $entity_type,\n '#machine_name' => array(\n 'exists' => '_mongo_node_type_exists',\n 'source' => array('label'),\n ),\n );\n\n // Send entity type.\n $form['entity_type'] = array(\n '#type' => 'value',\n '#value' => $entity_type,\n );\n\n $form['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save'),\n );\n\n return $form;\n}",
"function mongo_node_form_submit(&$form, &$form_state) {\n $entity_type = $form_state['entity_type'];\n $entity = entity_ui_controller($entity_type)->entityFormSubmitBuildEntity($form, $form_state);\n $insert = empty($entity->mid);\n entity_save($entity_type, $entity);\n\n $info = entity_get_info($entity_type);\n $bundle_key = $info['bundle keys']['bundle'];\n $bundle_label = $info['bundles'][$entity->{$bundle_key}]['label'];\n\n if ($insert) {\n drupal_set_message(t('@label %title has been created.',\n array(\n '@label' => $bundle_label,\n '%title' => $entity->title,\n )\n )\n );\n }\n else {\n drupal_set_message(t('@label %title has been updated.',\n array(\n '@label' => $bundle_label,\n '%title' => $entity->title,\n )\n )\n );\n }\n\n $uri = entity_uri($entity_type, $entity);\n $form_state['redirect'] = drupal_get_path_alias($uri['path']);\n}",
"function mongo_node_operation_validate($form, &$form_state) {\n if (!is_array($form_state['values']['entities']) || !count(array_filter($form_state['values']['entities']))) {\n form_set_error('', t('No items selected.'));\n }\n}",
"function mongo_node_add($entity_type, $bundle) {\n global $user;\n $set = mongo_node_settings();\n\n $entity = entity_create($entity_type, array(\n 'uid' => $user->uid,\n 'name' => (isset($user->name) ? $user->name : ''),\n 'type' => $bundle,\n 'language' => LANGUAGE_NONE,\n )\n );\n $form_id = $entity_type . '_' . $bundle . '_mongo_node_form';\n $output = drupal_get_form($form_id, $entity, $entity_type);\n\n return $output;\n}",
"function mongo_node_type_edit_form_submit($form, $form_state) {\n $label = $form_state['values']['label'];\n $machine_name = $form_state['values']['name'];\n $old_entity_type = $form_state['values']['entity_type'];\n\n $set = mongo_node_settings();\n\n if ($machine_name != $old_entity_type) {\n $set += mongo_node_type_default_settings($label, $machine_name);\n $set[$machine_name] = $set[$old_entity_type];\n unset($set[$old_entity_type]);\n\n // Update existing mongo entities with new entity type.\n _mongo_node_update_type($old_entity_type, $machine_name);\n }\n else {\n $set[$machine_name]['label'] = $label;\n }\n\n // Save settings.\n mongo_node_settings_save($set);\n return TRUE;\n}",
"function ting_visual_relation_slide_form_validate($form, &$form_state) {\n if (empty($form_state['values']['name'])) {\n form_set_error('name', t('Please enter a name for the slide'));\n }\n $type = $form_state['values']['type'];\n switch ($type) {\n case 'external':\n case 'circular':\n $datawell_pid = $form_state['values']['datawell_pid'];\n // TODO: use a regex to validate the datawell-PID.\n if (empty($datawell_pid)) {\n form_set_error('datawell_pid', t('Please enter a valid datawell-PID'));\n }\n break;\n case 'structural':\n if (empty($form_state['values']['search_query'])) {\n form_set_error('search_query', t('Please enter a search query'));\n }\n }\n}",
"function node_form(&$form_state, $node) {\n global $user;\n\n if (isset($form_state['node'])) {\n $node = $form_state['node'] + (array)$node;\n }\n if (isset($form_state['node_preview'])) {\n $form['#prefix'] = $form_state['node_preview'];\n }\n $node = (object)$node;\n foreach (array('body', 'title', 'format') as $key) {\n if (!isset($node->$key)) {\n $node->$key = NULL;\n }\n }\n if (!isset($form_state['node_preview'])) {\n node_object_prepare($node);\n }\n else {\n $node->build_mode = NODE_BUILD_PREVIEW;\n }\n\n // Set the id of the top-level form tag\n $form['#id'] = 'node-form';\n\n // Basic node information.\n // These elements are just values so they are not even sent to the client.\n foreach (array('nid', 'vid', 'uid', 'created', 'type', 'language') as $key) {\n $form[$key] = array(\n '#type' => 'value',\n '#value' => isset($node->$key) ? $node->$key : NULL,\n );\n }\n\n // Changed must be sent to the client, for later overwrite error checking.\n $form['changed'] = array(\n '#type' => 'hidden',\n '#default_value' => isset($node->changed) ? $node->changed : NULL,\n );\n // Get the node-specific bits.\n if ($extra = node_invoke($node, 'form', $form_state)) {\n $form = array_merge_recursive($form, $extra);\n }\n if (!isset($form['title']['#weight'])) {\n $form['title']['#weight'] = -5;\n }\n\n $form['#node'] = $node;\n\n // Add a log field if the \"Create new revision\" option is checked, or if the\n // current user has the ability to check that option.\n if (!empty($node->revision) || user_access('administer nodes')) {\n $form['revision_information'] = array(\n '#type' => 'fieldset',\n '#title' => t('Revision information'),\n '#collapsible' => TRUE,\n // Collapsed by default when \"Create new revision\" is unchecked\n '#collapsed' => !$node->revision,\n '#weight' => 20,\n );\n $form['revision_information']['revision'] = array(\n '#access' => user_access('administer nodes'),\n '#type' => 'checkbox',\n '#title' => t('Create new revision'),\n '#default_value' => $node->revision,\n );\n $form['revision_information']['log'] = array(\n '#type' => 'textarea',\n '#title' => t('Log message'),\n '#default_value' => (isset($node->log) ? $node->log : ''),\n '#rows' => 2,\n '#description' => t('An explanation of the additions or updates being made to help other authors understand your motivations.'),\n );\n }\n\n // Node author information for administrators\n $form['author'] = array(\n '#type' => 'fieldset',\n '#access' => user_access('administer nodes'),\n '#title' => t('Authoring information'),\n '#collapsible' => TRUE,\n '#collapsed' => TRUE,\n '#weight' => 20,\n );\n $form['author']['name'] = array(\n '#type' => 'textfield',\n '#title' => t('Authored by'),\n '#maxlength' => 60,\n '#autocomplete_path' => 'user/autocomplete',\n '#default_value' => $node->name ? $node->name : '',\n '#weight' => -1,\n '#description' => t('Leave blank for %anonymous.', array('%anonymous' => variable_get('anonymous', t('Anonymous')))),\n );\n $form['author']['date'] = array(\n '#type' => 'textfield',\n '#title' => t('Authored on'),\n '#maxlength' => 25,\n '#description' => t('Format: %time. Leave blank to use the time of form submission.', array('%time' => !empty($node->date) ? $node->date : format_date($node->created, 'custom', 'Y-m-d H:i:s O'))),\n );\n\n if (isset($node->date)) {\n $form['author']['date']['#default_value'] = $node->date;\n }\n\n // Node options for administrators\n $form['options'] = array(\n '#type' => 'fieldset',\n '#access' => user_access('administer nodes'),\n '#title' => t('Publishing options'),\n '#collapsible' => TRUE,\n '#collapsed' => TRUE,\n '#weight' => 25,\n );\n $form['options']['status'] = array(\n '#type' => 'checkbox',\n '#title' => t('Published'),\n '#default_value' => $node->status,\n );\n $form['options']['promote'] = array(\n '#type' => 'checkbox',\n '#title' => t('Promoted to front page'),\n '#default_value' => $node->promote,\n );\n $form['options']['sticky'] = array(\n '#type' => 'checkbox',\n '#title' => t('Sticky at top of lists'),\n '#default_value' => $node->sticky,\n );\n\n // These values are used when the user has no administrator access.\n foreach (array('uid', 'created') as $key) {\n $form[$key] = array(\n '#type' => 'value',\n '#value' => $node->$key,\n );\n }\n\n // Add the buttons.\n $form['buttons'] = array();\n $form['buttons']['submit'] = array(\n '#type' => 'submit',\n '#access' => !variable_get('node_preview', 0) || (!form_get_errors() && isset($form_state['node_preview'])),\n '#value' => t('Save'),\n '#weight' => 5,\n '#submit' => array('node_form_submit'),\n );\n $form['buttons']['preview'] = array(\n '#type' => 'submit',\n '#value' => t('Preview'),\n '#weight' => 10,\n '#submit' => array('node_form_build_preview'),\n );\n if (!empty($node->nid) && node_access('delete', $node)) {\n $form['buttons']['delete'] = array(\n '#type' => 'submit',\n '#value' => t('Delete'),\n '#weight' => 15,\n '#submit' => array('node_form_delete_submit'),\n );\n }\n $form['#validate'][] = 'node_form_validate';\n $form['#theme'] = array($node->type .'_node_form', 'node_form');\n return $form;\n}",
"public function ajax_create_field() {\n\t\tglobal $wpdb;\n\n\t\t$data = array();\n\t\t$field_options = $field_validation = $parent = $previous = '';\n\n\t\tforeach ( $_REQUEST['data'] as $k ) {\n\t\t\t$data[ $k['name'] ] = $k['value'];\n\t\t}\n\n\t\tcheck_ajax_referer( 'create-field-' . $data['form_id'], 'nonce' );\n\n\t\t$form_id = absint( $data['form_id'] );\n\t\t$field_key = sanitize_title( $_REQUEST['field_type'] );\n\t\t$field_type = strtolower( sanitize_title( $_REQUEST['field_type'] ) );\n\n\t\t$parent = ( isset( $_REQUEST['parent'] ) && $_REQUEST['parent'] > 0 ) ? $_REQUEST['parent'] : 0;\n\t\t$previous = ( isset( $_REQUEST['previous'] ) && $_REQUEST['previous'] > 0 ) ? $_REQUEST['previous'] : 0;\n\n\t\t// If a Page Break, the default name is Next, otherwise use the field type\n\t\t$field_name = ( 'page-break' == $field_type ) ? 'Next' : $_REQUEST['field_type'];\n\n\t\t// Set defaults for validation\n\t\tswitch ( $field_type ) :\n\t\t\tcase 'select' :\n\t\t\tcase 'radio' :\n\t\t\tcase 'checkbox' :\n\t\t\t\t$field_options = serialize( array( 'Option 1', 'Option 2', 'Option 3' ) );\n\t\t\t\tbreak;\n\n\t\t\tcase 'email' :\n\t\t\tcase 'url' :\n\t\t\tcase 'phone' :\n\t\t\t\t$field_validation = $field_type;\n\t\t\t\tbreak;\n\n\t\t\tcase 'currency' :\n\t\t\t\t$field_validation = 'number';\n\t\t\t\tbreak;\n\n\t\t\tcase 'number' :\n\t\t\t\t$field_validation = 'digits';\n\t\t\t\tbreak;\n\n\t\t\tcase 'min' :\n\t\t\tcase 'max' :\n\t\t\t\t$field_validation = 'digits';\n\t\t\t\t$field_options = serialize( array( '10' ) );\n\t\t\t\tbreak;\n\n\t\t\tcase 'range' :\n\t\t\t\t$field_validation = 'digits';\n\t\t\t\t$field_options = serialize( array( '1', '10' ) );\n\t\t\t\tbreak;\n\n\t\t\tcase 'time' :\n\t\t\t\t$field_validation = 'time-12';\n\t\t\t\tbreak;\n\n\t\t\tcase 'file-upload' :\n\t\t\t\t$field_options = serialize( array( 'png|jpe?g|gif' ) );\n\t\t\t\tbreak;\n\n\t\t\tcase 'ip-address' :\n\t\t\t\t$field_validation = 'ipv6';\n\t\t\t\tbreak;\n\n\t\t\tcase 'hidden' :\n\t\t\tcase 'custom-field' :\n\t\t\t\t$field_options = serialize( array( '' ) );\n\t\t\t\tbreak;\n\n\t\t\tcase 'autocomplete' :\n\t\t\t\t$field_validation = 'auto';\n\t\t\t\t$field_options = serialize( array( 'Option 1', 'Option 2', 'Option 3' ) );\n\t\t\t\tbreak;\n\n\t\t\tcase 'name' :\n\t\t\t\t$field_options = serialize( array( 'normal' ) );\n\t\t\t\tbreak;\n\n\t\t\tcase 'date' :\n\t\t\t\t$field_options = serialize( array( 'dateFormat' => 'mm/dd/yy' ) );\n\t\t\t\tbreak;\n\n\t\t\tcase 'rating' :\n\t\t\t\t$field_options = serialize( array( 'negative' => 'Disagree', 'positive' => 'Agree', 'scale' => '10' ) );\n\t\t\t\tbreak;\n\n\t\t\tcase 'likert' :\n\t\t\t\t$field_options = serialize( array( 'rows' => \"Ease of Use\\nPortability\\nOverall\", 'cols' => \"Strongly Disagree\\nDisagree\\nUndecided\\nAgree\\nStrongly Agree\" ) );\n\t\t\t\tbreak;\n\t\tendswitch;\n\n\n\n\t\t// Get fields info\n\t\t$all_fields = $wpdb->get_results( $wpdb->prepare( \"SELECT * FROM $this->field_table_name WHERE form_id = %d ORDER BY field_sequence ASC\", $form_id ) );\n\t\t$field_sequence = 0;\n\n\t\t// We only want the fields that FOLLOW our parent or previous item\n\t\tif ( $parent > 0 || $previous > 0 ) {\n\t\t\t$cut_off = ( $previous > 0 ) ? $previous : $parent;\n\n\t\t\tforeach( $all_fields as $field_index => $field ) {\n\t\t\t\tif ( $field->field_id == $cut_off ) {\n\t\t\t\t\t$field_sequence = $field->field_sequence + 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tunset( $all_fields[ $field_index ] );\n\t\t\t}\n\t\t\tarray_shift( $all_fields );\n\n\t\t\t// If the previous had children, we need to remove them so our item is placed correctly\n\t\t\tif ( !$parent && $previous > 0 ) {\n\t\t\t\tforeach( $all_fields as $field_index => $field ) {\n\t\t\t\t\tif ( !$field->field_parent )\n\t\t\t\t\t\tbreak;\n\t\t\t\t\telse {\n\t\t\t\t\t\t$field_sequence = $field->field_sequence + 1;\n\t\t\t\t\t\tunset( $all_fields[ $field_index ] );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Create the new field's data\n\t\t$newdata = array(\n\t\t\t'form_id' \t\t\t=> absint( $data['form_id'] ),\n\t\t\t'field_key' \t\t=> $field_key,\n\t\t\t'field_name' \t\t=> $field_name,\n\t\t\t'field_type' \t\t=> $field_type,\n\t\t\t'field_options' \t=> $field_options,\n\t\t\t'field_sequence' \t=> $field_sequence,\n\t\t\t'field_validation' \t=> $field_validation,\n\t\t\t'field_parent' \t\t=> $parent\n\t\t);\n\n\t\t// Create the field\n\t\t$wpdb->insert( $this->field_table_name, $newdata );\n\t\t$insert_id = $wpdb->insert_id;\n\n\t\t// VIP fields\n\t\t$vip_fields = array( 'verification', 'secret', 'submit' );\n\n\t\t// Rearrange the fields that follow our new data\n\t\tforeach( $all_fields as $field_index => $field ) {\n\t\t\tif ( !in_array( $field->field_type, $vip_fields ) ) {\n\t\t\t\t$field_sequence++;\n\t\t\t\t// Update each field with it's new sequence and parent ID\n\t\t\t\t$wpdb->update( $this->field_table_name, array( 'field_sequence' => $field_sequence ), array( 'field_id' => $field->field_id ) );\n\t\t\t}\n\t\t}\n\n\t\t// Move the VIPs\n\t\tforeach ( $vip_fields as $update ) {\n\t\t\t$field_sequence++;\n\t\t\t$where = array(\n\t\t\t\t'form_id' \t\t=> absint( $data['form_id'] ),\n\t\t\t\t'field_type' \t=> $update\n\t\t\t);\n\t\t\t$wpdb->update( $this->field_table_name, array( 'field_sequence' => $field_sequence ), $where );\n\n\t\t}\n\n\t\techo $this->field_output( $data['form_id'], $insert_id );\n\n\t\tdie(1);\n\t}",
"function node_add($type) {\n global $user;\n\n $types = node_get_types();\n $type = isset($type) ? str_replace('-', '_', $type) : NULL;\n // If a node type has been specified, validate its existence.\n if (isset($types[$type]) && node_access('create', $type)) {\n // Initialize settings:\n $node = array('uid' => $user->uid, 'name' => (isset($user->name) ? $user->name : ''), 'type' => $type, 'language' => '');\n\n drupal_set_title(t('Create @name', array('@name' => $types[$type]->name)));\n $output = drupal_get_form($type .'_node_form', $node);\n }\n\n return $output;\n}",
"function main() {\n\t\tif ($_SERVER['REQUEST_METHOD'] === 'POST') {\n\t\t\tprint_r($_POST);\n\t\t\techo \"<br />\";\n\t\t\t\n\t\t\t// Required Fields in the POST data //\t\t\t\n\t\t\tif ( !isset($_POST['_type']) ) return;\n\t\t\tif ( !isset($_POST['_subtype']) ) return;\n\t\t\tif ( !isset($_POST['_name']) ) return;\n\t\t\tif ( !isset($_POST['_mail']) ) return;\n\t\t\tif ( !isset($_POST['_password']) ) return;\n\t\t\tif ( !isset($_POST['_publish']) ) return;\n\t\n\t\t\t// Node Type //\n\t\t\t$type = sanitize_NodeType($_POST['_type']);\n\t\t\tif ( empty($type) ) return;\t\n\n\t\t\t$subtype = sanitize_NodeType($_POST['_subtype']);\n\t\n\t\t\t// Name/Title //\n\t\t\t$name = $_POST['_name'];\t// TODO: Sanitize\n\t\t\t\n\t\t\t// Slug //\n\t\t\tif ( empty($_POST['_slug']) )\n\t\t\t\t$slug = $_POST['_name'];\n\t\t\telse\n\t\t\t\t$slug = $_POST['_slug'];\n\t\t\t$slug = sanitize_Slug($slug);\n\t\t\tif ( empty($slug) ) return;\n\t\t\t\n\t\t\t// TODO: Confirm slug is legal\n\t\t\t\t\n\t\t\t// Body //\n\t\t\t$body = $_POST['_body'];\t// TODO: Sanitize\n\t\t\t\n\t\t\t// Do we publish? //\n\t\t\t$publish = mb_strtolower($_POST['_publish']) == \"true\";\n\t\t\t\n\t\t\t// Email //\n\t\t\t$mail = sanitize_Email($_POST['_mail']);\n\t\t\tif ( empty($mail) ) return;\n\n\t\t\t// Password //\n\t\t\t$password = $_POST['_password'];\n\t\t\tif ( empty($password) ) return;\n\n\t\n\t\t\t$id = node_Add(\n\t\t\t\t$type,$subtype,$slug,$name,$body,\n\t\t\t\t0,2,\n\t\t\t\t$publish\n\t\t\t);\n\t\t\t\n\t\t\tuser_Add($id,$mail,$password);\n\t\n\t\t\techo \"Added \" . $id . \".<br />\";\n\t\t\techo \"<br />\";\n\t\t}\n\t}",
"function validate_taxonomy_field($field)\n {\n }",
"function validate_blog_form()\n {\n }",
"public function createForm();",
"public function createForm();",
"function validate() {\n\t\t// If it's not required, there's nothing to validate\n\t\tif ( !$this->get_attribute( 'required' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t$field_id = $this->get_attribute( 'id' );\n\t\t$field_type = $this->get_attribute( 'type' );\n\t\t$field_label = $this->get_attribute( 'label' );\n\n\t\t$field_value = isset( $_POST[$field_id] ) ? stripslashes( $_POST[$field_id] ) : '';\n\n\t\tswitch ( $field_type ) {\n\t\tcase 'email' :\n\t\t\t// Make sure the email address is valid\n\t\t\tif ( !is_email( $field_value ) ) {\n\t\t\t\t$this->add_error( sprintf( __( '%s requires a valid email address', 'jetpack' ), $field_label ) );\n\t\t\t}\n\t\t\tbreak;\n\t\tdefault :\n\t\t\t// Just check for presence of any text\n\t\t\tif ( !strlen( trim( $field_value ) ) ) {\n\t\t\t\t$this->add_error( sprintf( __( '%s is required', 'jetpack' ), $field_label ) );\n\t\t\t}\n\t\t}\n\t}",
"abstract public function createForm();",
"abstract public function createForm();",
"function mongo_node_type_delete_form($form, $form_state, $entity_type) {\n $form = array();\n // Send entity type.\n $form['entity_type'] = array(\n '#type' => 'value',\n '#value' => $entity_type,\n );\n $path = '/admin/structure/mongo-node';\n\n $extist_entity_content = '';\n $collection = mongodb_collection('fields_current', $entity_type);\n $count = $collection->count(array('_type' => $entity_type));\n if ($count) {\n $extist_entity_content = t('%type is used by %count piece of content on your site. If you remove this entity type, you will not be able to edit the %type content and it may not display correctly.', array('%type' => $entity_type, '%count' => $count));\n $extist_entity_content .= '<br/><br/>';\n }\n return confirm_form($form, t('Delete entity type'), $path, $extist_entity_content . 'This action cannot be undone', t('Delete'), t('Cancel'), 'mongo_node_type_delete');\n}",
"protected function createFormFields() {\n\t}",
"public function createAction()\n {\n $entity = new Node();\n $request = $this->getRequest();\n $form = $this->createForm(new NodeType(), $entity);\n $form->bindRequest($request);\n\n if ($form->isValid()) {\n $em = $this->getDoctrine()->getEntityManager();\n $em->persist($entity);\n $em->flush();\n $this->get('session')->setFlash('notice', 'Los cambios se realizaron correctamente.');\n return $this->redirect($this->generateUrl('node_show', array('id' => $entity->getId())));\n \n }\n\n return $this->render('HegesAppNodeBundle:Node:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView()\n ));\n }",
"public function validate()\n {\n $this->validateNode($this->tree);\n }",
"function mongo_node_type_delete_form_submit($form, $form_state) {\n $set = mongo_node_settings();\n\n // Remove entity type.\n $entity_type = $form_state['values']['entity_type'];\n unset($set[$entity_type]);\n\n // Drop collection that stores entities for entity type.\n $collection = mongodb_collection('fields_current', $entity_type);\n $collection->drop();\n\n // Drop collection that stores entity types autoincrement ids.\n $collection = mongodb_collection($entity_type . '_ids');\n $collection->drop();\n\n mongo_node_settings_save($set);\n\n // Redirect to entity type admin.\n drupal_goto('admin/structure/mongo-node');\n}",
"function thumbwhere_contentcollection_edit_form_validate(&$form, &$form_state) {\n \n //if (twCanDebug()) debug($form); \n //if (twCanDebug()) debug($form_state);\n\n\n // No validation for pk\n\n\n // Convert fk autocomplete for fk_actor\n $value = $form['fk_actor']['#value'];\n // If we have something, escape the auto-completion encoding.\n if (!empty($value)) { \n $value = entity_autocomplete_get_id($value);\n form_set_value($form['fk_actor'], $value,$form_state);\n }\n //if (twCanDebug()) debug($form['fk_actor']);\n if (twCanDebug()) debug('fk_actor = ' . $value);\n // Validate fk fk_actor\n if (empty($value)) {\n form_set_error('fk_actor', t('Validation error, \\'fk_actor\\' is mandatory1.'));\n // throw new Exception('Field \\'fk_actor\\' in is mandatory');\n }\n\n // Validate normaltitle\n $value = $form['title']['#value'];\n // If we have no default value then we don't care much for checking for emptyness.\n\n\n \n\n //form_set_value( array('#parents' => array('array_key_parent', 'array_key_to_replace')) , $value, $form_state);\n\n \n \n $thumbwhere_contentcollection = $form_state['thumbwhere_contentcollection'];\n\n // Notify field widgets to validate their data.\n field_attach_form_validate('thumbwhere_contentcollection', $thumbwhere_contentcollection, $form, $form_state);\n \n \n \n}",
"function nobookoutline_nodetypes_settings_form() {\n $nodetypesobj = node_get_types();\n $options = array();\n foreach($nodetypesobj as $nodetype) {\n $options[$nodetype->type] = $nodetype->type;\n \n }\n \n\t$form['form_nobookoutline_nodetypes'] = array(\n\t\t'#type' => 'select',\n '#title' => t('Select Node Types'),\n '#default_value' => variable_get('form_nobookoutline_nodetypes', \"book\"),\n '#options' => $options,\n\t '#multiple' => TRUE,\n '#description' => t('<b>Select the node types to show book outline.</b>'),\n\t);\n\n\n return system_settings_form($form);\n}"
]
| [
"0.77895594",
"0.678418",
"0.66281605",
"0.6349097",
"0.6168554",
"0.610568",
"0.60453206",
"0.60402095",
"0.6012209",
"0.59940475",
"0.5758476",
"0.57140166",
"0.56463796",
"0.5642471",
"0.5613593",
"0.5533103",
"0.54347605",
"0.5433027",
"0.5426902",
"0.5426902",
"0.5405251",
"0.5385138",
"0.5385138",
"0.53786254",
"0.5359969",
"0.5351087",
"0.5350247",
"0.533616",
"0.5334571",
"0.5324472"
]
| 0.6903851 | 1 |
Form submission handler for mongo_node_type_create_form(). | function mongo_node_type_create_form_submit($form, $form_state) {
$label = $form_state['values']['label'];
$machine_name = $form_state['values']['name'];
$set = mongo_node_settings();
$set += mongo_node_type_default_settings($label, $machine_name);
// @todo - redirect to entity type page
mongo_node_settings_save($set);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function mongo_node_form($form, &$form_state, $entity, $entity_type) {\n $form = array();\n\n $form_state['entity_type'] = $entity_type;\n if (!isset($form_state[$entity_type])) {\n $form_state[$entity_type] = $entity;\n }\n else {\n $entity = $form_state[$entity_type];\n }\n\n // Get title label name from properties if exists\n static $settings = array();\n if(empty($settings)) {\n $settings = mongo_node_settings();\n }\n $title = isset($settings[$entity_type]['properties']['title']['label']) ? $settings[$entity_type]['properties']['title']['label'] : t('Title');\n\n $form['title'] = array(\n '#type' => 'textfield',\n '#title' => $title,\n '#required' => TRUE,\n '#default_value' => isset($entity->title) ? $entity->title : '',\n );\n\n $form['#attributes']['class'][] = 'mongo-node-form';\n if (!empty($entity->type)) {\n // TODO -- add entity type with bundle.\n $form['#attributes']['class'][] = 'mongo-node-' . $entity->type . '-form';\n }\n\n $form['actions'] = array('#type' => 'actions');\n $form['actions']['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save'),\n '#weight' => 5,\n '#submit' => array('mongo_node_form_submit'),\n );\n\n $form['#validate'][] = 'mongo_node_form_validate';\n field_attach_form($entity_type, $entity, $form, $form_state);\n\n return $form;\n}",
"function mongo_node_form_submit(&$form, &$form_state) {\n $entity_type = $form_state['entity_type'];\n $entity = entity_ui_controller($entity_type)->entityFormSubmitBuildEntity($form, $form_state);\n $insert = empty($entity->mid);\n entity_save($entity_type, $entity);\n\n $info = entity_get_info($entity_type);\n $bundle_key = $info['bundle keys']['bundle'];\n $bundle_label = $info['bundles'][$entity->{$bundle_key}]['label'];\n\n if ($insert) {\n drupal_set_message(t('@label %title has been created.',\n array(\n '@label' => $bundle_label,\n '%title' => $entity->title,\n )\n )\n );\n }\n else {\n drupal_set_message(t('@label %title has been updated.',\n array(\n '@label' => $bundle_label,\n '%title' => $entity->title,\n )\n )\n );\n }\n\n $uri = entity_uri($entity_type, $entity);\n $form_state['redirect'] = drupal_get_path_alias($uri['path']);\n}",
"function mongo_node_add($entity_type, $bundle) {\n global $user;\n $set = mongo_node_settings();\n\n $entity = entity_create($entity_type, array(\n 'uid' => $user->uid,\n 'name' => (isset($user->name) ? $user->name : ''),\n 'type' => $bundle,\n 'language' => LANGUAGE_NONE,\n )\n );\n $form_id = $entity_type . '_' . $bundle . '_mongo_node_form';\n $output = drupal_get_form($form_id, $entity, $entity_type);\n\n return $output;\n}",
"function mongo_node_bundle_create_form($form, $form_state, $entity_type) {\n $form = array();\n\n $form['label'] = array(\n '#type' => 'textfield',\n '#title' => t('Entity type'),\n '#description' => t('The human readable name of the entity.'),\n );\n\n $form['name'] = array(\n '#type' => 'machine_name',\n '#required' => FALSE,\n '#machine_name' => array(\n 'exists' => '_mongo_node_bundle_exists',\n 'source' => array('label'),\n ),\n );\n\n $form['description'] = array(\n '#type' => 'textarea',\n '#title' => t('Description'),\n '#description' => t('Describe this bundle.'),\n );\n\n $form['entity_type'] = array(\n '#type' => 'value',\n '#value' => $entity_type,\n );\n\n $form['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save'),\n );\n\n return $form;\n}",
"function mongo_node_type_edit_form($form, $form_state, $entity_type) {\n $set = mongo_node_settings();\n $form = array();\n\n $form['label'] = array(\n '#type' => 'textfield',\n '#title' => t('Entity type'),\n '#default_value' => $set[$entity_type]['label'],\n '#description' => t('The human readable name of the entity.'),\n );\n\n $form['name'] = array(\n '#type' => 'machine_name',\n '#required' => FALSE,\n '#default_value' => $entity_type,\n '#machine_name' => array(\n 'exists' => '_mongo_node_type_exists',\n 'source' => array('label'),\n ),\n );\n\n // Send entity type.\n $form['entity_type'] = array(\n '#type' => 'value',\n '#value' => $entity_type,\n );\n\n $form['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save'),\n );\n\n return $form;\n}",
"function main() {\n\t\tif ($_SERVER['REQUEST_METHOD'] === 'POST') {\n\t\t\tprint_r($_POST);\n\t\t\techo \"<br />\";\n\t\t\t\n\t\t\t// Required Fields in the POST data //\t\t\t\n\t\t\tif ( !isset($_POST['_type']) ) return;\n\t\t\tif ( !isset($_POST['_subtype']) ) return;\n\t\t\tif ( !isset($_POST['_name']) ) return;\n\t\t\tif ( !isset($_POST['_mail']) ) return;\n\t\t\tif ( !isset($_POST['_password']) ) return;\n\t\t\tif ( !isset($_POST['_publish']) ) return;\n\t\n\t\t\t// Node Type //\n\t\t\t$type = sanitize_NodeType($_POST['_type']);\n\t\t\tif ( empty($type) ) return;\t\n\n\t\t\t$subtype = sanitize_NodeType($_POST['_subtype']);\n\t\n\t\t\t// Name/Title //\n\t\t\t$name = $_POST['_name'];\t// TODO: Sanitize\n\t\t\t\n\t\t\t// Slug //\n\t\t\tif ( empty($_POST['_slug']) )\n\t\t\t\t$slug = $_POST['_name'];\n\t\t\telse\n\t\t\t\t$slug = $_POST['_slug'];\n\t\t\t$slug = sanitize_Slug($slug);\n\t\t\tif ( empty($slug) ) return;\n\t\t\t\n\t\t\t// TODO: Confirm slug is legal\n\t\t\t\t\n\t\t\t// Body //\n\t\t\t$body = $_POST['_body'];\t// TODO: Sanitize\n\t\t\t\n\t\t\t// Do we publish? //\n\t\t\t$publish = mb_strtolower($_POST['_publish']) == \"true\";\n\t\t\t\n\t\t\t// Email //\n\t\t\t$mail = sanitize_Email($_POST['_mail']);\n\t\t\tif ( empty($mail) ) return;\n\n\t\t\t// Password //\n\t\t\t$password = $_POST['_password'];\n\t\t\tif ( empty($password) ) return;\n\n\t\n\t\t\t$id = node_Add(\n\t\t\t\t$type,$subtype,$slug,$name,$body,\n\t\t\t\t0,2,\n\t\t\t\t$publish\n\t\t\t);\n\t\t\t\n\t\t\tuser_Add($id,$mail,$password);\n\t\n\t\t\techo \"Added \" . $id . \".<br />\";\n\t\t\techo \"<br />\";\n\t\t}\n\t}",
"function mongo_node_form_validate(&$form, &$form_state) {\n $entity_type = $form_state['entity_type'];\n $entity = $form_state[$entity_type];\n field_attach_form_validate($entity_type, $entity, $form, $form_state);\n}",
"function mongo_node_type_edit_form_submit($form, $form_state) {\n $label = $form_state['values']['label'];\n $machine_name = $form_state['values']['name'];\n $old_entity_type = $form_state['values']['entity_type'];\n\n $set = mongo_node_settings();\n\n if ($machine_name != $old_entity_type) {\n $set += mongo_node_type_default_settings($label, $machine_name);\n $set[$machine_name] = $set[$old_entity_type];\n unset($set[$old_entity_type]);\n\n // Update existing mongo entities with new entity type.\n _mongo_node_update_type($old_entity_type, $machine_name);\n }\n else {\n $set[$machine_name]['label'] = $label;\n }\n\n // Save settings.\n mongo_node_settings_save($set);\n return TRUE;\n}",
"function mongo_node_bundle_create_form_submit($form, $form_state) {\n $entity_type = $form_state['values']['entity_type'];\n\n $label = $form_state['values']['label'];\n $machine_name = $form_state['values']['name'];\n $description = $form_state['values']['description'];\n\n $set = mongo_node_settings();\n $set[$entity_type]['bundles'] += mongo_node_bundle_default_settings($label, $machine_name, $description);\n\n // @todo - redirect to bundle type page.\n mongo_node_settings_save($set);\n}",
"function node_add($type) {\n global $user;\n\n $types = node_get_types();\n $type = isset($type) ? str_replace('-', '_', $type) : NULL;\n // If a node type has been specified, validate its existence.\n if (isset($types[$type]) && node_access('create', $type)) {\n // Initialize settings:\n $node = array('uid' => $user->uid, 'name' => (isset($user->name) ? $user->name : ''), 'type' => $type, 'language' => '');\n\n drupal_set_title(t('Create @name', array('@name' => $types[$type]->name)));\n $output = drupal_get_form($type .'_node_form', $node);\n }\n\n return $output;\n}",
"function node_form(&$form_state, $node) {\n global $user;\n\n if (isset($form_state['node'])) {\n $node = $form_state['node'] + (array)$node;\n }\n if (isset($form_state['node_preview'])) {\n $form['#prefix'] = $form_state['node_preview'];\n }\n $node = (object)$node;\n foreach (array('body', 'title', 'format') as $key) {\n if (!isset($node->$key)) {\n $node->$key = NULL;\n }\n }\n if (!isset($form_state['node_preview'])) {\n node_object_prepare($node);\n }\n else {\n $node->build_mode = NODE_BUILD_PREVIEW;\n }\n\n // Set the id of the top-level form tag\n $form['#id'] = 'node-form';\n\n // Basic node information.\n // These elements are just values so they are not even sent to the client.\n foreach (array('nid', 'vid', 'uid', 'created', 'type', 'language') as $key) {\n $form[$key] = array(\n '#type' => 'value',\n '#value' => isset($node->$key) ? $node->$key : NULL,\n );\n }\n\n // Changed must be sent to the client, for later overwrite error checking.\n $form['changed'] = array(\n '#type' => 'hidden',\n '#default_value' => isset($node->changed) ? $node->changed : NULL,\n );\n // Get the node-specific bits.\n if ($extra = node_invoke($node, 'form', $form_state)) {\n $form = array_merge_recursive($form, $extra);\n }\n if (!isset($form['title']['#weight'])) {\n $form['title']['#weight'] = -5;\n }\n\n $form['#node'] = $node;\n\n // Add a log field if the \"Create new revision\" option is checked, or if the\n // current user has the ability to check that option.\n if (!empty($node->revision) || user_access('administer nodes')) {\n $form['revision_information'] = array(\n '#type' => 'fieldset',\n '#title' => t('Revision information'),\n '#collapsible' => TRUE,\n // Collapsed by default when \"Create new revision\" is unchecked\n '#collapsed' => !$node->revision,\n '#weight' => 20,\n );\n $form['revision_information']['revision'] = array(\n '#access' => user_access('administer nodes'),\n '#type' => 'checkbox',\n '#title' => t('Create new revision'),\n '#default_value' => $node->revision,\n );\n $form['revision_information']['log'] = array(\n '#type' => 'textarea',\n '#title' => t('Log message'),\n '#default_value' => (isset($node->log) ? $node->log : ''),\n '#rows' => 2,\n '#description' => t('An explanation of the additions or updates being made to help other authors understand your motivations.'),\n );\n }\n\n // Node author information for administrators\n $form['author'] = array(\n '#type' => 'fieldset',\n '#access' => user_access('administer nodes'),\n '#title' => t('Authoring information'),\n '#collapsible' => TRUE,\n '#collapsed' => TRUE,\n '#weight' => 20,\n );\n $form['author']['name'] = array(\n '#type' => 'textfield',\n '#title' => t('Authored by'),\n '#maxlength' => 60,\n '#autocomplete_path' => 'user/autocomplete',\n '#default_value' => $node->name ? $node->name : '',\n '#weight' => -1,\n '#description' => t('Leave blank for %anonymous.', array('%anonymous' => variable_get('anonymous', t('Anonymous')))),\n );\n $form['author']['date'] = array(\n '#type' => 'textfield',\n '#title' => t('Authored on'),\n '#maxlength' => 25,\n '#description' => t('Format: %time. Leave blank to use the time of form submission.', array('%time' => !empty($node->date) ? $node->date : format_date($node->created, 'custom', 'Y-m-d H:i:s O'))),\n );\n\n if (isset($node->date)) {\n $form['author']['date']['#default_value'] = $node->date;\n }\n\n // Node options for administrators\n $form['options'] = array(\n '#type' => 'fieldset',\n '#access' => user_access('administer nodes'),\n '#title' => t('Publishing options'),\n '#collapsible' => TRUE,\n '#collapsed' => TRUE,\n '#weight' => 25,\n );\n $form['options']['status'] = array(\n '#type' => 'checkbox',\n '#title' => t('Published'),\n '#default_value' => $node->status,\n );\n $form['options']['promote'] = array(\n '#type' => 'checkbox',\n '#title' => t('Promoted to front page'),\n '#default_value' => $node->promote,\n );\n $form['options']['sticky'] = array(\n '#type' => 'checkbox',\n '#title' => t('Sticky at top of lists'),\n '#default_value' => $node->sticky,\n );\n\n // These values are used when the user has no administrator access.\n foreach (array('uid', 'created') as $key) {\n $form[$key] = array(\n '#type' => 'value',\n '#value' => $node->$key,\n );\n }\n\n // Add the buttons.\n $form['buttons'] = array();\n $form['buttons']['submit'] = array(\n '#type' => 'submit',\n '#access' => !variable_get('node_preview', 0) || (!form_get_errors() && isset($form_state['node_preview'])),\n '#value' => t('Save'),\n '#weight' => 5,\n '#submit' => array('node_form_submit'),\n );\n $form['buttons']['preview'] = array(\n '#type' => 'submit',\n '#value' => t('Preview'),\n '#weight' => 10,\n '#submit' => array('node_form_build_preview'),\n );\n if (!empty($node->nid) && node_access('delete', $node)) {\n $form['buttons']['delete'] = array(\n '#type' => 'submit',\n '#value' => t('Delete'),\n '#weight' => 15,\n '#submit' => array('node_form_delete_submit'),\n );\n }\n $form['#validate'][] = 'node_form_validate';\n $form['#theme'] = array($node->type .'_node_form', 'node_form');\n return $form;\n}",
"public function createAction()\n {\n $entity = new Node();\n $request = $this->getRequest();\n $form = $this->createForm(new NodeType(), $entity);\n $form->bindRequest($request);\n\n if ($form->isValid()) {\n $em = $this->getDoctrine()->getEntityManager();\n $em->persist($entity);\n $em->flush();\n $this->get('session')->setFlash('notice', 'Los cambios se realizaron correctamente.');\n return $this->redirect($this->generateUrl('node_show', array('id' => $entity->getId())));\n \n }\n\n return $this->render('HegesAppNodeBundle:Node:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView()\n ));\n }",
"function mongo_node_operation_submit($form, &$form_state) {\n $operations = mongo_node_operations();\n $operation = $operations[$form_state['values']['operation']];\n\n $entities = array_filter($form_state['values']['entities']);\n $entity_type = $form_state['values']['entity_type'];\n if ($function = $operation['callback']) {\n // Add in callback arguments if present.\n if (isset($operation['callback arguments'])) {\n $args = array(\n $entity_type,\n $entities,\n $operation['callback arguments'],\n );\n }\n else {\n $args = array($entity_type, $entities);\n }\n call_user_func_array($function, $args);\n cache_clear_all();\n }\n}",
"public function create()\n {\n return view('nodes.form')\n ->with('types', NodeType::orderBy('display_name')->get())\n ->with('scripts', ['vendor/unisharp/laravel-ckeditor/ckeditor.js'])\n ->with('action', 'Add');\n }",
"function node_form_submit_build_node($form, &$form_state) {\n // Unset any button-level handlers, execute all the form-level submit\n // functions to process the form values into an updated node.\n unset($form_state['submit_handlers']);\n form_execute_handlers('submit', $form, $form_state);\n $node = node_submit($form_state['values']);\n $form_state['node'] = (array)$node;\n $form_state['rebuild'] = TRUE;\n return $node;\n}",
"function happywedding_node_form_submit($form, &$form_state) {\n global $user;\n //dpm($user);\n if ( !empty($form_state['nid']) && isset($_GET['vendor'] ) ) {\n \n $type = $form['type']['#value'];\n if (in_array('vendor', $user->roles)) {\n $basepath = 'bo/vendor/';\n } else {\n $basepath = 'node/';\n }\n //dpm($form);\n if($type=='news')\n $form_state['redirect'] = $basepath.$_GET['vendor'].'/'.$type;\n else if($type=='product') {\n $query = array('category' => array());\n foreach($form[\"field_product_category\"][\"und\"][\"#value\"] as $key => $value){\n $query[\"category\"][] = $key; \n }\n $form_state['redirect'] = array( \n $basepath.$_GET['vendor'].'/categories/'.$type.'s' ,\n array('query' => $query ) \n );\n //dpm($form_state['redirect']);\n }else\n $form_state['redirect'] = $basepath.$_GET['vendor'].'/'.$type.'s';\n }\n}",
"function mongo_node_type_delete_form_submit($form, $form_state) {\n $set = mongo_node_settings();\n\n // Remove entity type.\n $entity_type = $form_state['values']['entity_type'];\n unset($set[$entity_type]);\n\n // Drop collection that stores entities for entity type.\n $collection = mongodb_collection('fields_current', $entity_type);\n $collection->drop();\n\n // Drop collection that stores entity types autoincrement ids.\n $collection = mongodb_collection($entity_type . '_ids');\n $collection->drop();\n\n mongo_node_settings_save($set);\n\n // Redirect to entity type admin.\n drupal_goto('admin/structure/mongo-node');\n}",
"function create() {\n\t\tglobal $tpl, $lng;\n\n\t\t$form = $this->initForm(TRUE);\n\t\tif ($form->checkInput()) {\n\t\t\tif ($this->createElement($this->getPropertiesFromPost($form))) {\n\t\t\t\tilUtil::sendSuccess($lng->txt('msg_obj_modified'), TRUE);\n\t\t\t\t$this->returnToParent();\n\t\t\t}\n\t\t}\n\n\t\t$form->setValuesByPost();\n\t\t$tpl->setContent($form->getHtml());\n\t}",
"public function getSetupForm() {\n\n /**\n * @todo find a beter way to do this\n */\n\n if(!empty($_POST['nodeId'])){\n $this->id = $_POST['nodeId'];\n }\n\n if (empty($this->id)) {\n $table = new HomeNet_Model_DbTable_Nodes();\n $this->id = $table->fetchNextId($this->house);\n }\n // $this->id = 50;\n\n $form = new HomeNet_Form_Node();\n $sub = $form->getSubForm('node');\n $id = $sub->getElement('node');\n $id->setValue($this->id);\n \n $table = new HomeNet_Model_DbTable_Nodes();\n $rows = $table->fetchAllInternetNodes();\n\n $uplink = $sub->getElement('uplink');\n\n foreach($rows as $value){\n $uplink->addMultiOption($value->id, $value->id);\n }\n\n\n return $form;\n }",
"function nobookoutline_nodetypes_settings_form() {\n $nodetypesobj = node_get_types();\n $options = array();\n foreach($nodetypesobj as $nodetype) {\n $options[$nodetype->type] = $nodetype->type;\n \n }\n \n\t$form['form_nobookoutline_nodetypes'] = array(\n\t\t'#type' => 'select',\n '#title' => t('Select Node Types'),\n '#default_value' => variable_get('form_nobookoutline_nodetypes', \"book\"),\n '#options' => $options,\n\t '#multiple' => TRUE,\n '#description' => t('<b>Select the node types to show book outline.</b>'),\n\t);\n\n\n return system_settings_form($form);\n}",
"public function postCreate()\n {\n\n // Declare the rules for the form validation\n $rules = array(\n 'name' => 'required'\n );\n\n // Validate the inputs\n $validator = Validator::make(Input::all(), $rules);\n // Check if the form validates with success\n if ($validator->passes())\n {\n // Get the inputs, with some exceptions\n $inputs = Input::except('csrf_token');\n\n $this->type->name = $inputs['name'];\n $this->type->save();\n\n // Was the type created?\n if ($this->type->id)\n {\n // Redirect to the new type page\n return Redirect::to('admin/types/' . $this->type->id . '/edit')->with('success', Lang::get('admin/types/messages.create.success'));\n }\n\n // Redirect to the new type page\n return Redirect::to('admin/types/create')->with('error', Lang::get('admin/types/messages.create.error'));\n\n // Redirect to the type create page\n return Redirect::to('admin/types/create')->withInput()->with('error', Lang::get('admin/types/messages.' . $error));\n }\n\n // Form validation failed\n return Redirect::to('admin/types/create')->withInput()->withErrors($validator);\n }",
"function mongo_node_type_delete_form($form, $form_state, $entity_type) {\n $form = array();\n // Send entity type.\n $form['entity_type'] = array(\n '#type' => 'value',\n '#value' => $entity_type,\n );\n $path = '/admin/structure/mongo-node';\n\n $extist_entity_content = '';\n $collection = mongodb_collection('fields_current', $entity_type);\n $count = $collection->count(array('_type' => $entity_type));\n if ($count) {\n $extist_entity_content = t('%type is used by %count piece of content on your site. If you remove this entity type, you will not be able to edit the %type content and it may not display correctly.', array('%type' => $entity_type, '%count' => $count));\n $extist_entity_content .= '<br/><br/>';\n }\n return confirm_form($form, t('Delete entity type'), $path, $extist_entity_content . 'This action cannot be undone', t('Delete'), t('Cancel'), 'mongo_node_type_delete');\n}",
"function scfnode_form_add_association(&$form_state, $nid, $name) {\n $form = array();\n /*$form['cancel'] = array(\n '#type' => 'image_button',\n '#src' => drupal_get_path('module', 'scf') . '/images/icon-x.gif',\n '#attributes' => array(\n 'onclick' => \"$('#association-addtermdiv-\" . $name . \"').slideUp('slow');return false;\"\n ),\n '#executes_submit_callback' => FALSE,\n '#title' => 'Close'\n );*/\n \n /*$form['caption'] = array(\n '#type' => 'markup',\n '#value' => t('Add new term:')\n );*/\n \n $form['textfield'] = array(\n '#type' => 'textfield',\n '#autocomplete_path' => $name . '/autocomplete/title',\n '#size' => 20,\n '#id' => 'association-' . $name . '-text',\n '#name' => 'textfield',\n );\n $form['add'] = array(\n '#type' => 'button',\n '#value' => t('Add'),\n '#ahah' => array(\n 'path' => 'association/ajax/add/' . $nid . '/' . $name . '/',\n 'wrapper' => 'association-list-' . $name,\n 'event' => 'click',\n 'effect' => 'slide',\n 'method' => 'append',\n 'progress' => 'none',\n ),\n '#executes_submit_callback' => FALSE\n );\n \n $form['nid'] = array(\n '#type' => 'value',\n '#value' => $nid\n );\n return $form;\n }",
"function bookcrossing_add_new_book_form() {\n global $user;\n\n $types = node_type_get_types();\n $node = (object) array('uid' => $user->uid, 'name' => (isset($user->name) ? $user->name : ''), 'type' => 'bookcrossing', 'language' => LANGUAGE_NONE);\n //drupal_set_title(t('Create @name', array('@name' => $types['bookcrossing']->name)), PASS_THROUGH);\n return drupal_get_form('bookcrossing_node_form', $node, 'add-new-book');\n}",
"private function loadNewNodeFormForTestContentType() {\n $this->drupalLogin($this->user);\n $this->drupalGet(self::CONTENT_ADD_PREFIX\n . self::TEST_CONTENT_TYPE_ID);\n $this->assertResponse(200);\n }",
"public function xadmin_createform() {\n\t\t\n\t\t$args = $this->getAllArguments ();\n\t\t\n\t\t/* get the form field title */\n\t\t$form_title = $args [1];\n\t\t$form_type = @$args [2] ? $args [2] : 'blank';\n\t\t\n\t\t/* Load Model */\n\t\t$form = $this->getModel ( 'form' );\n\t\t$this->session->returnto ( 'forms' );\n\t\t\n\t\t/* create the form */\n\t\t$form->createNewForm ( $form_title, $form_type );\n\t\t\n\t\t$this->loadPluginModel ( 'forms' );\n\t\t$plug = Plugins_Forms::getInstance ();\n\t\t\n\t\t$plug->_pluginList [$form_type]->onAfterCreateForm ( $form );\n\t\t\n\t\t/* set the view file (optional) */\n\t\t$this->_redirect ( 'xforms' );\n\t\n\t}",
"function multisite_aggregate_type_form($form, &$form_state, $aggregate_type, $op = 'edit') {\n if ($op == 'clone') {\n $aggregate_type->label .= ' (cloned)';\n $aggregate_type->type = '';\n }\n\n $form['label'] = array(\n '#title' => t('Label'),\n '#type' => 'textfield',\n '#default_value' => $aggregate_type->label,\n '#description' => t('The human-readable name of this multisite aggregate type.'),\n '#required' => TRUE,\n '#size' => 30,\n );\n $form['type'] = array(\n '#type' => 'machine_name',\n '#default_value' => isset($aggregate_type->type) ? $aggregate_type->type : '',\n '#maxlength' => 32,\n '#machine_name' => array(\n 'exists' => 'multisite_aggregate_get_types',\n 'source' => array('label'),\n ),\n '#description' => t('A unique machine-readable name for this multisite aggregate type. It must only contain lowercase letters, numbers, and underscores.'),\n );\n\n $form['source'] = array(\n '#type' => 'fieldset',\n '#title' => t('Source'),\n );\n // Only nodes are allowed for now\n $form['source']['source_type'] = array(\n '#type' => 'hidden',\n '#value' => 'node',\n );\n $form['source']['source_bundle'] = array(\n '#type' => 'select',\n '#title' => t('Node bundle'),\n '#options' => node_type_get_names(),\n '#default_value' => !empty($aggregate_type->source_bundle),\n );\n\n $form['actions'] = array('#type' => 'actions');\n $form['actions']['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save aggregate type'),\n '#weight' => 40,\n );\n return $form;\n}",
"function mongo_node_bundle_edit_form($form, $form_state, $entity_type, $bundle) {\n\n $set = mongo_node_settings();\n\n $form = array();\n\n $form['label'] = array(\n '#type' => 'textfield',\n '#title' => t('Entity type'),\n '#default_value' => $set[$entity_type]['bundles'][$bundle]['label'],\n '#description' => t('The human readable name of the entity.'),\n );\n\n $form['name'] = array(\n '#type' => 'machine_name',\n '#required' => FALSE,\n '#default_value' => $bundle,\n '#machine_name' => array(\n 'exists' => '_mongo_node_bundle_exists',\n 'source' => array('label'),\n ),\n );\n\n $description = isset($set[$entity_type]['bundles'][$bundle]['description']) ? $set[$entity_type]['bundles'][$bundle]['description'] : '';\n $form['description'] = array(\n '#type' => 'textarea',\n '#title' => t('Description'),\n '#default_value' => $description,\n '#description' => t('Describe this bundle.'),\n );\n\n // Save entity type and bundle.\n $form['bundle_type'] = array(\n '#type' => 'value',\n '#value' => array(\n 'entity_type' => $entity_type,\n 'bundle' => $bundle,\n ),\n );\n\n $form['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save'),\n );\n\n return $form;\n}",
"public function createForm();",
"public function createForm();"
]
| [
"0.75537634",
"0.7259901",
"0.681234",
"0.6734988",
"0.66604066",
"0.66321564",
"0.66177344",
"0.65728587",
"0.64692134",
"0.64574426",
"0.6294301",
"0.62569225",
"0.61547625",
"0.6117619",
"0.6045405",
"0.60168475",
"0.6002687",
"0.5941034",
"0.59276116",
"0.5846542",
"0.5828956",
"0.5796779",
"0.5793598",
"0.5789525",
"0.57869947",
"0.57788634",
"0.5773492",
"0.5766791",
"0.5762629",
"0.5762629"
]
| 0.75139195 | 1 |
Form constructor for editing entity types. | function mongo_node_type_edit_form($form, $form_state, $entity_type) {
$set = mongo_node_settings();
$form = array();
$form['label'] = array(
'#type' => 'textfield',
'#title' => t('Entity type'),
'#default_value' => $set[$entity_type]['label'],
'#description' => t('The human readable name of the entity.'),
);
$form['name'] = array(
'#type' => 'machine_name',
'#required' => FALSE,
'#default_value' => $entity_type,
'#machine_name' => array(
'exists' => '_mongo_node_type_exists',
'source' => array('label'),
),
);
// Send entity type.
$form['entity_type'] = array(
'#type' => 'value',
'#value' => $entity_type,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
return $form;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function travel_type_form($form, &$form_state, $entity_type, $op = 'edit') {\n // Handle the case when cloning is performed.\n if ($op == 'clone') {\n $entity_type->label .= ' (cloned)';\n $entity_type->type = '';\n }\n\n // Describe all properties of the entity which shall be shown on the form.\n $form['label'] = array(\n '#title' => t('Label'),\n '#type' => 'textfield',\n '#default_value' => $entity_type->label,\n '#description' => t('The human-readable name of this entity type.'),\n '#required' => TRUE,\n '#size' => 30,\n );\n $form['type'] = array(\n '#type' => 'machine_name',\n '#default_value' => isset($entity_type->type) ? $entity_type->type : '',\n '#maxlength' => 32,\n //'#disabled' => $entity_type->isLocked() && $op != 'clone',\n '#machine_name' => array(\n 'exists' => 'travel_type_load_multiple',\n 'source' => array('label'),\n ),\n '#description' => t('A unique machine-readable name for this entity type. It must only contain lowercase letters, numbers, and underscores.'),\n );\n $form['description'] = array(\n '#type' => 'textarea',\n '#default_value' => isset($entity_type->description) ? $entity_type->description : '',\n '#description' => t('Description about the entity type.'),\n );\n\n // Add some buttons.\n $form['actions'] = array('#type' => 'actions');\n $form['actions']['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save entity type'),\n '#weight' => 40,\n );\n //if (!$entity_type->isLocked() && $op != 'add' && $op != 'clone') {\n $entity_id = entity_id('travel', $entity);\n if (!empty($entity_id)) {\n $form['actions']['delete'] = array(\n '#type' => 'submit',\n '#value' => t('Delete entity type'),\n '#weight' => 45,\n '#limit_validation_errors' => array(),\n '#submit' => array('travel_type_form_submit_delete'),\n );\n }\n\n return $form;\n}",
"public function __construct(\\Library\\Entity $entity){\n\t\t$this->setForm(new Form\\Form($entity));\n\t}",
"public function initialize($entity = null, $options = array())\n {\n if (!isset($options['edit'])) {\n\n $elemento = new Text(\"formacion_id\");\n $this->add($elemento->setLabel(\"Id\"));\n } else {\n $this->add(new \\Phalcon\\Forms\\Element\\Hidden(\"formacion_id\"));\n }\n /*========================== ==========================*/\n $elemento = new Text('formacion_institucion',array('maxlength'=>50,'class'=>'form-control','required'=>'true','placeholder'=>'Ingrese el nombre de la institución'));\n $elemento->setLabel('<strong class=\"font-rojo \"> * </strong>Institución');\n $elemento->setFilters(array('striptags', 'string'));\n $elemento->addValidators(array(\n new PresenceOf(array(\n 'message' => 'El nombre de la institución es requerido'\n ))\n ));\n $this->add($elemento);\n /*========================== ==========================*/\n $elemento = new Select('formacion_gradoId', \\Curriculum\\Grado::find(), array(\n 'using' => array('grado_id', 'grado_nombre'),\n 'useEmpty' => true,\n 'emptyText' => 'Seleccionar ',\n 'emptyValue' => '',\n 'class'=>'form-control','required'=>'true'\n ));\n $elemento->addValidators(array(\n new PresenceOf(array(\n 'message' => 'Seleccione el nivel'\n ))\n ));\n $elemento->setLabel('<strong class=\"font-rojo \"> * </strong>Nivel');\n $this->add($elemento);\n /*========================== ==========================*/\n $elemento = new Text('formacion_titulo',array('maxlength'=>50,'class'=>'form-control','placeholder'=>'Ingrese el nombre del Titulo','required'=>'true'));\n $elemento->setLabel('<strong class=\"font-rojo \"> * </strong>Titulo');\n $elemento->setFilters(array('striptags', 'string'));\n $this->add($elemento);\n /*========================== ==========================*/\n $elemento = new Select('formacion_estadoId', \\Curriculum\\Estado::find(), array(\n 'using' => array('estado_id', 'estado_nombre'),\n 'useEmpty' => true,\n 'emptyText' => 'Seleccionar ',\n 'emptyValue' => '',\n 'class'=>'form-control','required'=>'true'\n ));\n $elemento->addValidators(array(\n new PresenceOf(array(\n 'message' => 'Seleccione el estado'\n ))\n ));\n $elemento->setLabel('<strong class=\"font-rojo \"> * </strong>Estado');\n $this->add($elemento);\n /*========================== ==========================*/\n $elemento = new Date('formacion_fechaInicio',array('class'=>'form-control','required'=>'true'));\n $elemento->setLabel('<strong class=\"font-rojo \"> * </strong>Fecha de Inicio');\n $elemento->addValidators(array(\n new PresenceOf(array(\n 'message' => 'La fecha de inicio es requerida.'\n ))\n ));\n $this->add($elemento);\n /*========================== ==========================*/\n $elemento = new Date('formacion_fechaFinal',array('class'=>'form-control', 'disabled'=>''));\n $elemento->setLabel('Fecha Final');\n $elemento->addValidators(array(\n new PresenceOf(array(\n 'message' => 'La fecha final es requerida.'\n ))\n ));\n $this->add($elemento);\n\n }",
"public function __construct( $form_type, $args )\n {\n parent::__construct( $form_type.'_form', $args );\n $this->form_type = $form_type;\n \n $this->add_column( 'id', 'number', 'ID', true );\n $this->add_column( 'date', 'date', 'Date Added', true );\n $this->add_column( 'typist_1', 'string', 'Typist 1', false );\n $this->add_column( 'typist_1_submitted', 'boolean', 'Submitted', false );\n $this->add_column( 'typist_2', 'string', 'Typist 2', false );\n $this->add_column( 'typist_2_submitted', 'boolean', 'Submitted', false );\n $this->add_column( 'conflict', 'boolean', 'Conflict', false );\n }",
"protected function _prepareForm()\n\t{\n\n\t\t$intId = $this->getRequest()->getParam(SDZeCOM_Aurednik_Model_Cms_Home_Entity :: TABLE_COLUMN_ID);\n\n\t\t$objEntity = new SDZeCOM_Aurednik_Model_Cms_Home_Entity ();\n\n\t\t$objEntity->load($intId);\n\n\t\t$objAttribute = new SDZeCOM_Aurednik_Model_Cms_Home_Entity_Attribute ();\n\n\t\t$objAttributeValue = new SDZeCOM_Aurednik_Model_Cms_Home_Entity_Attribute_Values ();\n\n\t\t$objEntityType = new SDZeCOM_Aurednik_Model_Cms_Home_Entity_Type ();\n\n\t\t$objForm = new Varien_Data_Form (\n\t\t\tarray(\n\t\t\t\t'id' => SDZeCOM_Aurednik_Block_Adminhtml_Cms_Home_Edit_Form_Container :: FORM_NAME,\n\t\t\t\t'action' => $this->getUrl('*/*/save'),\n\t\t\t\t'method' => 'post',\n\t\t\t\t'enctype' => 'multipart/form-data',\n\t\t\t\t'name' => SDZeCOM_Aurednik_Block_Adminhtml_Cms_Home_Edit_Form_Container :: FORM_NAME\n\t\t\t)\n\t\t);\n\n\t\t$this->setForm($objForm);\n\n\t\t$objForm->setUseContainer(true);\n\n\t\t//Set Enitty\n\t\t$objFieldset =\n\t\t\t$objForm->addFieldset('aurednik_cms_home_entity',\n\t\t\t\tarray(\n\t\t\t\t\t'legend' => Mage:: helper('admin')->__('entity')));\n\n\t\t$objType = $objFieldset->addField(\n\t\t\tSDZeCOM_Aurednik_Model_Cms_Home_Entity :: TABLE_COLUMN_ID,\n\t\t\t'text',\n\t\t\tarray(\n\t\t\t\t'name' => self :: POST_ENTITY_DATA . '[' . SDZeCOM_Aurednik_Model_Cms_Home_Entity :: TABLE_COLUMN_ID . ']',\n\t\t\t\t'label' => Mage:: helper('admin')->__('Id'),\n\t\t\t\t'title' => Mage:: helper('admin')->__('Id'),\n\t\t\t\t'required' => true,\n\t\t\t\t'value' => $objEntity->getId(),\n\t\t\t\t'readonly' => true,\n\t\t\t\t'class' => 'required-entry'\n\n\t\t\t));\n\n\t\t$objType = $objFieldset->addField(\n\t\t\tSDZeCOM_Aurednik_Model_Cms_Home_Entity :: TABLE_COLUMN_NAME,\n\t\t\t'text',\n\t\t\tarray(\n\t\t\t\t'name' => self :: POST_ENTITY_DATA . '[' . SDZeCOM_Aurednik_Model_Cms_Home_Entity :: TABLE_COLUMN_NAME . ']',\n\t\t\t\t'label' => Mage:: helper('admin')->__('Name'),\n\t\t\t\t'title' => Mage:: helper('admin')->__('Name'),\n\t\t\t\t'required' => false,\n\t\t\t\t'value' => $objEntity->getEntity_name(),\n\t\t\t\t'class' => 'required-entry'\n\n\t\t\t));\n\n\t\t$field = $objFieldset->addField(SDZeCOM_Aurednik_Model_Cms_Home_Entity_Store::TABLE_COLUMN_STORE_ID, 'multiselect', array(\n\t\t\t'name' => self :: POST_ENTITY_DATA . '[' . SDZeCOM_Aurednik_Model_Cms_Home_Entity_Store :: TABLE_COLUMN_STORE_ID . ']',\n\t\t\t'label' => Mage::helper('cms')->__('Store View'),\n\t\t\t'title' => Mage::helper('cms')->__('Store View'),\n\t\t\t'required' => true,\n\t\t\t'value' => $objEntity->getStore_id(),\n\t\t\t'values' => Mage:: getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),\n\t\t));\n\n\t\t$renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');\n\t\t$field->setRenderer($renderer);\n\n\n\t\t$objType = $objFieldset->addField(\n\t\t\tSDZeCOM_Aurednik_Model_Cms_Home_Entity :: TABLE_COLUMN_TYPE,\n\t\t\t'select',\n\t\t\tarray(\n\t\t\t\t'name' => self :: POST_ENTITY_DATA . '[' . SDZeCOM_Aurednik_Model_Cms_Home_Entity :: TABLE_COLUMN_TYPE . ']',\n\t\t\t\t'label' => Mage:: helper('admin')->__('Type'),\n\t\t\t\t'title' => Mage:: helper('admin')->__('Type'),\n\t\t\t\t'required' => true,\n\t\t\t\t'disabled' => true,\n\t\t\t\t'options' => $objEntityType->toOptionArray(),\n\t\t\t\t'readonly' => true,\n\t\t\t\t'value' => $objEntity->getType_id()\n\t\t\t));\n\n\t\t$objFieldset->addField(\n\t\t\tSDZeCOM_Aurednik_Model_Cms_Home_Entity :: TABLE_COLUMN_ACTIVE,\n\t\t\t'select',\n\t\t\tarray(\n\t\t\t\t'name' => self :: POST_ENTITY_DATA . '[' . SDZeCOM_Aurednik_Model_Cms_Home_Entity :: TABLE_COLUMN_ACTIVE . ']',\n\t\t\t\t'label' => Mage:: helper('admin')->__('Active'),\n\t\t\t\t'title' => Mage:: helper('admin')->__('Active'),\n\t\t\t\t'required' => true,\n\t\t\t\t'disabled' => false,\n\t\t\t\t'options' => array(0 => Mage:: helper('admin')->__('No'), 1 => Mage:: helper('admin')->__('Yes')),\n\t\t\t\t'value' => $objEntity->getActive()\n\n\t\t\t));\n\n\t\t$objFieldset->addField(\n\t\t\tSDZeCOM_Aurednik_Model_Cms_Home_Entity :: TABLE_COLUMN_SORT,\n\t\t\t'text',\n\t\t\tarray(\n\t\t\t\t'name' => self :: POST_ENTITY_DATA . '[' . SDZeCOM_Aurednik_Model_Cms_Home_Entity :: TABLE_COLUMN_SORT . ']',\n\t\t\t\t'label' => Mage:: helper('admin')->__('Sort'),\n\t\t\t\t'title' => Mage:: helper('admin')->__('Sort'),\n\t\t\t\t'required' => false,\n\t\t\t\t'value' => $objEntity->getSort(),\n\t\t\t\t'class' => 'required-entry',\n\t\t\t\t'required' => true,\n\t\t\t));\n\n\t\t$objAttrCollection = $objAttribute->getCollection()->getByEntityTypeId($objEntity->getType_id());\n\n\t\tif ($objAttrCollection->count() == 0)\n\t\t{\n\t\t\tMage:: getSingleton('core/session')->addError(Mage:: helper('aurednik')->__('Error no attributes'));\n\t\t\t$this->getResponse()->sendResponse();\n\t\t}\n\n\t\t$objFieldset =\n\t\t\t$objForm->addFieldset(\n\t\t\t\t'aurednik_cms_home_entity_data',\n\t\t\t\tarray(\n\t\t\t\t\t'legend' => Mage:: helper('admin')->__('entity attribute data')\n\t\t\t\t)\n\t\t\t);\n\n\t\tforeach ($objAttrCollection as $objCurrentAttr)\n\t\t{\n\n\t\t\t$objEntityAttrValuesCollection = $objAttributeValue->getCollection()->getByEntityIdAndAttributeId($objEntity->getId(), $objCurrentAttr->getId());\n\n\t\t\tif ($objEntityAttrValuesCollection->count() > 0)\n\t\t\t{\n\n\t\t\t\tforeach ($objEntityAttrValuesCollection as $objCurrentAttrValue)\n\t\t\t\t{\n\n\t\t\t\t\t$objFieldset->addField(\n\t\t\t\t\t\t$objCurrentAttrValue->getId(),\n\t\t\t\t\t\t$objCurrentAttr->getInput_type(),\n\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t'name' => self :: POST_ENTITY_ATTRIBUTE_DATA . '[' . $objCurrentAttr->getId() . ']',\n\t\t\t\t\t\t\t'label' => Mage:: helper('aurednik')->__($objCurrentAttr->getTitle()),\n\t\t\t\t\t\t\t'title' => Mage:: helper('aurednik')->__($objCurrentAttr->getTitle()),\n\t\t\t\t\t\t\t'required' => $objEntity->getRequired() == 1 ? true : false,\n\t\t\t\t\t\t\t'value' => $objCurrentAttrValue->getAttribute_value(),\n\t\t\t\t\t\t\t'class' => 'required-entry'\n\t\t\t\t\t\t));\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\n\t\t\t\t$objFieldset->addField(\n\t\t\t\t\t$objEntity->getId() . \"_\" . $objCurrentAttr->getId(),\n\t\t\t\t\t$objCurrentAttr->getInput_type(),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'name' => self :: POST_ENTITY_ATTRIBUTE_DATA . '[' . $objCurrentAttr->getId() . ']',\n\t\t\t\t\t\t'label' => Mage:: helper('aurednik')->__($objCurrentAttr->getTitle()),\n\t\t\t\t\t\t'title' => Mage:: helper('aurednik')->__($objCurrentAttr->getTitle()),\n\t\t\t\t\t\t'required' => $objEntity->getRequired() == 1 ? true : false,\n\t\t\t\t\t\t'class' => 'required-entry'\n\t\t\t\t\t));\n\t\t\t}\n\t\t}\n\t\treturn parent:: _prepareForm();\n\t}",
"function bat_event_type_form($form, &$form_state, $event_type, $op = 'edit') {\n $form['#attributes']['class'][] = 'bat-management-form bat-event-type-form';\n\n if ($op == 'clone') {\n $event_type->label .= ' (cloned)';\n $event_type->type = '';\n }\n\n $form['label'] = array(\n '#title' => t('Label'),\n '#type' => 'textfield',\n '#default_value' => $event_type->label,\n '#description' => t('The human-readable name of this event type.'),\n '#required' => TRUE,\n '#size' => 30,\n );\n\n // Machine-readable type name.\n $form['type'] = array(\n '#type' => 'machine_name',\n '#default_value' => isset($event_type->type) ? $event_type->type : '',\n '#maxlength' => 32,\n '#machine_name' => array(\n 'exists' => 'bat_event_get_types',\n 'source' => array('label'),\n ),\n '#description' => t('A unique machine-readable name for this event type. It must only contain lowercase letters, numbers, and underscores.'),\n );\n\n if ($op == 'add') {\n $form['fixed_event_states'] = array(\n '#type' => 'checkbox',\n '#title' => t('Fixed event states'),\n );\n }\n elseif ($op == 'edit') {\n $form['type']['#disabled'] = TRUE;\n }\n\n $form['event_granularity'] = array(\n '#type' => 'select',\n '#title' => t('Event Granularity'),\n '#options' => array('bat_daily' => t('Daily'), 'bat_hourly' => t('Hourly')),\n '#default_value' => isset($event_type->event_granularity) ? $event_type->event_granularity : 'bat_daily',\n );\n\n if (isset($event_type->is_new)) {\n // Check for available Target Entity types.\n $target_entity_types = module_invoke_all('bat_event_target_entity_types');\n if (count($target_entity_types) == 1) {\n // If there's only one target entity type, we simply store the value\n // without showing it to the user.\n $form['target_entity_type'] = array(\n '#type' => 'value',\n '#value' => $target_entity_types[0],\n );\n }\n else {\n // Build option list.\n $options = array();\n foreach ($target_entity_types as $target_entity_type) {\n $target_entity_info = entity_get_info($target_entity_type);\n $options[$target_entity_type] = $target_entity_info['label'];\n }\n $form['target_entity_type'] = array(\n '#type' => 'select',\n '#title' => t('Target Entity Type'),\n '#description' => t('Select the target entity type for this Event type. In most cases you will wish to leave this as \"Unit\".'),\n '#options' => $options,\n // Default to BAT Unit if available.\n '#default_value' => isset($target_entity_types['bat_unit']) ? 'bat_unit' : '',\n );\n }\n }\n\n if (!isset($event_type->is_new) && $event_type->fixed_event_states == 0) {\n $fields_options = array();\n\n $fields = field_info_instances('bat_event', $event_type->type);\n\n foreach ($fields as $field) {\n $fields_options[$field['field_name']] = $field['field_name'];\n }\n\n $form['events'] = array(\n '#type' => 'fieldset',\n '#group' => 'additional_settings',\n '#title' => t('Events'),\n '#tree' => TRUE,\n '#weight' => 80,\n );\n\n $form['events'][$event_type->type] = array(\n '#type' => 'select',\n '#title' => t('Select your default @event field', array('@event' => $event_type->label)),\n '#options' => $fields_options,\n '#default_value' => isset($event_type->default_event_value_field_ids[$event_type->type]) ? $event_type->default_event_value_field_ids[$event_type->type] : NULL,\n '#empty_option' => t('- Select a field -'),\n );\n }\n\n if (!isset($event_type->is_new)) {\n $fields_options = array();\n $fields = field_info_instances('bat_event', $event_type->type);\n\n foreach ($fields as $field) {\n $fields_options[$field['field_name']] = $field['field_name'];\n }\n\n $form['event_label'] = array(\n '#type' => 'fieldset',\n '#group' => 'additional_settings',\n '#title' => t('Label Source'),\n '#tree' => TRUE,\n '#weight' => 80,\n );\n\n $form['event_label']['default_event_label_field_name'] = array(\n '#type' => 'select',\n '#title' => t('Select your label field', array('@event' => $event_type->label)),\n '#default_value' => isset($event_type->default_event_label_field_name) ? $event_type->default_event_label_field_name : NULL,\n '#empty_option' => t('- Select a field -'),\n '#description' => t('If you select a field here, its value will be used as the label for your event. BAT will fall back to using the event state as the label if the field has no value.'),\n '#options' => $fields_options,\n );\n }\n\n $form['actions'] = array(\n '#type' => 'actions',\n '#tree' => FALSE,\n );\n $form['actions']['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save Event type'),\n '#weight' => 40,\n '#submit' => array('bat_event_type_form_submit'),\n );\n\n return $form;\n}",
"public function initialize($entity = null, $options = null)\n {\n if (isset($options['edit']) && $options['edit']) {\n $id = new Hidden('id');\n } else {\n $id = new Text('id');\n }\n\n $this->add($id);\n\n // //id reseller\n // $id_reseller= new Text('id_reseller', [\n // 'placeholder' => 'Id Reseller'\n // ]);\n //\n // $id_reseller->setLabel('Reseller');\n // // $id_reseller->addValidators([\n // // new PresenceOf([\n // // 'message' => 'Id Reseller is required'\n // // ])\n // // ]);\n // $this->add($id_reseller);\n\n //nama agen\n $nama_agen = new Text('nama_agen', [\n 'placeholder' => 'Nama Agen'\n ]);\n\n $nama_agen->setLabel('Nama Agen');\n\n $nama_agen->addValidators([\n new PresenceOf([\n 'message' => 'Nama Agen is required'\n ])\n ]);\n\n $this->add($nama_agen);\n\n\n //merk\n $merk = new Text('merk', [\n 'placeholder' => 'Merk'\n ]);\n\n $merk->setLabel('Merk');\n $merk->addValidators([\n new PresenceOf([\n 'message' => 'Merk is required'\n ])\n ]);\n\n $this->add($merk);\n\n\n //serial number\n $serial_number = new Text('serial_number', [\n 'placeholder' => 'Serial Number'\n ]);\n\n $serial_number->setLabel('Serial Number');\n $serial_number->addValidators([\n new PresenceOf([\n 'message' => 'Serial Number is required'\n ])\n ]);\n\n $this->add($serial_number);\n\n\n //lokasi\n $lokasi = new Text('lokasi', [\n 'placeholder' => 'Lokasi'\n ]);\n\n $lokasi->setLabel('Lokasi');\n $lokasi->addValidators([\n new PresenceOf([\n 'message' => 'Lokasi is required'\n ])\n ]);\n\n $this->add($lokasi);\n\n\n //alamat\n $alamat = new Text('alamat', [\n 'placeholder' => 'Alamat'\n ]);\n\n $alamat->setLabel('Alamat');\n $alamat->addValidators([\n new PresenceOf([\n 'message' => 'Alamat is required'\n ])\n ]);\n\n $this->add($alamat);\n\n // Save\n $this->add(new Submit('Save', [\n 'class' => 'btn btn-success',\n 'id'=> 'submit'\n ]));\n\n // Save\n $this->add(new Submit('Search', [\n 'class' => 'btn btn-success',\n 'id'=> 'submit'\n ]));\n\n //id_doctor\n $findreseller = Users::find([\"profilesId = '5'\"]);\n $id_reseller = new Select('id_reseller', $findreseller, [\n 'using' => [\n 'id',\n 'name'\n ],\n 'useEmpty' => true,\n 'emptyText' => '----Select Reseller----',\n 'emptyValue' => ''\n ]);\n $id_reseller->setLabel('Reseller *');\n $this->add($id_reseller);\n\n }",
"public function __construct() {\n\t\t\t$this->field_type = 'select-edit-delete';\n\n\t\t\tparent::__construct();\n\t\t}",
"private function createEditForm(ObjectType $entity)\n {\n $form = $this->createForm(new ObjectTypeType(), $entity, array(\n 'action' => $this->generateUrl('object_objecttype_update', array('id' => $entity->getId())),\n 'method' => 'PUT',\n ));\n\n $form->add('submit', 'submit', array('label' => 'Сохранить изменения'));\n\n return $form;\n }",
"protected function createComponentEditForm() {\r\n\t\t$form = new Form;\r\n\t\t$form->getElementPrototype()->class(\"formWide\");\r\n\t\t$options = array(0 => \"Default\", 1 => \"Odkaz na obsah\", 3 => \"Odkaz na položku menu\");\r\n\t\t// easy way how to create url slug\r\n\t\t$form->addText(\"title\", \"Název:\")\r\n\t\t\t\t->setAttribute('onchange', '\r\n\t\t\t\t\t\t\tvar nodiac = { \"á\": \"a\", \"č\": \"c\", \"ď\": \"d\", \"é\": \"e\", \"ě\": \"e\", \"í\": \"i\", \"ň\": \"n\", \"ó\": \"o\", \"ř\": \"r\", \"š\": \"s\", \"ť\": \"t\", \"ú\": \"u\", \"ů\": \"u\", \"ý\": \"y\", \"ž\": \"z\" };\r\n\t\t\t\t\t\t\ts = $(\"#frmeditForm-title\").val().toLowerCase();\r\n\t\t\t\t\t\t\tvar s2 = \"\";\r\n\t\t\t\t\t\t\tfor (var i=0; i < s.length; i++) {\r\n\t\t\t\t\t\t\t\ts2 += (typeof nodiac[s.charAt(i)] != \"undefined\" ? nodiac[s.charAt(i)] : s.charAt(i));\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tresult=s2.replace(/[^a-z0-9_]+/g, \"-\").replace(/^-|-$/g, \"\");\r\n\t\t\t\t\t\t\t$(\"#frmeditForm-url\").val(result);\r\n\t\t\t\t\t\t');\r\n\t\t$form->addText(\"url\", \"url:\")->setAttribute(\"readonly\", \"readonly\");\r\n\t\tif (!$this->onlyTree) {\r\n\t\t\t$form->addSelect(\"target_type\", \"Cíl:\", $options);\r\n\t\t\t$content = $this->prepareContentSelectBox();\r\n\t\t\t$menuContent = $this->prepareMenuContentSelectBox();\r\n\t\t\t$form->addSelect(\"target_id\", \"Odkazovaný obsah:\", $content)->setPrompt(\"Pouze při zvolení výše\");\r\n\t\t\t$form->addSelect(\"target_menu\", \"Odk. položka menu:\", $menuContent)->setPrompt(\"Pouze při zvolení výše\");\r\n\t\t}\r\n\t\t$form->addHidden(\"parent_id\", $this->parent_id);\r\n\t\t$form->addHidden(\"edit_id\", $this->edit_id);\r\n\t\t//filling form\r\n\t\tif ($this->edit_id or $this->edit_id === \"0\") {\r\n\t\t\t$defFromDb = $this->closureModel->getItemById($this->edit_id);\r\n\t\t\t$defaults = new \\Nette\\ArrayHash;\r\n\t\t\tforeach ($defFromDb as $key => $value) {\r\n\t\t\t\t$defaults->$key = $value;\r\n\t\t\t}\r\n\t\t\tif ($this->edit_id === \"0\") {\r\n\t\t\t\t$form[\"title\"]->setDisabled();\r\n\t\t\t}\r\n\t\t\tif (!$this->onlyTree) {\r\n\t\t\t\t$t = $defaults->target;\r\n\t\t\t\tif (!Validators::isNumericInt($t)) {\r\n\t\t\t\t\t$menuItem = $this->checkTargetMenuItemExists($t);\r\n\t\t\t\t\tif ($menuItem) {\r\n\t\t\t\t\t\t$defaults->target_type = 3;\r\n\t\t\t\t\t\t$defaults->target_menu = $menuItem;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t$contentId = $this->checkTargetContentExists($t);\r\n\t\t\t\t\t\t$defaults->target_type = 1;\r\n\t\t\t\t\t\t$defaults->target_id = $contentId;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$form[\"target_menu\"]->getControlPrototype()->addClass(\"formFieldInvisible\");\r\n\t\t\t\t} elseif ($t <= 0) {\r\n\t\t\t\t\t$defaults->target_type = 0;\r\n\t\t\t\t\t$form[\"target_menu\"]->getControlPrototype()->addClass(\"formFieldInvisible\");\r\n\t\t\t\t\t$form[\"target_id\"]->getControlPrototype()->addClass(\"formFieldInvisible\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t$defaults->target = null;\r\n\t\t\t$form->setDefaults($defaults);\r\n\t\t}\r\n\r\n\t\t$form->addSubmit('save', 'Save')\r\n\t\t\t\t\t\t->setAttribute('onclick', '$(\"#frmeditForm-title\").trigger(\"change\")')\r\n\t\t\t\t->onClick[] = callback($this, 'editFormSubmitted');\r\n\t\t$form->setRenderer(new \\Kdyby\\BootstrapFormRenderer\\BootstrapRenderer());\r\n\t\treturn $form;\r\n\t}",
"function ting_new_materials_content_type_edit_form($form, &$form_state) {\n return $form;\n}",
"function mongo_node_bundle_edit_form($form, $form_state, $entity_type, $bundle) {\n\n $set = mongo_node_settings();\n\n $form = array();\n\n $form['label'] = array(\n '#type' => 'textfield',\n '#title' => t('Entity type'),\n '#default_value' => $set[$entity_type]['bundles'][$bundle]['label'],\n '#description' => t('The human readable name of the entity.'),\n );\n\n $form['name'] = array(\n '#type' => 'machine_name',\n '#required' => FALSE,\n '#default_value' => $bundle,\n '#machine_name' => array(\n 'exists' => '_mongo_node_bundle_exists',\n 'source' => array('label'),\n ),\n );\n\n $description = isset($set[$entity_type]['bundles'][$bundle]['description']) ? $set[$entity_type]['bundles'][$bundle]['description'] : '';\n $form['description'] = array(\n '#type' => 'textarea',\n '#title' => t('Description'),\n '#default_value' => $description,\n '#description' => t('Describe this bundle.'),\n );\n\n // Save entity type and bundle.\n $form['bundle_type'] = array(\n '#type' => 'value',\n '#value' => array(\n 'entity_type' => $entity_type,\n 'bundle' => $bundle,\n ),\n );\n\n $form['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save'),\n );\n\n return $form;\n}",
"public function edit(Type $type)\n {\n //\n }",
"public function edit(Type $type)\n {\n //\n }",
"public function edit(Type $type)\n {\n //\n }",
"public function getEditForm();",
"private function createEditForm(Cardtype $entity)\n {\n $form = $this->createForm(new CardtypeType(), $entity, array(\n 'action' => $this->generateUrl('cardtype_update', array('id' => $entity->getId())),\n 'method' => 'PUT',\n ));\n\n $form->add('submit', 'submit', array('label' => 'Update'));\n\n return $form;\n }",
"function mongo_node_bundle_create_form($form, $form_state, $entity_type) {\n $form = array();\n\n $form['label'] = array(\n '#type' => 'textfield',\n '#title' => t('Entity type'),\n '#description' => t('The human readable name of the entity.'),\n );\n\n $form['name'] = array(\n '#type' => 'machine_name',\n '#required' => FALSE,\n '#machine_name' => array(\n 'exists' => '_mongo_node_bundle_exists',\n 'source' => array('label'),\n ),\n );\n\n $form['description'] = array(\n '#type' => 'textarea',\n '#title' => t('Description'),\n '#description' => t('Describe this bundle.'),\n );\n\n $form['entity_type'] = array(\n '#type' => 'value',\n '#value' => $entity_type,\n );\n\n $form['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save'),\n );\n\n return $form;\n}",
"public function initialize($entity = null, $options = [])\n {\n\n\n if (!isset($options['edit'])) {\n\n\n// $element = new Text(\"PrefixNameID\");\n// $this->add($element->setLabel(\"เลขที่คำนำหน้าชื่อ\"));\n }\n else {\n //Edit ONLY\n $this->add(new Hidden(\"CourseID\"));\n\n }\n\n\n $RecordStatus = new Hidden(\"RecordStatus\");\n $RecordStatus->setDefault('N');\n $this->add($RecordStatus);\n\n $CourseNameTh = new Text(\"CourseNameTh\");\n $CourseNameTh->setLabel(\"ชื่อหลักสูตร(Th)\");\n $CourseNameTh->setFilters(['striptags', 'string']);\n $CourseNameTh->addValidators([\n new PresenceOf([\n 'message' => 'กรุณากรอกข้อมูล ชื่อหลักสูตร(Th)'\n ])\n ]);\n\n $this->add($CourseNameTh);\n\n $CourseNameEn = new Text(\"CourseNameEn\");\n $CourseNameEn->setLabel(\"ชื่อหลักสูตร(En)\");\n $CourseNameEn->setFilters(['striptags', 'string']);\n\n $this->add($CourseNameEn);\n\n $CourseDetail = new Text(\"CourseDetail\");\n $CourseDetail->setLabel(\"รายละเอียด\");\n $CourseDetail->setFilters(['striptags', 'string']);\n\n $this->add($CourseDetail);\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n }",
"function form2($tablename, $type = false, $int = false)\n\t{\n\t\t$this->tablename = $tablename;\n\n\t\t$this->form = new form;\n\t\t$this->form->initTable($tablename);\n\t\t$this->type = $type;\n\t\t$this->table = &$this->form->tables->$tablename;\n\t\t$this->table->setupenv($_GET);\n\n\t\tif ($type == 'list')\n\t\t{\n\t\t\t//$this->getRecords($int);\n\t\t}\n\t\telseif ($type == 'record')\n\t\t{\n\t\t\tif ($int === false)\n\t\t\t\ttrigger_error(\"You need to specify an id for this type form\");\n\t\t\t$this->getRecord($int);\n\t\t\t$this->id = $int;\n\t\t}\n\t}",
"public function initialize(ThThesaurus $entity = null, $options = ['edit'=>true])\n {\n \t$this->add(new Hidden('id_thesaurus'));\n\n \t$this->addText('nombre', ['tooltip'=>'Título del Thesaurus (requerido)', 'label'=>'Titulo', 'filters'=>array('striptags', 'string'), 'validators'=>[new PresenceOf(['message' => 'Titulo es requerido'])] ]);\n \t//$this->addText('iso25964_identifier', ['label'=>'DC:Identificador', 'filters'=>array('striptags', 'string')]);\n\n \t$this->addTextArea('iso25964_description', ['label'=>'Descripción', 'filters'=>array('striptags', 'string'), 'validators'=>[new PresenceOf(['message' => 'Descripción es requerido'])] ]);\n $this->addText('iso25964_publisher', ['tooltip'=>'Entidad responsable de la publicación', 'label'=>'Editor', 'filters'=>array('striptags', 'string')]);\n $this->addText('iso25964_rights', ['tooltip'=>'Copyright / Otros Derechos de la Información', 'label'=>'Derechos/Copyright', 'filters'=>array('striptags', 'string')]);\n\n $this->addSelect('iso25964_license', ['tooltip'=> 'Licencias para otros trabajos', 'label'=>'Licencia', 'options'=> self::DEFAULT_RIGHTS, 'attrs'=> ['useEmpty' => true, 'emptyText' => '--']]);\n $this->addText('iso25964_coverage', ['tooltip'=>'Cobertura espacial o temporal del Thesaurus', 'label'=>'Cobertura/Alcance', 'filters'=>array('striptags', 'string')]);\n $this->addText('iso25964_created', ['label'=>'Fecha creación', 'filters'=>array('striptags', 'string')]);\n\n $this->addText('iso25964_subject', ['tooltip'=>'Indice de Términos indicando las materias del contenido', 'label'=>'Temática/Contenido', 'filters'=>array('striptags', 'string')]);\n $this->addText('iso25964_language', ['tooltip'=>'Idiomas soportados por el Thesaurus', 'label'=>'Idioma', 'filters'=>array('striptags', 'string')]);\n $this->addText('iso25964_source', ['tooltip'=>'Recursos desde los cuales el Thesaurus fue derivado', 'label'=>'Fuentes', 'filters'=>array('striptags', 'string')]);\n\n $this->addText('iso25964_creator', ['tooltip'=>'Persona o entidad principal responsable de la elaboración', 'label'=>'Creador', 'filters'=>array('striptags', 'string')]);\n $this->addText('iso25964_contributor', ['tooltip'=>'Personas u organizaciones quienes contribuyeron con el Thesaurus', 'label'=>'Colaborador', 'filters'=>array('striptags', 'string')]);\n $this->addSelect('iso25964_type', ['tooltip'=>'El género del vocabulario', 'label'=>'Tipo', 'options'=> self::DEFAULT_TYPES, 'attrs'=> ['useEmpty' => true, 'emptyText' => '--']]);\n\n $this->addSelect('is_activo', ['tooltip'=>'Activar / Inactivar', 'label'=>'Activo', 'options'=> [0 => 'NO', 1 => 'SI'], 'attrs'=> ['useEmpty' => true, 'emptyText' => '--']]);\n $this->addSelect('is_primario', ['tooltip'=>'Primario (Aparece como pagina inicial del sitio)', 'label'=>'Primario', 'options'=> [0 => 'NO', 1 => 'SI'], 'attrs'=> ['useEmpty' => true, 'emptyText' => '--']]);\n $this->addSelect('is_publico', ['tooltip'=>'Publico (Si LECTOR_PERMISO = ANONIMO es explorable sin ingresar como usuario registrado) / Privado (Solo pueden ver los usuarios autorizados)', 'label'=>'Publico/Privado', 'options'=> [0 => 'PRIVADO', 1 => 'PUBLICO'], 'attrs'=> ['useEmpty' => true, 'emptyText' => '--']]);\n\n $this->addSelect('permisos[]', ['tooltip'=>'Permisos por Usuario', 'label'=>'Tipo', 'options'=> AdUsuarioForm::PERMISOS_TYPES, 'attrs'=> ['useEmpty' => true, 'emptyText' => '--']]);\n\n if ($this->isEditable($options)) {\n\n }\n else {\n \tforeach($this->getElements() as &$e) {\n \t\t$e->setAttribute(\"readonly\", \"readonly\");\n \t}\n }\n }",
"function fyc_project_menu_content_type_edit_form($form, &$form_state) {\n return $form;\n}",
"public function initialize($entity = null, $options = array())\n {\n if (!isset($options['edit'])) {\n $element = new Text(\"id\");\n $this->add($element->setLabel(\"Id\"));\n } else {\n $this->add(new Hidden(\"id\"));\n }\n\n $name = new Text(\"nombre\");\n $name->setLabel(\"Nombre\");\n $name->setFilters(['striptags', 'string']);\n $name->addValidators([\n new PresenceOf([\n 'message' => 'El Nombre es Requerido'\n ])\n ]);\n $this->add($name);\n\n $genero = new Select('id_genero', Generos::find(), [\n 'using' => ['id_genero', 'genero'],\n 'useEmpty' => true,\n 'emptyText' => '...',\n 'emptyValue' => ''\n ]);\n $genero->setLabel('Genero de Pelicula');\n $this->add($genero);\n\n $year = new Text(\"Año\");\n $year->setLabel(\"Año\");\n $year->setFilters(['date']);\n $year->addValidators([\n new PresenceOf([\n 'message' => 'Por favor ingrese el Año'\n ])\n ]);\n $this->add($year);\n }",
"public function edit(TypesConges $typesConges)\n {\n //\n }",
"private function createEditForm(SkSpecies $entity) {\n $em = $this->getDoctrine()->getManager();\n\n // Get criterias from species\n $criteria_ids = $em->getRepository('SkaphandrusAppBundle:SkIdentificationCriteria')->getCriteriasFromSpecies($entity->getId());\n\n\n\n $form = $this->createForm(new SkIdentificationSpeciesType(), $entity, array(\n 'action' => $this->generateUrl('identification_species_admin_update', array('id' => $entity->getId())),\n 'method' => 'PUT',\n 'criterias' => $criteria_ids\n ));\n return $form;\n }",
"function ctools_term_list_content_type_edit_form(&$form, &$form_state) {\n $conf = $form_state['conf'];\n\n $form['type'] = array(\n '#type' => 'radios',\n '#title' => t('Which terms'),\n '#options' => ctools_admin_term_list_options(),\n '#default_value' => $conf['type'],\n '#prefix' => '<div class=\"clear-block no-float\">',\n '#suffix' => '</div>',\n );\n\n $form['list_type'] = array(\n '#type' => 'select',\n '#title' => t('List type'),\n '#options' => array('ul' => t('Unordered'), 'ol' => t('Ordered')),\n '#default_value' => $conf['list_type'],\n );\n}",
"private function createEditForm(Galeria $entity, $tipo=\"imagen\")\r\n {\r\n if($tipo == \"imagen\"){\r\n $form = $this->createForm(new GaleriaType(), $entity, array(\r\n 'action' => $this->generateUrl('galerias_update', array('id' => $entity->getId())),\r\n 'method' => 'PUT',\r\n ));\r\n }else if($tipo== \"link_video\"){\r\n $form = $this->createForm(new GaleriaLinkVideoType(), $entity, array(\r\n 'action' => $this->generateUrl('galerias_update', array('id' => $entity->getId())),\r\n 'method' => 'PUT',\r\n ));\r\n }else if($tipo==\"parcial\"){\r\n $form = $this->createForm(new GaleriaParcialType(), $entity, array(\r\n 'action' => $this->generateUrl('galerias_actualizar', array('id' => $entity->getId())),\r\n 'method' => 'PATCH',\r\n ));\r\n }\r\n\r\n //$form->add('submit', 'submit', array('label' => 'Update'));\r\n\r\n return $form;\r\n }",
"function ting_visual_relation_search_content_type_edit_form($form, &$form_state) {\n return $form;\n}",
"protected function form()\n {\n $form = new Form(new Usertype());\n\n $form->text('usertype', '类型名称')->rules('required|max:10');\n $form->tools(function (Form\\Tools $tools) {\n $tools->disableList();\n $tools->disableDelete();\n $tools->disableView();\n });\n $form->footer(function ($footer) {\n $footer->disableReset();\n $footer->disableViewCheck();\n $footer->disableEditingCheck();\n $footer->disableCreatingCheck();\n });\n return $form;\n }",
"function ctools_block_content_type_edit_form(&$form, &$form_state) {\n // Does nothing!\n}"
]
| [
"0.687346",
"0.6510986",
"0.6469823",
"0.6450052",
"0.63589495",
"0.6339538",
"0.6334518",
"0.63295275",
"0.62948775",
"0.6289656",
"0.6288563",
"0.62831736",
"0.62712705",
"0.62712705",
"0.62712705",
"0.6207555",
"0.620274",
"0.61831987",
"0.61577857",
"0.6130354",
"0.6123258",
"0.6119838",
"0.61140615",
"0.61041206",
"0.6071785",
"0.60556877",
"0.6027003",
"0.60263836",
"0.6010666",
"0.60090876"
]
| 0.6971317 | 0 |
Form submission handler for mongo_node_type_edit_form(). | function mongo_node_type_edit_form_submit($form, $form_state) {
$label = $form_state['values']['label'];
$machine_name = $form_state['values']['name'];
$old_entity_type = $form_state['values']['entity_type'];
$set = mongo_node_settings();
if ($machine_name != $old_entity_type) {
$set += mongo_node_type_default_settings($label, $machine_name);
$set[$machine_name] = $set[$old_entity_type];
unset($set[$old_entity_type]);
// Update existing mongo entities with new entity type.
_mongo_node_update_type($old_entity_type, $machine_name);
}
else {
$set[$machine_name]['label'] = $label;
}
// Save settings.
mongo_node_settings_save($set);
return TRUE;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function mongo_node_type_edit_form($form, $form_state, $entity_type) {\n $set = mongo_node_settings();\n $form = array();\n\n $form['label'] = array(\n '#type' => 'textfield',\n '#title' => t('Entity type'),\n '#default_value' => $set[$entity_type]['label'],\n '#description' => t('The human readable name of the entity.'),\n );\n\n $form['name'] = array(\n '#type' => 'machine_name',\n '#required' => FALSE,\n '#default_value' => $entity_type,\n '#machine_name' => array(\n 'exists' => '_mongo_node_type_exists',\n 'source' => array('label'),\n ),\n );\n\n // Send entity type.\n $form['entity_type'] = array(\n '#type' => 'value',\n '#value' => $entity_type,\n );\n\n $form['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save'),\n );\n\n return $form;\n}",
"function mongo_node_form($form, &$form_state, $entity, $entity_type) {\n $form = array();\n\n $form_state['entity_type'] = $entity_type;\n if (!isset($form_state[$entity_type])) {\n $form_state[$entity_type] = $entity;\n }\n else {\n $entity = $form_state[$entity_type];\n }\n\n // Get title label name from properties if exists\n static $settings = array();\n if(empty($settings)) {\n $settings = mongo_node_settings();\n }\n $title = isset($settings[$entity_type]['properties']['title']['label']) ? $settings[$entity_type]['properties']['title']['label'] : t('Title');\n\n $form['title'] = array(\n '#type' => 'textfield',\n '#title' => $title,\n '#required' => TRUE,\n '#default_value' => isset($entity->title) ? $entity->title : '',\n );\n\n $form['#attributes']['class'][] = 'mongo-node-form';\n if (!empty($entity->type)) {\n // TODO -- add entity type with bundle.\n $form['#attributes']['class'][] = 'mongo-node-' . $entity->type . '-form';\n }\n\n $form['actions'] = array('#type' => 'actions');\n $form['actions']['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save'),\n '#weight' => 5,\n '#submit' => array('mongo_node_form_submit'),\n );\n\n $form['#validate'][] = 'mongo_node_form_validate';\n field_attach_form($entity_type, $entity, $form, $form_state);\n\n return $form;\n}",
"public function postEdit(NodeFormRequest $request)\n { \n // first we save the node model\n $node = $this->nodeModel->find($request->input('id'));\n \n // save the node model\n $node->type = $request->input('type');\n $node->title = $request->input('title');\n $node->save();\n \n $nodeType = $node->nodeType;\n if($nodeType) {\n // instantiate nodeType model\n $nodeType->nid = $request->input('id');\n $nodeType->body = $request->input('body');\n // save model\n $nodeType->save();\n } else{\n \n $this->nodeTypeModel->create($request->input());\n }\n // we will flash a notification\n Notification::success($request->input('type') . ' page has been updated');\n return redirect()->route('admin.home');\n }",
"function mongo_node_page_edit($entity_type, $entity) {\n $title = $entity->title;\n drupal_set_title($title);\n\n $content = array();\n $content = drupal_get_form('mongo_node_form', $entity, $entity_type);\n\n return $content;\n}",
"function mongo_node_form_submit(&$form, &$form_state) {\n $entity_type = $form_state['entity_type'];\n $entity = entity_ui_controller($entity_type)->entityFormSubmitBuildEntity($form, $form_state);\n $insert = empty($entity->mid);\n entity_save($entity_type, $entity);\n\n $info = entity_get_info($entity_type);\n $bundle_key = $info['bundle keys']['bundle'];\n $bundle_label = $info['bundles'][$entity->{$bundle_key}]['label'];\n\n if ($insert) {\n drupal_set_message(t('@label %title has been created.',\n array(\n '@label' => $bundle_label,\n '%title' => $entity->title,\n )\n )\n );\n }\n else {\n drupal_set_message(t('@label %title has been updated.',\n array(\n '@label' => $bundle_label,\n '%title' => $entity->title,\n )\n )\n );\n }\n\n $uri = entity_uri($entity_type, $entity);\n $form_state['redirect'] = drupal_get_path_alias($uri['path']);\n}",
"function mongo_node_bundle_edit_form($form, $form_state, $entity_type, $bundle) {\n\n $set = mongo_node_settings();\n\n $form = array();\n\n $form['label'] = array(\n '#type' => 'textfield',\n '#title' => t('Entity type'),\n '#default_value' => $set[$entity_type]['bundles'][$bundle]['label'],\n '#description' => t('The human readable name of the entity.'),\n );\n\n $form['name'] = array(\n '#type' => 'machine_name',\n '#required' => FALSE,\n '#default_value' => $bundle,\n '#machine_name' => array(\n 'exists' => '_mongo_node_bundle_exists',\n 'source' => array('label'),\n ),\n );\n\n $description = isset($set[$entity_type]['bundles'][$bundle]['description']) ? $set[$entity_type]['bundles'][$bundle]['description'] : '';\n $form['description'] = array(\n '#type' => 'textarea',\n '#title' => t('Description'),\n '#default_value' => $description,\n '#description' => t('Describe this bundle.'),\n );\n\n // Save entity type and bundle.\n $form['bundle_type'] = array(\n '#type' => 'value',\n '#value' => array(\n 'entity_type' => $entity_type,\n 'bundle' => $bundle,\n ),\n );\n\n $form['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save'),\n );\n\n return $form;\n}",
"function ctools_block_content_type_edit_form_submit(&$form, &$form_state) {\n if (empty($form_state['subtype']) && isset($form_state['pane'])) {\n $form_state['pane']->subtype = $form_state['conf']['module'] . '-' . $form_state['conf']['delta'];\n unset($form_state['conf']['module']);\n unset($form_state['conf']['delta']);\n }\n}",
"function mongo_node_type_create_form_submit($form, $form_state) {\n $label = $form_state['values']['label'];\n $machine_name = $form_state['values']['name'];\n\n $set = mongo_node_settings();\n $set += mongo_node_type_default_settings($label, $machine_name);\n\n // @todo - redirect to entity type page\n mongo_node_settings_save($set);\n}",
"function mongo_node_type_delete_form($form, $form_state, $entity_type) {\n $form = array();\n // Send entity type.\n $form['entity_type'] = array(\n '#type' => 'value',\n '#value' => $entity_type,\n );\n $path = '/admin/structure/mongo-node';\n\n $extist_entity_content = '';\n $collection = mongodb_collection('fields_current', $entity_type);\n $count = $collection->count(array('_type' => $entity_type));\n if ($count) {\n $extist_entity_content = t('%type is used by %count piece of content on your site. If you remove this entity type, you will not be able to edit the %type content and it may not display correctly.', array('%type' => $entity_type, '%count' => $count));\n $extist_entity_content .= '<br/><br/>';\n }\n return confirm_form($form, t('Delete entity type'), $path, $extist_entity_content . 'This action cannot be undone', t('Delete'), t('Cancel'), 'mongo_node_type_delete');\n}",
"function mongo_node_type_delete_form_submit($form, $form_state) {\n $set = mongo_node_settings();\n\n // Remove entity type.\n $entity_type = $form_state['values']['entity_type'];\n unset($set[$entity_type]);\n\n // Drop collection that stores entities for entity type.\n $collection = mongodb_collection('fields_current', $entity_type);\n $collection->drop();\n\n // Drop collection that stores entity types autoincrement ids.\n $collection = mongodb_collection($entity_type . '_ids');\n $collection->drop();\n\n mongo_node_settings_save($set);\n\n // Redirect to entity type admin.\n drupal_goto('admin/structure/mongo-node');\n}",
"function mongo_node_bundle_edit_form_submit($form, $form_state) {\n\n $label = $form_state['values']['label'];\n $machine_name = $form_state['values']['name'];\n $entity_type = $form_state['values']['bundle_type']['entity_type'];\n $old_bundle_type = $form_state['values']['bundle_type']['bundle'];\n $description = $form_state['values']['description'];\n\n $set = mongo_node_settings();\n\n if ($machine_name != $old_bundle_type) {\n $set[$entity_type]['bundles'] += mongo_node_bundle_default_settings($label, $machine_name, $description);\n $set[$entity_type]['bundles'][$machine_name] = $set[$entity_type]['bundles'][$old_bundle_type];\n unset($set[$entity_type]['bundles'][$old_bundle_type]);\n\n // Update existing mongo entities with new bundle.\n //_mongo_node_update_bundle($entity_type, $old_bundle_type, $machine_name);\n }\n else {\n $set[$entity_type]['bundles'][$machine_name]['label'] = $label;\n $set[$entity_type]['bundles'][$machine_name]['description'] = $description;\n }\n\n // Save settings.\n mongo_node_settings_save($set);\n return TRUE;\n}",
"function mongo_node_admin_content($form, $form_state, $entity_type) {\n $settings = mongo_node_settings();\n\n // Send entity type.\n $form['entity_type'] = array(\n '#type' => 'value',\n '#value' => $entity_type,\n );\n\n $form['filters'] = array(\n '#type' => 'fieldset',\n '#title' => t('Show only items where'),\n );\n\n $filters = mongo_node_filters($entity_type);\n $applied_filters = isset($_SESSION[$entity_type . '_filters']) ? $_SESSION[$entity_type . '_filters'] : array();\n\n foreach ($filters as $f_type_name => $f_type) {\n $form['filters'][$f_type_name] = array('#type' => 'select', '#title' => $f_type_name);\n foreach ($f_type as $f_name => $f_val) {\n $form['filters'][$f_type_name]['#options'][$f_name] = $f_val['label'];\n }\n }\n\n $items = array();\n $remaining_filters = array();\n foreach ($applied_filters as $app_filter) {\n $items[] = t('where %f_name is %f_val', array('%f_name' => $app_filter['#type'], '%f_val' => $app_filter['#value']));\n $conditions = $filters[$app_filter['#type']][$app_filter['#value']]['filters'];\n foreach ($conditions as $condition) {\n $remaining_filters[$condition['#type']]['#callback'] = $condition['#callback'];\n $remaining_filters[$condition['#type']]['#value'][] = $condition['#value'];\n }\n }\n\n $form['filters']['#description'] = theme('item_list', array('items' => $items));\n\n if (empty($applied_filters)) {\n $form['filters']['filter'] = array(\n '#type' => 'submit',\n '#value' => 'Filter',\n '#submit' => array('mongo_node_filters_submit'),\n );\n }\n else {\n $form['filters']['refine'] = array(\n '#type' => 'submit',\n '#value' => 'Refine',\n '#submit' => array('mongo_node_filters_submit'),\n );\n $form['filters']['undo'] = array(\n '#type' => 'submit',\n '#value' => 'Undo',\n '#submit' => array('mongo_node_filters_submit'),\n );\n $form['filters']['reset'] = array(\n '#type' => 'submit',\n '#value' => 'Reset',\n '#submit' => array('mongo_node_filters_submit'),\n );\n }\n\n $form['options'] = array(\n '#type' => 'fieldset',\n '#title' => t('Update options'),\n );\n\n $operations = mongo_node_operations();\n foreach ($operations as $op => $op_set) {\n $options[$op] = $op_set['label'];\n }\n $form['options']['operation'] = array(\n '#type' => 'select',\n '#options' => $options,\n );\n\n $form['options']['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Update'),\n '#validate' => array('mongo_node_operation_validate'),\n '#submit' => array('mongo_node_operation_submit'),\n );\n\n $query = new EntityFieldQuery();\n\n $query->entityCondition('entity_type', $entity_type)\n ->propertyOrderBy('created', 'DESC')\n ->pager(10);\n\n // Actually apply filters.\n foreach ($remaining_filters as $r_name => $r_values) {\n $query->{$r_values['#callback']}($r_name, $r_values['#value'], 'IN');\n }\n\n $result = $query->execute();\n\n $languages = language_list();\n $destination = drupal_get_destination();\n $header = array(\n 'title' => array('data' => t('Title'), 'field' => 'title'),\n 'type' => t('Type'),\n 'author' => t('Author'),\n 'status' => t('Status'),\n 'changed' => t('Updated'),\n 'language' => t('Language'),\n 'operations' => t('Operations'),\n );\n $options = array();\n\n if (isset($result[$entity_type])) {\n $ids = array_keys($result[$entity_type]);\n $entities = entity_load($entity_type, $ids);\n\n foreach ($result[$entity_type] as $id => $efq_entity) {\n $entity = entity_load($entity_type, array($id));\n $entity = reset($entity);\n\n $entity_uri = entity_uri($entity_type, $entity);\n\n $options[$id] = array(\n 'title' => array(\n 'data' => array(\n '#type' => 'link',\n '#title' => $entity->title,\n '#href' => $entity_uri['path'],\n ),\n ),\n 'type' => check_plain($settings[$entity_type]['bundles'][$entity->type]['label']),\n 'author' => theme('username', array('account' => $entity)),\n 'status' => $entity->status ? t('published') : t('not published'),\n 'changed' => format_date($entity->changed, 'short'),\n 'language' => ($entity->language == LANGUAGE_NONE) ? t('Language neutral') : $languages[$entity->language]->name,\n );\n\n $operations = array();\n $operations[] = l(t('edit'), $entity_uri['path'] . '/edit', array('query' => $destination));\n $operations[] = l(t('delete'), $entity_uri['path'] . '/delete', array('query' => $destination));\n\n $options[$id]['operations'] = theme('item_list', array('items' => $operations, 'attributes' => array('class' => 'inline')));\n }\n }\n\n $form['entities'] = array(\n '#type' => 'tableselect',\n '#header' => $header,\n '#options' => $options,\n '#empty' => t('No content available'),\n );\n\n $form['pager'] = array(\n '#theme' => 'pager',\n );\n\n return $form;\n}",
"function mongo_node_form_validate(&$form, &$form_state) {\n $entity_type = $form_state['entity_type'];\n $entity = $form_state[$entity_type];\n field_attach_form_validate($entity_type, $entity, $form, $form_state);\n}",
"function ding_panels_node_body_content_type_edit_form(&$form, &$form_state) {\n return $form;\n}",
"function travel_type_form($form, &$form_state, $entity_type, $op = 'edit') {\n // Handle the case when cloning is performed.\n if ($op == 'clone') {\n $entity_type->label .= ' (cloned)';\n $entity_type->type = '';\n }\n\n // Describe all properties of the entity which shall be shown on the form.\n $form['label'] = array(\n '#title' => t('Label'),\n '#type' => 'textfield',\n '#default_value' => $entity_type->label,\n '#description' => t('The human-readable name of this entity type.'),\n '#required' => TRUE,\n '#size' => 30,\n );\n $form['type'] = array(\n '#type' => 'machine_name',\n '#default_value' => isset($entity_type->type) ? $entity_type->type : '',\n '#maxlength' => 32,\n //'#disabled' => $entity_type->isLocked() && $op != 'clone',\n '#machine_name' => array(\n 'exists' => 'travel_type_load_multiple',\n 'source' => array('label'),\n ),\n '#description' => t('A unique machine-readable name for this entity type. It must only contain lowercase letters, numbers, and underscores.'),\n );\n $form['description'] = array(\n '#type' => 'textarea',\n '#default_value' => isset($entity_type->description) ? $entity_type->description : '',\n '#description' => t('Description about the entity type.'),\n );\n\n // Add some buttons.\n $form['actions'] = array('#type' => 'actions');\n $form['actions']['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save entity type'),\n '#weight' => 40,\n );\n //if (!$entity_type->isLocked() && $op != 'add' && $op != 'clone') {\n $entity_id = entity_id('travel', $entity);\n if (!empty($entity_id)) {\n $form['actions']['delete'] = array(\n '#type' => 'submit',\n '#value' => t('Delete entity type'),\n '#weight' => 45,\n '#limit_validation_errors' => array(),\n '#submit' => array('travel_type_form_submit_delete'),\n );\n }\n\n return $form;\n}",
"function node_form(&$form_state, $node) {\n global $user;\n\n if (isset($form_state['node'])) {\n $node = $form_state['node'] + (array)$node;\n }\n if (isset($form_state['node_preview'])) {\n $form['#prefix'] = $form_state['node_preview'];\n }\n $node = (object)$node;\n foreach (array('body', 'title', 'format') as $key) {\n if (!isset($node->$key)) {\n $node->$key = NULL;\n }\n }\n if (!isset($form_state['node_preview'])) {\n node_object_prepare($node);\n }\n else {\n $node->build_mode = NODE_BUILD_PREVIEW;\n }\n\n // Set the id of the top-level form tag\n $form['#id'] = 'node-form';\n\n // Basic node information.\n // These elements are just values so they are not even sent to the client.\n foreach (array('nid', 'vid', 'uid', 'created', 'type', 'language') as $key) {\n $form[$key] = array(\n '#type' => 'value',\n '#value' => isset($node->$key) ? $node->$key : NULL,\n );\n }\n\n // Changed must be sent to the client, for later overwrite error checking.\n $form['changed'] = array(\n '#type' => 'hidden',\n '#default_value' => isset($node->changed) ? $node->changed : NULL,\n );\n // Get the node-specific bits.\n if ($extra = node_invoke($node, 'form', $form_state)) {\n $form = array_merge_recursive($form, $extra);\n }\n if (!isset($form['title']['#weight'])) {\n $form['title']['#weight'] = -5;\n }\n\n $form['#node'] = $node;\n\n // Add a log field if the \"Create new revision\" option is checked, or if the\n // current user has the ability to check that option.\n if (!empty($node->revision) || user_access('administer nodes')) {\n $form['revision_information'] = array(\n '#type' => 'fieldset',\n '#title' => t('Revision information'),\n '#collapsible' => TRUE,\n // Collapsed by default when \"Create new revision\" is unchecked\n '#collapsed' => !$node->revision,\n '#weight' => 20,\n );\n $form['revision_information']['revision'] = array(\n '#access' => user_access('administer nodes'),\n '#type' => 'checkbox',\n '#title' => t('Create new revision'),\n '#default_value' => $node->revision,\n );\n $form['revision_information']['log'] = array(\n '#type' => 'textarea',\n '#title' => t('Log message'),\n '#default_value' => (isset($node->log) ? $node->log : ''),\n '#rows' => 2,\n '#description' => t('An explanation of the additions or updates being made to help other authors understand your motivations.'),\n );\n }\n\n // Node author information for administrators\n $form['author'] = array(\n '#type' => 'fieldset',\n '#access' => user_access('administer nodes'),\n '#title' => t('Authoring information'),\n '#collapsible' => TRUE,\n '#collapsed' => TRUE,\n '#weight' => 20,\n );\n $form['author']['name'] = array(\n '#type' => 'textfield',\n '#title' => t('Authored by'),\n '#maxlength' => 60,\n '#autocomplete_path' => 'user/autocomplete',\n '#default_value' => $node->name ? $node->name : '',\n '#weight' => -1,\n '#description' => t('Leave blank for %anonymous.', array('%anonymous' => variable_get('anonymous', t('Anonymous')))),\n );\n $form['author']['date'] = array(\n '#type' => 'textfield',\n '#title' => t('Authored on'),\n '#maxlength' => 25,\n '#description' => t('Format: %time. Leave blank to use the time of form submission.', array('%time' => !empty($node->date) ? $node->date : format_date($node->created, 'custom', 'Y-m-d H:i:s O'))),\n );\n\n if (isset($node->date)) {\n $form['author']['date']['#default_value'] = $node->date;\n }\n\n // Node options for administrators\n $form['options'] = array(\n '#type' => 'fieldset',\n '#access' => user_access('administer nodes'),\n '#title' => t('Publishing options'),\n '#collapsible' => TRUE,\n '#collapsed' => TRUE,\n '#weight' => 25,\n );\n $form['options']['status'] = array(\n '#type' => 'checkbox',\n '#title' => t('Published'),\n '#default_value' => $node->status,\n );\n $form['options']['promote'] = array(\n '#type' => 'checkbox',\n '#title' => t('Promoted to front page'),\n '#default_value' => $node->promote,\n );\n $form['options']['sticky'] = array(\n '#type' => 'checkbox',\n '#title' => t('Sticky at top of lists'),\n '#default_value' => $node->sticky,\n );\n\n // These values are used when the user has no administrator access.\n foreach (array('uid', 'created') as $key) {\n $form[$key] = array(\n '#type' => 'value',\n '#value' => $node->$key,\n );\n }\n\n // Add the buttons.\n $form['buttons'] = array();\n $form['buttons']['submit'] = array(\n '#type' => 'submit',\n '#access' => !variable_get('node_preview', 0) || (!form_get_errors() && isset($form_state['node_preview'])),\n '#value' => t('Save'),\n '#weight' => 5,\n '#submit' => array('node_form_submit'),\n );\n $form['buttons']['preview'] = array(\n '#type' => 'submit',\n '#value' => t('Preview'),\n '#weight' => 10,\n '#submit' => array('node_form_build_preview'),\n );\n if (!empty($node->nid) && node_access('delete', $node)) {\n $form['buttons']['delete'] = array(\n '#type' => 'submit',\n '#value' => t('Delete'),\n '#weight' => 15,\n '#submit' => array('node_form_delete_submit'),\n );\n }\n $form['#validate'][] = 'node_form_validate';\n $form['#theme'] = array($node->type .'_node_form', 'node_form');\n return $form;\n}",
"function multisite_aggregate_type_form($form, &$form_state, $aggregate_type, $op = 'edit') {\n if ($op == 'clone') {\n $aggregate_type->label .= ' (cloned)';\n $aggregate_type->type = '';\n }\n\n $form['label'] = array(\n '#title' => t('Label'),\n '#type' => 'textfield',\n '#default_value' => $aggregate_type->label,\n '#description' => t('The human-readable name of this multisite aggregate type.'),\n '#required' => TRUE,\n '#size' => 30,\n );\n $form['type'] = array(\n '#type' => 'machine_name',\n '#default_value' => isset($aggregate_type->type) ? $aggregate_type->type : '',\n '#maxlength' => 32,\n '#machine_name' => array(\n 'exists' => 'multisite_aggregate_get_types',\n 'source' => array('label'),\n ),\n '#description' => t('A unique machine-readable name for this multisite aggregate type. It must only contain lowercase letters, numbers, and underscores.'),\n );\n\n $form['source'] = array(\n '#type' => 'fieldset',\n '#title' => t('Source'),\n );\n // Only nodes are allowed for now\n $form['source']['source_type'] = array(\n '#type' => 'hidden',\n '#value' => 'node',\n );\n $form['source']['source_bundle'] = array(\n '#type' => 'select',\n '#title' => t('Node bundle'),\n '#options' => node_type_get_names(),\n '#default_value' => !empty($aggregate_type->source_bundle),\n );\n\n $form['actions'] = array('#type' => 'actions');\n $form['actions']['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save aggregate type'),\n '#weight' => 40,\n );\n return $form;\n}",
"function main() {\n\t\tif ($_SERVER['REQUEST_METHOD'] === 'POST') {\n\t\t\tprint_r($_POST);\n\t\t\techo \"<br />\";\n\t\t\t\n\t\t\t// Required Fields in the POST data //\t\t\t\n\t\t\tif ( !isset($_POST['_type']) ) return;\n\t\t\tif ( !isset($_POST['_subtype']) ) return;\n\t\t\tif ( !isset($_POST['_name']) ) return;\n\t\t\tif ( !isset($_POST['_mail']) ) return;\n\t\t\tif ( !isset($_POST['_password']) ) return;\n\t\t\tif ( !isset($_POST['_publish']) ) return;\n\t\n\t\t\t// Node Type //\n\t\t\t$type = sanitize_NodeType($_POST['_type']);\n\t\t\tif ( empty($type) ) return;\t\n\n\t\t\t$subtype = sanitize_NodeType($_POST['_subtype']);\n\t\n\t\t\t// Name/Title //\n\t\t\t$name = $_POST['_name'];\t// TODO: Sanitize\n\t\t\t\n\t\t\t// Slug //\n\t\t\tif ( empty($_POST['_slug']) )\n\t\t\t\t$slug = $_POST['_name'];\n\t\t\telse\n\t\t\t\t$slug = $_POST['_slug'];\n\t\t\t$slug = sanitize_Slug($slug);\n\t\t\tif ( empty($slug) ) return;\n\t\t\t\n\t\t\t// TODO: Confirm slug is legal\n\t\t\t\t\n\t\t\t// Body //\n\t\t\t$body = $_POST['_body'];\t// TODO: Sanitize\n\t\t\t\n\t\t\t// Do we publish? //\n\t\t\t$publish = mb_strtolower($_POST['_publish']) == \"true\";\n\t\t\t\n\t\t\t// Email //\n\t\t\t$mail = sanitize_Email($_POST['_mail']);\n\t\t\tif ( empty($mail) ) return;\n\n\t\t\t// Password //\n\t\t\t$password = $_POST['_password'];\n\t\t\tif ( empty($password) ) return;\n\n\t\n\t\t\t$id = node_Add(\n\t\t\t\t$type,$subtype,$slug,$name,$body,\n\t\t\t\t0,2,\n\t\t\t\t$publish\n\t\t\t);\n\t\t\t\n\t\t\tuser_Add($id,$mail,$password);\n\t\n\t\t\techo \"Added \" . $id . \".<br />\";\n\t\t\techo \"<br />\";\n\t\t}\n\t}",
"function mongo_node_operation_submit($form, &$form_state) {\n $operations = mongo_node_operations();\n $operation = $operations[$form_state['values']['operation']];\n\n $entities = array_filter($form_state['values']['entities']);\n $entity_type = $form_state['values']['entity_type'];\n if ($function = $operation['callback']) {\n // Add in callback arguments if present.\n if (isset($operation['callback arguments'])) {\n $args = array(\n $entity_type,\n $entities,\n $operation['callback arguments'],\n );\n }\n else {\n $args = array($entity_type, $entities);\n }\n call_user_func_array($function, $args);\n cache_clear_all();\n }\n}",
"function mongo_node_add($entity_type, $bundle) {\n global $user;\n $set = mongo_node_settings();\n\n $entity = entity_create($entity_type, array(\n 'uid' => $user->uid,\n 'name' => (isset($user->name) ? $user->name : ''),\n 'type' => $bundle,\n 'language' => LANGUAGE_NONE,\n )\n );\n $form_id = $entity_type . '_' . $bundle . '_mongo_node_form';\n $output = drupal_get_form($form_id, $entity, $entity_type);\n\n return $output;\n}",
"function ting_visual_relation_search_content_type_edit_form($form, &$form_state) {\n return $form;\n}",
"function ding_event_similar_events_content_type_edit_form(&$form, &$form_state) {\n return $form;\n}",
"function ctools_term_list_content_type_edit_form(&$form, &$form_state) {\n $conf = $form_state['conf'];\n\n $form['type'] = array(\n '#type' => 'radios',\n '#title' => t('Which terms'),\n '#options' => ctools_admin_term_list_options(),\n '#default_value' => $conf['type'],\n '#prefix' => '<div class=\"clear-block no-float\">',\n '#suffix' => '</div>',\n );\n\n $form['list_type'] = array(\n '#type' => 'select',\n '#title' => t('List type'),\n '#options' => array('ul' => t('Unordered'), 'ol' => t('Ordered')),\n '#default_value' => $conf['list_type'],\n );\n}",
"function ctools_block_content_type_edit_form(&$form, &$form_state) {\n // Does nothing!\n}",
"function update_node()\n\t{\n\t\t\n\t\t// @todo form validation properly\n\t\t$this->EE->load->library('form_validation');\n\t\t$this->EE->form_validation->set_rules('label', 'Label', 'required');\n\t\t\n\t\tif ($this->EE->form_validation->run('label') == FALSE)\n\t\t{\n\t\t show_error('\"Label\" is a required field');\n\t\t}\n\n\t\t$tree_id \t= $this->EE->input->post('tree_id');\n\t\t$is_root\t= $this->EE->input->post('is_root');\n\t\t\n\t\t$data = array();\n\t\t$data['label'] \t\t= htmlspecialchars($this->EE->input->post('label'), ENT_COMPAT, 'UTF-8');\n\t\t$data['template_path'] \t= $this->EE->input->post('template');\n\t\t$data['entry_id'] \t= $this->EE->input->post('entry_id');\n\t\t$data['node_id'] \t= $this->EE->input->post('node_id');\n\t\t$data['custom_url']\t= $this->EE->input->post('custom_url');\n\t\t$data['field_data']\t= ( is_array($this->EE->input->post('custom_fields')) ) ? base64_encode(serialize($this->EE->input->post('custom_fields'))) : '';\n\t\t\n\t\t$data = $this->EE->security->xss_clean($data);\n\t\t\n\t\t$this->EE->ttree->check_tree_table_exists($tree_id);\n\t\t\n\t\t// are we adding a root node\n\t\tif($is_root)\n\t\t{\n\t\t\t// returns true if root has been added\n\t\t\tif($this->EE->ttree->insert_root($data))\n\t\t\t{\n\t\t\t\t$this->EE->session->set_flashdata('message_success', $this->EE->lang->line('root_added'));\n\t\t\t}\n\t\t\t// we already have a root!\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->EE->session->set_flashdata('message_failure', lang('root_already_exists'));\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t// are we updating\n\t\telseif($data['node_id'])\n\t\t{\n\t\t\t$this->EE->ttree->update_node_by_node_id($data['node_id'], $data);\n\t\t}\n\t\t// we're inserting a new node\n\t\telse\n\t\t{\n\t\t\t$parent_lft = $this->EE->input->post('parent');\n\t\t\t$this->EE->ttree->append_node_last($parent_lft, $data);\n\t\t}\n\t\t\n\t\tunset($data);\n\t\t\n\t\t// insert our tree array\n\t\t$data['tree_array'] = base64_encode(serialize( $this->EE->ttree->tree_to_array() ));\n\t\t$data['last_updated'] = time();\n\t\t$this->EE->db->where('id', $tree_id);\n\t\t$this->EE->db->update('exp_taxonomy_trees', $data); \n\t\t\n\t\t$this->EE->functions->redirect($this->_base_url.AMP.'method=edit_nodes'.AMP.'tree_id='.$tree_id);\n\t\n\t}",
"function pdfbulletin_edit_form(&$node, $form_state) {\n $type = node_get_types('type', $node);\n $pdfbulletin = $node->pdfbulletin;\n $form['pdfbulletin'] = array(\n '#type' => 'value',\n '#value' => $pdfbulletin,\n );\n $form['title'] = array(\n '#type' => 'textfield',\n '#title' => check_plain($type->title_label),\n '#required' => TRUE,\n '#default_value' => $node->title,\n '#weight' => -5,\n );\n\n $form['header_format'] = array(\n '#tree' => FALSE,\n );\n $form['header_format']['header'] = array(\n '#title' => t('Header'),\n '#type' => 'textarea',\n '#default_value' => $pdfbulletin->header,\n );\n $form['header_format']['format'] = filter_form($pdfbulletin->header_format, NULL, array('header_format'));\n\n $form['footer_format'] = array(\n '#tree' => FALSE,\n );\n $form['footer_format']['footer'] = array(\n '#title' => t('Footer'),\n '#type' => 'textarea',\n '#default_value' => $pdfbulletin->footer,\n );\n $form['footer_format']['format'] = filter_form($pdfbulletin->footer_format, NULL, array('footer_format'));\n\n $form['email_format'] = array(\n '#tree' => FALSE, \n );\n $form['email_format']['email'] = array(\n '#title' => t('Text for e-mail'),\n '#type' => 'textarea',\n '#default_value' => $pdfbulletin->email,\n );\n $form['email_format']['format'] = filter_form($pdfbulletin->email_format, NULL, array('email_format'));\n\n $form['empty_text_format'] = array(\n '#tree' => FALSE,\n );\n $form['empty_text_format']['empty_text'] = array(\n '#title' => t('Empty text'),\n '#type' => 'textarea',\n '#default_value' => $pdfbulletin->empty_text,\n '#description' => t('Text for e-mail if it is sent with an empty bulletin.'),\n );\n $form['empty_text_format']['format'] = filter_form($pdfbulletin->empty_text_format, NULL, array('empty_text_format'));\n\n $paper_sizes = pdfbulletin_util_settings('paper_size');\n $form['paper_size'] = array(\n '#title' => t('Paper size'),\n '#type' => 'select',\n '#default_value' => $pdfbulletin->paper_size,\n );\n foreach ($paper_sizes as $key => $value) {\n $form['paper_size']['#options'][$key] = t($key);\n }\n\n $css = pdfbulletin_css();\n $form['css_file'] = array(\n '#title' => t('Style'),\n '#type' => 'select',\n '#default_value' => $pdfbulletin->css_file,\n );\n foreach ($css as $key => $value) {\n $form['css_file']['#options'][$key] = check_plain($value);\n }\n\n\n return $form;\n}",
"function bat_event_type_form($form, &$form_state, $event_type, $op = 'edit') {\n $form['#attributes']['class'][] = 'bat-management-form bat-event-type-form';\n\n if ($op == 'clone') {\n $event_type->label .= ' (cloned)';\n $event_type->type = '';\n }\n\n $form['label'] = array(\n '#title' => t('Label'),\n '#type' => 'textfield',\n '#default_value' => $event_type->label,\n '#description' => t('The human-readable name of this event type.'),\n '#required' => TRUE,\n '#size' => 30,\n );\n\n // Machine-readable type name.\n $form['type'] = array(\n '#type' => 'machine_name',\n '#default_value' => isset($event_type->type) ? $event_type->type : '',\n '#maxlength' => 32,\n '#machine_name' => array(\n 'exists' => 'bat_event_get_types',\n 'source' => array('label'),\n ),\n '#description' => t('A unique machine-readable name for this event type. It must only contain lowercase letters, numbers, and underscores.'),\n );\n\n if ($op == 'add') {\n $form['fixed_event_states'] = array(\n '#type' => 'checkbox',\n '#title' => t('Fixed event states'),\n );\n }\n elseif ($op == 'edit') {\n $form['type']['#disabled'] = TRUE;\n }\n\n $form['event_granularity'] = array(\n '#type' => 'select',\n '#title' => t('Event Granularity'),\n '#options' => array('bat_daily' => t('Daily'), 'bat_hourly' => t('Hourly')),\n '#default_value' => isset($event_type->event_granularity) ? $event_type->event_granularity : 'bat_daily',\n );\n\n if (isset($event_type->is_new)) {\n // Check for available Target Entity types.\n $target_entity_types = module_invoke_all('bat_event_target_entity_types');\n if (count($target_entity_types) == 1) {\n // If there's only one target entity type, we simply store the value\n // without showing it to the user.\n $form['target_entity_type'] = array(\n '#type' => 'value',\n '#value' => $target_entity_types[0],\n );\n }\n else {\n // Build option list.\n $options = array();\n foreach ($target_entity_types as $target_entity_type) {\n $target_entity_info = entity_get_info($target_entity_type);\n $options[$target_entity_type] = $target_entity_info['label'];\n }\n $form['target_entity_type'] = array(\n '#type' => 'select',\n '#title' => t('Target Entity Type'),\n '#description' => t('Select the target entity type for this Event type. In most cases you will wish to leave this as \"Unit\".'),\n '#options' => $options,\n // Default to BAT Unit if available.\n '#default_value' => isset($target_entity_types['bat_unit']) ? 'bat_unit' : '',\n );\n }\n }\n\n if (!isset($event_type->is_new) && $event_type->fixed_event_states == 0) {\n $fields_options = array();\n\n $fields = field_info_instances('bat_event', $event_type->type);\n\n foreach ($fields as $field) {\n $fields_options[$field['field_name']] = $field['field_name'];\n }\n\n $form['events'] = array(\n '#type' => 'fieldset',\n '#group' => 'additional_settings',\n '#title' => t('Events'),\n '#tree' => TRUE,\n '#weight' => 80,\n );\n\n $form['events'][$event_type->type] = array(\n '#type' => 'select',\n '#title' => t('Select your default @event field', array('@event' => $event_type->label)),\n '#options' => $fields_options,\n '#default_value' => isset($event_type->default_event_value_field_ids[$event_type->type]) ? $event_type->default_event_value_field_ids[$event_type->type] : NULL,\n '#empty_option' => t('- Select a field -'),\n );\n }\n\n if (!isset($event_type->is_new)) {\n $fields_options = array();\n $fields = field_info_instances('bat_event', $event_type->type);\n\n foreach ($fields as $field) {\n $fields_options[$field['field_name']] = $field['field_name'];\n }\n\n $form['event_label'] = array(\n '#type' => 'fieldset',\n '#group' => 'additional_settings',\n '#title' => t('Label Source'),\n '#tree' => TRUE,\n '#weight' => 80,\n );\n\n $form['event_label']['default_event_label_field_name'] = array(\n '#type' => 'select',\n '#title' => t('Select your label field', array('@event' => $event_type->label)),\n '#default_value' => isset($event_type->default_event_label_field_name) ? $event_type->default_event_label_field_name : NULL,\n '#empty_option' => t('- Select a field -'),\n '#description' => t('If you select a field here, its value will be used as the label for your event. BAT will fall back to using the event state as the label if the field has no value.'),\n '#options' => $fields_options,\n );\n }\n\n $form['actions'] = array(\n '#type' => 'actions',\n '#tree' => FALSE,\n );\n $form['actions']['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save Event type'),\n '#weight' => 40,\n '#submit' => array('bat_event_type_form_submit'),\n );\n\n return $form;\n}",
"function mongo_node_bundle_delete_form_submit($form, $form_state) {\n $set = mongo_node_settings();\n\n $entity_type = $form_state['values']['entity_type'];\n $bundle = $form_state['values']['bundle'];\n\n // Remove entity type.\n unset($set[$entity_type]['bundles'][$bundle]);\n\n mongo_node_settings_save($set);\n\n // Redirect to entity type admin.\n drupal_goto('admin/structure/mongo-node/' . $entity_type);\n}",
"public function postEdit($type)\n {\n // Declare the rules for the form validation\n $rules = array(\n 'name' => 'required|min:3'\n );\n\n // Validate the inputs\n $validator = Validator::make(Input::all(), $rules);\n\n // Check if the form validates with success\n if ($validator->passes())\n {\n // Update the type post data\n $this->$type->name = Input::get('name');\n\n // Was the type post updated?\n if($this->$type->save())\n {\n // Redirect to the new type post page\n return Redirect::to('admin/types/' . $type->id . '/edit')->with('success', Lang::get('admin/types/messages.update.success'));\n }\n\n // Redirect to the types post management page\n return Redirect::to('admin/types/' . $type->id . '/edit')->with('error', Lang::get('admin/types/messages.update.error'));\n }\n\n // Form validation failed\n return Redirect::to('admin/types/' . $type->id . '/edit')->withInput()->withErrors($validator);\n }",
"function dgu_search_info_content_type_edit_form($form, &$form_state) {\n return $form;\n}"
]
| [
"0.75606555",
"0.72743845",
"0.71291107",
"0.6928399",
"0.68131834",
"0.668602",
"0.662143",
"0.65089715",
"0.6425825",
"0.6371721",
"0.63688594",
"0.6361926",
"0.6356016",
"0.62655133",
"0.6153967",
"0.6112404",
"0.5997931",
"0.59577876",
"0.5949831",
"0.59267294",
"0.5896008",
"0.58660424",
"0.5838378",
"0.5823254",
"0.58143425",
"0.5812541",
"0.5809478",
"0.58014643",
"0.58004725",
"0.5777057"
]
| 0.72839963 | 1 |
Form constructor for deleting entity types. | function mongo_node_type_delete_form($form, $form_state, $entity_type) {
$form = array();
// Send entity type.
$form['entity_type'] = array(
'#type' => 'value',
'#value' => $entity_type,
);
$path = '/admin/structure/mongo-node';
$extist_entity_content = '';
$collection = mongodb_collection('fields_current', $entity_type);
$count = $collection->count(array('_type' => $entity_type));
if ($count) {
$extist_entity_content = t('%type is used by %count piece of content on your site. If you remove this entity type, you will not be able to edit the %type content and it may not display correctly.', array('%type' => $entity_type, '%count' => $count));
$extist_entity_content .= '<br/><br/>';
}
return confirm_form($form, t('Delete entity type'), $path, $extist_entity_content . 'This action cannot be undone', t('Delete'), t('Cancel'), 'mongo_node_type_delete');
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function mongo_node_type_delete_form_submit($form, $form_state) {\n $set = mongo_node_settings();\n\n // Remove entity type.\n $entity_type = $form_state['values']['entity_type'];\n unset($set[$entity_type]);\n\n // Drop collection that stores entities for entity type.\n $collection = mongodb_collection('fields_current', $entity_type);\n $collection->drop();\n\n // Drop collection that stores entity types autoincrement ids.\n $collection = mongodb_collection($entity_type . '_ids');\n $collection->drop();\n\n mongo_node_settings_save($set);\n\n // Redirect to entity type admin.\n drupal_goto('admin/structure/mongo-node');\n}",
"public function __construct() {\n\t\t\t$this->field_type = 'select-edit-delete';\n\n\t\t\tparent::__construct();\n\t\t}",
"private function createDeleteForm(Types $type)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('types_delete', array('id' => $type->getId())))\n ->setMethod('DELETE')\n ->getForm()\n ;\n }",
"function travel_type_form_submit_delete(&$form, &$form_state) {\n // Redirect user to \"Delete\" URI for this entity type.\n $form_state['redirect'] = 'admin/structure/travel/' . $form_state['travel_type']->type . '/delete';\n}",
"function travel_type_form_delete_confirm($form, &$form_state, $entity_type) {\n // Store the entity in the form.\n $form_state['entity_type'] = $entity_type;\n\n // Show confirm dialog.\n $message = t('Are you sure you want to delete entity type %title?', array('%title' => entity_label('entity_type', $entity_type)));\n return confirm_form(\n $form,\n $message,\n 'travel/' . entity_id('travel_type', $entity_type),\n t('This action cannot be undone.'),\n t('Delete'),\n t('Cancel')\n );\n}",
"function mongo_node_bundle_delete_form_submit($form, $form_state) {\n $set = mongo_node_settings();\n\n $entity_type = $form_state['values']['entity_type'];\n $bundle = $form_state['values']['bundle'];\n\n // Remove entity type.\n unset($set[$entity_type]['bundles'][$bundle]);\n\n mongo_node_settings_save($set);\n\n // Redirect to entity type admin.\n drupal_goto('admin/structure/mongo-node/' . $entity_type);\n}",
"public function Delete($entity) {\n }",
"private function createDeleteForm(DictType $dictType)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('dicttype_delete', array('id' => $dictType->getId())))\n ->setMethod('DELETE')\n ->getForm()\n ;\n }",
"function mongo_node_bundle_delete_form($form, $form_state, $entity_type, $bundle) {\n $form = array();\n\n $form['entity_type'] = array(\n '#type' => 'value',\n '#value' => $entity_type,\n );\n $form['bundle'] = array(\n '#type' => 'value',\n '#value' => $bundle,\n );\n\n $path = '/admin/structure/mongo-node/' . $entity_type;\n\n $extist_bundle_content = '';\n $collection = mongodb_collection('fields_current', $entity_type);\n $count = $collection->count(array('_type' => $entity_type, '_bundle' => $bundle));\n if ($count) {\n $extist_bundle_content = t('%bundle is used by %count piece of content on your site. If you remove this bundle, you will not be able to edit the %bundle content and it may not display correctly.', array('%bundle' => $bundle, '%count' => $count));\n $extist_bundle_content .= '<br/><br/>';\n }\n\n return confirm_form($form, t('Delete entity bundle'), $path, $extist_bundle_content . 'This action cannot be undone', t('Delete'), t('Cancel'), 'mongo_node_bundle_delete');\n}",
"public function deleteForm()\n\t{\n\t\t$form = new \\IPS\\Helpers\\Form( 'form', 'delete' );\n\t\t$form->addMessage( 'node_delete_blurb_no_content' );\n\t\t\n\t\treturn $form;\n\t}",
"function mongo_node_page_delete($form, $form_state, $entity_type, $entity) {\n $form['#entity'] = $entity;\n $uri = entity_uri($entity_type, $entity);\n\n return confirm_form($form,\n t('Are you sure you want to delete %title', array('%title' => $entity->title)),\n $uri['path'],\n t('This action cannot be undone'),\n t('Delete'),\n t('Cancel')\n );\n}",
"function multisite_aggregate_type_form_submit_delete(&$form, &$form_state) {\n $form_state['redirect'] = 'admin/structure/multisite_aggregate_types/manage/' . $form_state['multisite_aggregate_type']->type . '/delete';\n}",
"public function delete($entity)\n {\n \n }",
"protected function createComponentDeleteForm()\r\n\t{\r\n\t\t$form = new Form;\r\n\t\t$form->addSubmit('delete', 'Smazat')->setAttribute('class', 'default');\r\n\t\t$form->addSubmit('cancel', 'Storno');\r\n\t\t$form->onSuccess[] = callback($this, 'deleteFormSubmitted');\r\n\t\t$form->addProtection(self::MESS_PROTECT);\r\n\t\treturn $form;\r\n\t}",
"public function deleteAction() {\n\t\t$id = $this->getInput('id');\n\t\t$info = Fanli_Service_Ptype::getType($id);\n\t\tif ($info && $info['id'] == 0) $this->output(-1, '无法删除');\n\t\t$result = Fanli_Service_Ptype::deleteType($id);\n\t\tif (!$result) $this->output(-1, '操作失败');\n\t\t$this->output(0, '操作成功');\n\t}",
"private function createDeleteForm($id)\n {\n \n $form = $this->createFormBuilder(null, array('attr' => array('id' => 'entrada_detalles_eliminar_type')))\n ->setAction('')\n ->setMethod('DELETE')\n ->add('submit', 'submit', array('label' => 'Eliminar', 'icon' => 'trash', 'attr' => array('class' => 'btn-danger')))\n ->getForm()\n ;\n \n return $form;\n \n \n }",
"public function delete(DataObject $entity){\n }",
"private function createDeleteForm(TypeDePokemons $typeDePokemon)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('typedepokemons_delete', array('id' => $typeDePokemon->getId())))\n ->setMethod('DELETE')\n ->getForm()\n ;\n }",
"function travel_type_form_delete_confirm_submit($form, &$form_state) {\n // Delete the entity type.\n $entity_type = $form_state['entity_type'];\n entity_delete('travel_type', entity_id('travel_type', $entity_type));\n\n // Redirect user.\n drupal_set_message(t('@type %title has been deleted.', array('@type' => $entity_type->type, '%title' => $entity_type->label)));\n $form_state['redirect'] = 'admin/structure/travel';\n}",
"private function createDeleteForm(Tipoanuncio $tipoanuncio)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('tipoanuncio_delete', array('id' => $tipoanuncio->getId())))\n ->setMethod('DELETE')\n ->getForm()\n ;\n }",
"private function createDeleteForm(TypeProduct $typeProduct)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('type_product_delete', array('id' => $typeProduct->getId())))\n ->setMethod('DELETE')\n ->getForm()\n ;\n }",
"public function delete($entity);",
"public function postDelete($type)\n {\n // Declare the rules for the form validation\n $rules = array(\n 'id' => 'required|integer'\n );\n\n // Validate the inputs\n $validator = Validator::make(Input::all(), $rules);\n\n // Check if the form validates with success\n if ($validator->passes())\n {\n $id = $type->id;\n $type->delete();\n\n // Was the type post deleted?\n $type = Type::find($id);\n if(empty($type))\n {\n // Redirect to the type posts management page\n return Redirect::to('admin/successful-delete')->with('success', Lang::get('admin/types/messages.delete.success'));\n }\n }\n // There was a problem deleting the type post\n return Redirect::to('admin/types/' . $id . '/delete')->with('error', Lang::get('admin/types/messages.delete.error'));\n }",
"private function createDeleteForm(JobType $jobType) {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('admin_jmp_job_type_delete', array('id' => $jobType->getId())))\n ->setMethod('DELETE')\n ->getForm()\n ;\n }",
"public function deleting($educationType)\n {\n\t\tparent::deleting($educationType);\n\n }",
"public function testLineItemTypeDeletion() {\n $values = [\n 'id' => strtolower($this->randomMachineName(8)),\n 'label' => $this->randomMachineName(16),\n 'purchasableEntityType' => 'commerce_product_variation',\n 'orderType' => 'default',\n ];\n $line_item_type = $this->createEntity('commerce_line_item_type', $values);\n\n $this->drupalGet($line_item_type->toUrl('delete-form'));\n $this->assertSession()->statusCodeEquals(200);\n $this->assertSession()->pageTextContains(t('This action cannot be undone.'));\n $this->submitForm([], t('Delete'));\n $line_item_type_exists = (bool) LineItemType::load($line_item_type->id());\n $this->assertFalse($line_item_type_exists, 'The line item type has been deleted form the database.');\n }",
"public function deleteAction() {\n \n }",
"private function createDeleteForm(NatureOp $priorite)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('back_natureop_delete', array('id' => $priorite->getId())))\n ->setMethod('DELETE')\n ->getForm()\n ;\n }",
"abstract function performDelete(Form $arg0);",
"public function newDelete()\n {\n return $this->newInstance('Delete');\n }"
]
| [
"0.6472056",
"0.6468265",
"0.6308098",
"0.6305742",
"0.6122077",
"0.60757643",
"0.5991428",
"0.58580947",
"0.58278126",
"0.582059",
"0.5791579",
"0.57691324",
"0.57279426",
"0.57035005",
"0.5696368",
"0.5626221",
"0.56165195",
"0.561625",
"0.5605363",
"0.5584769",
"0.5582737",
"0.55499464",
"0.55192906",
"0.5494267",
"0.5493179",
"0.5466169",
"0.54638124",
"0.54334587",
"0.5429448",
"0.54283977"
]
| 0.66571033 | 0 |
Form submission handler for mongo_node_type_delete_form(). | function mongo_node_type_delete_form_submit($form, $form_state) {
$set = mongo_node_settings();
// Remove entity type.
$entity_type = $form_state['values']['entity_type'];
unset($set[$entity_type]);
// Drop collection that stores entities for entity type.
$collection = mongodb_collection('fields_current', $entity_type);
$collection->drop();
// Drop collection that stores entity types autoincrement ids.
$collection = mongodb_collection($entity_type . '_ids');
$collection->drop();
mongo_node_settings_save($set);
// Redirect to entity type admin.
drupal_goto('admin/structure/mongo-node');
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function mongo_node_type_delete_form($form, $form_state, $entity_type) {\n $form = array();\n // Send entity type.\n $form['entity_type'] = array(\n '#type' => 'value',\n '#value' => $entity_type,\n );\n $path = '/admin/structure/mongo-node';\n\n $extist_entity_content = '';\n $collection = mongodb_collection('fields_current', $entity_type);\n $count = $collection->count(array('_type' => $entity_type));\n if ($count) {\n $extist_entity_content = t('%type is used by %count piece of content on your site. If you remove this entity type, you will not be able to edit the %type content and it may not display correctly.', array('%type' => $entity_type, '%count' => $count));\n $extist_entity_content .= '<br/><br/>';\n }\n return confirm_form($form, t('Delete entity type'), $path, $extist_entity_content . 'This action cannot be undone', t('Delete'), t('Cancel'), 'mongo_node_type_delete');\n}",
"function mongo_node_bundle_delete_form_submit($form, $form_state) {\n $set = mongo_node_settings();\n\n $entity_type = $form_state['values']['entity_type'];\n $bundle = $form_state['values']['bundle'];\n\n // Remove entity type.\n unset($set[$entity_type]['bundles'][$bundle]);\n\n mongo_node_settings_save($set);\n\n // Redirect to entity type admin.\n drupal_goto('admin/structure/mongo-node/' . $entity_type);\n}",
"function mongo_node_page_delete_submit($form, &$form_state) {\n if ($form_state['values']['confirm']) {\n $entity = $form['#entity'];\n $entity->delete();\n\n $entity_type = $entity->entityType();\n $info = entity_get_info($entity_type);\n $bundle_key = $info['bundle keys']['bundle'];\n $bundle_label = $info['bundles'][$entity->{$bundle_key}]['label'];\n\n drupal_set_message(t('@label %title deleted',\n array(\n '@label' => $bundle_label,\n '%title' => $entity->title)\n )\n );\n }\n\n $form_state['redirect'] = '<front>';\n}",
"function mongo_node_page_delete($form, $form_state, $entity_type, $entity) {\n $form['#entity'] = $entity;\n $uri = entity_uri($entity_type, $entity);\n\n return confirm_form($form,\n t('Are you sure you want to delete %title', array('%title' => $entity->title)),\n $uri['path'],\n t('This action cannot be undone'),\n t('Delete'),\n t('Cancel')\n );\n}",
"public function deleteSubmitHandler(array &$form, FormStateInterface $form_state) {\n $node_id = $form_state->getValue('article_title');\n $node = Node::load($node_id)->delete();\n }",
"function mongo_node_bundle_delete_form($form, $form_state, $entity_type, $bundle) {\n $form = array();\n\n $form['entity_type'] = array(\n '#type' => 'value',\n '#value' => $entity_type,\n );\n $form['bundle'] = array(\n '#type' => 'value',\n '#value' => $bundle,\n );\n\n $path = '/admin/structure/mongo-node/' . $entity_type;\n\n $extist_bundle_content = '';\n $collection = mongodb_collection('fields_current', $entity_type);\n $count = $collection->count(array('_type' => $entity_type, '_bundle' => $bundle));\n if ($count) {\n $extist_bundle_content = t('%bundle is used by %count piece of content on your site. If you remove this bundle, you will not be able to edit the %bundle content and it may not display correctly.', array('%bundle' => $bundle, '%count' => $count));\n $extist_bundle_content .= '<br/><br/>';\n }\n\n return confirm_form($form, t('Delete entity bundle'), $path, $extist_bundle_content . 'This action cannot be undone', t('Delete'), t('Cancel'), 'mongo_node_bundle_delete');\n}",
"function node_form_delete_submit($form, &$form_state) {\n $destination = '';\n if (isset($_REQUEST['destination'])) {\n $destination = drupal_get_destination();\n unset($_REQUEST['destination']);\n }\n $node = $form['#node'];\n $form_state['redirect'] = array('node/'. $node->nid .'/delete', $destination);\n}",
"function multisite_aggregate_type_form_submit_delete(&$form, &$form_state) {\n $form_state['redirect'] = 'admin/structure/multisite_aggregate_types/manage/' . $form_state['multisite_aggregate_type']->type . '/delete';\n}",
"function travel_type_form_submit_delete(&$form, &$form_state) {\n // Redirect user to \"Delete\" URI for this entity type.\n $form_state['redirect'] = 'admin/structure/travel/' . $form_state['travel_type']->type . '/delete';\n}",
"function bat_event_type_form_submit_delete(&$form, &$form_state) {\n $destination = array();\n if (isset($_GET['destination'])) {\n $destination = drupal_get_destination();\n unset($_GET['destination']);\n }\n\n $form_state['redirect'] = array('admin/bat/events/event_types/manage/' . $form_state['bat_event_type']->type . '/delete', array('query' => $destination));\n}",
"public function deleteForm()\n\t{\n\t\t$form = new \\IPS\\Helpers\\Form( 'form', 'delete' );\n\t\t$form->addMessage( 'node_delete_blurb_no_content' );\n\t\t\n\t\treturn $form;\n\t}",
"public function postDelete($type)\n {\n // Declare the rules for the form validation\n $rules = array(\n 'id' => 'required|integer'\n );\n\n // Validate the inputs\n $validator = Validator::make(Input::all(), $rules);\n\n // Check if the form validates with success\n if ($validator->passes())\n {\n $id = $type->id;\n $type->delete();\n\n // Was the type post deleted?\n $type = Type::find($id);\n if(empty($type))\n {\n // Redirect to the type posts management page\n return Redirect::to('admin/successful-delete')->with('success', Lang::get('admin/types/messages.delete.success'));\n }\n }\n // There was a problem deleting the type post\n return Redirect::to('admin/types/' . $id . '/delete')->with('error', Lang::get('admin/types/messages.delete.error'));\n }",
"function thumbwhere_contentcollection_form_submit_delete(&$form, &$form_state) {\n $form_state['redirect'] = 'admin/thumbwhere/thumbwhere_contentcollections/thumbwhere_contentcollection/' . $form_state['thumbwhere_contentcollection']->pk_contentcollection . '/delete';\n}",
"function kala_revision_batch_delete_form() {\n // Initialize Vars.\n $form = array();\n\n // Date text field.\n $form['date'] = array(\n '#type' => 'textfield',\n '#title' => t('Delete nodes revisions before this time.'),\n '#description' => t('Enter as a -1 day, 1-year, etc. Defaults to -90 days.'),\n '#default_value' => t('-90 days'),\n '#required' => TRUE,\n );\n\n $form['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Delete These Revisions!'),\n '#submit' => array('kala_revision_batch_delete_form_submit'),\n );\n\n return $form;\n}",
"public function post_delete(){\n\t\t\t\n\t\t$data \t= \tFiledb::_rawurldecode(json_decode(stripcslashes(Input::get('data')), true));\n\n\t\tif($data[\"delete\"] == 'delete'){\n\t\t\t\n\t\t\t$status = Users::delete($data[\"id\"]);\n\n\t\t\treturn ($status) ? Utilites::success_message(__('forms.deleted_word')) : Utilites::fail_message(__('forms_errors.undefined'));\n\t\t}\n\t}",
"function thumbwhere_contentcollectionitem_form_submit_delete(&$form, &$form_state) {\n $form_state['redirect'] = 'admin/thumbwhere/thumbwhere_contentcollectionitems/thumbwhere_contentcollectionitem/' . $form_state['thumbwhere_contentcollectionitem']->pk_contentcollectionitem . '/delete';\n}",
"public function ajax_delete_field() {\n\t\tglobal $wpdb;\n\n\t\tif ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'visual_form_builder_delete_field' ) {\n\t\t\t$form_id = absint( $_REQUEST['form'] );\n\t\t\t$field_id = absint( $_REQUEST['field'] );\n\n\t\t\tcheck_ajax_referer( 'delete-field-' . $form_id, 'nonce' );\n\n\t\t\tif ( isset( $_REQUEST['child_ids'] ) ) {\n\t\t\t\tforeach ( $_REQUEST['child_ids'] as $children ) {\n\t\t\t\t\t$parent = absint( $_REQUEST['parent_id'] );\n\n\t\t\t\t\t// Update each child item with the new parent ID\n\t\t\t\t\t$wpdb->update( $this->field_table_name, array( 'field_parent' => $parent ), array( 'field_id' => $children ) );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Delete the field\n\t\t\t$wpdb->query( $wpdb->prepare( \"DELETE FROM $this->field_table_name WHERE field_id = %d\", $field_id ) );\n\t\t}\n\n\t\tdie(1);\n\t}",
"function node_delete_confirm(&$form_state, $node) {\n $form['nid'] = array(\n '#type' => 'value',\n '#value' => $node->nid,\n );\n\n return confirm_form($form,\n t('Are you sure you want to delete %title?', array('%title' => $node->title)),\n isset($_GET['destination']) ? $_GET['destination'] : 'node/'. $node->nid,\n t('This action cannot be undone.'),\n t('Delete'),\n t('Cancel')\n );\n}",
"abstract function performDelete(Form $arg0);",
"function delete() {\n\n $document = Doctrine::getTable('DocDocument')->find($this->input->post('doc_document_id'));\n $node = Doctrine::getTable('Node')->find($document->node_id);\n\n if ($document && $document->delete()) {\n//echo '{\"success\": true}';\n\n $this->syslog->register('delete_document', array(\n $document->doc_document_filename,\n $node->getPath()\n )); // registering log\n\n $success = 'true';\n $msg = $this->translateTag('General', 'operation_successful');\n } else {\n//echo '{\"success\": false}';\n $success = 'false';\n $msg = $e->getMessage();\n }\n\n $json_data = $this->json->encode(array('success' => $success, 'msg' => $msg));\n echo $json_data;\n }",
"function travel_type_form_delete_confirm_submit($form, &$form_state) {\n // Delete the entity type.\n $entity_type = $form_state['entity_type'];\n entity_delete('travel_type', entity_id('travel_type', $entity_type));\n\n // Redirect user.\n drupal_set_message(t('@type %title has been deleted.', array('@type' => $entity_type->type, '%title' => $entity_type->label)));\n $form_state['redirect'] = 'admin/structure/travel';\n}",
"function thumbwhere_contentcollection_delete_form_wrapper($thumbwhere_contentcollection) {\n // Add the breadcrumb for the form's location.\n //thumbwhere_contentcollection_set_breadcrumb();\n return drupal_get_form('thumbwhere_contentcollection_delete_form', $thumbwhere_contentcollection);\n}",
"function thumbwhere_contentcollection_delete_form_submit($form, &$form_state) {\n $thumbwhere_contentcollection = $form_state['thumbwhere_contentcollection'];\n\n thumbwhere_contentcollection_delete($thumbwhere_contentcollection);\n\n drupal_set_message(t('The thumbwhere_contentcollection %name has been deleted.', array('%name' => $thumbwhere_contentcollection->title)));\n watchdog('thumbwhere_contentcollection', 'Deleted thumbwhere_contentcollection %name.', array('%name' => $thumbwhere_contentcollection->title));\n\n $form_state['redirect'] = 'admin/thumbwhere/thumbwhere_contentcollections';\n}",
"function access_scheme_form_delete_submit($form, &$form_state) {\n if (isset($_GET['destination'])) {\n drupal_get_destination();\n unset($_GET['destination']);\n }\n $scheme = $form_state['scheme'];\n $form_state['redirect'] = 'admin/structure/access/' . str_replace('_', '-', $scheme->machine_name) . '/delete';\n}",
"public function ajax_delete_field() {\n global $wpdb;\n\n if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'swpm_form_builder_delete_field') {\n $form_id = absint($_REQUEST['form']);\n $field_id = absint($_REQUEST['field']);\n\n check_ajax_referer('delete-field-' . $form_id, 'nonce');\n\n $field_key = $wpdb->get_var($wpdb->prepare(\"SELECT field_key FROM $this->field_table_name WHERE field_id=%d\", $field_id));\n if (SwpmFbUtils::is_mandatory_field($field_key)) {\n die('0'); // don't delete required fields\n }\n if (isset($_REQUEST['child_ids'])) {\n foreach ($_REQUEST['child_ids'] as $children) {\n $parent = absint($_REQUEST['parent_id']);\n\n // Update each child item with the new parent ID\n $wpdb->update($this->field_table_name, array('field_parent' => $parent), array('field_id' => $children));\n }\n }\n\n // Delete the field\n $wpdb->query($wpdb->prepare(\"DELETE FROM $this->field_table_name WHERE field_id = %d\", $field_id));\n }\n\n die(1);\n }",
"function thumbwhere_contentcollectionitem_delete_form_wrapper($thumbwhere_contentcollectionitem) {\n // Add the breadcrumb for the form's location.\n //thumbwhere_contentcollectionitem_set_breadcrumb();\n return drupal_get_form('thumbwhere_contentcollectionitem_delete_form', $thumbwhere_contentcollectionitem);\n}",
"public function actionDelete(){\n\t\t$form = $_POST;\n\t\t$db = $this->context->getService('database');\n\t\t$db->exec('DELETE FROM core_pages WHERE id = ?', $form['id']);\n\t\t$this->redirect('pages:');\n\t}",
"function thumbwhere_contentcollectionitem_delete_form_submit($form, &$form_state) {\n $thumbwhere_contentcollectionitem = $form_state['thumbwhere_contentcollectionitem'];\n\n thumbwhere_contentcollectionitem_delete($thumbwhere_contentcollectionitem);\n\n drupal_set_message(t('The thumbwhere_contentcollectionitem %name has been deleted.', array('%name' => $thumbwhere_contentcollectionitem->pk_contentcollectionitem)));\n watchdog('thumbwhere_contentcollectionitem', 'Deleted thumbwhere_contentcollectionitem %name.', array('%name' => $thumbwhere_contentcollectionitem->pk_contentcollectionitem));\n\n $form_state['redirect'] = 'admin/thumbwhere/thumbwhere_contentcollectionitems';\n}",
"public function save_trash_delete_form() {\n\t\t// Handled in the process_bulk_actions() function in includes/class-forms-list.php\n\t}",
"function _mica_datasets_node_delete_confirm($form, &$form_state, $node) {\n if ($node->type === 'dataset') {\n $form['#node'] = $node;\n // Always provide entity id in the same form key as in the entity edit form.\n $form['nid'] = array('#type' => 'value', '#value' => $node->nid);\n return confirm_form($form,\n t('Are you sure you want to delete %title?', array('%title' => $node->title)),\n 'node/' . $node->nid,\n t('It will also delete all its variables, queries and study connectors.')\n . '<br />' . t('This action cannot be undone.') . '<br /><br />',\n t('Delete'),\n t('Cancel')\n );\n }\n module_load_include('inc', 'node', 'node.pages');\n return node_delete_confirm($form, $form_state, $node);\n}"
]
| [
"0.78526545",
"0.7351332",
"0.7347114",
"0.7220521",
"0.71068573",
"0.7055229",
"0.6662198",
"0.6615363",
"0.657397",
"0.6415916",
"0.63025516",
"0.6188454",
"0.6143792",
"0.6140851",
"0.6084777",
"0.6066255",
"0.6050293",
"0.6005385",
"0.59997916",
"0.5976242",
"0.59560156",
"0.59102654",
"0.5907019",
"0.58810115",
"0.58738995",
"0.5871507",
"0.586136",
"0.58560365",
"0.5848908",
"0.58367103"
]
| 0.78017473 | 1 |
Entity type existance check Helper function. | function _mongo_node_type_exists($entity_type) {
$set = mongo_node_settings();
if (isset($set[$entity_type])) {
return TRUE;
}
return FALSE;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function hasEntityType() {\n return $this->_has(6);\n }",
"public function hasEntityType() {\n return $this->_has(5);\n }",
"public function getEntityTypeId(){\n $entityType = Mage::getModel('eav/entity_type')->loadByCode($this->_entityType);\n if (!$entityType->getId()){\n Mage::helper('connector')\n ->log(\"Entity type \" . $this->_entityType . \" undefined\", Zend_log::ERR);\n return false;\n }\n return $entityType->getId();\n }",
"public function hasEntity($name);",
"public function remoteEntityExists($entity_type, $entity_id) {\n $uri = $this->getRemoteUri($entity_type, $entity_id);\n if ($this->request('head', $uri)->getStatusCode() === 200) {\n return TRUE;\n }\n else {\n return FALSE;\n }\n }",
"public function hasEntityClass(): bool\n {\n return $this->hasDataItem('entity');\n }",
"protected function isEntity($class)\n {\n return Nishchay::getEntityCollection()->isExist($class);\n }",
"function invalidEntityType( Application $app, $entityType ) {\n\n if ( ! in_array( $entityType, getAvailableEntities( $app ) ) ) {\n // If entity type doesn't exists, return an error\n $error[\"code\"] = 2;\n $error[\"message\"] = \"EntityType unavailable\";\n $error[\"fields\"] = $entityType;\n return $error;\n }\n return false;\n}",
"public function exists($entity): bool;",
"public function has($type = null) {}",
"public function has($type);",
"public function type_exists($type)\n\t{\n\t\t$module_path=$this->_ci->config->item('module_path');\n\t\treturn file_exists($module_path.'/'.$type);\n\t}",
"public function getType(): EntityType;",
"public function getEntityType($entity)\n {\n $result = $this->db->query(\"SELECT type FROM entities WHERE id='$entity'\");\n// echo \"The result is $result->num_rows\";\n if (!isset($result->num_rows) || $result->num_rows == 0) {\n return Constants::ENTITY_NONEXISTENT;\n } else {\n $thing = $result->fetch_assoc()[\"type\"];\n// echo \"The thing iis $thing\";\n switch ($thing) {\n case \"ATOM\":\n return Constants::ENTITY_ATOM;\n case \"GROUP\":\n return Constants::ENTITY_GROUP;\n case \"USER\":\n return Constants::ENTITY_USER;\n }\n }\n throw new \\Exception(\"Unknown entity type\");\n }",
"public function hasType(){\r\n return $this->_has(1);\r\n }",
"public function hasType($name);",
"public function exist(BaseEntity $entity): bool\n {\n return $this->entityManager\n ->getRepository($entity->getClassName())\n ->find($entity) ? true : false;\n }",
"public function hasType(){\n return $this->_has(3);\n }",
"public function hasType(){\n return $this->_has(3);\n }",
"public function hasType(){\n return $this->_has(3);\n }",
"public function hasType(){\n return $this->_has(2);\n }",
"function acf_field_type_exists($type = '')\n{\n}",
"function check_exists()\n\t{\n\t\t$name = url_title($this->input->post('name'));\n\n\t\t$exists = $this->content_type_model->check_exists(\n\t\t\t'name',\n\t\t\t$name,\n\t\t\t$this->input->post('id_content_type')\n\t\t);\n\n\t\t$this->xhr_output($exists);\n\t}",
"function is_exists_s_atribute_type_lookup($s_attribute_type, $value) {\n\t$query = \"SELECT 'x' FROM s_attribute_type_lookup WHERE s_attribute_type = '\" . $s_attribute_type . \"' AND value = '$value'\";\n\n\t$result = db_query($query);\n\tif ($result && db_num_rows($result) > 0) {\n\t\tdb_free_result($result);\n\t\treturn TRUE;\n\t}\n\n\t//else\n\treturn FALSE;\n}",
"public function hasEntity($value, array $params = array());",
"public function hasType() {\n return $this->_has(2);\n }",
"public function hasType() {\n return $this->_has(3);\n }",
"function verifyEntityParam($entityParam) {\n global $authorizedEntities;\n\n return array_key_exists($entityParam, $authorizedEntities);\n}",
"public function hasReferencedEntityType() {\n return $this->_has(12);\n }",
"public function hasType(){\n return $this->_has(9);\n }"
]
| [
"0.68108726",
"0.6652305",
"0.65877634",
"0.65792507",
"0.6565098",
"0.65342337",
"0.6360991",
"0.6326077",
"0.6321625",
"0.6262326",
"0.61903954",
"0.6188985",
"0.6178305",
"0.6155019",
"0.6114054",
"0.6097126",
"0.6044834",
"0.60335714",
"0.60335714",
"0.60335714",
"0.6032001",
"0.6027361",
"0.5947106",
"0.5941511",
"0.5932704",
"0.591327",
"0.59020084",
"0.589839",
"0.58536935",
"0.58393097"
]
| 0.69549507 | 0 |
Form constructor for the entity bundle creation. | function mongo_node_bundle_create_form($form, $form_state, $entity_type) {
$form = array();
$form['label'] = array(
'#type' => 'textfield',
'#title' => t('Entity type'),
'#description' => t('The human readable name of the entity.'),
);
$form['name'] = array(
'#type' => 'machine_name',
'#required' => FALSE,
'#machine_name' => array(
'exists' => '_mongo_node_bundle_exists',
'source' => array('label'),
),
);
$form['description'] = array(
'#type' => 'textarea',
'#title' => t('Description'),
'#description' => t('Describe this bundle.'),
);
$form['entity_type'] = array(
'#type' => 'value',
'#value' => $entity_type,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
return $form;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function __construct(\\Library\\Entity $entity){\n\t\t$this->setForm(new Form\\Form($entity));\n\t}",
"public function __construct($form)\n\t{\n\t\t$formPackage = $form->getMergePackage();\n\t\t$this->name = $form->getName();\n\t\t$this->form = $form;\n\t\t$this->inputs = $formPackage['inputs'];\n\t\t$this->sectionIntro = $formPackage['intros'];\n\t\t$this->sectionOutro = $formPackage['outros'];\n\t\t$this->sectionLegends = $formPackage['legends'];\n\t\t$this->sectionClasses = $formPackage['classes'];\n\t\t$this->errors = $formPackage['errors'];\n\t}",
"public function __construct()\n {\n parent::__construct('ServicioForm');\n $this->setAttribute('method', 'post');\n \n $this->add(array(\n 'name' => 'servicio_nombre',\n 'type' => 'Text',\n 'options' => array(\n 'label' => 'Nombre',\n ),\n ));\n $this->add(array(\n 'name' => 'servicio_descripcion',\n 'type' => 'textarea',\n 'options' => array(\n 'label' => 'Descripcion',\n ),\n ));\n \n $this->add(array(\n 'name' => 'servicio_costo',\n 'type' => 'Text',\n 'options' => array(\n 'label' => 'Costo',\n ),\n ));\n \n $this->add(array(\n 'name' => 'servicio_precio',\n 'type' => 'Text',\n 'options' => array(\n 'label' => 'Precio',\n ),\n ));\n \n $this->add(array(\n 'name' => 'servicio_iva',\n 'type' => 'Text',\n 'options' => array(\n 'label' => 'IVA',\n ),\n ));\n \n\n\n }",
"protected function _construct()\n {\n $this->_init(\\AddictedToMagento\\DynamicForms\\Model\\ResourceModel\\Form::class);\n }",
"public function __construct($FormName)\n\t {\n\t \t// Call parent's constructor with the form name so nothing breaks down.\n\t \tparent::__construct($FormName);\n\t\t\t\n // ProductID.\n\t\t\t$this->add(\n\t\t\t[\n\t 'name' => 'productId',\n\t 'attributes' =>\n\t [\n\t 'type' => 'text',\n\t 'id' => 'productId',\n 'required' => 'required',\n\t \t],\n\t 'options' => ['label' => 'ProductID']\n\t ]);\n\t\t\t\n\t\t\t// Submit button.\n\t\t\t$this->add(\n\t\t\t[\n\t 'name' => 'submitDeleteProductForm',\n\t 'attributes' =>\n\t [\n\t 'type' => 'submit',\n\t 'id' => 'submitDeleteProductForm',\n 'required' => 'required',\n 'value' => 'Delete',\n\t \t]\n\t ]);\n\t }",
"public function __construct()\n {\n parent::__construct();\n\n // creates the form\n $this->form = new BootstrapFormBuilder(self::$formName);\n\n // define the form title\n $this->form->setFormTitle('Avaliações');\n\n $inscricao_evento_id = new TDBUniqueSearch('inscricao_evento_id', 'eventtus', 'Evento', 'id', 'id','nome asc' );\n\n $inscricao_evento_id->setSize('100%');\n $inscricao_evento_id->setMinLength(0);\n $inscricao_evento_id->setMask('{nome}');\n\n $row1 = $this->form->addFields([new TLabel('Evento', null, '14px', null),$inscricao_evento_id]);\n $row1->layout = ['col-sm-6'];\n\n // keep the form filled during navigation with session data\n $this->form->setData( TSession::getValue(__CLASS__.'_filter_data') );\n\n $btn_ongenerate = $this->form->addAction('Gerar', new TAction([$this, 'onGenerate']), 'fa:search #ffffff');\n $btn_ongenerate->addStyleClass('btn-primary'); \n\n // vertical box container\n $container = new TVBox;\n $container->style = 'width: 100%';\n $container->add(TBreadCrumb::create(['Cadastros','Avaliações']));\n $container->add($this->form);\n\n parent::add($container);\n\n }",
"public function createForm()\n {\n }",
"public function initialize()\n {\n $this->setEntity($this);\n\n // full name\n $key = new Text(\n \t'key',\n \t[\n \t\t\"required\"=>true,\n \t\t\"class\"=>\"form-control\",\n \t\t\"id\"=>\"key\",\n \t]\n );\n\n $key->addFilter('string');\n\n // full name\n $value = new Text(\n \t'val',\n \t[\n \t\t\"required\"=>true,\n \t\t\"class\"=>\"form-control\",\n \t\t\"id\"=>\"value\",\n \t]\n );\n\n $value->addFilter('string');\n \n\n \n \n\n $this->add($key);\n $this->add($value);\n\n // Add a text element to put a hidden CSRF\n $this->add(\n new Hidden(\n 'csrf'\n )\n );\n }",
"public function __construct()\n {\n parent::__construct();\n $this->FormGenerator = new FormGenerator();\n }",
"public function __construct()\n {\n parent::__construct(array(\n 'name' => __('WS Form', 'ws-form'),\n 'description' => __('Add a form.', 'ws-form'),\n 'category'\t\t=> __('Basic', 'ws-form'),\n 'dir' => FL_WS_FORM_DIR . 'modules/ws-form/',\n 'url' => FL_WS_FORM_URL . 'modules/ws-form/',\n 'editor_export' => true, // Defaults to true and can be omitted.\n 'enabled' => true, // Defaults to true and can be omitted.\n 'icon' => 'icon.svg'\n ));\n }",
"public function initialize($entity = null, $options = array())\n { \n $titulo = new Text(\"nome\");\n $titulo->setAttribute('class','form-control ');\n $this->add($titulo);\n\n $email = new Text(\"email\");\n $email->setAttribute('class','form-control ');\n $this->add($email);\n\n }",
"abstract public function createForm();",
"abstract public function createForm();",
"public function __construct(array $form)\n {\n $this->form = $form;\n }",
"public function __construct(Form $form)\n {\n $this->form = $form;\n }",
"public function __construct(Form $form)\n {\n $this->form = $form;\n }",
"public function initialize($entity = null, $options = null)\n {\n if (isset($options['edit']) && $options['edit']) {\n $id = new Hidden('id');\n } else {\n $id = new Text('id');\n }\n\n $this->add($id);\n\n // //id reseller\n // $id_reseller= new Text('id_reseller', [\n // 'placeholder' => 'Id Reseller'\n // ]);\n //\n // $id_reseller->setLabel('Reseller');\n // // $id_reseller->addValidators([\n // // new PresenceOf([\n // // 'message' => 'Id Reseller is required'\n // // ])\n // // ]);\n // $this->add($id_reseller);\n\n //nama agen\n $nama_agen = new Text('nama_agen', [\n 'placeholder' => 'Nama Agen'\n ]);\n\n $nama_agen->setLabel('Nama Agen');\n\n $nama_agen->addValidators([\n new PresenceOf([\n 'message' => 'Nama Agen is required'\n ])\n ]);\n\n $this->add($nama_agen);\n\n\n //merk\n $merk = new Text('merk', [\n 'placeholder' => 'Merk'\n ]);\n\n $merk->setLabel('Merk');\n $merk->addValidators([\n new PresenceOf([\n 'message' => 'Merk is required'\n ])\n ]);\n\n $this->add($merk);\n\n\n //serial number\n $serial_number = new Text('serial_number', [\n 'placeholder' => 'Serial Number'\n ]);\n\n $serial_number->setLabel('Serial Number');\n $serial_number->addValidators([\n new PresenceOf([\n 'message' => 'Serial Number is required'\n ])\n ]);\n\n $this->add($serial_number);\n\n\n //lokasi\n $lokasi = new Text('lokasi', [\n 'placeholder' => 'Lokasi'\n ]);\n\n $lokasi->setLabel('Lokasi');\n $lokasi->addValidators([\n new PresenceOf([\n 'message' => 'Lokasi is required'\n ])\n ]);\n\n $this->add($lokasi);\n\n\n //alamat\n $alamat = new Text('alamat', [\n 'placeholder' => 'Alamat'\n ]);\n\n $alamat->setLabel('Alamat');\n $alamat->addValidators([\n new PresenceOf([\n 'message' => 'Alamat is required'\n ])\n ]);\n\n $this->add($alamat);\n\n // Save\n $this->add(new Submit('Save', [\n 'class' => 'btn btn-success',\n 'id'=> 'submit'\n ]));\n\n // Save\n $this->add(new Submit('Search', [\n 'class' => 'btn btn-success',\n 'id'=> 'submit'\n ]));\n\n //id_doctor\n $findreseller = Users::find([\"profilesId = '5'\"]);\n $id_reseller = new Select('id_reseller', $findreseller, [\n 'using' => [\n 'id',\n 'name'\n ],\n 'useEmpty' => true,\n 'emptyText' => '----Select Reseller----',\n 'emptyValue' => ''\n ]);\n $id_reseller->setLabel('Reseller *');\n $this->add($id_reseller);\n\n }",
"function mongo_node_bundle_create_form_submit($form, $form_state) {\n $entity_type = $form_state['values']['entity_type'];\n\n $label = $form_state['values']['label'];\n $machine_name = $form_state['values']['name'];\n $description = $form_state['values']['description'];\n\n $set = mongo_node_settings();\n $set[$entity_type]['bundles'] += mongo_node_bundle_default_settings($label, $machine_name, $description);\n\n // @todo - redirect to bundle type page.\n mongo_node_settings_save($set);\n}",
"public function createForm();",
"public function createForm();",
"public function __construct (FormBuilder $formBuilder)\n {\n $this->middleware('auth');\n\n $this->formBuilder = $formBuilder;\n $this->entity = 'posts';\n }",
"private function createForm()\n\t{\n\t\t$builder = $this->getService('form')->create();\n\t\t$builder->setValidatorService($this->getService('validator'));\n\t\t$builder->setFormatter(new BasicFormFormatter());\n\t\t$builder->setDesigner(new DoctrineDesigner($this->getDoctrine(), 'Entity\\User',array('location')));\n\n\t\t$builder->getField('location')->setRequired(true);\n\t\t$builder->submit($this->getRequest());\n\n\t\treturn $builder;\n\t}",
"public function init()\n {\n $this->add([\n 'name' => 'name',\n 'type' => Text::class,\n 'attributes' => [\n 'placeholder' => 'Full Name',\n 'autofocus' => true,\n ],\n 'options' => [\n 'label' => 'Name',\n 'twb-layout' => TwbBundleForm::LAYOUT_HORIZONTAL,\n 'column-size' => 'sm-10',\n 'label_attributes' => [\n 'class' => 'col-sm-2',\n ],\n ],\n ]);\n\n $this->add([\n 'name' => 'email',\n 'type' => Email::class,\n 'attributes' => [\n 'placeholder' => 'Email Address',\n ],\n 'options' => [\n 'label' => 'Email',\n 'twb-layout' => TwbBundleForm::LAYOUT_HORIZONTAL,\n 'column-size' => 'sm-10',\n 'label_attributes' => [\n 'class' => 'col-sm-2',\n ],\n ],\n ]);\n\n $this->add([\n 'name' => 'subject',\n 'type' => Text::class,\n 'options' => [\n 'label' => 'Subject',\n 'twb-layout' => TwbBundleForm::LAYOUT_HORIZONTAL,\n 'column-size' => 'sm-10',\n 'label_attributes' => [\n 'class' => 'col-sm-2',\n ],\n ],\n 'attributes' => [\n 'placeholder' => 'Subject',\n ],\n ]);\n\n $this->add([\n 'name' => 'transport',\n 'type' => Select::class,\n 'options' => [\n 'label' => 'Department',\n 'value_options' => $this->getTransportList(),\n 'twb-layout' => TwbBundleForm::LAYOUT_HORIZONTAL,\n 'column-size' => 'sm-10',\n 'label_attributes' => [\n 'class' => 'col-sm-2',\n ],\n ],\n ]);\n\n $this->add([\n 'name' => 'body',\n 'type' => Textarea::class,\n 'options' => [\n 'label' => 'Message',\n 'twb-layout' => TwbBundleForm::LAYOUT_HORIZONTAL,\n 'column-size' => 'sm-10',\n 'label_attributes' => [\n 'class' => 'col-sm-2',\n ],\n ],\n 'attributes' => [\n 'placeholder' => 'Your message',\n 'rows' => 10,\n ],\n ]);\n\n if (true === $this->getOption('enable_captcha')) {\n $this->add([\n 'name' => 'captcha',\n 'type' => Captcha::class,\n 'attributes' => [\n 'placeholder' => 'Type letters and number here',\n ],\n 'options' => [\n 'label' => 'Please verify you are human',\n 'twb-layout' => TwbBundleForm::LAYOUT_HORIZONTAL,\n 'column-size' => 'sm-10 col-sm-offset-2',\n 'label_attributes' => [\n 'class' => 'col-sm-10 col-sm-offset-2',\n ],\n ],\n ]);\n }\n\n $this->add([\n 'name' => 'csrf',\n 'type' => Csrf::class,\n ]);\n\n $this->add([\n 'name' => 'submit',\n 'type' => Submit::class,\n 'attributes' => [\n 'id' => 'contact-submit-button',\n 'class' => 'btn btn-primary',\n ],\n 'options' => [\n 'label' => 'Send',\n 'twb-layout' => TwbBundleForm::LAYOUT_HORIZONTAL,\n 'column-size' => 'sm-10 col-sm-offset-2',\n ]\n ]);\n }",
"public function __construct()\n {\n $tmpl = implode(\n DIRECTORY_SEPARATOR,\n array(ARCH_PATH, 'theme', 'form', 'form.php')\n );\n parent::__construct($tmpl);\n }",
"public function __construct( Form $form ) {\n\t\t$this->form = $form;\n\t\t$this->phpRenderer = $this->form->getRenderer();\n\t\t$this->templatesEngine = ( Application::get() )->plugin->get( Engine::class );\n\n\t\t$this->setupFieldsAttributes();\n\t}",
"private function createCreateForm(BonCommandeLigne $entity)\n {\n $form = $this->createForm(new BonCommandeLigneType(), $entity, array(\n 'action' => $this->generateUrl('boncommandeligne_create'),\n 'method' => 'POST',\n ));\n\n $form->add('submit', 'submit', array('label' => 'Create'));\n\n return $form;\n }",
"public function __construct($name = null)\n {\n parent::__construct('serviceform');\n\n $this->add(array(\n 'name' => 'id',\n 'type' => 'Hidden',\n ));\n $this->add(array(\n 'name' => 'name',\n 'type' => 'Text',\n 'attributes' => array(\n 'class' => 'form-control',\n ),\n ));\n\n $this->add(array(\n 'name' => 'composition',\n 'type' => 'Text',\n 'attributes' => array(\n 'class' => 'form-control',\n ),\n ));\n $this->add(array(\n 'name' => 'description',\n 'type' => 'Text',\n\n 'attributes' => array(\n 'class' => 'form-control',\n ),\n ));\n\n $this->add(array(\n 'name' => 'url',\n 'type' => 'Text',\n\n 'attributes' => array(\n 'class' => 'form-control',\n ),\n ));\n\n $this->add(array(\n 'name' => 'input',\n 'type' => 'Text',\n\n 'attributes' => array(\n 'class' => 'form-control',\n ),\n ));\n\n $this->add(array(\n 'name' => 'output',\n 'type' => 'Text',\n\n 'attributes' => array(\n 'class' => 'form-control',\n ),\n ));\n\n $this->add(array(\n 'name' => 'categories',\n 'type' => 'Text',\n\n 'attributes' => array(\n 'class' => 'form-control',\n ),\n ));\n\n $this->add(array(\n 'name' => 'submit',\n 'type' => 'Submit',\n 'attributes' => array(\n 'value' => 'Create',\n 'id' => 'submit',\n 'class' => 'btn btn-success',\n ),\n ));\n $this->setAttribute('class','form-horizontal');\n\n }",
"public function initialize($entity = null, $options = array())\n {\n if (!isset($options['edit'])) {\n $element = new Text(\"id\");\n $this->add($element->setLabel(\"Id\"));\n } else {\n $this->add(new Hidden(\"id\"));\n }\n\n $name = new Text(\"nombre\");\n $name->setLabel(\"Nombre\");\n $name->setFilters(['striptags', 'string']);\n $name->addValidators([\n new PresenceOf([\n 'message' => 'El Nombre es Requerido'\n ])\n ]);\n $this->add($name);\n\n $genero = new Select('id_genero', Generos::find(), [\n 'using' => ['id_genero', 'genero'],\n 'useEmpty' => true,\n 'emptyText' => '...',\n 'emptyValue' => ''\n ]);\n $genero->setLabel('Genero de Pelicula');\n $this->add($genero);\n\n $year = new Text(\"Año\");\n $year->setLabel(\"Año\");\n $year->setFilters(['date']);\n $year->addValidators([\n new PresenceOf([\n 'message' => 'Por favor ingrese el Año'\n ])\n ]);\n $this->add($year);\n }",
"function __construct($form = null)\n\t{\n\t\t$lang = Factory::getLanguage();\n\t\t$lang->load(\"com_jevents\", JPATH_ADMINISTRATOR);\n\n\t\tparent::__construct($form);\n\t\t$this->data = array();\n\t\t$this->labeldata = array();\n\n\t}",
"protected function buildForm()\n {\n $this->form = Yii::createObject(array_merge([\n 'scenario' => $this->scenario,\n 'parent_id' => $this->parent_id,\n 'parentTariff' => $this->parentTariff,\n 'tariff' => $this->tariff,\n ], $this->getFormOptions()));\n }"
]
| [
"0.7282269",
"0.6783061",
"0.6717208",
"0.66257316",
"0.65306914",
"0.6512528",
"0.6465536",
"0.64655024",
"0.64308816",
"0.6401182",
"0.63922143",
"0.63817096",
"0.63817096",
"0.63507676",
"0.6347384",
"0.6347384",
"0.6320024",
"0.6294007",
"0.6288342",
"0.6288342",
"0.62788415",
"0.6277748",
"0.625975",
"0.6255916",
"0.62527245",
"0.6252583",
"0.62359387",
"0.6225507",
"0.6222608",
"0.6204458"
]
| 0.71189916 | 1 |
Form validation handler for mongo_node_bundle_create_form(). | function mongo_node_bundle_create_form_validate($form, $form_state) {
if (empty($form_state['values']['name'])) {
form_set_error('name', t('Machine name @machine_name already exists', array('@machine_name' => $machine_name)));
return FALSE;
}
$machine_name = $form_state['values']['name'];
$entity_type = $form_state['values']['entity_type'];
$set = mongo_node_settings();
if (isset($set[$entity_type]['bundles'][$machine_name])) {
form_set_error('name', t('Machine name @machine_name already exists', array('@machine_name' => $machine_name)));
return FALSE;
}
return TRUE;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function mongo_node_form_validate(&$form, &$form_state) {\n $entity_type = $form_state['entity_type'];\n $entity = $form_state[$entity_type];\n field_attach_form_validate($entity_type, $entity, $form, $form_state);\n}",
"function mongo_node_type_create_form_validate($form, $form_state) {\n $set = mongo_node_settings();\n $machine_name = $form_state['values']['name'];\n\n if (isset($set[$machine_name])) {\n form_set_error('name', t('Machine name @machine_name already exists', array('@machine_name' => $machine_name)));\n return FALSE;\n }\n return TRUE;\n}",
"function mongo_node_bundle_create_form($form, $form_state, $entity_type) {\n $form = array();\n\n $form['label'] = array(\n '#type' => 'textfield',\n '#title' => t('Entity type'),\n '#description' => t('The human readable name of the entity.'),\n );\n\n $form['name'] = array(\n '#type' => 'machine_name',\n '#required' => FALSE,\n '#machine_name' => array(\n 'exists' => '_mongo_node_bundle_exists',\n 'source' => array('label'),\n ),\n );\n\n $form['description'] = array(\n '#type' => 'textarea',\n '#title' => t('Description'),\n '#description' => t('Describe this bundle.'),\n );\n\n $form['entity_type'] = array(\n '#type' => 'value',\n '#value' => $entity_type,\n );\n\n $form['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save'),\n );\n\n return $form;\n}",
"function mongo_node_form_submit(&$form, &$form_state) {\n $entity_type = $form_state['entity_type'];\n $entity = entity_ui_controller($entity_type)->entityFormSubmitBuildEntity($form, $form_state);\n $insert = empty($entity->mid);\n entity_save($entity_type, $entity);\n\n $info = entity_get_info($entity_type);\n $bundle_key = $info['bundle keys']['bundle'];\n $bundle_label = $info['bundles'][$entity->{$bundle_key}]['label'];\n\n if ($insert) {\n drupal_set_message(t('@label %title has been created.',\n array(\n '@label' => $bundle_label,\n '%title' => $entity->title,\n )\n )\n );\n }\n else {\n drupal_set_message(t('@label %title has been updated.',\n array(\n '@label' => $bundle_label,\n '%title' => $entity->title,\n )\n )\n );\n }\n\n $uri = entity_uri($entity_type, $entity);\n $form_state['redirect'] = drupal_get_path_alias($uri['path']);\n}",
"function mongo_node_form($form, &$form_state, $entity, $entity_type) {\n $form = array();\n\n $form_state['entity_type'] = $entity_type;\n if (!isset($form_state[$entity_type])) {\n $form_state[$entity_type] = $entity;\n }\n else {\n $entity = $form_state[$entity_type];\n }\n\n // Get title label name from properties if exists\n static $settings = array();\n if(empty($settings)) {\n $settings = mongo_node_settings();\n }\n $title = isset($settings[$entity_type]['properties']['title']['label']) ? $settings[$entity_type]['properties']['title']['label'] : t('Title');\n\n $form['title'] = array(\n '#type' => 'textfield',\n '#title' => $title,\n '#required' => TRUE,\n '#default_value' => isset($entity->title) ? $entity->title : '',\n );\n\n $form['#attributes']['class'][] = 'mongo-node-form';\n if (!empty($entity->type)) {\n // TODO -- add entity type with bundle.\n $form['#attributes']['class'][] = 'mongo-node-' . $entity->type . '-form';\n }\n\n $form['actions'] = array('#type' => 'actions');\n $form['actions']['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save'),\n '#weight' => 5,\n '#submit' => array('mongo_node_form_submit'),\n );\n\n $form['#validate'][] = 'mongo_node_form_validate';\n field_attach_form($entity_type, $entity, $form, $form_state);\n\n return $form;\n}",
"function mongo_node_operation_validate($form, &$form_state) {\n if (!is_array($form_state['values']['entities']) || !count(array_filter($form_state['values']['entities']))) {\n form_set_error('', t('No items selected.'));\n }\n}",
"function mongo_node_bundle_create_form_submit($form, $form_state) {\n $entity_type = $form_state['values']['entity_type'];\n\n $label = $form_state['values']['label'];\n $machine_name = $form_state['values']['name'];\n $description = $form_state['values']['description'];\n\n $set = mongo_node_settings();\n $set[$entity_type]['bundles'] += mongo_node_bundle_default_settings($label, $machine_name, $description);\n\n // @todo - redirect to bundle type page.\n mongo_node_settings_save($set);\n}",
"function mongo_node_bundle_edit_form_submit($form, $form_state) {\n\n $label = $form_state['values']['label'];\n $machine_name = $form_state['values']['name'];\n $entity_type = $form_state['values']['bundle_type']['entity_type'];\n $old_bundle_type = $form_state['values']['bundle_type']['bundle'];\n $description = $form_state['values']['description'];\n\n $set = mongo_node_settings();\n\n if ($machine_name != $old_bundle_type) {\n $set[$entity_type]['bundles'] += mongo_node_bundle_default_settings($label, $machine_name, $description);\n $set[$entity_type]['bundles'][$machine_name] = $set[$entity_type]['bundles'][$old_bundle_type];\n unset($set[$entity_type]['bundles'][$old_bundle_type]);\n\n // Update existing mongo entities with new bundle.\n //_mongo_node_update_bundle($entity_type, $old_bundle_type, $machine_name);\n }\n else {\n $set[$entity_type]['bundles'][$machine_name]['label'] = $label;\n $set[$entity_type]['bundles'][$machine_name]['description'] = $description;\n }\n\n // Save settings.\n mongo_node_settings_save($set);\n return TRUE;\n}",
"function mongo_node_bundle_edit_form($form, $form_state, $entity_type, $bundle) {\n\n $set = mongo_node_settings();\n\n $form = array();\n\n $form['label'] = array(\n '#type' => 'textfield',\n '#title' => t('Entity type'),\n '#default_value' => $set[$entity_type]['bundles'][$bundle]['label'],\n '#description' => t('The human readable name of the entity.'),\n );\n\n $form['name'] = array(\n '#type' => 'machine_name',\n '#required' => FALSE,\n '#default_value' => $bundle,\n '#machine_name' => array(\n 'exists' => '_mongo_node_bundle_exists',\n 'source' => array('label'),\n ),\n );\n\n $description = isset($set[$entity_type]['bundles'][$bundle]['description']) ? $set[$entity_type]['bundles'][$bundle]['description'] : '';\n $form['description'] = array(\n '#type' => 'textarea',\n '#title' => t('Description'),\n '#default_value' => $description,\n '#description' => t('Describe this bundle.'),\n );\n\n // Save entity type and bundle.\n $form['bundle_type'] = array(\n '#type' => 'value',\n '#value' => array(\n 'entity_type' => $entity_type,\n 'bundle' => $bundle,\n ),\n );\n\n $form['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save'),\n );\n\n return $form;\n}",
"private function validateForm(): void\n { if ($this->form->isSubmitted()) {\n // get the status\n $status = $this->getRequest()->request->has('saveAsDraft') ? 'draft' : 'active';\n\n // cleanup the submitted fields, ignore fields that were added by hackers\n $this->form->cleanupFields();\n\n // validate fields\n $this->form->getField('title')->isFilled(BL::err('TitleIsRequired'));\n $this->form->getField('text')->isFilled(BL::err('FieldIsRequired'));\n $this->form->getField('publish_on_date')->isValid(BL::err('DateIsInvalid'));\n $this->form->getField('publish_on_time')->isValid(BL::err('TimeIsInvalid'));\n $this->form->getField('category_id')->isFilled(BL::err('FieldIsRequired'));\n if ($this->form->getField('category_id')->getValue() == 'new_category') {\n $this->form->getField('category_id')->addError(BL::err('FieldIsRequired'));\n }\n\n // validate meta\n $this->meta->validate();\n\n if ($this->form->isCorrect()) {\n // build item\n $item = [\n 'id' => (int) BackendBlogModel::getMaximumId() + 1,\n 'meta_id' => $this->meta->save(),\n 'category_id' => (int) $this->form->getField('category_id')->getValue(),\n 'user_id' => $this->form->getField('user_id')->getValue(),\n 'language' => BL::getWorkingLanguage(),\n 'title' => $this->form->getField('title')->getValue(),\n 'introduction' => $this->form->getField('introduction')->getValue(),\n 'text' => $this->form->getField('text')->getValue(),\n 'publish_on' => BackendModel::getUTCDate(\n null,\n BackendModel::getUTCTimestamp(\n $this->form->getField('publish_on_date'),\n $this->form->getField('publish_on_time')\n )\n ),\n 'created_on' => BackendModel::getUTCDate(),\n 'hidden' => $this->form->getField('hidden')->getValue(),\n 'allow_comments' => $this->form->getField('allow_comments')->getChecked(),\n 'num_comments' => 0,\n 'status' => $status,\n ];\n $item['edited_on'] = $item['created_on'];\n\n // insert the item\n $item['revision_id'] = BackendBlogModel::insert($item);\n\n if ($this->imageIsAllowed) {\n // the image path\n $imagePath = FRONTEND_FILES_PATH . '/Blog/images';\n\n // create folders if needed\n $filesystem = new Filesystem();\n $filesystem->mkdir([$imagePath . '/source', $imagePath . '/128x128']);\n\n // image provided?\n if ($this->form->getField('image')->isFilled()) {\n // build the image name\n $item['image'] = $this->meta->getUrl()\n . '-' . BL::getWorkingLanguage()\n . '-' . $item['revision_id']\n . '.' . $this->form->getField('image')->getExtension();\n\n // upload the image & generate thumbnails\n $this->form->getField('image')->generateThumbnails($imagePath, $item['image']);\n\n // add the image to the database without changing the revision id\n BackendBlogModel::updateRevision($item['revision_id'], ['image' => $item['image']]);\n }\n }\n\n // save the tags\n BackendTagsModel::saveTags($item['id'], $this->form->getField('tags')->getValue(), $this->url->getModule());\n\n // active\n if ($item['status'] == 'active') {\n // add search index\n BackendSearchModel::saveIndex($this->getModule(), $item['id'], ['title' => $item['title'], 'text' => $item['text']]);\n\n // everything is saved, so redirect to the overview\n $this->redirect(BackendModel::createUrlForAction('Index') . '&report=added&var=' . rawurlencode($item['title']) . '&highlight=row-' . $item['revision_id']);\n } elseif ($item['status'] == 'draft') {\n // draft: everything is saved, so redirect to the edit action\n $this->redirect(BackendModel::createUrlForAction('Edit') . '&report=saved-as-draft&var=' . rawurlencode($item['title']) . '&id=' . $item['id'] . '&draft=' . $item['revision_id'] . '&highlight=row-' . $item['revision_id']);\n }\n }\n }\n }",
"function inscription_jesa_manage_validate($form, &$form_state) {\n \n}",
"function mongo_node_type_create_form_submit($form, $form_state) {\n $label = $form_state['values']['label'];\n $machine_name = $form_state['values']['name'];\n\n $set = mongo_node_settings();\n $set += mongo_node_type_default_settings($label, $machine_name);\n\n // @todo - redirect to entity type page\n mongo_node_settings_save($set);\n}",
"function validate_blog_form()\n {\n }",
"public function createForm();",
"public function createForm();",
"function thumbwhere_contentcollection_edit_form_validate(&$form, &$form_state) {\n \n //if (twCanDebug()) debug($form); \n //if (twCanDebug()) debug($form_state);\n\n\n // No validation for pk\n\n\n // Convert fk autocomplete for fk_actor\n $value = $form['fk_actor']['#value'];\n // If we have something, escape the auto-completion encoding.\n if (!empty($value)) { \n $value = entity_autocomplete_get_id($value);\n form_set_value($form['fk_actor'], $value,$form_state);\n }\n //if (twCanDebug()) debug($form['fk_actor']);\n if (twCanDebug()) debug('fk_actor = ' . $value);\n // Validate fk fk_actor\n if (empty($value)) {\n form_set_error('fk_actor', t('Validation error, \\'fk_actor\\' is mandatory1.'));\n // throw new Exception('Field \\'fk_actor\\' in is mandatory');\n }\n\n // Validate normaltitle\n $value = $form['title']['#value'];\n // If we have no default value then we don't care much for checking for emptyness.\n\n\n \n\n //form_set_value( array('#parents' => array('array_key_parent', 'array_key_to_replace')) , $value, $form_state);\n\n \n \n $thumbwhere_contentcollection = $form_state['thumbwhere_contentcollection'];\n\n // Notify field widgets to validate their data.\n field_attach_form_validate('thumbwhere_contentcollection', $thumbwhere_contentcollection, $form, $form_state);\n \n \n \n}",
"public function createForm()\n {\n }",
"function mongo_node_add($entity_type, $bundle) {\n global $user;\n $set = mongo_node_settings();\n\n $entity = entity_create($entity_type, array(\n 'uid' => $user->uid,\n 'name' => (isset($user->name) ? $user->name : ''),\n 'type' => $bundle,\n 'language' => LANGUAGE_NONE,\n )\n );\n $form_id = $entity_type . '_' . $bundle . '_mongo_node_form';\n $output = drupal_get_form($form_id, $entity, $entity_type);\n\n return $output;\n}",
"abstract public function createForm();",
"abstract public function createForm();",
"function restapi_admin_form_validate($form, &$form_state) {\n\n $class = isset($form_state['values']['restapi_default_auth_class']) ? $form_state['values']['restapi_default_auth_class'] : NULL;\n $prefix = isset($form_state['values']['restapi_url_prefix']) ? $form_state['values']['restapi_url_prefix'] : NULL;\n\n if ($class && !class_exists($class)) {\n form_set_error('restapi_default_auth_class', t('The class \"@class\" does not seem to exist, or is not callable.', [\n '@class' => $class,\n ]));\n }\n\n if ($prefix != variable_get('restapi_url_prefix')) {\n $form_state['storage']['restapi_url_prefix_changed'] = TRUE;\n\n $prefix = trim($prefix);\n $prefix = rtrim($prefix, '/');\n $prefix = ltrim($prefix, '/');\n $form_state['values']['restapi_url_prefix'] = $prefix;\n }\n\n}",
"function dolist_messages_mail_admin_bundle_form_validate($form, &$form_state) {\n $bundle = new stdClass();\n $bundle->name = trim($form_state['values']['name']);\n\n if (!$form_state['values']['locked']) {\n $bundle->bundle = trim($form_state['values']['bundle']);\n // 'theme' conflicts with theme_node_form().\n // '0' is invalid, since elsewhere we check it using empty().\n if (in_array($bundle->bundle, array('0', 'theme'))) {\n form_set_error('type', t(\"Invalid machine-readable name. Enter a name other than %invalid.\", array('%invalid' => $bundle->bundle)));\n }\n }\n\n}",
"function _validate_form($form, &$form_state)\n{\n\t// Retrieve variables to be validated\n\t$terms_selected_options = $_SESSION['ef_term_merge']['selected']['#options'];\n\t$merge_into = $form_state['values']['terms-list-to-merge-into'];\n\n\tif(count($terms_selected_options) == 0 || $merge_into == 0)\n\t{\n\n\t\t$error_elements = array($form['container']['selected']['terms-selected-to-merge'], $form['merge-into']['terms-list-to-merge-into']);\n\n\t\tforeach ($error_elements as $element)\n\t\t{\n\t\t\t\tform_set_error($element);\n\t\t}\n\n\t\t// Reset vocabulary select\n\t\t$form_state['input']['vocabularies'] = 0;\n\n\t\t$form_state['rebuild'] = TRUE;\n\t\tdrupal_set_message('At least one term needs to be selected from \"Terms to be merged\" and another one from \"Term to merge into\"','error');\n\t}\n}",
"function pdfbulletin_settings_form_validate(&$form, &$form_state) {\n // @todo SERIOUSLY\n}",
"function validate_on_create() {}",
"function ting_visual_relation_slide_form_validate($form, &$form_state) {\n if (empty($form_state['values']['name'])) {\n form_set_error('name', t('Please enter a name for the slide'));\n }\n $type = $form_state['values']['type'];\n switch ($type) {\n case 'external':\n case 'circular':\n $datawell_pid = $form_state['values']['datawell_pid'];\n // TODO: use a regex to validate the datawell-PID.\n if (empty($datawell_pid)) {\n form_set_error('datawell_pid', t('Please enter a valid datawell-PID'));\n }\n break;\n case 'structural':\n if (empty($form_state['values']['search_query'])) {\n form_set_error('search_query', t('Please enter a search query'));\n }\n }\n}",
"function mongo_node_bundle_delete_form($form, $form_state, $entity_type, $bundle) {\n $form = array();\n\n $form['entity_type'] = array(\n '#type' => 'value',\n '#value' => $entity_type,\n );\n $form['bundle'] = array(\n '#type' => 'value',\n '#value' => $bundle,\n );\n\n $path = '/admin/structure/mongo-node/' . $entity_type;\n\n $extist_bundle_content = '';\n $collection = mongodb_collection('fields_current', $entity_type);\n $count = $collection->count(array('_type' => $entity_type, '_bundle' => $bundle));\n if ($count) {\n $extist_bundle_content = t('%bundle is used by %count piece of content on your site. If you remove this bundle, you will not be able to edit the %bundle content and it may not display correctly.', array('%bundle' => $bundle, '%count' => $count));\n $extist_bundle_content .= '<br/><br/>';\n }\n\n return confirm_form($form, t('Delete entity bundle'), $path, $extist_bundle_content . 'This action cannot be undone', t('Delete'), t('Cancel'), 'mongo_node_bundle_delete');\n}",
"function node_form(&$form_state, $node) {\n global $user;\n\n if (isset($form_state['node'])) {\n $node = $form_state['node'] + (array)$node;\n }\n if (isset($form_state['node_preview'])) {\n $form['#prefix'] = $form_state['node_preview'];\n }\n $node = (object)$node;\n foreach (array('body', 'title', 'format') as $key) {\n if (!isset($node->$key)) {\n $node->$key = NULL;\n }\n }\n if (!isset($form_state['node_preview'])) {\n node_object_prepare($node);\n }\n else {\n $node->build_mode = NODE_BUILD_PREVIEW;\n }\n\n // Set the id of the top-level form tag\n $form['#id'] = 'node-form';\n\n // Basic node information.\n // These elements are just values so they are not even sent to the client.\n foreach (array('nid', 'vid', 'uid', 'created', 'type', 'language') as $key) {\n $form[$key] = array(\n '#type' => 'value',\n '#value' => isset($node->$key) ? $node->$key : NULL,\n );\n }\n\n // Changed must be sent to the client, for later overwrite error checking.\n $form['changed'] = array(\n '#type' => 'hidden',\n '#default_value' => isset($node->changed) ? $node->changed : NULL,\n );\n // Get the node-specific bits.\n if ($extra = node_invoke($node, 'form', $form_state)) {\n $form = array_merge_recursive($form, $extra);\n }\n if (!isset($form['title']['#weight'])) {\n $form['title']['#weight'] = -5;\n }\n\n $form['#node'] = $node;\n\n // Add a log field if the \"Create new revision\" option is checked, or if the\n // current user has the ability to check that option.\n if (!empty($node->revision) || user_access('administer nodes')) {\n $form['revision_information'] = array(\n '#type' => 'fieldset',\n '#title' => t('Revision information'),\n '#collapsible' => TRUE,\n // Collapsed by default when \"Create new revision\" is unchecked\n '#collapsed' => !$node->revision,\n '#weight' => 20,\n );\n $form['revision_information']['revision'] = array(\n '#access' => user_access('administer nodes'),\n '#type' => 'checkbox',\n '#title' => t('Create new revision'),\n '#default_value' => $node->revision,\n );\n $form['revision_information']['log'] = array(\n '#type' => 'textarea',\n '#title' => t('Log message'),\n '#default_value' => (isset($node->log) ? $node->log : ''),\n '#rows' => 2,\n '#description' => t('An explanation of the additions or updates being made to help other authors understand your motivations.'),\n );\n }\n\n // Node author information for administrators\n $form['author'] = array(\n '#type' => 'fieldset',\n '#access' => user_access('administer nodes'),\n '#title' => t('Authoring information'),\n '#collapsible' => TRUE,\n '#collapsed' => TRUE,\n '#weight' => 20,\n );\n $form['author']['name'] = array(\n '#type' => 'textfield',\n '#title' => t('Authored by'),\n '#maxlength' => 60,\n '#autocomplete_path' => 'user/autocomplete',\n '#default_value' => $node->name ? $node->name : '',\n '#weight' => -1,\n '#description' => t('Leave blank for %anonymous.', array('%anonymous' => variable_get('anonymous', t('Anonymous')))),\n );\n $form['author']['date'] = array(\n '#type' => 'textfield',\n '#title' => t('Authored on'),\n '#maxlength' => 25,\n '#description' => t('Format: %time. Leave blank to use the time of form submission.', array('%time' => !empty($node->date) ? $node->date : format_date($node->created, 'custom', 'Y-m-d H:i:s O'))),\n );\n\n if (isset($node->date)) {\n $form['author']['date']['#default_value'] = $node->date;\n }\n\n // Node options for administrators\n $form['options'] = array(\n '#type' => 'fieldset',\n '#access' => user_access('administer nodes'),\n '#title' => t('Publishing options'),\n '#collapsible' => TRUE,\n '#collapsed' => TRUE,\n '#weight' => 25,\n );\n $form['options']['status'] = array(\n '#type' => 'checkbox',\n '#title' => t('Published'),\n '#default_value' => $node->status,\n );\n $form['options']['promote'] = array(\n '#type' => 'checkbox',\n '#title' => t('Promoted to front page'),\n '#default_value' => $node->promote,\n );\n $form['options']['sticky'] = array(\n '#type' => 'checkbox',\n '#title' => t('Sticky at top of lists'),\n '#default_value' => $node->sticky,\n );\n\n // These values are used when the user has no administrator access.\n foreach (array('uid', 'created') as $key) {\n $form[$key] = array(\n '#type' => 'value',\n '#value' => $node->$key,\n );\n }\n\n // Add the buttons.\n $form['buttons'] = array();\n $form['buttons']['submit'] = array(\n '#type' => 'submit',\n '#access' => !variable_get('node_preview', 0) || (!form_get_errors() && isset($form_state['node_preview'])),\n '#value' => t('Save'),\n '#weight' => 5,\n '#submit' => array('node_form_submit'),\n );\n $form['buttons']['preview'] = array(\n '#type' => 'submit',\n '#value' => t('Preview'),\n '#weight' => 10,\n '#submit' => array('node_form_build_preview'),\n );\n if (!empty($node->nid) && node_access('delete', $node)) {\n $form['buttons']['delete'] = array(\n '#type' => 'submit',\n '#value' => t('Delete'),\n '#weight' => 15,\n '#submit' => array('node_form_delete_submit'),\n );\n }\n $form['#validate'][] = 'node_form_validate';\n $form['#theme'] = array($node->type .'_node_form', 'node_form');\n return $form;\n}",
"protected function createFormFields() {\n\t}",
"public function postBind(FormEvent $event)\n {\n $data = $event->getData();\n $form = $event->getForm();\n\n // Check if the Form has a 'File' field\n if ($form->has('file')) {\n if (!$data->hasFile()) {\n $form->addError(new FormError('File must be given to create Document.'));\n }\n }\n }"
]
| [
"0.74918324",
"0.67976105",
"0.6633064",
"0.6482915",
"0.6348119",
"0.6339121",
"0.6242151",
"0.60979575",
"0.5983234",
"0.5968238",
"0.5949089",
"0.594119",
"0.58625954",
"0.5776641",
"0.5776641",
"0.5740215",
"0.572987",
"0.57215273",
"0.56918436",
"0.56918436",
"0.5639497",
"0.56300795",
"0.5603309",
"0.5557135",
"0.5542969",
"0.5509469",
"0.54869384",
"0.5486055",
"0.5477474",
"0.5472062"
]
| 0.73487484 | 1 |
Form submission handler for mongo_node_bundle_create_form(). | function mongo_node_bundle_create_form_submit($form, $form_state) {
$entity_type = $form_state['values']['entity_type'];
$label = $form_state['values']['label'];
$machine_name = $form_state['values']['name'];
$description = $form_state['values']['description'];
$set = mongo_node_settings();
$set[$entity_type]['bundles'] += mongo_node_bundle_default_settings($label, $machine_name, $description);
// @todo - redirect to bundle type page.
mongo_node_settings_save($set);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function mongo_node_form_submit(&$form, &$form_state) {\n $entity_type = $form_state['entity_type'];\n $entity = entity_ui_controller($entity_type)->entityFormSubmitBuildEntity($form, $form_state);\n $insert = empty($entity->mid);\n entity_save($entity_type, $entity);\n\n $info = entity_get_info($entity_type);\n $bundle_key = $info['bundle keys']['bundle'];\n $bundle_label = $info['bundles'][$entity->{$bundle_key}]['label'];\n\n if ($insert) {\n drupal_set_message(t('@label %title has been created.',\n array(\n '@label' => $bundle_label,\n '%title' => $entity->title,\n )\n )\n );\n }\n else {\n drupal_set_message(t('@label %title has been updated.',\n array(\n '@label' => $bundle_label,\n '%title' => $entity->title,\n )\n )\n );\n }\n\n $uri = entity_uri($entity_type, $entity);\n $form_state['redirect'] = drupal_get_path_alias($uri['path']);\n}",
"function mongo_node_bundle_create_form($form, $form_state, $entity_type) {\n $form = array();\n\n $form['label'] = array(\n '#type' => 'textfield',\n '#title' => t('Entity type'),\n '#description' => t('The human readable name of the entity.'),\n );\n\n $form['name'] = array(\n '#type' => 'machine_name',\n '#required' => FALSE,\n '#machine_name' => array(\n 'exists' => '_mongo_node_bundle_exists',\n 'source' => array('label'),\n ),\n );\n\n $form['description'] = array(\n '#type' => 'textarea',\n '#title' => t('Description'),\n '#description' => t('Describe this bundle.'),\n );\n\n $form['entity_type'] = array(\n '#type' => 'value',\n '#value' => $entity_type,\n );\n\n $form['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save'),\n );\n\n return $form;\n}",
"function mongo_node_form($form, &$form_state, $entity, $entity_type) {\n $form = array();\n\n $form_state['entity_type'] = $entity_type;\n if (!isset($form_state[$entity_type])) {\n $form_state[$entity_type] = $entity;\n }\n else {\n $entity = $form_state[$entity_type];\n }\n\n // Get title label name from properties if exists\n static $settings = array();\n if(empty($settings)) {\n $settings = mongo_node_settings();\n }\n $title = isset($settings[$entity_type]['properties']['title']['label']) ? $settings[$entity_type]['properties']['title']['label'] : t('Title');\n\n $form['title'] = array(\n '#type' => 'textfield',\n '#title' => $title,\n '#required' => TRUE,\n '#default_value' => isset($entity->title) ? $entity->title : '',\n );\n\n $form['#attributes']['class'][] = 'mongo-node-form';\n if (!empty($entity->type)) {\n // TODO -- add entity type with bundle.\n $form['#attributes']['class'][] = 'mongo-node-' . $entity->type . '-form';\n }\n\n $form['actions'] = array('#type' => 'actions');\n $form['actions']['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save'),\n '#weight' => 5,\n '#submit' => array('mongo_node_form_submit'),\n );\n\n $form['#validate'][] = 'mongo_node_form_validate';\n field_attach_form($entity_type, $entity, $form, $form_state);\n\n return $form;\n}",
"function mongo_node_type_create_form_submit($form, $form_state) {\n $label = $form_state['values']['label'];\n $machine_name = $form_state['values']['name'];\n\n $set = mongo_node_settings();\n $set += mongo_node_type_default_settings($label, $machine_name);\n\n // @todo - redirect to entity type page\n mongo_node_settings_save($set);\n}",
"function mongo_node_bundle_edit_form_submit($form, $form_state) {\n\n $label = $form_state['values']['label'];\n $machine_name = $form_state['values']['name'];\n $entity_type = $form_state['values']['bundle_type']['entity_type'];\n $old_bundle_type = $form_state['values']['bundle_type']['bundle'];\n $description = $form_state['values']['description'];\n\n $set = mongo_node_settings();\n\n if ($machine_name != $old_bundle_type) {\n $set[$entity_type]['bundles'] += mongo_node_bundle_default_settings($label, $machine_name, $description);\n $set[$entity_type]['bundles'][$machine_name] = $set[$entity_type]['bundles'][$old_bundle_type];\n unset($set[$entity_type]['bundles'][$old_bundle_type]);\n\n // Update existing mongo entities with new bundle.\n //_mongo_node_update_bundle($entity_type, $old_bundle_type, $machine_name);\n }\n else {\n $set[$entity_type]['bundles'][$machine_name]['label'] = $label;\n $set[$entity_type]['bundles'][$machine_name]['description'] = $description;\n }\n\n // Save settings.\n mongo_node_settings_save($set);\n return TRUE;\n}",
"function mongo_node_bundle_edit_form($form, $form_state, $entity_type, $bundle) {\n\n $set = mongo_node_settings();\n\n $form = array();\n\n $form['label'] = array(\n '#type' => 'textfield',\n '#title' => t('Entity type'),\n '#default_value' => $set[$entity_type]['bundles'][$bundle]['label'],\n '#description' => t('The human readable name of the entity.'),\n );\n\n $form['name'] = array(\n '#type' => 'machine_name',\n '#required' => FALSE,\n '#default_value' => $bundle,\n '#machine_name' => array(\n 'exists' => '_mongo_node_bundle_exists',\n 'source' => array('label'),\n ),\n );\n\n $description = isset($set[$entity_type]['bundles'][$bundle]['description']) ? $set[$entity_type]['bundles'][$bundle]['description'] : '';\n $form['description'] = array(\n '#type' => 'textarea',\n '#title' => t('Description'),\n '#default_value' => $description,\n '#description' => t('Describe this bundle.'),\n );\n\n // Save entity type and bundle.\n $form['bundle_type'] = array(\n '#type' => 'value',\n '#value' => array(\n 'entity_type' => $entity_type,\n 'bundle' => $bundle,\n ),\n );\n\n $form['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save'),\n );\n\n return $form;\n}",
"function mongo_node_add($entity_type, $bundle) {\n global $user;\n $set = mongo_node_settings();\n\n $entity = entity_create($entity_type, array(\n 'uid' => $user->uid,\n 'name' => (isset($user->name) ? $user->name : ''),\n 'type' => $bundle,\n 'language' => LANGUAGE_NONE,\n )\n );\n $form_id = $entity_type . '_' . $bundle . '_mongo_node_form';\n $output = drupal_get_form($form_id, $entity, $entity_type);\n\n return $output;\n}",
"function mongo_node_operation_submit($form, &$form_state) {\n $operations = mongo_node_operations();\n $operation = $operations[$form_state['values']['operation']];\n\n $entities = array_filter($form_state['values']['entities']);\n $entity_type = $form_state['values']['entity_type'];\n if ($function = $operation['callback']) {\n // Add in callback arguments if present.\n if (isset($operation['callback arguments'])) {\n $args = array(\n $entity_type,\n $entities,\n $operation['callback arguments'],\n );\n }\n else {\n $args = array($entity_type, $entities);\n }\n call_user_func_array($function, $args);\n cache_clear_all();\n }\n}",
"function create() {\n\t\tglobal $tpl, $lng;\n\n\t\t$form = $this->initForm(TRUE);\n\t\tif ($form->checkInput()) {\n\t\t\tif ($this->createElement($this->getPropertiesFromPost($form))) {\n\t\t\t\tilUtil::sendSuccess($lng->txt('msg_obj_modified'), TRUE);\n\t\t\t\t$this->returnToParent();\n\t\t\t}\n\t\t}\n\n\t\t$form->setValuesByPost();\n\t\t$tpl->setContent($form->getHtml());\n\t}",
"function main() {\n\t\tif ($_SERVER['REQUEST_METHOD'] === 'POST') {\n\t\t\tprint_r($_POST);\n\t\t\techo \"<br />\";\n\t\t\t\n\t\t\t// Required Fields in the POST data //\t\t\t\n\t\t\tif ( !isset($_POST['_type']) ) return;\n\t\t\tif ( !isset($_POST['_subtype']) ) return;\n\t\t\tif ( !isset($_POST['_name']) ) return;\n\t\t\tif ( !isset($_POST['_mail']) ) return;\n\t\t\tif ( !isset($_POST['_password']) ) return;\n\t\t\tif ( !isset($_POST['_publish']) ) return;\n\t\n\t\t\t// Node Type //\n\t\t\t$type = sanitize_NodeType($_POST['_type']);\n\t\t\tif ( empty($type) ) return;\t\n\n\t\t\t$subtype = sanitize_NodeType($_POST['_subtype']);\n\t\n\t\t\t// Name/Title //\n\t\t\t$name = $_POST['_name'];\t// TODO: Sanitize\n\t\t\t\n\t\t\t// Slug //\n\t\t\tif ( empty($_POST['_slug']) )\n\t\t\t\t$slug = $_POST['_name'];\n\t\t\telse\n\t\t\t\t$slug = $_POST['_slug'];\n\t\t\t$slug = sanitize_Slug($slug);\n\t\t\tif ( empty($slug) ) return;\n\t\t\t\n\t\t\t// TODO: Confirm slug is legal\n\t\t\t\t\n\t\t\t// Body //\n\t\t\t$body = $_POST['_body'];\t// TODO: Sanitize\n\t\t\t\n\t\t\t// Do we publish? //\n\t\t\t$publish = mb_strtolower($_POST['_publish']) == \"true\";\n\t\t\t\n\t\t\t// Email //\n\t\t\t$mail = sanitize_Email($_POST['_mail']);\n\t\t\tif ( empty($mail) ) return;\n\n\t\t\t// Password //\n\t\t\t$password = $_POST['_password'];\n\t\t\tif ( empty($password) ) return;\n\n\t\n\t\t\t$id = node_Add(\n\t\t\t\t$type,$subtype,$slug,$name,$body,\n\t\t\t\t0,2,\n\t\t\t\t$publish\n\t\t\t);\n\t\t\t\n\t\t\tuser_Add($id,$mail,$password);\n\t\n\t\t\techo \"Added \" . $id . \".<br />\";\n\t\t\techo \"<br />\";\n\t\t}\n\t}",
"function mongo_node_form_validate(&$form, &$form_state) {\n $entity_type = $form_state['entity_type'];\n $entity = $form_state[$entity_type];\n field_attach_form_validate($entity_type, $entity, $form, $form_state);\n}",
"function mongo_node_bundle_delete_form_submit($form, $form_state) {\n $set = mongo_node_settings();\n\n $entity_type = $form_state['values']['entity_type'];\n $bundle = $form_state['values']['bundle'];\n\n // Remove entity type.\n unset($set[$entity_type]['bundles'][$bundle]);\n\n mongo_node_settings_save($set);\n\n // Redirect to entity type admin.\n drupal_goto('admin/structure/mongo-node/' . $entity_type);\n}",
"function node_form(&$form_state, $node) {\n global $user;\n\n if (isset($form_state['node'])) {\n $node = $form_state['node'] + (array)$node;\n }\n if (isset($form_state['node_preview'])) {\n $form['#prefix'] = $form_state['node_preview'];\n }\n $node = (object)$node;\n foreach (array('body', 'title', 'format') as $key) {\n if (!isset($node->$key)) {\n $node->$key = NULL;\n }\n }\n if (!isset($form_state['node_preview'])) {\n node_object_prepare($node);\n }\n else {\n $node->build_mode = NODE_BUILD_PREVIEW;\n }\n\n // Set the id of the top-level form tag\n $form['#id'] = 'node-form';\n\n // Basic node information.\n // These elements are just values so they are not even sent to the client.\n foreach (array('nid', 'vid', 'uid', 'created', 'type', 'language') as $key) {\n $form[$key] = array(\n '#type' => 'value',\n '#value' => isset($node->$key) ? $node->$key : NULL,\n );\n }\n\n // Changed must be sent to the client, for later overwrite error checking.\n $form['changed'] = array(\n '#type' => 'hidden',\n '#default_value' => isset($node->changed) ? $node->changed : NULL,\n );\n // Get the node-specific bits.\n if ($extra = node_invoke($node, 'form', $form_state)) {\n $form = array_merge_recursive($form, $extra);\n }\n if (!isset($form['title']['#weight'])) {\n $form['title']['#weight'] = -5;\n }\n\n $form['#node'] = $node;\n\n // Add a log field if the \"Create new revision\" option is checked, or if the\n // current user has the ability to check that option.\n if (!empty($node->revision) || user_access('administer nodes')) {\n $form['revision_information'] = array(\n '#type' => 'fieldset',\n '#title' => t('Revision information'),\n '#collapsible' => TRUE,\n // Collapsed by default when \"Create new revision\" is unchecked\n '#collapsed' => !$node->revision,\n '#weight' => 20,\n );\n $form['revision_information']['revision'] = array(\n '#access' => user_access('administer nodes'),\n '#type' => 'checkbox',\n '#title' => t('Create new revision'),\n '#default_value' => $node->revision,\n );\n $form['revision_information']['log'] = array(\n '#type' => 'textarea',\n '#title' => t('Log message'),\n '#default_value' => (isset($node->log) ? $node->log : ''),\n '#rows' => 2,\n '#description' => t('An explanation of the additions or updates being made to help other authors understand your motivations.'),\n );\n }\n\n // Node author information for administrators\n $form['author'] = array(\n '#type' => 'fieldset',\n '#access' => user_access('administer nodes'),\n '#title' => t('Authoring information'),\n '#collapsible' => TRUE,\n '#collapsed' => TRUE,\n '#weight' => 20,\n );\n $form['author']['name'] = array(\n '#type' => 'textfield',\n '#title' => t('Authored by'),\n '#maxlength' => 60,\n '#autocomplete_path' => 'user/autocomplete',\n '#default_value' => $node->name ? $node->name : '',\n '#weight' => -1,\n '#description' => t('Leave blank for %anonymous.', array('%anonymous' => variable_get('anonymous', t('Anonymous')))),\n );\n $form['author']['date'] = array(\n '#type' => 'textfield',\n '#title' => t('Authored on'),\n '#maxlength' => 25,\n '#description' => t('Format: %time. Leave blank to use the time of form submission.', array('%time' => !empty($node->date) ? $node->date : format_date($node->created, 'custom', 'Y-m-d H:i:s O'))),\n );\n\n if (isset($node->date)) {\n $form['author']['date']['#default_value'] = $node->date;\n }\n\n // Node options for administrators\n $form['options'] = array(\n '#type' => 'fieldset',\n '#access' => user_access('administer nodes'),\n '#title' => t('Publishing options'),\n '#collapsible' => TRUE,\n '#collapsed' => TRUE,\n '#weight' => 25,\n );\n $form['options']['status'] = array(\n '#type' => 'checkbox',\n '#title' => t('Published'),\n '#default_value' => $node->status,\n );\n $form['options']['promote'] = array(\n '#type' => 'checkbox',\n '#title' => t('Promoted to front page'),\n '#default_value' => $node->promote,\n );\n $form['options']['sticky'] = array(\n '#type' => 'checkbox',\n '#title' => t('Sticky at top of lists'),\n '#default_value' => $node->sticky,\n );\n\n // These values are used when the user has no administrator access.\n foreach (array('uid', 'created') as $key) {\n $form[$key] = array(\n '#type' => 'value',\n '#value' => $node->$key,\n );\n }\n\n // Add the buttons.\n $form['buttons'] = array();\n $form['buttons']['submit'] = array(\n '#type' => 'submit',\n '#access' => !variable_get('node_preview', 0) || (!form_get_errors() && isset($form_state['node_preview'])),\n '#value' => t('Save'),\n '#weight' => 5,\n '#submit' => array('node_form_submit'),\n );\n $form['buttons']['preview'] = array(\n '#type' => 'submit',\n '#value' => t('Preview'),\n '#weight' => 10,\n '#submit' => array('node_form_build_preview'),\n );\n if (!empty($node->nid) && node_access('delete', $node)) {\n $form['buttons']['delete'] = array(\n '#type' => 'submit',\n '#value' => t('Delete'),\n '#weight' => 15,\n '#submit' => array('node_form_delete_submit'),\n );\n }\n $form['#validate'][] = 'node_form_validate';\n $form['#theme'] = array($node->type .'_node_form', 'node_form');\n return $form;\n}",
"function ds_extras_vd_bundle_form_submit($form, &$form_state) {\n\n // Save new bundle.\n $record = new stdClass();\n $record->vd = $form_state['values']['vd'];\n $record->label = $form['vd']['#options'][$record->vd];\n drupal_write_record('ds_vd', $record);\n\n // Clear entity cache and field info fields cache.\n cache_clear_all('field_info_fields', 'cache_field');\n cache_clear_all('entity_info', 'cache', TRUE);\n\n // Message and redirect.\n drupal_set_message(t('Bundle @label has been added.', array('@label' => $record->label)));\n $form_state['redirect'] = 'admin/structure/ds/vd';\n}",
"public function createForm() {\n module_load_include('inc', 'islandora_form_builder', 'FormGenerator');\n $form_values = &$this->formState['values'];\n $file = isset($form_values['ingest-file-location']) ? $form_values['ingest-file-location'] : '';\n $form['#attributes']['enctype'] = 'multipart/form-data';\n $form['indicator']['ingest-file-location'] = array(\n '#type' => 'file',\n '#title' => t('Upload Document'),\n '#size' => 48,\n '#description' => t('Select file to be added the the object.'),\n );\n $form_generator = FormGenerator::CreateFromModel($this->contentModelPid, $this->contentModelDsid);\n $form[FORM_ROOT] = $form_generator->generate($this->formName); // TODO get from user .\n $form['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Ingest'),\n '#prefix' => t('Please be patient. Once you click next there may be a number of files created. ' .\n 'Depending on your content model this could take a few minutes to process.<br />')\n );\n return $form;\n }",
"function mongo_node_type_edit_form_submit($form, $form_state) {\n $label = $form_state['values']['label'];\n $machine_name = $form_state['values']['name'];\n $old_entity_type = $form_state['values']['entity_type'];\n\n $set = mongo_node_settings();\n\n if ($machine_name != $old_entity_type) {\n $set += mongo_node_type_default_settings($label, $machine_name);\n $set[$machine_name] = $set[$old_entity_type];\n unset($set[$old_entity_type]);\n\n // Update existing mongo entities with new entity type.\n _mongo_node_update_type($old_entity_type, $machine_name);\n }\n else {\n $set[$machine_name]['label'] = $label;\n }\n\n // Save settings.\n mongo_node_settings_save($set);\n return TRUE;\n}",
"function happywedding_node_form_submit($form, &$form_state) {\n global $user;\n //dpm($user);\n if ( !empty($form_state['nid']) && isset($_GET['vendor'] ) ) {\n \n $type = $form['type']['#value'];\n if (in_array('vendor', $user->roles)) {\n $basepath = 'bo/vendor/';\n } else {\n $basepath = 'node/';\n }\n //dpm($form);\n if($type=='news')\n $form_state['redirect'] = $basepath.$_GET['vendor'].'/'.$type;\n else if($type=='product') {\n $query = array('category' => array());\n foreach($form[\"field_product_category\"][\"und\"][\"#value\"] as $key => $value){\n $query[\"category\"][] = $key; \n }\n $form_state['redirect'] = array( \n $basepath.$_GET['vendor'].'/categories/'.$type.'s' ,\n array('query' => $query ) \n );\n //dpm($form_state['redirect']);\n }else\n $form_state['redirect'] = $basepath.$_GET['vendor'].'/'.$type.'s';\n }\n}",
"function mongo_node_bundle_delete_form($form, $form_state, $entity_type, $bundle) {\n $form = array();\n\n $form['entity_type'] = array(\n '#type' => 'value',\n '#value' => $entity_type,\n );\n $form['bundle'] = array(\n '#type' => 'value',\n '#value' => $bundle,\n );\n\n $path = '/admin/structure/mongo-node/' . $entity_type;\n\n $extist_bundle_content = '';\n $collection = mongodb_collection('fields_current', $entity_type);\n $count = $collection->count(array('_type' => $entity_type, '_bundle' => $bundle));\n if ($count) {\n $extist_bundle_content = t('%bundle is used by %count piece of content on your site. If you remove this bundle, you will not be able to edit the %bundle content and it may not display correctly.', array('%bundle' => $bundle, '%count' => $count));\n $extist_bundle_content .= '<br/><br/>';\n }\n\n return confirm_form($form, t('Delete entity bundle'), $path, $extist_bundle_content . 'This action cannot be undone', t('Delete'), t('Cancel'), 'mongo_node_bundle_delete');\n}",
"public function newAction()\n {\n //Get the entity manager.\n $em = $this->get('doctrine.orm.entity_manager'); \n \n //Get the list of categories as an array. \n $categories = $em->getRepository('JobeetBundle:JobeetCategory')\n ->getCategoriesAsOptions(); \n \n //Set up the form.\n $job = new JobeetJob();\n $form = JobForm::create($categories, $job, $this->get('validator')); \n \n //If a POST, process the form and persist it if valid.\n $request = $this->get('request');\n if ('POST' === $request->getMethod()) {\n //Register an event subscriber to index the job.\n $em->getEventManager()->addEventSubscriber(new LuceneListener($this->get('lucene_search')));\n \n $params = $request->request->get('job'); \n \n //Get the category object.\n $params['category'] = $em->getReference('JobeetBundle:JobeetCategory', $params['category']); \n \n //TODO:VALIDATE HERE\n \n //Get uploaded files and bind the form.\n $files = $request->files->get('job'); \n //unset($params['category_id']);\n $form->bind($params, $files);\n \n //If there is a logo uploaded, move it to the uploads dir.\n if($files['logo']['file']) { \n $name = uniqid().'-'.$files['logo']['file']->getOriginalName();\n $files['logo']['file']->move($this->container->getParameter('frontend.logos_dir')); \n $files['logo']['file']->rename($name); \n }\n else {\n $name = '';\n } \n \n //Set the logo filename and persist the entity.\n $job->setLogo($name); \n $em->persist($job); \n $em->flush();\n }\n \n return $this->render('FrontendBundle:Job:new.twig', array('form' => $form));\n }",
"public function createAction()\n {\n $entity = new Node();\n $request = $this->getRequest();\n $form = $this->createForm(new NodeType(), $entity);\n $form->bindRequest($request);\n\n if ($form->isValid()) {\n $em = $this->getDoctrine()->getEntityManager();\n $em->persist($entity);\n $em->flush();\n $this->get('session')->setFlash('notice', 'Los cambios se realizaron correctamente.');\n return $this->redirect($this->generateUrl('node_show', array('id' => $entity->getId())));\n \n }\n\n return $this->render('HegesAppNodeBundle:Node:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView()\n ));\n }",
"function process() {\n // We always call the parent's method\n parent::process();\n $d = $this->getDocument();\n \n // We pass the form our request object and the location of us so the form\n // will make us handle the input (as actually we take care of processing\n // this form) - it could link to any other action as long as it is aware\n // of the form\n $form = new Form($this->getRequest(), new Location($this), Request::METHOD_POST);\n \n // This is how you prepare values for the radio buttons\n $radios = array('visa', 'master');\n \n // This is how we prepare the fields\n $form->addField('text1', new TextInputField('Your name here please', \n new RegexValidator('^[[:alpha:]]+[[:space:]][[:alpha:]]+$')));\n $form->addField('pass1', \n new TextInputField('', new RegexValidator('^[[:digit:]]{16}$'), TextInputField::PASSWORD));\n $form->addField('text2', new TextInputField('', null, TextInputField::TEXTAREA));\n $form->addField('check1', new CheckBoxInputField());\n $form->addField('payment', new RadioButtonInputField('visa', $radios));\n \n // Here we test if the form was correctly submitted\n if($form->isValidSubmission()) {\n // Normally, we would do something useful here and redirect to another page\n // since this form uses the POST method\n $d->setVariable('success', true);\n }\n \n // Here we place the form into the document variable so it can process it\n $d->setVariable('form', $form);\n }",
"public function createForm();",
"public function createForm();",
"function mongo_node_type_edit_form($form, $form_state, $entity_type) {\n $set = mongo_node_settings();\n $form = array();\n\n $form['label'] = array(\n '#type' => 'textfield',\n '#title' => t('Entity type'),\n '#default_value' => $set[$entity_type]['label'],\n '#description' => t('The human readable name of the entity.'),\n );\n\n $form['name'] = array(\n '#type' => 'machine_name',\n '#required' => FALSE,\n '#default_value' => $entity_type,\n '#machine_name' => array(\n 'exists' => '_mongo_node_type_exists',\n 'source' => array('label'),\n ),\n );\n\n // Send entity type.\n $form['entity_type'] = array(\n '#type' => 'value',\n '#value' => $entity_type,\n );\n\n $form['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save'),\n );\n\n return $form;\n}",
"function scfnode_form_add_association(&$form_state, $nid, $name) {\n $form = array();\n /*$form['cancel'] = array(\n '#type' => 'image_button',\n '#src' => drupal_get_path('module', 'scf') . '/images/icon-x.gif',\n '#attributes' => array(\n 'onclick' => \"$('#association-addtermdiv-\" . $name . \"').slideUp('slow');return false;\"\n ),\n '#executes_submit_callback' => FALSE,\n '#title' => 'Close'\n );*/\n \n /*$form['caption'] = array(\n '#type' => 'markup',\n '#value' => t('Add new term:')\n );*/\n \n $form['textfield'] = array(\n '#type' => 'textfield',\n '#autocomplete_path' => $name . '/autocomplete/title',\n '#size' => 20,\n '#id' => 'association-' . $name . '-text',\n '#name' => 'textfield',\n );\n $form['add'] = array(\n '#type' => 'button',\n '#value' => t('Add'),\n '#ahah' => array(\n 'path' => 'association/ajax/add/' . $nid . '/' . $name . '/',\n 'wrapper' => 'association-list-' . $name,\n 'event' => 'click',\n 'effect' => 'slide',\n 'method' => 'append',\n 'progress' => 'none',\n ),\n '#executes_submit_callback' => FALSE\n );\n \n $form['nid'] = array(\n '#type' => 'value',\n '#value' => $nid\n );\n return $form;\n }",
"public function get_create(array $args)\n { \n $node = $this->request->get_node();\n if ($node instanceof midgardmvc_core_providers_hierarchy_node_midgard2)\n {\n // If we have a Midgard node we can assign that as a \"default parent\"\n $this->data['parent'] = $node->get_object();\n }\n\n // Prepare the new object that form will eventually create\n $this->prepare_new_object($args);\n $this->data['object'] =& $this->object;\n\n if (isset($this->data['parent']))\n {\n midgardmvc_core::get_instance()->authorization->require_do('midgard:create', $this->data['parent']);\n }\n\n $this->load_form();\n $this->data['form'] =& $this->form;\n }",
"abstract public function createForm();",
"abstract public function createForm();",
"protected function processForm(sfWebRequest $request, sfForm $form) {\n $collectionId = sfToolkit::getArrayValueForPath($form->getName(), 'parent_node_id');\n $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));\n if ($form->isValid()) {\n $asset_group = $form->save();\n\n $this->redirect('assetgroup/edit?id=' . $asset_group->getId() . '&c=' . $form->getOption('collectionID'));\n }\n }",
"function node_form_submit_build_node($form, &$form_state) {\n // Unset any button-level handlers, execute all the form-level submit\n // functions to process the form values into an updated node.\n unset($form_state['submit_handlers']);\n form_execute_handlers('submit', $form, $form_state);\n $node = node_submit($form_state['values']);\n $form_state['node'] = (array)$node;\n $form_state['rebuild'] = TRUE;\n return $node;\n}"
]
| [
"0.77444345",
"0.7322824",
"0.7106233",
"0.7082012",
"0.6999719",
"0.6659567",
"0.6641731",
"0.6170207",
"0.61485773",
"0.61443996",
"0.61306095",
"0.6128872",
"0.612424",
"0.6100041",
"0.60700536",
"0.60196453",
"0.59921896",
"0.5978814",
"0.5967667",
"0.5955421",
"0.5953872",
"0.5953631",
"0.5953631",
"0.58987486",
"0.5879178",
"0.58722025",
"0.58614105",
"0.58614105",
"0.585374",
"0.5847335"
]
| 0.7590311 | 1 |
Form submission handler for mongo_node_bundle_edit_form(). | function mongo_node_bundle_edit_form_submit($form, $form_state) {
$label = $form_state['values']['label'];
$machine_name = $form_state['values']['name'];
$entity_type = $form_state['values']['bundle_type']['entity_type'];
$old_bundle_type = $form_state['values']['bundle_type']['bundle'];
$description = $form_state['values']['description'];
$set = mongo_node_settings();
if ($machine_name != $old_bundle_type) {
$set[$entity_type]['bundles'] += mongo_node_bundle_default_settings($label, $machine_name, $description);
$set[$entity_type]['bundles'][$machine_name] = $set[$entity_type]['bundles'][$old_bundle_type];
unset($set[$entity_type]['bundles'][$old_bundle_type]);
// Update existing mongo entities with new bundle.
//_mongo_node_update_bundle($entity_type, $old_bundle_type, $machine_name);
}
else {
$set[$entity_type]['bundles'][$machine_name]['label'] = $label;
$set[$entity_type]['bundles'][$machine_name]['description'] = $description;
}
// Save settings.
mongo_node_settings_save($set);
return TRUE;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function mongo_node_bundle_edit_form($form, $form_state, $entity_type, $bundle) {\n\n $set = mongo_node_settings();\n\n $form = array();\n\n $form['label'] = array(\n '#type' => 'textfield',\n '#title' => t('Entity type'),\n '#default_value' => $set[$entity_type]['bundles'][$bundle]['label'],\n '#description' => t('The human readable name of the entity.'),\n );\n\n $form['name'] = array(\n '#type' => 'machine_name',\n '#required' => FALSE,\n '#default_value' => $bundle,\n '#machine_name' => array(\n 'exists' => '_mongo_node_bundle_exists',\n 'source' => array('label'),\n ),\n );\n\n $description = isset($set[$entity_type]['bundles'][$bundle]['description']) ? $set[$entity_type]['bundles'][$bundle]['description'] : '';\n $form['description'] = array(\n '#type' => 'textarea',\n '#title' => t('Description'),\n '#default_value' => $description,\n '#description' => t('Describe this bundle.'),\n );\n\n // Save entity type and bundle.\n $form['bundle_type'] = array(\n '#type' => 'value',\n '#value' => array(\n 'entity_type' => $entity_type,\n 'bundle' => $bundle,\n ),\n );\n\n $form['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save'),\n );\n\n return $form;\n}",
"function mongo_node_form_submit(&$form, &$form_state) {\n $entity_type = $form_state['entity_type'];\n $entity = entity_ui_controller($entity_type)->entityFormSubmitBuildEntity($form, $form_state);\n $insert = empty($entity->mid);\n entity_save($entity_type, $entity);\n\n $info = entity_get_info($entity_type);\n $bundle_key = $info['bundle keys']['bundle'];\n $bundle_label = $info['bundles'][$entity->{$bundle_key}]['label'];\n\n if ($insert) {\n drupal_set_message(t('@label %title has been created.',\n array(\n '@label' => $bundle_label,\n '%title' => $entity->title,\n )\n )\n );\n }\n else {\n drupal_set_message(t('@label %title has been updated.',\n array(\n '@label' => $bundle_label,\n '%title' => $entity->title,\n )\n )\n );\n }\n\n $uri = entity_uri($entity_type, $entity);\n $form_state['redirect'] = drupal_get_path_alias($uri['path']);\n}",
"function mongo_node_form($form, &$form_state, $entity, $entity_type) {\n $form = array();\n\n $form_state['entity_type'] = $entity_type;\n if (!isset($form_state[$entity_type])) {\n $form_state[$entity_type] = $entity;\n }\n else {\n $entity = $form_state[$entity_type];\n }\n\n // Get title label name from properties if exists\n static $settings = array();\n if(empty($settings)) {\n $settings = mongo_node_settings();\n }\n $title = isset($settings[$entity_type]['properties']['title']['label']) ? $settings[$entity_type]['properties']['title']['label'] : t('Title');\n\n $form['title'] = array(\n '#type' => 'textfield',\n '#title' => $title,\n '#required' => TRUE,\n '#default_value' => isset($entity->title) ? $entity->title : '',\n );\n\n $form['#attributes']['class'][] = 'mongo-node-form';\n if (!empty($entity->type)) {\n // TODO -- add entity type with bundle.\n $form['#attributes']['class'][] = 'mongo-node-' . $entity->type . '-form';\n }\n\n $form['actions'] = array('#type' => 'actions');\n $form['actions']['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save'),\n '#weight' => 5,\n '#submit' => array('mongo_node_form_submit'),\n );\n\n $form['#validate'][] = 'mongo_node_form_validate';\n field_attach_form($entity_type, $entity, $form, $form_state);\n\n return $form;\n}",
"function mongo_node_type_edit_form($form, $form_state, $entity_type) {\n $set = mongo_node_settings();\n $form = array();\n\n $form['label'] = array(\n '#type' => 'textfield',\n '#title' => t('Entity type'),\n '#default_value' => $set[$entity_type]['label'],\n '#description' => t('The human readable name of the entity.'),\n );\n\n $form['name'] = array(\n '#type' => 'machine_name',\n '#required' => FALSE,\n '#default_value' => $entity_type,\n '#machine_name' => array(\n 'exists' => '_mongo_node_type_exists',\n 'source' => array('label'),\n ),\n );\n\n // Send entity type.\n $form['entity_type'] = array(\n '#type' => 'value',\n '#value' => $entity_type,\n );\n\n $form['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save'),\n );\n\n return $form;\n}",
"function mongo_node_type_edit_form_submit($form, $form_state) {\n $label = $form_state['values']['label'];\n $machine_name = $form_state['values']['name'];\n $old_entity_type = $form_state['values']['entity_type'];\n\n $set = mongo_node_settings();\n\n if ($machine_name != $old_entity_type) {\n $set += mongo_node_type_default_settings($label, $machine_name);\n $set[$machine_name] = $set[$old_entity_type];\n unset($set[$old_entity_type]);\n\n // Update existing mongo entities with new entity type.\n _mongo_node_update_type($old_entity_type, $machine_name);\n }\n else {\n $set[$machine_name]['label'] = $label;\n }\n\n // Save settings.\n mongo_node_settings_save($set);\n return TRUE;\n}",
"function mongo_node_bundle_delete_form_submit($form, $form_state) {\n $set = mongo_node_settings();\n\n $entity_type = $form_state['values']['entity_type'];\n $bundle = $form_state['values']['bundle'];\n\n // Remove entity type.\n unset($set[$entity_type]['bundles'][$bundle]);\n\n mongo_node_settings_save($set);\n\n // Redirect to entity type admin.\n drupal_goto('admin/structure/mongo-node/' . $entity_type);\n}",
"function mongo_node_bundle_create_form_submit($form, $form_state) {\n $entity_type = $form_state['values']['entity_type'];\n\n $label = $form_state['values']['label'];\n $machine_name = $form_state['values']['name'];\n $description = $form_state['values']['description'];\n\n $set = mongo_node_settings();\n $set[$entity_type]['bundles'] += mongo_node_bundle_default_settings($label, $machine_name, $description);\n\n // @todo - redirect to bundle type page.\n mongo_node_settings_save($set);\n}",
"function mongo_node_bundle_delete_form($form, $form_state, $entity_type, $bundle) {\n $form = array();\n\n $form['entity_type'] = array(\n '#type' => 'value',\n '#value' => $entity_type,\n );\n $form['bundle'] = array(\n '#type' => 'value',\n '#value' => $bundle,\n );\n\n $path = '/admin/structure/mongo-node/' . $entity_type;\n\n $extist_bundle_content = '';\n $collection = mongodb_collection('fields_current', $entity_type);\n $count = $collection->count(array('_type' => $entity_type, '_bundle' => $bundle));\n if ($count) {\n $extist_bundle_content = t('%bundle is used by %count piece of content on your site. If you remove this bundle, you will not be able to edit the %bundle content and it may not display correctly.', array('%bundle' => $bundle, '%count' => $count));\n $extist_bundle_content .= '<br/><br/>';\n }\n\n return confirm_form($form, t('Delete entity bundle'), $path, $extist_bundle_content . 'This action cannot be undone', t('Delete'), t('Cancel'), 'mongo_node_bundle_delete');\n}",
"function mongo_node_page_edit($entity_type, $entity) {\n $title = $entity->title;\n drupal_set_title($title);\n\n $content = array();\n $content = drupal_get_form('mongo_node_form', $entity, $entity_type);\n\n return $content;\n}",
"public function postEdit(NodeFormRequest $request)\n { \n // first we save the node model\n $node = $this->nodeModel->find($request->input('id'));\n \n // save the node model\n $node->type = $request->input('type');\n $node->title = $request->input('title');\n $node->save();\n \n $nodeType = $node->nodeType;\n if($nodeType) {\n // instantiate nodeType model\n $nodeType->nid = $request->input('id');\n $nodeType->body = $request->input('body');\n // save model\n $nodeType->save();\n } else{\n \n $this->nodeTypeModel->create($request->input());\n }\n // we will flash a notification\n Notification::success($request->input('type') . ' page has been updated');\n return redirect()->route('admin.home');\n }",
"protected function processEditForm(sfWebRequest $request, sfForm $form) {\n $collectionId = sfToolkit::getArrayValueForPath($form->getName(), 'parent_node_id');\n $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));\n if ($form->isValid()) {\n $asset_group = $form->save();\n $PostParams = $request->getPostParameters();\n\n $AssetInformatoin = Doctrine_Query::Create()\n ->from('AssetGroup a')\n ->select('a.*,ft.*')\n ->leftJoin('a.FormatType ft WITH ft.id=a.format_id')\n ->addWhere(\"ft.id = '\" . $PostParams['asset_group']['format_id'] . \"'\")\n ->fetchArray();\n\n $characteristicsValue = Doctrine_Query::Create()\n ->from('CharacteristicsValues cv')\n ->select('cv.*,cc.*,cf.*')\n ->leftJoin('cv.CharacteristicsConstraints cc')\n ->leftJoin('cv.CharacteristicsFormat cf')\n ->addWhere(\"cv.format_id = '\" . $AssetInformatoin[0]['FormatType']['type'] . \"'\")\n ->fetchArray();\n\n #Move copies to the end to check the total score if score is greater then 90 and less then 12 , copies score wont apply \n $copiesValue = NULL;\n $copieExist = FALSE;\n foreach ($characteristicsValue as $key => $SingleValue) {\n if ($SingleValue['c_name'] == 'copies') {\n $copiesValue = $SingleValue;\n $copieExist = TRUE;\n unset($characteristicsValue[$key]);\n }\n }\n $characteristicsValue[] = $copiesValue;\n\n #Loading Socre Calculater Library \n $ScoreCalculator = new scoreCalculator();\n $score = $ScoreCalculator->callFormatCalculator($AssetInformatoin, $characteristicsValue);\n\n #If Score is Greater Then 90 And Less Then 12 , Deduct Copies Score From Total\n if ($copieExist && isset($score['score']) && ($score['score'] >= 90 || $score['score'] <= 12)) {\n if ($AssetInformatoin[0]['FormatType']['copies'] == 1) {\n $scoreTotal = (float) $score['score'] - (float) $copiesValue['c_score'];\n if ($scoreTotal > 100) {\n $scoreTotal = 100;\n }\n $score['scoreRounded'] = round((float) $scoreTotal / 20, 2);\n $score['score'] = (float) $scoreTotal;\n }\n }\n if ($score != FALSE) {\n $update = Doctrine_Query::create()\n ->update('FormatType ')\n ->set('asset_score', '?', $score['scoreRounded'])\n ->where('id = ?', $AssetInformatoin[0]['FormatType']['id'])\n ->execute();\n echo 'Done';\n } else {\n echo 'calculator not found for this format type';\n }\n\n return true;\n }\n return false;\n }",
"public function EditNodeAction() {\n\n if ($_SESSION['usuarioPortal']['IdPerfil'] == '1') {\n\n switch ($this->request['METHOD']) {\n\n case 'GET':\n\n $tipo = $this->request['3'];\n $ambito = $this->request['2'];\n $nombre = $this->request['4'];\n $columna = $this->request['5'];\n $titulo = \"Variables {$this->request['3']} de '{$columna}'\";\n\n $variables = new Variables($ambito, $tipo, $nombre);\n $variablesColumna = $variables->getColumn($columna);\n unset($variables);\n\n $archivoConfig = new Form($nombre);\n $columnasConfig = $archivoConfig->getNode('columns');\n unset($archivoConfig);\n $datos = $this->ponAtributos($variablesColumna, $columnasConfig[$columna]);\n\n $this->values['titulo'] = $titulo;\n $this->values['tipo'] = $tipo;\n $this->values['ambito'] = $ambito;\n $this->values['nombre'] = $nombre;\n $this->values['columna'] = $columna;\n $this->values['d'] = $datos;\n\n $template = $this->entity . '/formPlantillaVariables.html.twig';\n break;\n\n case 'POST':\n\n $tipo = $this->request['tipo'];\n $ambito = $this->request['ambito'];\n $nombre = $this->request['nombre'];\n $columna = $this->request['columna'];\n $titulo = \"Variables {$tipo} de '{$columna}'\";\n\n $variables = new Variables($ambito, $tipo, $nombre);\n $variables->setColumn($columna, $this->request['d']);\n $variables->save();\n\n $this->values['titulo'] = $titulo;\n $this->values['tipo'] = $tipo;\n $this->values['ambito'] = $ambito;\n $this->values['nombre'] = $nombre;\n $this->values['columna'] = $columna;\n $this->values['errores'] = $variables->getErrores();\n\n $archivoConfig = new Form($nombre);\n $columnasConfig = $archivoConfig->getNode('columns');\n unset($archivoConfig);\n $datos = $this->ponAtributos($variables->getColumn($columna), $columnasConfig[$columna]);\n $this->values['d'] = $datos;\n unset($variables);\n\n $template = $this->entity . '/formPlantillaVariables.html.twig';\n break;\n }\n } else\n $template = '_global/forbiden.html.twig';\n\n return array('template' => $template, 'values' => $this->values);\n }",
"function mongo_node_bundle_create_form($form, $form_state, $entity_type) {\n $form = array();\n\n $form['label'] = array(\n '#type' => 'textfield',\n '#title' => t('Entity type'),\n '#description' => t('The human readable name of the entity.'),\n );\n\n $form['name'] = array(\n '#type' => 'machine_name',\n '#required' => FALSE,\n '#machine_name' => array(\n 'exists' => '_mongo_node_bundle_exists',\n 'source' => array('label'),\n ),\n );\n\n $form['description'] = array(\n '#type' => 'textarea',\n '#title' => t('Description'),\n '#description' => t('Describe this bundle.'),\n );\n\n $form['entity_type'] = array(\n '#type' => 'value',\n '#value' => $entity_type,\n );\n\n $form['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save'),\n );\n\n return $form;\n}",
"function doEdit()\n {\n $dt = new lmbDate();\n $this->dt_up = $dt->getStamp();\n\n $node_id = $this->request->getInteger('id');\n $this->node = $node_id;\n $category['node_id'] = $node_id;\n $category['title'] = TreeItem::getAttrValueByNodeId($node_id, TreeItem::ID_TITLE);\n $category['description'] = TreeItem::getAttrValueByNodeId($node_id, TreeItem::ID_DESCR);\n $category['identifier'] = TreeItem::getAttrValueByNodeId($node_id, TreeItem::ID_URI);\n\n $this->dt_cr = TreeItem::getAttrValueByNodeId($node_id, TreeItem::ID_CREATE_DATE);\n $category['date_create'] = TreeItem::getAttrValueByNodeId($node_id, TreeItem::ID_CREATE_DATE);\n $category['date_update'] = TreeItem::getAttrValueByNodeId($node_id, TreeItem::ID_UPDATE_DATE);\n $category['is_branch'] = TreeItem::getIsBranchByNodeId($node_id);\n\n $this->setFormDatasource($category, 'object_form');\n\n if($this->request->hasPost())\n {\n $this->_validateAndSave(false);\n //$this->_onAfterSave();\n }\n }",
"function doEdit()\n {\n $dt = new lmbDate();\n $this->dt_up = $dt->getStamp();\n\n $node_id = $this->request->getInteger('id');\n $node['node_id'] = $node_id;\n $node['title'] = TreeItem::getAttrValueByNodeId($node_id, TreeItem::ID_TITLE);\n $node['description'] = TreeItem::getAttrValueByNodeId($node_id, TreeItem::ID_DESCR);\n $node['identifier'] = TreeItem::getAttrValueByNodeId($node_id, TreeItem::ID_URI);\n $node['price'] = TreeItem::getAttrValueByNodeId($node_id, TreeItem::ID_PRICE);\n\n $this->dt_cr = TreeItem::getAttrValueByNodeId($node_id, TreeItem::ID_CREATE_DATE);\n $node['date_create'] = TreeItem::getAttrValueByNodeId($node_id, TreeItem::ID_CREATE_DATE);\n $node['date_update'] = TreeItem::getAttrValueByNodeId($node_id, TreeItem::ID_UPDATE_DATE);\n $node['is_branch'] = TreeItem::getIsBranchByNodeId($node_id);\n\n $this->setFormDatasource($node, 'object_form');\n\n $criteria = new lmbSQLFieldCriteria('is_branch', 1);\n $criteria->addAnd('attr_id = '. TreeItem::ID_TITLE );\n $this->items = lmbActiveRecord :: find('TreeItem', $criteria);\n\n\n if($this->request->hasPost())\n {\n $this->_validateAndSave(false);\n //$this->_onAfterSave();\n }\n }",
"function elife_article_markup_doi_edit_form_submit(&$form, &$form_state) {\n // Nothing.\n}",
"function node_form(&$form_state, $node) {\n global $user;\n\n if (isset($form_state['node'])) {\n $node = $form_state['node'] + (array)$node;\n }\n if (isset($form_state['node_preview'])) {\n $form['#prefix'] = $form_state['node_preview'];\n }\n $node = (object)$node;\n foreach (array('body', 'title', 'format') as $key) {\n if (!isset($node->$key)) {\n $node->$key = NULL;\n }\n }\n if (!isset($form_state['node_preview'])) {\n node_object_prepare($node);\n }\n else {\n $node->build_mode = NODE_BUILD_PREVIEW;\n }\n\n // Set the id of the top-level form tag\n $form['#id'] = 'node-form';\n\n // Basic node information.\n // These elements are just values so they are not even sent to the client.\n foreach (array('nid', 'vid', 'uid', 'created', 'type', 'language') as $key) {\n $form[$key] = array(\n '#type' => 'value',\n '#value' => isset($node->$key) ? $node->$key : NULL,\n );\n }\n\n // Changed must be sent to the client, for later overwrite error checking.\n $form['changed'] = array(\n '#type' => 'hidden',\n '#default_value' => isset($node->changed) ? $node->changed : NULL,\n );\n // Get the node-specific bits.\n if ($extra = node_invoke($node, 'form', $form_state)) {\n $form = array_merge_recursive($form, $extra);\n }\n if (!isset($form['title']['#weight'])) {\n $form['title']['#weight'] = -5;\n }\n\n $form['#node'] = $node;\n\n // Add a log field if the \"Create new revision\" option is checked, or if the\n // current user has the ability to check that option.\n if (!empty($node->revision) || user_access('administer nodes')) {\n $form['revision_information'] = array(\n '#type' => 'fieldset',\n '#title' => t('Revision information'),\n '#collapsible' => TRUE,\n // Collapsed by default when \"Create new revision\" is unchecked\n '#collapsed' => !$node->revision,\n '#weight' => 20,\n );\n $form['revision_information']['revision'] = array(\n '#access' => user_access('administer nodes'),\n '#type' => 'checkbox',\n '#title' => t('Create new revision'),\n '#default_value' => $node->revision,\n );\n $form['revision_information']['log'] = array(\n '#type' => 'textarea',\n '#title' => t('Log message'),\n '#default_value' => (isset($node->log) ? $node->log : ''),\n '#rows' => 2,\n '#description' => t('An explanation of the additions or updates being made to help other authors understand your motivations.'),\n );\n }\n\n // Node author information for administrators\n $form['author'] = array(\n '#type' => 'fieldset',\n '#access' => user_access('administer nodes'),\n '#title' => t('Authoring information'),\n '#collapsible' => TRUE,\n '#collapsed' => TRUE,\n '#weight' => 20,\n );\n $form['author']['name'] = array(\n '#type' => 'textfield',\n '#title' => t('Authored by'),\n '#maxlength' => 60,\n '#autocomplete_path' => 'user/autocomplete',\n '#default_value' => $node->name ? $node->name : '',\n '#weight' => -1,\n '#description' => t('Leave blank for %anonymous.', array('%anonymous' => variable_get('anonymous', t('Anonymous')))),\n );\n $form['author']['date'] = array(\n '#type' => 'textfield',\n '#title' => t('Authored on'),\n '#maxlength' => 25,\n '#description' => t('Format: %time. Leave blank to use the time of form submission.', array('%time' => !empty($node->date) ? $node->date : format_date($node->created, 'custom', 'Y-m-d H:i:s O'))),\n );\n\n if (isset($node->date)) {\n $form['author']['date']['#default_value'] = $node->date;\n }\n\n // Node options for administrators\n $form['options'] = array(\n '#type' => 'fieldset',\n '#access' => user_access('administer nodes'),\n '#title' => t('Publishing options'),\n '#collapsible' => TRUE,\n '#collapsed' => TRUE,\n '#weight' => 25,\n );\n $form['options']['status'] = array(\n '#type' => 'checkbox',\n '#title' => t('Published'),\n '#default_value' => $node->status,\n );\n $form['options']['promote'] = array(\n '#type' => 'checkbox',\n '#title' => t('Promoted to front page'),\n '#default_value' => $node->promote,\n );\n $form['options']['sticky'] = array(\n '#type' => 'checkbox',\n '#title' => t('Sticky at top of lists'),\n '#default_value' => $node->sticky,\n );\n\n // These values are used when the user has no administrator access.\n foreach (array('uid', 'created') as $key) {\n $form[$key] = array(\n '#type' => 'value',\n '#value' => $node->$key,\n );\n }\n\n // Add the buttons.\n $form['buttons'] = array();\n $form['buttons']['submit'] = array(\n '#type' => 'submit',\n '#access' => !variable_get('node_preview', 0) || (!form_get_errors() && isset($form_state['node_preview'])),\n '#value' => t('Save'),\n '#weight' => 5,\n '#submit' => array('node_form_submit'),\n );\n $form['buttons']['preview'] = array(\n '#type' => 'submit',\n '#value' => t('Preview'),\n '#weight' => 10,\n '#submit' => array('node_form_build_preview'),\n );\n if (!empty($node->nid) && node_access('delete', $node)) {\n $form['buttons']['delete'] = array(\n '#type' => 'submit',\n '#value' => t('Delete'),\n '#weight' => 15,\n '#submit' => array('node_form_delete_submit'),\n );\n }\n $form['#validate'][] = 'node_form_validate';\n $form['#theme'] = array($node->type .'_node_form', 'node_form');\n return $form;\n}",
"function mongo_node_operation_submit($form, &$form_state) {\n $operations = mongo_node_operations();\n $operation = $operations[$form_state['values']['operation']];\n\n $entities = array_filter($form_state['values']['entities']);\n $entity_type = $form_state['values']['entity_type'];\n if ($function = $operation['callback']) {\n // Add in callback arguments if present.\n if (isset($operation['callback arguments'])) {\n $args = array(\n $entity_type,\n $entities,\n $operation['callback arguments'],\n );\n }\n else {\n $args = array($entity_type, $entities);\n }\n call_user_func_array($function, $args);\n cache_clear_all();\n }\n}",
"function mongo_node_admin_content($form, $form_state, $entity_type) {\n $settings = mongo_node_settings();\n\n // Send entity type.\n $form['entity_type'] = array(\n '#type' => 'value',\n '#value' => $entity_type,\n );\n\n $form['filters'] = array(\n '#type' => 'fieldset',\n '#title' => t('Show only items where'),\n );\n\n $filters = mongo_node_filters($entity_type);\n $applied_filters = isset($_SESSION[$entity_type . '_filters']) ? $_SESSION[$entity_type . '_filters'] : array();\n\n foreach ($filters as $f_type_name => $f_type) {\n $form['filters'][$f_type_name] = array('#type' => 'select', '#title' => $f_type_name);\n foreach ($f_type as $f_name => $f_val) {\n $form['filters'][$f_type_name]['#options'][$f_name] = $f_val['label'];\n }\n }\n\n $items = array();\n $remaining_filters = array();\n foreach ($applied_filters as $app_filter) {\n $items[] = t('where %f_name is %f_val', array('%f_name' => $app_filter['#type'], '%f_val' => $app_filter['#value']));\n $conditions = $filters[$app_filter['#type']][$app_filter['#value']]['filters'];\n foreach ($conditions as $condition) {\n $remaining_filters[$condition['#type']]['#callback'] = $condition['#callback'];\n $remaining_filters[$condition['#type']]['#value'][] = $condition['#value'];\n }\n }\n\n $form['filters']['#description'] = theme('item_list', array('items' => $items));\n\n if (empty($applied_filters)) {\n $form['filters']['filter'] = array(\n '#type' => 'submit',\n '#value' => 'Filter',\n '#submit' => array('mongo_node_filters_submit'),\n );\n }\n else {\n $form['filters']['refine'] = array(\n '#type' => 'submit',\n '#value' => 'Refine',\n '#submit' => array('mongo_node_filters_submit'),\n );\n $form['filters']['undo'] = array(\n '#type' => 'submit',\n '#value' => 'Undo',\n '#submit' => array('mongo_node_filters_submit'),\n );\n $form['filters']['reset'] = array(\n '#type' => 'submit',\n '#value' => 'Reset',\n '#submit' => array('mongo_node_filters_submit'),\n );\n }\n\n $form['options'] = array(\n '#type' => 'fieldset',\n '#title' => t('Update options'),\n );\n\n $operations = mongo_node_operations();\n foreach ($operations as $op => $op_set) {\n $options[$op] = $op_set['label'];\n }\n $form['options']['operation'] = array(\n '#type' => 'select',\n '#options' => $options,\n );\n\n $form['options']['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Update'),\n '#validate' => array('mongo_node_operation_validate'),\n '#submit' => array('mongo_node_operation_submit'),\n );\n\n $query = new EntityFieldQuery();\n\n $query->entityCondition('entity_type', $entity_type)\n ->propertyOrderBy('created', 'DESC')\n ->pager(10);\n\n // Actually apply filters.\n foreach ($remaining_filters as $r_name => $r_values) {\n $query->{$r_values['#callback']}($r_name, $r_values['#value'], 'IN');\n }\n\n $result = $query->execute();\n\n $languages = language_list();\n $destination = drupal_get_destination();\n $header = array(\n 'title' => array('data' => t('Title'), 'field' => 'title'),\n 'type' => t('Type'),\n 'author' => t('Author'),\n 'status' => t('Status'),\n 'changed' => t('Updated'),\n 'language' => t('Language'),\n 'operations' => t('Operations'),\n );\n $options = array();\n\n if (isset($result[$entity_type])) {\n $ids = array_keys($result[$entity_type]);\n $entities = entity_load($entity_type, $ids);\n\n foreach ($result[$entity_type] as $id => $efq_entity) {\n $entity = entity_load($entity_type, array($id));\n $entity = reset($entity);\n\n $entity_uri = entity_uri($entity_type, $entity);\n\n $options[$id] = array(\n 'title' => array(\n 'data' => array(\n '#type' => 'link',\n '#title' => $entity->title,\n '#href' => $entity_uri['path'],\n ),\n ),\n 'type' => check_plain($settings[$entity_type]['bundles'][$entity->type]['label']),\n 'author' => theme('username', array('account' => $entity)),\n 'status' => $entity->status ? t('published') : t('not published'),\n 'changed' => format_date($entity->changed, 'short'),\n 'language' => ($entity->language == LANGUAGE_NONE) ? t('Language neutral') : $languages[$entity->language]->name,\n );\n\n $operations = array();\n $operations[] = l(t('edit'), $entity_uri['path'] . '/edit', array('query' => $destination));\n $operations[] = l(t('delete'), $entity_uri['path'] . '/delete', array('query' => $destination));\n\n $options[$id]['operations'] = theme('item_list', array('items' => $operations, 'attributes' => array('class' => 'inline')));\n }\n }\n\n $form['entities'] = array(\n '#type' => 'tableselect',\n '#header' => $header,\n '#options' => $options,\n '#empty' => t('No content available'),\n );\n\n $form['pager'] = array(\n '#theme' => 'pager',\n );\n\n return $form;\n}",
"function ctools_block_content_type_edit_form_submit(&$form, &$form_state) {\n if (empty($form_state['subtype']) && isset($form_state['pane'])) {\n $form_state['pane']->subtype = $form_state['conf']['module'] . '-' . $form_state['conf']['delta'];\n unset($form_state['conf']['module']);\n unset($form_state['conf']['delta']);\n }\n}",
"function mongo_node_page_delete_submit($form, &$form_state) {\n if ($form_state['values']['confirm']) {\n $entity = $form['#entity'];\n $entity->delete();\n\n $entity_type = $entity->entityType();\n $info = entity_get_info($entity_type);\n $bundle_key = $info['bundle keys']['bundle'];\n $bundle_label = $info['bundles'][$entity->{$bundle_key}]['label'];\n\n drupal_set_message(t('@label %title deleted',\n array(\n '@label' => $bundle_label,\n '%title' => $entity->title)\n )\n );\n }\n\n $form_state['redirect'] = '<front>';\n}",
"public function updateSubmitHandler(array &$form, FormStateInterface $form_state) {\n $node_id = $form_state->getValue('article_title');\n $node = Node::load($node_id);\n $node->setSticky($form_state->getValue('sticky'));\n $node->setPublished($form_state->getValue('status'));\n $node->save();\n }",
"public function editAction() {\n if($this->_getParam('id',false)) {\n $form = new ContentForm();\n $form->submit->setLabel('Submit changes');\n $form->author->setValue($this->getIdentityForForms());\n $this->view->form = $form;\n if($this->getRequest()->isPost() \n && $form->isValid($this->_request->getPost())){\n if ($form->isValid($form->getValues())) {\n $updateData = $form->getValues();\n $where = array();\n $where[] = $this->_content->getAdapter()\n ->quoteInto('id = ?', $this->_getParam('id'));\n $oldData = $this->_content->fetchRow($this->_content\n ->select()->where('id= ?' , \n (int)$this->_getParam('id')))->toArray();\n $this->_helper->audit($updateData, $oldData, 'ContentAudit', \n $this->_getParam('id'), $this->_getParam('id'));\n $this->_content->update($updateData, $where);\n $this->_helper->solrUpdater->update('beocontent', \n $this->_getParam('id'), 'content'); \n $this->getFlash()->addMessage('You updated: <em>' \n . $form->getValue('title') \n . '</em> successfully. It is now available for use.');\n $this->getCache()->clean(Zend_Cache::CLEANING_MODE_ALL);\n $this->_redirect('admin/content/');\n } else {\n $form->populate($this->_request->getPost());\n }\n } else {\n // find id is expected in $params['id']\n $id = (int)$this->_request->getParam('id', 0);\n if ($id > 0) {\n $content = $this->_content->fetchRow('id=' . (int)$id)->toArray();\n if($content) {\n $form->populate($content);\n } else {\n throw new Pas_Exception_Param($this->_nothingFound);\n }\n }\n }\n } else {\n throw new Pas_Exception_Param($this->_missingParameter, 500);\n }\n }",
"function pdfbulletin_edit_form(&$node, $form_state) {\n $type = node_get_types('type', $node);\n $pdfbulletin = $node->pdfbulletin;\n $form['pdfbulletin'] = array(\n '#type' => 'value',\n '#value' => $pdfbulletin,\n );\n $form['title'] = array(\n '#type' => 'textfield',\n '#title' => check_plain($type->title_label),\n '#required' => TRUE,\n '#default_value' => $node->title,\n '#weight' => -5,\n );\n\n $form['header_format'] = array(\n '#tree' => FALSE,\n );\n $form['header_format']['header'] = array(\n '#title' => t('Header'),\n '#type' => 'textarea',\n '#default_value' => $pdfbulletin->header,\n );\n $form['header_format']['format'] = filter_form($pdfbulletin->header_format, NULL, array('header_format'));\n\n $form['footer_format'] = array(\n '#tree' => FALSE,\n );\n $form['footer_format']['footer'] = array(\n '#title' => t('Footer'),\n '#type' => 'textarea',\n '#default_value' => $pdfbulletin->footer,\n );\n $form['footer_format']['format'] = filter_form($pdfbulletin->footer_format, NULL, array('footer_format'));\n\n $form['email_format'] = array(\n '#tree' => FALSE, \n );\n $form['email_format']['email'] = array(\n '#title' => t('Text for e-mail'),\n '#type' => 'textarea',\n '#default_value' => $pdfbulletin->email,\n );\n $form['email_format']['format'] = filter_form($pdfbulletin->email_format, NULL, array('email_format'));\n\n $form['empty_text_format'] = array(\n '#tree' => FALSE,\n );\n $form['empty_text_format']['empty_text'] = array(\n '#title' => t('Empty text'),\n '#type' => 'textarea',\n '#default_value' => $pdfbulletin->empty_text,\n '#description' => t('Text for e-mail if it is sent with an empty bulletin.'),\n );\n $form['empty_text_format']['format'] = filter_form($pdfbulletin->empty_text_format, NULL, array('empty_text_format'));\n\n $paper_sizes = pdfbulletin_util_settings('paper_size');\n $form['paper_size'] = array(\n '#title' => t('Paper size'),\n '#type' => 'select',\n '#default_value' => $pdfbulletin->paper_size,\n );\n foreach ($paper_sizes as $key => $value) {\n $form['paper_size']['#options'][$key] = t($key);\n }\n\n $css = pdfbulletin_css();\n $form['css_file'] = array(\n '#title' => t('Style'),\n '#type' => 'select',\n '#default_value' => $pdfbulletin->css_file,\n );\n foreach ($css as $key => $value) {\n $form['css_file']['#options'][$key] = check_plain($value);\n }\n\n\n return $form;\n}",
"function mongo_node_form_validate(&$form, &$form_state) {\n $entity_type = $form_state['entity_type'];\n $entity = $form_state[$entity_type];\n field_attach_form_validate($entity_type, $entity, $form, $form_state);\n}",
"function update() {\n\t\tglobal $tpl, $lng;\n\n\t\t$form = $this->initForm(TRUE);\n\t\tif ($form->checkInput()) {\n\t\t\tif ($this->updateElement($this->getPropertiesFromPost($form))) {\n\t\t\t\tilUtil::sendSuccess($lng->txt('msg_obj_modified'), TRUE);\n\t\t\t\t$this->returnToParent();\n\t\t\t}\n\t\t}\n\n\t\t$form->setValuesByPost();\n\t\t$tpl->setContent($form->getHtml());\n\t}",
"function cps_changeset_edit_form_submit($form, &$form_state) {\n $entity = $form_state['entity'];\n $entity->name = $form_state['values']['name'];\n $entity->description = $form_state['values']['description'];\n $entity->lock_in_select = $form_state['values']['lock_in_select'];\n\n if (!empty($entity->is_new)) {\n // Automatically move us to the new changeset context.\n cps_set_current_changeset($entity->changeset_id);\n\n // If there is a destination, we have to remove the changeset ID from it.\n if (!empty($_GET['destination'])) {\n // We used drupal_get_destination() before because it may not have been\n // calculated; to directly modify it we will then need to get the\n // (now cached) static.\n $_GET['destination'] = preg_replace(\"/changeset_id=[^&]+/\", 'changeset_id=' . $entity->changeset_id, $_GET['destination']);\n }\n }\n}",
"function thumbwhere_contentcollection_edit_form($form, &$form_state, $thumbwhere_contentcollection) {\n\n // Add the default field elements.\n $form['fk_actor'] = array(\n '#type' => 'textfield',\n '#title' => t('ThumbWhereContentCollection fk_actor'),\n '#default_value' => isset($thumbwhere_contentcollection->fk_actor) ? $thumbwhere_contentcollection->fk_actor : '',\n //'#maxlength' => 255,\n /// '#required' => TRUE,\n '#weight' => -5,\n '#autocomplete_path' => 'entity-autocomplete/thumbwhere_actor',\n );\n // Add the default field elements.\n $form['title'] = array(\n '#type' => 'textfield',\n '#title' => t('ThumbWhereContentCollection title'),\n '#default_value' => isset($thumbwhere_contentcollection->title) ? $thumbwhere_contentcollection->title : 'Hello',\n // '#maxlength' => 255,\n // '#required' => TRUE,\n '#weight' => -5,\n );\n\n\n\n $form['data']['#tree'] = TRUE;\n\n /*\n $form['data']['sample_data'] = array(\n '#type' => 'checkbox',\n '#title' => t('An interesting thumbwhere_contentcollection switch'),\n '#default_value' => isset($thumbwhere_contentcollection->data['sample_data']) ? $thumbwhere_contentcollection->data['sample_data'] : 1,\n );\n */\n\n\n // Add the field related form elements.\n $form_state['thumbwhere_contentcollection'] = $thumbwhere_contentcollection;\n field_attach_form('thumbwhere_contentcollection', $thumbwhere_contentcollection, $form, $form_state);\n\n $form['actions'] = array(\n '#type' => 'container',\n '#attributes' => array('class' => array('form-actions')),\n '#weight' => 400,\n );\n\n // We add the form's #submit array to this button along with the actual submit\n // handler to preserve any submit handlers added by a form callback_wrapper.\n $submit = array();\n\n if (!empty($form['#submit'])) {\n $submit += $form['#submit'];\n }\n\n $form['actions']['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save thumbwhere_contentcollection'),\n '#submit' => $submit + array('thumbwhere_contentcollection_edit_form_submit'),\n );\n\n // Do we show the delete button?\n if (!empty($thumbwhere_contentcollection->pk_contentcollection)) {\n $form['actions']['delete'] = array(\n '#type' => 'submit',\n '#value' => t('Delete thumbwhere_contentcollection'),\n '#suffix' => l(t('Cancel'), 'admin/thumbwhere/thumbwhere_contentcollections'),\n '#submit' => $submit + array('thumbwhere_contentcollection_form_submit_delete'),\n '#weight' => 45,\n );\n }\n\n // We append the validate handler to #validate in case a form callback_wrapper\n // is used to add validate handlers earlier.\n $form['#validate'][] = 'thumbwhere_contentcollection_edit_form_validate';\n return $form;\n}",
"public function processAction() {\n\t\t$form = $this->getForm ( \"/admin/invoices/process\" );\n\t\t$request = $this->getRequest ();\n\t\t$attachment = $form->getElement ( 'attachments' );\n\t\t\n\t\t// Check if we have a POST request\n\t\tif (! $request->isPost ()) {\n\t\t\treturn $this->_helper->redirector ( 'list', 'invoices', 'admin' );\n\t\t}\n\t\t\n\t\t// Create the buttons in the edit form\r\n\t\t$this->view->buttons = array(\r\n\t\t\t\tarray(\"url\" => \"#\", \"label\" => $this->translator->translate('Save'), \"params\" => array('css' => null,'id' => 'submit')),\r\n\t\t\t\tarray(\"url\" => \"/admin/invoices/list\", \"label\" => $this->translator->translate('List'), \"params\" => array('css' => null,'id' => 'submit')),\r\n\t\t\t\tarray(\"url\" => \"/admin/invoices/new/\", \"label\" => $this->translator->translate('New'), \"params\" => array('css' => null)),\r\n\t\t);\n\t\t\n\t\tif ($form->isValid ( $request->getPost () )) {\n\t\t\t// Get the id \n\t\t\t$id = $this->getRequest ()->getParam ( 'invoice_id' );\n\t\t\t\n\t\t\t// Set the new values\n\t\t\tif (is_numeric ( $id )) {\n\t\t\t\t$this->invoices = Doctrine::getTable ( 'Invoices' )->find ( $id );\n\t\t\t}\n\t\t\t\n\t\t\t// Get the values posted\n\t\t\t$params = $form->getValues ();\n\t\t\ttry {\n\t\t\t\t\n\t\t\t\t$this->invoices->invoice_date = Shineisp_Commons_Utilities::formatDateIn ( $params ['invoice_date'] );\n\t\t\t\t$this->invoices->number = $params ['number'];\n\t\t\t\t$this->invoices->order_id = $params ['order_id'];\n\t\t\t\t$this->invoices->note = $params ['note'];\n\t\t\t\t\n\t\t\t\t// Save the data\n\t\t\t\t$this->invoices->save ();\n\t\t\t\t$id = is_numeric ( $id ) ? $id : $this->invoices->getIncremented ();\n\n\t\t\t\t// Update formatted_number\n\t\t\t\tif ( $this->invoices->formatted_number != $params ['formatted_number'] || empty($this->invoices->formatted_number) ) {\n\t\t\t\t\t$this->invoices->formatted_number = !empty($params ['formatted_number']) ? $params ['formatted_number'] : Invoices::generateNumber($id);\t\n\t\t\t\t\t$this->invoices->save();\n\t\t\t\t}\n\t\t\t\n\t\t\t} catch ( Exception $e ) {\n\t\t\t\t$this->_helper->redirector ( 'list', 'invoices', 'admin', array ('mex' => $this->translator->translate ( 'The invoice cannot be created. Please check all your input data and try again.' ), 'status' => 'danger' ) );\n\t\t\t}\n\t\t\t\n\t\t\t$this->_helper->redirector ( 'edit', 'invoices', 'admin', array ('id' => $id, 'mex' => $this->translator->translate ( 'The task requested has been executed successfully.' ), 'status' => 'success' ) );\n\t\t} else {\n\t\t\t$this->view->form = $form;\n\t\t\t$this->view->title = $this->translator->translate(\"Invoice Edit\");\n\t\t\t$this->view->description = $this->translator->translate(\"Here you can edit the selected invoice.\");\n\t\t\treturn $this->render ( 'applicantform' );\n\t\t}\n\t}",
"function image_gallery_admin_edit($tid = NULL) {\r\n if ((isset($_POST['op']) && $_POST['op'] == t('Delete')) || isset($_POST['confirm'])) {\r\n return drupal_get_form('image_gallery_confirm_delete_form', $tid);\r\n }\r\n\r\n if (is_numeric($tid)) {\r\n $edit = (array) taxonomy_get_term($tid);\r\n }\r\n else {\r\n $edit = array(\r\n 'name' => '',\r\n 'description' => '',\r\n 'vid' => _image_gallery_get_vid(),\r\n 'tid' => NULL,\r\n 'weight' => 0,\r\n );\r\n }\r\n return drupal_get_form('image_gallery_admin_form', $edit);\r\n}"
]
| [
"0.7503424",
"0.72289693",
"0.66206306",
"0.65316916",
"0.6489455",
"0.64525265",
"0.64298",
"0.63958144",
"0.6388495",
"0.6169524",
"0.6124327",
"0.61211413",
"0.60745347",
"0.6058325",
"0.5982858",
"0.5959377",
"0.5955767",
"0.5938314",
"0.59210277",
"0.5911633",
"0.5896756",
"0.5875314",
"0.58536404",
"0.5815118",
"0.5804993",
"0.5777878",
"0.5773557",
"0.5771843",
"0.5771723",
"0.57537663"
]
| 0.75950235 | 0 |
Helper function Rename a mongo collection. | function _mongo_node_rename_collection($old_entity_type, $new_entity_type) {
$mongodb = mongodb();
// Get connection and database name by forcing call to __toString().
$m = $mongodb->connection;
$database = sprintf('%s', $mongodb);
$admin_db = $m->admin;
$res = $admin_db->command(array(
"renameCollection" => $database . ".fields_current." . $old_entity_type,
"to" => $database . ".fields_current." . $new_entity_type,
));
$res = $admin_db->command(array(
"renameCollection" => $database . "." . $old_entity_type . "_ids",
"to" => $database . "." . $new_entity_type . "_ids",
));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function setCollectionName($name);",
"protected function dropCollection($name)\n {\n if ($this->mongodb) {\n try {\n $this->mongodb->createCommand()->dropCollection($name);\n } catch (Exception $e) {\n // shut down exception\n }\n }\n }",
"public function createCollection($name) {}",
"public function setMongo(&$collection) {\n $this->collection = $collection;\n }",
"public function getCollectionName()\n {\n if (isset($this->collection)) {\n return $this->collection;\n }\n\n $reflector = new ReflectionClass($this);\n $str = new Str;\n\n return $str->lower(\n $str->plural(\n $str->snake(\n $reflector->getShortName()\n )\n )\n );\n }",
"public function getName(): string\n {\n return 'mongo';\n }",
"public static function factory($name)\n {\n return Mongo_Document::factory($name)->collection(TRUE);\n }",
"public function rename_db($oldname, $newname) {\n return UPS_SUCCESS;\n }",
"public function getCollectionName()\n {\n return $this->collectionName;\n }",
"public function drop($collection_name) {\r\n\t\t$collection = $this->database->selectCollection($collection_name);\r\n\t\tvar_dump($collection);\r\n\t\treturn $collection->drop();\r\n\t}",
"static protected function _createMongoCollection($config)\n {\n if(!isset($config['server'])){\n $server = \"mongodb://localhost:27017\";\n } else {\n $server = $config['server'];\n }\n if(!isset($config['options']) || !is_array($config['options'])){\n $options = array();\n } else {\n $options = $config['options'];\n }\n $mongo = new MongoDb($server, $options);\n return $mongo->selectDB($config['database'])\n ->selectCollection($config['collection']);\n }",
"function getCollection($name);",
"private function getDBCollection($collection)\n {\n return $this->database . '.' . $collection;\n }",
"public static function collectionName()\n {\n return 'staff';\n }",
"public function setCollection()\n {\n $cl = $this->nameCollection;\n $this->collection = self::$database->$cl;\n }",
"function setupmongo(){\n $mongo = new MongoClient(\"mongodb://technicolor:testbed@localhost/backendtest\");\n $collection = $mongo->selectDB('backendtest')->selectCollection('user');\n return $collection;\n}",
"static function drop($collection) {\n global $mongo;\n $col = $mongo->selectCollection(MONGODB_NAME, $collection);\n\n return $col->drop();\n }",
"protected function dropFileCollection($name = 'fs')\n {\n if ($this->mongodb) {\n try {\n $this->mongodb->getFileCollection($name)->drop();\n } catch (Exception $e) {\n // shut down exception\n }\n }\n }",
"public function setName(string $collection): self\n {\n $this->setOption('name', $collection);\n\n return $this;\n }",
"public function collection(string $name): CollectionRef\n {\n return new CollectionRef(documents: $this, name: $name);\n }",
"public static function collectionName(): string\n {\n return config('howToAddon.collection', 'how_to_addon_videos');\n }",
"function setDbcoll($collection){\n $this->collection = $collection;\n $this->dbdotcoll = $this->mdb.'.'.$this->collection;\n }",
"public function __get($name)\n {\n return new \\MongoCollection($this->getMongoDB(), $name);\n }",
"function mongo_lite($collection, $name = 'default')\n\t{\n\t\t$connection = \\Hexcores\\MongoLite\\Connection::instance($name);\n\n\t\treturn new \\Hexcores\\MongoLite\\Query($connection->collection($collection));\n\t}",
"protected function getCollectionName()\n {\n $configCollectionName = config('postman.collectionName');\n \n if (!empty($configCollectionName)) {\n \n return $configCollectionName;\n }\n \n return $this->ask('Enter collection name', 'LaravelPostman Collection');\n }",
"public function getCollection($name) {}",
"public function testCreateReplaceDocumentAndDeleteDocumentInExistingCollection()\n {\n $collectionName = $this->TESTNAMES_PREFIX . 'CollectionTestSuite-Collection';\n $requestBody = ['name' => 'Frank', 'bike' => 'vfr', '_key' => '1'];\n\n $document = new Document($this->client);\n\n /** @var HttpResponse $responseObject */\n $responseObject = $document->create($collectionName, $requestBody);\n $responseBody = $responseObject->body;\n\n $decodedJsonBody = json_decode($responseBody, true);\n\n $this->assertArrayNotHasKey('error', $decodedJsonBody);\n\n $this->assertEquals($collectionName . '/1', $decodedJsonBody['_id']);\n\n $requestBody = ['name' => 'Mike'];\n\n $document = new Document($this->client);\n\n $responseObject = $document->replace($collectionName . '/1', $requestBody);\n $responseBody = $responseObject->body;\n\n $decodedJsonBody = json_decode($responseBody, true);\n\n $this->assertArrayNotHasKey('error', $decodedJsonBody);\n\n $this->assertEquals($collectionName . '/1', $decodedJsonBody['_id']);\n\n $document = new Document($this->client);\n\n $responseObject = $document->get($collectionName . '/1', $requestBody);\n $responseBody = $responseObject->body;\n\n $this->assertArrayNotHasKey('bike', json_decode($responseBody, true));\n\n $decodedJsonBody = json_decode($responseBody, true);\n\n $this->assertEquals('Mike', $decodedJsonBody['name']);\n\n $this->assertEquals($collectionName . '/1', $decodedJsonBody['_id']);\n\n $responseObject = $document->delete($collectionName . '/1');\n $responseBody = $responseObject->body;\n\n $decodedJsonBody = json_decode($responseBody, true);\n\n $this->assertArrayNotHasKey('error', $decodedJsonBody);\n\n // Try to delete a second time .. should throw an error\n $responseObject = $document->delete($collectionName . '/1');\n $responseBody = $responseObject->body;\n\n $decodedJsonBody = json_decode($responseBody, true);\n\n $this->assertArrayHasKey('error', $decodedJsonBody);\n $this->assertEquals(true, $decodedJsonBody['error']);\n\n $this->assertEquals(true, $decodedJsonBody['error']);\n\n $this->assertEquals(404, $decodedJsonBody['code']);\n\n $this->assertEquals(1202, $decodedJsonBody['errorNum']);\n }",
"protected function setCollection($collectionName)\n {\n if (!isset($this->_collection))\n {\n $db = Yii::app()->getComponent($this->connectionID);\n if (!($db instanceof EMongoDB))\n {\n throw new EMongoException('EMongoHttpSession.connectionID is invalid');\n }\n\n $this->_collection = $db->getDbInstance()->selectCollection($collectionName);\n }\n\n return $this->_collection;\n }",
"public function collection($collection_name) {\n return $this->db->selectCollection(\\App\\Config::get('dbName'), $collection_name);\n }",
"public function getTestCollection($drop = true)\n\t{\n\t\t$collection = $this->client->mongominify->test;\n\t\tif ($drop)\n\t\t{\n\t\t\t$collection->drop();\n\t\t}\n\t\treturn $collection;\n\t}"
]
| [
"0.6554234",
"0.5911178",
"0.5841201",
"0.5796181",
"0.57822454",
"0.57485217",
"0.57028073",
"0.5685802",
"0.5666897",
"0.5641118",
"0.5636572",
"0.55369127",
"0.55330616",
"0.5511881",
"0.54671305",
"0.54500496",
"0.5412006",
"0.53969",
"0.536967",
"0.53045493",
"0.5280285",
"0.52563286",
"0.52016014",
"0.5191899",
"0.51429015",
"0.51201254",
"0.5105611",
"0.51049143",
"0.5086376",
"0.5080342"
]
| 0.7404457 | 0 |
Helper function update entities type. | function _mongo_node_update_type($old_entity_type, $entity_type) {
// Update collection names.
_mongo_node_rename_collection($old_entity_type, $entity_type);
// Update bundle name in mongo entities.
$collection = mongodb_collection('fields_current', $entity_type);
$result = $collection->update(
array('_type' => $old_entity_type),
array('$set' => array('_type' => $entity_type, 'type' => $entity_type))
);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"private function update_type($new_type) { \n\n\t\tif ($this->_update_item('type',$new_type,'50')) { \n\t\t\t$this->type = $new_type;\n\t\t}\n\n\t}",
"function entity_info_alter_build(&$entity_info, $entity_type) {\n}",
"public function getType(): EntityType;",
"public function setType(EntityType $type);",
"function nestedbox_core_entity_info_alter(array &$entity_info) {\n foreach (nestedbox_get_types() as $type => $info) {\n $entity_info['nestedbox']['bundles'][$type] = array(\n 'label' => $info->label,\n 'admin' => array(\n /* @see nestedbox_type_load() */\n 'path' => 'admin/structure/nestedbox-types/manage/%nestedbox_type',\n 'real path' => 'admin/structure/nestedbox-types/manage/' . $type,\n 'bundle argument' => 4,\n 'access arguments' => array('administer nestedbox types'),\n ),\n );\n }\n}",
"public function setMappedEntityType($entity_type);",
"function entity_rewrite($entity_type, &$entity)\n{\n $translate = entity_type_translate_array($entity_type);\n\n // By default, fill $entity['entity_name'] with name_field contents.\n if (isset($translate['name_field'])) { $entity['entity_name'] = $entity[$translate['name_field']]; }\n\n // By default, fill $entity['entity_shortname'] with shortname_field contents. Fallback to entity_name when field name is not set.\n if (isset($translate['shortname_field'])) { $entity['entity_shortname'] = $entity[$translate['name_field']]; } else { $entity['entity_shortname'] = $entity['entity_name']; }\n\n // By default, fill $entity['entity_descr'] with descr_field contents.\n if (isset($translate['descr_field'])) { $entity['entity_descr'] = $entity[$translate['descr_field']]; }\n\n // By default, fill $entity['entity_id'] with id_field contents.\n if (isset($translate['id_field'])) { $entity['entity_id'] = $entity[$translate['id_field']]; }\n\n switch($entity_type)\n {\n case \"bgp_peer\":\n // Special handling of name/shortname/descr for bgp_peer, since it combines multiple elements.\n\n if (Net_IPv6::checkIPv6($entity['bgpPeerRemoteAddr']))\n {\n $addr = Net_IPv6::compress($entity['bgpPeerRemoteAddr']);\n } else {\n $addr = $entity['bgpPeerRemoteAddr'];\n }\n\n $entity['entity_name'] = \"AS\".$entity['bgpPeerRemoteAs'] .\" \". $addr;\n $entity['entity_shortname'] = $addr;\n $entity['entity_descr'] = $entity['astext'];\n break;\n\n case \"sla\":\n $entity['entity_name'] = 'SLA #' . $entity['sla_index'];\n if (!empty($entity['sla_target']) && ($entity['sla_target'] != $entity['sla_tag']))\n {\n if (get_ip_version($entity['sla_target']) === 6)\n {\n $sla_target = Net_IPv6::compress($entity['sla_target'], TRUE);\n } else {\n $sla_target = $entity['sla_target'];\n }\n $entity['entity_name'] .= ' (' . $entity['sla_tag'] . ': ' . $sla_target . ')';\n } else {\n $entity['entity_name'] .= ' (' . $entity['sla_tag'] . ')';\n }\n $entity['entity_shortname'] = \"#\". $entity['sla_index'] . \" (\". $entity['sla_tag'] . \")\";\n break;\n\n case \"pseudowire\":\n $entity['entity_name'] = $entity['pwID'] . ($entity['pwDescr'] ? \" (\". $entity['pwDescr'] . \")\" : '');\n $entity['entity_shortname'] = $entity['pwID'];\n break;\n }\n}",
"function hook_uuid_entities_features_export_entity_alter(&$entity, $entity_type) {\n\n}",
"public function restoreEntityType() {\n $nid = $this->og_controller->og_node->nid;\n $path = \"private://dumper/restore.{$nid}/private://dumper/{$nid}/{$this->entity_type}\";\n foreach (file_scan_directory($path, '/\\.json/') as $file) {\n $this->restoreEntity($file->name);\n }\n }",
"function entity_type_translate_array($entity_type)\n{\n $translate = $GLOBALS['config']['entities'][$entity_type];\n\n // Base fields\n // FIXME, not listed here: agg_graphs, metric_graphs\n $fields = array('name', // Base entity name\n 'name_multiple', // (Optional) Plural entity name\n 'table', // Table name\n 'table_fields', // Array with table fields\n //'state_table', // State table name (deprecated)\n //'state_fields', // Array with state fields (deprecated)\n 'humanize_function', // Humanize function name\n 'parent_type', // Parent table type\n 'parent_table', // Parent table name\n 'parent_id_field', // Main parent id field\n 'where',\n 'icon', // Entity icon\n 'graph');\n foreach ($fields as $field)\n {\n if (isset($translate[$field]))\n {\n $data[$field] = $translate[$field];\n }\n else if (isset($GLOBALS['config']['entities']['default'][$field]))\n {\n $data[$field] = $GLOBALS['config']['entities']['default'][$field];\n }\n }\n\n // Table fields\n $fields_table = array(// Common fields\n 'id',\n 'device_id',\n 'index',\n 'mib',\n 'object',\n 'oid',\n 'name',\n 'shortname',\n 'descr',\n 'ignore',\n 'disable',\n 'deleted',\n // Limits fields\n 'limit_high', // High critical limit\n 'limit_high_warn', // High warning limit\n 'limit_low', // Low critical limit\n 'limit_low_warn', // Low warning limit\n // Value fields\n 'value', // RAW value\n 'status', // Entity specific status name (\n 'event', // Event name (ok, alert, warning, etc..)\n 'uptime', // Uptime\n 'last_change', // Last changed time\n // Measured entity fields\n 'measured_type', // Measured entity type\n 'measured_id', // Measured entity id\n );\n if (isset($translate['table_fields']))\n {\n // New definition style\n foreach ($translate['table_fields'] as $field => $entry)\n {\n // Add old style name (ie 'id_field') for compatibility\n $data[$field . '_field'] = $entry;\n }\n }\n\n return $data;\n}",
"function set_entity_attrib($entity_type, $entity_id, $attrib_type, $attrib_value, $device_id = NULL)\n{\n if (is_array($entity_id))\n {\n // Passed entity array, instead id\n $translate = entity_type_translate_array($entity_type);\n $entity = $entity_id;\n $entity_id = $entity[$translate['id_field']];\n }\n\n if (!$entity_id) { return NULL; }\n\n // If we're setting a device attribute, use the entity_id as the device_id\n if($entity_type == \"device\") { $device_id = $entity_id; }\n\n\n // If we don't have a device_id, try to work out what it should be\n if(!$device_id)\n {\n if(isset($entity) && isset($entity['device_id']))\n {\n $device_id = $entity['device_id'];\n } else {\n $entity = get_entity_by_id_cache($entity_type, $entity_id);\n $device_id = $entity['device_id'];\n }\n }\n if (!$device_id) { print_error(\"Enable to set attrib data : $entity_type, $entity_id, $attrib_type, $attrib_value, $device_id\"); return NULL; }\n\n if (isset($GLOBALS['cache']['entity_attribs'][$entity_type][$entity_id]))\n {\n // Reset entity attribs\n unset($GLOBALS['cache']['entity_attribs'][$entity_type][$entity_id]);\n }\n\n //if (dbFetchCell(\"SELECT COUNT(*) FROM `entity_attribs` WHERE `entity_type` = ? AND `entity_id` = ? AND `attrib_type` = ?\", array($entity_type, $entity_id, $attrib_type)))\n if (dbExist('entity_attribs', '`entity_type` = ? AND `entity_id` = ? AND `attrib_type` = ?', array($entity_type, $entity_id, $attrib_type)))\n {\n $return = dbUpdate(array('attrib_value' => $attrib_value), 'entity_attribs', '`entity_type` = ? AND `entity_id` = ? AND `attrib_type` = ?', array($entity_type, $entity_id, $attrib_type));\n } else {\n $return = dbInsert(array('device_id' => $device_id, 'entity_type' => $entity_type, 'entity_id' => $entity_id, 'attrib_type' => $attrib_type, 'attrib_value' => $attrib_value), 'entity_attribs');\n if ($return !== FALSE) { $return = TRUE; } // Note dbInsert return IDs if exist or 0 for not indexed tables\n }\n\n return $return;\n}",
"public function updateEntityType($entityTypeId, $request)\n {\n return $this->start()->uri(\"/api/entity/type\")\n ->urlSegment($entityTypeId)\n ->bodyHandler(new JSONBodyHandler($request))\n ->put()\n ->go();\n }",
"public function setEntityTypes($types) {\n $this->entity_types = $types;\n }",
"function mongo_node_mass_update($entity_type, $entities, $args) {\n foreach ($entities as $entity_id) {\n $entity = entity_get_controller($entity_type)->load(array($entity_id));\n $entity = reset($entity);\n // Skip if not updates.\n if (!isset($args['updates'])) {\n continue;\n }\n foreach ($args['updates'] as $p_name => $p_val) {\n $entity->$p_name = $p_val;\n }\n entity_save($entity_type, $entity);\n }\n}",
"function _mongo_node_update_bundle($entity_type, $old_bundle, $bundle) {\n\n // Update bundle name in ids collection.\n $collection = mongodb_collection($entity_type . '_ids');\n\n $result = $collection->update(\n array('bundle' => $old_bundle),\n array('$set' => array('bundle' => $bundle))\n );\n\n // Update bundle name in mongo entities.\n $collection = mongodb_collection('fields_current', $entity_type);\n $result = $collection->update(\n array('_bundle' => $old_bundle, '_type' => $entity_type),\n array('$set' => array('_bundle' => $bundle, 'type' => $bundle))\n );\n}",
"abstract protected function getEntityType(): string;",
"function entity_type_translate($entity_type)\n{\n $data = entity_type_translate_array($entity_type);\n if (!is_array($data)) { return NULL; }\n\n return array($data['table'], $data['id_field'], $data['name_field'], $data['ignore_field'], $data['entity_humanize']);\n}",
"public function getExtendedType()\n {\n return EntityType::class;\n }",
"protected abstract function initializeEntityType(): string;",
"public function saveType()\n {\n }",
"function create_or_update_type($data) {\n return $this->save_type($data);\n }",
"public function testUpdateFieldsWrongType(): void { }",
"function getEntityType() {\n return $this->entity_type;\n }",
"function schema_alter_build(&$schema, $entity_type) {}",
"public function getEntityTypeId();",
"private function loadTypes() {\n \n if(!empty($this->types)) return;\n \n $this->types = $this->doctrine\n ->getManager()\n ->getRepository('FenchyNoticeBundle:Type')\n ->getFilterTypes();\n }",
"public function update($entity)\n {\n \n }",
"function mongo_node_type_edit_form($form, $form_state, $entity_type) {\n $set = mongo_node_settings();\n $form = array();\n\n $form['label'] = array(\n '#type' => 'textfield',\n '#title' => t('Entity type'),\n '#default_value' => $set[$entity_type]['label'],\n '#description' => t('The human readable name of the entity.'),\n );\n\n $form['name'] = array(\n '#type' => 'machine_name',\n '#required' => FALSE,\n '#default_value' => $entity_type,\n '#machine_name' => array(\n 'exists' => '_mongo_node_type_exists',\n 'source' => array('label'),\n ),\n );\n\n // Send entity type.\n $form['entity_type'] = array(\n '#type' => 'value',\n '#value' => $entity_type,\n );\n\n $form['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save'),\n );\n\n return $form;\n}",
"public function getEntityType();",
"private function setEntityTypeFromArray(array $input, string $key = 'entity-type'): void\n {\n $this->entityType = is_null($entityType = ArrayAccess::getString($input, $key))\n ? new EntityType()\n : new EntityType($entityType);\n }"
]
| [
"0.6912789",
"0.65836614",
"0.6572131",
"0.6534108",
"0.648626",
"0.6399886",
"0.6325793",
"0.63029975",
"0.6285561",
"0.62635577",
"0.6200354",
"0.6191755",
"0.6148646",
"0.6144508",
"0.60502535",
"0.6000529",
"0.5997764",
"0.597976",
"0.59766966",
"0.59686095",
"0.5955569",
"0.5914679",
"0.5895234",
"0.58704174",
"0.57984096",
"0.5784975",
"0.5782443",
"0.5781503",
"0.57778245",
"0.57711"
]
| 0.77196634 | 0 |
Helper function update entities bundle. | function _mongo_node_update_bundle($entity_type, $old_bundle, $bundle) {
// Update bundle name in ids collection.
$collection = mongodb_collection($entity_type . '_ids');
$result = $collection->update(
array('bundle' => $old_bundle),
array('$set' => array('bundle' => $bundle))
);
// Update bundle name in mongo entities.
$collection = mongodb_collection('fields_current', $entity_type);
$result = $collection->update(
array('_bundle' => $old_bundle, '_type' => $entity_type),
array('$set' => array('_bundle' => $bundle, 'type' => $bundle))
);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function apachesolr_index_set_bundles($env_id, $entity_type, array $bundles) {\n $transaction = db_transaction();\n try {\n db_delete('apachesolr_index_bundles')\n ->condition('env_id', $env_id)\n ->condition('entity_type', $entity_type)\n ->execute();\n\n if ($bundles) {\n $insert = db_insert('apachesolr_index_bundles')\n ->fields(array('env_id', 'entity_type', 'bundle'));\n\n foreach ($bundles as $bundle) {\n $insert->values(array(\n 'env_id' => $env_id,\n 'entity_type' => $entity_type,\n 'bundle' => $bundle,\n ));\n }\n $insert->execute();\n }\n }\n catch (Exception $e) {\n $transaction->rollback();\n // Re-throw the exception so we are aware of the failure.\n throw $e;\n }\n}",
"public function update($entity)\n {\n \n }",
"protected function updateEntity($entity)\n {\n }",
"public function singleBundleEditWithOverrides() {\n $entityTypeInfo = $this->createEntityType();\n\n $title_overrides = [];\n foreach ($this->getConfigurableBaseFields() as $field) {\n $title_overrides[$field] = $this->randomMachineName(16);\n }\n\n $bundle_info = $this->createEntityBundle($entityTypeInfo['id'], '', $title_overrides);\n\n $new_title_overrides = [];\n foreach ($this->getConfigurableBaseFields() as $field) {\n $new_title_overrides[$field] = $this->randomMachineName(16);\n }\n\n $this->editEntityBundle($entityTypeInfo['id'], $bundle_info['type'], $this->randomMachineName(16), $new_title_overrides);\n }",
"public function update(Entity $entity);",
"public function update($entity);",
"public function update($entity);",
"public function Update($entity) {\n }",
"public function update(Connection $connection): void\n {\n $connection->executeUpdate('\n CREATE TABLE IF NOT EXISTS `slaleye_product_bundler_bundle` (\n `id` BINARY(16) NOT NULL,\n `discount_type` VARCHAR(255) NOT NULL,\n `discount` DOUBLE NOT NULL,\n `stackable` TINYINT(1) NULL DEFAULT 0,\n `created_at` DATETIME(3) NOT NULL,\n `updated_at` DATETIME(3) NULL,\n PRIMARY KEY (`id`)\n ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;\n ');\n // Product association Table\n $connection->executeUpdate('\n CREATE TABLE IF NOT EXISTS `slaleye_product_bundler_bundle_product` (\n `bundle_id` BINARY(16) NOT NULL,\n `product_id` BINARY(16) NOT NULL,\n `product_version_id` BINARY(16) NOT NULL,\n `created_at` DATETIME(3) NOT NULL,\n PRIMARY KEY (`bundle_id`, `product_id`, `product_version_id`),\n CONSTRAINT `fk.slaleye_pblr_bundle_product.bundle_id` FOREIGN KEY (`bundle_id`)\n REFERENCES `slaleye_product_bundler_bundle` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,\n CONSTRAINT `fk.slaleye_pblr_bundle_product.product_id_product_version_id` FOREIGN KEY (`product_id`, `product_version_id`)\n REFERENCES `product` (`id`, `version_id`) ON DELETE CASCADE ON UPDATE CASCADE\n ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;\n ');\n\n\n /* For every inherited field you have to add a binary column to the entity, which is used for saving the inherited information in a read optimized manner. */\n $this->updateInheritance($connection, 'product', 'slaleyePblrBundles');\n\n // Translation Table\n $connection->executeUpdate('\n CREATE TABLE IF NOT EXISTS `slaleye_product_bundler_bundle_translation` (\n `slaleye_product_bundler_bundle_id` BINARY(16) NOT NULL,\n `language_id` BINARY(16) NOT NULL,\n `name` VARCHAR(255),\n `created_at` DATETIME(3) NOT NULL,\n `updated_at` DATETIME(3) NULL,\n PRIMARY KEY (`slaleye_product_bundler_bundle_id`, `language_id`),\n CONSTRAINT `fk.slaleye_pblr_bundle_translation.bundle_id` FOREIGN KEY (`slaleye_product_bundler_bundle_id`)\n REFERENCES `slaleye_product_bundler_bundle` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,\n CONSTRAINT `fk.slaleye_pblr_bundle_translation.language_id` FOREIGN KEY (`language_id`)\n REFERENCES `language` (`id`) ON DELETE CASCADE ON UPDATE CASCADE\n ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;\n ');\n }",
"public function update(DataObject $entity){\n }",
"public function update(stubObject $entity);",
"public function update($entity, $flush = false);",
"private function executeExtraUpdates()\n {\n foreach ($this->extraUpdates as $oid => $update) {\n list ($entity, $changeset) = $update;\n $this->entityChangeSets[$oid] = $changeset;\n $this->getEntityPersister(get_class($entity))->update($entity);\n }\n $this->extraUpdates = [];\n }",
"function mongo_node_mass_update($entity_type, $entities, $args) {\n foreach ($entities as $entity_id) {\n $entity = entity_get_controller($entity_type)->load(array($entity_id));\n $entity = reset($entity);\n // Skip if not updates.\n if (!isset($args['updates'])) {\n continue;\n }\n foreach ($args['updates'] as $p_name => $p_val) {\n $entity->$p_name = $p_val;\n }\n entity_save($entity_type, $entity);\n }\n}",
"protected function loadEntitiesToUpdate($entity_ids) {\n return $this->entityTypeManager->getStorage($this->updateEntityType())->loadMultiple($entity_ids);\n }",
"public function update($entity){ \n //TODO: Implement update record.\n }",
"function apachesolr_index_node_bundles_changed($env_id, $existing_bundles, $new_bundles) {\n // Nothing to do for now.\n}",
"protected function saveAndReplaceEntity()\n {\n $behavior = $this->getBehavior();\n $listId = [];\n while ($bunch = $this->_dataSourceModel->getNextBunch()) {\n $entityList = [];\n foreach ($bunch as $rowNum => $rowData) {\n if (!$this->validateRow($rowData, $rowNum)) {\n $this->addRowError(ValidatorInterface::ERROR_ID_IS_EMPTY, $rowNum);\n continue;\n }\n if ($this->getErrorAggregator()->hasToBeTerminated()) {\n $this->getErrorAggregator()->addRowToSkip($rowNum);\n continue;\n }\n $taskId= $rowData[self::TASK_ID];\n $listId[] = $taskId;\n $entityList[$taskId][] = [\n self::TASK_ID => $rowData[self::TASK_ID ],\n self::TASK_NAME => $rowData[self::TASK_NAME ],\n self::TASK_CONTENT => $rowData[self::TASK_CONTENT],\n self::START_DATE => $rowData[self::START_DATE ],\n self::END_DATE => $rowData[self::END_DATE ],\n self::STATUS => $rowData[self::STATUS ],\n self::ASSIGN_TO => $rowData[self::ASSIGN_TO ],\n self::PROGRESS => $rowData[self::PROGRESS ],\n self::DESCRIPTION => $rowData[self::DESCRIPTION ],\n self::PRIORITY => $rowData[self::PRIORITY ],\n self::CREATED_AT => $rowData[self::CREATED_AT ],\n self::UPDATED_AT => $rowData[self::UPDATED_AT ],\n self::USER_CREATED => $rowData[self::USER_CREATED],\n self::USER_UPDATED => $rowData[self::USER_UPDATED],\n ];\n }\n\n if (Import::BEHAVIOR_REPLACE == $behavior) {\n if ($listId) {\n if ($this->deleteEntityFinish(array_unique($listId), self::TABLE_ENTITY)) {\n $this->saveEntityFinish($entityList, self::TABLE_ENTITY);\n }\n }\n } elseif (Import::BEHAVIOR_APPEND == $behavior) {\n $this->saveEntityFinish($entityList, self::TABLE_ENTITY);\n }\n }\n\n return $this;\n }",
"function _update($entity)\n {\n $key = $this->object->get_primary_key_column();\n return $this->object->_wpdb()->update($this->object->get_table_name(), $this->object->_convert_to_table_data($entity), array($key => $entity->{$key}));\n }",
"function nestedbox_core_entity_info_alter(array &$entity_info) {\n foreach (nestedbox_get_types() as $type => $info) {\n $entity_info['nestedbox']['bundles'][$type] = array(\n 'label' => $info->label,\n 'admin' => array(\n /* @see nestedbox_type_load() */\n 'path' => 'admin/structure/nestedbox-types/manage/%nestedbox_type',\n 'real path' => 'admin/structure/nestedbox-types/manage/' . $type,\n 'bundle argument' => 4,\n 'access arguments' => array('administer nestedbox types'),\n ),\n );\n }\n}",
"public function postUpdate($entity);",
"public function updateSlugs(object $entity) :void\n {\n foreach($this->reader->getSlugProperties($entity) as $slugProperty)\n {\n $this->updateSlug($entity, $slugProperty);\n }\n }",
"public function update($entity){\n\t\ttry {\n\t\t\t$data = $entity->toArray();\n\t\t\t$this->updateEmbedded($data,$entity);\n\t\t\t$theId = new MongoId($data['_id']);\n\t\t\tunset($data['_id']);\n\t\t\t$this->callBehavior('beforeUpdate',$data,$entity);\n\t\t\t$bulk = new BulkWrite();\n\t\t\t$bulk->update(['_id'=>$theId],$data);\n\t\t\t$this->manager->executeBulkWrite($this->dbName.'.'.$this->collectionName,$bulk);\n\t\t\t$this->callBehavior('afterUpdate',$data,$entity);\n\t\t} catch (Exception $e) {\n\t\t\tthrow $e;\n\t\t}\n\t}",
"public function update(IEntity $entity);",
"public function updateEntityData(EntityData $entityData);",
"public function getMappingEntityBundle();",
"public function updateBulkProductsInventorySource($products);",
"public function patchEntities(iterable $entities, array $data, array $options = []): array;",
"public function updateAction(Request $request, $id)\n{\n $em = $this->getDoctrine()->getManager();\n\n $entity = $em->getRepository('gemaBundle:Productosprogramas')->find($id);\n\n if (!$entity) {\n throw $this->createNotFoundException('Unable to find Productosprogramas entity.');\n }\n\n $deleteForm = $this->createDeleteForm($id);\n $editForm = $this->createEditForm($entity);\n $editForm->handleRequest($request);\n $accion = ' ';\n $this->get(\"gema.utiles\")->traza($accion);\n $em->flush();\n\n \n \n\n \n return $this->redirect($this->generateUrl('admin_productosprogramas_edit', array('id' => $id)));\n \n}",
"protected function afterImport($entities)\n {\n\n }"
]
| [
"0.623332",
"0.6216402",
"0.62133163",
"0.6124402",
"0.6114456",
"0.6112794",
"0.6112794",
"0.60829264",
"0.6059587",
"0.598349",
"0.5919275",
"0.5845906",
"0.58347076",
"0.5807777",
"0.57997024",
"0.57898045",
"0.5758896",
"0.57507616",
"0.574629",
"0.57397",
"0.57026",
"0.56827366",
"0.56574863",
"0.56548464",
"0.56398255",
"0.5616999",
"0.5611655",
"0.55750275",
"0.5564257",
"0.5549896"
]
| 0.6639322 | 0 |
Form constructor for entity bundle delete. | function mongo_node_bundle_delete_form($form, $form_state, $entity_type, $bundle) {
$form = array();
$form['entity_type'] = array(
'#type' => 'value',
'#value' => $entity_type,
);
$form['bundle'] = array(
'#type' => 'value',
'#value' => $bundle,
);
$path = '/admin/structure/mongo-node/' . $entity_type;
$extist_bundle_content = '';
$collection = mongodb_collection('fields_current', $entity_type);
$count = $collection->count(array('_type' => $entity_type, '_bundle' => $bundle));
if ($count) {
$extist_bundle_content = t('%bundle is used by %count piece of content on your site. If you remove this bundle, you will not be able to edit the %bundle content and it may not display correctly.', array('%bundle' => $bundle, '%count' => $count));
$extist_bundle_content .= '<br/><br/>';
}
return confirm_form($form, t('Delete entity bundle'), $path, $extist_bundle_content . 'This action cannot be undone', t('Delete'), t('Cancel'), 'mongo_node_bundle_delete');
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function deleteForm()\n\t{\n\t\t$form = new \\IPS\\Helpers\\Form( 'form', 'delete' );\n\t\t$form->addMessage( 'node_delete_blurb_no_content' );\n\t\t\n\t\treturn $form;\n\t}",
"protected function createComponentDeleteForm()\r\n\t{\r\n\t\t$form = new Form;\r\n\t\t$form->addSubmit('delete', 'Smazat')->setAttribute('class', 'default');\r\n\t\t$form->addSubmit('cancel', 'Storno');\r\n\t\t$form->onSuccess[] = callback($this, 'deleteFormSubmitted');\r\n\t\t$form->addProtection(self::MESS_PROTECT);\r\n\t\treturn $form;\r\n\t}",
"private function createDeleteForm($id) {\r\n return $this->createFormBuilder()\r\n ->setAction($this->generateUrl('rubrique_delete', array('id' => $id)))\r\n// ->setMethod('DELETE')\r\n ->add('submit', SubmitType::class, array('label' => 'Supprimer la rubrique courante'))\r\n ->getForm()\r\n ;\r\n }",
"function dolist_messages_mail_admin_bundle_delete_form($form, &$form_state, $bundle) {\n \n if(!$bundle) {\n drupal_set_message(t('Could not load bundle'), 'error');\n drupal_goto('admin/structure/dolist/messagesmail');\n }\n\n $form['type'] = array('#type' => 'value', '#value' => $bundle->bundle);\n $form['name'] = array('#type' => 'value', '#value' => $bundle->name);\n\n $message = t('Are you sure you want to delete the message bundle %bundle?', array('%bundle' => $bundle->name));\n $caption = '';\n $caption .= '<p>' . t('This action cannot be undone. Content using the bundle will be broken.') . '</p>';\n\n return confirm_form($form, $message, 'admin/structure/dolist/messagesmail', $caption, t('Delete'));\n}",
"abstract function performDelete(Form $arg0);",
"function mongo_node_bundle_delete_form_submit($form, $form_state) {\n $set = mongo_node_settings();\n\n $entity_type = $form_state['values']['entity_type'];\n $bundle = $form_state['values']['bundle'];\n\n // Remove entity type.\n unset($set[$entity_type]['bundles'][$bundle]);\n\n mongo_node_settings_save($set);\n\n // Redirect to entity type admin.\n drupal_goto('admin/structure/mongo-node/' . $entity_type);\n}",
"private function createDeleteForm(VerbTranslation $verbTranslation)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('verbtranslation_delete', array('id' => $verbTranslation->getId())))\n ->setMethod('DELETE')\n ->getForm()\n ;\n }",
"private function createDeleteForm(Superficie $superficie)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('superficie_delete', array('id' => $superficie->getId())))\n ->setMethod('DELETE')\n ->getForm()\n ;\n }",
"public function delete(DataObject $entity){\n }",
"private function createDeleteForm($id)\n {\n \n $form = $this->createFormBuilder(null, array('attr' => array('id' => 'entrada_detalles_eliminar_type')))\n ->setAction('')\n ->setMethod('DELETE')\n ->add('submit', 'submit', array('label' => 'Eliminar', 'icon' => 'trash', 'attr' => array('class' => 'btn-danger')))\n ->getForm()\n ;\n \n return $form;\n \n \n }",
"private function createDeleteForm(NatureOp $priorite)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('back_natureop_delete', array('id' => $priorite->getId())))\n ->setMethod('DELETE')\n ->getForm()\n ;\n }",
"function mongo_node_page_delete_submit($form, &$form_state) {\n if ($form_state['values']['confirm']) {\n $entity = $form['#entity'];\n $entity->delete();\n\n $entity_type = $entity->entityType();\n $info = entity_get_info($entity_type);\n $bundle_key = $info['bundle keys']['bundle'];\n $bundle_label = $info['bundles'][$entity->{$bundle_key}]['label'];\n\n drupal_set_message(t('@label %title deleted',\n array(\n '@label' => $bundle_label,\n '%title' => $entity->title)\n )\n );\n }\n\n $form_state['redirect'] = '<front>';\n}",
"public function Delete($entity) {\n }",
"private function createDeleteForm(NomDpa $nomdpa)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('dpa_delete', array('id' => $nomdpa->getIddpa())))\n ->setMethod('DELETE')\n ->getForm();\n }",
"private function createDeleteForm($id)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('bien_delete', array('id' => $id)))\n ->setMethod('DELETE')\n // ->add('submit', 'submit', array('label' => 'Delete'))\n ->add('submit', 'submit', array('label' => 'Eliminar','attr' => array('class' => 'btn btn-danger'),))\n ->getForm()\n ;\n }",
"function ds_extras_vd_bundle_remove($form, $form_state, $bundle, $label) {\n $form['#bundle'] = $bundle;\n $form['#label'] = $label;\n return confirm_form($form, t('Are you sure you want to remove bundle @label ?', array('@label' => $label)), 'admin/structure/ds/vd');\n}",
"public function delete($entity)\n {\n \n }",
"private function createDeleteForm(Bien $bien)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('backend_bien_delete', array('id' => $bien->getId())))\n ->setMethod('DELETE')\n ->getForm()\n ;\n }",
"private\n function createAnnonceeDeleteForm(Annonce $annonce)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('annoncee_delete', array('id' => $annonce->getAnnonceId())))\n ->setMethod('DELETE')\n ->getForm();\n }",
"private function createDeleteForm(Stable $stable)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('stable_delete', array('id' => $stable->getId())))\n ->setMethod('DELETE')\n ->getForm()\n ;\n }",
"private function createDeleteForm($id)\n {\n $translated = $this->get('translator');\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('configuracao_delete', array('id' => $id)))\n ->setMethod('DELETE')\n ->add('submit', 'submit', array('label' => $translated->transChoice('txt.excluir',0,array(),'messagesCommonBundle'), 'attr' => array('class' => 'btn btn-danger btn-lg')))\n ->getForm()\n ;\n }",
"private function createDeleteForm(DatParteDesvio $datParteDesvio)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('partedesvio_delete', array('id' => $datParteDesvio->getIdparte())))\n ->setMethod('DELETE')\n ->getForm();\n }",
"public function createDeleteForm($id){\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('rsp_delete',array('id'=>$id)))\n ->setMethod('DELETE')\n ->add('submit','submit',array('label'=>'Delete'))\n ->getForm()\n ;\n }",
"private function createDeleteForm(Nomenclature $nomenclature)\n {\n\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('nomenclature_delete', array('id' => $nomenclature->getId())))\n ->setMethod('DELETE')\n ->getForm()\n ;\n }",
"private function createDeleteForm(Component $component)\n {\n return $this->createFormBuilder()->setAction($this->generateUrl('component_delete', array('id' => $component->getId())))->setMethod('DELETE')->getForm();\n }",
"private function createDeleteForm(LoteInsumo $loteInsumo)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('loteinsumo_delete', array('id' => $loteInsumo->getId())))\n ->setMethod('DELETE')\n ->getForm()\n ;\n }",
"private\n function createPaiementDeleteForm(Paiement $paiement)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('annoncee_delete', array('id' => $paiement->getPaiementId())))\n ->setMethod('DELETE')\n ->getForm();\n }",
"public function deleteFormAction($id) {\n $form = $this->createDeleteForm($id);\n $entity = $this->getItem($id);\n\n return array(\n 'form' => $form->createView(),\n 'order' => $this->getOrder(),\n 'entity' => $this->getOrder()\n );\n }",
"private function createDeleteForm(Outlet $outlet)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('/db2/outlet_delete', array('id' => $outlet->getId())))\n ->setMethod('DELETE')\n ->getForm()\n ;\n }",
"private function createDeleteForm(Personnage $personnage)\n {\n return $this->createFormBuilder()\n ->setAction($this->generateUrl('personnage_delete', array('id' => $personnage->getId())))\n ->setMethod('DELETE')\n ->getForm()\n ;\n }"
]
| [
"0.65059566",
"0.65002024",
"0.64804673",
"0.6416298",
"0.64131904",
"0.6307785",
"0.62689507",
"0.62194777",
"0.6204152",
"0.61482984",
"0.6147878",
"0.6127656",
"0.6116169",
"0.6108576",
"0.6107843",
"0.60805726",
"0.60765046",
"0.60756636",
"0.60694903",
"0.6067795",
"0.60512495",
"0.60494226",
"0.60469997",
"0.6043688",
"0.602468",
"0.6022592",
"0.60202837",
"0.60185194",
"0.601413",
"0.599728"
]
| 0.6678628 | 0 |
Show all defined mongo entities to administer. | function mongo_node_entities() {
$set = mongo_node_settings();
$base_path = 'admin/structure/mongo-node';
$header = array(t('Name'), array(
'data' => t('Operations'),
'colspan' => 3,
),
);
foreach ($set as $entity_type => $settings) {
$rows[] = array(
array('data' => l($settings['label'], $base_path . '/' . $entity_type)),
array('data' => l(t('edit'), $base_path . '/' . $entity_type . '/edit')),
array('data' => l(t('delete'), $base_path . '/' . $entity_type . '/delete')),
);
}
$output = theme('table', array(
'rows' => $rows,
'header' => $header,
'empty' => t('No entities created yet.'),
)
);
return $output;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function showAll()\n {\n $objects = $this->repo->showAll();\n return view('admin.showAll', compact('objects') );\n }",
"public function findAllAdmin() {\n\t\t\t$result = $this->createQuery()->execute();\n\t\t\treturn $result;\n\t\t}",
"function findAllAdministrators() {\r\n\r\n\t\treturn ($this->query('SELECT * FROM admins;'));\r\n\r\n\t}",
"public function index()\n {\n return Admins::all();\n }",
"public function all()\n {\n if (!$this->isLogged())\n {\n header('Location: ' . ROOT_URL);\n exit; \n }\n else{\n\n $this->oUtil->oAdd_Admins = $this->oModel->getAll();\n\n $this->oUtil->getView('admin');\n }\n }",
"public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $entities = $em->getRepository('UserBundle:User')->findAllAdmin();\n\n return $this->render('AdminBundle:admin:index.html.twig', array(\n 'entities' => $entities\n ));\n }",
"public function admin_index() {\r\n\t\t$this->data = $this->{$this->modelClass}->find('all');\r\n }",
"public function index()\n {\n return Entity::all();\n }",
"public function index()\n {\n $admins = Admin::paginate(5);\n return AdminResourceCollection::collection($admins);\n }",
"public function index()\n {\n $admin = Admin::simplePaginate(25);\n \n return new AdminResourceCollection($admin);\n }",
"public function getAllEntities();",
"public function showAllAction( Request $request)\n { $em = $this->getDoctrine()->getManager();\n\n $entrepots = $em->getRepository('GererEntrepotBundle:Entrepot')->findAll();\n\n\n return $this->render('@GererEntrepot/admin/index.html.twig', array(\n 'entrepots' => $entrepots,\n ));\n\n }",
"function admin_index() {\n\t\t$this->Article->recursive = 0;\n\t\t$this->set('articles', $this->paginate());\n\t}",
"public function showEntities()\n {\n return Entity::paginate(10);\n }",
"function show_all()\n{\n\tsystem('clear');\n\tglobal $collection;\n\t$cursor = $collection->find();\n\t$cursor->sort(array('Login' => 1));\n\tforeach ($cursor as $document) {\n echo \"Login: \".$document[\"Login\"].\" Nom: \".$document[\"Nom\"]\n .\" Promo: \".$document[\"Promo\"].\" Email: \".$document[\"Email\"]\n .\" Téléphone: \".$document[\"Telephone\"].\"\\n\";\n }\necho \"\\n\";\n}",
"function list()\n {\n print_r($this->collection);\n }",
"public function index()\n {\n $this->allowedAdminAction();\n\n return $this->showAll(Organizador::all());\n }",
"public function listAdminAction() {\n $dons = $this->getDoctrine()->getManager()->getRepository('EasyDonBundle:Don')->findAll();\n\n return $this->render('EasyDonBundle:Don:listAdmin.html.twig', array('dons' => $dons));\n }",
"public function showAdmins() { \n\t\n return View('admin.admins');\n\t\t\t\n }",
"public function indexAdmin()\n\t{\n\t\treturn ResourcesWorks::collection(Works::all());\n\t}",
"public function indexAction() {\n $entities = $this\n ->_getRepository()\n ->findAllOrdered();\n\n return array(\n 'entities' => $entities,\n 'configtypes' => new ConfigTypes(),\n );\n }",
"public function index(): Collection\n {\n return $this->repository->findAll();\n }",
"public function all(){\r\n\treturn $this->getRepository()->findAll();\r\n }",
"function managementAdminAll(){\n $Admins = new \\Project\\Models\\ManagementAdminManager();\n $allAdmin = $Admins->allManagementAdmin();\n\n require 'app/views/back/managementAdmin.php';\n }",
"public function getAll()\n {\n return Admin::paginate($this->pagination);\n }",
"public function all()\n {\n $admins = User::all();\n return view('admin.index')->with('admins', $admins);\n }",
"public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $entities = $em->getRepository('RudakBlogBundle:Post')->getAdminIndexList();\n\n return $this->render('RudakBlogBundle:Post:index.html.twig', array(\n 'entities' => $entities,\n ));\n }",
"public function admin_index() {\r\n \r\n $sucursales = $this->Sucursal->find(\"all\");\r\n $this->set(compact('sucursales'));\r\n \r\n }",
"public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $entities = $em->getRepository('AdminBundle:User')->findAll();\n\n return array(\n 'entities' => $entities,\n );\n }",
"private function showCollections()\n {\n $currentDB = $this->currentDB;\n if (!empty($currentDB)) {\n $collections = $this->mongoClient->selectDatabase($currentDB)->listCollections();\n foreach ($collections as $collection) {\n $this->cli->shout(' ' . $collection->getName());\n }\n } else {\n $this->cli->error('Please select db');\n }\n }"
]
| [
"0.67338544",
"0.66438824",
"0.6639408",
"0.65726495",
"0.6551215",
"0.64955777",
"0.6485584",
"0.6479486",
"0.64198875",
"0.6326081",
"0.6307325",
"0.6274499",
"0.6237284",
"0.61738837",
"0.61732745",
"0.6170904",
"0.61017853",
"0.6087415",
"0.60782176",
"0.60630286",
"0.60231906",
"0.601617",
"0.60123044",
"0.596701",
"0.5965927",
"0.59531456",
"0.59138095",
"0.5910899",
"0.5904185",
"0.5896983"
]
| 0.6673599 | 1 |
Mongo entity filter submit handler. It is used by the filter buttons in mongo_node_admin_content(). | function mongo_node_filters_submit($form, &$form_state) {
$entity_type = $form_state['values']['entity_type'];
$filters = mongo_node_filters($entity_type);
$op = strtolower($form_state['input']['op']);
if ($op == 'reset') {
// Remove all filters.
unset($_SESSION[$entity_type . '_filters']);
}
elseif ($op == 'undo') {
// Remove last filter.
array_pop($_SESSION[$entity_type . '_filters']);
}
else {
// Apply filters.
foreach ($filters as $f_type => $f_val) {
if (!isset($form_state['values'][$f_type]) || $form_state['values'][$f_type] == 'any') {
continue;
}
$filter = $form_state['values'][$f_type];
if (!isset($_SESSION[$entity_type . '_filters'])) {
$_SESSION[$entity_type . '_filters'] = array();
}
$exists = FALSE;
foreach ($_SESSION[$entity_type . '_filters'] as &$app_filter) {
if ($app_filter['#type'] == $f_type && $app_filter['#value'] == $filter) {
$exists = TRUE;
break;
}
}
// Skip filter if already applied.
if ($exists) {
continue;
}
// Add filter to session.
$_SESSION[$entity_type . '_filters'][] = array(
'#type' => $f_type,
'#value' => $filter,
);
}
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function mongo_node_admin_content($form, $form_state, $entity_type) {\n $settings = mongo_node_settings();\n\n // Send entity type.\n $form['entity_type'] = array(\n '#type' => 'value',\n '#value' => $entity_type,\n );\n\n $form['filters'] = array(\n '#type' => 'fieldset',\n '#title' => t('Show only items where'),\n );\n\n $filters = mongo_node_filters($entity_type);\n $applied_filters = isset($_SESSION[$entity_type . '_filters']) ? $_SESSION[$entity_type . '_filters'] : array();\n\n foreach ($filters as $f_type_name => $f_type) {\n $form['filters'][$f_type_name] = array('#type' => 'select', '#title' => $f_type_name);\n foreach ($f_type as $f_name => $f_val) {\n $form['filters'][$f_type_name]['#options'][$f_name] = $f_val['label'];\n }\n }\n\n $items = array();\n $remaining_filters = array();\n foreach ($applied_filters as $app_filter) {\n $items[] = t('where %f_name is %f_val', array('%f_name' => $app_filter['#type'], '%f_val' => $app_filter['#value']));\n $conditions = $filters[$app_filter['#type']][$app_filter['#value']]['filters'];\n foreach ($conditions as $condition) {\n $remaining_filters[$condition['#type']]['#callback'] = $condition['#callback'];\n $remaining_filters[$condition['#type']]['#value'][] = $condition['#value'];\n }\n }\n\n $form['filters']['#description'] = theme('item_list', array('items' => $items));\n\n if (empty($applied_filters)) {\n $form['filters']['filter'] = array(\n '#type' => 'submit',\n '#value' => 'Filter',\n '#submit' => array('mongo_node_filters_submit'),\n );\n }\n else {\n $form['filters']['refine'] = array(\n '#type' => 'submit',\n '#value' => 'Refine',\n '#submit' => array('mongo_node_filters_submit'),\n );\n $form['filters']['undo'] = array(\n '#type' => 'submit',\n '#value' => 'Undo',\n '#submit' => array('mongo_node_filters_submit'),\n );\n $form['filters']['reset'] = array(\n '#type' => 'submit',\n '#value' => 'Reset',\n '#submit' => array('mongo_node_filters_submit'),\n );\n }\n\n $form['options'] = array(\n '#type' => 'fieldset',\n '#title' => t('Update options'),\n );\n\n $operations = mongo_node_operations();\n foreach ($operations as $op => $op_set) {\n $options[$op] = $op_set['label'];\n }\n $form['options']['operation'] = array(\n '#type' => 'select',\n '#options' => $options,\n );\n\n $form['options']['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Update'),\n '#validate' => array('mongo_node_operation_validate'),\n '#submit' => array('mongo_node_operation_submit'),\n );\n\n $query = new EntityFieldQuery();\n\n $query->entityCondition('entity_type', $entity_type)\n ->propertyOrderBy('created', 'DESC')\n ->pager(10);\n\n // Actually apply filters.\n foreach ($remaining_filters as $r_name => $r_values) {\n $query->{$r_values['#callback']}($r_name, $r_values['#value'], 'IN');\n }\n\n $result = $query->execute();\n\n $languages = language_list();\n $destination = drupal_get_destination();\n $header = array(\n 'title' => array('data' => t('Title'), 'field' => 'title'),\n 'type' => t('Type'),\n 'author' => t('Author'),\n 'status' => t('Status'),\n 'changed' => t('Updated'),\n 'language' => t('Language'),\n 'operations' => t('Operations'),\n );\n $options = array();\n\n if (isset($result[$entity_type])) {\n $ids = array_keys($result[$entity_type]);\n $entities = entity_load($entity_type, $ids);\n\n foreach ($result[$entity_type] as $id => $efq_entity) {\n $entity = entity_load($entity_type, array($id));\n $entity = reset($entity);\n\n $entity_uri = entity_uri($entity_type, $entity);\n\n $options[$id] = array(\n 'title' => array(\n 'data' => array(\n '#type' => 'link',\n '#title' => $entity->title,\n '#href' => $entity_uri['path'],\n ),\n ),\n 'type' => check_plain($settings[$entity_type]['bundles'][$entity->type]['label']),\n 'author' => theme('username', array('account' => $entity)),\n 'status' => $entity->status ? t('published') : t('not published'),\n 'changed' => format_date($entity->changed, 'short'),\n 'language' => ($entity->language == LANGUAGE_NONE) ? t('Language neutral') : $languages[$entity->language]->name,\n );\n\n $operations = array();\n $operations[] = l(t('edit'), $entity_uri['path'] . '/edit', array('query' => $destination));\n $operations[] = l(t('delete'), $entity_uri['path'] . '/delete', array('query' => $destination));\n\n $options[$id]['operations'] = theme('item_list', array('items' => $operations, 'attributes' => array('class' => 'inline')));\n }\n }\n\n $form['entities'] = array(\n '#type' => 'tableselect',\n '#header' => $header,\n '#options' => $options,\n '#empty' => t('No content available'),\n );\n\n $form['pager'] = array(\n '#theme' => 'pager',\n );\n\n return $form;\n}",
"public function requireFilterSubmit()\n\t{\n\t}",
"public function onSearch()\n {\n // get the search form data\n $data = $this->form->getData();\n \n if ($this->formFilters)\n {\n foreach ($this->formFilters as $filterKey => $formFilter)\n {\n $operator = isset($this->operators[$filterKey]) ? $this->operators[$filterKey] : 'like';\n $filterField = isset($this->filterFields[$filterKey]) ? $this->filterFields[$filterKey] : $formFilter;\n $filterFunction = isset($this->filterTransformers[$filterKey]) ? $this->filterTransformers[$filterKey] : null;\n \n // check if the user has filled the form\n if (isset($data->{$formFilter}) AND $data->{$formFilter})\n {\n // $this->filterTransformers\n if ($filterFunction)\n {\n $fieldData = $filterFunction($data->{$formFilter});\n }\n else\n {\n $fieldData = $data->{$formFilter};\n }\n \n // creates a filter using what the user has typed\n if (stristr($operator, 'like'))\n {\n $filter = new TFilter($filterField, $operator, \"%{$fieldData}%\");\n }\n else\n {\n $filter = new TFilter($filterField, $operator, $fieldData);\n }\n \n // stores the filter in the session\n TSession::setValue($this->activeRecord.'_filter', $filter); // BC compatibility\n TSession::setValue($this->activeRecord.'_filter_'.$formFilter, $filter);\n TSession::setValue($this->activeRecord.'_'.$formFilter, $data->{$formFilter});\n }\n else\n {\n TSession::setValue($this->activeRecord.'_filter', NULL); // BC compatibility\n TSession::setValue($this->activeRecord.'_filter_'.$formFilter, NULL);\n TSession::setValue($this->activeRecord.'_'.$formFilter, '');\n }\n }\n }\n \n TSession::setValue($this->activeRecord.'_filter_data', $data);\n TSession::setValue(get_class($this).'_filter_data', $data);\n \n // fill the form with data again\n $this->form->setData($data);\n \n $param=array();\n $param['offset'] =0;\n $param['first_page']=1;\n $this->onReload($param);\n }",
"public function onSearch()\n {\n // get the search form data\n $data = $this->form->getData();\n $filters = [];\n\n TSession::setValue(__CLASS__.'_filter_data', NULL);\n TSession::setValue(__CLASS__.'_filters', NULL);\n\n if (isset($data->inscricao_evento_id) AND ( (is_scalar($data->inscricao_evento_id) AND $data->inscricao_evento_id !== '') OR (is_array($data->inscricao_evento_id) AND (!empty($data->inscricao_evento_id)) )) )\n {\n\n $filters[] = new TFilter('inscricao_id', 'in', \"(SELECT id FROM inscricao WHERE evento_id = '{$data->inscricao_evento_id}')\");// create the filter \n }\n\n // fill the form with data again\n $this->form->setData($data);\n\n // keep the search data in the session\n TSession::setValue(__CLASS__.'_filter_data', $data);\n TSession::setValue(__CLASS__.'_filters', $filters);\n }",
"public function submit()\n {\n $this->find('css', '.filter-update')->click();\n }",
"public function onSearch()\n {\n // get the search form data\n $data = $this->form->getData();\n $filters = [];\n\n TSession::setValue(__CLASS__.'_filter_data', NULL);\n TSession::setValue(__CLASS__.'_filters', NULL);\n\n if (isset($data->exemplar_id) AND ( (is_scalar($data->exemplar_id) AND $data->exemplar_id !== '') OR (is_array($data->exemplar_id) AND (!empty($data->exemplar_id)) )) )\n {\n\n $filters[] = new TFilter('exemplar_id', '=', $data->exemplar_id);// create the filter \n }\n\n if (isset($data->leitor_id) AND ( (is_scalar($data->leitor_id) AND $data->leitor_id !== '') OR (is_array($data->leitor_id) AND (!empty($data->leitor_id)) )) )\n {\n\n $filters[] = new TFilter('leitor_id', '=', $data->leitor_id);// create the filter \n }\n\n if (isset($data->dt_emprestimo) AND ( (is_scalar($data->dt_emprestimo) AND $data->dt_emprestimo !== '') OR (is_array($data->dt_emprestimo) AND (!empty($data->dt_emprestimo)) )) )\n {\n\n $filters[] = new TFilter('dt_emprestimo', '>=', $data->dt_emprestimo);// create the filter \n }\n\n if (isset($data->dt_emprestimo_final) AND ( (is_scalar($data->dt_emprestimo_final) AND $data->dt_emprestimo_final !== '') OR (is_array($data->dt_emprestimo_final) AND (!empty($data->dt_emprestimo_final)) )) )\n {\n\n $filters[] = new TFilter('dt_emprestimo', '<=', $data->dt_emprestimo_final);// create the filter \n }\n\n if (isset($data->dt_previsao) AND ( (is_scalar($data->dt_previsao) AND $data->dt_previsao !== '') OR (is_array($data->dt_previsao) AND (!empty($data->dt_previsao)) )) )\n {\n\n $filters[] = new TFilter('dt_previsao', '>=', $data->dt_previsao);// create the filter \n }\n\n if (isset($data->dt_prevista_final) AND ( (is_scalar($data->dt_prevista_final) AND $data->dt_prevista_final !== '') OR (is_array($data->dt_prevista_final) AND (!empty($data->dt_prevista_final)) )) )\n {\n\n $filters[] = new TFilter('dt_previsao', '<=', $data->dt_prevista_final);// create the filter \n }\n\n if (isset($data->dt_devolucao) AND ( (is_scalar($data->dt_devolucao) AND $data->dt_devolucao !== '') OR (is_array($data->dt_devolucao) AND (!empty($data->dt_devolucao)) )) )\n {\n\n $filters[] = new TFilter('dt_devolucao', '>=', $data->dt_devolucao);// create the filter \n }\n\n if (isset($data->dt_devolucao_final) AND ( (is_scalar($data->dt_devolucao_final) AND $data->dt_devolucao_final !== '') OR (is_array($data->dt_devolucao_final) AND (!empty($data->dt_devolucao_final)) )) )\n {\n\n $filters[] = new TFilter('dt_devolucao', '<=', $data->dt_devolucao_final);// create the filter \n }\n\n $param = array();\n $param['offset'] = 0;\n $param['first_page'] = 1;\n\n // fill the form with data again\n $this->form->setData($data);\n\n // keep the search data in the session\n TSession::setValue(__CLASS__.'_filter_data', $data);\n TSession::setValue(__CLASS__.'_filters', $filters);\n\n $this->onReload($param);\n }",
"public function filter() {\r\n\t\t$this->resource->filter();\r\n\t}",
"public function _post_filter()\n {\n }",
"function mongo_node_operation_submit($form, &$form_state) {\n $operations = mongo_node_operations();\n $operation = $operations[$form_state['values']['operation']];\n\n $entities = array_filter($form_state['values']['entities']);\n $entity_type = $form_state['values']['entity_type'];\n if ($function = $operation['callback']) {\n // Add in callback arguments if present.\n if (isset($operation['callback arguments'])) {\n $args = array(\n $entity_type,\n $entities,\n $operation['callback arguments'],\n );\n }\n else {\n $args = array($entity_type, $entities);\n }\n call_user_func_array($function, $args);\n cache_clear_all();\n }\n}",
"function simplenews_issue_filter_form_submit($form, &$form_state) {\n switch ($form_state['values']['op']) {\n case t('Filter'):\n $_SESSION['simplenews_issue_filter'] = array(\n 'newsletter' => $form_state['values']['newsletter'],\n );\n break;\n case t('Reset'):\n $_SESSION['simplenews_issue_filter'] = _simplenews_issue_filter_default();\n break;\n }\n}",
"public function addFilterFormInput(): void;",
"public function processFilter()\n {\n call_user_func($this->builder, $this);\n\n return $this->filter->execute();\n }",
"public function action_filter()\n\t{\n\t\tif (Input::post()){\n\t\t\tif (Input::post('filter')){\n\n\t\t\t\trequire APPPATH.'likestv.php';\n\n\t\t\t\ttry {\n\n\t\t\t\t// Retrieve profile information since user is logged in\n\t\t\t\t\t$user_profile = $facebook->api('/me');\n\t\t\t\t \n\t\t\t\t \n\t\t\t\t} catch (FacebookApiException $e) {\n\n\t\t\t\t error_log($e);\n\t\t\t\t $user = null;\n\n\t\t\t\t}\n\t\t\t\t$addfilter = Input::post('filter');\n\n\t\t\t\t// Creates database entry to be added to the database\n\t\t\t\t$preference = Model_Preference::forge(array(\n\t\t\t\t\t'username' => $user_profile[\"username\"],\n\t\t\t\t\t'filter' => $addfilter,\n\t\t\t\t));\n\t\t\t\t$preference and $preference->save();\n\t\t\t\t$this->template->title = 'Channel Filter';\n\t\t\t\t$this->template->content = View::forge('channels/filter');\n\t\t\t\tResponse::redirect('channels/');\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\t// Filter redirects to channels if there is no post\n\t\t\tResponse::redirect('channels/');\n\t\t}\n\t}",
"private function filters() {\n\n\n\t}",
"public function indexForFilter(){\n $user = $this->_ap_right_check();\n if(!$user){\n return;\n }\n $query = $this->{$this->main_model}->find();\n $this->CommonQuery->build_common_query($query,$user,[]); \n $q_r = $query->all();\n $items = array();\n foreach($q_r as $i){\n array_push($items,array(\n 'id' => $i->id, \n 'text' => $i->name\n ));\n } \n\n $this->set(array(\n 'items' => $items,\n 'success' => true,\n '_serialize' => array('items','success')\n ));\n }",
"protected function filter()\n {\n $request = $this->getRequest();\n $session = $request->getSession();\n $filterForm = $this->createForm(new ProductFilterType());\n $em = $this->getDoctrine()->getManager();\n $queryBuilder = $em->getRepository('NiftyThriftyShopBundle:Product')->createQueryBuilder('e')->orderBy('e.productId', 'DESC');\n\n // Reset filter\n if ($request->get('filter_action') == 'reset') {\n $session->remove('ProductControllerFilter');\n }\n\n // Filter action\n if ($request->get('filter_action') == 'filter') {\n // Bind values from the request\n $filterForm->bind($request);\n\n if ($filterForm->isValid()) {\n // Build the query from the given form object\n $this->get('lexik_form_filter.query_builder_updater')->addFilterConditions($filterForm, $queryBuilder);\n // Save filter to session\n $filterData = $filterForm->getData();\n $session->set('ProductControllerFilter', $filterData);\n }\n } else {\n // Get filter from session\n if ($session->has('ProductControllerFilter')) {\n $filterData = $session->get('ProductControllerFilter');\n $filterForm = $this->createForm(new ProductFilterType(), $filterData);\n $this->get('lexik_form_filter.query_builder_updater')->addFilterConditions($filterForm, $queryBuilder);\n }\n }\n\n return array($filterForm, $queryBuilder);\n }",
"public function onSearch()\n {\n // get the search form data\n $data = $this->form->getData();\n $filters = [];\n\n if (count($data->relatorio_id) == 0)\n { \n TTransaction::open('bedevops');\n $conn = TTransaction::get();\n $result = $conn->query('SELECT * FROM relatorio WHERE user_id = '.TSession::getValue(\"userid\").' ORDER BY id DESC LIMIT 4');\n $objects = $result->fetchAll(PDO::FETCH_CLASS, \"stdClass\");\n foreach ($objects as $value) {\n array_push($data->relatorio_id,$value->id);\n }\n TTransaction::close();\n } \n\n TSession::setValue(__CLASS__.'_filter_data', NULL);\n TSession::setValue(__CLASS__.'_filters', NULL);\n\n if (isset($data->categoria_id) AND ( (is_scalar($data->categoria_id) AND $data->categoria_id !== '') OR (is_array($data->categoria_id) AND (!empty($data->categoria_id)) )) )\n {\n\n $filters[] = new TFilter('categoria_id', '=', $data->categoria_id);// create the filter \n }\n\n if (count($data->relatorio_id) <= 4)\n {\n if (isset($data->relatorio_id) AND ( (is_scalar($data->relatorio_id) AND $data->relatorio_id !== '') OR (is_array($data->relatorio_id) AND (!empty($data->relatorio_id)) )) )\n {\n\n $filters[] = new TFilter('relatorio_id', 'in', $data->relatorio_id);// create the filter \n }\n } else {\n throw new Exception('Selecione no máximo 4 relatórios!');\n }\n\n // fill the form with data again\n $this->form->setData($data);\n\n // keep the search data in the session\n TSession::setValue(__CLASS__.'_filter_data', $data);\n TSession::setValue(__CLASS__.'_filters', $filters);\n }",
"protected function filter()\n {\n $request = $this->getRequest();\n $session = $request->getSession();\n $filterForm = $this->createForm(new RemitovolvoFilterType());\n $em = $this->getDoctrine()->getManager();\n $queryBuilder = $em->getRepository('SistemaAdminBundle:Remitovolvo')->createQueryBuilder('e');\n \n // Reset filter\n if ($request->getMethod() == 'POST' && $request->get('filter_action') == 'reset') {\n $session->remove('RemitovolvoControllerFilter');\n }\n \n // Filter action\n if ($request->getMethod() == 'POST' && $request->get('filter_action') == 'filter') {\n // Bind values from the request\n $filterForm->bind($request);\n\n if ($filterForm->isValid()) {\n // Build the query from the given form object\n $this->get('lexik_form_filter.query_builder_updater')->addFilterConditions($filterForm, $queryBuilder);\n // Save filter to session\n $filterData = $filterForm->getData();\n $session->set('RemitovolvoControllerFilter', $filterData);\n }\n } else {\n // Get filter from session\n if ($session->has('RemitovolvoControllerFilter')) {\n $filterData = $session->get('RemitovolvoControllerFilter');\n $filterForm = $this->createForm(new RemitovolvoFilterType(), $filterData);\n $this->get('lexik_form_filter.query_builder_updater')->addFilterConditions($filterForm, $queryBuilder);\n }\n }\n \n return array($filterForm, $queryBuilder);\n }",
"function path_admin_filter_form_submit_filter($form, &$form_state) {\n $form_state['redirect'] = 'admin/build/path/list/'. trim($form_state['values']['filter']);\n}",
"protected function filter()\n {\n $request = $this->getRequest();\n $session = $request->getSession();\n $filterForm = $this->createForm(new EventDateFilterType());\n $em = $this->getDoctrine()->getManager();\n $queryBuilder = $em->getRepository('AtkRegistrationBundle:EventDate')->createQueryBuilder('e');\n\n // Reset filter\n if ($request->get('filter_action') == 'reset') {\n $session->remove('EventDateControllerFilter');\n }\n\n // Filter action\n if ($request->get('filter_action') == 'filter') {\n // Bind values from the request\n $filterForm->bind($request);\n\n if ($filterForm->isValid()) {\n // Build the query from the given form object\n $this->get('lexik_form_filter.query_builder_updater')->addFilterConditions($filterForm, $queryBuilder);\n // Save filter to session\n $filterData = $filterForm->getData();\n $session->set('EventDateControllerFilter', $filterData);\n }\n } else {\n // Get filter from session\n if ($session->has('EventDateControllerFilter')) {\n $filterData = $session->get('EventDateControllerFilter');\n $filterForm = $this->createForm(new EventDateFilterType(), $filterData);\n $this->get('lexik_form_filter.query_builder_updater')->addFilterConditions($filterForm, $queryBuilder);\n }\n }\n\n return array($filterForm, $queryBuilder);\n }",
"private function processSearchForm($filter)\t{\n\t\ttrace('[CMD] '.__METHOD__);\n\n\t\t$formname = 'SearchForm';\n\t\t$choicesArray = array();\n\t\t$disableArray = array();\n\t\t$hideArray = array();\n\n\t\t$failArray = $this->formHandler->fillFormIntoObject($formname, $filter, $choicesArray, $disableArray, $hideArray);\n\t\t// check for failures\n\t\t$msgArray = array();\n\t\tforeach ($failArray as $item) {\n\t\t\t$msgArray[] = $item.' failed';\n\t\t}\n\n\t\t// HOOK: allow multiple hooks to evaluate piVars and manipulate msgArray\n\t\tif (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['pt_gsauserreg']['pi5_hooks']['processSearchFormHook'])) {\n\t\t\tforeach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['pt_gsauserreg']['pi5_hooks']['processSearchFormHook'] as $className) {\n\t\t\t\t$hookObj = &t3lib_div::getUserObj($className);\n\t\t\t\t$msgArray = $hookObj->processSearchFormHook($this, $msgArray, $this->piVars);\n\t\t\t}\n\t\t}\n\n\t\treturn $this->formHandler->checkObjectInForm($formname, $filter, $msgArray, $hideArray);\n\t}",
"function mongo_node_filters($entity_type) {\n $filters = array(\n 'status' => array(\n 'any' => array(\n 'label' => 'Any',\n ),\n 'published' => array(\n 'label' => 'Published',\n 'filters' => array(\n array(\n '#type' => 'status',\n '#value' => 1,\n '#callback' => 'propertyCondition',\n ),\n ),\n ),\n 'not_published' => array(\n 'label' => 'Not published',\n 'filters' => array(\n array(\n '#type' => 'status',\n '#value' => 0,\n '#callback' => 'propertyCondition',\n ),\n ),\n ),\n ),\n 'type' => array(\n 'any' => array(\n 'label' => 'Any',\n ),\n ),\n );\n\n $set = mongo_node_settings();\n $bundles = $set[$entity_type]['bundles'];\n foreach ($bundles as $bundle_name => $bundle_settings) {\n $filters['type'][$bundle_name] = array(\n 'label' => $bundle_settings['label'],\n 'filters' => array(\n array(\n '#type' => 'bundle',\n '#value' => $bundle_name,\n '#callback' => 'entityCondition',\n ),\n ),\n );\n }\n return $filters;\n}",
"public function global_filter_field_expr()\n {\n\n // filtering $_GET\n if (is_array(ctx()->getRequest()->get()) && ! empty(ctx()->getRequest()->get()))\n {\n foreach (ctx()->getRequest()->get() as $key => $val){\n $key=$this->_clean_input_keys($key);\n if($key){\n ctx()->getRequest()->get($key, $this->_clean_input_field_expr($val));\n }\n }\n\n }\n\n // filtering $_POST\n if (is_array(ctx()->getRequest()->post()) && ! empty(ctx()->getRequest()->post()))\n {\n foreach (ctx()->getRequest()->post() as $key => $val){\n $key=$this->_clean_input_keys($key);\n if($key){\n ctx()->getRequest()->post($key, $this->_clean_input_field_expr($val));\n }\n }\n }\n\n // filtering $_COOKIE\n if (is_array(ctx()->getRequest()->cookie()) && ! empty(ctx()->getRequest()->cookie()))\n {\n foreach (ctx()->getRequest()->cookie() as $key => $val){\n $key=$this->_clean_input_keys($key);\n if($key){\n ctx()->getRequest()->cookie($key, $this->_clean_input_field_expr($val));\n }\n\n }\n }\n\n\n // filtering $_REQUEST\n if (is_array(ctx()->getRequest()->request()) && ! empty(ctx()->getRequest()->request()))\n {\n foreach (ctx()->getRequest()->request() as $key => $val){\n $key=$this->_clean_input_keys($key);\n if($key){\n ctx()->getRequest()->request($key, $this->_clean_input_field_expr($val));\n }\n }\n }\n\n }",
"public function filterAction()\r\n {\r\n \t/*\r\n \t * form needs to include:\r\n \t * \r\n \t * user id\r\n \t * task category\r\n \t * client id\r\n \t * project id\r\n \t * start date\r\n \t * end date\r\n \t */\r\n $this->view->allUsers = $this->userService->getUserList();\r\n $task = new Task();\r\n $this->view->categories = $task->constraints['category']->getValues();\r\n $this->view->clients = $this->clientService->getClients();\r\n \t $this->view->projects = new ArrayObject();\r\n $this->renderView('timesheet/filter.php'); \t\r\n }",
"function dblog_filter_form_submit($form, &$form_state) {\n $op = $form_state['values']['op'];\n $filters = dblog_filters();\n switch ($op) {\n case t('Filter'):\n foreach ($filters as $name => $filter) {\n if (isset($form_state['values'][$name])) {\n $_SESSION['dblog_overview_filter'][$name] = $form_state['values'][$name];\n }\n }\n break;\n case t('Reset'):\n $_SESSION['dblog_overview_filter'] = array();\n break;\n }\n return 'admin/reports/dblog';\n}",
"public function filterAction()\n\t{\n\t\t$userSession = new Container('fo_user');\n\t\t$this->layout('frontend');\n\t\t$request \t\t= $this->getRequest();\n\t\t$message\t\t= '';\n\t\t$errorMessage\t= '';\n\t\t\n\t\t//\tDestroy listing Session Vars\n\t\t$listingSession = new Container('fo_listing');\n\t\t/*\t$sessionArray\t= array();\n\t\tforeach($listingSession->getIterator() as $key => $value) {\n\t\t\t$sessionArray[]\t= $key;\n\t\t}\n\t\tforeach($sessionArray as $key => $value) {\n\t\t\t$listingSession->offsetUnset($value);\n\t\t}\t*/\n\t\t\n\t\tif ($request->isPost()) {\n\t\t\t$formData\t= $request->getPost();\n\t\t\t\n\t\t\tif(isset($formData['search'])) {\n\t\t\t\t//\tKeyword\n\t\t\t\tif($formData['search'] != '')\n\t\t\t\t\t$listingSession->keyword\t= $formData['search'];\n\t\t\t\telse\n\t\t\t\t\t$listingSession->keyword\t= '';\n\t\t\t\t\n\t\t\t\t//\tTrack Search Keyword Query\n\t\t\t\t$this->insertSearchQuery($listingSession->keyword);\n\t\t\t\t\n\t\t\t} else {\n\t\t\t\t//\tCategory\n\t\t\t\tif(isset($formData['category']) && $formData['category'] != '')\n\t\t\t\t\t$listingSession->category\t= $formData['category'];\n\t\t\t\telse\n\t\t\t\t\t$listingSession->category\t= '';\n\t\t\t\t//\tRanking\n\t\t\t\tif(isset($formData['ranking']) && $formData['ranking'] != '')\n\t\t\t\t\t$listingSession->ranking\t= $formData['ranking'];\n\t\t\t\telse\n\t\t\t\t\t$listingSession->ranking\t= '';\n\t\t\t\t//\tLength\n\t\t\t\tif(isset($formData['length']) && $formData['length'] != '')\n\t\t\t\t\t$listingSession->length\t= $formData['length'];\n\t\t\t\telse\n\t\t\t\t\t$listingSession->length\t= '';\n\t\t\t\t//\tFriend\n\t\t\t\tif(isset($formData['friend']) && $formData['friend'] != '')\n\t\t\t\t\t$listingSession->friend\t= $formData['friend'];\n\t\t\t\telse\n\t\t\t\t\t$listingSession->friend\t= '';\n\t\t\t\t//\tSeen\n\t\t\t\tif(isset($formData['seen']) && $formData['seen'] != '')\n\t\t\t\t\t$listingSession->seen\t= $formData['seen'];\n\t\t\t\telse\n\t\t\t\t\t$listingSession->seen\t= '';\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn new ViewModel(array(\n\t\t\t'userObject'\t=> $userSession->userSession,\n\t\t\t'message'\t\t=> $message,\n\t\t\t'errorMessage'\t=> $errorMessage,\n\t\t\t'action'\t\t=> $this->params('action'),\n\t\t\t'controller'\t=> $this->params('controller'),\n\t\t));\n }",
"public function onFilterArticle(\\Enlight_Event_EventArgs $args)\n {\n $subject = $args->getSubject();\n $filterBy = $subject->Request()->getParam('filterBy');\n\n list($sqlParams, $filterSql, $categorySql, $imageSQL, $order) = $args->getReturn();\n\n if ($filterBy === 'connect') {\n $imageSQL = '\n LEFT JOIN s_plugin_connect_items as connect_items\n ON connect_items.article_id = articles.id\n ';\n\n $filterSql .= ' AND connect_items.shop_id > 0 ';\n }\n\n return [$sqlParams, $filterSql, $categorySql, $imageSQL, $order];\n }",
"function getFilters() {\r\n global $filterList;\r\n foreach ($filterList as $filter) {\r\n echo getSelectionOptions($filter);\r\n }\r\n echo '<button type=\"submit\" value=\"submit\">Save Filters</button>';\r\n }",
"function mutate($filter,$field=[],$type=null)\n\t{\n\t\tif(count($filter)>0)\n\t\t{\n\t\t\tif($type==null)\n\t\t\t{\n\t\t\t\t$this->{$this->model}->mutate($filter,$field);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->{$this->model}->$type($filter,$field);\t\n\t\t\t}\n\t\t\t$this->json($this->post->success_mutation());\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->json($this->post->fail());\n\t\t}\n\t}",
"public function afterFilter()\n\t{\n\n\t}"
]
| [
"0.6391795",
"0.63402665",
"0.60834455",
"0.5925225",
"0.58937114",
"0.5856125",
"0.5801112",
"0.5790417",
"0.5740966",
"0.5717158",
"0.56784385",
"0.56057435",
"0.5585326",
"0.5578976",
"0.5576083",
"0.5572961",
"0.55641407",
"0.55086225",
"0.5496539",
"0.548823",
"0.54838896",
"0.54813385",
"0.54723823",
"0.5471349",
"0.54708767",
"0.5463141",
"0.54605085",
"0.5458963",
"0.5443064",
"0.5443004"
]
| 0.72924733 | 0 |
Form submit handler for mongo_node_form(). | function mongo_node_form_submit(&$form, &$form_state) {
$entity_type = $form_state['entity_type'];
$entity = entity_ui_controller($entity_type)->entityFormSubmitBuildEntity($form, $form_state);
$insert = empty($entity->mid);
entity_save($entity_type, $entity);
$info = entity_get_info($entity_type);
$bundle_key = $info['bundle keys']['bundle'];
$bundle_label = $info['bundles'][$entity->{$bundle_key}]['label'];
if ($insert) {
drupal_set_message(t('@label %title has been created.',
array(
'@label' => $bundle_label,
'%title' => $entity->title,
)
)
);
}
else {
drupal_set_message(t('@label %title has been updated.',
array(
'@label' => $bundle_label,
'%title' => $entity->title,
)
)
);
}
$uri = entity_uri($entity_type, $entity);
$form_state['redirect'] = drupal_get_path_alias($uri['path']);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function mongo_node_operation_submit($form, &$form_state) {\n $operations = mongo_node_operations();\n $operation = $operations[$form_state['values']['operation']];\n\n $entities = array_filter($form_state['values']['entities']);\n $entity_type = $form_state['values']['entity_type'];\n if ($function = $operation['callback']) {\n // Add in callback arguments if present.\n if (isset($operation['callback arguments'])) {\n $args = array(\n $entity_type,\n $entities,\n $operation['callback arguments'],\n );\n }\n else {\n $args = array($entity_type, $entities);\n }\n call_user_func_array($function, $args);\n cache_clear_all();\n }\n}",
"function mongo_node_type_create_form_submit($form, $form_state) {\n $label = $form_state['values']['label'];\n $machine_name = $form_state['values']['name'];\n\n $set = mongo_node_settings();\n $set += mongo_node_type_default_settings($label, $machine_name);\n\n // @todo - redirect to entity type page\n mongo_node_settings_save($set);\n}",
"function mongo_node_form($form, &$form_state, $entity, $entity_type) {\n $form = array();\n\n $form_state['entity_type'] = $entity_type;\n if (!isset($form_state[$entity_type])) {\n $form_state[$entity_type] = $entity;\n }\n else {\n $entity = $form_state[$entity_type];\n }\n\n // Get title label name from properties if exists\n static $settings = array();\n if(empty($settings)) {\n $settings = mongo_node_settings();\n }\n $title = isset($settings[$entity_type]['properties']['title']['label']) ? $settings[$entity_type]['properties']['title']['label'] : t('Title');\n\n $form['title'] = array(\n '#type' => 'textfield',\n '#title' => $title,\n '#required' => TRUE,\n '#default_value' => isset($entity->title) ? $entity->title : '',\n );\n\n $form['#attributes']['class'][] = 'mongo-node-form';\n if (!empty($entity->type)) {\n // TODO -- add entity type with bundle.\n $form['#attributes']['class'][] = 'mongo-node-' . $entity->type . '-form';\n }\n\n $form['actions'] = array('#type' => 'actions');\n $form['actions']['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save'),\n '#weight' => 5,\n '#submit' => array('mongo_node_form_submit'),\n );\n\n $form['#validate'][] = 'mongo_node_form_validate';\n field_attach_form($entity_type, $entity, $form, $form_state);\n\n return $form;\n}",
"function mongo_node_type_edit_form_submit($form, $form_state) {\n $label = $form_state['values']['label'];\n $machine_name = $form_state['values']['name'];\n $old_entity_type = $form_state['values']['entity_type'];\n\n $set = mongo_node_settings();\n\n if ($machine_name != $old_entity_type) {\n $set += mongo_node_type_default_settings($label, $machine_name);\n $set[$machine_name] = $set[$old_entity_type];\n unset($set[$old_entity_type]);\n\n // Update existing mongo entities with new entity type.\n _mongo_node_update_type($old_entity_type, $machine_name);\n }\n else {\n $set[$machine_name]['label'] = $label;\n }\n\n // Save settings.\n mongo_node_settings_save($set);\n return TRUE;\n}",
"function main() {\n\t\tif ($_SERVER['REQUEST_METHOD'] === 'POST') {\n\t\t\tprint_r($_POST);\n\t\t\techo \"<br />\";\n\t\t\t\n\t\t\t// Required Fields in the POST data //\t\t\t\n\t\t\tif ( !isset($_POST['_type']) ) return;\n\t\t\tif ( !isset($_POST['_subtype']) ) return;\n\t\t\tif ( !isset($_POST['_name']) ) return;\n\t\t\tif ( !isset($_POST['_mail']) ) return;\n\t\t\tif ( !isset($_POST['_password']) ) return;\n\t\t\tif ( !isset($_POST['_publish']) ) return;\n\t\n\t\t\t// Node Type //\n\t\t\t$type = sanitize_NodeType($_POST['_type']);\n\t\t\tif ( empty($type) ) return;\t\n\n\t\t\t$subtype = sanitize_NodeType($_POST['_subtype']);\n\t\n\t\t\t// Name/Title //\n\t\t\t$name = $_POST['_name'];\t// TODO: Sanitize\n\t\t\t\n\t\t\t// Slug //\n\t\t\tif ( empty($_POST['_slug']) )\n\t\t\t\t$slug = $_POST['_name'];\n\t\t\telse\n\t\t\t\t$slug = $_POST['_slug'];\n\t\t\t$slug = sanitize_Slug($slug);\n\t\t\tif ( empty($slug) ) return;\n\t\t\t\n\t\t\t// TODO: Confirm slug is legal\n\t\t\t\t\n\t\t\t// Body //\n\t\t\t$body = $_POST['_body'];\t// TODO: Sanitize\n\t\t\t\n\t\t\t// Do we publish? //\n\t\t\t$publish = mb_strtolower($_POST['_publish']) == \"true\";\n\t\t\t\n\t\t\t// Email //\n\t\t\t$mail = sanitize_Email($_POST['_mail']);\n\t\t\tif ( empty($mail) ) return;\n\n\t\t\t// Password //\n\t\t\t$password = $_POST['_password'];\n\t\t\tif ( empty($password) ) return;\n\n\t\n\t\t\t$id = node_Add(\n\t\t\t\t$type,$subtype,$slug,$name,$body,\n\t\t\t\t0,2,\n\t\t\t\t$publish\n\t\t\t);\n\t\t\t\n\t\t\tuser_Add($id,$mail,$password);\n\t\n\t\t\techo \"Added \" . $id . \".<br />\";\n\t\t\techo \"<br />\";\n\t\t}\n\t}",
"function happywedding_node_form_submit($form, &$form_state) {\n global $user;\n //dpm($user);\n if ( !empty($form_state['nid']) && isset($_GET['vendor'] ) ) {\n \n $type = $form['type']['#value'];\n if (in_array('vendor', $user->roles)) {\n $basepath = 'bo/vendor/';\n } else {\n $basepath = 'node/';\n }\n //dpm($form);\n if($type=='news')\n $form_state['redirect'] = $basepath.$_GET['vendor'].'/'.$type;\n else if($type=='product') {\n $query = array('category' => array());\n foreach($form[\"field_product_category\"][\"und\"][\"#value\"] as $key => $value){\n $query[\"category\"][] = $key; \n }\n $form_state['redirect'] = array( \n $basepath.$_GET['vendor'].'/categories/'.$type.'s' ,\n array('query' => $query ) \n );\n //dpm($form_state['redirect']);\n }else\n $form_state['redirect'] = $basepath.$_GET['vendor'].'/'.$type.'s';\n }\n}",
"public function updateSubmitHandler(array &$form, FormStateInterface $form_state) {\n $node_id = $form_state->getValue('article_title');\n $node = Node::load($node_id);\n $node->setSticky($form_state->getValue('sticky'));\n $node->setPublished($form_state->getValue('status'));\n $node->save();\n }",
"private function _handleFormPost()\n {\n // see submit.php\n // 'FILE_OBJECTS' => 'handle_file_post',\n // 'BASE64_ENCODED_FILE_OBJECTS' => 'handle_base64_encoded_file_post',\n // 'TRANSFER_IDS' => 'handle_transfer_ids_post'\n }",
"public static abstract function postSubmit(Form $form);",
"function node_form_submit_build_node($form, &$form_state) {\n // Unset any button-level handlers, execute all the form-level submit\n // functions to process the form values into an updated node.\n unset($form_state['submit_handlers']);\n form_execute_handlers('submit', $form, $form_state);\n $node = node_submit($form_state['values']);\n $form_state['node'] = (array)$node;\n $form_state['rebuild'] = TRUE;\n return $node;\n}",
"function process() {\n // We always call the parent's method\n parent::process();\n $d = $this->getDocument();\n \n // We pass the form our request object and the location of us so the form\n // will make us handle the input (as actually we take care of processing\n // this form) - it could link to any other action as long as it is aware\n // of the form\n $form = new Form($this->getRequest(), new Location($this), Request::METHOD_POST);\n \n // This is how you prepare values for the radio buttons\n $radios = array('visa', 'master');\n \n // This is how we prepare the fields\n $form->addField('text1', new TextInputField('Your name here please', \n new RegexValidator('^[[:alpha:]]+[[:space:]][[:alpha:]]+$')));\n $form->addField('pass1', \n new TextInputField('', new RegexValidator('^[[:digit:]]{16}$'), TextInputField::PASSWORD));\n $form->addField('text2', new TextInputField('', null, TextInputField::TEXTAREA));\n $form->addField('check1', new CheckBoxInputField());\n $form->addField('payment', new RadioButtonInputField('visa', $radios));\n \n // Here we test if the form was correctly submitted\n if($form->isValidSubmission()) {\n // Normally, we would do something useful here and redirect to another page\n // since this form uses the POST method\n $d->setVariable('success', true);\n }\n \n // Here we place the form into the document variable so it can process it\n $d->setVariable('form', $form);\n }",
"function mongo_node_bundle_edit_form_submit($form, $form_state) {\n\n $label = $form_state['values']['label'];\n $machine_name = $form_state['values']['name'];\n $entity_type = $form_state['values']['bundle_type']['entity_type'];\n $old_bundle_type = $form_state['values']['bundle_type']['bundle'];\n $description = $form_state['values']['description'];\n\n $set = mongo_node_settings();\n\n if ($machine_name != $old_bundle_type) {\n $set[$entity_type]['bundles'] += mongo_node_bundle_default_settings($label, $machine_name, $description);\n $set[$entity_type]['bundles'][$machine_name] = $set[$entity_type]['bundles'][$old_bundle_type];\n unset($set[$entity_type]['bundles'][$old_bundle_type]);\n\n // Update existing mongo entities with new bundle.\n //_mongo_node_update_bundle($entity_type, $old_bundle_type, $machine_name);\n }\n else {\n $set[$entity_type]['bundles'][$machine_name]['label'] = $label;\n $set[$entity_type]['bundles'][$machine_name]['description'] = $description;\n }\n\n // Save settings.\n mongo_node_settings_save($set);\n return TRUE;\n}",
"function mongo_node_form_validate(&$form, &$form_state) {\n $entity_type = $form_state['entity_type'];\n $entity = $form_state[$entity_type];\n field_attach_form_validate($entity_type, $entity, $form, $form_state);\n}",
"function islandora_collection_search_form_submit($form, &$form_state) {\n $form_state['rebuild'] = TRUE;\n $search_string = $form_state['values']['islandora_simple_search_query'];\n // Replace the slash so url doesn't break.\n module_load_include('inc', 'islandora_solr', 'includes/utilities');\n $search_string = islandora_solr_replace_slashes($search_string);\n $collection_select = isset($form_state['values']['collection_select']) ?\n $form_state['values']['collection_select'] :\n FALSE;\n\n // Using edismax by default.\n $query = array('type' => 'edismax');\n if (isset($collection_select) && $collection_select !== 'all') {\n $query['cp'] = $collection_select;\n }\n drupal_goto('islandora/search/' . $search_string, array('query' => $query));\n}",
"function mongo_node_bundle_create_form_submit($form, $form_state) {\n $entity_type = $form_state['values']['entity_type'];\n\n $label = $form_state['values']['label'];\n $machine_name = $form_state['values']['name'];\n $description = $form_state['values']['description'];\n\n $set = mongo_node_settings();\n $set[$entity_type]['bundles'] += mongo_node_bundle_default_settings($label, $machine_name, $description);\n\n // @todo - redirect to bundle type page.\n mongo_node_settings_save($set);\n}",
"function submit() {\n foreach ($this->submit_callbacks as $callback) {\n call_user_func($callback, $this);\n }\n foreach ($this->children as $element) {\n $element->submit();\n }\n }",
"function mongo_node_type_delete_form_submit($form, $form_state) {\n $set = mongo_node_settings();\n\n // Remove entity type.\n $entity_type = $form_state['values']['entity_type'];\n unset($set[$entity_type]);\n\n // Drop collection that stores entities for entity type.\n $collection = mongodb_collection('fields_current', $entity_type);\n $collection->drop();\n\n // Drop collection that stores entity types autoincrement ids.\n $collection = mongodb_collection($entity_type . '_ids');\n $collection->drop();\n\n mongo_node_settings_save($set);\n\n // Redirect to entity type admin.\n drupal_goto('admin/structure/mongo-node');\n}",
"function submit()\n {\n\t\t//all data is handled by submit2()\n }",
"function lib4ridora_ingest_selector_form_submit(array $form, array &$form_state) {\n module_load_include('inc', 'xml_form_builder', 'includes/associations');\n module_load_include('inc', 'lib4ridora', 'includes/utilities');\n module_load_include('inc', 'lib4ridora', 'includes/citation.subtypes');\n $association_step_storage = &islandora_ingest_form_get_step_storage($form_state, 'xml_form_builder_association_step');\n $association_step_storage['journal_import_method'] = $form_state['values']['journal_import_method'];\n $association_step_storage['doi'] = $form_state['values']['doi'];\n $association_step_storage['ingest_selector'] = $form_state['values']['ingest_selector'];\n\n $subtype = $form_state['values']['ingest_selector'];\n $subtypes = lib4ridora_citation_form_subtypes();\n $form_name = $subtypes[$subtype]['form'];\n foreach (xml_form_builder_get_associations(array($form_name), array(), array('MODS')) as $key => $association) {\n // Update the content_model to be ir:citationCModel so that regardless of\n // the form used it will only have the ir:citationCModel.\n $association['content_model'] = \"ir:citationCModel\";\n $association_step_storage['association'] = $association;\n break;\n }\n if (!isset($association_step_storage['association'])) {\n form_set_error('ingest_selector', t('A form could not be determined for the selected publication type.'));\n }\n}",
"function elife_article_markup_doi_edit_form_submit(&$form, &$form_state) {\n // Nothing.\n}",
"function handle_form() {\n\t\tglobal $wpdb;\n\t\t\n\t\t// Exit if user not logged in\n\t\t// TODO: GET THIS WORKING TO AVOID NON-ADMINS USING IT\n/*\t\tif( ! is_user_logged_in() ) {\n\t\t\tcpd_not_logged_in_message();\n\t\t\treturn;\t\n\t\t}\n*/\n\t\t// Exit if the Cancel button was pressed, and redirect to page that lists all orgs\n\t\tif( isset( $_POST['submit'] ) && 'Cancel' == $_POST['submit'] ) {\n\t\t\t\n\t\t\t// TODO: Check destination\n\t\t\twp_safe_redirect( site_url() . '/admin/list-orgs' );\n\t\t\texit();\n\t\t}\n\n\t\t$org = new Organisation();\n\n\t\t$org->save_org_from_post();\n\t\t\n\t}",
"function process_form()\n {\n }",
"public function process_post() {\n\t\t$name = $this->node->attr('name');\n\n\n\t\tif (!empty($_POST) && $this->get_post_value($name)) {\n//\t\t\t$this->value = $this->get_post_value($name);\n\t\t\t$this->value($this->get_post_value($name));\n\t\t}\n\t}",
"protected function _handle_forms()\n\t{\n\t\tif (!strlen($this->_form_posted)) return;\n\t\t$method = 'on_'.$this->_form_posted.'_submit';\n\n\t\tif (method_exists($this, $method))\n\t\t{\n\t\t\tcall_user_func(array($this, $method), $this->_form_action);\n\t\t\treturn;\n\t\t}\n\n\t\tforeach ($this->controls as $k=>$v)\n\t\t{\n\t\t\t$ctl = $this->controls[$k];\n\n\t\t\tif (method_exists($ctl, $method))\n\t\t\t{\n\t\t\t\t$ctl->page = $this;\n\t\t\t\tcall_user_func(array($ctl, $method), $this->_form_action);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tif (DEBUG) dwrite(\"Method '$method' not defined\");\n\t}",
"function mongo_node_page_delete_submit($form, &$form_state) {\n if ($form_state['values']['confirm']) {\n $entity = $form['#entity'];\n $entity->delete();\n\n $entity_type = $entity->entityType();\n $info = entity_get_info($entity_type);\n $bundle_key = $info['bundle keys']['bundle'];\n $bundle_label = $info['bundles'][$entity->{$bundle_key}]['label'];\n\n drupal_set_message(t('@label %title deleted',\n array(\n '@label' => $bundle_label,\n '%title' => $entity->title)\n )\n );\n }\n\n $form_state['redirect'] = '<front>';\n}",
"public function submitEvent();",
"function node_form(&$form_state, $node) {\n global $user;\n\n if (isset($form_state['node'])) {\n $node = $form_state['node'] + (array)$node;\n }\n if (isset($form_state['node_preview'])) {\n $form['#prefix'] = $form_state['node_preview'];\n }\n $node = (object)$node;\n foreach (array('body', 'title', 'format') as $key) {\n if (!isset($node->$key)) {\n $node->$key = NULL;\n }\n }\n if (!isset($form_state['node_preview'])) {\n node_object_prepare($node);\n }\n else {\n $node->build_mode = NODE_BUILD_PREVIEW;\n }\n\n // Set the id of the top-level form tag\n $form['#id'] = 'node-form';\n\n // Basic node information.\n // These elements are just values so they are not even sent to the client.\n foreach (array('nid', 'vid', 'uid', 'created', 'type', 'language') as $key) {\n $form[$key] = array(\n '#type' => 'value',\n '#value' => isset($node->$key) ? $node->$key : NULL,\n );\n }\n\n // Changed must be sent to the client, for later overwrite error checking.\n $form['changed'] = array(\n '#type' => 'hidden',\n '#default_value' => isset($node->changed) ? $node->changed : NULL,\n );\n // Get the node-specific bits.\n if ($extra = node_invoke($node, 'form', $form_state)) {\n $form = array_merge_recursive($form, $extra);\n }\n if (!isset($form['title']['#weight'])) {\n $form['title']['#weight'] = -5;\n }\n\n $form['#node'] = $node;\n\n // Add a log field if the \"Create new revision\" option is checked, or if the\n // current user has the ability to check that option.\n if (!empty($node->revision) || user_access('administer nodes')) {\n $form['revision_information'] = array(\n '#type' => 'fieldset',\n '#title' => t('Revision information'),\n '#collapsible' => TRUE,\n // Collapsed by default when \"Create new revision\" is unchecked\n '#collapsed' => !$node->revision,\n '#weight' => 20,\n );\n $form['revision_information']['revision'] = array(\n '#access' => user_access('administer nodes'),\n '#type' => 'checkbox',\n '#title' => t('Create new revision'),\n '#default_value' => $node->revision,\n );\n $form['revision_information']['log'] = array(\n '#type' => 'textarea',\n '#title' => t('Log message'),\n '#default_value' => (isset($node->log) ? $node->log : ''),\n '#rows' => 2,\n '#description' => t('An explanation of the additions or updates being made to help other authors understand your motivations.'),\n );\n }\n\n // Node author information for administrators\n $form['author'] = array(\n '#type' => 'fieldset',\n '#access' => user_access('administer nodes'),\n '#title' => t('Authoring information'),\n '#collapsible' => TRUE,\n '#collapsed' => TRUE,\n '#weight' => 20,\n );\n $form['author']['name'] = array(\n '#type' => 'textfield',\n '#title' => t('Authored by'),\n '#maxlength' => 60,\n '#autocomplete_path' => 'user/autocomplete',\n '#default_value' => $node->name ? $node->name : '',\n '#weight' => -1,\n '#description' => t('Leave blank for %anonymous.', array('%anonymous' => variable_get('anonymous', t('Anonymous')))),\n );\n $form['author']['date'] = array(\n '#type' => 'textfield',\n '#title' => t('Authored on'),\n '#maxlength' => 25,\n '#description' => t('Format: %time. Leave blank to use the time of form submission.', array('%time' => !empty($node->date) ? $node->date : format_date($node->created, 'custom', 'Y-m-d H:i:s O'))),\n );\n\n if (isset($node->date)) {\n $form['author']['date']['#default_value'] = $node->date;\n }\n\n // Node options for administrators\n $form['options'] = array(\n '#type' => 'fieldset',\n '#access' => user_access('administer nodes'),\n '#title' => t('Publishing options'),\n '#collapsible' => TRUE,\n '#collapsed' => TRUE,\n '#weight' => 25,\n );\n $form['options']['status'] = array(\n '#type' => 'checkbox',\n '#title' => t('Published'),\n '#default_value' => $node->status,\n );\n $form['options']['promote'] = array(\n '#type' => 'checkbox',\n '#title' => t('Promoted to front page'),\n '#default_value' => $node->promote,\n );\n $form['options']['sticky'] = array(\n '#type' => 'checkbox',\n '#title' => t('Sticky at top of lists'),\n '#default_value' => $node->sticky,\n );\n\n // These values are used when the user has no administrator access.\n foreach (array('uid', 'created') as $key) {\n $form[$key] = array(\n '#type' => 'value',\n '#value' => $node->$key,\n );\n }\n\n // Add the buttons.\n $form['buttons'] = array();\n $form['buttons']['submit'] = array(\n '#type' => 'submit',\n '#access' => !variable_get('node_preview', 0) || (!form_get_errors() && isset($form_state['node_preview'])),\n '#value' => t('Save'),\n '#weight' => 5,\n '#submit' => array('node_form_submit'),\n );\n $form['buttons']['preview'] = array(\n '#type' => 'submit',\n '#value' => t('Preview'),\n '#weight' => 10,\n '#submit' => array('node_form_build_preview'),\n );\n if (!empty($node->nid) && node_access('delete', $node)) {\n $form['buttons']['delete'] = array(\n '#type' => 'submit',\n '#value' => t('Delete'),\n '#weight' => 15,\n '#submit' => array('node_form_delete_submit'),\n );\n }\n $form['#validate'][] = 'node_form_validate';\n $form['#theme'] = array($node->type .'_node_form', 'node_form');\n return $form;\n}",
"function ting_visual_relation_slide_form_submit($form, &$form_state) {\n $type = $form_state['values']['type'];\n $fields = array(\n 'name' => $form_state['values']['name'],\n 'type' => $type,\n );\n switch ($type) {\n case 'external':\n case 'circular':\n $fields['datawell_pid'] = $form_state['values']['datawell_pid'];\n break;\n case 'structural':\n $fields['search_query'] = $form_state['values']['search_query'];\n }\n // Determine if this is an update or insert\n $slide = isset($form_state['slide']) ? $form_state['slide'] : FALSE;\n if ($slide) {\n db_update('ting_visual_relation_slides')\n ->condition('slide_id', $slide->slide_id)\n ->fields($fields)\n ->execute();\n }\n else {\n db_insert('ting_visual_relation_slides')->fields($fields)->execute();\n }\n // Set message and go back to table overview\n drupal_set_message(t('Slide saved'));\n $form_state['redirect'] = 'admin/config/ting/ting-visual-relation/app-settings';\n}",
"function _or_chart_admin_url_export_submit($form, &$form_state) {\n $nodes = array_filter($form_state['values']['nodes']);\n _or_chart_url_export_operation($form,$nodes);\n}",
"public function handleDataSubmission() {}"
]
| [
"0.7229615",
"0.67927057",
"0.6580903",
"0.6456499",
"0.6303718",
"0.624416",
"0.6215408",
"0.6187164",
"0.61237925",
"0.60917765",
"0.6072781",
"0.6052198",
"0.6030238",
"0.60244405",
"0.5989919",
"0.5971032",
"0.5894369",
"0.5832111",
"0.58249694",
"0.57996845",
"0.57809097",
"0.57748276",
"0.57695895",
"0.57358074",
"0.5718472",
"0.5713914",
"0.5694909",
"0.5676379",
"0.56579643",
"0.5650627"
]
| 0.781233 | 0 |
Menu callback ask for confirmation of mongo entity deletion. | function mongo_node_page_delete($form, $form_state, $entity_type, $entity) {
$form['#entity'] = $entity;
$uri = entity_uri($entity_type, $entity);
return confirm_form($form,
t('Are you sure you want to delete %title', array('%title' => $entity->title)),
$uri['path'],
t('This action cannot be undone'),
t('Delete'),
t('Cancel')
);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function mongo_node_page_delete_submit($form, &$form_state) {\n if ($form_state['values']['confirm']) {\n $entity = $form['#entity'];\n $entity->delete();\n\n $entity_type = $entity->entityType();\n $info = entity_get_info($entity_type);\n $bundle_key = $info['bundle keys']['bundle'];\n $bundle_label = $info['bundles'][$entity->{$bundle_key}]['label'];\n\n drupal_set_message(t('@label %title deleted',\n array(\n '@label' => $bundle_label,\n '%title' => $entity->title)\n )\n );\n }\n\n $form_state['redirect'] = '<front>';\n}",
"protected function confirmDelete() {\n\t}",
"public function deleteAction()\n {\n if ($this->isConfirmedItem($this->_('Delete %s'))) {\n $model = $this->getModel();\n $deleted = $model->delete();\n\n $this->addMessage(sprintf($this->_('%2$u %1$s deleted'), $this->getTopic($deleted), $deleted), 'success');\n $this->_reroute(array('action' => 'index'), true);\n }\n }",
"function delete()\n\t{\n\t\t$model = $this->getModel();\n\t\t$viewType\t= JFactory::getDocument()->getType();\n\t\t$view = $this->getView($this->view_item, $viewType);\n\t\t$view->setLayout('confirmdelete');\n\t\tif (!JError::isError($model)) {\n\t\t\t$view->setModel($model, true);\n\t\t}\n\t\t//used to load in the confirm form fields\n\t\t$view->setModel($this->getModel('list'));\n\t\t$view->display();\n\t}",
"function procMenuAdminDeleteItem()\n\t{\n\t\t// argument variables\n\t\t$args = new stdClass();\n\t\t$args->menu_srl = Context::get('menu_srl');\n\t\t$args->menu_item_srl = Context::get('menu_item_srl');\n\t\t$args->is_force = Context::get('is_force');\n\n\t\t$returnObj = $this->deleteItem($args);\n\t\tif(is_object($returnObj))\n\t\t{\n\t\t\t$this->setError($returnObj->error);\n\t\t\t$this->setMessage($returnObj->message);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->setMessage('success_deleted');\n\t\t}\n\n\t\t$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispMenuAdminManagement', 'menu_srl', $args->menu_srl);\n\t\t$this->setRedirectUrl($returnUrl);\n\t}",
"public function delete()\n\t{\n\t\t$this->plugin->setResponse('in delete');\n\t}",
"function procMenuAdminDeleteButton()\n\t{\n\t\t$menu_srl = Context::get('menu_srl');\n\t\t$menu_item_srl = Context::get('menu_item_srl');\n\t\t$target = Context::get('target');\n\t\t$filename = Context::get('filename');\n\t\tFileHandler::removeFile($filename);\n\n\t\t$this->add('target', $target);\n\t}",
"public function doDeleteAction()\n {\n $chapId = Zend_Auth::getInstance()->getIdentity()->id; \n //get id of the menu to be deleted from the view\n $chapMenuId = trim($this->_request->id);\n $menuDeleteModel = new Pbo_Model_WlMenuItems();\n //pass the chap ID and the menu id of the menu to be deleted to the model\n $menuDeleteModel->deleteMenu($chapId, $chapMenuId);\n\n //message when the menu is deleted\n $this->_helper->flashMessenger->addMessage('Menu item successfully deleted.');\n\n \n $this->_redirect( '/menu' );\n\n }",
"function onDelete($param)\n {\n $key=$param['key'];\n \n // define duas acoes\n $action1 = new TAction(array($this, 'Delete'));\n \n // define os parametros de cada acao\n $action1->setParameter('key', $key);\n \n //encaminha a chave estrangeira\n $action1->setParameter('fk', filter_input(INPUT_GET, 'fk'));\n\n // exibe um dialogo ao usuario\n new TQuestion('Deseja realmente excluir o registro ?', $action1, $action2);\n }",
"public function confirmAction() {\n\t\t$id = $this->getRequest ()->getParam ( 'id' );\n\t\t$controller = Zend_Controller_Front::getInstance ()->getRequest ()->getControllerName ();\n\t\ttry {\n\t\t\tif (is_numeric ( $id )) {\n\t\t\t\t$this->view->back = \"/admin/$controller/edit/id/$id\";\n\t\t\t\t$this->view->goto = \"/admin/$controller/delete/id/$id\";\n\t\t\t\t$this->view->title = $this->translator->translate ( 'Are you sure you want to delete the invoice selected?' );\n\t\t\t\t$this->view->description = $this->translator->translate ( 'The invoice will not be longer available' );\n\t\t\t\t$record = $this->invoices->find ( $id );\n\t\t\t\t$this->view->recordselected = $record ['number'] . \" - \" . Shineisp_Commons_Utilities::formatDateOut ( $record ['invoice_date'] );\n\t\t\t} else {\n\t\t\t\t$this->_helper->redirector ( 'list', $controller, 'admin', array ('mex' => $this->translator->translate ( 'Unable to process the request at this time.' ), 'status' => 'danger' ) );\n\t\t\t}\n\t\t} catch ( Exception $e ) {\n\t\t\techo $e->getMessage ();\n\t\t}\n\t\n\t}",
"public function confirmDelete( )\r\n {\r\n throw new KVDdom_RedactieException( 'Kan het verwijderen niet bevestigen van een object dat niet verwijderd is.' );\r\n }",
"public function confirmAction() {\r\n\t\t$id = $this->getRequest ()->getParam ( 'id' );\r\n\t\t$controller = Zend_Controller_Front::getInstance ()->getRequest ()->getControllerName ();\r\n\t\ttry {\r\n\t\t\tif (is_numeric ( $id )) {\r\n\t\t\t\t$this->view->back = \"/admin/$controller/edit/id/$id\";\r\n\t\t\t\t$this->view->goto = \"/admin/$controller/delete/id/$id\";\r\n\t\t\t\t$this->view->title = $this->translator->translate ( 'Are you sure you want to delete the selected record?' );\r\n\t\t\t\t$this->view->description = $this->translator->translate ( 'If you delete the selected bank information, your customers will not be able to pay you with this method of payment' );\r\n\t\r\n\t\t\t\t$record = $this->productsattributes->find ( $id )->toArray();\r\n\t\t\t\t$this->view->recordselected = $record ['code'];\r\n\t\t\t} else {\r\n\t\t\t\t$this->_helper->redirector ( 'list', $controller, 'admin', array ('mex' => $this->translator->translate ( 'Unable to process the request at this time.' ), 'status' => 'danger' ) );\r\n\t\t\t}\r\n\t\t} catch ( Exception $e ) {\r\n\t\t\techo $e->getMessage ();\r\n\t\t}\r\n\t}",
"public function deleteAction() {\n \n }",
"function confirm()\n\t{\n\t\tglobal $tree, $rbacsystem, $rbacadmin;\n\t\t// AT LEAST ONE OBJECT HAS TO BE CHOSEN.\n\t\tif (!isset($_SESSION[\"saved_post\"]))\n\t\t{\n\t\t\t$this->ilias->raiseError($this->lng->txt(\"no_checkbox\"),$this->ilias->error_obj->MESSAGE);\n\t\t}\n\n\t\t// FOR ALL SELECTED OBJECTS\n\t\tforeach ($_SESSION[\"saved_post\"] as $id)\n\t\t{\n\t\t\t$type = ilBookmark::_getTypeOfId($id);\n\n\t\t\t// get node data and subtree nodes\n\t\t\tif ($this->tree->isInTree($id))\n\t\t\t{\n\t\t\t\t$node_data = $this->tree->getNodeData($id);\n\t\t\t\t$subtree_nodes = $this->tree->getSubTree($node_data);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// delete tree\n\t\t\t$this->tree->deleteTree($node_data);\n\n\t\t\t// delete objects of subtree nodes\n\t\t\tforeach ($subtree_nodes as $node)\n\t\t\t{\n\t\t\t\tswitch ($node[\"type\"])\n\t\t\t\t{\n\t\t\t\t\tcase \"bmf\":\n\t\t\t\t\t\t$BookmarkFolder = new ilBookmarkFolder($node[\"obj_id\"]);\n\t\t\t\t\t\t$BookmarkFolder->delete();\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase \"bm\":\n\t\t\t\t\t\t$Bookmark = new ilBookmark($node[\"obj_id\"]);\n\t\t\t\t\t\t$Bookmark->delete();\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Feedback\n\t\tilUtil::sendSuccess($this->lng->txt(\"info_deleted\"),true);\n\n\t\t$this->view();\n\t}",
"function callbackDeletePopup() {\n if ($this->deleted) {\n return;\n }\n $child = $this->deleteMenuItem->child;\n $name = $this->name;\n if (!$name) { \n $name = 'UNNAMED';\n }\n $child->set_text('Delete Field : '. $name);\n $this->deleteMenuItem->show();\n \n }",
"public function actionDelete() {}",
"public function actionDelete() {}",
"protected function afterDelete()\r\n {\r\n }",
"function travel_type_form_delete_confirm($form, &$form_state, $entity_type) {\n // Store the entity in the form.\n $form_state['entity_type'] = $entity_type;\n\n // Show confirm dialog.\n $message = t('Are you sure you want to delete entity type %title?', array('%title' => entity_label('entity_type', $entity_type)));\n return confirm_form(\n $form,\n $message,\n 'travel/' . entity_id('travel_type', $entity_type),\n t('This action cannot be undone.'),\n t('Delete'),\n t('Cancel')\n );\n}",
"public function deleteAction()\n {\n \n }",
"public function deleteAction() {\n\t\tif(!isset($this->params['cancel'])) {\n\n\t\t\t// XXX: Maybe do some hook call validation here?\n\n\t\t\t// auto call the hooks for this module/action\n\t\t\tAPI::callHooks(self::$module, $this->action, 'controller', $this);\n\n\t\t\t// delete an entry\n\t\t\t$host = $this->_model->delete();\n\t\t}\n\t\tAPI::redirect(API::printUrl($this->_redirect));\n\t}",
"public function deleteAction() {\n\t\t$this->_notImplemented();\n\t}",
"public function confirmingDeletion()\n {\n $this->confirmingExpenseDeletion = true;\n }",
"public function delete_command(){\n\t\t$this->layout = 'ajax';\n\t\n\t\tif($this->request->is('post')){\n\t\t\t$command_id = $this->request->data['command_id'];\n\t\n\t\t\t$obj_command = $this->Command->findBy('IDCommand', $command_id);\n\t\t\tif($obj_command->saveField('Status', 0)){\n\t\t\t\techo json_encode(array('success'=>true,'msg'=>__('Eliminado con éxito.')));\n\t\t\t\texit();\n\t\t\t}else{\n\t\t\t\techo json_encode(array('success'=>false,'msg'=>__('Error inesperado.')));\n\t\t\t\texit();\n\t\t\t}\n\t\t}\n\t\n\t}",
"function deleteCompleted() {\n\n if ( isset( $_POST['confirm'] ) ) {\n\n // User has confirmed deletion: delete the to-dos\n if ( !checkAuthToken() ) return;\n Todo::deleteCompletedForUser( User::getLoggedInUser() );\n header( \"Location: \" . APP_URL . \"?action=listTodos\" );\n\n } else {\n\n // User has not confirmed deletion yet: display the confirm dialog\n require( TEMPLATE_PATH . \"/deleteCompleted.php\" );\n }\n}",
"public function actionDelete ()\n\t\t{\n\t\t\tif (Yii::$app->request->isAjax)\n\t\t\t{\n\t\t\t\t$id = Yii::$app->request->post('id');\n\t\t\t\t$menu = Menu::findOne($id);\n\t\t\t\tif ($menu !== null)\n\t\t\t\t{\n\t\t\t\t\tif (!$menu->deleteWithChildren())\n\t\t\t\t\t\techo Json::encode(current($menu->firstErrors));\n\t\t\t\t\telse\n\t\t\t\t\t\techo 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\tYii::$app->end();\n\t\t}",
"public function deleteDance(){\n $data = [\n 'status' => ''\n ];\n if(isset($_GET['id'])) {\n $id = $_GET['id'];\n\n if (isset($_POST['confirm'])) {\n if ($_POST['confirm'] == 'Yes') {\n $this->adminModel->deleteDance($id);\n $data['status'] = 'Event has been deleted';\n $this->view('admins/homepage', $data);\n } else if ($_POST['confirm'] == 'No') {\n $data['status'] = 'Event could not be deleted please contact the administrator';\n $this->view('admins/homepage', $data);\n }\n }\n }\n $this->view('admins/deleteDance' , $data);\n\n }",
"public function undeleteAction(){\n\t}",
"protected function afterDelete()\n {\n }",
"public function deleted(MenuItem $menuItem)\n {\n //\n }"
]
| [
"0.7021321",
"0.68786114",
"0.6858826",
"0.6818826",
"0.6798554",
"0.6672725",
"0.66523004",
"0.66453815",
"0.65345025",
"0.6451527",
"0.6426621",
"0.6326857",
"0.6311236",
"0.6309773",
"0.6291765",
"0.62407255",
"0.62407255",
"0.6235067",
"0.6228635",
"0.62215805",
"0.62202984",
"0.6187475",
"0.6185959",
"0.6173757",
"0.6159098",
"0.6137883",
"0.6137878",
"0.61311483",
"0.6126681",
"0.6091969"
]
| 0.6905984 | 1 |
Mongo entity delete submit handler for mongo_node_page_delete(). | function mongo_node_page_delete_submit($form, &$form_state) {
if ($form_state['values']['confirm']) {
$entity = $form['#entity'];
$entity->delete();
$entity_type = $entity->entityType();
$info = entity_get_info($entity_type);
$bundle_key = $info['bundle keys']['bundle'];
$bundle_label = $info['bundles'][$entity->{$bundle_key}]['label'];
drupal_set_message(t('@label %title deleted',
array(
'@label' => $bundle_label,
'%title' => $entity->title)
)
);
}
$form_state['redirect'] = '<front>';
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function mongo_node_page_delete($form, $form_state, $entity_type, $entity) {\n $form['#entity'] = $entity;\n $uri = entity_uri($entity_type, $entity);\n\n return confirm_form($form,\n t('Are you sure you want to delete %title', array('%title' => $entity->title)),\n $uri['path'],\n t('This action cannot be undone'),\n t('Delete'),\n t('Cancel')\n );\n}",
"protected function _postDelete() {}",
"protected function _postDelete() {}",
"public function deleteSubmitHandler(array &$form, FormStateInterface $form_state) {\n $node_id = $form_state->getValue('article_title');\n $node = Node::load($node_id)->delete();\n }",
"function mongo_node_type_delete_form_submit($form, $form_state) {\n $set = mongo_node_settings();\n\n // Remove entity type.\n $entity_type = $form_state['values']['entity_type'];\n unset($set[$entity_type]);\n\n // Drop collection that stores entities for entity type.\n $collection = mongodb_collection('fields_current', $entity_type);\n $collection->drop();\n\n // Drop collection that stores entity types autoincrement ids.\n $collection = mongodb_collection($entity_type . '_ids');\n $collection->drop();\n\n mongo_node_settings_save($set);\n\n // Redirect to entity type admin.\n drupal_goto('admin/structure/mongo-node');\n}",
"function delete() {\n\n $document = Doctrine::getTable('DocDocument')->find($this->input->post('doc_document_id'));\n $node = Doctrine::getTable('Node')->find($document->node_id);\n\n if ($document && $document->delete()) {\n//echo '{\"success\": true}';\n\n $this->syslog->register('delete_document', array(\n $document->doc_document_filename,\n $node->getPath()\n )); // registering log\n\n $success = 'true';\n $msg = $this->translateTag('General', 'operation_successful');\n } else {\n//echo '{\"success\": false}';\n $success = 'false';\n $msg = $e->getMessage();\n }\n\n $json_data = $this->json->encode(array('success' => $success, 'msg' => $msg));\n echo $json_data;\n }",
"function mongo_node_mass_delete($entity_type, $entities) {\n entity_delete_multiple($entity_type, $entities);\n}",
"protected function _postDelete()\n\t{\n\t}",
"function mongo_node_bundle_delete_form_submit($form, $form_state) {\n $set = mongo_node_settings();\n\n $entity_type = $form_state['values']['entity_type'];\n $bundle = $form_state['values']['bundle'];\n\n // Remove entity type.\n unset($set[$entity_type]['bundles'][$bundle]);\n\n mongo_node_settings_save($set);\n\n // Redirect to entity type admin.\n drupal_goto('admin/structure/mongo-node/' . $entity_type);\n}",
"protected function _afterDeleteCommit()\n {\n parent::_afterDeleteCommit();\n\n /** @var \\Mage_Index_Model_Indexer $indexer */\n $indexer = Mage::getSingleton('index/indexer');\n\n $indexer->processEntityAction($this, self::ENTITY, Mage_Index_Model_Event::TYPE_DELETE);\n }",
"public function delete()\n {\n $post['id'] = $this->request->getParameter('id'); // récupérer le paramètre de l'ID\n $this->post->deletePost($post['id']);\n $this->redirect(\"admin\", \"chapters\"); // une fois le post supprimé, je redirige vers la vue chapters\n }",
"protected function _afterDeleteCommit()\n {\n parent::_afterDeleteCommit();\n\n /** @var \\Mage_Index_Model_Indexer $indexer */\n $indexer = Mage::getSingleton('index/indexer');\n\n $indexer->processEntityAction($this, $this::ENTITY, Mage_Index_Model_Event::TYPE_DELETE);\n }",
"public function delete() { // Page::destroy($this->pages()->select('id')->get());\n $this->pages()->detach();\n parent::delete();\n }",
"public function postRemove($entity);",
"public function onAfterDelete() {\n if (!($this->owner instanceof \\SiteTree))\n {\n $this->doDeleteDocumentIfInSearch();\n }\n }",
"protected function entityDelete(){\n // TODO: deal with errors\n // delete from api\n $deleted = $this->resourceService()->delete($this->getId());\n }",
"public function delete($entity)\n {\n \n }",
"public function delete($entity);",
"protected function _postDelete()\n {\n $this->getResource()->delete();\n\n $this->getIssue()->compileHorizontalPdfs();\n }",
"public function postDelete() {\n if ($server = $this->server()) {\n if ($server->enabled) {\n $server->removeIndex($this);\n }\n // Once the index is deleted, servers won't be able to tell whether it was\n // read-only. Therefore, we prefer to err on the safe side and don't call\n // the server method at all if the index is read-only and the server\n // currently disabled.\n elseif (empty($this->read_only)) {\n $tasks = variable_get('search_api_tasks', array());\n $tasks[$server->machine_name][$this->machine_name] = array('remove');\n variable_set('search_api_tasks', $tasks);\n }\n }\n\n // Stop tracking entities for indexing.\n $this->dequeueItems();\n }",
"function mongo_node_type_delete_form($form, $form_state, $entity_type) {\n $form = array();\n // Send entity type.\n $form['entity_type'] = array(\n '#type' => 'value',\n '#value' => $entity_type,\n );\n $path = '/admin/structure/mongo-node';\n\n $extist_entity_content = '';\n $collection = mongodb_collection('fields_current', $entity_type);\n $count = $collection->count(array('_type' => $entity_type));\n if ($count) {\n $extist_entity_content = t('%type is used by %count piece of content on your site. If you remove this entity type, you will not be able to edit the %type content and it may not display correctly.', array('%type' => $entity_type, '%count' => $count));\n $extist_entity_content .= '<br/><br/>';\n }\n return confirm_form($form, t('Delete entity type'), $path, $extist_entity_content . 'This action cannot be undone', t('Delete'), t('Cancel'), 'mongo_node_type_delete');\n}",
"public function processDelete()\n {\n $pageId = Tools::getValue('id_page');\n\n Db::getInstance()->delete($this->module->table_name, 'id_page='.$pageId);\n Db::getInstance()->delete($this->module->table_lang, 'id_page='.$pageId);\n Db::getInstance()->delete($this->module->table_related, 'id_parent='.$pageId.' OR id_related='.$pageId);\n\n $this->redirect_after = static::$currentIndex.'&conf=1&token='.$this->token;\n }",
"function afterDelete(&$model) {\n\t\t$node = Set::extract($this->node($model), \"0.Node.id\");\n\t\tif (!empty($node)) {\n\t\t\t$model->Node->delete($node);\n\t\t}\n\t}",
"public function deleteObject(){\n $qry = new DeleteEntityQuery($this);\n $this->getContext()->addQuery($qry);\n //$this->removeFromParentCollection();\n }",
"public function delete($entity){ \n //TODO: Implement remove record.\n }",
"public function deleteNode(){\n\t\tparent::deleteNode();\n\n\t\t//Delete Langs\n\t\t$relMetaLang = new XlyreRelMetaLangs();\n\t\t$results = $relMetaLang->find(\"IdRel\", \"IdNode=%s\", array($this->nodeID), MONO);\n\t\tif ($results) {\n\t\t\tforeach ($results as $idRel) {\n\t\t\t\t$objectToDelete = new XlyreRelMetaLangs($idRel);\n\t\t\t\t$objectToDelete->delete();\n\t\t\t}\n\t\t}\n\n\t\t//Delete Tags\n\t\t$relMetaLang = new XlyreRelMetaTags();\n\t\t$results = $relMetaLang->find(\"IdRel\", \"IdNode=%s\", array($this->nodeID), MONO);\n\t\tif ($results) {\n\t\t\tforeach ($results as $idRel) {\n\t\t\t\t$objectToDelete = new XlyreRelMetaTags($idRel);\n\t\t\t\t$objectToDelete->delete();\n\t\t\t}\n\t\t}\n\n\t\t//Delete dataset\n\t\t$dataset = new XlyreDataset($this->nodeID);\n\t\treturn $dataset->delete();\n\t}",
"public function delete()\n {\n $ids = Request::get(\"id\");\n\n $ids = is_array($ids) ? $ids : [$ids];\n\n foreach ($ids as $ID) {\n\n $page = Page::findOrFail($ID);\n\n // Fire deleting action\n\n Action::fire(\"page.deleting\", $page);\n\n $page->tags()->detach();\n $page->delete();\n\n // Fire deleted action\n\n Action::fire(\"page.deleted\", $page);\n }\n\n return Redirect::back()->with(\"message\", trans(\"pages::pages.events.deleted\"));\n }",
"public function deleteAction()\n {\n $postId = (int)$this->params()->fromRoute('id', -1);\n \n // Validate input parameter\n if ($postId<0) {\n $this->getResponse()->setStatusCode(404);\n return;\n }\n \n $post = $this->entityManager->getRepository(Post::class)\n ->findOneById($postId); \n if ($post == null) {\n $this->getResponse()->setStatusCode(404);\n return; \n }\n \n if (!$this->access('post.own.delete', ['post'=>$post])) {\n return $this->redirect()->toRoute('not-authorized');\n }\n \n $this->postManager->removePost($post);\n $this->imageManager->removePost($postId);\n $this->videoManager->removePost($postId);\n $this->audioManager->removePost($postId);\n \n // Redirect the user to \"admin\" page.\n return $this->redirect()->toRoute('posts', ['action'=>'admin']); \n \n }",
"public function Delete($entity) {\n }",
"public function deleteDocument() {\n\n // should get instance of model and run delete-function\n\n // softdeletes-column is found inside database table\n\n return redirect('/home');\n }"
]
| [
"0.71317905",
"0.7057607",
"0.7055268",
"0.68226093",
"0.67156976",
"0.6710894",
"0.67040217",
"0.66735077",
"0.642241",
"0.6374308",
"0.6361223",
"0.63513196",
"0.6340487",
"0.6323407",
"0.63184184",
"0.6316687",
"0.62518245",
"0.62388307",
"0.6222638",
"0.6219751",
"0.61835533",
"0.6167757",
"0.613239",
"0.6130876",
"0.61226094",
"0.6096067",
"0.60891426",
"0.6087671",
"0.6077549",
"0.6071453"
]
| 0.71954656 | 0 |
/ funcion que recupera el pais de una IP del visitante | function getPais($ip = false){
$ip = ($ip==false)?getUserIP():$ip;
$key="7b471597a8e15e665536cef21de5b54ffc5a38a7";
$data= file_get_contents("http://api.db-ip.com/addrinfo?addr=$ip&api_key=$key");
$data = json_decode($data,true);
return ($data['country']);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function iploc($ip){\n\t\t/* preg_match(\"/<li>Country : (.*?) <img/\",$html,$data); */\n\t\t$d['pais'] = \"nada\";\n\t\t/* preg_match(\"/<li>State\\/Province : (.*?)<\\/li>/\",$html,$data); */\n\t\t$d['estado'] = \"nada\";\n\t\t/* preg_match(\"/<li>City : (.*?)<\\/li>/\",$html,$data); */\n\t\t$d['ciudad'] = \"nada\";\n\t\treturn ($d);\n\t}",
"public function ObtenerIp()\n { \n\n return str_replace(\".\",\"\",$this->getIP()); //Funcion que quita los puntos de la IP\n\n }",
"function listNetworkIp($net,$broadcast,$sn) {\n\n $lista=[]; // lista da ritornare \n\n $no = explode('.', $net); // array con gli ottetti dell'indirizzo NET\n $bo = explode('.', $broadcast); // array con gli ottetti dell'indirizzo NET\n\n $nbit = 32-$sn; // numero di bit assegnati agli host\n \n $nhost = pow(2,$nbit); // numero totale degli host\n\n $start = (int) $no[3]+1;\n $end = (int) $bo[3]-1;\n $roots = $no[0].\".\".$no[1].\".\".$no[2].\".\";\n $roote = $bo[0].\".\".$bo[1].\".\".$bo[2].\".\";\n $primo = $roots.$start;\n $ultimo = $roote.$end;\n $hosts = [];\n\n //echo $start.\" - \".$end.\"<br>\";\n\n // verifica che gli IP disponibili non superino le 5000 unità -> stila la lista\n if($nhost > 35000) {\n $lista[0] = $primo;\n $lista[1] = $ultimo;\n }\n else {\n for($i=ip2long($primo); $i<=ip2long($ultimo); $i++) {\n\n $ip2conv = $i;\n $ip2write = long2ip($ip2conv);\n $lista[] = $ip2write;\n \n $host=gethostbyaddr($ip2write); // prelevo il nome del host (se disponibile)\n //echo $host.\" | \";\n\n // se il nome host NON è uguale all'IP -> salvo il nome Host in una lista\n if(!filter_var($host, FILTER_VALIDATE_IP)) {\n $hosts[] = \"IP: $ip2write ==> Nome Host:<b> $host </b><br>\";\n }\n\n }\n }\n\n $ret['hostnames'] = $hosts;\n $ret['primo'] = $primo;\n $ret['ultimo'] = $ultimo;\n $ret['lista'] = $lista;\n $ret['nhost'] = $nhost; \n\n return $ret;\n}",
"public function beLoginLinkIPList() {}",
"public function ip()\n {\n \n try {\n $ip_arr = Yaml::parseFile($this->config['ip_config_path']);\n } catch (\\Exception $e) {\n // Do something\n $ip_arr = [];\n }\n\n $out = [];\n\n // Compile SQL\n $cnt = 0;\n $sel_arr = array('COUNT(1) as count');\n foreach ($ip_arr as $key => $value) {\n if (is_scalar($value)) {\n $value = array($value);\n }\n $when_str = '';\n foreach ($value as $k => $v) {\n $when_str .= sprintf(\" WHEN remote_ip LIKE '%s%%' THEN 1\", $v);\n }\n $sel_arr[] = \"SUM(CASE $when_str ELSE 0 END) AS r{$cnt}\";\n $cnt++;\n }\n $sql = \"SELECT \" . implode(', ', $sel_arr) . \"\n\t\t\t\tFROM reportdata \"\n .get_machine_group_filter();\n\n $reportdata = Reportdata_model::selectRaw(implode(', ', $sel_arr))\n ->filter()\n ->first();\n // Create Out array\n if ($reportdata) {\n $cnt = $total = 0;\n foreach ($ip_arr as $key => $value) {\n $col = 'r' . $cnt++;\n\n $out[] = array('key' => $key, 'cnt' => intval($reportdata[$col]));\n\n $total += $reportdata[$col];\n }\n\n // Add Remaining IP's as other\n if ($reportdata['count'] - $total) {\n $out[] = array('key' => 'Other', 'cnt' => $reportdata['count'] - $total);\n }\n }\n\n $obj = new View();\n $obj->view('json', array('msg' => $out));\n }",
"function getIPInfo($IPParagraph='0.0.0.0/32'){\n\tif (!$IPParagraph) {\n\t\treturn '请输入IP段';\n\t}\n\t$isTrue=isIPParagraph($IPParagraph);\n\tif (!$isTrue) {\n\t\treturn '无效IP段';\n\t}\n\t$IPParagraphArray = explode('/', $IPParagraph);\n\t$mark = $IPParagraphArray[1]; // 获取IP段的掩码位\n\t$dilatation = pow(2, 32-$mark); // 最多可以容纳的主机数\n\t$usable = $dilatation-2; // 可供使用的主机数\n\t$subnetMask = long2ip(ip2long('255.255.255.255')-($dilatation-1)); // 子网掩码\n\t$subnetMaskArray = explode('.', $subnetMask);\n\t$ipArray = explode('.', $IPParagraphArray[0]);\n\tif ($subnetMaskArray[2] === '255') { // ip所处子网掩码判断某一位是在哪个类别下\n\t\t$category = 'C类';\n\t\t$flag=array(3); // 标识ip哪位为0的数组\n\t}elseif ($subnetMaskArray[2] < '255' && $subnetMaskArray[1] === '255') {\n\t\t$category = 'B类';\n\t\t$flag=array(2,3);\n\t}elseif ($subnetMaskArray[1] < '255') {\n\t\t$category = 'A类';\n\t\t$flag=array(1,2,3);\n\t}\n\tfor ($i=0; $i < count($flag); $i++) {\n\t\t$subnet = pow(2, 8*($i+1)-(32-$mark)); // 子网个数\n\t\t$count = $subnet===1 ? pow(2, 8*($i+1)) : $subnet; // 当子网等于1,则说明是8,16,24,分别是a,b,c类\n\t\t$ipArray[$flag[$i]] = 0; // 将对等的类别下ipArray数组中的某个下标的值清零\n\t}\n\n\t$ipString = implode('.', $ipArray); // 将原ip转化成x.x.x.0的形式\n\t$iplong = ip2long($ipString); // ip转长整型\n\t$subnetInit = array();\n\tfor ($i=0; $i < $subnet; $i++) {\n\t\t$subnetInit[$i] = long2ip($iplong+($dilatation*$i)); // 循环算出每个子网的第一个ip\n\t}\n\n\t$dilatationIP = array();\n\tfor ($i=0; $i < $count; $i++) {\n\t\tif ($subnet === 1) { // 当子网只有一个时,循环当前类别的总个数\n\t\t\t$dilatationIP[$i] = long2ip(ip2long($subnetInit[0])+$i);\n\t\t}elseif(isset($subnetInit[$i+1])){\n\t\t\tif (ip2long($IPParagraphArray[0]) >= ip2long($subnetInit[$i]) && ip2long($IPParagraphArray[0]) < ip2long($subnetInit[$i+1])) {\n\t\t\t\tfor ($j=0; $j < $dilatation; $j++) {\n\t\t\t\t\t$dilatationIP[$j] = long2ip(ip2long($subnetInit[$i])+$j); // ip在子网里所有的ip数\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}else{\n\t\t\tif (ip2long($IPParagraphArray[0]) >= ip2long($subnetInit[$i])) {\n\t\t\t\tfor ($j=0; $j < $dilatation; $j++) {\n\t\t\t\t\t$dilatationIP[$j] = long2ip(ip2long($subnetInit[$i])+$j); // ip在子网里所有的ip数\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t}\n\n\t$rs = array(\n\t\t'ip'\t\t\t=>\t$IPParagraphArray[0],\n\t\t'mark'\t\t\t=>\t$mark,\n\t\t'dilatation'\t=>\t$dilatation,\n\t\t'usable'\t\t=>\t$usable,\n\t\t'dilatationIP'\t=>\t$dilatationIP,\n\t\t'networkAddr'\t=>\t$dilatationIP[0],\n\t\t'roadcastAddr'\t=>\t$dilatationIP[$dilatation-1],\n\t\t'subnet'\t\t=>\t$subnet,\n\t\t'subnetInit'\t=>\t$subnetInit,\n\t\t'subnetMask'\t=>\t$subnetMask,\n\t\t'category'\t\t=>\t$category,\n\t);\n\t// return json_encode($rs, JSON_UNESCAPED_UNICODE);\n\treturn $rs;\n}",
"public function Persona (){ \n\n $this->ip=$this->getIP();\n }",
"public function allIpAction() {\n\n $url = \"156.17.231.34\";\n $ch = curl_init($url);\n curl_setopt($ch, CURLOPT_NOBODY, true);\n curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);\n curl_exec($ch);\n $retcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);\n curl_close($ch);\n if ($retcode >= 100 && $retcode <= 505) {\n //echo \"work \" . $retcode . \"<br/>\";\n } else {\n // echo \"nie dziala \" . $retcode . \"<br/>\";\n }\n }",
"public function ip()\n\t{\n\t\treturn $this->Players->ip($this->SqueezePlyrID);\n\t}",
"function ipextract ($str, $remote_ip='')\r\n{\r\n global $ip_private_arr;\r\n\r\n if (empty($ip_private_arr) || !is_array($ip_private_arr)) {\r\n $ip_private_arr = array();\r\n $ip_private_arr[] = array('from' => '0.0.0.0', 'to' => '9.255.255.255');\r\n $ip_private_arr[] = array('from' => '10.0.0.0', 'to' => '10.255.255.255');\r\n $ip_private_arr[] = array('from' => '97.160.0.0', 'to' => '97.255.255.255');\r\n $ip_private_arr[] = array('from' => '100.0.0.0', 'to' => '111.255.255.255');\r\n $ip_private_arr[] = array('from' => '127.0.0.0', 'to' => '127.255.255.255');\r\n $ip_private_arr[] = array('from' => '145.0.0.0', 'to' => '145.0.255.255');\r\n $ip_private_arr[] = array('from' => '163.0.0.0', 'to' => '163.0.255.255');\r\n $ip_private_arr[] = array('from' => '169.254.0.0', 'to' => '169.254.255.255');\r\n $ip_private_arr[] = array('from' => '172.0.0.0', 'to' => '172.127.255.255');\r\n $ip_private_arr[] = array('from' => '175.0.0.0', 'to' => '185.255.255.255');\r\n $ip_private_arr[] = array('from' => '191.0.0.0', 'to' => '192.0.255.255');\r\n $ip_private_arr[] = array('from' => '192.88.0.0', 'to' => '192.88.255.255');\r\n $ip_private_arr[] = array('from' => '192.101.0.0', 'to' => '192.114.255.255');\r\n $ip_private_arr[] = array('from' => '192.140.0.0', 'to' => '192.145.255.255');\r\n $ip_private_arr[] = array('from' => '192.168.0.0', 'to' => '192.178.255.255');\r\n $ip_private_arr[] = array('from' => '194.55.0.0', 'to' => '194.55.255.255');\r\n $ip_private_arr[] = array('from' => '198.17.0.0', 'to' => '198.20.255.255');\r\n $ip_private_arr[] = array('from' => '224.0.0.0', 'to' => '239.255.255.255');\r\n }\r\n\r\n $iplong = ip2long(trim($remote_ip));\r\n $valarr = empty($str) ? array() : preg_split('/[,\\s]+/', trim($str));\r\n foreach ($valarr as $ipval) {\r\n if (preg_match('%(\\d{1,3}(?:[.]\\d{1,3}){3})%', $ipval, $matches)) {\r\n $iptest = ip2long($matches[1]);\r\n if ($iptest) {\r\n if (empty($iplong)) $iplong = $iptest;\r\n if (!empty($ip_private_arr)) {\r\n foreach ($ip_private_arr as $ip_range) {\r\n $ipfrom = ip2long(trim($ip_range['from']));\r\n $ipto = ip2long(trim($ip_range['to']));\r\n if ($ipfrom<=$iptest && $iptest<=$ipto) {\r\n $iptest = 0;\r\n break;\r\n }\r\n }\r\n if ($iptest) $iplong = $iptest;\r\n }\r\n }\r\n }\r\n }\r\n return (!$iplong || $iplong==-1) ? FALSE : long2ip($iplong);\r\n}",
"private function getIPPublic ()\n {\n $dbs = new DB ( $this->config['database'] );\n $search = $dbs->query(\"SELECT * FROM tbl_client_connection_priv WHERE\n priv_client_id LIKE '\". $this->c .\"%' order by private_rec_date desc limit 1\");\n\t\t\tif ( count ( $search ) ) {\n\t\t\t\t$this->result['id'] = $this->c;\n\t\t\t\t$this->result['real_ip_address'] = $search[0]['real_client_ip'];\n\t\t\t} else\n\t\t\t\t$this->result['data']['result'] = $this->c . \":No usage history found\";\n\t\t\t\n\t\t\t$dbs->CloseConnection ();\n\t\t\treturn;\n\t\t}",
"public static function ip_info()\r\n {\r\n\r\n $a = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip='.self::get_client_ip()));\r\n \r\n $a = Input::filter_text($a);\r\n \r\n return $a;\r\n \r\n }",
"function ip_visiteur() {\n\tif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {\n\t\t$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];\n\t}\n\telseif(isset($_SERVER['HTTP_CLIENT_IP']))\n\t{\n\t\t$ip = $_SERVER['HTTP_CLIENT_IP'];\n\t}\n\telse\n\t{\n\t\t$ip = $_SERVER['REMOTE_ADDR'];\n\t}\n\treturn $ip;\n}",
"public function getIp($ip)\n {\n return getTrack()->getTrackingPaginatedByIp($ip);\n }",
"public function getIp()\r\n\t{\r\n\t\tif($this->getQuality() != FALSE OR $this->getSks() != FALSE)\r\n\t\t{\r\n\t\t\t$ipk = $this->getQuality() / $this->getSks();\r\n\r\n\t\t\t$pembulatan = round($ipk, ceil($ipk));\r\n\t\t} else {\r\n\t\t\t$pembulatan = 0.0000;\r\n\t\t}\r\n\r\n\t\treturn substr($pembulatan, 0, 5);\r\n\t}",
"function ip_is_local($ip){\r\n\t\r\n\t $ipv4array = explode('.',$ip); $ipv6array = explode(':',$ip);\r\n\t $lenipv4 = count($ipv4array) ; $lenipv6 = count($ipv6array); \r\n\t $ipint = array(); \r\n\t if($lenipv4 > 0 ){//We have an ipv4 address\r\n\t\t for ($i = 0 ; $i<$lenipv4 ; $i++){\r\n\t\t\t $ipint[$i] = intval($ipv4array[$i]) ; //Generating integera values for the ips\r\n\t\t }\r\n\t\t \r\n\t\t\t//Let's see if our IP is riv ate\r\n\t\t\tif ($ipint[0] == 10) {\r\n\t\t\t\treturn true;\r\n\t\t\t} else if ($ipint[0] == 172 && $ipint[1] > 15 && $ipint[1] < 32) {\r\n\t\t\t\treturn true;\r\n\t\t\t} else if ($ipint[0] == 192 && $ipint[1] == 168) {\r\n\t\t\t\treturn true;\r\n\t\t\t}else return false ;\r\n\t }else{\r\n\t //Either something went wrong, or we are in IPV6 format.\t \r\n\t\t \r\n\t\t if( $lenipv6 > 0){//We are having a big IPV6 address here !\r\n\t\t\t //We are in IPV4. Haven't implemented IPV6 yet\r\n\t\t\t \r\n\t\t }\r\n\t\t return false ;\r\n\t }\r\n\t \r\n\t \r\n\t return false;\r\n}",
"function get_next($ip) {\n\t\t\tif (IPv6::validate_subnet($ip)) {\n\t\t\t\tlist($ip, $cidr) = explode(\"/\", $ip);\n\t\t\t\treturn IPv6::get_next(IPv6::maxip($ip .\"/\" .$cidr)) .\"/\" .$cidr;\n\t\t\t} else if (IPv6::validate_ip($ip)) {\n\t\t\t\t$binip = IPv6::iptobin($ip);\n\t\t\t\tif ($binip == sprintf(\"%'1\", 128))\n\t\t\t\t\treturn false;\n\t\t\t\telse {\n\t\t\t\t\t$bits = str_split($binip);\n\t\t\t\t\tfor ($index = count($bits)-1; $index >= 0; $index--) {\n\t\t\t\t\t\tif ($bits[$index] == 1)\n\t\t\t\t\t\t\t$bits[$index] = 0;\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t$bits[$index] = 1;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn IPv6::bintoip(implode(\"\", $bits));\n\t\t\t\t}\n\t\t\t} else\n\t\t\t\treturn false;\n\t\t}",
"function ipInfo($ip)\n {\n $geoplugin_url = 'http://www.geoplugin.net/php.gp?ip=' . $ip;\n $ip_details = unserialize(file_get_contents($geoplugin_url));\n return $ip_details;\n }",
"function getIps() {\n\t\treturn $this->findParentsOfClass('Ip');\n\t}",
"public function getDeviceIP();",
"public function ip()\n {\n return $this->rule('ip');\n }",
"function getIPs() {\r\n $ip = $_SERVER[\"REMOTE_ADDR\"];\r\n if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {\r\n \t$ip .= '_'.$_SERVER['HTTP_X_FORWARDED_FOR'];\r\n }\r\n if (isset($_SERVER['HTTP_CLIENT_IP'])) {\r\n \t$ip .= '_'.$_SERVER['HTTP_CLIENT_IP'];\r\n }\r\n return $ip;\r\n}",
"public function calcularTodas() {\n $padres = InventarioIp::where('Netmask', '=', 18)->select('IpAddress', 'Netmask', 'RangeId')->get();\n foreach ($padres as $padre) {\n $this->calcularIpArriba($padre->IpAddress, $padre->Netmask, $padre->RangeId);\n echo $padre->IpAddress . \"/\" . $padre->Netmask . \"<br>\";\n }\n }",
"private static function ip2addr($intIp) {\n $arrUnknown = array(\n \"region\" => \"(unknown)\",\n \"address\" => \"(unknown)\"\n );\n $fileIp = fopen(__DIR__ . self::IPFILE, \"rb\");\n if (!$fileIp) return 1;\n $strBuf = fread($fileIp, 4);\n $intFirstRecord = self::bin2dec($strBuf);\n $strBuf = fread($fileIp, 4);\n $intLastRecord = self::bin2dec($strBuf);\n $intCount = floor(($intLastRecord - $intFirstRecord) / 7);\n if ($intCount < 1) return 2;\n $intStart = 0;\n $intEnd = $intCount;\n while ($intStart < $intEnd - 1) {\n $intMid = floor(($intStart + $intEnd) / 2);\n $intOffset = $intFirstRecord + $intMid * 7;\n fseek($fileIp, $intOffset);\n $strBuf = fread($fileIp, 4);\n $intMidStartIp = self::bin2dec($strBuf);\n if ($intIp == $intMidStartIp) {\n $intStart = $intMid;\n break;\n }\n if ($intIp > $intMidStartIp) $intStart = $intMid;\n else $intEnd = $intMid;\n }\n $intOffset = $intFirstRecord + $intStart * 7;\n fseek($fileIp, $intOffset);\n $strBuf = fread($fileIp, 4);\n $intStartIp = self::bin2dec($strBuf);\n $strBuf = fread($fileIp, 3);\n $intOffset = self::bin2dec($strBuf);\n fseek($fileIp, $intOffset);\n $strBuf = fread($fileIp, 4);\n $intEndIp = self::bin2dec($strBuf);\n if ($intIp < $intStartIp || $intIp > $intEndIp) return $arrUnknown;\n $intOffset += 4;\n while (($intFlag = ord(fgetc($fileIp))) == 1) {\n $strBuf = fread($fileIp, 3);\n $intOffset = self::bin2dec($strBuf);\n if ($intOffset < 12) return $arrUnknown;\n fseek($fileIp, $intOffset);\n }\n switch ($intFlag) {\n case 0:\n return $arrUnknown;\n break;\n case 2:\n $intOffsetAddr = $intOffset + 4;\n $strBuf = fread($fileIp, 3);\n $intOffset = self::bin2dec($strBuf);\n if ($intOffset < 12) return $arrUnknown;\n fseek($fileIp, $intOffset);\n while (($intFlag = ord(fgetc($fileIp))) == 2 || $intFlag == 1) {\n $strBuf = fread($fileIp, 3);\n $intOffset = self::bin2dec($strBuf);\n if ($intOffset < 12) return $arrUnknown;\n fseek($fileIp, $intOffset);\n }\n if (!$intFlag) return $arrUnknown;\n $arrAddr = array(\n \"region\" => chr($intFlag)\n );\n while (ord($c = fgetc($fileIp))) $arrAddr[\"region\"] .= $c;\n fseek($fileIp, $intOffsetAddr);\n while (($intFlag = ord(fgetc($fileIp))) == 2 || $intFlag == 1) {\n $strBuf = fread($fileIp, 3);\n $intOffset = self::bin2dec($strBuf);\n if ($intOffset < 12) {\n $arrAddr[\"address\"] = \"(unknown)\";\n return $arrAddr;\n }\n fseek($fileIp, $intOffset);\n }\n if (!$intFlag) {\n $arrAddr[\"address\"] = \"(unknown)\";\n return $arrAddr;\n }\n $arrAddr[\"address\"] = chr($intFlag);\n while (ord($c = fgetc($fileIp))) $arrAddr[\"address\"] .= $c;\n return $arrAddr;\n break;\n default:\n $arrAddr = array(\"region\" => chr($intFlag));\n while (ord($c = fgetc($fileIp))) $arrAddr[\"region\"] .= $c;\n while (($intFlag = ord(fgetc($fileIp))) == 2 || $intFlag == 1) {\n $strBuf = fread($fileIp, 3);\n $intOffset = self::bin2dec($strBuf);\n if ($intOffset < 12) {\n $arrAddr[\"address\"] = \"(unknown)\";\n return $arrAddr;\n }\n fseek($fileIp, $intOffset);\n }\n if (!$intFlag) {\n $arrAddr[\"address\"] = \"(unknown)\";\n return $arrAddr;\n }\n $arrAddr[\"address\"] = chr($intFlag);\n while (ord($c = fgetc($fileIp))) $arrAddr[\"address\"] .= $c;\n return $arrAddr;\n }\n }",
"function getVisitorIP()\r\n {\r\n $ip_regexp = \"/^([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})/\"; \r\n\r\n //Retrieve IP address from which the user is viewing the current page \r\n if (isset ($HTTP_SERVER_VARS[\"HTTP_X_FORWARDED_FOR\"]) && !empty ($HTTP_SERVER_VARS[\"HTTP_X_FORWARDED_FOR\"]))\r\n { \r\n $visitorIP = (!empty ($HTTP_SERVER_VARS[\"HTTP_X_FORWARDED_FOR\"])) ? $HTTP_SERVER_VARS[\"HTTP_X_FORWARDED_FOR\"] : ((!empty ($HTTP_ENV_VARS['HTTP_X_FORWARDED_FOR'])) ? $HTTP_ENV_VARS['HTTP_X_FORWARDED_FOR'] : @ getenv ('HTTP_X_FORWARDED_FOR')); \r\n } \r\n else\r\n { \r\n $visitorIP = (!empty ($HTTP_SERVER_VARS['REMOTE_ADDR'])) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : ((!empty ($HTTP_ENV_VARS['REMOTE_ADDR'])) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : @ getenv ('REMOTE_ADDR')); \r\n } \r\n\r\n return $visitorIP; \r\n }",
"function get_all_ip()\r\n{ \r\n global $db,$strings;\r\n $count = 0;\r\n $result = $db->query('SELECT ip_id,ipaddr FROM ipmap ORDER BY ipaddr ASC');\r\n\r\n while (@extract($db->fetch_array($result), EXTR_PREFIX_ALL, 'db')) {\r\n \t$iplist[$db_ip_id] = $db_ipaddr;\r\n\t\t$count ++;\r\n }\r\n\r\n\t$iplist[-1] = $strings[IPMAP_NOTASSIGNED];\r\n \r\n return $iplist;\r\n}",
"function getVisitorIP() {\n $ip = \"0.0.0.0\";\n if( ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) && ( !empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) ) {\n $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];\n } elseif( ( isset( $_SERVER['HTTP_CLIENT_IP'])) && (!empty($_SERVER['HTTP_CLIENT_IP'] ) ) ) {\n $ip = explode(\".\",$_SERVER['HTTP_CLIENT_IP']);\n $ip = $ip[3].\".\".$ip[2].\".\".$ip[1].\".\".$ip[0];\n } elseif((!isset( $_SERVER['HTTP_X_FORWARDED_FOR'])) || (empty($_SERVER['HTTP_X_FORWARDED_FOR']))) {\n if ((!isset( $_SERVER['HTTP_CLIENT_IP'])) && (empty($_SERVER['HTTP_CLIENT_IP']))) {\n $ip = $_SERVER['REMOTE_ADDR'];\n }\n }\n return $ip;\n}",
"public function getPadres(){\n return $this->vectorUrlsPadres;\n }",
"function findNet($ip,$sm) {\n\n $res = \"\";\n\n // divido gli ottetti\n $exip = explode('.',$ip);\n $exsm = explode('.',$sm);\n\n for($i=0; $i<4; $i++) {\n\n $subip=$exip[$i]; // ottetto del IP\n $subsm=$exsm[$i]; // ottetto della SM\n\n for($k=0; $k<8; $k++) {\n \n if($subip[$k] & $subsm[$k]) {\n $res.=\"1\";\n }\n else {\n $res.=\"0\";\n }\n }\n\n // rimetto i punti (tranne alla fine)\n if($i<3) {\n $res.=\".\";\n }\n \n }\n\n return $res;\n}",
"public function getRemoteIp();"
]
| [
"0.64549655",
"0.60389394",
"0.5822331",
"0.5804361",
"0.57738405",
"0.567063",
"0.56298107",
"0.5623736",
"0.5584858",
"0.5565743",
"0.55511135",
"0.5549495",
"0.5544723",
"0.5543816",
"0.5520428",
"0.551994",
"0.54972196",
"0.5468901",
"0.5441195",
"0.5437298",
"0.5436699",
"0.5433156",
"0.5420641",
"0.5411008",
"0.5399828",
"0.5367837",
"0.53464156",
"0.53406656",
"0.53069067",
"0.5300691"
]
| 0.6262196 | 1 |
/ funcion para convertir caracteres especiales a codigos html | function to_html($cadena){
$busqueda = array("á","é","í","ó","ú","Á","É","Í","Ó","Ú","ñ","Ñ","¿");
$reemplazo= array("á","é","í","ó","ú","Á","É","Í","Ó","Ú",
"ñ","Ñ","¿");
$resultado = str_replace($busqueda, $reemplazo, $cadena);
return $resultado;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function traducirHTML($cad){\n $cad=htmlspecialchars_decode($cad);\n $esp=array(' ','Á','Ä','Č','Ď','É','Ĺ','Ľ','Ň','Ó','Ô','Ŕ','Š','Ť','Ú','Ý','Ž','á','ä','č','ď','é','ĺ','ľ','ň','ó','ô','ŕ','š','ť','ú','ý','ž','Í','í');\n $sust=array(' ','Á','Ä','Č','Ď','É','Ĺ','Ľ','Ň','Ó','Ô','Ŕ','Š','Ť','Ú','Ý','Ž','á','ä','č','ď','é','ĺ','ľ','ň','ó','ô','ŕ','š','ť','ú','ý','ž','Í','í');\n return str_replace($esp,$sust,$cad);\n}",
"function traducirHTML($cad){\n $cad=htmlspecialchars_decode($cad);\n $esp=array(' ','Á','Ä','Č','Ď','É','Ĺ','Ľ','Ň','Ó','Ô','Ŕ','Š','Ť','Ú','Ý','Ž','á','ä','č','ď','é','ĺ','ľ','ň','ó','ô','ŕ','š','ť','ú','ý','ž','Í','í');\n $sust=array(' ','Á','Ä','Č','Ď','É','Ĺ','Ľ','Ň','Ó','Ô','Ŕ','Š','Ť','Ú','Ý','Ž','á','ä','č','ď','é','ĺ','ľ','ň','ó','ô','ŕ','š','ť','ú','ý','ž','Í','í');\n return str_replace($esp,$sust,$cad);\n}",
"function uc2html($str) {\r\n $ret = '';\r\n\r\n if (function_exists(\"iconv\")) {\r\n $ret = iconv(\"UCS-2LE\",\"CP949\",$str);\r\n\r\n }\r\n else\r\n {\r\n for( $i=0; $i<strlen($str)/2; $i++ ) {\r\n $charcode = ord($str[$i*2])+256*ord($str[$i*2+1]);\r\n $ret .= '&#'.$charcode;\r\n }\r\n }\r\n return $ret;\r\n }",
"public function getAsciiReplace();",
"function convert_chars($content, $deprecated = '')\n {\n }",
"function pdfTextChars($string) {\n \n\t$string = trim($string);\n\t$string = stripslashes($string);\n\t$string = convertToHtml($string);\n\t\n\t// Eliminare i commenti HTML\n\t$string = preg_replace(\"#(\\n*)#\", \"\", $string);\n\t$string = preg_replace(\"#<!--(.*)-->#\", \"\", $string);\n\t\n\t//$string = preg_replace(\"#<br />#\", \"\\n\", $string);\n\n\t$string = str_replace ('€', '€', $string);\n\t$string = str_replace ('•', '•', $string);\n\t//$string = str_replace ('&', '&', $string);\n\t//$string = str_replace ('\\'', ''', $string);\n\t//$string = preg_replace(\"/:/\", \":\", $string);\n\t//$string = str_replace(':', \":\", $string);\n\t\n\t// conversione in entities\n\t$string = htmlentities($string, ENT_QUOTES, 'UTF-8');\n\t// riconversione di alcune entities\n\t$string = preg_replace('#<([a-zA-Z]+)>#', \"<$1>\", $string);\t// <p>\n\t$string = preg_replace('#</([a-zA-Z]+)>#', \"</$1>\", $string);\t// </p>\n\t//$string = preg_replace('#/>#', '/>', $string);\t\t\t\t\t// />\n\t$string = preg_replace(\"#<([a-zA-Z]+)[\\s]+[\\w]*/>#\", \"<$1 />\", $string);\t// <br />\n\t$string = preg_replace(\"#<([a-zA-Z]+)[\\s]+(id|class|lang)="[\\w\\.\\-]*"[\\s]*>#\", \"<$1>\", $string);\t// <span id=\"...\">\n\t\n\t// per risolvere i problemi nel riconoscere la fine del tag 'b' quando è in prossimità di un 'br'\n\t$string = preg_replace(\"#><br />#\", \">\\n<br />\", $string);\n\t$string = preg_replace(\"#<br />\\n(<[a-zA-Z]+>)#\", \"$1\\n<br />\", $string);\n\t\n\t// problema quando non sono tag:\n\t//$string = str_replace('<', \"<\", $string);\n\t//$string = str_replace('>', \">\", $string);\n\t\n\t//$string = preg_replace(\"#><br />#\", \"> <br />\", $string);\n\t//$string = preg_replace(\"#<ul>#\", \"<ul style=\\\"margin:-20px;padding:0;\\\">\", $string);\n\t\n\treturn $string;\n}",
"function encode_desc(&$data)\n{\n $to_entities = get_html_translation_table(HTML_ENTITIES);\n\n $from_entities = array_flip($to_entities);\n\n $data = strtr($data,$from_entities);\n $data = strtr($data,$to_entities);\n\n return $data;\n}",
"static function Sustituto_Cadena($rb){\n $rb = str_replace(\"á\", \"á\", $rb);\n $rb = str_replace(\"é\", \"é\", $rb);\n $rb = str_replace(\"®\", \"®\", $rb);\n $rb = str_replace(\"Ã\", \"í\", $rb);\n $rb = str_replace(\"�\", \"í\", $rb);\n $rb = str_replace(\"ó\", \"ó\", $rb);\n $rb = str_replace(\"ú\", \"ú\", $rb);\n $rb = str_replace(\"n~\", \"ñ\", $rb);\n $rb = str_replace(\"º\", \"º\", $rb);\n $rb = str_replace(\"ª\", \"ª\", $rb);\n $rb = str_replace(\"á\", \"á\", $rb);\n $rb = str_replace(\"ñ\", \"ñ\", $rb);\n $rb = str_replace(\"Ñ\", \"Ñ\", $rb);\n $rb = str_replace(\"ñ\", \"ñ\", $rb);\n $rb = str_replace(\"n~\", \"ñ\", $rb);\n $rb = str_replace(\"Ú\", \"Ú\", $rb);\n return $rb;\n }",
"function xml_special_char($t_data){\n\n if(preg_match(\"/\\\"/\", $t_data)) str_replace(\"\\\"\", \""\", $t_data);\n elseif(preg_match(\"/'/\", $t_data)) str_replace(\"\\'\", \""\", $t_data);\n elseif(preg_match(\"/&/\", $t_data)) str_replace(\"&\", \"&\", $t_data);\n elseif(preg_match(\"/</\", $t_data)) str_replace(\"<\", \"<\", $t_data);\n elseif(preg_match(\"/>/\", $t_data)) str_replace(\">\", \">\", $t_data);\n\n return $t_data;\n }",
"function html_to_utf8 ($data)\r\n {\r\n return preg_replace(\"/\\\\&\\\\#([0-9]{3,10})\\\\;/e\", '_html_to_utf8(\"\\\\1\")', $data);\r\n }",
"function htmlRemoveSpecialCharacters($input){\n\t\tfor($i=0; $i<strlen($input); $i++){\n\n\t\t\t$value = ord($input[$i]);\n\t\t\tif($value >= 48 && $value <= 57);\n\t\t\telseif ($value >= 65 && $value <= 90) ;\n\t\t\telseif ($value >= 97 && $value <= 122) ;\n\t\t\telseif ($value == 32) ;\n\t\t\telse{\n\t\t\t\t$input = substr($input, 0, $i) . '\\\\' . substr($input, $i);\n\t\t\t}\n\t\t}\n\t\techo $input;\n\t\treturn $input;\n\t}",
"function entify($string) { \n /* used by /samuel/cv/, should leave tags as is and only convert chars */\n # echo \"<!-- $string -->\\n\";\n $from = array('/&/',\n '/å/', '/ä/', '/ö/',\n '/Å/', '/Ä/', '/Ö/',\n );\n $to = array('&',\n 'å', 'ä', 'ö',\n 'Å', 'Ä', 'Ö',\n );\n # echo \"<!-- $string -->\\n\";\n return preg_replace($from, $to, $string);\n }",
"function convertHTML($strInput) //Convert to html special code\n{\n\t//$strInput = htmlspecialchars($strInput, ENT_QUOTES);\n\t$strInput = str_replace('\"', '"', $strInput);\n\t$strInput = str_replace(\"'\", \"'\", $strInput);\n\treturn $strInput;\n}",
"function RSC($txt){\n\t$txt = str_replace(\"'\",\"'\",$txt);\n\t$txt = str_replace(\"!\",\"!\",$txt);\n\t$txt = str_replace(\"’\",\"’\",$txt);\n\t$txt = str_replace(\"‘\",\"‘\",$txt);\n\t$txt = str_replace('“',\"“\",$txt);\n\t$txt = str_replace('”',\"”\",$txt);\n\n\treturn $txt;\n}",
"function TildesHtml($cadena)\n{\n return str_replace(array(\"á\", \"é\", \"í\", \"ó\", \"ú\", \"ñ\", \"Á\", \"É\", \"Í\", \"Ó\", \"Ú\", \"Ñ\"), array(\"á\", \"é\", \"í\", \"ó\", \"ú\", \"ñ\",\n \"Á\", \"É\", \"Í\", \"Ó\", \"Ú\", \"Ñ\"), $cadena);\n}",
"function tarkista($s) {\n\t\n\t$etsi = array('#', '´', '%', '|', '--', '\\t');\n\t$korv = array('#', ''', '%', '|', '–', ' ');\n\n\t$s = htmlspecialchars($s);\n\t$s = trim(str_replace($etsi, $korv, $s));\n\t$s = stripslashes($s);\n\t$enc = mb_detect_encoding($s, 'UTF-8', true);\n\n\tif ($enc == 'UTF-8'){\n\t\treturn $s;\n\t} else {\n\t\treturn utf8_encode($s);\n\t}\n\t\n}",
"function get_contenido_html ($input_texto)\r\n{\r\n\t// inicializacion de variables\r\n\t$var_contenido_html = $input_texto;\r\n\r\n\t$var_contenido_html = str_replace(\"<\",\"<\",$var_contenido_html);\r\n\t$var_contenido_html = str_replace(\">\",\">\",$var_contenido_html);\r\n\t$var_contenido_html = str_replace(\""\",\"\\\"\",$var_contenido_html);\r\n\t$var_contenido_html = str_replace(\"&\",\"&\",$var_contenido_html);\r\n\r\n\t// devuelve el texto en formato nombre propio\r\n\treturn $var_contenido_html;\r\n}",
"function prepare_code($text) {\n $replace = array( '\\\"' => '"','\"' => '"', '<' => '<', '>' => '>', \"\\'\" => ''', \"'\" => ''' );\n return str_replace(array_keys($replace), array_values($replace),$text);\n}",
"function unconvertHTML($strInput)//Convert html special code to standart form\n{\n\t//$strInput = html_entity_decode($strInput);\n\t$strInput = str_replace('"', '\"', $strInput);\n\t$strInput = str_replace(\"'\", \"'\", $strInput);\n\treturn $strInput;\n}",
"public static function unescape($som) {}",
"abstract public function convert_to_html();",
"function txt_raw2form($t=\"\")\n\t{\n\t\t$t = str_replace( '$', \"$\", $t);\n\t\t\t\n\t\tif ( $this->get_magic_quotes )\n\t\t{\n\t\t\t$t = stripslashes($t);\n\t\t}\n\t\t\n\t\t$t = preg_replace( \"/\\\\\\(?!&#|\\?#)/\", \"\\", $t );\n\t\t\n\t\t//---------------------------------------\n\t\t// Make sure macros aren't converted\n\t\t//---------------------------------------\n\t\t\n\t\t$t = preg_replace( \"/<{(.+?)}>/\", \"<{\\\\1}>\", $t );\n\t\t\n\t\treturn $t;\n\t}",
"static function specialCharsToHTML( $str )\n {\n $search = array(\n 'á', 'é', 'í', 'ó', 'ú',\n 'Á', 'É', 'Í', 'Ó', 'Ú',\n 'ñ', 'Ñ', '¿', '¡'\n );\n $replace = array(\n 'á', 'é', 'í', 'ó', 'ú',\n 'Á', 'É', 'Í', 'Ó', 'Ú',\n 'ñ', 'Ñ', '¿', '¡'\n );\n\n $str = str_replace($search, $replace, $str);\n return $str;\n }",
"function convert_umlaute($text) {\r\n $pattern1 = \"/ä/\";\r\n $replace1 = \"ä\";\r\n $text = preg_replace($pattern1, $replace1, $text);\r\n $pattern2 = \"/ö/\";\r\n $replace2 = \"ö\";\r\n $text = preg_replace($pattern2, $replace2, $text);\r\n $pattern3 = \"/ü/\";\r\n $replace3 = \"ü\";\r\n $text = preg_replace($pattern3, $replace3, $text);\r\n $pattern1a = \"/Ä/\";\r\n $replace1a = \"Ä\";\r\n $text = preg_replace($pattern1a, $replace1a, $text);\r\n $pattern2a = \"/Ö/\";\r\n $replace2a = \"Ö\";\r\n $text = preg_replace($pattern2a, $replace2a, $text);\r\n $pattern3a = \"/Ü/\";\r\n $replace3a = \"Ü\";\r\n $text = preg_replace($pattern3a, $replace3a, $text);\r\n $pattern4 = \"/ß/\";\r\n $replace4 = \"ß\";\r\n $text = preg_replace($pattern4, $replace4, $text);\r\n $pattern5a = \"/\\\"/\";\r\n $replace5a = \""\";\r\n $text = preg_replace($pattern5a, $replace5a, $text);\r\n $pattern5b = \"/</\";\r\n $replace5b = \"<\";\r\n $text = preg_replace($pattern5b, $replace5b, $text);\r\n $pattern5c = \"/>/\";\r\n $replace5c = \">\";\r\n $text = preg_replace($pattern5c, $replace5c, $text);\r\n//\t $pattern5d=\"/&/\";\r\n//\t $replace5d=\"&\";\r\n//\t $text=preg_replace($pattern5d,$replace5d, $text);\r\n\r\n return $text;\r\n}",
"function cs_safebalises($texte) {\r\n\t$texte = trim($texte);\r\n\t// ouvre/supprime la premiere balise trouvee fermee (attention aux modeles SPIP)\r\n\tif(preg_match(',^(.*)</([a-z]+)>,Ums', $texte, $m) && !preg_match(\",<$m[2][ >],\", $m[1])) \r\n\t\t$texte = strlen($m[1])?\"<$m[2]>$texte\":trim(substr($texte, strlen($m[2])+3));\r\n\t// referme/supprime la derniere balise laissee ouverte (attention aux modeles SPIP)\r\n\tif(preg_match(',^(.*)[ >]([a-z]+)<,Ums', $rev = strrev($texte), $m) && !preg_match(\",>$m[2]/<,\", $m[1])) \r\n\t\t$texte = strrev(strlen($m[1])?\">$m[2]/<$rev\":trim(substr($rev, strlen($m[2])+2)));\r\n\t// balises <p|span|div> a traiter\r\n\tforeach(array('span', 'div', 'p') as $b) {\r\n\t\t// ouvrante manquante\r\n\t\tif(($fin = strpos($texte, \"</$b>\")) !== false)\r\n\t\t\tif(!preg_match(\",<{$b}[ >],\", substr($texte, 0, $fin)))\r\n\t\t\t\t$texte = \"<$b>$texte\";\r\n\t\t// fermante manquante\r\n\t\t$texte = strrev($texte);\r\n\t\tif(preg_match(',[ >]'.strrev(\"<{$b}\").',', $texte, $reg)) {\r\n\t\t\t$fin = strpos(substr($texte, 0, $deb = strpos($texte, $reg[0])), strrev(\"</$b>\"));\r\n\t\t\tif($fin===false || $fin>$deb) $texte = strrev(\"</$b>\").$texte;\r\n\t\t}\r\n\t\t$texte = strrev($texte);\r\n\t}\r\n\treturn $texte;\r\n}",
"function txt_bbcode($var) {\n\n $txt = utf8_encode(html_entity_decode($var));\n\n return $txt;\n}",
"function HtmlEncode(&$str)\n{\n\t\t\t //$str = str_replace(\"&\", \"。。\",$str);\n $str = str_replace(\"<\", \"。。\",$str);\n $str = str_replace(\">\", \"。。\",$str);\n $str = str_replace(\"'\", \"\\'\",$str);\n $str = str_replace(\"*\", \"\",$str);\n $str = str_replace(\"\\n\", \"<br/>\",$str);\n $str = str_replace(\"\\r\\n\", \"<br/>\",$str);\n $str = str_replace(\"select\", \"\",$str);\n $str = str_replace(\"insert\", \"\",$str);\n $str = str_replace(\"update\", \"\",$str);\n $str = str_replace(\"delete\", \"\",$str);\n $str = str_replace(\"create\", \"\",$str);\n $str = str_replace(\"drop\", \"\",$str);\n $str = str_replace(\"delcare\", \"\",$str);\n\t\t\t return $str;\n}",
"function uniencode($s)\n{\n $r = \"\";\n for ($i=0;$i<strlen($s);$i++) $r.= \"&#\".ord(substr($s,$i,1)).\";\";\n return $r;\n}",
"function hsc($in){\rif(\r\tgettype(strpos($in,\"<\"))==\"integer\"\r\t|| gettype(strpos($in,\">\"))==\"integer\"\r\t|| gettype(strpos($in,\"\\\"\"))==\"integer\"\r\t|| gettype(strpos($in,\"&\"))==\"integer\"\r\t|| gettype(strpos($in,\"'\"))==\"integer\"\r\t|| gettype(strpos($in,\""\"))==\"integer\"\r\t\t) return htmlentities($in,ENT_QUOTES,\"UTF-8\");\relse return $in;\r}",
"function AbbcH2T($text)\r\n{\r\n\t// This function is taken from WMS/common.lib/h2t()\r\n\r\n\t$text = str_replace('<', '<', $text);\r\n\t$text = str_replace('>', '>', $text);\r\n\t$text = str_replace('"', '\"', $text);\r\n\t$text = str_replace(' ', ' ', $text);\r\n\t$text = str_replace('&', '&', $text);\r\n\treturn $text;\r\n}"
]
| [
"0.6673663",
"0.6673663",
"0.6527756",
"0.6498215",
"0.63972336",
"0.6355365",
"0.6302068",
"0.630082",
"0.6292011",
"0.62564963",
"0.6237709",
"0.62167984",
"0.61930776",
"0.6155556",
"0.6132251",
"0.6110325",
"0.6109017",
"0.6101897",
"0.6043615",
"0.6041443",
"0.6031668",
"0.60203123",
"0.6012526",
"0.60103637",
"0.59809613",
"0.5978741",
"0.5977986",
"0.5966171",
"0.59627664",
"0.59549856"
]
| 0.67559993 | 0 |
/ Permite copiar un directorio completo de forma recursiva | function copiar ($desde, $hasta){
mkdir($hasta, 0777);
$this_path = getcwd();
if(is_dir($desde)) {
chdir($desde);
$handle=opendir('.');
while(($file = readdir($handle))!==false){
if(($file != ".") && ($file != "..")){
if(is_dir($file)){
copiar($desde.$file."/", $hasta.$file."/");
chdir($desde);
}
if(is_file($file)){
copy($desde.$file, $hasta.$file);
}
}
}
closedir($handle);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function recursive_copy($src, $dst): void\n{\n $dir = opendir($src);\n if (!@mkdir($dst) && !is_dir($dst)) {\n throw new RuntimeException(sprintf('Directory \"%s\" was not created', $dst));\n }\n while (($file = readdir($dir))) {\n if (($file !== '.') && ($file !== '..')) {\n if (is_dir($src . '/' . $file)) {\n recursive_copy($src . '/' . $file, $dst . '/' . $file);\n } else {\n copy($src . '/' . $file, $dst . '/' . $file);\n }\n }\n }\n closedir($dir);\n}",
"function recurse_copy($src,$dst) { \n $dir = opendir($src);\n @mkdir($dst); \n while(false !== ( $file = readdir($dir)) ) {\n if (( $file != '.' ) && ( $file != '..') && !strstr($file,'.DS_Store')) {\n if ( is_dir($src . '/' . $file) ) { \n recurse_copy($src . '/' . $file,$dst . '/' . $file); \n } \n else { \n if(!copy($src . '/' . $file,$dst . '/' . $file)) {\n echo (\"Failed to copy\");\n } \n } \n } \n } \n closedir($dir); \n }",
"function recurse_copy(string $src, string $dst) : void {\n\t$dir = opendir($src);\n\t@mkdir($dst);\n\twhile(false !== ( $file = readdir($dir)) ) {\n\t\tif (( $file != '.' ) && ( $file != '..' )) {\n\t\t\tif ( is_dir($src . '/' . $file) ) {\n\t\t\t\trecurse_copy($src . '/' . $file,$dst . '/' . $file);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tcopy($src . '/' . $file,$dst . '/' . $file);\n\t\t\t}\n\t\t}\n\t}\n\tclosedir($dir);\n}",
"function recurse_copy_dir($src,$dst) { \n\t$dir = opendir($src); \n\t$resp=mkdir($dst);\n\tLOG_MSG(\"INFO\",\"creating directory $resp -> [$dst] \");\n\twhile($dir && false !== ( $file = readdir($dir)) ) { \n\t\tif (( $file != '.' ) && ( $file != '..' )) { \n\t\t\tif ( is_dir($src . '/' . $file) ) { \n\t\t\t\trecurse_copy_dir($src . '/' . $file,$dst . '/' . $file); \n\t\t\t} \n\t\t\telse { \n\t\t\t\tcopy($src . '/' . $file,$dst . '/' . $file); \n\t\t\t} \n\t\t} \n\t} \n\tclosedir($dir); \n}",
"function recursive_copy($src,$dst) { \r\n\t $dir = opendir($src); \r\n\t @mkdir($dst); \r\n\t while(false !== ( $file = readdir($dir)) ) { \r\n\t if (( $file != '.' ) && ( $file != '..' )) { \r\n\t if ( is_dir($src . '/' . $file) ) { \r\n\t recursive_copy($src . '/' . $file,$dst . '/' . $file); \r\n\t } \r\n\t else { \r\n\t copy($src . '/' . $file,$dst . '/' . $file); \r\n\t } \r\n\t } \r\n\t } \r\n\t closedir($dir); \r\n\t}",
"function copydir($src, $dst) {\n // open the source directory\n $dir = opendir($src);\n // Make the destination directory if not exist\n @mkdir($dst);\n // Loop through the files in source directory\n foreach (scandir($src) as $file) {\n if (( $file != '.' ) && ( $file != '..' )) {\n if ( is_dir($src . '/' . $file) )\n {\n // Recursively calling custom copy function\n // for sub directory\n copydir($src . '/' . $file, $dst . '/' . $file);\n }\n else {\n copy($src . '/' . $file, $dst . '/' . $file);\n }\n }\n }\n closedir($dir);\n}",
"abstract public function copyLocalDir($from, $to);",
"public function recurseCopy($src,$dst) { \n $dir = opendir($src); \n @mkdir($dst); \n while(false !== ( $file = readdir($dir)) ) { \n if (( $file != '.' ) && ( $file != '..' )) { \n if ( is_dir($src . '/' . $file) ) { \n recurseCopy($src . '/' . $file,$dst . '/' . $file); \n } \n else { \n copy($src . '/' . $file,$dst . '/' . $file); \n } \n } \n } \n closedir($dir); \n }",
"function cp_r ($from, $to, $skip = array())\n{\n\t$fromFile = basename($from);\n\tif (in_array($fromFile,$skip))\n\t\treturn false;\n\t\n\tif (!is_dir($from))\n\t\tcopy($from, $to . '/' . $fromFile);\n\telse\n\t{\n\t\tmkdir($to . '/' . $fromFile);\n\t\t$dir = array_diff(getTreeStructure($from, GTS_ALL),$skip);\n\t\tsort($dir);\n\t\t\n\t\tfor($i=0; $i<count($dir); $i++)\n\t\t{\n\t\t\tif (!is_dir($from . '/' . $dir[$i]))\n\t\t\t\tcopy($from . '/' . $dir[$i], $to . $fromFile . '/' . $dir[$i]);\n\t\t\telse\n\t\t\t\tmkdir($to . $fromFile . '/' . $dir[$i]);\n\t\t}\n\t\treturn true;\n\t}\n}",
"public function testCopyDirectoryMovesEntireDirectory()\n {\n mkdir(self::$temp.DS.'tmp', 0777, true);\n file_put_contents(self::$temp.DS.'tmp'.DS.'foo.txt', '');\n file_put_contents(self::$temp.DS.'tmp'.DS.'bar.txt', '');\n\n mkdir(self::$temp.DS.'tmp'.DS.'nested', 0777, true);\n file_put_contents(self::$temp.DS.'tmp'.DS.'nested'.DS.'baz.txt', '');\n\n Storage::cpdir(self::$temp.DS.'tmp', self::$temp.DS.'tmp2');\n\n $this->assertTrue(is_dir(self::$temp.DS.'tmp2'));\n $this->assertTrue(is_file(self::$temp.DS.'tmp2'.DS.'foo.txt'));\n $this->assertTrue(is_file(self::$temp.DS.'tmp2'.DS.'bar.txt'));\n $this->assertTrue(is_dir(self::$temp.DS.'tmp2'.DS.'nested'));\n $this->assertTrue(is_file(self::$temp.DS.'tmp2'.DS.'nested'.DS.'baz.txt'));\n }",
"static public function copy($src, $dst) \n {\n if (is_file($src)) {\n if (!file_exists($f = dirname($dst))) {\n mkdir($f, 0775, true);\n @chmod($f, 0775); // let @, if www-data is not owner but allowed to write\n }\n copy($src, $dst);\n return;\n }\n if (is_dir($src)) {\n $src = rtrim($src, '/');\n $dst = rtrim($dst, '/');\n if (!file_exists($dst)) {\n mkdir($dst, 0775, true);\n @chmod($dst, 0775); // let @, if www-data is not owner but allowed to write\n }\n $handle = opendir($src);\n while (false !== ($entry = readdir($handle))) {\n if ($entry[0] == '.') continue;\n self::copy($src . '/' . $entry, $dst . '/' . $entry);\n }\n closedir($handle);\n }\n }",
"public static function rcopy($src,$dst) { //dd($src);\n $dir = opendir($src); \n @mkdir($dst); \n while(false !== ( $file = readdir($dir)) ) { \n if (( $file != '.' ) && ( $file != '..' )) { \n if ( is_dir($src . '/' . $file) ) { \n self::rcopy($src . '/' . $file,$dst . '/' . $file); \n } \n else { \n copy($src . '/' . $file,$dst . '/' . $file); \n } \n } \n } \n closedir($dir); \n }",
"function recurse_copy($src,$dst) {\n\t\t$dir = opendir($src);\n\t\t@mkdir($dst);\n\t\twhile(false !== ( $file = readdir($dir)) ) {\n\t\t\tif (( $file != '.' ) && ( $file != '..' )) {\n\t\t\t\tif ( is_dir($src . '/' . $file) ) {\n\t\t\t\t\t$this->recurse_copy($src . '/' . $file,$dst . '/' . $file);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tcopy($src . '/' . $file,$dst . '/' . $file);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tclosedir($dir);\n\t}",
"function smartCopy($source, $dest, $options=array('folderPermission'=>0755, 'filePermission'=>0755)) \r\n{ \r\n\t$result=false; \r\n\t \r\n\tif (is_file($source)) \r\n\t{ \r\n\t\tif ($dest[strlen($dest)-1]=='/') \r\n\t\t{ \r\n\t\t\tif (!file_exists($dest)) \r\n\t\t\t{ \r\n\t\t\t\t cmfcDirectory::makeAll($dest,$options['folderPermission'],true); \r\n\t\t\t} \r\n\t\t\t\r\n\t\t\t$__dest = $dest . \"/\" . basename($source); \r\n\t\t}\r\n\t\telse \r\n\t\t{ \r\n\t\t\t$__dest=$dest; \r\n\t\t}\r\n\t\t\r\n\t\t$result=copy($source, $__dest); \r\n\t\t\r\n\t\tchmod($__dest,$options['filePermission']); \r\n\t\t \r\n\t } elseif(is_dir($source)) { \r\n\t\tif ($dest[strlen($dest)-1]=='/') { \r\n\t\t\tif ($source[strlen($source)-1]=='/') { \r\n\t\t\t\t//Copy only contents \r\n\t\t\t} else { \r\n\t\t\t\t//Change parent itself and its contents \r\n\t\t\t\t$dest=$dest.basename($source); \r\n\t\t\t\t@mkdir($dest); \r\n\t\t\t\tchmod($dest,$options['filePermission']); \r\n\t\t\t} \r\n\t\t} else { \r\n\t\t\tif ($source[strlen($source)-1]=='/') { \r\n\t\t\t\t//Copy parent directory with new name and all its content \r\n\t\t\t\t@mkdir($dest,$options['folderPermission']); \r\n\t\t\t\tchmod($dest,$options['filePermission']); \r\n\t\t\t} else { \r\n\t\t\t\t//Copy parent directory with new name and all its content \r\n\t\t\t\t@mkdir($dest,$options['folderPermission']); \r\n\t\t\t\tchmod($dest,$options['filePermission']); \r\n\t\t\t} \r\n\t\t}\r\n\r\n\t\t$dirHandle=opendir($source); \r\n\t\twhile($file=readdir($dirHandle)) \r\n\t\t{ \r\n\t\t\tif($file!=\".\" && $file!=\"..\") \r\n\t\t\t{ \r\n\t\t\t\tif(!is_dir($source.\"/\".$file)) { \r\n\t\t\t\t\t$__dest=$dest.\"/\".$file; \r\n\t\t\t\t} else { \r\n\t\t\t\t\t$__dest=$dest.\"/\".$file; \r\n\t\t\t\t} \r\n\t\t\t\t//echo \"$source/$file ||| $__dest<br />\"; \r\n\t\t\t\t$result=smartCopy($source.\"/\".$file, $__dest, $options); \r\n\t\t\t} \r\n\t\t} \r\n\t\tclosedir($dirHandle); \r\n\t\t \r\n\t} else { \r\n\t\t$result=false; \r\n\t} \r\n\treturn $result; \r\n}",
"function copy_directory( $src, $dst ) {\r\n $dir = opendir( $src );\r\n @mkdir( $dst );\r\n while ( false !== ( $file = readdir( $dir )) ) {\r\n if ( ( $file != '.' ) && ( $file != '..' ) ) {\r\n if ( is_dir( $src . '/' . $file ) ) {\r\n recurse_copy( $src . '/' . $file, $dst . '/' . $file );\r\n } else {\r\n copy( $src . '/' . $file, $dst . '/' . $file );\r\n }\r\n }\r\n }\r\n closedir( $dir );\r\n }",
"function custom_copy($src, $dst) {\n $dir = opendir($src); \n \n // Make the destination directory if not exist \n @mkdir($dst); \n \n // Loop through the files in source directory \n while( $file = readdir($dir) ) { \n \n if (( $file != '.' ) && ( $file != '..' )) { \n if ( is_dir($src . '/' . $file) ) \n { \n \n // Recursively calling custom copy function \n // for sub directory \n custom_copy($src . '/' . $file, $dst . '/' . $file); \n \n } \n else { \n copy($src . '/' . $file, $dst . '/' . $file); \n } \n } \n } \n \n closedir($dir); \n }",
"public function copyOtherFiles(): void;",
"function smartCopy($source, $dest, $options=array('folderPermission'=>0777,'filePermission'=>0777)) \n{ \n $result=false; \n \n if (is_file($source)) { \n if ($dest[strlen($dest)-1]=='/') { \n if (!file_exists($dest)) { \n cmfcDirectory::makeAll($dest,$options['folderPermission'],true); \n } \n $__dest=$dest.\"/\".basename($source); \n } else { \n $__dest=$dest; \n } \n $result=copy($source, $__dest); \n chmod($__dest,$options['filePermission']); \n \n } elseif(is_dir($source)) { \n if ($dest[strlen($dest)-1]=='/') { \n if ($source[strlen($source)-1]=='/') { \n //Copy only contents \n } else { \n //Change parent itself and its contents \n $dest=$dest.basename($source); \n @mkdir($dest); \n chmod($dest,$options['filePermission']); \n } \n } else { \n if ($source[strlen($source)-1]=='/') { \n //Copy parent directory with new name and all its content \n @mkdir($dest,$options['folderPermission']); \n chmod($dest,$options['filePermission']); \n } else { \n //Copy parent directory with new name and all its content \n @mkdir($dest,$options['folderPermission']); \n /*\n * modify by Zoe\n * dunno why this will generate warning message\n * tune this warning temporally \n */\n @chmod($dest,$options['filePermission']); \n } \n } \n\n $dirHandle=opendir($source); \n while($file=readdir($dirHandle)) \n { \n if($file!=\".\" && $file!=\"..\") \n { \n if(!is_dir($source.\"/\".$file)) { \n $__dest=$dest.\"/\".$file; \n } else { \n $__dest=$dest.\"/\".$file; \n } \n //echo \"$source/$file ||| $__dest<br />\"; \n $result=smartCopy($source.\"/\".$file, $__dest, $options); \n } \n } \n closedir($dirHandle); \n \n } else { \n $result=false; \n } \n return $result; \n}",
"function folder_recurse($src,$dst, $action = 'copy') {\n $dir = opendir($src);\n @mkdir($dst);\n while(false !== ( $file = readdir($dir)) ) {\n if (( $file != '.' ) && ( $file != '..' )) {\n if ( is_dir($src . '/' . $file) ) {\n folder_recurse($src . '/' . $file,$dst . '/' . $file, $action);\n }\n else {\n\n $action($src . '/' . $file,$dst . '/' . $file);\n }\n }\n }\n closedir($dir);\n }",
"function copy_directory($source, $destination) {\n if ($source == '.' || $source == '..') {\n return;\n }\n if (is_dir($source)) {\n @mkdir($destination);\n $directory = dir($source);\n while (false !== ($read_directory = $directory->read())) {\n if ($read_directory == '.' || $read_directory == '..') {\n continue;\n }\n $path_dir = $source . '/' . $read_directory;\n if (is_dir($path_dir)) {\n copy_directory($path_dir, $destination . '/' . $read_directory);\n continue;\n }\n copy($path_dir, $destination . '/' . $read_directory);\n }\n \n $directory->close();\n } else {\n copy($source, $destination);\n }\n}",
"function copy($source, $dest, $options=array('folderPermission'=>0755,'filePermission'=>0755))\n\t{\n\t\t$result=false;\n\t\t\n\t\tif (is_file($source)) {\n\t\t\tif ($dest[strlen($dest)-1]=='/') {\n\t\t\t\tif (!file_exists($dest)) {\n\t\t\t\t\tcmfcDirectory::makeAll($dest,$options['folderPermission'],true);\n\t\t\t\t}\n\t\t\t\t$__dest=$dest.\"/\".basename($source);\n\t\t\t} else {\n\t\t\t\t$__dest=$dest;\n\t\t\t}\n\t\t\t$result=copy($source, $__dest);\n\t\t\tchmod($__dest,$options['filePermission']);\n\t\t\t\n\t\t} elseif(is_dir($source)) {\n\t\t\tif ($dest[strlen($dest)-1]=='/') {\n\t\t\t\tif ($source[strlen($source)-1]=='/') {\n\t\t\t\t\t//Copy only contents\n\t\t\t\t} else {\n\t\t\t\t\t//Change parent itself and its contents\n\t\t\t\t\t$dest=$dest.basename($source);\n\t\t\t\t\t@mkdir($dest);\n\t\t\t\t\tchmod($dest,$options['filePermission']);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ($source[strlen($source)-1]=='/') {\n\t\t\t\t\t//Copy parent directory with new name and all its content\n\t\t\t\t\t@mkdir($dest,$options['folderPermission']);\n\t\t\t\t\tchmod($dest,$options['filePermission']);\n\t\t\t\t} else {\n\t\t\t\t\t//Copy parent directory with new name and all its content\n\t\t\t\t\t@mkdir($dest,$options['folderPermission']);\n\t\t\t\t\tchmod($dest,$options['filePermission']);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$dirHandle=opendir($source);\n\t\t\twhile($file=readdir($dirHandle))\n\t\t\t{\n\t\t\t\tif($file!=\".\" && $file!=\"..\")\n\t\t\t\t{\n\t\t\t\t\tif(!is_dir($source.\"/\".$file)) {\n\t\t\t\t\t\t$__dest=$dest.\"/\".$file;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$__dest=$dest.\"/\".$file;\n\t\t\t\t\t}\n\t\t\t\t\t//echo \"$source/$file ||| $__dest<br />\";\n\t\t\t\t\t$result=cmfcDirectory::copy($source.\"/\".$file, $__dest, $options);\n\t\t\t\t}\n\t\t\t}\n\t\t\tclosedir($dirHandle);\n\t\t\t\n\t\t} else {\n\t\t\t$result=false;\n\t\t}\n\t\treturn $result;\n\t}",
"public static function recurse_copy($src,$dst)\n {\n $dir = opendir($src);\n @mkdir($dst);\n while(false !== ( $file = readdir($dir)) ) {\n if (( $file != '.' ) && ( $file != '..' )) {\n if ( is_dir($src . '/' . $file) ) {\n self::recurse_copy($src . '/' . $file,$dst . '/' . $file);\n }\n else {\n copy($src . '/' . $file,$dst . '/' . $file);\n }\n }\n }\n closedir($dir);\n }",
"function rcopy($src, $dst)\n{\n ini_set('max_execution_time', 0);\n set_time_limit(0);\n if (is_dir($src)) {\n if (!file_exists($dst)) : mkdir($dst);\n endif;\n $files = scandir($src);\n foreach ($files as $file) {\n if ($file != \".\" && $file != \"..\") {\n rcopy(\"$src/$file\", \"$dst/$file\");\n }\n }\n } elseif (file_exists($src)) {\n copy($src, $dst);\n }\n return true;\n}",
"function copyFolder($old_dir,$new_dir){\r\n\t\t\t\t// open the user's directory\r\n\t\t\t\t\t$path = './cloud/'.$_SESSION['SESS_USER_ID'].'/'; // '.' for current\r\n\r\n\t\t\t\t\t\r\n\t\t\t}",
"function copyDirRecursive($source, $dest, $dirname='', $privileges=0777)\n {\n static $orgdest = null;\n\n if (is_null($orgdest))\n $orgdest = $dest;\n\n atkdebug(\"Checking write permission for \".$orgdest);\n\n if (!atkFileUtils::is_writable($orgdest))\n {\n atkdebug(\"Error no write permission!\");\n return false;\n }\n\n atkdebug(\"Permission granted to write.\");\n\n if ($dest == $orgdest && $dirname != '')\n {\n mkdir($orgdest . \"/\" . $dirname,$privileges);\n return atkFileUtils::copyDirRecursive($source,$orgdest.\"/\".$dirname,'',$privileges);\n }\n\n // Simple copy for a file\n if (is_file($source))\n {\n $c = copy($source, $dest);\n\n chmod($dest, $privileges);\n\n return $c;\n }\n\n // Make destination directory\n if (!is_dir($dest))\n {\n if ($dest != $orgdest && !is_dir($orgdest.'/'.$dirname) && $dirname != '')\n $dest = $orgdest.'/'.$dirname;\n\n $oldumask = umask(0);\n\n mkdir($dest, $privileges);\n\n umask($oldumask);\n }\n\n // Loop through the folder\n $dir = dir($source);\n\n while (false !== $entry = $dir->read())\n {\n // Skip pointers\n if ($entry == '.' || $entry == '..')\n continue;\n\n // Deep copy directories\n if ($dest !== \"$source/$entry\")\n atkFileUtils::copyDirRecursive(\"$source/$entry\", \"$dest/$entry\", $dirname, $privileges);\n }\n\n // Clean up\n $dir->close();\n\n return true;\n }",
"function publisher_copyr($source, $dest)\r\n{\r\n // Simple copy for a file\r\n if (is_file($source)) {\r\n return copy($source, $dest);\r\n }\r\n\r\n // Make destination directory\r\n if (!is_dir($dest)) {\r\n mkdir($dest);\r\n }\r\n\r\n // Loop through the folder\r\n $dir = dir($source);\r\n while (false !== $entry = $dir->read()) {\r\n // Skip pointers\r\n if ($entry == '.' || $entry == '..') {\r\n continue;\r\n }\r\n\r\n // Deep copy directories\r\n if (is_dir(\"$source/$entry\") && ($dest !== \"$source/$entry\")) {\r\n copyr(\"$source/$entry\", \"$dest/$entry\");\r\n } else {\r\n copy(\"$source/$entry\", \"$dest/$entry\");\r\n }\r\n }\r\n\r\n // Clean up\r\n $dir->close();\r\n return true;\r\n}",
"public function copy($name){\n\t\t$path_array = explode(self::DS, $this->path);\n\t\t$oldPath = $this->path;\n\t\t$path_array = explode(self::DS, $oldPath);\n\t\tarray_pop($path_array);\n\t\t$_newPath = implode(self::DS, $path_array);\n\t\t$newPath = $_newPath . self::DS . $name;\n\t\tcopy($this->path, $newPath);\n\t}",
"function copy_dir_with_files($src, $dst)\n{\n $dir = opendir($src);\n\n // Make the destination directory if not exist\n @mkdir($dst);\n\n // Loop through the files in source directory\n while ($file = readdir($dir)) {\n\n if (($file != '.') && ($file != '..')) {\n if (is_dir($src . '/' . $file)) {\n\n // Recursively calling custom copy function\n // for sub directory\n custom_copy($src . '/' . $file, $dst . '/' . $file);\n\n } else {\n copy($src . '/' . $file, $dst . '/' . $file);\n }\n }\n }\n\n closedir($dir);\n}",
"function recursive_copy($source,$destination) {\n\t $counter = 0;\n\t if (substr($source,strlen($source),1)!=\"/\") $source .= \"/\";\n\t if (substr($destination,strlen($destination),1)!=\"/\") $destination .= \"/\";\n\t if (!is_dir($destination)) makeDirs($destination);\n\t $itens = listFiles($source);\n\t foreach($itens as $id => $name) {\n\t if ($name[0] == \"/\") $name = substr($name,1);\n\t if (is_file($source.$name)) { // file\n\t \tif ($name != \"Thumbs.db\") {\n\t\t $counter ++;\n\t\t if (!copy ($source.$name,$destination.$name))\n\t\t echo \"Error: \".$source.$name.\" -> \".$destination.$name.\"<br/>\";\n\t\t else\n\t\t safe_chmod($destination.$name,0775);\n\t \t} else\n\t \t\t@unlink($source.$name);\n\t } else if(is_dir($source.$name)) { // dir\n\t if (!is_dir($destination.$name))\n\t safe_mkdir($destination.$name);\n\t $counter += recursive_copy($source.$name,$destination.$name);\n\t }\n\t }\n\t return $counter;\n\t}",
"function smartCopy($source, $dest, $folderPermission=0755,$filePermission=0644){\r\n# source=file & dest=file / not there yet => copy file from source-dir to dest and overwrite a file there, if present\r\n\r\n# source=dir & dest=dir => copy all content from source to dir\r\n# source=dir & dest not there yet => copy all content from source to a, yet to be created, dest-dir\r\n $result=false;\r\n \r\n if (is_file($source)) { # $source is file\r\n if(hb_is_dir($dest)) { # $dest is folder\r\n if ($dest[strlen($dest)-1]!='/') # add '/' if necessary\r\n $__dest=$dest.\"/\";\r\n $__dest .= basename($source);\r\n }\r\n else { # $dest is (new) filename\r\n $__dest=$dest;\r\n }\r\n $result=copy($source, $__dest);\r\n chmod($__dest,$filePermission);\r\n }\r\n elseif(hb_is_dir($source)) { # $source is dir\r\n if(!hb_is_dir($dest)) { # dest-dir not there yet, create it\r\n @mkdir($dest,$folderPermission);\r\n chmod($dest,$folderPermission);\r\n }\r\n if ($source[strlen($source)-1]!='/') # add '/' if necessary\r\n $source=$source.\"/\";\r\n if ($dest[strlen($dest)-1]!='/') # add '/' if necessary\r\n $dest=$dest.\"/\";\r\n\r\n # find all elements in $source\r\n $result = true; # in case this dir is empty it would otherwise return false\r\n $dirHandle=opendir($source);\r\n while($file=readdir($dirHandle)) { # note that $file can also be a folder\r\n if($file!=\".\" && $file!=\"..\") { # filter starting elements and pass the rest to this function again\r\n# echo \"$source$file ||| $dest$file<br />\\n\";\r\n $result=smartCopy($source.$file, $dest.$file, $folderPermission, $filePermission);\r\n }\r\n }\r\n closedir($dirHandle);\r\n }\r\n else {\r\n $result=false;\r\n }\r\n return $result;\r\n }"
]
| [
"0.6919138",
"0.6891525",
"0.684044",
"0.6804076",
"0.6776408",
"0.6764926",
"0.66789585",
"0.6662889",
"0.66518027",
"0.66457427",
"0.6632279",
"0.6572202",
"0.6561335",
"0.6530037",
"0.6505243",
"0.64843374",
"0.64732915",
"0.6471976",
"0.6463541",
"0.6450435",
"0.64069027",
"0.63656133",
"0.6364114",
"0.62684953",
"0.62332535",
"0.62283117",
"0.62103003",
"0.6176198",
"0.6171818",
"0.6171131"
]
| 0.76319045 | 0 |
/ Permite eliminar un directorio completo | function eliminarDirectorio($directorio){
foreach(glob($directorio . "/*") as $archivos_carpeta){
if (is_dir($archivos_carpeta)){
eliminarDirectorio($archivos_carpeta);
}
else{
unlink($archivos_carpeta);
}
}
rmdir($directorio);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function eliminarDirectorio($directorio,$rutaActual){\n\t$carpeta = @scandir($rutaActual.\"/\".$directorio);\n\tif (count($carpeta) > 2){\n\t echo \"El directorio contiene Archivos, verifique la informacion\";\n\t}else{\n\t if(rmdir($rutaActual.\"/\".$directorio)){\n\t\techo \"<script type='text/javascript'> abrirDirectorio('\".$rutaActual.\"'); </script>\";\n\t }else{\n\t\techo \"<script type='text/javascript'> alert('Error al ejecutar la operacion'); </script>\";\n\t }\n\t}\n }",
"public function remove_dir() {\n\n $path = $this->get_upload_pres_path();\n\n //append_debug_msg($path);\n\n if(!$path || !file_exists($path)){ return; }\n delete_dir($path);\n }",
"function borrarCarpeta($carpeta) {\r\n foreach(glob($carpeta . \"/*\") as $archivos_carpeta){ \r\n if (is_dir($archivos_carpeta)){\r\n if($archivos_carpeta != \".\" && $archivos_carpeta != \"..\") {\r\n borrarCarpeta($archivos_carpeta);\r\n }\r\n } else {\r\n unlink($archivos_carpeta);\r\n }\r\n }\r\n rmdir($carpeta);\r\n}",
"function remdir()\r\n {\r\n if(is_writable($_REQUEST['file']))\r\n {\r\n $dir=$_GET['file'];\r\n $this->deleteDirectory($dir); \r\n }\r\n else{echo \"Permission Denied !\";}\r\n }",
"function eliminaRecursivo($dir) {\r\n\t\t$error=0;\r\n\t\tif (is_dir($dir)) {\r\n\t\t\t$cont=scandir($dir); //Recojemos todo el contenido del directorio\r\n\t\t\tforeach ($cont as $elem) {\r\n\t\t\t\t//Por cada elemento del contenido, si no es el . o los ..\r\n\t\t\t\tif ($elem != \".\" && $elem != \"..\") {\r\n\t\t\t\t\t//generamos la nueva ruta\r\n\t\t\t\t\t$ruta=$dir.\"/\".$elem;\r\n\t\t\t\t\tif (is_dir($ruta)){\r\n\t\t\t\t\t\t//si es un directorio volvemos a llamar a la funcion\r\n\t\t\t\t\t\t$error=$error+eliminaRecursivo($ruta); \r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\t//si no lo es, intentamos eliminar el archivo (o lo que sea)\r\n\t\t\t\t\t\tif(!unlink($ruta)){\r\n\t\t\t\t\t\t\t$error=$error+1;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tunset($cont);//reseteamos la array de contenidos e intentamos eliminar el directorio\r\n\t\t\tif(!rmdir($dir)){\r\n\t\t\t\t$error=$error+1;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn $error;\r\n\t}",
"function eliminar_archivos($dir)\n{\n\tif (is_dir($dir)) {\n\t\t$directorio = opendir($dir);\n\t\twhile ($archivo = readdir($directorio)) {\n\t\t\tif ($archivo != '.' and $archivo != '..') {\n\t\t\t\t@unlink($dir . $archivo);\n\t\t\t}\n\t\t}\n\t\tclosedir($directorio);\n\t\t@rmdir($dir);\n\t}\n}",
"public function destroyFolder()\n {\n $file=public_path(config('larapages.media.folder')).Input::all()['folder'];\n if (!file_exists($file)) die('File not found '.$file);\n if (!is_dir($file)) die('Not a folder '.$file);\n $h=opendir($file);\n while($f=readdir($h)) {\n if ($f!='.' && $f!='..') die('Folder is not empty');\n }\n closedir($h);\n rmdir($file);\n }",
"public function eliminar(){\n //si el archivo existe\n if(is_file($this->ruta)){\n //doy permisos para eliminar archivos\n chmod($this->ruta, 0777);\n //elimino el archivo y devuelvo el resultado\n return unlink($this->ruta);\n }\n }",
"public function delete()\n {\n $filesystem = $this->localFilesystem(dirname($this->path));\n\n method_exists($filesystem, 'deleteDir')\n ? $filesystem->deleteDir(basename($this->path))\n : $filesystem->deleteDirectory(basename($this->path));\n }",
"final public static function clearDir($directorio){\n\t\tif (!is_dir($directorio)) {\n\t\t\treturn new \\RuntimeException('El direcotrio especificado no es un directorio.');\n\t\t}\n\t\tif (!is_link($directorio)) {\n\t\t\tforeach (glob($directorio . '*') as $files) {\n\t\t\t\tif (file_exists($files)) {\n\t\t\t\t\tunlink($files);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t}",
"function deleteFolder();",
"function remove_client_dir(){\n\t\t$cmd=\"rm -rf $this->client_dir\";\n\t\t`$cmd`;\n\t}",
"function borrar_directorio($id_dir,$id_usuario,$parent,$ruta) {\n\t\n\t\t$connection = mysql_connect($this->HOST, $this->USERNAME, $this->PASSWORD);\n\t\t$SelectedDB = mysql_select_db($this->DBNAME);\n\t\t\t\t\n\t\t$query2 = \"SELECT * FROM repositorio_directorios\n\t\tWHERE ruta_dir LIKE '$ruta%' AND id_usuario='$id_usuario'\";\n\t\t$result2 = mysql_query($query2); \n\t\t\n\t\twhile ($row2=mysql_fetch_array($result2)) {\n\t\t\n\t\t\t$id_directorio=$row2['id'];\n\t\t\t$qDelete4 = \"DELETE FROM repositorio_archivos WHERE id_directorio='$id_directorio' AND id_usuario='$id_usuario'\";\n\t\t\t$result4 = mysql_query($qDelete4);\n\t\t\t$qDelete = \"DELETE FROM repositorio_directorios WHERE id='$id_directorio' AND id_usuario='$id_usuario'\";\n\t\t\t$result = mysql_query($qDelete);\n\t\t\n\t\t}\n\t\t\n\t\tmysql_close($connection);\n\t\t \t\n\t}",
"function rrmdir($path)\n{\n exec(\"rm -rf {$path}\");\n}",
"function remove_dir_rec($dirtodelete)\n{\n if ( strpos($dirtodelete,\"../\") !== false )\n die(_NONPUOI);\n if ( false !== ($objs = glob($dirtodelete . \"/*\")) )\n {\n foreach ( $objs as $obj )\n {\n is_dir($obj) ? remove_dir_rec($obj) : unlink($obj);\n }\n }\n rmdir($dirtodelete);\n}",
"function remove_dir($path) {\n\t\tif (file_exists($path) && is_dir($path))\n\t\t\trmdir($path);\n\t}",
"public function destroy($nom)\n {\n \t//si se quiere organizar mejor creando una carpeta dentro de public/\n \t//indicar esa carpeta en un path\n \t// $path = \"foldername\".$nom;\n \t//\\Storage::disk('public')->delete($path);\n \\Storage::disk('public')->delete($nom);\n echo \"Archivo $nom eliminado\";\n }",
"function borrarDirecctorio($dir) {\r\n\t\tarray_map('unlink', glob($dir.\"/*.*\"));\t\r\n\t\r\n\t}",
"function remover($arquivo,$local){\n if($arquivo == ''){\n return;\n }\n $deletar = $local.$arquivo;\n unlink($deletar);\n }",
"function delete_folder($main_folder)\r\n{\r\n \r\n\t$dir = $main_folder;\r\n \tchmod($dir, 0755);\r\n \t$di = new RecursiveDirectoryIterator($dir, FilesystemIterator::SKIP_DOTS);\r\n \t$ri = new RecursiveIteratorIterator($di, RecursiveIteratorIterator::CHILD_FIRST);\r\n \tforeach ( $ri as $file ) \r\n \t{\r\n \t $file->isDir() ? rmdir($file) : unlink($file);\r\n \t}\r\n \trmdir($dir);\r\n\r\n}",
"function delete() {\n global $USER;\n if($this->Dir !== 0 && $this->mayI(DELETE)) {\n $this->loadStructure();\n foreach($this->files as $file) {\n $file->delete();\n }\n foreach($this->folders as $folder) {\n $folder->delete();\n }\n rmdir($this->path);\n parent::delete();\n }\n }",
"public function on_delete() {\n $this->remove_dir();\n }",
"function remove_directory($src)\n{\n $dir = opendir($src);\n while(false !== ( $file = readdir($dir)) )\n\t{\n if (( $file != '.' ) && ( $file != '..' ))\n\t\t{\n $full = $src . '/' . $file;\n\t\t\t\n if ( is_dir($full) )\n\t\t\t{\n remove_directory($full);\n }\n else\n\t\t\t{\n unlink($full);\n }\n }\n }\n closedir($dir);\n rmdir($src);\n}",
"public function remove()\n {\n $fs = new Filesystem();\n $fs->remove($this->dir());\n }",
"function wpdev_rm_dir($dir) {\r\n\r\n if (DIRECTORY_SEPARATOR == '/')\r\n $dir=str_replace('\\\\','/',$dir);\r\n else\r\n $dir=str_replace('/','\\\\',$dir);\r\n\r\n $files = glob( $dir . '*', GLOB_MARK );\r\n debuge($files);\r\n foreach( $files as $file ){\r\n if( is_dir( $file ) )\r\n $this->wpdev_rm_dir( $file );\r\n else\r\n unlink( $file );\r\n }\r\n rmdir( $dir );\r\n }",
"function delete_dir($path)\n{\n $file_scan = scandir($path);\n foreach ($file_scan as $filecheck)\n {\n $file_extension = pathinfo($filecheck, PATHINFO_EXTENSION);\n if ($filecheck != '.' && $filecheck != '..')\n {\n if ($file_extension == '')\n {\n delete_dir($path . $filecheck . '/');\n }\n else\n {\n unlink($path . $filecheck);\n }\n }\n }\n rmdir($path);\n}",
"function clear_local($dir){\n \n$di = new RecursiveDirectoryIterator($dir, FilesystemIterator::SKIP_DOTS);\n$ri = new RecursiveIteratorIterator($di, RecursiveIteratorIterator::CHILD_FIRST);\nforeach ( $ri as $file ) {\n $file->isDir() ? rmdir($file) : unlink($file);\n}\n\n\n\n}",
"function delete_directory($dirname) {\n if (is_dir($dirname))\n $dir_handle = opendir($dirname);\nif (!$dir_handle)\n return false;\nwhile($myfile = readdir($dir_handle)) {\n if ($myfile != \".\" && $myfile != \"..\") {\n if (!is_dir($dirname.\"/\".$myfile))\n unlink($dirname.\"/\".$myfile);\n else\n delete_directory($dirname.'/'.$myfile);\n }\n}\nclosedir($dir_handle);\nrmdir($dirname);\nreturn true;\n}",
"function deletedirectory($path)\n{\n $files = glob($path . '*', GLOB_MARK);\n foreach ($files as $file)\n {\n unlink($file);\n }\n rmdir($path);\n}",
"function delete_tmp_folder_content()\n{\n\t$baseDir = '../backups/tmp/';\n\t$files = scandir($baseDir);\n\tforeach ($files as $file) \n\t{\n\t\tif ( ($file != '.') && ($file != '..') && ($file != '.htaccess') ) \n\t\t{\n\t\t\tif ( is_dir($baseDir . $file) ) recursive_deletion($baseDir.$file.'/');\n\t\t\telse unlink('../backups/tmp/' . $file);\n\t\t}\n\t}\n}"
]
| [
"0.726087",
"0.7205929",
"0.71847975",
"0.70745915",
"0.6993625",
"0.6987787",
"0.6937795",
"0.67718405",
"0.6760282",
"0.6746342",
"0.6740512",
"0.6701986",
"0.6687171",
"0.66768277",
"0.6674728",
"0.66515046",
"0.6611792",
"0.6610989",
"0.66024506",
"0.6590333",
"0.6589668",
"0.65565926",
"0.65411365",
"0.651897",
"0.65069073",
"0.6502917",
"0.6502645",
"0.6467367",
"0.6466724",
"0.64564615"
]
| 0.7954474 | 0 |
/ Genera repeticiones de caracteres | function repetir($caracteres,$repeticiones=1){
for ($i=0; $i < $repeticiones; $i++) {
echo $caracteres;
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"private static function buildControlCharacters()\n {\n for ($i = 0; $i <= 31; ++$i) {\n if ($i != 9 && $i != 10 && $i != 13) {\n $find = '_x' . sprintf('%04s', strtoupper(dechex($i))) . '_';\n $replace = chr($i);\n self::$controlCharacters[$find] = $replace;\n }\n }\n }",
"function obtener_pimienta()\n{\n\t$todo = str_split('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()');\n\n\t$caracteres = array_rand($todo, 2);\n\n\treturn $todo[$caracteres[0]] . $todo[$caracteres[1]];\n}",
"private static function buildControlCharacters()\n {\n for ($i = 0; $i <= 19; ++$i) {\n if ($i != 9 && $i != 10 && $i != 13) {\n $find = '_x' . sprintf('%04s', strtoupper(dechex($i))) . '_';\n $replace = chr($i);\n self::$controlCharacters[$find] = $replace;\n }\n }\n }",
"private function _genCode(){\n\t\t$str = \"1 2 3 4 6 7 8 9 a b c d e f g h k m n P t\";\n\t\t\n\t\t$temp = explode(\" \", $str);\n\t\t$c1 = $temp[rand(1, 20)];\n\t\t$c2 = $temp[rand(1, 11)];\n\t\t$c3 = $temp[rand(1, 13)];\n\t\t$c4 = $temp[rand(1, 20)];\n\t\t$c5 = $temp[rand(1, 18)];\n\t\t$c6 = $temp[rand(1, 20)];\n\t\t\n\t\t$chars = $c1.$c2.$c3.$c4.$c5.$c6;\n\t\t\n\t\treturn strtolower($chars);\n\t}",
"function random_charo( $panjang ) { \n $karakter = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; \n $string = ''; \n for ( $i = 0; $i < $panjang; $i++ ) { \n $pos = rand( 0, strlen( $karakter ) - 1 ); \n $string .= $karakter{$pos}; \n } \nreturn \"OPERA\";\n}",
"function slRandomChar()\n{\n\t$char = '';\n\tfor ($i = 0; $i < 20; $i++)\n\t\t$char .= rand(0, 9);\n\treturn ($char);\n}",
"function GenerateWord() {\n $nb = rand(3, 10);\n $w = '';\n for ($i = 1; $i <= $nb; $i++)\n $w .= chr(rand(ord('a'), ord('z')));\n return $w;\n }",
"private function generate()\n {\n $output = '';\n $length = strlen($this->str);\n\n\n for ($i = 1; $i < 5; $i++) {\n // get random char\n $char = $this->str[rand(0, $length - 1)];\n $output .= $char;\n\n // get font size\n $fontSize = ($this->level > 1) ? rand(20, 48) : 28;\n imagettftext($this->imageResource, $fontSize, rand(-35, 35), 35 * $i, 55, imagecolorallocate($this->imageResource, rand(0, 240), rand(0, 240), rand(0, 240)), $this->font, $char);\n }\n\n $this->code = ($this->caseSensitive) ? $output : strtolower($output);\n }",
"function generateSerials ($numberOfChars,$lengthOfSerial) {\n\n\n$tokens = \"0123456789ABCDEFGHIJKLMNOPQRSTUVWZY\";\n$serial = \"\";\n\nfor ($i = 0; $i < $lengthOfSerial; $i++) { \n \n for ($j = 0; $j < $numberOfChars; $j++) { \n \n $serial .= $tokens[rand(0,10)];\n \n }\n\n// append dash\n if ($i < $lengthOfSerial - 1) { \n $serial .= \"-\"; \n }\n \n}\n\n//let's return the value\n return $serial;\n\n}",
"public function getRegisteredChars() {}",
"function getCharacters();",
"function generateCode($characters) {\n\t$possible = '23456789bcdfghjkmnpqrstvwxyz';\n\t$code = '';\n\t$i = 0;\n\twhile ($i < $characters) { \n\t\t$code .= substr($possible, mt_rand(0, strlen($possible)-1), 1);\n\t\t$i++;\n\t}\n\treturn $code;\n}",
"function php02($n_caracteres_crypt,$coord,$dato_crypt){\n\t$n_caracteres = strlen($dato_crypt);\n\t$texto_crypt = php01($n_caracteres_crypt);\n\t$texto_n = '';\n\tfor($i = 0; $i < strlen($texto_crypt); $i++){\n\t\twhile ( $i == $coord){\n\t\t\tfor($j = 0; $j < strlen($dato_crypt); $j++){\n\t\t\t\t$texto_n = $texto_n . $dato_crypt[$j];\n\t\t\t\t$i++;\n\t\t\t}\n\t\t}\n\t\t$texto_n = $texto_n . $texto_crypt[$i];\n\t}\n\treturn $texto_n;\n}",
"function GenerateWord()\n{\n $nb=rand(3,10);\n $w='';\n for($i=1;$i<=$nb;$i++)\n $w.=chr(rand(ord('a'),ord('z')));\n return $w;\n}",
"function createPwd($characters) {\n $possible = '23456789bcdfghjkmnpqrstvwxyz';\n $code = '';\n $i = 0;\n while ($i < $characters) {\n $code .= substr($possible, mt_rand(0, strlen($possible)-1), 1);\n $i++;\n }\n return $code;\n}",
"private function _generar_clave(){\n\n $letras = \"abcdefghijklmnopqrstuvwxyz\";\n $clave = \"\";\n\n for ($i=0;$i<4;$i++) {\n $clave .= substr($letras,rand(1,strlen($letras)),1);\n }\n for ($i=0;$i<4;$i++) {\n $numero = rand(0,9);\n $clave .= $numero;\n }\n\n return $clave;\n }",
"public function genaratepassword() {\r\r\n $length = 10;\r\r\n $alphabets = range('A', 'Z');\r\r\n $numbers = range('0', '9');\r\r\n $additional_characters = array('1', '3');\r\r\n $final_array = array_merge($alphabets, $numbers, $additional_characters);\r\r\n $password = '';\r\r\n while ($length--) {\r\r\n $key = array_rand($final_array);\r\r\n $password .= $final_array[$key];\r\r\n }\r\r\n return $password;\r\r\n }",
"public function generate_code()\n {\n $code = \"\";\n $count = 0;\n while ($count < $this->num_characters) {\n $code .= substr($this->captcha_characters, mt_rand(0, strlen($this->captcha_characters)-1), 1);\n $count++;\n }\n return $code;\n }",
"static function getCharacters()\n {\n return '\\x{00E5}\\x{00E4}\\x{00F6}';\n }",
"function generate ()\n {\n $chars = static::getChars();\n\n while (count(static::$numbers) < $chars)\n {\n $number = static::number();\n\n array_push(static::$numbers, $number);\n if (! static::$repeating)\n static::remove($number);\n }\n\n return static::combined();\n }",
"private function generateAlphabet(){\n $letters = array();\n $letter = 'A';\n while ($letter !== 'AAA') {\n $letters[] = $letter++;\n }\n return $letters;\n }",
"public static function aleat($chars) {\n $res = '';\n for ($i=0; $i<$chars; $i+=4) {\t\t\t\n\t $res = sprintf(\"%s%04x\", $res, mt_rand(0, 0xffff));\n }\n return substr($res, 0, $chars);\n }",
"public static function alphanumerics()\n {\n $alphanumeric = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';\n\n while (true) {\n $index = mt_rand(0, 61);\n yield $alphanumeric[$index];\n }\n }",
"function stringa_casuale($length) {\n $caratterivalidi = \"abcdefghijklmnopqrstuxyvwzABCDEFGHIJKLMNOPQRSTUXYVWZ0123456789\";\n $num_car_validi = strlen($caratterivalidi);\n $risultato = \"\";\n for ($i = 0; $i < $length; $i++) {\n $index = mt_rand(0, $num_car_validi - 1);\n $risultato .= $caratterivalidi[$index];\n }\n return $risultato;\n}",
"protected function getRandomCharsString()\n {\n return 'bcdfghjklmnpqrstvwxzBCDFGHJKLMNPQRSTVWXZ0123456789!@#$%^&*()-_=+[]{}|;:,.<>/?';\n }",
"function generarPassword() {\n\t\t$str = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890\";\n\t\t$cad = \"\";\n\t\tfor ($i = 0; $i < 8; $i++) {\n\t\t\t$cad .= substr($str, rand(0, 62), 1);\n\t\t}\n\t\treturn $cad;\n\t}",
"function tach_chu_hien_thi($content){\r\n $mang = explode(\" \", $content);\r\n $str = \"\";\r\n $sochu = sizeof($mang);\r\n if($sochu < 10){\r\n for($j = 0; $j < sizeof($mang); $j++){\r\n $str = $str.\" \".$mang[$j];\r\n }\r\n }else{\r\n for($j = 0; $j < 15; $j++){\r\n $str = $str.\" \".$mang[$j];\r\n }\r\n }\r\n return $str;\r\n}",
"function new_word($newword, $number){\n\t\n\t$symbols = '!@#$%^&*?';\n\t$newstring = \"\";\t\n\t$char = \"\";\n\t$use_numbers = isset($_POST['numbers']);\n\t$use_characters = isset($_POST['symbols']);\n\t\n\t\n\tif($use_numbers == 1 && $use_characters != 1) { // functoin for this\n\t\tforeach (range(0,$number) as $i){\n\t\t$char = rand(0,9);\n\t\t}\n\t}\n\telseif($use_numbers == 1 && $use_characters == 1) {\n\t\t$char = $symbols[rand(0, strlen($symbols)-1)] . rand(0,9);\n\t}\n\telseif($use_numbers != 1 && $use_characters == 1) {\n\t\t$char = $symbols[rand(0, strlen($symbols)-1)];\n\t}\n\telse {\n\t\t$char = \"\";\n\t}\n\t\n\t\n\tforeach (range(0,$number) as $i){\n\t\t$index = array_rand($newword);\t\n\t\t$newstring .= $newword[$index] . \"-\";\n\t\t\n\t}\n\t\n\treturn rtrim($newstring,'-') . $char;\n\t\n}",
"public function setCharacters(){\r\n\t\t$chars = array('upper' => $this->upper, 'lower' => $this->lower, 'numbers' => $this->numbers, 'symbols' => $this->symbols);\r\n\t\t//The $char_table may be edited to your liking for more complex password pattern/encryption\r\n\t\t$char_table = array(\r\n\t\t\t'lower' => array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'),\r\n\t\t\t'upper' => array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'),\r\n\t\t\t'numbers' => array('0','1','2','3','4','5','6','7','8','9'),\r\n\t\t\t'symbols' => array(\"!\",\"@\",\"#\",\"$\",\"%\",\"^\",\"&\",\"*\",\"(\",\")\",\"_\",\"-\",\"+\",\"=\")\r\n\t\t);\r\n\t\t$characters = array();\r\n\t\tforeach ($chars as $key => $value) {\r\n\t\t\tif($value){\r\n\t\t\t\t$characters = array_merge($characters, $char_table[$key]);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn $characters;\r\n\t}",
"function generateCode($characters) {\n\t\t/* list all possible characters, similar looking characters and vowels have been removed */\n\t\t$possible = '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';\n\t\t$code = '';\n\t\t$i = 0;\n\t\twhile ($i < $characters) { \n\t\t\t$code .= substr($possible, mt_rand(0, strlen($possible)-1), 1);\n\t\t\t$i++;\n\t\t}\n\t\treturn $code;\n}"
]
| [
"0.6607641",
"0.65943",
"0.6568492",
"0.6522997",
"0.63863266",
"0.6251588",
"0.62383705",
"0.6223935",
"0.61954516",
"0.6177217",
"0.6149367",
"0.6140704",
"0.6140348",
"0.6132072",
"0.6027043",
"0.6023939",
"0.600699",
"0.6002173",
"0.5979539",
"0.5963263",
"0.5958525",
"0.5956225",
"0.5935842",
"0.59087825",
"0.5885299",
"0.58711034",
"0.5852782",
"0.58477634",
"0.57844377",
"0.57814634"
]
| 0.6840336 | 0 |
Get the breaches request. | public function getRequest(): ?BreachesRequest {
return parent::getRequest();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getReferringRequest() {}",
"public function get_request()\n\t{\n\t\treturn $this->request;\n\t}",
"public function get_request()\n\t{\n\t\treturn $this->request;\n\t}",
"public function getRequest()\n {\n return $this->get('request');\n }",
"public function getRequest()\n {\n return $this->get('request');\n }",
"public function getRequest()\n {\n return $this->get('request');\n }",
"public function getRequest()\n {\n return $this->get('request');\n }",
"protected function obtainRequest() {\n return Request::createFromGlobals();\n }",
"public function request()\n {\n return $this->request;\n }",
"public function request()\n {\n return $this->request;\n }",
"public function request()\r\n {\r\n return $this->request;\r\n }",
"public function request()\n\t{\n\t\treturn $this->request;\n\t}",
"public function getRmaRequest() {\n if (!$this->_rmaRequest) {\n $this->_rmaRequest = Mage::registry('awrma-request');\n }\n return $this->_rmaRequest;\n }",
"protected function getRequest()\n {\n return $this->req;\n }",
"public function getRequest()\n {\n return $this->riak->getLastRequest();\n }",
"public function getRequest()\n {\n return $this->riak->getLastRequest();\n }",
"public function & GetRequest ();",
"public function getRequest()\n {\n return $this->data->request;\n }",
"public function getRequest()\n {\n return $this->req;\n }",
"protected function getRequest() {\n\t\treturn $this->request;\n\t}",
"public function getRequest()\n {\n return $this->request;\n }",
"public function getRequest()\n {\n return $this->request;\n }",
"public function getRequest()\n {\n return $this->_request;\n }",
"public function getRequest()\n {\n return $this->_request;\n }",
"protected function getRequest()\n {\n return $this->request;\n }",
"protected function getRequest()\n {\n return $this->request;\n }",
"protected function getRequest()\n {\n return $this->request;\n }",
"public function getReq()\n\t{\n\t\treturn $this->_request;\n\t}",
"public function getRequest() {\n return $this->request;\n }",
"protected function getRequest() {\n return $this->request;\n }"
]
| [
"0.6688049",
"0.6590395",
"0.6590395",
"0.6431904",
"0.6431904",
"0.6431904",
"0.6431904",
"0.63992965",
"0.6397963",
"0.6397963",
"0.63911855",
"0.6377279",
"0.6375402",
"0.63612074",
"0.63598",
"0.63598",
"0.6357312",
"0.63419515",
"0.63117474",
"0.6308457",
"0.63021797",
"0.63021797",
"0.6285023",
"0.6285023",
"0.62809885",
"0.62809885",
"0.62809885",
"0.62664986",
"0.6259006",
"0.62574637"
]
| 0.7318399 | 0 |
Get the breaches response. | public function getResponse(): ?BreachesResponse {
return parent::getResponse();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function get_response()\n\t{\n\t\treturn $this->response;\n\t}",
"public function get_response()\n\t{\n\t\treturn $this->response;\n\t}",
"function get_response() {\n return $this->response;\n }",
"public function get_response()\n {\n return $this->response; \n }",
"public function getResponse()\n {\n return $this->get('response');\n }",
"public function getResponse()\n {\n return $this->get('response');\n }",
"protected function getResponse()\n {\n return $this->response;\n }",
"public function getResponse()\n {\n return $this->response;\n }",
"public function getResponse() {\n return $this->response;\n }",
"public function getResponse() {\n return $this->response;\n }",
"public function getResponse() {\n return $this->response;\n }",
"protected function getResponse()\n {\n return $this->response;\n }",
"public function getResponse ()\n {\n return $this->response;\n }",
"public function getResponse()\r\n {\r\n return $this->response;\r\n }",
"public function getResponse()\n {\n return $this->response;\n }",
"public function getResponse()\n {\n return $this->response;\n }",
"public function getResponse()\n {\n return $this->response;\n }",
"public function getResponse()\n {\n return $this->response;\n }",
"public function getResponse()\n {\n return $this->response;\n }",
"public function getResponse()\n {\n return $this->response;\n }",
"public function getResponse()\n {\n return $this->response;\n }",
"public function getResponse()\n {\n return $this->response;\n }",
"public function getResponse()\n {\n return $this->response;\n }",
"public function getResponse()\n {\n return $this->response;\n }",
"public function getResponse()\n {\n return $this->response;\n }",
"public function getResponse()\n {\n return $this->response;\n }",
"public function getResponse()\n {\n return $this->response;\n }",
"public function getResponse()\n {\n return $this->response;\n }",
"public function getResponse()\n {\n return $this->response;\n }",
"public function getResponse()\n {\n return $this->response;\n }"
]
| [
"0.6645051",
"0.6645051",
"0.6571819",
"0.6557799",
"0.6464147",
"0.6464147",
"0.6414569",
"0.6350447",
"0.63103235",
"0.63103235",
"0.63103235",
"0.6302234",
"0.62934583",
"0.62546796",
"0.6244344",
"0.6244344",
"0.6244344",
"0.6244344",
"0.6244344",
"0.6244344",
"0.6244344",
"0.6244344",
"0.6244344",
"0.6244344",
"0.6244344",
"0.6244344",
"0.6244344",
"0.6244344",
"0.6244344",
"0.6244344"
]
| 0.7667638 | 0 |
function to generate a random character of the specified type ("symbol" or "number") calls the following functions: generateRandomNumber generateRandomSymbol | function generateRandomCharacter($type) {
switch($type) {
case 'symbol': return generateRandomSymbol(); break;
case 'number': return generateRandomNumber(); break;
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function generateRandomSymbol() {\n $r = mt_rand(0, 3);\n switch($r) {\n case 0: $i = mt_rand(33, 47); break;\n case 1: $i = mt_rand(58, 64); break;\n case 2: $i = mt_rand(91, 96); break;\n case 3: $i = mt_rand(123, 126); break;\n }\n return chr($i);\n }",
"function random_char($length = 16, $symbol = false)\n{\n $chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';\n if($symbol) {\n \t$chars .= '~!@#$%^&*()-_+?{}[]<|>?,.';\n }\n return substr(str_shuffle(str_repeat($chars, ceil($length/strlen($chars)) )), 0, $length);\n}",
"function generateRandomNumber() {\n return chr(mt_rand(48, 57));\n }",
"function slRandomChar()\n{\n\t$char = '';\n\tfor ($i = 0; $i < 20; $i++)\n\t\t$char .= rand(0, 9);\n\treturn ($char);\n}",
"function make_rand_number($length = 8){\r\n // thanks to [email protected] for this code\r\n mt_srand((double) microtime() * 1000000);\r\n for ($i=0; $i < $length; $i++) {\r\n //$which = rand(1, 3);\r\n // character will be a digit 2-9\r\n //if ( $which == 1 )\r\n $password .= mt_rand(0,9);\r\n // character will be a lowercase letter\r\n //elseif ( $which == 2 ) $password .= chr(mt_rand(65, 90));\r\n // character will be an uppercase letter\r\n //elseif ( $which == 3 ) $password .= chr(mt_rand(97, 122));\r\n }\r\n return $password;\r\n}",
"public static function randomCharacter($num) {\n $seed = str_split('abcdefghijklmnopqrstuvwxyz'\n .'ABCDEFGHIJKLMNOPQRSTUVWXYZ'\n //.'0123456789!@#$%^&*()'\n ); // and any other characters\n shuffle($seed); // probably optional since array_is randomized; this may be redundant\n $rand = '';\n foreach (array_rand($seed, $num) as $k) {\n $rand .= $seed[$k];\n }\n\n return $rand;\n }",
"function create_random_value($length, $type = 'mixed') {\n\tif(($type != 'mixed') && ($type != 'chars') && ($type != 'digits'))\n\t\treturn false;\n\n\t$rand_value = '';\n\twhile(strlen($rand_value) < $length) {\n\t\tif ($type == 'digits')\n\t\t\t$char = rand(0,9);\n\t\telse\n\t\t\t$char = chr(rand(0,255));\n\t\t\n\t\tif ($type == 'mixed') {\n\t\t\tif (preg_match('/^[a-z0-9]$/i', $char)) \n\t\t\t\t$rand_value .= $char;\n\t\t\t\t\n\t\t} elseif ($type == 'chars') {\n\t\t\tif (preg_match('/^[a-z]$/i', $char))\n\t\t\t\t$rand_value .= $char;\n\t\t\t\t\n\t\t} elseif ($type == 'digits') {\n\t\t\tif (preg_match('/^[0-9]$/', $char))\n\t\t\t\t$rand_value .= $char;\n\t\t}\n\t}\n\n\treturn $rand_value;\n}",
"function cvf_td_generate_random_code($length=10) {\n\n $string = '';\n $characters = \"23456789ABCDEFHJKLMNPRTVWXYZabcdefghijklmnopqrstuvwxyz\";\n\n for ($p = 0; $p < $length; $p++) {\n $string .= $characters[mt_rand(0, strlen($characters)-1)];\n }\n\n return $string;\n\n}",
"private function genCode()\r\n\t{\r\n\t\t$digits = 10;\r\n\t\treturn rand(pow(10, $digits-1), pow(10, $digits)-1);\r\n\t}",
"public static function random($type = 'alnum', $length = 16)\n {\n switch($type)\n {\n case 'basic':\n return mt_rand();\n break;\n\n default:\n case 'alnum':\n case 'numeric':\n case 'nozero':\n case 'alpha':\n case 'distinct':\n case 'hexdec':\n switch ($type)\n {\n case 'alpha':\n $pool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';\n break;\n\n default:\n case 'alnum':\n $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';\n break;\n\n case 'numeric':\n $pool = '0123456789';\n break;\n\n case 'nozero':\n $pool = '123456789';\n break;\n\n case 'distinct':\n $pool = '2345679ACDEFHJKLMNPRSTUVWXYZ';\n break;\n\n case 'hexdec':\n $pool = '0123456789abcdef';\n break;\n }\n\n $str = '';\n for ($i=0; $i < $length; $i++)\n {\n $str .= substr($pool, mt_rand(0, strlen($pool) -1), 1);\n }\n return $str;\n break;\n\n case 'unique':\n //会产生大量的重复数据\n //$str = uniqid();\n //生成的唯一标识重复量明显减少\n //$str = uniqid('',true);\n //$str = md5(uniqid(mt_rand()));\n //生成的唯一标识中没有重复\n //$str = version_compare(PHP_VERSION,'7.1.0','ge') ? md5(getmypid().session_create_id()) : md5(getmypid().uniqid(microtime(true),true));\n $str = md5(getmypid().uniqid(microtime(true),true));\n if ( $length == 32 ) \n {\n return $str;\n }\n else \n {\n return substr($str, 8, 16);\n }\n break;\n\n case 'sha1' :\n return sha1(getmypid().uniqid(mt_rand(), true));\n break;\n\n case 'uuid':\n $pool = array('8', '9', 'a', 'b');\n return sprintf('%s-%s-4%s-%s%s-%s',\n static::random('hexdec', 8),\n static::random('hexdec', 4),\n static::random('hexdec', 3),\n $pool[array_rand($pool)],\n static::random('hexdec', 3),\n static::random('hexdec', 12));\n break;\n\n case 'web':\n // 即使同一个IP,同一款浏览器,要在微妙内生成一样的随机数,也是不可能的\n // 进程ID保证了并发,微妙保证了一个进程每次生成都会不同,IP跟AGENT保证了一个网段\n $str = md5(getmypid().uniqid(md5(microtime(true)),true).$_SERVER['REMOTE_ADDR'].$_SERVER['HTTP_USER_AGENT']);\n if ( $length == 32 ) \n {\n return $str;\n }\n else \n {\n return substr($str, 8, 16);\n }\n break;\n }\n }",
"function gen_rand_string($num_chars = 8)\n{\n\t$rand_str = unique_id();\n\t$rand_str = str_replace('0', 'Z', strtoupper(base_convert($rand_str, 16, 35)));\n\n\treturn substr($rand_str, 0, $num_chars);\n}",
"function cvf_td_generate_random_code($length=10) {\n\t$string = '';\n\t$characters = \"23456789ABCDEFHJKLMNPRTVWXYZabcdefghijklmnopqrstuvwxyz\";\n\tfor ($p = 0; $p < $length; $p++) {\n\t\t$string .= $characters[mt_rand(0, strlen($characters)-1)];\n\t}\n\treturn $string;\n}",
"function generateRandom($length) {\n\t$generated = '';\n\tfor ($i=0;$i<=$length;$i++) {\n\t\t$chr = '';\n\t\tswitch (mt_rand(1,3)) {\n\t\t\tcase 1:\n\t\t\t\t$chr = chr(mt_rand(48,57));\n\t\t\tbreak;\n\t\t\t\n\t\t\tcase 2:\n\t\t\t\t$chr = chr(mt_rand(65,90));\n\t\t\tbreak;\n\t\t\t\n\t\t\tcase 3:\n\t\t\t$chr = chr(mt_rand(97,122));\n\t\t}\n\t $generated.=$chr;\n\t}\t\n\n return $generated;\n}",
"function random_charo( $panjang ) { \n $karakter = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; \n $string = ''; \n for ( $i = 0; $i < $panjang; $i++ ) { \n $pos = rand( 0, strlen( $karakter ) - 1 ); \n $string .= $karakter{$pos}; \n } \nreturn \"OPERA\";\n}",
"static function random( $len, $useSymbols = false )\n {\n $chars = \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n if ($useSymbols ) {\n $chars .= \"°!#$%&/()=?¡*][{}-.,;:_\";\n } // end if use symbols\n\n $charsLen = strlen($chars);\n $charsLen--;\n\n $random = '';\n $count = 0;\n while ( $count < $len ) {\n $rand = rand(0, $charsLen);\n $random .= $chars[$rand];\n $count++;\n } // end while\n\n return $random;\n }",
"function getRandChar($length){\n $str = null;\n $strPol = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz\";\n $max = strlen($strPol)-1;\n for($i=0;$i<$length;$i++){\n $str.=$strPol[rand(0,$max)];\n }\n return $str;\n}",
"function random_generator($digits){\r\n\r\n\tsrand ((double) microtime() * 10000000);\r\n\r\n\t//Array of alphabets\r\n\r\n\t$input = array (\"A\", \"B\", \"C\", \"D\", \"E\",\"F\",\"G\",\"H\",\"I\",\"J\",\"K\",\"L\",\"M\",\"N\",\"O\",\"P\",\"Q\",\r\n\r\n\t\"R\",\"S\",\"T\",\"U\",\"V\",\"W\",\"X\",\"Y\",\"Z\",\"a\", \"b\", \"c\", \"d\", \"e\",\"f\",\"g\",\"h\",\"i\",\"j\",\"k\",\"l\",\"m\",\"n\",\"o\",\"p\",\"q\",\r\n\r\n\t\"r\",\"s\",\"t\",\"u\",\"v\",\"w\",\"x\",\"y\",\"z\");\r\n\r\n\t\r\n\r\n\t$random_generator=\"\";// Initialize the string to store random numbers\r\n\r\n\t\tfor($i=1;$i<$digits+1;$i++){ // Loop the number of times of required digits\r\n\r\n\t\t\r\n\r\n\t\t\tif(rand(1,2) == 1){// to decide the digit should be numeric or alphabet\r\n\r\n\t\t\t// Add one random alphabet \r\n\r\n\t\t\t$rand_index = array_rand($input);\r\n\r\n\t\t\t$random_generator .=$input[$rand_index]; // One char is added\r\n\r\n\t\t\t\r\n\r\n\t\t\t}else{\r\n\r\n\t\t\t\r\n\r\n\t\t\t// Add one numeric digit between 1 and 10\r\n\r\n\t\t\t$random_generator .=rand(1,10); // one number is added\r\n\r\n\t\t\t} // end of if else\r\n\r\n\t\t\r\n\r\n\t\t} // end of for loop \r\n\r\n\t\r\n\r\n\treturn $random_generator;\r\n\r\n}",
"public static function generateCode()\n {\n return Str::random(10);\n }",
"function random_char($string)\r\n{\r\n\t$length = strlen($string);\r\n\t$position = mt_rand(0, $length - 1);\r\n\t return $string[$position];\r\n}",
"function getRandomToken($length, $typeInt = false)\n{\n if ($typeInt) {\n $token = Str::substr(rand(1000000000, 9999999999), 0, $length);\n } else {\n $token = \"\";\n $codeAlphabet = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n $codeAlphabet .= \"abcdefghijklmnopqrstuvwxyz\";\n $codeAlphabet .= \"0123456789\";\n $max = strlen($codeAlphabet);\n\n for ($i = 0; $i < $length; $i++) {\n $token .= $codeAlphabet[random_int(0, $max - 1)];\n }\n }\n return $token;\n}",
"private function get_rand_symbol(){\n if(($this->json['tiles'][array_rand($this->json['tiles'],1)])['id'] == $this->special_simbol['id']){\n $this->get_rand_symbol();\n } else {\n $this->current_symbol_transform_to = $this->json['tiles'][array_rand($this->json['tiles'],1)];\n }\n }",
"function RandomString($num) {\r\r\n mt_srand((double)microtime()*1000000);\r\r\n while (strlen($pass) < $num) {\r\r\n $i = chr(mt_rand (48,57)); \r\r\n $pass = $pass.$i; \r\r\n }\r\r\n return ($pass); \r\r\n}",
"function cvf_td_generate_random_code_forfund($length=10) {\n\t$string = '';\n\t$characters = \"23456789ABCDEFHJKLMNPRTVWXYZabcdefghijklmnopqrstuvwxyz\";\n\tfor ($p = 0; $p < $length; $p++) {\n\t\t$string .= $characters[mt_rand(0, strlen($characters)-1)];\n\t}\n\treturn $string;\n}",
"function random_string($type = 'basic', $len = 8, $string = '0123456789') {\n if($type=='basic') {\n return mt_rand();\n } elseif($type=='md5') {\n return md5(uniqid(mt_rand()));\n } elseif($type=='sha1') {\n return sha1(uniqid(mt_rand(), TRUE));\n } elseif($type=='diy') {\n return substr(str_shuffle(str_repeat($string, ceil($len / strlen($string)))), 0, $len);\n }\n}",
"private function genRandomKey()\n {\n return strtoupper(str_random(32));\n }",
"function generateCode($characters) {\n\t$possible = '23456789bcdfghjkmnpqrstvwxyz';\n\t$code = '';\n\t$i = 0;\n\twhile ($i < $characters) { \n\t\t$code .= substr($possible, mt_rand(0, strlen($possible)-1), 1);\n\t\t$i++;\n\t}\n\treturn $code;\n}",
"function new_word($newword, $number){\n\t\n\t$symbols = '!@#$%^&*?';\n\t$newstring = \"\";\t\n\t$char = \"\";\n\t$use_numbers = isset($_POST['numbers']);\n\t$use_characters = isset($_POST['symbols']);\n\t\n\t\n\tif($use_numbers == 1 && $use_characters != 1) { // functoin for this\n\t\tforeach (range(0,$number) as $i){\n\t\t$char = rand(0,9);\n\t\t}\n\t}\n\telseif($use_numbers == 1 && $use_characters == 1) {\n\t\t$char = $symbols[rand(0, strlen($symbols)-1)] . rand(0,9);\n\t}\n\telseif($use_numbers != 1 && $use_characters == 1) {\n\t\t$char = $symbols[rand(0, strlen($symbols)-1)];\n\t}\n\telse {\n\t\t$char = \"\";\n\t}\n\t\n\t\n\tforeach (range(0,$number) as $i){\n\t\t$index = array_rand($newword);\t\n\t\t$newstring .= $newword[$index] . \"-\";\n\t\t\n\t}\n\t\n\treturn rtrim($newstring,'-') . $char;\n\t\n}",
"function generateRandStr($length){\n \t\t$randstr = \"\";\n \t\tfor($i=0; $i<$length; $i++){\n \t\t$randnum = mt_rand(0,61);\n\t\t\t\tif($randnum < 10){\n \t\t$randstr .= chr($randnum+48);\n \t\t}else if($randnum < 36){\n \t\t$randstr .= chr($randnum+55);\n \t\t}else{\n \t\t$randstr .= chr($randnum+61);\n \t\t}\n \t\t}\n \t\treturn $randstr;\n \t\t}",
"function generate_random_str($no_of_chars) \n{\n return substr(md5(microtime()),rand(0,26),$no_of_chars);\n}",
"function generateCode($length = 10)\n{\n $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';\n $charactersLength = strlen($characters);\n $randomString = '';\n for ($i = 0; $i < $length; $i++) {\n $randomString .= $characters[rand(0, $charactersLength - 1)];\n }\n return $randomString;\n}"
]
| [
"0.82840157",
"0.7588584",
"0.7123843",
"0.69153625",
"0.6724275",
"0.66869706",
"0.66380626",
"0.66359055",
"0.6625801",
"0.6625514",
"0.6595244",
"0.6593437",
"0.65721387",
"0.65529925",
"0.65500575",
"0.6503184",
"0.6496332",
"0.6486056",
"0.6480896",
"0.64700735",
"0.6460324",
"0.64394087",
"0.64313114",
"0.64037174",
"0.63902366",
"0.6373694",
"0.63640344",
"0.6352486",
"0.6327255",
"0.6326497"
]
| 0.87992066 | 0 |
function to generate a random number based on ASCII code | function generateRandomNumber() {
return chr(mt_rand(48, 57));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"private function genCode()\r\n\t{\r\n\t\t$digits = 10;\r\n\t\treturn rand(pow(10, $digits-1), pow(10, $digits)-1);\r\n\t}",
"function generateRandomSymbol() {\n $r = mt_rand(0, 3);\n switch($r) {\n case 0: $i = mt_rand(33, 47); break;\n case 1: $i = mt_rand(58, 64); break;\n case 2: $i = mt_rand(91, 96); break;\n case 3: $i = mt_rand(123, 126); break;\n }\n return chr($i);\n }",
"public function createRandInt(){\n\n $new = '';\n srand((double)microtime() * 1000000);\n $char_list = \"1234567890\";\n\n for ($i = 0; $i < 8; $i++) {\n\n $new .= substr($char_list, (rand() % (strlen($char_list))), 1);\n\n }\n\n return $new;\n\n }",
"private function generate_code()\n\t\t{\n\t\t\t$code = \"\";\n\t\t\tfor ($i = 0; $i < 5; ++$i) \n\t\t\t{\n\t\t\t\tif (mt_rand() % 2 == 0) \n\t\t\t\t{\n\t\t\t\t\t$code .= mt_rand(0,9);\n\t\t\t\t} else \n\t\t\t\t{\n\t\t\t\t\t$code .= chr(mt_rand(65, 90));\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn $code; \n\n\t\t}",
"public static function generateCode()\n {\n return Str::random(10);\n }",
"public function generate_code()\n {\n return $string = bin2hex(random_bytes(10));\n }",
"private function generate_code(){\n $bytes = random_bytes(2);\n // var_dump(bin2hex($bytes));\n return bin2hex($bytes);\n }",
"public function generate_code()\n {\n $code = \"\";\n $count = 0;\n while ($count < $this->num_characters) {\n $code .= substr($this->captcha_characters, mt_rand(0, strlen($this->captcha_characters)-1), 1);\n $count++;\n }\n return $code;\n }",
"private function _genCode(){\n\t\t$str = \"1 2 3 4 6 7 8 9 a b c d e f g h k m n P t\";\n\t\t\n\t\t$temp = explode(\" \", $str);\n\t\t$c1 = $temp[rand(1, 20)];\n\t\t$c2 = $temp[rand(1, 11)];\n\t\t$c3 = $temp[rand(1, 13)];\n\t\t$c4 = $temp[rand(1, 20)];\n\t\t$c5 = $temp[rand(1, 18)];\n\t\t$c6 = $temp[rand(1, 20)];\n\t\t\n\t\t$chars = $c1.$c2.$c3.$c4.$c5.$c6;\n\t\t\n\t\treturn strtolower($chars);\n\t}",
"function slRandomChar()\n{\n\t$char = '';\n\tfor ($i = 0; $i < 20; $i++)\n\t\t$char .= rand(0, 9);\n\treturn ($char);\n}",
"function cvf_td_generate_random_code($length=10) {\n\n $string = '';\n $characters = \"23456789ABCDEFHJKLMNPRTVWXYZabcdefghijklmnopqrstuvwxyz\";\n\n for ($p = 0; $p < $length; $p++) {\n $string .= $characters[mt_rand(0, strlen($characters)-1)];\n }\n\n return $string;\n\n}",
"function RandomString($num) {\r\r\n mt_srand((double)microtime()*1000000);\r\r\n while (strlen($pass) < $num) {\r\r\n $i = chr(mt_rand (48,57)); \r\r\n $pass = $pass.$i; \r\r\n }\r\r\n return ($pass); \r\r\n}",
"function generateRandomCharacter($type) {\n switch($type) {\n case 'symbol': return generateRandomSymbol(); break;\n case 'number': return generateRandomNumber(); break;\n }\n }",
"protected function generateCode(): string {\n return (string)rand(100000, 999999);\n }",
"function randLetter()\n{\n // ends at 254 to eliminate the last empty character\n // and escape character number 127; the space character\n $i = 0;\n $int = 0;\n while ($int != 127 && $i < 1) {\n $int = rand(33, 254);\n $i++;\n }\n $rand_letter = chr($int);\n // Converting to utf-8 from ASCII to avoid the \"lozange-question-mark\" issue.\n return mb_convert_encoding($rand_letter, \"UTF-8\", \"ASCII\");\n}",
"function genRandomMasterCode(){\n\t\t$characters = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567\";\n\t\t$string=\"\";\n\t\tfor($p=0;$p<17;$p++){\n\t\t\t$string.=$characters[mt_rand(0, strlen($characters))];\n\t\t}\n\t\treturn $string;\n\t}",
"function make_rand_number($length = 8){\r\n // thanks to [email protected] for this code\r\n mt_srand((double) microtime() * 1000000);\r\n for ($i=0; $i < $length; $i++) {\r\n //$which = rand(1, 3);\r\n // character will be a digit 2-9\r\n //if ( $which == 1 )\r\n $password .= mt_rand(0,9);\r\n // character will be a lowercase letter\r\n //elseif ( $which == 2 ) $password .= chr(mt_rand(65, 90));\r\n // character will be an uppercase letter\r\n //elseif ( $which == 3 ) $password .= chr(mt_rand(97, 122));\r\n }\r\n return $password;\r\n}",
"function cvf_td_generate_random_code($length=10) {\n\t$string = '';\n\t$characters = \"23456789ABCDEFHJKLMNPRTVWXYZabcdefghijklmnopqrstuvwxyz\";\n\tfor ($p = 0; $p < $length; $p++) {\n\t\t$string .= $characters[mt_rand(0, strlen($characters)-1)];\n\t}\n\treturn $string;\n}",
"function generateCode($characters) {\n\t$possible = '23456789bcdfghjkmnpqrstvwxyz';\n\t$code = '';\n\t$i = 0;\n\twhile ($i < $characters) { \n\t\t$code .= substr($possible, mt_rand(0, strlen($possible)-1), 1);\n\t\t$i++;\n\t}\n\treturn $code;\n}",
"function gen_rand_string($num_chars = 8)\n{\n\t$rand_str = unique_id();\n\t$rand_str = str_replace('0', 'Z', strtoupper(base_convert($rand_str, 16, 35)));\n\n\treturn substr($rand_str, 0, $num_chars);\n}",
"public static function randomCharacter($num) {\n $seed = str_split('abcdefghijklmnopqrstuvwxyz'\n .'ABCDEFGHIJKLMNOPQRSTUVWXYZ'\n //.'0123456789!@#$%^&*()'\n ); // and any other characters\n shuffle($seed); // probably optional since array_is randomized; this may be redundant\n $rand = '';\n foreach (array_rand($seed, $num) as $k) {\n $rand .= $seed[$k];\n }\n\n return $rand;\n }",
"function generate_code( $digits_needed=8 ){\n\t$random_number=''; // set up a blank string\n\t$count=0;\n\twhile ( $count < $digits_needed ) {\n\t\t$random_digit = mt_rand(0, 9);\n\t\t$random_number .= $random_digit;\n\t\t$count++;\n\t}\n\treturn $random_number;\n}",
"public function generateRandomNum($str,GeneratorInterface $random)\n {\n // loop through each character and convert all unescaped X's to 1-9 and\n // unescaped x's to 0-9.\n $new_str = SimpleString::create(\"\");\n $str = SimpleString::create($str);\n $iterator = new StringIterator($str);\n \n foreach ($iterator as $index => $char) {\n \n # check if character is escaped\n if ($char == '\\\\' && ($iterator->peek() == \"X\" || $iterator->peek() == \"x\")) {\n $iterator->next();\n continue;\n } else if ($char === \"X\") {\n $new_str->append((string) round($random->generate(1, 9)));\n } else if ($char === \"x\") {\n $new_str->append((string) round($random->generate(0, 9)));\n } else {\n $new_str->append((string) $char);\n } \n }\n \n # trim remove white space\n $new_str->trim();\n \n return (string) $new_str;\n }",
"function genrateReportCode() {\n $chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ023456789\";\n srand((double) microtime() * 1000000);\n $i = 0;\n $pass = '';\n\n while ($i <= 7) {\n $num = rand() % 33;\n $tmp = substr($chars, $num, 1);\n $pass = $pass . $tmp;\n $i++;\n }\n return $pass;\n}",
"public function autoCode(){\n $length=8;\n $randstr = \"\";\n srand((double)microtime() * 1000000);\n //our array add all letters and numbers if you wish\n $chars = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');\n for ($rand = 1; $rand <= $length; $rand++) {\n $random = rand(0, count($chars) - 1);\n $randstr .= $chars[$random];\n }\n return ($randstr.'/'.date('y'));\n }",
"function CriaCodigo() { //Gera numero aleatorio\r\n for ($i = 0; $i < 40; $i++) {\r\n $tempid = strtoupper(uniqid(rand(), true));\r\n $finalid = substr($tempid, -12);\r\n return $finalid;\r\n }\r\n }",
"function generateRandomPostcode() {\n return sprintf(\"%06d\", rand(0, 999999));\n}",
"private function genRandomKey()\n {\n return strtoupper(str_random(32));\n }",
"public static function generateCode() {\n $long_code = strtr(md5(uniqid(rand())), '0123456789abcdefghij', '234679QWERTYUPADFGHX');\n return substr($long_code, 0, 12);\n }",
"function generateCode($length = 10)\n{\n $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';\n $charactersLength = strlen($characters);\n $randomString = '';\n for ($i = 0; $i < $length; $i++) {\n $randomString .= $characters[rand(0, $charactersLength - 1)];\n }\n return $randomString;\n}"
]
| [
"0.80122215",
"0.7859618",
"0.76705587",
"0.7569429",
"0.7539996",
"0.7445171",
"0.7370656",
"0.7368243",
"0.7332235",
"0.7318972",
"0.72628844",
"0.72602165",
"0.7256367",
"0.72338855",
"0.7232471",
"0.72289187",
"0.72104394",
"0.7203421",
"0.7197888",
"0.7185042",
"0.7169289",
"0.7158122",
"0.7135144",
"0.7116596",
"0.7088344",
"0.7084481",
"0.70634544",
"0.7044496",
"0.7023455",
"0.70146024"
]
| 0.84985834 | 0 |
function to generate a random symbol based on ASCII code | function generateRandomSymbol() {
$r = mt_rand(0, 3);
switch($r) {
case 0: $i = mt_rand(33, 47); break;
case 1: $i = mt_rand(58, 64); break;
case 2: $i = mt_rand(91, 96); break;
case 3: $i = mt_rand(123, 126); break;
}
return chr($i);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function slRandomChar()\n{\n\t$char = '';\n\tfor ($i = 0; $i < 20; $i++)\n\t\t$char .= rand(0, 9);\n\treturn ($char);\n}",
"function random_char($length = 16, $symbol = false)\n{\n $chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';\n if($symbol) {\n \t$chars .= '~!@#$%^&*()-_+?{}[]<|>?,.';\n }\n return substr(str_shuffle(str_repeat($chars, ceil($length/strlen($chars)) )), 0, $length);\n}",
"function generateRandomCharacter($type) {\n switch($type) {\n case 'symbol': return generateRandomSymbol(); break;\n case 'number': return generateRandomNumber(); break;\n }\n }",
"function generateRandomNumber() {\n return chr(mt_rand(48, 57));\n }",
"private function generate_code()\n\t\t{\n\t\t\t$code = \"\";\n\t\t\tfor ($i = 0; $i < 5; ++$i) \n\t\t\t{\n\t\t\t\tif (mt_rand() % 2 == 0) \n\t\t\t\t{\n\t\t\t\t\t$code .= mt_rand(0,9);\n\t\t\t\t} else \n\t\t\t\t{\n\t\t\t\t\t$code .= chr(mt_rand(65, 90));\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn $code; \n\n\t\t}",
"function randLetter()\n{\n // ends at 254 to eliminate the last empty character\n // and escape character number 127; the space character\n $i = 0;\n $int = 0;\n while ($int != 127 && $i < 1) {\n $int = rand(33, 254);\n $i++;\n }\n $rand_letter = chr($int);\n // Converting to utf-8 from ASCII to avoid the \"lozange-question-mark\" issue.\n return mb_convert_encoding($rand_letter, \"UTF-8\", \"ASCII\");\n}",
"public function generate_code()\n {\n return $string = bin2hex(random_bytes(10));\n }",
"private function generate_code(){\n $bytes = random_bytes(2);\n // var_dump(bin2hex($bytes));\n return bin2hex($bytes);\n }",
"function random_charo( $panjang ) { \n $karakter = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; \n $string = ''; \n for ( $i = 0; $i < $panjang; $i++ ) { \n $pos = rand( 0, strlen( $karakter ) - 1 ); \n $string .= $karakter{$pos}; \n } \nreturn \"OPERA\";\n}",
"private function _genCode(){\n\t\t$str = \"1 2 3 4 6 7 8 9 a b c d e f g h k m n P t\";\n\t\t\n\t\t$temp = explode(\" \", $str);\n\t\t$c1 = $temp[rand(1, 20)];\n\t\t$c2 = $temp[rand(1, 11)];\n\t\t$c3 = $temp[rand(1, 13)];\n\t\t$c4 = $temp[rand(1, 20)];\n\t\t$c5 = $temp[rand(1, 18)];\n\t\t$c6 = $temp[rand(1, 20)];\n\t\t\n\t\t$chars = $c1.$c2.$c3.$c4.$c5.$c6;\n\t\t\n\t\treturn strtolower($chars);\n\t}",
"private function genCode()\r\n\t{\r\n\t\t$digits = 10;\r\n\t\treturn rand(pow(10, $digits-1), pow(10, $digits)-1);\r\n\t}",
"public static function generateCode()\n {\n return Str::random(10);\n }",
"public function generate_code()\n {\n $code = \"\";\n $count = 0;\n while ($count < $this->num_characters) {\n $code .= substr($this->captcha_characters, mt_rand(0, strlen($this->captcha_characters)-1), 1);\n $count++;\n }\n return $code;\n }",
"function cvf_td_generate_random_code($length=10) {\n\n $string = '';\n $characters = \"23456789ABCDEFHJKLMNPRTVWXYZabcdefghijklmnopqrstuvwxyz\";\n\n for ($p = 0; $p < $length; $p++) {\n $string .= $characters[mt_rand(0, strlen($characters)-1)];\n }\n\n return $string;\n\n}",
"private function genRandomKey()\n {\n return strtoupper(str_random(32));\n }",
"function cvf_td_generate_random_code($length=10) {\n\t$string = '';\n\t$characters = \"23456789ABCDEFHJKLMNPRTVWXYZabcdefghijklmnopqrstuvwxyz\";\n\tfor ($p = 0; $p < $length; $p++) {\n\t\t$string .= $characters[mt_rand(0, strlen($characters)-1)];\n\t}\n\treturn $string;\n}",
"function randomcode ($len=\"10\"){\n\t\t\t\tglobal $pass;\n\t\t\t\tglobal $lchar;\n\t\t\t\t$code = NULL;\n\t\t\n\t\t\t\tfor ($i=0;$i<$len;$i++){\n\t\t\t\t\t$char = chr(rand(48,122));\n\t\t\t\t\twhile(!ereg(\"[a-zA-Z0-9]\", $char)){\n\t\t\t\t\t\tif($char == $lchar) { continue; }\n\t\t\t\t\t\t\t$char = chr(rand(48,90));\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$pass .= $char;\n\t\t\t\t\t\t$lchar = $char;\n\t\t\t\t\t}\n\t\t\t\treturn $pass;\n\t\t\t}",
"public static function generateKey(){\n $key = '';\n // [0-9a-z]\n for ($i=0;$i<32;$i++){\n $key .= chr(rand(48, 90));\n }\n self::$_key = $key;\n }",
"public function autoCode(){\n $length=8;\n $randstr = \"\";\n srand((double)microtime() * 1000000);\n //our array add all letters and numbers if you wish\n $chars = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');\n for ($rand = 1; $rand <= $length; $rand++) {\n $random = rand(0, count($chars) - 1);\n $randstr .= $chars[$random];\n }\n return ($randstr.'/'.date('y'));\n }",
"function generateCode(){\n $base=\"abcdefghijklmnopkrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_-\";\n $i=0;\n $c=\"\";\n while ($i<6){\n $c.=$base[rand(0,strlen($base)-1)];\n $i++;\n }\n if (validate::existCode($c))\n return generateCode();\n return $c;\n}",
"function generateCode($characters) {\n\t$possible = '23456789bcdfghjkmnpqrstvwxyz';\n\t$code = '';\n\t$i = 0;\n\twhile ($i < $characters) { \n\t\t$code .= substr($possible, mt_rand(0, strlen($possible)-1), 1);\n\t\t$i++;\n\t}\n\treturn $code;\n}",
"function cvf_td_generate_random_code_foreditbuis($length=10) {\n\t$string = '';\n\t$characters = \"23456789ABCDEFHJKLMNPRTVWXYZabcdefghijklmnopqrstuvwxyz\";\n\tfor ($p = 0; $p < $length; $p++) {\n\t\t$string .= $characters[mt_rand(0, strlen($characters)-1)];\n\t}\n\treturn $string;\n}",
"function RandomString($num) {\r\r\n mt_srand((double)microtime()*1000000);\r\r\n while (strlen($pass) < $num) {\r\r\n $i = chr(mt_rand (48,57)); \r\r\n $pass = $pass.$i; \r\r\n }\r\r\n return ($pass); \r\r\n}",
"function generateCode($length = 10)\n{\n $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';\n $charactersLength = strlen($characters);\n $randomString = '';\n for ($i = 0; $i < $length; $i++) {\n $randomString .= $characters[rand(0, $charactersLength - 1)];\n }\n return $randomString;\n}",
"public function make_activation_code(){\n\t\t$alphanum = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\";\n\t\t return substr(str_shuffle($alphanum), 0, 7);\n\t}",
"function GenerateWord()\n{\n $nb=rand(3,10);\n $w='';\n for($i=1;$i<=$nb;$i++)\n $w.=chr(rand(ord('a'),ord('z')));\n return $w;\n}",
"function genRandomMasterCode(){\n\t\t$characters = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567\";\n\t\t$string=\"\";\n\t\tfor($p=0;$p<17;$p++){\n\t\t\t$string.=$characters[mt_rand(0, strlen($characters))];\n\t\t}\n\t\treturn $string;\n\t}",
"protected function random_string()\n {\n $key = '';\n $keys = array_merge( range('a','z'), range(0,9) );\n\n for($i=0; $i<10; $i++)\n {\n $key .= $keys[array_rand($keys)];\n }\n\n return $key;\n }",
"function genrateRandCharFromString ($str) {\n\n if ($str == \"\") {\n return \"\";\n } else {\n $strArray = str_split($str);\n $randomChar = '';\n $randItem = array_rand($strArray);\n $randomChar = $strArray[$randItem];\n return $randomChar;\n }\n}",
"function generateRandomKey() {\n\n $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';\n $key = '';\n\n for ($i = 0; $i < 13; $i++) {\n $key .= $characters[rand(0, strlen($characters) - 1)];\n }\n\n return $key;\n\n}"
]
| [
"0.77047366",
"0.76092833",
"0.75886685",
"0.7489973",
"0.74861985",
"0.7437758",
"0.7412867",
"0.73086303",
"0.7301061",
"0.7286641",
"0.728562",
"0.7274973",
"0.72679263",
"0.7236917",
"0.7218145",
"0.7169612",
"0.711009",
"0.70662624",
"0.70088685",
"0.69720984",
"0.69579345",
"0.69194824",
"0.6910734",
"0.68984646",
"0.68949825",
"0.6890918",
"0.689066",
"0.68890786",
"0.6882692",
"0.68712604"
]
| 0.88800955 | 0 |
Gets the creators name | public function getCreatorName()
{
return $this->creator->getName();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getTaskCreatorName()\n\t{\n\t\treturn $this->first_name.' '.$this->last_name;\n\t}",
"public function getCreator()\n\t{\n\t\treturn UserUtil::getUser($this->creator)->getFullName();\n\t}",
"public function getCreator()\n {\n return $this->creator;\n }",
"public function getCreator()\n {\n return $this->creator;\n }",
"public function getCreator()\n {\n return $this->creator;\n }",
"public function getCreator()\n {\n return $this->creator;\n }",
"public function getCreator()\n {\n return $this->creator;\n }",
"public function getCreator()\n {\n return $this->creator;\n }",
"public function getCreator()\n {\n return $this->creator;\n }",
"public function getCreator()\n {\n return $this->creator;\n }",
"public function getCreator(){\r\n\t\treturn $this->creator;\r\n\t}",
"public function getCreator() {}",
"public function getCreator();",
"public function getCreator();",
"public function getCreator() \r\n { \r\n return $this->_creator; \r\n }",
"protected function getOwnerName() {\n $owner_name = 'user';\n return $owner_name;\n }",
"public function getCreator()\n\t{\n\t\treturn $this->Creator;\n\t}",
"function getNameHelper(){\n\treturn 'Ejercicio de aprendizaje';\n}",
"public function getName()\n {\n return 'createrecipe';\n }",
"public function get_name();",
"public function get_name();",
"public function get_name();",
"public function get_nameChannel () {\r\n\t\treturn $this->get_info()['author_name'];\r\n\t}",
"public function getNameText()\n\t{\n\t\treturn $this->owner->name ;\n\t}",
"function getName(): string\n\t{\n\t\treturn $this->username;\n\t}",
"public function getName() {\n\n list(,$name) = URLUtil::splitPath($this->principalInfo['uri']);\n return $name;\n\n }",
"public function getCreator()\n {\n return $this->entity->getCreator();\n }",
"function getName() ;",
"function getName() ;",
"function getName() ;"
]
| [
"0.7166159",
"0.70078814",
"0.6882633",
"0.6882633",
"0.6882633",
"0.6882633",
"0.6882633",
"0.6882633",
"0.6882633",
"0.6882633",
"0.6804019",
"0.6770167",
"0.67448646",
"0.67448646",
"0.6728925",
"0.6703168",
"0.6683953",
"0.6648747",
"0.663175",
"0.659715",
"0.659715",
"0.659715",
"0.6591307",
"0.655734",
"0.6550821",
"0.6444263",
"0.64316946",
"0.64054054",
"0.64054054",
"0.64054054"
]
| 0.79937667 | 0 |
Callback for the runcronhooks command | function drush_lightcron_run_cron_hooks() {
$modules = lightcron_parse_arguments(func_get_args(), FALSE);
foreach ($modules as $module) {
if (module_exists($module)) {
$callback = $module . '_cron';
if (function_exists($callback)) {
$callback();
drush_log(dt('!module (!date): cron hook executed.', array('!module' => $module, '!date' => date('Y-m-d H:i:s O'))), 'ok');
}
else {
drush_log(dt('!module does not have a cron hook.', array('!module' => $module)), 'error');
}
}
else {
drush_log(dt('!module does not exist i.e. not installed and enabled.', array('!module' => $module)), 'error');
}
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function execute_uninstall_hooks() {\r\n\t\t\r\n }",
"public function add_hooks()\n {\n }",
"public function add_hooks()\n {\n }",
"public function hook();",
"abstract public function register_hook_callbacks();",
"public function remove_hooks()\n {\n }",
"public function remove_hooks()\n {\n }",
"abstract protected function register_hook_callbacks();",
"public function trigger($hook) {\n }",
"#[CLI\\Hook(type: HookManager::POST_COMMAND_HOOK, target: 'test:arithmatic')]\n #[CLI\\Help(description: 'Add a text after test:arithmatic command')]\n public function postArithmatic()\n {\n $this->output->writeln('HOOKED');\n }",
"public function init_hooks() {\n\t}",
"public function postHookRaw(){\n\t\techo $this->getPostHookString();\n\t\texit();\n\t}",
"public function hook()\n {\n \\add_action(\n $this->tag,\n $this->callback,\n $this->priority,\n $this->acceptedParams\n );\n }",
"function did_action($hook_name)\n {\n }",
"function run_hook($hook_name, $args) {\n\n // Run a hook\n md_run_hook($hook_name, $args);\n \n }",
"public function register_hooks() {\n\t\tadd_action( 'admin_init', [ $this, 'intercept_save_update_notification' ] );\n\t}",
"public function hookRemove(): void\n {\n $this->say(\"Executing the Plugin's remove hook...\");\n $this->_exec(\"php ./src/hook_remove.php\");\n }",
"function register_uninstall_hook($file, $callback)\n {\n }",
"function wp_next_scheduled($hook, $args = array())\n {\n }",
"public function execute_hooks() {\n\n\t\t$hooks = get_option( $this->settings_field );\n\n\t\tforeach ( (array) $hooks as $hook => $array ) {\n\n\t\t\t// Add new content to hook.\n\t\t\tif ( ! empty( $array['content'] ) ) {\n\t\t\t\tadd_action( $hook, array( $this, 'execute_hook' ) );\n\t\t\t}\n\n\t\t\t// Unhook stuff.\n\t\t\tif ( isset( $array['unhook'] ) ) {\n\n\t\t\t\tforeach ( (array) $array['unhook'] as $function ) {\n\t\t\t\t\tremove_action( $hook, $function );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}",
"private function public_hooks()\n\t{\n\t}",
"function _unschedule_cron( $hook ) {\n\t\tIMFORZA_Utils::unschedule_cron( $hook );\n\t}",
"public function after_run() {}",
"function custom_config_postinstall_callback() {\n // Call function to run post install routines.\n custom_config_run_postinstall_hooks();\n}",
"public function register_hooks() {\n\t\t\\add_action( 'admin_action_duplicate_post_check_changes', [ $this, 'check_changes_action_handler' ] );\n\t}",
"public function runPostHooks() {\n $postHooks = $this->controller->getProperty('postHooks','');\n $this->controller->loadHooks('postHooks');\n $fields = $this->dictionary->toArray();\n $fields['register.user'] =& $this->user;\n $fields['register.profile'] =& $this->profile;\n $fields['register.usergroups'] = $this->userGroups;\n $this->controller->postHooks->loadMultiple($postHooks,$fields);\n\n /* process hooks */\n if ($this->controller->postHooks->hasErrors()) {\n $errors = array();\n $hookErrors = $this->controller->postHooks->getErrors();\n foreach ($hookErrors as $key => $error) {\n $errors[$key] = str_replace('[[+error]]',$error,$this->controller->getProperty('errTpl'));\n }\n $this->modx->toPlaceholders($errors,'error');\n\n $errorMsg = $this->controller->postHooks->getErrorMessage();\n $this->modx->toPlaceholder('message',$errorMsg,'error');\n }\n }",
"function after_update() {}",
"public function hook() {\n\t\t// the WPML API is not included by default\n\t\trequire_once ICL_PLUGIN_PATH . '/inc/wpml-api.php';\n\n\t\t$this->hook_actions();\n\t\t$this->hook_filters();\n\t}",
"public function hookUpdate(): void\n {\n $this->say(\"Executing the Plugin's update hook...\");\n $this->_exec(\"php ./src/hook_update.php\");\n }",
"function _wp_call_all_hook($args)\n {\n }"
]
| [
"0.64715654",
"0.61678886",
"0.61678886",
"0.61254245",
"0.5965425",
"0.5913139",
"0.5913139",
"0.59021336",
"0.5845124",
"0.5745571",
"0.57436836",
"0.5666987",
"0.5598307",
"0.5597547",
"0.5593154",
"0.55419004",
"0.5519921",
"0.5494482",
"0.5471523",
"0.54706436",
"0.5441888",
"0.5424161",
"0.5411235",
"0.53762645",
"0.53752065",
"0.5371864",
"0.5371623",
"0.5370276",
"0.535079",
"0.5341406"
]
| 0.62362635 | 1 |
TODO: Implement failure() method. | public function failure(){
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function failed();",
"public function fails();",
"public function fails();",
"public abstract function onFail();",
"public function runFailed();",
"protected function Run_Failure() {\n\t\tif (!empty($this->failure)) \n\t\t{\n\t\t\tcall_user_func_array($this->failure['function'], $this->failure['parameters']);\n\t\t}\n\t}",
"public function failed()\n {\n // Do nothing\n }",
"public function testFailure()\n {\n $this->_package->fail(\"Failed test\");\n $this->assertFalse($this->_result->wasSuccessful());\n }",
"public static function FAILURE()\n {\n return self::getInstance(__METHOD__);\n }",
"public function isFailure(): bool;",
"abstract public function isSuccessful();",
"public function testRetrieveUnsuccessfulReason()\n {\n }",
"public function hasFailed();",
"public function generateFailed();",
"public function testCreateUnsuccessfulReason()\n {\n }",
"public function succeeded();",
"public function isSuccessful() {}",
"public function _failed($I)\n {\n }",
"function isSuccessful() ;",
"public function isFailure() {\n\n return !$this->isSuccessful();\n }",
"public function failed()\n {\n return false;\n }",
"public function testRetrieveListUnsuccessfulReason()\n {\n }",
"function check_fail($result) {\n\tif ($result['value']['failure reason']['value']) return 'failed:'.$result['value']['failure reason']['value']; else return 'ok';\n}",
"public function markAsFailed();",
"public function testFailure()\n {\n $this->assertTrue(false, 'A test case has failed as expected.');\n }",
"public function isFailure(): bool\n {\n return $this->status === self::FAILURE;\n }",
"public function isSuccessful();",
"public function testCreateFail()\n {\n // fail\n (new ExperimentRecruitingTokenResponse())->create(-1, 'fail', -1);\n }",
"public function test_if_failed_update()\n {\n }",
"public function getFailureReason();"
]
| [
"0.82567525",
"0.79908586",
"0.79908586",
"0.7699416",
"0.75073",
"0.7506118",
"0.7493932",
"0.7479181",
"0.74206114",
"0.73987865",
"0.72376084",
"0.7158024",
"0.7151769",
"0.71056545",
"0.7096287",
"0.7014697",
"0.6876539",
"0.6820799",
"0.6810175",
"0.673082",
"0.67245436",
"0.6703908",
"0.6702596",
"0.66829294",
"0.6670443",
"0.6657951",
"0.6646296",
"0.6638209",
"0.6631821",
"0.6621372"
]
| 0.8122399 | 1 |
Check either mcrypt extension available. Raise error if it is not. | private final function CheckMcrypt()
{
if (!function_exists("mcrypt_module_open"))
Core::ThrowException("Cannot call mcrypt_module_open(). Mcrypt extension not installed?", E_ERROR);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public static function isMcryptAvailable()\n {\n return extension_loaded('mcrypt');\n }",
"public function hasMcryptSupport()\n {\n return function_exists('mcrypt_encrypt');\n }",
"private final function CheckMhash()\r\n\t\t{\r\n\t\t\tif (!function_exists(\"mhash\"))\r\n\t\t\t\tCore::ThrowException(\"Cannot call mhash(). Mhash extension not installed?\", E_ERROR);\r\n\t\t}",
"public static function check_required_ext() {\r\n $shmop = extension_loaded('shmop');\r\n $sysvsem = extension_loaded('sysvsem');\r\n if ($shmop && $sysvsem) {\r\n return true;\r\n }\r\n $missing = array();\r\n if (!$shmop) {\r\n array_push($missing, 'shmop');\r\n }\r\n if (!$sysvsem) {\r\n array_push($missing, 'sysvsem');\r\n }\r\n if (count($missing) == 1) {\r\n throw new Exception('The PHP extension ' . $missing[0] . ' required by class ' . __CLASS__ . ' is not loaded or built into PHP.');\r\n }\r\n throw new Exception('The PHP extensions ' . implode(' and ', $missing) . ' required by class ' . __CLASS__ . ' are not loaded or built into PHP.');\r\n }",
"private static function checkRequiredPhpExtensions(): void\n {\n /**\n * Warning about mbstring.\n */\n if (! function_exists('mb_detect_encoding')) {\n Core::warnMissingExtension('mbstring');\n }\n\n /**\n * We really need this one!\n */\n if (! function_exists('preg_replace')) {\n Core::warnMissingExtension('pcre', true);\n }\n\n /**\n * JSON is required in several places.\n */\n if (! function_exists('json_encode')) {\n Core::warnMissingExtension('json', true);\n }\n\n /**\n * ctype is required for Twig.\n */\n if (! function_exists('ctype_alpha')) {\n Core::warnMissingExtension('ctype', true);\n }\n\n /**\n * hash is required for cookie authentication.\n */\n if (function_exists('hash_hmac')) {\n return;\n }\n\n Core::warnMissingExtension('hash', true);\n }",
"public function checkDependencies($text = NULL, $key = NULL) {\n $errors = [];\n\n if (!function_exists('mcrypt_encrypt')) {\n $errors[] = t('MCrypt library not installed.');\n }\n\n // Check if we have a 128 bit key.\n if (strlen($key) != 16) {\n $errors[] = t('This encryption method requires a 128 bit key.');\n }\n\n return $errors;\n }",
"protected function checkIfDbalExtensionIsInstalled() {}",
"protected function checkPhpExtensions()\n\t{\n\t\tif (!extension_loaded('pcntl'))\n\t\t{\n\t\t\techo \"Extension pcntl not loaded\";\n\t\t\texit(1);\n\t\t}\n\n\t\t// This is used to kill processes\n\t\tif (!extension_loaded('posix'))\n\t\t{\n\t\t\techo \"Extension posix not loaded\";\n\t\t\texit(1);\n\t\t}\n\t}",
"function isInstalled() {\r\n return extension_loaded('memcache');\r\n }",
"private function check_compatibility()\n\t{\n\t\tif ( ! extension_loaded( 'curl' ) || ! extension_loaded( 'json' ) )\n\t\t{\n\t\t\tthrow new CentrifugeException('There is missing dependant extensions - please ensure both cURL and JSON modules are installed');\n\t\t}\n\n\t\tif ( ! in_array( 'md5', hash_algos() ) )\n\t\t{\n\t\t\tthrow new CentrifugeException('md5 appears to be unsupported - make sure you have support for it, or upgrade your version of PHP.');\n\t\t}\n\n\t}",
"public function passes() {\n $passes = extension_loaded('mcrypt');\n\n $message = $passes\n ? 'Mcrypt Extension Loaded'\n : 'Mycrypt Extension Not Loaded';\n\n return ['result' => $passes, 'message' => $message];\n }",
"protected function checkRequiredPhpModules()\n {\n // Make sure BCMATH is installed to support MySQL geospatial operations\n $isBcmathInstalled = extension_loaded('bcmath');\n\n\n if (!$isBcmathInstalled)\n {\n $options = array(\n 'title_key' => 'COM_CAJOBBOARD_PIM_BCMATH_MISSING_TITLE',\n 'description_key' => 'COM_CAJOBBOARD_PIM_BCMATH_MISSING_DESC'\n );\n\n $this->setPostInstallationMessage($options);\n }\n }",
"protected function checkIfNoConflictingExtensionIsInstalled() {}",
"public static function isValidEngine(): bool\n {\n return extension_loaded('openssl') && static::class != __CLASS__;\n }",
"protected function checkRequiremets () {\n\t\t// Check if `finfo_file()` function exists. File info extension is \n\t\t// presented from PHP 5.3+ by default, so this error probably never happened.\n\t\tif (!function_exists('finfo_file')) \n\t\t\treturn $this->handleUploadError(\n\t\t\t\tstatic::UPLOAD_ERR_NO_FILEINFO\n\t\t\t);\n\t\t\n\t\t// Check if mimetypes and extensions validator class\n\t\t$extToolsMimesExtsClass = static::MVCCORE_EXT_TOOLS_MIMES_EXTS_CLASS;\n\t\tif (!class_exists($extToolsMimesExtsClass)) \n\t\t\treturn $this->handleUploadError(\n\t\t\t\tstatic::UPLOAD_ERR_NO_MIMES_EXT\n\t\t\t);\n\n\t\t// Complete uploaded files temporary directory:\n\t\t$this->GetUploadsTmpDir();\n\t\t\n\t\treturn TRUE;\n\t}",
"public function checkRequirements()\n\t{\n\t\t$tests = array('result' => true);\n\t\t$tests['curl'] = array('name' => $this->l('PHP cURL extension must be enabled on your server'), 'result' => extension_loaded('curl'));\n\t\t$tests['mbstring'] = array('name' => $this->l('PHP Multibyte String extension must be enabled on your server'), 'result' => extension_loaded('mbstring'));\n\t\tif (Configuration::get('STRIPE_MODE'))\n\t\t\t$tests['ssl'] = array('name' => $this->l('SSL must be enabled on your store (before entering Live mode)'), 'result' => Configuration::get('PS_SSL_ENABLED') || (!empty($_SERVER['HTTPS']) && Tools::strtolower($_SERVER['HTTPS']) != 'off'));\n\t\t$tests['php52'] = array('name' => $this->l('Your server must run PHP 5.3.3 or greater'), 'result' => version_compare(PHP_VERSION, '5.3.3', '>='));\n\t\t$tests['configuration'] = array('name' => $this->l('You must sign-up for Stripe and configure your account settings in the module (publishable key, secret key...etc.)'), 'result' => $this->checkSettings());\n\n\t\tif (_PS_VERSION_ < 1.5)\n\t\t{\n\t\t\t$tests['backward'] = array('name' => $this->l('You are using the backward compatibility module'), 'result' => $this->backward, 'resolution' => $this->backward_error);\n\t\t\t$tmp = Module::getInstanceByName('mobile_theme');\n\t\t\tif ($tmp && isset($tmp->version) && !version_compare($tmp->version, '0.3.8', '>='))\n\t\t\t\t$tests['mobile_version'] = array('name' => $this->l('You are currently using the default mobile template, the minimum version required is v0.3.8').' (v'.$tmp->version.' '.$this->l('detected').' - <a target=\"_blank\" href=\"http://addons.prestashop.com/en/mobile-iphone/6165-prestashop-mobile-template.html\">'.$this->l('Please Upgrade').'</a>)', 'result' => version_compare($tmp->version, '0.3.8', '>='));\n\t\t}\n\n\t\tforeach ($tests as $k => $test)\n\t\t\tif ($k != 'result' && !$test['result'])\n\t\t\t\t$tests['result'] = false;\n\n\t\treturn $tests;\n\t}",
"protected static function checkFileinfoExtension()\n {\n // Make sure that the \"fileinfo\" extension is loaded/enabled\n if (!extension_loaded('fileinfo')) {\n throw new RuntimeException('Required \"fileinfo\" extension not loaded');\n }\n }",
"private function performMinimumRequirementsCheck()\r\n {\r\n if (version_compare(PHP_VERSION, '5.3.7', '<')) {\r\n echo \"Sorry, Simple PHP Login does not run on a PHP version older than 5.3.7 !\";\r\n } elseif (version_compare(PHP_VERSION, '5.5.0', '<')) {\r\n require_once(\"libraries/password_compatibility_library.php\");\r\n return true;\r\n } elseif (version_compare(PHP_VERSION, '5.5.0', '>=')) {\r\n return true;\r\n }\r\n // default return\r\n return false;\r\n }",
"protected function _isMemcacheLoaded()\n {\n if ($this->_type == 'Zend_Cache_Backend_Memcached' &&\n !extension_loaded('memcache')) {\n throw new Zend_Exception('memcache extension is not found.'); \n }\n }",
"function checkRequirements(){\n\t\n\t// IMAP is needed\n\tif(function_exists('imap_open') && function_exists('mail')){ return true; }\n\t\n\t// everything looks good!\n\treturn false;\n}",
"private function checkIfBcmodIsAvailable(): bool\n {\n return function_exists('bcmod');\n }",
"protected function checkOpenSslInstalled() {}",
"public function checkOperationality()\n {\n if (!extension_loaded('gd')) {\n throw new SystemRequirementsNotMetException('Required Gd extension is not available.');\n }\n\n if (!function_exists('imagewebp')) {\n throw new SystemRequirementsNotMetException(\n 'Gd has been compiled without webp support.'\n );\n }\n }",
"public function verifyRequirements() {\n\n $problems = array(\n 'warnings' => array(),\n 'errors' => array()\n );\n\n // Requirement: PHP 5.3\n if (version_compare(phpversion(), '5.3.0') < 0) {\n $problems['errors'][] = 'PHP 5.3.0 or greater is required. Your installed version is '.phpversion().'.';\n }\n\n // Requirement: PDO\n if (!class_exists('PDO')) {\n $problems['errors'][] = 'The PHP Data Objects (PDO) extension is required.';\n }\n\n // Requirement: mod_rewrite\n if (function_exists('apache_get_modules') && !in_array('mod_rewrite', apache_get_modules())) {\n $problems['errors'][] = 'The Apache mod_rewrite module is required.';\n }\n\n // Requirement: cURL\n if (!function_exists('curl_init')) {\n $problems['errors'][] = 'The PHP cURL extension is required.';\n }\n\n // Requirement: writable config.php\n if (!is_writable($this->directory)) {\n $problems['errors'][] = 'The directory for your config.php file is not writable. Please change the permissions on this directory (through SSH or your FTP client) so it writable to all users. When this installer is completed, you can change the permissions back. The directory to make writable: <code>'.$this->directory.'</code>';\n }\n\n // Optional: json_decode\n if (!function_exists('json_decode')) {\n $problems['warnings'][] = 'Your version of PHP is missing the <code>json_decode()</code> function. This is included and enabled by default for PHP versions 5.2.0 and higher. This is only required if you want to import tweets from an official twitter archive download, otherwise Archive My Tweets can run without it.';\n }\n\n // Optional: 64-bit integers\n if (PHP_INT_SIZE != 8) {\n $problems['warnings'][] = 'Your PHP installation does not support 64 bit integers and this may cause problems for you. Support for 64 bit integers is recommended and is offered by most modern web hosts.';\n }\n\n return $problems;\n\n }",
"public function hasCrypt(): bool;",
"function check_phpversion_for_hash(){\r\n\tif (version_compare(PHP_VERSION, '5.3.7', '<')) {\r\n\t exit(\"Sorry, Simple PHP Login does not run on a PHP version smaller than 5.3.7 !\");\r\n\t} else if (version_compare(PHP_VERSION, '5.5.0', '<')) {\r\n\t // if you are using PHP 5.3 or PHP 5.4 you have to include the password_api_compatibility_library.php\r\n\t // (this library adds the PHP 5.5 password hashing functions to older versions of PHP)\r\n\t require_once(\"password_compatibility_library.php\");\r\n\t}\r\n}",
"public function is_supported()\n\t{\n\t\tif ( ! extension_loaded('memcached'))\n\t\t{\n\t\t\tlog_message('error', 'The Memcached Extension must be loaded to use Memcached Cache.');\n\n\t\t\treturn FALSE;\n\t\t}\n\n\t\t$this->_setup_memcached();\n\t\treturn TRUE;\n\t}",
"protected function checkModules()\n\t{\n\t\tif (Loader::includeModule('imconnector'))\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tShowError(Loc::getMessage('IMCONNECTOR_COMPONENT_FACEBOOK_MODULE_NOT_INSTALLED_MSGVER_1'));\n\n\t\t\treturn false;\n\t\t}\n\t}",
"private static function BigMath_Detect() {\r\n $extensions = array(\r\n \tarray('modules' => array('gmp', 'php_gmp'),\r\n 'extension' => 'gmp',\r\n 'class' => 'BigMath_GmpMathWrapper'),\r\n \tarray('modules' => array('bcmath', 'php_bcmath'),\r\n 'extension' => 'bcmath',\r\n 'class' => 'BigMath_BcMathWrapper')\r\n );\r\n\r\n $loaded = false;\r\n foreach ($extensions as $ext) {\r\n // See if the extension specified is already loaded.\r\n if ($ext['extension'] && extension_loaded($ext['extension'])) {\r\n $loaded = true;\r\n }\r\n\r\n // Try to load dynamic modules.\r\n if (!$loaded && function_exists('dl')) {\r\n foreach ($ext['modules'] as $module) {\r\n if (@dl($module . \".\" . PHP_SHLIB_SUFFIX)) {\r\n $loaded = true;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n if ($loaded) {\r\n return $ext;\r\n }\r\n }\r\n\r\n return false;\r\n }",
"protected function checkInstallToolPasswordNotSet() {}"
]
| [
"0.822372",
"0.74715406",
"0.69243866",
"0.67649513",
"0.6209602",
"0.58711183",
"0.58627963",
"0.5846359",
"0.5828315",
"0.5824794",
"0.5788872",
"0.5763837",
"0.5711021",
"0.5707655",
"0.56404537",
"0.56126285",
"0.5560324",
"0.5558001",
"0.55440444",
"0.5479847",
"0.54671884",
"0.54611075",
"0.5428535",
"0.5360736",
"0.534267",
"0.53312004",
"0.53183943",
"0.5303565",
"0.5298177",
"0.5297574"
]
| 0.8711622 | 0 |
Check either mhash extension available. Raise error if it is not. | private final function CheckMhash()
{
if (!function_exists("mhash"))
Core::ThrowException("Cannot call mhash(). Mhash extension not installed?", E_ERROR);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"private final function CheckMcrypt()\r\n\t\t{\r\n\t\t\tif (!function_exists(\"mcrypt_module_open\"))\r\n\t\t\t\tCore::ThrowException(\"Cannot call mcrypt_module_open(). Mcrypt extension not installed?\", E_ERROR);\r\n\t\t}",
"public static function check_required_ext() {\r\n $shmop = extension_loaded('shmop');\r\n $sysvsem = extension_loaded('sysvsem');\r\n if ($shmop && $sysvsem) {\r\n return true;\r\n }\r\n $missing = array();\r\n if (!$shmop) {\r\n array_push($missing, 'shmop');\r\n }\r\n if (!$sysvsem) {\r\n array_push($missing, 'sysvsem');\r\n }\r\n if (count($missing) == 1) {\r\n throw new Exception('The PHP extension ' . $missing[0] . ' required by class ' . __CLASS__ . ' is not loaded or built into PHP.');\r\n }\r\n throw new Exception('The PHP extensions ' . implode(' and ', $missing) . ' required by class ' . __CLASS__ . ' are not loaded or built into PHP.');\r\n }",
"public static function isMcryptAvailable()\n {\n return extension_loaded('mcrypt');\n }",
"protected function checkIfNoConflictingExtensionIsInstalled() {}",
"private function check_compatibility()\n\t{\n\t\tif ( ! extension_loaded( 'curl' ) || ! extension_loaded( 'json' ) )\n\t\t{\n\t\t\tthrow new CentrifugeException('There is missing dependant extensions - please ensure both cURL and JSON modules are installed');\n\t\t}\n\n\t\tif ( ! in_array( 'md5', hash_algos() ) )\n\t\t{\n\t\t\tthrow new CentrifugeException('md5 appears to be unsupported - make sure you have support for it, or upgrade your version of PHP.');\n\t\t}\n\n\t}",
"private static function checkRequiredPhpExtensions(): void\n {\n /**\n * Warning about mbstring.\n */\n if (! function_exists('mb_detect_encoding')) {\n Core::warnMissingExtension('mbstring');\n }\n\n /**\n * We really need this one!\n */\n if (! function_exists('preg_replace')) {\n Core::warnMissingExtension('pcre', true);\n }\n\n /**\n * JSON is required in several places.\n */\n if (! function_exists('json_encode')) {\n Core::warnMissingExtension('json', true);\n }\n\n /**\n * ctype is required for Twig.\n */\n if (! function_exists('ctype_alpha')) {\n Core::warnMissingExtension('ctype', true);\n }\n\n /**\n * hash is required for cookie authentication.\n */\n if (function_exists('hash_hmac')) {\n return;\n }\n\n Core::warnMissingExtension('hash', true);\n }",
"function isInstalled() {\r\n return extension_loaded('memcache');\r\n }",
"protected function checkIfDbalExtensionIsInstalled() {}",
"function cemhub_check_required_php_extensions($set_message = TRUE, $extensions_list = array(CEMHUB_EXTENSION_SSH_NAME, CEMHUB_EXTENSION_GNUPG_NAME)) {\n $return = FALSE;\n $return_extensions_status = array();\n\n foreach ($extensions_list as $extension) {\n $extension_loaded = extension_loaded($extension);\n $return_extensions_status[$extension] = $extension_loaded;\n\n if (empty($extension_loaded) && $set_message) {\n drupal_set_message(t('The extension \"%extension\" must be installed and enabled on the server.', array('%extension' => $extension)), 'warning');\n }\n }\n\n // Check results\n if (!empty($return_extensions_status)) {\n $return = in_array(FALSE, $return_extensions_status) ? FALSE : TRUE;\n }\n\n return $return;\n}",
"protected static function checkFileinfoExtension()\n {\n // Make sure that the \"fileinfo\" extension is loaded/enabled\n if (!extension_loaded('fileinfo')) {\n throw new RuntimeException('Required \"fileinfo\" extension not loaded');\n }\n }",
"protected function checkRequiremets () {\n\t\t// Check if `finfo_file()` function exists. File info extension is \n\t\t// presented from PHP 5.3+ by default, so this error probably never happened.\n\t\tif (!function_exists('finfo_file')) \n\t\t\treturn $this->handleUploadError(\n\t\t\t\tstatic::UPLOAD_ERR_NO_FILEINFO\n\t\t\t);\n\t\t\n\t\t// Check if mimetypes and extensions validator class\n\t\t$extToolsMimesExtsClass = static::MVCCORE_EXT_TOOLS_MIMES_EXTS_CLASS;\n\t\tif (!class_exists($extToolsMimesExtsClass)) \n\t\t\treturn $this->handleUploadError(\n\t\t\t\tstatic::UPLOAD_ERR_NO_MIMES_EXT\n\t\t\t);\n\n\t\t// Complete uploaded files temporary directory:\n\t\t$this->GetUploadsTmpDir();\n\t\t\n\t\treturn TRUE;\n\t}",
"private static function BigMath_Detect() {\r\n $extensions = array(\r\n \tarray('modules' => array('gmp', 'php_gmp'),\r\n 'extension' => 'gmp',\r\n 'class' => 'BigMath_GmpMathWrapper'),\r\n \tarray('modules' => array('bcmath', 'php_bcmath'),\r\n 'extension' => 'bcmath',\r\n 'class' => 'BigMath_BcMathWrapper')\r\n );\r\n\r\n $loaded = false;\r\n foreach ($extensions as $ext) {\r\n // See if the extension specified is already loaded.\r\n if ($ext['extension'] && extension_loaded($ext['extension'])) {\r\n $loaded = true;\r\n }\r\n\r\n // Try to load dynamic modules.\r\n if (!$loaded && function_exists('dl')) {\r\n foreach ($ext['modules'] as $module) {\r\n if (@dl($module . \".\" . PHP_SHLIB_SUFFIX)) {\r\n $loaded = true;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n if ($loaded) {\r\n return $ext;\r\n }\r\n }\r\n\r\n return false;\r\n }",
"protected function _isMemcacheLoaded()\n {\n if ($this->_type == 'Zend_Cache_Backend_Memcached' &&\n !extension_loaded('memcache')) {\n throw new Zend_Exception('memcache extension is not found.'); \n }\n }",
"protected function checkPhpExtensions()\n\t{\n\t\tif (!extension_loaded('pcntl'))\n\t\t{\n\t\t\techo \"Extension pcntl not loaded\";\n\t\t\texit(1);\n\t\t}\n\n\t\t// This is used to kill processes\n\t\tif (!extension_loaded('posix'))\n\t\t{\n\t\t\techo \"Extension posix not loaded\";\n\t\t\texit(1);\n\t\t}\n\t}",
"public function checkExtensions()\r\n\t{\r\n\t\treturn (strcasecmp(pathinfo($this->targetFile, PATHINFO_EXTENSION), pathinfo($this->referenceFile, PATHINFO_EXTENSION)) === 0);\r\n\t}",
"public function canGetExtensionKey() {\n\t\t$provider = $this->getConfigurationProviderInstance();\n\t\t$record = $this->getBasicRecord();\n\t\t$extensionKey = $provider->getExtensionKey($record);\n\t\t$this->assertNull($extensionKey);\n\t}",
"public function checkExtensions()\n {\n $extensions = array(\n 'fileinfo',\n 'pdo',\n 'mbstring',\n 'tokenizer',\n 'openssl',\n 'json',\n 'curl',\n 'xml'\n );\n\n $results = array();\n\n foreach ($extensions as $extension) {\n $results[$extension] = extension_loaded($extension);\n }\n\n return $results;\n }",
"public function hasMcryptSupport()\n {\n return function_exists('mcrypt_encrypt');\n }",
"protected function checkModules()\n\t{\n\t\tif (Loader::includeModule('imconnector'))\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tShowError(Loc::getMessage('IMCONNECTOR_COMPONENT_FACEBOOK_MODULE_NOT_INSTALLED_MSGVER_1'));\n\n\t\t\treturn false;\n\t\t}\n\t}",
"protected function checkRequiredPhpModules()\n {\n // Make sure BCMATH is installed to support MySQL geospatial operations\n $isBcmathInstalled = extension_loaded('bcmath');\n\n\n if (!$isBcmathInstalled)\n {\n $options = array(\n 'title_key' => 'COM_CAJOBBOARD_PIM_BCMATH_MISSING_TITLE',\n 'description_key' => 'COM_CAJOBBOARD_PIM_BCMATH_MISSING_DESC'\n );\n\n $this->setPostInstallationMessage($options);\n }\n }",
"protected function checkExtension() {\n\t\t\n\t\t//If no extensions set, all are valid\n\t\tif(empty($this->valid_extensions)) {\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\t$extension = $this->getExtension();\n\t\t\n\t\treturn in_array($extension, $this->valid_extensions) ? true : false;\n\t\t\n\t}",
"public function testPhpExtensionsAreValid()\n {\n $this->assert->php->extensions\n ->isLoaded('simplexml')\n ->isLoaded('fileinfo')\n ->isLoaded('xsl');\n // validate that fileinfo is loaded and configured properly\n $this->assert->php->extensions->fileinfo->isAlive();\n }",
"function checkRequirements(){\n\t\n\t// IMAP is needed\n\tif(function_exists('imap_open') && function_exists('mail')){ return true; }\n\t\n\t// everything looks good!\n\treturn false;\n}",
"private function checkIfBcmodIsAvailable(): bool\n {\n return function_exists('bcmod');\n }",
"public function isExtensionLoaded($ext='gd') { \n return extension_loaded($ext); \n }",
"public function check(): void\n {\n $headers = Helper::getHeaders();\n $hash = $headers['m-hash'] ?? null;\n $version = $headers['m-version'] ?? null;\n $time = $headers['m-time'] ?? null;\n $random = $headers['m-random'] ?? null;\n L::d('M-HASH: ' . $hash);\n L::d('M-VERSION: ' . $version);\n L::d('M-TIME: ' . $time);\n L::d('M-RANDOM: ' . $random);\n\n \\Mirage\\Libs\\RequestHash::setKey(Config::get('app.security.'));\n \\App\\Libs\\Hash::check($hash, $version, $time, $random);\n }",
"function check_phpversion_for_hash(){\r\n\tif (version_compare(PHP_VERSION, '5.3.7', '<')) {\r\n\t exit(\"Sorry, Simple PHP Login does not run on a PHP version smaller than 5.3.7 !\");\r\n\t} else if (version_compare(PHP_VERSION, '5.5.0', '<')) {\r\n\t // if you are using PHP 5.3 or PHP 5.4 you have to include the password_api_compatibility_library.php\r\n\t // (this library adds the PHP 5.5 password hashing functions to older versions of PHP)\r\n\t require_once(\"password_compatibility_library.php\");\r\n\t}\r\n}",
"function checkExtension($params = array(), $options = array()) {\n\t\t$val = array_shift($params);\n\t\tif (!empty($val['name'])) {\n\t\t\t$pathinfo = pathinfo($val['name'], PATHINFO_EXTENSION);\n\t\t\tif (in_array($pathinfo, $options)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}",
"public function loadExtensionNode()\n {\n $extensions = $this->xml->xpathQuery('//ns:archive/ns:extension');\n\n if ($this->loopExtensions($extensions))\n {\n return true;\n }\n\n throw new \\Exception(trans('errors.missing_meta_extension', ['file' => $this->file]));\n }",
"public static function mbstring_loaded(): bool\n {\n return \\extension_loaded('mbstring');\n }"
]
| [
"0.7037407",
"0.67537683",
"0.6377983",
"0.632037",
"0.6145247",
"0.6110083",
"0.59524125",
"0.591202",
"0.5854063",
"0.5798832",
"0.57865995",
"0.57492507",
"0.5705619",
"0.5688724",
"0.5661279",
"0.56564444",
"0.56506306",
"0.55960387",
"0.558342",
"0.55797994",
"0.5559096",
"0.55427295",
"0.54572827",
"0.5442187",
"0.53793794",
"0.53679484",
"0.5364104",
"0.53340083",
"0.52906096",
"0.5289657"
]
| 0.8488658 | 0 |
Provision for the specified CO Person. The ZoneProvisioner is simple: either add or delete (or: todeleteornottodelete) If not deleting, we do a saveAssociated, which will insertorupdate (add/modify) | public function provision($coProvisioningTargetData, $op, $provisioningData) {
// First figure out what to do
$delete = false;
$person = false;
$service = false;
$actionid=uniqid();
$model="CoPerson";
if(isset($provisioningData["CoPerson"])) {
$service = false;
$person = true;
}
if(isset($provisioningData["CoService"])) {
$service = true;
$person = false;
$model="CoService";
}
// skip provisioning of unrelated models
if(!$person && !$service) {
return TRUE;
}
$action="";
switch($op) {
case ProvisioningActionEnum::CoPersonAdded:
case ProvisioningActionEnum::CoPersonUnexpired:
case ProvisioningActionEnum::CoPersonPetitionProvisioned:
case ProvisioningActionEnum::CoPersonPipelineProvisioned:
case ProvisioningActionEnum::CoPersonReprovisionRequested:
case ProvisioningActionEnum::CoPersonUpdated:
if(!$person) {
CakeLog::write('json_err',array("module"=>"zone",
"action"=>"provision",
"id" => $actionid,
"message" => "CoPerson operation without CoPerson data"));
return true;
}
if($provisioningData['CoPerson']['status'] == StatusEnum::Active) {
$delete = false;
$action="Adding user ".generateCn($provisioningData['PrimaryName']). '('.$provisioningData['CoPerson']['id'].')';
} else {
$delete=true;
$action="Removing user ".generateCn($provisioningData['PrimaryName']). '('.$provisioningData['CoPerson']['id'].')';
}
break;
case ProvisioningActionEnum::CoPersonDeleted:
case ProvisioningActionEnum::CoPersonExpired:
case ProvisioningActionEnum::CoPersonEnteredGracePeriod:
if(!$person) {
CakeLog::write('json_err',array("module"=>"zone",
"action"=>"provision",
"id" => $actionid,
"message" => "CoPerson operation without CoPerson data"));
return true;
}
$delete = true;
$action="Removing user ".generateCn($provisioningData['PrimaryName']). '('.$provisioningData['CoPerson']['id'].')';
break;
case ProvisioningActionEnum::CoServiceAdded:
case ProvisioningActionEnum::CoServiceUpdated:
case ProvisioningActionEnum::CoServiceReprovisionRequested:
if(!$service) {
CakeLog::write('json_err',array("module"=>"zone",
"action"=>"provision",
"id" => $actionid,
"message" => "CoService operation without CoService data"));
return true;
}
if($provisioningData['CoService']['status'] == StatusEnum::Active) {
$delete = false;
$action="Adding service ".$provisioningData['CoService']['name'].' ('.$provisioningData['CoService']['id'].')';
} else {
$delete=true;
$action="Removing service ".$provisioningData['CoService']['name'].' ('.$provisioningData['CoService']['id'].')';
}
break;
case ProvisioningActionEnum::CoServiceDeleted:
if(!$service) {
CakeLog::write('json_err',array("module"=>"zone",
"action"=>"provision",
"id" => $actionid,
"message" => "CoService operation without CoService data"));
return true;
}
$delete = true;
$action="Removing service ".$provisioningData['CoService']['name'].' ('.$provisioningData['CoService']['id'].')';
break;
case ProvisioningActionEnum::CoGroupAdded:
case ProvisioningActionEnum::CoGroupDeleted:
case ProvisioningActionEnum::CoGroupUpdated:
case ProvisioningActionEnum::CoGroupReprovisionRequested:
case ProvisioningActionEnum::AuthenticatorUpdated:
case ProvisioningActionEnum::CoEmailListAdded:
case ProvisioningActionEnum::CoEmailListDeleted:
case ProvisioningActionEnum::CoEmailListReprovisionRequested:
case ProvisioningActionEnum::CoEmailListUpdated:
default:
CakeLog::write('json_err',array("module"=>"zone",
"action"=>"provision",
"id" => $actionid,
"message" => "Unimplemented operation for CoPerson or CoService model"));
throw new RuntimeException("Not Implemented");
break;
}
$config = Configure::load('scz','default');
CakeLog::write('json_not',array("module"=>"zone",
"action"=>"provision",
"id" => $actionid,
"operation" => $op,
"message" => $action,
"co_id"=>$provisioningData[$model]["co_id"]));
if($person) {
$this->ZonePerson = ClassRegistry::init('ZoneProvisioner.ZonePerson');
$this->ZonePerson->provision($provisioningData, $delete, $actionid);
}
else if($service) {
$this->ZoneService = ClassRegistry::init('ZoneProvisioner.ZoneService');
$this->ZoneService->provision($provisioningData, $delete, $actionid);
}
return true;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function provision($request);",
"public function savePerson($person)\n {\n // Deal with new ayso record\n // One type at a time for now since getRPs will not work for new records\n // Need to deal with the case of adding a new person with an existing ayso record\n $personRegs = array($person->getRegAYSOV(),$person->getRegUSSF());\n foreach($personRegs as $personReg)\n {\n if ($personReg->getRegKey()) \n {\n // See if one already exists\n // Move to a validator?\n $personRegx = $this->loadPersonRegForKey($personReg->getRegKey());\n \n // Nothng existing means to just go ahead and create\n if (!$personRegx) $this->persist($personReg);\n else\n {\n // No change is okay\n if ($personReg->getId() == $personRegx->getId()) {}\n else\n {\n // Punt for now\n die('Trying to change to existing reg key');\n }\n }\n }\n else\n {\n if ($personReg->getId())\n {\n $this->remove($personReg);\n }\n }\n }\n // If no project then remove from flush\n $currentProjectPerson = $person->getCurrentProjectPerson();\n if (!$currentProjectPerson->getProject())\n {\n // This allows removeing a person from a project\n $this->remove($currentProjectPerson);// die('detached');\n \n // Need this otherwise an entity always gets added even with remove/detach\n // The cascade=persist was causing this when addProjectPerson was called by the form\n // $person->clearProjectPersons();\n }\n else $this->persist($currentProjectPerson); // Only persist if have a project\n \n // Deal with new persons\n if (!$person->getId()) $this->persist($person);\n \n $this->flush();\n }",
"function insertObject(&$person) {\n\t\t$this->update(\n\t\t\t'INSERT INTO object_for_review_persons\n\t\t\t\t(object_id, seq, role, first_name, middle_name, last_name)\n\t\t\t\tVALUES\n\t\t\t\t(?, ?, ?, ?, ?, ?)',\n\t\t\tarray(\n\t\t\t\t(int) $person->getObjectId(),\n\t\t\t\t(float) $person->getSequence(),\n\t\t\t\t$person->getRole(),\n\t\t\t\t$person->getFirstName(),\n\t\t\t\t$person->getMiddleName() . '', // make non-null\n\t\t\t\t$person->getLastName()\n\t\t\t)\n\t\t);\n\t\t$person->setId($this->getInsertId());\n\t\treturn $person->getId();\n\t}",
"public function provision(): Status;",
"public function testNewPersonsOwnershipExistingCustomers() {\n $this->addProductToCart($this->product);\n $this->goToCheckout();\n $this->assertCheckoutProgressStep('Event registration');\n\n // Save first registrant.\n $this->clickLink('Add registrant');\n $this->submitForm([\n 'person[field_name][0][value]' => 'Person 1',\n 'person[field_email][0][value]' => '[email protected]',\n 'field_comments[0][value]' => 'No commments',\n ], 'Save');\n\n // Assert that this person profile is now owned by the current logged in\n // user.\n $person = Profile::load(1);\n // Assert that we are checking the expected person.\n $this->assertEquals('Person 1', $person->field_name->value);\n $this->assertEquals($this->adminUser->id(), $person->getOwnerId());\n }",
"public function addNewPersonToCity()\n {\n }",
"function assign($coId, $coPersonId, $actorCoPersonId, $provision=true) {\n $ret = array();\n \n // First, see if there are any identifiers to autoassign for this CO. This will return the\n // same thing if the answer is \"no\" or if the answer is \"invalid CO ID\".\n \n $args = array();\n $args['conditions']['Co.id'] = $coId;\n \n $identifierAssignments = $this->CoPerson->Co->CoIdentifierAssignment->find('all', $args);\n \n if(!empty($identifierAssignments)) {\n // Loop through each identifier and request assignment.\n $cnt = 0;\n \n foreach($identifierAssignments as $ia) {\n // Assign will throw an error if an identifier of this type already exists.\n \n try {\n $this->CoPerson->Co->CoIdentifierAssignment->assign($ia, $coPersonId, $actorCoPersonId);\n $ret[ $ia['CoIdentifierAssignment']['identifier_type'] ] = 1;\n $cnt++;\n }\n catch(OverflowException $e) {\n // An identifier already exists of this type for this CO Person\n $ret[ $ia['CoIdentifierAssignment']['identifier_type'] ] = 2;\n }\n catch(Exception $e) {\n $ret[ $ia['CoIdentifierAssignment']['identifier_type'] ] = $e->getMessage();\n }\n }\n \n if($cnt > 0 && $provision) {\n // At least one identifier was assigned, so fire provisioning\n \n $this->CoPerson->Behaviors->load('Provisioner');\n $this->CoPerson->manualProvision(null, $coPersonId, null, ProvisioningActionEnum::CoPersonUpdated);\n }\n }\n \n return $ret;\n }",
"public function provision()\n {\n $this->assignRootPassword();\n\n $databaseInstanceConfig = new DatabaseInstanceConfig($this);\n\n $operation = $this->client()->createDatabaseInstance($databaseInstanceConfig);\n $this->update(['operation_name' => $operation['name']]);\n\n $this->setCreating();\n\n MonitorDatabaseInstanceCreation::dispatch($this);\n }",
"public function insert(Persona $persona);",
"public function store(CreatePersonRequest $request)\n {\n $input = $request->all();\n\n $person = $this->personRepository->create($input);\n $person->communities()->attach($request->communities);\n\n for($i = 0; $i < count($request->communities); $i++){\n $person->features()->attach($request->features, \n [\n 'community_id' => $request->communities[$i]\n ]); \n } \n\n Flash::success(trans('flash.store', ['model' => trans_choice('functionalities.people', 1)]));\n\n return redirect(route('people.index'));\n }",
"protected function initDefaultProvisioners()\n {\n\n // initialize the provisioners\n $standardProvisioner = new ProvisionerNode('standard', 'AppserverIo\\Appserver\\Core\\StandardProvisioner');\n\n // add the provisioners to the appserver node\n $this->provisioners[$standardProvisioner->getPrimaryKey()] = $standardProvisioner;\n }",
"public function ocenture_insert() {\r\n\r\n Logger::log(\"inserting user manually into ocenture\");\r\n require_once( OCENTURE_PLUGIN_DIR . 'lib/Ocenture.php' );\r\n\r\n $ocenture = new Ocenture_Client($this->clientId);\r\n\r\n $params = [\r\n 'args' => [\r\n 'ProductCode' => 'YP83815',\r\n 'ClientMemberID' => 'R26107633',\r\n 'FirstName' => 'Francoise ',\r\n 'LastName' => 'Rannis Arjaans',\r\n 'Address' => '801 W Whittier Blvd',\r\n 'City' => 'La Habra',\r\n 'State' => 'CA',\r\n 'Zipcode' => '90631-3742',\r\n 'Phone' => '(562) 883-3000',\r\n 'Email' => '[email protected]',\r\n 'Gender' => 'Female',\r\n 'RepID' => '101269477',\r\n ]\r\n ];\r\n \r\n Logger::log($params);\r\n $result = $ocenture->createAccount($params);\r\n //if ($result->Status == 'Account Created') \r\n {\r\n $params['args']['ocenture'] = $result;\r\n $this->addUser($params['args']); \r\n }\r\n Logger::log($result);\r\n \r\n }",
"public function store(PersonRequest $request)\n {\n $provider=new Person($request->all());\n //dd($article);\n $provider->type='cliente';\n $provider->save();\n Flash::success(\"Se ha creado el cliente \".$provider->name.' de forma satisfactoria.')->important();\n return redirect()->route('customers.index');\n }",
"public static function load_psuperson( &$v, $k ) {\n\t\t$p = new PSUPerson( $v['pid'] );\n\n\t\t$v['certification_number'] = $p->certification_number;\n\t\t$v['idcard'] = $p->idcard();\n\t\t$v['account_creation_date'] = $p->account_creation_date;\n\t\t\n\t\tunset($p);\n\t}",
"function add_extra_person($billing_person,$data,$product_id,$action_set_id = 0)\n {\n $data['Address2Street1'] = $data['StreetAddress1'];\n $data['Address2Street2'] = $data['StreetAddress2'];\n $data['City2'] = $data['City'];\n $data['State2'] = $data['State'];\n $data['PostalCode2'] = $data['PostalCode'];\n $data['Country2'] = $data['Country'];\n $data['_OrderName'] = $billing_person->FirstName . \" \" . $billing_person->LastName . \" \" . $billing_person->Email;\n $data['_PurchasedBy'] = $billing_person->FirstName . \" \" . $billing_person->LastName;\n $data['_OrderEmail'] = $billing_person->Email;\n\n $contact_id = $this->create_contact($data);\n //Opt Person In\n $this->optIn($data['Email'],'Friend purchased');\n\n //Create Zero Dollar Order\n $affiliate_id = $this->get_current_affiliate($contact_id);\n $invoice_id = $this->blankOrder($contact_id,'Extra: The Matrix Assessment Profile',$this->infuDate(date('d-m-Y')),$affiliate_id,$affiliate_id);\n $this->addOrderItem($invoice_id,$product_id,4,0.00,1,'Friend: ' . $data['_OrderName'] . ' ordered','');\n\n sleep(1); //IS throttling\n\n //Add Notes to the Job/Order Record\n $invoice = $this->dsLoad('Invoice',$invoice_id,array('JobId'));\n $r = $this->dsUpdate('Job',$invoice['JobId'],array('JobNotes' => 'Ordered By: ' . $data['_OrderName']));\n\n sleep(1); //IS throttling\n\n $r = $this->runAS($contact_id,$action_set_id);\n\n $this->achieveGoal('optimalwellness','mapfriendemail',$contact_id);\n\n return $data['FirstName'] . ' ' . $data['LastName'] . ' ID: ' . $contact_id;\n\n }",
"public function setProvisionAmount(float $provision_amount): self\n {\n $this->provision_amount = $provision_amount;\n\n return $this;\n }",
"function addPerson(){\n\t\t \n\t\t $this->getMakeMetadata();\n\t\t $changesMade = false;\n\t\t $requestParams = $this->requestParams;\n\t\t if(isset($requestParams[\"uuid\"]) && isset($requestParams[\"role\"])){\n\t\t\t\t\n\t\t\t\t$personUUID = trim($requestParams[\"uuid\"]);\n\t\t\t\t$uri = self::personBaseURI.$personUUID;\n\t\t\t\t\n\t\t\t\tif(isset($requestParams[\"rank\"])){\n\t\t\t\t\t $rank = $requestParams[\"rank\"];\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\t $rank = false;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t$pObj = new dbXML_dbPerson;\n\t\t\t\t$pObj->initialize();\n\t\t\t\t$pObj->dbPenelope = true;\n\t\t\t\t$pFound = $pObj->getByID($personUUID);\n\t\t\t\tif($pFound){\n\t\t\t\t\t $name = $pObj->label;\n\t\t\t\t\t if($requestParams[\"role\"] == \"creator\"){\n\t\t\t\t\t\t $persons = $this->rawCreators;\n\t\t\t\t\t\t $persons = $this->addPersonRank($persons, $name, $uri, $rank);\n\t\t\t\t\t\t $this->rawCreators = $persons;\n\t\t\t\t\t\t $changesMade = true;\n\t\t\t\t\t }\n\t\t\t\t\t elseif($requestParams[\"role\"] == \"contributor\"){\n\t\t\t\t\t\t $persons = $this->rawContributors;\n\t\t\t\t\t\t $persons = $this->addPersonRank($persons, $name, $uri, $rank);\n\t\t\t\t\t\t $this->rawContributors = $persons;\n\t\t\t\t\t\t $changesMade = true;\n\t\t\t\t\t }\n\t\t\t\t\t elseif($requestParams[\"role\"] == \"person\"){\n\t\t\t\t\t\t $persons = $this->rawLinkedPersons;\n\t\t\t\t\t\t $persons = $this->addPersonRank($persons, $name, $uri, $rank);\n\t\t\t\t\t\t $this->rawLinkedPersons = $persons;\n\t\t\t\t\t\t $changesMade = true;\n\t\t\t\t\t }\n\t\t\t\t\t else{\n\t\t\t\t\t\t \n\t\t\t\t\t }\n\t\t\t\t}\n\t\t }\n\t\t \n\t\t if($changesMade){\n\t\t\t\t$this->saveMetadata(); //save the results\n\t\t }\n\t\t return $changesMade;\n\t }",
"public function createPerson($personData) {\n return $this->createRecord('person', $personData);\n }",
"function create_person($personRec = \"\", $personID = \"\")\n\t{\n\t\t//throw new exception(\"create_person - this function is not implemented\");\n\n\t}",
"public function store(PersonRequest $request)\n {\n $person = new Person();\n $person -> first_name = $request->first_name;\n $person -> middle_name = $request->middle_name;\n $person -> last_name = $request->last_name;\n $person -> gender = $request->gender;\n $person -> cadre = $request->cadre;\n $person -> email = $request->email;\n $person -> phone = $request->phone;\n $person -> facility = $request->facility;\n $person -> save(); \n $personId = $person->person_id;\n $pRole = $request->role;\n \n if ($pRole == 1) {\n $mentor = new Mentor();\n $mentor->person_id = $personId;\n $mentor->save();\n } else {\n $mentee = new Mentee();\n $mentee->person_id = $personId;\n $mentee->save();\n }\n return redirect('person-home');\n \n }",
"public function only_person(CreateVisitorRequest $request){\n \n $person = Person::create([\n 'type_dni' => $request->type_dni,\n 'dni' => $request->dni,\n 'name' => $request->name,\n 'lastname' => $request->lastname,\n 'address' => $request->address,\n 'phone' => $request->phone,\n 'email' => $request->email,\n 'branch_id' => 1,\n ]);\n\n /**\n * Registro de la fotografia \n */\n if ($request->file('file') != null) {\n $photo = $request->file('file');\n $path = $photo->store('persons');\n $image = new Image;\n $image->path = $path;\n $image->imageable_type = \"App\\Person\";\n $image->imageable_id = $person->id;\n $image->save();\n }\n\n return response()->json([\n 'message' => 'Registrado correctamente',\n ]);\n }",
"public function __construct($person)\n {\n $this->person = $person;\n }",
"public function setPerson(\\Entities\\Person $person = null) {\n $this->person = $person;\n }",
"public function dokan_remove_bookable_person() {\n $post_data = wp_unslash( $_POST ); // phpcs:ignore\n\n // @codingStandardsIgnoreLine\n if ( ! isset( $post_data['action'] ) && $post_data['action'] != 'woocommerce_remove_bookable_person' ) {\n return;\n }\n if ( ! wp_verify_nonce( $post_data['security'], 'delete-bookable-person' ) ) {\n return;\n }\n\n wp_delete_post( intval( $post_data['person_id'] ) );\n exit;\n }",
"public function recoverPersonUsingCity(Person $person)\n {\n }",
"public function __construct(Person $person)\n {\n $this->person = $person;\n }",
"public function createOrLoadPerson($params)\n {\n $personLeague = null;\n $person = null;\n \n // Have to have a league identifier\n if (isset($params['aysoVolunteerId']))\n {\n // AYSOV12345678\n $identifier = $params['aysoVolunteerId'];\n $personLeague = $this->loadPersonLeagueForIdentifier($identifier);\n \n // No updated is the person exists\n if ($personLeague) return $personLeague->getPerson();\n \n // Make one\n $person = $this->newPerson();\n $personLeague = $person->getVolunteerAYSO();\n $person->addLeague($personLeague);\n \n $personLeague->setMemId (substr($identifier,5));\n \n $personLeague->setLeague($params['aysoRegionId']);\n \n // Always have primary person person\n $personPerson = $this->newPersonPerson();\n $personPerson->setRolePrimary();\n $personPerson->setMaster($person);\n $personPerson->setSlave ($person);\n $personPerson->setVerified('Yes');\n $person->addPerson($personPerson);\n \n // Referee badge\n if (isset($params['aysoRefereeBadge']))\n {\n $badge = $params['aysoRefereeBadge'];\n $cert = $person->getCertRefereeAYSO(); // Creates one if needed\n $person->addCert($cert);\n \n $cert->setIdentifier($identifier);\n $cert->setBadgex($badge);\n }\n }\n // Check other possible leagues\n if (!$person) return null;\n \n // Update Person\n $person->setFirstName($params['personFirstName']);\n $person->setLastName ($params['personLastName']);\n $person->setNickName ($params['personNickName']);\n $person->setEmail ($params['personEmail']);\n $person->setPhone ($params['personPhone']);\n \n if ($params['personNickName']) $name = $params['personNickName'] . ' ' . $params['personLastName'];\n else $name = $params['personFirstName'] . ' ' . $params['personLastName'];\n \n $person->setName($name);\n \n return $person;\n }",
"public function testAddNewPersonWithPersonList() {\n // Add an existing person.\n Profile::create([\n 'type' => 'person',\n 'field_name' => 'Existing person',\n 'field_email' => '[email protected]',\n 'uid' => $this->adminUser->id(),\n ])->save();\n\n $this->addProductToCart($this->product);\n $this->goToCheckout();\n $this->assertCheckoutProgressStep('Event registration');\n\n // Go to add registrant page.\n $this->clickLink('Add registrant');\n // Assert that one person is already shown.\n $this->assertSession()->pageTextContains('Existing person');\n $this->submitForm([], 'New person');\n\n // Assert that no new profile is created yet.\n $this->assertNull(Profile::load(2));\n\n // Now, create person.\n $this->submitForm([\n 'person[field_name][0][value]' => 'Person 1',\n 'person[field_email][0][value]' => '[email protected]',\n ], 'Save');\n\n // Assert that a new profile now exists.\n $person = Profile::load(2);\n $this->assertEquals('Person 1', $person->field_name->value);\n $this->assertEquals($this->adminUser->id(), $person->getOwnerId());\n\n // Continue checkout.\n $this->submitForm([], 'Continue');\n $this->assertSession()->pageTextContains('1 item');\n $this->processOrderInformation(FALSE);\n // Review.\n $this->assertCheckoutProgressStep('Review');\n $this->assertSession()->pageTextContains('Contact information');\n $this->assertSession()->pageTextContains('Billing information');\n $this->assertSession()->pageTextContains('Order Summary');\n $this->assertSession()->pageTextContains('Person 1');\n // Finalize order.\n $this->submitForm([], 'Complete checkout');\n $this->assertSession()->pageTextContains('Your order number is 1. You can view your order on your account page when logged in.');\n $this->assertSession()->pageTextContains('0 items');\n }",
"public function hire(Person $person)\r\n {\r\n $this->staff->add($person);\r\n\r\n }",
"public function testUpdatePerson()\n {\n }"
]
| [
"0.5092642",
"0.50719213",
"0.4851578",
"0.47544652",
"0.46343556",
"0.4537914",
"0.4531917",
"0.4522646",
"0.45019546",
"0.44570738",
"0.44196057",
"0.44115287",
"0.43901756",
"0.43724993",
"0.43669438",
"0.43552187",
"0.43490082",
"0.43408313",
"0.42856318",
"0.4269936",
"0.4243094",
"0.42204386",
"0.4220283",
"0.42186964",
"0.4206158",
"0.42016256",
"0.41866648",
"0.41721722",
"0.4163343",
"0.41471967"
]
| 0.5952425 | 0 |
Get CSV header. Usually it's a first line in file. | public function getHeader()
{
$this->withHeader = true;
if (ftell($this->handle) == 0) {
$this->header = $this->read();
}
return $this->header;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function csvHeader()\n {\n return end($this->_csvHeader);\n }",
"function getQBaseHeaderLine(){\r\n\t\tglobal $LANG;\r\n\t\t$delimeter = $this->extConf['CSV_qualifier'];\r\n\t\t$parter = $delimeter.$this->extConf['CSV_parter'].$delimeter;\r\n\r\n\t\t$csvheader = $delimeter.$this->q_data['uid'].$parter.$this->q_data['header'].$delimeter.\"\\n\\n\";\r\n\r\n\t\t$csvheader .= $delimeter;\r\n\t\t$csvheader .= $LANG->getLL('CSV_questionId').$parter;\r\n\t\t$csvheader .= $LANG->getLL('CSV_questionPlus').$parter;\r\n\t\t$csvheader .= $LANG->getLL('CSV_answer').$parter;\r\n\t\t$csvheader .= $LANG->getLL('CSV_resultIdPlus').$parter;\r\n\t\t$csvheader .= $parter;\r\n\t\t$csvheader .= $delimeter.\"\\n\";\r\n\r\n\t\treturn $csvheader;\r\n\t}",
"public function GetHeader()\n {\n return $this->HeaderName;\n }",
"public function get_header() {\n\t\tif (!isset($this->header)) {\n\t\t\t$this->get_array();\n\t\t}\n\t\treturn $this->header;\n\t}",
"public function getHeader()\n {\n return $this->getFilename();\n }",
"public function get_header() {\n $this->do_header();\n return $this->c_header;\n }",
"public function firstLine(){\n return $this->file[0] ?? '';\n }",
"function get_csv_header_fields()\r\n {\r\n\t\t$this->analyse_file($this->file_name, intval(filesize($this->file_name) / 1024) + 1024);\r\n\t\t\r\n\t\tif(count($this->arr_csv_columns) > 0) {\r\n\t\t\t$arr_temp = $this->arr_csv_columns;\r\n\t\t\t$this->arr_csv_columns = NULL;\r\n\r\n\t\t\tforeach($arr_temp as $key => $value) {\r\n\t\t\t\t$st = str_replace(\",,\", \" , , \", $arr_temp[$key]);\r\n\t\t\t\t//$st = $arr_temp[$key];\r\n\t\t\t\t$arr = str_getcsv($st);\r\n\t\t\t\t$this->arr_csv_columns[] = $arr;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t$this->arr_csv_columns = '';\r\n\t\t}\r\n\t\treturn true;\r\n\t\t\r\n $this->arr_csv_columns = array();\r\n $fpointer = fopen($this->file_name, \"r\");\r\n if ($fpointer)\r\n {\r\n\t\t\t$arr = array();\r\n\t\t\twhile (($data = fgetcsv($fpointer, 10*1024, $this->field_separate_char, $this->field_enclose_char)) !== false) { \r\n\t\t\t\t$arr[] = $data;\r\n\t\t\t}\r\n\t\t\t$this->arr_csv_columns = $arr;\r\n unset($arr);\r\n fclose($fpointer);\r\n }\r\n else\r\n $this->error = \"file cannot be opened: \".(\"\"==$this->file_name ? \"[empty]\" : @mysql_escape_string($this->file_name));\r\n return $this->arr_csv_columns;\r\n }",
"public function getCsvRowHeaders()\n {\n\n $headersType = Arr::get($this->csvSettings, 'headers', 'translate');\n\n $methodName = 'getCsvRowHeaders' . Str::studly($headersType);\n $headers = $this->$methodName();\n return rtrim(implode($this->separator, $headers), $this->separator) . $this->endline;\n }",
"public function getHeader() {\n return (isset($this->header)) ? $this->header : '';\n }",
"function _webform_csv_headers_file($component) {\r\n $header = array();\r\n // Two columns in header.\r\n $header[0] = array('', '');\r\n $header[1] = array($component['name'], '');\r\n $header[2] = array(t('Name'), t('Filesize (KB)'));\r\n return $header;\r\n}",
"protected function getLineHeader($line) {\n\t\treturn Billrun_Factory::db()->logCollection()->query(array('header.stamp' => $line['log_stamp']))->cursor()->current();\n\t}",
"private function parseFileHeader()\n\t{\n\n\t\tif ($this->data)\n\t\t{\n\t\t\t$line = StringHelper::substr($this->data, 0, StringHelper::strpos($this->data, \"\\n\") + 1);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$fp = fopen($this->file, 'r');\n\t\t\t$line = fgets($fp, 4096);\n\t\t\t$line = trim($line); // remove white spaces, at the end always \\n (or \\r\\n)\n\t\t\tfclose($fp);\n\t\t}\n\n\t\t$headers = explode($this->columnSeparator, $line);\n\t\t$this->colsNum = count($headers);\n\t\tfor ($i = 0; $i < $this->colsNum; $i++)\n\t\t{\n\t\t\t// -------- remove the utf-8 BOM ----\n\t\t\t$headers[$i] = str_replace(\"\\xEF\\xBB\\xBF\", '', $headers[$i]);\n\t\t\t$this->colsOrder[str_replace('\"', '', trim($headers[$i]))] = $i;\n\t\t\t// some people let white space at the end of text, so better to trim\n\t\t\t// CSV has often begining and ending \" - replace it\n\t\t}\n\t}",
"public function getHeader(): string\n {\n return $this->header;\n }",
"public function getHeader()\n {\n return isset($this->header) ? $this->header : null;\n }",
"public function getHeader()\n {\n return isset($this->header) ? $this->header : null;\n }",
"public function getHeader()\n {\n return $this->content['header'];\n }",
"public function getHeader()\n {\n return $this->header;\n }",
"public function getHeader()\n {\n return $this->header;\n }",
"public function getHeader()\n {\n return $this->header;\n }",
"public function getHeader()\n {\n return $this->header;\n }",
"public function getHeader()\n {\n return $this->header;\n }",
"public static function getHeader()\n {\n return self::$_header;\n }",
"public function csvHeaders()\n\t{\n\t\t$headers = array();\n\t\tforeach ($this->Columns as $field => $Column) {\n\t\t\t$headers[] = $Column->label();\n\t\t}\n\t\treturn $headers;\n\t}",
"public function getHeader()\n\t{\n\t\treturn $this->header;\n\t}",
"public function getHeader() {\n return $this->header;\n }",
"public static function file_get_contents_csv_header($path, $delimiter = ',') {\n $rows = self::file_get_contents_csv($path, $delimiter);\n $header = array_shift($rows);\n return self::arrayToAssoc($rows, $header);\n }",
"public function getHeader ()\n {\n return $this->header;\n }",
"public function getHeader() {\r\n return $this->__header;\r\n }",
"function GetHeader() {\n return ($this->ses['response']['header']);\n }"
]
| [
"0.767566",
"0.6901435",
"0.6859122",
"0.68434995",
"0.68240535",
"0.6823405",
"0.67184794",
"0.6676887",
"0.66745484",
"0.66723377",
"0.6669941",
"0.6580675",
"0.65394974",
"0.65358925",
"0.6532634",
"0.6532634",
"0.6528428",
"0.64533013",
"0.64533013",
"0.64533013",
"0.64533013",
"0.64533013",
"0.6423957",
"0.64162016",
"0.6404731",
"0.638352",
"0.6375342",
"0.63675445",
"0.6365121",
"0.6346087"
]
| 0.7245194 | 1 |
Delete Role Master Data | public function deleteRoleMasterData()
{
$RoleID = $this->input->post('RoleID');
$RoleData = $this->system_structure_m->deleteRoleMasterData($RoleID);
echo $RoleData;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function roleDelete(Role $role);",
"function delete_role($roleid) {\n $success = true;\n\n// mdl 10149, check if this is the last active admin role\n// if we make the admin role not deletable then this part can go\n \n $systemcontext = get_context_instance(CONTEXT_SYSTEM);\n \n if ($role = get_record('role', 'id', $roleid)) {\n if (record_exists('role_capabilities', 'contextid', $systemcontext->id, 'roleid', $roleid, 'capability', 'moodle/site:doanything')) {\n // deleting an admin role\n $status = false;\n if ($adminroles = get_roles_with_capability('moodle/site:doanything', CAP_ALLOW, $systemcontext)) {\n foreach ($adminroles as $adminrole) {\n if ($adminrole->id != $roleid) {\n // some other admin role\n if (record_exists('role_assignments', 'roleid', $adminrole->id, 'contextid', $systemcontext->id)) {\n // found another admin role with at least 1 user assigned \n $status = true;\n break;\n }\n }\n } \n } \n if ($status !== true) {\n error ('You can not delete this role because there is no other admin roles with users assigned'); \n }\n } \n }\n\n// first unssign all users\n if (!role_unassign($roleid)) {\n debugging(\"Error while unassigning all users from role with ID $roleid!\");\n $success = false;\n }\n\n// cleanup all references to this role, ignore errors\n if ($success) {\n delete_records('role_capabilities', 'roleid', $roleid);\n delete_records('role_allow_assign', 'roleid', $roleid);\n delete_records('role_allow_assign', 'allowassign', $roleid);\n delete_records('role_allow_override', 'roleid', $roleid);\n delete_records('role_allow_override', 'allowoverride', $roleid);\n delete_records('role_names', 'roleid', $roleid);\n }\n\n// finally delete the role itself\n // get this before the name is gone for logging\n $rolename = get_field('role', 'name', 'id', $roleid);\n \n if ($success and !delete_records('role', 'id', $roleid)) {\n debugging(\"Could not delete role record with ID $roleid!\");\n $success = false;\n }\n \n if ($success) {\n add_to_log(SITEID, 'role', 'delete', 'admin/roles/action=delete&roleid='.$roleid, $rolename, '', $USER->id);\n }\n\n return $success;\n}",
"public function actionDeleteRole ()\n\t\t{\n\n\t\t\t$auth = Yii::$app->getAuthManager();\n\t\t\t$role = $auth->getRole(Yii::$app->request->get('id'));\n\t\t\t$auth->remove($role);\n\t\t\t$url = Yii::$app->request->referrer . '#roles';\n\t\t\tYii::$app->response->redirect($url);\n\n\t\t\tYii::$app->end();\n\t\t}",
"public function clear() {\r\n\r\n \t\r\n \t\tunset ( $this->__sesionStorage->role );\r\n \t\t\r\n }",
"public function postDelete()\n {\n self::getConnection()->delete('@system_user_role', ['user_id' => $this->getId()]);\n }",
"public function deleteRoleAccess()\n\t{\n\t\t$RoleAccessID = $this->input->post('RoleAccessID');\n\t\t$RoleAccessData = $this->system_structure_m->deleteRoleAccess($RoleAccessID);\n\t\techo $RoleAccessData;\n\t}",
"public function del_role(){\n\t\textract($_POST);\n\n\t\t//Connection establishment to get data from REST API\n\t\t$path=base_url();\n\t\t$url = $path.'api/manageRoles_api/del_role?role_id='.$role_id;\t\t\n\t\t$ch = curl_init($url);\n\t\tcurl_setopt($ch, CURLOPT_HTTPGET, true);\n\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n\t\t$response_json = curl_exec($ch);\n\t\tcurl_close($ch);\n\t\t$response=json_decode($response_json, true);\n\t\t//api processing ends\n\n\t\tif($response['status']==0){\n\t\t\techo '<div class=\"alert alert-danger\">\n\t\t\t<strong>'.$response['status_message'].'</strong> \n\t\t\t</div>\t\t\t\t\t\t\n\t\t\t';\t\n\t\t\t\n\t\t}\n\t\telse{\n\t\t\techo '<div class=\"alert alert-warning\">\n\t\t\t<strong>'.$response['status_message'].'</strong> \n\t\t\t</div>\t\t\t\t\t\t\n\t\t\t';\t\t\t\t\n\t\t\t\n\t\t}\t\n\t\t\n\t}",
"public function destroy($id)\n {\n $del = $this->Role->delete($id); \n if($del): echo \"Role Deleted Successfully\"; else: \"Error deleting this data... Please try again later\"; endif;\n\t\n\n }",
"function delete_role ($role_id) {\r\n $conn = db_connect();\r\n $query = \"delete from roles where role_id = '\".$role_id.\"'\";\r\n $result = $conn->query($query);\r\n $query = \"delete from role_priv where role_id = '\".$role_id.\"'\";\r\n $result1 = $conn->query($query);\r\n\r\n // change the users` priv to default\r\n $result2 = $conn->query(\"update users set role_id = '1' where role_id = '\".$role_id.\"'\");\r\n\r\n if (!$result || !$result1 || !$result2) {\r\n throw new Exception(\"Could not connect to the db!\");\r\n } else {\r\n return true;\r\n }\r\n }",
"public static function deletePerms() {\n $sql = \"TRUNCATE role_perm\";\n $res = $_POST['link']->query($sql);\n return $res;\n }",
"public function testDelete()\n {\n\n $this->createDummyRole();\n\n $this->assertDatabaseHas('roles', [\n 'id' => 1,\n ]);\n\n $this->call('POST', '/api/role', array(\n 'action' => $this->deleteAction,\n 'id' => 1,\n ));\n\n $this->assertDatabaseMissing('roles', [\n 'id' => 1,\n ]);\n\n $this->assertDatabaseMissing('role_permission', [\n 'role_id' => 1,\n 'permission_id' => [1, 2]\n ]);\n }",
"public static function RoleDelete($id) {\n $role = Roles::find($id);\n $role->status = 0;\n $role->save(); \n }",
"public function testDeleteRole()\n {\n }",
"public function delete_data_to_tombstone(){\n }",
"public function deleting(Role $role)\n {\n }",
"public function deleteRolesAction(){\n \n $request = $this->getRequest();\n \n if(! isset($request->id)) {\n // TODO Massege (Helper bauen??!)\n $this->_helper->messenger('error', \n Zend_Registry::get('config')->messages->role->invalid);\n return $this->_redirect('/admin/role');\n }\n \n $entity = 'Jbig3\\Entity\\RolesEntity';\n $repositoryFunction = 'findOneById';\n \n $role = $this->em->getRepository($entity)->$repositoryFunction($request->id);\n \n if($role !== null) {\n // TODO Cascade - hier anders gelöst (Kinder vorher manuell löschen)\n if(count($role->rules)) {\n // Masseges\n $this->_helper->messenger('error', \n 'Unable to remove group. Please remove dependencies first (Manual)');\n return $this->_redirect('/admin/role');\n }\n \n $roleName = $role->name;\n \n $this->em->remove($role);\n $this->em->flush();\n \n // TODO Masseges\n $this->_helper->messenger('success', \n sprintf(Zend_Registry::get('config')->messages->role->delete, $roleName));\n return $this->_redirect('/admin/role');\n } else {\n // TODO Masseegs\n $this->_helper->messenger('success', \n Zend_Registry::get('config')->messages->role->invalid);\n return $this->_redirect('/admin/role');\n }\n }",
"public function delete()\r\n {\r\n // Remove Roles\r\n $objPartnerRole = new Partner($this->conf, $this->lang, $this->conf->getExtensionPrefix().'partner');\r\n $objPartnerRole->remove(); // Remove roles if exist - Launch only on first time activation\r\n\r\n $objAssistantRole = new Assistant($this->conf, $this->lang, $this->conf->getExtensionPrefix().'assistant');\r\n $objAssistantRole->remove(); // Remove roles if exist - Launch only on first time activation\r\n\r\n $objManagerRole = new Manager($this->conf, $this->lang, $this->conf->getExtensionPrefix().'manager');\r\n $objManagerRole->remove(); // Remove roles if exist - Launch only on first time activation\r\n\r\n // Remove all plugin capabilities from WordPress admin role\r\n $objWPAdminRole = get_role('administrator');\r\n $capabilitiesToRemove = $objManagerRole->getCapabilities();\r\n foreach($capabilitiesToRemove AS $capability => $grant)\r\n {\r\n $objWPAdminRole->remove_cap($capability);\r\n }\r\n\r\n // Create mandatory instances\r\n $objSingleSiteInstall = new Install($this->conf, $this->lang, $this->blogId);\r\n $objSingleSiteInstall->deleteContent();\r\n\r\n flush_rewrite_rules();\r\n }",
"function delete_pac_emp_role($id)\n {\n $response = $this->getdb()->delete('pac_emp_roles',array('id'=>$id));\n if($response)\n {\n return \"pac_emp_role deleted successfully\";\n }\n else\n {\n return \"Error occuring while deleting pac_emp_role\";\n }\n }",
"protected function deleteAdminUserFixture()\n {\n if ($this->userName) {\n $users = Mage::getModel('admin/user')->getCollection();\n $users->addFieldToFilter('username', array( 'eq' => $this->userName));\n $users->load();\n foreach ( $users as $user ) {\n $user->delete();\n }\n }\n \n if ($this->roleName) {\n $roles = Mage::getModel('api/roles')->getCollection();\n $roles->addFieldToFilter('role_name', array('eq' => $this->roleName));\n $roles->load();\n foreach ( $roles as $role ) {\n $role->delete();\n }\n }\n }",
"public function delete($id)\n {\n $role = $this->findById($id);\n\n \n $role->delete();\n }",
"public function delete($role_id)\r\n {\r\n $this->checkIfDemo();\r\n $this->AdminRoleModel->remove($role_id);\r\n }",
"function delete_user_role($id,$table){\n $this->db->delete($table, array('user_id' => $id));\n return;\n }",
"function delete_user_role($id,$table){\n $this->db->delete($table, array('user_id' => $id));\n return;\n }",
"public function destroy($id)\n {\n $role = Role::firstOrCreate(['id' => Auth::user()->role_id]);\n if (!is_null($role->hasPermissionTo('clearingagent-add')) && $role->hasPermissionTo('clearingagent-add')){\n $clearingagent = ClearingAgent::find($id);\n if(!is_null($clearingagent)){\n $clearingagent->delete();\n }\n\n\n return redirect()->route('clearingagent.index')->with('message', 'Successfully deleted');\n }else\n return redirect()->back()->with('not_permitted', 'Sorry! You are not allowed to access this module');\n }",
"public function testDeleteAuthorizationRole()\n {\n }",
"public function resetTable($role)\n {\n DB::table('permission_role')->where('role_id', $role->id()->value())->delete();\n }",
"public function _event_before_delete() {\n\t\tstatic::$_delete['roles'] = $this->roles;\n\t}",
"public function destroy(MasterUser $masterUser)\n {\n //\n }",
"function delete($role_id)\n\t{\n\t\t// response array\n\t\t$jsonData = array('success' => false);\n\t\t$result = $this->role_model->remove($role_id);\n\t\t// if role deleted successfully\n\t\tif($result) {\n\t\t\t$jsonData['success'] = true;\n\t\t}\n\n\t\t// send response to clint\n\t\techo json_encode($jsonData);\n\t}",
"private function delete(){\n\t\t$id = $this->objAccessCrud->getId();\n\t\tif (empty ( $id )) return;\n\t\t// Check if there are permission to execute delete command.\n\t\t$result = $this->clsAccessPermission->toDelete();\n\t\tif(!$result){\n\t\t\t$this->msg->setWarn(\"You don't have permission to delete!\");\n\t\t\treturn;\n\t\t}\n\t\tif(!$this->objAccessCrud->delete($id)){\n\t\t\t$this->msg->setError (\"There was an issue to delete, because this register has some relation with another one!\");\n\t\t\treturn;\n\t\t}\n\t\t// Cleaner all class values.\n\t\t$this->objAccessCrud->setAccessCrud(null);\n\t\t// Cleaner session primary key.\n\t\t$_SESSION['PK']['ACCESSCRUD'] = null;\n\n\t\t$this->msg->setSuccess (\"Delete the record with success!\");\n\t\treturn;\n\t}"
]
| [
"0.7020674",
"0.68856496",
"0.6879654",
"0.6687952",
"0.6565636",
"0.6551272",
"0.65369695",
"0.6468845",
"0.6405283",
"0.6384726",
"0.6365593",
"0.635362",
"0.63266987",
"0.62496334",
"0.62468845",
"0.6219779",
"0.61988425",
"0.6189037",
"0.61869925",
"0.6175382",
"0.6174534",
"0.61708015",
"0.61708015",
"0.6144643",
"0.6142707",
"0.6141576",
"0.61382926",
"0.6131824",
"0.6112116",
"0.6106471"
]
| 0.79997045 | 0 |
Delete Role Access Data | public function deleteRoleAccess()
{
$RoleAccessID = $this->input->post('RoleAccessID');
$RoleAccessData = $this->system_structure_m->deleteRoleAccess($RoleAccessID);
echo $RoleAccessData;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function roleDelete(Role $role);",
"public function actionDeleteRole ()\n\t\t{\n\n\t\t\t$auth = Yii::$app->getAuthManager();\n\t\t\t$role = $auth->getRole(Yii::$app->request->get('id'));\n\t\t\t$auth->remove($role);\n\t\t\t$url = Yii::$app->request->referrer . '#roles';\n\t\t\tYii::$app->response->redirect($url);\n\n\t\t\tYii::$app->end();\n\t\t}",
"public function testDelete()\n {\n\n $this->createDummyRole();\n\n $this->assertDatabaseHas('roles', [\n 'id' => 1,\n ]);\n\n $this->call('POST', '/api/role', array(\n 'action' => $this->deleteAction,\n 'id' => 1,\n ));\n\n $this->assertDatabaseMissing('roles', [\n 'id' => 1,\n ]);\n\n $this->assertDatabaseMissing('role_permission', [\n 'role_id' => 1,\n 'permission_id' => [1, 2]\n ]);\n }",
"private function delete(){\n\t\t$id = $this->objAccessCrud->getId();\n\t\tif (empty ( $id )) return;\n\t\t// Check if there are permission to execute delete command.\n\t\t$result = $this->clsAccessPermission->toDelete();\n\t\tif(!$result){\n\t\t\t$this->msg->setWarn(\"You don't have permission to delete!\");\n\t\t\treturn;\n\t\t}\n\t\tif(!$this->objAccessCrud->delete($id)){\n\t\t\t$this->msg->setError (\"There was an issue to delete, because this register has some relation with another one!\");\n\t\t\treturn;\n\t\t}\n\t\t// Cleaner all class values.\n\t\t$this->objAccessCrud->setAccessCrud(null);\n\t\t// Cleaner session primary key.\n\t\t$_SESSION['PK']['ACCESSCRUD'] = null;\n\n\t\t$this->msg->setSuccess (\"Delete the record with success!\");\n\t\treturn;\n\t}",
"public function testDeleteRole()\n {\n }",
"function delete_role ($role_id) {\r\n $conn = db_connect();\r\n $query = \"delete from roles where role_id = '\".$role_id.\"'\";\r\n $result = $conn->query($query);\r\n $query = \"delete from role_priv where role_id = '\".$role_id.\"'\";\r\n $result1 = $conn->query($query);\r\n\r\n // change the users` priv to default\r\n $result2 = $conn->query(\"update users set role_id = '1' where role_id = '\".$role_id.\"'\");\r\n\r\n if (!$result || !$result1 || !$result2) {\r\n throw new Exception(\"Could not connect to the db!\");\r\n } else {\r\n return true;\r\n }\r\n }",
"public function testDeleteAuthorizationRole()\n {\n }",
"public function postDelete()\n {\n self::getConnection()->delete('@system_user_role', ['user_id' => $this->getId()]);\n }",
"public function delete() {\r\n $this->db->delete(\"assets_permissions\", $this->db->quoteInto(\"id = ?\", $this->model->getId()));\r\n }",
"function delete_role($roleid) {\n $success = true;\n\n// mdl 10149, check if this is the last active admin role\n// if we make the admin role not deletable then this part can go\n \n $systemcontext = get_context_instance(CONTEXT_SYSTEM);\n \n if ($role = get_record('role', 'id', $roleid)) {\n if (record_exists('role_capabilities', 'contextid', $systemcontext->id, 'roleid', $roleid, 'capability', 'moodle/site:doanything')) {\n // deleting an admin role\n $status = false;\n if ($adminroles = get_roles_with_capability('moodle/site:doanything', CAP_ALLOW, $systemcontext)) {\n foreach ($adminroles as $adminrole) {\n if ($adminrole->id != $roleid) {\n // some other admin role\n if (record_exists('role_assignments', 'roleid', $adminrole->id, 'contextid', $systemcontext->id)) {\n // found another admin role with at least 1 user assigned \n $status = true;\n break;\n }\n }\n } \n } \n if ($status !== true) {\n error ('You can not delete this role because there is no other admin roles with users assigned'); \n }\n } \n }\n\n// first unssign all users\n if (!role_unassign($roleid)) {\n debugging(\"Error while unassigning all users from role with ID $roleid!\");\n $success = false;\n }\n\n// cleanup all references to this role, ignore errors\n if ($success) {\n delete_records('role_capabilities', 'roleid', $roleid);\n delete_records('role_allow_assign', 'roleid', $roleid);\n delete_records('role_allow_assign', 'allowassign', $roleid);\n delete_records('role_allow_override', 'roleid', $roleid);\n delete_records('role_allow_override', 'allowoverride', $roleid);\n delete_records('role_names', 'roleid', $roleid);\n }\n\n// finally delete the role itself\n // get this before the name is gone for logging\n $rolename = get_field('role', 'name', 'id', $roleid);\n \n if ($success and !delete_records('role', 'id', $roleid)) {\n debugging(\"Could not delete role record with ID $roleid!\");\n $success = false;\n }\n \n if ($success) {\n add_to_log(SITEID, 'role', 'delete', 'admin/roles/action=delete&roleid='.$roleid, $rolename, '', $USER->id);\n }\n\n return $success;\n}",
"public function deleteRoleMasterData()\n\t{\n\t\t$RoleID = $this->input->post('RoleID');\n\t\t$RoleData = $this->system_structure_m->deleteRoleMasterData($RoleID);\n\t\techo $RoleData;\n\t}",
"public function clear() {\r\n\r\n \t\r\n \t\tunset ( $this->__sesionStorage->role );\r\n \t\t\r\n }",
"public function destroy($id)\n {\n $del = $this->Role->delete($id); \n if($del): echo \"Role Deleted Successfully\"; else: \"Error deleting this data... Please try again later\"; endif;\n\t\n\n }",
"public function testDeleteWontEffectOtherRoleWithSamePermission()\n {\n\n $this->createDummyRole(\"1\");\n $this->createDummyRole(\"2\");\n\n $this->call('POST', '/api/role', array(\n 'action' => $this->deleteAction,\n 'id' => 1,\n ));\n\n $this->assertDatabaseMissing('roles', [\n 'id' => 1,\n 'name' => $this->testRoleName . \"1\",\n 'description' => $this->testRoleDesc . \"1\"\n ]);\n\n $this->assertDatabaseHas('roles', [\n 'id' => 2,\n 'name' => $this->testRoleName . \"2\",\n 'description' => $this->testRoleDesc . \"2\"\n ]);\n\n $this->assertDatabaseMissing('role_permission', [\n 'role_id' => 1,\n 'permission_id' => 1,\n ]);\n\n $this->assertDatabaseHas('role_permission', [\n 'role_id' => 2,\n 'permission_id' => 1,\n ]);\n }",
"public function testPermissionOwnGotDeleted()\n {\n $this->createDummyRole();\n\n // Delete the permission\n $this->call('POST', '/api/permissions', array(\n 'action' => $this->deleteAction,\n 'id' => 1,\n ));\n\n $this->assertDatabaseHas('roles', [\n 'id' => 1,\n 'name' => $this->testRoleName,\n 'description' => $this->testRoleDesc\n ]);\n\n $this->assertDatabaseMissing('role_permission', [\n 'role_id' => 1,\n 'permission_id' => 1.\n ]);\n\n $this->assertDatabaseHas('role_permission', [\n 'role_id' => 1,\n 'permission_id' => 2,\n ]);\n }",
"public static function deletePerms() {\n $sql = \"TRUNCATE role_perm\";\n $res = $_POST['link']->query($sql);\n return $res;\n }",
"public function delete()\n {\n // Remove all role associations\n $this->roles()->detach();\n\n // Delete the permission\n $result = parent::delete();\n\n return $result;\n }",
"function deleteRecord()\n\t{\n\t\t$this->db->where('roleID', $this->roleID);\n\t\t$this->db->delete('roles'); \n\t \t\n\t\tif ($this->db->_error_message())\n\t\t\treturn false;\n\t\telse \n\t\t\treturn true; \t\t\n\t}",
"public function testDeleteUserRoles()\n {\n }",
"public function deleting(Role $role)\n {\n }",
"function delete_user_role($id,$table){\n $this->db->delete($table, array('user_id' => $id));\n return;\n }",
"function delete_user_role($id,$table){\n $this->db->delete($table, array('user_id' => $id));\n return;\n }",
"public function delete($id)\n {\n $role = $this->findById($id);\n\n \n $role->delete();\n }",
"public function del_role(){\n\t\textract($_POST);\n\n\t\t//Connection establishment to get data from REST API\n\t\t$path=base_url();\n\t\t$url = $path.'api/manageRoles_api/del_role?role_id='.$role_id;\t\t\n\t\t$ch = curl_init($url);\n\t\tcurl_setopt($ch, CURLOPT_HTTPGET, true);\n\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n\t\t$response_json = curl_exec($ch);\n\t\tcurl_close($ch);\n\t\t$response=json_decode($response_json, true);\n\t\t//api processing ends\n\n\t\tif($response['status']==0){\n\t\t\techo '<div class=\"alert alert-danger\">\n\t\t\t<strong>'.$response['status_message'].'</strong> \n\t\t\t</div>\t\t\t\t\t\t\n\t\t\t';\t\n\t\t\t\n\t\t}\n\t\telse{\n\t\t\techo '<div class=\"alert alert-warning\">\n\t\t\t<strong>'.$response['status_message'].'</strong> \n\t\t\t</div>\t\t\t\t\t\t\n\t\t\t';\t\t\t\t\n\t\t\t\n\t\t}\t\n\t\t\n\t}",
"public static function RoleDelete($id) {\n $role = Roles::find($id);\n $role->status = 0;\n $role->save(); \n }",
"public function deleteRolesAction(){\n \n $request = $this->getRequest();\n \n if(! isset($request->id)) {\n // TODO Massege (Helper bauen??!)\n $this->_helper->messenger('error', \n Zend_Registry::get('config')->messages->role->invalid);\n return $this->_redirect('/admin/role');\n }\n \n $entity = 'Jbig3\\Entity\\RolesEntity';\n $repositoryFunction = 'findOneById';\n \n $role = $this->em->getRepository($entity)->$repositoryFunction($request->id);\n \n if($role !== null) {\n // TODO Cascade - hier anders gelöst (Kinder vorher manuell löschen)\n if(count($role->rules)) {\n // Masseges\n $this->_helper->messenger('error', \n 'Unable to remove group. Please remove dependencies first (Manual)');\n return $this->_redirect('/admin/role');\n }\n \n $roleName = $role->name;\n \n $this->em->remove($role);\n $this->em->flush();\n \n // TODO Masseges\n $this->_helper->messenger('success', \n sprintf(Zend_Registry::get('config')->messages->role->delete, $roleName));\n return $this->_redirect('/admin/role');\n } else {\n // TODO Masseegs\n $this->_helper->messenger('success', \n Zend_Registry::get('config')->messages->role->invalid);\n return $this->_redirect('/admin/role');\n }\n }",
"public function testAdminCanDeleteARole()\n {\n $existRole = Role::factory()->create();\n\n $response = $this\n ->actingAs($this->admin)\n ->delete('/admin/roles/'. $existRole->id);\n\n $role = Role::where('id', $existRole->id)->first();\n $this->assertNull($role);\n\n $response->assertStatus(302);\n $response->assertRedirect('/admin/roles');\n $response->assertSessionHas('success', __('roles.success_deleted_message', ['name' => $existRole->name]));\n }",
"public function testDeleteRoleItem()\n {\n // TODO: implement\n $this->markTestIncomplete('Not implemented');\n }",
"static public function remove()\n {\n remove_role(self::ROLE_KEY);\n }",
"public function destroy($id) {\n //fetcg the data spotlight by id\n DB::table('roles')->where('id', $id)->delete();\n\n //redirect the listing page\n return redirect('Roles ')->withMessage('Data Delete Successfully');\n }"
]
| [
"0.73920023",
"0.7296694",
"0.71099824",
"0.7003252",
"0.69234455",
"0.6917699",
"0.6913297",
"0.6911456",
"0.6872483",
"0.67910755",
"0.676202",
"0.6743962",
"0.67257106",
"0.6716634",
"0.6690992",
"0.6663016",
"0.6651142",
"0.6613578",
"0.6564592",
"0.65533566",
"0.6542743",
"0.6542743",
"0.65395176",
"0.6521828",
"0.64983445",
"0.6487339",
"0.6482018",
"0.6460427",
"0.64590937",
"0.64389443"
]
| 0.7866396 | 0 |
Screens Get Screens Details | public function getScreensDetails()
{
$screens = $this->system_structure_m->getScreensDetails();
//echo json_encode($screens);
$output='';
foreach ($screens as $scrn) {
$output=$output.'<option value="'.$scrn->ScreenID.'">'.$scrn->ScreenDescription.'</option>';
}
echo $output;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"private function get_allowed_screens() {\n\t\t$screens = [\n\t\t\t'avada-fusion-patcher',\n\t\t\t'avada-registration',\n\t\t\t'avada-plugins',\n\t\t\t'avada-demos',\n\t\t];\n\n\t\treturn $screens;\n\t}",
"function &getScreens()\n{\n if(count($this->_screens) > 0){\n return $this->_screens;\n } else {\n $debug_prefix = debug_indent(\"Module-getScreens() {$this->ModuleID}:\");\n $screens_element = $this->_map->selectFirstElement('Screens', NULL, NULL);\n\n if(!empty($screens_element) && count($screens_element->c) > 0){\n foreach($screens_element->c as $screen_element){\n $screen = $screen_element->createObject($this->ModuleID);\n $this->_screens[$screen_element->name] =& $screen;\n\n switch(strtolower(get_class($screen))){\n case 'viewscreen':\n $this->viewScreen =& $screen;\n break;\n case 'searchscreen':\n $this->searchScreen =& $screen;\n break;\n case 'listscreen':\n $this->listScreen =& $screen;\n break;\n default:\n //do nothing\n }\n unset($screen);\n }\n }\n\n debug_unindent();\n return $this->_screens;\n }\n//print_r($this->_screens);\n}",
"function get_current_screen()\n {\n }",
"function infoScreenObject()\n\t{\n\t\t$this->checkPermission(\"visible\");\n\t\t$this->ctrl->setCmd(\"showSummary\");\n\t\t$this->ctrl->setCmdClass(\"ilinfoscreengui\");\n\t\t$this->infoScreen();\n\t}",
"function screen($screen_id){\n\t\t$rows= query(\"select name, description from screen where id=?\",$screen_id);\n\t\treturn [\"name\"=>$rows[0][\"name\"],\"description\"=>$rows[0][\"description\"]];\n\t}",
"protected function _screen() {}",
"function &getScreen($name)\n{\n print \"getScreen: $name\\n\";\n if(isset($this->_screens[$name]) && count($this->_screens) > 0){\n return $this->_screens[$name];\n } else {\n if($screens = $this->getScreens()){\n return $screens[$name];\n } else {\n $dummy = null;\n return $dummy;\n }\n }\n}",
"public function current_screen()\n {\n }",
"function infoScreen()\n\t{\n\t\t$this->ctrl->setCmd(\"showSummary\");\n\t\t$this->ctrl->setCmdClass(\"ilinfoscreengui\");\n\t\t$this->infoScreenForward();\n\t}",
"protected function infoScreenAction() {}",
"function current_screen()\n {\n }",
"public function screen()\n {\n return array('post', 'page');\n }",
"function infoScreenObject()\n\t{\n\t\t$this->ctrl->setCmd(\"showSummary\");\n\t\t$this->ctrl->setCmdClass(\"ilinfoscreengui\");\n\t\t$this->infoScreen();\n\t}",
"public function get_screen_variables() {\n\n\t\tglobal $pagenow, $typenow;\n\t\t$current_screen['pagenow'] = $pagenow;\n\t\t$current_screen['post'] = isset( $_GET['post'] ) ? $_GET['post'] : '';\n\t\t$current_screen['type'] = $typenow;\n\n\t\tif ( empty( $current_screen['type'] ) && ! empty( $current_screen['type'] ) ) {\n\t\t\t$current_screen['post_obj'] = get_post( $_GET['post'] );\n\t\t\t$current_screen['type'] = $current_screen['post_obj']->post_type;\n\t\t}\n\n\t\treturn $current_screen;\n\n\t}",
"public function getlogicalScreenDescriptor()\n {\n return $this->logicalScreenDescriptor;\n }",
"function current_screen($screen)\n {\n }",
"public function settings_screen () {\n \n $this->ui->get_header();\n\n $screen = $this->ui->get_current_screen();\n\n switch ( $screen ) {\n //** Products screen. */\n case 'more_products':\n $this->more_products = $this->get_more_products();\n require_once( $this->screens_path . 'screen-more.php' );\n break;\n //** Licenses screen. */\n case 'licenses':\n default:\n $this->ensure_keys_are_actually_active();\n $this->installed_products = $this->get_detected_products();\n $this->pending_products = $this->get_pending_products();\n require_once( $this->screens_path . 'screen-manage-' . $this->type . '.php' );\n break;\n }\n\n $this->ui->get_footer();\n }",
"function get_screen_icon()\n {\n }",
"public function homeScreen(): array\n {\n $Banners = BannerSlider::all();\n $Categories = Category::root()->get();\n\n return [\n 'status' => 1,\n 'banners' => $Banners,\n 'categories' => $Categories,\n ];\n }",
"protected function initScreens()\n\t{\n\t\tadd_action('admin_menu', array($this->Main, 'screensHandler'));\n\n\t\t// Set up handler for admin bar registration (100 = put menu item at the end of standard items)\n\t\tadd_action('admin_bar_menu', array($this->Main, 'adminBarRegister'), 100);\n\t}",
"public static function get_current_screen() {\n\t\tif ( function_exists( 'get_current_screen' ) ) {\n\t\t\t$current_screen = get_current_screen();\n\t\t\tif ( $current_screen instanceof \\WP_Screen ) {\n\t\t\t\treturn $current_screen;\n\t\t\t}\n\t\t}\n\n\t\t// No screen found, return object with same properties but with empty values.\n\t\treturn (object) array(\n\t\t\t'action' => null,\n\t\t\t'base' => null,\n\t\t\t'id' => null,\n\t\t\t'is_network' => null,\n\t\t\t'is_user' => null,\n\t\t\t'parent_base' => null,\n\t\t\t'parent_file' => null,\n\t\t\t'post_type' => null,\n\t\t\t'taxonomy' => null,\n\t\t\t'is_block_editor' => null,\n\t\t);\n\t}",
"public function hasScreen(){\n return $this->_has(12);\n }",
"function screen_options($screen)\n {\n }",
"public function screen()\n {\n $poolScreens = json_decode(\\Session::get('poll_screens'));\n \n if (!is_array($poolScreens) || count($poolScreens) < 1) {\n return view('poll.error', ['content' => __('poll.error.generic')]);\n }\n \n $currentScreenId = array_shift($poolScreens);\n \n \\Session::put('poll_screens', json_encode($poolScreens));\n \n $screen = Screen::find($currentScreenId);\n\n $questions = (new Question())->getForScreen($currentScreenId);\n\n $questionAnswers = [];\n foreach ($questions as $question) {\n $className = \"\\\\App\\\\Research\\\\Poll\\\\Question\\\\\" . ucfirst($question->question_type);\n $questionAnswers[$question->id] = new $className($question->id);\n }\n\n return view('poll.screen', compact('questions', 'screen', 'questionAnswers', 'currentScreenId'));\n }",
"public function getDisplay();",
"function screen_meta($screen)\n {\n }",
"public function getScreenshots() {\n\t\treturn ScreenshotManager::getScreenshotsFromAddon($this->id);\n\t}",
"public function screen()\n {\n return view('screen');\n }",
"public function index()\n {\n $screenOne = DamageScreen::where('order', 0)->first();\n $screenTwo = DamageScreen::where('order', 1)->first();\n $status = DamageStatus::get();\n return view('dashboard.screens.index')->with('screenOne', $screenOne)->with('screenTwo', $screenTwo)->with('status',$status);\n }",
"public function getScreenFolder()\n {\n return $this->screenFolder;\n }"
]
| [
"0.6537875",
"0.6385602",
"0.608241",
"0.6005124",
"0.59540874",
"0.5943824",
"0.59298617",
"0.5898245",
"0.58824545",
"0.5860758",
"0.5820196",
"0.57913446",
"0.57882553",
"0.5726827",
"0.5714163",
"0.56430453",
"0.562844",
"0.56045103",
"0.5590049",
"0.55152386",
"0.55149984",
"0.55126905",
"0.55091023",
"0.55022246",
"0.5454369",
"0.539725",
"0.53865516",
"0.5385399",
"0.5378349",
"0.5314662"
]
| 0.6434759 | 1 |
If set, render this module's review view and shove the result into the appropriate slot. | public function renderReviewSection()
{
if (empty($this->review_view_name)) return;
slot::append(
'BYOB.repack.edit.review.sections',
View::factory($this->review_view_name, Event::$data)
);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function reviewformAction()\r\n {\r\n if (!$this->config->isPhaseOpen(Config::REVIEWING_PHASE)) {\r\n $this->view->content = $this->texts->reviewer->review_phase_is_closed;\r\n echo $this->view->render(\"layout\");\r\n return;\r\n }\r\n\r\n\r\n $reviewTbl = new Review();\r\n $this->view->setFile(\"content\", \"reviewform.xml\");\r\n $this->view->setBlock(\"content\", \"SECTION\", \"SECTIONS\");\r\n\r\n\r\n // Extract the blocks from the template\r\n $this->view->setFile(\"review\", \"form_review.xml\");\r\n $this->view->setBlock (\"review\", \"review_mark\", \"review_marks\");\r\n $this->view->setBlock (\"review\", \"review_answer\", \"review_answers\");\r\n\r\n $this->view->selected1 = $this->view->selected2 = $this->view->selected3 = \"\";\r\n\r\n // Actions if the id of a paper is submitted\r\n if (isSet($_REQUEST['id_paper'])) {\r\n $idPaper = $this->getRequest()->getParam(\"id_paper\");\r\n $review = $reviewTbl->find($idPaper, $this->user->id)->current();\r\n\r\n // Check that the paper is REALLY assigned to the reviewer\r\n if (is_object($review)) {\r\n $this->view->review_form = $review->showReview($this->view, false);\r\n }\r\n else {\r\n $this->view->content = \"You do not have access to this paper!<br/>\";\r\n }\r\n }\r\n else {\r\n $this->view->content = \"Invalid action<br/>\";\r\n }\r\n \r\n echo $this->view->render(\"layout\");\r\n }",
"function processreviewAction()\r\n {\r\n if (!$this->config->isPhaseOpen(Config::REVIEWING_PHASE)) {\r\n $this->view->content = $this->texts->reviewer->review_phase_is_closed;\r\n echo $this->view->render(\"layout\");\r\n return;\r\n }\r\n\r\n $this->view->setFile(\"content\", \"processreview.xml\");\r\n $this->view->setBlock(\"content\", \"review\");\r\n // Extract the block with marks.\r\n $this->view->set_block('review', \"review_mark\", \"review_marks\");\r\n // Extracts the block with answers\r\n $this->view->set_block('review', \"review_answer\", \"review_answers\");\r\n\r\n\r\n // Actions if the id of a paper is submitted\r\n if (isSet($_REQUEST['idPaper'])) {\r\n $idPaper = $this->getRequest()->getParam(\"idPaper\");\r\n $reviewTbl = new Review();\r\n $review = $reviewTbl->find($idPaper, $this->user->id)->current();\r\n\r\n // Check that the paper is REALLY assigned to the reviewer\r\n if (is_object($review)) {\r\n\r\n // Put the review in the database\r\n $review->updateFromArray ($_POST);\r\n\r\n // Create the review presentation\r\n $this->view->review = $review->showReview($this->view, true) ;\r\n // Resolve the entities replacement\r\n $this->view->assign(\"content\", \"content\");\r\n \r\n // Send a mail to confirm review submission\r\n $mail = new Mail (Mail::SOME_USER, $this->texts->mail->subj_ack_review,\r\n $this->view->getScriptPaths());\r\n $mail->setFormat(Mail::FORMAT_HTML);\r\n $mail->setTo($this->user->email);\r\n\r\n $mail->loadTemplate ($this->lang, \"ack_review\");\r\n $mailViewEngine = $mail->getEngine();\r\n $mailViewEngine->setBlock(\"template\", \"template_mark\", \"template_marks\");\r\n $mailViewEngine->setBlock(\"template\", \"template_answer\", \"template_answers\");\r\n\r\n $instantiatedMail = $review->showReview($mailViewEngine, true, \"template\");\r\n $mail->setTemplate ($instantiatedMail);\r\n if ($this->config->mailOnReview == \"Y\") {\r\n $mail->setCopyToChair(true);\r\n }\r\n\r\n $mail->send();\r\n }\r\n else {\r\n $this->view->content = $this->texts->def->access_denied;;\r\n }\r\n }\r\n else {\r\n $this->view->content = \"Invalid action<br/>\";\r\n }\r\n echo $this->view->render(\"layout\");\r\n }",
"public function view(Review $review);",
"protected function _getReviewHtml(){\n\t\tMage::app()->getCacheInstance()->cleanType('layout');\n\n\t\t$layout = $this->getLayout();\n\t\t$update = $layout->getUpdate();\n\t\t$update->load('checkout_onepage_review');\n\t\t$layout->generateXml();\n\t\t$layout->generateBlocks();\n\t\t$review = $layout->getBlock('root');\n\t\t$review->setTemplate('opc/onepage/review/info.phtml');\n\t\t\n\t\treturn $review->toHtml();\n\t}",
"public function review()\n {\n return view('review');\n }",
"public function show(Review $review)\n {\n //\n }",
"public function show(Review $review)\n {\n //\n }",
"public function show(Review $review)\n {\n //\n }",
"public function show(Review $review)\n {\n //\n }",
"protected function _getReviewHtml()\n\t{\n\t\t$layout = $this->getLayout();\n\t\t$update = $layout->getUpdate();\n\t\t$update->load('checkout_onestep_review');\n\t\t$layout->generateXml();\n\t\t$layout->generateBlocks();\n\t\t$output = $layout->getOutput();\n\t\tMage::getSingleton('core/translate_inline')->processResponseBody($output);\n\t\treturn $output;\n\t}",
"public function indexAction() {\n if (!Engine_Api::_()->core()->hasSubject('sitereview_listing') && !Engine_Api::_()->core()->hasSubject('sitereview_review')) {\n return $this->setNoRender();\n }\n\n if (Engine_Api::_()->core()->hasSubject('sitereview_listing')) {\n $this->view->sitereview = $sitereview = Engine_Api::_()->core()->getSubject();\n } elseif (Engine_Api::_()->core()->hasSubject('sitereview_review')) {\n $this->view->sitereview = $sitereview = Engine_Api::_()->core()->getSubject()->getParent();\n }\n\n //GET SUBJECT\n $this->view->sitereview = $sitereview = Engine_Api::_()->core()->getSubject();\n\n $this->view->viewType = $this->_getParam('viewType', 0);\n $this->view->statistics = $this->_getParam('statistics', array(\"likeCount\", \"reviewCount\", \"commentCount\"));\n Engine_Api::_()->sitereview()->setListingTypeInRegistry($sitereview->listingtype_id);\n $listingtypeArray = Zend_Registry::get('listingtypeArray' . $sitereview->listingtype_id);\n\n //SEND REVIEW TITLE TO TPL\n $this->view->reviewTitleSingular = $listingtypeArray->review_title_singular ? $listingtypeArray->review_title_singular : 'Review';\n $this->view->reviewTitlePlular = $listingtypeArray->review_title_plural ? $listingtypeArray->review_title_plural : 'Reviews';\n \n if (!empty($this->view->statistics) && empty($listingtypeArray->reviews) || $listingtypeArray->reviews == 1) {\n $key = array_search('reviewCount', $this->view->statistics);\n if (!empty($key)) {\n unset($this->view->statistics[$key]);\n }\n }\n\n $values = array();\n $values['listing_id'] = $sitereview->listing_id;\n $this->view->count = $limit = $values['limit'] = $this->_getParam('itemCount', 3);\n $values['similar_items_order'] = 1;\n $this->view->title_truncation = $this->_getParam('truncation', 24);\n $values['ratingType'] = $this->view->ratingType = $this->_getParam('ratingType', 'rating_avg');\n $listingTable = Engine_Api::_()->getDbTable('listings', 'sitereview');\n\n $similar_items = Engine_Api::_()->getDbTable('otherinfo', 'sitereview')->getColumnValue($sitereview->listing_id, 'similar_items');\n $similarItems = array();\n if (!empty($similar_items)) {\n $similarItems = Zend_Json_Decoder::decode($similar_items);\n }\n\n $showSameCategoryListings = $this->_getParam('showSameCategoryListings', 1);\n \n if (!empty($similar_items) && !empty($similarItems) && Count($similarItems) >= 0) {\n $values['similarItems'] = $similarItems;\n $this->view->listings = $listingTable->getListing('', $values);\n } else {\n \n if(!$showSameCategoryListings) {\n return $this->setNoRender();\n } \n \n $values['listingtype_id'] = $sitereview->listingtype_id;\n\n if ($sitereview->subsubcategory_id) {\n $values['subsubcategory_id'] = $sitereview->subsubcategory_id;\n } elseif ($sitereview->subcategory_id) {\n $values['subcategory_id'] = $sitereview->subcategory_id;\n } elseif ($sitereview->category_id) {\n $values['category_id'] = $sitereview->category_id;\n } else {\n return $this->setNoRender();\n }\n\n $this->view->listings = $listingTable->getListing('', $values);\n }\n\n if (Engine_API::_()->seaocore()->checkSitemobileMode('fullsite-mode')) {\n $this->_childCount = count($this->view->listings);\n } else {\n $this->view->listings->setCurrentPageNumber($this->_getParam('page'));\n $this->view->listings->setItemCountPerPage($limit);\n $this->_childCount = $this->view->listings->getTotalItemCount();\n }\n\n if ($this->_childCount <= 0) {\n return $this->setNoRender();\n }\n\n $this->view->columnWidth = $this->_getParam('columnWidth', '180');\n $this->view->columnHeight = $this->_getParam('columnHeight', '328');\n }",
"protected function _beforeToHtml()\n {\n if (!$this->isReviewsEnabled()) {\n $this->setTemplate('');\n return parent::_beforeToHtml();\n }\n\n if (!$this->_setReviews()) {\n $this->setTemplate('');\n return parent::_beforeToHtml();\n }\n\n return parent::_beforeToHtml();\n }",
"public function renderView(){ \n if ($this->hlp->sess(\"listing\")->render){\n $this->template->renderBuyForm = TRUE;\n }\n }",
"public function viewAction()\n {\n // Procesar cambio de estados\n if ($this->getRequest()->isXmlHttpRequest()) {\n return $this->forward()->dispatch('Registry\\Controller\\Review', array('action' => 'view-ajax'));\n }\n\n $registry = $this->getRegistry();\n if (!$registry) {\n $this->fm(_('La rendicion solicitada no pudo ser encontrada'), 'error');\n return $this->redirect()->toRoute('review', array('action' => 'index'));\n }\n\n $formManager = $this->getServiceLocator()->get('FormElementManager');\n $form = $formManager->get('Registry\\Form\\Confirm', array('element' => $registry->getId()));\n\n $url = $this->url()->fromRoute('review/default', array('action' => 'view'), array('query' => array('id' => $registry->getId())));\n $prg = $this->prg($url, true);\n if ($prg instanceof \\Zend\\Http\\PhpEnvironment\\Response) {\n return $prg;\n } elseif (is_array($prg)) {\n // Validar formulario\n $form->setData($prg);\n if (!$form->isValid()) {\n $this->fm(_('No se ha podido cerrar la rendicion'), 'error');\n $helper = $this->getServiceLocator()->get('viewhelpermanager')->get('htmlList');\n $this->fm($helper($form->getMessages()), 'error');\n\n return $this->redirect()->toRoute('review');\n }\n\n if ($prg['task'] === 'reopen') {\n return $this->reopen($registry);\n } else {\n return $this->close($registry);\n }\n }\n\n $commentsForm = $formManager->get('Registry\\Form\\Comment');\n $commentsForm->setAttribute(\n 'action',\n $this->url()->fromRoute(\n 'review/comment',\n array('action' => 'comment'),\n array('query' => array('id' => $registry->getId()))\n )\n );\n\n return array(\n 'form' => $form,\n 'registry' => $registry,\n 'commentform' => $commentsForm,\n );\n }",
"public function review()\n {\n return view('company.review');\n }",
"public function display() {\n\n\t\t// Include our views row.\n\t\t$this->views();\n\n\t\t// Handle our search output.\n\t\t$this->search_box( __( 'Search Reviews', 'woo-better-reviews' ), 'reviews' );\n\n\t\t// Wrap the display in a form.\n\t\techo '<form class=\"woo-better-reviews-admin-form\" id=\"woo-better-reviews-admin-reviews-form\" method=\"post\">';\n\n\t\t\t// Add a nonce for the bulk action.\n\t\t\twp_nonce_field( 'wbr_list_reviews_action', 'wbr_list_reviews_nonce' );\n\n\t\t\t// And the parent display (which is most of it).\n\t\t\tparent::display();\n\n\t\t// Close up the form.\n\t\techo '</form>';\n\t}",
"public function actionReview($id)\n {\n $model = $this->findModel($id);\n\n if('in-review' == $model->status){\n /* no changing of reviewer permitted when module is in-review */\n $enquirySpecialistsList[\"$model->reviewer_id\"] = User::findOne($model->reviewer_id)['name'];\n } else { \n /* get (id,name) as (key,value) array/list of enquiry specialists */\n $subQuery = AuthAssignment::find()->where((['item_name' => 'enquiryspecialist']))->all();\n $subQuery = ArrayHelper::map($subQuery,'user_id','user_id');\n $mainQuery = User::find()->where(['in', 'id', $subQuery])->all();\n $enquirySpecialistsList = ArrayHelper::map($mainQuery, 'id', 'name' ); \n } \n $model->enquirySpecialistsList = $enquirySpecialistsList; \n\n if ($model->load(Yii::$app->request->post())) {\n\n $model->status = 'in-review';\n if($model->owner_id == Yii::$app->user->getId()){\n /* meaning review is submitted by module owner. So review_status has to be 'in-review'*/\n $model->review_status = 'in-review'; \n } \n\n if( ($model->reviewer_id == Yii::$app->user->getId()) and ('approved' == $model->review_status)){\n /* review is approved so ALSO change model status to approved (along with review status).*/\n $model->status = 'approved';\n } \n\n /* adding review comment to review_comment model */\n $modelComment = new ReviewComment();\n $modelComment->commenter_id = Yii::$app->user->getId();\n $modelComment->module_id = $model->id;\n $modelComment->comment = $model->reviewComment;\n $modelComment->review_status_before = $model->review_status;\n $modelComment->review_status_after = $model->review_status;\n $modelComment->save();\n\n $model->save(); \n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('review', [\n 'model' => $model,\n ]);\n }\n }",
"public function actionReview(){\r\n $user = $_REQUEST['pro'];\r\n $list = MvCouiManager::getReview($user);\r\n $aclist = MvCouiManager::getAcreview($user);\r\n $nolist = MvCouiManager::getNoreview($user);\r\n $dellist = MvCouiManager::getDelreview();\r\n $this->render('review',array('list'=>$list,'aclist'=>$aclist,'nolist'=>$nolist,'dellist'=>$dellist));\r\n }",
"abstract protected function renderView();",
"function paperAction()\r\n {\r\n if (!$this->config->isPhaseOpen(Config::REVIEWING_PHASE)) {\r\n $this->view->content = $this->texts->reviewer->review_phase_is_closed;\r\n echo $this->view->render(\"layout\");\r\n return;\r\n }\r\n\r\n $reviewTbl = new Review();\r\n $paperTbl = new Paper();\r\n $messageTbl = new Message ();\r\n\r\n $this->view->setFile (\"content\", \"paper.xml\");\r\n $this->view->setBlock (\"content\", \"paper_status_link\");\r\n $this->view->setBlock (\"content\", \"message\", \"messages\");\r\n $this->view->setBlock(\"content\", \"review\", \"show_review\");\r\n $this->view->setBlock(\"review\", \"review_mark\", \"review_marks\");\r\n $this->view->setBlock(\"review\", \"review_answer\", \"review_answers\");\r\n $this->view->initial_message = \"\";\r\n\r\n // Am I an admin? If yes I want a link to the paper status page\r\n if (!$this->user->isAdmin()) {\r\n $this->view->paper_status_link =\"\";\r\n }\r\n\r\n $texts = $this->zmax_context->texts;\r\n\r\n if (isSet($_REQUEST['id_paper']) and $this->config->discussion_mode != Config::NO_DISCUSSION) {\r\n $idPaper = $this->getRequest()->getParam(\"id_paper\");\r\n $review = $reviewTbl->find($idPaper, $this->user->id)->current();\r\n $paper = $paperTbl->find($idPaper)->current();\r\n $paper->putInView($this->view);\r\n\r\n // Check that the paper is REALLY assigned to the reviewer (or admin)\r\n if (is_object($review) or $this->user->isAdmin()) {\r\n\r\n // Show all other SUBMITTED reviews, do not propose to see only my review\r\n $this->view->show_review = \"\";\r\n $reviews = $paper->findReview();\r\n foreach ($reviews as $otherReview) {\r\n if (!empty($otherReview->overall)) {\r\n $this->view->show_review .= $otherReview->showReview($this->view);\r\n }\r\n }\r\n\r\n // Message submitted ? Store it in the DB\r\n if (isSet($_REQUEST['form_message'])) {\r\n $message = $messageTbl->createRow();\r\n $message->id_parent = $this->getRequest()->getParam(\"id_parent\");\r\n $message->id_user = $this->user->id;\r\n $message->id_paper =$this->getRequest()->getParam(\"id_paper\");\r\n $message->message = htmlSpecialChars($this->getRequest()->getParam(\"message\"), ENT_NOQUOTES);\r\n $message->date = date(\"Y-m-d H-i-s\");\r\n $message->save();\r\n\r\n // And now, we must send the message to the reviewers and to the PC chair.\r\n $mail = new Mail (Mail::SOME_USER,\r\n $this->texts->mail->subj_new_message . \" \" . $paper->id,\r\n $this->view->getScriptPaths());\r\n $mail->loadTemplate ($this->lang, \"new_message\");\r\n $mail->setFormat(Mail::FORMAT_HTML);\r\n $mail->getEngine()->base_url = $this->view->base_url;\r\n $mail->getEngine()->author_first_name = $this->user->first_name;\r\n $mail->getEngine()->author_last_name = $this->user->last_name;\r\n $paper->putInView ($mail->getEngine());\r\n $message->putInView($mail->getEngine());\r\n\r\n // Send the message to the PC chair.\r\n $fakeName = \"User\" . \"->first_name\";\r\n $mail->getEngine()->setVar($fakeName, $this->config->chair_names);\r\n $mail->setTo ($this->config->chairMail);\r\n $mail->send();\r\n\r\n // Now, mail to each OTHER reviewer\r\n $reviews = $paper->findReview();\r\n $mailOthers = $comma = \"\";\r\n foreach ($reviews as $review) {\r\n if ($review->id_user != $this->user->id) {\r\n $reviewer = $review->findParentUser();\r\n $reviewer->putInView($mail->getEngine());\r\n $mail->setTo ($reviewer->email);\r\n $mail->send();\r\n }\r\n }\r\n }\r\n\r\n // Show the tree of messages\r\n $this->view->messages = Message::display($paper->id, 0, $this->view);\r\n }\r\n else {\r\n $this->view->content = \"You do not have access to this paper!<br/>\";\r\n }\r\n }\r\n else {\r\n $this->view->content = \"Invalid action<br/>\";\r\n }\r\n\r\n \r\n echo $this->view->render(\"layout\");\r\n }",
"public function actionView()\n\t{ \n $id=isset($_GET['id']) ? (int) ($_GET['id']) : 0 ;\n $this->menu=array_merge($this->menu, \n array(\n array('label'=>t('Update this Review'), 'url'=>array('update','id'=>$id),'linkOptions'=>array('class'=>'btn btn-mini'))\n )\n );\n\t\t$this->render('review_view');\n\t}",
"public function indexAction()\n {\n $viewer = Engine_Api::_()->user()->getViewer();\n\n $params = array(\n 'featured' => 1,\n 'order' => 'random'\n );\n \n $this->view->review = Engine_Api::_()->getDbtable('reviews', 'review')->getReview($params);\n \n if (!$this->view->review) {\n return $this->setNoRender();\n }\n \n }",
"public function view() : void\n {\n $this->PAGE_TITLE = \"Product rating\";\n }",
"public function display()\n \t{\n \t\t$this->assign(\"__view\", $this->_view);\n \t\tparent::display();\n \t}",
"public function render_view_mode()\n {\n }",
"public function review()\n\t{\n\t\t\n\t\t$this->templateFileName = 'review.tpl';\n\t\t\n\t\t// Get the cart data, shipping address, billing address, and payment method records for display.\n\t\t\n\t\t$cart_items = $this->dbConnection->prepareRecordSet( \"SELECT * FROM b_cart_item ci INNER JOIN b_item i ON ci.item_id = i.item_id WHERE cart_id = ?\", $this->session->cartID );\n\t\t$shipping_address = $this->dbConnection->prepareRecord(\"SELECT * FROM b_user_address WHERE address_id = ?\", $this->session->shippingAddressID);\n\t\t$billing_address = $this->dbConnection->prepareRecord(\"SELECT * FROM b_user_address WHERE address_id = ?\", $this->session->billingAddressID);\n\t\t$payment_method = $this->dbConnection->prepareRecord(\"SELECT payment_id, payment_type, credit_card_type, payment_name, RIGHT(account_number, 4) AS account_number_last_4, LPAD(RIGHT(account_number, 4), LENGTH(account_number), 'X') AS account_number, card_expiration_month, card_expiration_year, rp.description AS payment_type_description, rc.description AS credit_card_type_description FROM b_payment INNER JOIN b_reference rp ON rp.data_member = 'PAYMENT_TYPE' AND rp.data_value = payment_type LEFT OUTER JOIN b_reference rc ON rc.data_member = 'CREDIT_CARD_TYPE' AND rc.data_value = credit_card_type WHERE payment_id = ?\", $this->session->paymentMethodID);\n\n\t\t\n\t\t// Calculate the subtotal\n\t\t$cartCount = count($cart_items);\n\t\tfor($i=0; $i<$cartCount; $i++)\n\t\t{\n\t\t\t$item_extended_price = ($cart_items[$i]['quantity'] * $cart_items[$i]['price']);\n\t\t\t$cart_items[$i]['ext_price'] = $item_extended_price;\n\t\t\t$subtotal += $item_extended_price;\n\t\t}\n\t\t\n\t\t\n\t\t// Calculate the tax for the order\n\t\t$tax = $this->calculateTax( $this->session->shippingAddressID , $subtotal );\n\t\t\n\t\t// Calculate the shipping rate for the order\n\t\t$shipping_rate = $this->calculateShipping();\n\t\t\n\t\t$total = $subtotal + $shipping_rate + $tax;\n\t\t\n\t\t// Set output data\n\t\t$this->set('cart_items', $cart_items);\n\t\t$this->set('shipping_address', $shipping_address);\n\t\t$this->set('billing_address', $billing_address);\n\t\t$this->set('payment_method', $payment_method);\n\t\t\n\t\t$this->set('subtotal', $subtotal);\n\t\t$this->set('tax', $tax);\n\t\t$this->set('shipping_rate', $shipping_rate);\n\t\t$this->set('total', $total);\n\t\t\n\t\t\n\t\t\n\t\t// If the user clicked the submit button, then process the order\n\t\tif ( count($_POST) > 0 && isset($_POST['review_submit']) )\n\t\t{\n\t\t\t\n\t\t\t\n\t\t\t$errors = [];\n\t\t\t\n\t\t\t\n\t\t\t// Process the payment first\n\t\t\tif (!$this->processPayment( $this->session->paymentMethodID, $total ))\n\t\t\t{\n\t\t\t\t// Uh oh, there was an error processing the payment\n\t\t\t\t$errors[] = 'Error processing payment. Please try again.';\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\n\t\t\t\t// The payment has been processed correctly.\n\t\t\t\t\n\t\t\t\t// Create the order record\n\t\t\t\t$this->dbConnection->begin_transaction();\n\n\t\t\t\t$orderInsertSQL = \"INSERT INTO b_order ( order_timestamp, user_id, shipping_address_id, billing_address_id, order_status, cart_id, subtotal, tax, shipping, total, payment_id )\"\n\t\t\t\t\t\t\t\t\t\t. \" VALUES( CURRENT_TIMESTAMP(), ?, ?, ?, 'P', ?, ?, ?, ?, ?, ?)\";\n\t\t\t\t$orderLineInsertSQL = \"INSERT INTO b_order_item (order_id, item_id, item_sequence, quantity, price, extended_price, line_status)\"\n\t\t\t\t\t\t . \" VALUES(?, ?, ?, ?, ?, ?, 'P')\";\n\t\t\t\t$cartUpdateSQL = \"UPDATE b_cart SET record_status = 'C' WHERE cart_id = ?\";\n\n\n\t\t\t\tif ($this->dbConnection->prepareCommand($orderInsertSQL, $this->session->userID, $this->session->shippingAddressID, $this->session->billingAddressID, $this->session->cartID, $subtotal, $tax, $shipping_rate, $total, $this->session->paymentMethodID))\n\t\t\t\t{\n\n\t\t\t\t\t$orderID = $this->dbConnection->insert_id;\n\t\t\t\t\t$line_success = true;\n\n\t\t\t\t\t// The order was inserted, so insert the line records\n\t\t\t\t\tfor ($i=0; $i<$cartCount; $i++) \n\t\t\t\t\t{\n\t\t\t\t\t\t$item_sequence = $i+1;\n\t\t\t\t\t\tif ($this->dbConnection->prepareCommand($orderLineInsertSQL, $orderID, $cart_items[$i]['item_id'], $item_sequence, $cart_items[$i]['quantity'], $cart_items[$i]['price'], $cart_items[$i]['ext_price']))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// the insert was succesful\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse \n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// There was an error inserting one of the lines\n\t\t\t\t\t\t\t$errors[] = 'Error creating order. (1)';\n\t\t\t\t\t\t\t$this->dbConnection->rollback();\n\t\t\t\t\t\t\t$line_success = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif ($line_success)\n\t\t\t\t\t{\n\t\t\t\t\t\t// The order was created succesfuly.\n\t\t\t\t\t\t// Update the cart record to close it\n\t\t\t\t\t\tif ($this->dbConnection->prepareCommand($cartUpdateSQL, $this->session->cartID))\n\t\t\t\t\t\t{\n\n\t\t\t\t\t\t\t// The process is done, so commit the changes to the database\n\t\t\t\t\t\t\t$this->dbConnection->commit();\n\n\t\t\t\t\t\t\t//Clear all of the checkout session variables\n\t\t\t\t\t\t\t$this->session->cartID = null;\n\t\t\t\t\t\t\t$this->session->billingAddressID = null;\n\t\t\t\t\t\t\t$this->session->shippingAddressID = null;\n\t\t\t\t\t\t\t$this->session->paymentMethodID = null;\n\n\t\t\t\t\t\t\t// Redirect the user to the receipt page for the order\n\t\t\t\t\t\t\theader(\"Location: /checkout/receipt?orderID={$orderID}\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Error updating the cart record, so rolblack\n\t\t\t\t\t\t\t$this->dbConnection->rollback();\n\t\t\t\t\t\t\t$errors[] = 'Error clearing cart. (2)';\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t// There was an error inserting the order record\n\t\t\t\t\t// Display an error\n\t\t\t\t\t$errors[] = 'Error creating order. (3)';\n\t\t\t\t\t$this->dbConnection->rollback();\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\n\t\t\t\n\t\t\t$this->set('errors', $errors);\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t}",
"protected function render(){\n //render view\n \n }",
"public function getReviewAction()\n\t{\n\t\t$this->_ajaxValidation();\n\t\t$response['content']=$this->_getReviewHtml();\n\t\t$this->getResponse()->setBody(json_encode($response));\n\t}",
"abstract protected function renderFirstView();",
"public function show(ProductReview $productReview)\n {\n //\n }"
]
| [
"0.65921366",
"0.6561468",
"0.64910406",
"0.6378712",
"0.6209332",
"0.6113921",
"0.6113921",
"0.6113921",
"0.6113921",
"0.60603356",
"0.60590494",
"0.60014874",
"0.59857154",
"0.5975177",
"0.5969667",
"0.5912137",
"0.5899351",
"0.5866203",
"0.5859563",
"0.5829139",
"0.5805936",
"0.57993007",
"0.5731874",
"0.57232684",
"0.56949",
"0.5692891",
"0.56549615",
"0.5641508",
"0.56315255",
"0.56308734"
]
| 0.66816807 | 0 |
Generate product price diagram coords by SooR 18022013 v.2.0 | private function getDiagram() {
$diagram_data = array();
if ($this->product_prices && count($this->product_prices['products']) > 1) {
$height = 40;
$items = 6;
$width = 190;
$price_range = $this->max_price - $this->min_price;
if ($price_range < $items) {
return;
}
$price_interval = $price_range / $items;
$items_data = array();
$max_count = 0;
for ($i = 0; $i < $items; $i++) {
$from = $i * $price_interval + $this->min_price;
$to = ($i + 1) * $price_interval + $this->min_price;
$count = 0;
foreach ($this->product_prices['products'] as $price) {
if ($price >= $from && $price <= $to) {
$count++;
}
}
if ($count > $max_count) {
$max_count = $count;
}
$items_data[] = $count;
}
$items_interval = $width / ($items - 1);
$diagram_data['circles'] = array();
$diagram_data['path'] = 'M0,' . $height;
foreach ($items_data as $key => $count) {
$y = round($height / 100 * (100 - $count / $max_count * 100));
$y = ($y < $height / 2 ? $y + 5 : $y - 5);
$x = round($key * $items_interval, 1);
$diagram_data['circles'][] = array('y' => $y, 'x' => $x, 'count' => $count);
$diagram_data['path'] .= ' L' . $x . ',' . $y;
if ($key == count($items_data) - 1) {
$diagram_data['path'] .= ' L' . $x . ',' . $height;
}
}
$diagram_data['path'] .= ' L0,' . $height . 'Z';
}
return $diagram_data;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function generateGraphic() {}",
"public function generatePictureLine()\n {\n $values = $this->data;\n\n // Get the total number of columns we are going to plot\n $columns = count($values);\n\n // Get the height and width of the diagram itself\n $width = round($this->w*0.75);\n $height = round($this->h*0.75);\n\n //$padding = 0;\n //$padding_l = 5;\n $padding_h = round(($this->w - $width) / 2);\n $padding_v = round(($this->h - $height) / 2); \n\n // Get the width of 1 column\n $column_width = round ($width / $columns) ;\n \n \n // Fill in the background of the image\n imagefilledrectangle($this->im,0,0,$this->w,$this->h,$this->white);\n\n $maxv = 0;\n\n // Calculate the maximum value we are going to plot\n\n foreach($values as $key => $value) \n {\n $maxv = max($value,$maxv); \n }\n \n $this->drawAxesLabels($width, $height, $column_width, $padding_h,$padding_v, $maxv);\n \n //diagram itself\n $i=0;\n //for ($i = 0;$i<count($values);)\n foreach ($values as $key => $value)\n {\n //if ($i==count($values))\n // break;\n $column_height1 = ($height / 100) * (( $value / $maxv) *100);\n $x1 = $i*$column_width + $padding_h + $column_width/2;\n $y1 = $height-$column_height1 + $padding_v;\n $i++;\n if ($i<2)\n {\n $column_height2 = ($height / 100) * (( $value / $maxv) *100);\n $x2 = (($i)*$column_width) + $padding_h + $column_width/2;\n $y2 = $height-$column_height2 + $padding_v;\n }\n if ($i>1)\n imageline($this->im,$x1,$y1,$x2,$y2,$this->color_helper->img_colorallocate($this->im, $this->color_helper->nextColor()));\n $x2 = $x1; \n\t\t$y2 = $y1;\n }\n \n return $this->im;\n }",
"public function showPrice() {\n return 'This ' .$this->getColor() .' vehicle cost ' . $this->getPrice() ;\n }",
"protected function generateHighDensityGraphic() {}",
"public function getProductPosition()\n {\n return Mage::getStoreConfig('splitprice/split_price_presentation/show_product_position');\n }",
"function draw_singolo_ordine($id_prodotto, $nome_prodotto, $prezzo, $foto, $quantita)\n {\n echo \"<div class='col-md-9 col-xs-12 text-center' style='background-color:#F9F9F9; padding:5px; margin-bottom:5px;'>\";\n echo \" <div class='col-md-3 col-xs-12'>\";\n echo \" <a href='product_img/$foto'><img class='img-thumbnail' src='product_img/$foto' height='150px' width='150px'></a>\";\n echo \" </div>\";\n echo \" <div class='col-md-6 col-xs-12'>\";\n echo \" <div class='col-xs-12'>\";\n echo \" <h3 class='text-primary'> $nome_prodotto </h3>\";\n echo \" </div>\";\n echo \" </div>\";\n echo \" <div class='col-md-3 col-xs-12'>\";\n echo \" <div class='col-xs-12'>\";\n echo \" <h4>Prezzo</h4>\";\n echo \" <h3 style='color:green;'>€$prezzo</h3>\";\n echo \" </div>\";\n echo \" <div class='col-md-12'>\";\n echo \" <h5>Quantità:$quantita</h5>\";\n echo \" </div>\";\n echo \" </div>\";\n echo \"</div>\";\n }",
"function drawSelectedProducts(){\n \n }",
"function graficoPoligno() {\n $maxValue = $this->desenhaBase();\n\n $labelY = $this->margem;\n\n $idx = 0;\n foreach ($this->vetor as $label => $item) {\n $points = array();\n $arPonto = array();\n $arValor = array();\n $idx++;\n\n $color = $this->getColor($idx, 0, 0, 0, 60);\n $x = $this->margem;\n $y = $this->gtamanho + $this->margem;\n\n foreach ($item as $referencia => $value) {\n $val = ($this->gtamanho + ($this->margem * 1)) - (floor((($this->gtamanho) * $value) / $maxValue));\n\n $points[] = $x;\n $points[] = $y;\n $points[] = ($x + $this->columSize);\n $points[] = $val;\n\n $arPonto[] = array(\n 'x' => ($x + $this->columSize),\n 'y' => $val\n );\n\n $arValor[] = array(\n 'x' => ($x + ($this->columSize + $this->margem)),\n 'y' => ($val - 3),\n 'value' => $value\n );\n\n $y = $val;\n $x += $this->columSize;\n }\n\n $points[] = $this->gtamanho + $this->margem;\n $points[] = $this->gtamanho + $this->margem;\n\n imagefilledpolygon($this->image, $points, (count($points) / 2), $color);\n\n if($this->opMostrarPontoValor) {\n foreach ($arPonto as $item) {\n $this->desenhaPonto($item['x'], $item['y'], null);\n }\n\n foreach ($arValor as $item) {\n imagestring($this->image, 2, $item['x'], ($item['y'] - $this->margem), utf8_decode($item['value']), null);\n }\n }\n\n $this->desenhaLabel($label, $color, $labelY);\n $labelY += ($this->margem * 2);\n }\n }",
"function _prepareGroupedProductPriceData($entityIds = null) {\n\t\t\t$write = $this->_getWriteAdapter( );\n\t\t\t$table = $this->getIdxTable( );\n\t\t\t$select = $write->select( )->from( array( 'e' => $this->getTable( 'catalog/product' ) ), 'entity_id' )->joinLeft( array( 'l' => $this->getTable( 'catalog/product_link' ) ), 'e.entity_id = l.product_id AND l.link_type_id=' . LINK_TYPE_GROUPED, array( ) )->join( array( 'cg' => $this->getTable( 'customer/customer_group' ) ), '', array( 'customer_group_id' ) );\n\t\t\t$this->_addWebsiteJoinToSelect( $select, true );\n\t\t\t$this->_addProductWebsiteJoinToSelect( $select, 'cw.website_id', 'e.entity_id' );\n\n\t\t\tif ($this->getVersionHelper( )->isGe1600( )) {\n\t\t\t\t$minCheckSql = $write->getCheckSql( 'le.required_options = 0', 'i.min_price', 0 );\n\t\t\t\t$maxCheckSql = $write->getCheckSql( 'le.required_options = 0', 'i.max_price', 0 );\n\t\t\t\t$taxClassId = $this->_getReadAdapter( )->getCheckSql( 'MIN(i.tax_class_id) IS NULL', '0', 'MIN(i.tax_class_id)' );\n\t\t\t\t$minPrice = new Zend_Db_Expr( 'MIN(' . $minCheckSql . ')' );\n\t\t\t\t$maxPrice = new Zend_Db_Expr( 'MAX(' . $maxCheckSql . ')' );\n\t\t\t} \nelse {\n\t\t\t\t$taxClassId = new Zend_Db_Expr( 'IFNULL(i.tax_class_id, 0)' );\n\t\t\t\t$minPrice = new Zend_Db_Expr( 'MIN(IF(le.required_options = 0, i.min_price, 0))' );\n\t\t\t\t$maxPrice = new Zend_Db_Expr( 'MAX(IF(le.required_options = 0, i.max_price, 0))' );\n\t\t\t}\n\n\t\t\t$stockId = 'IF (i.stock_id IS NOT NULL, i.stock_id, 1)';\n\t\t\t$select->columns( 'website_id', 'cw' )->joinLeft( array( 'le' => $this->getTable( 'catalog/product' ) ), 'le.entity_id = l.linked_product_id', array( ) );\n\n\t\t\tif ($this->getVersionHelper( )->isGe1700( )) {\n\t\t\t\t$columns = array( 'tax_class_id' => $taxClassId, 'price' => new Zend_Db_Expr( 'NULL' ), 'final_price' => new Zend_Db_Expr( 'NULL' ), 'min_price' => $minPrice, 'max_price' => $maxPrice, 'tier_price' => new Zend_Db_Expr( 'NULL' ), 'group_price' => new Zend_Db_Expr( 'NULL' ), 'stock_id' => $stockId, 'currency' => 'i.currency', 'store_id' => 'i.store_id' );\n\t\t\t} \nelse {\n\t\t\t\t$columns = array( 'tax_class_id' => $taxClassId, 'price' => new Zend_Db_Expr( 'NULL' ), 'final_price' => new Zend_Db_Expr( 'NULL' ), 'min_price' => $minPrice, 'max_price' => $maxPrice, 'tier_price' => new Zend_Db_Expr( 'NULL' ), 'stock_id' => $stockId, 'currency' => 'i.currency', 'store_id' => 'i.store_id' );\n\t\t\t}\n\n\t\t\t$select->joinLeft( array( 'i' => $table ), '(i.entity_id = l.linked_product_id) AND (i.website_id = cw.website_id) AND ' . '(i.customer_group_id = cg.customer_group_id)', $columns );\n\t\t\t$select->group( array( 'e.entity_id', 'cg.customer_group_id', 'cw.website_id', $stockId, 'i.currency', 'i.store_id' ) )->where( 'e.type_id=?', $this->getTypeId( ) );\n\n\t\t\tif (!is_null( $entityIds )) {\n\t\t\t\t$select->where( 'l.product_id IN(?)', $entityIds );\n\t\t\t}\n\n\t\t\t$eventData = array( 'select' => $select, 'entity_field' => new Zend_Db_Expr( 'e.entity_id' ), 'website_field' => new Zend_Db_Expr( 'cw.website_id' ), 'stock_field' => new Zend_Db_Expr( $stockId ), 'currency_field' => new Zend_Db_Expr( 'i.currency' ), 'store_field' => new Zend_Db_Expr( 'cs.store_id' ) );\n\n\t\t\tif (!$this->getWarehouseHelper( )->getConfig( )->isMultipleMode( )) {\n\t\t\t\t$eventData['stock_field'] = new Zend_Db_Expr( 'i.stock_id' );\n\t\t\t}\n\n\t\t\tMage::dispatchEvent( 'catalog_product_prepare_index_select', $eventData );\n\t\t\t$query = $select->insertFromSelect( $table );\n\t\t\t$write->query( $query );\n\t\t\treturn $this;\n\t\t}",
"private function generateCoordinates()\n {\n $this->mapDiagonal();\n $this->mapVertical();\n $this->mapHorizontal();\n\n $this->disabledCells = array_unique($this->disabledCells);\n sort($this->disabledCells);\n }",
"public function wktGenerateMultipoint();",
"function DrawDot($x,$y) //center x y\n\t\t{\n\t\t $op = 'B'; // draw Filled Dots\n\t\t //F == fill //S == stroke //B == stroke and fill \n\t\t $r = 0.5 * $this->k; //raio\n\t\t \n\t\t //Start Point\n\t\t $x1 = $x - $r;\n\t\t $y1 = $y;\n\t\t //End Point\n\t\t $x2 = $x + $r;\n\t\t $y2 = $y;\n\t\t //Auxiliar Point\n\t\t $x3 = $x;\n\t\t $y3 = $y + (2*$r);// 2*raio to make a round (not oval) shape \n\n\t\t //Round join and cap\n\t\t $s=\"\\n\".'1 J'.\"\\n\";\n\t\t $s.='1 j'.\"\\n\";\n\n\t\t //Upper circle\n\t\t $s.=sprintf('%.3f %.3f m'.\"\\n\",$x1,$y1); //x y start drawing\n\t\t $s.=sprintf('%.3f %.3f %.3f %.3f %.3f %.3f c'.\"\\n\",$x1,$y1,$x3,$y3,$x2,$y2);//Bezier curve\n\t\t //Lower circle\n\t\t $y3 = $y - (2*$r);\n\t\t $s.=sprintf(\"\\n\".'%.3f %.3f m'.\"\\n\",$x1,$y1); //x y start drawing\n\t\t $s.=sprintf('%.3f %.3f %.3f %.3f %.3f %.3f c'.\"\\n\",$x1,$y1,$x3,$y3,$x2,$y2);\n\t\t $s.=$op.\"\\n\"; //stroke and fill\n\n\t\t //Draw in PDF file\n\t\t $this->_out($s);\n\t\t}",
"private function SetPricingDetails()\n\t{\n\t\t$product = $this->productClass->getProduct();\n\n\t\t$GLOBALS['PriceLabel'] = GetLang('Price');\n\n\t\tif($this->productClass->GetProductCallForPricingLabel()) {\n\t\t\t$GLOBALS['ProductPrice'] = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseGL($this->productClass->GetProductCallForPricingLabel());\n\t\t}\n\t\t// If prices are hidden, then we don't need to go any further\n\t\telse if($this->productClass->ArePricesHidden()) {\n\t\t\t$GLOBALS['HidePrice'] = \"display: none;\";\n\t\t\t$GLOBALS['HideRRP'] = 'none';\n\t\t\t$GLOBALS['ProductPrice'] = '';\n\t\t\treturn;\n\t\t}\n\t\telse if (!$this->productClass->IsPurchasingAllowed()) {\n\t\t\t$GLOBALS['ProductPrice'] = GetLang('NA');\n\t\t}\n\t\telse {\n\t\t\t$options = array('strikeRetail' => false);\n\t\t\t$GLOBALS['ProductPrice'] = formatProductDetailsPrice($product, $options);\n\t\t}\n\n\t\t// Determine if we need to show the RRP for this product or not\n\t\t// by comparing the price of the product including any taxes if\n\t\t// there are any\n\t\t$GLOBALS['HideRRP'] = \"none\";\n\t\t$productPrice = $product['prodcalculatedprice'];\n\t\t$retailPrice = $product['prodretailprice'];\n\t\tif($retailPrice) {\n\t\t\t// Get the tax display format\n\t\t\t$displayFormat = getConfig('taxDefaultTaxDisplayProducts');\n\t\t\t$options['displayInclusive'] = $displayFormat;\n\n\t\t\t// Convert to the browsing currency, and apply group discounts\n\t\t\t$productPrice = formatProductPrice($product, $productPrice, array(\n\t\t\t\t'localeFormat' => false, 'displayInclusive' => $displayFormat\n\t\t\t));\n\t\t\t$retailPrice = formatProductPrice($product, $retailPrice, array(\n\t\t\t\t'localeFormat' => false, 'displayInclusive' => $displayFormat\n\t\t\t));\n\n\t\t\tif($productPrice < $retailPrice) {\n\t\t\t\t$GLOBALS['HideRRP'] = '';\n\n\t\t\t\t// Showing call for pricing, so just show the RRP and that's all\n\t\t\t\tif($this->productClass->GetProductCallForPricingLabel()) {\n\t\t\t\t\t$GLOBALS['RetailPrice'] = CurrencyConvertFormatPrice($retailPrice);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t// ISC-1057: do not apply customer discount to RRP in this case\n\t\t\t\t\t$retailPrice = formatProductPrice($product, $product['prodretailprice'], array(\n\t\t\t\t\t\t'localeFormat' => false,\n\t\t\t\t\t\t'displayInclusive' => $displayFormat,\n\t\t\t\t\t\t'customerGroup' => 0,\n\t\t\t\t\t));\n\t\t\t\t\t$GLOBALS['RetailPrice'] = '<strike>' . formatPrice($retailPrice) . '</strike>';\n\t\t\t\t\t$GLOBALS['PriceLabel'] = GetLang('YourPrice');\n\t\t\t\t\t$savings = $retailPrice - $productPrice;\n\t\t\t\t\t$string = sprintf(getLang('YouSave'), '<span class=\"YouSaveAmount\">'.formatPrice($savings).'</span>');\n\t\t\t\t\t$GLOBALS['YouSave'] = '<span class=\"YouSave\">'.$string.'</span>';\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}",
"protected function _getProductData() {\n\n\n $cat_id = Mage::getModel('catalog/layer')->getCurrentCategory()->getId();\n $category = Mage::getModel('catalog/category')->load($cat_id);\n $data['event'] = 'product';\n\n $finalPrice = $this->getFinalPriceDiscount();\n if($finalPrice):\n $google_tag_params = array();\n $google_tag_params['ecomm_prodid'] = $this->getProduct()->getSku();\n $google_tag_params['name'] = $this->getProduct()->getName();\n $google_tag_params['brand'] = $this->getProduct()->getBrand();\n $google_tag_params['ecomm_pagetype'] = 'product';\n $google_tag_params['ecomm_category'] = $category->getName();\n $google_tag_params['ecomm_totalvalue'] = (float)$this->formatNumber($finalPrice);\n \n $customer = Mage::getSingleton('customer/session');\n if ($customer->getCustomerId()){\n $google_tag_params['user_id'] = (string) $customer->getCustomerId(); \n }\n if($this->IsReturnedCustomer()){\n $google_tag_params['returnCustomer'] = 'true';\n }\n else {\n $google_tag_params['returnCustomer'] = 'false';\n }\n\n $data['google_tag_params'] = $google_tag_params;\n\n /* Facebook Conversion API Code */\n $custom_data = array(\n \"content_name\" => $this->getProduct()->getName(),\n \"content_ids\" => [$this->getProduct()->getSku()],\n \"content_category\" => $category->getName(),\n \"content_type\" => \"product\",\n \"value\" => (float)$this->formatNumber($finalPrice),\n \"currency\" => \"BRL\"\n );\n $this->createFacebookRequest(\"ViewContent\", [], [], $custom_data);\n /* End Facebook Conversion API Code */\n\n endif;\n\n return $data;\n }",
"private function getItemXml($item)\n {\n $qty = (int)$item->getQty() ? (int)$item->getQty() : 1;\n $product = Mage::getModel('catalog/product')->load( $item->getProductId() );\n\n\n\n //$this->_totalPrice += $product->getFinalPrice() * $qty;\n if($this->getConfig('product_cost') && $product->getCost() > 0)\n {\n $this->_totalPrice += $product->getCost() * $qty;\n }\n else\n {\n $this->log(\"p p \" . $product->getFinalPrice() . \" and i P \". $product->getPrice());\n $this->_totalPrice += $product->getFinalPrice() * $qty;\n }\n\n $height = $this->getConvertedMeasure($product->getHeight(), $product->getDimensionUnits());\n //$weight = $this->getConvertedWeight($product->getWeight(),$product->getWeightUnits())*$qty;\n $weight = $this->getConvertedWeight($product->getWeight(),$product->getWeightMeasure());\n $width = $this->getConvertedMeasure($product->getWidth(), $product->getDimensionUnits());\n $length = $this->getConvertedMeasure($product->getLength(), $product->getDimensionUnits());\n $title = substr($product->getSku().';'.preg_replace('/[^a-z0-9\\s\\'\\.\\_]/i','',substr($product->getName(),0,32).\" ...\"),0,32);\n $Readytoship = $product->getReadytoship();\n\n if(intval($length) < 1 || intval($width) < 1 || intval($height) < 1 )\n {\n $length = $width = $height = 1;\n }\n\n $Readytoship = \"\";\n if($product->getReadytoship() != 1)\n {\n $Readytoship = '';\n\t\t\t\n }\n\n if(ceil($weight) <= 0.0000)\n {\n $weight = .7; //default to 7.7 kg\n }\n\n if($height < 1 || !is_numeric($height))\n {\n $height = $this->_default_heightlow; // just a low default\n if($weight >= $this->_weight_low) // less than 1k no height (default 2)\n {\n $height = $this->_default_heighthigh;\n }\n\n }\n\n if($width < 1 || !is_numeric($width))\n {\n $width = $this->_default_widthlow; // just a low default\n if($weight >= $this->_weight_low)\n {\t\t\t // less than 1k no height (default 2)\n $width = $this->_default_widthhigh;\n }\n }\n\n // Create default value for length should value be missing\n if($length < 1 || !is_numeric($length))\n {\n $length = $this->_default_lengthlow; // just a low default\n if($weight >= $this->_weight_low) // less than 1k no height (default 2)\n {\n $length = $this->_default_lengthhigh;\n }\n }\n$aweight = $weight;\n/*$aheight = $height*$qty;*/\n\nif($product->getReadytoship() != 1)\n {\n \n\t\t$this->_package_height += $height; \n\t\tif($width > $this->_package_width) $this->_package_width = $width; \n\t\tif($length > $this->_package_length) $this->_package_length = $length;\n\t\t$this->shipping_weight += $aweight; \n\t\t \n\t\n\n\t\t\t\n\t\t\t $items_xml = \"\\n\n <parcel>\n <weight>{$this->shipping_weight}</weight>\n <length>{$this->_package_length}</length>\n <width>{$this->_package_width}</width>\n <height>{$this->_package_height}</height>\n</parcel>\n\";\n\t\t\t\n }\n\t\telse\n\t\t{\n\t\t\t $items_xml = \"\\n\n <parcel>\n <weight>{$aweight}</weight>\n <length>{$length}</length>\n <width>{$width}</width>\n <height>{$height}</height>\n</parcel>\n\";\n\t\t}\n\n\n \n return $items_xml;\n }",
"static function DrawPageGraph($pdf, $data, $filename_offset, $graph_location_hori, $area_length = 480, $area_width = 110)\n {\n //echo \"data:\".print_r($data);\n if ($data) {\n $image_name = ModuleUtils::getCustomerTempPath() . 'chart2_' . time() . $filename_offset . '.png';\n //echo \"imagename:\".$image_name;\n\n $p1 = new PHPlot($area_length, $area_width);\n $p1->SetTitle('');\n $p1->SetDataType('text-data');\n\n $p1->SetDataValues($data);\n $p1->SetDataColors(array(COLOUR_GRAY, COLOUR_BLACK));\n\n $p1->SetPlotType('linepoints');\n\n $p1->SetPlotAreaWorld(.5, 0, 21.8, 1000);\n\n $p1->SetGridColor(COLOUR_WHITE);\n //$p1->SetDrawXGrid(True);\n //$p1->SetDrawYGrid(True);\n $p1->SetDrawXGrid(False);\n $p1->SetDrawYGrid(False);\n $p1->SetLineWidths(1);\n $p1->SetLineSpacing(0);\n $p1->SetLineStyles('solid');\n\n $p1->SetMarginsPixels(20, 5, 5, 15);\n $p1->SetNumXTicks(20);\n $p1->SetNumYTicks(4);\n\n $p1->SetXDataLabelPos('none');\n $p1->SetXTickPos('none');\n $p1->SetXTickLabelPos('none');\n $p1->SetYTickPos('none');\n $p1->SetYTickLabelPos('none');\n\n $p1->SetImageBorderColor('#FFFFFF');\n //\n $p1->SetPlotBorderType('none');\n $p1->SetIsInline(true);\n $p1->SetOutputfile($image_name);\n $p1->DrawGraph();\n\n $graph_location_verti = $pdf->GetDataHeaderOffsetY() + 0.8;\n $pdf->RotatedImage($image_name, $graph_location_hori, $graph_location_verti , null, null, 270); // 26 // first page\n\n unlink($image_name);\n }\n }",
"public function getPricePoint() {\n return $this->pricePoint;\n }",
"public function getgraphAction(){\n $params = array(\n 'cht' => 'lc', \t\t\t\t\t// chart type\n 'chf' => 'bg,s,f4f4f4|c,lg,90,ffffff,0.1,ededed,0', //background fills for the chart\n // 'chm' => 'B,f4d4b2,0,0,0|B,FF0000,1,1,0|B,00FF00,2,2,0', \t\t// line fills\n 'chco' => 'db4814,1919D1',\t\t\t\t\t//Series Colors\n 'chs' => '587x300',\t\t\t\t// chart size <width>x<height>\n\t\t\t'chxt' => 'x,y',\t\t\t\t\t// visible axes\n\t\t\t//'chof' => 'validate'\t\t\t\t// output format (png,gif,json,html{when chof='validate'})\n );\n \n\t$post=$this->getRequest()->getPost();\n\t\n\t\n\t$timezoneLocal = Mage::app()->getStore()->getConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_TIMEZONE);\n\n\t\tlist ($dateStart, $dateEnd) = Mage::getResourceModel('reports/order_collection')\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t->getDateRange($post['range'], '', '', true);\n\n $dateStart->setTimezone($timezoneLocal);\n $dateEnd->setTimezone($timezoneLocal);\n\t\n\t\t$dates = array();\n $datas = array();\n\n while($dateStart->compare($dateEnd) < 0){\n switch ($post['range']) {\n case '24h':\n $d = $dateStart->toString('yyyy-MM-dd HH:00');\n $dateStart->addHour(1);\n break;\n case '7d':\n case '1m':\n $d = $dateStart->toString('yyyy-MM-dd');\n $dateStart->addDay(1);\n break;\n case '1y':\n case '2y':\n $d = $dateStart->toString('yyyy-MM');\n $dateStart->addMonth(1);\n break;\n }\n\n $dates[] = $d;\n }\n\n\t\t$graphData=array();\n\t\t\n\t\t$product_list=array('product1'=>$post['product'],\n\t\t\t\t\t\t\t'product2'=>$post['compare2']\n\t\t\t\t\t\t\t);\t\n\t\t$graphData=Mage::Helper('graphs')->getGraphData($dates,$product_list);\n\n /**\n * setting skip step\n */\n if (count($dates) > 8 && count($dates) < 15) {\n $c = 1;\n } else if (count($dates) >= 15){\n $c = 2;\n } else {\n $c = 0;\n }\n /**\n * skipping some x labels for good reading\n */\n $i=0;\n foreach ($dates as $k => $d) {\n if ($i == $c) {\n $dates[$k] = $d;\n $i = 0;\n } else {\n $dates[$k] = '';\n $i++;\n }\n }\n \n $this->_axisLabels['x'] = $dates;\n\t\t$this->_axisLabels['y'] = $graphData['quantity'][$post['product']];\n\t\t\n\t\tforeach ($graphData['quantity'] as $index => $serie) {\n $localmaxlength[$index] = sizeof($serie);\n $localmaxvalue[$index] = max($serie);\n $localminvalue[$index] = min($serie);\n }\n \n\t\t$maxvalue = max($localmaxvalue);\n\t\t$minvalue = min($localminvalue);\n\n $yrange = 0;\n $yLabels = array();\n $miny = 0;\n $maxy = 0;\n $yorigin = 0;\n\n $maxlength = max($localmaxlength);\n if ($minvalue >= 0 && $maxvalue >= 0) {\n $miny = 0;\n if ($maxvalue > 10) {\n $p = pow(10, $this->_getPow($maxvalue));\n $maxy = (ceil($maxvalue/$p))*$p;\n $yLabels = range($miny, $maxy, $p);\n } else {\n $maxy = ceil($maxvalue+1);\n $yLabels = range($miny, $maxy, 1);\n }\n $yrange = $maxy;\n $yorigin = 0;\n }\n\n \n\t\t\t\n\t\t\t$params['chd'] = \"e:\";\n $dataDelimiter = \"\";\n $dataSetdelimiter = \",\";\n $dataMissing = \"__\";\n \n\t\t\t// EXTENDED ENCODING\n\t\t\tforeach($product_list as $productid){\n\t\t\t\t$chartdata = array();\t\n for ($j = 0; $j < sizeof($graphData['quantity'][$productid]); $j++) {\n $currentvalue = $graphData['quantity'][$productid][$j];\n \n if (is_numeric($currentvalue)) {\n if ($yrange) {\n $ylocation = (4095 * ($yorigin + $currentvalue) / $yrange);\n\n } else {\n $ylocation = 0;\n }\n $firstchar = floor($ylocation / 64);\n $secondchar = $ylocation % 64;\n $mappedchar = substr($this->_extendedEncoding, $firstchar, 1)\n . substr($this->_extendedEncoding, $secondchar, 1);\n array_push($chartdata, $mappedchar . $dataDelimiter);\n } else {\n array_push($chartdata, $dataMissing . $dataDelimiter);\n }\n\n\t\t\t }\n\t\t\t $buffer = implode('', $chartdata);\t\t\t \n\t\t\t\t\t$buffer = rtrim($buffer, $dataSetdelimiter);\n\t\t\t\t\t$buffer = rtrim($buffer, $dataDelimiter);\n\t\t\t\t\t$buffer = str_replace(($dataDelimiter . $dataSetdelimiter), $dataSetdelimiter, $buffer);\n\t\t\t\t\t\n\t\t\t\t\t$params['chd'] .= $buffer.',';\n\t\t\t\t\t$buffer=null;\n\t\t\t\t\t$chartdata=null;\n\t\t\t\t}\n\t\t\t\t\t$labelBuffer = \"\";\n\t\t\t\t\t$valueBuffer = array();\n\t\t\t\t\t$rangeBuffer = \"\";\n \n if (sizeof($this->_axisLabels) > 0) {\n $params['chxt'] = implode(',', array_keys($this->_axisLabels));\n $indexid = 0;\n foreach ($this->_axisLabels as $idx=>$labels){\n\t\t\t\t\n if ($idx == 'x') {\n /**\n * Format date\n */\n foreach ($this->_axisLabels[$idx] as $_index=>$_label) {\n if ($_label != '') {\n switch ($post['range']) {\n case '24h':\n $this->_axisLabels[$idx][$_index] = $this->formatTime(\n new Zend_Date($_label, 'yyyy-MM-dd HH:00'), 'short', false\n );\n break;\n case '7d':\n case '1m':\n $this->_axisLabels[$idx][$_index] = $this->formatDate(\n new Zend_Date($_label, 'yyyy-MM-dd')\n );\n break;\n case '1y':\n case '2y':\n\t\t\t\t\t\t\t\t\t\n $formats = Mage::app()->getLocale()->getTranslationList('datetime');\n $format = isset($formats['yyMM']) ? $formats['yyMM'] : 'MM/yyyy';\n $format = str_replace(array(\"yyyy\", \"yy\", \"MM\"), array(\"Y\", \"y\", \"m\"), $format);\n $this->_axisLabels[$idx][$_index] = date($format, strtotime($_label));\n break;\n }\n } else {\n $this->_axisLabels[$idx][$_index] = '';\n }\n\n }\n\t\t\t\t\t\t\t\t\t\t\n $tmpstring = implode('|', $this->_axisLabels[$idx]);\n\n $valueBuffer[] = $indexid . \":|\" . $tmpstring;\n if (sizeof($this->_axisLabels[$idx]) > 1) {\n $deltaX = 100/(sizeof($this->_axisLabels[$idx])-1);\n } else {\n $deltaX = 100;\n }\n } else if ($idx == 'y') {\n $valueBuffer[] = $indexid . \":|\" . implode('|', $yLabels);\n if (sizeof($yLabels)-1) {\n $deltaY = 100/(sizeof($yLabels)-1);\n } else {\n $deltaY = 100;\n }\n // setting range values for y axis\n $rangeBuffer = $indexid . \",\" . $miny . \",\" . $maxy . \"|\";\n }\n $indexid++;\n }\n $params['chxl'] = implode('|', $valueBuffer);\n }\t\t\t\n\t\t\t\t\t\n\t\tif (isset($deltaX) && isset($deltaY)) {\n $params['chg'] = $deltaX . ',' . $deltaY . ',1,0';\n }\n \n\n\t\t\t$p = array();\n foreach ($params as $name => $value) {\n $p[] = $name . '=' .urlencode($value);\n }\n\n $url= Mage_Adminhtml_Block_Dashboard_Graph::API_URL . '?' . implode('&', $p);\n\n\t\t\t\techo $url;\n\t}",
"function generate_price($prod_arr,$row_price,$row_settings,$tax_val,$return_price_withouttax=0)\n\t{\n\t\tglobal $db,$ecom_siteid,$ecom_allpricewithtax;\n\t\t\n\t\t$webprice \t\t\t= $prod_arr['product_webprice'];\n\t\t$disc_asval\t\t\t= $prod_arr['product_discount_enteredasval'];\n\t\t$tax_before_disc\t= $row_settings['saletax_before_discount'];\n\t\t$discount\t\t\t= 0;\n\t\t\n\t\tif($prod_arr['product_discount']>0)\n\t\t{\n\t\t\tif($disc_asval==2) // For Exact Discount Price \n\t\t\t\t$discount\t= $webprice-$prod_arr['product_discount']; \t\n\t\t\telse\n\t\t\t\t$discount\t= $prod_arr['product_discount'];\n\t\t}\n\t\t//if($ecom_siteid==70 or $ecom_siteid==104) // bypassed tax calculation for nationwide fireextinguisher and discount mobility\n\t\t\n\t\tif($ecom_siteid==104) // bypassed tax calculation for discount mobility and puregusto\n\t\t\t$apply_tax = 'Y';\n\t\telse\t\n\t\t\t$apply_tax\t\t= $prod_arr['product_applytax'];\n\t\t\t\n\t\t\n\t\tif($return_price_withouttax==1)\n\t\t{\n\t\t\t$apply_tax = 'N';\n\t\t}\n\t\t\t\n\t\t/*switch($row_price['price_displaytype'])\n\t\t{\n\t\t\tcase 'show_price_only':\t\t\t\t\t\n\t\t\tcase 'show_price_plus_tax':\n\t\t\t\tif($discount>0)\n\t\t\t\t{\n\t\t\t\t\tif($disc_asval==1) // If discount is specified as value\n\t\t\t\t\t{\n\t\t\t\t\t\t$disc_price = $webprice - $discount;\n\t\t\t\t\t}\t\n\t\t\t\t\telse if($disc_asval==2) \n\t\t\t\t\t{ // For Exact Discount Price \n\t\t\t\t\t\t$disc_price\t= $webprice-$discount; \t// For Exact Discount Price \n\t\t\t\t\t}\t\n\t\t\t\t\telse // case if discount is given as percentage\n\t\t\t\t\t{\n\t\t\t\t\t\t$disc_price = $webprice - ($webprice * $discount/100);\n\t\t\t\t\t}\n\t\t\t\t}\t\n\t\t\tbreak;\n\t\t\tcase 'show_price_inc_tax': // Show price including tax\n\t\t\tcase 'show_both':*/\n\t\t\t\tif ($apply_tax=='Y' and $ecom_allpricewithtax==0)\n\t\t\t\t{\t\n\t\t\t\t\t$disc_price\t= $webprice + ($webprice * $tax_val/100);\n\t\t\t\t\t//$disc_price = sprintf('%0.2f',$disc_price);\n\t\t\t\t}\t\n\t\t\t\telse\n\t\t\t\t\t$disc_price = $webprice;\n\t\t\t\tif ($discount>0)\n\t\t\t\t{\n\t\t\t\t\tif($disc_asval==1) // If discount is specified as value\n\t\t\t\t\t{\n\t\t\t\t\t\t$disc_price \t\t\t= $webprice - $discount; // calculate the original discount\n\t\t\t\t\t\tif ($apply_tax=='Y')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif($tax_before_disc==1)// case of apply tax before discount\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$disc_price_with_tax \t= $disc_price + ($webprice * $tax_val/100); // apply tax to it\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$disc_price_with_tax \t= $disc_price + ($disc_price * $tax_val/100); // apply tax to it\n\t\t\t\t\t\t\t}\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t$disc_price_with_tax = $disc_price;\n\n\t\t\t\t\t}\t\n\t\t\t\t\telse if($disc_asval==2) // For Exact Discount Price \n\t\t\t\t\t{\n\t\t\t\t\t\t$disc_price = $webprice - $discount;\n\t\t\t\t\t\tif ($apply_tax=='Y')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif($tax_before_disc==1)// case of apply tax before discount\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$disc_price_with_tax \t= $disc_price + ($webprice * $tax_val/100); // apply tax to it\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$disc_price_with_tax \t= $disc_price + ($disc_price * $tax_val/100); // apply tax to it\n\t\t\t\t\t\t\t}\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t$disc_price_with_tax = $disc_price;\n\t\t\t\t\t}\t\n\t\t\t\t\telse // case if discount is given as percentage\n\t\t\t\t\t{\n\t\t\t\t\t\t$disc_price \t\t\t\t= $webprice - ($webprice * $discount/100);// calculate the original discount\n\t\t\t\t\t\t//$disc_price = sprintf('%0.2f',$disc_price);\n\t\t\t\t\t\tif ($apply_tax=='Y')\n\t\t\t\t\t\t{\t\t\t\t\t\t\n\t\t\t\t\t\t\tif($tax_before_disc==1)// case of apply tax before discount\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$disc_price_with_tax \t\t= $disc_price + ($webprice * $tax_val/100); // apply tax to it\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$disc_price_with_tax \t\t= $disc_price + ($disc_price * $tax_val/100); // apply tax to it\n\t\t\t\t\t\t\t}\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t$disc_price_with_tax = $disc_price;\n\t\t\t\t\t}\n\t\t\t\t\t$disc_price = $disc_price_with_tax;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t/*break;\n\t\t};\t*/\n\t\tif($disc_price>0)\n\t\t\treturn $disc_price;\n\t\telse\n\t\t\treturn $webprice;\n\t}",
"public function getProductPrice()\n {\n }",
"function get_list_product_price() {\n\n global $product;\n\n if ( $price_html = $product->get_price_html() ) :\n \t\n \techo '<span class=\"price uk-margin-small-bottom\" style=\"float: right\">';\n \techo $price_html;\n \techo '</span>';\n \t\n endif; \n\n }",
"protected function calculatePrices()\n {\n }",
"function displayOrder($orderoid){\n $r = array();\n // le champ INFOCOMPL de WTSCATALOG (PRODUCT) est optionnel, si présent nécessaire dans certains documents\n $r['do'] = $this->dsorder->display(array('oid'=>$orderoid, \n\t\t\t\t\t 'selectedfields'=>'all', \n\t\t\t\t\t 'options'=>array('PICKUPPOINT'=>array('target_fields'=>array('title')))\n\t\t\t\t\t ));\n $r['bl'] = $this->dsline->browse(\n\t\t\t\t array('selectedfields'=>'all',\n\t\t\t\t\t 'options'=>array('PRODUCT'=>array('target_fields'=>array('INFOCOMPL', 'label'))),\n\t\t\t\t\t 'order'=>'WTPCARD, REFERENCE',\n\t\t\t\t\t 'pagesize'=>9999,\n\t\t\t\t\t 'first'=>0,\n\t\t\t\t\t 'select'=>$this->dsline->select_query(array('cond'=>array('LNKORDER'=>array('=', $orderoid))))));\n // mise en forme des lignes achats carte, utlisation bonus, assurance, port\n // recup du premier jour de ski (paiement chq)\n $r['bl']['lines__bonu'] = array();\n $r['bl']['lines__validfromhidden'] = array();\n $r['bl']['lines__cart'] = array();\n $r['bl']['lines__assu'] = array();\n $r['bl']['lines__validtill'] = array();\n $r['bl']['lines__annul'] = array_fill(0, count($r['bl']['lines_oid']), false);\n $r['_totassu'] = 0;\n $r['_totcart'] = 0;\n $r['_totport'] = 0;\n $r['_nbforf'] = 0;\n $r['_tot1'] = 0;\n $r['_tot2'] = 0;\n $r['_totassuAnnul'] = 0;\n $r['_totcartAnnul'] = 0;\n $r['_totportAnnul'] = 0;\n $r['_tot1Annul'] = 0;\n $r['_tot2Annul'] = 0;\n $r['_cartesseules'] = array();\n $cartesfaites = array();\n $firstday = NULL;\n $nodates = true;\n // rem : assur pointe sur son forfait\n // bonus pointe sur son forfait\n // les forfaits de nouvelles cartes pointent TOUS vers la ligne ...\n // a ne compter qu'ne fois donc\n //\n // ajout du calendrier pour les lignes forfaits\n //\n foreach($r['bl']['lines_oLINETYPE'] as $l=>$olinetype){\n if ($r['bl']['lines_oETATTA'][$l]->raw == XModEPassLibre::$WTSORDERLINE_ETATTA_ANNULATION){\n $r['bl']['lines__annul'][$l] = true;\n }\n $r['bl']['lines__validfromhidden'][$l] = 0;\n if($olinetype->raw == 'port'){\n\t$r['_totport']+=$r['bl']['lines_oTTC'][$l]->raw;\n }\n if($olinetype->raw == 'forf'){\n /* -- vente de cartes seules -- */\n $r['_nbforf'] += 1;\n /* -- vente de cartes seules -- */\n $r['_tot1']+=$r['bl']['lines_oTTC'][$l]->raw;\n if ($r['bl']['lines__annul'][$l] == true)\n\t $r['_tot1Annul']+= $r['bl']['lines_oTTC'][$l]->raw;\n if ($firstday == NULL || $r['bl']['lines_oVALIDFROM'][$l]->raw < $firstday)\n $firstday = $r['bl']['lines_oVALIDFROM'][$l]->raw;\n $rsc = selectQueryGetAll(\"select type from \".self::$tablePRDCALENDAR.\" c where c.koid=(select calendar from \".self::$tablePRDCONF.\" pc where pc.koid=(select prdconf from \".self::$tableCATALOG.\" p where p.koid='{$r['bl']['lines_oPRODUCT'][$l]->raw}'))\");\n if (count($rsc)>=1 && $rsc[0]['type'] == 'NO-DATE'){\n $r['bl']['lines__validfromhidden'][$l] = 1;\n } else {\n // calcul du validtill\n $dp = $this->modcatalog->displayProduct(NULL, NULL, NULL, NULL, $r['bl']['lines_oPRODUCT'][$l]->raw);\n $dpc = $this->modcatalog->getPrdConf($dp);\n $r['bl']['lines__validtill'][$l] = $this->getValidtill($r['bl']['lines_oVALIDFROM'][$l]->raw, $dp, $dpc);\n $nodates = false;\n }\n }\n $r['_tot2']+=$r['bl']['lines_oTTC'][$l]->raw;\n if ($r['bl']['lines__annul'][$l] == true)\n $r['_tot2Annul']+= $r['bl']['lines_oTTC'][$l]->raw;\n\n $ll = false;\n if (!empty($r['bl']['lines_oLNKLINE'][$l]->raw)){\n $ll = array_search($r['bl']['lines_oLNKLINE'][$l]->raw, $r['bl']['lines_oid']);\n }\n if ($ll === false)\n continue;\n\n if($r['bl']['lines_oLINETYPE'][$ll]->raw == 'cart'){\n if (!isset($cartesfaites['_'.$ll])){\n $r['_totcart']+= $r['bl']['lines_oTTC'][$ll]->raw;\n $cartesfaites['_'.$ll] = 1;\n if ($r['bl']['lines__annul'][$ll] == true)\n $r['_totcartAnnul']+= $r['bl']['lines_oTTC'][$ll]->raw;\n }\n $r['bl']['lines__cart'][$l] = $ll;\n }\n if($olinetype->raw == 'bonu' && $r['bl']['lines_oLINETYPE'][$ll]->raw == 'forf'){\n $r['bl']['lines__bonu'][$ll] = $l;\n }\n if($olinetype->raw == 'assu' && $r['bl']['lines_oLINETYPE'][$ll]->raw == 'forf'){\n $r['bl']['lines__assu'][$ll] = $l;\n $r['_totassu']+= $r['bl']['lines_oTTC'][$l]->raw;\n if ($r['bl']['lines__annul'][$l] == true)\n $r['_totassuAnnul']+= $r['bl']['lines_oTTC'][$l]->raw;\n }\n }\n // utilisation avoirs et coupons\n if ($r['_tot2'] <= 0){\n $r['_tot2'] = 0;\n }\n /* -- vente de cartes seules -- */\n foreach($r['bl']['lines_oLINETYPE'] as $l=>$olinetype){\n if($r['bl']['lines_oLINETYPE'][$l]->raw == 'cart'){\n if (!isset($cartesfaites['_'.$l])){\n $r['_totcart']+= $r['bl']['lines_oTTC'][$l]->raw;\n $cartesfaites['_'.$l] = 1;\n $r['_cartesseules'][] = $l;\n }\n }\n }\n // calcul des totaux - annulations (pro)\n foreach(array('_tot1', '_tot2', '_totassu') as $tn){\n $r[$tn.'C'] = $r[$tn] - $r[$tn.'Annul'];\n }\n if ($firstday == NULL){\n $firstday = $r['do']['oFIRSTDAYSKI']->raw;\n }\n /* -- vente de cartes seules -- */\n $r['firstday'] = $firstday;\n $r['nodates'] = $nodates;\n /* -- cas des commandes pro -- */\n if ($this->customerIsPro()){\n $this->summarizeOrder($r);\n }\n\n return $r;\n }",
"function wc_sample_xml_get_line_items( $order ) {\n \n \t//connect\n \t\tUse Wp\n\t//output the product elements from the order\n\tforeach( $order->get_items() as $item_id => $item_data ) {\n \t\t $OrderId = $order->id; \n\t\t //grab the data we need\n\t$query = \"Request to grab data from bd based on the $OrderId\";\n\t\t $sql = $connexion->query($query);\t \n\t\t $curData = array();\n \t $count = 0;\n\n\t\t //data specific info for each line item\n\n while($Ca = $sql -> fetch()) {\n\t\t\t $curData[] = $Ca;\n\t\t\t $count ++;\n\t\t\t}\n\t\t\t//If the product ned some customizations before generating the xml\n \tif ($count >0){\n\t\t\t //Format the file name and replace spaces by \"-\"\n\t\t\t $titlePath = sanitize_title( trim($ItemName) );\n\t\t\t $title = $order_idmeta.'_order_item_generated';\n\t\t\t $filePath = content_url('/fancy_products_orders/images/'.$OrderId.'/'.$order_idmeta.'/'.$title.'.png');\n\t\t\t //If the item's image is not generated\n\t\t\t $urlLiveSite = 'http://www.yourWebsite.com/';\n\t\t\t $NofilePath = ($urlTestSite.'/'.$pathElement.'/'.$titlePath);\n\t\t\t //Check if the file physically exists\n\t\t\t if (file($filePath)) {\n\t\t\t $png_url = array('Source'\t=> $filePath);\n\t\t\t } \n\t\t\t else {\n\t\t\t $png_url = array('Source'\t=> $NofilePath);\n\t\t\t }\n\n\t\t$product = $order->get_product_from_item( $item_data );\n\t\t//This is the final xml customized \n\t\t$items[] = array(\n\t\t\t'LineNumber'\t\t\t\t=> $LineNumber,\n\t\t\t'ProductCode'\t\t\t\t=> $ProductCode,\n\t\t\t'ProductUPC'\t\t\t\t=> '0004-2478',\n\t\t\t'ItemDescription'\t\t\t=> $ItemName,\n\t\t\t'Quantity'\t\t\t\t\t=> $item_data['qty'],\n\t\t\t//we need to write a function that grabs the image URL, store the url as a variable and then pass it as the value here\n\t\t\t'FileList' \t\t\t=> $png_url,\n\t\t);\n\t } //end if\n\t} //end for\n}",
"private function _generateProductsData(){\n \n $products = $this->context->cart->getProducts();\n $pagseguro_items = array();\n \n $cont = 1;\n \n foreach ($products as $product) {\n \n $pagSeguro_item = new PagSeguroItem();\n $pagSeguro_item->setId($cont++);\n $pagSeguro_item->setDescription(Tools::truncate($product['name'], 255));\n $pagSeguro_item->setQuantity($product['quantity']);\n $pagSeguro_item->setAmount($product['price_wt']);\n $pagSeguro_item->setWeight($product['weight'] * 1000); // defines weight in gramas\n \n if ($product['additional_shipping_cost'] > 0)\n $pagSeguro_item->setShippingCost($product['additional_shipping_cost']);\n \n array_push($pagseguro_items, $pagSeguro_item);\n }\n \n return $pagseguro_items;\n }",
"public function run()\n {\n $priceList = [\n ['337','5 Refractarios de Vidrio y 5 tapas de plastico Glazé',1],\n ['338','5 Refractarios de Vidrio y 5 tapas de plastico Glazé',2],\n ['339','5 Refractarios de Vidrio y 5 tapas de plastico Glazé',4],\n ['340','5 Refractarios de Vidrio y 5 tapas de plastico Glazé',3],\n ['341','5 Refractarios de Vidrio y 5 tapas de plastico Glazé',1],\n ['369','Abanico de Techo Harbor Breeze',1],\n ['172','abanico de techo harbor breeze.',2],\n ['531','Abanico Harbor',1],\n ['168','Abanico Taurus',1],\n ['175','Abanico Taurus',1],\n ['179','Abanico Taurus',1],\n ['310','alaciadora con placas de ceramica timco.',1],\n ['311','alaciadora con placas de ceramica timco.',1],\n ['312','alaciadora con placas de ceramica timco.',1],\n ['335','Alaciadora Revlon',2],\n ['336','Alaciadora Revlon',3],\n ['152','Alaciadora Taurus.',4],\n ['153','Alaciadora Taurus.',2],\n ['154','Alaciadora Taurus.',3],\n ['155','Alaciadora Taurus.',4],\n ['253','Arrocera c/tapa Tramontina',2],\n ['254','Arrocera c/tapa Tramontina',1],\n ['418','Asador Outdoor trend',3],\n ['360','Aspiradora',1],\n ['423','Aspiradora Dirt Devil',2],\n ['449','Aspiradora Mikel¨S',3],\n ['490','Aspiradora Mikel¨S',2],\n ['134','audifonos stf sound',3],\n ['135','audifonos stf sound',4],\n ['136','audifonos stf sound',2],\n ['137','audifonos stf sound',4],\n ['138','audifonos stf sound',1],\n ['365','Audifonos STF Sound',4],\n ['397','Audifonos STF Sound',3],\n ['406','Audifonos STF Sound',2],\n ['421','Audifonos STF Sound',1],\n ['422','Audifonos STF Sound',3],\n ['558','Audifonos STF Sound',4],\n ['559','Audifonos STF Sound',2],\n ['560','Audifonos STF Sound',4],\n ['178','Azador de Carbón Outdoor Trend',1],\n ['9','Bafle Recargable (Bocina) Concierto mio',2],\n ['352','Bajilla Ebro (12pz)',3],\n ['353','Bajilla Ebro (12pz)',4],\n ['358','Bajilla Santa Anita (16pz)',2],\n ['371','Bandeja Rectangular PYR-O-REY',1],\n ['372','Bandeja Rectangular PYR-O-REY',3],\n ['429','Bandeja Rectangular PYR-O-REY',4],\n ['548','Baño de burbujas para pies Revlon',3],\n ['604','Baño de burbujas Revlon',1],\n ['373','Bateria CINSA (7pz)',2],\n ['534','Bateria CINSA (7pz)',3],\n ['6','Bateria de Cocina (9pz) Ekos',1],\n ['480','Bateria de Cocina (9pz) Ekos',3],\n ['481','Bateria de Cocina (9pz) Ekos',4],\n ['618','Bateria de cocina 20pz Main Stays',1],\n ['619','Bateria de cocina 20pz Main Stays',3],\n ['107','bateria ecko 9 pzs.',2],\n ['308','batidora de imersion sunbeam.',1],\n ['299','batidora de imersion taurus.',3],\n ['300','batidora de imersion taurus.',4],\n ['301','batidora de imersion taurus.',2],\n ['302','batidora de imersion taurus.',1],\n ['303','batidora de imersion taurus.',4],\n ['304','batidora de imersion taurus.',2],\n ['305','batidora de imersion taurus.',4],\n ['306','batidora de imersion taurus.',3],\n ['307','batidora de imersion taurus.',3],\n ['519','Batidora Tradition',1],\n ['367','Batidora Traditions',2],\n ['375','Batidora Traditions',4],\n ['376','Batidora Traditions',4],\n ['165','bocina bafle.',3],\n ['166','bocina bafle.',2],\n ['167','bocina bafle.',1],\n ['91','bocina bafle.?cm',3],\n ['99','bocina bafle.?cm',1],\n ['430','Bocina Bluetooth Kaiser',2],\n ['431','Bocina Bluetooth Kaiser',2],\n ['148','bocina green leaf.',1],\n ['171','bocina green leaf.',2],\n ['444','Bocina green leaf.',1],\n ['8','Bocina Inalambrica Green Leaf',1],\n ['468','Bocina Inalambrica Green Leaf',2],\n ['522','Bocina Logitech',2],\n ['128','bocinas logitech.',3],\n ['510','Bocinas logitech.',4],\n ['580','Bolsa Cosmetic Lab',4],\n ['581','Bolsa Cosmetic Lab',3],\n ['536','Bolsita negra Cosmetic Lab',4],\n ['552','Bolsita negra Cosmetic Lab',2],\n ['586','Bolsita negra Cosmetic Lab',2],\n ['662','Brochas 6pz',3],\n ['664','Brochas 6pz',4],\n ['663','Brochas 8pz',3],\n ['118','brown sunbeam',4],\n ['119','brown sunbeam',3],\n ['120','brown sunbeam',4],\n ['121','brown sunbeam',3],\n ['255','Cable Pasa Corriente 120 a 12 V cc 2.5 m multitop',4],\n ['256','Cable Pasa Corriente 120 a 12 V cc 2.5 m multitop',3],\n ['48','Cafetera Best Home',4],\n ['49','Cafetera Best Home',3],\n ['189','Cafetera Best Home',4],\n ['190','Cafetera Best Home',2],\n ['366','Cafetera Best Home',2],\n ['392','Cafetera Best Home',2],\n ['386','Cafetera Best Home',4],\n ['433','Cafetera Best Home',2],\n ['442','Cafetera Best Home',2],\n ['443','Cafetera Best Home',1],\n ['85','cafetera best home.',2],\n ['110','cafetera best home.',3],\n ['144','cafetera best home.',4],\n ['466','Cafetera de goteo Best Home',2],\n ['216','caja de herramientas 17\" truper.',3],\n ['217','caja de herramientas 17\" truper.',2],\n ['218','caja de herramientas 17\" truper.',4],\n ['489','Calefactor Best Home',1],\n ['57','Calefactor de halógeno Best Home',3],\n ['251','Calentador c/tapa de Vidrio CINSA 1.7 Litros',4],\n ['252','Calentador c/tapa de Vidrio CINSA 1.7 Litros',2],\n ['354','Calentón Best Home',1],\n ['361','Calentón Best Home',4],\n ['507','Calentón Best Home',2],\n ['374','Class Bows (5pz) Libbey',1],\n ['159','cobertor con borrega.',4],\n ['243','Cobertor Fusionado Estampado con Borrega Soft Sensations King Size',2],\n ['244','Cobertor Fusionado Estampado con Borrega Soft Sensations Matrimonial',1],\n ['113','cobijita cuadrada.',4],\n ['196','Colcha con cojin Mainstays',2],\n ['237','Colcha con Cojin Mainstays',2],\n ['229','colchon ortopedico individual master',3],\n ['230','colchon ortopedico individual master',4],\n ['231','Colchón Ortopedico Individual Master',2],\n ['232','Colchón Super Ortopedico Individual Master',1],\n ['233','Colchón Super Ortopedico Individual Master',3],\n ['535','Comedor',1],\n ['124','copa cristar 4 pzs.',2],\n ['125','copa cristar 4 pzs.',2],\n ['504','Copa cristar 4 pzs.',4],\n ['501','Copas cristar (4pz)',2],\n ['364','Copas de Cristal (4pz)',1],\n ['390','Copas de Cristal (4pz)',3],\n ['72','cortadora de cabello taurus',4],\n ['73','cortadora de cabello taurus',2],\n ['74','cortadora de cabello taurus',1],\n ['147','cortadora de cabello taurus',3],\n ['416','Cortadora de cabello taurus',4],\n ['425','cortadora de cabello taurus',2],\n ['426','cortadora de cabello taurus',1],\n ['440','cortadora de cabello taurus',3],\n ['470','Cortadora de cabello taurus',4],\n ['471','Cortadora de cabello taurus',4],\n ['520','Cortadora de cabello taurus',1],\n ['582','Cosmetiquera',3],\n ['583','Cosmetiquera',2],\n ['584','Cosmetiquera',3],\n ['585','Cosmetiquera',2],\n ['653','Cosmetiquera',1],\n ['659','Cosmetiquera',3],\n ['643','Cosmetiquera Cosmetic Lab',3],\n ['599','Cosmetiquera cristalina Cosmetic Lab',2],\n ['600','Cosmetiquera gris con blanco Cosmetic Lab',3],\n ['567','Cosmetiquera rosa Cosmetic Lab',2],\n ['568','Cosmetiquera rosa Cosmetic Lab',2],\n ['569','Cosmetiquera rosa Cosmetic Lab',3],\n ['570','Cosmetiquera rosa Cosmetic Lab',4],\n ['537','Cosmetiquera The Best',1],\n ['84','crock. Pot olla electrica.',3],\n ['546','Cuadro flotante Main Stayns 24 fotos (Blanco)',2],\n ['545','Cuadro flotante Main Stayns 24 fotos (Negro)',3],\n ['417','Cubiertos SK (16pz)',1],\n ['176','Delineadora de Barba Timco',1],\n ['645','Desarmador de trinquete Stanley',3],\n ['641','Desarmadores truper 5pz',1],\n ['642','Desarmadores truper 5pz',2],\n ['434','Duo Cups T-Fal',3],\n ['592','DVD con Karaoke',2],\n ['593','DVD con Karaoke',1],\n ['241','Edredón de Microfibra Matrimonial Mainstays',3],\n ['242','Edredón de Microfibra Matrimonial Mainstays',4],\n ['158','edredon mainstays.',5],\n ['191','Edredon Viajero',2],\n ['195','Edredon Viajero 926',3],\n ['235','Edredón Viajero NANO (1.15 x 1.50) mts beige',4],\n ['236','Edredón Viajero NANO (1.15 x 1.50) mts café',1],\n ['239','Edredrón Doble Vista Individual Essentails Home',2],\n ['240','Edredrón Doble Vista Individual Essentails Home',3],\n ['238','Edredrón Matrimonial Mainstays',4],\n ['414','Escurridor de platos',1],\n ['437','Escurridor de platos Hamilton Beach',2],\n ['438','Escurridor de platos Hamilton Beach',3],\n ['439','Escurridor de platos Hamilton Beach',4],\n ['633','Estuche de brochas 6pz',1],\n ['3','Estufa Acros',2],\n ['108','estufa para bufe black + decker.',3],\n ['1','Estufa Ranger IEM',4],\n ['385','Exprimidor electrico proctor siler',1],\n ['529','Exprimidor electrico proctor siler',2],\n ['530','Exprimidor electrico proctor siler',3],\n ['399','Frasada',1],\n ['400','Frasada',2],\n ['401','Frasada',3],\n ['402','Frasada',4],\n ['403','Frasada',1],\n ['404','Frasada',2],\n ['511','Frazada Main Stayns',3],\n ['538','Frazada Main Stayns',1],\n ['539','Frazada Main Stayns',2],\n ['540','Frazada Main Stayns',3],\n ['541','Frazada Main Stayns',4],\n ['566','Frazada Main Stayns',1],\n ['370','Frazada Mainstays',2],\n ['156','frazada mainstays.',4],\n ['157','frazada mainstays.',1],\n ['163','frazada mainstays.',2],\n ['112','frazada throw',3],\n ['245','Frazada Viajera NANO',4],\n ['219','hielera 12 latas 10.5 litros nyc.',1],\n ['220','hielera 12 latas 10.5 litros nyc.',2],\n ['486','hielera 12 latas nyc.',3],\n ['225','hielera 54 lata 45.5 litros nyc.',4],\n ['223','hielera coleman 34 litros',1],\n ['224','hielera coleman 34 litros',2],\n ['221','hielera igloo 11 litros',3],\n ['222','hielera igloo 11 litros',3],\n ['532','Horno Black and Decker',1],\n ['203','horno de microondas hamilton Beach.',2],\n ['180','Horno Electrico Best Home',3],\n ['487','Horno microondas Hamilton',4],\n ['350','Jarra y Vasos Crisa (5pz)',1],\n ['448','Jarra y Vasos Crisa (5pz)',2],\n ['459','Jarra y Vasos Crisa (7pz)',3],\n ['66','Jarra y Vasos Crisia (5pz)',4],\n ['184','Jarra y Vasos Crisia (7pz)',1],\n ['349','Juedo de Cubiertos Mainstays',2],\n ['26','Juego Crisa (8pz)',3],\n ['461','Juego Crisa (8pz)',3],\n ['602','Juego de 6 llaves pretul',1],\n ['647','Juego de 6 llaves pretul',2],\n ['101','juego de agua bassic',3],\n ['102','juego de agua bassic',4],\n ['379','Juego de Agua Bassic (7pz)',1],\n ['380','Juego de Agua Bassic (7pz)',2],\n ['395','Juego de agua Bassic (7pz)',3],\n ['419','Juego de Agua Bassic (7pz)',4],\n ['12','Juego de Agua Neptuno (7pz)',1],\n ['23','Juego de Agua Neptuno (7pz)',2],\n ['29','Juego de Agua Neptuno (7pz)',4],\n ['75','juego de agua neptuno 7 pzas.',1],\n ['76','juego de agua neptuno 7 pzas.',2],\n ['658','Juego de baño',3],\n ['660','Juego de baño',3],\n ['639','Juego de baño 7pz Aromanice',1],\n ['640','Juego de baño 7pz Aromanice',2],\n ['553','Juego de baño Aromanice',3],\n ['554','Juego de baño Aromanice',4],\n ['555','Juego de baño Aromanice',1],\n ['644','Juego de baño Aromanice',2],\n ['465','Juego de Bar de vidrio (8pz)',4],\n ['485','Juego de Bar de vidrio (8pz)',1],\n ['183','Juego de Bar Libbey (8pz)',1],\n ['505','Juego de Bar Libbey (8pz)',2],\n ['561','Juego de brochas 7pz Xpert Beauty',3],\n ['562','Juego de brochas 7pz Xpert Beauty',4],\n ['563','Juego de brochas 7pz Xpert Beauty',1],\n ['564','Juego de brochas 7pz Xpert Beauty',2],\n ['565','Juego de brochas 7pz Xpert Beauty',4],\n ['608','Juego de brochas 8pz',1],\n ['609','Juego de brochas 8pz',2],\n ['610','Juego de brochas 8pz',1],\n ['188','Juego de Cocina (4pz) Ekco',2],\n ['104','juego de cocina 4 pzs ecko.',4],\n ['405','Juego de Cubiertos (16pz)',1],\n ['257','Juego de Cubiertos (16pz) Mainstays',2],\n ['258','Juego de Cubiertos (16pz) Mainstays',3],\n ['259','Juego de Cubiertos (16pz) Mainstays',4],\n ['260','Juego de Cubiertos (16pz) Mainstays',1],\n ['261','Juego de Cubiertos (16pz) Mainstays',2],\n ['293','juego de cubiertos 16 pcs mainstays.',3],\n ['309','juego de cubiertos 16 pzas simple kitchen.',4],\n ['284','juego de cubiertos 16 pzs gibson.',1],\n ['285','juego de cubiertos 16 pzs gibson.',2],\n ['286','juego de cubiertos 16 pzs gibson.',4],\n ['287','juego de cubiertos 16 pzs gibson.',1],\n ['288','juego de cubiertos 16 pzs gibson.',2],\n ['289','juego de cubiertos 16 pzs gibson.',4],\n ['290','juego de cubiertos 16 pzs gibson.',1],\n ['291','juego de cubiertos 16 pzs gibson.',2],\n ['63','Juego de Cubiertos Sk (16pz)',3],\n ['64','Juego de Cubiertos Sk (16pz)',4],\n ['276','juego de cucharas 5 pzs para cocinar.',1],\n ['277','juego de cucharas 5 pzs para cocinar.',2],\n ['278','juego de cucharas 5 pzs para cocinar.',3],\n ['279','juego de cucharas 5 pzs para cocinar.',4],\n ['280','juego de cucharas 5 pzs para cocinar.',1],\n ['281','juego de cucharas 5 pzs para cocinar.',2],\n ['282','juego de cucharas 5 pzs para cocinar.',3],\n ['283','juego de cucharas 5 pzs para cocinar.',3],\n ['383','Juego de cuchillos top choice',4],\n ['488','Juego de cuchillos 12 piezas Tramontina',1],\n ['262','juego de cuchillos 4 pcs tramontina.',2],\n ['263','juego de cuchillos 4 pcs tramontina.',3],\n ['264','juego de cuchillos 4 pcs tramontina.',4],\n ['265','juego de cuchillos 4 pcs tramontina.',1],\n ['266','juego de cuchillos 4 pcs tramontina.',2],\n ['267','juego de cuchillos 4 pcs tramontina.',3],\n ['268','juego de cuchillos 4 pcs tramontina.',1],\n ['269','juego de cuchillos 4 pcs tramontina.',2],\n ['270','juego de cuchillos 4 pcs tramontina.',3],\n ['271','juego de cuchillos 4 pcs tramontina.',4],\n ['272','juego de cuchillos 4 pcs tramontina.',1],\n ['273','juego de cuchillos 4 pcs tramontina.',2],\n ['274','juego de cuchillos 4 pcs tramontina.',3],\n ['275','juego de cuchillos 4 pcs tramontina.',4],\n ['292','juego de cuchillos 4 pcs tramontina.',1],\n ['44','Juego de cuchillos Top Choice',2],\n ['182','Juego de cuchillos Top Choice',3],\n ['199','Juego de Cuchillos Top Choice',4],\n ['646','Juego de desarmador de puntas',1],\n ['638','Juego de desarmador truper',2],\n ['650','Juego de desatornillador truper',3],\n ['321','juego de herramientas 15 pzas workpro.',4],\n ['427','Juego de herramientas pretul (70pz)',1],\n ['428','Juego de herramientas pretul (70pz)',2],\n ['41','Juego de jarras y vasos crisa',3],\n ['42','Juego de jarras y vasos crisa',4],\n ['607','Juego de maquillaje 37pz',1],\n ['572','Juego de maquillaje 37pz C.L.',2],\n ['573','Juego de maquillaje 37pz C.L.',3],\n ['634','Juego de maquillaje 41pz',4],\n ['635','Juego de maquillaje 41pz',1],\n ['636','Juego de maquillaje 41pz',2],\n ['637','Juego de maquillaje 41pz',3],\n ['318','juego de peluqueria 18 pzas conair.',4],\n ['319','juego de peluqueria 18 pzas conair.',1],\n ['31','Juego de puntas p/desarmador Truper',2],\n ['32','Juego de puntas p/desarmador Truper',3],\n ['411','Juego de puntas y dados Truper (25pz)',4],\n ['193','Juego de recipientes Best Home (3pz)',1],\n ['194','Juego de recipientes Best Home (3pz)',1],\n ['67','Juego de Sartenes (3pz) Ecko',2],\n ['68','Juego de Sartenes (3pz) Ecko',3],\n ['69','Juego de Sartenes (3pz) Ecko',4],\n ['70','Juego de Sartenes (4pz) Ecko',1],\n ['477','Juego de servir Jarra con vaso',2],\n ['469','Juego de vasos (12pz) Main Stayns',3],\n ['478','Juego de vasos (6pz9 glaze',4],\n ['632','Juego de vasos 6pz Glaze',2],\n ['620','Juego de vasos 8pz Main Stays',3],\n ['621','Juego de vasos 8pz Main Stays',4],\n ['622','Juego de vasos 8pz Main Stays',3],\n ['623','Juego de vasos 8pz Main Stays',1],\n ['624','Juego de vasos 8pz Main Stays',2],\n ['625','Juego de vasos 8pz Vsantos',3],\n ['626','Juego de vasos 8pz Vsantos',4],\n ['627','Juego de vasos 8pz Vsantos',1],\n ['467','Juego de vasos de España (10pz) Santos',2],\n ['458','Juego de vasos Vsantos (10pz)',3],\n ['7','Juego de Vasos, Platos y Cucharas (12 pz) Santa Elenita',4],\n ['456','Juego para agua valencia (6pz)',1],\n ['38','Juguera Electrica Hometech',2],\n ['39','Juguera Electrica Hometech',3],\n ['71','Juguera Electrica Hometech',4],\n ['197','Juguera Electrica Hometech',1],\n ['457','Kit de peluqueria Timco (10pz)',2],\n ['116','lampara de buro best home.',3],\n ['435','lampara de buro best home.',3],\n ['4','Lavadora Acros',1],\n ['201','lavadora automatica daewo 14kg.',2],\n ['204','lavadora automatica daewo 19 kg.',3],\n ['200','lavadora automatica daewo 19kg.',4],\n ['143','licuadora americam',2],\n ['10','Licuadora American',1],\n ['20','Licuadora American',2],\n ['21','Licuadora American',1],\n ['22','Licuadora American',2],\n ['34','Licuadora American',3],\n ['36','Licuadora American',1],\n ['37','Licuadora American',2],\n ['462','Licuadora American',3],\n ['89','licuadora american.',4],\n ['142','licuadora oster',3],\n ['151','licuadora oster',1],\n ['177','Licuadora Oster',2],\n ['483','Licuadora Oster',3],\n ['198','Licuadora Taurus',4],\n ['359','Licuadora Taurus',1],\n ['388','Licuadora Taurus',2],\n ['574','Make up collection 89pz',3],\n ['575','Make up collection 89pz',4],\n ['579','Make up collection 89pz',1],\n ['576','Make up collection 96pz',2],\n ['577','Make up collection 96pz',3],\n ['578','Make up collection 96pz',4],\n ['226','maleta etco travel.',3],\n ['227','maleta etco travel.',1],\n ['174','Maleta LQ Chica',2],\n ['173','Maleta LQ Mediana',3],\n ['59','Manta de Polar Mainstays',4],\n ['60','Manta de Polar Mainstays',1],\n ['61','Manta de Polar Mainstays',2],\n ['342','Manta de Polar Mainstays',3],\n ['343','Manta de Polar Mainstays',4],\n ['344','Manta de Polar Mainstays',3],\n ['345','Manta de Polar Mainstays',4],\n ['346','Manta de Polar Mainstays',2],\n ['347','Manta de Polar Mainstays',3],\n ['348','Manta de Polar Mainstays',1],\n ['591','Manta de Polar Mainstays',2],\n ['652','Manta Mainstays azul',3],\n ['651','Manta Mainstays gris',4],\n ['648','Manta polar Azul',1],\n ['657','Manta polar café',2],\n ['656','Manta polar gris',3],\n ['649','Manta polar verde',4],\n ['398','Maquina para el cabello Timco',1],\n ['549','Maquina para palomitas sunbeam',2],\n ['603','Matraka con dados 16pz Santul',3],\n ['105','microondas daewoo.',2],\n ['106','microondas daewoo.',2],\n ['202','microondas daewoo.',2],\n ['249','Olla de Aluminio c/tapa Hometrends 1.9 litros',3],\n ['250','Olla de Aluminio c/tapa Hometrends 1.9 litros',4],\n ['247','Olla de Aluminio c/tapa Hometrends 2.8 litros',1],\n ['248','Olla de Aluminio c/tapa Hometrends 2.8 litros',2],\n ['246','Olla de Aluminio c/tapa Hometrends 4.7 litros',3],\n ['160','olla de coccion lenta black & decker.',4],\n ['492','olla de lento cocimiento Black and decker',1],\n ['473','Olla de lento cocimiento hamilton beach',2],\n ['464','Olla Lento Cocimiento Black Decker',3],\n ['181','Olla Lento Cocimiento Hamilton Beach',4],\n ['378','Olla Lento Cocimiento Hamilton Beach',1],\n ['187','Parrilla Electrica Michel',2],\n ['368','Parrilla Electrica Michel',3],\n ['77','parrilla electrica michel.',4],\n ['149','parrilla electrica taurus',1],\n ['150','parrilla electrica taurus',2],\n ['377','Parrilla Michel',3],\n ['82','parrillera electrica michel.',4],\n ['408','Perfiladora tauros',1],\n ['409','Perfiladora tauros',2],\n ['410','Perfiladora tauros',3],\n ['11','Plancha Black & Decker',4],\n ['14','Plancha Black & Decker',1],\n ['15','Plancha Black & Decker',2],\n ['16','Plancha Black & Decker',3],\n ['17','Plancha Black & Decker',4],\n ['18','Plancha Black & Decker',1],\n ['78','plancha black & decker.',2],\n ['79','plancha black & decker.',3],\n ['80','plancha black & decker.',4],\n ['103','plancha black & decker.',1],\n ['19','Plancha Taurus',2],\n ['122','plancha taurus.',3],\n ['123','plancha taurus.',4],\n ['500','Platos Crisa (12pz)',1],\n ['43','Platos elite (3pz)',2],\n ['450','Platos porcelana elit (3pz)',3],\n ['30','Proctor Silex (exprimidor)',4],\n ['384','Rasuradora timco Men',1],\n ['407','Razones crisa (8pz)',2],\n ['357','Recamara',3],\n ['451','Recipientes Best Home (3pz)',4],\n ['313','recortadora de barba y bigote conair.',1],\n ['314','recortadora de barba y bigote conair.',2],\n ['315','recortadora de barba y bigote conair.',3],\n ['316','recortadora de barba y bigote conair.',4],\n ['317','recortadora de barba y bigote conair.',1],\n ['320','recortadora de barba y bigote conair.',2],\n ['514','Recortadora de barba y bigote conair.',2],\n ['2','Refrigerador Mabe',3],\n ['542','Reloj de pared',4],\n ['590','Reloj Home Trends',1],\n ['322','rizador de cabello taurus.',2],\n ['323','rizador de cabello taurus.',3],\n ['324','rizador de cabello taurus.',4],\n ['325','rizador de cabello taurus.',1],\n ['326','rizador de cabello taurus.',2],\n ['327','rizador de cabello taurus.',3],\n ['328','rizador de cabello taurus.',1],\n ['329','rizador de cabello taurus.',2],\n ['330','rizador de cabello taurus.',3],\n ['331','rizador de cabello taurus.',1],\n ['362','Ropero',2],\n ['50','Sandwichera Black & Decker',4],\n ['62','Sandwichera Black & Decker',4],\n ['81','sandwichera black and decker',3],\n ['40','Santa Elenita (16pz)',2],\n ['52','Sarten electrico Holstein',1],\n ['351','Sarten electrico Holstein',4],\n ['356','Secadora Conair',3],\n ['139','secadora conair.',3],\n ['140','secadora conair.',1],\n ['332','Secadora Mediana Conair',2],\n ['333','Secadora Mediana Conair',3],\n ['334','Secadora Mediana Conair',4],\n ['164','secadora timco.',1],\n ['297','set de accesorios para asar 3 pzas acero inoxidable.',2],\n ['298','set de accesorios para asar 3 pzas acero inoxidable.',3],\n ['296','set de accesorios para asar 3 pzas. Acero inoxidable.',4],\n ['294','set de accesorios para asar 3 pzas. Outdoor trend',1],\n ['295','set de accesorios para asar 3 pzas. Outdoor trend',2],\n ['571','Set de brochas 6pz Cosmetic Lab',3],\n ['543','Set de cubiertos 24 piezas',4],\n ['544','Set de cubiertos 24 piezas',1],\n ['594','Set de cuchillos Acero Inoxidable',2],\n ['595','Set de cuchillos Acero Inoxidable',3],\n ['596','Set de cuchillos Acero Inoxidable',2],\n ['493','Set de tazas (3pz) Main Stayns',1],\n ['192','Set de Tazones (3pz)',2],\n ['513','Set de Tazones (3pz) Main Stayns',3],\n ['598','Set de tazones 3pz',4],\n ['631','Set de tazones 3pz Main Stays',1],\n ['460','Set de Tazones Mainstays (3pz)',2],\n ['661','Set de utencilios Backyard Grill',4],\n ['597','Set de utencilios de bambu',4],\n ['654','Set de utencilios de bambu',3],\n ['655','Set de utencilios de bambu',1],\n ['611','Set de vaso 8 pz Crisa',2],\n ['612','Set de vaso 8 pz Crisa',3],\n ['613','Set de vaso 8 pz Crisa',4],\n ['614','Set de vaso 8 pz Crisa',1],\n ['615','Set de vaso 8 pz Crisa',2],\n ['517','Set Oasis (2pz)',3],\n ['605','Silla mariposa Main Stays',4],\n ['606','Silla mariposa Main Stays',1],\n ['5','Smart TV RCA 40\"',2],\n ['228','sofacama hometrends.',3],\n ['601','Stanley Control Grip 29pz',4],\n ['382','Tablet tech pad \"7\"',1],\n ['387','Tablet tech pad \"7\"',2],\n ['455','Tablet tech pad \"7\"',3],\n ['518','Tablet tech pad \"7\"',4],\n ['129','tablet tech pad 7\"',1],\n ['130','tablet tech pad 7\"',4],\n ['131','tablet tech pad 7\"',3],\n ['132','tablet tech pad 7\"',2],\n ['133','tablet tech pad 7\"',1],\n ['412','tazones crisa',4],\n ['413','tazones crisa',3],\n ['420','Tazones crisa (8pz)',2],\n ['452','Tazones crisa (8pz)',1],\n ['497','Tazones crisa (8pz)',4],\n ['90','tazones crisa 8 pzas.',3],\n ['92','tazones crisa 8 pzas.',2],\n ['56','Tazones de Vidrio Crisa',1],\n ['415','Tazones Maintavs (3pz)',4],\n ['441','Tazones Maintavs (3pz)',3],\n ['498','Tazones Maintays (3pz)',2],\n ['234','Televición Led Smart FHD TV 40\" RCA',1],\n ['215','television orizzonte 43\" smart.',4],\n ['205','television quaroni 32\" led.',3],\n ['206','television quaroni 32\" led.',2],\n ['207','television quaroni 32\" led.',1],\n ['208','television quaroni 32\" led.',2],\n ['209','television quaroni 32\" led.',4],\n ['210','television quaroni 32\" led.',2],\n ['211','television quaroni 32\" led.',3],\n ['212','television quaroni 32\" led.',4],\n ['213','television quaroni 32\" led.',2],\n ['214','television quaroni 32\" led.',4],\n ['111','tetera best home.',1],\n ['33','Tetera Electrica RCA',2],\n ['35','Tetera RCA',1],\n ['169','Tetera RCA',3],\n ['393','Tetera RCA',1],\n ['463','Tetera RCA',2],\n ['117','t-fal duo cups.',2],\n ['355','Tostador Best Home',3],\n ['479','Tostador de pan Taurus',1],\n ['145','tostador taurus',2],\n ['185','Tostador Taurus',3],\n ['186','Tostador Taurus',4],\n ['550','Tres espejos Home creations',1],\n ['551','Tres espejos Home creations',2],\n ['484','Vajilla (12pz) Bormioli',3],\n ['491','Vajilla (12pz) Crisa',4],\n ['51','Vajilla (12pz) Venecia',1],\n ['474','Vajilla (12pz)Bormioli',2],\n ['616','Vajilla 12pz Andalucita',3],\n ['617','Vajilla 12pz Home Gallery',4],\n ['503','Vajilla Bicrila (12pz)',1],\n ['502','Vajilla Crisa (12pz)',2],\n ['556','Vajilla Crisa (12pz)',3],\n ['557','Vajilla Crisa (8pz)',4],\n ['630','Vajilla de porcelana 12pz Home Gallery',1],\n ['628','Vajilla de vidrio 12pz crisa',2],\n ['629','Vajilla de vidrio 12pz crisa',3],\n ['446','Vajilla Ebro (12pz)',3],\n ['447','Vajilla Ebro (12pz)',1],\n ['472','vajilla para 4 personas opal glass',1],\n ['476','Vajilla para 5 personas Bormioli',3],\n ['58','Vajilla Santa Elenita (16pz)',2],\n ['88','vajilla venecia 12 pzas.',1],\n ['93','vajilla venecia 12 pzas.',1],\n ['94','vajilla venecia 12 pzas.',2],\n ['98','vajilla venecia 12 pzas.',3],\n ['516','vajilla venecia 12 pzas.',4],\n ['65','Vajilla Vicria (12pz)',1],\n ['389','Vajilla vicrila (12pz)',2],\n ['432','Vajilla vicrila (12pz)',3],\n ['521','Vajillas Santa Anita (16pz)',4],\n ['127','vallija 12 pzs crisa.',1],\n ['547','Vaporera 5.2 lts Hammilton',2],\n ['496','Vaso Bassic (8pz)',3],\n ['53','Vasos (6pz) Bassic',4],\n ['54','Vasos (6pz) Bassic',2],\n ['55','Vasos (6pz) Bassic',1],\n ['24','Vasos (8pz) Bassic',3],\n ['25','Vasos (8pz) Bassic',1],\n ['13','Vasos (8pz) Crisa',3],\n ['391','Vasos Bassic (6pz)',4],\n ['394','Vasos Bassic (6pz)',3],\n ['396','Vasos Bassic (6pz)',1],\n ['436','Vasos Bassic (8pz)',4],\n ['445','Vasos Bassic (8pz)',4],\n ['515','Vasos Bassic (8pz)',4],\n ['170','vasos bassic 6 pzas.',1],\n ['87','vasos bassic 8 pzas.',2],\n ['95','vasos bassic 8 pzas.',3],\n ['28','Vasos Crisa (8pz)',1],\n ['161','Vasos Crisa (8pz)',2],\n ['162','Vasos Crisa (8pz)',3],\n ['83','vasos crisa 8 pzas.',1],\n ['86','vasos crisa 8 pzas.',2],\n ['96','vasos crisa 8 pzas.',3],\n ['97','vasos crisa 8 pzas.',1],\n ['100','vasos crisa 8 pzas.',1],\n ['146','vasos crisa 8 pzas.',2],\n ['424','Vasos España (10pz)',3],\n ['499','Vasos España (10pz)',1],\n ['509','Vasos España (10pz)',2],\n ['512','Vasos España (10pz)',3],\n ['381','Vasos glaze',1],\n ['453','Vasos Glaze (6pz)',2],\n ['454','Vasos Glaze (6pz)',1],\n ['494','Vasos Glaze (6pz)',2],\n ['495','Vasos Glaze (6pz)',1],\n ['506','Vasos Glaze (6pz)',2],\n ['508','Vasos Glaze (6pz)',1],\n ['523','Vasos glaze (6pz)',4],\n ['524','Vasos glaze (6pz)',3],\n ['525','Vasos glaze (6pz)',2],\n ['526','Vasos glaze (6pz)',3],\n ['527','Vasos glaze (6pz)',4],\n ['528','Vasos glaze (6pz)',2],\n ['533','Vasos Glaze (6pz)',3],\n ['45','Vasos Glazé (6pz)',4],\n ['46','Vasos Glazé (6pz)',2],\n ['47','Vasos Glazé (6pz)',3],\n ['114','vasos glazé 6 pzs',4],\n ['115','vasos glazé 6 pzs',2],\n ['126','vasos glazé 6 pzs',3],\n ['141','vasos glazé 6 pzs',2],\n ['109','vasos vicrila 8 pzas.',3],\n ['363','Ventilador Taurus',2],\n ['27','Vitrolero (3 tLts)',3],\n ['482','Vitrolero practico Jema flex',2],\n ['587','Zapatero 2 niveles',3],\n ['588','Zapatero 2 niveles',2],\n ['589','Zapatero 2 niveles',3],\n ['475','Juego de 6 vasos de cristal',4]\n ];\n\n foreach ($priceList as $key => $priceName) {\n Prize::create([\n 'article_no' => $priceName[0],\n 'name' => $priceName[1],\n 'batch' => $priceName[2],\n ]);\n }\n }",
"public function getCssCustomProduct()\n {\n return Mage::getStoreConfig('splitprice/split_price_presentation/css_product');\n }",
"public function getProductSaveInfo($product, $data) {\n $product->setColor ( $data [11] );\n $product->setCost ( $data [12] );\n $product->setCountry ( $data [13] );\n $product->setCountryOfManufacture ( $data [14] );\n $product->setCreatedAt ( $data [15] );\n $product->setDescription ( $data [20] );\n $product->setEnableGooglecheckout ( $data [21] );\n $product->setGallery ( $data [22] );\n $product->setGiftMessageAvailable ( $data [23] );\n $product->setHasOptions ( $data [24] );\n $product->setHostemail ( $data [25] );\n $product->setHouserule ( $data [26] );\n $product->setImage ( $data [27] );\n $product->setImageLabel ( $data [28] );\n $product->setMediaGallery ( $data [30] );\n $product->setMinimalPrice ( $data [34] );\n $product->setMsrp ( $data [35] );\n $product->setMsrpDisplayActualPriceType ( $data [36] );\n $product->setMsrpEnabled ( $data [37] );\n $product->setName ( $data [38] );\n $product->setNewsFromDate ( strtotime ( $data [39] ) );\n $product->setNewsToDate ( '' );\n if (isset ( $data [41] )) {\n $product->setOptionsContainer ( $data [41] );\n }\n if (isset ( $data [43] )) {\n $product->setPrice ( $data [43] );\n }\n if (isset ( $data [44] )) {\n $product->setPrivacy ( $data [44] );\n }\n if (isset ( $data [45] )) {\n $product->setPropertyadd ( $data [45] );\n }\n if (isset ( $data [46] )) {\n $product->setPropertytype ( $data [46] );\n }\n if (isset ( $data [47] )) {\n $product->setPropertyWebsite ( $data [47] );\n }\n if (isset ( $data [48] )) {\n $product->setRequiredOptions ( $data [48] );\n }\n if (isset ( $data [49] )) {\n $product->setShortDescription ( $data [49] );\n }\n if (isset ( $data [50] )) {\n $product->setSmallImage ( $data [50] );\n }\n if (isset ( $data [51] )) {\n $product->setSmallImageLabel ( $data [51] );\n }\n if (isset ( $data [52] )) {\n $product->setSpecialFromDate ( $data [52] );\n }\n if (isset ( $data [53] )) {\n $product->setSpecialPrice ( $data [53] );\n }\n if (isset ( $data [54] )) {\n $product->setSpecialToDate ( $data [54] );\n }\n if (isset ( $data [55] )) {\n $product->setStatus ( $data [55] );\n }\n if (isset ( $data [56] )) {\n $product->setTaxClassId ( $data [56] );\n }\n if (isset ( $data [57] )) {\n $product->setThumbnail ( $data [57] );\n } \n return $product;\n }",
"public function price_table() {\n\t\tif ( $this->coming_soon ) {\n\t\t\treturn;\n\t\t}\n\n\t\t$out[] = '<script>jQuery( document ).ready(function() {jQuery( \".edd-add-to-cart-label\" ).html( \"Choose\" );});</script>';\n\t\t$out[] = sprintf( '<!--Pricing Table Section--><section id=\"pricing\"><div class=\"container\">\n<div class=\"container\">%1s</div>', $this->purchase_cta());\n\t\t$i = 1;\n\t\tforeach( $this->pricing() as $price ) {\n\t\t\t$out[] = sprintf(\n\t\t\t\t'<div class=\"col-lg-4 col-md-4 col-sm-12 col-xs-12 pricing-box\">\n\t\t\t\t\t<div id=\"price-%0s\" class=\"bggray price\">\n\t\t\t\t\t\t<div class=\"package\">%1s</div>\n\t\t\t\t\t\t<div class=\"divider\"></div>\n\t\t\t\t\t\t<div class=\"amount\">$%2s</div>\n\t\t\t\t\t\t<div class=\"duration\">%3s</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"featcontent\">\n\t\t\t\t\t\t%4s\n\t\t\t\t\t</div>\n\t\t\t\t</div>',\n\t\t\t\t$i,\n\t\t\t\t$price[ 'level' ],\n\t\t\t\t$price[ 'amount' ],\n\t\t\t\t$price[ 'sites' ],\n\t\t\t\t$price[ 'link' ]\n\t\t\t);\n\t\t\t$i++;\n\n\t\t}\n\n\t\t$out[] = '</div></section>';\n\n\t\treturn implode( '', $out );\n\n\t}",
"private function HTML_SumUp_Price() : string\n {\n return $this->HTML_TxPart(\n 'Prix ' . ($this->infos['tx_type'] == 'buy' ? 'd\\'achat' : 'de vente'),\n self::AutoFloatFormat($this->infos['tx_price']) . ' ' . $this->Index()->infos['symbol']\n );\n }"
]
| [
"0.5706712",
"0.5511237",
"0.5510589",
"0.5443353",
"0.54194796",
"0.53943783",
"0.5340442",
"0.53276503",
"0.5318903",
"0.52887887",
"0.5229765",
"0.5181606",
"0.5166354",
"0.51449585",
"0.51226646",
"0.51155376",
"0.5095597",
"0.5092357",
"0.50828147",
"0.5054158",
"0.5052926",
"0.5045726",
"0.50442857",
"0.5013255",
"0.5012708",
"0.5002795",
"0.49939293",
"0.49822685",
"0.49662358",
"0.49613354"
]
| 0.6910343 | 0 |
Builds an XML Map used to parse listeners from an XML source | protected function xmlListenersMapFactory()
{
$map = new Map();
$map->add(
Path::factory('/fwk/listener', 'listeners')
->loop(true)
->attribute('class')
->attribute('service')
->addChildren(
Path::factory('param', 'params')
->attribute('name')
->filter(array($this, 'propertizeString'))
->value('value')
->loop(true)
)
);
return $map;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function build_xml_map() {\n $this->_create_map();\n header(\"content-type: text/xml\");\n echo $this->result;\n }",
"protected function xmlServicesMapFactory()\n {\n $map = new Map();\n $map->add(\n Path::factory('/fwk/services', 'services', array())\n ->loop(true, '@xml')\n ->attribute('xmlMap')\n );\n \n return $map;\n }",
"protected function xmlPluginsMapFactory()\n {\n $map = new Map();\n $map->add(\n Path::factory('/fwk/plugin', 'plugins')\n ->loop(true)\n ->attribute('class')\n ->attribute('service')\n ->addChildren(\n Path::factory('param', 'params')\n ->attribute('name')\n ->filter(array($this, 'propertizeString'))\n ->value('value')\n ->loop(true)\n )\n );\n\n return $map;\n }",
"public static function getMap() {\n\t\t$map = array (\"SendListener\" => \"sendPerformed\", \"BeforeSendListener\" => \"beforeSendPerformed\", \"CommandListener\" => \"commandSent\", \"BeforeCommandListener\" => \"beforeCommandSent\", \"ResponseListener\" => \"responseReceived\", \"ConnectListener\" => \"connectPerformed\", \"DisconnectListener\" => \"disconnectPerformed\" );\n\t\treturn $map;\n\t}",
"protected static function buildEventMaps()\n {\n \\Log::info('Building event cache');\n\n // Build event mapping from services in database\n\n //\tInitialize the event map\n $processEventMap = [];\n $broadcastEventMap = [];\n\n // Pull any custom swagger docs\n $result = ServiceModel::with(\n [\n 'serviceDocs' => function ($query){\n $query->where('format', ApiDocFormatTypes::SWAGGER);\n }\n ]\n )->get();\n\n //\tSpin through services and pull the events\n foreach ($result as $service) {\n $apiName = $service->name;\n try {\n if (empty($content = ServiceModel::getStoredContentForService($service))) {\n throw new \\Exception(' * No event content found for service.');\n continue;\n }\n\n $serviceEvents = static::parseSwaggerEvents($apiName, $content);\n\n //\tParse the events while we get the chance...\n $processEventMap[$apiName] = ArrayUtils::get($serviceEvents, 'process', []);\n $broadcastEventMap[$apiName] = ArrayUtils::get($serviceEvents, 'broadcast', []);\n\n unset($content, $service, $serviceEvents);\n } catch (\\Exception $ex) {\n \\Log::error(\" * System error building event map for service '$apiName'.\\n{$ex->getMessage()}\");\n }\n }\n\n static::$eventMap = ['process' => $processEventMap, 'broadcast' => $broadcastEventMap];\n\n //\tWrite event cache file\n \\Cache::forever(static::EVENT_CACHE_KEY, static::$eventMap);\n\n \\Log::info('Event cache build process complete');\n }",
"public function getXMLPageMap() {\n\t\tstatic $xml;\n\n\t\tif (isset($xml)) return $xml;\n\t\t$cache = SA_SimpleCache::singleton('__XML_PAGES_MAP__');\n\t\tif ($xmlString = $cache->load()) {\n\t\t\t$xml = new SimpleXMLElement($xmlString);\n\t\t} else {\n\t\t\t$xml = new SimpleXMLElement('<?xml version=\"1.0\" standalone=\"yes\"?><pages/>');\n\t\t\t$this->xmlFileSystem($this->getPagesDir(), $xml);\n\t\t\t$cache->save($xml->asXML());\n\t\t}\n\t\treturn $xml;\n\t}",
"protected function xmlActionMapFactory()\n {\n $map = new Map();\n $map->add(\n Path::factory('/fwk/actions/action', 'actions')\n ->loop(true, '@name')\n ->attribute('class')\n ->attribute('method')\n ->attribute('shortcut')\n );\n \n return $map;\n }",
"protected function xmlIniMapFactory()\n {\n $map = new Map();\n $map->add(\n Path::factory('/fwk/ini', 'ini', array())\n ->loop(true)\n ->attribute('category')\n ->value('value')\n );\n \n return $map;\n }",
"function get_listener_config_data() {\n $config_file = file_get_contents('config.xml');\n $config_xml = new SimpleXMLElement($config_file);\n $location = $config_xml->path;\n if (empty($location)) {\n //try using a default\n $location = '/opt/php_listeners';\n }\n $services = $config_xml->services->service;\n return array('location' => $location, 'services' => $services);\n}",
"protected function _getDomMap()\n {\n $domMap = parent::_getDomMap();\n $domMap = reset($domMap);\n\n return [\n 'initSubscriptionResponse' => array_merge([\n 'transactionId' => 'transactionId',\n 'subscriptionPageUrl' => 'subscriptionPageUrl',\n 'status' => 'status',\n ], $domMap)\n ];\n }",
"public function init_from_xml($xml, $from = Bean::SOURCE_STRING)\n {\n if($from == Bean::SOURCE_URL || $from == Bean::SOURCE_FILE)\n {\n $xdom = @simplexml_load_file($xml);\n }\n if($from == Bean::SOURCE_STRING)\n {\n $xdom = @simplexml_load_string($xml);\n }\n\n foreach($xdom as $key => $val)\n {\n $this->set($key,$val); \n } \n }",
"protected function parseEventsXML(&$observers, $eventsFile, $key)\n {\n $xml = simplexml_load_file($eventsFile);\n foreach ($xml->children()->event as $event) {\n $observer = [];\n $observer['name'] = (string) $event['name'];\n $observer['instance'] = (string) $event->observer['instance'];\n\n $observers[$key][] = $observer;\n }\n\n // Update the totals\n $observers[\"total_{$key}\"] = count($observers[$key]);\n $observers['total'] = $observers['total'] + $observers[\"total_{$key}\"];\n }",
"protected function parseXmlNode(\\DOMElement $node, $map) {\n /** @var \\DOMElement $attribute */\n $attribute = $node->firstChild;\n $result = [];\n do {\n $name = $attribute->localName;\n if (isset($map['sourceMap'][$name])) {\n foreach($map['sourceMap'][$name] as $target) {\n //pass null since we do not have implemented $row yes to pass to normalize\n $value = $this->normalize($attribute->nodeValue, $map['map'][$target]['type'], $node);\n\n if (isset($result[$target])) {\n switch ($map['map'][$target]['multiple']) {\n case 'array': if (is_array($result[$target])) {\n $result[$target][] = $value;\n } else {\n $result[$target] = [$result[$target], $value];\n }\n break;\n case 'last':\n $result[$target] = $value;\n break;\n default:\n throw new \\Exception(\"Unknown value for multiple: {$map['map'][$target]['multiple']}\");\n\n }\n } else {\n $result[$target] = $value;\n }\n }\n }\n } while(null !== $attribute = $attribute->nextSibling);\n foreach($map['map'] as $target => $def) {\n if (!isset($result[$target])) {\n $result[$target] = null;\n }\n }\n return $result;\n }",
"protected static function buildEventMaps()\n {\n \\Log::info('Building event cache');\n\n // Build event mapping from services in database\n\n //\tInitialize the event map\n $eventMap = [];\n\n // Pull any custom swagger docs\n $result = ServiceModel::whereIsActive(true)->get();\n\n //\tSpin through services and pull the events\n /** @var ServiceModel $model */\n foreach ($result as $model) {\n $apiName = $model->name;\n try {\n /** @var BaseRestService $service */\n if (empty($service = ServiceManager::getService($apiName))) {\n throw new \\Exception('No service found.');\n }\n\n if ($service instanceof FileServiceInterface) {\n // don't want the full folder list here\n $accessList = (empty($service->getPermissions()) ? [] : ['', '*']);\n } else {\n $accessList = $service->getAccessList();\n }\n\n if (!empty($accessList)) {\n if (!empty($doc = $model->getDocAttribute())) {\n if (is_array($doc) && !empty($content = array_get($doc, 'content'))) {\n if (is_string($content)) {\n $content = ServiceModel::storedContentToArray($content, array_get($doc, 'format'),\n $model);\n if (!empty($content)) {\n $eventMap[$apiName] = static::parseSwaggerEvents($content, $accessList);\n }\n }\n }\n }\n }\n } catch (\\Exception $ex) {\n \\Log::error(\" * System error building event map for service '$apiName'.\\n{$ex->getMessage()}\");\n }\n\n unset($content, $service, $serviceEvents);\n }\n\n static::$eventMap = $eventMap;\n\n \\Log::info('Event cache build process complete');\n }",
"function parse_application_events($file)\r\n {\r\n $doc = new DOMDocument();\r\n $result = array();\r\n\r\n $doc->load($file);\r\n $object = $doc->getElementsByTagname('application')->item(0);\r\n $result['name'] = $object->getAttribute('name');\r\n\r\n // Get events\r\n $events = $doc->getElementsByTagname('event');\r\n $trackers = array();\r\n\r\n foreach ($events as $index => $event)\r\n {\r\n $event_name = $event->getAttribute('name');\r\n $trackers = array();\r\n\r\n // Get trackers in event\r\n $event_trackers = $event->getElementsByTagname('tracker');\r\n $attributes = array('name', 'active');\r\n\r\n foreach ($event_trackers as $index => $event_tracker)\r\n {\r\n $property_info = array();\r\n\r\n foreach ($attributes as $index => $attribute)\r\n {\r\n if ($event_tracker->hasAttribute($attribute))\r\n {\r\n $property_info[$attribute] = $event_tracker->getAttribute($attribute);\r\n }\r\n }\r\n $trackers[$event_tracker->getAttribute('name')] = $property_info;\r\n }\r\n\r\n $result['events'][$event_name]['name'] = $event_name;\r\n $result['events'][$event_name]['trackers'] = $trackers;\r\n }\r\n\r\n return $result;\r\n }",
"function xml_to_array()\r\n {\r\n $output=array();\r\n \r\n foreach($this->xpath_map as $key=>$value)\r\n {\r\n $output[$key]=$value['data'];\r\n }\r\n \r\n return $output;\r\n }",
"private function _getXSIMap($actionParam){\n\t\t$arrayMap = array();\n\t\tforeach($actionParam->childNodes as $item){\n\t\t\tif($item->nodeType==1){\n\t\t\t\tif($item->localName=='item'){\n\t\t\t\t\t$index = null;\n\t\t\t\t\t$value = null;\n\t\t\t\t\tforeach($item->childNodes as $node){\n\t\t\t\t\t\tif($node->nodeType==1){\n\t\t\t\t\t\t\tif($node->localName=='key'){\n\t\t\t\t\t\t\t\t$index = (string) $node->nodeValue;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tif($node->localName=='value'){\n\t\t\t\t\t\t\t\t\t$paramType = $node->getAttributeNS($this->_xmlSchemaNamespace, 'type');\n\t\t\t\t\t\t\t\t\tif($this->_isTypeLiteral($paramType)==true){\n\t\t\t\t\t\t\t\t\t\t$value = $this->_decodeXSDType($paramType, $node->nodeValue);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tif($paramType=='ns2:Map'){\n\t\t\t\t\t\t\t\t\t\t\t$value = $this->_getXSIMap($node);\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\tif($paramType=='SOAP-ENC:Array'||$paramType=='enc:Array'){\n\t\t\t\t\t\t\t\t\t\t\t\t$value = $this->_getSoapArray($node);\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\t$value = null;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif($index!==null){\n\t\t\t\t\t\t$arrayMap[$index] = $value;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$arrayMap[] = $value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $arrayMap;\n\t}",
"abstract protected function buildMap();",
"function begin_xml() {\n\t\tglobal $pgv_lang, $factarray;//, $eventsArray, $dom, $ePeople, $this->eFams, $egSources, $ePlaces, $eObject;\n\t\t$user = PGV_USER_NAME;\n\n\t\t$this->dom = new DomDocument(\"1.0\", \"UTF-8\");\n\t\t$this->dom->formatOutput = true;\n\n\t\t$eRoot = $this->dom->createElementNS(\"http://gramps-project.org/xml/1.1.0/\", \"database\");\n\t\t$eRoot = $this->dom->appendChild($eRoot);\n\n\t\t$eHeader = $this->dom->createElement(\"header\");\n\t\t$eHeader = $eRoot->appendChild($eHeader);\n\n\t\t$eCreated = $this->dom->createElement(\"created\");\n\t\t$eCreated = $eHeader->appendChild($eCreated);\n\t\t$eCreated->setAttribute(\"date\", date(\"Y-m-d\"));\n\t\t$eCreated->setAttribute(\"version\", \"1.1.2.6\");\n\n\t\t$eResearcher = $this->dom->createElement(\"researcher\");\n\t\t$eResname = $this->dom->createElement(\"resname\");\n\t\t$etResname = $this->dom->createTextNode(getUserFullName($user));\n\t\t$etResname = $eResname->appendChild($etResname);\n\t\t$eResname = $eResearcher->appendChild($eResname);\n\t\t$eResemail = $this->dom->createElement(\"resemail\");\n\t\t$etResemail = $this->dom->createTextNode(get_user_setting($user, 'email'));\n\t\t$etResemail = $eResemail->appendChild($etResemail);\n\t\t$eResemail = $eResearcher->appendChild($eResemail);\n\t\t$eResearcher = $eHeader->appendChild($eResearcher);\n\n\t\t$this->egEvents = $this->dom->createElement(\"events\");\n\t\t$this->egEvents = $eRoot->appendChild($this->egEvents);\n\n\t\t$this->ePeople = $this->dom->createElement(\"people\");\n\t\t$this->ePeople = $eRoot->appendChild($this->ePeople);\n\n\t\t$this->eFams = $this->dom->createElement(\"families\");\n\t\t$this->eFams = $eRoot->appendChild($this->eFams);\n\n\t\t$this->egSources = $this->dom->createElement(\"sources\");\n\t\t$this->egSources = $eRoot->appendChild($this->egSources);\n\n\t\t$this->ePlaces = $this->dom->createElement(\"places\");\n\t\t$this->ePlaces = $eRoot->appendChild($this->ePlaces);\n\n\t\t$this->eObject = $this->dom->createElement(\"objects\");\n\t\t$this->eObject = $eRoot->appendChild($this->eObject);\n\t}",
"private function generateMaps(): void\n {\n $this->socketMap = $this->streamMap = [\n self::RESOURCE => [\n self::READ => [],\n self::WRITE => []\n ],\n self::HANDLER => [\n self::READ => [],\n self::WRITE => []\n ]\n ];\n\n $socketCount = $streamCount = 0;\n\n\n\n // Sockets\n foreach ($this->sockets as $id => $binding) {\n /** @var resource|Socket $socket */\n $socket = $binding->getIoResource();\n $resourceId = $this->identifySocket($socket);\n\n if ($binding->isStreamBased()) {\n /** @var resource $socket */\n $this->streamMap[self::RESOURCE][$binding->ioMode][$resourceId] = $socket;\n $this->streamMap[self::HANDLER][$binding->ioMode][$resourceId][$id] = $binding;\n $streamCount++;\n } else {\n $this->socketMap[self::RESOURCE][$binding->ioMode][$resourceId] = $socket;\n $this->socketMap[self::HANDLER][$binding->ioMode][$resourceId][$id] = $binding;\n $socketCount++;\n }\n }\n\n\n // Streams\n foreach ($this->streams as $id => $binding) {\n /** @var resource $stream */\n $stream = $binding->getIoResource();\n $resourceId = (int)$stream;\n\n $this->streamMap[self::RESOURCE][$binding->ioMode][$resourceId] = $stream;\n $this->streamMap[self::HANDLER][$binding->ioMode][$resourceId][$id] = $binding;\n $streamCount++;\n }\n\n\n // Signals\n $this->signalMap = [];\n\n foreach ($this->signals as $id => $binding) {\n foreach (array_keys($binding->signals) as $number) {\n $this->signalMap[$number][$id] = $binding;\n }\n }\n\n // Cleanup\n if (!$socketCount) {\n $this->socketMap = null;\n }\n\n if (!$streamCount) {\n $this->streamMap = null;\n }\n\n $this->generateMaps = false;\n }",
"protected function getMap(): ReferenceMap\n {\n return new ReferenceMap(\n [\n new SrcNode(\n new \\SplFileInfo('folder/Example/ClassExample.php'),\n new FullClassName('Example', 'ClassExample'),\n [\n new Inheritance(0, new FullClassName('Example', 'ParentClassExample')),\n new Inheritance(0, new FullClassName('', 'FilterIterator')),\n new Dependency(0, new FullClassName('Example', 'AnotherClassExample')),\n new Dependency(0, new FullClassName('Vendor', 'ThirdPartyExample')),\n new Dependency(0, new FullClassName('', 'iterable')),\n new Composition(0, new FullClassName('Example', 'InterfaceExample')),\n new Composition(0, new FullClassName('Example', 'AnotherInterface')),\n new Composition(0, new FullClassName('', 'iterable')),\n new Mixin(0, new FullClassName('Example', 'TraitExample')),\n new Mixin(0, new FullClassName('', 'PHPDocElement'))\n ]\n )\n ],\n [\n new FullClassName('', 'iterable'),\n new FullClassName('', 'FilterIterator'),\n new FullClassName('', 'PHPDocElement'),\n ],\n [\n new ComposerPackage('main', [], [], [], [])\n ]\n );\n }",
"static function xmlList()\n\t{\n\t\treturn simplexml_load_file('http://ws.geonames.org/countryInfo');\n\t}",
"public function getInstanceFromXML($xml, &$xmlMapping, $tracker) {\n $rules = array();\n //test this better\n if(property_exists($xml, 'list_rules')) {\n $list_rules = $xml->list_rules;\n $rules['list_rules'] = $this->generateListRulesArrayFromXml($list_rules, $xmlMapping, $tracker);\n }\n \n if(property_exists($xml, 'date_rules')) {\n $date_rules = $xml->date_rules;\n $rules['date_rules'] = $this->generateDateRulesArrayFromXml($date_rules, $xmlMapping, $tracker);\n }\n\n return $rules;\n }",
"public static function getEventMap()\n {\n if (!empty(static::$eventMap)) {\n return static::$eventMap;\n }\n\n static::$eventMap = \\Cache::get(static::EVENT_CACHE_KEY);\n\n //\tIf we still have no event map, build it.\n if (empty(static::$eventMap)) {\n static::buildEventMaps();\n }\n\n return static::$eventMap;\n }",
"function venture_geo_process_map_xml($id, $params) { \n $output = '';\n if ($params) {\n $output = \" <state id=\\\"$id\\\">\\n\";\n foreach ($params as $name => $value) {\n if($value) \n $output .= \" <$name>$value</$name>\\n\";\n }\n $output .= \" </state>\\n\";\n }\n return $output;\n}",
"function generate_mapservice_conf_file(){\n\t\t$dom;\n\t\tif(!$dom = domxml_open_file($this->default_mapservconf_file)){\n\t\t\techo \"Could not open xml file: \" . $this->default_mapservconf_file;\n\t\t\treturn NULL; \n\t\t}\n\t\t$mapservice = $this->find_mapservice($dom);\n\t\t// map service not found\n\t\tif($mapservice == NULL){\n\t\t\techo \"could not find map-service named: \" . $mapservice_name ;\n\t\t\treturn NULL;\n\t\t}\n\t\t\n\t\t$children = $mapservice->child_nodes();\n\t\t$n_children = count($children);\n\t\t\n\t\t// loop through to find <map-file>\n\t\t// and <layer-config> element\n\t\tfor($i = 0; $i < $n_children; $i++){\n\t\t\tswitch ($children[$i]->tagname){\n\t\t\t\tcase \"map-file\":\n\t\t\t\t\t$this->change_node_content($dom, $children[$i], $this->output_mapfile);\n\t\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\tcase \"layer-config-file\":\n\t\t\t\t\t$this->change_node_content($dom, $children[$i], $this->output_layerconf);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\t$dom->dump_file($this->output_mapservconf, false, false);\n\t\treturn $this->output_mapservconf;\n\t}",
"public function __construct(XMLDocument $x = null) {\n \n // initialize the string map\n $this->dbc = new StringMap();\n \n // set the values\n $this->dbc->set(\"name\",\n $x->xpath(\"normalize-space(string(//database/@name))\")); \n $this->dbc->set(\"type\",\n $x->xpath(\"normalize-space(string(//database/type))\")); \n $this->dbc->set(\"driver\",\n $x->xpath(\"normalize-space(string(//database/driver))\")); \n $this->dbc->set(\"host\",\n $x->xpath(\"normalize-space(string(//database/host))\")); \n $this->dbc->set(\"port\",\n $x->xpath(\"normalize-space(string(//database/port))\")); \n $this->dbc->set(\"user\",\n $x->xpath(\"normalize-space(string(//database/user))\")); \n $this->dbc->set(\"pass\",\n $x->xpath(\"normalize-space(string(//database/pass))\")); \n $this->dbc->set(\"db\",\n $x->xpath(\"normalize-space(string(//database/db))\")); \n $this->dbc->set(\"ssl\",\n $x->xpath(\"normalize-space(string(//database/ssl))\")); \n $this->dbc->set(\"persistent\",\n $x->xpath(\"normalize-space(string(//database/persistent))\"));\n $this->dbc->set(\"charset\",\n $x->xpath(\"normalize-space(string(//database/charset))\")); \n $this->dbc->set(\"timeout\",\n $x->xpath(\"normalize-space(string(//database/timeout))\")); \n\n }",
"public function getEventMappings()\n {\n return [\n HttpRequestEvent::EVENT_ID => [\n 'method' => 'onRequest',\n 'priority' => Priority::MIN\n ]\n ];\n }",
"abstract protected function buildData(DOMDocument $xml);",
"public static function buildTableMap()\n {\n $dbMap = Propel::getServiceContainer()->getDatabaseMap(CKOrderXmlTableMap::DATABASE_NAME);\n if (!$dbMap->hasTable(CKOrderXmlTableMap::TABLE_NAME)) {\n $dbMap->addTableObject(new CKOrderXmlTableMap());\n }\n }"
]
| [
"0.6444875",
"0.6097816",
"0.57355887",
"0.5629596",
"0.53465986",
"0.5275113",
"0.521377",
"0.5208028",
"0.51833755",
"0.51134807",
"0.5046077",
"0.5019277",
"0.5014572",
"0.49979517",
"0.49915347",
"0.49905762",
"0.49672246",
"0.49671835",
"0.49537045",
"0.49379966",
"0.4867143",
"0.48641184",
"0.4852946",
"0.48418617",
"0.4806488",
"0.48013237",
"0.47731167",
"0.47582358",
"0.47547337",
"0.47110394"
]
| 0.75873345 | 0 |
Builds an XML Map used to parse plugins from an XML source | protected function xmlPluginsMapFactory()
{
$map = new Map();
$map->add(
Path::factory('/fwk/plugin', 'plugins')
->loop(true)
->attribute('class')
->attribute('service')
->addChildren(
Path::factory('param', 'params')
->attribute('name')
->filter(array($this, 'propertizeString'))
->value('value')
->loop(true)
)
);
return $map;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function build_xml_map() {\n $this->_create_map();\n header(\"content-type: text/xml\");\n echo $this->result;\n }",
"protected function xmlServicesMapFactory()\n {\n $map = new Map();\n $map->add(\n Path::factory('/fwk/services', 'services', array())\n ->loop(true, '@xml')\n ->attribute('xmlMap')\n );\n \n return $map;\n }",
"protected function xmlListenersMapFactory()\n {\n $map = new Map();\n $map->add(\n Path::factory('/fwk/listener', 'listeners')\n ->loop(true)\n ->attribute('class')\n ->attribute('service')\n ->addChildren(\n Path::factory('param', 'params')\n ->attribute('name')\n ->filter(array($this, 'propertizeString'))\n ->value('value')\n ->loop(true)\n )\n );\n \n return $map;\n }",
"public function getXMLPageMap() {\n\t\tstatic $xml;\n\n\t\tif (isset($xml)) return $xml;\n\t\t$cache = SA_SimpleCache::singleton('__XML_PAGES_MAP__');\n\t\tif ($xmlString = $cache->load()) {\n\t\t\t$xml = new SimpleXMLElement($xmlString);\n\t\t} else {\n\t\t\t$xml = new SimpleXMLElement('<?xml version=\"1.0\" standalone=\"yes\"?><pages/>');\n\t\t\t$this->xmlFileSystem($this->getPagesDir(), $xml);\n\t\t\t$cache->save($xml->asXML());\n\t\t}\n\t\treturn $xml;\n\t}",
"protected function xmlIniMapFactory()\n {\n $map = new Map();\n $map->add(\n Path::factory('/fwk/ini', 'ini', array())\n ->loop(true)\n ->attribute('category')\n ->value('value')\n );\n \n return $map;\n }",
"public function initXmlPlugins()\n {\n $this->collXmlPlugins = new ObjectCollection();\n $this->collXmlPluginsPartial = true;\n\n $this->collXmlPlugins->setModel('\\Plugins');\n }",
"abstract protected function buildMap();",
"protected function xmlActionMapFactory()\n {\n $map = new Map();\n $map->add(\n Path::factory('/fwk/actions/action', 'actions')\n ->loop(true, '@name')\n ->attribute('class')\n ->attribute('method')\n ->attribute('shortcut')\n );\n \n return $map;\n }",
"public function buildFromXML($eloXML = null){\n\t\tif ($eloXML !== null){\n\t\t\t$dom = str_get_dom($eloXML);\n\t\t\t\n\t\t\t$contentWithDataTag = $this->getElemAtPos($dom, 'content', 0);\n\t\t\t$dataTag = $this->getElemAtPos($contentWithDataTag, 'data', 0); \n\t\t\tif ($dataTag->innertext !== null){\n\t\t\t\t$content = $dataTag->innertext;\n\t\t\t}else{\n\t\t\t\t$content = '';\n\t\t\t}\n\t\t\t\n\t\t\t$this->setContent($content);\n\t\t\t\n\t\t\t$metadataElem = $this->getElemAtPos($dom, 'metadata', 0);\n\t\t\tif ($metadataElem !== null){\n\t\t\t\tforeach($metadataElem->childNodes() as $curMetadataElem){\n\t\t\t\t\t\n\t\t\t\t\tif ($curMetadataElem->tag == 'uri'){\n\t\t\t\t\t\t$curMetadataElem = $curMetadataElem->find('entry');\n\t\t\t\t\t\t$curMetadataElem = $curMetadataElem[0];\n\t\t\t\t\t\t\n\t\t\t\t\t\t$key = 'uri';\n\t\t\t\t\t\t\n\t\t\t\t\t}else {\n\t\t\t\t\t\t$key = $curMetadataElem->tag;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t$value = $curMetadataElem->innertext;\n\t\t\t\t\t$this->_metadata[$key] = $value;\n\n\t\t\t\t\t// extract the id from URI\n\t\t\t\t\tif ($key === 'uri'){\n\t\t\t\t\t\t$this->_id = substr(strrchr($value, '/'), 1);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t// This code is to dynamically set the values for the\n\t\t\t\t\t// elo's metadatas\n\t\t\t\t\t/*\n\t\t\t\t\t * THIS WAS MESSING UP THE POPULATION OF THE CODE. \n\t\t\t\t\t * SEEMS TO BE DOING THE EXACT SAME THING AS $this->_metadata[$key] = $value; BUT ADDING A _<mt key> VARIABLE THAT\n\t\t\t\t\t * MESSES UP THE XML GENERATION.\n\t\t\t\t\t */\n//\t\t\t\t\t$keyVar = \"_\" . $key;\n//\t\t\t\t\t$this->$keyVar = $value;\n//\t\t\t\t\t$this->addMetadata($key, $value);\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t$resourceElem = $this->getElemAtPos($dom, 'resource', 0);\n\t\t\tif ($resourceElem !== null){\n\t\t\t\tif ($resourceElem ){\n\t\t\t\t\tforeach($resourceElem->childNodes() as $curResourceElem){\n\t\t\t\t\t\t$key = $curResourceElem->tag;\n\t\t\t\t\t\t$value = $curResourceElem->innertext;\n\t\t\t\t\t\t\n\t\t\t\t\t\t$this->_resources[$key] = $value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}",
"static function xmlList()\n\t{\n\t\treturn simplexml_load_file('http://ws.geonames.org/countryInfo');\n\t}",
"function webmap_compo_lib_xml_build()\r\n{\r\n\t$this->webmap_compo_lib_xml_base();\r\n}",
"private function generateXml()\n {\n\n $args = array(\n\n 'posts_per_page' => -1,\n 'numberposts' => -1,\n 'orderby' => 'post_type',\n 'order' => 'DESC',\n 'post_type' => apply_filters('fpcms_sitemap_post_types', array('post', 'page'))\n\n );\n\n if ($results = get_posts($args)) {\n\n $sitemap = new \\SimpleXMLElement($this->getDocStructure());\n\n foreach ($results as $result) {\n\n $url = $sitemap->addChild('url');\n $url->addChild('loc', get_permalink($result->ID));\n\n if (has_post_thumbnail($result->ID)) {\n\n if ($image = wp_get_attachment_image_src(get_post_thumbnail_id($result->ID))) {\n $url->addChild('image:image', $image[0]);\n }\n\n }\n\n $url->addChild('lastmod', mysql2date('Y-m-d', $result->post_date_gmt));\n\n if ($result->post_type == 'page') {\n\n //Pages should display higher than posts for the same keyword\n $url->addChild('priority', apply_filters('fpcms_sitemap_page_priority', '0.7'));\n\n } else {\n\n $url->addChild('priority', apply_filters('fpcms_sitemap_post_priority', '0.4'));\n\n }\n\n }\n\n return $sitemap->asXML();\n\n }\n\n }",
"public function map() {\n\t\treturn array(\n\t\t\t'name' => esc_html__( 'Image Grid', 'total-theme-core' ),\n\t\t\t'description' => esc_html__( 'Responsive image gallery', 'total-theme-core' ),\n\t\t\t'base' => 'vcex_image_grid',\n\t\t\t'icon' => 'vcex_element-icon vcex_element-icon--image-gallery',\n\t\t\t'admin_enqueue_js' => vcex_wpbakery_asset_url( 'js/backend-editor/vcex-image-gallery-view.min.js' ),\n\t\t\t'js_view' => 'vcexBackendViewImageGallery',\n\t\t\t'category' => vcex_shortcodes_branding(),\n\t\t\t'params' => Shortcode::get_params(),\n\t\t);\n\t}",
"public function loadXml($filename,$map_path){\r\n \r\n $this->rootPath = $this->_preparePath($map_path);\r\n \r\n if(!File::exists( $this->rootPath .DS. $filename ))\r\n App::critical_error ('XML document not found: '.$this->rootPath .DS. $filename);\r\n \r\n $xmlDoc = $this->_initDocument($this->rootPath .DS. $filename);\r\n \r\n //get the project elements\r\n $elements = $xmlDoc->getElementsByTagName('element');\r\n \r\n foreach($elements as $element){\r\n \r\n if(count($this->elements) == 0 ){\r\n $this->elements = $this->_loadElement($element);\r\n }\r\n else{\r\n $this->elements = array_merge($this->elements,$this->_loadElement($element));\r\n }\r\n }\r\n \r\n //isolate the template key\r\n if(!is_null($this->_templatekey) && !is_null($this->elements[$this->_templatekey]))\r\n $this->elements['templates'] = $this->elements[$this->_templatekey];\r\n \r\n //clean the element values\r\n //array_walk_recursive($this->element, array($this, '_clean'));\r\n \r\n return File::put(APP_PROJECT .DS. 'elements.php' ,serialize($this->elements)); \r\n }",
"function generate_mapservice_conf_file(){\n\t\t$dom;\n\t\tif(!$dom = domxml_open_file($this->default_mapservconf_file)){\n\t\t\techo \"Could not open xml file: \" . $this->default_mapservconf_file;\n\t\t\treturn NULL; \n\t\t}\n\t\t$mapservice = $this->find_mapservice($dom);\n\t\t// map service not found\n\t\tif($mapservice == NULL){\n\t\t\techo \"could not find map-service named: \" . $mapservice_name ;\n\t\t\treturn NULL;\n\t\t}\n\t\t\n\t\t$children = $mapservice->child_nodes();\n\t\t$n_children = count($children);\n\t\t\n\t\t// loop through to find <map-file>\n\t\t// and <layer-config> element\n\t\tfor($i = 0; $i < $n_children; $i++){\n\t\t\tswitch ($children[$i]->tagname){\n\t\t\t\tcase \"map-file\":\n\t\t\t\t\t$this->change_node_content($dom, $children[$i], $this->output_mapfile);\n\t\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\tcase \"layer-config-file\":\n\t\t\t\t\t$this->change_node_content($dom, $children[$i], $this->output_layerconf);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\t$dom->dump_file($this->output_mapservconf, false, false);\n\t\treturn $this->output_mapservconf;\n\t}",
"protected function buildPluginNodes() {\n\t\t$this->node = $this->getToken();\n\t\t\n\t\t// fetch ordered pips\n\t\t$pips = array();\n\t\t$sql = \"SELECT\t\tpluginName, className,\n\t\t\t\t\tCASE pluginName WHEN 'packageinstallationplugins' THEN 1 WHEN 'files' THEN 2 ELSE 0 END 'pluginOrder'\n\t\t\tFROM\t\twcf\".WCF_N.\"_package_installation_plugin\n\t\t\tWHERE\t\tpackageID IN (\n\t\t\t\t\t\t1 /* TESTING ONLY */\n\t\t\t\t\t\t/*\n\t\t\t\t\t\tSELECT\tdependency\n\t\t\t\t\t\tFROM\twcf\".WCF_N.\"_package_dependency\n\t\t\t\t\t\tWHERE\tpackageID = \".$this->installation->queue->packageID.\"\n\t\t\t\t\t\t*/\n\t\t\t\t\t)\n\t\t\tORDER BY\tpluginOrder ASC, priority DESC\";\n\t\t$statement = WCF::getDB()->prepareStatement($sql);\n\t\t$statement->execute();\n\t\twhile ($row = $statement->fetchArray()) {\n\t\t\t$pips[] = $row;\n\t\t}\n\t\t\n\t\t// insert pips\n\t\t$sql = \"INSERT INTO\twcf\".WCF_N.\"_package_installation_node\n\t\t\t\t\t(queueID, processNo, sequenceNo, node, nodeType, nodeData)\n\t\t\tVALUES\t\t(?, ?, ?, ?, ?, ?)\";\n\t\t$statement = WCF::getDB()->prepareStatement($sql);\n\t\t$sequenceNo = 0;\n\t\t\n\t\tforeach ($pips as $pip) {\n\t\t\t$statement->execute(array(\n\t\t\t\t$this->installation->queue->queueID,\n\t\t\t\t$this->installation->queue->processNo,\n\t\t\t\t$sequenceNo,\n\t\t\t\t$this->node,\n\t\t\t\t'pip',\n\t\t\t\tserialize(array(\n\t\t\t\t\t'pluginName' => $pip['pluginName'],\n\t\t\t\t\t'className' => $pip['className']\n\t\t\t\t))\n\t\t\t));\n\t\t\t\n\t\t\t$sequenceNo++;\n\t\t}\n\t}",
"function get_map($source)\n{\n // for dest_position, 0/1/2 denotes root/extras/resources.\n $map_json = array(\n 'title' => array('title', 0),\n 'notes' => array('description', 0),\n 'publisher' => array('publisher', 1),\n 'public_access_level' => array('accessLevel', 1),\n 'contact_email' => array('mbox', 1),\n 'contact_name' => array('person', 1),\n 'unique_id' => array('identifier', 1),\n 'tags' => array('keyword', 0),\n 'tag_string' => array('keyword', 0),\n 'data_dictionary' => array('dataDictionary', 1),\n 'license_title' => array('license', 0),\n 'category' => array('theme', 1),\n 'spatial' => array('spatial', 1),\n 'temporal' => array('temporal', 1),\n 'release_date' => array('issued', 1),\n 'accrual_periodicity' => array('accrualPeriodicity', 1),\n 'related_documents' => array('references', 1),\n 'language' => array('language', 1),\n 'data_quality' => array('dataQuality', 1),\n 'homepage_url' => array('landingPage', 1),\n 'system_of_records' => array('systemOfRecords', 1),\n 'url' => array('accessURL', 2),\n 'format' => array('format', 2),\n );\n\n // 'dest_key' => array('source_key', dest_position)\n // for dest_position, 0/1/2 denotes root/extras/resources.\n $map_datajson = array(\n 'title' => array('title', 0),\n 'notes' => array('description', 0),\n 'publisher' => array('publisher', 1),\n 'public_access_level' => array('accessLevel', 1),\n 'contact_email' => array('mbox', 1),\n 'contact_name' => array('contactPoint', 1),\n 'unique_id' => array('identifier', 1),\n 'tags' => array('keyword', 0),\n 'tag_string' => array('keyword', 0),\n 'data_dictionary' => array('dataDictionary', 1),\n 'license_title' => array('license', 0),\n 'category' => array('theme', 1),\n 'spatial' => array('spatial', 1),\n 'temporal' => array('temporal', 1),\n 'release_date' => array('issued', 1),\n 'accrual_periodicity' => array('accrualPeriodicity', 1),\n 'related_documents' => array('references', 1),\n 'bureau_code' => array('bureauCode', 1),\n 'program_code' => array('programCode', 1),\n 'language' => array('language', 1),\n 'data_quality' => array('dataQuality', 1),\n 'homepage_url' => array('landingPage', 1),\n //'system_of_records' => array('systemOfRecords', 1),\n 'url' => array('accessURL', 2),\n 'format' => array('format', 2),\n );\n\n // 'dest_key' => array('source_key', dest_position)\n // for dest_position, 0/1/2 denotes root/extras/resources.\n $map_socratajson = array(\n 'title' => array('title', 0),\n 'notes' => array('description', 0),\n 'publisher' => array('publisher', 1),\n 'public_access_level' => array('accessLevel', 1),\n 'contact_email' => array('mbox', 1),\n 'contact_name' => array('contactPoint', 1),\n 'unique_id' => array('identifier', 1),\n 'tags' => array('keyword', 0),\n 'tag_string' => array('keyword', 0),\n 'data_dictionary' => array('dataDictionary', 1),\n 'license_title' => array('license', 0),\n 'category' => array('theme', 1),\n 'spatial' => array('spatial', 1),\n 'temporal' => array('temporal', 1),\n 'release_date' => array('issued', 1),\n 'accrual_periodicity' => array('accrualPeriodicity', 1),\n 'related_documents' => array('references', 1),\n 'bureau_code' => array('bureauCode', 1),\n 'program_code' => array('programCode', 1),\n 'language' => array('language', 1),\n 'data_quality' => array('dataQuality', 1),\n 'homepage_url' => array('landingPage', 1),\n //'system_of_records' => array('systemOfRecords', 1),\n 'upload' => array('upload', 2),\n 'format' => array('format', 2),\n 'name' => array('name', 2),\n 'modified' => array('modified',1),\n );\n\n // 'dest_key' => array('source_key', dest_position, source_position)\n // 0/1/2 denotes root/extras/resources.\n $map_ckan = array(\n 'title' => array('title', 0, 0),\n 'notes' => array('notes', 0, 0),\n // hard-code publisher to orgnization.title in ckan_map for now.\n // todo: change this map structure.\n 'publisher' => array('place-holder', 1, 1),\n 'public_access_level' => array('access-level', 1, 1),\n 'contact_email' => array('contact-email', 1, 1),\n 'contact_name' => array('person', 1, 1),\n 'unique_id' => array('id', 1, 0),\n 'tags' => array('tags', 0, 1),\n 'tag_string' => array('keyword', 0),\n 'data_dictionary' => array('data-dictiionary', 1, 1), // there is a typo.\n 'license_title' => array('license_title', 0, 0),\n 'spatial' => array('spatial-text', 1, 1),\n 'temporal' => array('dataset-reference-date', 1, 1),\n 'release_date' => array('issued', 1, 1),\n 'accrual_periodicity' => array('frequency-of-update', 1, 1),\n 'related_documents' => array('references', 1, 1),\n 'language' => array('metadata-language', 1, 1),\n 'homepage_url' => array('url', 1, 0),\n 'url' => array('url', 2, 2),\n 'name' => array('name', 2, 2),\n 'format' => array('format', 2, 2),\n );\n\n $ret_map = \"map_$source\";\n return isset($$ret_map) ? $$ret_map : null;\n}",
"function GetMapContent($hide_mode_ids) {\n\tglobal $config;\n\n\t$lang = GetLangContent(\"map\");\n\n\t$map = array();\n\tif (file_exists($config[\"site_path\"].\"/include/map.xml\")) {\n\t\t$xml_parser = new SimpleXmlParser( $config[\"site_path\"].\"/include/map.xml\" );\n\t\t$xml_root = $xml_parser->getRoot();\n\n\t\tforeach ( $xml_root->children as $cnt => $xml_section ) {\n\t\t\tif (!isset($xml_section->attrs[\"id\"]) || (isset($xml_section->attrs[\"id\"]) && !in_array($xml_section->attrs[\"id\"], $hide_mode_ids))) {\n\t\t\t\t$section = array();\n\t\t\t\t$section = array(\"name\" => (isset($lang[$xml_section->attrs[\"name\"]]) ? $lang[$xml_section->attrs[\"name\"]] : $xml_section->attrs[\"name\"]), \"link\" => $xml_section->attrs[\"link\"]);\n\t\t\t\tif ($xml_section->children) {\n\t\t\t\t\tforeach ( $xml_section->children as $xml_subsection_cnt => $xml_subsection ) {\n\t\t\t\t\t\tif (!isset($xml_subsection->attrs[\"id\"]) || (isset($xml_subsection->attrs[\"id\"]) && !in_array($xml_subsection->attrs[\"id\"], $hide_mode_ids))) {\n\t\t\t\t\t\t\t$subsection = array();\n\t\t\t\t\t\t\t$subsection[\"name\"] = (isset($lang[$xml_subsection->attrs[\"name\"]]) ? $lang[$xml_subsection->attrs[\"name\"]] : $xml_subsection->attrs[\"name\"]);\n\t\t\t\t\t\t\t$subsection[\"link\"] = $xml_subsection->attrs[\"link\"];\n\t\t\t\t\t\t\tif ($xml_subsection->children) {\n\t\t\t\t\t\t\t\t$item = array();\n\t\t\t\t\t\t\t\tforeach ( $xml_subsection->children as $xml_item_cnt => $xml_item ) {\n\t\t\t\t\t\t\t\t\tif (!isset($xml_item->attrs[\"id\"]) || (isset($xml_item->attrs[\"id\"]) && !in_array($xml_item->attrs[\"id\"], $hide_mode_ids))) {\n\t\t\t\t\t\t\t\t\t\t$item[] = array(\"name\" => (isset($lang[$xml_item->attrs[\"name\"]]) ? $lang[$xml_item->attrs[\"name\"]] : $xml_item->attrs[\"name\"]), \"link\" => $xml_item->attrs[\"link\"]);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t$subsection[\"subsection\"] = $item;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t$section[\"subsection\"][] = $subsection;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$map[] = $section;\n\t\t\t}\n\t\t}\n\t}\n\treturn $map;\n}",
"public static function buildTableMap()\n {\n $dbMap = Propel::getServiceContainer()->getDatabaseMap(CKOrderXmlTableMap::DATABASE_NAME);\n if (!$dbMap->hasTable(CKOrderXmlTableMap::TABLE_NAME)) {\n $dbMap->addTableObject(new CKOrderXmlTableMap());\n }\n }",
"function loadPlugins() {\n\n\t\t// load and parse the plugins file\n\t\tif ($plugins = $this->xml_parser->parseXml('plugins.xml')) {\n\t\t\tif (!empty($plugins['XASECO2_PLUGINS']['PLUGIN'])) {\n\t\t\t\t// take each plugin tag\n\t\t\t\tforeach ($plugins['XASECO2_PLUGINS']['PLUGIN'] as $plugin) {\n\t\t\t\t\t// log plugin message\n\t\t\t\t\t$this->console_text('[XAseco2] Load plugin [' . $plugin . ']');\n\t\t\t\t\t// include the plugin\n\t\t\t\t\trequire_once('plugins/' . $plugin);\n\t\t\t\t\t$this->plugins[] = $plugin;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\ttrigger_error('Could not read/parse plugins list plugins.xml !', E_USER_ERROR);\n\t\t}\n\t}",
"function xmlProvider() {\n\n return [\n [\n 'hello',\n 'hello',\n ],\n [\n '<element>hello</element>',\n '<element xmlns=\"http://sabredav.org/ns\">hello</element>'\n ],\n [\n '<element foo=\"bar\">hello</element>',\n '<element xmlns=\"http://sabredav.org/ns\" foo=\"bar\">hello</element>'\n ],\n [\n '<element x1:foo=\"bar\" xmlns:x1=\"http://example.org/ns\">hello</element>',\n '<element xmlns:x1=\"http://example.org/ns\" xmlns=\"http://sabredav.org/ns\" x1:foo=\"bar\">hello</element>'\n ],\n [\n '<element xmlns=\"http://example.org/ns\">hello</element>',\n '<element xmlns=\"http://example.org/ns\">hello</element>',\n '<x1:element xmlns:x1=\"http://example.org/ns\">hello</x1:element>',\n ],\n [\n '<element xmlns:foo=\"http://example.org/ns\">hello</element>',\n '<element xmlns:foo=\"http://example.org/ns\" xmlns=\"http://sabredav.org/ns\">hello</element>',\n '<element>hello</element>',\n ],\n [\n '<foo:element xmlns:foo=\"http://example.org/ns\">hello</foo:element>',\n '<foo:element xmlns:foo=\"http://example.org/ns\">hello</foo:element>',\n '<x1:element xmlns:x1=\"http://example.org/ns\">hello</x1:element>',\n ],\n [\n '<foo:element xmlns:foo=\"http://example.org/ns\"><child>hello</child></foo:element>',\n '<foo:element xmlns:foo=\"http://example.org/ns\" xmlns=\"http://sabredav.org/ns\"><child>hello</child></foo:element>',\n '<x1:element xmlns:x1=\"http://example.org/ns\"><child>hello</child></x1:element>',\n ],\n [\n '<foo:element xmlns:foo=\"http://example.org/ns\"><child/></foo:element>',\n '<foo:element xmlns:foo=\"http://example.org/ns\" xmlns=\"http://sabredav.org/ns\"><child/></foo:element>',\n '<x1:element xmlns:x1=\"http://example.org/ns\"><child/></x1:element>',\n ],\n [\n '<foo:element xmlns:foo=\"http://example.org/ns\"><child a=\"b\"/></foo:element>',\n '<foo:element xmlns:foo=\"http://example.org/ns\" xmlns=\"http://sabredav.org/ns\"><child a=\"b\"/></foo:element>',\n '<x1:element xmlns:x1=\"http://example.org/ns\"><child a=\"b\"/></x1:element>',\n ],\n ];\n\n }",
"protected function getMap(): ReferenceMap\n {\n return new ReferenceMap(\n [\n new SrcNode(\n new \\SplFileInfo('folder/Example/ClassExample.php'),\n new FullClassName('Example', 'ClassExample'),\n [\n new Inheritance(0, new FullClassName('Example', 'ParentClassExample')),\n new Inheritance(0, new FullClassName('', 'FilterIterator')),\n new Dependency(0, new FullClassName('Example', 'AnotherClassExample')),\n new Dependency(0, new FullClassName('Vendor', 'ThirdPartyExample')),\n new Dependency(0, new FullClassName('', 'iterable')),\n new Composition(0, new FullClassName('Example', 'InterfaceExample')),\n new Composition(0, new FullClassName('Example', 'AnotherInterface')),\n new Composition(0, new FullClassName('', 'iterable')),\n new Mixin(0, new FullClassName('Example', 'TraitExample')),\n new Mixin(0, new FullClassName('', 'PHPDocElement'))\n ]\n )\n ],\n [\n new FullClassName('', 'iterable'),\n new FullClassName('', 'FilterIterator'),\n new FullClassName('', 'PHPDocElement'),\n ],\n [\n new ComposerPackage('main', [], [], [], [])\n ]\n );\n }",
"final protected function buildDependencyMap() {\n\n\t\t$this->dependencyMap = array();\n\t\t$this->prioritiesHandlers = array();\n $p = new dummyPriorityhookHandler();\n\t\t$this->prioritiesHandlers[self::NORMAL] = $p;\n $this->priorityBased = array('min' => array(),'max' => array());\n\t\t//$this->priorityBased['min'][self::NORMAL][spl_object_hash($p)] = $p;\n\t\tforeach ($this->objects as $hash => $handler) {\n\t\t\t$this->priorityBased['min'][self::NORMAL][$hash] = $handler;\n\t\t\t$this->dependencyMap[$hash] = array('priority' => $this->prioritiesHandlers[self::NORMAL]);\n\t\t\t$this->priorityBased['max'][self::LATEST-1][$hash] = $handler;\n\t\t\t$handler->registerDependencies($this);\n\t\t}\n\t}",
"function siteMap($node, $lang='en', $wide_info=false){\r\n\t\t$dir = \"sitemaps\";\r\n\t\t$lang = $this->CFG->lang;\r\n\t\t$db = $this->DB->dbName;\r\n\t\t$fname = \"sitemap_\".$db.\"_\".$node.\"_\".$lang.\".xml\";\r\n\t\tif(!($xml = $this->getCache($dir, $fname))){\r\n\t\t\t$xml = $this->cache__siteMap($node, $lang, $wide_info);\r\n\t\t\t$this->newCache($dir, $fname, $xml);\r\n\t\t\t//print \"newcache [$dir]\";\r\n\t\t} //else print \"readcache [$dir/$fname]\";\r\n\t\t//print \"<textarea>$xml</textarea>\";\r\n\t\treturn $xml;\r\n\t}",
"public function init_from_xml($xml, $from = Bean::SOURCE_STRING)\n {\n if($from == Bean::SOURCE_URL || $from == Bean::SOURCE_FILE)\n {\n $xdom = @simplexml_load_file($xml);\n }\n if($from == Bean::SOURCE_STRING)\n {\n $xdom = @simplexml_load_string($xml);\n }\n\n foreach($xdom as $key => $val)\n {\n $this->set($key,$val); \n } \n }",
"function createSitemap() {\n\tglobal $wpdb;\n\n\t$posts = $wpdb->get_results (\"SELECT id, post_title, post_content, post_date_gmt, post_excerpt \n\t\t\t\t\t\t\tFROM $wpdb->posts \n\t\t\t\t\t\t\tWHERE post_status = 'publish' \n\t\t\t\t\t\t\tAND post_type = 'post'\n\t\t\t\t\t\t\tAND (post_content LIKE '%youtube.com%' or post_content LIKE '%[video url=%') \n\t\t\t\t\t\t\tORDER BY post_date DESC\");\n\n\tif (empty ($posts)) {\n\t//$xml = \"Video not available\";\n\t\t$xml = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>' . \"\\n\"; \n\t\t$xml .= '<!-- Created by (http://wdtmedia.com) -->' . \"\\n\";\n\t\t$xml .= '<!-- Generated-on=\"' . date(\"F j, Y, g:i a\") .'\" -->' . \"\\n\";\t\t \n\t\t$xml .= '<?xml-stylesheet type=\"text/xsl\" href=\"' . get_bloginfo('wpurl') . '/wp-content/plugins/video_sitemap_xml/videositemap.xsl\"?>' . \"\\n\" ;\t\t\n\t $xml .= '<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xmlns:video=\"http://www.google.com/schemas/sitemap-video/1.1\">' . \"\\n\";\n\t\t$xml .= \"<dt>5</dt>\";\n\t\t$xml .= \"\\n</urlset>\";\n\n\t} else {\n\n\t\t$xml = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>' . \"\\n\"; \n\t\t$xml .= '<!-- Created by (http://wdtmedia.com) -->' . \"\\n\";\n\t\t$xml .= '<!-- Generated-on=\"' . date(\"F j, Y, g:i a\") .'\" -->' . \"\\n\";\t\t \n\t\t$xml .= '<?xml-stylesheet type=\"text/xsl\" href=\"' . get_bloginfo('wpurl') . '/wp-content/plugins/video_sitemap_xml/videositemap.xsl\"?>' . \"\\n\" ;\t\t\n\t $xml .= '<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xmlns:video=\"http://www.google.com/schemas/sitemap-video/1.1\">' . \"\\n\";\n\t\t\n\t\t$selfUrl = get_bloginfo('url');\n\t\tforeach ($posts as $post) {\n\t\t$meta_title = get_post_meta($post->id, 'mcustom-seo-title',true );\n\t\t$meta_desc = get_post_meta($post->id, 'mcustom-seo-desc',true );\n\t\t\t\t\n\t\t\t\tif((preg_match_all (\"(\\[video url=\\\"http:\\/\\/[^www.youtube.com][^youtube.com]*)\", \n\t\t\t\t$post->post_content, $matches2, PREG_SET_ORDER)))\n\t\t\t\t{\n\t\t\t\t\t$flag=1;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(preg_match_all (\"(<embed|<iframe[^>]*src=['\\\"]http:\\/\\/www.youtube.com\\/v\\/([a-zA-Z0-9\\-_]*)|youtube.com\\/watch\\?v=([a-zA-Z0-9\\-_]*)|youtube.com\\/embed\\/([a-zA-Z0-9\\-_]*))\", \n\t\t\t\t$post->post_content, $matches, PREG_SET_ORDER)|| $flag==1){\n\t\t\t\t\t$matches=array_merge($matches2,$matches);\n\t\t\t\t\t$excerpt = ($post->post_excerpt != \"\") ? $post->post_excerpt : $post->post_title ; \n\t\t\t\t\t$permalink = get_permalink($post->id); \n\n\t\t\t\t\t$beg=0;\n\t\t\t\t\t$end=0; \n\t\t\t\t\t$contentLen = strlen($post->post_content);\n\t\t\t\t\tforeach ($matches as $match) {\n\t\t\t\t\t\t$id = $match [1];\n\t\t\t\t\t\tif ($id == '') $id = $match [2];\n\t\t\t\t\t\tif ($id == '') $id = $match [3];\n\t\t\t\t\t$thumb_path = '';\n\t\t\t\t\t$beg = strpos($post->post_content, 'thumb=\"', $beg);\n\t\t\t\t\tif($beg)\n\t\t\t\t\t{\n\t\t\t\t\t\t$thumb_path='';\n\t\t\t\t\t\t$end = strpos($post->post_content,'\"]',$beg+7);\n\t\t\t\t\t\tif($end <= $contentLen) {\n\t\t\t\t\t\t\t$thumb_path = substr($post->post_content,$beg+7,$end-$beg-7);\n\t\t\t\t\t\t\t$beg = $end;\n\t\t\t\t\t\t}\n\t\t\t\t\t}else\n\t\t\t\t\t{\n\t\t\t\t\t\t$beg = $end;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t$xml .= \"\\n <url>\\n\";\n\t\t\t\t\t$xml .= \" <loc>$permalink</loc>\\n\";\n\t\t\t\t\t$xml .= \" <video:video>\\n\";\n\t\t\t\t\t$xml .= \" <video:player_loc allow_embed=\\\"yes\\\" autoplay=\\\"autoplay=1\\\">http://www.youtube.com/v/$id</video:player_loc>\\n\";\n\t\t\t\t\t\n\t\t\t\t\tif(!empty($thumb_path) && count(file($thumb_path))>0)\n\t\t\t\t\t{\n\t\t\t\t\t\t$xml .= \" <video:thumbnail_loc>\".$thumb_path.\"</video:thumbnail_loc>\\n\";\n\t\t\t\t\t}\n\t\t\t\t\t/*else if(!empty($id))\n\t\t\t\t\t{\n\t\t\t\t\t\t//$xml .= \" <video:thumbnail_loc>http://i.ytimg.com/vi/$id/2.jpg</video:thumbnail_loc>\\n\";\n\t\t\t\t\t\t$xml .= \" <video:thumbnail_loc>http://i.ytimg.com/vi/$id/default.jpg</video:thumbnail_loc>\\n\";\n\t\t\t\t\t}*/\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t$xml .= \" <video:thumbnail_loc>$selfUrl/wp-content/plugins/video_sitemap_xml/noimage.gif</video:thumbnail_loc>\\n\";\n\t\t\t\t\t}\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t$xml .= \" <video:title>\" . $meta_title . \"</video:title>\\n\";\n\t\t\t\t\t$xml .= \" <video:description>\" . $meta_desc . \"</video:description>\\n\";\n\t\n if ($_POST['time'] == 1) { \n\t\t\t\t\t\t$duration = play_time ($id);\n\t\t\t\t\t\tif ($duration != 0)\n\t\t\t\t\t\t\t$xml .= \" <video:duration>\".play_time ($id).\"</video:duration>\\n\";\n\t\t\t\t\t}\n\n\t\t\t\t\t$xml .= \" <video:publication_date>\".date (DATE_W3C, strtotime ($post->post_date_gmt)).\"</video:publication_date>\\n\";\n\t\n\t\t\t\t\t$posttags = get_the_tags($post->id); if ($posttags) { \n\t\t\t\t\t$tagcount=0;\n\t\t\t\t\tforeach ($posttags as $tag) {\n\t\t\t\t\t\tif ($tagcount++ > 32) break;\n\t\t\t\t\t\t$xml .= \" <video:tag>$tag->name</video:tag>\\n\";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\t\n\n\t\t\t\t\t$postcats = get_the_category($post->id); if ($postcats) { \n\t\t\t\t\tforeach ($postcats as $category) {\n\t\t\t\t\t\t$xml .= \" <video:category>$category->name</video:category>\\n\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\t\t\n\n\t\t\t\t\t$xml .= \" </video:video>\\n </url>\";\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t$xml .= \"\\n</urlset>\";\n\t}\n\n\t$video_sitemap_url = ABSPATH.'videositemap.xml';;\n\tif (CheckFilePermission($_SERVER[\"DOCUMENT_ROOT\"]) || CheckFilePermission($video_sitemap_url)) {\n\t\tif (file_put_contents ($video_sitemap_url, $xml)) {\n\t\t\treturn true;\n\t\t}\n\t} \n\necho '<br /><div class=\"wrap\"><p>Unable to save xml file because the folder have no write permission. Create a file videositemap.xml in your wordpress root folder and paste the following text</p><br /><textarea rows=\"30\" cols=\"150\" style=\"font-family:verdana; font-size:11px;color:#666;background-color:#f9f9f9;padding:5px;margin:5px\">' . $xml . '</textarea></div>';\t\n\texit();\n}",
"public function mapClasses() {\n // TODO: this is needed when the class map is not created yet (i.e. at very first install).\n if (!is_dir($this->dir['tmp'])) {\n mkdir($this->dir['tmp']);\n }\n $fop = fopen(CLASS_MAP_FILE, 'w+');\n\n foreach ($this->modules_loaded as $module) {\n $autoload_paths = array('Common', 'Qtags');\n foreach ($autoload_paths as $autoload_path) {\n $full_autoload_path = $module['path'] . '/classes/' . $autoload_path;\n /**\n * Autoload module's qtags.\n */\n if (is_dir($full_autoload_path)) {\n $classes = $this->scanDirectory($full_autoload_path);\n foreach ($classes as $class) {\n // Parse the Qtag.\n $exp1 = explode('/', $class);\n $exp2 = explode('.', $exp1[count($exp1) - 1]);\n $item_name = $exp2[0];\n $this->class_map[$autoload_path][$item_name] = $full_autoload_path . '/' . $class;\n }\n }\n }\n }\n fwrite($fop, serialize($this->class_map));\n fclose($fop);\n }",
"protected function _getDomMap()\n {\n $domMap = parent::_getDomMap();\n $domMap = reset($domMap);\n\n return [\n 'initSubscriptionResponse' => array_merge([\n 'transactionId' => 'transactionId',\n 'subscriptionPageUrl' => 'subscriptionPageUrl',\n 'status' => 'status',\n ], $domMap)\n ];\n }",
"function step_xml_parse_zone($xml){\n\n\t// enlever la balise doctype qui provoque une erreur \"balise non fermee\"\n\t$xml = preg_replace('#<!DOCTYPE[^>]*>#','',$xml);\n\tif (!is_array($arbre = spip_xml_parse($xml)) OR !is_array($arbre = $arbre['archives'][0])){\n\t\treturn false;\n\t}\n\n\t// boucle sur les elements pour creer un tableau array (url_zip => datas)\n\t$paquets = array();\t\t\t\n\tforeach ($arbre as $z=>$c){\n\t\t$c = $c[0];\n\t\t// si plugin et fichier zip, on ajoute le paquet dans la liste\n\t\tif ((is_array($c['plugin'])) AND ($url = $c['zip'][0]['file'][0])) {\n\t\t\t$paquets[$url] = array(\n\t\t\t\t'plugin' => step_xml_parse_plugin($c['plugin'][0]), \n\t\t\t\t'file' => $url, \n\t\t\t);\n\t\t}\n\t}\n\n\tif (!$paquets) {\n\t\treturn false;\n\t}\n\t\n\treturn $paquets;\n}",
"function load_countries_from_xml() {\n\t\t$doc = new DOMDocument();\n\t\t$doc->load( plugin_dir_path( __FILE__ ) . 'xml/countrylist.xml' );\n\t\t\n\t\t$rootnode = $doc->getElementsByTagName( 'countries' )->item( 0 );\n\t\t\n\t\t$arrayofcountries = array();\n\t\t$arrayposition = 0;\n\t\tforeach ( $rootnode->getElementsByTagName( 'country' ) as $countryitem ) {\n\t\t\t\n\t\t\t$arrayattributes = array();\n\t\t\tif ( $countryitem->hasAttributes() ) {\n\t\t\t\t$xmlattributes = $countryitem->attributes;\n\t\t\t\tif ( ! is_null( $xmlattributes ) ) {\n\t\t\t\t\tforeach ( $xmlattributes as $index => $attr ) {\n\t\t\t\t\t\t$arrayattributes[$attr->name] = $attr->value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t$arrayofcountries[$arrayposition][0] = $arrayattributes;\n\t\t\t\n\t\t\t$citysubnodes = array();\n\t\t\tif ( $countryitem->childNodes->length ) {\n\t\t\t\t$cityarrpos = 0;\n\t\t\t\tforeach ( $countryitem->childNodes as $city ) {\n\t\t\t\t\t\n\t\t\t\t\t//echo count( $city->attributes ) . ',';\n\t\t\t\t\t$cityarrayattributes = array();\n\t\t\t\t\tif ( $city->hasAttributes() ) {\n\t\t\t\t\t\t//echo 'has attributes';\n\t\t\t\t\t\t\n\t\t\t\t\t\t$xmlattributes = $city->attributes;\n\t\t\t\t\t\tif ( ! is_null( $xmlattributes ) ) {\n\t\t\t\t\t\t\tforeach ( $xmlattributes as $index => $attr ) {\n\t\t\t\t\t\t\t\t//echo $attr->value;\n\t\t\t\t\t\t\t\t$cityarrayattributes[$attr->name] = $attr->value;\n\t\t\t\t\t\t\t\t//echo $cityarrayattributes[$attr->name] . 'xx';\n\t\t\t\t\t\t\t\t//echo $attr->value;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t$citysubnodes[$cityarrpos] = $cityarrayattributes;\n\t\t\t\t\t\t$cityarrpos++;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t$arrayofcountries[$arrayposition][1] = $citysubnodes;\n\t\t\t//echo count( $arrayofcountries[$arrayposition][1] );\n\t\t\t$arrayposition++;\n\t\t}\n\t\t\n\t\treturn $arrayofcountries;\n\t}"
]
| [
"0.6548875",
"0.6045412",
"0.5887497",
"0.58413464",
"0.5827318",
"0.5365801",
"0.52512115",
"0.52498484",
"0.5141279",
"0.5129361",
"0.510453",
"0.5054593",
"0.5033763",
"0.50192624",
"0.4980078",
"0.49616188",
"0.49413353",
"0.49323654",
"0.49303576",
"0.49236235",
"0.49057853",
"0.48865122",
"0.4886238",
"0.48836786",
"0.48677605",
"0.4863889",
"0.48635483",
"0.48133245",
"0.47909826",
"0.4788702"
]
| 0.7538879 | 0 |
Builds an XML Map used to parse Actions from an XML source | protected function xmlActionMapFactory()
{
$map = new Map();
$map->add(
Path::factory('/fwk/actions/action', 'actions')
->loop(true, '@name')
->attribute('class')
->attribute('method')
->attribute('shortcut')
);
return $map;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function build_xml_map() {\n $this->_create_map();\n header(\"content-type: text/xml\");\n echo $this->result;\n }",
"private function _getXSIMap($actionParam){\n\t\t$arrayMap = array();\n\t\tforeach($actionParam->childNodes as $item){\n\t\t\tif($item->nodeType==1){\n\t\t\t\tif($item->localName=='item'){\n\t\t\t\t\t$index = null;\n\t\t\t\t\t$value = null;\n\t\t\t\t\tforeach($item->childNodes as $node){\n\t\t\t\t\t\tif($node->nodeType==1){\n\t\t\t\t\t\t\tif($node->localName=='key'){\n\t\t\t\t\t\t\t\t$index = (string) $node->nodeValue;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tif($node->localName=='value'){\n\t\t\t\t\t\t\t\t\t$paramType = $node->getAttributeNS($this->_xmlSchemaNamespace, 'type');\n\t\t\t\t\t\t\t\t\tif($this->_isTypeLiteral($paramType)==true){\n\t\t\t\t\t\t\t\t\t\t$value = $this->_decodeXSDType($paramType, $node->nodeValue);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tif($paramType=='ns2:Map'){\n\t\t\t\t\t\t\t\t\t\t\t$value = $this->_getXSIMap($node);\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\tif($paramType=='SOAP-ENC:Array'||$paramType=='enc:Array'){\n\t\t\t\t\t\t\t\t\t\t\t\t$value = $this->_getSoapArray($node);\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\t$value = null;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif($index!==null){\n\t\t\t\t\t\t$arrayMap[$index] = $value;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$arrayMap[] = $value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $arrayMap;\n\t}",
"protected function xmlServicesMapFactory()\n {\n $map = new Map();\n $map->add(\n Path::factory('/fwk/services', 'services', array())\n ->loop(true, '@xml')\n ->attribute('xmlMap')\n );\n \n return $map;\n }",
"public static function createActionDictionary() {}",
"public function getXMLPageMap() {\n\t\tstatic $xml;\n\n\t\tif (isset($xml)) return $xml;\n\t\t$cache = SA_SimpleCache::singleton('__XML_PAGES_MAP__');\n\t\tif ($xmlString = $cache->load()) {\n\t\t\t$xml = new SimpleXMLElement($xmlString);\n\t\t} else {\n\t\t\t$xml = new SimpleXMLElement('<?xml version=\"1.0\" standalone=\"yes\"?><pages/>');\n\t\t\t$this->xmlFileSystem($this->getPagesDir(), $xml);\n\t\t\t$cache->save($xml->asXML());\n\t\t}\n\t\treturn $xml;\n\t}",
"protected function xmlListenersMapFactory()\n {\n $map = new Map();\n $map->add(\n Path::factory('/fwk/listener', 'listeners')\n ->loop(true)\n ->attribute('class')\n ->attribute('service')\n ->addChildren(\n Path::factory('param', 'params')\n ->attribute('name')\n ->filter(array($this, 'propertizeString'))\n ->value('value')\n ->loop(true)\n )\n );\n \n return $map;\n }",
"protected function xmlPluginsMapFactory()\n {\n $map = new Map();\n $map->add(\n Path::factory('/fwk/plugin', 'plugins')\n ->loop(true)\n ->attribute('class')\n ->attribute('service')\n ->addChildren(\n Path::factory('param', 'params')\n ->attribute('name')\n ->filter(array($this, 'propertizeString'))\n ->value('value')\n ->loop(true)\n )\n );\n\n return $map;\n }",
"abstract protected function buildMap();",
"public function read_actions(DOMNode $config){\n\n\t\tglobal $CFG;\n\t\t$CFG->actions = new StdClass();\n\t\t\n\t\t$this->action_id = 1;\n\t\t\n\t\t$this->getLogger()->debug(\"reading actions section configuration\");\n\t\t\n\t\t// lecture de chacun des modes\n\t\t$actions = $config->getElementsByTagName(\"action\");\n\t\t$a_actions = array();\n\n\t\tforeach ($actions as $xml_action){\n\n\t\t\t$action = new StdClass();\n\t\t\t$a_gpio = array();\n\t\t\t\n\t\t\tforeach ($xml_action->childNodes as $node){\n\t\t\t\t\n\t\t\t\tswitch(strtolower($node->nodeName)){\n\t\t\t\t\tcase \"name\" :\n\t\t\t\t\t\t$action->name = $node->textContent;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"gpio\" :\n\t\t\t\t\t\t$gpio = $this->read_gpio($node);\n\t\t\t\t\t\tarray_push($a_gpio,$gpio);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"description\" :\n\t\t\t\t\t\t$action->description = $node->textContent;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$action->id = $this->action_id++;\n\t\t\t$action->gpio = $a_gpio;\n\t\t\tarray_push($a_actions, $action);\n\t\t}\t\t\n\t\t\n\t\t// print_r($a_actions);\n\t\t$CFG->actions->list = $a_actions;\n\t}",
"protected function initializeActionEntries() {}",
"protected function xmlIniMapFactory()\n {\n $map = new Map();\n $map->add(\n Path::factory('/fwk/ini', 'ini', array())\n ->loop(true)\n ->attribute('category')\n ->value('value')\n );\n \n return $map;\n }",
"public function getActionDictionary() {}",
"function venture_geo_process_map_xml($id, $params) { \n $output = '';\n if ($params) {\n $output = \" <state id=\\\"$id\\\">\\n\";\n foreach ($params as $name => $value) {\n if($value) \n $output .= \" <$name>$value</$name>\\n\";\n }\n $output .= \" </state>\\n\";\n }\n return $output;\n}",
"private function generateXml()\n {\n\n $args = array(\n\n 'posts_per_page' => -1,\n 'numberposts' => -1,\n 'orderby' => 'post_type',\n 'order' => 'DESC',\n 'post_type' => apply_filters('fpcms_sitemap_post_types', array('post', 'page'))\n\n );\n\n if ($results = get_posts($args)) {\n\n $sitemap = new \\SimpleXMLElement($this->getDocStructure());\n\n foreach ($results as $result) {\n\n $url = $sitemap->addChild('url');\n $url->addChild('loc', get_permalink($result->ID));\n\n if (has_post_thumbnail($result->ID)) {\n\n if ($image = wp_get_attachment_image_src(get_post_thumbnail_id($result->ID))) {\n $url->addChild('image:image', $image[0]);\n }\n\n }\n\n $url->addChild('lastmod', mysql2date('Y-m-d', $result->post_date_gmt));\n\n if ($result->post_type == 'page') {\n\n //Pages should display higher than posts for the same keyword\n $url->addChild('priority', apply_filters('fpcms_sitemap_page_priority', '0.7'));\n\n } else {\n\n $url->addChild('priority', apply_filters('fpcms_sitemap_post_priority', '0.4'));\n\n }\n\n }\n\n return $sitemap->asXML();\n\n }\n\n }",
"public function sitemapAction() {\n\t\t\n\t\t$urls = array(\n\t\t\t'/',\n\t\t\t'/contact',\n\t\t\t'/map'\n\t\t);\n\t\t\n\t\t$regionDb = Yadda_Db_Table::getInstance('region');\n\t\t$select = $regionDb\n\t\t\t->select()\n\t\t\t->from('region', array('id'))\n\t\t\t->order('name');\n\t\t$regions = $regionDb->fetchAll($select);\n\t\tforeach ($regions as $region) {\n\t\t\t$urls[] = $this->view->url(array(), 'search').'?region='.urlencode($region['id']);\n\t\t}\n\t\t\n\t\t// generate XML\n\t\t\n\t\t$xml = new DOMDocument('1.0', 'utf-8');\n\t\t\n\t\t$urlset = $xml->createElement('urlset');\n\t\t$urlset->setAttribute('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9');\n\t\t$xml->appendChild($urlset);\n\t\t\n\t\tforeach ($urls as $url) {\n\t\t\t$loc = $xml->createElement('loc', 'http://'.$_SERVER['HTTP_HOST'].$url);\n\t\t\t$url = $xml->createElement('url');\n\t\t\t$url->appendChild($loc);\n\t\t\t$urlset->appendChild($url);\n\t\t}\n\t\t\n\t\t$this->getResponse()->setHeader('Content-Type', 'text/xml');\n\t\t$this->getResponse()->setBody($xml->saveXML(null, LIBXML_NOEMPTYTAG));\n\t\t$this->getResponse()->sendResponse();\n\t\tdie;\n\t\t/*\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"\n xmlns:image=\"http://www.sitemaps.org/schemas/sitemap-image/1.1\"\n xmlns:video=\"http://www.sitemaps.org/schemas/sitemap-video/1.1\">\n <url> \n <loc>http://www.example.com/foo.html</loc> \n <image:image>\n <image:loc>http://example.com/image.jpg</image:loc> \n </image:image>\n <video:video> \n <video:content_loc>http://www.example.com/video123.flv</video:content_loc>\n <video:thumbnail_loc>http://www.example.com/thumbs/123.jpg</video:thumbnail_loc>\n <video:player_loc allow_embed=\"yes\" autoplay=\"ap=1\">http://www.example.com/videoplayer.swf?video=123</video:player_loc>\n <video:title>Grilling steaks for summer</video:title> \n <video:description>Get perfectly done steaks every time</video:description>\n </video:video>\n </url>\n</urlset>\n\t\t */\n\t}",
"private function genSitemapXML() {\n $url_same = array();\n $sitemap_xml = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xmlns:image=\"http://www.google.com/schemas/sitemap-image/1.1\" xmlns:video=\"http://www.google.com/schemas/sitemap-video/1.1\">\n <!-- created by CSZ CMS Sitemap Generator www.cszcms.com -->'.\"\\n\";\n $sitemap_xml.= '<url>\n\t<loc>'.base_url().'</loc>\n\t<changefreq>always</changefreq>\n </url>'.\"\\n\";\n if($this->lang !== FALSE){ /* Language */\n foreach ($this->lang as $row) {\n $url = $this->Csz_model->base_link().'/lang/'.$row['lang_iso'];\n if(!in_array($url, $url_same)){\n $sitemap_xml.= '<url>\n <loc>'.$url.'</loc>\n <changefreq>always</changefreq>\n </url>'.\"\\n\";\n $url_same[] = $url;\n }\n }\n }\n if($this->menu_other !== FALSE){ /* Navigation */\n foreach ($this->menu_other as $row) {\n $chkotherlink = strpos($row['other_link'], BASE_URL);\n if($row['pages_id'] && $row['pages_id'] != NULL && $row['pages_id'] != 0){\n $pages = $this->Csz_model->getValue('page_url', 'pages', \"active = '1' AND pages_id = '\".$row['pages_id'].\"'\", '', 1, 'page_url', 'ASC'); \n if($row['drop_page_menu_id'] != 0 && $row['drop_page_menu_id'] != NULL){\n $main = $this->Csz_model->getValue('menu_name', 'page_menu', \"active = '1' AND page_menu_id = '\".$row['drop_page_menu_id'].\"'\", '', 1, 'menu_name', 'ASC'); \n $url = $this->Csz_model->base_link().'/'.$this->Csz_model->rw_link($main->menu_name).'/'.$pages->page_url;\n if(!in_array($url, $url_same)){\n $sitemap_xml.= '<url>\n <loc>'.$url.'</loc>\n <changefreq>always</changefreq>\n </url>'.\"\\n\";\n $url_same[] = $url;\n }\n }else{\n $url = $this->Csz_model->base_link().'/'.$pages->page_url;\n if(!in_array($url, $url_same)){\n $sitemap_xml.= '<url>\n <loc>'.$url.'</loc>\n <changefreq>always</changefreq>\n </url>'.\"\\n\";\n $url_same[] = $url;\n }\n }\n }else if($row['other_link'] && $row['other_link'] != NULL && $chkotherlink !== FALSE){ \n if(!in_array($row['other_link'], $url_same)){\n $sitemap_xml.= '<url>\n <loc>'.$row['other_link'].'</loc>\n <changefreq>always</changefreq>\n </url>'.\"\\n\";\n $url_same[] = $row['other_link'];\n }\n }else if($row['plugin_menu'] && $row['plugin_menu'] != NULL){\n $url = $this->Csz_model->base_link().'/plugin/'.$row['plugin_menu'];\n if(!in_array($url, $url_same)){\n $sitemap_xml.= '<url>\n <loc>'.$url.'</loc>\n <changefreq>always</changefreq>\n </url>'.\"\\n\";\n $url_same[] = $url;\n }\n }\n }\n }\n if($this->pages_content !== FALSE){ /* Pages Content without navigation */\n foreach ($this->pages_content as $row) {\n $url = $this->Csz_model->base_link().'/'.$row['page_url'];\n if(!in_array($url, $url_same)){\n $sitemap_xml.= '<url>\n <loc>'.$url.'</loc>\n <changefreq>always</changefreq>\n </url>'.\"\\n\";\n $url_same[] = $url;\n }\n }\n }\n if($this->plugin !== FALSE){ /* Plugin with sitemap config */\n foreach ($this->plugin as $row) {\n $plugin_db = $this->Csz_model->getPluginConfig($row['plugin_config_filename'], 'plugin_sitemap_viewtable');\n if(!empty($plugin_db)){\n $plugindata = $this->Csz_model->getValueArray('*', $plugin_db, $this->Csz_model->getPluginConfig($row['plugin_config_filename'], 'plugin_sqlextra_condition'), '', 0, $plugin_db.'_id', 'DESC');\n if($plugindata !== FALSE){\n foreach ($plugindata as $rs) {\n $url = $this->Csz_model->base_link().'/plugin/'.$this->Csz_model->getPluginConfig($row['plugin_config_filename'], 'plugin_urlrewrite').'/view/'.$rs[$plugin_db.'_id'].'/'.$rs['url_rewrite'];\n if(!in_array($url, $url_same)){\n $sitemap_xml.= '<url>\n <loc>'.$url.'</loc>\n <changefreq>always</changefreq>\n </url>'.\"\\n\";\n $url_same[] = $url;\n }\n if($row['plugin_config_filename'] == 'article'){\n $urlamp = $this->Csz_model->base_link().'/plugin/'.$this->Csz_model->getPluginConfig($row['plugin_config_filename'], 'plugin_urlrewrite').'/amp/'.$rs[$plugin_db.'_id'].'/'.$rs['url_rewrite'];\n if(!in_array($urlamp, $url_same)){\n $sitemap_xml.= '<url>\n <loc>'.$urlamp.'</loc>\n <changefreq>always</changefreq>\n </url>'.\"\\n\";\n $url_same[] = $urlamp;\n }\n }\n }\n }\n }\n $plugin_cat_db = $this->Csz_model->getPluginConfig($row['plugin_config_filename'], 'plugin_sitemap_cattable');\n if(!empty($plugin_cat_db)){\n $plugindata = $this->Csz_model->getValueArray('*', $plugin_cat_db, $this->Csz_model->getPluginConfig($row['plugin_config_filename'], 'plugin_sqlextra_catcondition'), '', 0, $plugin_cat_db.'_id', 'DESC');\n if($plugindata !== FALSE){\n foreach ($plugindata as $rs) {\n $url = $this->Csz_model->base_link().'/plugin/'.$this->Csz_model->getPluginConfig($row['plugin_config_filename'], 'plugin_urlrewrite').'/category/'.$rs['url_rewrite'];\n if(!in_array($url, $url_same)){\n $sitemap_xml.= '<url>\n <loc>'.$url.'</loc>\n <changefreq>always</changefreq>\n </url>'.\"\\n\";\n $url_same[] = $url;\n }\n }\n }\n }\n } \n }\n $sitemap_xml.= '</urlset>'.\"\\n\";\n if($sitemap_xml){\n /* Gen sitemap.xml */\n $file_path = FCPATH.\"sitemap.xml\";\n $fopen = fopen($file_path, 'wb') or die(\"can't open file\");\n fwrite($fopen, $sitemap_xml);\n fclose($fopen);\n /* Gen sitemap.xml.gz */\n $gzdata = @gzencode($sitemap_xml, 9);\n if($gzdata !== FALSE){\n $fopen1 = fopen(FCPATH.\"sitemap.xml.gz\", 'wb') or die(\"can't open file\");\n fwrite($fopen1, $gzdata);\n fclose($fopen1);\n }\n\t}\n }",
"protected static function dataMapProcessKey($source_data, $actions)\n\t{\n\t\t$data = array();\n\t\t\n\t\t// If an array, this key can map to multiple other actions\n\t\tif (is_array($actions))\n\t\t{\n\t\t\tforeach ($actions AS $action)\n\t\t\t{\n\t\t\t\t$data = array_merge($data, self::dataMapProcessKey($source_data, $action));\n\t\t\t}\n\t\t}\n\t\t// If an action begins with a '/' assume it is a regular expression with named subpatterns\n\t\telseif ($actions[0] == '/')\n\t\t{\n\t\t\tif (preg_match($actions, $source_data, $matches))\n\t\t\t{\n\t\t\t\tforeach ($matches AS $match_name => $match_value)\n\t\t\t\t{\n\t\t\t\t\tif (!is_int($match_name))\n\t\t\t\t\t{\n\t\t\t\t\t\t$data[$match_name] = $match_value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$data[$actions] = $source_data;\n\t\t}\n\t\t\n\t\treturn $data;\n\t}",
"private static function xml_route(){\n\t\t\n\t\t$xml_routes=new Parser();\n\t\t$xml_routes->load_from_file('routes.xml');\n\t\t$request=(isset($_GET['request']))?$_GET['request']:'/index';\n\t\t$route_found=false;\n\t\t\n\t\t$routes=$xml_routes->getElementsByAttributeValue('method', Request::get_request_type());\n\t\t\n\t\t$str_routes=\"\";\n\t\t$found_route=null;\n\t\tforeach ($routes as $item){\n\t\t\t\n\t\t\tif($item->nodeType==XML_ELEMENT_NODE){\n\t\t\t\tforeach($item->childNodes as $attr){\n\t\t\t\t\t\n\t\t \tif($attr->nodeType==XML_ELEMENT_NODE){\n\t\t \n\t\t \t\tif($attr->tagName==\"request\"){\n\t\t \t\t\tif($item->getAttribute('method')==$_SERVER['REQUEST_METHOD']){\n\t\t \t\t\t\t$match_route=$item->cloneNode(true);\n\t\t \t\t\t\t//print \"{$match_route->getElementsByTagName('request')->item(0)->nodeValue}\\n\";\n\t\t \t\t\t\t\n\t\t \t\t\t\t$controller=$match_route->getElementsByTagName('controller')->item(0)->nodeValue;\n\t\t \t\t\t\t$action=$match_route->getElementsByTagName('action')->item(0)->nodeValue;\n\t\t \t\t\t\t\n\t\t \t\t\t\t$match=str_ireplace('/','\\\\/',$match_route->getElementsByTagName('request')->item(0)->nodeValue);\n\t\t \t\t\t\t//$match.=\"(\\\\/(.*))?\";\n\t\t \t\t\t\t$match='/^'.$match.'$/';\n\t\t \t\t\t\t$replace=\"/$controller/$action\";\n\t\t \t\t\t\tif($match_route->getAttribute('args')==true){\n\t\t \t\t\t\t\t$number_args=($match_route->getAttribute('argsnum')!==null)?$match_route->getAttribute('argsnum'):1;\n\t\t \t\t\t\t\tfor($i=1;$i<=$number_args;$i++)\n\t\t \t\t\t\t\t$replace.=\"/$\".$i;\n\t\t \t\t\t\t}\n\t\t \t\t\t\tif(preg_match($match, $request)){\n\t\t \t\t\t\t\t$request=preg_replace($match,$replace,$request);\n\t\t \t\t\t\t\t$found_route=$item->cloneNode(true);\n\t\t \t\t\t\t\t\n\t\t \t\t\t\t\t//print \"Found\\n\";\n\t\t \t\t\t\t\tbreak;\n\t\t \t\t\t\t}\n\t\t \t\t\t}\n\t\t \t\t}\n\t\t \t}\n\t\t\t\t}\n\t\t }\n\t\t if($found_route!==null){\n\t\t \tbreak;\n\t\t }\n\t\t}\n\t\t\n\t\treturn $request;\n\t}",
"public function sitemap_xml()\n {\n // Get All Pages.\n $this->data['pages'] = $this->pages->get_all(FALSE, 0, 'ASC', FALSE);\n // Get All Sermons.\n $this->data['sermons'] = $this->sermons->get_sermons(FALSE, FALSE, FALSE, 0, \"DESC\", FALSE);\n // Get All Posts\n $this->data['posts'] = $this->posts->get_all(FALSE, 0, 'ASC', FALSE);\n // Get All Post Categories\n $this->data['post_categories'] = $this->categories->get_all();\n\n // Set page content to xml.\n header(\"Content-Type: text/xml;charset=iso-8859-1\");\n $this->load->view(\"sitemap/sitemap\", $this->data);\n }",
"function get_map($source)\n{\n // for dest_position, 0/1/2 denotes root/extras/resources.\n $map_json = array(\n 'title' => array('title', 0),\n 'notes' => array('description', 0),\n 'publisher' => array('publisher', 1),\n 'public_access_level' => array('accessLevel', 1),\n 'contact_email' => array('mbox', 1),\n 'contact_name' => array('person', 1),\n 'unique_id' => array('identifier', 1),\n 'tags' => array('keyword', 0),\n 'tag_string' => array('keyword', 0),\n 'data_dictionary' => array('dataDictionary', 1),\n 'license_title' => array('license', 0),\n 'category' => array('theme', 1),\n 'spatial' => array('spatial', 1),\n 'temporal' => array('temporal', 1),\n 'release_date' => array('issued', 1),\n 'accrual_periodicity' => array('accrualPeriodicity', 1),\n 'related_documents' => array('references', 1),\n 'language' => array('language', 1),\n 'data_quality' => array('dataQuality', 1),\n 'homepage_url' => array('landingPage', 1),\n 'system_of_records' => array('systemOfRecords', 1),\n 'url' => array('accessURL', 2),\n 'format' => array('format', 2),\n );\n\n // 'dest_key' => array('source_key', dest_position)\n // for dest_position, 0/1/2 denotes root/extras/resources.\n $map_datajson = array(\n 'title' => array('title', 0),\n 'notes' => array('description', 0),\n 'publisher' => array('publisher', 1),\n 'public_access_level' => array('accessLevel', 1),\n 'contact_email' => array('mbox', 1),\n 'contact_name' => array('contactPoint', 1),\n 'unique_id' => array('identifier', 1),\n 'tags' => array('keyword', 0),\n 'tag_string' => array('keyword', 0),\n 'data_dictionary' => array('dataDictionary', 1),\n 'license_title' => array('license', 0),\n 'category' => array('theme', 1),\n 'spatial' => array('spatial', 1),\n 'temporal' => array('temporal', 1),\n 'release_date' => array('issued', 1),\n 'accrual_periodicity' => array('accrualPeriodicity', 1),\n 'related_documents' => array('references', 1),\n 'bureau_code' => array('bureauCode', 1),\n 'program_code' => array('programCode', 1),\n 'language' => array('language', 1),\n 'data_quality' => array('dataQuality', 1),\n 'homepage_url' => array('landingPage', 1),\n //'system_of_records' => array('systemOfRecords', 1),\n 'url' => array('accessURL', 2),\n 'format' => array('format', 2),\n );\n\n // 'dest_key' => array('source_key', dest_position)\n // for dest_position, 0/1/2 denotes root/extras/resources.\n $map_socratajson = array(\n 'title' => array('title', 0),\n 'notes' => array('description', 0),\n 'publisher' => array('publisher', 1),\n 'public_access_level' => array('accessLevel', 1),\n 'contact_email' => array('mbox', 1),\n 'contact_name' => array('contactPoint', 1),\n 'unique_id' => array('identifier', 1),\n 'tags' => array('keyword', 0),\n 'tag_string' => array('keyword', 0),\n 'data_dictionary' => array('dataDictionary', 1),\n 'license_title' => array('license', 0),\n 'category' => array('theme', 1),\n 'spatial' => array('spatial', 1),\n 'temporal' => array('temporal', 1),\n 'release_date' => array('issued', 1),\n 'accrual_periodicity' => array('accrualPeriodicity', 1),\n 'related_documents' => array('references', 1),\n 'bureau_code' => array('bureauCode', 1),\n 'program_code' => array('programCode', 1),\n 'language' => array('language', 1),\n 'data_quality' => array('dataQuality', 1),\n 'homepage_url' => array('landingPage', 1),\n //'system_of_records' => array('systemOfRecords', 1),\n 'upload' => array('upload', 2),\n 'format' => array('format', 2),\n 'name' => array('name', 2),\n 'modified' => array('modified',1),\n );\n\n // 'dest_key' => array('source_key', dest_position, source_position)\n // 0/1/2 denotes root/extras/resources.\n $map_ckan = array(\n 'title' => array('title', 0, 0),\n 'notes' => array('notes', 0, 0),\n // hard-code publisher to orgnization.title in ckan_map for now.\n // todo: change this map structure.\n 'publisher' => array('place-holder', 1, 1),\n 'public_access_level' => array('access-level', 1, 1),\n 'contact_email' => array('contact-email', 1, 1),\n 'contact_name' => array('person', 1, 1),\n 'unique_id' => array('id', 1, 0),\n 'tags' => array('tags', 0, 1),\n 'tag_string' => array('keyword', 0),\n 'data_dictionary' => array('data-dictiionary', 1, 1), // there is a typo.\n 'license_title' => array('license_title', 0, 0),\n 'spatial' => array('spatial-text', 1, 1),\n 'temporal' => array('dataset-reference-date', 1, 1),\n 'release_date' => array('issued', 1, 1),\n 'accrual_periodicity' => array('frequency-of-update', 1, 1),\n 'related_documents' => array('references', 1, 1),\n 'language' => array('metadata-language', 1, 1),\n 'homepage_url' => array('url', 1, 0),\n 'url' => array('url', 2, 2),\n 'name' => array('name', 2, 2),\n 'format' => array('format', 2, 2),\n );\n\n $ret_map = \"map_$source\";\n return isset($$ret_map) ? $$ret_map : null;\n}",
"function map_action($action) {\n return $action . '_action';\n }",
"function webmap_compo_lib_xml_build()\r\n{\r\n\t$this->webmap_compo_lib_xml_base();\r\n}",
"public function generateMap()\n {\n try\n {\n // Select all published articles and pages.\n // Lessons and other new stuff to be added upon needed.\n $pgs = ORM::factory( 'Page' )\n ->where( 'status', '>', 0 )\n ->find_all()->as_array();\n\n $articles = ORM::factory( 'Article' )\n ->where( 'status', '>', 0 )\n ->find_all()->as_array();\n \n // Place found URLs into the container array.\n $pages = [];\n foreach ( array_merge( $pgs, $articles ) as $value )\n array_push ( $pages, $value->make_full_url () );\n \n // Select whatever is already in the map...\n $urls = [];\n foreach ( $this->map->children() as $node )\n $urls[] = ( string )$node->loc;\n\n // Delete redundant links\n foreach ( array_diff( $urls, $pages ) as $url )\n $this->removeEntry( $url, FALSE, TRUE );\n\n // Add missing links.\n foreach ( array_diff( $pages, $urls ) as $uri )\n $this->addEntry ( $uri, NULL, FALSE, TRUE );\n\n // Save result into the file.\n return $this->save();\n }\n catch ( Exception $e )\n {\n Kohana::$log->add( LOG_ERR, $e->getMessage() );\n return FALSE;\n }\n }",
"public static function attributeMap();",
"protected function parseXmlNode(\\DOMElement $node, $map) {\n /** @var \\DOMElement $attribute */\n $attribute = $node->firstChild;\n $result = [];\n do {\n $name = $attribute->localName;\n if (isset($map['sourceMap'][$name])) {\n foreach($map['sourceMap'][$name] as $target) {\n //pass null since we do not have implemented $row yes to pass to normalize\n $value = $this->normalize($attribute->nodeValue, $map['map'][$target]['type'], $node);\n\n if (isset($result[$target])) {\n switch ($map['map'][$target]['multiple']) {\n case 'array': if (is_array($result[$target])) {\n $result[$target][] = $value;\n } else {\n $result[$target] = [$result[$target], $value];\n }\n break;\n case 'last':\n $result[$target] = $value;\n break;\n default:\n throw new \\Exception(\"Unknown value for multiple: {$map['map'][$target]['multiple']}\");\n\n }\n } else {\n $result[$target] = $value;\n }\n }\n }\n } while(null !== $attribute = $attribute->nextSibling);\n foreach($map['map'] as $target => $def) {\n if (!isset($result[$target])) {\n $result[$target] = null;\n }\n }\n return $result;\n }",
"public function loadXml($filename,$map_path){\r\n \r\n $this->rootPath = $this->_preparePath($map_path);\r\n \r\n if(!File::exists( $this->rootPath .DS. $filename ))\r\n App::critical_error ('XML document not found: '.$this->rootPath .DS. $filename);\r\n \r\n $xmlDoc = $this->_initDocument($this->rootPath .DS. $filename);\r\n \r\n //get the project elements\r\n $elements = $xmlDoc->getElementsByTagName('element');\r\n \r\n foreach($elements as $element){\r\n \r\n if(count($this->elements) == 0 ){\r\n $this->elements = $this->_loadElement($element);\r\n }\r\n else{\r\n $this->elements = array_merge($this->elements,$this->_loadElement($element));\r\n }\r\n }\r\n \r\n //isolate the template key\r\n if(!is_null($this->_templatekey) && !is_null($this->elements[$this->_templatekey]))\r\n $this->elements['templates'] = $this->elements[$this->_templatekey];\r\n \r\n //clean the element values\r\n //array_walk_recursive($this->element, array($this, '_clean'));\r\n \r\n return File::put(APP_PROJECT .DS. 'elements.php' ,serialize($this->elements)); \r\n }",
"protected function buildLocalActions(): array {\n $build = $this->localActionManager->getActionsForRoute($this->routeMatch->getRouteName());\n // Without this workaround, the action links will be rendered as <li> with\n // no wrapping <ul> element.\n if (!empty($build)) {\n $build['#prefix'] = '<ul class=\"action-links\">';\n $build['#suffix'] = '</ul>';\n }\n return $build;\n }",
"public function refreshActionLookups()\n {\n //\n }",
"protected function buildRoutes()\n {\n $routes = array();\n \n foreach (glob($this->dir.'*.xml') as $file) {\n $xml = simplexml_load_file($file);\n \n $attr = $xml -> attributes();\n $actionsNS = isset($attr['namespace']) ? $attr['namespace'].'\\\\' : '';\n $module = isset($attr['module']) ? $attr['module'].'/' : '';\n \n foreach ($xml->children() as $tag) {\n $id = (string) $tag['id'];\n $method = (string) $tag['method'];\n $pattern = (string) $tag -> url;\n $action = (string) $tag -> action;\n \n $params = [];\n \n if (isset($tag -> params)) {\n foreach ($tag -> params -> children() as $param) {\n $arr = (array) $param -> attributes();\n $arr = $arr['@attributes'];\n \n if (isset($arr['required'])) {\n $arr['required'] = $arr['required'] == 'true' ? true : false;\n }\n \n $params[$arr['name']] = $arr;\n }\n }\n \n if (isset($routes[$module.$id])) {\n throw new \\RuntimeException('Duplicated Route ID: '.$module.$id.' in '.$file.'!');\n }\n \n $routes[$module.$id] = new PatternRoute(\n $this->getActionClass($action, $actionsNS, $id),\n strtoupper($method),\n $pattern,\n $params\n );\n }\n }\n \n return $routes;\n }",
"public function getInstanceFromXML($xml, &$xmlMapping, $tracker) {\n $rules = array();\n //test this better\n if(property_exists($xml, 'list_rules')) {\n $list_rules = $xml->list_rules;\n $rules['list_rules'] = $this->generateListRulesArrayFromXml($list_rules, $xmlMapping, $tracker);\n }\n \n if(property_exists($xml, 'date_rules')) {\n $date_rules = $xml->date_rules;\n $rules['date_rules'] = $this->generateDateRulesArrayFromXml($date_rules, $xmlMapping, $tracker);\n }\n\n return $rules;\n }"
]
| [
"0.70240086",
"0.60125303",
"0.555362",
"0.5550691",
"0.54016286",
"0.5391256",
"0.5335074",
"0.53046703",
"0.52497953",
"0.5238481",
"0.5210544",
"0.516157",
"0.507359",
"0.50047517",
"0.49701786",
"0.49166536",
"0.4909372",
"0.48981518",
"0.48906216",
"0.48865682",
"0.48664922",
"0.48366362",
"0.48233208",
"0.4810854",
"0.47625044",
"0.4760871",
"0.47309852",
"0.47095707",
"0.46981734",
"0.46946082"
]
| 0.76401955 | 0 |
Builds an XML Map used to parse .ini includes | protected function xmlIniMapFactory()
{
$map = new Map();
$map->add(
Path::factory('/fwk/ini', 'ini', array())
->loop(true)
->attribute('category')
->value('value')
);
return $map;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function build_xml_map() {\n $this->_create_map();\n header(\"content-type: text/xml\");\n echo $this->result;\n }",
"protected function xmlPluginsMapFactory()\n {\n $map = new Map();\n $map->add(\n Path::factory('/fwk/plugin', 'plugins')\n ->loop(true)\n ->attribute('class')\n ->attribute('service')\n ->addChildren(\n Path::factory('param', 'params')\n ->attribute('name')\n ->filter(array($this, 'propertizeString'))\n ->value('value')\n ->loop(true)\n )\n );\n\n return $map;\n }",
"abstract protected function buildMap();",
"protected function xmlServicesMapFactory()\n {\n $map = new Map();\n $map->add(\n Path::factory('/fwk/services', 'services', array())\n ->loop(true, '@xml')\n ->attribute('xmlMap')\n );\n \n return $map;\n }",
"public function getXMLPageMap() {\n\t\tstatic $xml;\n\n\t\tif (isset($xml)) return $xml;\n\t\t$cache = SA_SimpleCache::singleton('__XML_PAGES_MAP__');\n\t\tif ($xmlString = $cache->load()) {\n\t\t\t$xml = new SimpleXMLElement($xmlString);\n\t\t} else {\n\t\t\t$xml = new SimpleXMLElement('<?xml version=\"1.0\" standalone=\"yes\"?><pages/>');\n\t\t\t$this->xmlFileSystem($this->getPagesDir(), $xml);\n\t\t\t$cache->save($xml->asXML());\n\t\t}\n\t\treturn $xml;\n\t}",
"public function getINIEntries()\n {\n }",
"function generate_mapservice_conf_file(){\n\t\t$dom;\n\t\tif(!$dom = domxml_open_file($this->default_mapservconf_file)){\n\t\t\techo \"Could not open xml file: \" . $this->default_mapservconf_file;\n\t\t\treturn NULL; \n\t\t}\n\t\t$mapservice = $this->find_mapservice($dom);\n\t\t// map service not found\n\t\tif($mapservice == NULL){\n\t\t\techo \"could not find map-service named: \" . $mapservice_name ;\n\t\t\treturn NULL;\n\t\t}\n\t\t\n\t\t$children = $mapservice->child_nodes();\n\t\t$n_children = count($children);\n\t\t\n\t\t// loop through to find <map-file>\n\t\t// and <layer-config> element\n\t\tfor($i = 0; $i < $n_children; $i++){\n\t\t\tswitch ($children[$i]->tagname){\n\t\t\t\tcase \"map-file\":\n\t\t\t\t\t$this->change_node_content($dom, $children[$i], $this->output_mapfile);\n\t\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\tcase \"layer-config-file\":\n\t\t\t\t\t$this->change_node_content($dom, $children[$i], $this->output_layerconf);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\t$dom->dump_file($this->output_mapservconf, false, false);\n\t\treturn $this->output_mapservconf;\n\t}",
"public function buildClassAliasMapFile() {}",
"protected function getMap(): ReferenceMap\n {\n return new ReferenceMap(\n [\n new SrcNode(\n new \\SplFileInfo('folder/Example/ClassExample.php'),\n new FullClassName('Example', 'ClassExample'),\n [\n new Inheritance(0, new FullClassName('Example', 'ParentClassExample')),\n new Inheritance(0, new FullClassName('', 'FilterIterator')),\n new Dependency(0, new FullClassName('Example', 'AnotherClassExample')),\n new Dependency(0, new FullClassName('Vendor', 'ThirdPartyExample')),\n new Dependency(0, new FullClassName('', 'iterable')),\n new Composition(0, new FullClassName('Example', 'InterfaceExample')),\n new Composition(0, new FullClassName('Example', 'AnotherInterface')),\n new Composition(0, new FullClassName('', 'iterable')),\n new Mixin(0, new FullClassName('Example', 'TraitExample')),\n new Mixin(0, new FullClassName('', 'PHPDocElement'))\n ]\n )\n ],\n [\n new FullClassName('', 'iterable'),\n new FullClassName('', 'FilterIterator'),\n new FullClassName('', 'PHPDocElement'),\n ],\n [\n new ComposerPackage('main', [], [], [], [])\n ]\n );\n }",
"private function config_file_listing($includenull = false) {\n\n\t\t$this->EE->load->helper('directory');\n\t\t$map = $map = directory_map(PATH_THIRD.'dm_eeck/config/',1);\n\n\t\t$out = array();\n\n\t\tif($includenull) {\n\t\t\t$out[] = $this->EE->lang->line('dm_eeck_global_default');\n\t\t}\n\n\t\t$name = '';\n\n\t\tforeach($map as $file) {\n\t\t\tunset($name);\n\t\t\tinclude(PATH_THIRD.'dm_eeck/config/'.$file);\n\t\t\tif(!isset($name)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$out[$file] = $name;\n\t\t}\n\n\t\treturn $out;\n\t}",
"function infoDictionary() {}",
"private function parseConfigFile($file) {\n\t\tif (! file_exists($file)) {\n\t\t\treturn '{}';\n\t\t}\n\n\t\t$xml = simplexml_load_file($file);\n\t\tif (! ($xml instanceof SimpleXMLElement)) {\n\t\t\treturn '{}';\n\t\t}\n\n\t\tif (! isset($xml->fieldset)) {\n\t\t\treturn '{}';\n\t\t}\n\n\t\t// Getting the fieldset tags\n\t\t$fieldsets = $xml->fieldset;\n\n\t\t// Creating the data collection variable:\n\t\t$ini = array ();\n\n\t\t// Iterating through the fieldsets:\n\t\tforeach ($fieldsets as $fieldset) {\n\t\t\tif (! count($fieldset->children())) {\n\t\t\t\t// Either the tag does not exist or has no children therefore we return zero files processed.\n\t\t\t\treturn '{}';\n\t\t\t}\n\n\t\t\t// Iterating through the fields and collecting the name/default values:\n\t\t\tforeach ($fieldset as $field) {\n\t\t\t\t// Check against the null value since otherwise default values like \"0\"\n\t\t\t\t// cause entire parameters to be skipped.\n\n\t\t\t\tif (($name = $field->attributes()->name) === null) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (($value = $field->attributes()->default) === null) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t$ini[(string) $name] = (string) $value;\n\t\t\t}\n\t\t}\n\n\t\treturn json_encode($ini);\n\t}",
"private function LoadConstants()\r\n\t{\r\n\t\t$data_config = $this->LoadData('application/data/appconfig.xml','config');\r\n\t\t\r\n\t\tif(!defined(\"NEW_LINE\"))\r\n\t\t\tdefine(\"NEW_LINE\",\"\\n\");\r\n\t\t\t\r\n\t\tforeach ($data_config AS $elem)\r\n\t\t{\r\n\t\t\tif(!defined(strtoupper('sitename')))\r\n\t\t\t\tdefine(strtoupper('sitename'),$elem->getElementsByTagName('sitename')->item(0)->nodeValue);\r\n\t\t\t\t\r\n\t\t\tif(!defined(strtoupper('tagline')))\r\n\t\t\t\tdefine(strtoupper('tagline'),$elem->getElementsByTagName('tagline')->item(0)->nodeValue);\r\n\t\t\t\t\r\n\t\t\tif(!defined(strtoupper('ownername')))\t\r\n\t\t\t\tdefine(strtoupper('ownername'),$elem->getElementsByTagName('ownername')->item(0)->nodeValue);\r\n\t\t\t\t\r\n\t\t\tif(!defined(strtoupper('owneremail')))\t\r\n\t\t\t\tdefine(strtoupper('owneremail'),$elem->getElementsByTagName('owneremail')->item(0)->nodeValue);\r\n\t\t\t\t\r\n\t\t\tif(!defined(strtoupper('appversion')))\r\n\t\t\t\tdefine(strtoupper('appversion'),$elem->getElementsByTagName('appversion')->item(0)->nodeValue);\r\n\t\t\t\r\n\t\t\t$path = $elem->getElementsByTagName('paths');\r\n\t\t\tif($path->length > 0)\r\n\t\t\t{\r\n\t\t\t\tforeach ($path AS $nested)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(!defined(strtoupper('application')))\r\n\t\t\t\t\t\tdefine(strtoupper('application'),$nested->getElementsByTagName('application')->item(0)->nodeValue);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\tif(!defined(strtoupper('controls')))\r\n\t\t\t\t\t\tdefine(strtoupper('controls'),$nested->getElementsByTagName('controls')->item(0)->nodeValue);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\tif(!defined(strtoupper('data')))\r\n\t\t\t\t\t\tdefine(strtoupper('data'),$nested->getElementsByTagName('data')->item(0)->nodeValue);\r\n\r\n\t\t\t\t\tif(!defined(strtoupper('templates')))\r\n\t\t\t\t\t\tdefine(strtoupper('templates'),$nested->getElementsByTagName('templates')->item(0)->nodeValue);\r\n\r\n\t\t\t\t\tif(!defined(strtoupper('navigation')))\n\t\t\t\t\t\tdefine(strtoupper('navigation'),$nested->getElementsByTagName('navigation')->item(0)->nodeValue);\r\n\t\t\t\t\t\r\n\t\t\t\t\tif(!defined(strtoupper('navigationdata')))\n\t\t\t\t\t\tdefine(strtoupper('navigationdata'),$nested->getElementsByTagName('navigationdata')->item(0)->nodeValue);\r\n\t\t\t\t\t\r\n\t\t\t\t\tif(!defined(strtoupper('modules')))\r\n\t\t\t\t\t\tdefine(strtoupper('modules'),$nested->getElementsByTagName('modules')->item(0)->nodeValue);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\tif(!defined(strtoupper('pages')))\r\n\t\t\t\t\t\tdefine(strtoupper('pages'),$nested->getElementsByTagName('pages')->item(0)->nodeValue);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\tif(!defined(strtoupper('public')))\r\n\t\t\t\t\t\tdefine(strtoupper('public'),$nested->getElementsByTagName('public')->item(0)->nodeValue);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\tif(!defined(strtoupper('logs')))\r\n\t\t\t\t\t\tdefine(strtoupper('logs'),$nested->getElementsByTagName('logs')->item(0)->nodeValue);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tunset($data_config);\r\n\t}",
"function get_parse_ini($file)\n{\n if (!is_file($file))\n return false;\n\n $ini = file($file);\n\n // to hold the categories, and within them the entries\n $cats = array();\n\n foreach ($ini as $i) {\n if (@preg_match('/\\[(.+)\\]/', $i, $matches)) {\n $last = $matches[1];\n } elseif (@preg_match('/(.+)=(.+)/', $i, $matches)) {\n $cats[$last][trim($matches[1])] = trim($matches[2]);\n }\n }\n\n return $cats;\n\n}",
"public function get_ini_entries() {\n\t\treturn $this->ini_entries;\n\t}",
"protected function generateMapFile()\n {\n $namespace = $this->getNamespace();\n $class = $this->options['class'];\n\n $php = <<<EOD\n<?php\n\nnamespace $namespace;\n\nuse $namespace\\\\Base\\\\${class}Map as Base${class}Map;\nuse $namespace\\\\${class};\nuse \\\\Pomm\\\\Exception\\\\Exception;\nuse \\\\Pomm\\\\Query\\\\Where;\n\nclass ${class}Map extends Base${class}Map\n{\n}\n\nEOD;\n\n return $php;\n }",
"protected function generate()\n {\n // first of all we will get the version, so we will later know about changes made DURING indexing\n $this->version = $this->findVersion();\n\n // get the iterator over our project files and create a regex iterator to filter what we got\n $recursiveIterator = $this->getProjectIterator();\n $regexIterator = new \\RegexIterator($recursiveIterator, '/^.+\\.php$/i', \\RecursiveRegexIterator::GET_MATCH);\n\n // get the list of enforced files\n $enforcedFiles= $this->getEnforcedFiles();\n\n // if we got namespaces which are omitted from enforcement we have to mark them as such\n $omittedNamespaces = array();\n if ($this->config->hasValue('enforcement/omit')) {\n $omittedNamespaces = $this->config->getValue('enforcement/omit');\n }\n\n // iterator over our project files and add array based structure representations\n foreach ($regexIterator as $file) {\n // get the identifiers if any.\n $identifier = $this->findIdentifier($file[0]);\n\n // if we got an identifier we can build up a new map entry\n if ($identifier !== false) {\n // We need to get our array of needles\n $needles = array(\n Invariant::ANNOTATION,\n Ensures::ANNOTATION,\n Requires::ANNOTATION,\n After::ANNOTATION,\n AfterReturning::ANNOTATION,\n AfterThrowing::ANNOTATION,\n Around::ANNOTATION,\n Before::ANNOTATION,\n Introduce::ANNOTATION,\n Pointcut::ANNOTATION\n );\n\n // If we have to enforce things like @param or @returns, we have to be more sensitive\n if ($this->config->getValue('enforcement/enforce-default-type-safety') === true) {\n $needles[] = '@var';\n $needles[] = '@param';\n $needles[] = '@return';\n }\n\n // check if the file has contracts and if it should be enforced\n $hasAnnotations = $this->findAnnotations($file[0], $needles);\n\n // create the entry\n $this->map[$identifier[1]] = array(\n 'cTime' => filectime($file[0]),\n 'identifier' => $identifier[1],\n 'path' => $file[0],\n 'type' => $identifier[0],\n 'hasAnnotations' => $hasAnnotations,\n 'enforced' => $this->isFileEnforced(\n $file[0],\n $identifier[1],\n $hasAnnotations,\n $enforcedFiles,\n $omittedNamespaces\n )\n );\n }\n }\n\n // save for later reuse.\n $this->save();\n }",
"private function generateSiteMapMain()\n {\n $this->load->model('extension/module/siteMapGenerate');\n $output = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>';\n $output .= '<sitemapindex xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">';\n\n foreach ($this->includedFiles as $file) {\n $removeFromUrl = mb_substr($file, 0, mb_strrpos($file, '/'));;\n $clearFileUrl = str_replace($removeFromUrl . '/', '', $file);\n $output .= '<sitemap>';\n $output .= '<loc>' . $this->siteUrl . $clearFileUrl . '</loc>';\n $output .= '</sitemap>';\n }\n\n $output \t.= '</sitemapindex>';\n $this->response->addHeader('Content-Type: application/xml');\n\n $siteMapXmlUrl = DIR_MAIN . 'sitemap_custom.xml';\n $openedFile = fopen($siteMapXmlUrl, 'w');\n chmod($siteMapXmlUrl, 0775);\n file_put_contents($siteMapXmlUrl, $output);\n fclose($openedFile);\n }",
"public function getConfigurationsMap()\n {\n $sel = $this->getAllConfigurations();\n $arr = array();\n foreach ($sel as $cf)\n $arr[$cf->identifier] = $cf->identifier;\n \n return $arr;\n }",
"public static function attributeMap();",
"protected function register_titles_ini( $ini = self::TITLES_INI )\r\n\t\t{\r\n\t\t\t$this->titles = parse_ini_file( $ini );\r\n\t\t\t\r\n\t\t}",
"protected function xmlListenersMapFactory()\n {\n $map = new Map();\n $map->add(\n Path::factory('/fwk/listener', 'listeners')\n ->loop(true)\n ->attribute('class')\n ->attribute('service')\n ->addChildren(\n Path::factory('param', 'params')\n ->attribute('name')\n ->filter(array($this, 'propertizeString'))\n ->value('value')\n ->loop(true)\n )\n );\n \n return $map;\n }",
"function loadIniFiles()\n {\n \n $ff = HTML_FlexyFramework::get();\n $ff->generateDataobjectsCache(true);\n $this->dburl = parse_url($ff->database);\n \n \n $dbini = 'ini_'. basename($this->dburl['path']);\n \n \n $iniCache = isset( $ff->PDO_DataObject) ? $ff->PDO_DataObject['schema_location'] : $ff->DB_DataObject[$dbini];\n if (!file_exists($iniCache)) {\n return;\n }\n \n $this->schema = parse_ini_file($iniCache, true);\n $this->links = parse_ini_file(preg_replace('/\\.ini$/', '.links.ini', $iniCache), true);\n \n\n \n }",
"function parseIniFile($iIniFile)\n\t{\n\t\t$aResult =\n\t\t$aMatches = array();\n\t\n\t\t$a = &$aResult;\n\t\t$s = '\\s*([[:alnum:]_\\- \\*]+?)\\s*';\tpreg_match_all('#^\\s*((\\['.$s.'\\])|((\"?)'.$s.'\\\\5\\s*=\\s*(\"?)(.*?)\\\\7))\\s*(;[^\\n]*?)?$#ms', @file_get_contents($iIniFile), $aMatches, PREG_SET_ORDER);\n\t\n\t\tforeach ($aMatches as $aMatch)\n\t\t\t{\n\t\t\tif (empty($aMatch[2]))\n\t\t\t\t\t$a [$aMatch[6]] = $aMatch[8];\n\t\t\t else\t$a = &$aResult [$aMatch[3]];\n\t\t\t}\n\t\n\t\treturn $aResult;\n\t}",
"public static function buildTableMap()\n {\n $dbMap = Propel::getServiceContainer()->getDatabaseMap(CKOrderXmlTableMap::DATABASE_NAME);\n if (!$dbMap->hasTable(CKOrderXmlTableMap::TABLE_NAME)) {\n $dbMap->addTableObject(new CKOrderXmlTableMap());\n }\n }",
"public static function config($_file) {\n\t\t// Generate hash code for config file\n\t\t$_hash='php.'.self::hashCode($_file);\n\t\t$_cached=Cache::cached($_hash);\n\t\tif ($_cached && filemtime($_file)<$_cached['time'])\n\t\t\t// Retrieve from cache\n\t\t\t$_save=gzinflate(Cache::fetch($_hash));\n\t\telse {\n\t\t\tif (!file_exists($_file)) {\n\t\t\t\t// .ini file not found\n\t\t\t\tself::$global['CONTEXT']=$_file;\n\t\t\t\ttrigger_error(self::TEXT_Config);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Map sections to framework methods\n\t\t\t$_map=array('global'=>'set','routes'=>'route','maps'=>'map');\n\t\t\t// Read the .ini file\n\t\t\tpreg_match_all(\n\t\t\t\t'/\\s*(?:\\[(.+?)\\]|(?:;.+?)*|(?:([^=]+)=(.+?)))(?:\\v|$)/s',\n\t\t\t\t\tfile_get_contents($_file),$_matches,PREG_SET_ORDER\n\t\t\t);\n\t\t\t$_cfg=array();\n\t\t\t$_ptr=&$_cfg;\n\t\t\tforeach ($_matches as $_match) {\n\t\t\t\tif ($_match[1]) {\n\t\t\t\t\t// Section header\n\t\t\t\t\tif (!isset($_map[$_match[1]])) {\n\t\t\t\t\t\t// Unknown section\n\t\t\t\t\t\tself::$global['CONTEXT']=$_section;\n\t\t\t\t\t\ttrigger_error(self::TEXT_Section);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\t$_ptr=&$_cfg[$_match[1]];\n\t\t\t\t}\n\t\t\t\telseif ($_match[2]) {\n\t\t\t\t\t$_csv=array_map(\n\t\t\t\t\t\tfunction($_val) {\n\t\t\t\t\t\t\t// Typecast if necessary\n\t\t\t\t\t\t\treturn is_numeric($_val) ||\n\t\t\t\t\t\t\t\tpreg_match('/^(TRUE|FALSE)\\b/i',$_val)?\n\t\t\t\t\t\t\t\t\teval('return '.$_val.';'):$_val;\n\t\t\t\t\t\t},\n\t\t\t\t\t\tstr_getcsv($_match[3])\n\t\t\t\t\t);\n\t\t\t\t\t// Convert comma-separated values to array\n\t\t\t\t\t$_match[3]=count($_csv)>1?$_csv:$_csv[0];\n\t\t\t\t\tif (preg_match('/(.+?)\\[(.*?)\\]/',$_match[2],$_sub)) {\n\t\t\t\t\t\tif ($_sub[2])\n\t\t\t\t\t\t\t// Associative array\n\t\t\t\t\t\t\t$_ptr[$_sub[1]][$_sub[2]]=$_match[3];\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t// Numeric-indexed array\n\t\t\t\t\t\t\t$_ptr[$_sub[1]][]=$_match[3];\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\t// Key-value pair\n\t\t\t\t\t\t$_ptr[$_match[2]]=$_match[3];\n\t\t\t\t}\n\t\t\t}\n\t\t\tob_start();\n\t\t\tforeach ($_cfg as $_section=>$_pair) {\n\t\t\t\t$_func=$_map[$_section];\n\t\t\t\tforeach ($_pair as $_key=>$_val)\n\t\t\t\t\t// Generate PHP snippet\n\t\t\t\t\techo 'F3::'.$_func.'('.\n\t\t\t\t\t\tvar_export($_key,TRUE).','.\n\t\t\t\t\t\t($_func=='set' || !is_array($_val)?\n\t\t\t\t\t\t\tvar_export($_val,TRUE):self::listArgs($_val)).\n\t\t\t\t\t');'.\"\\n\";\n\t\t\t}\n\t\t\t$_save=ob_get_contents();\n\t\t\tob_end_clean();\n\t\t\t// Compress and save to cache\n\t\t\tCache::store($_hash,gzdeflate($_save));\n\t\t}\n\t\t// Execute cached PHP code\n\t\teval($_save);\n\t\tif (self::$global['ERROR'])\n\t\t\t// Remove from cache\n\t\t\tCache::remove($_hash);\n\t}",
"private function configuration() {\n\n $f = \"includes/expr.ini\";\n\n return parse_ini_file($f);\n\n }",
"public function generateMap()\n {\n try\n {\n // Select all published articles and pages.\n // Lessons and other new stuff to be added upon needed.\n $pgs = ORM::factory( 'Page' )\n ->where( 'status', '>', 0 )\n ->find_all()->as_array();\n\n $articles = ORM::factory( 'Article' )\n ->where( 'status', '>', 0 )\n ->find_all()->as_array();\n \n // Place found URLs into the container array.\n $pages = [];\n foreach ( array_merge( $pgs, $articles ) as $value )\n array_push ( $pages, $value->make_full_url () );\n \n // Select whatever is already in the map...\n $urls = [];\n foreach ( $this->map->children() as $node )\n $urls[] = ( string )$node->loc;\n\n // Delete redundant links\n foreach ( array_diff( $urls, $pages ) as $url )\n $this->removeEntry( $url, FALSE, TRUE );\n\n // Add missing links.\n foreach ( array_diff( $pages, $urls ) as $uri )\n $this->addEntry ( $uri, NULL, FALSE, TRUE );\n\n // Save result into the file.\n return $this->save();\n }\n catch ( Exception $e )\n {\n Kohana::$log->add( LOG_ERR, $e->getMessage() );\n return FALSE;\n }\n }",
"public function loadXml($filename,$map_path){\r\n \r\n $this->rootPath = $this->_preparePath($map_path);\r\n \r\n if(!File::exists( $this->rootPath .DS. $filename ))\r\n App::critical_error ('XML document not found: '.$this->rootPath .DS. $filename);\r\n \r\n $xmlDoc = $this->_initDocument($this->rootPath .DS. $filename);\r\n \r\n //get the project elements\r\n $elements = $xmlDoc->getElementsByTagName('element');\r\n \r\n foreach($elements as $element){\r\n \r\n if(count($this->elements) == 0 ){\r\n $this->elements = $this->_loadElement($element);\r\n }\r\n else{\r\n $this->elements = array_merge($this->elements,$this->_loadElement($element));\r\n }\r\n }\r\n \r\n //isolate the template key\r\n if(!is_null($this->_templatekey) && !is_null($this->elements[$this->_templatekey]))\r\n $this->elements['templates'] = $this->elements[$this->_templatekey];\r\n \r\n //clean the element values\r\n //array_walk_recursive($this->element, array($this, '_clean'));\r\n \r\n return File::put(APP_PROJECT .DS. 'elements.php' ,serialize($this->elements)); \r\n }",
"function c_ini_data($filename,$process_sections=false)\r\n {\r\n\r\n if (file_exists($filename))\r\n {\r\n $output = parse_ini_file($filename,$process_sections);\r\n return (array) $output;\r\n }\r\n else\r\n {\r\n trigger_error($filename.' configuration file not found.');\r\n }\r\n\r\n }"
]
| [
"0.6298302",
"0.5663068",
"0.5564768",
"0.53880966",
"0.5346692",
"0.53239864",
"0.5299677",
"0.5215316",
"0.50380766",
"0.500899",
"0.50022036",
"0.5001408",
"0.49921328",
"0.49877095",
"0.4985223",
"0.49799305",
"0.49754384",
"0.49635845",
"0.49174458",
"0.4886537",
"0.4867606",
"0.4856973",
"0.4837681",
"0.4807186",
"0.4802975",
"0.4796455",
"0.4792413",
"0.47735357",
"0.47634447",
"0.47592127"
]
| 0.7168414 | 0 |
Builds an XML Map used to parse services includes (xml) | protected function xmlServicesMapFactory()
{
$map = new Map();
$map->add(
Path::factory('/fwk/services', 'services', array())
->loop(true, '@xml')
->attribute('xmlMap')
);
return $map;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function build_xml_map() {\n $this->_create_map();\n header(\"content-type: text/xml\");\n echo $this->result;\n }",
"function generate_mapservice_conf_file(){\n\t\t$dom;\n\t\tif(!$dom = domxml_open_file($this->default_mapservconf_file)){\n\t\t\techo \"Could not open xml file: \" . $this->default_mapservconf_file;\n\t\t\treturn NULL; \n\t\t}\n\t\t$mapservice = $this->find_mapservice($dom);\n\t\t// map service not found\n\t\tif($mapservice == NULL){\n\t\t\techo \"could not find map-service named: \" . $mapservice_name ;\n\t\t\treturn NULL;\n\t\t}\n\t\t\n\t\t$children = $mapservice->child_nodes();\n\t\t$n_children = count($children);\n\t\t\n\t\t// loop through to find <map-file>\n\t\t// and <layer-config> element\n\t\tfor($i = 0; $i < $n_children; $i++){\n\t\t\tswitch ($children[$i]->tagname){\n\t\t\t\tcase \"map-file\":\n\t\t\t\t\t$this->change_node_content($dom, $children[$i], $this->output_mapfile);\n\t\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\tcase \"layer-config-file\":\n\t\t\t\t\t$this->change_node_content($dom, $children[$i], $this->output_layerconf);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\t$dom->dump_file($this->output_mapservconf, false, false);\n\t\treturn $this->output_mapservconf;\n\t}",
"protected function xmlPluginsMapFactory()\n {\n $map = new Map();\n $map->add(\n Path::factory('/fwk/plugin', 'plugins')\n ->loop(true)\n ->attribute('class')\n ->attribute('service')\n ->addChildren(\n Path::factory('param', 'params')\n ->attribute('name')\n ->filter(array($this, 'propertizeString'))\n ->value('value')\n ->loop(true)\n )\n );\n\n return $map;\n }",
"abstract protected function buildMap();",
"protected function xmlIniMapFactory()\n {\n $map = new Map();\n $map->add(\n Path::factory('/fwk/ini', 'ini', array())\n ->loop(true)\n ->attribute('category')\n ->value('value')\n );\n \n return $map;\n }",
"public function getXMLPageMap() {\n\t\tstatic $xml;\n\n\t\tif (isset($xml)) return $xml;\n\t\t$cache = SA_SimpleCache::singleton('__XML_PAGES_MAP__');\n\t\tif ($xmlString = $cache->load()) {\n\t\t\t$xml = new SimpleXMLElement($xmlString);\n\t\t} else {\n\t\t\t$xml = new SimpleXMLElement('<?xml version=\"1.0\" standalone=\"yes\"?><pages/>');\n\t\t\t$this->xmlFileSystem($this->getPagesDir(), $xml);\n\t\t\t$cache->save($xml->asXML());\n\t\t}\n\t\treturn $xml;\n\t}",
"function create_service_map($soap) {\n foreach ($this->services as $service) {\n require_once($service . '.php');\n if (class_exists($service)) {\n $c = (string) $service; \n $object = new $c();\n $soap->addObjectMap($object, 'urn:php-islandora-soapservice');\n }\n else {\n $this->log->lwrite(\"Could not load class $service, check the config files list \n of services to make sure they are correct\", 'SOAP_SERVER', NULL, NULL, 'ERROR');\n }\n }\n }",
"protected function xmlListenersMapFactory()\n {\n $map = new Map();\n $map->add(\n Path::factory('/fwk/listener', 'listeners')\n ->loop(true)\n ->attribute('class')\n ->attribute('service')\n ->addChildren(\n Path::factory('param', 'params')\n ->attribute('name')\n ->filter(array($this, 'propertizeString'))\n ->value('value')\n ->loop(true)\n )\n );\n \n return $map;\n }",
"protected static function buildEventMaps()\n {\n \\Log::info('Building event cache');\n\n // Build event mapping from services in database\n\n //\tInitialize the event map\n $processEventMap = [];\n $broadcastEventMap = [];\n\n // Pull any custom swagger docs\n $result = ServiceModel::with(\n [\n 'serviceDocs' => function ($query){\n $query->where('format', ApiDocFormatTypes::SWAGGER);\n }\n ]\n )->get();\n\n //\tSpin through services and pull the events\n foreach ($result as $service) {\n $apiName = $service->name;\n try {\n if (empty($content = ServiceModel::getStoredContentForService($service))) {\n throw new \\Exception(' * No event content found for service.');\n continue;\n }\n\n $serviceEvents = static::parseSwaggerEvents($apiName, $content);\n\n //\tParse the events while we get the chance...\n $processEventMap[$apiName] = ArrayUtils::get($serviceEvents, 'process', []);\n $broadcastEventMap[$apiName] = ArrayUtils::get($serviceEvents, 'broadcast', []);\n\n unset($content, $service, $serviceEvents);\n } catch (\\Exception $ex) {\n \\Log::error(\" * System error building event map for service '$apiName'.\\n{$ex->getMessage()}\");\n }\n }\n\n static::$eventMap = ['process' => $processEventMap, 'broadcast' => $broadcastEventMap];\n\n //\tWrite event cache file\n \\Cache::forever(static::EVENT_CACHE_KEY, static::$eventMap);\n\n \\Log::info('Event cache build process complete');\n }",
"protected function _getDomMap()\n {\n $domMap = parent::_getDomMap();\n $domMap = reset($domMap);\n\n return [\n 'initSubscriptionResponse' => array_merge([\n 'transactionId' => 'transactionId',\n 'subscriptionPageUrl' => 'subscriptionPageUrl',\n 'status' => 'status',\n ], $domMap)\n ];\n }",
"protected static function buildEventMaps()\n {\n \\Log::info('Building event cache');\n\n // Build event mapping from services in database\n\n //\tInitialize the event map\n $eventMap = [];\n\n // Pull any custom swagger docs\n $result = ServiceModel::whereIsActive(true)->get();\n\n //\tSpin through services and pull the events\n /** @var ServiceModel $model */\n foreach ($result as $model) {\n $apiName = $model->name;\n try {\n /** @var BaseRestService $service */\n if (empty($service = ServiceManager::getService($apiName))) {\n throw new \\Exception('No service found.');\n }\n\n if ($service instanceof FileServiceInterface) {\n // don't want the full folder list here\n $accessList = (empty($service->getPermissions()) ? [] : ['', '*']);\n } else {\n $accessList = $service->getAccessList();\n }\n\n if (!empty($accessList)) {\n if (!empty($doc = $model->getDocAttribute())) {\n if (is_array($doc) && !empty($content = array_get($doc, 'content'))) {\n if (is_string($content)) {\n $content = ServiceModel::storedContentToArray($content, array_get($doc, 'format'),\n $model);\n if (!empty($content)) {\n $eventMap[$apiName] = static::parseSwaggerEvents($content, $accessList);\n }\n }\n }\n }\n }\n } catch (\\Exception $ex) {\n \\Log::error(\" * System error building event map for service '$apiName'.\\n{$ex->getMessage()}\");\n }\n\n unset($content, $service, $serviceEvents);\n }\n\n static::$eventMap = $eventMap;\n\n \\Log::info('Event cache build process complete');\n }",
"function webmap_compo_lib_xml_build()\r\n{\r\n\t$this->webmap_compo_lib_xml_base();\r\n}",
"public static function buildTableMap()\n {\n $dbMap = Propel::getServiceContainer()->getDatabaseMap(CKOrderXmlTableMap::DATABASE_NAME);\n if (!$dbMap->hasTable(CKOrderXmlTableMap::TABLE_NAME)) {\n $dbMap->addTableObject(new CKOrderXmlTableMap());\n }\n }",
"private function generateXml()\n {\n\n $args = array(\n\n 'posts_per_page' => -1,\n 'numberposts' => -1,\n 'orderby' => 'post_type',\n 'order' => 'DESC',\n 'post_type' => apply_filters('fpcms_sitemap_post_types', array('post', 'page'))\n\n );\n\n if ($results = get_posts($args)) {\n\n $sitemap = new \\SimpleXMLElement($this->getDocStructure());\n\n foreach ($results as $result) {\n\n $url = $sitemap->addChild('url');\n $url->addChild('loc', get_permalink($result->ID));\n\n if (has_post_thumbnail($result->ID)) {\n\n if ($image = wp_get_attachment_image_src(get_post_thumbnail_id($result->ID))) {\n $url->addChild('image:image', $image[0]);\n }\n\n }\n\n $url->addChild('lastmod', mysql2date('Y-m-d', $result->post_date_gmt));\n\n if ($result->post_type == 'page') {\n\n //Pages should display higher than posts for the same keyword\n $url->addChild('priority', apply_filters('fpcms_sitemap_page_priority', '0.7'));\n\n } else {\n\n $url->addChild('priority', apply_filters('fpcms_sitemap_post_priority', '0.4'));\n\n }\n\n }\n\n return $sitemap->asXML();\n\n }\n\n }",
"protected function getMap(): ReferenceMap\n {\n return new ReferenceMap(\n [\n new SrcNode(\n new \\SplFileInfo('folder/Example/ClassExample.php'),\n new FullClassName('Example', 'ClassExample'),\n [\n new Inheritance(0, new FullClassName('Example', 'ParentClassExample')),\n new Inheritance(0, new FullClassName('', 'FilterIterator')),\n new Dependency(0, new FullClassName('Example', 'AnotherClassExample')),\n new Dependency(0, new FullClassName('Vendor', 'ThirdPartyExample')),\n new Dependency(0, new FullClassName('', 'iterable')),\n new Composition(0, new FullClassName('Example', 'InterfaceExample')),\n new Composition(0, new FullClassName('Example', 'AnotherInterface')),\n new Composition(0, new FullClassName('', 'iterable')),\n new Mixin(0, new FullClassName('Example', 'TraitExample')),\n new Mixin(0, new FullClassName('', 'PHPDocElement'))\n ]\n )\n ],\n [\n new FullClassName('', 'iterable'),\n new FullClassName('', 'FilterIterator'),\n new FullClassName('', 'PHPDocElement'),\n ],\n [\n new ComposerPackage('main', [], [], [], [])\n ]\n );\n }",
"public function loadXml($filename,$map_path){\r\n \r\n $this->rootPath = $this->_preparePath($map_path);\r\n \r\n if(!File::exists( $this->rootPath .DS. $filename ))\r\n App::critical_error ('XML document not found: '.$this->rootPath .DS. $filename);\r\n \r\n $xmlDoc = $this->_initDocument($this->rootPath .DS. $filename);\r\n \r\n //get the project elements\r\n $elements = $xmlDoc->getElementsByTagName('element');\r\n \r\n foreach($elements as $element){\r\n \r\n if(count($this->elements) == 0 ){\r\n $this->elements = $this->_loadElement($element);\r\n }\r\n else{\r\n $this->elements = array_merge($this->elements,$this->_loadElement($element));\r\n }\r\n }\r\n \r\n //isolate the template key\r\n if(!is_null($this->_templatekey) && !is_null($this->elements[$this->_templatekey]))\r\n $this->elements['templates'] = $this->elements[$this->_templatekey];\r\n \r\n //clean the element values\r\n //array_walk_recursive($this->element, array($this, '_clean'));\r\n \r\n return File::put(APP_PROJECT .DS. 'elements.php' ,serialize($this->elements)); \r\n }",
"private function genSitemapXML() {\n $url_same = array();\n $sitemap_xml = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xmlns:image=\"http://www.google.com/schemas/sitemap-image/1.1\" xmlns:video=\"http://www.google.com/schemas/sitemap-video/1.1\">\n <!-- created by CSZ CMS Sitemap Generator www.cszcms.com -->'.\"\\n\";\n $sitemap_xml.= '<url>\n\t<loc>'.base_url().'</loc>\n\t<changefreq>always</changefreq>\n </url>'.\"\\n\";\n if($this->lang !== FALSE){ /* Language */\n foreach ($this->lang as $row) {\n $url = $this->Csz_model->base_link().'/lang/'.$row['lang_iso'];\n if(!in_array($url, $url_same)){\n $sitemap_xml.= '<url>\n <loc>'.$url.'</loc>\n <changefreq>always</changefreq>\n </url>'.\"\\n\";\n $url_same[] = $url;\n }\n }\n }\n if($this->menu_other !== FALSE){ /* Navigation */\n foreach ($this->menu_other as $row) {\n $chkotherlink = strpos($row['other_link'], BASE_URL);\n if($row['pages_id'] && $row['pages_id'] != NULL && $row['pages_id'] != 0){\n $pages = $this->Csz_model->getValue('page_url', 'pages', \"active = '1' AND pages_id = '\".$row['pages_id'].\"'\", '', 1, 'page_url', 'ASC'); \n if($row['drop_page_menu_id'] != 0 && $row['drop_page_menu_id'] != NULL){\n $main = $this->Csz_model->getValue('menu_name', 'page_menu', \"active = '1' AND page_menu_id = '\".$row['drop_page_menu_id'].\"'\", '', 1, 'menu_name', 'ASC'); \n $url = $this->Csz_model->base_link().'/'.$this->Csz_model->rw_link($main->menu_name).'/'.$pages->page_url;\n if(!in_array($url, $url_same)){\n $sitemap_xml.= '<url>\n <loc>'.$url.'</loc>\n <changefreq>always</changefreq>\n </url>'.\"\\n\";\n $url_same[] = $url;\n }\n }else{\n $url = $this->Csz_model->base_link().'/'.$pages->page_url;\n if(!in_array($url, $url_same)){\n $sitemap_xml.= '<url>\n <loc>'.$url.'</loc>\n <changefreq>always</changefreq>\n </url>'.\"\\n\";\n $url_same[] = $url;\n }\n }\n }else if($row['other_link'] && $row['other_link'] != NULL && $chkotherlink !== FALSE){ \n if(!in_array($row['other_link'], $url_same)){\n $sitemap_xml.= '<url>\n <loc>'.$row['other_link'].'</loc>\n <changefreq>always</changefreq>\n </url>'.\"\\n\";\n $url_same[] = $row['other_link'];\n }\n }else if($row['plugin_menu'] && $row['plugin_menu'] != NULL){\n $url = $this->Csz_model->base_link().'/plugin/'.$row['plugin_menu'];\n if(!in_array($url, $url_same)){\n $sitemap_xml.= '<url>\n <loc>'.$url.'</loc>\n <changefreq>always</changefreq>\n </url>'.\"\\n\";\n $url_same[] = $url;\n }\n }\n }\n }\n if($this->pages_content !== FALSE){ /* Pages Content without navigation */\n foreach ($this->pages_content as $row) {\n $url = $this->Csz_model->base_link().'/'.$row['page_url'];\n if(!in_array($url, $url_same)){\n $sitemap_xml.= '<url>\n <loc>'.$url.'</loc>\n <changefreq>always</changefreq>\n </url>'.\"\\n\";\n $url_same[] = $url;\n }\n }\n }\n if($this->plugin !== FALSE){ /* Plugin with sitemap config */\n foreach ($this->plugin as $row) {\n $plugin_db = $this->Csz_model->getPluginConfig($row['plugin_config_filename'], 'plugin_sitemap_viewtable');\n if(!empty($plugin_db)){\n $plugindata = $this->Csz_model->getValueArray('*', $plugin_db, $this->Csz_model->getPluginConfig($row['plugin_config_filename'], 'plugin_sqlextra_condition'), '', 0, $plugin_db.'_id', 'DESC');\n if($plugindata !== FALSE){\n foreach ($plugindata as $rs) {\n $url = $this->Csz_model->base_link().'/plugin/'.$this->Csz_model->getPluginConfig($row['plugin_config_filename'], 'plugin_urlrewrite').'/view/'.$rs[$plugin_db.'_id'].'/'.$rs['url_rewrite'];\n if(!in_array($url, $url_same)){\n $sitemap_xml.= '<url>\n <loc>'.$url.'</loc>\n <changefreq>always</changefreq>\n </url>'.\"\\n\";\n $url_same[] = $url;\n }\n if($row['plugin_config_filename'] == 'article'){\n $urlamp = $this->Csz_model->base_link().'/plugin/'.$this->Csz_model->getPluginConfig($row['plugin_config_filename'], 'plugin_urlrewrite').'/amp/'.$rs[$plugin_db.'_id'].'/'.$rs['url_rewrite'];\n if(!in_array($urlamp, $url_same)){\n $sitemap_xml.= '<url>\n <loc>'.$urlamp.'</loc>\n <changefreq>always</changefreq>\n </url>'.\"\\n\";\n $url_same[] = $urlamp;\n }\n }\n }\n }\n }\n $plugin_cat_db = $this->Csz_model->getPluginConfig($row['plugin_config_filename'], 'plugin_sitemap_cattable');\n if(!empty($plugin_cat_db)){\n $plugindata = $this->Csz_model->getValueArray('*', $plugin_cat_db, $this->Csz_model->getPluginConfig($row['plugin_config_filename'], 'plugin_sqlextra_catcondition'), '', 0, $plugin_cat_db.'_id', 'DESC');\n if($plugindata !== FALSE){\n foreach ($plugindata as $rs) {\n $url = $this->Csz_model->base_link().'/plugin/'.$this->Csz_model->getPluginConfig($row['plugin_config_filename'], 'plugin_urlrewrite').'/category/'.$rs['url_rewrite'];\n if(!in_array($url, $url_same)){\n $sitemap_xml.= '<url>\n <loc>'.$url.'</loc>\n <changefreq>always</changefreq>\n </url>'.\"\\n\";\n $url_same[] = $url;\n }\n }\n }\n }\n } \n }\n $sitemap_xml.= '</urlset>'.\"\\n\";\n if($sitemap_xml){\n /* Gen sitemap.xml */\n $file_path = FCPATH.\"sitemap.xml\";\n $fopen = fopen($file_path, 'wb') or die(\"can't open file\");\n fwrite($fopen, $sitemap_xml);\n fclose($fopen);\n /* Gen sitemap.xml.gz */\n $gzdata = @gzencode($sitemap_xml, 9);\n if($gzdata !== FALSE){\n $fopen1 = fopen(FCPATH.\"sitemap.xml.gz\", 'wb') or die(\"can't open file\");\n fwrite($fopen1, $gzdata);\n fclose($fopen1);\n }\n\t}\n }",
"function venture_geo_process_map_xml($id, $params) { \n $output = '';\n if ($params) {\n $output = \" <state id=\\\"$id\\\">\\n\";\n foreach ($params as $name => $value) {\n if($value) \n $output .= \" <$name>$value</$name>\\n\";\n }\n $output .= \" </state>\\n\";\n }\n return $output;\n}",
"public function generateMap()\n {\n try\n {\n // Select all published articles and pages.\n // Lessons and other new stuff to be added upon needed.\n $pgs = ORM::factory( 'Page' )\n ->where( 'status', '>', 0 )\n ->find_all()->as_array();\n\n $articles = ORM::factory( 'Article' )\n ->where( 'status', '>', 0 )\n ->find_all()->as_array();\n \n // Place found URLs into the container array.\n $pages = [];\n foreach ( array_merge( $pgs, $articles ) as $value )\n array_push ( $pages, $value->make_full_url () );\n \n // Select whatever is already in the map...\n $urls = [];\n foreach ( $this->map->children() as $node )\n $urls[] = ( string )$node->loc;\n\n // Delete redundant links\n foreach ( array_diff( $urls, $pages ) as $url )\n $this->removeEntry( $url, FALSE, TRUE );\n\n // Add missing links.\n foreach ( array_diff( $pages, $urls ) as $uri )\n $this->addEntry ( $uri, NULL, FALSE, TRUE );\n\n // Save result into the file.\n return $this->save();\n }\n catch ( Exception $e )\n {\n Kohana::$log->add( LOG_ERR, $e->getMessage() );\n return FALSE;\n }\n }",
"function service_information() {\r\n\t\t$return_value = '<service name=\"' . $this->basename . '\">'\r\n\t\t. '<port name=\"' . $this->basename . 'Port\" binding=\"tns:' . $this->basename . 'Binding\">'\r\n\t\t. '<soap:address location=\"' . $this->api_url . '\"/>'\r\n\t\t. '</port>'\r\n\t\t. '</service>';\r\n\r\n\t\treturn $return_value;\r\n\t}",
"private function generateSiteMapMain()\n {\n $this->load->model('extension/module/siteMapGenerate');\n $output = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>';\n $output .= '<sitemapindex xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">';\n\n foreach ($this->includedFiles as $file) {\n $removeFromUrl = mb_substr($file, 0, mb_strrpos($file, '/'));;\n $clearFileUrl = str_replace($removeFromUrl . '/', '', $file);\n $output .= '<sitemap>';\n $output .= '<loc>' . $this->siteUrl . $clearFileUrl . '</loc>';\n $output .= '</sitemap>';\n }\n\n $output \t.= '</sitemapindex>';\n $this->response->addHeader('Content-Type: application/xml');\n\n $siteMapXmlUrl = DIR_MAIN . 'sitemap_custom.xml';\n $openedFile = fopen($siteMapXmlUrl, 'w');\n chmod($siteMapXmlUrl, 0775);\n file_put_contents($siteMapXmlUrl, $output);\n fclose($openedFile);\n }",
"public static function addSiteMapElement($xml, $siteMapelementsArr){\n \n foreach ($siteMapelementsArr as $oneElement){\n //start at url node\n $url = $xml->addChild('url');\n \n //use loop to add all elements to url node\n foreach ($oneElement as $key=>$value) {\n if ($key == 'lastmod') {\n $value = date('Y-m-d', strtotime($value));\n }//force format date.\n \n $loc = $url->addChild($key, $value);\n }\n \n }\n \n }",
"function find_mapservice($dom){\n\t\t$mapservice = NULL;\n\t\t// get all <map-service> elements\n\t\t$mapservices = $dom->get_elements_by_tagname(\"map-service\");\n\t\t$n_services = count($mapservices);\n\t\t// loop through all the services and find\n\t\t// the one whose name matches the mapservice\n\t\t// name that was passed into the constructor\n\t\tfor($i = 0; $i < $n_services; $i++){\n\t\t\t// get all the child nodes of\n\t\t\t// a <map-service> node\n\t\t\t$children = $mapservices[$i]->child_nodes();\n\t\t\t$n_children = count($children);\n\t\t\t$child_found = false;\n\t\t\t// go through the children and\n\t\t\t// find a <name> node\n\t\t\tfor($j = 0; $j < $n_children; $j++){\n\t\t\t\tif($children[$j]->tagname == \"name\"){\n\t\t\t\t\t// check if the <name> value \n\t\t\t\t\t// matches the name that was passed\n\t\t\t\t\t// in to the constructor. to get the\n\t\t\t\t\t// <name> value, we get the child node\n\t\t\t\t\t// of <name>, which should be a text node.\n\t\t\t\t\t$name_value = $children[$j]->child_nodes();\n\t\t\t\t\t$name_value = $name_value[0];\n\t\t\t\t\tif($name_value->get_content() == $this->mapservice_name){\n\t\t\t\t\t\t$child_found = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t// if the <map-service> we are looking for \n\t\t\t// is found, terminate the loop\n\t\t\tif($child_found){\n\t\t\t\t$mapservice = $mapservices[$i];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\t\t\n\t\treturn $mapservice;\n\t}",
"private function getServiceMap()\n {\n $result = array(\n 'transport' => 'POST',\n 'envelope' => 'JSON-RPC-2.0',\n 'SMDVersion' => '2.0',\n 'contentType' => 'application/json',\n 'target' => !empty($_SERVER['REQUEST_URI']) ? substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?')) : '',\n 'services' => array(),\n 'description' => '',\n );\n\n foreach ($this->instances as $namespace => $instance) {\n $rc = new ReflectionClass($instance);\n\n // Get Class Description\n if ($rcDocComment = $this->getDocDescription($rc->getDocComment())) {\n $result['description'] .= $rcDocComment . PHP_EOL;\n }\n\n foreach ($rc->getMethods() as $method) {\n /** @var ReflectionMethod $method */\n if (!$method->isPublic() || in_array(strtolower($method->getName()), $this->hiddenMethods)) {\n continue;\n }\n\n $methodName = ($namespace ? $namespace . '.' : '') . $method->getName();\n $docComment = $method->getDocComment();\n\n $result['services'][$methodName] = array('parameters' => array());\n\n // set description\n if ($rmDocComment = $this->getDocDescription($docComment)) {\n $result['services'][$methodName]['description'] = $rmDocComment;\n }\n\n // @param\\s+([^\\s]*)\\s+([^\\s]*)\\s*([^\\s\\*]*)\n $parsedParams = array();\n if (preg_match_all('/@param\\s+([^\\s]*)\\s+([^\\s]*)\\s*([^\\n\\*]*)/', $docComment, $matches)) {\n foreach ($matches[2] as $number => $name) {\n $type = $matches[1][$number];\n $desc = $matches[3][$number];\n $name = trim($name, '$');\n\n $param = array('type' => $type, 'description' => $desc);\n $parsedParams[$name] = array_filter($param);\n }\n };\n\n // process params\n foreach ($method->getParameters() as $parameter) {\n $name = $parameter->getName();\n $param = array('name' => $name, 'optional' => $parameter->isDefaultValueAvailable());\n if (array_key_exists($name, $parsedParams)) {\n $param += $parsedParams[$name];\n }\n\n if ($param['optional']) {\n $param['default'] = $parameter->getDefaultValue();\n }\n\n $result['services'][$methodName]['parameters'][] = $param;\n }\n\n // set return type\n if (preg_match('/@return\\s+([^\\s]+)\\s*([^\\n\\*]+)/', $docComment, $matches)) {\n $returns = array('type' => $matches[1], 'description' => trim($matches[2]));\n $result['services'][$methodName]['returns'] = array_filter($returns);\n }\n }\n }\n\n return $result;\n }",
"private function addHeaderToStaticMap()\n {\n HeaderLoader::addStaticMap(\n [\n 'xmagentotags' => XMagentoTags::class,\n ]\n );\n }",
"function initMap() {\n\n\t\t// Instantiate the xajax object and configure it\n\t\trequire_once (t3lib_extMgm::extPath('xajax') . 'class.tx_xajax.php');\n\t\t$this->xajax = t3lib_div::makeInstance('tx_xajax'); // Make the instance\n\t\tif ($GLOBALS['TSFE']->metaCharset == 'utf-8') {\n\t\t\t$this->xajax->decodeUTF8InputOn(); // Decode form vars from utf8\n\t\t}\n\t\t$this->xajax->setCharEncoding($GLOBALS['TSFE']->metaCharset); \t\t// Encode of the response to utf-8 ???\n\t\t$this->xajax->setWrapperPrefix($this->prefixId); \t\t// To prevent conflicts, prepend the extension prefix\n\t\t$this->xajax->statusMessagesOn(); \t\t// Do you wnat messages in the status bar?\n\n\t\t// register the functions of the ajax requests\n\t\t$this->xajax->registerFunction(array('infomsg', &$this, 'ajaxGetInfomsg'));\n\t\t$this->xajax->registerFunction(array('activeRecords', &$this, 'ajaxGetActiveRecords'));\n\t\t$this->xajax->registerFunction(array('processCat', &$this, 'ajaxProcessCat'));\n\t\t$this->xajax->registerFunction(array('tab', &$this, 'ajaxGetPoiTab'));\n\t\t$this->xajax->registerFunction(array('search', &$this, 'ajaxSearch'));\n\t\t$this->xajax->registerFunction(array('processCatTree', &$this, 'ajaxProcessCatTree'));\n\t\t$this->xajax->registerFunction(array('getDynamicList', &$this, 'ajaxGetDynamicList'));\n\n\t\t$this->xajax->processRequests();\n\n\t\t// additional output using a template\n\t\t$template['total'] = $this->cObj2->getSubpart($this->templateCode,'###HEADER###');\n\t\t$markerArray = $subpartArray = array();\n\t\t$markerArray['###PATH###'] = t3lib_extMgm::siteRelpath('rggooglemap');\n\n\t\tif ($this->conf['map.']['addLanguage'] == 1) {\n\t\t\tif ($this->conf['map.']['addLanguage.']['override'] != '') {\n\t\t\t\t$markerArray['###MAP_KEY###'] .= '&hl=' . $this->conf['map.']['addLanguage.']['override'];\n\t\t\t} elseif ($GLOBALS['TSFE']->lang != '') {\n\t\t\t\t$markerArray['###MAP_KEY###'] .= '&hl=' . $GLOBALS['TSFE']->lang;\n\t\t\t}\n\t\t}\n\n\t\t$markerArray['###DYNAMIC_JS###'] = $this->getJs();\n\n\t\t// load spefic files if needed for clustering\n\t\tif ($this->conf['map.']['activateCluster'] == 1) { // gxmarkers\n\t\t\t$subpartArray['###CLUSTER_2###'] = '';\n\n\t\t} elseif ($this->conf['map.']['activateCluster'] == 2) { // markerclusterer\n\t\t\t$subpartArray['###CLUSTER_1###'] = '';\n\t\t} else { // no clustering\n\t\t\t$subpartArray['###CLUSTER_1###'] = $subpartArray['###CLUSTER_2###'] = '';\n\t\t}\n\n\t\t$totalJS = $this->cObj2->substituteMarkerArrayCached($template['total'],$markerArray, $subpartArray);\n\t\t$GLOBALS['TSFE']->additionalHeaderData['rggooglemap_xajax'] = $this->xajax->getJavascript(t3lib_extMgm::siteRelPath('xajax'));\n\t\t$GLOBALS['TSFE']->additionalHeaderData['rggooglemap_js'] = $totalJS;\n\t}",
"function generate_map_file(){\n\t\t$map = ms_newMapObj($this->default_map_file);\n\t\t$n_layers = count($this->viewable_layers);\n\t\t// go through and create new \n\t\t// layer objects for those layers\n\t\t// that have their display property set\n\t\t// to true, adding them to the\n\t\t// map object\n\t\tfor($i = 0; $i < $n_layers; $i++){\n\t\t\tif($this->viewable_layers[$i]->display == \"true\"){\n\t\t\t\t$layer = ms_newLayerObj($map);\n\t\t\t\t$layer->set(\"name\", $this->viewable_layers[$i]->layer_name);\n\t\t\t\t$layer->set(\"status\", MS_OFF);\n\t\t\t\t$layer->set(\"template\", \"nepas.html\");\n\t\t\t\t$this->set_ms_layer_type($layer, $this->viewable_layers[$i]);\n\t\t\t\t$layer->set(\"connectiontype\", MS_POSTGIS);\n\t\t\t\t$layer->set(\"connection\", $this->dbconn->mapserver_conn_str);\n\t\t\t\t$this->set_ms_data_string($layer, $this->viewable_layers[$i]);\n\t\t\t\t$layer->setProjection($this->viewable_layers[$i]->layer_proj);\n\t\t\t\t// added to allow getfeatureinfo requests on\n\t\t\t\t// this layer via WMS\n\t\t\t\t$layer->setMetaData(\"WMS_INCLUDE_ITEMS\", \"all\");\n\t\t\t\t// generate a CLASSITEM directive \n\t\t\t\tif($this->viewable_layers[$i]->layer_ms_classitem != \"\")\n\t\t\t\t\t$layer->set(\"classitem\", $this->viewable_layers[$i]->layer_ms_classitem);\n\n\t\t\t\t// generate classes that this\n\t\t\t\t// layer contains\n\t\t\t\t$n_classes = count($this->viewable_layers[$i]->layer_classes);\n\t\t\t\tfor($j = 0; $j < $n_classes; $j++){\n\t\t\t\t\t$ms_class_obj = ms_newClassObj($layer);\n\t\t\t\t\t$ms_class_obj->set(\"name\", $this->viewable_layers[$i]->layer_classes[$j]->name);\n\t\t\t\t\t$ms_class_obj->setExpression($this->viewable_layers[$i]->layer_classes[$j]->expression);\n\t\t\t\t\tforeach($this->viewable_layers[$i]->layer_classes[$j]->styles as $style){\n\t\t\t\t\t\t$ms_style_obj = ms_newStyleObj($ms_class_obj);\n\t\t\t\t\t\t$ms_style_obj->color->setRGB($style->color_r,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$style->color_g,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$style->color_b);\n\t\t\t\t\t\t// set bg color\n\t\t\t\t\t\t$ms_style_obj->backgroundcolor->setRGB($style->bgcolor_r,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$style->bgcolor_g,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$style->bgcolor_b);\n\t\t\t\t\t\t// set outline color\n\t\t\t\t\t\t$ms_style_obj->outlinecolor->setRGB($style->outlinecolor_r,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$style->outlinecolor_g,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$style->outlinecolor_b);\n\t\t\t\t\t\tif($style->symbol_name != \"\"){\n\t\t\t\t\t\t\t$ms_style_obj->set(\"symbolname\", $style->symbol_name);\n\t\t\t\t\t\t\t// check for valid size\n\t\t\t\t\t\t\tif($style->symbol_size != \"\")\n\t\t\t\t\t\t\t\t$ms_style_obj->set(\"size\", $style->symbol_size);\n\t\t\t\t\t\t\t// check for valid angle\n\t\t\t\t\t\t\tif($style->angle != \"\")\n\t\t\t\t\t\t\t\t$ms_style_obj->set(\"angle\", $style->angle);\n\t\t\t\t\t\t\t// check for valid width\n\t\t\t\t\t\t\tif($style->width != \"\")\n\t\t\t\t\t\t\t\t$ms_style_obj->set(\"width\", $style->width);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tif($map->save($this->output_mapfile) == MS_FAILURE){\n\t\t\techo \"mapfile could not be saved\";\n\t\t\treturn NULL;\n\t\t}\n\t\t\n\t\treturn $this->output_mapfile;\t\n\t}",
"public function generateMap()\n {\n $map = array();\n $database = $this->binding->getDatabase()->getData();\n\n foreach ($database->classes as $class) {\n $map[$class->name] = $class->clusters;\n }\n\n $this->map = $map;\n $this->cache->save($this->getCacheKey(), $map);\n }",
"public function getDocStructure()\n {\n\n $xml_string = '<?xml version=\"1.0\" encoding=\"UTF-8\"?><urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xmlns:image=\"http://www.google.com/schemas/sitemap-image/1.1\">';\n $xml_string .= '</urlset>';\n\n return $xml_string;\n\n }",
"private function _getXSIMap($actionParam){\n\t\t$arrayMap = array();\n\t\tforeach($actionParam->childNodes as $item){\n\t\t\tif($item->nodeType==1){\n\t\t\t\tif($item->localName=='item'){\n\t\t\t\t\t$index = null;\n\t\t\t\t\t$value = null;\n\t\t\t\t\tforeach($item->childNodes as $node){\n\t\t\t\t\t\tif($node->nodeType==1){\n\t\t\t\t\t\t\tif($node->localName=='key'){\n\t\t\t\t\t\t\t\t$index = (string) $node->nodeValue;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tif($node->localName=='value'){\n\t\t\t\t\t\t\t\t\t$paramType = $node->getAttributeNS($this->_xmlSchemaNamespace, 'type');\n\t\t\t\t\t\t\t\t\tif($this->_isTypeLiteral($paramType)==true){\n\t\t\t\t\t\t\t\t\t\t$value = $this->_decodeXSDType($paramType, $node->nodeValue);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tif($paramType=='ns2:Map'){\n\t\t\t\t\t\t\t\t\t\t\t$value = $this->_getXSIMap($node);\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\tif($paramType=='SOAP-ENC:Array'||$paramType=='enc:Array'){\n\t\t\t\t\t\t\t\t\t\t\t\t$value = $this->_getSoapArray($node);\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\t$value = null;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif($index!==null){\n\t\t\t\t\t\t$arrayMap[$index] = $value;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$arrayMap[] = $value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $arrayMap;\n\t}"
]
| [
"0.7044736",
"0.6119876",
"0.5788437",
"0.56900597",
"0.56242883",
"0.5547064",
"0.55125326",
"0.55121243",
"0.5498514",
"0.5485582",
"0.5394869",
"0.52672815",
"0.5255118",
"0.519329",
"0.51895106",
"0.50757754",
"0.50058645",
"0.49868304",
"0.4973628",
"0.4959603",
"0.49507436",
"0.49200845",
"0.49180052",
"0.49006346",
"0.4897781",
"0.48888478",
"0.4864115",
"0.4848633",
"0.48414993",
"0.48309252"
]
| 0.6814833 | 1 |
$Id$ Implementation of hook_views_query_alter(). Modify query to sum ancestor's search scores for ead search, to improve search accuracy | function ead_import_views_query_alter(&$view, &$query){
if ($view->name === "collection_search"){
// create inner join on the child-ancestor table
// to get all ancestors for a node
$join = new views_join();
$join->table = 'ead_import_child_ancestor';
$join->field = 'child_nid';
$join->left_table = 'node';
$join->left_field = 'nid';
$join->type = 'INNER';
// add the join to the query
$alias = $query->ensure_table("ead_import_child_ancestor", NULL, $join);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function query() {\n // Since attachment views don't validate the exposed input, parse the search\n // expression if required.\n if (!$this->parsed) {\n $this->query_parse_search_expression($this->value);\n }\n $required = FALSE;\n if (!isset($this->search_query)) {\n $required = TRUE;\n }\n else {\n $words = $this->search_query->words();\n if (empty($words)) {\n $required = TRUE;\n }\n }\n if ($required) {\n if ($this->operator == 'required') {\n $this->query->add_where($this->options['group'], 'FALSE');\n }\n }\n else {\n $search_index = $this->ensure_my_table();\n\n $search_condition = db_and();\n\n if (!$this->options['remove_score']) {\n // Create a new join to relate the 'serach_total' table to our current 'search_index' table.\n $join = new views_join;\n $join->construct('search_total', $search_index, 'word', 'word');\n $search_total = $this->query->add_relationship('search_total', $join, $search_index);\n\n $this->search_score = $this->query->add_field('', \"SUM($search_index.score * $search_total.count)\", 'score', array('aggregate' => TRUE));\n }\n\n if (empty($this->query->relationships[$this->relationship])) {\n $base_table = $this->query->base_table;\n }\n else {\n $base_table = $this->query->relationships[$this->relationship]['base'];\n }\n $search_condition->condition(\"$search_index.type\", $base_table);\n if (!$this->search_query->simple()) {\n $search_dataset = $this->query->add_table('search_dataset');\n $conditions = $this->search_query->conditions();\n $condition_conditions =& $conditions->conditions();\n foreach ($condition_conditions as $key => &$condition) {\n // Take sure we just look at real conditions.\n if (is_numeric($key)) {\n // Replace the conditions with the table alias of views.\n $this->search_query->condition_replace_string('d.', \"$search_dataset.\", $condition);\n }\n }\n $search_conditions =& $search_condition->conditions();\n $search_conditions = array_merge($search_conditions, $condition_conditions);\n }\n else {\n // Stores each condition, so and/or on the filter level will still work.\n $or = db_or();\n foreach ($words as $word) {\n $or->condition(\"$search_index.word\", $word);\n }\n\n $search_condition->condition($or);\n }\n\n $this->query->add_where($this->options['group'], $search_condition);\n $this->query->add_groupby(\"$search_index.sid\");\n $matches = $this->search_query->matches();\n $placeholder = $this->placeholder();\n $this->query->add_having_expression($this->options['group'], \"COUNT(*) >= $placeholder\", array($placeholder => $matches));\n }\n // Set to NULL to prevent PDO exception when views object is cached.\n $this->search_query = NULL;\n }",
"function cbf_views_query_alter(&$view, &$query) {\n $filter_vocabulary = null;\n switch ($view->name) {\n case 'cbf2019_local_office':\n $filter_vocabulary = 'office';\n $filter_table = 'field_data_field_office';\n $filter_tid = 'field_office_tid';\n break;\n\n case 'cbf2019_local_events':\n case 'cbf2019_local_activities':\n $filter_vocabulary = 'vocabulary_1';\n $filter_table = 'field_data_taxonomy_vocabulary_1';\n $filter_tid = 'taxonomy_vocabulary_1_tid';\n break;\n\n case 'cbf2019_mappable':\n if ($view->current_display == 'block_4') {\n $filter_vocabulary = 'vocabulary_1';\n $filter_table = 'field_data_taxonomy_vocabulary_1';\n $filter_tid = 'taxonomy_vocabulary_1_tid';\n }\n break;\n }\n\n /*\n * The view is localised if the following conditions hold ...\n *\n * The view can be localised, and this invocation is the loading of the page\n * (refreshes use AJAX), and the $filter_table is not already in the query,\n * and the visitor's $localCity is known.\n */\n if (\n isset($filter_vocabulary)\n && strpos($_SERVER['REQUEST_URI'], '/views/ajax') === false\n && empty($query->get_table_info($filter_table))\n && !empty($localCity = cbf_visitor_city_string())\n ) {\n $city = taxonomy_get_term_by_name($localCity, $filter_vocabulary);\n $join = new views_join;\n $join->construct(\n $filter_table,\n $query->base_table,\n $query->base_field,\n 'entity_id',\n \"({$filter_table}.entity_type = '{$query->base_table}'\"\n . \" AND {$filter_table}.deleted = '0')\",\n 'INNER'\n );\n $query->add_relationship($filter_table, $join, $query->base_table);\n $query->add_where(1, \"{$filter_table}.{$filter_tid}\", reset($city)->tid, '=');\n }\n\n /*\n * The cbf2019_rated_content view supplies a 'More by' block ('block_1') and\n * a 'More on' block ('block_2'). We need to exclude the article on whose\n * page this block is being displayed.\n */\n if ($view->name == 'cbf2019_rated_content'\n && ($view->current_display == 'block_1'\n || $view->current_display == 'block_2')\n && is_numeric($view->args[0])\n && $view->args[0] > 0\n ) {\n $view->query->where[] = [\n 'conditions' => [\n [\n 'field' => 'node.nid',\n 'value' => $view->args[0],\n 'operator' => '!=',\n ],\n ],\n 'args' => [],\n 'type' => 'AND',\n ];\n }\n\n /*\n * The cbf2019_article_topics view definition shows only 'general' topics\n * and this code extends the query to include 'christian' topics when on\n * the 'christian' site. Ditto for cbf2019_speaker_listings.\n *\n * The tag 'add-christian-content' signals this is needed.\n */\n if (stripos($view->tag, 'add-christian-content') !== false) {\n $currentDomainId = domain_get_domain()['domain_id'];\n $christianDomainId = domain_load_domain_id('christian');\n if ($currentDomainId == $christianDomainId) {\n // We are on the 'christian' site so we want to see 'christian' topics\n foreach ($view->query->where as $i => $clause) {\n foreach ($clause['conditions'] as $j => $condition) {\n if (\n stripos($condition['field'], 'taxonomy_vocabulary_3_tid') !== false\n && $condition['operator'] == '='\n && $condition['value'] == '48'\n ) {\n $view->query->where[$i]['conditions'][$j]['operator'] = 'in';\n $view->query->where[$i]['conditions'][$j]['value'] = [ '47', '48' ];\n }\n }\n }\n }\n }\n}",
"private function _getBaseSearchQuery()\n {\n $store = Mage::app()->getStore($this->getStoreId());\n $collection = Mage::helper('catalogsearch')\n ->getEngine()\n ->getResultCollection()\n ->addSearchFilter($this->getFulltextQuery());\n\n $allowedVisibilities = Mage::getSingleton('catalog/product_visibility')->getVisibleInSearchIds();\n $allowedStatuses = Mage::getSingleton('catalog/product_status')->getVisibleStatusIds();\n\n $query = $collection->getSearchEngineQuery()\n ->addFilter('terms', array('store_id' => $this->getStoreId()))\n ->addFilter('terms', array('visibility' => $allowedVisibilities))\n ->addFilter('terms', array('status' => $allowedStatuses))\n ->setLanguageCode(Mage::helper('smile_elasticsearch')->getLanguageCodeByStore($store))\n ->setPageParams(0, self::PREVIEW_SIZE)\n ->getRawQuery();\n\n return $this->_applyOptimizers($query);\n }",
"private function sum_hits( $rows )\n {\n // Get the label for the hit field\n $hitsField = $this->sql_filterFields[ $this->curr_tableField ][ 'hits' ];\n\n // Init sum hits\n $sum_hits = 0;\n\n // Tree view flag\n $bTreeView = false;\n list( $table ) = explode( '.', $this->curr_tableField );\n // #i0117, 141223, dwildt, 1-/+\n //if ( in_array( $table, $this->arr_tablesWiTreeparentfield ) )\n if ( in_array( $this->curr_tableField, $this->arr_tablesWiTreeparentfield ) )\n {\n $bTreeView = true;\n }\n // Tree view flag\n // Tree view : get lowest uid_parent\n if ( $bTreeView )\n {\n // Get the field label\n $treeParentField = $this->sql_filterFields[ $this->curr_tableField ][ 'treeParentField' ];\n // Set lowest uid_parent 'unlimited'\n $lowestPid = 9999999;\n // LOOP all rows : set lowest pid\n foreach ( ( array ) $rows as $row )\n {\n if ( ( $row[ $treeParentField ] < $lowestPid ) && ( $row[ $treeParentField ] !== null ) )\n {\n $lowestPid = $row[ $treeParentField ];\n }\n }\n // LOOP all rows : set lowest pid\n }\n // Tree view : get lowest uid_parent\n // LOOP all rows : count hits\n foreach ( ( array ) $rows as $row )\n {\n // Default case : count each row\n if ( !$bTreeView )\n {\n $sum_hits = $sum_hits + $row[ $hitsField ];\n }\n // Default case : count each row\n // Tree view case : count top level rows only\n if ( $bTreeView )\n {\n if ( $row[ $treeParentField ] == $lowestPid )\n {\n $sum_hits = $sum_hits + $row[ $hitsField ];\n }\n }\n // Tree view case : count top level rows only\n }\n // LOOP all rows : count hits\n // Set class var $this->hits_sum\n $this->hits_sum[ $this->curr_tableField ] = ( int ) $sum_hits;\n\n return;\n }",
"function _admin_search_query()\n {\n }",
"function opensky_islandora_solr_query_alter($qp) {\n // dsm('opensky_islandora_solr_query_alter');\n\n // if sort is not set for search pages, then set it to keyDate desc\n if (current_path() == ISLANDORA_SOLR_SEARCH_PATH && !isset($qp->solrParams['sort'])) {\n $qp->solrParams['sort'] = 'keyDate desc';\n }\n\n if (isset($qp->internalSolrParams['collection'])) {\n $collection = $qp->internalSolrParams['collection'];\n\n // create $fq_new by removing all RELS_EXT_isMemberOfCollection_uri_ms\n // clauses\n $fq_new = array();\n $pat = 'RELS_EXT_isMemberOfCollection_uri_ms';\n if (isset($qp->solrParams['fq'])) {\n $fq_old = $qp->solrParams['fq'];\n unset($qp->solrParams['fq']);\n foreach ($fq_old as $item) {\n if (substr($item, 0, strlen($pat)) !== $pat) {\n $fq_new[] = $item;\n }\n }\n }\n\n // construct a filter to search all searchable sub-collections (those\n // that have no sub-collections).\n $searchable_collections = opensky_get_searchable_subcollections($collection);\n\n $children_params = array();\n foreach ($searchable_collections as $searchable) {\n $children_params[] = 'RELS_EXT_isMemberOfCollection_uri_ms:\"info:fedora/'.$searchable.'\"';\n }\n\n $searchable_collection_clause = implode(' OR ', $children_params);\n\n $qp->solrParams['fq'] = array_merge($fq_new, array($searchable_collection_clause));\n // dsm($qp->solrParams);\n }\n}",
"public function query() {\n $this->ensureMyTable();\n\n $def = $this->definition;\n $def['table'] = 'taxonomy_term_field_data';\n\n if (!array_filter($this->options['vids'])) {\n $taxonomy_index = $this->query->addTable('taxonomy_index', $this->relationship);\n $def['left_table'] = $taxonomy_index;\n $def['left_field'] = 'tid';\n $def['field'] = 'tid';\n $def['type'] = empty($this->options['required']) ? 'LEFT' : 'INNER';\n }\n else {\n // If vocabularies are supplied join a subselect instead\n $def['left_table'] = $this->tableAlias;\n $def['left_field'] = 'nid';\n $def['field'] = 'nid';\n $def['type'] = empty($this->options['required']) ? 'LEFT' : 'INNER';\n $def['adjusted'] = TRUE;\n\n $query = Database::getConnection()->select('taxonomy_term_field_data', 'td');\n $query->addJoin($def['type'], 'taxonomy_index', 'tn', 'tn.tid = td.tid');\n $query->condition('td.vid', array_filter($this->options['vids']), 'IN');\n if (empty($this->query->options['disable_sql_rewrite'])) {\n $query->addTag('taxonomy_term_access');\n }\n $query->fields('td');\n $query->fields('tn', ['nid']);\n $def['table formula'] = $query;\n }\n\n $join = \\Drupal::service('plugin.manager.views.join')->createInstance('standard', $def);\n\n // use a short alias for this:\n $alias = $def['table'] . '_' . $this->table;\n\n $this->alias = $this->query->addRelationship($alias, $join, 'taxonomy_term_field_data', $this->relationship);\n }",
"function display_elastic_search ($q, $filter=null, $from = 0, $size = 20, $callback = '')\n{\n\tglobal $elastic;\n\t\n\t$status = 404;\n\t\t\t\t\n\tif ($q == '')\n\t{\n\t\t$obj = new stdclass;\n\t\t$obj->hits = new stdclass;\n\t\t$obj->hits->total = 0;\n\t\t$obj->hits->hits = array();\n\t\t\n\t\t$status = 200;\n\t}\n\telse\n\t{\t\t\n\t\t// query type\t\t\n\t\t$query_json = '';\n\t\t\n\t\tif ($filter)\n\t\t{\n\t\t\tif (isset($filter->author))\n\t\t\t{\n\t\t\t\t// author search is different( but not working yet)\t\n\t\t\t\t$query_json = \t\t\n\t'{\n\t\"size\":50,\n \"query\": {\n \"bool\": {\n \"must\": [ {\n\t\t\t\t \"multi_match\" : {\n\t\t\t\t \"query\": \"<QUERY>\",\n\t\t\t\t \"fields\":[\"search_data.author\"] \n\t\t\t\t}\n\t\t\t\t}]\n }\n }\n\t}';\n\t\t\t$query_json = str_replace('<QUERY>', $q, $query_json);\n\t\t\t\n\t\t\t// echo $query_json;\n\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\t// default is search on fulltext fields\n\t\tif ($query_json == '')\n\t\t{\n\t\t\t$query_json = '{\n\t\t\t\"size\":50,\n\t\t\t\t\"query\": {\n\t\t\t\t\t\"bool\" : {\n\t\t\t\t\t\t\"must\" : [ {\n\t\t\t\t \"multi_match\" : {\n\t\t\t\t \"query\": \"<QUERY>\",\n\t\t\t\t \"fields\":[\"search_data.fulltext\", \"search_data.fulltext_boosted^4\"] \n\t\t\t\t}\n\t\t\t\t}],\n\t\t\t\"filter\": <FILTER>\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"aggs\": {\n\t\t\t\"type\" :{\n\t\t\t\t\"terms\": { \"field\" : \"search_data.type.keyword\" }\n\t\t\t },\n\t\t\t \"year\" :{\n\t\t\t\t\"terms\": { \"field\" : \"search_data.year\" }\n\t\t\t },\n\t\t\t \"container\" :{\n\t\t\t\t\"terms\": { \"field\" : \"search_data.container.keyword\" }\n\t\t\t },\n\t\t\t \"author\" :{\n\t\t\t\t\"terms\": { \"field\" : \"search_data.author.keyword\" }\n\t\t\t },\n\t\t\t \"classification\" :{\n\t\t\t\t\"terms\": { \"field\" : \"search_data.classification.keyword\" }\n\t\t\t } \n\n\t\t\t}\n\n\t\n\t\t\t}';\n\t\t\t\n\t\t\t$query_json = str_replace('<QUERY>', $q, $query_json);\n\t\t}\n\t\n\t$filter_string = '[]';\n\t\n\tif ($filter)\n\t{\n\t\t$f = array();\n\t\t\n\t\tif (isset($filter->year))\n\t\t{\n\t\t\t$one_filter = new stdclass;\n\t\t\t$one_filter->match = new stdclass;\n\t\t\t$one_filter->match->{'search_data.year'} = $filter->year;\n\t\t\t\n\t\t\t$f[] = $one_filter;\t\t\t\n\t\t}\n\n\t\t// this doesn't work\n\t\tif (isset($filter->author))\n\t\t{\n\t\t\t$one_filter = new stdclass;\n\t\t\t$one_filter->match = new stdclass;\n\t\t\t$one_filter->match->{'search_data.author'} = $filter->author;\n\t\t\t\n\t\t\t$f[] = $one_filter;\t\t\t\n\t\t}\n\t\t\n\t\t$filter_string = json_encode($f);\n\t}\n\t\n\t$query_json = str_replace('<FILTER>', $filter_string, $query_json);\n\t\n\t\n\t$resp = $elastic->send('POST', '_search?pretty', $post_data = $query_json);\n\t\n\n\t\t$obj = json_decode($resp);\n\n\t\t$status = 200;\n\t}\n\t\n\tapi_output($obj, $callback, 200);\n}",
"private function _getBaseSearchQuery()\n {\n $store = Mage::app()->getStore($this->getStoreId());\n $collection = Mage::helper('catalogsearch')\n ->getEngine()\n ->getResultCollection();\n\n $allowedVisibilities = Mage::getSingleton('catalog/product_visibility')->getVisibleInCatalogIds();\n $allowedStatuses = Mage::getSingleton('catalog/product_status')->getVisibleStatusIds();\n\n $query = $collection->getSearchEngineQuery()\n ->addFilter('terms', array('visibility' => $allowedVisibilities))\n ->addFilter('terms', array('status' => $allowedStatuses));\n\n if ($this->getStoreId() != Mage_Core_Model_App::ADMIN_STORE_ID) {\n $query->addFilter('terms', array('store_id' => $this->getStoreId()));\n }\n\n // Append the query string for the virtual categories\n if ($rule = $this->getCategory()->getVirtualRulePreview()) {\n $queryString = $this->_getQueryStringFromRule($rule);\n $query->addFilter('query', array('query_string' => $queryString));\n }\n\n $query = $query->setLanguageCode(Mage::helper('smile_elasticsearch')->getLanguageCodeByStore($store));\n\n $query->setQueryType(\"category_products_layer\");\n\n // Mimic query assembling, because ->search() is never really called on it\n $eventData = new Varien_Object(\n array('query' => $query->getRawQuery(), 'query_type' => $query->getQueryType(), 'store_id' => $this->getStoreId())\n );\n Mage::dispatchEvent('smile_elasticsearch_query_assembled', array('query_data' => $eventData));\n\n $query = $eventData->getQuery();\n\n return $query;\n }",
"function query_parse_search_expression($input) {\n if (!isset($this->search_query)) {\n $this->parsed = TRUE;\n $this->search_query = db_select('search_index', 'i', array('target' => 'slave'))->extend('viewsSearchQuery');\n $this->search_query->searchExpression($input, $this->view->base_table);\n $this->search_query->publicParseSearchExpression();\n }\n }",
"public function buildQuery() {\n\t\t\tif (isset($this->postTypes[$this->postType])) {\n\t\t\t\t$this->SetFilter('type', array($this->postTypes[$this->postType] + 1));\n\t\t\t}\n\t\t\t$this->SetFilter('status', array(1));\n\t\t\tswitch ($this->matchMode) {\n\t\t\t\tcase 'any';\n\t\t\t\tdefault:\n\t\t\t\t\t$this->SetMatchMode(SPH_MATCH_ALL);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tswitch ($this->sortMode) {\n\t\t\t\tcase 'posted':\n\t\t\t\t\t$this->SetSortMode(SPH_SORT_EXTENDED, 'posted DESC');\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'relevance':\n\t\t\t\t\t$this->SetSortMode(SPH_SORT_EXTENDED, '@relevance DESC, posted DESC');\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'top':\n\t\t\t\tdefault:\n\t\t\t\t\t$this->SetSortMode(SPH_SORT_EXPR, 'upvotes - downvotes + @weight + LN(posted) * 1000');\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\t$this->SetLimits((int) $this->currentPage, (int) $this->pageLimit, (int) $this->resultLimit);\n\t\t}",
"function scorm_get_score_from_parent($sco,$userid,$grademethod=VALUESCOES) {\n $scores = NULL; \n $scores->scoes = 0;\n $scores->values = 0;\n $scores->scaled = 0;\n $scores->max = 0;\n $scores->sum = 0;\n\n $scoes_total = 0;\n $scoes_count = 0;\n $attempt = scorm_get_last_attempt($sco->scorm, $userid);\n $scoes = get_records('scorm_scoes', 'parent', $sco->identifier);\n foreach ($scoes as $sco)\n {\n $scoes_total++;\n if ($userdata=scorm_get_tracks($sco->id, $userid,$attempt)) {\n if (($userdata->status == 'completed') || ($userdata->success_status == 'passed')) {\n $scoes_count++;\n }\n\n $scoreraw = $userdata->score_raw; \n if (!empty($userdata->score_raw)) {\n $scores->values++;\n $scores->sum += $userdata->score_raw;\n $scores->max = ($userdata->score_raw > $scores->max)?$userdata->score_raw:$scores->max;\n } \n if (!empty($userdata->score_scaled)) {\n $scores->scaled = $scores->scaled + $userdata->score_scaled;\n } \n } \n }\n if ($scoes_count > 0) {\n $scores->scaled = ($scores->scaled)/($scoes_count);\n }\n switch ($grademethod) {\n case VALUEHIGHEST:\n return $scores->max;\n break; \n case VALUEAVERAGE:\n if ($scores->values > 0) {\n return $scores->sum/$scores->values;\n } else {\n return 0;\n } \n break; \n case VALUESUM:\n return $scores->sum;\n break; \n case VALUESCOES:\n return $scores->scaled;\n break; \n }\n}",
"function university_adjust_queries($query) {\n // Adjust Programs Query\n if (\n !is_admin()\n AND is_post_type_archive('program')\n AND $query->is_main_query()\n ) {\n $query->set('orderby', 'title');\n $query->set('order', 'asc');\n $query->set('posts_per_page', -1);\n\n }\n // Adjust Events Query\n if (\n ! is_admin()\n AND is_post_type_archive('event')\n AND $query->is_main_query()\n ) {\n $today = date('Ymd');\n $query->set('meta_key', 'event_date');\n $query->set('orderby', 'meta_value_num');\n $query->set('order', 'asc');\n $query->set('meta_query', [\n [\n 'key' => 'event_date',\n 'compare' => '>=',\n 'value' => $today,\n 'type' => 'numeric'\n ]\n ]);\n }\n}",
"private function makeQuerySplit(){\n\t\t\n\t\t$this->searchQ['select'] = array('l.name','l.level_id AS levelId','l.summary','l.sum_approach','l.sum_problems','l.address_line_1','l.address_line_2','l.town','l.county','l.postcode','l.country','l.phone','l.image','l.latitude','l.longitude','l.publish_address','l.publish_phone','l.approved','p.uri','p.urlname','e.level','y.listing_type');\n\t\t$this->searchQ['orderby'][] = 'levelId DESC';\n\t\t$this->searchQ['from'] = 'listing l, listing_level e, listing_type y, pages p'; //should always be the same...\n\t\t$this->searchQ['where'] = array('e.level_id = l.level_id','y.listing_type_id = l.listing_type_id','l.page_id = p.page_id','l.publish = 1');//,'p.publish = 1');\n\t\t\n\t\t\n\t\t//! freetext\n\t\tif( strlen($this->vars['term']) ){\n\t\t\t$this->searchQ['select'][] = \"MATCH(\" . $this->ftfields . \") AGAINST ('\" . $this->booleanAndTerm($this->vars['term']) . \"' IN BOOLEAN MODE) AS score\";\n\t\t\t//$this->searchQ['where'][] = \"MATCH(\" . $ftfields . \") AGAINST ('\" . $this->booleanAndTerm($this->vars['term']) . \"' IN BOOLEAN MODE)\";\n\t\t\t// use having rather than where\n\t\t\t$this->searchQ['having'][] = \"score > 0\";\n\t\t\t$this->searchQ['orderby'][] = 'score DESC';\n\t\t\t$this->doSearch = true;\n\t\t}\n\t\t\n\t\t\n\t\t//! **** FILTERS ****\n\t\t//! profession\n\t\tif( isset($this->vars['profession']) && strlen($this->vars['profession']) ){\n\t\t\n\t\t\t//$this->searchQ['where'][] = \" l.listing_type_id IN (\" . implode(',', $this->vars['profession']) . \") \";\n\t\t\t$this->searchQ['where'][] = \" l.listing_type_id = \" . (int)$this->vars['profession'] . \" \";\n\t\t\t$this->doSearch = true;\n\t\t}\n\t\t//! max price\n\t\tif( isset($this->vars['maxprice']) && is_numeric($this->vars['maxprice']) ){\n\t\t\n\t\t\t$this->searchQ['where'][] = \" l.hourly_rate <= \" . (int)$this->vars['maxprice'] . \" \";\n\t\t\t$this->doSearch = true;\n\t\t}\n\t\t\n\t\t//! gender\n\t\tif( isset($this->vars['gender']) && in_array($this->vars['gender'] , array('M','F')) ){\n\t\t\n\t\t\t$this->searchQ['from'] .= ', listing_to_gender ltg';\n\t\t\t$this->searchQ['where'][] = \" ltg.listing_id = l.listing_id \";\n\t\t\t$this->searchQ['where'][] = \" ltg.gender = '\" . $this->vars['gender'] . \"' \";\n\t\t\t$this->doSearch = true;\n\t\t}\n\t\n\t\t//! speciality\n\t\tif( isset($this->vars['speciality']) && is_numeric($this->vars['speciality']) ){\n\t\t\n\t\t\t$this->searchQ['from'] .= ', listing_to_age ltag';\n\t\t\t$this->searchQ['where'][] = \" ltag.listing_id = l.listing_id \";\n\t\t\t$this->searchQ['where'][] = \" ltag.age_id = \" . (int)$this->vars['speciality'] . \" \";\n\t\t\t$this->doSearch = true;\n\t\t}\n\t\t\n\t\tif( strlen($this->vars['location']) ){\n\t\t\t//! ** build the location query **\n\t\t\t\n\t\t\t$this->Geocode = new Geolocation( $this->vars['location']. ', UK' );\n\t\t\t$this->Geocode->lookup();\n\t\t\t$union = array();\n\t\t\t\n\t\t\t$this->doSearch = true;\n\t\t\t$this->searchQ['orderby'][] = 'distance ASC';\n\t\t\t$c = 1;\t\n\t\t\tforeach($this->searchLevels as $level_id => $distance){\n\t\t\t// set up the initial search variables\t\t\n\t\t\t//! location\n\t\t\t\t\n\t\t\t\t//load in current other query info for this level\n\t\t\t\t$l_select = $this->searchQ['select'];\n\t\t\t\t$l_where = $this->searchQ['where'];\n\t\t\t\t$l_having = $this->searchQ['having'];\n\t\t\t\t\n\t\t\t\t// using the OS grid as makes calculation simpler than using lng/lat - can use simple pythag rather than calculus functions\n\t\t\t\t// we shorten the list of rows needing the calculation by the greater / less than in the where\n\t\t\t\t\n\t\t\t\t$calculation = ' SQRT(POW(( l.easting - ' . round($this->Geocode->getOSEast()) . '),2) + POW((l.northing - ' . round($this->Geocode->getOSNorth()) . '),2)) ';\n\t\t\t\t$l_select[] = $calculation . \" AS distance\";\n\t\t\t\t$l_where[] = \"l.level_id = \" . $level_id;\n\t\t\t\t$l_where[] = \"northing < \" . round( $this->Geocode->getOSNorth() + $distance ) ; \n\t\t\t\t$l_where[] = \"northing > \" . round( $this->Geocode->getOSNorth() - $distance ) ;\n\t\t\t\t$l_where[] = \"easting < \" . round( $this->Geocode->getOSEast() + $distance ) ;\n\t\t\t\t$l_where[] = \"easting > \" . round( $this->Geocode->getOSEast() - $distance ) ;\n\t\t\t//\t$this->searchQ['where'][] = \"(\" . $calculation . \") <= \" . $this->searchDistance ;\n\t\t\t// use having rather than where\n\t\t\t\t$l_having[] = \"distance <= \" . $distance;\n\t\t\t\t//$this->searchQ['orderby'][] = 'distance ASC';\n\t\t\t\t\n\t\t\t\t$l_q = \"SELECT \" . (($this->numRows) && 1 == $c ?' SQL_CALC_FOUND_ROWS ':'') . implode(',', $l_select). \"\n\t\t\t\t\tFROM \" . $this->searchQ['from'] . \"\n\t\t\t\t\tWHERE\n\t\t\t\t\t\t\" . implode(' AND ', $l_where) ;\n\t\n\t\t\t\tif( count($l_having) ){\n\t\t\t\t\t$l_q .= \" HAVING \" . implode(' AND ' , $l_having);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t$union[] = $l_q;\n\t\t\t\t$c++;\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t$q = '(' . implode(' ) UNION ALL (', $union) . ') ';\n\t\t\t\n\t\t\t$q .= \"\tORDER BY \" . implode(',', $this->searchQ['orderby']) . \" \";\n\t\t\t$q .= \"\tLIMIT \" . ( ($this->page-1)* $this->limit) . \",\" . $this->limit . \" \";\n\t\t\n\t\t\n\t\t}else{\n\t\t\n\t\t\n\t\t\t//! ** build the non-location query **\n\t\t\t$q = \"SELECT \" . (($this->numRows)?' SQL_CALC_FOUND_ROWS ':'') . implode(',', $this->searchQ['select']). \"\n\t\t\t\t\tFROM \" . $this->searchQ['from'] . \"\n\t\t\t\t\tWHERE\n\t\t\t\t\t\t\" . implode(' AND ', $this->searchQ['where']) ;\n\t\t\t\t\t\t\n\t\t\tif( isset($this->searchQ['having']) && count($this->searchQ['having']) ){\n\t\t\t\t$q .= \" HAVING \" . implode(' AND ' , $this->searchQ['having']);\n\t\t\t}\n\t\t\t\n\t\t\t$q .= \"\tORDER BY \" . implode(',', $this->searchQ['orderby']) . \" \";\n\t\n\t\t\t$q .= \"\tLIMIT \" . ( ($this->page-1)* $this->limit) . \",\" . $this->limit . \" \"; \n\t\t}\n\t\t//echo $q;\t\t\n\t\treturn $q;\n\t\t\n\t}",
"public function query() {\n $this->field_alias = $this->real_field;\n if (isset($this->definition['trovequery'])) {\n $this->query->add_where('', $this->definition['trovequery']['arg'], $this->definition['trovequery']['value']);\n }\n }",
"public function modifyQuery($query, SearchTerm $search);",
"private function makeQuery(){\n\t\t\n\t\t$this->searchQ['select'] = array('l.name','l.summary','l.sum_approach','l.sum_problems','l.address_line_1','l.address_line_2','l.town','l.county','l.postcode','l.country','l.phone','l.latitude','l.longitude','l.publish_address','l.publish_phone','l.approved','p.uri','p.urlname','e.level','y.listing_type');\n\t\t$this->searchQ['select'][] = '(SELECT i.image FROM listing_images i WHERE l.listing_id=i.listing_id ORDER BY i.sort_order ASC LIMIT 1) AS image';\n\t\t$this->searchQ['from'] = 'listing_level e, listing_type y, pages p, listing l '; //should always be the same...\n\t\t$this->searchQ['where'] = array('e.level_id = l.level_id','y.listing_type_id = l.listing_type_id','l.page_id = p.page_id','l.publish = 1');//,'p.publish = 1');\n\t\t\n\t\t// set up the initial search variables\t\t\n\t\t//! location\n\t\tif( strlen($this->vars['location']) ){\n\t\t\n\t\t\t$this->Geocode = new Geolocation( $this->vars['location']. ', UK' );\n\t\t\t$this->Geocode->lookup();\n\t\t\t// using the OS grid as makes calculation simpler than using lng/lat - can use simple pythag rather than calculus functions\n\t\t\t// we shorten the list of rows needing the calculation by the greater / less than in the where\n\t\t\t\n\t\t\t$calculation = ' SQRT(POW(( l.easting - ' . round($this->Geocode->getOSEast()) . '),2) + POW((l.northing - ' . round($this->Geocode->getOSNorth()) . '),2)) ';\n\t\t\t$this->searchQ['select'][] = $calculation . \" AS distance\";\n\t\t\t$this->searchQ['where'][] = \"northing < \" . round( $this->Geocode->getOSNorth() + $this->searchDistance ) ; \n\t\t\t$this->searchQ['where'][] = \"northing > \" . round( $this->Geocode->getOSNorth() - $this->searchDistance ) ;\n\t\t\t$this->searchQ['where'][] = \"easting < \" . round( $this->Geocode->getOSEast() + $this->searchDistance ) ;\n\t\t\t$this->searchQ['where'][] = \"easting > \" . round( $this->Geocode->getOSEast() - $this->searchDistance ) ;\n\t\t//\t$this->searchQ['where'][] = \"(\" . $calculation . \") <= \" . $this->searchDistance ;\n\t\t// use having rather than where\n\t\t\t$this->searchQ['having'][] = \"distance <= \" . $this->searchDistance;\n\t\t\t//$this->searchQ['orderby'][] = '(distance - ((l.level_id-1)*16000)) ASC'; // (x^3 -400^3)^(1/3)\n\t\t\t\n\t\t\t// using a exponential function to order distances based on the listing level and multiplying by 16000 m = 16km = 10 miles\n\t\t\t// then raising to power 3, deleteing the distance cubed and then 1/3 (cube root), so only makes a diffenrce within that area\n\t\t\t\n\t\t\t$this->searchQ['orderby'][] = ' POW( (POW( distance ,3) - POW(((l.level_id-1)*' . $this->levelMultiplier. '),3)),(1/3)) ASC ';\n\t\t\t$this->searchQ['orderby'][] = 'l.level_id DESC';\n\t\t\t$this->doSearch = true;\n\t\t}else{\n\t\t\t$this->searchQ['orderby'][] = 'l.level_id DESC';\n\t\t}\n\t\t\n\t\t//! freetext\n\t\tif( strlen($this->vars['term']) ){\n\t\t\t$this->searchQ['select'][] = \"MATCH(\" . $this->ftfields . \") AGAINST ('\" . $this->booleanAndTerm($this->vars['term']) . \"' IN BOOLEAN MODE) AS score\";\n\t\t\t//$this->searchQ['where'][] = \"MATCH(\" . $ftfields . \") AGAINST ('\" . $this->booleanAndTerm($this->vars['term']) . \"' IN BOOLEAN MODE)\";\n\t\t\t// use having rather than where\n\t\t\t$this->searchQ['having'][] = \"score > 0\";\n\t\t\t$this->searchQ['orderby'][] = 'score DESC';\n\t\t\t$this->doSearch = true;\n\t\t}\n\t\t\n\t\t\n\t\t//! **** FILTERS ****\n\t\t//! profession\n\t\tif( isset($this->vars['profession']) && strlen($this->vars['profession']) ){\n\t\t\n\t\t\t//$this->searchQ['where'][] = \" l.listing_type_id IN (\" . implode(',', $this->vars['profession']) . \") \";\n\t\t\t$this->searchQ['where'][] = \" l.listing_type_id = \" . (int)$this->vars['profession'] . \" \";\n\t\t\t$this->doSearch = true;\n\t\t}\n\t\t//! max price\n\t\tif( isset($this->vars['maxprice']) && is_numeric($this->vars['maxprice']) ){\n\t\t\n\t\t\t$this->searchQ['where'][] = \" l.hourly_rate <= \" . (int)$this->vars['maxprice'] . \" \";\n\t\t\t$this->doSearch = true;\n\t\t}\n\t\t\n\t\t//! gender\n\t\tif( isset($this->vars['gender']) && in_array($this->vars['gender'] , array('M','F')) ){\n\t\t\n\t\t\t$this->searchQ['from'] .= ', listing_to_gender ltg';\n\t\t\t$this->searchQ['where'][] = \" ltg.listing_id = l.listing_id \";\n\t\t\t$this->searchQ['where'][] = \" ltg.gender = '\" . $this->vars['gender'] . \"' \";\n\t\t\t$this->doSearch = true;\n\t\t}\n\t\n\t\t//! speciality\n\t\tif( isset($this->vars['speciality']) && is_numeric($this->vars['speciality']) ){\n\t\t\n\t\t\t$this->searchQ['from'] .= ', listing_to_age ltag';\n\t\t\t$this->searchQ['where'][] = \" ltag.listing_id = l.listing_id \";\n\t\t\t$this->searchQ['where'][] = \" ltag.age_id = \" . (int)$this->vars['speciality'] . \" \";\n\t\t\t$this->doSearch = true;\n\t\t}\n\t\t\n\t\t//! ** build the query **\n\t\t$q = \"SELECT \" . (($this->numRows)?' SQL_CALC_FOUND_ROWS ':'') . implode(',', $this->searchQ['select']). \"\n\t\t\t\tFROM \" . $this->searchQ['from'] . \"\n\t\t\t\tWHERE\n\t\t\t\t\t\" . implode(' AND ', $this->searchQ['where']) ;\n\n\t\tif( isset($this->searchQ['having']) && count($this->searchQ['having']) ){\n\t\t\t$q .= \" HAVING \" . implode(' AND ' , $this->searchQ['having']);\n\t\t}\n\t\t\n\t\t$q .= \"\tORDER BY \" . implode(',', $this->searchQ['orderby']) . \" \";\n\t\t\n\t\t$q .= \"\tLIMIT \" . ( ($this->page-1)* $this->limit) . \",\" . $this->limit . \" \"; \n\t\n\t\treturn $q;\n\t\t\n\t}",
"public function hook_query_index(&$query) {\n\t //Your code here\n\t \n\t }",
"function search_query($query){\n\t\tglobal $bBlog;\n\t\t$query = $this->replace($query);\n\t\t$words = explode(' ', $query);\n\t \n\t\t$sql = '';\n\t\tforeach ($words as $word){\n\t\t\t$this->make_tmp($word);\n\t\t\t$sql .= \" OR `string` = '\".$word.\"'\";\n\t\t}\n\t\treturn $bBlog->db->get_results(\"\n\t \tSELECT \n\t\t\t`article_id` AS `id`,\n\t\t\tSUM(points) AS points_sum\n\t\tFROM `\".T_SEARCH_TMP.\"`\n\t\tWHERE 0 \".$sql.\"\n\t\tGROUP BY `id`\n\t\tORDER BY `points_sum` DESC\n\t\tLIMIT 20;\n\t\t\");\n\t}",
"private function internal_query($start, $limit, $year) {\n global $DB, $CFG;\n $from = '';\n $fromarray = array();\n $where = '';\n $wherearray = array();\n $total = '';\n\n $occurstable = year_tables::get_occurs_table($year);\n $docstable = year_tables::get_docs_table($year);\n\n $join = 0;\n foreach ($this->terms as $term) {\n foreach ($term->ids as $id) {\n $alias = \"o$join\";\n if ($join == 0) {\n $from .= \"{\" . $occurstable . \"} $alias \";\n $where .= \"$alias.wordid = ?\";\n $wherearray[] = $id;\n $total .= \"$alias.score\";\n } else {\n // Note: This line uses the id directly rather than as a ?\n // parameter, because.\n $from .= \"JOIN {\" . $occurstable . \"} $alias\n ON $alias.documentid = o0.documentid AND $alias.wordid = ? \";\n $fromarray[] = $id;\n $total .= \"+$alias.score\";\n }\n $join++;\n }\n }\n // Because it kills the server to search for a large number of terms\n // when the database is full, we need to limit it.\n $maxterms = $CFG->local_ousearch_maxterms;\n if ($join > $maxterms) {\n $referer = $_SERVER['HTTP_REFERER'];\n if (!$referer) {\n $referer = ''; // Use default.\n }\n throw new moodle_exception('toomanyterms', 'local_ousearch', $referer, $maxterms);\n }\n foreach ($this->negativeterms as $term) {\n if (count($term->ids) == 1) {\n $alias = \"o$join\";\n $from .= \"LEFT JOIN {\" . $occurstable . \"} $alias\n ON $alias.documentid = o0.documentid AND $alias.wordid = ?\";\n $fromarray[] = $term->ids[0];\n $total .= \"-(CASE WHEN $alias.score IS NULL THEN 0 ELSE 999999 END)\";\n $join++;\n }\n }\n\n list ($restrict, $restrictarray) = $this->internal_get_restrictions();\n $query = \"\n SELECT o0.documentid, $total AS totalscore, d.*,\n c.shortname AS courseshortname, c.fullname AS coursefullname,\n g.name AS groupname\n FROM $from\n JOIN {\" . $docstable . \"} d ON d.id = o0.documentid\n LEFT JOIN {course} c ON d.courseid = c.id\n LEFT JOIN {groups} g ON d.groupid = g.id\n WHERE $where\n $restrict\n AND $total > 0\n ORDER BY totalscore DESC, o0.documentid\";\n $queryarray = array_merge($fromarray, $wherearray, $restrictarray);\n $result = $DB->get_records_sql($query, $queryarray, $start, $limit);\n if (!$result) {\n $result = array();\n }\n return $result;\n }",
"public function hook_query_index(&$query)\n\t{\n\t\t//Your code here\n\n\t}",
"function calc_dream_mp_score_a($db, $dreamid, $personid) {\n global $pwpdo;\n $query = \"select pw_vote.vote as mpvote, pw_dyn_dreamvote.vote as dreamvote from\n pw_vote, pw_dyn_dreamvote, pw_division, pw_mp where\n pw_vote.division_id = pw_division.division_id and\n pw_dyn_dreamvote.division_number = pw_division.division_number and\n pw_dyn_dreamvote.division_date = pw_division.division_date\n and pw_vote.mp_id = pw_mp.mp_id\n and pw_mp.person = ? and pw_dyn_dreamvote.dream_id = ?\";\n\n $qrowarray=$pwpdo->fetch_all_rows($query,array($personid,$dreamid));\n $t = 0.0;\n $c = 0.0;\n foreach ($qrowarray as $qrow)\n {\n $weight = 1;\n $mpvote = $qrow['mpvote'];\n $mpvote = str_replace(\"tell\", \"\", $mpvote);\n $dreamvote = $qrow['dreamvote'];\n if ($dreamvote == \"aye3\" or $dreamvote == \"no3\") {\n $dreamvote = str_replace(\"3\", \"\", $dreamvote);\n $weight = 3;\n }\n $t += $weight;\n\n if ($mpvote == $dreamvote)\n $c += $weight;\n elseif ($mpvote == \"both\" or $dreamvote == \"both\")\n $c = $c + ($weight / 2);\n }\n\n return array($c, $t);\n}",
"public function onAfterPrepare()\n {\n if (!$this->owner->searchString) {\n $this->owner->parent ??= EntryParentFromRequest::getParent();\n\n // Set default order from parent entry, if no category order was set.\n if (!$this->owner->category?->getEntryOrderBy()) {\n if ($orderBy = $this->owner->parent?->getDescendantsOrder()) {\n $this->owner->query->orderBy($orderBy);\n }\n }\n\n $this->owner->query->andWhere(['parent_id' => $this->owner->parent?->id]);\n }\n }",
"function _fourD_analysis_calculate_project_goal_weight( $nid, $uid=0, $goals, $project ) {\n// fourD_analysis_debug('_fourD_analysis_calculate_project_goal_weight('.$nid.'); <br>----------------------------<br>' );\n// fourD_analysis_debug('_fourD_analysis_calculate_project_goal_weight('.$nid.'); $goals: '.print_r($goals, true) );\n //fourD_analysis_debug('_fourD_analysis_calculate_project_goal_weight('.$nid.'); $project: '.print_r($project, true) );\n \n if( !count($goals) || !$project ){\n return 0.0;\n }\n \n $weight = 0;\n $indirectParents = array();\n if( isset($project['project_goal']) ){\n foreach( $goals as $gid=>$g ){\n\n $goal = fourD_analysis_goal_entry_get($gid, $uid);\n// fourD_analysis_debug('----- _fourD_analysis_calculate_project_goal_weight; : Goal: '.$project['project_goal'][$gid]['title'].'; Info: '.print_r($goal, true) );\n\n if($goal && isset($goal['goal_weight']) ){\n if( isset($project['project_goal'][$gid]['rating']) ){\n \n// fourD_analysis_debug('+++++ _fourD_analysis_calculate_project_goal_weight; : Goal: '.$project['project_goal'][$gid]['title'].'; Info: '.print_r($project['project_goal'][$gid], true) );\n\n\n /* Direct parent and top-level are G1*W1 */\n if( _fourD_analysis_is_goal_applicable_to_project_input($nid, $g) ){\n $weight += ( $goal['goal_weight']*$project['project_goal'][$gid]['rating'] );\n// fourD_analysis_debug('_fourD_analysis_calculate_project_goal_weight; INPUT: Goal: '.$project['project_goal'][$gid]['title'].'; nid: '. $gid.'; W'.$gid.' = '.$goal['goal_weight'].'; G'.$gid.' = '.$project['project_goal'][$gid]['rating'].'; W'.$gid.'*G'.$gid.' = '.( $goal['goal_weight']*$project['project_goal'][$gid]['rating'] ). '; Cumlative: '.$weight );\n\n //fourD_analysis_debug('_fourD_analysis_calculate_project_goal_weight('.$nid.'); INPUT: Goal: '.print_r($project['project_goal'][$gid], true) );\n }\n /* Indirect parents are simply (*W6*W7) - Note: not (G6*W6+G7*W7) */\n// elseif( _fourD_analysis_is_goal_applicable_to_project($nid, $g) ){\n// $indirectParents[$gid] = $goal['goal_weight'];\n// fourD_analysis_debug('_fourD_analysis_calculate_project_goal_weight; APPLICABLE: Goal: '.$project['project_goal'][$gid]['title'].'; nid: '. $gid.'; W'.$gid.' = '.$goal['goal_weight'].'; G'.$gid.' = '.$project['project_goal'][$gid]['rating'].'; W'.$gid.'*G'.$gid.' = '.( $goal['goal_weight']*$project['project_goal'][$gid]['rating'] ). '; Cumlative: '.$weight );\n// }\n \n /* ALL parents are simply (*W6*W7) - Note: not (G6*W6+G7*W7) */\n if( _fourD_analysis_is_goal_parent_to_project($nid, $g) ){\n $indirectParents[$gid] = $goal['goal_weight'];\n// fourD_analysis_debug('_fourD_analysis_calculate_project_goal_weight; PARENT: Goal: '.$project['project_goal'][$gid]['title'].'; nid: '. $gid.'; W'.$gid.' = '.$goal['goal_weight'].'; G'.$gid.' = '.$project['project_goal'][$gid]['rating'].'; W'.$gid.'*G'.$gid.' = '.( $goal['goal_weight']*$project['project_goal'][$gid]['rating'] ). '; Cumlative: '.$weight );\n //fourD_analysis_debug('_fourD_analysis_calculate_project_goal_weight('.$nid.'); PARENT: Goal: '.print_r($project['project_goal'][$gid], true) );\n }\n \n \n// fourD_analysis_debug('_fourD_analysis_calculate_project_goal_weight; nid: '. $gid.'; W'.$gid.' = '.$goal['goal_weight'].'; G'.$gid.' = '.$project['project_goal'][$gid]['rating'].'; W'.$gid.'*G'.$gid.' = '.( $goal['goal_weight']*$project['project_goal'][$gid]['rating'] ). '; Cumlative: '.$weight );\n }\n\n else{\n /* ALL parents are simply (*W6*W7) - Note: not (G6*W6+G7*W7) */\n if( _fourD_analysis_is_goal_parent_to_project($nid, $g) ){\n $indirectParents[$gid] = $goal['goal_weight'];\n// fourD_analysis_debug('_fourD_analysis_calculate_project_goal_weight; PARENT: Goal: '.$project['project_goal'][$gid]['title'].'; nid: '. $gid.'; W'.$gid.' = '.$goal['goal_weight'].'; G'.$gid.' = '.$project['project_goal'][$gid]['rating'].'; W'.$gid.'*G'.$gid.' = '.( $goal['goal_weight']*$project['project_goal'][$gid]['rating'] ). '; Cumlative: '.$weight );\n //fourD_analysis_debug('_fourD_analysis_calculate_project_goal_weight('.$nid.'); PARENT: Goal: '.print_r($g, true) );\n }\n }\n }\n\n\n }\n\n /* Finally, factor in any indirect parents */\n foreach($indirectParents as $nid=>$w){\n $weight = ($weight*$w);\n }\n }\n \n return $weight;\n}",
"function sopac_catalog_search() {\n global $pager_page_array, $pager_total, $locum_results_all, $locum_cfg;\n global $user;\n $account = user_load(array('uid' => $user->uid));\n // Load Required JS libraries\n drupal_add_js(drupal_get_path('module', 'sopac') .'/js/jquery.treeview.js');\n drupal_add_js(drupal_get_path('module', 'sopac') .'/js/jquery.rating.js');\n drupal_add_js(drupal_get_path('module', 'sopac') .'/js/facet-browser.js');\n require_once('sopac_social.php');\n $getvars = sopac_parse_get_vars();\n $actions = sopac_parse_uri();\n $locum = sopac_get_locum();\n $locum_cfg = $locum->locum_config;\n $no_circ = $locum->csv_parser($locum_cfg['location_limits']['no_request']);\n $valid_search_types = array('title', 'author', 'keyword', 'subject', 'series', 'callnum', 'tags', 'reviews'); // TODO handle this more dynamically\n\n $output = $getvars['output'];\n $sort = $getvars['sort'];\n $format = $getvars['search_format'];\n $location = $getvars['location'];\n $limit_avail = $getvars['limit_avail'];\n $pager_page_array = explode(',', $getvars['page']);\n // temp for advanced page. should this be broken out\n if($actions[1] == 'isn'){\n $actions[1] = 'keyword';\n }\n $search_type = $actions[1];\n if ($actions[3]) {\n $actions[2] = $actions[2] . \"/\" . $actions[3];\n }\n $search_term = $actions[2];\n // If there is a proper search query, we get that data here.\n if (in_array($actions[1], $valid_search_types)) {\n $valid_search = TRUE;\n\n // Save the search URL in a cookie\n $_SESSION['search_url'] = request_uri();\n\n if ($getvars['perpage']) {\n $limit = $getvars['perpage'];\n }\n elseif ($account->profile_perpage) {\n $limit = $account->profile_perpage;\n }\n else {\n $limit = variable_get('sopac_results_per_page', 10);\n }\n\n\n if ($user->uid && $limit != $account->profile_perpage) {\n $field = db_fetch_object(db_query(\"SELECT * FROM profile_fields WHERE name = 'profile_perpage'\"));\n db_query(\"INSERT INTO profile_values (fid, uid, value) VALUES (%d, %d, '%s') ON DUPLICATE KEY UPDATE value = '%s'\", $field->fid, $user->uid, $limit, $limit);\n }\n\n //if ($addl_search_args['limit']) {\n // $limit = $addl_search_args['limit'];\n //}\n //else {\n // $limit = variable_get('sopac_results_per_page', 20);\n //}\n\n // Initialize the pager if need be\n if ($pager_page_array[0]) {\n $page = $pager_page_array[0] + 1;\n }\n else {\n $page = 1;\n }\n $page_offset = $limit * ($page - 1);\n\n // Grab the faceted search arguments from the URL\n $facet_args = array();\n if (count($getvars['facet_series'])) {\n $facet_args['facet_series'] = $getvars['facet_series'];\n }\n if (count($getvars['facet_lang'])) {\n $facet_args['facet_lang'] = $getvars['facet_lang'];\n }\n if (count($getvars['facet_year'])) {\n $facet_args['facet_year'] = $getvars['facet_year'];\n }\n if (count($getvars['facet_decade'])) {\n $facet_args['facet_decade'] = $getvars['facet_decade'];\n }\n if (count($getvars['age'])) {\n $facet_args['age'] = $getvars['age'];\n }\n if (count($getvars['facet_subject'])) {\n $facet_args['facet_subject'] = $getvars['facet_subject'];\n }\n if (count($getvars['facet_lexile'])) {\n $facet_args['facet_lexile'] = $getvars['facet_lexile'];\n }\n\n // Hide suppressed records unless permission\n $show_inactive = user_access('show suppressed records');\n\n // Get the search results from Locum\n $locum_results_all = $locum->search($search_type, $search_term, $limit, $page_offset, $sort, $format, $location, $facet_args, FALSE, $limit_avail, $show_inactive);\n $num_results = $locum_results_all['num_hits'];\n $result_info['limit'] = $limit;\n $result_info['num_results'] = $num_results;\n $result_info['hit_lowest'] = $page_offset + 1;\n if (($page_offset + $limit) < $num_results) {\n $result_info['hit_highest'] = $page_offset + $limit;\n }\n else {\n $result_info['hit_highest'] = $num_results;\n }\n }\n\n // Construct the search form\n $search_form_cfg = variable_get('sopac_search_form_cfg', 'both');\n $search_form = sopac_search_form($search_form_cfg);\n\n // If we get results back, we begin creating the hitlist\n if ($num_results > 0) {\n // We need to determine how many result pages there are.\n $pager_total[0] = ceil($num_results / $limit);\n $hitlist = '';\n $hitnum = $page_offset + 1;\n\n // When limiting to available, sometimes the \"Last\" link takes the user beyond the number of\n // available items and errors out. This will step them back until they have at least 1 hit.\n if (!count($locum_results_all['results']) && $getvars['limit_avail']) {\n $uri_arr = explode('?', request_uri());\n $uri = $uri_arr[0];\n $getvars_tmp = $getvars;\n if ($getvars_tmp['page']) {\n if ($getvars_tmp['page'] == 1) {\n $getvars_tmp['page'] = '';\n }\n else {\n $getvars_tmp['page']--;\n }\n $pvars_tmp = trim(sopac_make_pagevars(sopac_parse_get_vars($getvars_tmp)));\n $gvar_indicator = $pvars_tmp ? '?' : '';\n $step_link = $uri . $gvar_indicator . $pvars_tmp;\n header('Location: ' . $step_link);\n }\n }\n\n // Loop through results.\n foreach ($locum_results_all['results'] as $locum_result) {\n\n // Grab Stdnum\n $stdnum = $locum_result['stdnum'][0];\n\n // Get the cover image\n $cover_img_url = $locum_result['cover_img'];\n $locum_result['sort'] = $sort;\n // Grab Syndetics reviews, etc..\n $review_links = $locum->get_syndetics($locum_result['stdnum'][0]);\n if (count($review_links)) {\n $locum_result['review_links'] = $review_links;\n }\n\n // Send it all off to the template\n if ($output == \"rss\") {\n $result_body .= theme('sopac_results_hitlist_rss', $hitnum, $cover_img_url, $locum_result, $locum_cfg, $no_circ);\n }\n else if ($output == \"xml\") {\n $result_body .= theme('sopac_results_hitlist_xml', $hitnum, $cover_img_url, $locum_result, $locum_cfg, $no_circ);\n }\n else {\n $result_body .= theme('sopac_results_hitlist', $hitnum, $cover_img_url, $locum_result, $locum_cfg, $no_circ);\n }\n $hitnum++;\n }\n\n $hitlist_pager = theme('pager', NULL, $limit, 0, NULL, 6);\n }\n else if ($valid_search) {\n $result_body .= theme('sopac_results_nohits', $locum_results_all, $locum->locum_config);\n }\n\n // Pull it all together into the search page template\n $result_page = $search_form . theme($output_template, $result_info, $hitlist_pager, $result_body, $locum_results_all, $locum->locum_config);\n\n // Check to see if we're doing RSS\n if ($output == \"rss\") {\n print theme('sopac_results_rss', $result_info, $search_term, $search_type, $result_body, $locum_results_all, $locum->locum_config);\n exit(0);\n }\n else if ($output == \"xml\") {\n print theme('sopac_results_xml', $result_info, $hitlist_pager, $result_body, $locum_results_all, $locum->locum_config);\n exit(0);\n }\n else {\n $result_page = $search_form . theme('sopac_results', $result_info, $hitlist_pager, $result_body, $locum_results_all, $locum->locum_config);\n }\n\n $search_feed_url = sopac_update_url(request_uri(), 'output', 'rss');\n drupal_add_feed($search_feed_url, 'Search for \"' . $search_term . '\"');\n\n return $result_page;\n\n}",
"public function query() {\n if (!empty($this->value)) {\n $this->ensureMyTable();\n $field = \"$this->tableAlias.nid\";\n\n $configuration = array(\n 'type' => 'INNER',\n 'table' => 'menu_link_content_data',\n 'field' => 'link__uri',\n 'left_table' => 'node_field_data',\n 'left_field' => 'nid',\n 'operator' => '=',\n );\n $join = Views::pluginManager('join')->createInstance('standard', $configuration);\n $this->query->addRelationship('my_uu', $join, 'node_field_data');\n $this->query->addWhere($this->options['group'], $field, $this->value, '=');\n }\n }",
"function gre_search_results()\n\t{\n\t\tglobal $wpdb,$post;\n\n\t\t\t$select = 'city,blurb,address,bedrooms,bathrooms,saleprice';\n\t\t\t$pre_where = '';\n\t\t\t$output = '';\n\t\t\t\n\t\t\tif( $_POST )\n\t\t\t{\n\t\t\t\t$search_type = $_POST['search-type'];\n\t\t\t\tif($search_type == 'fs')\n\t\t\t\t{\n\t\t\t\t\tif($_POST['location'] != '')\n\t\t\t\t\t{\n\t\t\t\t\t\t$loc = $wpdb->escape($_POST['location']);\n\t\t\t\t\t\t$pre_where .= \"(address LIKE '%$loc%' OR postcode LIKE '%$loc%' OR city LIKE '%$loc%')\";\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif($_POST['min'] != 'min' && ($_POST['max'] == '' || $_POST['max'] == 'max'))\n\t\t\t\t\t{\n\t\t\t\t\t\t$min = $wpdb->escape($_POST['min']);\n\t\t\t\t\t\t$pre_where .= \" AND saleprice > $min\";\n\t\t\t\t\t}\n\t\t\t\t\telse if(($_POST['min'] == '' || $_POST['min'] == 'min') && $_POST['max'] != 'max')\n\t\t\t\t\t{\n\t\t\t\t\t\t$max = $wpdb->escape($_POST['max']);\n\t\t\t\t\t\t$pre_where .= \" AND saleprice <= $max\";\n\t\t\t\t\t}\n\t\t\t\t\telse if($_POST['min'] != 'min' && $_POST['max'] != 'max')\n\t\t\t\t\t{\n\t\t\t\t\t\t$min = $wpdb->escape($_POST['min']);\n\t\t\t\t\t\t$max = $wpdb->escape($_POST['max']);\n\t\t\t\t\t\t$pre_where .= \" AND (saleprice >= $min AND saleprice <= $max)\";\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif($_POST['beds'] != 0)\n\t\t\t\t\t{\n\t\t\t\t\t\t$arr = explode('-',$_POST['beds']);\n\t\t\t\t\t\t$min = $wpdb->escape($arr[0]);\n\t\t\t\t\t\t$max = $wpdb->escape($arr[1]);\n\t\t\t\t\t\t$pre_where .= \" AND (bedrooms >= $min AND bedrooms <= $max)\";\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif($_POST['baths'] != 0)\n\t\t\t\t\t{\n\t\t\t\t\t\t$arr = explode('-',$_POST['baths']);\n\t\t\t\t\t\t$min = $wpdb->escape($arr[0]);\n\t\t\t\t\t\t$max = $wpdb->escape($arr[1]);\n\t\t\t\t\t\t$pre_where .= \" AND (bathrooms >= $min AND bathrooms <= $max)\";\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif($_POST['sqft'] != 0)\n\t\t\t\t\t{\n\t\t\t\t\t\t$sqft = $wpdb->escape($_POST['sqft']);\n\t\t\t\t\t\t$pre_where .= \" AND acsf >= $sqft\";\n\t\t\t\t\t}\n\t\t\t\t\tif(isset($_POST['price_change']))\n\t\t\t\t\t{\n\t\t\t\t\t\t$pre_where .= \" AND reduceprice <> '0' AND saleprice > reduceprice\";\n\t\t\t\t\t\t$select .= \",reduceprice\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if($search_type == 'sh')\n\t\t\t\t{\n\t\t\t\t\tif($_POST['location'] != '')\n\t\t\t\t\t{\n\t\t\t\t\t\t$loc = $wpdb->escape($_POST['location']);\n\t\t\t\t\t\t$pre_where .= \"(address LIKE '%$loc%' OR postcode LIKE '%$loc%' OR city LIKE '%$loc%')\";\n\t\t\t\t\t\t$pre_where .=\" AND saledate <> '0000-00-00'\";\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif($_POST['min'] != 'min' && ($_POST['max'] == '' || $_POST['max'] == 'max'))\n\t\t\t\t\t{\n\t\t\t\t\t\t$min = $wpdb->escape($_POST['min']);\n\t\t\t\t\t\t$pre_where .= \" AND saleprice >= $min\";\n\t\t\t\t\t}\n\t\t\t\t\telse if(($_POST['min'] == '' || $_POST['min'] == 'min') && $_POST['max'] != 'max')\n\t\t\t\t\t{\n\t\t\t\t\t\t$max = $wpdb->escape($_POST['max']);\n\t\t\t\t\t\t$pre_where .= \" AND saleprice <= $max\";\n\t\t\t\t\t}\n\t\t\t\t\telse if($_POST['min'] != 'min' && $_POST['max'] != 'max')\n\t\t\t\t\t{\n\t\t\t\t\t\t$min = $wpdb->escape($_POST['min']);\n\t\t\t\t\t\t$max = $wpdb->escape($_POST['max']);\n\t\t\t\t\t\t$pre_where .= \" AND (saleprice >= $min AND saleprice <= $max)\";\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif($_POST['beds'] != 0)\n\t\t\t\t\t{\n\t\t\t\t\t\t$arr = explode('-',$_POST['beds']);\n\t\t\t\t\t\t$min = $wpdb->escape($arr[0]);\n\t\t\t\t\t\t$max = $wpdb->escape($arr[1]);\n\t\t\t\t\t\t$pre_where .= \" AND (bedrooms >= $min AND bedrooms <= $max)\";\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif($_POST['baths'] != 0)\n\t\t\t\t\t{\n\t\t\t\t\t\t$arr = explode('-',$_POST['baths']);\n\t\t\t\t\t\t$min = $wpdb->escape($arr[0]);\n\t\t\t\t\t\t$max = $wpdb->escape($arr[1]);\n\t\t\t\t\t\t$pre_where .= \" AND (bathrooms >= $min AND bathrooms <= $max)\";\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif($_POST['sold'] != 0)\n\t\t\t\t\t{\n\t\t\t\t\t\t$num_month = $wpdb->escape($_POST['sold']);\n\t\t\t\t\t\t$pre_where .= \" AND (saledate <= DATE_ADD(listdate, INTERVAL $num_month MONTH))\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif($_POST['location'] != '')\n\t\t\t\t\t{\n\t\t\t\t\t\t$loc = $wpdb->escape($_POST['location']);\n\t\t\t\t\t\t$pre_where .= \"(address LIKE '%$loc%' OR postcode LIKE '%$loc%' OR city LIKE '%$loc%')\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t$where .= (empty($pre_where))? \"\" : \"WHERE $pre_where\";\n\t\t\t\t\t\t\n\t\t\t\t$listing = $wpdb->get_results(\"SELECT $select FROM $wpdb->gre_search_listing $where\");\n\t\t\t\tif($listing)\n\t\t\t\t{\n\t\t\t\t\t$output .= \"<div>\";\n\t\t\t\t\tforeach ($listing as $row) \n\t\t\t\t\t{\n\t\t\t\t\t\t\n\t\t\t\t\t\t$output .= \"<div>City : $row->city</div>\";\n\t\t\t\t\t\t$output .= \"<div>Blurb : $row->blurb</div>\";\n\t\t\t\t\t\t$output .= \"<div>Address : $row->address</div>\";\n\t\t\t\t\t\t$output .= \"<div>Bedrooms : $row->bedrooms</div>\";\n\t\t\t\t\t\t$output .= \"<div>Bathrooms : $row->bathrooms</div>\";\n\t\t\t\t\t\t$output .= \"<div>Saleprice : $ \". number_format($row->saleprice) .\"</div>\";\n\t\t\t\t\t\tif($row->reduceprice)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$output .= \"<div>Reduce Saleprice : $ \". number_format($row->reduceprice) .\"</div>\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$output .= \"<hr/>\";\n\t\t\t\t\t}\n\t\t\t\t\t$output .= \"</div>\";\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$output .= \"<div>No Result Found</div>\";\n\t\t\t\t}\n\t\t\t\treturn '<br/>'.$output;\n\t\t\t}\n\t}",
"public function execute()\n\t{\n\t\t$searchQuery = $this->searchPhrase ? '\"' . $this->searchPhrase . '\"' : '';\n\t\t$queryParams['attributesToRetrieve']\t= '*';\n\t\t$queryParams['maxValuesPerFacet']\t\t= '100';\n\t\t$queryParams['attributesToHighlight']\t= array();\n\t\t$queryParams['filters']\t\t\t\t\t= $this->filters;\n\t\t$queryParams['facetFilters']\t\t\t= $this->facetFilters;\n\t\t$queryParams['offset']\t\t\t\t\t= $this->start;\n\t\t$queryParams['length']\t\t\t\t\t= $this->limit;\n\n\t\t$queryParams['facets']\t\t\t\t\t= array($this->facetField);\n\n\t\t// We need to pass this query by setRawQueryParams for advsearch frontent.\n\t\t$queryParams['advancedSyntax']\t\t\t= 'true';\n\n\t\tif (count($this->rawQueryParams))\n\t\t{\n\t\t\t$queryParams = array_merge($queryParams, $this->rawQueryParams);\n\t\t}\n\n\t\t// This is something Juggad related to Osianama requirement.\n\t\tif (isset($queryParams['restrictSearchableAttributes']))\n\t\t{\n\t\t\t$searchQuery = $this->searchPhrase ? $this->searchPhrase : '';\n\t\t}\n\n\t\t$Data = $this->algoliaIndex->search($searchQuery, $queryParams);\n\n\t\tif (count($Data['hits']) > 0)\n\t\t{\n\t\t\t$this->total\t= $Data['nbHits'];\n\t\t\t$this->count\t= $Data['hitsPerPage'];\n\t\t\t$this->records\t= '';\n\n\t\t\tforeach ($Data['hits'] as $key => $row)\n\t\t\t{\n\t\t\t\tunset($row['_highlightResult']);\n\n\t\t\t\t$row['id']\t\t\t\t\t\t= $row['objectID'];\n\t\t\t\t$this->records['data'][$key]\t= (object) $row;\n\t\t\t}\n\n\t\t\tif ($this->facetField)\n\t\t\t{\n\t\t\t\t$this->records['facets'] = $Data['facets'];\n\t\t\t}\n\t\t}\n\t}",
"public function createDefaultSearchQuery()\n {\n $qB = SearchEngine::getElasticaQueryBuilder();\n\n $keyword = Utility::convertArrayToString($this->searchEvent->getKeyword());\n $where = $this->searchEvent->getWhere();\n\n $keywordQuery = null;\n $whereQuery = null;\n $content = 0;\n if ($where) {\n if ($geoDistance = $this->container->get(\"nearby.handler\")->getGeoDistanceInfoByWhere()) {\n $whereQuery = $qB->query()->bool();\n $whereQuery->addShould(\n $qB->query()->match()->setFieldQuery(\"searchInfo.location\",$where)\n ->setFieldType(\"searchInfo.location\", \"phrase\")\n ->setFieldBoost(\"searchInfo.location\", 2)\n ->setFieldParam('searchInfo.location', 'slop', 30)\n );\n $whereQuery->addShould(\n $qB->query()->geo_distance(\n 'geoLocation',\n [\n 'lat' => $geoDistance['latitude'],\n 'lon' => $geoDistance['longitude'],\n ],\n $geoDistance['radius'])\n );\n $content |= 1;\n } else {\n $whereQuery = $qB->query()->match()->setFieldQuery('searchInfo.location',$where)\n ->setFieldType('searchInfo.location', 'phrase')\n ->setFieldParam('searchInfo.location', 'slop', 30);\n $content |= 1;\n }\n }\n\n if ($keyword) {\n $keywordQuery = $qB->query()->multi_match();\n\n $keywordQuery->setQuery($keyword)\n ->setTieBreaker(0.3)\n ->setOperator(\"and\")\n ->setFields([\n 'friendlyUrl^500',\n 'title.raw^200',\n 'title.analyzed^10',\n 'description^5',\n 'searchInfo.keyword^1',\n 'searchInfo.location^1',\n ]);\n\n $content |= 2;\n }\n\n /* ModStores Hooks */\n HookFire(\"baseconfiguration_before_setup_query\", [\n \"content\" => &$content,\n \"whereQuery\" => &$whereQuery,\n \"keywordQuery\" => &$keywordQuery\n ]);\n\n switch ($content) {\n case 1:\n $query = $whereQuery;\n break;\n case 2:\n $query = $keywordQuery;\n break;\n case 3:\n $query = $qB->query()->bool();\n $query->addMust($keywordQuery);\n $query->addMust($whereQuery);\n break;\n default:\n $query = $qB->query()->match_all();\n break;\n }\n\n /* ModStores Hooks */\n HookFire(\"baseconfiguration_before_return_query\", [\n \"query\" => &$query,\n ]);\n\n return $query;\n }",
"public static function applyCostSearch($query, $search)\n { \n static::applyRelatedSearch($query, $search);\n }"
]
| [
"0.63922375",
"0.5687345",
"0.5610112",
"0.5465404",
"0.5323646",
"0.52082294",
"0.51995945",
"0.51544017",
"0.5142923",
"0.51165235",
"0.5106122",
"0.50598943",
"0.50287026",
"0.501357",
"0.49986017",
"0.49760142",
"0.49670443",
"0.49514598",
"0.49207982",
"0.48586658",
"0.48554507",
"0.48446074",
"0.48307046",
"0.48277065",
"0.48116198",
"0.48095548",
"0.48082387",
"0.47988302",
"0.47970492",
"0.47969538"
]
| 0.66665363 | 0 |
Reads string from specified file path and parses it as TOML. | public static function parseFile($path)
{
if(!is_file($path))
{
throw new Exception('Invalid file path');
}
$toml = file_get_contents($path);
// Remove BOM if present
$toml = preg_replace('/^' . pack('H*','EFBBBF') . '/', '', $toml);
return self::parse($toml);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function tidy_parse_file($filename, $config = null, $encoding = null, $use_include_path = false) {}",
"function loadTemplateFile($filePath)\n{\n return loadTemplateString(file_get_contents($filePath));\n}",
"public static function loadFile($path)\n {\n assert(is_string($path), 'Wrong type for argument 1. String expected');\n return \\simplexml_load_file($path, __CLASS__);\n }",
"private function fileContent($path)\n\t{\n\t\tif ( !file_exists($path))\n\t\t{\n\t\t\tUtils_Configuration_XMLLoaderOpenFileException(\n\t\t\t\t'Nie ma pliku ' . $path);\n\t\t}\n\n\t\t$this->sXML = file_get_contents($path);\n\n\t\tif (false === $this->sXML)\n\t\t{\n\t\t\tUtils_Configuration_XMLLoaderOpenFileException(\n\t\t\t\t'Nie udalo sie odczytac zawartosci pliku ' . $path);\n\t\t}\n\t}",
"public static function parsing($path, $array)\n {\n if (!file_exists($path)) {\n throw new Exceptions\\MyException ('Invalid path specified');\n }\n\n if (!is_readable($path)) {\n throw new Exceptions\\MyException ('File read error');\n }\n\n $temp = file_get_contents($path);\n\n foreach ($array as $mark => $text) {\n $pos = strripos($temp,'<!--'.$mark.'-->');\n\n if ($pos){\n $temp = substr_replace($temp,' '.$text.' ',$pos,0);}\n }\n return $temp; \n }",
"function load_t2s_text(){\n\tglobal $config, $t2s_langfile, $t2s_text_stand, $templatepath;\n\t\n\tif (file_exists($templatepath.'/lang/'.$t2s_langfile)) {\n\t\t$TL = parse_ini_file($templatepath.'/lang/'.$t2s_langfile, true);\n\t} else {\n\t\tLOGGING(\"For selected T2S language no translation file still exist! Please go to LoxBerry Plugin translation and create a file for selected language \".substr($config['TTS']['messageLang'],0,2),3);\n\t\texit;\n\t}\n\treturn $TL;\n}",
"function load_file($path){\n\tif (!file_exists($path)) system_die('File reading error - \"' . $path . '\"', 'Template->load_file');\n\t$this->template = @file($path);\n\tunset($this->result);\n\t$this->filename = $path;\n}",
"public function parseXML($filePath) {\n \t$doc = $this->_loadXML($filePath);\n\n \t$texts = $doc->getElementsByTagName('text');\n \tforeach ($texts as $text) {\n \t\tdefine($text->getAttribute('id'), $text->nodeValue);\n \t}\n\n //\tthat's all folks!\n }",
"public function parse($file);",
"public function parse($file);",
"public function readtpl(string $tpl_temp):string{\n\t\t$extension = explode('.',$tpl_temp);\n\t\t$extension = end($extension);\n\t\tif(strtolower($extension) == 'tpl'){\n\t\t\tif (!file_exists($this->template_dir . Options::get('template') . '/'.$tpl_temp)) \n\t\t\t\treturn \"Error loading template file <br />\";\n\t\t\telse\n\t\t\t\treturn file_get_contents($this->template_dir . Options::get('template') . '/'.$tpl_temp);\n\t\t}\n\t}",
"public function loadTemplate($path);",
"function transformFile($filePath)\n{\n return transformDOM(loadTemplateFile($filePath));\n}",
"function readTemplates( $input )\r\n {\r \tglobal $CONFIG;\r\n \tif (isset($this->_rootAtts['relative'])) {\r\n\t\t\t$relative = $this->_rootAtts['relative'];\r\n\t\t} else {\r\n\t\t\t$relative = false;\r\n\t\t}\r\n\t\tif ($relative === false) {\r\n \t\t$this->_currentInput = $input;\r\n\t\t} else {\r\n\t\t\t$this->_currentInput = dirname($relative) . DIRECTORY_SEPARATOR . $input;\r\n\t\t}\r\n\r\n\t\t$content = $this->_getFileContents($this->getTemplateRoot().$input.'.'.$CONFIG['tpl']['ext']);\r\n\t\tif (patErrorManager::isError($content)) {\r\n\t\t\treturn $content;\r\n\t\t}\r\n\r\n\t\t$templates = $this->parseString($content);\r\n\r\n\t\treturn\t$templates;\r\n }",
"public function actionGetText($filePath)\n {\n $file = new FileDoc();\n $file->loadFile($filePath);\n $text = $file->getTextUtf8();\n echo $text;\n }",
"public function run()\n {\n $this->loadTextFile($this->text_file);\n }",
"public function parse($path)\n\t{\n\t\tlibxml_use_internal_errors(true);\n\n\t\t$xml = simplexml_load_file($path, null, LIBXML_NOERROR);\n\n\t\tif ($xml === false)\n\t\t{\n\t\t\t$errors = libxml_get_errors();\n\t\t\t$latestError = array_pop($errors);\n\t\t\t$error = array(\n\t\t\t\t'message' => $latestError->message,\n\t\t\t\t'type' => $latestError->level,\n\t\t\t\t'code' => $latestError->code,\n\t\t\t\t'file' => $latestError->file,\n\t\t\t\t'line' => $latestError->line,\n\t\t\t);\n\t\t\tthrow new ParseException($error);\n\t\t}\n\n\t\t$data = new stdClass;\n\t\tforeach ($xml->children() as $node)\n\t\t{\n\t\t\t$data->{$node['name']} = $this->getValueFromNode($node);\n\t\t}\n\t\t$data = json_decode(json_encode($data), true);\n\n\t\treturn $data;\n\t}",
"public function parse( $contents );",
"public function load(string $file): string;",
"public function readFile($path);",
"protected function load()\n {\n if ($this->contentLoaded) {\n return;\n }\n\n $content = file_get_contents($this->path);\n\n if (!$content) {\n $this->contentLoaded = true;\n return;\n }\n\n preg_match_all('/\\@([a-z]+)\\s([^\\r\\n\\@]+)/i', $content, $matches, PREG_SET_ORDER);\n\n foreach ($matches as $match) {\n $fullMatch = $match[0];\n $variable = $match[1];\n $value = $match[2];\n\n $content = str_replace($fullMatch, '', $content);\n $this->metadata[$variable] = $value;\n }\n\n $this->content = trim($content, \"\\r\\n\");\n $this->contentLoaded = true;\n }",
"public function processTemplateFromFileProcessesTemplateFromFile() {\n\t\t$this->subject->processTemplateFromFile(\n\t\t\t'EXT:oelib/Tests/Unit/Fixtures/oelib.html'\n\t\t);\n\n\t\t$this->assertSame(\n\t\t\t'Hello world!' . LF,\n\t\t\t$this->subject->render()\n\t\t);\n\t}",
"private function _get_translations_from_file () {\n\n\t\t$lang = file_exists(self::DIR_LANGS . $this->lang . '.php')\n\t\t\t\t\t? $this->lang : $this->_default_lang;\n\n\t\trequire self::DIR_LANGS . $lang . '.php';\n\n\t\treturn $t;\n\n\t}",
"public function read($path) {\n return file_get_contents($path);\n }",
"public function readFileTemplate(): string\n {\n $template = resource_path('templates/EnumModel.txt');\n\n if (!file_exists($template) || !is_readable($template)) {\n throw new Exception(sprintf('The path \"%s\" is not a file or not readable', $template));\n }\n $search = [\"/\", \"app\"];\n $replace = [\"\\\\\", \"App\"];\n $namespace = str_replace($search, $replace, $this->path);\n\n $values = [\n '$className' => $this->className,\n '$content' => $this->content,\n '$namespace' => $namespace\n ];\n\n return strtr(file_get_contents($template), $values);\n }",
"public function readFile() {\n\t\ttry {\n\t\t\tparent::readFile();\n\t\t} catch (LFException $e) {\n\t\t\tthrow $e;\n\t\t}\n\n\t\t// convert all language values from utf-8 to the original charset\n\t\tif (!typo3Lib::isTypo3BackendInUtf8Mode()) {\n\t\t\t$this->localLang = typo3Lib::utf8($this->localLang, FALSE, array('default'));\n\t\t}\n\t}",
"public function read($path)\n {\n return file_get_contents($path);\n }",
"public function parseFile(string $filename);",
"public function parseFile( $filename ) {\n if( $this->isInitialized == false ) throw new GPTParserException( \"GPT parser not initialized. Call init() first.\" );\n\n $lines = file( $filename, FILE_IGNORE_NEW_LINES );\n\n $this->context = GPTParserContext::get();\n $this->context->Filename = $filename;\n $this->context->Parser = $this;\n\n $this->lastWhitespace = 0;\n $this->scopes = array();\n\n $this->rootNodes = array();\n\n // Iterate over all lines\n foreach( $lines as $lineNumber => $line ) {\n $this->internalParse( $lineNumber, $line );\n }\n\n $result = \"\";\n\n // Render result\n foreach( $this->rootNodes as $rootNode ) {\n $result .= $rootNode->render( $this->PostProcessor );\n }\n\n return $result;\n }",
"private function _loadXML($filePath) {\n \tif (substr($this->localizationPath, -1) != DIRECTORY_SEPARATOR) {\n \t\t$this->localizationPath = $this->localizationPath.DIRECTORY_SEPARATOR;\n \t}\n\n \t$filePath = $this->localizationPath.$filePath;\n\n \t//\tPARSING...\n \t$doc = new DOMDocument();\n \t$doc->preserveWhiteSpace = false;\n \t$doc->formatOutput = true;\n\n \tif (!$doc->load(realpath($filePath))) {\n \t\tthrow new Exception('Can not load locale '.$filePath);\n \t}\n\n \treturn $doc;\n }"
]
| [
"0.57235503",
"0.5707733",
"0.56545484",
"0.55041873",
"0.54930955",
"0.5492181",
"0.5481962",
"0.5474074",
"0.5365802",
"0.5365802",
"0.5347656",
"0.53309923",
"0.5264904",
"0.52642643",
"0.52217174",
"0.5221573",
"0.5201459",
"0.5138567",
"0.5127056",
"0.5122626",
"0.5104767",
"0.5099675",
"0.5092993",
"0.5070643",
"0.5056553",
"0.50428843",
"0.5029494",
"0.5026043",
"0.5022079",
"0.5021656"
]
| 0.61673886 | 0 |
Recursion function to parse all array values through self::parseValue() | private static function parseArray($val)
{
$result = array();
$openBrackets = 0;
$openString = false;
$openCurlyBraces = 0;
$openLString = false;
$buffer = '';
$strLen = strlen($val);
for($i = 0; $i < $strLen; $i++)
{
if($val[$i] == '[' && !$openString && !$openLString)
{
$openBrackets++;
if($openBrackets == 1)
{
// Skip first and last brackets.
continue;
}
}
elseif($val[$i] == ']' && !$openString && !$openLString)
{
$openBrackets--;
if($openBrackets == 0)
{
// Allow terminating commas before the closing bracket
if(trim($buffer) != '')
{
$result[] = self::parseValue( trim($buffer) );
}
if (!self::checkDataType($result))
{
throw new Exception('Data types cannot be mixed in an array: ' . $buffer);
}
// Skip first and last brackets. We're finish.
return $result;
}
}
elseif($val[$i] == '"' && $val[$i - 1] != "\\" && !$openLString)
{
$openString = !$openString;
}
elseif($val[$i] == "'" && !$openString) {
$openLString = !$openLString;
}
elseif($val[$i] == "{" && !$openString && !$openLString) {
$openCurlyBraces++;
}
elseif($val[$i] == "}" && !$openString && !$openLString) {
$openCurlyBraces--;
}
if( ($val[$i] == ',' || $val[$i] == '}') && !$openString && !$openLString && $openBrackets == 1 && $openCurlyBraces == 0)
{
if ($val[$i] == '}') {
$buffer .= $val[$i];
}
$buffer = trim($buffer);
if (!empty($buffer)) {
$result[] = self::parseValue($buffer);
if (!self::checkDataType($result))
{
throw new Exception('Data types cannot be mixed in an array: ' . $buffer);
}
}
$buffer = '';
}
else
{
$buffer .= $val[$i];
}
}
// If we're here, something went wrong.
throw new Exception('Wrong array definition: ' . $val);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function parseValues($_values)\n\t{\n\t\t$use_ingroup = $this->field->parameters->get('use_ingroup', 0);\n\t\t$multiple = $use_ingroup || (int) $this->field->parameters->get('allow_multiple', 0);\n\n\t\t// Make sure we have an array of values\n\t\tif (!$_values)\n\t\t{\n\t\t\t$vals = array(array());\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$vals = !is_array($_values)\n\t\t\t\t? array($_values)\n\t\t\t\t: $_values;\n\t\t}\n\n\t\t// Compatibility with legacy storage, we no longer serialize all values to one, this way the field can be reversed and filtered\n\t\tif (count($vals) === 1 && is_string(reset($vals)))\n\t\t{\n\t\t\t$array = $this->unserialize_array(reset($vals), $force_array = false, $force_value = false);\n\t\t\t$vals = $array ?: $vals;\n\t\t}\n\n\t\t// Force multiple value format (array of arrays)\n\t\tif (!$multiple)\n\t\t{\n\t\t\tif (is_string(reset($vals)))\n\t\t\t{\n\t\t\t\t$vals = array($vals);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tforeach ($vals as & $v)\n\t\t\t{\n\t\t\t\tif (!is_array($v))\n\t\t\t\t{\n\t\t\t\t\t$v = strlen($v) ? array($v) : array();\n\t\t\t\t}\n\t\t\t}\n\t\t\tunset($v);\n\t\t}\n\n\t\t//echo '<div class=\"alert alert-info\"><h2>parseValues(): ' . $this->field->label . '</h2><pre>'; print_r($vals); echo '</pre></div>';\n\t\treturn $vals;\n\t}",
"public function values() {\n\t\t// Get arguments :\n\t\t$args = func_get_args();\n\t\t\n\t\t// Add values :\n\t\tif (is_array($args[0])) {\n\t\t\tif ( ! is_array(reset($args[0]))) {\n\t\t\t\t// Deal with normal case : ->values(array(val1, val2, ...), array(val1, val2, ...), ...)\n\t\t\t\tforeach($args as $values_array)\n\t\t\t\t\t$this->push(new \\Glue\\DB\\Fragment_Item_Values($values_array));\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// Array of arrays given, call this function recursively for each of them :\n\t\t\t\tforeach($args[0] as $arg)\n\t\t\t\t\t$this->values($arg);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t\t// List of values given, call this function recursively with the same values as an array :\n\t\t\t$this->values($args);\n\t\n\t\treturn $this;\n\t}",
"function parseValues($workOnlyOnDataArr=0)\t{\n\t\t//Blog Hack\n\t\t$evalValues=$this->conf['blogData']?$this->metafeeditlib->getBlogEvalValues($this->conf):$this->conf[$this->conf['cmdKey'].'.']['evalValues.'];\t\t\n\t\t//$parseValues=array_merge(is_array($this->conf['parseValues.'])?$this->conf['parseValues.']:array(),is_array($evalValues)?$evalValues:array());\n\t\tif(is_array($this->conf['parseValues.'])) {\n\t\t\t$parseValues=$this->conf['parseValues.'];\n\t\t\tif (is_array($evalValues)) {\n\t\t\t\t$arr=$parseValues;\n\t\t\t\tforeach ($evalValues as $key=>$val) {\n\t\t\t\t\tif ($arr[$key]) {\n\t\t\t\t\t\t$arr[$key]=implode(',',array_merge(t3lib_div::trimexplode(',',$parseValues[$key]),t3lib_div::trimexplode(',',$evalValues[$key])));\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$arr[$key]=$val;\n\t\t\t\t\t}\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t$parseValues=$arr;\n\t\t\t}\n\t\t}\n\t\telse $parseValues = $evalValues;\n\t\t\n\t\tif ($workOnlyOnDataArr) {\n\t\t\t$theParseValues=array();\n\t\t\tforeach ($this->dataArr as $field=>$val) {\n\t\t\t\tif ($theParseValues[$field]) $parseValues[]=$parseValues[$field];\n\t\t\t}\n\t\t\tunset ($parseValues);\n\t\t\t$parseValues=&$theParseValues;\n\t\t}\n\n\t\tif (is_array($parseValues))\t{\n\t\t\treset($parseValues);\n\t\t\t while(list($theField,$theValue)=each($parseValues))\t{\t\t\t \t\n\t\t\t\t$this->markerArray['###EVAL_ERROR_FIELD_'.$theField.'###']='';\n\t\t\t\t$this->markerArray['###CSS_ERROR_FIELD_'.$theField.'###']='';\n\t\t\t\t$this->markerArray['###EVAL_ERROR_FIELD_'.str_replace('.','_',$theField).'###']='';\n\t\t\t\t$this->markerArray['###CSS_ERROR_FIELD_'.str_replace('.','_',$theField).'###']='';\n\t\t\t\t$listOfCommands = t3lib_div::trimExplode(',',$theValue,1);\n\t\t\t\twhile(list(,$cmd)=each($listOfCommands))\t{\n\t\t\t\t\t$cmdParts = preg_split('/\\[|\\]/',$cmd);\t// Point is to enable parameters after each command enclosed in brackets [..]. These will be in position 1 in the array.\n\t\t\t\t\t$theCmd=trim($cmdParts[0]);\n\t\t\t\t\tswitch($theCmd)\t{\n\t\t\t\t\t\tcase 'int':\n\t\t\t\t\t\t\t$this->dataArr[$theField]=intval($this->dataArr[$theField]);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'lower':\n\t\t\t\t\t\tcase 'upper':\n\t\t\t\t\t\t\t$this->dataArr[$theField] = $this->cObj->caseshift($this->dataArr[$theField],$theCmd);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'upperfirst':\n\t\t\t\t\t\t\t$val = $this->cObj->caseshift($this->dataArr[$theField],'lower');\n\t\t\t\t\t\t\t$this->dataArr[$theField]=strtoupper(substr($val,0,1)).substr($val,1);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'nospace':\n\t\t\t\t\t\t\t$this->dataArr[$theField] = str_replace(' ', '', $this->dataArr[$theField]);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'alpha':\n\t\t\t\t\t\t\t$this->dataArr[$theField] = preg_replace('/[^a-zA-Z]/','',$this->dataArr[$theField]);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'num':\n\t\t\t\t\t\t\t$this->dataArr[$theField] = preg_replace('/[^0-9]/','',$this->dataArr[$theField]);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'alphanum':\n\t\t\t\t\t\t\t$this->dataArr[$theField] = preg_replace('/[^a-zA-Z0-9]/','',$this->dataArr[$theField]);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'alphanum_x':\n\t\t\t\t\t\t\t$this->dataArr[$theField] = preg_replace('/[^a-zA-Z0-9_-]/','',$this->dataArr[$theField]);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'trim':\n\t\t\t\t\t\t\t$this->dataArr[$theField] = trim($this->dataArr[$theField]);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'strip_tags':\n\t\t\t\t\t\t\t$this->dataArr[$theField] = strip_tags($this->dataArr[$theField]);\n\t\t\t\t\t\t break;\n\t\t\t\t\t\tcase 'noaccents':\n\t\t\t\t\t\t\t$this->dataArr[$theField] = removeaccents($this->dataArr[$theField]);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'invert':\n\t\t\t\t\t\t\t$this->dataArr[$theField]=$this->dataArr[$theField]?0:1;\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'random':\n\t\t\t\t\t\t\t$this->dataArr[$theField] = substr(md5(uniqid(microtime(),1)),0,intval($cmdParts[1]));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'files':\n\t\t\t\t\t\t\t$this->processFiles($cmdParts,$theField);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'setEmptyIfAbsent':\n\t\t\t\t\t\t\tif (!isset($this->dataArr[$theField]))\t{\n\t\t\t\t\t\t\t\t$this->dataArr[$theField]='';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'multiple':\n\t\t\t\t\t\t\tif (is_array($this->dataArr[$theField]))\t{\n\t\t\t\t\t\t\t\t$this->dataArr[$theField] = implode(',',$this->dataArr[$theField]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'checkArray':\n\t\t\t\t\t\t\tif (is_array($this->dataArr[$theField]))\t{\n\t\t\t\t\t\t\t\treset($this->dataArr[$theField]);\n\t\t\t\t\t\t\t\t$val = 0;\n\t\t\t\t\t\t\t\twhile(list($kk,$vv)=each($this->dataArr[$theField]))\t{\n\t\t\t\t\t\t\t\t\t$kk = t3lib_div::intInRange($kk,0);\n\t\t\t\t\t\t\t\t\tif ($kk<=30)\t{\n\t\t\t\t\t\t\t\t\t\tif ($vv)\t{\n\t\t\t\t\t\t\t\t\t\t\t$val|=pow(2,$kk);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t$this->dataArr[$theField] = $val;\n\t\t\t\t\t\t\t} else {$this->dataArr[$theField]=0;}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'uniqueHashInt':\n\t\t\t\t\t\t\t$otherFields = t3lib_div::trimExplode(';',$cmdParts[1],1);\n\t\t\t\t\t\t\t$hashArray=array();\n\t\t\t\t\t\t\twhile(list(,$fN)=each($otherFields))\t{\n\t\t\t\t\t\t\t\t$vv = $this->dataArr[$fN];\n\t\t\t\t\t\t\t\t$vv = preg_replace('/[[:space:]]/','',$vv);\n\t\t\t\t\t\t\t\t$vv = preg_replace('/[^[:alnum:]]/','',$vv);\n\t\t\t\t\t\t\t\t$vv = strtolower($vv);\n\t\t\t\t\t\t\t\t$hashArray[]=$vv;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t$this->dataArr[$theField]=hexdec(substr(md5(serialize($hashArray)),0,8));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t // Call to user parse function\n\t\t$this->conf['parentObj']=&$this;\n\t\tif ($this->conf['userFunc_afterParse']) {\n\t\t\tt3lib_div::callUserFunction($this->conf['userFunc_afterParse'],$this->conf,$this);\n\t\t}\n\t}",
"public function parseFromArray()\n {\n $this->value = $this->reader->next();\n }",
"public function ParseFromArray() {\n $this->value = $this->reader->next();\n $this->clean();\n }",
"function parse_incoming_recursively( &$data, $input=array(), $iteration = 0 )\n\t{\n\t\t// Crafty hacker could send something like &foo[][][][][][]....to kill Apache process\n\t\t// We should never have an input array deeper than 10..\n\t\t\n\t\tif( $iteration >= 10 )\n\t\t{\n\t\t\treturn $input;\n\t\t}\n\t\t\n\t\tif( count( $data ) )\n\t\t{\n\t\t\tforeach( $data as $k => $v )\n\t\t\t{\n\t\t\t\tif ( is_array( $v ) )\n\t\t\t\t{\n\t\t\t\t\t//$input = $this->parse_incoming_recursively( $data[ $k ], $input );\n\t\t\t\t\t$input[ $k ] = $this->parse_incoming_recursively( $data[ $k ], array(), $iteration+1 );\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\t\n\t\t\t\t\t$k = $this->parse_clean_key( $k );\n\t\t\t\t\t$v = $this->parse_clean_value( $v );\n\t\t\t\t\t\n\t\t\t\t\t$input[ $k ] = $v;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn $input;\n\t}",
"function printValues($arr) {\n global $count;\n global $values;\n global $keys;\n \n // Check input is an array\n if(!is_array($arr)){\n die(\"ERROR: Input is not an array\");\n }\n \n /*\n Loop through array, if value is itself an array recursively call the\n function else add the value found to the output items array,\n and increment counter by 1 for each value found\n */\n foreach($arr as $key => $value){\n if(is_array($value)){\n printValues($value);\n } else{\n $values[] = $value;\n $count++;\n $keys[] = $key;\n }\n }\n \n // Return total count and values found in array\n return array('total' => $count, 'keys' => $keys, 'values' => $values);\n }",
"abstract public function values(): array;",
"function recursive_array_check_blank($element_value)\n{\n\n global $set;\n\n if (!is_array($element_value)) {\n if (!empty($element_value)) {\n $set = 1;\n }\n } else {\n\n foreach ($element_value as $value) {\n if ($set) {\n break;\n }\n recursive_array_check_blank($value);\n }\n\n }\n\n}",
"function recursive_array_check_blank($element_value)\n{\n\n global $set;\n\n if (!is_array($element_value)) {\n if (!empty($element_value)) {\n $set = 1;\n }\n } else {\n\n foreach ($element_value as $value) {\n if ($set) {\n break;\n }\n recursive_array_check_blank($value);\n }\n\n }\n\n}",
"protected function fixValue(array $value)/*# : array */\n {\n $result = [];\n foreach ($value as $k => $v) {\n if (false !== strpos($k, $this->field_splitter)) {\n $res = &$this->searchTree($k, $result, true);\n $res = is_array($v) ? $this->fixValue($v) : $v;\n } else {\n $result[$k] = is_array($v) ? $this->fixValue($v) : $v;\n }\n }\n return $result;\n }",
"protected function recursiveArrayHandler($arrayText)\n {\n $matches = [];\n $arrayToBuild = [];\n if (preg_match_all(Patterns::$SPLIT_PATTERN_SHORTHANDSYNTAX_ARRAY_PARTS, $arrayText, $matches, PREG_SET_ORDER)) {\n foreach ($matches as $singleMatch) {\n $arrayKey = $this->unquoteString($singleMatch['Key']);\n if (!empty($singleMatch['VariableIdentifier'])) {\n $arrayToBuild[$arrayKey] = new ObjectAccessorNode($singleMatch['VariableIdentifier']);\n } elseif (array_key_exists('Number', $singleMatch) && (!empty($singleMatch['Number']) || $singleMatch['Number'] === '0')) {\n // Note: this method of casting picks \"int\" when value is a natural number and \"float\" if any decimals are found. See also NumericNode.\n $arrayToBuild[$arrayKey] = $singleMatch['Number'] + 0;\n } elseif ((array_key_exists('QuotedString', $singleMatch) && !empty($singleMatch['QuotedString']))) {\n $argumentString = $this->unquoteString($singleMatch['QuotedString']);\n $arrayToBuild[$arrayKey] = $this->buildArgumentObjectTree($argumentString);\n } elseif (array_key_exists('Subarray', $singleMatch) && !empty($singleMatch['Subarray'])) {\n $arrayToBuild[$arrayKey] = new ArrayNode($this->recursiveArrayHandler($singleMatch['Subarray']));\n }\n }\n }\n return $arrayToBuild;\n }",
"protected function parseValues()\n {\n\n $this->setValues([]);\n\n $matches = [];\n\n preg_match_all(\"/\\<(.+?)\\>/\", $this->getDomainRegex() . '/' . $this->getRegex(), $matches);\n\n if(!empty($matches[1])){\n foreach($matches[1] as $value){\n $this->values[$value] = null;\n }\n }\n }",
"protected function _parseNestedValues($values)\n {\n foreach ($values as $key => $value) {\n if ($value === '1') {\n $value = true;\n }\n if ($value === '') {\n $value = false;\n }\n\n if (strpos($key, '.') !== false) {\n $values = Set::insert($values, $key, $value);\n //$this->_parseNestedValues($values);\n } else {\n $values[$key] = $value;\n }\n }\n return $values;\n }",
"protected function parse()\n {\n if($this->isRelationalKey()){\n $this->parsedValue = $this->makeRelationInstruction();\n } \n else {\n $this->parsedValue = $this->parseFlatValue($this->value);\n } \n }",
"function pg_array_parse($array, $asText = true) {\n $s = $array;\n if ($asText) {\n $s = str_replace(\"{\", \"array('\", $s);\n $s = str_replace(\"}\", \"')\", $s); \n $s = str_replace(\",\", \"','\", $s); \n } else {\n $s = str_replace(\"{\", \"array(\", $s);\n $s = str_replace(\"}\", \")\", $s);\n }\n\t$ss = \"\\$retval = $s;\";\n eval($ss);\n\treturn $retval;\n}",
"abstract public function parseInput(array $input): array;",
"private function process_array($value) {\n return is_array($value);\n }",
"abstract public static function getValues(): array;",
"public function parse_array($value)\n\t{\n\t\tif ($value==null)\n\t\t\treturn array();\n\t\t\n\t\tif (is_array($value))\n\t\t\treturn $value;\n\t\t\t\n\t\t$value=trim($value,'{}');\n\t\t$result=explode(',',$value);\n\t\t\n\t\tfor($i=0; $i<count($result); $i++)\n\t\t\tif ($result[$i]=='NULL')\n\t\t\t\t$result[$i]=null;\n\t\t\t\t\n\t\treturn $result;\n\t}",
"function get_values($arr)\n{\n $values = [];\n foreach ($arr as $item) {\n if (is_array($item)) {\n $values = array_merge($values, get_values($item));\n } else {\n $values[] = $item;\n }\n }\n return $values;\n}",
"private function parseVars($vals, $tab =\"\")//optional recursive values for output\n {\n $rval = \"\";\n foreach($vals as $key => $val)\n {\n if( $this->cleanData($key, $val))\n {\n if(is_object($val))\n {\n $rval = $rval.$tab.\"Object: \".$key.\" of type: \".get_class($val).\"\\n\";\n $rval = $rval.$tab.\"{\\n\";\n $newAry = get_object_vars($val);\n $rval = $rval.$this->parseVars($newAry, $tab.\" \");\n $rval = $rval.$tab.\"}\\n\";\n }\n elseif(is_array($val))\n {\n $rval = $rval.$tab.\"Array: \".$key.\"\\n\";\n $rval = $rval.$tab.\"{\\n\";\n $rval = $rval.$this->parseVars($val, $tab.\" \");\n $rval = $rval.$tab.\"}\\n\";\n }\n else\n {\n if($val != \"\")\n $rval= $rval.$tab.$key.\" = \".$val.\"\\n\";\n else\n $rval= $rval.$tab.$key.\" = NULL\\n\";\n }\n }\n }\n return $rval;\n }",
"function sanitizeArray($data = array())\r\n{\r\n foreach ($data as $k => $v) {\r\n if (!is_array($v) && !is_object($v)) { // deep enough to only be values? sanitize them now.\r\n $data[$k] = sanitizeValue($v);\r\n }\r\n if (is_array($v)) { // go deeper\r\n $data[$k] = sanitizeArray($v);\r\n }\r\n }\r\n return $data;\r\n}",
"public function prepare_marc_values($value_arr, $subfields, $delimiter = ' ') {\n\n // Repeatable values can be returned as an array or a serialized value\n foreach ($subfields as $subfield) {\n if (is_array($value_arr[$subfield])) {\n\n foreach ($value_arr[$subfield] as $subkey => $subvalue) {\n\n if (is_array($subvalue)) {\n foreach ($subvalue as $sub_subvalue) {\n if ($i[$subkey]) { $pad[$subkey] = $delimiter; }\n $sv_tmp = trim($sub_subvalue);\n $matches = array();\n preg_match_all('/\\{u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]\\}/', $sv_tmp, $matches);\n foreach ($matches[0] as $match_string) {\n $code = hexdec($match_string);\n $character = html_entity_decode(\"&#$code;\", ENT_NOQUOTES, 'UTF-8');\n $sv_tmp = str_replace($match_string, $character, $sv_tmp);\n }\n if (trim($sub_subvalue)) { $marc_values[$subkey] .= $pad[$subkey] . $sv_tmp; }\n $i[$subkey] = 1;\n }\n } else {\n if ($i[$subkey]) { $pad[$subkey] = $delimiter; }\n\n // Process unicode for diacritics\n $sv_tmp = trim($subvalue);\n $matches = array();\n preg_match_all('/\\{u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]\\}/', $sv_tmp, $matches);\n foreach ($matches[0] as $match_string) {\n $code = hexdec($match_string);\n $character = html_entity_decode(\"&#$code;\", ENT_NOQUOTES, 'UTF-8');\n $sv_tmp = str_replace($match_string, $character, $sv_tmp);\n }\n\n if (trim($subvalue)) { $marc_values[$subkey] .= $pad[$subkey] . $sv_tmp; }\n $i[$subkey] = 1;\n }\n }\n }\n }\n\n if (is_array($marc_values)) {\n foreach ($marc_values as $mv) {\n $result[] = $mv;\n }\n }\n return $result;\n }",
"protected function _filterValueRecursive(&$value)\n {\n if (is_array($value)) {\n array_walk($value, array($this, '_filterValueRecursive'));\n } else {\n $this->_filterValue($value);\n }\n }",
"public function values() : array;",
"public function parseValue();",
"public function transfArray($valuepost) {\n\t\t$total = 0;\n\t\tforeach ( $valuepost as $value ) {\n\t\t\t$arr [$total] = $this->validStringForm ( $value );\n\t\t\t$total ++;\n\t\t}\n\t\treturn $arr;\n\t}",
"abstract public function parse($value);",
"protected function _decodeArray()\n {\n $result = array();\n $starttok = $tok = $this->_getNextToken(); // Move past the '['\n $index = 0;\n\n while ($tok && $tok != self::RBRACKET) {\n $result[$index++] = $this->_decodeValue();\n\n $tok = $this->_token;\n\n if ($tok == self::RBRACKET || !$tok) {\n break;\n }\n\n if ($tok != self::COMMA) {\n throw new Rx_Json_Exception('Missing \",\" in array encoding: ' . $this->_getProblemContext());\n }\n\n $tok = $this->_getNextToken();\n }\n\n $this->_getNextToken();\n return ($result);\n }"
]
| [
"0.6160349",
"0.6029965",
"0.59977025",
"0.5938872",
"0.59384584",
"0.5835887",
"0.5822228",
"0.5759705",
"0.57368875",
"0.57368875",
"0.5660413",
"0.5632466",
"0.559076",
"0.55403626",
"0.5529888",
"0.5440726",
"0.54395217",
"0.5429909",
"0.54120326",
"0.54034454",
"0.54012436",
"0.54011595",
"0.53764224",
"0.5366908",
"0.53484946",
"0.53054625",
"0.5295648",
"0.52944803",
"0.5291544",
"0.5281549"
]
| 0.6301702 | 0 |
Function that checks the data type of the first and last elements of an array, and returns false if they don't match | private static function checkDataType($array)
{
if(count($array) <= 1)
{
return true;
}
$last = count($array) - 1;
$type = self::getCustomDataType($array[$last]);
if ($type != self::getCustomDataType($array[0]))
{
return false;
}
else
{
return true;
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"private function strictTypeCheckForArrayElements(array $arr)\n {\n $firstType = null;\n\n foreach ($arr as $item) {\n if ($firstType == null) {\n $firstType = $this->detectType($item);\n } else {\n if ($firstType != $this->detectType($item)) {\n return false;\n }\n }\n }\n\n return true;\n }",
"public static function arrayOfArray( $array )\n {\n $arr = array_shift( $array );\n // Checks to see if first item of the array is an array.\n if( is_array( $arr ) )\n {\n // First item is we assume the rest are.\n return true;\n }\n else\n {\n // First item isn't, we assume the rest are not.\n return false;\n }\n }",
"function rest_is_array($maybe_array)\n {\n }",
"function wpsl_is_multi_array( $array ) {\n\n foreach ( $array as $value ) {\n if ( is_array( $value ) ) return true;\n }\n\n return false;\n}",
"protected function is_single($data){\n foreach ($data as $value){\n if (is_array($value)){\n return false;\n }\n return true;\n }\n }",
"private function validateArrayElement($element, $type) {\n\n return gettype($element) == $type ? true : false;\n\n }",
"function acf_is_array($array)\n{\n}",
"public function validDataTypes();",
"function acf_is_sequential_array($array)\n{\n}",
"function is_numeric_array(iterable $array): bool\n{\n foreach ($array as $key => $_) {\n if (!is_integer($key)) {\n return false;\n }\n }\n\n return true;\n}",
"function isSpecialArray($arr)\n{\n for ($i = 0; $i < count($arr); $i++) {\n if ($i % 2 == 0) {\n if ($arr[$i] % 2 != 0) {\n return false;\n }\n } else {\n if ($arr[$i] % 2 == 0) {\n return false;\n }\n }\n }\n return true;\n}",
"public function testIsArray() {\n\t\t$array = array('one' => 1, 'two' => 2);\n\t\t$result = _::isArray($array);\n\t\t$this->assertTrue($result);\n\n\t\t// test that an object is not an array\n\t\t$object = (object)$array;\n\t\t$result = _::isArray($object);\n\t\t$this->assertFalse($result);\n\t}",
"function array_is_multi(array $array)\n {\n return (count($array) !== count($array, true));\n }",
"function wp_is_numeric_array($data)\n {\n }",
"private function process_array($value) {\n return is_array($value);\n }",
"public static function isArraySequential(array $array) {\n\t\treturn (array_keys($array) === range(0, count($array) - 1));\n\t}",
"function array_is_list(array $arr): bool\n {\n if ($arr === []) {\n return true;\n }\n return array_keys($arr) === range(0, count($arr) - 1);\n }",
"private function _isArray($value) {\n return is_array($value) && array_keys($value) === range(0, sizeof($value) - 1);\n }",
"protected function validateArray($value){\n\t\treturn is_array($value);\n\t}",
"function isNumber($tableauPost) {\n unset($tableauPost['type']);\n $tableau = array();\n foreach ($tableauPost as $key => $value) {\n if (is_numeric($value)) { //is_numeric\n $tableau[] = $value;\n }\n }\n if (count($tableauPost) != count($tableau)) {\n return false;\n }\n else {\n return true;\n }\n}",
"function isValid($array){\n return $array['format_valid'];\n }",
"public function is_valid_vb_spec($data_array) {\n\n // Check that there are at least two rows.\n if ( count($data_array) < 2 ) {\n $this->notifier->add('There must be at least two rows in the '\n . 'uploaded dataset.', 'error');\n return false;\n }\n\n // Split the dataset into the header row and the rest of the sheet\n $header = $data_array[0]; // Just the first row\n $data_array = array_slice($data_array, 1); // Everything but the first row\n\n // Count the number of timepoint columns and check that there is\n // at least one.\n $num_timepoint_cols = count(self::ordered_columns_of_type($header, 0));\n if ($num_timepoint_cols < 1) {\n $this->notifier->add(esc_html('There must be at least one timepoint column. '\n . 'None were found. Note that syntax for timepoint column '\n . 'headers is strict: the fieldname must be machine-readable '\n . 'as a date. Try formats like \"2012\" or \"2012-08\" or \"3Q 2008\".'),\n 'error', 108);\n return false;\n }\n\n // Count the number of level columns and check that there is\n // at least one.\n $num_level_cols = count(self::ordered_columns_of_type($header, 1));\n if ($num_level_cols < 1) {\n $this->notifier->add(esc_html('There must be at least one LEVEL column. '\n . 'None were found. Note that syntax for LEVEL column '\n . 'headers is strict: the fieldname must be of the form '\n . 'LEVEL<N>, where <N> is an integer.'),\n 'error', 109);\n return false;\n }\n\n return true;\n }",
"public static function arrayIsList(array $array): bool\n\t{\n\t\t$expectedKey = 0;\n\t\tforeach ($array as $i => $value) {\n\t\t\tif ($i !== $expectedKey) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t$expectedKey++;\n\t\t}\n\n\t\treturn true;\n\t}",
"protected function isList($array)\n {\n return array_keys($array) === range(0, count($array) - 1);\n }",
"protected function isValidArray($array)\n {\n return (!is_null($array) && is_array($array) && count($array) > 0);\n }",
"private function array_validator(array $data)\n {\n if (!array_key_exists(0, $data))\n {\n $this->is_valid = false;\n return false;\n }\n\n if ($data[0] === false)\n {\n $this->is_empty = true;\n return false;\n }\n\n if (!is_array($data[0]))\n {\n // 1 dimensional data -- diverge from typical here to\n // function for 1 dimensional data?\n }\n\n $this->columns = $this->set_columns(array_keys($data[0]));\n \n if (empty($this->columns))\n {\n $this->is_empty = false;\n return false;\n }\n\n $this->set_number_of_columns(count($this->columns));\n $number_of_rows = 0;\n\n foreach ($data as $row)\n {\n ++$number_of_rows;\n if (count(array_keys($row)) > $this->number_of_columns)\n {\n // invalid data\n // data must have same number of columns throughout.\n // although, there is a desgin decision here: it is possible\n // that this ought to be considered valid data, and a filling\n // of the data could be performed... *thinking on that*\n }\n \n foreach ($this->columns as $key)\n {\n if (!array_key_exists($key, $row))\n {\n // invalid data? or possibly same decison as above\n // and fill the data...\n }\n }\n }\n\n $this->set_number_of_rows($number_of_rows);\n\n // valid array. from here, either pass $data to a building function\n // or simply say $this->data = $data. unsure of design yet.\n }",
"function hasArray($arr) {\r\n\tforeach ($arr as $value) {\r\n\t\tif(is_array($value))\r\n\t\t\treturn true;\r\n\t}\r\n\treturn false;\r\n}",
"public static function end($array)\n {\n $count = count($array);\n $count = $count > 0 ? $count - 1 : 0;\n $newArr = array_slice($array, $count, 1);\n\n return !empty($newArr[0]) ? $newArr[0] : false;\n }",
"public function test_array_returns_true_when_not_optional_and_input_array() {\n\t\t$optional = false;\n\n\t\t$result = self::$validator->validate( array('test','test2'), $optional );\n\t\t$this->assertTrue( $result );\n\t}",
"protected function _check($data)\n {\n if ($this->_count != 0) {\n $this->_type($data);\n } elseif (is_array($data)) {\n $this->_type($data);\n }\n }"
]
| [
"0.6298559",
"0.615921",
"0.5957354",
"0.59457254",
"0.58980423",
"0.5851669",
"0.5833901",
"0.58093876",
"0.58070546",
"0.57576126",
"0.5728989",
"0.5707374",
"0.57060564",
"0.5696079",
"0.5689695",
"0.5674041",
"0.5648677",
"0.5629497",
"0.558549",
"0.55695766",
"0.5546822",
"0.5543256",
"0.5540864",
"0.55231136",
"0.5520908",
"0.5499663",
"0.5494497",
"0.5493237",
"0.5483982",
"0.5455354"
]
| 0.78253275 | 0 |
Return whether the given value is a valid ISODate | public static function isISODate($val)
{
if(!is_string($val)) {
return false;
}
// Use DateTime support to check for valid dates.
try
{
$date = new DateTime($val);
}
catch(Exception $e)
{
return false;
}
return true;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function run($value)\n {\n if ($value instanceof Date) {\n return true;\n }\n if (!is_string($value)) {\n return false;\n }\n if (preg_match(Date::ISO8601_REGEX, $value)) {\n return true;\n }\n\n return false;\n }",
"private function check_date($value) : bool\n {\n // 'YYYY-MM-DDThh:mm:ss'\n // 'YYYY-MM-DD hh:mm:ss.u'\n // 'YYYY-MM-DD hh:mm:ss'\n // 'YYYY-MM-DD'\n // 'YYYYMMDD'\n\n if (!is_string($value))\n return false;\n\n // TODO: the \\DateTime::createFromFormat() can't handle certain\n // types of date time formats allowed by the standard (i.e, partial\n // times given by \".ttt\" in the following: YYYY-MM-DDThh:mm:ss.tttZ)\n $dt = \\DateTime::createFromFormat(\\DateTime::ISO8601, $value);\n if ($dt !== false)\n return true;\n\n $dt = \\DateTime::createFromFormat('Y-m-d H:i:s.u', $value);\n if ($dt !== false)\n return true;\n\n $dt = \\DateTime::createFromFormat('Y-m-d H:i:s', $value);\n if ($dt !== false)\n return true;\n\n $dt = \\DateTime::createFromFormat('Y-m-d', $value);\n if ($dt !== false)\n return true;\n\n $dt = \\DateTime::createFromFormat('Ymd', $value);\n if ($dt !== false)\n return true;\n\n return false;\n }",
"public function validateDateTimeISO($data)\n {\n if($data =='now' || (strlen($data)>=23)) {\n try {\n $value_time = new DateTime($data);\n return true;\n } catch (Exception $e) {\n $this->errorFields[] = [$e.$this->errorMsg];\n // Is not a valida Date\n }\n }\n return false;\n }",
"function isValidISODate ($var) {\n //Returns error message for an invalid date\n\n //Check for unsafe characters\n $msg = isSantizeString($var);\n if ($msg != \"\") {\n return $msg;\n }\n // Format yyyy-mm-dd or yy-mm-dd\n $tmpDate = explode(\"-\",$var);\n //if the date can't be split into 3 parts, then a \"-\" was missing\n if (count($tmpDate) != 3) {\n return \"Invalid Date\"; \n }\n\n // isValidInt does not validate numbers with leading zeros. Strip off the leading zeros.\n $tmpDate[0] = ltrim($tmpDate[0], \"0\"); \n $tmpDate[1] = ltrim($tmpDate[1], \"0\"); \n $tmpDate[2] = ltrim($tmpDate[2], \"0\"); \n\n //Make sure all of the parts are valid numbers\n if (isValidInt($tmpDate[0]) == \"\" && isValidInt($tmpDate[1]) == \"\" && isValidInt($tmpDate[2]) == \"\") {\n\n // Use checkdate to validate the date\n if (checkdate($tmpDate[1], $tmpDate[2], $tmpDate[0])) { //checkdate(month, day, year)\n return \"\";\n } else {\n return \"Invalid Date\";\n }\n } else {\n return \"Invalid Date\";\n }\n}",
"function mycheck_isodate($str)\n{\n if (preg_match('/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/', $str)) {\n return TRUE;\n } else {\n return FALSE;\n }\n}",
"public static function validateDate($value)\n {\n if (preg_match('/^' .\n '(\\d{4})-(\\d{2})-(\\d{2})T' . // YYYY-MM-DDT ex: 2014-01-01T\n '(\\d{2}):(\\d{2}):(\\d{2})' . // HH-MM-SS ex: 17:00:00\n '(Z|((-|\\+)\\d{2}:\\d{2}))' . // Z or +01:00 or -01:00\n '$/', $value, $parts) == true) {\n try {\n new \\DateTime($value);\n return true;\n } catch (\\Exception $e) {\n return false;\n }\n } else {\n return false;\n }\n }",
"protected function validateDate($value) {\n if (preg_match(\"/^[0-9]{4}\\-[0-9]{2}\\-[0-9]{2}$/\", $value))\n return true;\n $this->setError(t(\"Invalid date (YYYY-MM-DD)\"));\n return false;\n }",
"protected function validateDate($value){\n\t\tif ($value instanceof DateTime) return true;\n\n\t\tif (strtotime($value) === false) return false;\n\n\t\t$date = date_parse($value);\n\n\t\treturn checkdate($date['month'], $date['day'], $date['year']);\n\t}",
"function iso_date($date) {\n if (preg_match('/^\\d\\d-\\d\\d\\-\\d\\d$/', $date)) $date = \"20\" . $date;\n if (!preg_match('/^\\d\\d\\d\\d-\\d\\d\\-\\d\\d$/', $date)) {\n if (strlen($date) == 6) $date = \"20\" . $date; //150923 => 20150923\n $date = substr_replace($date, '-', 6, 0);\n $date = substr_replace($date, '-', 4, 0);\n }\n return date(\"Y-m-d\", strtotime($date)) == $date ? $date : false;\n }",
"public function isValidDate() {\n\t\t// TODO\n\t\treturn TRUE;\n\t}",
"public function isdate($input){\n\n if (!preg_match(\"/^(0[1-9]|[1-2][0-9]|3[0-1])-(0[1-9]|1[0-2])-[0-9]{4}$/\",$input)){\n return false;\n }\n return true;\n }",
"public function validateDate($data)\n {\n\n if($data =='now' || (strlen($data)>=8 && strlen($data)<=10)) {\n try {\n $value_time = new DateTime($data);\n return true;\n } catch (Exception $e) {\n // Is not a valida Date\n }\n }\n return false;\n }",
"function validate_date($date) {\n $d = \\DateTime::createFromFormat('Y-m-d', $date);\n return $d && $d->format('Y-m-d') === $date;\n }",
"public function isDate();",
"function validate_date() {\n # Check the date is in ISO date format\n if (ereg('(19|20)[0-9]{2}[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])', $this->cur_val)) {\n # Remove any existing error message\n $this->error_message = \"\";\n\n # Return Value\n return $this->cur_val;\n }\n else {\n # Set Error Message\n $this->set_error(\"Validation for date ({$this->cur_val}) failed. This is type \" . gettype($this->cur_val));\n\n # Return Blank Date\n return \"0000-00-00\";\n }\n }",
"static public function IsDate( $value )\r\n\t{\r\n\t\t$date = date( 'Y', strtotime( $value ) );\r\n\t\tif( $date == \"1969\" || $date == '' )\r\n\t\t{\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}",
"function valid_date( $value = '', $format = 'Y-m-d H:i:s' )\n\t{\n\t\t$date = date_parse($value);\n\t\t$valid = ( $date['error_count'] == 0 && checkdate($date['month'], $date['day'], $date['year']) );\n\t\t\n\t\t/*\n\t\t// Create a date depending on PHP version\n\t\t$version = explode('.', phpversion());\n\t\tif (((int) $version[0] >= 5 && (int) $version[1] >= 2 && (int) $version[2] > 17))\n\t\t{\n\t\t\t$d = DateTime::createFromFormat($format, $date);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$d = new DateTime(date($format, strtotime($date)));\n\t\t}\n\t\t*/\n\t\t/*\n\t\t// Check valid date\n\t\t$format = 'Y-m-d H:i:s';\n\t\t$d = new DateTime(date($format, strtotime($date)));\n\t\t$valid_date = ( $d && $d->format($format) == $date );\n\t\t// or\n\t\t$date = date_parse($date);\n\t\t$valid_date = ( $date['error_count'] == 0 && checkdate($date['month'], $date['day'], $date['year']) );\n\t\tif ( ! $valid_date )\n\t\t{\n\t\t\t$valid = false;\n\t\t\t$return_message[] = 'The approved date is invalid.';\n\t\t}\n\t\t*/\n\t\t\n\t\tif ( ! $valid )\n\t\t{\n\t\t\t$this->set_message('valid_date', 'The %s field has in invalid date.');\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\treturn true;\n\t}",
"public static function validateDate($input)\r\n\t{\r\n\t\treturn preg_match('/\\d{2}-\\d{2}-\\d{4}/', $input) && (strlen($input) == 10);\r\n\t}",
"function validateDate($date)\n\t\t{\n\t\t\t$d = DateTime::createFromFormat('Y-m-d', $date);\n\t\t\treturn $d && $d->format('Y-m-d') == $date;\n\t\t}",
"function validateDate($date)\n\t\t{\n\t\t\t$d = DateTime::createFromFormat('Y-m-d', $date);\n\t\t\treturn $d && $d->format('Y-m-d') == $date;\n\t\t}",
"function validateDate($value) {\n\tif(ereg(\"^(([1-9])|(0[1-9])|(1[0-2]))\\/(([0-9])|([0-2][0-9])|(3[0-1]))\\/(([0-9][0-9])|([1-2][0,9][0-9][0-9]))$\", $value, $regs)) {\n\t\techo \"true\";\n\t} else {\n\t\techo \"false\";\n\t}\n}",
"function isDateValid($date) {\r\n //$uy = $uyear->format(\"Y\");\r\n //$sy = date(\"Y\");\r\n \r\n if(preg_match('^(((0[1-9]|[12]\\d|3[01])\\/(0[13578]|1[02])\\/((19|[2-9]\\d)\\d{2}))|((0[1-9]|[12]\\d|30)\\/(0[13456789]|1[012])\\/((19|[2-9]\\d)\\d{2}))|((0[1-9]|1\\d|2[0-8])\\/02\\/((19|[2-9]\\d)\\d{2}))|(29\\/02\\/((1[6-9]|[2-9]\\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))))$^', $date))\r\n return false;\r\n else\r\n return true;\r\n \r\n}",
"private static function validateDate(string $date): bool\n {\n $date = \\DateTime::createFromFormat('Y-m-d', $date);\n\n if (!$date) {\n return false;\n }\n\n return true;\n }",
"function isDateValid($dateInput){\n\t\t$d = DateTime::createFromFormat('Y-m-d', $dateInput);\n\t\treturn $d && $d->format('Y-m-d') === $dateInput;\n\t}",
"public function validate(): bool\n {\n return !is_object($this->value) && !is_array($this->value) && strtotime($this->value);\n }",
"function is_date ($date) {\n\t\n\t\treturn !(\n\t\t\tis_null($date) ||\n\t\t\t(gettype($date)!=='object') ||\n\t\t\t(get_class($date)!=='DateTime') ||\n\t\t\t($date->format('Y m j')==='-0001 11 30')\n\t\t);\n\t\n\t}",
"function is_date($date) {\n\tif (preg_match('/^((1|2)[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/', $date) || preg_match('/^(0[1-9]|[1-2][0-9]|3[0-1])-(0[1-9]|1[0-2])-((1|2)[0-9]{3})$/', $date)){\n\t\t$date = explode('-', $date);\n\t\tif (checkdate($date[1], $date[2], $date[0]) || checkdate($date[1], $date[0], $date[2])) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t} else {\n\t\treturn false;\n\t}\n}",
"function isValidDate($date) {\n $d = DateTime::createFromFormat('Y-m-d', $date);\n return $d && $d->format('Y-m-d') == $date;\n}",
"public function valid_date($str)\n\t{\n\t\treturn ( ! ereg(\"^[0-9]{1,2}/[0-9]{1,2}/[0-9]{4}$\", $str)) ? FALSE : TRUE;\n\t}",
"private function _is_date($date) {\n\t\tif (empty($date)) {\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\tif(!strpos($date,'-') && is_numeric($date)) {\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\tlist( $y, $m, $d ) = explode('-', $date );\n\n\t\tif ( is_numeric($m) && is_numeric($d) && is_numeric($y) && checkdate( $m, $d, $y ) ) {\n\t\t\treturn true;\n\t\t}\n\t\telse {\n\t\t\treturn false;\n\t\t}\n\t}"
]
| [
"0.74049497",
"0.7397895",
"0.7364437",
"0.717261",
"0.714827",
"0.7120575",
"0.7045961",
"0.7041389",
"0.68813264",
"0.6844565",
"0.68218493",
"0.68178296",
"0.6795506",
"0.6793685",
"0.678895",
"0.6775554",
"0.674608",
"0.6706285",
"0.6695407",
"0.6695407",
"0.6678262",
"0.66644955",
"0.6663715",
"0.66243607",
"0.65888053",
"0.6588395",
"0.6586069",
"0.65781945",
"0.6562437",
"0.6553318"
]
| 0.8178765 | 0 |
Combine the event name with the namespace of the package. | public function getNamespacedEventName($name)
{
$namespace = trim($this->namespacing(), '::');
$namespace = ! empty($namespace) ? $namespace . '.' : '';
return strtolower($namespace . $this->package . '.' . $name);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public static function getEventNamespace(): string\n {\n return Components::detectClassComponent(static::class)->slug . ':' . static::class;\n }",
"protected function getPackageName(PackageEvent $event)\n {\n return $this->getPackage($event)->getName();\n }",
"public static function get_event_string_name($suffix='') {\n $class = get_called_class();\n $class = substr($class, strlen(__NAMESPACE__) + 1);\n return 'event_'.$class.$suffix;\n }",
"abstract protected function get_event_name();",
"public function getTableName(string $namespace): string\n {\n return \"{$namespace}_events\";\n }",
"protected function buildEventName($event)\n {\n return join('.', $this->getTypes()).'.'.$event;\n }",
"public function getNamespaceName();",
"abstract protected function namespace(): string;",
"public function getNamespaceName() {\n return $this->forwardCallToReflectionSource( __FUNCTION__ );\n }",
"public function getQualifiedEvent($event)\n\t{\n\t\treturn 'rocketeer.'.$this->getSlug().'.'.$event;\n\t}",
"public function getQualifiedEvent($event)\n\t{\n\t\treturn 'rocketeer.'.$this->getSlug().'.'.$event;\n\t}",
"public function fromPackage($fqcn)\n {\n $name = str_replace(array('\\\\', '_'), '.', ltrim($fqcn, '\\\\'));\n\n // convert root namespace to default; default is a keyword and no namespace CAN be named as such\n if ($name === '') {\n $name = 'default';\n }\n\n return $name;\n }",
"public abstract function getApplicationNamespace();",
"public function getNamespaceName()\n\t{\n\t\t$pos = strrpos($this->name, '\\\\');\n\t\treturn false === $pos ? '' : substr($this->name, 0, $pos);\n\t}",
"public function fromPackage($fqcn)\n {\n $name = str_replace(['\\\\', '_'], '-', ltrim($fqcn, '\\\\'));\n\n // convert root namespace to default; default is a keyword and no namespace CAN be named as such\n if ($name === '') {\n $name = 'default';\n }\n\n return $name;\n }",
"public function getter_event_name()\n\t{\n\t\t$event = strtolower($this->qualified_name);\n\t\t\n\t\t$matches = [];\n\t\t\n\t\tif(preg_match(\"/numeric([0-9]{3})/\", $event, $matches))\n\t\t\t$event = $matches[1];\n\t\t\n\t\treturn $this->event_name = $event;\n\t}",
"private function formatEventName($event_name, $entity)\n {\n if (is_object($entity)) {\n $event_name = strtolower(str_replace(NAMESPACE_SEPARATOR, '.', get_class($entity)) . '.' . $event_name);\n// @TODO gvf\n// if ($entity instanceof \\Doctrine\\ORM\\Proxy\\Proxy) {\n// $prefix = str_replace(\n// NAMESPACE_SEPARATOR,\n// '.',\n// $this->application->getEntityManager()->getConfiguration()->getProxyNamespace()\n// );\n// $prefix .= '.'.$entity::MARKER.'.';\n//\n// $event_name = str_replace(strtolower($prefix), '', $event_name);\n// }\n } else {\n $event_name = strtolower(str_replace(NAMESPACE_SEPARATOR, '.', $entity) . '.' . $event_name);\n }\n\n $event_name = str_replace(array('backbee.', 'classcontent.', 'coredomain.'), array('', '', ''), $event_name);\n\n return $event_name;\n }",
"protected function getName()\n\t{\n\t\treturn 'event';\n\t}",
"public function name(): string\n {\n return 'event';\n }",
"public function name()\n {\n return 'event';\n }",
"public function makeEventName()\n {\n if (!$this->getName()) return '';\n $evt = strtolower('status.' . ObjectUtil::getBaseNamespace($this->getFkey()) . '.' . ObjectUtil::basename($this->getFkey()) . '.' . $this->getName());\n //$evt = strtolower('status.' . ObjectUtil::basename($this->getFkey()) . '.' . $this->getName());\n return $evt;\n }",
"public function get_namespace() : string\n {\n return $this->namespace;\n }",
"public function name()\n {\n return 'events';\n }",
"public function namespaceAlias() {}",
"protected function normalizeNS($package)\n {\n $package = ltrim($package, '.');\n\n if ($this->compiler->hasPackage($package)) {\n return $this->compiler->getPackage($package);\n }\n\n // Check the currently registered packages to find a root one\n $found = null;\n foreach ($this->compiler->getPackages() as $pkg=>$ns) {\n // Keep only the longest match\n if (0 === strpos($package, $pkg.'.') && strlen($found) < strlen($pkg)) {\n $found = $pkg;\n }\n }\n\n // If no matching package was found issue a warning and use the package name\n if (!$found) {\n $this->compiler->warning('Non tracked package name found \"' . $package . '\"');\n $namespace = str_replace('.', '\\\\', $package);\n } else {\n // Complete the namespace with the remaining package\n $namespace = $this->compiler->getPackage($found);\n $namespace .= substr($package, strlen($found));\n $namespace = str_replace('.', '\\\\', $namespace);\n // Set the newly found namespace in the registry\n $this->compiler->setPackage($package, $namespace);\n }\n\n return $namespace;\n }",
"public function getNamespace(): string\n {\n return (string) SocketIORouter::getNamespace(static::class);\n }",
"public function setNamespaceName($namespace);",
"function getNameSpace() { return $this->_namespace; }",
"protected function getEventName($event)\n {\n $name = (new ReflectionClass($event))->getShortName();\n\n if (substr($name, -5) == 'Event') {\n\n $name = substr($name, 0, -5);\n }\n\n return $name;\n }",
"function packageNameWithParent()\n {\n $parent = $this->getParent();\n return ucwords($parent) . $this->getPackageName();\n }"
]
| [
"0.7164336",
"0.636638",
"0.60878617",
"0.6079372",
"0.6065608",
"0.6060202",
"0.60278594",
"0.6019438",
"0.59989625",
"0.59707975",
"0.59707975",
"0.5948002",
"0.594338",
"0.59385395",
"0.5918697",
"0.5863427",
"0.5863066",
"0.58243495",
"0.5823832",
"0.5796731",
"0.5767998",
"0.5753899",
"0.5726582",
"0.5725767",
"0.56995445",
"0.5696942",
"0.56967914",
"0.56871474",
"0.5663159",
"0.5622249"
]
| 0.7438675 | 0 |
overwrite WP_List_Table::single_row to insert optional message row | public function single_row( $item ) {
echo '<tr>';
$this->single_row_columns( $item );
$this->displayMessageRow( $item );
echo '</tr>';
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function add_row($selector, $row = \\false, $post_id = \\false)\n{\n}",
"function add_sub_row($selector, $row = \\false, $post_id = \\false)\n{\n}",
"function single_row( $item ) {\r\n\t\tstatic $row_class = '';\r\n\r\n\t\t// WP 4.2+ uses \"striped\" CSS styles to implement \"alternate\"\r\n\t\tif ( version_compare( get_bloginfo( 'version' ), '4.2', '<' ) ) {\r\n\t\t\t$row_class = ( $row_class == '' ? ' class=\"alternate\"' : '' );\r\n\t\t}\r\n\r\n\t\techo '<tr id=\"attachment-' . $item->ID . '\"' . $row_class . '>';\r\n\t\techo parent::single_row_columns( $item );\r\n\t\techo '</tr>';\r\n\t}",
"function displayMessageRow( $item ){\n $listing_title = '';\n\n // show errors and warning on online and failed items\n if ( in_array( $item['status'], array( 'online', 'failed' ) ) ) {\n\n $history = maybe_unserialize( $item['history'] );\n $tips_errors = array();\n $tips_warnings = array();\n if ( is_array( $history ) ) {\n foreach ( $history['errors'] as $feed_error ) {\n $tips_errors[] = WPLA_FeedValidator::formatAmazonFeedError( $feed_error );\n }\n foreach ( $history['warnings'] as $feed_error ) {\n $tips_warnings[] = WPLA_FeedValidator::formatAmazonFeedError( $feed_error );\n }\n }\n if ( ! empty( $tips_errors ) ) {\n $listing_title .= '<!br><small style=\"color:darkred\">'.join('<br>',$tips_errors).'</small><br>';\n }\n if ( ! empty( $tips_warnings ) ) {\n $listing_title .= '<small><!br><a href=\"#\" onclick=\"jQuery(\\'#warnings_container_'.$item['id'].'\\').slideToggle();return false;\">» '.''.sizeof($tips_warnings).' warning(s)'.'</a></small><br>';\n $listing_title .= '<div id=\"warnings_container_'.$item['id'].'\" style=\"display:none\">';\n $listing_title .= '<small>'.join('<br>',$tips_warnings).'</small>';\n $listing_title .= '</div>';\n }\n\n }\n\n // show listing quality issues on online and changed items\n if ( in_array( $item['status'], array( 'online', 'changed', 'prepared' ) ) ) {\n\n $quality_info = maybe_unserialize( $item['quality_info'] );\n if ( is_array( $quality_info ) ) {\n\n $quality_warning_title = $quality_info['alert-type'];\n if ( $quality_warning_title == 'Missing' ) $quality_warning_title .= ' ' . $quality_info['field-name'];\n\n $error_msg = '<b>Warning: '.$quality_warning_title.'</b>';\n $error_msg .= '<br>'.$quality_info['explanation'];\n\n if ( ! empty( $quality_info['current-value'] ) ) {\n $error_msg .= '<br>'.$quality_info['field-name'].': '.$quality_info['current-value'].' ';\n }\n\n if ( ! empty( $quality_info['status'] ) ) {\n $error_msg .= '<br>Status: '.$quality_info['status'].' ('.$quality_info['alert-name'].')';\n }\n $error_msg = WPLA_FeedValidator::convert_links( $error_msg );\n\n $listing_title .= '<small style=\"color:darkred\">'.$error_msg.'</small><br>';\n }\n\n }\n\n if ( empty($listing_title) ) return;\n\n echo '</tr>';\n echo '<tr>';\n // echo '<td colspan=\"'.sizeof( $this->_column_headers[0] ).'\">';\n\n // echo '<td> </td>';\n // echo '<td class=\"wpla_auto_width_column\" colspan=\"7\">';\n // echo $listing_title;\n // echo '</td>';\n // echo '<td> </td>';\n\n // get hidden columns for current user - and adjust colspan attribute on message row\n $user = wp_get_current_user();\n $meta = get_user_meta( $user->ID );\n $hidden_cols = isset( $meta['managetoplevel_page_wplacolumnshidden'][0] ) ? maybe_unserialize( $meta['managetoplevel_page_wplacolumnshidden'][0] ) : array();\n $colspan = 10 - count( $hidden_cols );\n\n echo '<td> </td>';\n echo '<td colspan=\"'.$colspan.'\">';\n echo $listing_title;\n echo '</td>';\n echo '<td> </td>';\n\n }",
"function add_row()\n\t{\n\t\t$args = func_get_args();\n\t\t$this->rows[] = $this->_prep_args($args);\n\t}",
"function addRowToTable(&$table, $row) {\n\t\tglobal $TCA, $BACK_PATH;\n\t\t$uid = $row['uid'];\n\t\t$hidden = $row['hidden'];\n\n\t\tif ($row[$TCA[$this->tableName]['ctrl']['languageField']]==0) {\n\t\t\t$catnum = $this->categories[$row['category']] . sprintf ('%02d', $row['number']);\n\t\t} else {\n\t\t\t$catnum = '';\n\t\t}\n\t\t// Get language flag\n\t\tlist($imglang, $imgtrans) = $this->makeLocalizationPanel($this->tableName,$row);\n\n\t\t// If deleted show the delete icon instead of the delete link\n\t\tif ('DELETED!' == $row['t3ver_label']) {\n\t\t\t$deleteIcon = '<img'\n\t\t\t\t. t3lib_iconWorks::skinImg(\n\t\t\t\t\t$BACK_PATH,\n\t\t\t\t\t'gfx/i/shadow_delete.png',\n\t\t\t\t\t'width=\"16\" height=\"14\"'\n\t\t\t\t\t)\n\t\t\t\t. '>';\n\t\t} else {\n\t\t\t$deleteIcon = $this->getDeleteIcon($uid);\n\t\t}\n\t\t\n\t\t// Add the result row to the table array.\n\t\t$table[] = array(\n\t\t\tTAB . TAB . TAB . TAB . TAB\n\t\t\t\t. $catnum . LF,\n\t\t\tTAB . TAB . TAB . TAB . TAB\n\t\t\t\t. t3lib_div::fixed_lgd_cs(\n\t\t\t\t\t$row['name'],\n\t\t\t\t\t50\n\t\t\t\t) . LF,\n\t\t\tTAB . TAB . TAB . TAB . TAB\n\t\t\t\t. $imglang . LF,\n\t\t\tTAB . TAB . TAB . TAB . TAB\n\t\t\t\t. $imgtrans . LF,\n\t\t\tTAB . TAB . TAB . TAB . TAB\n\t\t\t\t. $row['timeslots'] . LF,\n\t\t\tTAB . TAB . TAB . TAB . TAB\n\t\t\t\t. $this->getEditIcon($uid) . LF\n\t\t\t\t. TAB . TAB . TAB . TAB . TAB\n\t\t\t\t. $deleteIcon . LF\n\t\t\t\t. TAB . TAB . TAB . TAB . TAB\n\t\t\t\t. $this->getHideUnhideIcon($uid,$hidden) . LF,\n\t\t);\n\t}",
"public function single_row($item)\n {\n }",
"public function single_row($item)\n {\n }",
"public function single_row($item)\n {\n }",
"function row($lebel, $content, $contentExists = false) {\n\t\tif ($contentExists == true) {\n\t\t\tif (!empty($contentExists)) {\n\t\t\t\techo \"<tr><td width=\\\"200\\\"><div align=\\\"right\\\">\" . $label . \":</div></td><td>\" . $content . \"</td></tr>\";\n\t\t\t}\n\t\t} else {\n\t\t\techo \"<tr><td width=\\\"200\\\"><div align=\\\"right\\\">\" . $label . \":</div></td><td>\" . $content . \"</td></tr>\";\n\t\t}\n\t}",
"public function single_row( $item ) {\n\t\t$status = $item->status;\n\n\t\techo '<tr id=\"request-' . esc_attr( $item->ID ) . '\" class=\"status-' . esc_attr( $status ) . '\">';\n\t\t$this->single_row_columns( $item );\n\t\techo '</tr>';\n\t}",
"public function single_row($item)\n {\n $class = '';\n if ($item->topic_contrib_status !== 'open') :\n $class = 'closed';\n elseif (!$this->db()->meta()->get($item->topic_id, 'approved', true)) :\n $class = 'unapproved';\n elseif ($this->db()->meta()->get($item->topic_id, 'approved', true) == -1) :\n $class = 'wait_approve';\n endif;\n ?>\n <tr class=\"<?php echo $class; ?>\">\n <?php\n $this->single_row_columns($item);\n ?>\n </tr>\n <?php\n }",
"public function action_insert_entry_message( int $row_id ) {\n\t\tif ( $row_id <= 0 ) {\n\t\t\tadd_settings_error( self::POST_ACTION_ID, 'insertion_failed', __( 'Entry insertion failed.', 'autowpdb-example-plugin' ) );\n\t\t\treturn;\n\t\t}\n\n\t\tadd_settings_error(\n\t\t\tself::POST_ACTION_ID,\n\t\t\t'insertion_success',\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s is a formatted number, dont use %d. */\n\t\t\t\t__( 'Entry %s successfully added.', 'autowpdb-example-plugin' ),\n\t\t\t\tnumber_format_i18n( $row_id )\n\t\t\t),\n\t\t\t'success'\n\t\t);\n\t}",
"public function single_row( $item )\n\t{\n\t\tstatic $row_class = '';\n\t\t$row_class = ( $row_class == '' ? 'alternate' : '' );\n\n\t\t$action = ( isset($item['data']['action']) ? $item['data']['action'] : 'no-action' );\n\t\t$type = ( isset($item['data']['type']) ? $item['data']['type'] : 'no-type' );\n\t\t\n\t\techo '<tr class=\"'.$action.' '.$type.' '.$row_class.'\">';\n\t\t$this->single_row_columns( $item );\n\t\techo '</tr>';\n\t}",
"public function single_row( $item ) {\n\t\tswitch_to_blog( $item->blog_id );\n\t\t$request = get_post( $item->post_id );\n\t\tparent::single_row( $request );\n\t\trestore_current_blog();\n\t}",
"public function addRow($text, $raw=null, $passed=null) {\n\t\t$default = array('numbers' => false, 'noformat' => false, 'theme' => 'a');\n\t\t$argus = merge_defaults($default, $passed);\n\t\t\n\t\tif ( $argus['noformat'] ) {\n\t\t\t$this->items[] = \"\\t\".$text;\n\t\t} else {\n\t\t\t$this->items[] = \"\\t<li data-theme=\\\"{$argus['theme']}\\\">\" . vsprintf($this->formatstring, $text) . (($this->options['actions'])?$this->do_actions($raw):\"\") .\"</li>\";\n\t\t}\n\t\t$this->currentrow++;\n\t}",
"function formatRow(){\n $this->hook('formatRow');\n }",
"function onMissingTranslation(&$row_to_translate, $language, $reference_table, $tableArray){\n\n //0:Original content\n\t\t//1:Placeholder\n\t\t//2:Original with info\n\t\t//3:Original with alt\n\n $noTranslationBehaviour = 2;\n\n $default_language =JComponentHelper::getParams('com_languages')->get('site','en-GB');\n if ($noTranslationBehaviour >= 1 && ($reference_table == 'content' || $reference_table == 'k2_items' ) && $default_language != $language) {\n\n $defaultText = '<div class=\"falang-missing\">' .JText::_($this->params->get('missing-text')). '</div>';\n\n if ($this->params->get('bootstrap-alert')) {\n $defaultText = '<div class=\"falang-missing alert '.$this->params->get('bootstrap-alert-style').' alert-dismissable\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">×</button>' .JText::_($this->params->get('missing-text')). '</div>';\n }\n\n if ($noTranslationBehaviour==3 && isset($row_to_translate->id)){\n $defaultText=\"{jfalternative}\".$row_to_translate->id.\"|content|$defaultText{/jfalternative}\";\n }\n\n\n $cache = JFactory::getCache();\n// $fieldInfo = $cache->call(\"Falang::contentElementFields\",$reference_table, $language);\n $fieldInfo = $cache->call(array(\"Falang\",\"contentElementFields\"),$reference_table, $language);\n\n $textFields = $fieldInfo[\"textFields\"];\n if( $textFields !== null ) {\n $defaultSet = false;\n foreach ($textFields as $field) {\n if( !$defaultSet && $fieldInfo[\"fieldTypes\"][$field]==\"htmltext\") {\n if ($noTranslationBehaviour==1)\t{\n $row_to_translate->$field = $defaultText;\n } else if ($noTranslationBehaviour>=2) {\n $cr=\"<br/>\";\n $row_to_translate->$field = $defaultText .$cr.(isset($row_to_translate->$field)?$row_to_translate->$field:\"\");\n }\n $defaultSet = true;\n } else {\n if ($noTranslationBehaviour==1)\t{\n $row_to_translate->$field = \"\";\n } else if ($noTranslationBehaviour>=2) {\n if ($fieldInfo[\"fieldTypes\"][$field]==\"htmltext\"){\n $cr=\"<br/>\";\n } else {\n $cr=\"\\n\";\n }\n $row_to_translate->$field = (isset($row_to_translate->$field)?$row_to_translate->$field:\"\");\n }\n }\n }\n }\n }\n }",
"function plugin_row() {\n\t\t$licence = $this->get_licence_key();\n\t\t$licence_response = $this->is_licence_expired();\n\t\t$licence_problem = isset( $licence_response['errors'] );\n\n\t\tif ( !isset( $GLOBALS['wpmdb_meta'][$this->plugin_slug]['version'] ) ) {\n\t\t\t$installed_version = '0';\n\t\t}\n\t\telse {\n\t\t\t$installed_version = $GLOBALS['wpmdb_meta'][$this->plugin_slug]['version'];\n\t\t}\n\n\t\t$latest_version = $this->get_latest_version( $this->plugin_slug );\n\n\t\t$new_version = '';\n\t\tif ( version_compare( $installed_version, $latest_version, '<' ) ) {\n\t\t\t$new_version = __( 'There is a new version of ' . $this->plugin_title . ' available.', 'wp-migrate-db-pro' );\n\t\t\t$new_version .= ' <a class=\"thickbox\" title=\"' . $this->plugin_title . '\" href=\"plugin-install.php?tab=plugin-information&plugin=' . rawurlencode( $this->plugin_slug ) . '&TB_iframe=true&width=640&height=808\">';\n\t\t\t$new_version .= sprintf( __( 'View version %s details', 'wp-migrate-db-pro' ), $latest_version ) . '</a>.';\n\t\t}\n\n\t\tif ( !$new_version && !empty( $licence ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif( empty( $licence ) ) {\n\t\t\t$settings_link = sprintf( '<a href=\"%s\">%s</a>', network_admin_url( $this->plugin_base ) . '#settings', __( 'Settings', 'wp-migrate-db-pro' ) );\n\t\t\tif ( $new_version ) {\n\t\t\t\t$message = 'To update, ';\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$message = 'To finish activating ' . $this->plugin_title . ', please ';\n\t\t\t}\n\n\t\t\t$message .= 'go to ' . $settings_link . ' and enter your licence key. \n\t\t\t\tIf you don\\'t have a licence key, you may \n\t\t\t\t<a href=\"http://deliciousbrains.com/wp-migrate-db-pro/pricing/\">purchase one</a>.';\n\t\t}\n\t\telseif ( $licence_problem ) {\n\t\t\t$message = array_shift( $licence_response['errors'] ) . ' <a href=\"#\" class=\"check-my-licence-again\">Check my license again</a>';\n\t\t}\n\t\telse {\n\t\t\treturn;\n\t\t}\n\t\t?>\n\n\t\t<tr class=\"plugin-update-tr wpmdbpro-custom\">\n\t\t\t<td colspan=\"3\" class=\"plugin-update\">\n\t\t\t\t<div class=\"update-message\"><span class=\"wpmdb-new-version-notice\"><?php echo $new_version; ?></span> <span class=\"wpmdb-licence-error-notice\"><?php echo $message; ?></span></div>\n\t\t\t</td>\n\t\t</tr>\n\n\t\t<?php if ( $new_version ) : // removes the built-in plugin update message ?>\n\t\t<script type=\"text/javascript\">\n\t\t(function($) {\n\t\t\tvar wpmdb_row = jQuery('#<?php echo $this->plugin_slug; ?>'),\n\t\t\t\tnext_row = wpmdb_row.next();\n\n\t\t\t// If there's a plugin update row - need to keep the original update row available so we can switch it out\n\t\t\t// if the user has a successful response from the 'check my license again' link\n\t\t\tif (next_row.hasClass('plugin-update-tr') && !next_row.hasClass('wpmdbpro-custom')) {\n\t\t\t\tvar original = next_row.clone();\n\t\t\t\toriginal.add\n\t\t\t\tnext_row.html(next_row.next().html()).addClass('wpmdbpro-custom-visible');\n\t\t\t\tnext_row.next().remove();\n\t\t\t\tnext_row.after(original);\n\t\t\t\toriginal.addClass('wpmdb-original-update-row');\n\t\t\t}\n\t\t})(jQuery);\n\t\t</script>\n\t\t<?php endif; ?>\n\n\t\t<?php\n\t}",
"function BeforeMoveNextList(&$data, &$row, &$record, &$pageObject)\n{\n\n\t\t//Row Color Start\nif($data[\"is_urgent\"]==\"1\")\n{\n$row[\"rowstyle\"]=\"style=\\\"background:#FFCCCC\\\"\";\n}\n\n//Row Color End\n\n// Place event code here.\n// Use \"Add Action\" button to add code snippets.\n;\t\t\n}",
"public function renderListRow($table, $row, $cc, $titleCol, $thumbsCol, $indent = 0)\n { \n if (!is_array($row)) {\n return '';\n } \n \n $this->fieldArray[] = '_CONTROL_';\n $this->fieldArray[] = '_CLIPBOARD_';\n $rowOutput = '';\n $id_orig = null;\n // If in search mode, make sure the preview will show the correct page\n if ((string)$this->searchString !== '') {\n $id_orig = $this->id;\n $this->id = $row['pid'];\n }\n \n $tagAttributes = [\n 'class' => ['t3js-entity'],\n 'data-table' => $table,\n 'title' => 'id=' . $row['uid'],\n ];\n \n // Add special classes for first and last row\n if ($cc == 1 && $indent == 0) {\n $tagAttributes['class'][] = 'firstcol';\n }\n if ($cc == $this->totalRowCount || $cc == $this->iLimit) {\n $tagAttributes['class'][] = 'lastcol';\n }\n // Overriding with versions background color if any:\n if (!empty($row['_CSSCLASS'])) {\n $tagAttributes['class'] = [$row['_CSSCLASS']];\n }\n // Incr. counter.\n $this->counter++;\n // The icon with link\n $toolTip = BackendUtility::getRecordToolTip($row, $table);\n\n \n\n $additionalStyle = $indent ? ' style=\"margin-left: ' . $indent . 'px;\"' : '';\n $iconImg = '<span ' . $toolTip . ' ' . $additionalStyle . '>'\n . $this->iconFactory->getIconForRecord($table, $row, Icon::SIZE_SMALL)->render()\n . '</span>'; \n $theIcon = $this->clickMenuEnabled ? BackendUtility::wrapClickMenuOnIcon($iconImg, $table, $row['uid']) : $iconImg;\n // Preparing and getting the data-array\n $theData = [];\n $localizationMarkerClass = '';\n foreach ($this->fieldArray as $fCol) {\n \n if ($fCol == $titleCol) {\n $recTitle = BackendUtility::getRecordTitle($table, $row, false, true);\n $warning = '';\n // If the record is edit-locked\tby another user, we will show a little warning sign:\n $lockInfo = BackendUtility::isRecordLocked($table, $row['uid']);\n if ($lockInfo) {\n $warning = '<span data-toggle=\"tooltip\" data-placement=\"right\" data-title=\"' . htmlspecialchars($lockInfo['msg']) . '\">'\n . $this->iconFactory->getIcon('status-warning-in-use', Icon::SIZE_SMALL)->render() . '</span>';\n }\n $theData[$fCol] = $theData['__label'] = $warning . $this->linkWrapItems($table, $row['uid'], $recTitle, $row);\n // Render thumbnails, if:\n // - a thumbnail column exists\n // - there is content in it\n // - the thumbnail column is visible for the current type\n $type = 0;\n if (isset($GLOBALS['TCA'][$table]['ctrl']['type'])) {\n $typeColumn = $GLOBALS['TCA'][$table]['ctrl']['type'];\n $type = $row[$typeColumn];\n }\n // If current type doesn't exist, set it to 0 (or to 1 for historical reasons,\n // if 0 doesn't exist)\n if (!isset($GLOBALS['TCA'][$table]['types'][$type])) {\n $type = isset($GLOBALS['TCA'][$table]['types'][0]) ? 0 : 1;\n }\n $visibleColumns = $GLOBALS['TCA'][$table]['types'][$type]['showitem'];\n \n if ($this->thumbs &&\n trim($row[$thumbsCol]) &&\n preg_match('/(^|(.*(;|,)?))' . $thumbsCol . '(((;|,).*)|$)/', $visibleColumns) === 1\n ) {\n $thumbCode = '<br />' . $this->thumbCode($row, $table, $thumbsCol);\n $theData[$fCol] .= $thumbCode;\n $theData['__label'] .= $thumbCode;\n }\n if (isset($GLOBALS['TCA'][$table]['ctrl']['languageField'])\n && $row[$GLOBALS['TCA'][$table]['ctrl']['languageField']] != 0\n && $row[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']] != 0\n ) {\n // It's a translated record with a language parent\n $localizationMarkerClass = ' localization';\n }\n } elseif ($fCol === 'pid') {\n $theData[$fCol] = $row[$fCol];\n } elseif ($fCol === '_PATH_') {\n $theData[$fCol] = $this->recPath($row['pid']);\n } elseif ($fCol === '_REF_') {\n $theData[$fCol] = $this->createReferenceHtml($table, $row['uid']);\n } elseif ($fCol === '_CONTROL_') {\n $theData[$fCol] = $this->makeControl($table, $row);\n } elseif ($fCol === '_CLIPBOARD_') {\n $theData[$fCol] = $this->makeClip($table, $row);\n } elseif ($fCol === '_LOCALIZATION_') {\n list($lC1, $lC2) = $this->makeLocalizationPanel($table, $row);\n $theData[$fCol] = $lC1;\n $theData[$fCol . 'b'] = '<div class=\"btn-group\">' . $lC2 . '</div>';\n } elseif ($fCol === '_LOCALIZATION_b') {\n // deliberately empty\n } else {\n $pageId = $table === 'pages' ? $row['uid'] : $row['pid'];\n $tmpProc = BackendUtility::getProcessedValueExtra($table, $fCol, $row[$fCol], 100, $row['uid'], true, $pageId);\n $theData[$fCol] = $this->linkUrlMail(htmlspecialchars($tmpProc), $row[$fCol]);\n if ($this->csvOutput) {\n $row[$fCol] = BackendUtility::getProcessedValueExtra($table, $fCol, $row[$fCol], 0, $row['uid']);\n }\n }\n }\n // Reset the ID if it was overwritten\n if ((string)$this->searchString !== '') {\n $this->id = $id_orig;\n }\n // Add row to CSV list:\n if ($this->csvOutput) {\n $this->addToCSV($row);\n }\n // Add classes to table cells\n $this->addElement_tdCssClass[$titleCol] = 'col-title col-responsive' . $localizationMarkerClass;\n $this->addElement_tdCssClass['__label'] = $this->addElement_tdCssClass[$titleCol];\n $this->addElement_tdCssClass['_CONTROL_'] = 'col-control';\n if ($this->getModule()->MOD_SETTINGS['clipBoard']) {\n $this->addElement_tdCssClass['_CLIPBOARD_'] = 'col-clipboard';\n }\n $this->addElement_tdCssClass['_PATH_'] = 'col-path';\n $this->addElement_tdCssClass['_LOCALIZATION_'] = 'col-localizationa';\n $this->addElement_tdCssClass['_LOCALIZATION_b'] = 'col-localizationb';\n // Create element in table cells:\n $theData['uid'] = $row['uid'];\n if (isset($GLOBALS['TCA'][$table]['ctrl']['languageField'])\n && isset($GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'])\n && $table !== 'pages_language_overlay'\n ) {\n $theData['_l10nparent_'] = $row[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']];\n }\n \n $tagAttributes = array_map(\n function ($attributeValue) {\n if (is_array($attributeValue)) {\n return implode(' ', $attributeValue);\n }\n return $attributeValue;\n },\n $tagAttributes\n );\n \n $rowOutput .= $this->addElement(1, $theIcon, $theData, GeneralUtility::implodeAttributes($tagAttributes, true));\n // Finally, return table row element:\n return $rowOutput;\n }",
"public function prepareRow($row) {\n // Set the Language.\n $lang = (preg_match(\"/eng/i\", $row->sourceid)) ? 'en' : 'fr';\n $row->language = $lang;\n $xmlobj = $row->xml;\n\n // Set the Path.\n if (!isset($xmlobj->external)) {\n $link_path = strip_tags($xmlobj->link_path->asXML());\n if ($link_path == 'group') {\n $row->link_path = '<group>';\n }\n elseif ($link_path == 'front') {\n $row->link_path = '<front>';\n }\n elseif ($link_path == 'nolink') {\n $row->link_path = '<nolink>';\n }\n elseif ($link_path == 'separator') {\n $row->link_path = '<separator>';\n }\n elseif ($link_path == 'user') {\n $row->link_path = 'user';\n }\n else {\n $path = drupal_lookup_path('source', $link_path, $lang);\n if (!empty($path)) {\n $row->link_path = $path;\n }\n else {\n $row->link_path = $link_path;\n }\n }\n }\n else {\n $row->link_path = strip_tags($xmlobj->link_path->asXML());\n $row->external = 1;\n }\n\n // Set the Options.\n $options = array();\n\n if (isset($xmlobj->attribute_title)) {\n $options += array(\n 'attributes' => array(\n 'title' => strip_tags($xmlobj->attribute_title->asXML()),\n ),\n );\n }\n else {\n $options += array(\n 'attributes' => array(\n 'title' => NULL,\n ),\n );\n }\n\n $row->options = $options;\n\n // Set the Parent Menu.\n if (isset($xmlobj->parent)) {\n $result = db_query('SELECT n.destid1\n FROM {migrate_map_wetkitmigratesitemenulinks} n WHERE n.sourceid1 = :sourceid', array(':sourceid' => strip_tags($xmlobj->parent->asXML())));\n foreach ($result as $result_row) {\n $row->plid = $result_row->destid1;\n }\n }\n }",
"public function addWishingIconAddFieldsSingle($row){\n // $img_id = $row['IMAGE_ID'];\n // $url = $this->imageModel->getImageUrlOrPlaceholder($img_id);\n // $row['TUTORIAL_IMAGE_URL'] = $url;\n //get teacher image url\n $student_data = $this->userModel->getUserData($row['NAME']);\n $student_pic_url = $student_data['PICTURE_URL'];\n $row['STUDENT_PICTURE_URL'] = $student_pic_url;\n //add the tutorial url\n //$row['WISHING_URL'] = base_url().'index.php/pages/tutorials/'.$row['WISH_ID']; \n return $row;\n }",
"public function addRaw($row) {\n\t\t$this->addRow($row, null, array('noformat' => true));\n\t}",
"function renderRow(& $data) \n {\n $title = $this->_highlightText($data['title']);\n $text = $this->_highlightText($data['text']);\n if ($data['persite'] != 0) {\n $row = str_replace('{title}', $title, $this->_rowTemplate);\n $row = str_replace('{text}', $text, $row);\n $row = str_replace('{url}', $data['url'], $row);\n $this->_html .= $row;\n $row = str_replace('{title}', \n $data['persite'].\" results\", \n $this->_rowDetailTemplate);\n $row = str_replace('{text}', $data['lastmod'], $row);\n $url = $_SERVER['PHP_SELF'].'?'.\n $this->_http_parameters['query'].'='.\n urlencode($this->_query).\n '&'.$this->_http_parameters['siteid'].'='.$data['siteid'];\n $row = str_replace('{url}', $url, $row);\n $this->_html .= $row;\n } else {\n $row = str_replace('{title}', $title, $this->_rowTemplate);\n $row = str_replace('{text}', $text, $row);\n $row = str_replace('{url}', $data['url'], $row);\n $this->_html .= $row;\n $row = str_replace('{title}', \"\", $this->_rowDetailTemplate);\n $row = str_replace('{text}', $data['lastmod'], $row);\n $row = str_replace('{url}', $data['url'], $row);\n $this->_html .= $row;\n }\n }",
"function makeTemplateRowsForMsg($allMessage) {\n global $user;\n\n foreach($allMessage as $message) {\n $row = new Template(__DIR__ . '/../view/message.tpl');\n\n $login = $message['senderId'] === $user->getId() ? 'You' : '<b>SUPPORT</b>';\n $class = '';\n\n if ($message['senderId'] !== $user->getId()) {\n $class = $message['isRead'] == 0 ? \" class='notRead'\" : '';\n }\n\n foreach ($message as $key => $value) {\n $row->add($key, $value);\n $row->add('login', $login);\n $row->add('class', $class);\n }\n $rowsTemplateMsg[] = $row;\n }\n $rowsMessages = Template::joinTemplates($rowsTemplateMsg);\n return $rowsMessages;\n}",
"private function AddRow($row) {\n $this->_table .= $this->Tpl2HTML($this->_rowtpl, array('RowContent' => $row));\n $this->_rown++;\n }",
"function okrs_add_table_row($row ,$aRow)\n{\n\n $CI = &get_instance();\n $CI->load->model('okr/okr_model');\n\n if($aRow['rel_type'] == 'okrs'){\n $okrs = $CI->okr_model->get_okrs($aRow['rel_id']);\n if ($okrs) {\n\n $str = '<span class=\"hide\"> - </span><a class=\"text-muted task-table-related\" data-toggle=\"tooltip\" title=\"' . _l('task_related_to') . '\" href=\"' . admin_url('okr/show_detail_node/' . $okrs->id) . '\">' . $okrs->your_target . '</a><br />';\n\n $row[2] = $row[2].$str;\n }\n\n }\n\n return $row;\n}",
"function the_row($format = \\false)\n{\n}",
"function AggregateListRow() {\n\n\t\t// Call Row Rendered event\n\t\t$this->Row_Rendered();\n\t}"
]
| [
"0.6295404",
"0.5945382",
"0.5917445",
"0.58279717",
"0.58221585",
"0.5644677",
"0.5599541",
"0.5599541",
"0.55975413",
"0.5569235",
"0.54667115",
"0.5455615",
"0.5451195",
"0.53785753",
"0.5373998",
"0.5261557",
"0.523028",
"0.5226587",
"0.52214026",
"0.5194971",
"0.51915973",
"0.5177648",
"0.51658344",
"0.5163481",
"0.5158241",
"0.51484495",
"0.5142909",
"0.5116805",
"0.51104176",
"0.50914085"
]
| 0.6246777 | 1 |
get profile object if possible from cache | function getProfile( $profile_id ) {
// update cache if required
if ( $this->last_profile_id != $profile_id ) {
$this->last_profile_object = new WPLA_AmazonProfile( $profile_id );
$this->last_profile_id = $profile_id;
}
return $this->last_profile_object;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getProfile(){\n $profile = $this->loadUser();\n return $profile;\n }",
"public function getProfile(){\n\t\treturn (new Profile($this->userName));\n\t}",
"function yz_profile() {\n\treturn Youzer_Profile::get_instance();\n}",
"public function fetch(): object\n {\n return $this->get('userProfile/v1/internal/users/' . $this->accountId . '/profiles');\n }",
"public function fetch(): object\n {\n return $this->get('userProfile/v1/internal/users/' . $this->accountId . '/profiles');\n }",
"public function getFromCache() {}",
"public function getProfile()\n {\n $profile = new \\login\\user\\Profile($this->db);\n if (array_key_exists('profile_id', $this->data)) {\n $profile->loadFromId($this->data['profile_id']);\n }\n return $profile;\n }",
"public function getProfile()\n {\n $res = $this->getEntity()->getProfile();\n\t\tif($res === null)\n\t\t{\n\t\t\t$this->setProfile(SDIS62_Model_DAO_Abstract::getInstance($this::$type_objet)->findByCriteria('Profile', array('primary' => $this::getPrimary())));\n\t\t\treturn $this->getEntity()->getProfile();\n\t\t}\n return $res;\n }",
"public function GetProfile()\n {\n return $this->profile;\n }",
"public function getProfile()\n {\n return $this->profile;\n }",
"public function getProfile()\n {\n return $this->profile;\n }",
"public function getProfile()\n {\n return $this->profile;\n }",
"public function getProfile() {\n\t\treturn $this->profile;\n\t}",
"public function profile() {\n return $this->profile;\n }",
"function current_user_profile($user_id = null)\n{\n if (is_null($user_id)) {\n $user_id = current_user_id();\n }\n\n// return \\base\\libs\\Redis::getUserProfile($user_id);\n}",
"abstract protected function getUserProfile();",
"public function getProfile()\r\n {\r\n return $this->getGuardUser() ? $this->getGuardUser()->getProfile() : null;\r\n }",
"public function get_profile($username = '')\n {\n\n\n if($username) $this->username = $username;\n\n $details = (Object) $this->user_details($this->username);\n\n $profile = $details->profile;\n\n $not_valid = !(!empty($profile) and FILE::isExist($profile,\"profile\"));\n\n if($not_valid) return;\n\n return $profile;\n\n\n }",
"protected function getResourceObject()\n {\n return new Profile($this->api);\n }",
"function loadCacheObject ()\n {\n if (!$this->cacheObjectLocked()) {\n $return = $this->cacheObjectContents($this->cacheObjectId);\n } else {\n $return = $this->loadLockedObject();\n }\n\n return $return;\n }",
"public function getUserProfile();",
"public function getUserProfile(){\n\n\t\treturn $this->cnuser->getUserProfile($this->request->header('Authorization'));\n\t}",
"public function getObjFromCache($key);",
"static function getProfile($profile_id)\n\t{\n\t\t$profile = ORM::for_table('PROFILE')->where('profile_id', $profile_id)->find_array();\n\n\t\treturn $profile;\n\t}",
"public function getProfile() {\n return $this->getGuardUser() ? $this->getGuardUser()->getProfile() : null;\n }",
"public function getProfile()\n {\n ProfileResource::withoutWrapping();\n MinistryResource::withoutWrapping();\n\n if (request()->has('complete') && request()->complete) {\n return new ProfileResource(auth()->user());\n } else {\n return new MinistryResource(auth()->user());\n }\n }",
"public function getCurrentProfile(){\n\n try{\n\n if( $this->hasToken() ){\n\n $account = $this->asObj( '/profile' );\n\n return $account->data;\n\n }\n else\n throw new ClientException(\"You need an authorization token, in order to request a profile.\");\n\n }\n catch (ResourceNotFoundException $e){\n //account does not exist\n return NULL;\n }\n\n }",
"function wpcom_vip_get_user_profile( $email_or_id ) {\n\n\tif ( is_numeric( $email_or_id ) ) {\n\t\t$user = get_user_by( 'id', $email_or_id );\n\t\tif ( ! $user )\n\t\t\treturn false;\n\n\t\t$email = $user->user_email;\n\t} elseif ( is_email( $email_or_id ) ) {\n\t\t$email = $email_or_id;\n\t} else {\n\t\t$user_login = sanitize_user( $email_or_id, true );\n\t\t$user = get_user_by( 'login', $user_login );\n\t\tif ( ! $user )\n\t\t\treturn;\n\n\t\t$email = $user->user_email;\n\t}\n\n\t$hashed_email = md5( strtolower( trim( $email ) ) );\n\t$profile_url = esc_url_raw( sprintf( '%s.gravatar.com/%s.php', ( is_ssl() ? 'https://secure' : 'http://www' ), $hashed_email ), array( 'http', 'https' ) );\n\n\t$profile = wpcom_vip_file_get_contents( $profile_url, 1, 900 );\n\tif ( $profile ) {\n\t\t$profile = unserialize( $profile );\n\n\t\tif ( is_array( $profile ) && ! empty( $profile['entry'] ) && is_array( $profile['entry'] ) ) {\n\t\t\t$profile = $profile['entry'][0];\n\t\t} else {\n\t\t\t$profile = false;\n\t\t}\n\t}\n\treturn $profile;\n}",
"public static function currentOrNew():Profile\n {\n return self::current() ?? new Profile;\n }",
"private function cacheFetch() {\n //$data = cache_get($this->id, 'cache');;\n $data = NULL;\n if ($data) {\n foreach ($this->properties as $prop) {\n if (isset($data->data[$prop]) && !empty($data->data[$prop])) {\n $this->$prop = $data->data[$prop];\n }\n }\n }\n }"
]
| [
"0.7011431",
"0.6802176",
"0.6677892",
"0.6673705",
"0.6673705",
"0.65596294",
"0.6528889",
"0.65261894",
"0.65084875",
"0.6487563",
"0.6487563",
"0.6487563",
"0.6469138",
"0.6325378",
"0.6320044",
"0.63184",
"0.6308052",
"0.629311",
"0.6285728",
"0.62789893",
"0.6217724",
"0.62035096",
"0.61776257",
"0.6173635",
"0.61510026",
"0.6147912",
"0.61120033",
"0.608856",
"0.6087554",
"0.60752475"
]
| 0.69050723 | 1 |
Fetch a doc that shouldn't exist yet | public function testFetchDoesntExist() {
self::$sag->get("foo");
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function testRetrieveReturnFalseIfNotFound()\n {\n if (! $this->_url) $this->markTestSkipped(\"Test requires a CouchDb server set up - see TestConfiguration.php\");\n $db = $this->_setupDb();\n\n $ret = $db->retrieve('nonexistingdoc');\n $this->assertFalse($ret);\n \n $this->_teardownDb();\n }",
"function testDontGettingAnyDocumentIfNoContain() {\n\t\t$result = $this->page->find('first', array('conditions' => array('Page.id' => 2), 'contain' => false));\n\t\t$this->assertTrue(empty($result['Document']));\n\t}",
"function testDontGettingAnyDocumentIfNegativeRecursive() {\n\t\t$result = $this->page->find('first', array('conditions' => array('Page.id' => 2), 'contain' => false));\n\t\t$this->assertTrue(empty($result['Document']));\n\t}",
"protected function _get()\n {\n $this->query('where', array(\n '_summary' => array( '$exists' => false ),\n ));\n\n // check if locale exists for this document\n if( $this->_locale )\n {\n $this->query('where', array(\n '_tapioca.locale' => $this->_locale\n ));\n }\n\n // if we define a document ref\n if( !is_null( $this->_ref ) )\n {\n $this->query('where', array('_ref' => $this->_ref));\n\n // get a specific revison\n if( isset( $this->_tapioca['revision'] ) )\n {\n $this->_unset('where', '_tapioca.status');\n $this->_unset('where', '_tapioca.locale');\n\n $this->query('where', array( '_tapioca.revision' => $this->_tapioca['revision'] ));\n }\n }\n\n // Always return ref\n if( count( $this->_select ) != 0 )\n {\n $tmp = array_merge( $this->_select, array('_ref') );\n $this->query('select', $tmp);\n }\n\n }",
"public function testNoResultingDocument()\n\t {\n\t\t$instance = $this->testForValidity(\"nodocument\");\n\t\t$instance->getExpandedDocument(array(), 0);\n\t }",
"public function testRetrieve()\n {\n if (! $this->_url) $this->markTestSkipped(\"Test requires a CouchDb server set up - see TestConfiguration.php\");\n $db = $this->_setupDb();\n \n $id = time();\n $value = rand(1, 1000);\n $db->create(array('mtime' => $value), $id);\n \n // Try to fetch the document\n $doc = $db->retrieve($id);\n $this->assertType('Sopha_Document', $doc);\n $this->assertEquals($value, $doc->mtime);\n \n $this->_teardownDb();\n }",
"function is_exists_doc($doc_id){\n\tif(!filter_var($doc_id, FILTER_VALIDATE_INT)){\n\t\n\treturn false;\n\t\n\t}\n\telse{\n\t\tglobal $prefix_doc;\n\t\t$query = borno_query(\"SELECT * FROM $prefix_doc WHERE id='$doc_id'\");\n\t\t\n\t\t$count = mysqli_num_rows($query);\n\t\tif($count==1){\n\t\t\treturn true;\n\t\t}\n\t\telse{\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\n\t}\n\n}",
"function getDocument($id) { /* {{{ */\n\t\t$hits = $this->index->find('D'.$id);\n\t\treturn $hits['hits'] ? $hits['hits'][0] : false;\n\t}",
"public function fetchOrException()\n {\n $record = $this->fetch();\n if ($record === null) {\n throw new NoRecordException;\n }\n return $record;\n }",
"public function testFindWithoutIteratingDoesNotThrow()\n {\n $result = self::$mainRepo->find();\n\n $this->assertInstanceOf(MongoDbCursor::class, $result);\n }",
"public function fetch() {\n\t\t$this->requireDatabase();\n\t\t$this->requireId();\n\n\t\tif (!empty($this->document->_rev)) {\n\t\t\t$this->options[\"rev\"] = $this->document->_rev;\n\t\t}\n\n\t\ttry {\n\t\t\t$request = new HttpRequest();\n\t\t\t$request->setUrl($this->databaseHost . \"/\" . rawurlencode($this->databaseName) . \"/\" . rawurlencode($this->document->_id) . self::encodeOptions($this->options));\n\t\t\t$request->send();\n\n\t\t\t$request->response = json_decode($request->response);\n\t\t} catch (Exception $exception) {\n\t\t\tthrow new DocumentException(\"HTTP request failed.\", DocumentException::HTTP_REQUEST_FAILED, $exception);\n\t\t}\n\n\t\tif ($request->status === 200) {\n\t\t\tforeach ($request->response as $fieldName => $fieldValue) {\n\t\t\t\t$this->document->$fieldName = $fieldValue;\n\t\t\t}\n\n\t\t\treturn $this;\n\t\t} elseif (isset($this->document->_rev)) {\n\t\t\tthrow new DocumentException(self::describeError($request->response, $this->document->_id, $this->document->_rev));\n\t\t} else {\n\t\t\tthrow new DocumentException(self::describeError($request->response, $this->document->_id));\n\t\t}\n\t}",
"public function existNoReturned(){\r\n $docs=ClientSDocs::where('projectclientservices_id',$this->id)->where('file_id',-1) ->get();\r\n if($docs!=null){\r\n foreach($docs as $doc)\r\n if($doc->notes_resend==\"\")\r\n return true;\r\n }\r\n return false;\r\n }",
"public function get_document(){retrun($id_local_document); }",
"abstract public function getDocument($id);",
"public function testUnfoundResult() {\n\t\t$this->_rowset->expects($this->once())\n\t\t\t\t->method('current')\n\t\t\t\t->will($this->returnValue(null));\n\n\t\t$this->_tableGateway->expects($this->once())\n\t\t\t\t->method('find')\n\t\t\t\t->with($this->equalTo(0))\n\t\t\t\t->will($this->returnValue($this->_rowset));\n\n\t\t$userResult = $this->object->find(0);\n\t\t$this->assertEquals(null, $userResult);\n\t}",
"function getDocument($id = 0, $fields = '*') {\r\n if ($id == 0) {\r\n return false;\r\n } else {\r\n $ids = array($id);\r\n $docs = $this->getDocuments($ids, '', '', $fields);\r\n\r\n return ($docs != false) ? $docs[0] : false;\r\n }\r\n }",
"public function get_document_single(Request $request, $doc_id)\n {\n try\n {\n // $user = array(\n // 'userid' => Auth::user()->id,\n // 'role' => Auth::user()->role\n // );\n // $user = (object) $user;\n // $post = new Resource_Post(); // You create a new resource Post instance\n // if (Gate::forUser($user)->denies('allow_admin', [$post,false])) { \n // $result = array('code'=>403, \"description\"=>\"Access denies\");\n // return response()->json($result, 403);\n // } \n // else {\n $query = DB::table('documents')\n ->leftJoin('users', 'documents.doc_user_id', '=', 'users.id')\n ->leftJoin('project_firm', 'users.company_name', '=', 'project_firm.f_id')\n ->select('documents.*', 'project_firm.*', \n 'users.username as user_name', 'users.email as user_email', 'users.first_name as user_firstname', 'users.last_name as user_lastname', 'users.company_name as user_company', 'users.phone_number as user_phonenumber', 'users.status as user_status', 'users.role as user_role')\n ->where('doc_id', '=', $doc_id)\n ->first();\n if(count($query) < 1)\n {\n $result = array('code'=>404, \"description\"=>\"No Records Found\");\n return response()->json($result, 404);\n }\n else\n {\n $result = array('data'=>$query,'code'=>200);\n return response()->json($result, 200);\n }\n // }\n }\n catch(Exception $e)\n {\n return response()->json(['error' => 'Something is wrong'], 500);\n }\n }",
"abstract protected function _doFetch($id);",
"public function testOffsetGetIndexNotExists()\n {\n $entity1 = $this->createMock(IdentifyTestEntity::class);\n $entity2 = $this->createMock(IdentifyTestEntity::class);\n $entity3 = $this->createMock(IdentifyTestEntity::class);\n\n $entities = [1 => $entity1, 3 => $entity2, 7 => $entity3];\n\n $this->setPrivateProperty($this->collection, 'entities', $entities);\n\n $result = $this->collection->offsetGet(2);\n }",
"public function fetch( $query_id=null );",
"function get_the_doc($doc_id,$data){\n\tif(filter_var($doc_id, FILTER_VALIDATE_INT)){\n\t\tglobal $prefix_doc;\n\t\t$query = borno_query(\"SELECT * FROM $prefix_doc WHERE id='$doc_id'\");\n\t\t$count = mysqli_num_rows($query);\n\t\tif($count==1){\n\t\t\t$row = mysqli_fetch_array($query);\n\t\t\treturn $row[$data];\n\t\t}\n\t\telse{\n\t\treturn false;\n\t\t}\n\t\n\t}\n\telse{\n\t\treturn false;\n\n\t}\n}",
"public function testDeleteMissingDocument()\n {\n if (! $this->_url) $this->markTestSkipped(\"Test requires a CouchDb server set up - see TestConfiguration.php\");\n $db = $this->_setupDb();\n \n // Delete missing document\n $ret = $db->delete('mydoc', 12345);\n $this->assertFalse($ret);\n \n $this->_teardownDb();\n }",
"public function get_document($record, $options = array()) {\n\n try {\n $cm = $this->get_cm($this->get_module_name(), $record->id, $record->course);\n $context = \\context_module::instance($cm->id);\n } catch (\\dml_missing_record_exception $ex) {\n // Notify it as we run here as admin, we should see everything.\n debugging('Error retrieving ' . $this->areaid . ' ' . $record->id . ' document, not all required data is available: ' .\n $ex->getMessage(), DEBUG_DEVELOPER);\n return false;\n } catch (\\dml_exception $ex) {\n // Notify it as we run here as admin, we should see everything.\n debugging('Error retrieving ' . $this->areaid . ' ' . $record->id . ' document: ' . $ex->getMessage(), DEBUG_DEVELOPER);\n return false;\n }\n\n // Prepare associative array with data from DB.\n $doc = \\core_search\\document_factory::instance($record->id, $this->componentname, $this->areaname);\n $doc->set('title', content_to_text($record->name, false));\n $doc->set('content', content_to_text($record->intro, $record->introformat));\n $doc->set('contextid', $context->id);\n $doc->set('courseid', $record->course);\n $doc->set('owneruserid', \\core_search\\manager::NO_OWNER_ID);\n $doc->set('modified', $record->{static::MODIFIED_FIELD_NAME});\n\n // Check if this document should be considered new.\n if (isset($options['lastindexedtime'])) {\n $createdfield = static::CREATED_FIELD_NAME;\n if (!empty($createdfield) && ($options['lastindexedtime'] < $record->{$createdfield})) {\n // If the document was created after the last index time, it must be new.\n $doc->set_is_new(true);\n }\n }\n\n return $doc;\n }",
"public function fetch(): ?IEntity;",
"public function test_getEcontentRecordFromOverDriveID_NotFound_returnFalse()\r\n\t{\r\n\t\t$threemId = \"aDummyOverDriveId\";\r\n\t\t$this->eContentRecordMock->expects($this->once())\r\n\t\t\t\t\t\t\t\t\t->method(\"find\")\r\n\t\t\t\t\t\t\t\t\t->with($this->equalTo(true))\r\n\t\t\t\t\t\t\t\t\t->will($this->returnValue(false));\r\n\t\r\n\t\t$actual = OverDriveUtils::getEcontentRecordFromOverDriveID($threemId, $this->eContentRecordMock);\r\n\t\t$this->assertFalse($actual);\r\n\t}",
"abstract public function fetch();",
"abstract public function fetch();",
"public function isNotFound();",
"public function test_get_non_existent() {\n $this->_cut->get(1);\n }",
"function getMissing() {\n\t\t$articleDao =& \\DAORegistry::getDAO('ArticleDAO');\n\t\t$sql = \"SELECT * FROM articles WHERE pages like '%#DFM'\";\n\t\t$blub = $articleDao->retrieve($sql);\n\t\t$result = new \\DAOResultFactory($blub, $this, '_dummy');\n\t\t$result = $result->toArray();\n\t\tforeach ($result as $record) {\n\t\t\t$this->getArticleGalleys($record['article_id']);\n\t\t}\n\t}"
]
| [
"0.71450967",
"0.6197753",
"0.5921436",
"0.5875945",
"0.5763566",
"0.5703948",
"0.56345326",
"0.55992043",
"0.5566758",
"0.5551524",
"0.55242133",
"0.5523264",
"0.5515667",
"0.54462475",
"0.5440051",
"0.53946185",
"0.5386363",
"0.53138953",
"0.53120726",
"0.5252978",
"0.5229018",
"0.5210255",
"0.5188012",
"0.5141214",
"0.5095178",
"0.5090346",
"0.5090346",
"0.50797975",
"0.50775737",
"0.5055579"
]
| 0.64492387 | 1 |
Fill members array from DB, call after save | function fillMembers()
{
// select members list
$trs = db_query("select , from `ugmembers` order by ,",$this->conn);
while($tdata = db_fetch_numarray($trs))
{
$this->members[] = array($tdata[1],$tdata[0]);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function loadMembers()\n {\n /*\n * we assume the members-array is always filled\n */\n if (!empty($this->members) && !($this->members[0] instanceof User)) {\n $response = Helper::get('group/'.$this->unique_id);\n if (isset($response->body['result']['members'])) {\n $this->setMembers($response->body['result']['members']);\n }\n }\n }",
"public function loadMembers() {\n if(!$this->id) return;\n\n $list = $this->getClient()->getDmMembers($this->id);\n\n if($list) $this->members = $list;\n }",
"public function populate();",
"abstract public function populate();",
"public function __reFill(){\n foreach ($this->data as $key=>$datum) {\n $name = @$this->struct['fieldsDB'][$key];\n if ($name!==null) $this->filled[$name] = true;\n }\n }",
"public function setMembers($list)\n {\n $this->members_objs = array();\n if (!isset($list)) {\n return;\n }\n foreach ($list as $user) {\n $this->members_objs[] = is_array($user) ? User::find($user['unique_id'], $user) : $user;\n }\n }",
"function populate(){\n\t\t$this->db_tools->populate();\n\t\t$this->db_tools->echo_populate();\n\t}",
"public function run()\n {\n $data = $this->seedData();\n DB::table('members')->insertOrIgnore($data);\n }",
"function prepareData(){\n $this->ref = array();\n foreach($this->getIterator() as $junk=>$item){\n // current values\n $id = $item[$this->id_field];\n \n // save item\n $this->items[$id] = $item;\n \n // save relation\n if(isset($item[$this->parent_id_field])) {\n $this->ref[$item[$this->parent_id_field]][] = $id;\n } else {\n $this->ref[undefined][] = $id;\n }\n }\n }",
"public function execute()\n {\n $affiliateMember=$this->affiliateMemberFactory->create();\n// $member=$affiliateMember->load(1);\n// $member->delete();\n// $member->setAddress('new address');\n// $member->save();\n// var_dump($member->getData());\n// $affiliateMember->addData(['name'=>'Rand','address'=>'a new address','status'=>false,'phone_number'=>'9423719134']);\n// $affiliateMember->save();\n $collection=$affiliateMember->getCollection();\n foreach($collection as $item){\n print_r($item->getData());\n echo '</br>';\n }\n }",
"public function afterFind()\n {\n foreach ($this->fields as $f) {\n $this->owner->{$f} = Json::decode(($this->owner->{$f} ? $this->owner->{$f} : null));\n }\n }",
"private function loadAllFacilities(){\n $sql=\"SELECT f.id,f.facility name,f.dhis2_name,f.hub_id,\n h.ip_id, f.district_id,f.dhis2_uid,d.dhis2_uid as district_uid \n FROM backend_facilities f \n left join backend_hubs h on f.hub_id = h.id \n left join backend_districts d on d.id = f.district_id\";\n\n $facilities_array = $this->db->select($sql);\n\n $this->mongo->facilities->drop();\n \n foreach($facilities_array AS $row){\n $data=[\n 'id'=>$row->id,\n 'name'=>$row->name,\n 'dhis2_name'=>$row->dhis2_name,\n 'hub_id'=>$row->hub_id,\n 'ip_id'=>$row->ip_id,\n\n 'district_id'=>$row->district_id,\n 'dhis2_uid'=>$row->dhis2_uid,\n 'district_uid'=>$row->district_uid,\n 'updated'=>'done'\n ];\n $this->mongo->facilities->insert($data);\n }\n\n }",
"public function assign_members($data) {\n // Make sure that the user is a member of the current users site.\n $users = $this->db->select('id')->from('users')->where('site_id', kohana::config('chapterboard.site_id'))->where('status', 1)->get();\n foreach ($users as $user) {\n $ids[$user->id] = $user->id;\n }\n \n // Loop through checked members as submitted by the user.\n foreach ($data['members'] as $user_id => $value) {\n if ($value && array_key_exists($user_id, $ids)) {\n $post = array(\n 'finance_charge_id' => $this->id,\n 'user_id' => $user_id,\n 'amount' => $this->amount,\n );\n $charge = ORM::factory('finance_charge_member');\n $charge->validate($post, TRUE);\n }\n }\n }",
"function loadData()\n\t{\n\t\tstatic $data;\n\t\t\n\t\tif(!$data)\n\t\t\t$data=self::getData();\n\n\t\tif(isset($data[$this->id]))\n\t\t\t$this->setValues((array)$data[$this->id]);\t\t\t\n\t}",
"private function _populate()\n {\n // populate Rgion\n foreach ($this->regionData as $region)\n {\n $this->region->create(\n $region['name'],\n $region['promotor_ID']\n );\n }\n \n // Populate branch\n foreach ($this->branchData as $branch)\n {\n $this->branch->create(\n $branch['name'],\n $branch['region_ID'],\n $branch['promotor_ID']\n );\n }\n\n // Popular Dealer \n foreach ($this->dealerData as $dealer)\n { \n $data = [\n 'region_ID' => $dealer['region_ID'],\n 'branch_ID' => $dealer['branch_ID'],\n 'dealer_account_ID' => $dealer['dealer_account_ID'],\n 'dealer_channel_ID' => $dealer['dealer_channel_ID'],\n 'dealer_type_ID' => $dealer['dealer_type_ID'],\n 'code' => $dealer['code'],\n 'name' => $dealer['name'],\n 'company' => $dealer['company'],\n 'address' => $dealer['address']\n ];\n\n $this->dealer->create($data);\n }\n\n foreach ($this->dealerChannelData as $dealerChannel)\n {\n $this->dealerChannel->create(\n $dealerChannel['name']\n );\n }\n\n // Populate dealer account\n foreach ($this->dealerAccountData as $dealerAccount)\n {\n $this->dealerAccount->create(\n $dealerAccount['name'],\n $dealerAccount['branch_ID'],\n $dealerAccount['promotor_ID']\n );\n }\n\n //Populate token\n foreach ($this->tokenData as $token)\n {\n $this->token->create(\n $token['dashboard_account_ID'],\n $token['token']\n );\n }\n\n // Populate promotor\n foreach ($this->promotorData as $promotor)\n { \n $this->promotor->create(\n $promotor['dealer_ID'],\n $promotor['phone'],\n $promotor['password'],\n $promotor['name'],\n $promotor['gender'],\n $promotor['type'],\n $promotor['parent_ID']\n );\n }\n\n // Populate report\n foreach ($this->reportData as $data)\n {\n return $this->report->create($data);\n\n }\n \n // Populate dashboard \n $accountIDs = [];\n\n foreach ($this->accountData as $account)\n {\n $accountIDs[] = $this->account->create(\n $account['email'],\n $account['name'],\n $account['last_access']\n );\n }\n\n return $accountIDs;\n }",
"public function set_members($members) {\n $this->data->members = $members;\n return $this;\n }",
"public function populate()\n\t{\n\t\tif (!$this->index)\n\t\t{\n\t\t\treturn array();\n\t\t}\n\n\t\t$records = $this->model->find(array_keys($this->index));\n\n\t\tforeach ($records as $nid => $record)\n\t\t{\n\t\t\t$this->index[$nid]->record = $record;\n\t\t}\n\n\t\treturn $records;\n\t}",
"private function _populate()\n {\n // Populate region\n foreach ($this->regionData as $region)\n {\n $regionIDs[] = $this->region->create(\n $region['name'],\n $region['promotor_ID']\n );\n }\n \n // Populate promotor\n foreach ($this->promotorData as $promotor)\n {\n $this->promotor->create(\n $promotor['dealer_ID'],\n $promotor['phone'],\n $promotor['password'],\n $promotor['name'],\n $promotor['gender'],\n $promotor['type'],\n $promotor['parent_ID']\n );\n }\n \n // Populate branch\n $branchIDs = [];\n \n foreach ($this->branchData as $branch)\n {\n $branchIDs[] = $this->branch->create(\n $branch['name'],\n $branch['region_ID'],\n $branch['promotor_ID']\n );\n }\n \n return $branchIDs;\n }",
"private function convert_members()\n\t{\n\t\t$num = $this->oldboard->db->fetch( \"SELECT COUNT(MEMBER_ID) AS count FROM %pmember_profiles\" );\n\t\t$MID = $num['count'] + 1;\n\n\t\t$this->qsf->db->query( \"TRUNCATE %pusers\" );\n\t\t$this->qsf->db->query( \"INSERT INTO %pusers (user_id, user_name, user_group) VALUES (1, 'Guest', 3)\" );\n\n\t\t$result = $this->oldboard->db->query( \"SELECT * FROM %pmember_profiles\" );\n\t\twhile( $row = $this->oldboard->db->nqfetch($result) )\n\t\t{\n\t\t\twhile( $row['MEMBER_ID'] >= $MID )\n\t\t\t\t$MID++;\n\n\t\t\tif( $row['MEMBER_ID'] == 1 )\n\t\t\t\t$row['MEMBER_ID'] = 2;\n\n\t\t\t$row['MEMBER_NAME'] = $this->strip_ikon_tags( $row['MEMBER_NAME'] );\n\t\t\t$row['MEMBER_EMAIL'] = $this->strip_ikon_tags( $row['MEMBER_EMAIL'] );\n\t\t\t$row['WEBSITE'] = $this->strip_ikon_tags( $row['WEBSITE'] );\n\t\t\t$row['LOCATION'] = $this->strip_ikon_tags( $row['LOCATION'] );\n\t\t\t$row['INTERESTS'] = $this->strip_ikon_tags( $row['INTERESTS'] );\n\t\t\t$row['SIGNATURE'] = $this->strip_ikon_tags( $row['SIGNATURE'] );\n\n\t\t\t$pos = strpos( $row['MEMBER_ID'], '-' );\n\t\t\tif( $pos != false )\n\t\t\t{\n\t\t\t\t$IDTABLE[] = array( 'uname' => $row['MEMBER_NAME'], 'newid' => $MID, 'oldid' => $row['MEMBER_ID'] );\n\t\t\t\t$row['MEMBER_ID'] = $MID;\n\t\t\t\t$MID++;\n\t\t\t}\n\t\t\tif( $row['HIDE_EMAIL'] == '' || $row['HIDE_EMAIL'] == 1 )\n\t\t\t\t$showmail = 0;\n\t\t\telse\n\t\t\t\t$showmail = 1;\n\n\t\t\tif( $row['LAST_LOG_IN'] == '' )\n\t\t\t\t$row['LAST_LOG_IN'] = $row['MEMBER_JOINED'];\n\t\t\tif( $row['LAST_ACTIVITY'] == '' )\n\t\t\t\t$row['LAST_ACTIVITY'] = $row['MEMBER_JOINED'];\n\n\t\t\t/* The default Ikonboard groups they claim you can never alter.\n\t\t\t * Additional groups will not be converted. Members in these groups will become standard members.\n\t\t\t */\n\t\t\tif( $row['MEMBER_GROUP'] == 1 )\n\t\t\t\t$row['MEMBER_GROUP'] = 5;\n\t\t\telse if( $row['MEMBER_GROUP'] == 2 )\n\t\t\t\t$row['MEMBER_GROUP'] = 3;\n\t\t\telse if( $row['MEMBER_GROUP'] == 3 )\n\t\t\t\t$row['MEMBER_GROUP'] = 2;\n\t\t\telse if( $row['MEMBER_GROUP'] == 4 )\n\t\t\t\t$row['MEMBER_GROUP'] = 1;\n\t\t\telse\n\t\t\t\t$row['MEMBER_GROUP'] = 2;\n\n\t\t\t$level = $row['MEMBER_LEVEL'] + 1;\n\t\t\tif( $level < 1 )\n\t\t\t\t$level = 1;\n\n\t\t\t$pos = strpos( $row['MEMBER_AVATAR'], '://' );\n\t\t\tif( $pos == 4 )\n\t\t\t{\n\t\t\t\t$avatar = $row['MEMBER_AVATAR'];\n\t\t\t\t$width = 100;\n\t\t\t\t$height = 100;\n\t\t\t\t$type = 'url';\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$avatar = '';\n\t\t\t\t$width = 0;\n\t\t\t\t$height = 0;\n\t\t\t\t$type = 'none';\n\t\t\t}\n\n\t\t\t$icq = 0;\n\t\t\tif( $row['ICQNUMBER'] )\n\t\t\t\t$icq = intval( $row['ICQNUMBER'] );\n\n\t\t\t$this->qsf->db->query( \"INSERT INTO %pusers\n\t\t\t\t(user_id, user_name, user_password, user_joined, user_level, user_title, user_group, user_avatar, user_avatar_type, user_avatar_width, user_avatar_height, user_email, user_email_show, user_homepage, user_posts, user_location, user_icq, user_msn, user_aim, user_yahoo, user_interests, user_signature, user_lastvisit, user_lastpost, user_view_avatars, user_view_signatures, user_regip)\n\t\t\t\tVALUES( %d, '%s', '%s', %d, %d, '%s', %d, '%s', '%s', %d, %d, '%s', %d, '%s', %d, '%s', %d, '%s', '%s', '%s', '%s', '%s', %d, %d, %d, %d, INET_ATON( '%s' ) )\",\n\t\t\t\t$row['MEMBER_ID'], $row['MEMBER_NAME'], $row['MEMBER_PASSWORD'], $row['MEMBER_JOINED'], $level, $row['MEMBER_TITLE'], $row['MEMBER_GROUP'], $avatar, $type, $width, $height, $row['MEMBER_EMAIL'], $showmail, $row['WEBSITE'], $row['MEMBER_POSTS'], $row['LOCATION'], $icq, $row['MSNNAME'], $row['AOLNAME'], $row['YAHOONAME'], $row['INTERESTS'], $row['SIGNATURE'], $row['LAST_LOG_IN'], $row['LAST_ACTIVITY'], $row['VIEW_AVS'], $row['VIEW_SIGS'], $row['MEMBER_IP'] );\n\t\t}\n\n\t\t$this->qsf->db->query( \"DROP TABLE IF EXISTS %pikon_ids\" );\n\t\t$this->qsf->db->query( \"CREATE TABLE %pikon_ids\n\t\t\t( old_name varchar(32) NOT NULL, old_id varchar(32) NOT NULL, new_id int(10) unsigned NOT NULL, PRIMARY KEY(old_id) )\" );\n\n\t\tfor( $x = 0; $x < sizeof( $IDTABLE ); $x++ )\n\t\t{\n\t\t\t$name = $IDTABLE[$x]['uname'];\n\t\t\t$oldid = $IDTABLE[$x]['oldid'];\n\t\t\t$newid = $IDTABLE[$x]['newid'];\n\n\t\t\t$this->qsf->db->query( \"INSERT INTO %pikon_ids VALUES( '%s', '%s', %d )\", $name, $oldid, $newid );\n\t\t}\n\t}",
"public function run()\n {\n DB::table('member_review')->delete();\n\n $review = Review::find(1);\n $review->members()->attach([\n 1 => [\n 'stof' => 4,\n 'aandacht' => 2,\n 'tevreden' => 3,\n 'mening' => 4,\n 'bericht' => 'Je bent het allerleukste spookje dat er bestaat!',\n ],\n ]);\n }",
"public function run()\n\t{\n\t\t// DB::table('party_members')->truncate();\n\n\t\t$party_members = array(\n\n\t\t);\n\n\t\t// Uncomment the below to run the seeder\n\t\t// DB::table('party_members')->insert($party_members);\n\t}",
"public function run()\n {\n $identities = Identity::whereDoesntHave('user', function ($user) {\n $user->where('username', 'admin');\n })->get();\n\n foreach ($identities as $identity) {\n $identity->member()->save(factory(App\\Models\\Member::class)->make());\n }\n }",
"public function fillOutDb()\n {\n /* Fill out the Contacts table. BatchInsert is a good idea for that */\n $this->batchInsert('Contacts', ['name', 'surname', 'description'], self::InitialContacts);\n\n /* Prepare array for batchInsert request at first */\n $list = [];\n foreach(self::InitialPhoneNumbers as $name => $numbers){\n $query = new \\yii\\db\\Query();\n $contact_id = $query->select('id')->from('Contacts')->where(['name' => $name])->one();\n foreach($numbers as $number){\n $list[] = ['number' => $number, 'contact_id' => $contact_id['id']];\n }\n }\n\n /* Fill out the Numbers table */\n $this->batchInsert('Numbers', ['number', 'contact_id'], $list);\n }",
"protected function populateDatabase(){\n $itemsSaved = (\"\\n\" . implode(';', get_object_vars($this)));\n file_put_contents('coursesTakenDB.csv', $itemsSaved, FILE_APPEND | LOCK_EX);\n }",
"private function _update() {\n\n $this->db->replace(XCMS_Tables::TABLE_USERS, $this->getArray());\n $this->attributes->save();\n\n }",
"public function run()\n {\n DB::table('members')->insert(\n [\n \t[\n 'name' => \"Hồ Ngọc Hà\",\n 'address' => \"HCM\",\n 'age' => \"34\",\n 'photo' => \"hongocha.jpg\",\n ],\n [\n 'name' => \"Hồ Ngọc Hà\",\n 'address' => \"HCM\",\n 'age' => \"34\",\n 'photo' => \"hongocha.jpg\",\n ],\n [\n 'name' => \"Hồ Ngọc Hà\",\n 'address' => \"HCM\",\n 'age' => \"34\",\n 'photo' => \"hongocha.jpg\",\n ],\n [\n 'name' => \"Hồ Ngọc Hà\",\n 'address' => \"HCM\",\n 'age' => \"34\",\n 'photo' => \"hongocha.jpg\",\n ],[\n 'name' => \"Hồ Ngọc Hà\",\n 'address' => \"HCM\",\n 'age' => \"34\",\n 'photo' => \"hongocha.jpg\",\n ],\n [\n 'name' => \"Hồ Ngọc Hà\",\n 'address' => \"HCM\",\n 'age' => \"34\",\n 'photo' => \"hongocha.jpg\",\n ]\n \t]);\n }",
"public function populateMcoData(){\n\t\t$mcoDiffs = new Application_Model_DbTable_McoData();\n\t\t$editAccredit = $mcoDiffs->fetchAll($mcoDiffs->select()->where('mco = 9'));\n\t\tforeach ($editAccredit as $edit) {\n\t\t\t$edit['id'] = $edit->id;\n\t\t\t$edit['amount_passenger'] = $edit->end_roulette - $edit->start_roulette;\n\t\t\t$edit->save();\n\t\t}\n\t}",
"public function loadData(){\r\n $this->host = Team::find($this->host);\r\n $this->guest = Team::find($this->guest);\r\n $this->winner = Team::find($this->winner);\r\n $this->tournament = Tournament::find($this->tournamentID); \r\n }",
"public function initData()\n {\n $this->member = new WMember(Base::parIndex());\n $this->client = $this->member->getClient();\n if (!$this->client)\n {\n $this->client = new WClient(Base::parIndex());\n $this->member = null;\n }\n }",
"function getHouseholdMembers($pdo){\n\t\t$getMembers =\n\t\t$pdo->prepare('SELECT UserID FROM hhm_users WHERE HouseholdID =:householdid');\n\t\t$getMembers->execute(array('householdid'=>\"$this->householdId\"));\n\t\t$info = $getMembers->fetchAll(PDO::FETCH_COLUMN);\n\t\t$members =[];\n\t\tforeach ($info as $key => $id){\n\t\t\t$member = new Member($id, $pdo);\n\t\t\tarray_push($members, $member);\n\t\t}\n\t\n\t\t$this->members = $members;\n\t}"
]
| [
"0.63185906",
"0.6252849",
"0.62182105",
"0.58949727",
"0.58558077",
"0.58474684",
"0.58137405",
"0.57514226",
"0.5740742",
"0.5721191",
"0.56579614",
"0.5626018",
"0.5620895",
"0.5606167",
"0.5605646",
"0.5579679",
"0.5575196",
"0.5548283",
"0.5530898",
"0.55300987",
"0.5522785",
"0.55085874",
"0.54996264",
"0.5485787",
"0.54833734",
"0.54547197",
"0.5450283",
"0.54398257",
"0.5431169",
"0.54013586"
]
| 0.7707988 | 0 |
Fill groups array from DB, call after save | function fillGroups()
{
$this->groups[] = array(-1,"<"."Admin".">");
$this->groupFullChecked[] = true;
$trs = db_query("select , from `uggroups` order by ",$this->conn);
while($tdata = db_fetch_numarray($trs))
{
$this->groups[] = array($tdata[0],$tdata[1]);
$this->groupFullChecked[] = true;
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function run()\n\t{\n\t\t\\DB::table('customers_groups')->truncate();\n \n\t\t\\DB::table('customers_groups')->insert(array (\n\t\t\t0 => \n\t\t\tarray (\n\t\t\t\t'customers_groups_id' => 1,\n\t\t\t\t'groupname' => 'Allianz',\n\t\t\t\t'default' => 0,\n\t\t\t\t'created_at' => '2014-04-19 04:02:36',\n\t\t\t\t'updated_at' => '2014-05-04 13:56:55',\n\t\t\t),\n\t\t\t1 => \n\t\t\tarray (\n\t\t\t\t'customers_groups_id' => 2,\n\t\t\t\t'groupname' => 'Deleted',\n\t\t\t\t'default' => 0,\n\t\t\t\t'created_at' => '2014-07-04 14:23:41',\n\t\t\t\t'updated_at' => '2014-07-04 14:23:41',\n\t\t\t),\n\t\t\t2 => \n\t\t\tarray (\n\t\t\t\t'customers_groups_id' => 3,\n\t\t\t\t'groupname' => 'Existing Customers',\n\t\t\t\t'default' => 0,\n\t\t\t\t'created_at' => '2014-07-07 05:52:11',\n\t\t\t\t'updated_at' => '2014-07-07 05:52:11',\n\t\t\t),\n\t\t\t3 => \n\t\t\tarray (\n\t\t\t\t'customers_groups_id' => 4,\n\t\t\t\t'groupname' => 'General',\n\t\t\t\t'default' => 0,\n\t\t\t\t'created_at' => '2014-07-07 06:02:35',\n\t\t\t\t'updated_at' => '2014-07-07 06:02:35',\n\t\t\t),\n\t\t\t4 => \n\t\t\tarray (\n\t\t\t\t'customers_groups_id' => 5,\n\t\t\t\t'groupname' => 'Gesperrt',\n\t\t\t\t'default' => 0,\n\t\t\t\t'created_at' => '2014-07-07 06:18:46',\n\t\t\t\t'updated_at' => '2014-07-07 06:18:46',\n\t\t\t),\n\t\t\t5 => \n\t\t\tarray (\n\t\t\t\t'customers_groups_id' => 6,\n\t\t\t\t'groupname' => 'Keine E-Mails',\n\t\t\t\t'default' => 0,\n\t\t\t\t'created_at' => '2014-07-07 06:21:25',\n\t\t\t\t'updated_at' => '2014-07-08 09:59:05',\n\t\t\t),\n\t\t\t6 => \n\t\t\tarray (\n\t\t\t\t'customers_groups_id' => 7,\n\t\t\t\t'groupname' => 'Retailer',\n\t\t\t\t'default' => 1,\n\t\t\t\t'created_at' => '2014-07-07 06:36:18',\n\t\t\t\t'updated_at' => '2014-07-07 06:36:18',\n\t\t\t),\n\t\t\t7 => \n\t\t\tarray (\n\t\t\t\t'customers_groups_id' => 8,\n\t\t\t\t'groupname' => 'TopCustomer',\n\t\t\t\t'default' => 0,\n\t\t\t\t'created_at' => '2014-07-07 10:08:00',\n\t\t\t\t'updated_at' => '2014-07-07 10:08:00',\n\t\t\t),\n\t\t\t8 => \n\t\t\tarray (\n\t\t\t\t'customers_groups_id' => 9,\n\t\t\t\t'groupname' => 'Wholesale',\n\t\t\t\t'default' => 0,\n\t\t\t\t'created_at' => '2014-07-07 10:08:00',\n\t\t\t\t'updated_at' => '2014-07-07 10:08:00',\n\t\t\t),\n\t\t));\n\t}",
"function initGroups() {\n $groups = array(0 => array('alias' => 'members',\n 'model' => 'Group',\n 'foreign_key' => 1),\n 1 => array('alias' => 'moderators',\n 'model' => 'Group',\n 'foreign_key' => 2),\n 2 => array('alias' => 'administrators',\n 'model' => 'Group',\n 'foreign_key' => 3));\n\n foreach ($groups as $data) {\n $this->Acl->Aro->create();\n $this->Acl->Aro->save($data);\n }\n }",
"public function afterFind()\n {\n parent::afterFind();\n $groups = AuthDAO::getGroups($this->id, $this->groupType);\n $groupIds = [];\n foreach ($groups as $group)\n {\n $groupIds[] = $group['id'];\n }\n $this->groups = $groupIds;\n }",
"public function getGroupsFromDatabase() {\n $db = \\Helper::getDB();\n $db->join('groups g', 'gd.groupId = g.id', 'LEFT');\n $db->where('gd.documentId', $db->escape($this->getId()));\n $groups = $db->get('group_documents gd', NULL, 'g.*');\n $this->groups = array();\n\n // Process all groups\n foreach($groups as $group) {\n $newGroup = new \\Models\\Group($group['id'], $group['name']);\n $this->addGroup($newGroup);\n }\n }",
"public function run()\n {\n if( is_array($this->array) && count($this->array) > 0){\n foreach ($this->array as $index){\n DB::table('groups')->insert([\n 'name' => $index[0],\n 'description' => $index[1],\n 'owner_id' => $index[2],\n 'created_at' => DB::raw('now()'),\n 'updated_at' => DB::raw('now()')\n ]);\n }\n }\n }",
"private function insertGroups() {\n\t DB::table('base_group')->insert(['group_name' => 'sales.reporting', 'group_info' => 'Sales Reporting', 'group_alias' => 'National', 'active' => 1]);\n\t DB::table('base_group')->insert(['group_name' => 'customer.analytics', 'group_info' => 'Customer Analytics', 'group_alias' => 'National', 'active' => 1]);\n\t}",
"public function refreshGroups()\n {\n $this->sortedAttributeGroups = AttributeGroup::whereAttributableType($this->typeClass)\n ->orderBy('position')->get();\n\n $this->showGroupCreate = false;\n }",
"public function load() {\n\t\t\t$this->arList = array(); \n\t\t\t\n\t\t\t$oDB = new database(); \n\t\t\t\n\t\t\t$strSQL = \"select g.* from tblGroups g \";\n\t\t\tforeach ($this->arJoin as $strJoin) $strSQL .= $strJoin; \n\t\t\tif (count($this->arWhere)>0) $strSQL .= \" where \" . implode(\" and \", $this->arWhere); \n\t\t\t$this->arOrder[] = \"g.naam\"; \n\t\t\t$strSQL .= \" order by \" . implode(\",\", $this->arOrder); \n\t\t\t$oDB->sql($strSQL); \n\t\t\t$oDB->execute(); \n\t\t\twhile ($oDB->nextRecord()) {\n\t\t\t\t$oGroep = new group(); \n\t\t\t\t$oGroep->id($oDB->get(\"id\")); \n\t\t\t\t$oGroep->naam($oDB->get(\"naam\")); \n\t\t\t\t$oGroep->info($oDB->get(\"info\")); \n\t\t\t\t$oGroep->admin($oDB->get(\"admin\")); \n\t\t\t\t$oGroep->website($oDB->get(\"website\")); \n\t\t\t\t$this->arList[] = $oGroep; \n\t\t\t}\t\n\t\t}",
"public function fetchGroupData() {}",
"public function fetchGroupData() {}",
"public function run()\n\t{\n\t\t// DB::table('groups')->truncate();\n\n\t\t$groups = array(\n\t\t\t['id' => uniqid(),\n\t\t\t'name' => 'all users',\n\t\t\t'created_at' => date('Y-m-d H:i:s'),\n\t\t\t'updated_at' => date('Y-m-d H:i:s')],\n\t\t\t['id' => uniqid(),\n\t\t\t'name' => 'private',\n\t\t\t'created_at' => date('Y-m-d H:i:s'),\n\t\t\t'updated_at' => date('Y-m-d H:i:s')],\n\t\t\t['id' => uniqid(),\n\t\t\t'name' => 'genel kurul',\n\t\t\t'created_at' => date('Y-m-d H:i:s'),\n\t\t\t'updated_at' => date('Y-m-d H:i:s')]\n\t\t);\n\n\t\t// Uncomment the below to run the seeder\n\t\t// DB::table('groups')->insert($groups);\n\t}",
"public function Fill(): Groups {\n if($this->User === null || $this->User->ID === null) {\n throw new IDNullException();\n }\n $this->StopDispatch();\n foreach(\n Expression::Select(\"Group\")\n ->From(\"Security.GroupMemberships\")\n ->Where([\"User\" => $this->User])\n ->OrderBy([\"Group\" => true])\n as\n $Group\n ) {\n $this->Add(new Group((int)$Group[\"Group\"]));\n }\n $this->StartDispatch();\n return $this;\n }",
"public function afterSave($object)\n {\n \n $websiteId = Mage::app()->getStore($object->getStoreId())->getWebsiteId();\n $isGlobal = $this->getAttribute()->isScopeGlobal() || $websiteId == 0;\n $groupRows = $object->getData($this->getAttribute()->getName());\n \n \n \n if (empty( $groupRows)) {\n $this->_getResource()->deleteGroupData($object->getId());\n return $this;\n }\n \n $old = array();\n $new = array();\n \n $origGroupRows = $object->getOrigData($this->getAttribute()->getName());\n if (!is_array( $origGroupRows )) {\n $origGroupRows = array();\n }\n foreach ( $origGroupRows as $data) {\n if ($data['website_id'] > 0 || ($data['website_id'] == '0' && $isGlobal)) {\n $key = join('-', array_merge(\n array($data['website_id'], $data['cust_group']),\n $this->_getAdditionalUniqueFields($data)\n ));\n $old[$key] = $data;\n }\n }\n \n // prepare data for save\n foreach ($groupRows as $data) {\n $hasEmptyData = false;\n foreach ($this->_getAdditionalUniqueFields($data) as $field) {\n if (empty($field)) {\n $hasEmptyData = true;\n break;\n }\n }\n\n if ($hasEmptyData || !isset($data['cust_group']) || !empty($data['delete'])) {\n continue;\n }\n if ($this->getAttribute()->isScopeGlobal() && $data['website_id'] > 0) {\n continue;\n }\n if (!$isGlobal && (int)$data['website_id'] == 0) {\n continue;\n }\n\n if(!isset($data['website_id'])) $data['website_id'] =0;\n \n $key = join('-', array_merge(\n array($data['website_id'], $data['cust_group']),\n $this->_getAdditionalUniqueFields($data)\n ));\n\n $useForAllGroups = $data['cust_group'] == Mage_Customer_Model_Group::CUST_GROUP_ALL;\n $customerGroupId = !$useForAllGroups ? $data['cust_group'] : 0;\n\n \n $new[$key] = array_merge(array(\n 'website_id' => $data['website_id'],\n 'all_groups' => $useForAllGroups ? 1 : 0,\n 'customer_group_id' => $customerGroupId,\n 'value' => $data['value'],\n ), $this->_getAdditionalUniqueFields($data));\n }\n\n $delete = array_diff_key($old, $new);\n $insert = array_diff_key($new, $old);\n $update = array_intersect_key($new, $old);\n\n $isChanged = false;\n $productId = $object->getId();\n\n if (!empty($delete)) {\n foreach ($delete as $data) {\n $this->_getResource()->deleteGroupData($productId, null, $data['group_id']);\n $isChanged = true;\n }\n }\n\n if (!empty($insert)) {\n foreach ($insert as $data) {\n $group = new Varien_Object($data);\n $group->setEntityId($productId);\n $this->_getResource()->saveGroupData($group);\n\n $isChanged = true;\n }\n }\n\n if (!empty($update)) {\n foreach ($update as $k => $v) {\n \n \n \n if ($old[$k]['value'] != $v['value']) {\n $group = new Varien_Object(array(\n 'value_id' => $old[$k]['value_id'],\n 'value' => $v['value']\n ));\n $this->_getResource()->saveGroupData($group);\n\n $isChanged = true;\n }\n }\n }\n\n if ($isChanged) {\n $valueChangedKey = $this->getAttribute()->getName() . '_changed';\n $object->setData($valueChangedKey, 1);\n }\n \n \n \n \n \n \n \n \n \n \n \n \n \n /*$websiteId = Mage::app()->getStore($object->getStoreId())->getWebsiteId();\n $isGlobal = $this->getAttribute()->isScopeGlobal() || $websiteId == 0;\n\n $priceRows = $object->getData($this->getAttribute()->getName());\n if (empty($priceRows)) {\n if ($isGlobal) {\n $this->_getResource()->deletePriceData($object->getId());\n } else {\n $this->_getResource()->deletePriceData($object->getId(), $websiteId);\n }\n return $this;\n }\n\n $old = array();\n $new = array();\n\n // prepare original data for compare\n $origGroupPrices = $object->getOrigData($this->getAttribute()->getName());\n if (!is_array($origGroupPrices)) {\n $origGroupPrices = array();\n }\n foreach ($origGroupPrices as $data) {\n if ($data['website_id'] > 0 || ($data['website_id'] == '0' && $isGlobal)) {\n $key = join('-', array_merge(\n array($data['website_id'], $data['cust_group']),\n $this->_getAdditionalUniqueFields($data)\n ));\n $old[$key] = $data;\n }\n }\n\n // prepare data for save\n foreach ($priceRows as $data) {\n $hasEmptyData = false;\n foreach ($this->_getAdditionalUniqueFields($data) as $field) {\n if (empty($field)) {\n $hasEmptyData = true;\n break;\n }\n }\n\n if ($hasEmptyData || !isset($data['cust_group']) || !empty($data['delete'])) {\n continue;\n }\n if ($this->getAttribute()->isScopeGlobal() && $data['website_id'] > 0) {\n continue;\n }\n if (!$isGlobal && (int)$data['website_id'] == 0) {\n continue;\n }\n\n $key = join('-', array_merge(\n array($data['website_id'], $data['cust_group']),\n $this->_getAdditionalUniqueFields($data)\n ));\n\n $useForAllGroups = $data['cust_group'] == Mage_Customer_Model_Group::CUST_GROUP_ALL;\n $customerGroupId = !$useForAllGroups ? $data['cust_group'] : 0;\n\n $new[$key] = array_merge(array(\n 'website_id' => $data['website_id'],\n 'all_groups' => $useForAllGroups ? 1 : 0,\n 'customer_group_id' => $customerGroupId,\n 'value' => $data['price'],\n ), $this->_getAdditionalUniqueFields($data));\n }\n\n $delete = array_diff_key($old, $new);\n $insert = array_diff_key($new, $old);\n $update = array_intersect_key($new, $old);\n\n $isChanged = false;\n $productId = $object->getId();\n\n if (!empty($delete)) {\n foreach ($delete as $data) {\n $this->_getResource()->deletePriceData($productId, null, $data['price_id']);\n $isChanged = true;\n }\n }\n\n if (!empty($insert)) {\n foreach ($insert as $data) {\n $price = new Varien_Object($data);\n $price->setEntityId($productId);\n $this->_getResource()->savePriceData($price);\n\n $isChanged = true;\n }\n }\n\n if (!empty($update)) {\n foreach ($update as $k => $v) {\n if ($old[$k]['price'] != $v['value']) {\n $price = new Varien_Object(array(\n 'value_id' => $old[$k]['price_id'],\n 'value' => $v['value']\n ));\n $this->_getResource()->savePriceData($price);\n\n $isChanged = true;\n }\n }\n }\n\n if ($isChanged) {\n $valueChangedKey = $this->getAttribute()->getName() . '_changed';\n $object->setData($valueChangedKey, 1);\n }*/\n\n return $this;\n }",
"function rebuild_group_cache()\n\t{\n\t\t$this->ipsclass->cache['group_cache'] = array();\n\n\t\t$this->ipsclass->DB->simple_construct( array( 'select' => \"*\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t 'from' => 'groups'\n\t\t\t\t\t\t\t\t\t\t\t ) );\n\n\t\t$this->ipsclass->DB->simple_exec();\n\n\t\twhile ( $i = $this->ipsclass->DB->fetch_row() )\n\t\t{\n\t\t\t$this->ipsclass->cache['group_cache'][ $i['g_id'] ] = $i;\n\t\t}\n\n\t\t$this->ipsclass->update_cache( array( 'name' => 'group_cache', 'array' => 1, 'deletefirst' => 1 ) );\n\t}",
"function PreLoadGroups($MID){\n $dbcon=mysqli_connect(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME);\n if (mysqli_connect_errno()){ \n die(\"Database connection failed: \" .\n mysqli_connect_error() .\n \" (\" . mysqli_connect_error() . \")\");\n }\n /*#############################################\n * GET THE LAST MEETING ID TO GET GROUPS FROM\n *############################################*/\n $query = \"SELECT \";\n $query .= \"groups.MtgID \";\n $query .= \"FROM groups \";\n $query .= \"INNER JOIN \";\n $query .= \"meetings ON groups.MtgID = meetings.ID \";\n $query .= \"ORDER BY meetings.MtgDate DESC\";\n // echo \"<br />\" . $query . \"<br /><hr /\";\n $result = mysqli_query($dbcon, $query);\n if (!result){\n die(\"Database query failed.\");\n }\n $grpIDs = mysqli_fetch_assoc($result);\n $lastMtgID = $grpIDs[\"MtgID\"];\n mysqli_free_result($result); \n // echo \"<br />lastMtgID=\" . $lastMtgID . \"<br/>\";\n /*****************************************************\n * Now get the groups from that last meeting in array\n * ===================================================\n * we need:\n * FacID\n * CoFacID\n * Gender\n * Location\n * Title\n * ===================================================\n *****************************************************/\n $query = \"SELECT \";\n $query .= \"groups.FacID, groups.CoFacID, groups.Gender, \";\n $query .= \"groups.Location, groups.Title \";\n $query .= \"FROM groups \";\n $query .= \"WHERE groups.MtgID = \" . $lastMtgID . \" \";\n $query .= \"ORDER BY groups.Gender, groups.Title\";\n $result = mysqli_query($dbcon, $query);\n $group = array();\n $FacID = array();\n $CoFacID = array();\n $Gender = array();\n $Location = array();\n $Title = array();\n \n if (!result){\n die(\"Database query failed.\");\n }\n $grpCnt = 0;\n while($groups = mysqli_fetch_assoc($result)){\n /*========================================/\n * now load array with groups retrieved\n *****************************************/\n $FacID[$grpCnt] = $groups[\"FacID\"];\n $CoFacID[$grpCnt] = $groups[\"CoFacID\"];\n $Gender[$grpCnt] = $groups[\"Gender\"];\n $Location[$grpCnt] = $groups[\"Location\"];\n $Title[$grpCnt] = $groups[\"Title\"];\n ++$grpCnt;\n }\n mysqli_free_result($result); \n $i = 0;\n while ($i < $grpCnt){\n /*****************************\n * print group\n *****************************/\n //echo $Gender[$i] . \" \" . $Title[$i] . \" in \" . $Location[$i] . \"<br/>\";\n ++$i;\n }\n /***********************************\n * insert data for new week\n ***********************************/\n $i = 0;\n while ($i < $grpCnt){\n $query = \"INSERT INTO groups (FacID, CoFacID, Gender, Title, Location, MtgID)\n Values({$FacID[$i]}, {$CoFacID[$i]}, {$Gender[$i]}, '{$Title[$i]}',\n '{$Location[$i]}', {$MID})\";\n \n //echo \"query:\" . $query . \"<br/><hr />\"; \n $result = mysqli_query($dbcon, $query);\n if (!$result){\n die(\"Database query INSERT failed\"); \n }\n ++$i;\n }\n \n mysqli_close($dbcon);\n $dest = \"mtgForm.php?ID=\" . $MID;\n destination(307, $dest);\n}",
"public function load_group(){\n $this->_compteur = 0;\n $this->_id_list_group = null;\n $this->_statut_group = null;\n $this->_list_group=null;\n $this->_users_group = null;\n $this->_all_group = null;\n\n /* $groups = array();\n if (!session()->has('group')) {\n session(['group' => $groups]);\n }//*/\n\n\n $this->_all_group = DB::table('group')->get();\n $this->_users_group = usergroup::where('user_ID', '=', Auth::id())->where('statut','=', 'actif')->get();\n\n $_users_group2 = usergroup::where('user_ID', '=', Auth::id())->get();\n foreach ($_users_group2 as $_el){\n $this->_statut_group[''.$_el->group_ID.''] = $_el->statut;\n\n }\n\n foreach ($this->_users_group as $element){\n $this->_list_group[$this->_compteur] = group::where('id','=',$element['group_ID'])->first();\n $this->_id_list_group[$this->_compteur] = $this->_list_group[$this->_compteur]['id'];\n //$this->_statut_group[''.$this->_id_list_group[$this->_compteur].''] = $element->statut;\n\n /* if(!array_has(session('group'),$this->_compteur))\n {\n session()->push('group',$element['group_ID']);\n }//*/\n $this->_compteur++;\n session(['menu' => 'groupe']);\n\n }\n\n }",
"public static function _prepareSortable() {\n $data = [];\n $sortableGroupField = static::getSortableGroupField();\n $sortableField = static::getSortableField();\n foreach(static::all() as $row) {\n $keyParts = [];\n foreach ($sortableGroupField as $sgf) {\n $keyParts[] = $row->{$sortableGroupField};\n }\n $key = implode('_',$keyParts);\n if ($sortableGroupField) {\n $data[$key][] = $row;\n } else {\n $data[0][$row];\n }\n }\n\n foreach ($data as $group => $groupData ) {\n $i = 0;\n foreach ($groupData as $row) {\n $row->{$sortableField} = ++$i;\n $row->save();\n echo sprintf(\"row %d was orderer<br>\\n\",$row->id);\n }\n }\n }",
"public function run()\n {\n\n \t$groups = [\n ['id' => 1, 'name' => 'Caleçon Citron', 'attribute' => 'Coutures Orange', 'prefix' => 'calecon-citron', 'price' => 12, 'price_prod' => 5, 'price_vat' => 2, 'price_mclh' => 5],\n ['id' => 2, 'name' => 'Caleçon Pêche', 'attribute' => 'Coutures Rouges', 'prefix' => 'calecon-peche', 'price' => 12, 'price_prod' => 5, 'price_vat' => 2, 'price_mclh' => 5],\n ];\n\n DB::table('product_groups')->insert($groups);\n }",
"public function saveFbGroups()\n {\n\n $fb = new Facebook([\n 'app_id' => $this->config('fbAppId'),\n 'app_secret' => $this->config('fbAppSec'),\n 'default_graph_version' => 'v2.6',\n ]);\n\n\n try {\n\n $response = $fb->get('me/?fields=groups.limit(1000)', $this->config('fbAppToken'));\n $body = $response->getBody();\n $data = json_decode($body, true);\n\n facebookGroups::where('userId', Auth::id())->delete();\n\n foreach ($data['groups']['data'] as $no => $field) {\n if (!isset($field['privacy'])) {\n } else {\n $privacy = $field['privacy'];\n $facebookGroup = new facebookGroups();\n $facebookGroup->pageId = $field['id'];\n $facebookGroup->pageName = $field['name'];\n $facebookGroup->privacy = $privacy;\n $facebookGroup->userId = Auth::user()->id;\n $facebookGroup->save();\n }\n\n\n }\n\n } catch (FacebookResponseException $e) {\n\n return 'Graph returned an error: ' . $e->getMessage();\n } catch (FacebookSDKException $e) {\n\n return 'Facebook SDK returned an error: ' . $e->getMessage();\n }\n }",
"public function run()\n {\n $groups = config('groups');\n\n foreach ($groups as $group) {\n $new_group_obj = new Group();\n $new_group_obj->name = $group['name'];\n $new_group_obj->save();\n }\n }",
"public function run()\n\t{\n\t\t\\DB::table('taskgroups')->delete();\n \n\t\t\\DB::table('taskgroups')->insert(array (\n\t\t\t0 => \n\t\t\tarray (\n\t\t\t\t'id' => 1,\n\t\t\t\t'name' => 'Tour',\n\t\t\t\t'order' => 1,\n\t\t\t\t'created_at' => NULL,\n\t\t\t\t'updated_at' => '2015-04-23 12:22:14',\n\t\t\t\t'deleted_at' => NULL,\n\t\t\t),\n\t\t\t1 => \n\t\t\tarray (\n\t\t\t\t'id' => 2,\n\t\t\t\t'name' => 'Technical',\n\t\t\t\t'order' => 4,\n\t\t\t\t'created_at' => NULL,\n\t\t\t\t'updated_at' => '2015-04-23 12:22:14',\n\t\t\t\t'deleted_at' => NULL,\n\t\t\t),\n\t\t\t2 => \n\t\t\tarray (\n\t\t\t\t'id' => 3,\n\t\t\t\t'name' => 'Marketing',\n\t\t\t\t'order' => 2,\n\t\t\t\t'created_at' => NULL,\n\t\t\t\t'updated_at' => '2015-04-23 12:22:14',\n\t\t\t\t'deleted_at' => NULL,\n\t\t\t),\n\t\t\t3 => \n\t\t\tarray (\n\t\t\t\t'id' => 4,\n\t\t\t\t'name' => 'Travel',\n\t\t\t\t'order' => 3,\n\t\t\t\t'created_at' => NULL,\n\t\t\t\t'updated_at' => '2015-04-23 12:22:14',\n\t\t\t\t'deleted_at' => NULL,\n\t\t\t),\n\t\t\t4 => \n\t\t\tarray (\n\t\t\t\t'id' => 5,\n\t\t\t\t'name' => 'all',\n\t\t\t\t'order' => 5,\n\t\t\t\t'created_at' => NULL,\n\t\t\t\t'updated_at' => NULL,\n\t\t\t\t'deleted_at' => NULL,\n\t\t\t),\n\t\t));\n\t}",
"public function run()\n {\n //\n DB::table('grupos')->insert(['nombre' => 'A',\n 'descripcion' => 'Group A',\n 'id_evento' => 1,\n 'created_at' => Carbon::now()->format('Y-m-d H:i:s'),\n 'updated_at' => Carbon::now()->format('Y-m-d H:i:s')]);\n DB::table('grupos')->insert(['nombre' => 'B',\n 'descripcion' => 'Group B',\n 'id_evento' => 1,\n 'created_at' => Carbon::now()->format('Y-m-d H:i:s'),\n 'updated_at' => Carbon::now()->format('Y-m-d H:i:s')]);\n DB::table('grupos')->insert(['nombre' => 'C',\n 'descripcion' => 'Group C',\n 'id_evento' => 1,\n 'created_at' => Carbon::now()->format('Y-m-d H:i:s'),\n 'updated_at' => Carbon::now()->format('Y-m-d H:i:s')]);\n DB::table('grupos')->insert(['nombre' => 'D',\n 'descripcion' => 'Group D',\n 'id_evento' => 1,\n 'created_at' => Carbon::now()->format('Y-m-d H:i:s'),\n 'updated_at' => Carbon::now()->format('Y-m-d H:i:s')]);\n DB::table('grupos')->insert(['nombre' => 'E',\n 'descripcion' => 'Group E',\n 'id_evento' => 1,\n 'created_at' => Carbon::now()->format('Y-m-d H:i:s'),\n 'updated_at' => Carbon::now()->format('Y-m-d H:i:s')]);\n DB::table('grupos')->insert(['nombre' => 'F',\n 'descripcion' => 'Group F',\n 'id_evento' => 1,\n 'created_at' => Carbon::now()->format('Y-m-d H:i:s'),\n 'updated_at' => Carbon::now()->format('Y-m-d H:i:s')]);\n DB::table('grupos')->insert(['nombre' => 'G',\n 'descripcion' => 'Group G',\n 'id_evento' => 1,\n 'created_at' => Carbon::now()->format('Y-m-d H:i:s'),\n 'updated_at' => Carbon::now()->format('Y-m-d H:i:s')]);\n DB::table('grupos')->insert(['nombre' => 'H',\n 'descripcion' => 'Group H',\n 'id_evento' => 1,\n 'created_at' => Carbon::now()->format('Y-m-d H:i:s'),\n 'updated_at' => Carbon::now()->format('Y-m-d H:i:s')]);\n DB::table('grupos')->insert(['nombre' => 'N/D',\n 'descripcion' => 'N/D',\n 'id_evento' => 1,\n 'created_at' => Carbon::now()->format('Y-m-d H:i:s'),\n 'updated_at' => Carbon::now()->format('Y-m-d H:i:s')]);\n\n }",
"public static function importGroups() {\n $validation = self::validateGroups();\n $error = $validation['error'];\n\n if (strlen($validation['comment']) == 0) {\n self::deleteDocumentGroupTable();\n foreach (array_keys($validation['data']) as $key) {\n $name = $key;\n try {\n self::$em = self::createNewEntityManager();\n self::insertDocumentGroups($name);\n } catch (Exception $e) {\n $error .= $e->getMessage();\n break;\n }\n }\n }\n\n return array(\n 'data' => $validation['data'],\n 'comment' => $validation['comment'],\n 'duplicates' => $validation['duplicates'],\n 'error' => $error\n );\n }",
"public function run()\n {\n //\n RefPurchaseGroup::truncate();\n DB::statement('ALTER SEQUENCE ref_purchase_groups_id_seq RESTART WITH 1');\n\n $data = [\n [\n 'group_code' => '101',\n 'description' => 'Mechanical',\n ], [\n 'group_code' => '102',\n 'description' => 'Civil & Structure',\n ], [\n 'group_code' => '103',\n 'description' => 'Elec, Inst & Telco',\n ], [\n 'group_code' => '104',\n 'description' => 'Consumable/General',\n ], [\n 'group_code' => '105',\n 'description' => 'Piping',\n ], [\n 'group_code' => '106',\n 'description' => 'Pipeline/Subsea',\n ], [\n 'group_code' => '107',\n 'description' => 'Mrne & Vsl Chrtr',\n ], [\n 'group_code' => '108',\n 'description' => 'Lgstc & Formlt',\n ], [\n 'group_code' => '109',\n 'description' => 'Crw,Formlt,MCU&Trn',\n ], [\n 'group_code' => '110',\n 'description' => 'Mrne Formlt&Agcy S',\n ], [\n 'group_code' => '111',\n 'description' => 'Onsh Prj Serv',\n ], [\n 'group_code' => '112',\n 'description' => 'Offsh Prj Serv',\n ], [\n 'group_code' => '113',\n 'description' => 'Corporate Service',\n ]\n ];\n RefPurchaseGroup::insert($data); // Eloquent approach\n }",
"public function run()\n {\n DB::table('grupos')->insert(['id' => 1, \n 'nombre' => 'SB141A',\n 'id_programa' => 1,\n 'id_jornada_academica' => 1,\n 'id_sede' => 2]);\n DB::table('grupos')->insert(['id' => 2, \n 'nombre' => 'SB141B',\n 'id_programa' => 1,\n 'id_jornada_academica' => 1,\n 'id_sede' => 2]);\n DB::table('grupos')->insert(['id' => 3, \n 'nombre' => 'SB141C',\n 'id_programa' => 1,\n 'id_jornada_academica' => 2,\n 'id_sede' => 2]);\n DB::table('grupos')->insert(['id' => 4, \n 'nombre' => 'SB241',\n 'id_programa' => 1,\n 'id_jornada_academica' => 2,\n 'id_sede' => 2]);\n DB::table('grupos')->insert(['id' => 5, \n 'nombre' => 'S241A',\n 'id_programa' => 1,\n 'id_jornada_academica' => 1,\n 'id_sede' => 2]);\n DB::table('grupos')->insert(['id' => 6, \n 'nombre' => 'S241B',\n 'id_programa' => 1,\n 'id_jornada_academica' => 1,\n 'id_sede' => 2]);\n DB::table('grupos')->insert(['id' => 7, \n 'nombre' => 'S341',\n 'id_programa' => 1,\n 'id_jornada_academica' => 1,\n 'id_sede' => 2]);\n DB::table('grupos')->insert(['id' => 8,\n 'nombre' => 'S441',\n 'id_programa' => 1,\n 'id_jornada_academica' => 1,\n 'id_sede' => 2]);\n DB::table('grupos')->insert(['id' => 9,\n 'nombre' => 'S541',\n 'id_programa' => 1,\n 'id_jornada_academica' => 1,\n 'id_sede' => 2]);\n DB::table('grupos')->insert(['id' => 10,\n 'nombre' => 'S641',\n 'id_programa' => 1,\n 'id_jornada_academica' => 1,\n 'id_sede' => 2]);\n DB::table('grupos')->insert(['id' => 11,\n 'nombre' => 'S741',\n 'id_programa' => 1,\n 'id_jornada_academica' => 1,\n 'id_sede' => 2]);\n DB::table('grupos')->insert(['id' => 12,\n 'nombre' => 'S841',\n 'id_programa' => 1,\n 'id_jornada_academica' => 1,\n 'id_sede' => 2]);\n DB::table('grupos')->insert(['id' => 13,\n 'nombre' => 'S941',\n 'id_programa' => 1,\n 'id_jornada_academica' => 1,\n 'id_sede' => 2]);\n DB::table('grupos')->insert(['id' => 14,\n 'nombre' => 'S941',\n 'id_programa' => 1,\n 'id_jornada_academica' => 1,\n 'id_sede' => 2]);\n DB::table('grupos')->insert(['id' => 15,\n 'nombre' => 'S1041',\n 'id_programa' => 1,\n 'id_jornada_academica' => 1,\n 'id_sede' => 2]);\n }",
"public function run()\n {\n $groups = [\n '5Mb_group100',\n '10Mb_group102',\n 'Disabled103',\n 'Expired104',\n ];\n foreach ($groups as $group) {\n DB::table('groups')\n ->insert([\n 'groupname' => $group,\n 'created_at' =>\\Carbon\\Carbon::now(),\n 'updated_at' =>\\Carbon\\Carbon::now()\n ]);\n }\n\n }",
"public function fillarrElements()\r\n\t\t\t{ $this->arrElements=[];\r\n\t\t\t\t //we need element only for our group\r\n\t\t\t\t \r\n\t\t\t\t $this->BottomArrCurSection[]=intval((trim($this->section)));\r\n\t\t\t\t \r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t $elements = Element::find()\r\n\t\t\t\t ->where(['idp' =>$this->BottomArrCurSection ,'issection' =>false, 'active'=>1 ]) \r\n\t\t\t\t ->orderBy(\"name\")\t\t\t\t\r\n\t\t\t\t ->offset( intval( $this->page*$this->elementPerPage))\r\n\t\t\t\t ->limit(intval($this->elementPerPage))\r\n\t\t\t\t //->where(['idp' =>ltrim( $startCode )])\r\n\t\t\t\t ->all();\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t \r\n\t\t\t\t\r\n\t\t\t\tforeach($elements as $element){\r\n\t\t\t\t\t$idArray=Array();\r\n\t\t\t\t\t\t\t//echo $element->id;\r\n\t\t\t\t\t\t\r\n //we do not make the tree in this function\r\n\t\t\t\t\t\t// echo 'ffff <br>';\r\n\t\t\t\t\t\t$idArray[ 'id']= $element->id;\r\n\t\t\t\t\t\t$idArray[ 'name']= $element->name;\r\n\t\t\t\t\t\t$idArray[ 'index1']= $element->index1;\r\n\t\t\t\t\t\t$idArray[ 'index2']= $element->index2;\r\n\t\t\t\t\t\t$idArray[ 'idp']= $element->idp;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t$this->arrElements[]=$idArray;\r\n\t\t\t\t};\r\n\t\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\t\r\n\t\t\t}",
"public function run()\n {\n DB::table('permission_groups')->delete();\n $today = date('Y-m-d H:i:s');\n\n $objs = array(\n ['id' => '1', 'name' => 'Reports', 'group_code' => '001', 'level' => '1', 'parent_id' => '0', 'status' => '1', 'created_by' => '1', 'updated_by' => '1', 'created_by' => 1, 'created_at' => $today],\n ['id' => '2', 'name' => 'Sale Summary Report', 'group_code' => '001', 'level' => '2', 'parent_id' => '1', 'status' => '1', 'created_by' => '1', 'updated_by' => '1', 'created_by' => 1, 'created_at' => $today],\n ['id' => '3', 'name' => 'Site Setup', 'group_code' => '002', 'level' => '1', 'parent_id' => '0', 'status' => '1', 'created_by' => '1', 'updated_by' => '1', 'created_by' => 1, 'created_at' => $today],\n ['id' => '4', 'name' => 'Role', 'group_code' => '002', 'level' => '2', 'parent_id' => '3', 'status' => '1', 'created_by' => '1', 'updated_by' => '1', 'created_by' => 1, 'created_at' => $today],\n ['id' => '5', 'name' => 'Permission', 'group_code' => '002', 'level' => '2', 'parent_id' => '3', 'status' => '1', 'created_by' => '1', 'updated_by' => '1', 'created_by' => 1, 'created_at' => $today],\n ['id' => '6', 'name' => 'Staff', 'group_code' => '002', 'level' => '2', 'parent_id' => '3', 'status' => '1', 'created_by' => '1', 'updated_by' => '1', 'created_by' => 1, 'created_at' => $today],\n ['id' => '7', 'name' => 'Site Config', 'group_code' => '002', 'level' => '2', 'parent_id' => '3', 'status' => '1', 'created_by' => '1', 'updated_by' => '1', 'created_by' => 1, 'created_at' => $today],\n ['id' => '8', 'name' => 'Area', 'group_code' => '003', 'level' => '1', 'parent_id' => '0', 'status' => '1', 'created_by' => '1', 'updated_by' => '1', 'created_by' => 1, 'created_at' => $today],\n ['id' => '9', 'name' => 'Country', 'group_code' => '003', 'level' => '2', 'parent_id' => '8', 'status' => '1', 'created_by' => '1', 'updated_by' => '1', 'created_by' => 1, 'created_at' => $today],\n ['id' => '10', 'name' => 'City', 'group_code' => '003', 'level' => '2', 'parent_id' => '8', 'status' => '1', 'created_by' => '1', 'updated_by' => '1', 'created_by' => 1, 'created_at' => $today],\n ['id' => '11', 'name' => 'Township', 'group_code' => '003', 'level' => '2', 'parent_id' => '8', 'status' => '1', 'created_by' => '1', 'updated_by' => '1', 'created_by' => 1, 'created_at' => $today],\n );\n DB::table('permission_groups')->insert($objs);\n\n }",
"function add() {\n $this->set('groups', $this->Group->find('all'));\n if (!empty($this->data)) {\n if ($this->Group->save($this->data)) {\n $this->Session->setFlash('The group has been saved.');\n } else {\n $this->Session->setFlash('Failed saving the group.');\n }\n }\n }",
"public static function getAll(){\n $conn = DataManager::getInstance()->getConnection();\n if(!$conn || $conn->connect_error) exit();\n $statement = $conn->prepare('SELECT `id` FROM `groups` WHERE 1');\n if(!$statement || !$statement->execute()) exit();\n $result_set = $statement->get_result();\n $group_ids = array();\n while($row = $result_set->fetch_assoc()){\n array_push($group_ids, $row['id']);\n }\n $output = array();\n foreach($group_ids as $id){\n array_push($output, self::fromId($id));\n }\n return $output;\n }"
]
| [
"0.699877",
"0.68180984",
"0.669832",
"0.6545684",
"0.6545394",
"0.64563257",
"0.63628787",
"0.6347619",
"0.6304524",
"0.6304524",
"0.61291844",
"0.6095662",
"0.60956174",
"0.59995973",
"0.5989722",
"0.59783983",
"0.59105325",
"0.589611",
"0.58927",
"0.5882657",
"0.5872308",
"0.586275",
"0.58238614",
"0.580914",
"0.580151",
"0.5761543",
"0.5758578",
"0.57546735",
"0.5751487",
"0.5749692"
]
| 0.74067 | 0 |
Sort rows by groups | function doSortByGroup(&$rowInfo)
{
if ($this->sortByGroup!==false)
{
$this->DPOrderUsers($rowInfo);
// apply pagination
$firstindex=$this->pageSize*($this->myPage-1);
for($i=0;$i<$firstindex;$i++)
array_shift($rowInfo);
if(count($rowInfo)>$this->pageSize)
array_splice($rowInfo,$this->pageSize,0);
$this->recNo=1;
for($i=0;$i<count($rowInfo);$i++)
{
$rowInfo[$i]["usercheckbox_attrs"].= " rowid=".$this->recNo;
for($j=0;$j<count($rowInfo[$i]["usergroup_boxes"]["data"]);$j++)
{
$rowInfo[$i]["usergroup_boxes"]["data"][$j]["groupbox_attrs"]="name=\"cb_"
.$this->recNo."[]\" value=\""
.$rowInfo[$i]["usergroup_boxes"]["data"][$j]["group"]."\"";
if($rowInfo[$i]["usergroup_boxes"]["data"][$j]["checked"])
$rowInfo[$i]["usergroup_boxes"]["data"][$j]["groupbox_attrs"].=" checked";
}
$this->recNo++;
}
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function sortbygroup($col,$groupby) {\n $unique = array();\n $sorted = array();\n foreach ($col as $val) { //get all the unique values\n if (!in_array($val[$groupby],$unique)) {\n $unique[] = $val[$groupby];\n } \n }\n \n foreach($unique as $key) {\n foreach($col as $val) {//reads off the collection\n if($key == $val[$groupby]) {\n $sorted[] = $val;\n }\n }\n }\n return $sorted;\n}",
"public static function _prepareSortable() {\n $data = [];\n $sortableGroupField = static::getSortableGroupField();\n $sortableField = static::getSortableField();\n foreach(static::all() as $row) {\n $keyParts = [];\n foreach ($sortableGroupField as $sgf) {\n $keyParts[] = $row->{$sortableGroupField};\n }\n $key = implode('_',$keyParts);\n if ($sortableGroupField) {\n $data[$key][] = $row;\n } else {\n $data[0][$row];\n }\n }\n\n foreach ($data as $group => $groupData ) {\n $i = 0;\n foreach ($groupData as $row) {\n $row->{$sortableField} = ++$i;\n $row->save();\n echo sprintf(\"row %d was orderer<br>\\n\",$row->id);\n }\n }\n }",
"protected function sortDataArray() {}",
"function sortGroups(&$smartyGroups) \n\t{\n\t\t//\t\tassign sort links\n\t\tforeach($this->groups as $i=>$g)\n\t\t{\n\t\t\tif($this->sortByGroup==$g[0] && $this->sortOrder==\"a\")\n\t\t\t{\n\t\t\t\t$smartyGroups[$i][\"groupheaderlink_attrs\"]=\"href=\\\"\".$this->tName.\"_list.php?orderby=d\".$g[0].\"\\\"\";\n\t\t\t\tif($this->is508)\n\t\t\t\t\t$smartyGroups[$i][\"groupheader_img\"] = \"<img src=\\\"images/up.gif\\\" alt=\\\" \\\" border=0>\";\n\t\t\t\telse\n\t\t\t\t\t$smartyGroups[$i][\"groupheader_img\"] = \"<img src=\\\"images/up.gif\\\" border=0>\";\n\t\t\t}\n\t\t\telseif($this->sortByGroup==$g[0] && $this->sortOrder==\"d\")\n\t\t\t{\t\t\t\t\n\t\t\t\tif($this->is508)\n\t\t\t\t\t$smartyGroups[$i][\"groupheader_img\"] = \"<img src=\\\"images/down.gif\\\" alt=\\\" \\\" border=0>\";\n\t\t\t\telse\n\t\t\t\t\t$smartyGroups[$i][\"groupheader_img\"] = \"<img src=\\\"images/down.gif\\\" border=0>\";\n\t\t\t}\n\t\t\t\t\n\t\t}\n\t}",
"public function sortGroups($groups)\n {\n DB::transaction(function () use ($groups) {\n $this->sortedAttributeGroups = $this->attributeGroups->map(function ($group) use ($groups) {\n $updatedOrder = collect($groups['items'])->first(function ($updated) use ($group) {\n return $updated['id'] == $group->id;\n });\n $group->position = $updatedOrder['order'];\n $group->save();\n\n return $group;\n })->sortBy('position');\n });\n $this->notify(\n __('adminhub::notifications.attribute-groups.reordered')\n );\n }",
"public function providerSortByWithGroupBy() {\n return array(\n array('name','ASC','item-01'),\n array('name','DESC','item-39'),\n );\n }",
"public function sort();",
"public function testBasicTestGroupSort()\n {\n $sampleTestArray = [\n 'test1' => 100,\n 'test2' => 300,\n 'test3' => 50,\n 'test4' => 60,\n 'test5' => 25,\n 'test6' => 125,\n 'test7' => 250,\n 'test8' => 1,\n 'test9' => 80,\n 'test10' => 25\n ];\n\n $expectedResult = [\n 1 => ['test2'],\n 2 => ['test7'],\n 3 => ['test6', 'test4', 'test8'],\n 4 => ['test1', 'test9'],\n 5 => ['test3', 'test5', 'test10']\n ];\n\n $testSorter = new ParallelGroupSorter();\n $actualResult = $testSorter->getTestsGroupedBySize([], $sampleTestArray, 200);\n\n $this->assertCount(5, $actualResult);\n\n foreach ($actualResult as $gropuNumber => $actualTests) {\n $expectedTests = $expectedResult[$gropuNumber];\n $this->assertEquals($expectedTests, array_keys($actualTests));\n }\n }",
"public function asort() {}",
"public function testComplexDifferentOrder()\n {\n $groupTable = Centurion_Db::getSingleton('auth/group');\n\n //Two order, first asc, the second one desc\n $select = $groupTable->select()->where('name like(\\'test_%\\')')->order('name asc')->order('id desc');\n\n //We get the first one\n $groupRow = $select->fetchRow();\n $data = array();\n while (null !== $groupRow) {\n $data[] = $groupRow->id;\n //We iterate by using getNextBy on each $group;\n $groupRow = $groupRow->getNextBy('name', null, $select);\n }\n\n $expected = array(\n '10', '12', '11', '13'\n );\n\n $this->assertEquals($expected, $data);\n }",
"public function sortStrategy();",
"function add_buildgroup_sortlist($groupname)\n{\n // This information can be provided as a query string, otherwise we apply\n // some default ordering here. Default sort ordering for a group is based\n // on the groupname.\n //\n // Sort settings should probably be definable/overrideable by the user as wel\n // on the users page, or perhaps by the project admin on the project page.\n //\n $st = '';\n $xml = '';\n\n if(isset($_GET[\"sort\"]))\n {\n $xml .= add_XML_value(\"sortlist\", \"{sortlist: \" . $_GET[\"sort\"] . \"}\");\n return $xml;\n }\n\n $gn = strtolower($groupname);\n\n if (strpos($gn, 'nightly') !== FALSE)\n {\n $st = 'SortAsNightly';\n }\n else if ((strpos($gn, 'continuous') !== FALSE) || (strpos($gn, 'experimental') !== FALSE))\n {\n $st = 'SortByTime';\n }\n\n switch($st)\n {\n case 'SortAsNightly':\n $xml .= add_XML_value(\"sortlist\", \"{sortlist: [[4,1],[7,1],[11,1],[10,1],[5,1],[8,1]]}\");\n // Theoretically, most important to least important:\n // configure errors DESC, build errors DESC, tests failed DESC, tests not run DESC,\n // configure warnings DESC, build warnings DESC\n break;\n\n case 'SortByTime':\n $xml .= add_XML_value(\"sortlist\", \"{sortlist: [[14,1]]}\");\n // build time DESC\n break;\n\n // By default, no javascript-based sorting. Accept the ordering naturally as it came from\n // MySQL and the php processing code...\n }\n\n return $xml;\n}",
"protected function applySorting()\n\t{\n\t\t$i = 1;\n\t\tparse_str($this->order, $list);\n\t\tforeach ($list as $field => $dir) {\n\t\t\t$this->dataSource->sort($field, $dir === 'a' ? IDataSource::ASCENDING : IDataSource::DESCENDING);\n\t\t\t$list[$field] = array($dir, $i++);\n\t\t}\n\t\treturn $list;\n\t}",
"public function testComplexSameOrder()\n {\n $groupTable = Centurion_Db::getSingleton('auth/group');\n\n //Two order both asc\n $select = $groupTable->select()->where('name like(\\'test_%\\')')->order('name asc')->order('id asc');\n\n //We get the first one\n $groupRow = $select->fetchRow();\n $data = array();\n\n while (null !== $groupRow) {\n $data[] = $groupRow->id;\n //We iterate by using getNextBy on each $group;\n $groupRow = $groupRow->getNextBy('name', null, $select);\n }\n\n $expected = array(\n '10', '11', '12', '13'\n );\n\n $this->assertEquals($expected, $data);\n }",
"public function getSorting();",
"abstract public function prepareSort();",
"function group_membership_sort_fields($hook, $type, $return, $params) {\n\n\t$page_owner = elgg_get_page_owner_entity();\n\tif (!$page_owner instanceof ElggGroup) {\n\t\treturn;\n\t}\n\n\treturn array(\n\t\t'alpha::asc',\n\t\t'alpha::desc',\n\t\t'group_rel::desc',\n\t\t'group_rel::asc',\n\t);\n}",
"public function sortArraysByKeyCheckIfSortingIsCorrectDataProvider() {}",
"function MyMod_Sort_Detect($group=\"\")\n {\n $sort=\"\";\n $reverse=$this->Reverse;\n\n if ($this->CGI_VarValue($this->ModuleName.\"_Sort\")!=\"\")\n {\n $sort=$this->CGI_VarValue($this->ModuleName.\"_Sort\");\n $reverse=$this->CGI_VarValue($this->ModuleName.\"_Reverse\");\n }\n\n if ($sort==\"\" && $group!=\"\")\n {\n if (!empty($this->ItemDataGroups[ $group ][ \"Sort\" ]))\n {\n $sort=$this->ItemDataGroups[ $group ][ \"Sort\" ];\n $reverse=$this->ItemDataGroups[ $group ][ \"Reverse\" ];\n }\n }\n\n if ($sort) { $this->MyMod_Sort_Add($sort); }\n\n $this->Reverse=$reverse;\n\n return array($sort,$reverse);\n }",
"abstract protected function _buildGroupBy( $group );",
"public function groupBy(array $fields, $order = null);",
"public function reorderShowGroup(string $group, array $keys): void;",
"public function testSortByWithGroupBy($sort,$dir,$nameOfFirst) {\n \tif (!empty(xPDOTestHarness::$debug)) print \"\\n\" . __METHOD__ . \" = \";\n try {\n $criteria = $this->xpdo->newQuery('Item');\n $criteria->groupby(\"{$sort},id,color\");\n $criteria->sortby($this->xpdo->escape($sort),$dir);\n $criteria->sortby($this->xpdo->escape('id'),'ASC');\n $criteria->sortby($this->xpdo->escape('color'),'ASC');\n $result = $this->xpdo->getCollection('Item',$criteria);\n if (is_array($result) && !empty($result)) {\n $match = null;\n foreach ($result as $r) { $match = $r; break; }\n $name = $match->get('name');\n $this->assertEquals($nameOfFirst,$name,'xPDOQuery: SortBy did not return expected result, returned `'.$name.'` instead.');\n } else {\n throw new Exception('xPDOQuery: SortBy test with groupby call did not return an array');\n }\n } catch (Exception $e) {\n $this->assertTrue(false,$e->getMessage());\n }\n }",
"private function sortQueryOrders() {\n foreach ($this->queryResult as $index => $order) {\n $order = $this->injectKitData($order);\n $this->statusOutputOrder[$order['Order']['status']][$order['Order']['id']] = $order;\n }\n }",
"public function getSortOrder();",
"public function getSortOrder();",
"public function getSortOrder();",
"function groupByKey($arr, $key){\n\t$groupeItmes = array();\n\tforeach ( $arr as $row ) {\n\t\t$groupeItmes[$row[$key]][] = $row;\n\t}\n\n\t$finalData = array();\n\tforeach ( $groupeItmes as $row ) {\n\t\t$finalData[] = array($key => $row[0][$key], 'items' => $row );\n\t}\n\n\tusort($finalData, sortByOrder($key));\n\n\treturn $finalData;\n}",
"function theme_moove_order_courses_by_shortname(&$array_courses){\n\n $grouped_courses_array = array();\n $regular_courses_array = array();\n $no_regular_courses_array = array();\n $counter = 0;\n\n foreach($array_courses as $key=>&$course){\n\n $idcourse = $course->id;\n $timecreated = $this->theme_moove_get_timecreated_course($idcourse);\n $timemodified = $this->theme_moove_get_timemodified_course($idcourse);\n $categoryid = $this->theme_moove_get_course_category($idcourse);\n\n $course->timecreated = $timecreated;\n $course->timemodified = $timemodified;\n $course->categoryid = $categoryid;\n\n // Validación para cursos regulares\n if($course->categoryid >= 30001 && $course->categoryid <= 30999){\n\n array_push($regular_courses_array, $course);\n\n $explode_course_shortname = explode(\"-\", $course->shortname);\n\n // Se verifica que tenga en su nombre corto la especificación de fecha de creación\n // una vez identificada se le añade como atributo al curso\n if(count($explode_course_shortname) && preg_match(\"/^20/\", $explode_course_shortname[3])){\n $date_course = substr($explode_course_shortname[3], 0, -3);\n $course->date_course = $date_course;\n }\n\n }else{\n // Cursos no regulares\n array_push($no_regular_courses_array, $course);\n }\n }\n\n $this->array_sort_by($regular_courses_array, 'timecreated', $order = SORT_DESC);\n $this->array_sort_by($no_regular_courses_array, 'timecreated', $order = SORT_DESC);\n\n $grouped_courses_array['regular_courses'] = $regular_courses_array;\n $grouped_courses_array['no_regular_courses'] = $no_regular_courses_array;\n\n return $grouped_courses_array;\n }",
"function adleex_resource_list_column_sort($cols) {\nglobal $current_screen;\n\t\n\tif ($current_screen->post_type!='resource') return $cols;\n\n\t$order = array(\n 'post_title' => true, );\n\tforeach($order\tas $k => $v) $cols[$k]=true;\n\treturn $cols;\n}"
]
| [
"0.7277136",
"0.63317204",
"0.61603296",
"0.61170053",
"0.60967094",
"0.60207325",
"0.6004537",
"0.6000417",
"0.5940128",
"0.59272116",
"0.5854101",
"0.5689667",
"0.5616957",
"0.55312103",
"0.5512167",
"0.54556215",
"0.5423618",
"0.54202884",
"0.5408487",
"0.5398429",
"0.5362079",
"0.52991253",
"0.52899456",
"0.5279708",
"0.52669483",
"0.52669483",
"0.52669483",
"0.524353",
"0.52406543",
"0.5220584"
]
| 0.6480533 | 1 |
show page at the end of its proccess, depending on mode | function showPage()
{
$this->xt->display($this->templatefile);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function endPage() {}",
"function _endpage()\n\t\t{\n\t\t\t$this->state=1;\n\t\t}",
"public function show() {\n $this->buildPage();\n echo $this->_page;\n }",
"function show_panel()\n\t{\n\t\tglobal $errors, $template;\n\t\t\n\t\t// get the mode\n\t\t$s = ( isset( $_GET[ 's' ] ) ) ? strval( $_GET[ 's' ] ) : '';\n\t\t\n\t\t// fire the template\n\t\t$template->assign_files( array(\n\t\t\t'ACP_advance' => 'ACP/advance' . tplEx\n\t\t) );\n\t\t\n\t\t// act upon it\n\t\tswitch( $s )\n\t\t{\n\t\t\tcase 'settings':\n\t\t\t\t$this->settings();\n\t\t\t\tbreak;\n\t\t\tcase 'settings_real':\n\t\t\t\t$this->settings_real();\n\t\t\t\tbreak;\n\t\t\tcase 'browser':\n\t\t\t\t$this->browser();\n\t\t\t\tbreak;\n\t\t\tcase 'clearcache':\n\t\t\t\t$this->clearcache();\n\t\t\t\tbreak;\n\t\t\tcase 'console':\n\t\t\t\t$this->console();\n\t\t\t\tbreak;\n\t\t\tcase 'key':\n\t\t\t\t$this->key();\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t$errors->report_error( $this->lang[ 'Wrong_mode' ], CRITICAL_ERROR );\n\t\t\t\tbreak;\n\t\t}\n\t}",
"public static function outputPage() {\n\t\tself::phpSetup();\n\t\t// Set the session\n global $clsession;\n $clsession =new SessionV4;\n //--------------------------------------------------------------\n // Exit if the web is closed for maintenance except\n // when the user is the master\n if( self::ISCLOSED && $_SESSION['usr'] != 'master' )\n exit(pageMaintenance::show());\n # --------------------------------------------------------------\n \t# Show the parameters entered with the request\n self::see();\n\t\tif( self::SEEPHPINFO ) phpinfo();\n\t\t# --------------------------------------------------------------\n\t\t# Reset the session if requested\n\t\tif( isset($_POST['reset']) && $_POST['reset'] == 'XRESET')\n\t\t\t$clsession->logout(sessionV4::NOACT);\n # --------------------------------------------------------------\n\t\t# Open the main class of the system\n\t\trequire_once('main.php');\n $clmain=new main;\n $s=$clmain->execute();\n $shses=(singleton::SHOWSESSION ? $clsession->getSession() : '');\n\t\treturn $s.$shses;\n\t}",
"function showPage($db) {\n $this->user_info($db);\n $this->log_visitor($db,$_SERVER['PHP_SELF'],0);\n $this->showPage=true;\n }",
"public function getPageMode() {}",
"function show_after_running_page()\n\t\t{\n\t\t\t$this->t->set_file('after_running', 'after_running.tpl');\n\t\t\t\n\t\t\t//prepare the links form\n\t\t\t$link_data_proc = array(\n\t\t\t\t'menuaction'\t\t=> 'workflow.ui_userinstances.form',\n\t\t\t\t'filter_process'\t=> $this->process_id,\n\t\t\t);\n\t\t\t$link_data_inst = array(\n\t\t\t\t'menuaction'\t\t=> 'workflow.ui_userinstances.form',\n\t\t\t\t'filter_instance'\t=> $this->instance_id,\n\t\t\t);\n\t\t\tif ($this->activity_type == 'start')\n\t\t\t{\n\t\t\t\t$activitytxt = lang('get back to instance creation');\n\t\t\t\t$act_button_name = lang('New instance');\n\t\t\t\t$link_data_act = array(\n\t\t\t\t\t'menuaction'\t\t=> 'workflow.ui_useropeninstance.form',\n\t\t\t\t);\n\t\t\t}\n\t\t\telseif ($this->activity_type == 'standalone')\n\t\t\t{\n\t\t\t\t$activitytxt = lang('get back to global activities');\n\t\t\t\t$act_button_name = lang('Global activities');\n\t\t\t\t$link_data_act = array(\n\t\t\t\t\t'menuaction'\t\t=> 'workflow.ui_useractivities.form',\n\t\t\t\t\t'show_globals'\t\t=> true,\n\t\t\t\t);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$activitytxt = lang('go to same activities for other instances of this process');\n\t\t\t\t$act_button_name = lang('activity %1', $this->activity_name);\n\t\t\t\t$link_data_act = array(\n\t\t\t\t\t'menuaction'\t\t=> 'workflow.ui_userinstances.form',\n\t\t\t\t\t'filter_process' => $this->process_id,\n\t\t\t\t\t'filter_activity_name'\t=> $this->activity_name,\n\t\t\t\t);\n\t\t\t}\n\t\t\t$button='<img src=\"'. $GLOBALS['egw']->common->image('workflow', 'next')\n\t\t\t\t.'\" alt=\"'.lang('go').'\" title=\"'.lang('go').'\" width=\"16\" >';\n\t\t\t$this->t->set_var(array(\n\t\t\t\t'same_instance_text'\t=> ($this->activity_type=='standalone')? '-' : lang('go to the actual state of this instance'),\n\t\t\t\t'same_activities_text'\t=> $activitytxt,\n\t\t\t\t'same_process_text'\t=> lang('go to same process activities'),\n\t\t\t\t'same_instance_button'\t=> ($this->activity_type=='standalone')? '-' : '<a href=\"'.$GLOBALS['egw']->link('/index.php',$link_data_inst).'\">'\n\t\t\t\t\t.$button.lang('instance %1', ($this->instance_name=='')? $this->instance_id: $this->instance_name).'</a>',\n\t\t\t\t'same_activities_button'=> '<a href=\"'.$GLOBALS['egw']->link('/index.php',$link_data_act).'\">'\n\t\t\t\t\t.$button.$act_button_name.'</a>',\n\t\t\t\t'same_process_button'\t=> '<a href=\"'.$GLOBALS['egw']->link('/index.php',$link_data_proc).'\">'\n\t\t\t\t\t.$button.lang('process %1', $this->process_name).'</a>',\n\t\t\t));\n\t\t\t$this->translate_template('after_running');\n\t\t\t$this->t->pparse('output', 'after_running');\n\t\t\t$GLOBALS['egw']->common->egw_footer();\n\t\t}",
"public function displayPage()\n {\n $this->getState()->template = 'displaygroup-page';\n }",
"public function displayPage()\n\t{\n\t\t$this->assign('rightMenu', $this->rightMenu);\n\t\t$this->assign('content', $this->content);\n\t\t$this->display(\"main.tpl\");\n\t}",
"function displayPage()\n {\n $this->getState()->template = 'transition-page';\n }",
"protected function show_contents()\n\t\t{\n\t\t\t//echo(\"<a href='javascript:setTimeout(window.location.href=\\\"\". $_SERVER['PHP_SELF']. \"?\". $this->paramname. \"=\". $this->menuvalue. \"\\\",5000);'>\". $this->menutext. \"</a>\");\n\t\t\techo(\"<a href='javascript:openhelp(\\\"helppage.php?context=\". (isset($_GET['Page']) ? $_GET['Page'] : \"\"). \"\\\")'>\". $this->menutext. \"</a>\");\t\n\t\t\techo(\"<SCRIPT> function openhelp(aurl) { window.open(aurl,'_blank'); } </SCRIPT>\");\n\t\t}",
"public function startNewPage()\n {\n }",
"public function page () {\n\t\tinclude _APP_ . '/views/pages/' . $this->_reg->controller . '/' . $this->_page . '.phtml';\n\t}",
"function endPage(){\n global $_inContainer, $_pageName, $_loadChosen;\n require('inc/pageend.php');\n}",
"function go()\n {\n $this->session->layout == 'gallery' ? \n $this->data['pagebody'] = 'Roster/rosterGal' : \n $this->data['pagebody'] = 'Roster/rosterTab'; \n $this->render();\n }",
"protected function displayContent() {\r\n\t\t$this -> model -> processLogout();\r\n\t\theader('Location: index.php?page=home');\r\n\t}",
"public function displayPageStart()\n {\n if( isset( $_SERVER[\"HTTP_HOST\"] ) && true === $this->display )\n {\n echo '<pre style=\"font-size: 11px; line-height: 7px;\">';\n }\n }",
"function pageend()\n{\n echo( \"</body>\\n</html>\\n\" );\n}",
"function show_panel()\n\t{\n\t\tglobal $template, $errors, $Cl_root_path;\n\t\t\n\t\t$template->assign_files( array(\n\t\t\t'ACP_pages' => 'ACP/pages' . tplEx\n\t\t) );\n\t\t\n\t\t// get the subsubmode\n\t\t$sub = ( isset( $_GET[ 's' ] ) ) ? strval( $_GET[ 's' ] ) : 'add';\n\t\t\n\t\t\t\n\t\tswitch( $sub )\n\t\t{\n\t\t\tcase 'add':\n\t\t\t\t$this->adding();\n\t\t\t\tbreak;\n\t\t\tcase 'edit':\n\t\t\t\t$this->editting();\n\t\t\t\tbreak;\n\t\t\tcase 'add_bar':\n\t\t\t\t$mode = ( isset( $_POST[ 'MODE' ] ) ) ? strval( $_POST[ 'MODE' ] ) : '';\n\t\t\t\tswitch( $mode )\n\t\t\t\t{\n\t\t\t\t\tcase 'create':\n\t\t\t\t\t\t$this->add_page();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'edit':\n\t\t\t\t\t\t$this->edit_page();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t$errors->report_error( $this->lang[ 'Wrong_form' ], CRITICAL_ERROR );\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'convert':\n\t\t\t\tinclude( $Cl_root_path . 'kernel/config/static_pages' . phpEx );\n\t\t\t\tif ( isset( $pages ) )\n\t\t\t\t{\n\t\t\t\t\t$this->pages_array = $pages;\n\t\t\t\t}\n\t\t\t\t$this->save_pages();\n\t\t\t\t$errors->report_error( $this->lang[ 'Converted' ], MESSAGE );\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t$errors->report_error( $this->lang[ 'Wrong_mode' ], CRITICAL_ERROR );\n\t\t\t\tbreak;\n\t\t}\n\t}",
"function slide_show_splash()\n {\n // Grab the category information\n if( $this->ipsclass->input['cat'] )\n {\n $info = $this->setup_cat();\n }\n else\n {\n $info = $this->setup_album();\n }\n \n // Show the form\n $this->output .= $this->html->ss_form();\n\n $sort = $this->glib->build_sort_order_info( $info['def_view'] );\n\n $this->output = preg_replace( \"/<#SORT_KEY_HTML#>/\", $sort['SORT_KEY_HTML'], $this->output );\n $this->output = preg_replace( \"/<#ORDER_HTML#>/\" , $sort['ORDER_KEY_HTML'], $this->output );\n $this->output = preg_replace( \"/<#PRUNE_HTML#>/\" , $sort['PRUNE_KEY_HTML'], $this->output );\n \n // Page Info\n $this->title = $this->ipsclass->vars['board_name'].$this->ipsclass->lang['sep'].$this->ipsclass->lang['gallery'];\n $this->nav[] = \"<a href='{$this->ipsclass->base_url}act=module&module=gallery'>{$this->ipsclass->lang['gallery']}</a>\";\n $this->nav[] = \"{$this->ipsclass->lang['ss_start']} {$info['name']}\";\n }",
"public function finish_display ()\n {\n $this->_finish_body ();\n?>\n </body>\n</html>\n<?php\n }",
"public function main_options_page(){\n\t\t$page_base = $this->page_url();\n\t\tob_start();\n\t\t?>\n\t\t<div class=\"wp_lms settings\">\n\t\t\t<h1>GrandPubbah</h1>\n\n\t\t</div>\n\t\t<?\n\t\tob_end_flush();\n\t}",
"public function switchPagePanel() {\n\t\t$request = GeneralUtility::_GET('request');\n\t\t$arguments = $request['arguments'];\n\n\t\t$GLOBALS['BE_USER']->uc['tx_versaillesutilities_page_panel'] = $arguments['flag'];\n\t\t$GLOBALS['BE_USER']->overrideUC();\n\t\t$GLOBALS['BE_USER']->writeUC();\n\n\t\techo $GLOBALS['BE_USER']->uc['tx_versaillesutilities_page_panel'];\n\t}",
"public function main()\n {\n $lang = $this->getLanguageService();\n // Access check...\n // The page will show only if there is a valid page and if this page may be viewed by the user\n $access = is_array($this->pageinfo) ? 1 : 0;\n // Content\n $content = '';\n if ($this->id && $access) {\n // Initialize permission settings:\n $this->CALC_PERMS = $this->getBackendUser()->calcPerms($this->pageinfo);\n $this->EDIT_CONTENT = $this->contentIsNotLockedForEditors();\n\n $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($this->pageinfo);\n\n // override the default jumpToUrl\n $this->moduleTemplate->addJavaScriptCode('jumpToUrl', '\n function jumpToUrl(URL,formEl) {\n if (document.editform && TBE_EDITOR.isFormChanged) { // Check if the function exists... (works in all browsers?)\n if (!TBE_EDITOR.isFormChanged()) {\n window.location.href = URL;\n } else if (formEl) {\n if (formEl.type==\"checkbox\") formEl.checked = formEl.checked ? 0 : 1;\n }\n } else {\n window.location.href = URL;\n }\n }\n ');\n $this->moduleTemplate->addJavaScriptCode('mainJsFunctions', '\n if (top.fsMod) {\n top.fsMod.recentIds[\"web\"] = ' . (int)$this->id . ';\n top.fsMod.navFrameHighlightedID[\"web\"] = \"pages' . (int)$this->id . '_\"+top.fsMod.currentBank; ' . (int)$this->id . ';\n }\n ' . ($this->popView ? BackendUtility::viewOnClick($this->id, '', BackendUtility::BEgetRootLine($this->id)) : '') . '\n function deleteRecord(table,id,url) { //\n window.location.href = ' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('tce_db') . '&cmd[')\n . ' + table + \"][\" + id + \"][delete]=1&redirect=\" + encodeURIComponent(url) + \"&prErr=1&uPT=1\";\n return false;\n }\n ');\n\n // Find backend layout / columns\n $backendLayout = GeneralUtility::callUserFunction(BackendLayoutView::class . '->getSelectedBackendLayout', $this->id, $this);\n if (!empty($backendLayout['__colPosList'])) {\n $this->colPosList = implode(',', $backendLayout['__colPosList']);\n }\n // Removing duplicates, if any\n $this->colPosList = array_unique(GeneralUtility::intExplode(',', $this->colPosList));\n // Accessible columns\n if (isset($this->modSharedTSconfig['properties']['colPos_list']) && trim($this->modSharedTSconfig['properties']['colPos_list']) !== '') {\n $this->activeColPosList = array_unique(GeneralUtility::intExplode(',', trim($this->modSharedTSconfig['properties']['colPos_list'])));\n // Match with the list which is present in the colPosList for the current page\n if (!empty($this->colPosList) && !empty($this->activeColPosList)) {\n $this->activeColPosList = array_unique(array_intersect(\n $this->activeColPosList,\n $this->colPosList\n ));\n }\n } else {\n $this->activeColPosList = $this->colPosList;\n }\n $this->activeColPosList = implode(',', $this->activeColPosList);\n $this->colPosList = implode(',', $this->colPosList);\n\n $content .= $this->getHeaderFlashMessagesForCurrentPid();\n\n // Render the primary module content:\n if ($this->MOD_SETTINGS['function'] == 1 || $this->MOD_SETTINGS['function'] == 2) {\n $content .= '<form action=\"' . htmlspecialchars(BackendUtility::getModuleUrl($this->moduleName, ['id' => $this->id, 'imagemode' => $this->imagemode])) . '\" id=\"PageLayoutController\" method=\"post\">';\n // Page title\n $content .= '<h1 class=\"t3js-title-inlineedit\">' . htmlspecialchars($this->getLocalizedPageTitle()) . '</h1>';\n // All other listings\n $content .= $this->renderContent();\n }\n $content .= '</form>';\n $content .= $this->searchContent;\n // Setting up the buttons for the docheader\n $this->makeButtons();\n // @internal: This is an internal hook for compatibility7 only, this hook will be removed without further notice\n if ($this->MOD_SETTINGS['function'] != 1 && $this->MOD_SETTINGS['function'] != 2) {\n $renderActionHook = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::class]['renderActionHook'];\n if (is_array($renderActionHook)) {\n foreach ($renderActionHook as $hook) {\n $params = [\n 'deleteButton' => $this->deleteButton,\n ''\n ];\n $content .= GeneralUtility::callUserFunction($hook, $params, $this);\n }\n }\n }\n // Create LanguageMenu\n $this->makeLanguageMenu();\n } else {\n $this->moduleTemplate->addJavaScriptCode(\n 'mainJsFunctions',\n 'if (top.fsMod) top.fsMod.recentIds[\"web\"] = ' . (int)$this->id . ';'\n );\n $content .= '<h1>' . htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']) . '</h1>';\n $view = GeneralUtility::makeInstance(StandaloneView::class);\n $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Private/Templates/InfoBox.html'));\n $view->assignMultiple([\n 'title' => $lang->getLL('clickAPage_header'),\n 'message' => $lang->getLL('clickAPage_content'),\n 'state' => InfoboxViewHelper::STATE_INFO\n ]);\n $content .= $view->render();\n }\n // Set content\n $this->moduleTemplate->setContent($content);\n }",
"function mainmenu(){\n\t\t\techo(\"No switch. Please specify -p [NewPageName]\");\n\t\t}",
"public function page() {\n\t\t$this->page = $this->plugin->factory->adminPage;\n\t\t$this->page->show();\n\t}",
"function main()\t{\n\t\tglobal $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;\n\n\t\t// Access check!\n\t\t// The page will show only if there is a valid page and if this page may be viewed by the user\n\t\t$this->pageinfo = t3lib_BEfunc::readPageAccess($this->id,$this->perms_clause);\n\t\t$access = is_array($this->pageinfo) ? 1 : 0;\n\n\t\tif (($this->id && $access) || ($BE_USER->user[\"admin\"] && !$this->id))\t{\n\n\t\t\t// Draw the header.\n\t\t\t$this->doc = t3lib_div::makeInstance(\"mediumDoc\");\n\t\t\t$this->doc->backPath = $BACK_PATH;\n\t\t\t$this->doc->form = '<form action=\"\" method=\"post\">';\n\n\t\t\t// JavaScript\n\t\t\t$this->doc->JScode = '\n\t\t\t\t<script language=\"javascript\" type=\"text/javascript\">\n\t\t\t\t\tscript_ended = 0;\n\t\t\t\t\tfunction jumpToUrl(URL) {\n\t\t\t\t\t\tdocument.location = URL;\n\t\t\t\t\t}\n\t\t\t\t</script>\n\t\t\t';\n\t\t\t$this->doc->postCode='\n\t\t\t\t<script language=\"javascript\" type=\"text/javascript\">\n\t\t\t\t\tscript_ended = 1;\n\t\t\t\t\tif (top.fsMod) top.fsMod.recentIds[\"web\"] = ' . intval($this->id) . ';\n\t\t\t\t</script>\n\t\t\t';\n\n\t\t\t$headerSection = $this->doc->getHeader(\"pages\",$this->pageinfo,$this->pageinfo[\"_thePath\"]).\"<br>\".$LANG->sL(\"LLL:EXT:lang/locallang_core.php:labels.path\").\": \".t3lib_div::fixed_lgd_pre($this->pageinfo[\"_thePath\"],50);\n\n\t\t\t$this->content .= $this->doc->startPage($LANG->getLL(\"title\"));\n\t\t\t$this->content .= $this->doc->header($LANG->getLL(\"title\"));\n\t\t\t$this->content .= $this->doc->spacer(5);\n\t\t\t$this->content.=$this->doc->section(\"\",$this->doc->funcMenu($headerSection,t3lib_BEfunc::getFuncMenu($this->id,\"SET[function]\",$this->MOD_SETTINGS[\"function\"],$this->MOD_MENU[\"function\"])));\n\t\t\t$this->content .= $this->doc->divider(5);\n\n\n\t\t\t// Render content:\n\t\t\t$this->moduleContent();\n\n\n\t\t\t// ShortCut\n\t\t\tif ($BE_USER->mayMakeShortcut())\t{\n\t\t\t\t$this->content .= $this->doc->spacer(20).$this->doc->section(\"\",$this->doc->makeShortcutIcon(\"id\",implode(\",\",array_keys($this->MOD_MENU)),$this->MCONF[\"name\"]));\n\t\t\t}\n\n\t\t\t$this->content.=$this->doc->spacer(10);\n\t\t} else {\n\t\t\t// If no access or if ID == zero\n\n\t\t\t$this->doc = t3lib_div::makeInstance(\"mediumDoc\");\n\t\t\t$this->doc->backPath = $BACK_PATH;\n\n\t\t\t$this->content.=$this->doc->startPage($LANG->getLL(\"title\"));\n\t\t\t$this->content.=$this->doc->header($LANG->getLL(\"title\"));\n\t\t\t$this->content.=$this->doc->spacer(5);\n\t\t\t$this->content.=$this->doc->spacer(10);\n\t\t}\n\t}",
"public function renderPage()\r\n {\r\n $this->setMasterContent();\r\n // Echo the page immediately.\r\n $this->_htmlpage->renderPage();\r\n }",
"public function renderPage()\r\n {\r\n $this->setMasterContent();\r\n // Echo the page immediately.\r\n $this->_htmlpage->renderPage();\r\n }"
]
| [
"0.646372",
"0.64264375",
"0.61686623",
"0.6052898",
"0.5991154",
"0.59908134",
"0.59840226",
"0.5971935",
"0.5953765",
"0.59502494",
"0.594355",
"0.592937",
"0.5919857",
"0.5916541",
"0.5906409",
"0.58810574",
"0.58413965",
"0.575019",
"0.57367516",
"0.5735362",
"0.57323486",
"0.5730635",
"0.57070935",
"0.5691757",
"0.5656292",
"0.565233",
"0.56492865",
"0.5623222",
"0.5608257",
"0.5608257"
]
| 0.6577301 | 0 |
Get max Date history. | public function maxDate()
{
$qb = $this->createQueryBuilder('h')->select('h')->orderBy('h.date', 'DESC')->setMaxResults(1);
/** @var AbstractHistory $last */
$last = $qb->getQuery()->getOneOrNullResult();
if (is_null($last)) {
return;
}
return $last->getDate();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getLatestHistory() {\n $history = $this->getHistory();\n if (count($history) === 0) {\n return null;\n }\n return $history[count($history) - 1];\n }",
"public function get_last_date()\n\t{\n\t\treturn \"SELECT MAX(Date) AS recentDate from HistoricalPrices GROUP BY Symbol\";\n\t}",
"public function getMaxFeedDate()\r\n\t\t{\r\n\t\t\t\t$link = $this->connect();\r\n\t\t\t\t$query = \" SELECT max(date_given)\r\n\t\t\t\t\t\t\tFROM feed_transaction\";\r\n\t\t\t\t$result = mysqli_query($link, $query);\r\n\t\t\t\t$f = array();\r\n\t\t\t\t$f_arr = array();\r\n\t\t\t\twhile($row = mysqli_fetch_row($result)){\r\n\t\t\t\t\t$f['fdate'] = $row[0];\r\n\t\t\t\t\t$f_arr[] = $f;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t\r\n\r\n\t\t\t\treturn $f_arr;\r\n\t\t\t\t\r\n\t\t}",
"public function getMaxDateRange()\n {\n return $this->_getBorderDateRange(self::MAX_DATE_RANGE_KEY);\n }",
"public function getMaxDateProperty()\n {\n return Carbon::now()->subDay()->format('Y-m-d');\n }",
"public function tolerantion()\n {\n $row =$this->db->select('*')->from('c_history')->orderBy('date')->asc()->fetchPairs('date', 'idc_history');\n $date =new DateTime('1991-01-01');\n $max =0;\n while($date->format('Y-m-d') != '2010-01-28')\n {\n $buffer =0;\n while(!isset($row[$date->format('Y-m-d')]))\n {\n $date->modify('+1 day');\n $buffer++;\n }\n if($buffer > $max)\n $max =$buffer;\n $date->modify('+1 day');\n }\n return $max;\n }",
"public function last(): array\n {\n return $this->single('date DESC');\n }",
"public function latest();",
"public function latest($limit);",
"function buscar_mayor_fecha () {\n global $DB;\n $sql = \"SELECT date FROM {report_user_statistics} WHERE id=(SELECT max(id) FROM {report_user_statistics});\";\n $fecha = $DB->get_record_sql($sql);\n return $fecha;\n}",
"function getHistory() {\n\t\treturn db_query_params ('SELECT * FROM artifact_history_user_vw WHERE artifact_id=$1 ORDER BY entrydate DESC, id ASC',\n\t\t\t\t\tarray ($this->getID())) ;\n\t}",
"public function getLast();",
"public function getLast();",
"public static function latest_entries()\n\t{\n\t\t// Recursively get a list of log files\n\t\t$logs = Kohana::list_files('logs');\n\n\t\t// Find the month directory name\n\t\t$log_year = array_pop( $logs );\n\t\t$log_month = array_pop( $log_year );\n\n\t\t// Build an array of log entries\n\t\t$entries = array();\n\t\tforeach($log_month as $day => $path)\n\t\t{\n\t\t\t$path = str_replace(APPPATH.'logs/', '', $path);\n\n\t\t\t// Create array of log entries and merge it in\n\t\t\t$entries = array_merge($entries, self::get_entries($path));\n\t\t}\n\n\t\treturn static::format_entries($entries);\n\t}",
"private function get_zset_most_recent_archive_date() {\n return intval(gettimeofday(true) - 86400); // yesterday\n }",
"public function getMaxDateRange()\n {\n $dob = $this->_getAttribute('dob');\n if ($dob !== null) {\n $rules = $this->_getAttribute('dob')->getValidationRules();\n $maxDateValue = ArrayObjectSearch::getArrayElementByName(\n $rules,\n self::MAX_DATE_RANGE_KEY\n );\n if ($maxDateValue !== null) {\n return date(\"Y/m/d\", $maxDateValue);\n }\n }\n\n return null;\n }",
"function maxDate(array $dates)\n {\n $timestamp = max(array_map('strtotime', $dates));\n\n return date('Y-m-j', $timestamp);\n }",
"public function getMaxDaysOnMarket();",
"public function getMaxMedDate()\r\n\t\t{\r\n\t\t\t\t$link = $this->connect();\r\n\t\t\t\t$query = \" SELECT max(date_given)\r\n\t\t\t\t\t\t\tFROM med_record\";\r\n\t\t\t\t$result = mysqli_query($link, $query);\r\n\t\t\t\t$m = array();\r\n\t\t\t\t$m_arr = array();\r\n\t\t\t\twhile($row = mysqli_fetch_row($result)){\r\n\t\t\t\t\t$m['mdate'] = $row[0];\r\n\t\t\t\t\t$m_arr[] = $m;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\treturn $m_arr;\r\n\t\t\t\t\r\n\t\t}",
"public function getLogHistory() {\n\t\treturn $this->log;\n\t}",
"public function getMaxDateProperty()\n {\n return Carbon::now()->timezone($this->timezome)->format('Y-m-d');\n }",
"public function getLastLog()\n {\n $log = $this->createQueryBuilder()\n ->select('l.*')\n ->from($this->tableName, 'l')\n ->orderBy('l.id', 'DESC')\n ->setMaxResults(1)\n ->execute()\n ->fetch();\n \n if (false !== $log) {\n return new Log($log);\n }\n }",
"public function last_entries()\n\t{\n\t\treturn $this->last_entries;\n\t}",
"static function getJobHistory( $numberOfDays, $maxNumRecords = null ) {\n\n // include those records from the given number of days\n global $wpdb;\n $resultset = $wpdb->get_results($wpdb->prepare(\n \"SELECT job_id, classname, status, start_date, end_date\n FROM wp_lh_jobs\n WHERE IFNULL(last_updated_date, created_date) > NOW() - INTERVAL %d DAY\n ORDER BY job_id DESC \" . \n ($maxNumRecords != null ? \"LIMIT $maxNumRecords\" : \"\"), $numberOfDays));\n\n $jobHistories = array();\n foreach( $resultset as $record ) {\n $jobHistories[$record->job_id] = $record;\n }\n return $jobHistories;\n }",
"public function getLatestRecord();",
"function getLastDate($table)\r\n {\r\n \r\n $queryString = \"SELECT MAX(date) FROM $table\";\r\n \r\n // Interpret Query\r\n $result = $this->runQuery($queryString);\r\n \r\n if (!$result && $this->getMySQLErrorCode()!=0)\r\n return 0;\r\n \r\n $row = mysql_fetch_row($result);\r\n \r\n return $row[0];\r\n }",
"final public function getLastEvent()\n\t\t{\n\n\t\t\treturn $this->getEventByTimeAlgo(\"last_event\");\n\n\t\t}",
"public function getLastLog () {\n return end($this->log);\n }",
"public function getLastDate()\n {\n $query = \"SELECT MAX(stat_date) AS last FROM \" . $this->tableName;\n $data = $this->SelectData($query, PDO::FETCH_ASSOC);\n\n if (false === $data) {\n return false;\n } else {\n return $data[0]['last'];\n }\n }",
"public function getLastAudit();"
]
| [
"0.6784279",
"0.66746044",
"0.65539384",
"0.63473743",
"0.63310075",
"0.62765956",
"0.62141496",
"0.6095562",
"0.605567",
"0.59828943",
"0.5976562",
"0.5956593",
"0.5956593",
"0.5948144",
"0.5928591",
"0.592095",
"0.58956885",
"0.58838457",
"0.58695847",
"0.5862871",
"0.58573264",
"0.58330554",
"0.5822377",
"0.5788878",
"0.57858306",
"0.5785273",
"0.578263",
"0.57804817",
"0.5780133",
"0.57552296"
]
| 0.77326894 | 0 |
Count databases by server. | public function countDatabasesByServer(\DateTime $date, Server $server)
{
$qb = $this->createQueryBuilder('h')
->select('count(distinct(h.dbName)) AS nb')
->where('h.date = :date')
->setParameter('date', $date)
->andWhere('h.server = :server')
->setParameter('server', $server)
->groupBy('h.date');
$row = $qb->getQuery()->getOneOrNullResult();
if (is_null($row)) {
return;
}
return $row['nb'];
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function findServersCount()\r\n {\r\n \t$query = \"select count(*) as count from `servers`\";\r\n \r\n \t$result = $this->DB->fetchColumn($query);\r\n \r\n \treturn $result;\r\n }",
"public function countNameservers(): int {}",
"public function getServerCountAttribute()\n {\n return $this->servers->count();\n }",
"public function getDatabaseCount(){\n\t\treturn count($this->databases) - 1;\n\t}",
"function getTotalServerCount() {\n\t\t$count = 0;\n\t\tforeach ($this->masterservers as $masterserver) {\n\t\t\tif (isset($masterserver['num_servers_loaded'])) {\n\t\t\t\t$count += $masterserver['num_servers_loaded'];\n\t\t\t} else if (isset($masterserver['num_servers'])) {\n\t\t\t\t$count += $masterserver['num_servers'];\n\t\t\t}\n\t\t}\n\t\treturn $count;\n\t}",
"public function getConnectionCount();",
"private function showDatabases()\n {\n $dbs = $this->mongoClient->listDatabases();\n foreach ($dbs as $db) {\n $padding = $this->cli->padding(20)->char('.');\n $padding->label($db->getName())->result($this->formatBytes($db->getSizeOnDisk()));\n }\n }",
"public function countTablesByServer(\\DateTime $date, Server $server)\n {\n $qb = $this->createQueryBuilder('h')\n ->select('count(distinct(h.tableName)) AS nb')\n ->where('h.date = :date')\n ->setParameter('date', $date)\n ->andWhere('h.server = :server')\n ->setParameter('server', $server)\n ->groupBy('h.date');\n\n $row = $qb->getQuery()->getOneOrNullResult();\n\n if (is_null($row)) {\n return;\n }\n\n return $row['nb'];\n }",
"public function getServerInfoCount()\n {\n return $this->count(self::_SERVER_INFO);\n }",
"public function showdbs()\n {\n $this->_validate(array());\n $this->_QUERYCOUNT++;\n\n return $this->_query->showdatabases();\n }",
"public function getCachedServersCountAttribute(): int\n {\n return Cache::remember($this->cacheKey().':servers_count', 10, function () {\n return $this->servers()->count();\n });\n }",
"function countDb()\n {\n global $g_db;\n $cnt = $g_db->getrows(\"SELECT count(*) as cnt FROM hourdeposit_deposit\");\n return $cnt[0][\"cnt\"];\n }",
"public function countDataLengthByServer(\\DateTime $date, Server $server)\n {\n $qb = $this->createQueryBuilder('h')\n ->select('sum(h.dataLength) AS nb')\n ->where('h.date = :date')\n ->setParameter('date', $date)\n ->andWhere('h.server = :server')\n ->setParameter('server', $server)\n ->groupBy('h.date');\n\n $row = $qb->getQuery()->getOneOrNullResult();\n\n if (is_null($row)) {\n return;\n }\n\n return $row['nb'];\n }",
"public function countIndexLengthByServer(\\DateTime $date, Server $server)\n {\n $qb = $this->createQueryBuilder('h')\n ->select('sum(h.indexLength) AS nb')\n ->where('h.date = :date')\n ->setParameter('date', $date)\n ->andWhere('h.server = :server')\n ->setParameter('server', $server)\n ->groupBy('h.date');\n\n $row = $qb->getQuery()->getOneOrNullResult();\n\n if (is_null($row)) {\n return;\n }\n\n return $row['nb'];\n }",
"public function listDatabases(){\n\t\treturn $this->instance->listDatabases();\n\t}",
"public function serviceCount(){\n $this->getDataAccessObject()->daoCount();\n }",
"public function count_all_database($table,$where) \n {\n $this->db->select();\n $this->db->from($table);\n if(isset($where) && !empty($where))\n {\n $this->db->where($where);\n }\n \n $query = $this->db->get();\n return $query->num_rows(); \n }",
"function contarServicios()\n\t{\n\t\treturn \"select count(*) as number\nfrom trabajadores, servicios,sucursales where servicios.trabajador_id = trabajadores.trabajador_id \nand servicios.estado_servicio = 1 \nand servicios.sucursal_id = sucursales.sucursal_id\";\n\t}",
"function contarServiciosFinalizados()\n\t{\n\t\treturn \"select count(*) as number\nfrom trabajadores, servicios,sucursales \nwhere servicios.trabajador_id = trabajadores.trabajador_id \nand servicios.estado_servicio = 0\nand servicios.sucursal_id = sucursales.sucursal_id\";\n\t}",
"protected static function get_db_size(){\n\n\t\t$size = 0;\n\t\t$tables = static::get_tables();\n\n\t\tforeach ($tables as &$table) {\n\n\t\t\t$size += static::get_table_size($table);\n\n\t\t\tunset($table);\n\t\t}\n\n\t\treturn $size;\n\t}",
"public function countRowsByServer(\\DateTime $date, Server $server)\n {\n $qb = $this->createQueryBuilder('h')\n ->select('sum(h.nbRows) AS nb')\n ->where('h.date = :date')\n ->setParameter('date', $date)\n ->andWhere('h.server = :server')\n ->setParameter('server', $server)\n ->groupBy('h.date');\n\n $row = $qb->getQuery()->getOneOrNullResult();\n\n if (is_null($row)) {\n return;\n }\n\n return $row['nb'];\n }",
"function db_driver_count($resource)\n{\n global $_db;\n\n return pg_num_rows($resource);\n}",
"public function getconnectioncount()\n\t{\n\t\treturn $this->connect('getconnectioncount');\n\t}",
"function count_sql($table) {\n\t$dbh = db_connect(); #DATABASE CONNEXION\n\n\t$dossier = $dbh->query('SELECT COUNT(*) FROM ' . $table)->fetch();\n\tforeach ($dossier as $count) return $count;\n\n\techo($count);\n}",
"public function count (): int {\n return count($this->clients);\n }",
"public function testCountDBProcesses()\n {\n $this->assertTrue(is_integer($this->fixture->countDBProcesses()));\n }",
"public static function count_for_site( $db_site, $modifier = NULL )\n {\n return static::select_for_site( $db_site, $modifier, true );\n }",
"public function showDatabases(){\n\t\treturn $this->instance->listDatabases();\n\t}",
"public function getDatabases() {\n\t\treturn $this->databases;\n\t}",
"public function get_my_counters($instance_id)\n {\n $st = $this->db->query('SELECT COUNT(*) as count from servers where instance_id='.$instance_id)->result_array();\n $data['servers'] = $st[0]['count'];\n\n /*==== COUNT MODULES ====*/\n $st = $this->db->query('SELECT COUNT(*) as count from modules where instance_id='.$instance_id)->result_array();\n $data['modules'] = $st[0]['count'];\n\n return $data;\n }"
]
| [
"0.6889528",
"0.6640621",
"0.64038384",
"0.6285838",
"0.6276865",
"0.62096363",
"0.59162617",
"0.58938473",
"0.58740133",
"0.585931",
"0.5757923",
"0.57197607",
"0.55678326",
"0.55013627",
"0.5486577",
"0.5465805",
"0.5440619",
"0.5419378",
"0.53868574",
"0.53843683",
"0.5370422",
"0.53496236",
"0.53488505",
"0.5347869",
"0.53332573",
"0.5317359",
"0.53130656",
"0.52986026",
"0.5297725",
"0.52964926"
]
| 0.74388295 | 0 |
Count tables by server. | public function countTablesByServer(\DateTime $date, Server $server)
{
$qb = $this->createQueryBuilder('h')
->select('count(distinct(h.tableName)) AS nb')
->where('h.date = :date')
->setParameter('date', $date)
->andWhere('h.server = :server')
->setParameter('server', $server)
->groupBy('h.date');
$row = $qb->getQuery()->getOneOrNullResult();
if (is_null($row)) {
return;
}
return $row['nb'];
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getNumTables() {}",
"public function getNumTables() {}",
"public function getNumTables() {}",
"public function findServersCount()\r\n {\r\n \t$query = \"select count(*) as count from `servers`\";\r\n \r\n \t$result = $this->DB->fetchColumn($query);\r\n \r\n \treturn $result;\r\n }",
"abstract public function countTable();",
"public function countNameservers(): int {}",
"public function getEntriesCountForTable($table);",
"public function countDatabasesByServer(\\DateTime $date, Server $server)\n {\n $qb = $this->createQueryBuilder('h')\n ->select('count(distinct(h.dbName)) AS nb')\n ->where('h.date = :date')\n ->setParameter('date', $date)\n ->andWhere('h.server = :server')\n ->setParameter('server', $server)\n ->groupBy('h.date');\n\n $row = $qb->getQuery()->getOneOrNullResult();\n\n if (is_null($row)) {\n return;\n }\n\n return $row['nb'];\n }",
"function getTotalServerCount() {\n\t\t$count = 0;\n\t\tforeach ($this->masterservers as $masterserver) {\n\t\t\tif (isset($masterserver['num_servers_loaded'])) {\n\t\t\t\t$count += $masterserver['num_servers_loaded'];\n\t\t\t} else if (isset($masterserver['num_servers'])) {\n\t\t\t\t$count += $masterserver['num_servers'];\n\t\t\t}\n\t\t}\n\t\treturn $count;\n\t}",
"public function getSpecificCount($table) {\n return ORM::for_table($table, $_SESSION[\"language\"])->count();\n }",
"public function getTableCount($table)\n {\n $DB = new PDO(DB_DRIVER.':host='.DB_SERVER.';dbname='.DB_DATABASE, DB_SERVER_USERNAME, DB_SERVER_PASSWORD , $dboptions); \n try {\n \n ///\n \n $sql = \"SELECT COUNT(*) AS num FROM \". $table;\n $stmt = $DB->prepare($sql);\n $stmt->execute();\n $row_count = $stmt->fetchAll();\n return $row_count[0][\"num\"] ;\n\n } catch (Exception $ex) {\n\n echo $ex->getMessage();\n }\n }",
"public function getConnectionCount();",
"function contarServicios()\n\t{\n\t\treturn \"select count(*) as number\nfrom trabajadores, servicios,sucursales where servicios.trabajador_id = trabajadores.trabajador_id \nand servicios.estado_servicio = 1 \nand servicios.sucursal_id = sucursales.sucursal_id\";\n\t}",
"public function getServerCountAttribute()\n {\n return $this->servers->count();\n }",
"public function countAll(string $table): int\n\t{\n\t\t$sql = 'SELECT * FROM '.$this->driver->quoteTable($table);\n\t\t$res = $this->driver->query($sql);\n\t\treturn (int) count($res->fetchAll());\n\t}",
"static function get_Count($table) {\r\n $rekete = \"SELECT COUNT(*) as NOMBRE FROM \" . $table;\r\n $result = Functions::commit_sql($rekete, \"\");\r\n $list = $result->fetch();\r\n if ($list[\"NOMBRE\"] != NULL)\r\n return $list[\"NOMBRE\"];\r\n else\r\n return 0;\r\n }",
"public function countAll($table){\r\n $this->db->from($table);\r\n return $this->db->count_all_results();\r\n }",
"function contarServiciosFinalizados()\n\t{\n\t\treturn \"select count(*) as number\nfrom trabajadores, servicios,sucursales \nwhere servicios.trabajador_id = trabajadores.trabajador_id \nand servicios.estado_servicio = 0\nand servicios.sucursal_id = sucursales.sucursal_id\";\n\t}",
"public function getServerInfoCount()\n {\n return $this->count(self::_SERVER_INFO);\n }",
"public function getTablesAndRowCounts()\n {\n return $this->callSql(\"\n SELECT\n t.NAME AS TableName,\n p.rows AS RowCounts\n FROM\n sys.tables t\n INNER JOIN\n sys.indexes i ON t.OBJECT_ID = i.object_id\n INNER JOIN\n sys.partitions p ON i.object_id = p.OBJECT_ID AND i.index_id = p.index_id\n WHERE\n t.is_ms_shipped = 0\n AND p.rows > 0\n GROUP BY\n t.Name, p.Rows\n ORDER BY\n t.Name\n \");\n }",
"public function getNombreTables() {\n\t\t\n\t\t\t$this->log->debug(\"Maintenance::getNombreTables() Début\");\n\t\t\t\n\t\t\t$total = 0;\n\t\t\n\t\t\ttry {\n\t\t\t\t$sql = \"select count(*) from information_schema.tables where table_schema=?\";\n\t\t\t\t$sth = $this->dbh->prepare($sql);\n\t\t\t\t$sth->execute(array(DB_NAME));\n\t\t\t\t\t\n\t\t\t\t// Obtenir le nombre de tables\n\t\t\t\t$total = $sth->fetchColumn();\n\t\t\t\n\t\t\t} catch (Exception $e) {\n\t\t\t\tErreur::erreurFatal('018', \"Maintenance::getNombreTables() - Erreur technique détectée : '\" . $e->getMessage() . $e->getTraceAsString() . \"'\", $this->log);\n\t\t\t}\n\t\t\t\t\t\n\t\t\t$this->log->debug(\"Maintenance::getNombreTables() Fin total = '$total'\");\n\t\t\n\t\t\treturn $total;\n\t\t}",
"function count_sql($table) {\n\t$dbh = db_connect(); #DATABASE CONNEXION\n\n\t$dossier = $dbh->query('SELECT COUNT(*) FROM ' . $table)->fetch();\n\tforeach ($dossier as $count) return $count;\n\n\techo($count);\n}",
"public function testResultNumTables()\n {\n \t$this->assertEquals(1, $this->conn->query('SELECT * FROM test')->numTables());\n \t$this->assertEquals(2, $this->conn->query('SELECT * FROM test INNER JOIN child ON test.id = child.idTest')->numTables(), \"SELECT FROM test, child\");\n }",
"public function count_all_database($table,$where) \n {\n $this->db->select();\n $this->db->from($table);\n if(isset($where) && !empty($where))\n {\n $this->db->where($where);\n }\n \n $query = $this->db->get();\n return $query->num_rows(); \n }",
"public static function getCountOfRecords($table)\n {\n $sql = \"SELECT COUNT(*) FROM \".$table;\n $result = self::prepareQuery($sql);\n $result = $result->fetchAll(PDO::FETCH_ASSOC) ;\n return $result[0]['COUNT(*)'];\n }",
"function getDataCount($table='',$selFields = '*',$where='') \t{\n\t\t$query \t= 'SELECT COUNT('.$selFields.') AS cnt FROM ' . $this->tablePrefix . $table .' ' .$where;\t\t\t\t \n \t\t\n \t\treturn $this->fetchOne($this->execute($query));\n\t}",
"function getCount($tbl)\n {\n \t$db = $this->load->database('default',TRUE);\n \t$query = $this->db->count($tbl);\n return $query; \n }",
"public function count($table)\n {\n $class_name = $this->resolveEntityName($table);\n $rows = $this->_em->getRepository($class_name)\n ->createQueryBuilder('e')\n ->select()\n ->getQuery()\n ->execute();\n return count($rows);\n }",
"public function countRowsByServer(\\DateTime $date, Server $server)\n {\n $qb = $this->createQueryBuilder('h')\n ->select('sum(h.nbRows) AS nb')\n ->where('h.date = :date')\n ->setParameter('date', $date)\n ->andWhere('h.server = :server')\n ->setParameter('server', $server)\n ->groupBy('h.date');\n\n $row = $qb->getQuery()->getOneOrNullResult();\n\n if (is_null($row)) {\n return;\n }\n\n return $row['nb'];\n }",
"public static function count($table,$filter = null){\n if($filter){ $filter = ' WHERE '.$filter; }\n $res = Db::query(\"SELECT COUNT(*) as rows FROM {$table}\".$filter);\n if(!$res){return 0;}\n $row = $res->fetch_assoc();\n return $row['rows'];\n }"
]
| [
"0.6838429",
"0.6838429",
"0.6838429",
"0.68073165",
"0.67963475",
"0.66255975",
"0.6573536",
"0.65506923",
"0.6436579",
"0.6405971",
"0.63667876",
"0.63447046",
"0.62474513",
"0.622492",
"0.6220429",
"0.62158865",
"0.6205093",
"0.60975605",
"0.6027791",
"0.6019517",
"0.6008078",
"0.5982647",
"0.59813756",
"0.5964999",
"0.5905844",
"0.5897607",
"0.58957726",
"0.5894738",
"0.5859022",
"0.5833373"
]
| 0.7152058 | 0 |
Count index length by server. | public function countIndexLengthByServer(\DateTime $date, Server $server)
{
$qb = $this->createQueryBuilder('h')
->select('sum(h.indexLength) AS nb')
->where('h.date = :date')
->setParameter('date', $date)
->andWhere('h.server = :server')
->setParameter('server', $server)
->groupBy('h.date');
$row = $qb->getQuery()->getOneOrNullResult();
if (is_null($row)) {
return;
}
return $row['nb'];
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function countNameservers(): int {}",
"public function getServerCountAttribute()\n {\n return $this->servers->count();\n }",
"public function findServersCount()\r\n {\r\n \t$query = \"select count(*) as count from `servers`\";\r\n \r\n \t$result = $this->DB->fetchColumn($query);\r\n \r\n \treturn $result;\r\n }",
"function getTotalServerCount() {\n\t\t$count = 0;\n\t\tforeach ($this->masterservers as $masterserver) {\n\t\t\tif (isset($masterserver['num_servers_loaded'])) {\n\t\t\t\t$count += $masterserver['num_servers_loaded'];\n\t\t\t} else if (isset($masterserver['num_servers'])) {\n\t\t\t\t$count += $masterserver['num_servers'];\n\t\t\t}\n\t\t}\n\t\treturn $count;\n\t}",
"public function length();",
"public function length();",
"public function getServerInfoCount()\n {\n return $this->count(self::_SERVER_INFO);\n }",
"final public function count(): int\n {\n return count($this->index);\n }",
"public function getConnectionCount();",
"public function getCachedServersCountAttribute(): int\n {\n return Cache::remember($this->cacheKey().':servers_count', 10, function () {\n return $this->servers()->count();\n });\n }",
"public function countDataLengthByServer(\\DateTime $date, Server $server)\n {\n $qb = $this->createQueryBuilder('h')\n ->select('sum(h.dataLength) AS nb')\n ->where('h.date = :date')\n ->setParameter('date', $date)\n ->andWhere('h.server = :server')\n ->setParameter('server', $server)\n ->groupBy('h.date');\n\n $row = $qb->getQuery()->getOneOrNullResult();\n\n if (is_null($row)) {\n return;\n }\n\n return $row['nb'];\n }",
"public function getTotalLength();",
"public function getTotalLength();",
"public function getLength();",
"public function getLength() {}",
"public function getLength() {}",
"public function getLength() {}",
"public function getLength() {}",
"public function getTotalLength() {}",
"public function getTotalLength() {}",
"public function count (): int {\n return count($this->clients);\n }",
"public function count()\n {\n return $this->length;\n }",
"public function count() {\n \n return $this->getLength();\n }",
"public function length()\n {\n return $this->count();\n }",
"public function count()\n {\n return $this->length;\n }",
"public function numberOfHostEntries()\n {\n return (int)$this->prepareRequest()->GetHostNumberOfEntries();\n }",
"public function receivedCount();",
"public function getLength(): int;",
"public function getLength(): int;",
"public function count() {\n return $this->length;\n }"
]
| [
"0.70486385",
"0.6739224",
"0.6609436",
"0.65574414",
"0.65519214",
"0.65519214",
"0.64854103",
"0.62902117",
"0.62204385",
"0.61674774",
"0.61458224",
"0.613579",
"0.613579",
"0.6122543",
"0.60973823",
"0.60973823",
"0.60973823",
"0.60953397",
"0.60846794",
"0.6083668",
"0.607887",
"0.6043603",
"0.59651047",
"0.59617895",
"0.5961052",
"0.5959409",
"0.5946452",
"0.5945098",
"0.5945098",
"0.5945074"
]
| 0.7009692 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.