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 |
---|---|---|---|---|---|---|
Is the solr server properly configured?.
|
public function is_server_configured() {
if (empty($this->config->server_hostname) || empty($this->config->indexname)) {
return 'No solr configuration found';
}
if (!$client = $this->get_search_client(false)) {
return get_string('engineserverstatus', 'search');
}
try {
if ($this->get_solr_major_version() < 4) {
// Minimum solr 4.0.
return get_string('minimumsolr4', 'search_solr');
}
} catch (\SolrClientException $ex) {
debugging('Solr client error: ' . html_to_text($ex->getMessage()), DEBUG_DEVELOPER);
return get_string('engineserverstatus', 'search');
} catch (\SolrServerException $ex) {
debugging('Solr server error: ' . html_to_text($ex->getMessage()), DEBUG_DEVELOPER);
return get_string('engineserverstatus', 'search');
}
return true;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function is_installed() {\n return function_exists('solr_get_version');\n }",
"public function is_server_ready() {\n\n $configured = $this->is_server_configured();\n if ($configured !== true) {\n return $configured;\n }\n\n // As part of the above we have already checked that we can contact the server. For pages\n // where performance is important, we skip doing a full schema check as well.\n if ($this->should_skip_schema_check()) {\n return true;\n }\n\n // Update schema if required/possible.\n $schemalatest = $this->check_latest_schema();\n if ($schemalatest !== true) {\n return $schemalatest;\n }\n\n // Check that the schema is already set up.\n try {\n $schema = new \\search_solr\\schema();\n $schema->validate_setup();\n } catch (\\moodle_exception $e) {\n return $e->getMessage();\n }\n\n return true;\n }",
"public function isValid()\n\t{\n\t\tglobal $modSettings;\n\n\t\treturn !empty($modSettings['sphinx_searchd_server']) && !empty($modSettings['sphinxql_searchd_port']);\n\t}",
"protected function _checkCoreExists(){\n if(!in_array($this->_core,$this->_getCores())){\n throw new Pas_Solr_Exception('That is not a valid core',500);\n } else {\n return true;\n }\n }",
"protected function isSearchEngineAvailable()\n {\n $settings = \\Administration::getSettings();\n return empty($settings->settings['info_fts_down']);\n }",
"abstract public function installSolr();",
"public static function pingSolrServer($options=array())\n {\n try {\n return self::connect($options)->ping();\n } catch (Exception $e) {\n return false;\n }\n }",
"public function init()\n\t{\n\t\tif ($this->db->get_sql_layer() != 'mysql' && $this->db->get_sql_layer() != 'mysql4' && $this->db->get_sql_layer() != 'mysqli' && $this->db->get_sql_layer() != 'postgres')\n\t\t{\n\t\t\treturn $this->user->lang['FULLTEXT_SPHINX_WRONG_DATABASE'];\n\t\t}\n\n\t\t// Move delta to main index each hour\n\t\tset_config('search_gc', 3600);\n\n\t\treturn false;\n\t}",
"function shIsSearchEngine()\n{\n\tstatic $isSearchEngine = null;\n\n\t//return true;\n\tif (!is_null($isSearchEngine))\n\t{\n\t\treturn $isSearchEngine;\n\t}\n\telse\n\t{\n\t\t$isSearchEngine = false;\n\t\t$useragent = empty($_SERVER['HTTP_USER_AGENT']) ? '' : strtolower($_SERVER['HTTP_USER_AGENT']);\n\t\tif (!empty($useragent))\n\t\t{\n\t\t\t$remoteConfig = Sh404sefHelperUpdates::getRemoteConfig($forced = false);\n\t\t\t$remotes = empty($remoteConfig->config['searchenginesagents']) ? array() : $remoteConfig->config['searchenginesagents'];\n\t\t\t$agents = array_unique(array_merge(Sh404sefFactory::getPConfig()->searchEnginesAgents, $remotes));\n\t\t\tforeach ($agents as $agent)\n\t\t\t{\n\t\t\t\tif (strpos($useragent, strtolower($agent)) !== false)\n\t\t\t\t{\n\t\t\t\t\t$isSearchEngine = true;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $isSearchEngine;\n\t}\n}",
"protected function isHostConfigured() {}",
"public function check_conditions() \n\t{\n\t\t$ok = true;\n\t\tif( !is_writable( $this->_root_path ) ) {\n\t\t\tSession::error( 'Init failed, Search index directory is not writeable. Please update configuration with a writeable directiory.', 'Multi Search' );\n\t\t\t$ok = false;\n\t\t}\n\t\tif( !class_exists(\"Zend_Search_Lucene\") ) {\n\t\t\tSession::error( 'Init failed, Zend Framework or Zend Search Lucene not installed.', 'Multi Search' );\n\t\t\t$ok = false;\n\t\t}\n\n\t\treturn $ok;\n\t}",
"public function testOrgApacheJackrabbitOakPluginsIndexSolrOsgiEmbeddedSolrServerCo()\n {\n $client = static::createClient();\n\n $path = '/system/console/configMgr/org.apache.jackrabbit.oak.plugins.index.solr.osgi.EmbeddedSolrServerConfigurationProvider';\n\n $crawler = $client->request('POST', $path);\n }",
"public function installSolr()\n {\n $this->span(\"Option not supported for this Linux distribution and version.\", 'error');\n }",
"public function isCatalogSearch()\n {\n $pathInfo = $this->_getRequest()->getPathInfo();\n if (stripos($pathInfo, '/catalogsearch/result') !== false) {\n return true;\n }\n return false;\n }",
"public function isForServer()\n {\n return $this->server !== null;\n }",
"public function testOrgApacheJackrabbitOakPluginsIndexSolrOsgiRemoteSolrServerConf()\n {\n $client = static::createClient();\n\n $path = '/system/console/configMgr/org.apache.jackrabbit.oak.plugins.index.solr.osgi.RemoteSolrServerConfigurationProvider';\n\n $crawler = $client->request('POST', $path);\n }",
"public function plugin_is_configured() {\n\t\treturn isset( $this->settings->client_id, $this->settings->base_uri ) && $this->settings->client_id && $this->settings->base_uri;\n\t}",
"public function is_searchable()\r\n {\r\n // to search by.\r\n $st = !empty($this->content) ? $this->content : '';\r\n $clean = PiplApi_Utils::piplapi_alnum_chars($st);\r\n $func = function_exists(\"mb_strlen\") ? \"mb_strlen\" : \"strlen\";\r\n return ($func($clean) >= 3);\r\n }",
"function is_system_configured() {\n global $CFG;\n return (!empty($CFG->ombielalertsserverendpoint) && \n !empty($CFG->ombielalertsserversserverusername) && \n !empty($CFG->ombielalertsserverpassword) && \n !empty($CFG->ombielalertsorgcode) && \n !empty($CFG->ombielalertsorgpassword)\n );\n }",
"public function hasServer(string $name): bool {}",
"function Sparql_Setup() {\n global $wgDebugLogGroups, $IP;\n // log - make sure this is writeable by php/apache\n $wgDebugLogGroups = array(\"SPARQL_LOG\" => \"$IP/logs/sparql.log\");\n\n // add scripts present in every page (try to keep to minimum)\n addUtilityScripts();\n \n return true;\n}",
"public function testOrgApacheJackrabbitOakPluginsIndexSolrOsgiOakSolrConfiguration()\n {\n $client = static::createClient();\n\n $path = '/system/console/configMgr/org.apache.jackrabbit.oak.plugins.index.solr.osgi.OakSolrConfigurationProviderService';\n\n $crawler = $client->request('POST', $path);\n }",
"public function isTagalysActive()\n\t{\n\t\t//$status = $this->scopeConfig->getValue('tgs_search/default/status', \\Magento\\Store\\Model\\ScopeInterface::SCOPE_STORE);\n\t\t$status = $this->scopeConfig->getValue('tagalys_tglssearch/general/enable', \\Magento\\Store\\Model\\ScopeInterface::SCOPE_STORE);\n\n\t\tif ($status)\n\t\t{\n\n\t\t\t//$service = $this->tglssearchClientConnector;\n\t\t\t$service = $this->tglssearchClientConnector;\n\t\t $tagalys = $service->isRequestSuccess();\n\t\t if($tagalys)\n\t\t\t{\n\t\t\t\t//print_r('if');die;\n\t\t \treturn $service;\n\t\t }\n\t\t\telse\n\t\t\t{\n\t\t\t\t//print_r('else');die;\n\t\t \treturn false;\n\t\t }\n\n\t\t} else\n\t\t{\n\t\t\t//print_r('false');die;\n\t\t\treturn false;\n\t\t}\n\t\t//print_r('nthg');die;\n\t}",
"private function isClerkSearchEnabled()\n {\n return $this->scopeConfig->isSetFlag(Config::XML_PATH_SEARCH_ENABLED, ScopeInterface::SCOPE_STORE);\n }",
"function checkNginxServer()\n {\n // check nginx is installed\n if (!isNginxInstalled()) {\n return false;\n }\n\n $config = $this->inst()->webServer->getConfig();\n\n return $config && in_array($this->inst()->domain, $config->domains);\n }",
"function connectionExists(){\n\t\tglobal $dbConnection;\n\t\tif($dbConnection == null){\n\t\t\treturn false;\n\t\t}\n\t\telse{\n\t\t\treturn true;\n\t\t}\n\t}",
"public function testOrgApacheJackrabbitOakPluginsIndexSolrOsgiSolrServerProviderSe()\n {\n $client = static::createClient();\n\n $path = '/system/console/configMgr/org.apache.jackrabbit.oak.plugins.index.solr.osgi.SolrServerProviderService';\n\n $crawler = $client->request('POST', $path);\n }",
"function has_config() {\n return true;\n }",
"public function isSearchable(): ?bool {\n\t\treturn Hash::get($this->_config, 'searchable');\n\t}",
"protected function isInstalled(){\n\t\t$dsn = Configuration::get('dsn', '');\n\t\t//echo \"dsn = \" . $dsn . \"--\";\n\t\tif ($dsn == ''){\n\t\t\t$alreadyInstalled = false;\n\t\t}\n\t\telse{\n\t\t\t$alreadyInstalled = true;\n\t\t}\n\t\treturn $alreadyInstalled;\n\t}"
] |
[
"0.7063379",
"0.69436884",
"0.65957624",
"0.6428939",
"0.63026583",
"0.6142883",
"0.60936415",
"0.60374147",
"0.6007144",
"0.5940829",
"0.5935877",
"0.59016365",
"0.58843374",
"0.57983756",
"0.5768858",
"0.5750221",
"0.57410985",
"0.57216763",
"0.5712808",
"0.5696866",
"0.56683975",
"0.5645799",
"0.5645637",
"0.564294",
"0.562557",
"0.5596685",
"0.55882514",
"0.5562562",
"0.5562126",
"0.55592936"
] |
0.75209564
|
0
|
Returns the solr server major version.
|
public function get_solr_major_version() {
if ($this->solrmajorversion !== null) {
return $this->solrmajorversion;
}
// We should really ping first the server to see if the specified indexname is valid but
// we want to minimise solr server requests as they are expensive. system() emits a warning
// if it can not connect to the configured index in the configured server.
$systemdata = @$this->get_search_client()->system();
$solrversion = $systemdata->getResponse()->offsetGet('lucene')->offsetGet('solr-spec-version');
$this->solrmajorversion = intval(substr($solrversion, 0, strpos($solrversion, '.')));
return $this->solrmajorversion;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getMajorVersion()\n {\n return $this->major_version;\n }",
"public function getMajorVersion(): string {\n return $this->majorVersion;\n }",
"public function versionMajor() { return $this->_m_versionMajor; }",
"public function getMajorVersion() {}",
"public function minimum_core_version()\n\t{\n\t\treturn CMS_VERSION;\n\t}",
"public static function getMajorVersion()\r\n {\r\n $t3ver = TYPO3_version;\r\n\r\n if(strpos($t3ver, \".\")) {\r\n $t3ver = explode(\".\", $t3ver)[0];\r\n }\r\n\r\n return (int) $t3ver;\r\n }",
"function get_version_min() {\n return $this->version_min;\n }",
"public function getOsMajorVersion()\n {\n return $this->os_major_version;\n }",
"protected function getInstalledMajorVersion() {}",
"private function getBrowserMajorVer()\n {\n if(isset($this->browser->MajorVer))\n {\n return $this->browser->MajorVer;\n }\n else\n {\n return $this->browser->majorver;\n }\n }",
"public function getOsVersionMajor()\n {\n return $this->os_major;\n }",
"function getServerVersion();",
"public function GetServerVersion()\r\n {\r\n $this->checkDatabaseManager();\r\n return $this->_DatabaseHandler->server_version;\r\n }",
"public function getBrowserVersionMajor()\n {\n return $this->browser_major;\n }",
"function getMajor() {\n\t\treturn $this->getInfo('Major');\n\t}",
"public function getMajor() {\n return $this->major;\n }",
"public function getServerVersion() {}",
"public function getServerVersion() {}",
"public function getMajor()\n {\n return $this->major;\n }",
"public function getOsMajorVersionUnwrapped()\n {\n return $this->readWrapperValue(\"os_major_version\");\n }",
"public function GetSQLServerVersion()\r\n\t\t{\t\r\n\t\t\t$res = self::$SDB->getOne(\"select version()\");\r\n\t\t\t$retval = explode(\".\", $res);\r\n\t\t\treturn($retval);\r\n\t\t}",
"public function get_version()\n {\n return cms_version_number();\n }",
"public function get_version()\n {\n return cms_version_number();\n }",
"public function get_version()\n {\n return cms_version_number();\n }",
"public function get_version()\n {\n return cms_version_number();\n }",
"public function get_version()\n {\n return cms_version_number();\n }",
"public function get_version()\n {\n return cms_version_number();\n }",
"public function get_version()\n {\n return cms_version_number();\n }",
"public function get_version()\n {\n return cms_version_number();\n }",
"public function getServerVersion ()\n {\n $this->_connect();\n\n try\n\t\t{\n $version = $this->_connection->getAttribute(EhrlichAndreas_Db_Abstract::ATTR_SERVER_VERSION);\n }\n\t\tcatch (Exception $e)\n\t\t{\n // In case of the driver doesn't support getting attributes\n return null;\n }\n\n $matches = array();\n\n if (preg_match('/((?:[0-9]{1,2}\\.){1,3}[0-9]{1,2})/', $version, $matches))\n {\n return $matches[1];\n }\n else\n {\n return null;\n }\n }"
] |
[
"0.76375264",
"0.7621259",
"0.72838813",
"0.72543895",
"0.7243337",
"0.7233264",
"0.7080781",
"0.69703",
"0.6951646",
"0.69502294",
"0.69228524",
"0.69212204",
"0.68455356",
"0.6810683",
"0.67780834",
"0.67067945",
"0.67019886",
"0.67011684",
"0.6691751",
"0.66670233",
"0.6604136",
"0.65073824",
"0.65073824",
"0.65073824",
"0.65073824",
"0.65073824",
"0.65073824",
"0.65073824",
"0.65073824",
"0.6504274"
] |
0.82396156
|
0
|
Checks if the PHP Solr extension is available.
|
public function is_installed() {
return function_exists('solr_get_version');
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function installSolr()\n {\n $this->span(\"Option not supported for this Linux distribution and version.\", 'error');\n }",
"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 }",
"abstract public function installSolr();",
"function available() {\n\t\treturn function_exists('curl_init');\n\t}",
"public function isSupported() {\nif (extension_loaded('mysqli')) {\n\treturn true;\n}\nelse {\n\t$this->error='The mysqli extension for PHP is not installed.';\n\treturn false;\n};\n}",
"public static function available()\n\t{\n\t\treturn function_exists('curl_init');\n\t}",
"public function checkPhp()\n {\n return (version_compare(PHP_VERSION, '7.0.0') >= 0);\n }",
"public static function checkExistsPhp()\n {\n $server_info = AiBolitHelper::getServer()->get_info();\n $php = isset($server_info['phparr'][self::getScannerPhpVersion()]) ? $server_info['phparr'][self::getScannerPhpVersion()] : 0;\n return $php ? true : false;\n }",
"function fiorello_mikado_revolution_slider_installed() {\n\t\treturn class_exists( 'RevSliderFront' );\n\t}",
"private static function check_xsl_loaded()\n {\n if (!defined('PHPOPENFW_XSL_LOADED')) {\n if (extension_loaded('xsl') && extension_loaded('dom')) {\n define('PHPOPENFW_XSL_LOADED', true);\n }\n else {\n define('PHPOPENFW_XSL_LOADED', false);\n }\n }\n return PHPOPENFW_XSL_LOADED;\n }",
"private static function check_xsl_loaded()\n {\n if (!defined('PHPOPENFW_XSL_LOADED')) {\n if (extension_loaded('xsl') && extension_loaded('dom')) {\n define('PHPOPENFW_XSL_LOADED', true);\n }\n else {\n define('PHPOPENFW_XSL_LOADED', false);\n }\n }\n return PHPOPENFW_XSL_LOADED;\n }",
"protected function _checkCoreExists(){\n if(!in_array($this->_core,$this->_getCores())){\n throw new Pas_Solr_Exception('That is not a valid core',500);\n } else {\n return true;\n }\n }",
"public function preflight_check() {\n\t\t\n\t\t\tif( $this->zend_loader_present = @fopen( 'Zend/Loader.php', 'r', true ) ) {\n\t\t\t\tif( !$this->zend_loader_present ) {\n\t\t\t\t\t// ZF Not Found!\n\t\t\t\t\treturn false;\n\t\t\t\t} else {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"protected function checkPhpExtensionEnabled($ext)\n {\n return extension_loaded($ext);\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}",
"private static function check_php() {\n\t\treturn version_compare( phpversion(), self::MINIMUM_PHP_VERSION, '>=' );\n\t}",
"protected function isSearchEngineAvailable()\n {\n $settings = \\Administration::getSettings();\n return empty($settings->settings['info_fts_down']);\n }",
"function checkFTPSupport() {\n if (extension_loaded(\"ftp\")) {\n return true;\n } else {\n return false;\n }\n }",
"public function is_elex_dpd_enabled() {\n\t\treturn class_exists( 'Elex_dp_dynamic_pricing_plugin' );\n\t}",
"function plugin_is_active() {\n\t\treturn function_exists( 'jigoshop_init' ) || class_exists( 'JigoshopInit' );\n\t}",
"function checkCurlExtension()\n\t{\n\t\tif ( ! extension_loaded('curl') or ! is_callable('curl_init'))\n\t\t{\n\t\t\techo '<h3>' . __('cURL Error !', 'Gr_Integration') . '</h3>';\n\t\t\techo '<h3>' . __('GetResponse Integration Plugin requires PHP cURL extension', 'Gr_Integration') . '</h3>';\n\n\t\t\treturn;\n\t\t}\n\t}",
"function _isInstalled()\n\t{\n\t\t$success = false;\n\t\t\n\t\tjimport('joomla.filesystem.file');\n\t\tif (JFile::exists(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_phplist'.DS.'defines.php')) \n\t\t{\n\t\t\t// Check the registry to see if our Tienda class has been overridden\r\n\t\t\tif ( !class_exists('Phplist') )\r\n\t\t\t\tJLoader::register( \"Phplist\", JPATH_ADMINISTRATOR.DS.\"components\".DS.\"com_phplist\".DS.\"defines.php\" );\r\n\t\t\tif ( !class_exists('PhplistConfigPhplist') )\r\n\t\t\t\tJLoader::register( \"PhplistConfigPhplist\", JPATH_ADMINISTRATOR.DS.\"components\".DS.\"com_phplist\".DS.\"defines.php\" );\r\n\t\t\t\t\n\t\t\t\n\t\t\tPhplist::load( 'PhplistHelperNewsletter', 'helpers.newsletter' );\n\t\t\tPhplist::load( 'PhplistHelperMessage', 'helpers.message' );\n\t\t\tPhplist::load( 'PhplistHelperEmail', 'helpers.email' );\n\t\t\tPhplist::load( 'PhplistHelperPhplist', 'helpers.phplist' );\n\t\t\tPhplist::load( 'PhplistHelperConfigPhplist', 'helpers.configphplist' );\n\t\t\t\n\t\t\t$success = true;\n\t\t}\n\t\t\n\t\tif ($success == true) {\n\t\t\t// Also check that DB is setup\n\t\t\t$database = PhplistHelperPhplist::getDBO();\n\t\t\tif (!isset($database->error)) \n\t\t\t{\n\t\t\t\t$success = true;\n\t\t\t}\n\t\t}\n\t\treturn $success;\n\t}",
"public static function symfony_polyfill_used(): bool\n {\n // init\n $return = false;\n\n $return_tmp = \\extension_loaded('mbstring');\n if (!$return_tmp && \\function_exists('mb_strlen')) {\n $return = true;\n }\n\n $return_tmp = \\extension_loaded('iconv');\n if (!$return_tmp && \\function_exists('iconv')) {\n $return = true;\n }\n\n return $return;\n }",
"private function init_radialsearchExtension()\n {\n $key = 'radialsearch';\n\n // RETURN : extension is installed\n if ( t3lib_extMgm::isLoaded( $key ) )\n {\n return true;\n }\n // RETURN : extension is installed\n\n $header = 'FATAL ERROR!';\n $text = 'You are using a radial search filter in the current view.<br />\n But the extension Radial Search (Umkreissuche) (extension key: radialsearch) isn\\'t loaded.<br />\n Please remove the radialsearch filter or install and enable the extension radialsearch.';\n $this->pObj->drs_die( $header, $text );\n }",
"function is_legacy_searchwp() {\n\t\treturn ! ( defined( 'SEARCHWP_VERSION' ) && version_compare( SEARCHWP_VERSION, '3.99.0', '>=' ) );\n\t}",
"public function is_supported_php()\n {\n if (version_compare(PHP_VERSION, $this->min_php, '<=')) {\n return false;\n }\n\n return true;\n }",
"function enabled() {\n\t\treturn extension_loaded('mysql');\n\t}",
"public static function isSupported(): bool;",
"private function checkGDLibrary(){\n\t//Check for GD support\n\t\treturn extension_loaded('gd');\n\t}",
"public function isCurlAvailable(): bool\n {\n return (in_array('curl', get_loaded_extensions()));\n }"
] |
[
"0.6474907",
"0.6369485",
"0.6118117",
"0.61093074",
"0.6106799",
"0.6102086",
"0.6071297",
"0.6029455",
"0.59916615",
"0.5970481",
"0.5970481",
"0.5922955",
"0.58942163",
"0.58739233",
"0.5865526",
"0.58651394",
"0.5810938",
"0.5787059",
"0.5768697",
"0.5749014",
"0.57462907",
"0.57310987",
"0.5711167",
"0.56893545",
"0.5682003",
"0.5680776",
"0.5642848",
"0.5633872",
"0.5608789",
"0.5604833"
] |
0.74286944
|
0
|
Returns a curl object for conntecting to solr.
|
public function get_curl_object() {
if (!is_null($this->curl)) {
return $this->curl;
}
// Connection to Solr is allowed to use 'localhost' and other potentially blocked hosts/ports.
$this->curl = new \curl(['ignoresecurity' => true]);
$options = array();
// Build the SSL options. Based on pecl-solr and general testing.
if (!empty($this->config->secure)) {
if (!empty($this->config->ssl_cert)) {
$options['CURLOPT_SSLCERT'] = $this->config->ssl_cert;
$options['CURLOPT_SSLCERTTYPE'] = 'PEM';
}
if (!empty($this->config->ssl_key)) {
$options['CURLOPT_SSLKEY'] = $this->config->ssl_key;
$options['CURLOPT_SSLKEYTYPE'] = 'PEM';
}
if (!empty($this->config->ssl_keypassword)) {
$options['CURLOPT_KEYPASSWD'] = $this->config->ssl_keypassword;
}
if (!empty($this->config->ssl_cainfo)) {
$options['CURLOPT_CAINFO'] = $this->config->ssl_cainfo;
}
if (!empty($this->config->ssl_capath)) {
$options['CURLOPT_CAPATH'] = $this->config->ssl_capath;
}
}
// Set timeout as for Solr client.
$options['CURLOPT_TIMEOUT'] = !empty($this->config->server_timeout) ? $this->config->server_timeout : '30';
$this->curl->setopt($options);
if (!empty($this->config->server_username) && !empty($this->config->server_password)) {
$authorization = $this->config->server_username . ':' . $this->config->server_password;
$this->curl->setHeader('Authorization: Basic ' . base64_encode($authorization));
}
return $this->curl;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function solr_proxy_main() {\n $params = array();\n\tglobal $userdata;\n\n // The names of Solr parameters that may be specified multiple times.\n $multivalue_keys = array('bf', 'bq', 'facet.date', 'facet.date.other', 'facet.field', 'facet.query', 'fq', 'pf', 'qf');\n\n foreach ($_GET as $key => $value) {\n if (in_array($key, $multivalue_keys)) {\n $params[$key][] = $value;\n }\n elseif ($key == 'q') {\n $keys = $value;\n }\n else {\n $params[$key] = $value;\n }\n }\n\n $hour = (time() / (60 * 60)) % 24;\n $app = (($hour / 4) % 2) ? '/solr' : '/solralt';\n $transportInstance = new Apache_Solr_HttpTransport_Curl(array(CURLOPT_USERPWD => $userdata, CURLOPT_HTTPAUTH => CURLAUTH_ANY));\n $solr = new Apache_Solr_Service('localhost', 8080, $app, $transportInstance); \n\n var_dump($params);\n\n try {\n if(!isset($params['start'])) {\n $params['start'] = 0;\n }\n $response = $solr->search($keys, $params['start'], $params['rows'], $params);\n }\n catch (Exception $e) {\n die($e->__toString());\n }\n print $response->getRawResponse();\n}",
"protected function connect() {\n if (!$this->solr) {\n $this->solr = new Client();\n\n // The parent method is overridden so that this alternate adapter class\n // can be set. This line is the only difference from the parent method.\n $this->solr->setAdapter('Drupal\\search_api_pantheon\\Solarium\\PantheonCurl');\n\n $this->solr->createEndpoint($this->configuration + ['key' => 'core'], TRUE);\n $this->attachServerEndpoint();\n }\n }",
"public function getCurl() {\r\n $curl = new Curl();\r\n $curl->setOption(CURLOPT_HTTPHEADER, array(\r\n 'Content-Type:application/json',\r\n 'Authorization:' . $this->passcode,\r\n 'X-Forwarded-Host:' . $_SERVER['HTTP_HOST'],\r\n 'X-Forwarded-For:' . $_SERVER['SERVER_ADDR'],\r\n 'Referer:' . NetHelper::getCurrentURL(),\r\n ));\r\n $curl->setOption(CURLOPT_TIMEOUT, 200);\r\n $curl->setOption(CURLOPT_CONNECTTIMEOUT, 200);\r\n // temporarily disables SSL verifying\r\n $curl->setOption(CURLOPT_SSL_VERIFYPEER, false);\r\n return $curl;\r\n }",
"private function initCurl() {\r\n\t\tif (isset($this->curl)) { return $this->curl; }\r\n\r\n\t\t$this->curl = curl_init();\r\n\r\n\t\tcurl_setopt($this->curl, CURLOPT_RETURNTRANSFER, true);\r\n\t\tcurl_setopt($this->curl, CURLOPT_TIMEOUT, $this->request_timeout);\r\n\r\n\t\tif (isset($this->cookie_jar)) {\r\n\t\t\tcurl_setopt($this->curl, CURLOPT_COOKIEJAR, $this->cookie_jar);\r\n\t\t\tcurl_setopt($this->curl, CURLOPT_COOKIEFILE, $this->cookie_jar);\r\n\t\t}\r\n\r\n\t\tcurl_setopt($this->curl, CURLOPT_FOLLOWLOCATION, $this->is_multiple);\r\n\r\n\t\t# If a User Agent has been set, set the curl option\r\n\t\tif (isset($this->user_agent)) {\r\n\t\t\tcurl_setopt($this->curl, CURLOPT_USERAGENT, $this->user_agent);\r\n\t\t}\r\n\r\n\t\t# We are not too concerned about the strictness of SSL when finding redirects\r\n\t\t# Without these, some SSL links just fail to return anything\r\n\t\tcurl_setopt($this->curl, CURLOPT_SSL_VERIFYHOST, 0); \r\n\t\tcurl_setopt($this->curl, CURLOPT_SSL_VERIFYPEER, 0); \r\n\r\n\t\t# We want the headers returned to us to follow redirects\r\n\t\tcurl_setopt($this->curl, CURLOPT_HEADER, true); \r\n\t\t$this->code = curl_getinfo($this->curl, CURLINFO_HTTP_CODE);\r\n\t\treturn $this->curl;\r\n\t}",
"protected function getConnection() {\n\t\tstatic $connection;\n\t\tif ($connection === null) {\n\t\t\t$connection = new ASolrConnection();\n\t\t\t$connection->clientOptions->hostname = SOLR_HOSTNAME;\n\t\t\t$connection->clientOptions->port = SOLR_PORT;\n\t\t\t$connection->clientOptions->path = SOLR_PATH;\n\t\t\tASolrDocument::$solr = $connection;\n\t\t}\n\t\treturn $connection;\n\t}",
"public function api_connect($url) {\n return curl_init($url);\n }",
"public function setupCurl()\n {\n $ch = curl_init();\n curl_setopt($ch,CURLOPT_URL,\"https://jsonplaceholder.typicode.com/posts\");\n curl_setopt($ch, CURLOPT_HEADER, 0);\n curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);\n\n return $ch;\n }",
"function Curl($url = false , array $data = array()){\n\n\t\tif($url !== false){\n\n\t\t\t$build[CURLOPT_POST] = 1;\n\t\t\t$build[CURLOPT_POSTFIELDS] = http_build_query($data, '', '&');\n\n\t\t\treturn new curlseton($url,$build);\n\t\t\t\n\t\t}\n\t}",
"public function getCurl()\n {\n return $this->curl;\n }",
"private function create_curl($s_url, $post_params = array() )\n\t{\n\n\t\t$full_url = $this->settings['server'];\n if ($this->settings['port'] != '80') $full_url .= ':' . $this->settings['port'];\n $full_url .= $s_url ;\n\n\t\t$this->log( 'curl_init( ' . $full_url . ' )' );\n\t\t\n $post_value = Centrifuge::array_implode( '=', '&', $post_params );\n \n\t\t# Set cURL opts and execute request\n\t\t$ch = curl_init();\n\t\tif ( $ch === false )\n\t\t{\n\t\t\tthrow new CentrifugeException('Could not initialize cURL!');\n\t\t}\n\n\t\tcurl_setopt( $ch, CURLOPT_URL, $full_url );\n curl_setopt( $ch, CURLOPT_HTTPHEADER, array ( \"Content-type: application/x-www-form-urlencoded\" ) );\t\n\t\tcurl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );\n\t\tcurl_setopt( $ch, CURLOPT_TIMEOUT, $this->settings['timeout'] );\n\t\t\n $this->log( 'trigger POST: ' . $post_value );\n\n\t\tcurl_setopt( $ch, CURLOPT_POST, 1 );\n\t\tcurl_setopt( $ch, CURLOPT_POSTFIELDS, $post_value );\n \n\t\treturn $ch;\n\t}",
"private function init() {\n $this->_cm = curl_init();\n curl_setopt($this->_cm, CURLOPT_PROXY, $config['curl']['proxy']);\n curl_setopt($this->_cm, CURLOPT_HTTPAUTH, CURLAUTH_BASIC | CURLAUTH_DIGEST);\n curl_setopt($this->_cm, CURLOPT_SSL_VERIFYPEER, FALSE);\n curl_setopt($this->_cm, CURLOPT_SSL_VERIFYHOST, FALSE);\n curl_setopt($this->_cm, CURLOPT_RETURNTRANSFER, TRUE);\n curl_setopt($this->_cm, CURLOPT_TIMEOUT, $config['curl']['timeout']);\n curl_setopt($this->_cm, CURLOPT_POST, true); \n }",
"public function getClient($path='/solr')\n {\n $options = $this->options;\n $options = [\n 'secure' => $options->isSecure(),\n 'hostname' => $options->getHostname(),\n 'port' => $options->getPort(),\n 'path' => $path,\n 'login' => $options->getUsername(),\n 'password' => $options->getPassword(),\n 'wt' => 'phps'\n ];\n\n return new \\SolrClient($options);\n }",
"private function initCurl()\n {\n $this->curlObj = curl_init();\n curl_setopt_array($this->curlObj, array(\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_POST => true,\n CURLOPT_FORBID_REUSE => true,\n CURLOPT_HEADER => false,\n CURLOPT_TIMEOUT => 120,\n CURLOPT_CONNECTTIMEOUT => 2,\n CURLOPT_HTTPHEADER => [\"Connection: Keep-Alive\", \"Keep-Alive: 120\"]\n ));\n }",
"function basicCurl($curlURL) {\n $url = $curlURL;\n $cURL = curl_init();\n curl_setopt($cURL, CURLOPT_URL, $url);\n curl_setopt($cURL, CURLOPT_HTTPGET, true);\n curl_setopt($cURL, CURLOPT_HTTPHEADER, array(\n 'Content-Type: application/json',\n 'Accept: application/json'\n ));\n curl_setopt($cURL, CURLOPT_FOLLOWLOCATION, true);\n curl_setopt($cURL, CURLOPT_RETURNTRANSFER, 1);\n curl_setopt($cURL, CURLOPT_USERAGENT, \"spider\");\n $result = curl_exec($cURL);\n \nif ($result === FALSE) {\n return \"cURL Error: \" . curl_error($cURL);\n} else {\n\treturn $result;\n}\n curl_close($cURL);\n \n}",
"public function getTransport()\n {\n return new Curl;\n }",
"private function configureCurl ()\n {\n curl_setopt_array($this->cURL, [\n CURLOPT_URL => $this->url,\n CURLOPT_RETURNTRANSFER => true\n ]);\n }",
"private function registerCurl()\n {\n // Curl options\n $curlOptions = [\n [CURLOPT_RETURNTRANSFER, true],\n [CURLOPT_FOLLOWLOCATION, true],\n [CURLOPT_MAXREDIRS, 2],\n [CURLOPT_HTTPAUTH, CURLAUTH_BASIC],\n [CURLOPT_SSLVERSION, 6],\n [CURLOPT_SSL_VERIFYPEER, false],\n [CURLOPT_SSL_VERIFYHOST, false],\n ];\n\n // Register service via dependency injection\n $service = $this->services->register('crawler', '%crawler.class%');\n\n // Set options via setopt\n array_walk(\n $curlOptions,\n function (array $params) use ($service) {\n $service->addMethodCall('setopt', $params);\n }\n );\n\n $this->services->setParameter('crawler.class', 'Curl\\Curl');\n }",
"private function initCurl()\n\t{\n\t\t$this->_curl = curl_init();\n\t\t//TODO: delete useless lines\n\t\tcurl_setopt ($this->_curl, CURLOPT_SSL_VERIFYPEER, FALSE);\n\t\tcurl_setopt ($this->_curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);\n\t\tcurl_setopt ($this->_curl, CURLOPT_TIMEOUT, 4000);\n\t\tcurl_setopt ($this->_curl, CURLOPT_FOLLOWLOCATION, 1);\n\t\tcurl_setopt ($this->_curl, CURLOPT_RETURNTRANSFER, 1);\n\t\tcurl_setopt ($this->_curl, CURLOPT_COOKIEJAR, self::$_COOKIE);\n\t\tcurl_setopt ($this->_curl, CURLOPT_COOKIEFILE, self::$_COOKIE);\n\t\tcurl_setopt ($this->_curl, CURLOPT_POST, 1);\n\t}",
"private function create_curl($s_url, $request_method = 'GET', $query_params = array() )\n\t{\n\t\t# Create the signed signature...\n\t\t$signed_query = Pusher::build_auth_query_string(\n\t\t\t$this->settings['auth_key'],\n\t\t\t$this->settings['secret'],\n\t\t\t$request_method,\n\t\t\t$s_url,\n\t\t\t$query_params);\n\n\t\t$full_url = $this->settings['server'] . ':' . $this->settings['port'] . $s_url . '?' . $signed_query;\n\t\t\n\t\t# Set cURL opts and execute request\n\t\t$ch = curl_init();\n\t\tif ( $ch === false )\n\t\t{\n\t\t\tthrow new PusherException('Could not initialise cURL!');\n\t\t}\n\t\t\n\t\tcurl_setopt( $ch, CURLOPT_URL, $full_url );\n\t\tcurl_setopt( $ch, CURLOPT_HTTPHEADER, array ( \"Content-Type: application/json\" ) );\n\t\tcurl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );\n\t\tcurl_setopt( $ch, CURLOPT_TIMEOUT, $this->settings['timeout'] );\n\t\t\n\t\treturn $ch;\n\t}",
"protected function connect()\n {\n $url = $this->createUrl(\"\");\n // create curl resource\n $this->connection = curl_init();\n\n // set url\n curl_setopt($this->connection, CURLOPT_URL, $url);\n\n //return the transfer as a string\n curl_setopt($this->connection, CURLOPT_RETURNTRANSFER, 1);\n\n }",
"public function __construct($hostname, $port, $path = \"solr\", $options = array()) {\n $this->baseurl = \"https://$hostname:$port/$path/select\";\t// select is for searching\n\n $this->facet_fields = array();\n $this->facet_limit = 5;\t// reasonable defaults (?)\n $this->facet_mincount = 2;\n\n // configure Solr response format; default to json (must be enabled in Solr)\n if (isset($options['responseFormat'])) {\n $this->responseFormat = $options['responseFormat'];\n }\n\n $this->filter = \"\";\n }",
"function initCurl() {\n\t$ch = curl_init();\n\tcurl_setopt( $ch, CURLOPT_MAXCONNECTS, 100 );\n\tcurl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );\n\tcurl_setopt( $ch, CURLOPT_ENCODING, 'gzip' );\n\tcurl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );\n\tcurl_setopt( $ch, CURLOPT_TIMEOUT, 100 );\n\tcurl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 10 );\n\tcurl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 0 );\n\tcurl_setopt( $ch, CURLOPT_URL, \"https://en.wikipedia.org/w/api.php\" );\n\tcurl_setopt( $ch, CURLOPT_POST, 1 );\n\tcurl_setopt( $ch, CURLOPT_HTTPGET, 0 );\n\tcurl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, 0 );\t//For reasons that escape me, CURL fails without this.\n\treturn $ch;\n}",
"private function initCurl() {\n\t\tif( $this->valid() ) {\n\t\t\t$this->ch = curl_init();\n\t\t\tcurl_setopt( $this->ch, CURLOPT_URL, \t\t\t\t$this->config['postUrl'] );\n\t\t\tcurl_setopt( $this->ch, CURLOPT_RETURNTRANSFER, \tTRUE);\n\t\t\tcurl_setopt( $this->ch, CURLOPT_FOLLOWLOCATION, \tTRUE);\n\t\t\tcurl_setopt( $this->ch, CURLOPT_TIMEOUT, \t\t\t10);\n\t\t\tcurl_setopt( $this->ch, CURLOPT_HEADER, \t\t\tFALSE ); \n\t\t\tcurl_setopt( $this->ch, CURLOPT_POST, \t\t\t\tcount( $this->getFieldsAsString() ) );\n\t\t\tcurl_setopt( $this->ch, CURLOPT_POSTFIELDS, \t\t$this->getFieldsAsString() ); \n\t\t\tcurl_setopt( $this->ch, CURLOPT_REFERER, \t\t\t$this->config['referrerUrl'] );\n\t\t\tcurl_setopt( $this->ch, CURLOPT_USERAGENT, \t\t\t$this->config['userAgent']);\n\t\t\tcurl_setopt( $this->ch, CURLOPT_AUTOREFERER, \t\tTRUE);\n\t\t\tcurl_setopt( $this->ch, CURLOPT_VERBOSE, \t\t\tFALSE);\n\t\t\tcurl_setopt( $this->ch, CURLOPT_COOKIEJAR, \t\t\t$this->config['cookieFile']);\n\t\t\treturn TRUE;\n\t\t}\n\t\treturn FALSE;\n\t}",
"public function initialize()\n {\n curl_setopt($this->ch, CURLOPT_AUTOREFERER, TRUE);\n curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, TRUE);\n curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);\n curl_setopt($this->ch, CURLOPT_MAXREDIRS, 5);\n curl_setopt($this->ch, CURLOPT_USERAGENT, self::$USER_AGENT); \n // curl_setopt($this->ch, CURLOPT_COOKIEFILE, '/tmp/curl_client');\n // curl_setopt($this->ch, CURLOPT_COOKIEJAR, '/tmp/curl_client');\n // curl_setopt($this->ch, CURLOPT_HEADER, TRUE);\n return $this;\n }",
"public function __construct(){\n\t\t$solariumClient = new SolariumClient();\n\t\t$this->_solariumClient = $solariumClient->getSolrClient();\n\t}",
"function quick_curl( $url, $user_auth = null, $rest = 'GET', $input = null, $type = 'JSON'){\n if( function_exists('curl_init') ){\n\n $ch = curl_init();\n curl_setopt( $ch, CURLOPT_URL, $url ); // The URL we're using to get/send data\n\n if( $user_auth ){\n curl_setopt( $ch, CURLOPT_USERPWD, $user_auth ); // Add the authentication\n }\n\n if( $rest == 'POST' ){\n curl_setopt( $ch, CURLOPT_POST, true ); // Send a post request to the server\n } elseif( $rest == 'PATCH' ){\n curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, 'PATCH'); // Send a patch request to the server to update the listing\n } elseif( $rest == 'PUT'){\n curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, 'PUT'); // Send a put request to the server to update the listing\n } // If POST or PATCH isn't set then we're using a GET request, which is the default\n\n curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 15 ); // Timeout when connecting to the server\n curl_setopt( $ch, CURLOPT_TIMEOUT, 30 ); // Timeout when retrieving from the server\n curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); // We want to capture the data returned, so set this to true\n //curl_setopt( $ch, CURLOPT_HEADER, true ); // Get the HTTP headers sent with the data\n curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); // We don't want to force SSL incase a site doesn't use it\n\n if( $rest !== 'GET' ){\n\n curl_setopt( $ch, CURLOPT_HTTPHEADER, array( 'Content-Type: ' . mime_type( $type ), 'Content-Length: ' . strlen( $input ) ) ); // Tell server to expect the right content type and the content length\n curl_setopt( $ch, CURLOPT_POSTFIELDS, $input ); // Send the actual data\n }\n\n // Get the response\n $response = curl_exec( $ch );\n\n // Check if there's an error in the header\n $httpcode = curl_getinfo( $ch, CURLINFO_HTTP_CODE );\n\n // If there's any cURL errors\n if( curl_errno( $ch ) || ( $httpcode < 200 || $httpcode >= 300 ) ){\n $data = 'error';\n } else {\n \n // Turn response into stuff we can use\n if( $type == 'JSON' ){\n $data = json_decode( $response, true );\n } elseif( $type == 'csv' ){\n $data = csv_to_array( $response );\n } else {\n $data = $response;\n }\n\n }\n\n // Close curl\n curl_close( $ch );\n \n // Send the data back to the function calling the cURL\n return $data;\n \n } else {\n \n // cURL not installed so leave\n return false;\n \n }\n\n\t\n}",
"private function build_curl_handle($url) {\n if (!function_exists('curl_init')) {\n die('the curl library is required for this client to work');\n }\n $ch = curl_init();\n if (!$ch) {\n die('could not initialize curl');\n }\n curl_setopt($ch, CURLOPT_URL, $url);\n // Method and headers can be different, but these are always the same.\n curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);\n curl_setopt($ch, CURLOPT_USERPWD, $this->auth_string);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\n return $ch;\n }",
"public function __construct() {\n $this->_handle = curl_init();\n $this->_opt(CURLOPT_HEADER, false);\n $this->_opt(CURLOPT_RETURNTRANSFER, true);\n }",
"private function sendQueryByCurl() {\n $this->curl = curl_init();\n\n // JSON data request\n $jsonData = $this->getJsonData();\n\n // some params\n $urlParams = $this->getParamsUrlFormat();\n\n $this->setCurlOpts($this->curl, $jsonData, $urlParams);\n $this->setResult(curl_exec($this->curl));\n $this->setHttpCode(curl_getinfo($this->curl, CURLINFO_HTTP_CODE));\n\n curl_close($this->curl);\n }",
"public static function getServiceName()\n {\n return 'Curl';\n }"
] |
[
"0.64386106",
"0.63092905",
"0.60837996",
"0.596888",
"0.59659225",
"0.59054947",
"0.5852627",
"0.57875866",
"0.5756786",
"0.57407564",
"0.5712075",
"0.5664801",
"0.56377655",
"0.5634256",
"0.55847466",
"0.5571321",
"0.55468297",
"0.55258715",
"0.54942966",
"0.5458641",
"0.5448775",
"0.5440564",
"0.5438268",
"0.5432412",
"0.5423423",
"0.539931",
"0.5390828",
"0.5378573",
"0.5377054",
"0.53558224"
] |
0.8133004
|
0
|
Return a Moodle url object for the server connection.
|
public function get_connection_url($path) {
// Must use the proper protocol, or SSL will fail.
$protocol = !empty($this->config->secure) ? 'https' : 'http';
$url = $protocol . '://' . rtrim($this->config->server_hostname, '/');
if (!empty($this->config->server_port)) {
$url .= ':' . $this->config->server_port;
}
$url .= '/solr/' . $this->config->indexname . '/' . ltrim($path, '/');
return new \moodle_url($url);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getServerUrl() {\n return $this->conn->getServerUrl();\n }",
"public function getServerUrl() {\n $host = $this->getHeader(Header::HEADER_HOST);\n if (!$host) {\n $host = 'localhost';\n }\n\n if ($this->isSecure) {\n return 'https://' . $host;\n }\n\n return 'http://' . $host;\n }",
"static function URL ()\n\t\t{\n\t\t\tif (php_sapi_name() === \"cli\")\n\t\t\t\treturn NULL;\n\t\t\treturn (self::Protocol().\"://\".self::ServerName().self::PortReadable().self::RequestURI());\n\t\t}",
"protected function _getUrl()\n {\n $s = empty($_SERVER['HTTPS']) ? '' : ($_SERVER['HTTPS'] == 'on') ? 's' : '';\n\n $protocol = substr(strtolower($_SERVER['SERVER_PROTOCOL']), 0, strpos(strtolower($_SERVER['SERVER_PROTOCOL']), '/')) . $s;\n\n $port = ($_SERVER['SERVER_PORT'] == '80') ? '' : (':'.$_SERVER['SERVER_PORT']);\n\n return $protocol . '://' . $_SERVER['SERVER_NAME'] . $port . $_SERVER['REQUEST_URI'];\n }",
"public function getUrl()\n {\n return $this->scheme . '://' . $this->host . ':' . $this->port . '/' . trim($this->path, '/');\n }",
"protected function _getURL()\n {\n $s = empty($_SERVER[\"HTTPS\"]) ? '' : ($_SERVER[\"HTTPS\"] == \"on\") ? \"s\" : \"\";\n\n $protocol = substr(\n strtolower($_SERVER[\"SERVER_PROTOCOL\"]), 0, strpos(strtolower($_SERVER[\"SERVER_PROTOCOL\"]), \"/\")\n ) . $s;\n\n $port = ($_SERVER[\"SERVER_PORT\"] == \"80\") ? \"\" : (\":\".$_SERVER[\"SERVER_PORT\"]);\n\n return $protocol.\"://\".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI'];\n }",
"public function url(){\n $protocol = \"http://\";\n if ( !empty( $_SERVER['HTTPS'] ) ) {\n $protocol = \"https://\";\n }\n $url = $protocol . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];\n return $url;\n }",
"public function getUrl()\n {\n if ($this->urlPartsModified) {\n $scheme = $this->getScheme();\n $host = $this->getHost();\n $port = $this->getPort();\n #$user = isset($parsed_url['user']) ? $parsed_url['user'] : '';\n #$pass = isset($parsed_url['pass']) ? ':' . $parsed_url['pass'] : '';\n #$pass = ($user || $pass) ? \"$pass@\" : '';\n $path = $this->getPath();\n $query = !empty($this->urlParts['query']) ? '?' . $this->urlParts['query'] : '';\n\n if ($scheme == 'http' && $port != 80) {\n $port = ':' . $port;\n } else if ($scheme == 'https' && $port != 443) {\n $port = ':' . $port;\n }\n\n $this->url = \"$scheme://$host$port$path$query\";\n }\n\n return $this->url;\n }",
"function getUrl() {\n\t\tif($this->_url === null) {\n\t\t\t$this->_url = $this->getProtocol() . '://' . str_replace('www.', '', $_SERVER['HTTP_HOST']) . $_SERVER['REQUEST_URI'];\n\t\t}\n\t\treturn $this->_url;\n\t}",
"public static function getBaseUrl()\n\t{\n\t\tlist($host, $address, $port, $ssl) = MHTTPD::getServerInfo();\n\t\t$url = $ssl ? 'https://' : 'http://';\n\t\t$url .= $host.':'.$port;\n\t\treturn $url;\n\t}",
"public function getFullUrl()\r\n {\r\n return $this->hostname . '.' . $this->owner->username . '.' . Yii::app()->params['serverBaseHost'];\r\n }",
"protected function url()\n\t{\n\t\treturn new \\Jstewmc\\Url\\Url('http://localhost:8000');\n\t}",
"static public function selfURL()\r\n {\r\n //global $cfgSite;\r\n $cfgSite = Warecorp_Config_Loader::getInstance()->getAppConfig('cfg.site.xml');\r\n $s = empty($_SERVER[\"HTTPS\"]) ? '' : ($_SERVER[\"HTTPS\"] == \"on\") ? \"s\" : \"\";\r\n $protocol = self::strleft(strtolower($_SERVER[\"SERVER_PROTOCOL\"]), \"/\").$s;\r\n if ($cfgSite->use_port_in_URL == '1') {\r\n $port = ($_SERVER[\"SERVER_PORT\"] == \"80\") ? \"\" : (\":\".$_SERVER[\"SERVER_PORT\"]);\r\n } else {$port = '';}\r\n return $protocol.\"://\".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI'];\r\n }",
"public function getRequestURL() {\n\t\t$scheme = $this->getScheme();\n\t\t$port = $this->getServerPort();\n\t\t$url = $scheme . '://';\n\t\t$url .= $this->getServerName();\n\t\tif(($scheme == 'http' && $port != 80) || ($scheme == 'https' && $port != 443)) {\n\t\t\t$url .= ':' . $port;\n\t\t}\n\t\t$url .= $this->getRequestURI();\n\t\treturn $url;\n\t}",
"public function get_url(): string\n {\n return $this->get_url_internal();\n }",
"public static function requestedURL()\n\t{\n\t\t$url = new SMURL;\n\t\t\n\t\t// set scheme\n\t\t$scheme = ( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] == 'on' ) ? 'https' : 'http';\n\t\t$url->setScheme( $scheme );\n\t\t\n\t\t// set host\n\t\t$url->setHost( $_SERVER['HTTP_HOST'] );\n\t\t\n\t\t// set path and query\n\t\tif( isset( $_SERVER['REQUEST_URI'] ) )\n\t\t{\n\t\t\tpreg_match( '/\\/([^\\?]*)(?:\\?(.*))?$/', $_SERVER['REQUEST_URI'], $match );\n\t\t\t$url->setPath( $match[1] );\n\t\t\t$url->setQueryString( $match[2] );\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$url->setPath( $_SERVER['SCRIPT_NAME'] );\n\t\t\t$url->setQueryString( $_SERVER['QUERY_STRING'] );\n\t\t}\n\n\t\t// set port\n\t\t$url->setPort( $_SERVER['SERVER_PORT'] );\n\t\t\n\t\treturn $url;\n\t}",
"public function getInstanceUrl(): string\n {\n return $this->instanceUrl;\n }",
"protected function getRemoteServerUrl(){\n return rtrim(@$this->params['server']);\n }",
"public function getServerUrl()\n { \n return $this->_shoptimallyDomain;\n }",
"public function getServer()\n {\n return sprintf(\"mongodb://%s:%s@%s\", $this->config['user'], $this->config['password'], $this->config['host']);\n }",
"public function getOwnURL() \n\t{ \n\t\t$s = empty($_SERVER[\"HTTPS\"]) ? '' : ($_SERVER[\"HTTPS\"] == \"on\") ? \"s\" : \"\"; \n\t\t$protocol = $this->strleft(strtolower($_SERVER[\"SERVER_PROTOCOL\"]), \"/\").$s; \n$port = ($_SERVER[\"SERVER_PORT\"] == \"80\" || $_SERVER[\"SERVER_PORT\"] == \"82\") ? \"\" : (\":\".$_SERVER[\"SERVER_PORT\"]); \n\t\treturn $protocol.\"://\".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI']; \n\t}",
"public function getUrl()\n {\n $uri = $this->getHost();\n\n $server = provider::access('server');\n\n if ($server->isExist('PHP_SELF') && $server->isExist('REQUEST_URI') && $server->isValid('REQUEST_URI', validate::T_PRINTABLE)) {\n // for 'good' servers\n $uri .= $server->getValue('REQUEST_URI');\n } else {\n // for IIS\n if ($server->isValid('SCRIPT_NAME', validate::T_PRINTABLE)) {\n $uri .= $server->getValue('SCRIPT_NAME');\n }\n\n if ($server->isValid('QUERY_STRING', validate::T_PRINTABLE)) {\n $uri .= '?' . $server->getValue('QUERY_STRING');\n }\n }\n\n return $uri;\n }",
"public static function url(): string\n\t{\n\t\treturn static::$url;\n\t}",
"public function getConncetion() {\n return $this->link;\n }",
"public function getUrl(){\n return $this->server->getUrl() . \"/\" . $this->name;\n \n }",
"public function getURL(): string\n {\n return $this->http->getURL();\n }",
"public function getRemoteUrl();",
"public function url() \n\t{\n\t\treturn static::protocol().'://'.static::host().$this->server('REQUEST_URI', '/' );\n\t}",
"function getUrl() {\n\t\t$url = @( $_SERVER[\"HTTPS\"] != 'on' ) ? 'http://'.$_SERVER[\"SERVER_NAME\"] : 'https://'.$_SERVER[\"SERVER_NAME\"];\n\t\t$url .= ( $_SERVER[\"SERVER_PORT\"] !== 80 ) ? \":\".$_SERVER[\"SERVER_PORT\"] : \"\";\n\t\t$url .= $_SERVER[\"REQUEST_URI\"];\n\t\treturn $url;\n\t}",
"public function getUrl(): string\n {\n $query = $this->getQuery();\n return\n $this->getScheme() .\n '://' .\n $this->getHostAndPort() .\n $this->getRoot() .\n $this->getPath() .\n (!empty($query) ? '?' . http_build_query($query) : '');\n }"
] |
[
"0.74605083",
"0.691433",
"0.6877399",
"0.6744966",
"0.66801834",
"0.66236573",
"0.649191",
"0.6455794",
"0.64392775",
"0.64328206",
"0.642971",
"0.64204705",
"0.64204377",
"0.63444483",
"0.63231915",
"0.63135827",
"0.6288305",
"0.62718254",
"0.62709564",
"0.6267786",
"0.6260245",
"0.62475693",
"0.6234854",
"0.62320024",
"0.62181175",
"0.6181374",
"0.61811894",
"0.6160093",
"0.6157741",
"0.6137115"
] |
0.725451
|
1
|
Solr supports deleting the index for a course.
|
public function delete_index_for_course(int $oldcourseid) {
$client = $this->get_search_client();
try {
$client->deleteByQuery('courseid:' . $oldcourseid);
$client->commit(true);
return true;
} catch (\Exception $e) {
throw new \core_search\engine_exception('error_solr', 'search_solr', '', $e->getMessage());
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function deleteAction()\n {\n if ( $this->getRequest()->getParam('id') > 0) {\n try {\n $coursedoc = Mage::getModel('bs_coursedoc/coursedoc');\n $coursedoc->setId($this->getRequest()->getParam('id'))->delete();\n Mage::getSingleton('adminhtml/session')->addSuccess(\n Mage::helper('bs_coursedoc')->__('Course Document was successfully deleted.')\n );\n $this->_redirect('*/*/');\n return;\n } catch (Mage_Core_Exception $e) {\n Mage::getSingleton('adminhtml/session')->addError($e->getMessage());\n $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));\n } catch (Exception $e) {\n Mage::getSingleton('adminhtml/session')->addError(\n Mage::helper('bs_coursedoc')->__('There was an error deleting course doc.')\n );\n $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));\n Mage::logException($e);\n return;\n }\n }\n Mage::getSingleton('adminhtml/session')->addError(\n Mage::helper('bs_coursedoc')->__('Could not find course doc to delete.')\n );\n $this->_redirect('*/*/');\n }",
"public function deleteFromIndex()\n {\n if ($this->es_info) {\n ESHelper::deleteDocumentFromType($this);\n }\n }",
"public function index_delete(){\n\t\t\n\t\t}",
"public function delete_index_for_course(int $oldcourseid) {\n $this->deletes[] = ['course', $oldcourseid];\n return true;\n }",
"public function deletecourses ($id_course) {\n $sqlQuery = \" DELETE FROM courses \";\n $sqlQuery .= \" WHERE id_course= $id_course\";\n $result = $this -> getDbManager () -> executeQuery ( $sqlQuery );\n return $result ;\n }",
"public static function deleteIndex()\n {\n $db = static::getDb();\n $command = $db->createCommand();\n $command->deleteIndex(static::index(), static::type());\n }",
"public function deleteCourse($courseid){\n Logger::Log(\n 'starts DELETE DeleteCourse',\n LogLevel::DEBUG\n );\n\n $courseid = DBJson::mysql_real_escape_string( $courseid );\n\n foreach ( $this->_createCourse as $_link ){\n $result = Request::routeRequest(\n 'DELETE',\n '/course/course/'.$courseid,\n array(),\n '',\n $_link,\n 'course'\n );\n\n // checks the correctness of the query\n if ( $result['status'] >= 200 &&\n $result['status'] <= 299 ){\n\n $this->app->response->setStatus( 201 );\n if ( isset( $result['headers']['Content-Type'] ) )\n $this->app->response->headers->set(\n 'Content-Type',\n $result['headers']['Content-Type']\n );\n\n } else {\n Logger::Log(\n 'POST DeleteCourse failed',\n LogLevel::ERROR\n );\n $this->app->response->setStatus( isset( $result['status'] ) ? $result['status'] : 409 );\n $this->app->stop( );\n }\n }\n }",
"public function delete() {\n\n // Does the course object have an ID?\n if ( is_null( $this->courseId ) ) trigger_error ( \"Course::delete(): Attempt to delete course object that does not have its ID property set.\", E_USER_ERROR );\n\n // Delete the Student\n $conn = new PDO( DB_DSN, DB_USERNAME, DB_PASSWORD );\n $st = $conn->prepare ( \"DELETE FROM course WHERE courseId = :courseId LIMIT 1\" );\n $st->bindValue( \":courseId\", $this->courseId, PDO::PARAM_INT );\n $st->execute();\n $conn = null;\n }",
"public function delete_index_for_context(int $oldcontextid) {\n $client = $this->get_search_client();\n try {\n $client->deleteByQuery('contextid:' . $oldcontextid);\n $client->commit(true);\n return true;\n } catch (\\Exception $e) {\n throw new \\core_search\\engine_exception('error_solr', 'search_solr', '', $e->getMessage());\n }\n }",
"public function massDeleteAction()\n {\n $coursedocIds = $this->getRequest()->getParam('coursedoc');\n if (!is_array($coursedocIds)) {\n Mage::getSingleton('adminhtml/session')->addError(\n Mage::helper('bs_coursedoc')->__('Please select course docs to delete.')\n );\n } else {\n try {\n foreach ($coursedocIds as $coursedocId) {\n $coursedoc = Mage::getModel('bs_coursedoc/coursedoc');\n $coursedoc->setId($coursedocId)->delete();\n }\n Mage::getSingleton('adminhtml/session')->addSuccess(\n Mage::helper('bs_coursedoc')->__('Total of %d course docs were successfully deleted.', count($coursedocIds))\n );\n } catch (Mage_Core_Exception $e) {\n Mage::getSingleton('adminhtml/session')->addError($e->getMessage());\n } catch (Exception $e) {\n Mage::getSingleton('adminhtml/session')->addError(\n Mage::helper('bs_coursedoc')->__('There was an error deleting course docs.')\n );\n Mage::logException($e);\n }\n }\n $this->_redirect('*/*/index');\n }",
"public static function deleteCourse()\n {\n global $cont;\n $script = $_POST['script'];\n $courseId = $_POST['delete_id'];\n $request = $cont->prepare(\"SELECT FROM requests WHERE courses_id = ?\");\n $request->execute([$courseId]);\n if(!empty($request->fetchColumn()))\n {\n session_start();\n $_SESSION['error'] = \"Not Allowed\";\n header(\"location:../admin/pages/tables/Courses.php\");\n die(); \n }\n if(!empty($script))\n {\n session_start();\n $_SESSION['error'] = \"Not Allowed\";\n header(\"location:../admin/pages/tables/Courses.php\");\n die();\n }\n $courses = $cont->prepare(\"DELETE FROM courses WHERE id = ?\");\n $courses->execute([$courseId]);\n session_start();\n $_SESSION['message'] = \"course was deleted\";\n header(\"location:../admin/pages/tables/Courses.php\");\n \n \n \n }",
"function apachesolr_index_delete_index($env_id, $entity_type = NULL, $bundle = NULL) {\n if (apachesolr_environment_variable_get($env_id, 'apachesolr_read_only', APACHESOLR_READ_WRITE) == APACHESOLR_READ_ONLY) {\n watchdog('Apache Solr', 'Trying to update the Solr index while the environment %env_id is read-only in function %function', array('%function' => __FUNCTION__, '%env_id' => $env_id), WATCHDOG_WARNING);\n return FALSE;\n }\n // Instantiate a new Solr object.\n try {\n $solr = apachesolr_get_solr($env_id);\n $query = '*:*';\n\n if (!empty($entity_type) && !empty($bundle)) {\n $query = \"(bundle:$bundle AND entity_type:$entity_type) OR sm_parent_entity_bundle:{$entity_type}-{$bundle}\";\n }\n elseif (!empty($bundle)) {\n $query = \"(bundle:$bundle)\";\n }\n\n // Allow other modules to modify the delete query.\n // For example, use the site hash so that you only delete this site's\n // content: $query = 'hash:' . apachesolr_site_hash()\n drupal_alter('apachesolr_delete_by_query', $query);\n $solr->deleteByQuery($query);\n $solr->commit();\n\n // Log the query used for deletion.\n watchdog('Apache Solr', 'Deleted documents from index with query @query', array('@query' => $query), WATCHDOG_INFO);\n\n if (!empty($entity_type)) {\n $reindex_callback = apachesolr_entity_get_callback($entity_type, 'reindex callback');\n if (is_callable($reindex_callback)) {\n $reindex_callback($env_id, $bundle);\n }\n }\n else {\n apachesolr_index_mark_for_reindex($env_id);\n }\n\n apachesolr_set_last_index_updated($env_id, REQUEST_TIME);\n }\n catch (Exception $e) {\n watchdog('Apache Solr', nl2br(check_plain($e->getMessage())), NULL, WATCHDOG_ERROR);\n return FALSE;\n }\n return TRUE;\n}",
"public function destroy(course $course)\n {\n //\n }",
"public function deleteAction()\n {\n if ( $this->getRequest()->getParam('id') > 0) {\n try {\n $curriculumdoc = Mage::getModel('bs_curriculumdoc/curriculumdoc');\n $curriculumdoc->setId($this->getRequest()->getParam('id'))->delete();\n Mage::getSingleton('adminhtml/session')->addSuccess(\n Mage::helper('bs_curriculumdoc')->__('Curriculum Document was successfully deleted.')\n );\n $this->_redirect('*/*/');\n return;\n } catch (Mage_Core_Exception $e) {\n Mage::getSingleton('adminhtml/session')->addError($e->getMessage());\n $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));\n } catch (Exception $e) {\n Mage::getSingleton('adminhtml/session')->addError(\n Mage::helper('bs_curriculumdoc')->__('There was an error deleting curriculum doc.')\n );\n $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));\n Mage::logException($e);\n return;\n }\n }\n Mage::getSingleton('adminhtml/session')->addError(\n Mage::helper('bs_curriculumdoc')->__('Could not find curriculum doc to delete.')\n );\n $this->_redirect('*/*/');\n }",
"function course_delete(){\n\n\t\t$id = $this->input->post('id');\n\t\t$field = $this->input->post('field');\n\t\t$table = $this->input->post('table');\n\t\n\t\tif($this->setting_model->deleteData($table, $field, $id)) {\n\t\t\t$this->setting_model->delete('course_module_subject','course_id',$id);\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}",
"public function removeFromIndex()\n\t{\n\t\t$params = $this->getBasicEsParams();\n\t\t// By default all writes to index will be synchronous\n\t\t$params['custom'] = ['refresh' => true];\n\n\t\ttry {\n\t\t\t$result = $this->getElasticSearchClient()->delete($params);\n\t\t}\n\t\tcatch (Missing404Exception $e) {\n\t\t\t// That will mean the document was not found in index\n\t\t}\n\n\t\tDB::table($this->getTable())\n\t\t\t->where($this->getKeyName(), '=', $this->getKeyForSaveQuery())\n\t\t\t->update(['indexed_at' => null]);\n\n\t\treturn isset($result) ? $result : null;\n\t}",
"public function deleteIndex(string $documentType);",
"function local_mediacore_course_delete_event_handler($course) {\n global $DB;\n $DB->delete_records('config_plugins',\n array(\n 'plugin' => MEDIACORE_LOCAL_COURSELTI_SETTING_NAME,\n 'name' => (string)$course->id,\n )\n );\n return TRUE;\n}",
"public function deleteIndex($category, $id);",
"function __safeDeleteDocument() {\n\t\ttry {\n\t\t\t$this->solr->deleteById($this->__createDocId());\n\t\t\t$this->solr->commit();\n\t\t\t$this->solr->optimize();\t\n\t\t} catch (Exception $e) {\n\t\t\t$this->log($e, 'solr');\n\t\t}\n\t}",
"public function destroy(Course $course)\n {\n //\n }",
"public function destroy(Course $course)\n {\n //\n }",
"public function testDelete()\r\n\t{\r\n\t\t// Load table\r\n\t\t$table = Table::model()->findByPk(array(\r\n\t\t\t'TABLE_SCHEMA' => 'indextest',\r\n\t\t\t'TABLE_NAME' => 'table2',\r\n\t\t));\r\n\r\n\t\t// Delete all indices\r\n\t\tforeach($table->indices AS $index)\r\n\t\t{\r\n\t\t\t$this->assertNotSame(false, $index->delete());\r\n\t\t}\r\n\r\n\t\t// Reload table\r\n\t\t$table->refresh();\r\n\r\n\t\t// Check index count\r\n\t\t$this->assertEquals(0, count($table->indices));\r\n\t}",
"public function testDeleteDocument()\n {\n echo \"\\nTesting subject deletion...\";\n $id = \"0\";\n \n //$url = TestServiceAsReadOnly::$elasticsearchHost . \"/CIL_RS/index.php/rest/documents/\".$id;\n $url = TestServiceAsReadOnly::$elasticsearchHost .$this->context.\"/documents/\".$id;\n \n $response = $this->curl_delete($url);\n // echo $response;\n $json = json_decode($response);\n $this->assertTrue(!$json->success);\n }",
"public function clearIndex()\n {\n $this->eventManager->dispatch(Events::PRE_CLEAR_INDEX, new Event($this->solrClient));\n\n try\n {\n $delete = $this->solrClient->createUpdate();\n $delete->addDeleteQuery('*:*');\n $delete->addCommit();\n\n $this->solrClient->update($delete);\n }\n catch(\\Exception $e)\n {\n $errorEvent = new ErrorEvent(null, null, null, 'clear-index');\n $errorEvent->setException($e);\n\n $this->eventManager->dispatch(Events::ERROR, $errorEvent);\n }\n\n $this->eventManager->dispatch(Events::POST_CLEAR_INDEX, new Event($this->solrClient));\n }",
"public function testDelete()\n {\n if (! $this->_url) $this->markTestSkipped(\"Test requires a CouchDb server set up - see TestConfiguration.php\");\n $db = $this->_setupDb();\n \n $db->create(array('a' => 1), 'mydoc');\n \n // Make sure document exists in DB\n $doc = $db->retrieve('mydoc');\n $this->assertType('Sopha_Document', $doc);\n \n // Delete document\n $ret = $db->delete('mydoc', $doc->getRevision());\n \n // Make sure return value is true\n $this->assertTrue($ret);\n \n // Try to fetch doc again \n $this->assertFalse($db->retrieve('mydoc'));\n \n $this->_teardownDb();\n }",
"public function delete_course($id) {\n $del_query=\"DELETE FROM `courses` WHERE course_id='$id'\";\n $del_exe=mysqli_query($GLOBALS['con'],$del_query);\n if ($del_exe) {\n header('Location:..\\courses_page.php?msg=successfuly Deleted record');//redirecting to main page of courses\n }else {\n header('Location:..\\courses_page.php?msg=Error Deleting record');//redirecting to main page of courses\n }\n }",
"private function _clearIndex(string $collection)\n {\n $config = business('solr_config');\n $curl = curl_init('http://localhost:' . $config['endpoint']['localhost']['port'] . '/solr/' . $collection . '/update?commit=true');\n curl_setopt($curl, CURLOPT_POST, true);\n curl_setopt($curl, CURLOPT_POSTFIELDS, '<delete><query>*:*</query></delete>');\n curl_setopt($curl, CURLOPT_HTTPHEADER, ['Content-Type: application/xml']);\n curl_exec($curl);\n }",
"public function delete_using_index(){\n\n $query = 'DELETE \n FROM ' . $this->table . '\n WHERE cart_id = :cart_id AND product_id = :product_id';\n\n //Prepare statement\n $stmt = $this->conn->prepare($query);\n\n $stmt->bindParam(':cart_id', $this->cart_id);\n $stmt->bindParam(':product_id', $this->product_id);\n\n $stmt->execute();\n\n $success = $stmt->rowCount() > 0 ? true : false;\n return $success;\n }",
"function apachesolr_index_delete_entity_from_index($env_id, $entity_type, $entity_id) {\n static $failed = FALSE;\n if ($failed) {\n return FALSE;\n }\n if (apachesolr_environment_variable_get($env_id, 'apachesolr_read_only', APACHESOLR_READ_WRITE) == APACHESOLR_READ_ONLY) {\n watchdog('Apache Solr', 'Trying to update the Solr index while the environment %env_id is read-only in function %function', array('%function' => __FUNCTION__, '%env_id' => $env_id), WATCHDOG_WARNING);\n return FALSE;\n }\n try {\n $solr = apachesolr_get_solr($env_id);\n $document_id = apachesolr_document_id($entity_id, $entity_type);\n $query = \"id:\\\"$document_id\\\" OR sm_parent_document_id:\\\"$document_id\\\"\";\n $solr->deleteByQuery($query);\n // Log the query used for deletion.\n watchdog('Apache Solr', 'Deleted documents from index with query @query', array('@query' => $query), WATCHDOG_INFO); \n apachesolr_set_last_index_updated($env_id, REQUEST_TIME);\n return TRUE;\n }\n catch (Exception $e) {\n watchdog('Apache Solr', nl2br(check_plain($e->getMessage())), NULL, WATCHDOG_ERROR);\n // Don't keep trying queries if they are failing.\n $failed = TRUE;\n return FALSE;\n }\n}"
] |
[
"0.70918506",
"0.68675065",
"0.6867137",
"0.68669105",
"0.67086065",
"0.6596933",
"0.6543226",
"0.6521045",
"0.651846",
"0.6515801",
"0.64940685",
"0.64712375",
"0.64231974",
"0.6408959",
"0.63494295",
"0.62561333",
"0.6247472",
"0.62444454",
"0.6211767",
"0.6196797",
"0.6111847",
"0.6111847",
"0.60473573",
"0.6028186",
"0.601712",
"0.6009662",
"0.5996332",
"0.5990011",
"0.598887",
"0.5978128"
] |
0.73220253
|
0
|
/ Method to process the notifySmsDeliveryReceipt SOAP request from the client The programmer must save some code to record the parameters received into the database/file for further processing
|
function notifySmsDeliveryReceipt($correlator,$deliveryStatus){
global $timeStamp;
global $subReqID;
global $traceUniqueID;
//variables to be saved in a database or processed
$msg_timeStamp=$timeStamp;
$msg_subReqID=$subReqID;
$msg_traceUniqueID=$traceUniqueID;
$msg_correlator=$correlator;
$msg_address=$deliveryStatus->address;
$msg_deliveryStatus=$deliveryStatus->deliveryStatus;
/*
* Code to use the data received will appear here.
* You can connect save the data in a database and have it polled by another service.
*/
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"protected function postProcessUpdateReceipt()\n {\n }",
"public function process_gateway_notification() {\r\n\t\t$order_id = self::get_post_var( 'OrderID' );\r\n\t\t$message = self::get_post_var( 'Message' );\r\n\t\t$status_code = self::get_post_var( 'StatusCode' );\r\n\t\t$prev_status_code = self::get_post_var( 'PreviousStatusCode' );\r\n\t\t$session_id = explode( ' ', self::get_post_var( 'OrderDescription' ) );\r\n\r\n\t\tif ( is_numeric( $status_code ) ) {\r\n\t\t\t$processed = WPSC_Purchase_Log::INCOMPLETE_SALE;\r\n\t\t\tswitch ( $status_code ) {\r\n\t\t\t\tcase PS_TRX_RESULT_SUCCESS:\r\n\t\t\t\t\t$processed = WPSC_Purchase_Log::ACCEPTED_PAYMENT;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase PS_TRX_RESULT_REFERRED:\r\n\t\t\t\t\t$processed = WPSC_Purchase_Log::PAYMENT_DECLINED;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase PS_TRX_RESULT_DECLINED:\r\n\t\t\t\t\t$processed = WPSC_Purchase_Log::PAYMENT_DECLINED;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase PS_TRX_RESULT_DUPLICATE:\r\n\t\t\t\t\t$processed = ( PS_TRX_RESULT_SUCCESS === $prev_status_code )\r\n\t\t\t\t\t\t? WPSC_Purchase_Log::ACCEPTED_PAYMENT\r\n\t\t\t\t\t\t: WPSC_Purchase_Log::PAYMENT_DECLINED;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase PS_TRX_RESULT_FAILED:\r\n\t\t\t\t\t$processed = WPSC_Purchase_Log::INCOMPLETE_SALE;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\twp_die( 'Unsupported StatusCode. Please contact support.',\r\n\t\t\t\t\t\t'Unsupported StatusCode',\r\n\t\t\t\t\t\tarray( 'response' => 400 )\r\n\t\t\t\t\t);\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\t$data = array(\r\n\t\t\t\t'processed' => $processed,\r\n\t\t\t\t'transactid' => $order_id,\r\n\t\t\t\t'notes' => $message,\r\n\t\t\t\t'date' => time(),\r\n\t\t\t);\r\n\t\t\twpsc_update_purchase_log_details( $session_id[4], $data, 'sessionid' );\r\n\r\n\t\t\tswitch ( $processed ) {\r\n\t\t\t\tcase WPSC_Purchase_Log::ACCEPTED_PAYMENT:\r\n\t\t\t\t\ttransaction_results( $session_id, false, $order_id );\r\n\t\t\t\t\t// Thank you for purchasing.\r\n\t\t\t\t\t$this->go_to_transaction_results( $session_id[4] );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase WPSC_Purchase_Log::PAYMENT_DECLINED:\r\n\t\t\t\t\t// Sorry, your transaction was not accepted.\r\n\t\t\t\t\t$this->go_to_transaction_results( null );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\t// Thank you, your purchase is pending.\r\n\t\t\t\t\t$this->go_to_transaction_results( $session_id[4] );\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\twp_die( 'Unexpected response from the payment gateway. Please contact support.',\r\n\t\t\t\t'Unexpected response from the payment gateway',\r\n\t\t\t\tarray( 'response' => 400 )\r\n\t\t\t);\r\n\t\t}\r\n\t}",
"function notifySmsReception($correlator,$message){\r\n\t\t//refer to the global variables set by the XML parser from the SOAP header\r\n\t\tglobal $traceUniqueID;\r\n\t\tglobal $spRevId;\r\n\t\tglobal $spRevpassword;\r\n\t\tglobal $spId;\r\n\t\tglobal $serviceId;\r\n\t\tglobal $linkid;\r\n\t\t\r\n\t\t//soap header parameters \r\n\t\t$msg_spRevId=$spRevId;\r\n\t\t$msg_spRevpassword=$spRevpassword;\r\n\t\t$msg_spId=$spId;\r\n\t\t$msg_serviceId=$serviceId;\r\n\t\t$msg_linkid=$linkid;\r\n\t\t$msg_traceUniqueID=$traceUniqueID;\r\n\t\t\r\n\t\t//soap body parameters\r\n\t\t$msg_message=$message->message;\r\n\t\t$msg_senderAddress=$message->senderAddress;\r\n\t\t$msg_smsServiceActivationNumber=$message->smsServiceActivationNumber;\r\n\t\t$msg_dateTime=$message->dateTime;\r\n\t\t\r\n\t\t/*\r\n\t\t* Code to use the data received will appear here. \r\n\t\t* You can connect save the data in a database and have it polled by another service.\r\n\t\t*/\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t}",
"function _processSale() {\n\t\t$this->autoload();\t\t\n\t\tJbPaymentxxsourcexxLib::write_log('xxsourcexx.txt', 'IPN: '.json_encode($_REQUEST));\n\t\t\n\t\t$input = jfactory::getApplication()->input;\t\t\n\t\t$status = $input->getString('xxsourcexx_transactionStatus');\n\t\t\n\t\t$success_status = array('CO','PA');\n\t\t\n\t\tif(in_array($status, $success_status)){\n\t\t\t$order_number = $input->getString('_itemId');\n\t\t\t$order_jb = JbPaymentxxsourcexxLib::getOrder($order_number);\n\t\t\t$order_jb->pay_status = 'SUCCESS';\n\t\t\t$order_jb->order_status = 'CONFIRMED';\n\t\t\t$order_jb->tx_id = $tnxref;\n\t\t\t$order_jb->store ();\n\t\t\treturn $order_jb;\t\n\t\t}else{\n\t\t\texit;\n\t\t}\n\t\t\n\t\t\n\t\t\n\t}",
"public function receipt()\n\t{\n\t\t\n\t\t$this->templateFileName = 'receipt.tpl';\n\t\t\n\t\tif (!isset($_REQUEST['orderID']))\n\t\t{\n\t\t\tthrow new \\Exception(\"Incorrect parameters\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\t\n\t\t\t// Get the order data\n\t\t\t$order = $this->dbConnection->prepareRecord(\"SELECT o.order_id, DATE_FORMAT(o.order_timestamp, '%W, %M %D, %Y') AS order_timestamp, r.description AS order_status, subtotal, tax, shipping, total, user_id, shipping_address_id, billing_address_id, payment_id FROM b_order o INNER JOIN b_reference r ON o.order_status = r.data_value AND r.data_member = 'ORDER_STATUS' WHERE order_id = ?\", $_REQUEST['orderID']);\n\t\t\t\n\t\t\t// Make sure the order is for the current user\n\t\t\tif ($order['user_id'] != $this->session->userID)\n\t\t\t{\n\t\t\t\tthrow new \\Exception(\"The order is for another user.\");\n\t\t\t}\n\n\t\t\t// Get the order lines\n\t\t\t$order_items = $this->dbConnection->prepareRecordSet(\"SELECT oi.order_id, oi.item_id, oi.item_sequence, oi.quantity, oi.price, oi.extended_price, oi.line_status, i.item_name, i.item_description, i.image_url, i.thumb_url, i.price, i.isbn, i.author, i.category_id FROM b_order_item oi INNER JOIN b_item i ON oi.item_id = i.item_id WHERE oi.order_id = ? ORDER BY oi.item_sequence\", $_REQUEST['orderID'] );\n\t\t\t\n\t\t\t// Get the addresses\n\t\t\t$shipping_address = $this->dbConnection->prepareRecord(\"SELECT * FROM b_user_address WHERE address_id = ?\", $order['shipping_address_id']);\n\t\t\t$billing_address = $this->dbConnection->prepareRecord(\"SELECT * FROM b_user_address WHERE address_id = ?\", $order['billing_address_id']);\n\t\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 = ?\", $order['payment_id']);\n\t\t\t\n\t\t\t$this->set('order', $order);\n\t\t\t$this->set('order_items', $order_items);\n\t\t\t$this->set('shipping_address', $shipping_address);\n\t\t\t$this->set('billing_address', $billing_address);\n\t\t\t$this->set('payment_method', $payment_method);\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\t\n\t}",
"public function execute() {\n $request = $this->getRequest()->getParams();\n \n $order_id = strip_tags($request[\"orderId\"]);\n $order = $this->objectManagement->create('Magento\\Sales\\Model\\Order')->loadByIncrementId($order_id);\n $validateOrder = $this->validateWebhook($request, $order);\n\n $transactionId = $request['referenceId'];\n\n $mageOrderStatus = $order->getStatus();\n\n if($mageOrderStatus === 'pending') {\n\n if(!empty($validateOrder['status']) && $validateOrder['status'] === true) {\n if($request['txStatus'] == 'SUCCESS') {\n $request['additional_data']['cf_transaction_id'] = $transactionId;\n $this->logger->info(\"Cashfree Notify processing started for cashfree transaction_id(:$transactionId)\");\n $this->processPayment($transactionId, $order);\n $this->logger->info(\"Cashfree Notify processing complete for cashfree transaction_id(:$transactionId)\");\n return;\n } elseif($request['txStatus'] == 'FAILED' || $request['txStatus'] == 'CANCELLED') {\n $orderStatus = self::STATE_CANCELED;\n $this->processWebhookStatus($orderStatus, $order);\n $this->logger->info(\"Cashfree Notify change magento order status to (:$orderStatus) cashfree transaction_id(:$transactionId)\");\n return;\n } elseif($request['txStatus'] == 'USER_DROPPED') {\n $orderStatus = self::STATE_CLOSED;\n $this->processWebhookStatus($orderStatus, $order);\n $this->logger->info(\"Cashfree Notify change magento order status to (:$orderStatus) cashfree transaction_id(:$transactionId)\");\n return;\n } else {\n $orderStatus = self::STATE_PENDING_PAYMENT;\n $this->processWebhookStatus($orderStatus, $order);\n $this->logger->info(\"Cashfree Notify change magento order status to (:$orderStatus) cashfree transaction_id(:$transactionId)\");\n return;\n }\n } else {\n $errorMsg = $validateOrder['errorMsg'];\n $this->logger->info(\"Cashfree Notify processing payment for cashfree transaction_id(:$transactionId) is failed due to ERROR(: $errorMsg)\");\n return;\n }\n } else {\n $this->logger->info(\"Order has been already in processing state for cashfree transaction_id(:$transactionId)\");\n return;\n }\n }",
"function _process($data)\n {\t\t\n\t\t$post = JFactory::getApplication()->input->get($_POST);\n \t\n \t$orderpayment_id = @$data['ssl_invoice_number'];\n \t\n \t$errors = array();\n \t$send_email = false;\n \t\n \t// load the orderpayment record and set some values\n JTable::addIncludePath( JPATH_ADMINISTRATOR.'/components/com_tienda/tables' );\n $orderpayment = JTable::getInstance('OrderPayments', 'TiendaTable');\n $orderpayment->load( $orderpayment_id );\n if (empty($orderpayment_id) || empty($orderpayment->orderpayment_id))\n {\n $errors[] = JText::_('VIRTUALMERCHANT MESSAGE INVALID ORDERPAYMENTID');\n return count($errors) ? implode(\"\\n\", $errors) : '';\n }\n $orderpayment->transaction_details = $data['ssl_result_message'];\n $orderpayment->transaction_id = $data['ssl_txn_id'];\n $orderpayment->transaction_status = $data['ssl_result'];\n \n // check the stored amount against the payment amount \n \tTienda::load( 'TiendaHelperBase', 'helpers._base' );\n $stored_amount = TiendaHelperBase::number( $orderpayment->get('orderpayment_amount'), array( 'thousands'=>'' ) );\n $respond_amount = TiendaHelperBase::number( $data['ssl_amount'], array( 'thousands'=>'' ) );\n if ($stored_amount != $respond_amount ) {\n \t$errors[] = JText::_('VIRTUALMERCHANT MESSAGE AMOUNT INVALID');\n \t$errors[] = $stored_amount . \" != \" . $respond_amount;\n }\n \n // set the order's new status and update quantities if necessary\n Tienda::load( 'TiendaHelperOrder', 'helpers.order' );\n Tienda::load( 'TiendaHelperCarts', 'helpers.carts' );\n $order = JTable::getInstance('Orders', 'TiendaTable');\n $order->load( $orderpayment->order_id );\n if (count($errors)) \n {\n // if an error occurred \n $order->order_state_id = $this->params->get('failed_order_state', '10'); // FAILED\n }\n\t\telse\n {\n $order->order_state_id = $this->params->get('payment_received_order_state', '17');; // PAYMENT RECEIVED\n\n // do post payment actions\n $setOrderPaymentReceived = true;\n \n // send email\n $send_email = true;\n }\n\n // save the order\n if (!$order->save())\n {\n \t$errors[] = $order->getError();\n }\n \n // save the orderpayment\n if (!$orderpayment->save())\n {\n \t$errors[] = $orderpayment->getError(); \n }\n \n if (!empty($setOrderPaymentReceived))\n {\n $this->setOrderPaymentReceived( $orderpayment->order_id );\n }\n \n if ($send_email)\n {\n // send notice of new order\n Tienda::load( \"TiendaHelperBase\", 'helpers._base' );\n $helper = TiendaHelperBase::getInstance('Email');\n $model = Tienda::getClass(\"TiendaModelOrders\", \"models.orders\");\n $model->setId( $orderpayment->order_id );\n $order = $model->getItem();\n $helper->sendEmailNotices($order, 'new_order');\n }\n\n return count($errors) ? implode(\"\\n\", $errors) : ''; \n\n \treturn true;\n }",
"function SAP_set_order($rec_id)\n{\n/*\n\tThis FUNCTION posts SD order \n\tINPUT: id of invoice\n\tOUTPUT:\n\t\t\t- \"ID\" of SD order\n\t\t\tOR \"0\" - if failed\n*/\n\tinclude(\"login_re.php\");\n\tini_set(\"soap.wsdl_cache_enabled\", \"0\");\n\t\n\t//THESE PARAMS ARE FIXED NOW\n\t$cond_type='ZPR0';\t\n\t//$cond_value='10';\n\t$service_mode='SO_C';\t// CREATE\t\n\t$req = new Request();\n\t \n\t\t\t//Setting up the object\n\t\t\t$item= new Item();\n\t\t\n\t\t//Set up mySQL connection\n\t\t\t$db_server = mysqli_connect($db_hostname, $db_username,$db_password);\n\t\t\t$db_server->set_charset(\"utf8\");\n\t\t\tIf (!$db_server) die(\"Can not connect to a database!!\".mysqli_connect_error($db_server));\n\t\t\tmysqli_select_db($db_server,$db_database)or die(mysqli_error($db_server));\n\t//1.\t\n\t\t// LOCATE data for the invoice\n\t\t\t$invoice_sql=\"SELECT invoice.date,invoice.value,contract.id_SAP,currency.code,decade,month,year \n\t\t\t\t\t\t\tFROM invoice \n\t\t\t\t\t\t\tLEFT JOIN contract ON invoice.contract_id=contract.id \n LEFT JOIN currency ON invoice.currency=currency.id\n\t\t\t\t\t\t\tWHERE invoice.id=$rec_id\";\n\t\t\t\t\n\t\t\t$answsql=mysqli_query($db_server,$invoice_sql);\n\t\t\t\t\n\t\t\tif(!$answsql) die(\"Database SELECT TO invoice table failed: \".mysqli_error($db_server));\t\n\t\t\tif (!$answsql->num_rows)\n\t\t\t{\n\t\t\t\techo \"WARNING: No invoice found for a given ID in invoice TABLE <br/>\";\n\t\t\t\treturn 0;\n\t\t\t}\t\n\t\t\t$i_data= mysqli_fetch_row($answsql);\n\t\t\t\t\n\t\t\t\n\t//2.\t\n\t\t\t// Prepare request for SAP ERPclass Item\n\t\n\t\t\t// Set up params\n\t\t\t\n\t\t\t$c_date=$i_data[0];\n\t\t\t$val=$i_data[1];\n\t\t\t$contract_id=$i_data[2];\n\t\t\t$curr=$i_data[3];\t// Currency in invoice\n\t\t\t$decade=$i_data[4];\n\t\t\t$month=$i_data[5];\n\t\t\t$year=$i_data[6];\n\t\t\t//SERVICE DATE\n\t\t\t$service_date='';\n\t\t\tswitch($month)\n\t\t\t{\n\t\t\t\tcase 1:\n\t\t\t\t\t$service_date='-01-';\n\t\t\t\t\t$day='31';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\t$service_date='-02-';\n\t\t\t\t\tif((int)$year%4)\n\t\t\t\t\t\t$day='28';\n\t\t\t\t\telse\n\t\t\t\t\t\t$day='29';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\t$service_date='-03-';\n\t\t\t\t\t$day='31';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 4:\n\t\t\t\t\t$service_date='-04-';\n\t\t\t\t\t$day='30';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 5:\n\t\t\t\t\t$service_date='-05-';\n\t\t\t\t\t$day='31';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 6:\n\t\t\t\t\t$service_date='-06-';\n\t\t\t\t\t$day='30';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 7:\n\t\t\t\t\t$service_date='-07-';\n\t\t\t\t\t$day='31';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 8:\n\t\t\t\t\t$service_date='-08-';\n\t\t\t\t\t$day='31';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 9:\n\t\t\t\t\t$service_date='-09-';\n\t\t\t\t\t$day='30';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 10:\n\t\t\t\t\t$service_date='-10-';\n\t\t\t\t\t$day='31';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 11:\n\t\t\t\t\t$service_date='-11-';\n\t\t\t\t\t$day='30';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 12:\n\t\t\t\t\t$service_date='-12-';\n\t\t\t\t\t$day='31';\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\techo 'WARNING _ WRONG MONTH IN THE INPUT DATA! <br/>';\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tswitch($decade)\n\t\t\t{\n\t\t\t\tcase 0:\n\t\t\t\t\t$day='01';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 1:\n\t\t\t\t\t$day='10';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\t$day='20';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 1:\n\t\t\t\t\t$day='28';\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\techo 'WARNING _ WRONG DECADE IN THE INPUT DATA! <br/>';\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\t$service_date='20'.$year.$service_date.$day;\n\t\t\t// Preparing Items for Invoice\n\t\t\t$count_in=1;// only one position by Invoice now\n\t\t\t$items=new ItemList();\n\t\t\tfor($it=0;$it<$count_in;$it++)\n\t\t\t{\t\n\t\t\t\t$item1 = new Item();\n\t\t\t\t// 1. Item number\n\t\t\t\t$item_num=($it+1).'0';\n\t\t\t\t$item1->ITM_NUMBER=$item_num;\n\t\t\t\n\t\t\t\t// 2. Material code\n\t\t\t\t$item1->MATERIAL='901200000';//now it's fixed\n\t\t\t\n\t\t\t/*2.1 BLOCK LEFT FOR LOCATING SAP MATERIAL ID\n\t\t\t\n\t\t\t\t$servicesql='SELECT id_SAP,id FROM services WHERE id_NAV=\"'.$service_id.'\"';\t\n\t\t\t\t$answsql=mysqli_query($db_server,$servicesql);\t\n\t\t\t\tif(!$answsql) die(\"Database SELECT in services table failed: \".mysqli_error($db_server));\t\n\n\t\t\t\t$sap_service_id= mysqli_fetch_row($answsql);\n\t\t\t*/\n\t\t\t\t// 3. Currency\n\t\t\t\t$item1->CURRENCY=$curr;\n\t\t\t\t\n\t\t\t\t// 4. SD conditions\n\t\t\t\t$item1->COND_TYPE=$cond_type;\n\t\t\t\t$item1->COND_VALUE=$val;\n\t\t\t\t\n\t\t\t\t// 4. Quantity\n\t\t\t\t$item1->TARGET_QTY='1'; //FIXED!\n\t\t\t\t\n\t\t\t\n\t\t\t//Inserting into Item List\n\t\t\t\n\t\t\t\t$items->item[$it] = $item1;\n\t\t\t}\n\t\t\t\n\t\t// GENERAL SECTION (HEADER)\n\t\t\n\t\t\t$req->ID_SALESCONTRACT = $contract_id;\t\n\t\t\t$req->SERVICEMODE = $service_mode;\n\t\t\t$req->SERVICEDATE = $service_date;\t\t\t\n\t\t\t$req->BILLDATE=$c_date;\n\t\t\t$req->SALES_ITEMS_IN=$items;\n\t\t\t$req->RETURN2 = '';\n\t\t\t\n\t\t\t$order=SAP_connector($req);\n\t\t\tif ($order)\n\t\t\t\t$doc_id=$order->RETURN2->item->MESSAGE_V4;\n\tmysqli_close($db_server);\n\treturn $doc_id;\n}",
"public function initUpdateReceiptContent()\n {\n }",
"function SAP_set_order_multy($rec_id)\n{\n/*\n\tThis FUNCTION posts SD order \n\tINPUT: id of invoice\n\tOUTPUT:\n\t\t\t- \"ID\" of SD order\n\t\t\tOR \"0\" - if failed\n*/\n\tinclude(\"login_re.php\");\n\tini_set(\"soap.wsdl_cache_enabled\", \"0\");\n\n\t//THESE PARAMS ARE FIXED NOW\n\t$cond_type='ZPR0';\t\n\t\n\t$service_mode='SO_C';\t// CREATE\t\n\t$req = new Request();\n\t \n\t\t\t//Setting up the object\n\t\t\t$item= new Item();\n\t\t\n\t\t//Set up mySQL connection\n\t\t\t$db_server = mysqli_connect($db_hostname, $db_username,$db_password);\n\t\t\t$db_server->set_charset(\"utf8\");\n\t\t\tIf (!$db_server) die(\"Can not connect to a database!!\".mysqli_connect_error($db_server));\n\t\t\tmysqli_select_db($db_server,$db_database)or die(mysqli_error($db_server));\n\t//1.\t\n\t\t// LOCATE data for the invoice\n\t\t\t$invoice_sql=\"SELECT invoice.date,invoice.value,contract.id_SAP,currency.code,invoice.month,invoice.year \n\t\t\t\t\t\t\tFROM invoice \n\t\t\t\t\t\t\tLEFT JOIN contract ON invoice.contract_id=contract.id \n LEFT JOIN currency ON invoice.currency=currency.id\n\t\t\t\t\t\t\tWHERE invoice.id=$rec_id\";\n\t\t\t\t\n\t\t\t$answsql=mysqli_query($db_server,$invoice_sql);\n\t\t\t\t\n\t\t\tif(!$answsql) die(\"Database SELECT TO invoice table failed: \".mysqli_error($db_server));\t\n\t\t\tif (!$answsql->num_rows)\n\t\t\t{\n\t\t\t\techo \"WARNING: No invoice found for a given ID in invoice TABLE <br/>\";\n\t\t\t\treturn 0;\n\t\t\t}\t\n\t\t\t$i_data= mysqli_fetch_row($answsql);\n\t\t\t\t\n\t\t\t\n\t//2.\t\n\t\t\t// Prepare request for SAP ERPclass Item\n\t\n\t\t\t// Set up params\n\t\t\t\n\t\t\t$c_date=$i_data[0];\n\t\t\t$val=$i_data[1];\n\t\t\t$contract_id=$i_data[2];\n\t\t\t$curr=$i_data[3];\t// Currency in invoice\n\t\t\t$c_month=$i_data[4];\n\t\t\t$c_year=$i_data[5];\n\t\t\t$srv_date='';\n\t\t\t$m_date='';\n\t\t\t//SET UP SERVICE DATE - END OF THE BILLING PERIOD\n\t\t\tswitch($c_month)\n\t\t\t{\n\t\t\t\tcase '1':\n\t\t\t\t$m_date='-01-31';\n\t\t\t\tbreak;\n\t\t\t\tcase '2':\n\t\t\t\t$m_date='-02-28';\n\t\t\t\tbreak;\n\t\t\t\tcase '3':\n\t\t\t\t$m_date='-03-31';\n\t\t\t\tbreak;\n\t\t\t\tcase '4':\n\t\t\t\t$m_date='-04-30';\n\t\t\t\tbreak;\n\t\t\t\tcase '5':\n\t\t\t\t$m_date='-05-31';\n\t\t\t\tbreak;\n\t\t\t\tcase '6':\n\t\t\t\t$m_date='-06-30';\n\t\t\t\tbreak;\n\t\t\t\tcase '7':\n\t\t\t\t$m_date='-07-31';\n\t\t\t\tbreak;\n\t\t\t\tcase '8':\n\t\t\t\t$m_date='-08-31';\n\t\t\t\tbreak;\n\t\t\t\tcase '9':\n\t\t\t\t$m_date='-09-30';\n\t\t\t\tbreak;\n\t\t\t\tcase '10':\n\t\t\t\t$m_date='-10-31';\n\t\t\t\tbreak;\n\t\t\t\tcase '11':\n\t\t\t\t$m_date='-11-30';\n\t\t\t\tbreak;\n\t\t\t\tcase '12':\n\t\t\t\t$m_date='-12-31';\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\t$srv_date='20'.$c_year.$m_date;\n\t\t\t\n\t\t\t// Preparing Items for Invoice\n\t\t\t\n\t\t\t// LOCATE POSITIONS for the invoice\n\t\t\t$positions_sql=\"SELECT service_id,quantity,service.id_SAP \n\t\t\t\t\t\t\tFROM invoice_reg \n\t\t\t\t\t\t\tLEFT JOIN service ON invoice_reg.service_id=service.id\n\t\t\t\t\t\t\tWHERE invoice_id=$rec_id\";\n\t\t\t\t\n\t\t\t$answsql1=mysqli_query($db_server,$positions_sql);\n\t\t\t\t\n\t\t\tif(!$answsql1) die(\"Database SELECT TO invoice_reg table failed: \".mysqli_error($db_server));\t\n\t\t\t$count_in=$answsql1->num_rows;\n\t\t\tif (!$count_in)\n\t\t\t{\n\t\t\t\techo \"WARNING: No POSITIONS found for a given ID in invoice_reg TABLE <br/>\";\n\t\t\t\treturn 0;\n\t\t\t}\t\n\t\t\t\t\n\t\t\t\t$items=new ItemList();\n\t\t\t\tfor($it=0;$it<$count_in;$it++)\n\t\t\t\t{\t\n\t\t\t\t\t$pos_data= mysqli_fetch_row($answsql1);\n\t\t\t\t\t$item1 = new Item();\n\t\t\t\t\t// 1. Item number\n\t\t\t\t\t$item_num=($it+1).'0';\n\t\t\t\t\t$item1->ITM_NUMBER=$item_num;\n\t\t\t\n\t\t\t\t\t// 2. Material code\n\t\t\t\t\t$item1->MATERIAL=$pos_data[2];\n\t\t\t\n\t\t\t\t\n\t\t\t\t// 3. Currency ?? - need it?\n\t\t\t\t\t$item1->CURRENCY=$curr;\n\t\t\t\t\n\t\t\t\t\t// 4. SD conditions\n\t\t\t\t\t$item1->COND_TYPE=$cond_type;\n\t\t\t\t\t$item1->COND_VALUE=$val;\n\t\t\t\t\n\t\t\t\t\t// 4. Quantity\n\t\t\t\t\t$item1->TARGET_QTY=$pos_data[1];; \n\t\t\t\t\n\t\t\t\n\t\t\t\t\t//Inserting into Item List\n\t\t\t\n\t\t\t\t\t$items->item[$it] = $item1;\n\t\t\t\t}\n\t\t\t\n\t\t// GENERAL SECTION (HEADER)\n\t\t\n\t\t\t$req->ID_SALESCONTRACT = $contract_id;\t\n\t\t\t$req->SERVICEMODE = $service_mode; \t\t\n\t\t\t$req->BILLDATE=$c_date;\n\t\t\t$req->SALES_ITEMS_IN=$items;\n\t\t\t$req->SERVICEDATE=$srv_date;\n\t\t\t$req->RETURN2 = '';\n\t\t\t//echo \"SENDING TO SAP\";\n\t\t\t$order=SAP_connector($req);\n\t\t\tif ($order->RETURN2->item->MESSAGE==\"SUCCESS\")\n\t\t\t\t$doc_id=$order->RETURN2->item->MESSAGE_V4;\n\t\t\telse\n\t\t\t\t$doc_id=0;\n\t\t\t\n\tmysqli_close($db_server);\n\treturn $doc_id;\n}",
"public function loadNotification(){\r\n //remove trace code.\r\n// eeFile::saveFile('new post request get.');\r\n \r\n //get xml\r\n $tmpXML = file_get_contents('php://input');\r\n if (empty($tmpXML)) {\r\n $this->generateReturnXML(0);\r\n }//xml content not get.\r\n \r\n //save response to file to get the structure.\r\n eeFile::saveFile($tmpXML);\r\n \r\n //xml to array\r\n $tmpXMLArr = $this->FromXml($tmpXML);\r\n if ($tmpXMLArr['return_code'] != \"SUCCESS\") {\r\n $this->generateReturnXML();\r\n }\r\n \r\n //check sign\r\n $this->safeValues = $tmpXMLArr;\r\n if ($tmpXMLArr['sign'] != $this->MakeSign()) {\r\n $this->generateReturnXML(0);\r\n };\r\n \r\n //massive attributes\r\n $this->scenario = 'notification';\r\n $this->attributes = $tmpXMLArr;\r\n $this->noti_result_code = $tmpXMLArr['result_code'];\r\n// var_dump($this->attributes);\r\n \r\n //remove trace code.\r\n// eeFile::saveFile('otn->'.$this->out_trade_no);\r\n //load OPM\r\n $tmpArr = explode('_', $this->out_trade_no);\r\n if (!isset($tmpArr[1])) {\r\n $this->generateReturnXML(0);\r\n }\r\n $opm = OrderPaymentMethod::findOne((int)$tmpArr[1]);\r\n if (empty($opm)) {\r\n $this->generateReturnXML();\r\n }\r\n \r\n if ($opm->opm_status_id == OrderPaymentMethod::OPM_PAID) {\r\n //already paid, direct return success\r\n $this->generateReturnXML(1);\r\n }\r\n \r\n \r\n $opm->scenario = 'notification';\r\n //update opm\r\n $opm->opm_paid = $this->total_fee/100;\r\n $opm->opm_cash = $this->cash_fee/100;\r\n $opm->opm_openId = $this->openid;\r\n $opm->opm_tradeType_return = $this->trade_type;\r\n $opm->opm_transaction_id = $this->transaction_id;\r\n $opm->opm_paidDate = date('Y-m-d H:i:s', strtotime($this->time_end));\r\n \r\n if ($this->noti_result_code == 'SUCCESS') {\r\n //SUCCESS\r\n //update opm status\r\n $opm->opm_status_id = OrderPaymentMethod::OPM_PAID;\r\n $opm->save();\r\n// var_dump($opm->errors);\r\n// exit;\r\n \r\n //load ORDER\r\n $order = $opm->opmOrder;\r\n if (!empty($order)) {\r\n $order->scenario = 'notification';\r\n $order->or_pricePaid = $this->total_fee/100;\r\n $order->or_status_id = OrderPaymentMethod::OPM_PAID;\r\n $order->or_paidDate = $opm->opm_paidDate;\r\n $order->save();\r\n }\r\n }else{\r\n //FAIL\r\n //update opm status\r\n $opm->opm_status_id = OrderPaymentMethod::OPM_FAIL;\r\n $opm->save();\r\n \r\n //load ORDER\r\n $order = $opm->opmOrder;\r\n if (!empty($order)) {\r\n $order->or_status_id = OrderPaymentMethod::OPM_FAIL;\r\n $order->save();\r\n }\r\n }\r\n \r\n $this->generateReturnXML(1);\r\n }",
"public function receive(){\n $eslId = $this->uri->segment(3); //Get the flower shop ID\n $this->load->model('esls_model');\n\n $formData = $this->input->post(NULL, TRUE);\n\n //DATA THAT COMES FROM PRODUCERS\n $domain = $formData['_domain'];\n $name = $formData['_name'];\n\n if($name === \"delivery_ready\"){\n $this->process_delivery_ready_event($formData);\n }\n else if($name === \"bid_awarded\"){\n $this->process_bid_awarded_event($formData);\n }\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}",
"public function notify()\n\t{\n\t\t// Check the sender is 2Checkout\n\t\t$key = Context::get('md5_hash');\n\n\t\t$sale_id = Context::get('sale_id');\n\t\t$vendor_id = $this->sid;\n\t\t$invoice_id = Context::get('invoice_id');\n\t\t$secret_word = $this->secret_word;\n\t\t$expected_key = strtoupper(md5($sale_id . $vendor_id . $invoice_id . $secret_word));\n\n\t\tif(strtoupper($key) != $expected_key)\n\t\t{\n\t\t\tShopLogger::log(\"Invalid 2checkout IPN message received - key \" . $key . ' ' . print_r($_REQUEST, TRUE));\n\t\t\treturn;\n\t\t}\n\n\t\t$message_type = Context::get('message_type');\n\t\tif($message_type != 'ORDER_CREATED')\n\t\t{\n\t\t\tShopLogger::log(\"Unsupported IPN 2checkout message received: \" . print_r($_REQUEST, TRUE));\n\t\t\treturn;\n\t\t}\n\n\t\t$cart_srl = Context::get('vendor_order_id');\n\t\t$transaction_id = $sale_id; // Hopefully, this is order number\n\n\t\t$order_repository = new OrderRepository();\n\n\t\t// Check if order has already been created for this transaction\n\t\t$order = $order_repository->getOrderByTransactionId($transaction_id);\n\t\tif(!$order) // If not, create it\n\t\t{\n\t\t\t$cart = new Cart($cart_srl);\n\t\t\t$this->createNewOrderAndDeleteExistingCart($cart, $transaction_id);\n\n // get created order\n $model = getModel('shop');\n $orderRepository = $model->getOrderRepository();\n $order_srl = Context::get('order_srl');\n $order = $orderRepository->getOrderBySrl($order_srl);\n\t\t}\n\n // generate invoice\n $args = new StdClass();\n $args->order_srl = $order->order_srl;\n $args->module_srl = $order->module_srl;\n $invoice = new Invoice($args);\n $invoice->save();\n if ($invoice->invoice_srl) {\n if (isset($order->shipment))\n $order->order_status = Order::ORDER_STATUS_COMPLETED;\n else\n $order->order_status = Order::ORDER_STATUS_PROCESSING;\n try {\n $order->save();\n }\n catch(Exception $e) {\n return new Object(-1, $e->getMessage());\n }\n } else {\n throw new ShopException('Something whent wrong when adding invoice');\n }\n\t}",
"function mailPaymentReceipt($invoice_no,$payment_date=\"\",$payment_amount=0)\n {\n $data_array = array();\n $cycle = $this->props->cycles;\n $temp = $this->BL->invoices->get(\"WHERE `invoice_no`=\".intval($invoice_no));\n $invoice = $temp[0];\n $data_array1= $this->BL->mailWelcome($invoice['order_id'],true);\n $data_array2= $this->BL->invoices->mailInvoice($invoice_no, true, true);\n $data_array = array_merge($data_array1,$data_array2);\n if(empty($payment_date))\n {\n $payment_date = date('Y-m-d');\n }\n if(empty($payment_amount))\n {\n $payment_amount = $invoice['gross_amount'];\n }\n\n if(empty($payment_amount) || empty($invoice_no) || !count($invoice))\n return false;\n\n $reciept_template = $this->BL->emails->getByKey(3);\n $subject = $this->BL->conf['company_name'] . \" \" . $this->props->lang['payment_confirmation'];\n $body = $this->utils->entity_decode($this->utils->htmlspecialchars_decode($reciept_template['email_text']));\n if(!empty($reciept_template['email_subject']))\n {\n $subject = $this->utils->entity_decode($this->utils->htmlspecialchars_decode($reciept_template['email_subject']));\n }\n foreach($invoice as $key=>$data)\n {\n $data_array[$key] = $data;\n }\n $data_array['payment_date'] = $this->BL->fDate($payment_date);\n $data_array['amount_paid'] = $this->BL->toCurrency($payment_amount, null, 1);\n $data_array['due_date'] = $this->BL->fDate($invoice['due_date']);\n $data_array['invoice_no'] = $this->BL->conf['invoice_prefix'] . $invoice['invoice_no'] . $this->BL->conf['invoice_suffix'];\n $data_array['company_email']= $this->BL->conf['comp_email'];\n $data_array['company_name'] = $this->BL->conf['company_name'];\n $data_array['company_address']= $this->BL->conf['company_address'];\n $data_array['description'] = $this->BL->getFriendlyDesc($invoice['desc'],$invoice['sub_id'],$invoice['domain_name']);\n\n $body = $this->BL->etp->parseEmail($data_array,$body);\n $subject= $this->BL->etp->parseEmail($data_array,$subject);\n\n $this->BL->notice_to = $invoice['email'];\n $this->BL->msg = $body;\n $this->BL->ALPmail->AddAddress($invoice['email'], $this->BL->getCustomerFieldValue(\"name\",$invoice['id']));\n $this->BL->ALPmail->AddCC($this->BL->conf['comp_email'], $this->BL->conf['company_name']);\n $this->BL->ALPmail->Subject = $subject;\n $this->BL->ALPmail->Body = $body;\n $return = $this->BL->ALPmail->sendMail();\n $this->BL->runCS('A_PP',$invoice['sub_id'], $invoice['invoice_no']);\n return $return;\n }",
"function after_process() {\n\t\t $requestParamList = array(\"MID\" => MODULE_PAYMENT_PAYTM_MERCHANT_ID , \"ORDERID\" => $_POST['ORDERID']);\n\n\t\t $paytmParamsStatus = array();\n /* body parameters */\n $paytmParamsStatus[\"body\"] = array(\n /* Find your MID in your Paytm Dashboard at https://dashboard.paytm.com/next/apikeys */\n \"mid\" => $requestParamList['MID'],\n /* Enter your order id which needs to be check status for */\n \"orderId\" => $requestParamList['ORDERID'],\n );\n $checksumStatus = PaytmChecksum::generateSignature(json_encode($paytmParamsStatus[\"body\"], JSON_UNESCAPED_SLASHES), MODULE_PAYMENT_PAYTM_MERCHANT_KEY);\n /* head parameters */\n $paytmParamsStatus[\"head\"] = array(\n /* put generated checksum value here */\n \"signature\" => $checksumStatus\n );\n /* prepare JSON string for request */\n $post_data_status = json_encode($paytmParamsStatus, JSON_UNESCAPED_SLASHES);\n $paytstsusmurl = $this->paytmurl.PaytmConstants::ORDER_STATUS_URL; \n $ch = curl_init($paytstsusmurl);\n curl_setopt($ch, CURLOPT_POST, 1);\n curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data_status);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\n $responseJson = curl_exec($ch);\n $responseStatusArray = json_decode($responseJson, true);\n\t\t if($responseStatusArray['body']['resultInfo']['resultStatus']=='TXN_SUCCESS' && $responseStatusArray['body']['txnAmount']==$_POST['TXNAMOUNT'])\n\t\t {\n\t\t \tglobal $insert_id;\n\t\t\t $status_comment=array();\n\t\t\t if(isset($_POST)){\n\t\t\t\t if(isset($_POST['ORDERID'])){\n\t\t\t\t \t$status_comment[]=\"Order Id: \" . $_POST['ORDERID'];\n\t\t\t\t }\n\t\t\t\t\n\t\t\t\t if(isset($_POST['TXNID'])){\n\t\t\t\t\t $status_comment[]=\"Paytm TXNID: \" . $_POST['TXNID'];\n\t\t\t\t }\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t$sql_data_array = array('orders_id' => $insert_id,\n 'orders_status_id' => MODULE_PAYMENT_PAYTM_ORDER_STATUS_ID,\n 'date_added' => 'now()',\n 'customer_notified' => '0',\n 'comments' => implode(\"\\n\", $status_comment));\n\n\t\t\tzen_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);\n\t\t}\n\t\telse{\n\t\t\tzen_redirect(zen_href_link(FILENAME_CHECKOUT_SHIPPING, 'error_message=' . urlencode(\"It seems some issue in server to server communication. Kindly connect with administrator.\"), 'SSL', true, false));\n\t\t}\n }",
"function sendsms_tm_unshipped_products($invoices='')\r\n\t{\r\n\t\t\r\n\t\t$sql_trans = \"select inv.invoice_no,a.id,e.franchise_id,a.itemid,group_concat(concat(b.print_name,'-',pnh_id)) as itemname,i_orgprice,login_mobile1,i_price,i_coup_discount,i_discount,group_concat(a.quantity) as qty,c.menuid,a.transid,f.franchise_id,f.franchise_name\r\n\t\t\t\t\t\t\tfrom king_invoice inv\r\n\t\t\t\t\t\t\tjoin king_orders a on a.id=inv.order_id\r\n\t\t\t\t\t\t\tjoin king_dealitems b on a.itemid = b.id\r\n\t\t\t\t\t\t\tjoin king_deals c on b.dealid = c.dealid \r\n\t\t\t\t\t\t\tjoin pnh_menu d on d.id = c.menuid \r\n\t\t\t\t\t\t\tjoin king_transactions e on e.transid = a.transid\r\n\t\t\t\t\t\t\tjoin pnh_m_franchise_info f on f.franchise_id = e.franchise_id \r\n\t\t\t\t\t\t\twhere inv.invoice_no in ($invoices)\r\n\t\t\t\t\t\t\tgroup by inv.invoice_no\";\r\n\t\t\r\n\t\t$res_trans = $this->db->query($sql_trans);\r\n\t\r\n\t\t$sms_msg = '';\r\n\t\t$datetime = new DateTime('tomorrow');\r\n\t\t\r\n\t\tif($res_trans->num_rows())\r\n\t\t{\r\n\t\t\tforeach($res_trans->result_array() as $row_trans)\r\n\t\t\t{\r\n\t\t\t\t$sms_msg=\"Dear \".$row_trans['franchise_name'].\", your invoice no(\".$row_trans['invoice_no'].\") with \".$row_trans['itemname'].\" products and \".$row_trans['qty'].\" qty is shipped successfully, please expect delivery on \".$datetime->format('d/m/Y');\r\n\t\t\t\t$this->erpm->pnh_sendsms($row_trans['login_mobile1'],$sms_msg,$row_trans['franchise_id'],0,12);\r\n\t\t\t}\r\n\t\t}\r\n\t\r\n\t}",
"function paid_sendEmail_supplier($details) {\n\n\t\t\t$currencycode = $details->currCode;\n\t\t\t$currencysign = $details->currSymbol;\n\n\t\t\t\t$custid = $details->bookingUser;\n\t\t\t\t$country = $details->userCountry;\n\t\t\t\t$name = $details->userFullName;\n\t\t\t\t$phone = $details->userMobile;\n\t\t\t\t$paymethod = $details->paymethod;\n\t\t\t\t$invoiceid = $details->id;\n\t\t\t\t$refno = $details->code;\n\t\t\t\t$totalamount = $details->checkoutTotal;\n\t\t\t\t$deposit = $details->checkoutAmount;\n\t\t\t\t$duedate = $details->expiry;\n\t\t\t\t$date = $details->date;\n\t\t\t\t$remaining = $details->remainingAmount;\n\t\t\t\t$custemail = $details->accountEmail;\t\t\t\t\n\t\t\t\t$sendto = $this->supplierEmail($details->module, $details->itemid);\n\n\t\t\t\t$sitetitle = \"\";\n\n\t\t\t\t$invoicelink = \"<a href=\" . base_url() . \"invoice?id=\" . $invoiceid . \"&sessid=\" . $refno . \" >\" . base_url() . \"invoice?id=\" . $invoiceid . \"&sessid=\" . $refno . \"</a>\";\n\t\t\t\t$template = $this->shortcode_variables(\"bookingpaidsupplier\");\n\t\t\t\t$details = email_template_detail(\"bookingpaidsupplier\");\n\t\t\t\t//$smsdetails = sms_template_detail(\"bookingpaidadmin\");\n\t\t\t\t$values = array($invoiceid, $refno, $deposit, $totalamount, $custemail, $custid, $country, $phone, $currencycode, $currencysign, $invoicelink, $sitetitle, $name);\n\t\t\t\t\n\t\t\t\t$message = $this->mailHeader;\n\t\t\t\t$message .= str_replace($template, $values, $details[0]->temp_body);\n\t\t\t\t$message .= $this->mailFooter;\n\n\t\t\t\t//$smsmessage = str_replace($template, $values, $smsdetails[0]->temp_body);\n\t\t\t\t//sendsms($smsmessage, $this->adminmobile, \"bookingpaidadmin\");\n\t\t\t\t$this->email->set_newline(\"\\r\\n\");\n\t\t\t\t$this->email->from($this->sendfrom);\n\t\t\t\t$this->email->to($sendto);\n\t\t\t\t$this->email->subject('Booking Payment Notification');\n\t\t\t\t$this->email->message($message);\n\t\t\t\t$this->email->send();\n\t\t}",
"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 }",
"private function recepcion_repuesta(){\n $this->cdr = $this->respuesta->getCdrResponse(); // CLASE BillResult\n $this->actualizar_docxpagarcpe_recepcion();\n\n // GUARDAR ZIP RESPUESTA SUNAT\n $zip = $this->respuesta->getCdrZip(); // CLASE BillResult\n $this->guardar_respuesta_xml($zip);\n\n }",
"function dsf_send_sagepay_mail($savedorder, $address_confirmations=''){\nglobal $basket, $customer_id, $payment, $currencies;\n\n\t\t\t\t\t$good_mail_id = '3';\n\t\t\t\t\t$bad_mail_id = '6';\n\n\n\t\t\t\t\tif ($address_confirmations == 'OK'){ // status OK and addresses OK\n\t\t\t\t\t\t\n\t\t\t\t\t\t$email_query = dsf_db_query(\"select subject, details from \". DS_DB_SHOP . \".email_templates where id ='\" . $good_mail_id .\"'\");\n\t\t\t\t\t }elseif (MODULE_PAYMENT_PROTXCC_CHECK_ADDRESS == 'false'){\n\t\t\t\t\t\t$email_query = dsf_db_query(\"select subject, details from \". DS_DB_SHOP . \".email_templates where id ='\" . $good_mail_id .\"'\");\n\t\t\t\t\t}elseif ($address_confirmations == 'ALLOW'){ // status OK Adress failed under threshold.\n\t\t\t\t\t\t$email_query = dsf_db_query(\"select subject, details from \". DS_DB_SHOP . \".email_templates where id ='\" . $good_mail_id .\"'\");\n\t\t\t\t\t }else{\n\t\t\t\t\t $email_query = dsf_db_query(\"select subject, details from \". DS_DB_SHOP . \".email_templates where id ='\" . $bad_mail_id .\"'\");\n\t\t\t\t\t\n\t\t\t\t\t}\n\t\n// lets start with the email confirmation\n\n\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t\t$email_details = dsf_db_fetch_array($email_query);\n\t\t\t\t\t\t\t\t\t\t$signature_query = dsf_db_query(\"select subject, details from \". DS_DB_SHOP . \".email_templates where id ='1'\");\n\t\t\t\t\t\t\t\t\t $signature_details = dsf_db_fetch_array($signature_query);\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t $email_subject = $email_details['subject'];\n\t\t\t\t\t\t\t\t\t $email_footer = $signature_details['details'];\n\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\t// overwrite subject as per Christian emails 2011-09-28\n\t\t\t\t\t\t\t\t\t $email_subject = TRANSLATION_EMAIL_YOUR_ORDER . ' ' . SAP_ORDER_PREFIX . $savedorder->info['id'];\n\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// plain text;\n\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\t $email_order = TRANSLATION_WORD_DEAR . ' ' . $savedorder->customer['name'] . \"\\n\\n\" . $email_details['details'] . \"\\n\";\n\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t\t// get products ordered by doing email function.\n\t\t\t\t\t\t\t\t\t $products_ordered = dsf_order_email_items($savedorder, 'true');\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\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\t $email_order .= $products_ordered['plain'];\n\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t $email_order .= \"\\n\" .EMAIL_SEPARATOR .\"\\n\" . $email_footer;\n\t\t\t\t\t\t \n\t\t\t\t\t\t \n\t\t\t\t\t\t \t\t// html\n\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t $html_order = TRANSLATION_WORD_DEAR . ' ' . $savedorder->customer['name'] . \"<br /><br />\";\n\t\t\t\t\t\t\t\t\t $html_order .= $email_details['details'] . \"<br /><br />\";\n\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t $html_order .= $products_ordered['html'] . '<br /><br />';\n\t\t\t\t\t\t\t\t\t $html_order .= $email_footer;\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\t $email_order = str_replace(\"[ORDER_NUMBER]\" , SAP_ORDER_PREFIX . $savedorder->info['id'], $email_order);\n\t\t\t\t\t\t\t\t\t $html_order = str_replace(\"[ORDER_NUMBER]\" , SAP_ORDER_PREFIX . $savedorder->info['id'], $html_order);\n\t\t\t\t\t\t \n\t\t\t\t\t\t \n\t\t\t\t\t\t // end of email.\n\t\t\t\t\t\t \n\n\n \n\t\t\t\t\t dsf_send_email($savedorder->customer['name'], $savedorder->customer['email_address'], $email_subject, $email_order, STORE_OWNER, EMAIL_FROM,$html_order);\n\t\t\t\t\t\n\t\t\t\t\t// send emails to other people\n\t\t\t\t\t if (SEND_EXTRA_ORDER_EMAILS_TO != '') {\n\t\t\t\t\t\tdsf_send_email(STORE_OWNER, SEND_EXTRA_ORDER_EMAILS_TO, $email_subject, $email_order, STORE_OWNER, EMAIL_FROM,$html_order);\n\t\t\t\t\t }\n\n\n\t\t\t\t\t// send emails to other people\n\t\t\t\t\t if (SEND_EXTRA_ORDER_EMAILS_DUPLICATE != '') {\n\t\t\t\t\t\tdsf_send_email(STORE_OWNER, SEND_EXTRA_ORDER_EMAILS_DUPLICATE, $email_subject, $email_order, STORE_OWNER, EMAIL_FROM,$html_order);\n\t\t\t\t\t }\n\n\n\n\n\n// just for consistancy.\n\nreturn true;\n\n\n\n\n}",
"function resend_invoice($details) {\n\t\t\t\t$name = $details[0]->ai_first_name . \" \" . $details[0]->ai_last_name;\n\t\t\t\t$invoiceid = $details[0]->booking_id;\n\t\t\t\t$refno = $details[0]->booking_ref_no;\n\t\t\t\t$sendto = $details[0]->accounts_email;\n\t\t\t\t$message = $this->mailHeader;\n\t\t\t\t$message .= \"Dear \" . $name . \",<br>\";\n\t\t\t\t$message .= \"You may review your invoice by visiting at: <a href=\" . base_url() . \"invoice?id=\" . $invoiceid . \"&sessid=\" . $refno . \" >\" . base_url() . \"invoice?id=\" . $invoiceid . \"&sessid=\" . $refno . \"</a>\";\n\t\t\t\t$message .= $this->mailFooter;\n\n\n\t\t\t\t$this->email->set_newline(\"\\r\\n\");\n\t\t\t\t$this->email->from($this->sendfrom);\n\t\t\t\t$this->email->to($sendto);\n\t\t\t\t$this->email->subject('Booking Invoice');\n\t\t\t\t$this->email->message($message);\n\t\t\t\t$this->email->send();\n\t\t}",
"public function execute()\n {\n $processId = uniqid();\n $processString = self::class;\n\n $this->_getSession()->setPayUProcessId($processId);\n $this->_getSession()->setPayUProcessString($processString);\n\n $this->logger->debug(['info' => \"($processId) START $processString\"]);\n\n $postData = file_get_contents(\"php://input\");\n $sxe = simplexml_load_string($postData);\n\n $resultJson = $this->resultFactory->create(ResultFactory::TYPE_JSON)->setJsonData('{}');\n\n if (empty($sxe)) {\n $this->respond('500', 'Instant Payment Notification data is empty');\n\n return $resultJson;\n }\n\n $ipnData = XMLHelper::parseXMLToArray($sxe);\n\n if (!$ipnData) {\n $this->respond('500', 'Failed to decode Instant Payment Notification data.');\n\n return $resultJson;\n }\n\n $incrementId = $ipnData['MerchantReference'];\n /** @var Order $order */\n $order = $incrementId ? $this->_orderFactory->create()->loadByIncrementId($incrementId) : false;\n\n if (!$order || ((int)$order->getId() <= 0)) {\n $this->respond('500', 'Failed to load order.');\n\n return $resultJson;\n }\n\n $this->respond();\n $this->response->processNotify($ipnData, $order);\n\n return $resultJson;\n }",
"public function salesOrderShipmentSaveAfter($observer)\n {\n\n // Get the settings\n $settings = Mage::helper('smsnotifications/data')->getSettings();\n $arr = $settings['order_status'];\n $a = explode(',', $settings['order_status']);\n $b = explode(',', $settings['order_status']);\n $final_array = array_combine($a, $b);\n \n if (!$settings['shipment_notification_message']) {\n return;\n }\n $order = $observer->getEvent()->getShipment()->getOrder();\n \n $billingAdress = $order->getBillingAddress();\n $shippingAdress = $order->getShippingAddress();\n\n if ($order->getCustomerFirstname()) {\n $customer_name = $order->getCustomerFirstname();\n $customer_name .= ' '.$order->getCustomerLastname();\n } elseif ($billingAdress->getFirstname()) {\n $customer_name = $billingAdress->getFirstname();\n $customer_name .= ' '.$billingAdress->getLastname();\n } else {\n $customer_name = $shippingAdress->getFirstname();\n $customer_name .= ' '.$shippingAdress->getLastname();\n }\n\n $order_id = $order->getIncrementId();\n $order_amount = $order->getBaseCurrencyCode();\n $order_amount .= ' '.$order->getBaseGrandTotal();\n\n $telephoneNumber = trim($shippingAdress->getTelephone());\n\n $shipment = $order->getShipmentsCollection()->getFirstItem();\n $shipId = $shipment->getIncrementId();\n\n // Check if a telephone number has been specified\n if(in_array('shippment', $final_array)){\n if ($telephoneNumber) {\n // Send the shipment notification to the specified telephone number\n $text = $settings['shipment_notification_message'];\n $text = str_replace('{{name}}', $customer_name, $text);\n $text = str_replace('{{order}}', $order_id, $text);\n $text = str_replace('{{amount}}', $order_amount, $text);\n $text = str_replace('{{shipmentno}}', $shipId, $text);\n\n array_push($settings['order_noficication_recipients'], $telephoneNumber);\n\n $result = Mage::helper('smsnotifications/data')->sendSms($text, $settings['order_noficication_recipients']);\n // Display a success or error message\n if ($result) {\n $recipients_string = implode(',', $settings['order_noficication_recipients']);\n Mage::getSingleton('adminhtml/session')->addSuccess(sprintf('The shipment notification has been sent via SMS to: %s', $recipients_string));\n } else {\n Mage::getSingleton('adminhtml/session')->addError('There has been an error sending the shipment notification SMS.');\n }\n }\n } \n}",
"public function generate_ack_receipt() {\n $clsid = $this->input->post('cls');\n $crsid = $this->input->post('crs');\n $userid = $this->input->post('usr');\n $invoice_id = $this->input->post('invoice');\n $ack_data = $this->payments_model->get_acknowledgement_data($clsid, $crsid, $userid);\n\n $sfc_amount= $this->payments_model->get_sfc_details($invoice_id);\n if(!empty($sfc_amount['othr_mode_of_payment'])){ \n $other_mod_of_payment= \" & Other Mode Of Payment : ($ \".number_format($sfc_amount['other_amount_recd'],2,'.','').\")\";}\n else{\n $other_mod_of_payment=\"\";\n }\n if(($sfc_amount['sfc_claimed']>0))\n { \n $mod = 'Mode of payment: '.$sfc_amount['mode_of_pymnt'].'($ '.number_format($sfc_amount['sfc_claimed'],2,'.','').')'.''.$other_mod_of_payment;\n }else\n {\n $mod = 'Mode of payment: '.$sfc_amount['mode_of_pymnt'].'($ '.number_format($sfc_amount['amount_recd'],2,'.','').')'.''.$other_mod_of_payment;\n }\n //resetting classroom location parameter id with category name\n $ack_data[classroom_location] = $this->meta_data[$ack_data[classroom_location]];\n\n $ack_data[cert_level] = $this->meta_data[$ack_data[certi_level]];\n\n $tanant = $this->courses_model->get_tenant_details();\n $gender = ($ack_data['gender'] == 'MALE') ? 'Mr. ' : 'Ms. ';\n $date = date('M d Y', strtotime($ack_data['inv_date']));\n $logourl = base_url() . 'logos/' . $this->session->userdata(public_tenant_details)->Logo;\n $startdate = date('M d Y, l', strtotime($ack_data[class_start_datetime])) . ' @ ' . date('h:i A', strtotime($ack_data[class_start_datetime]));\n $Url = base_url() . 'payments/print_receipt';\n echo ' <form action=\"' . $Url . '\" method=\"post\"><p>\n \n <h2 class=\"panel_heading_style\">Payment Receipt</h2><br><a class=\"close-modal \" rel=\"modal:close\" href=\"#close-modal\">Close</a>\n <table width=\"100%\"> \n <tbody>\n <tr>\n <td rowspan=\"4\"><img src=\"' . $logourl . '\" border=\"0\" /></td>\n <td colspan=\"2\">' . $tanant->tenant_name . '</td>\n <td class=\"td_heading\">Receipt No.:</td>\n <td>' . date('Y') . '' . $ack_data['invoice_id'] . '</td>\n </tr>\n <tr>\n <td colspan=\"2\">' . $tanant->tenant_address, $tanant->tenant_city . '</td>\n <td class=\"td_heading\">Receipt Date:</td>\n <td>' . $date . '</td>\n </tr>\n <tr>\n <td colspan=\"4\"></td>\n </tr>\n <tr>\n <td colspan=\"4\">' . $tanant->tenant_contact_num . '</td>\n </tr>\n \n </tbody>\n </table><br>\n \n <p><font style=\"font-size:14px; font-weight:bold;\">Received</font> with thanks SGD ' . $ack_data[total_inv_amount] . ' from <b>' \n . $ack_data[first_name] . ' ' . $ack_data[last_name] . ' </b> for <b> Course: \"' . $ack_data[crse_name] . ' ,Class: '\n . $ack_data[class_name] . ' Certificate Code:' . $ack_data[cert_level] . '</b>\". '.$mod.'</p>\n\n <table class=\"table table-bordered\">\n \n <tbody>\n <tr>\n <td class=\"td_heading\">Class Start Date:</td>\n <td>' . $startdate . '</td>\n </tr>\n \n <tr>\n <td class=\"td_heading\">Location:</td>\n <td>' . $ack_data[classroom_location] . '</td>\n </tr>\n \n <tr>\n <td class=\"td_heading\">Contact Details:</td>\n <td>' . $gender . $ack_data[crse_manager][first_name] . ' ' . $ack_data[crse_manager][last_name] . '(Phone:' . $tanant->tenant_contact_num . ',Email Id: ' . $tanant->tenant_email_id . ')\n <input type=\"hidden\" value=\"' . $clsid . '\" name=\"classId\"/>\n <input type=\"hidden\" value=\"' . $crsid . '\" name=\"courseId\"/> \n <input type=\"hidden\" value=\"' . $userid . '\" name=\"userId\"/>\n </tr>\n </tbody>\n </table>\n \n <p>\n\n</br><p class=\"red\"><i>This is a computer generated receipt and does not require a seal or signature.</i></p>\n\n<div style=\"clear:both;\"></div><br>\n<span style=\"float:right;\">\n<button id=\"print_ack_receipt\" class=\"btn btn-primary\" type=\"submit\">Print</button>\n</p> </form> ';\n }",
"function ProcessNewOrderNotification($dom_response_obj) {\n /*\n * +++ CHANGE ME +++\n * New order notifications inform you of new orders that have\n * been submitted through Google Checkout. A <new-order-notification>\n * message contains a list of the items in an order, the tax\n * assessed on the order, the shipping method selected for the\n * order and the shipping address for the order.\n *\n * If you are implementing the Notification API, you need to\n * modify this function to relay the information in the\n * <new-order-notification> to your internal systems that\n * process this order data.\n */\n // Get Google order ID and customer email from XML response\n $dom_data_root = $dom_response_obj->document_element();\n $google_order_number = $dom_data_root->get_elements_by_tagname(\"google-order-number\");\n $number = $google_order_number[0]->get_content();\n $shop_order_id = $dom_data_root->get_elements_by_tagname(\"order-id\");\n $order_id = $shop_order_id[0]->get_content();\n //echo PROCESS . \"\\n\";\n //print_r($order_id);\n if($order_id > 0)\n {\n // Update order by Google order ID\n tep_db_query(\"update \" . TABLE_ORDERS . \" set google_orders_id='\" . $number . \"' where orders_id='\" . $order_id . \"'\");\n }\n else\n {\n CreateNewOrder($dom_response_obj);\n }\n SendNotificationAcknowledgment();\n}",
"public function processPayment();",
"public function process()\n {\n // check order configurations for funny PT case\n foreach ($this->order_configurations as $config) {\n $products = $config->getProductArray(true);\n $hasPreceptorTraining = in_array(\"9\", $products);\n\n // we found preceptor training and other products\n //(we need an addtional serial number, therefor an additional config)\n if (count($products) > 1 && $hasPreceptorTraining && !$this->upgrade_purchase) {\n $this->addPreceptorTrainingConfig($config->quantity);\n }\n }\n\n //Mark order as completed\n $this->completed = true;\n $this->order_date = new \\DateTime();\n\n //Either apply upgrades or generate new serial numbers\n if ($this->upgrade_purchase) {\n $this->applyUpgradesAndDowngrades();\n } else {\n $this->generateSerialNumbers();\n }\n\n //Send email to interested parties, unless this is an instant order by Staff\n if ($this->order_type->id != 3) {\n $this->emailSerialNumbers();\n }\n\n //Generate invoice number and email the invoice if appropriate\n if ($this->payment_method->id == 1 && !$this->isFreeOrder()) {\n $this->generateInvoiceNumber();\n $this->emailInvoicePdf();\n }\n \n $session = new \\Zend_Session_Namespace(\"OrdersController\");\n $session->unsetAll();\n }",
"function process_message($sender,$message){\n $date_time = date(\"Y/m/d H:i:s\"); \n\n //insert details to message into recsms table\n $query = \"INSERT INTO recsms (date_time,msg,sender_num) VALUES ('$date_time','$message','$sender') \";\n $result_set= mysqli_query($connection,$query);\n if($result_set) {\n \n //echo \"Record has been saved successfully!\";\n \n } \n else {\n // echo \"Record Entry Failed !\";\n }\n\n //getting the id of the entered sms(or last entered row)\n $query= \"SELECT * FROM recsms ORDER BY id DESC LIMIT 1\";\n $result_set= mysqli_query($connection,$query);\n $row=mysqli_fetch_assoc($result_set);\n $rec_id=$row[\"id\"]; //this is the same id for corresponding send message allowing user to crosscheck based on id\n\n //function to seperate based on vendors and output the extracted parts accordingly\n function ext_sms($rec_sms) {\n\n $array=explode(\" \",$rec_sms); \n if($array[0]==\"+\") \n {\n require('functions/fget_huawei.php'); \n return ext_huawei($rec_sms);\n }\n\n else {\n require('functions/fget_ZTE.php');\n return ext_ZTE($rec_sms);\n }\n \n }\n \n $array= ext_sms($message);\n\n //entering region code,alarm name and date-time from received sms into variables\n $region_code=$array['region_code'];\n $alarm=$array['alarm_name'];\n $date_time=$array['date_time'];\n\n //checking weather filtering is enabled for the particular alarm\n $query=\"SELECT* FROM filtersms WHERE alarm_name='$alarm' LIMIT 1\";\n $result_set= mysqli_query($connection,$query);\n\n if (isset($result_set)) { //isset in case alarm name becomes unavailable\n $row = mysqli_fetch_assoc($result_set);\n $filter_alarm = $row['filter_op']; \n \n //code to store sending sms to a single string variable\n $send_message=\"Region : \".$region.\" ; \".\"Alarm : \".$alarm.\" ; \".\"Occurrence : \".$date_time;\n\n if ($filter_alarm == \"1\") { \n\n //taking corresponding region name from regions table\n $query=\"SELECT* FROM regions WHERE region_code='$region_code' LIMIT 1\";\n $result_set= mysqli_query($connection,$query);\n \n if (isset($result_set)) { //isset in case a region_code becomes unavailable\n $row = mysqli_fetch_assoc($result_set);\n $region = $row['region_name'];\n \n //CODE TO SEND SMS\n \n //calling smppclass to send sms\n include ('smppclass.php');\n \n //setting SMPP parameters for sending sms\n $smpphost = \"172.22.88.150\"; //******SPECIFY SMSC IP TO SEND SMS HERE*******\n $smppport = 5020; //******SPECIFY SMSC PORT NUMBER TO SEND SMS HERE*******\n $systemid = \"NOCAlert\"; //******SPECIFY ID TO BIND TRANSMITTER NUMBER HERE*******\n $password = \"noc123\"; //******SPECIFY PASSWORD TO BIND TRANSMITTER NUMBER HERE*******\n $system_type = \"INOC\";\n $from = \"INOC\";\n $smpp = new SMPPClass();\n \n \n $messagefinalstat = \"Ok\";\n $message_sts = \"\";\n \n \n \n //selecting mobile numbers for the respective region\n $query = \" SELECT * FROM regions WHERE region_code = '$region_code'\";\n $result_set= mysqli_query($connection,$query);\n \n $numbersarray = array();\n\n //entering region mobile numbers to an array\n while ($row = mysqli_fetch_assoc($result_set)) {\n \n array_push($numbersarray, $row['mobile_num']);\n \n }\n \n $numberten = \"\";\n for ($ii = 0; $ii < count($numbersarray); $ii++) {\n \n $numbersarray .= $numbersarray[$ii] . \",\";\n }\n\n $numbersarray = rtrim($numbersarray, \",\");\n \n $smpp->SetSender($from);\n $smpp->Start($smpphost, $smppport, $systemid, $password, $system_type);\n $smpp->TestLink();\n \n $smpp->SendMulti($numbersarray, $send_message);\n $smpp->End();\n\n // $msg_status = \"Sent\";\n //Following part addded according to smpp protocol to see success\n \n $message_sts = \"Send Failed\";\n if ($smpp->get_last_message_status() != 0) {\n $message_sts = \"Send Failed\";\n // echo 'Error';\n } else {\n $message_sts = \"Send Success\";\n }\n\n\n } //end isset region_code\n \n } //end if filter alarm\n\n else { $msg_status = \"Not Sent\"; } //not sent when not filtered\n\n //entering data to the sentsms table\n $query= \"INSERT INTO sentsms (id,date_time,region_name,alarm_name,ack) VALUES ($rec_id,'$date_time','$region','$alarm','$msg_status')\";\n $result_set= mysqli_query($connection,$query);\n\n } //end isset alarm_name\n\n }",
"function paid_sendEmail_customer($details) {\n\t\t\t\n\t\t\t$currencycode = $details->currCode;\n\t\t\t$currencysign = $details->currSymbol;\n\n\n\t\t\t\t$total_amount = $details->checkoutTotal;\n\t\t\t\t $abc = $details->Extra_data->normal_price - $total_amount;\n if($abc < 0){\n $save = '0';\n\n }else{\n $save = number_format($details->Extra_data->normal_price - $total_amount,0);\n\t\t\t\t\t}\n\n\t\t\t\t$id = $details->id;\n\t\t\t\t$itemid = $details->itemid;\n\t\t\t\t$custid = $details->bookingUser;\n\t\t\t\t$country = $details->userCountry;\n\t\t\t\t$name = $details->userFullName;\n\t\t\t\t$stars = $details->stars;\n\t\t\t\t$code = $details->code;\n\t\t\t\t$booking_adults = $details->Extra_data->adults;\n\t\t\t\t$child = $details->Extra_data->child;\n\t\t\t\t\n\t\t\t\t$phone = $details->userMobile;\n\t\t\t\t$paymethod = $details->paymethod;\n\t\t\t\t$invoiceid = $details->id;\n\t\t\t\t$refno = $details->code;\n\t\t\t\t$deposit = $details->subItem->price;\n\t\t\t\t$quantity = $details->subItem->quantity;\n\t\t\t\t$hotel_title = $details->subItem->title;\n\t\t\t\t$duedate = $details->expiry;\n\t\t\t\t$date = $details->date;\n\t\t\t\t$sendto = $details->accountEmail;\n\n\t\t\t\t$additionaNotes = $details->additionaNotes;\n\n\t\t\t\t$remaining = $details->remainingAmount;\n\t\t\t\t$HOTEL_NAME = $details->title;\n\t\t\t\t$location = $details->location;\n\t\t\t\t$room_name = $details->subItem->title;\n\t\t\t\t$booking_adults = $details->subItem->booking_adults;\n\t\t\t\t$room_price = $details->subItem->price;\n\t\t\t\t\n\t\t\t\t$checkin = $details->checkin;\n\t\t\t\t\n\t\t\t\t$checkout = $details->checkout;\n\t\t\t\t$couponRate = $details->couponRate;\n\t\t\t\t\n\t\t\t\t$date = date ( \"m/d/Y\" , strtotime ( \"-1 day\" , strtotime ( $details->checkin ) ) );\n\t\t\t\t$no_of_room = $details->subItem->quantity;\n\t\t\t\t$thumbnail = str_replace(\"demo.tarzango.com/\",\"tarzango.com/\",$details->thumbnail);\n\t\t\t\t$hotel_id = $details->itemid;\n\n\t\t\t\t$guest_name = $details->Extra_data->guest_name;\n\t\t\t\t$guest_age = $details->Extra_data->guest_age;\n\t\t\t\t$chil = $details->Extra_data->child;\n\t\t\t\t$child_name = isset($details->Extra_data->child_name) ? $details->Extra_data->child_name : 0;\n\t\t\t\t$child_age = isset($details->Extra_data->child_age) ? $details->Extra_data->child_age : 0;\n\t\t\t\t\n\t\t\t\t$sitetitle = \"\";\n\n\t\t\t\t$invoicelink = \"\";\n\t\t\t\t\n\t\t\t\t$sendto = $details->accountEmail;\n\t\t\t\t\n\t\t\t\t $ptheme = pt_default_theme();\n\t\t\t\t\t$this->_config = config_item('theme');\n\t\t\t\t\t$uu = $this->_config['url'];\n\t\t\t\t$email_temp_img = $uu.$ptheme.'/email_temp_img/gb_email_temp_img/';\n\t\t\t\t/*$template = $this->shortcode_variables(\"bookingpaidcustomer\");\n\t\t\t\t$details = email_template_detail(\"bookingpaidcustomer\");*/\n\n\t\t\t\t $book_room = $no_of_room;\n \n $room_per_guest = $booking_adults / $book_room;\n \n for ($r_i=0; $r_i < $book_room ; $r_i++) {\n \t$cc = $r_i+1;\n \t$no_top_hotel .= '<li class=\"title\" style=\"float: left; width: 100%; list-style-type: none; margin-left:0px;\">\n <p style=\"font-size: 11px;color: #a5a6b4;padding-top: 15px;margin-left: -30px;\">ROOM '.$cc.'</p>\n </li>';\n\t for($g_d_a=0; $g_d_a < $room_per_guest; $g_d_a++){\n\n\t $jj = $g_d_a + $r_i;\n\t $dd = $guest_name[$jj];\n\t $age = $guest_age[$jj];\n\t \n\n\t \t$no_top_hotel .= '<li class=\"username\" style=\"list-style-type: none;width: 100%;float:left;border-bottom: 1px solid #e6e7ed; margin-left:0px; \">\n\t\t <h5 class=\"left\" style=\"font-size: 16px;color: #0c134f;float: left; margin-left: -30px;\">'.$dd.'</h5>\n \t\t<h5 class=\"right\" style=\"float:right;font-size: 16px;color: #0c134f;margin-right: 5px;\">'.$age.' Years</h5>\n\t\t </li>';\n\t }\n }\n\n if($chil > 0){\n\t $no_top_hotel .= ' <li class=\"title\" style=\"float: left; width: 100%; list-style-type: none; margin-left:0px; \">\n \t\t\t\t <p style=\"font-size: 11px;color: #a5a6b4;padding-top: 15px;\">CHILD DETAILS</p>\n \t\t\t\t </li>';\n \t for($c_i=0;$c_i<$chil;$c_i++){\n \t \t $ii = $c_i;\n\t \t\t $child_name1 = $child_name[$ii];\n\t \t\t $child_age1= $child_age[$ii];\n \t \t\n \t \t $no_top_hotel .= '<li class=\"username\" style=\"list-style-type: none;width: 96%;float:left;border-bottom: 1px solid #e6e7ed; margin-left:0px;\">\n \t\t\t<h5 class=\"left\" style=\"font-size: 16px;color: #0c134f;float: left; margin-left: -30px;\">'.$child_name1.'</h5>\n \t\t<h5 class=\"right\" style=\"font-size: 16px;color: #0c134f;float: right;margin-right: 5px;\"><img src=\"'.$email_temp_img.'paynow_icon8.png\"> '.$child_age1.' Years</h5>\n \t\t\t</li>';\n \t}\n }\n\n \t$this->db->select('hotel_latitude,hotel_longitude,hotel_desc,hotel_map_city,hotel_stars');\n\t\t \t$this->db->where('hotel_id', $itemid);\n\t\t \t$query = $this->db->get('pt_hotels');\t\n\t\t \t$hotel_data = $query->result();\n\n\t\t \t$star_temp_img = $uu.$ptheme.'/images/';\n\n\t\t\t\t\t/*echo $hotel_data[0]->hotel_stars;*/\n\n\t\t\t\t\t$aaa = '';\n\t\t\t\t\tfor ($st_i=0; $st_i < 5 ; $st_i++) { \n \tif($st_i < $hotel_data[0]->hotel_stars){\n \t\t$aaa .= '<img src=\"'.$star_temp_img.'/star-on.png\">';\n \t}else{\n \t\t$aaa .= '<img src=\"'.$star_temp_img.'/star-off.png\">';\n \t}\n }\n\n\t\t \t$arrayInfo['checkIn'] = date(\"m/d/Y\", strtotime(\"+1 days\"));\n\t\t \t$arrayInfo['checkOut'] = date(\"m/d/Y\", strtotime(\"+2 days\"));\n\t\t \t$arrayInfo['adults'] = '1';\n\t\t \t$arrayInfo['child'] = '';\n\t\t \t$arrayInfo['room'] = '1';\n\t\t \t/*error_reporting(E_ALL);*/\n\t\t \t\t//$this->ci = & get_instance();\n\t\t\t\t\t\t// $this->db = $this->ci->db;\n\t\t\t\t\t$this->load->model('hotels/hotels_model');\n\t\t \t\n\t\t \t$local_hotels = $this->hotels_model->search_hotels_by_lat_lang($hotel_data[0]->hotel_latitude, $hotel_data[0]->hotel_longitude,$arrayInfo);\n\n\t\t \t$top_hotel = '<div class=\"col-sm-12 hotels\">';\n\n\t\t \tfor ($i=0; $i < count($local_hotels['hotels']) ; $i++) { \n\t\t \t\tif($i < 3){\n\t\t \t\t $image = str_replace(\"demo.tarzango.com/\",\"tarzango.com/\",$bb[$i]->thumbnail);\n\t\t \t\t$bb = $local_hotels['hotels'];\n\t\t \t\t $bb[$i]->title;\n\t\t \t\t$top_hotel .= '<a class=\"col-sm-4\" href=\"'.$bb[$i]->slug.'\" style=\"margin-left: 2%;padding:10px;text-decoration: none; width:27.3333%;float: left; box-sizing: border-box;position: relative;\">';\n\t\t \t\t\t\t\t\tif($image == \"\"){\n\n\t\t\t\t\t\t\t\t\t\t\t$top_hotel .= '<img height=185px class=\"img-responsive\" src=\"'.$uu.$ptheme.'/email_temp_img/gb_email_temp_img/email-d-lasvegas.png\" style=\"width: 100%; min-height: 185px; height: 185px; max-height: 185px;\">';\n\t\t\t\t\t\t\t\t\t\t}else{\n\n\t\t\t\t\t\t\t\t\t\t\t$top_hotel .= '<img height=185px class=\"img-responsive\" src=\"'.$image.'\" style=\"width: 100%; min-height: 185px; height: 185px; max-height: 185px;\">';\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\t$top_hotel .= '<p style=\"text-align:center;margin:0px;color: rgb(12, 19, 79);font-size: 14px;margin: 20px 0 10px;font-family: \\'Roboto\\',sans-serif;\">'.$this->custom_echo($bb[$i]->title, 25).'</p>\n\t\t\t\t\t\t\t\t\t\t\t<h4 style=\" text-align:center;margin:0px; color: rgb(28, 192, 251);font-size: 20px;font-weight: 600;font-family: \\'Roboto\\',sans-serif;\">'.$bb[$i]->currCode.$bb[$i]->price.'</h4>\n\t\t\t\t\t\t\t\t\t\t</a>';\n\t\t \t} \n\t\t }\n\n\t\t \t$map = '<div class=\"col-sm-12 map\" style=\"width: 100%;padding-left: 0;float: left; box-sizing: border-box;min-height: 1px; padding-right:0px; position: relative;\">\n\t\t\t\t\t\t\t\t <a href=\"http://maps.google.com/?daddr={hotel_name}\" target=\"_blank\"> \n <img style=\"width:100%\" border=\"0\" src=\"https://maps.googleapis.com/maps/api/staticmap?center='.$hotel_data[0]->hotel_latitude.','.$hotel_data[0]->hotel_longitude.'&zoom=14&size=620x260&markers=size:mid%7Ccolor:red%7C'.$hotel_data[0]->hotel_latitude.','.$hotel_data[0]->hotel_longitude.'&key=AIzaSyAH65sTGsDsP4mMpmbHC8zqRiM1Qh07iL8\" alt=\"Google map\"></a>\n\t\t\t\t\t\t\t</div>';\n\n\t\t\t\t$res = $this->settings_model->get_contact_page_details();\n\t\t\t\t$contact_phone = $res[0]->contact_phone;\n\t\t\t\t$contact_email = $res[0]->contact_email;\n\t\t\t\t$contact_address = $res[0]->contact_address;\n\n\t\t\t\t\n\n\t\t\t\t$template = array(\"{invoice_id}\", \"{hotel_name}\", \"{stars}\", \"{location}\", \"{code}\",\"{invoice_code}\", \"{deposit_amount}\", \"{total_amount}\", \"{customer_email}\", \"{customer_id}\", \"{country}\", \"{phone}\", \"{currency_code}\", \"{currency_sign}\", \"{invoice_link}\", \"{site_title}\", \"{remaining_amount}\", \"{fullname}\",\"{room_name}\",\"{date}\",\"{checkin}\",\"{checkout}\",\"{no_of_room}\",\"{thumbnail}\",\"{booking_adults}\",\"{room_price}\",\"{couponRate}\",\"{additionaNotes}\",\"{email_temp_img}\",\"{quantity}\",\"{hotel_title}\",\"{booking_adults}\",\"{child}\",\"{no_top_hotel}\",\"{top_hotel}\",\"{map}\",\"{aaa}\",\"{save}\");\n\t\t\t\t//$smsdetails = sms_template_detail(\"bookingpaidcustomer\");\n\t\t\t\t$values = array($invoiceid, $HOTEL_NAME, $stars, $location, $code, $refno, $deposit, $total_amount, $sendto, $custid, $country, $phone, $currencycode, $currencysign, $invoicelink, $sitetitle, $remaining , $name, $room_name, $date, $checkin, $checkout, $no_of_room, $thumbnail,$booking_adults,$room_price,$couponRate,$additionaNotes,$email_temp_img, $quantity,$hotel_title,$booking_adults,$child,$no_top_hotel,$top_hotel,$map,$aaa,$save);\n\n\t\t\t\t$HTML_DATA = file_get_contents( $uu.$ptheme.'/invoice.html');\n\t\t\t\t$message = str_replace($template, $values, $HTML_DATA);\n\n\t\t\t\t\n\t\t\t\t/*$message = $this->mailHeader;*/\n\t\t\t\t/*echo '<pre>'.json_encode($message).'</pre>';\n\t\t\t\texit();*/\n\t\t\t\t/*$details = $this->html_template_booking($hotel_id,$invoiceid);\n\t\t\t\t$message .= str_replace($template, $values, $details);*/\n\t\t\t\t//$message .= $this->mailFooter;\n\t\t\t\t/*echo $message;\n\t\t\t\texit;*/\n\t\t\t\t//$smsmessage = str_replace($template, $values, $smsdetails[0]->temp_body);\n\t\t\t\t//sendsms($smsmessage, $phone, \"bookingpaidcustomer\");\n\t\t\t\t$this->email->set_newline(\"\\r\\n\");\n\t\t\t\t$this->email->from($this->sendfrom);\n\t\t\t\t$this->email->to($sendto);\n\t\t\t\t$this->email->subject('Thanks for Booking at the '.$HOTEL_NAME);\n\t\t\t\t$this->email->message($message);\n\t\t\t\t$this->email->send();\n\t\t\t\t\n\t\t}"
] |
[
"0.66655177",
"0.6397369",
"0.61713976",
"0.6044066",
"0.6040718",
"0.59833896",
"0.5917501",
"0.58195776",
"0.58002305",
"0.57915616",
"0.5745082",
"0.56682366",
"0.56661737",
"0.5655749",
"0.55598557",
"0.5550321",
"0.5512129",
"0.5503838",
"0.5487822",
"0.5481361",
"0.5479305",
"0.5458178",
"0.54539144",
"0.5452497",
"0.5429523",
"0.54163575",
"0.5415178",
"0.5405416",
"0.5404822",
"0.5391408"
] |
0.75695753
|
0
|
/ Method to process the notifySmsReception SOAP request from the client The programmer must save some code to record the parameters received into the database/file for further processing
|
function notifySmsReception($correlator,$message){
//refer to the global variables set by the XML parser from the SOAP header
global $traceUniqueID;
global $spRevId;
global $spRevpassword;
global $spId;
global $serviceId;
global $linkid;
//soap header parameters
$msg_spRevId=$spRevId;
$msg_spRevpassword=$spRevpassword;
$msg_spId=$spId;
$msg_serviceId=$serviceId;
$msg_linkid=$linkid;
$msg_traceUniqueID=$traceUniqueID;
//soap body parameters
$msg_message=$message->message;
$msg_senderAddress=$message->senderAddress;
$msg_smsServiceActivationNumber=$message->smsServiceActivationNumber;
$msg_dateTime=$message->dateTime;
/*
* Code to use the data received will appear here.
* You can connect save the data in a database and have it polled by another service.
*/
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function notifySmsDeliveryReceipt($correlator,$deliveryStatus){\r\n\t\t\tglobal $timeStamp;\r\n\t\t\tglobal $subReqID;\r\n\t\t\tglobal $traceUniqueID;\r\n\t\t\t\r\n\t\t\t//variables to be saved in a database or processed\r\n\t\t\t$msg_timeStamp=$timeStamp;\r\n\t\t\t$msg_subReqID=$subReqID;\r\n\t\t\t$msg_traceUniqueID=$traceUniqueID;\r\n\t\t\t$msg_correlator=$correlator;\r\n\t\t\t$msg_address=$deliveryStatus->address;\r\n\t\t\t$msg_deliveryStatus=$deliveryStatus->deliveryStatus;\r\n\t\t\t \r\n\t\t\t/*\r\n\t\t\t* Code to use the data received will appear here. \r\n\t\t\t* You can connect save the data in a database and have it polled by another service.\r\n\t\t\t*/\r\n\t\t \r\n\t}",
"public function processMsg()\n {\n\t\t$postStr = $GLOBALS[\"HTTP_RAW_POST_DATA\"];\n \t//extract post data\n \t$logfile = fopen(\"./log/request_log\", \"a\");\n \tfwrite($logfile, $postStr);\n \tfclose($logfile);\n\t\tif (!empty($postStr)){\n /* libxml_disable_entity_loader is to prevent XML eXternal Entity Injection,\n the best way is to check the validity of xml by yourself */\n libxml_disable_entity_loader(true);\n $parseObj = new RequestParse();\n $requestData = $parseObj->parse($postStr);\n $processObj = new RequestProcess();\n $responseData = $processObj->process($requestData);\n $responseObj = new RequestResponse();\n //echo $responseObj->response($responseData);\n\t\t $response = $responseObj->response($responseData);\n\t\t echo $response;\n\t\t $logfile = fopen(\"./log/response_log\", \"a\");\n\t\t fwrite($logfile, $response);\n\t\t fclose($logfile);\n }else {\n \techo \"\";\n \texit;\n }\n }",
"public function postAction()\n {\n \n try{\n $externalId=null;\n $to=null;\n $status=null;\n $provider=null;\n $providerName=null;\n \n $writer = new Zend_Log_Writer_Stream('../private/logs/n2manager.messages.log');\n $logger = new Zend_Log($writer);\n //request sent from n2manager system to spoora\n if($this->_getParam('externalid')!=null){\n $externalId=$this->_getParam('externalid');\n }\n\t //intelliSMS status report\n\t elseif($this->_getParam('msgid')!=null){\n\t $provider = new IntelliSMSProvider();\n\t $providerName=\"IntelliSMS\";\n\t $externalId=$this->_getParam('msgid');\n\t $to=\"00\".$this->_getParam('toaddr');\n\t }\n\t //Routo report\n\t elseif($this->_getParam('mess_id')!=null){\n\t $provider = new RoutoProvider();\n\t $providerName=\"RoutoSMS\";\n\t $externalId=$this->_getParam('mess_id');\n\t $to=\"00\".$this->_getParam('number');\n\t }\n\t //42Telecom\n\t elseif($this->_getParam('smsid')!=null){\n\t $provider = new Sms42TelecomProvider();\n\t $providerName=\"42Telecom\";\n\t $externalId=$this->_getParam('smsid');\n\t $to=null;\n\t \n\t }\n\t //USA BulkSMS\n\t elseif($this->_getParam('referring_batch_id')!=null){\n\t $provider = new UsaBulkSMSProvider();\n\t $providerName=\"UsaBulkSMS\";\n\t $externalId=$this->_getParam('referring_batch_id');\n\t \n\t if($this->_getParam('msisdn')!=null)\n\t\t$to=\"00\".$this->_getParam('msisdn');\n\t \n\t }\n\t $status=$this->_getParam('status');\n\t \n\t sleep(2);\n\t\t\n\t if($to!=null){$messageBroadcast=MessageHelper::getMessageBroadcastByExternalId($externalId,$to);}\n\t else{\n\t\t$messageBroadcast=MessageHelper::getMessageBroadcastByExternalIdOnly($externalId);\n\t\t$to=$messageBroadcast->getDestinationNumber();\n\t\t}\n //to update spoora SMS send messages status\n \t$providerId=$messageBroadcast->getProviderId();\n\t \tswitch($providerId){\n\t\t\t/*case 1: $provider= new Tm4bProvider();break;*/\n\t\t\tcase 2: $provider= new RoutoProvider();$providerName=\"RoutoSMS\";break;\n\t\t\tcase 3: $provider= new IntelliSMSProvider();$providerName=\"IntelliSMS\";break;\n\t\t}\n\t \n\t\tif($messageBroadcast!=null){\n\t\t $provider->updateSmsStatus($messageBroadcast,$status); \n\t\t $responseError=\"No error\";\n\t\t}\n\t\telse{\n\t\t $responseError=\"messageBroadcast NULL\";\n\t\t}\n\t \n\t \n\t $logger->info($this->getRequest()->getServer('REMOTE_ADDR').\" - MessagestatusController > getAction:\\n\\t\".\n\t\t\t\t \"Provider: \".$providerName.\"\\n\\t\".\n\t\t\t\t \"externalId: \".$externalId.\"\\n\\t\".\n\t\t\t\t \"status: \".$status.\"\\n\\t\".\n\t\t\t\t \"to: \".$to.\"\\n\\t\".\n\t\t\t\t \"Error: \".$responseError.\"\\n\\t\");\n\t \n\t $this->getResponse()->appendBody(\"OK\");\n\t}catch (Exception $e) {\n\t\t$this->getRequest()->setParam('error_code', $e->getCode());\n\t\t$this->getRequest()->setParam('error_message', $e->getMessage());\n\t\t$this->getRequest()->setParam('error_trace', $e->getTraceAsString());\n\t\t$this->_forward('n2sms', 'error');\n \n }\n\t\n }",
"public function smsReceive(Request $request){\n if(isset($request->requestId)){\n $message = $request->input('message');\t\n $requestId = $request->input('requestId');\t\t\n $encoding = $request->input('encoding');\t\n $applicationId = $request->input('applicationId');\t\t\n $sourceAddress = $request->input('sourceAddress');\t\n $version = $request->input('version');\t\n\n $messageData = new MessageData();\n $messageData->message = $message;\n $messageData->requestId = $requestId;\n $messageData->encoding = $encoding;\n $messageData->applicationId = $applicationId;\n $messageData->sourceAddress = $sourceAddress;\n $messageData->version = $version;\n $otp \t= $this->generateRandomString(6);\n $messageData->otp = $otp;\n\n if($messageData->save()){\n $msg = \"You have successfully subscribed to our service. Your code is:\" . $otp .\" Please use this Code to avail your service. Thank you \";\n $this->sendSubsriptionSmsToSubscriber($applicationId, $msg, $sourceAddress);\n $data['sucess'] = true;\n $data['message'] = \"Data Saved\";\n\n }else{\n $data['sucess'] = false;\n $data['message'] = \"Messaeg Data saving error.\";\n }\n\n\n }else{\n\n $version = $request->input('version');\t\n $applicationId = $request->input('applicationId');\t\t\n $subscriberId = $request->input('subscriberId');\t\n $status = $request->input('status');\t\t\n $frequency = $request->input('frequency');\t\n $timeStamp = $request->input('timeStamp');\t\t\t\n \n if($status == \"REGISTERED\"){\n $subData = new SubscriptionData();\n $subData->appId = $applicationId;\n $subData->subscriberId = $subscriberId;\n $otp \t= $this->generateRandomString(6);\n $subData->otp = $otp;\n\n if($subData->save()){\n $msg = \"You have successfully subscribed to our service. Your code is:\" . $otp .\" Please use this Code to avail your service. Thank you \";\n $musk = \"tel:\".$subscriberId;\n $this->sendSubsriptionSmsToSubscriber($applicationId, $msg, $musk);\n }\n \n }\n\n\n $sms = new SmsSaved();\n\n $sms->version = isset($version) ? $version : \"\";\n $sms->applicationId = isset($applicationId) ? $applicationId : \"\";\t\t\n $sms->subscriberId = isset($subscriberId) ? $subscriberId : \"\";\t\n $sms->status = isset($status) ? $status : \"\";\t\t\n \n $sms->frequency = isset($frequency) ? $frequency : \"\";\n $sms->timeStamp = isset($timeStamp) ? $timeStamp : \"\"; \n \n\n if($sms->save()){\n $data['sucess'] = true;\n $data['message'] = \"Data Saved\";\n }\n }\n return $data;\n \n \n }",
"function process_message($sender,$message){\n $date_time = date(\"Y/m/d H:i:s\"); \n\n //insert details to message into recsms table\n $query = \"INSERT INTO recsms (date_time,msg,sender_num) VALUES ('$date_time','$message','$sender') \";\n $result_set= mysqli_query($connection,$query);\n if($result_set) {\n \n //echo \"Record has been saved successfully!\";\n \n } \n else {\n // echo \"Record Entry Failed !\";\n }\n\n //getting the id of the entered sms(or last entered row)\n $query= \"SELECT * FROM recsms ORDER BY id DESC LIMIT 1\";\n $result_set= mysqli_query($connection,$query);\n $row=mysqli_fetch_assoc($result_set);\n $rec_id=$row[\"id\"]; //this is the same id for corresponding send message allowing user to crosscheck based on id\n\n //function to seperate based on vendors and output the extracted parts accordingly\n function ext_sms($rec_sms) {\n\n $array=explode(\" \",$rec_sms); \n if($array[0]==\"+\") \n {\n require('functions/fget_huawei.php'); \n return ext_huawei($rec_sms);\n }\n\n else {\n require('functions/fget_ZTE.php');\n return ext_ZTE($rec_sms);\n }\n \n }\n \n $array= ext_sms($message);\n\n //entering region code,alarm name and date-time from received sms into variables\n $region_code=$array['region_code'];\n $alarm=$array['alarm_name'];\n $date_time=$array['date_time'];\n\n //checking weather filtering is enabled for the particular alarm\n $query=\"SELECT* FROM filtersms WHERE alarm_name='$alarm' LIMIT 1\";\n $result_set= mysqli_query($connection,$query);\n\n if (isset($result_set)) { //isset in case alarm name becomes unavailable\n $row = mysqli_fetch_assoc($result_set);\n $filter_alarm = $row['filter_op']; \n \n //code to store sending sms to a single string variable\n $send_message=\"Region : \".$region.\" ; \".\"Alarm : \".$alarm.\" ; \".\"Occurrence : \".$date_time;\n\n if ($filter_alarm == \"1\") { \n\n //taking corresponding region name from regions table\n $query=\"SELECT* FROM regions WHERE region_code='$region_code' LIMIT 1\";\n $result_set= mysqli_query($connection,$query);\n \n if (isset($result_set)) { //isset in case a region_code becomes unavailable\n $row = mysqli_fetch_assoc($result_set);\n $region = $row['region_name'];\n \n //CODE TO SEND SMS\n \n //calling smppclass to send sms\n include ('smppclass.php');\n \n //setting SMPP parameters for sending sms\n $smpphost = \"172.22.88.150\"; //******SPECIFY SMSC IP TO SEND SMS HERE*******\n $smppport = 5020; //******SPECIFY SMSC PORT NUMBER TO SEND SMS HERE*******\n $systemid = \"NOCAlert\"; //******SPECIFY ID TO BIND TRANSMITTER NUMBER HERE*******\n $password = \"noc123\"; //******SPECIFY PASSWORD TO BIND TRANSMITTER NUMBER HERE*******\n $system_type = \"INOC\";\n $from = \"INOC\";\n $smpp = new SMPPClass();\n \n \n $messagefinalstat = \"Ok\";\n $message_sts = \"\";\n \n \n \n //selecting mobile numbers for the respective region\n $query = \" SELECT * FROM regions WHERE region_code = '$region_code'\";\n $result_set= mysqli_query($connection,$query);\n \n $numbersarray = array();\n\n //entering region mobile numbers to an array\n while ($row = mysqli_fetch_assoc($result_set)) {\n \n array_push($numbersarray, $row['mobile_num']);\n \n }\n \n $numberten = \"\";\n for ($ii = 0; $ii < count($numbersarray); $ii++) {\n \n $numbersarray .= $numbersarray[$ii] . \",\";\n }\n\n $numbersarray = rtrim($numbersarray, \",\");\n \n $smpp->SetSender($from);\n $smpp->Start($smpphost, $smppport, $systemid, $password, $system_type);\n $smpp->TestLink();\n \n $smpp->SendMulti($numbersarray, $send_message);\n $smpp->End();\n\n // $msg_status = \"Sent\";\n //Following part addded according to smpp protocol to see success\n \n $message_sts = \"Send Failed\";\n if ($smpp->get_last_message_status() != 0) {\n $message_sts = \"Send Failed\";\n // echo 'Error';\n } else {\n $message_sts = \"Send Success\";\n }\n\n\n } //end isset region_code\n \n } //end if filter alarm\n\n else { $msg_status = \"Not Sent\"; } //not sent when not filtered\n\n //entering data to the sentsms table\n $query= \"INSERT INTO sentsms (id,date_time,region_name,alarm_name,ack) VALUES ($rec_id,'$date_time','$region','$alarm','$msg_status')\";\n $result_set= mysqli_query($connection,$query);\n\n } //end isset alarm_name\n\n }",
"function recive_sms(){\n // 'originalsenderid' => '+19179354988',\n // 'body' => 'Chat with you started 5157248',\n // 'message' => 'Chat with you started 5157248',\n // 'sms' => '+16102231415',\n // 'custom_string' => '',\n // 'to' =>'+16102231415',\n // 'original_message_id' => '',\n // 'originalmessageid' => '',\n // 'customstring' => '',\n // 'from' => '+918591041420',\n // 'originalmessage' => '',\n // 'user_id' => '73872',\n // 'subaccount_id' => '86325',\n // 'original_body' => '',\n // 'timestamp' => '1556179523',\n // 'message_id' => 'FBF799B1-2BDC-4D29-86EE-4F9EC69931D7',\n // );\n App::save_data('log_data',array('log_type'=>'sms_receive','log_data'=> json_encode($_POST) ) );\n if(isset($_POST['to'] ) ){\n $to_sms = $_POST['to'];\n $from_sms = $_POST['message'];\n $raw = json_encode($_POST);\n $timestamp = $_POST['timestamp'];\n $datetime = date('Y:m:d H:i:s');\n \n // $from_sms_api = (array) App::get_by_where('leads_sms', array('sms_to'=>$to_sms) );\n \n $newstring = substr($to_sms, -10);\n $this->db->select('*');\n $this->db->from('leads');\n $this->db->like(\"phone\",\"$newstring\");\n $query=$this->db->get();\n $from_sms_api = $query->row();\n \n $leadData = array(\n 'lead_id' =>$from_sms_api->id,\n 'sms_text' => $from_sms,\n 'sms_to' => $to_sms,\n 'sms_type' => 'in',\n 'sms_time' => $datetime,\n );\n App::save_data( 'leads_sms',$leadData);\n App::create_activity('lead_activity',$from_sms_api->id,'SMS Received',json_encode($_POST));\n }\n }",
"public function receiveMessageAction() \n { \n \n $this->_helper->layout()->disableLayout();\n if ($_SERVER['REQUEST_METHOD'] == 'POST') {\n ini_set(\"display_errors\", 1);\n function receiveMessage($a) {\n $ReceiveMessage = new App_Controller_Action_Helper_ReceiveMessageProduccion();\n $result = $ReceiveMessage->_receiveMessages($a);\n return array(\"response\" => $result);\n }\n\n function logTrama($str = \"\") {\n $archivo = APPLICATION_PATH . '/../data/tramas_recibido/datos_recibidos_abdcp_nuevos_ultimos_producion_' . date('Ymdhis') . \".txt\";\n $fl = fopen($archivo, \"x\");\n fwrite($fl, $str);\n fclose($fl);\n }\n\n function filtrarMensage($msg) {\n\n /* ES DONDE LE QUITAMOS EL MIME */\n $INI = strpos($msg, '<?xml');\n $FIN = strpos($msg, ':Envelope>');\n return substr($msg, $INI, ($FIN + strlen(':Envelope>')) - $INI);\n }\n\n function soaputils_autoFindSoapRequest() {\n global $HTTP_RAW_POST_DATA;\n if ($HTTP_RAW_POST_DATA) {\n logTrama($HTTP_RAW_POST_DATA);\n return filtrarMensage(utf8_decode($HTTP_RAW_POST_DATA));\n }\n $f = file(\"php://input\");\n $texto = implode(\" \", $f);\n logTrama($texto);\n return filtrarMensage(utf8_decode($texto));\n }\n\n ini_set(\"soap.wsdl_cache_enabled\", \"0\");\n $this->_serverSoap->addFunction(\"receiveMessage\");\n $this->_serverSoap->handle(soaputils_autoFindSoapRequest());\n exit;\n }\n \n }",
"public function main()\n {\n $sms = $this->SmsService->smsList();\n $sendId= [];\n $cnt = count($sms);\n $this->log(\"Send Message count \".$cnt,'debug');\n if($cnt>0){\n $refKey = \"FCCTV\".time();\n $api = new gabiaSmsApi('brickcommerce','6caf388099c1c8f8a782dfa57534b1dc');\n\n foreach($sms as $key => $info){\n try{\n //$sendId[]=$info->id;\n $r = $api->sms_send($info->recv_phone_number, \"070-5015-6383\",$info->message,$refKey);\n\n if ($r == gabiaSmsApi::$RESULT_OK)\n {\n $this->log(\"Send Message \".$info->id.\" : number : \".$info->recv_phone_number. \" : \" . $api->getResultMessage() . \"이전 : \" . $api->getBefore() . \" : 이후 : \" . $api->getAfter(),'debug');\n $this->SmsService->smsSendUpdate($info->id);\n }\n\n //$this->log(\"Send Message \".$info->id.\" : number : \".$info->recv_phone_number,'debug');\n }catch (Exception $e){\n $this->log($e->getMessage(),'error');\n }\n\n }\n\n $result = $api->get_status_by_ref($refKey);\n $this->log(\"CODE : \".$result[\"CODE\"].\"::::::MESG : \".$result[\"MESG\"],'debug');\n\n }\n }",
"public function responseMsg()\n {\n $postStr = $GLOBALS[\"HTTP_RAW_POST_DATA\"];\n \n //extract post data\n if (!empty($postStr)){\n /* libxml_disable_entity_loader is to prevent XML eXternal Entity Injection,\n the best way is to check the validity of xml by yourself */\n libxml_disable_entity_loader(true);\n $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);\n $fromUsername = $postObj->FromUserName;\n $toUsername = $postObj->ToUserName;\n $keyword = trim($postObj->Content);\n $time = time();\n $msgType = $postObj->MsgType;//消息类型\n $event = $postObj->Event;//时间类型,subscribe(订阅)、unsubscribe(取消订阅)\n $textTpl = \"<xml>\n <ToUserName><![CDATA[%s]]></ToUserName>\n <FromUserName><![CDATA[%s]]></FromUserName>\n <CreateTime>%s</CreateTime>\n <MsgType><![CDATA[%s]]></MsgType>\n <Content><![CDATA[%s]]></Content>\n <FuncFlag>0</FuncFlag>\n </xml>\"; \n \n switch($msgType){\n case \"event\":\n if($event==\"subscribe\"){\n $contentStr = \"最新更新说明:\".\"\\n\".\"A:优化二维码搜索功能,搜索更精准\".\"\\n\".\"B:微信群二维码采集源更新:\".\"\\n\".\"1、百度贴吧\".\"\\n\".\"2、新浪微博\".\"\\n\".\"3、兴趣部落\".\"\\n\".\"4、700+陌陌群\".\"\\n\".\"5、3500+个微信群\".\"\\n\".\"6、1300+个QQ群\".\"\\n\".\"C:支持支付方式:\".\"\\n\".\"1、微信支付\".\"\\n\".\"2、支付宝(敬请期待)\";\n } \n break;\n case \"text\":\n /*switch($keyword){\n case \"1\":\n $contentStr = \"店铺地址:\".\"\\n\".\"杭州市江干艮山西路233号新东升市场地下室第一排.\"; \n break;\n case \"2\":\n $contentStr = \"商品种类:\".\"\\n\".\"杯子、碗、棉签、水桶、垃圾桶、洗碗巾(刷)、拖把、扫把、\"\n .\"衣架、粘钩、牙签、垃圾袋、保鲜袋(膜)、剪刀、水果刀、饭盒等.\";\n break;\n default:\n $contentStr = \"对不起,你的内容我会稍后回复\";\n }*/\n $contentStr = \"对不起,你的内容我会稍后回复\";\n break;\n }\n $msgType = \"text\";\n $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);\n echo $resultStr;\n }else {\n echo \"post str is null\";\n exit;\n }\n }",
"function send_sms()\n\t{\n\t\t$config['functions']['send_sms'] = array('function' => 'Xmlrpc.rpc_send_sms');\n\t\t$this->xmlrpcs->initialize($config);\n\t\t$this->xmlrpcs->serve();\n\t}",
"public function loadNotification(){\r\n //remove trace code.\r\n// eeFile::saveFile('new post request get.');\r\n \r\n //get xml\r\n $tmpXML = file_get_contents('php://input');\r\n if (empty($tmpXML)) {\r\n $this->generateReturnXML(0);\r\n }//xml content not get.\r\n \r\n //save response to file to get the structure.\r\n eeFile::saveFile($tmpXML);\r\n \r\n //xml to array\r\n $tmpXMLArr = $this->FromXml($tmpXML);\r\n if ($tmpXMLArr['return_code'] != \"SUCCESS\") {\r\n $this->generateReturnXML();\r\n }\r\n \r\n //check sign\r\n $this->safeValues = $tmpXMLArr;\r\n if ($tmpXMLArr['sign'] != $this->MakeSign()) {\r\n $this->generateReturnXML(0);\r\n };\r\n \r\n //massive attributes\r\n $this->scenario = 'notification';\r\n $this->attributes = $tmpXMLArr;\r\n $this->noti_result_code = $tmpXMLArr['result_code'];\r\n// var_dump($this->attributes);\r\n \r\n //remove trace code.\r\n// eeFile::saveFile('otn->'.$this->out_trade_no);\r\n //load OPM\r\n $tmpArr = explode('_', $this->out_trade_no);\r\n if (!isset($tmpArr[1])) {\r\n $this->generateReturnXML(0);\r\n }\r\n $opm = OrderPaymentMethod::findOne((int)$tmpArr[1]);\r\n if (empty($opm)) {\r\n $this->generateReturnXML();\r\n }\r\n \r\n if ($opm->opm_status_id == OrderPaymentMethod::OPM_PAID) {\r\n //already paid, direct return success\r\n $this->generateReturnXML(1);\r\n }\r\n \r\n \r\n $opm->scenario = 'notification';\r\n //update opm\r\n $opm->opm_paid = $this->total_fee/100;\r\n $opm->opm_cash = $this->cash_fee/100;\r\n $opm->opm_openId = $this->openid;\r\n $opm->opm_tradeType_return = $this->trade_type;\r\n $opm->opm_transaction_id = $this->transaction_id;\r\n $opm->opm_paidDate = date('Y-m-d H:i:s', strtotime($this->time_end));\r\n \r\n if ($this->noti_result_code == 'SUCCESS') {\r\n //SUCCESS\r\n //update opm status\r\n $opm->opm_status_id = OrderPaymentMethod::OPM_PAID;\r\n $opm->save();\r\n// var_dump($opm->errors);\r\n// exit;\r\n \r\n //load ORDER\r\n $order = $opm->opmOrder;\r\n if (!empty($order)) {\r\n $order->scenario = 'notification';\r\n $order->or_pricePaid = $this->total_fee/100;\r\n $order->or_status_id = OrderPaymentMethod::OPM_PAID;\r\n $order->or_paidDate = $opm->opm_paidDate;\r\n $order->save();\r\n }\r\n }else{\r\n //FAIL\r\n //update opm status\r\n $opm->opm_status_id = OrderPaymentMethod::OPM_FAIL;\r\n $opm->save();\r\n \r\n //load ORDER\r\n $order = $opm->opmOrder;\r\n if (!empty($order)) {\r\n $order->or_status_id = OrderPaymentMethod::OPM_FAIL;\r\n $order->save();\r\n }\r\n }\r\n \r\n $this->generateReturnXML(1);\r\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 my_hook_monitor_function($keyword, $params)\n{\n global $app_name, $app_version, $nama_modem;\n global $my_kembali_sms_format, $my_kembali_sms_sample;\n // Sometime, you don't need to reply SMS from non-user number,\n // such as SMS from Service Center, message center, \n // or promotional SMS:\n $valid_param_count = 5;\n // pre( $params);\n // return true;\n if (strlen($params['sender'])<=6) {\n return true;\n }\n else\n {\n if (count($params['params'])!=$valid_param_count){\n sms_send($params['sender'], '1/2. SMS tidak valid. Jumlah parameter data harus '.$valid_param_count.'.', $nama_modem);\n sms_send($params['sender'], '2/2. Format SMS: '.$my_monitor_sms_format, $nama_modem);\n sms_send($params['sender'], '3/2. Contoh SMS: '.$my_monitor_sms_sample, $nama_modem);\n }\n else\n {\n $kode_pinjam = strtoupper($params['params'][1]);\n // cek kode pinjam, jika ID = 0, berarti kode pinjam tidak valid:\n $id_pinjam = fetch_one_value(\"select coalesce( (\n select UUID_SHORT() id from inkubator_pinjam p where upper(p.kode_pinjam) = '$kode_pinjam'\n and p.status_pinjam = 'Disetujui' \n ),0) as id\");\n if ($id_pinjam == 0)\n {\n sms_send($params['sender'], 'Kode Pinjam tidak ditemukan: '.$kode_pinjam.'.', $nama_modem); \n } \n else\n { \n // proses SMS dan insert ke table `inkubator_kembali`:\n // Sample: KEMBALI*323431-353131-35*30*3.60*SEHAT;\n $p_pjg = trim($params['params'][ 2]);\n $p_berat = trim($params['params'][ 3]);\n $p_kondisi = strtoupper(trim($params['params'][ 4])); \n // cek tangal, panjang dan berat apakah formatnya sesuai atau tidak.\n // $p_validate_tgl = '/^[0-9]{2}\\/[0-9]{2}\\/[0-9]{4}$/'; // dd/mm/yyyy\n $p_validate_pjg = '/^[0-9]{1,2}+([\\,\\.][0-9]{1,2})?$/'; // max2digits[.,]max2digits\n if (!preg_match($p_validate_pjg, $p_pjg))\n {\n sms_send($params['sender'], 'Maaf. Panjang bayi saat kembali salah. Contoh panjang bayi: 31.5', $nama_modem);\n }\n else\n if (!preg_match($p_validate_pjg, $p_berat))\n {\n sms_send($params['sender'], 'Maaf. Berat bayi saat kembali salah. Contoh berat bayi: 3,12', $nama_modem);\n }\n else\n if (($p_kondisi!='SEHAT') && ($p_kondisi!='SAKIT'))\n {\n sms_send($params['sender'], 'Maaf. Kondisi bayi salah. Harus SEHAT atau SAKIT.', $nama_modem);\n }\n else\n {\n // process tgl, berat & panjang:\n // xx/yy/xxxx\n $p_skor = ($p_kondisi=='SEHAT'?1:0);\n $p_berat = str_replace(',','.', $p_berat);\n $p_pjg = str_replace(',','.', $p_pjg);\n // all set! save it to database.\n $sub_mon_sql = \"insert into inkubator_monitoring \n \t\t(id, kode_pinjam, tgl_input, panjang_bayi, berat_bayi, kondisi, skor, keterangan)\n \t values\n \t\t(UUID_SHORT(), '$kode_pinjam', CURRENT_TIMESTAMP(), $p_pjg, $p_berat, '$p_kondisi', $p_skor,\n \t\tconcat('Data monitoring ', (select p.nama_bayi from inkubator_pinjam p where p.kode_pinjam = '$kode_pinjam'))\n \t );\";\n /*\n $f = fopen('d:/test-.txt','w');\n fputs($f, $save_sql);\n fputs($f, $sub_mon_sql);\n fclose($f);\n */ \n if (exec_query($sub_mon_sql))\n {\n sms_send($params['sender'], 'Data monitoring telah diterima.', $nama_modem);\n }\n else\n {\n sms_send($params['sender'], 'Maaf, server sedang sibuk. Cobalah beberapa saat lagi.', $nama_modem);\n } \n } \n }\n }\n return true;\n } \n}",
"public function smsReceive(Request $request)\n {\n if (isset($request->requestId)) {\n $message = $request->input('message');\n $requestId = $request->input('requestId');\n $encoding = $request->input('encoding');\n $applicationId = $request->input('applicationId');\n $sourceAddress = $request->input('sourceAddress');\n $version = $request->input('version');\n\n $messageData = new MessageData();\n $messageData->message = $message;\n $messageData->requestId = $requestId;\n $messageData->encoding = $encoding;\n $messageData->applicationId = $applicationId;\n $messageData->sourceAddress = $sourceAddress;\n $messageData->version = $version;\n $otp = $this->generateRandomString(6);\n $messageData->otp = $otp;\n\n if ($messageData->save()) {\n $link = $this->getPlaystoreLink($applicationId);\n $link_msg = isset($link) ? 'Download this app from: ' . $link : \"\";\n $msg = \"You have successfully subscribed to our service. Your code is:\" . $otp . \" Please use this Code to avail your service.\" . $link_msg . \" Thank you \";\n $this->sendSubsriptionSmsToSubscriber($applicationId, $msg, $sourceAddress);\n $data['sucess'] = true;\n $data['message'] = \"Data Saved\";\n\n } else {\n $data['sucess'] = false;\n $data['message'] = \"Messaeg Data saving error.\";\n }\n\n\n } else {\n\n $version = $request->input('version');\n $applicationId = $request->input('applicationId');\n $subscriberId = $this->refineSubscriberId($request->input('subscriberId'));\n $status = $request->input('status');\n $otp = null;\n $frequency = $request->input('frequency');\n $timeStamp = $request->input('timeStamp');\n\n if ($status == \"REGISTERED\") {\n $subData = new SubscriptionData();\n $subData->appId = $applicationId;\n $subData->subscriberId = $this->refineSubscriberId($subscriberId);\n $otp = $this->generateRandomString(6);\n $subData->otp = $otp;\n\n if ($subData->save()) {\n\n $link = $this->getPlaystoreLink($applicationId);\n $link_msg = isset($link) ? 'Download this app from: ' . $link : \"\";\n $msg = \"You have successfully subscribed to our service. Your code is:\" . $otp . \" Please use this Code or open http://activate?otp=\" . $otp . \" with your APP to avail your service.\" . $link_msg . \" Thank you \";\n $musk = $this->refineSubscriberId($subscriberId);\n $data['msg'] = $msg;\n $data['response'] = $this->sendSubsriptionSmsToSubscriber($applicationId, $msg, $musk);\n }\n\n }\n\n\n $sms = new SmsSaved();\n\n $sms->version = isset($version) ? $version : \"\";\n $sms->applicationId = isset($applicationId) ? $applicationId : \"\";\n $sms->subscriberId = isset($subscriberId) ? $this->refineSubscriberId($subscriberId) : \"\";\n $sms->status = isset($status) ? $status : \"\";\n $sms->otp_id = $otp;\n $sms->frequency = isset($frequency) ? $frequency : \"\";\n $sms->timeStamp = isset($timeStamp) ? $timeStamp : \"\";\n\n\n if ($sms->save()) {\n $data['sucess'] = true;\n $data['message'] = \"Data Saved\";\n }\n }\n return $data;\n\n\n }",
"function send_sms_client()\n\t{\n\t\t$this->load->helper('url');\n\t\t$server_url = site_url('plugin/xmlrpc/send_sms');\n\n\t\t$this->xmlrpc->server($server_url, 80);\n\t\t$this->xmlrpc->method('send_sms');\n\t\t//$this->xmlrpc->set_debug(TRUE);\n\n\t\t$request = array('1234', 'Testing XMLRPC');\n\t\t$this->xmlrpc->request($request);\n\n\t\tif ( ! $this->xmlrpc->send_request())\n\t\t{\n\t\t\techo $this->xmlrpc->display_error();\n\t\t}\n\t\telse\n\t\t{\n\t\t\techo '<pre>';\n\t\t\tprint_r($this->xmlrpc->display_response());\n\t\t\techo '</pre>';\n\t\t}\n\t}",
"public function execute()\n {\n $processId = uniqid();\n $processString = self::class;\n\n $this->_getSession()->setPayUProcessId($processId);\n $this->_getSession()->setPayUProcessString($processString);\n\n $this->logger->debug(['info' => \"($processId) START $processString\"]);\n\n $postData = file_get_contents(\"php://input\");\n $sxe = simplexml_load_string($postData);\n\n $resultJson = $this->resultFactory->create(ResultFactory::TYPE_JSON)->setJsonData('{}');\n\n if (empty($sxe)) {\n $this->respond('500', 'Instant Payment Notification data is empty');\n\n return $resultJson;\n }\n\n $ipnData = XMLHelper::parseXMLToArray($sxe);\n\n if (!$ipnData) {\n $this->respond('500', 'Failed to decode Instant Payment Notification data.');\n\n return $resultJson;\n }\n\n $incrementId = $ipnData['MerchantReference'];\n /** @var Order $order */\n $order = $incrementId ? $this->_orderFactory->create()->loadByIncrementId($incrementId) : false;\n\n if (!$order || ((int)$order->getId() <= 0)) {\n $this->respond('500', 'Failed to load order.');\n\n return $resultJson;\n }\n\n $this->respond();\n $this->response->processNotify($ipnData, $order);\n\n return $resultJson;\n }",
"public function handleBulkSmsNotificationAction()\n {\n $handle = new \\Samurai\\BulkSms\\Handle\\NotificationHandle();\n\n if ($handle->isValid()) {\n\n $resource = $handle->resource();\n $status = $resource->getStatus();\n $inputData = [];\n $smsId = $resource->getSmsId();\n \n if ($status->isDelivered()) {\n \n $inputData['sms_sent'] = 1;\n }\n \n $statusCode = $status->getCode();\n $statusMessage = $status->getMessage();\n \n $inputData['sms_status_code'] = $statusCode;\n $inputData['sms_status_message'] = $statusMessage;\n \n // TODO Update model()->where('sms_id' => $smsId)->save($inputData);\n $id = $smsId;\n $data = array('sms_status_message'=>$statusMessage,'sms_sent'=>$inputData['sms_sent']);\n $model = Mage::getModel('easywebshopsms/easywebshopsms')->load($id)->addData($data);\n \n $model->setId($id)->save();\n // Update\n } else {\n // Invalid handle request\n }\n }",
"function schedulesms() {\n \t\t\n \t\tConfigure::write('debug', 0);\n \t\t\n \t\t$this->send(true, $_REQUEST['message'], $_REQUEST['mobile'], $_REQUEST['skey'], $_REQUEST['senderid'], \n \t\t\t\t\t\t\t$_REQUEST['group'], $_REQUEST['tag'], $_REQUEST['date'], $_REQUEST['response']);\n \t\t\n \t}",
"function refund_sms_notification_send($tourwise_id)\n{\n $sq_personal_info = mysql_fetch_assoc(mysql_query(\"select mobile_no from traveler_personal_info where tourwise_traveler_id='$tourwise_id'\"));\n $mobile_no = $sq_personal_info['mobile_no'];\n\n $message = \"We are providing the refunds considering your cancellation request of the genuine reason. Pls, contact us for the future journey.\";\n global $model;\n $model->send_message($mobile_no, $message);\n}",
"public function gw_send_sms($user,$pass,$sms_from,$sms_to,$sms_msg) \n { \n $query_string = \"api.aspx?apiusername=\".$user.\"&apipassword=\".$pass;\n $query_string .= \"&senderid=\".rawurlencode($sms_from).\"&mobileno=\".rawurlencode($sms_to);\n $query_string .= \"&message=\".rawurlencode(stripslashes($sms_msg)) . \"&languagetype=1\"; \n $url = \"http://gateway.onewaysms.com.au:10001/\".$query_string; \n $fd = @implode ('', file ($url)); \n if ($fd) \n { \n if ($fd > 0) {\n Print(\"MT ID : \" . $fd);\n $ok = \"success\";\n } \n else {\n print(\"Please refer to API on Error : \" . $fd);\n $ok = \"fail\";\n }\n } \n else \n { \n // no contact with gateway \n $ok = \"fail\"; \n } \n return $ok; \n }",
"public function Msghandle(){\n\n\t\t\t$this->message = $this->msglog = $this->asciilog = $this->status = NULL;\n\t\t\t$this->showclassnames = TRUE;\n\n\t\t\t$this->msgcode = array(\n\t\t\t\t\t\t\t\t\t\t\"000\" => array(\"message\" => \"Message code not found\", \"status\" => \"Error\"),\n\t\t\t\t\t\t\t\t\t\t\"001\" => array(\"message\" => \"Connection resource is not set\", \"status\" => \"Error\"),\n\t\t\t\t\t\t\t\t\t\t\"002\" => array(\"message\" => \"Missing parameters\", \"status\" => \"Error\"),\n\t\t\t\t\t\t\t\t\t\t\"003\" => array(\"message\" => \"Statement is not valid\", \"status\" => \"Error\"),\n\t\t\t\t\t\t\t\t\t\t\"004\" => array(\"message\" => \"Email address already taken\", \"status\" => \"Error\"),\n\t\t\t\t\t\t\t\t\t\t\"005\" => array(\"message\" => \"No row affected\", \"status\" => \"Error\"),\n\t\t\t\t\t\t\t\t\t\t\"006\" => array(\"message\" => \"Password not found\", \"status\" => \"Error\"),\n\t\t\t\t\t\t\t\t\t\t\"007\" => array(\"message\" => \"User data not found\", \"status\" => \"Error\"),\n\t\t\t\t\t\t\t\t\t\t\"008\" => array(\"message\" => \"Username doesn't exist\", \"status\" => \"Error\"),\n\t\t\t\t\t\t\t\t\t\t\"009\" => array(\"message\" => \"Wrong password\", \"status\" => \"Error\"),\n\t\t\t\t\t\t\t\t\t\t\"010\" => array(\"message\" => \"URL format is not valid\", \"status\" => \"Error\"),\n\t\t\t\t\t\t\t\t\t\t\"011\" => array(\"message\" => \"No URL specified\", \"status\" => \"Error\"),\n\t\t\t\t\t\t\t\t\t\t\"012\" => array(\"message\" => \"BabelNet connection failed\", \"status\" => \"Error\"),\n\t\t\t\t\t\t\t\t\t\t\"013\" => array(\"message\" => \"Method is not valid\", \"status\" => \"Error\"),\n\t\t\t\t\t\t\t\t\t\t\"014\" => array(\"message\" => \"Parameters are not valid\", \"status\" => \"Error\"),\n\t\t\t\t\t\t\t\t\t\t\"015\" => array(\"message\" => \"Conflictual settings\", \"status\" => \"Error\"),\n\t\t\t\t\t\t\t\t\t\t\"016\" => array(\"message\" => \"Required attribute not found\", \"status\" => \"Error\"),\n\t\t\t\t\t\t\t\t\t\t\"017\" => array(\"message\" => \"Microsoft Translator auth token not valid\", \"status\" => \"Error\"),\n\t\t\t\t\t\t\t\t\t\t\"018\" => array(\"message\" => \"A parameter is an array\", \"status\" => \"Error\"),\n\t\t\t\t\t\t\t\t\t\t\"019\" => array(\"message\" => \"A parameter is not an array\", \"status\" => \"Error\"),\n\n\t\t\t\t\t\t\t\t\t\t\"998\" => array(\"message\" => \"Operation successful\", \"status\" => \"Notice\"),\n\t\t\t\t\t\t\t\t\t\t\"999\" => array(\"message\" => \"Class instanced successfully\", \"status\" => \"Notice\"),\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\n\t\t\t$this->log(\"999\", __METHOD__);\n\t\t}",
"public function processRequest() {\n $this->server->service($GLOBALS['HTTP_RAW_POST_DATA']);\n }",
"public function api_entry_sendnotification() {\n parent::validateParams(array('sender', 'receiver', 'subject'));\n\n if(!$this->Mdl_Users->get($_POST['sender'])) parent::returnWithErr(\"Sender is not valid\");\n if(!$this->Mdl_Users->get($_POST['receiver'])) parent::returnWithErr(\"Receiver is not valid\");\n\n $sender = $this->Mdl_Users->get($_POST['sender']);\n $receiver = $this->Mdl_Users->get($_POST['receiver']);\n\n unset($sender->password);\n unset($receiver->password);\n\n if ($_POST['subject'] == \"ipray_sendinvitation\") {\n $msg = $sender->username . \" has invited you.\";\n }\n else if ($_POST['subject'] == \"ipray_acceptinvitation\") {\n $msg = $sender->username . \" has accepted your invitation.\";\n\n // sender ---> receiver \n $this->Mdl_Users->makeFriends($_POST[\"sender\"], $_POST[\"receiver\"]);\n }\n else if ($_POST['subject'] == \"ipray_rejectinvitation\") {\n $msg = $sender->username . \" has rejected your invitation.\";\n }\n else if ($_POST['subject'] == 'ipray_sendprayrequest') {\n parent::validateParams(array('request'));\n }\n else if ($_POST['subject'] == 'ipray_acceptprayrequest') {\n parent::validateParams(array('request'));\n }\n else if ($_POST['subject'] == 'ipray_rejectprayrequest') {\n parent::validateParams(array('request'));\n }\n else {\n parent::returnWithErr(\"Unknown subject is requested.\");\n }\n\n if (!isset($receiver->devicetoken) || $receiver->devicetoken == \"\")\n parent::returnWithErr(\"User is not available at this moment. Please try again later.\");\n\n $payload = array(\n 'sound' => \"default\",\n 'subject' => $_POST['subject'],\n 'alert' => $msg,\n 'sender' => $sender,\n 'receiver' => $receiver\n );\n\n if (($failedCnt = $this->qbhelper->sendPN($receiver->devicetoken, json_encode($payload))) == 0) {\n $this->load->model('Mdl_Notifications');\n $this->Mdl_Notifications->create(array(\n 'subject' => $_POST['subject'],\n 'message' => $msg,\n 'sender' => $sender->id,\n 'receiver' => $receiver->id\n ));\n\n parent::returnWithoutErr(\"Contact request has been sent successfully.\");\n }\n else {\n parent::returnWithErr($failedCnt . \" requests have not been sent.\");\n }\n \n }",
"public function send_mail () {\r\n\r\n $this->add_log('send_mail: Sending mails...', 'DEBUG');\r\n\r\n // Prepare xml to be send\r\n if (!$messages = $this->get_messages()) {\r\n $this->add_log('send_mail: No messages or malformed', 'ERROR');\r\n self::debugging('mailsender send_mail: No messages or malformed');\r\n return false;\r\n }\r\n\r\n try {\r\n $response = $this->call_function('enviament', $messages);\r\n } catch (SoapFault $e) {\r\n $this->increase_message_counters();\r\n\r\n // Re-init SOAP\r\n $this->init_soap();\r\n\r\n $this->add_log('send_mail: Send mail SoapFault Exception KO', 'ERROR');\r\n return false;\r\n } catch (Throwable $e) {\r\n // In case of KO, do not try again\r\n $this->clear_messages();\r\n $this->add_log('send_mail: Send mail KO', 'ERROR');\r\n return false;\r\n }\r\n $this->add_log('send_mail: Send mail OK', 'DEBUG');\r\n\r\n // Process each message\r\n $return = array();\r\n $errors = 0;\r\n if (!is_array($response->respostaCorreu)) {\r\n $response->respostaCorreu = array($response->respostaCorreu);\r\n }\r\n\r\n foreach ($response->respostaCorreu as $respostaCorreu) {\r\n $responsemessage = (isset($respostaCorreu->message) && !empty($respostaCorreu->message))? $respostaCorreu->message : \"\" ;\r\n $return[] = array('id' => $respostaCorreu->id, 'status' => $respostaCorreu->status, 'message' => $responsemessage);\r\n\r\n if ($respostaCorreu->status == 'KO') {\r\n $this->add_log('send_mail: Response message '.$respostaCorreu->id.' response with KO. Reason: '.$responsemessage, 'WARNING');\r\n $errors ++;\r\n continue;\r\n }\r\n\r\n $this->add_log('send_mail: Response message '.$respostaCorreu->id.' response with OK', 'DEBUG');\r\n }\r\n $this->add_log('send_mail: Response messages resume: '.(count($return)-$errors).' OK, '.$errors.' KO, '.count($return).' Total');\r\n\r\n $this->clear_messages();\r\n\r\n return $return;\r\n }",
"function rpc_send_sms($request)\n\t{\n\t\t$this->load->model(array('Kalkun_model', 'Message_model'));\n\t\t$parameters = $request->output_parameters();\n\n\t\t$data['coding'] = 'default';\n\t\t$data['class'] = '1';\n\t\t$data['dest'] = $parameters[0];\n\t\t$data['date'] = date('Y-m-d H:i:s');\n\t\t$data['message'] = $parameters[1];\n\t\t$data['delivery_report'] = 'default';\n\t\t$data['uid'] = 1;\n\t\t$sms = $this->Message_model->send_messages($data);\n\n\t\treturn $this->xmlrpc->send_response($sms);\n\t}",
"public function send_sms($order_no=null,$customer_id=null,$type=null){\n\n $CI =& get_instance();\n $CI->load->model('dashboard/Sms_model','sms_model');\n $gateway = $CI->sms_model->retrieve_active_getway();\n $sms_template = $CI->db->select('*')->from('sms_template')->where('type',$type)->get()->row();\n $sms = $CI->db->select('*')->from('sms_configuration')->get()->row();\n\t\t$customer_info=$CI->db->select('customer_phone')->from('customer_info')->where('customer_id',$customer_id)->get()->row();\n\t\t$recipients = $customer_info->customer_phone;\n\t\t\n\t\t $sms_type= strtolower($sms_template->type);\n if($sms_type == \"neworder\" || $sms_type == \"completeorder\" || $sms_type == \"processing\" || $sms_type == \"cancel\"){ \n $message= str_replace('{id}', $order_no, $sms_template->message);\n }\n if(1 == $gateway->id ){\n\n\n /****************************\n * SMSRank Gateway Setup\n ****************************/\n $CI =& get_instance();\n $url = \"http://api.smsrank.com/sms/1/text/singles\"; \n $username = $gateway->user_name;\n $password=base64_encode($gateway->password); \n $message=base64_encode($message);\n $curl = curl_init();\n\n curl_setopt($curl, CURLOPT_URL, \"$url?username=$username&password=$password&to=$recipients&text=$message\");\n curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);\n $agent = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)';\n curl_setopt($curl, CURLOPT_USERAGENT, $agent);\n $output = json_decode(curl_exec($curl), true);\n return true;\n curl_close($curl);\n }\n if( 2 == $gateway->id ){\n /****************************\n * nexmo Gateway Setup\n ****************************/\n $api = $gateway->user_name;\n $secret_key = $gateway->password;\n $message = $message;\n $from = $gateway->sms_from; \n\n $data = array(\n 'from' => $from,\n 'text' => $message,\n 'to' => $recipients\n );\n require_once APPPATH.'libraries/nexmo/vendor/autoload.php';\n $basic = new \\Nexmo\\Client\\Credentials\\Basic($api, $secret_key);\n $client = new \\Nexmo\\Client($basic);\n $message = $client->message()->send($data);\n if(!$message) \n { \n return json_encode(array(\n 'status' => false,\n 'message' => 'Curl error: '\n ));\n } else { \n return json_encode(array(\n 'status' => true,\n 'message' => \"success: \"\n )); \n }\n }\n\n if( 3 == $gateway->id ){\n /****************************\n * budgetsms Gateway Setup\n ****************************/\n $message = $message;\n $from = $gateway->sms_from; \n $userid = $gateway->userid; \n $username = $gateway->user_name; \n $handle = $gateway->password; \n\n $data = array(\n 'handle' => $handle,\n 'username' => $username,\n 'userid' => $userid,\n 'from' => $from,\n 'msg' => $message,\n 'to' => $recipients\n );\n\t\t\t\t\n\t\t$url = \"https://api.budgetsms.net/sendsms/?\"; \n\n $curl = curl_init($url);\n curl_setopt($curl, CURLOPT_POST, 1);\n curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));\n curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);\n $response = curl_exec($curl); \n\t\t \n if(curl_errno($curl)) \n { \n return json_encode(array(\n 'status' => false,\n 'message' => 'Curl error: ' . curl_error($curl)\n ));\n } else { \n return json_encode(array(\n 'status' => true,\n 'message' => \"success: \". $response\n )); \n } \n\n curl_close($curl);\n\n\n }\n\n}",
"public function responseMsg()\n {\n\t\t$postStr = $GLOBALS[\"HTTP_RAW_POST_DATA\"];\n\n if (!empty($postStr)){\n $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);\n $RX_TYPE = trim($postObj->MsgType);\n\n switch ($RX_TYPE)\n {\n case \"text\":\n $resultStr = $this->receiveText1($postObj);\n break;\n case \"event\":\n $resultStr = $this->receiveEvent($postObj);\n break;\n default:\n $resultStr = \"\";\n break;\n }\n echo $resultStr;\n }else {\n echo \"\";\n exit;\n }\n // \t//extract post data\n\t\t// if (!empty($postStr)){\n // /* libxml_disable_entity_loader is to prevent XML eXternal Entity Injection,\n // the best way is to check the validity of xml by yourself */\n // libxml_disable_entity_loader(true);\n // \t$postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);\n // $fromUsername = $postObj->FromUserName;\n // $toUsername = $postObj->ToUserName;\n // $keyword = trim($postObj->Content);\n // $time = time();\n // $textTpl = \"<xml>\n\t\t// \t\t\t\t\t<ToUserName><![CDATA[%s]]></ToUserName>\n\t\t// \t\t\t\t\t<FromUserName><![CDATA[%s]]></FromUserName>\n\t\t// \t\t\t\t\t<CreateTime>%s</CreateTime>\n\t\t// \t\t\t\t\t<MsgType><![CDATA[%s]]></MsgType>\n\t\t// \t\t\t\t\t<Content><![CDATA[%s]]></Content>\n\t\t// \t\t\t\t\t<FuncFlag>0</FuncFlag>\n\t\t// \t\t\t\t\t</xml>\"; \n\t\t// \t\tif(!empty( $keyword ))\n // {\n // \t\t$msgType = \"text\";\n // \t$contentStr = \"Welcome to wechat world!\";\n // \t$resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);\n // \techo $resultStr;\n // }else{\n // \techo \"Input something...\";\n // }\n\n // }else {\n // \techo \"\";\n // \texit;\n // }\n }",
"public function receive(){\n $eslId = $this->uri->segment(3); //Get the flower shop ID\n $this->load->model('esls_model');\n\n $formData = $this->input->post(NULL, TRUE);\n\n //DATA THAT COMES FROM PRODUCERS\n $domain = $formData['_domain'];\n $name = $formData['_name'];\n\n if($name === \"delivery_ready\"){\n $this->process_delivery_ready_event($formData);\n }\n else if($name === \"bid_awarded\"){\n $this->process_bid_awarded_event($formData);\n }\n }",
"public function userAskToBeNotified(){\n// $message = new Message();\n// $message->setHeure(\"19h50\");\n// $message->setVille(\"TO\");\n// $message->setStatue(\"Retart\");\n// $message->setPhoneNumber(\"+15143468023\");\n// $message->setMessage(\"Salut je fait un test\");\n// $messagemodel->sendSMS($message);\n $arryNotif [0]= $_POST[\"vol\"];\n $arryNotif[1] = $_POST[\"phone\"];\n $arryNotif[2] = $_POST[\"date\"];\n $arryNotif[3] = $_POST[\"status\"];\n $notifDAO = new NotifyDAO();\n $notifDAO->create($arryNotif);\n\n }",
"private function deliverySms($type,$state,$messageID,$from,$to,$message,$count){\n $datum = Date(\"Y-m-d\");\n $count = $count + 1;\n\n if (isset($this->_stateIDs[$state])){\n $stateId = $this->_stateIDs[$state]; \n } else {\n $stateId = 0;\n }\n \n /*\n * Uncomment if is needed to disable sending at specific time\n */\n // $sleep_time = date('H');\n // $sleep = array('21', '22','23','00','01','02','03','04','05','06');\n\n // if not between 21:00 - 07:00\n // if(!in_array($sleep_time, $sleep)){\n\n if ($type !== \"bulk\") { \n $to = $this->cleanMob($to, $state);\n if ($to == false) { \n return \"wrong number\";\n }\n }\n //ucitavanje liste odjava \n if ($type == \"reorder\") { \n $suppression = $this->getSuppressionList($state);\n $supArr = array();\n\n foreach ($suppression as $sNumber){\n array_push($supArr, $sNumber['number']);\n }\n\n if (in_array($to, $supArr) == true) {\n return \"number unsubscribed\";\n }\n } \n\n // konacno filtriranje samo brojeva \n $to = preg_replace('/[^0-9]/', '', $to);\n\n $firstTwo = substr($to, 0, 2);\n\n if ($state == \"XK\" && $firstTwo == \"49\") {\n $responsePhone = \"+386\".$to; \n $to = \"00386\".$to;\n } else {\n $responsePhone = \"+\".$this->_areaCodes[$state].$to; \n $to = \"00\".$this->_areaCodes[$state].$to;\n }\n\n \n $message = strip_tags($message);\n\n $msg = $this->cleanUTF($message, $state);\n $ch = curl_init('http://bulk.mobile-gw.com:9000/?');\n curl_setopt($ch, CURLOPT_POST, true);\n curl_setopt($ch, CURLOPT_POSTFIELDS, \"username=*******&password=*********&allow_adaption=1&messageid={$messageID}&status_report=3&origin={$from}&call-number={$to}&text=\".urlencode($msg));\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($ch, CURLOPT_VERBOSE, 1);\n curl_setopt($ch, CURLOPT_HEADER, 1);\n $send_response = curl_exec ($ch);\n curl_close ($ch);\n\n $getRow = explode(\"\\n\", $send_response);\n //******** Hvatanje SMSID broja\n // $getId = explode(\":\", $getRow[2]);\n // $smsId = trim($getId[1]);\n\n\n $getId = explode(\":\", $getRow[2]);\n $smsIdRaw = trim($getId[1]);\n\n $countSeparator = substr_count($smsIdRaw,\";\");\n $messageNumber = $countSeparator + 1;\n $smsIdExploaded = explode(\";\", $smsIdRaw);\n\n $smsId = $smsIdExploaded[0];\n //******** Hvatanje Statusa slanja\n $getSecond = explode(\":\", $getRow[6]); \n $getCode = explode(\",\", $getSecond[1]);\n $statusCode = trim($getCode[0]);\n\n $statusNum = 0;\n if ($statusCode == \"00\"){\n $statusNum = 1;\n } else {\n $statusNum = 3;\n }\n\n $this->insertMessage($smsId,$from,$to,$messageID,$msg,$statusNum,$messageNumber,$stateId); \n if($type == \"bulk\"){\n //echo json_encode(array(\"count\"=>$count, \"number\"=>$to, \"response\"=>$send_response));\n $writeFile ='{\"MessageId\":\"'.$messageID.'\",\"SenderId\":\"'.$from.'\",\"Recipient\":\"'.$to.'\",\"Response\":\"'.$send_response.'\",\"Message\":\"'.$msg.'\"},\\n';\n $file = fopen($this->_logRoot.\"reports/bulk/\".$messageID.\".txt\", \"a\");\n file_put_contents($this->_logRoot.\"reports/bulk/\".$messageID.\".txt\", $writeFile, FILE_APPEND);\n fclose($file);\n } else if ($type == \"reorder\"){\n //echo json_encode(array(\"count\"=>$count, \"number\"=>$to, \"response\"=>$send_response));\n $writeFile ='{\"MessageId\":\"'.$messageID.'\",\"SenderId\":\"'.$from.'\",\"Recipient\":\"'.$to.'\",\"Response\":\"'.$send_response.'\",\"Message\":\"'.$msg.'\"},\\n';\n $file = fopen($this->_logRoot.\"reports/reorder/\".$messageID.\".txt\", \"a\");\n file_put_contents($this->_logRoot.\"reports/reorder/\".$messageID.\".txt\", $writeFile, FILE_APPEND);\n fclose($file);\n } else {\n $writeFile ='{\"MessageId\":\"'.$messageID.'\",\"SenderId\":\"'.$from.'\",\"Recipient\":\"'.$to.'\",\"Response\":\"'.$send_response.'\",\"Message\":\"'.$msg.'\",\"Quantity\":\"'.$messageNumber.'\"},\\n';\n $existCount2 = 0;\n if (file_exists($this->_logRoot.\"reports/orders/\".$datum.\".txt\")){\n $existCount2 = 1;\n }\n\n $file = fopen($this->_logRoot.\"reports/orders/\".$datum.\".txt\", \"a\");\n file_put_contents($this->_logRoot.\"reports/orders/\".$datum.\".txt\", $writeFile, FILE_APPEND);\n fclose($file);\n\n if ($existCount2 == 0){\n chmod($this->_logRoot.\"reports/orders/\".$datum.\".txt\", 0777);\n }\n }\n $responseJson = '{\"status\":\"'.$statusNum.'\",\"msisdn\":\"'.$responsePhone.'\"}';\n return $responseJson;\n // }else{\n // return 'sleep time';\n // }\n }"
] |
[
"0.63784087",
"0.6218579",
"0.6094773",
"0.6062073",
"0.6008472",
"0.59750414",
"0.5975008",
"0.5877912",
"0.5796604",
"0.57894254",
"0.57369137",
"0.5728501",
"0.5720912",
"0.57039386",
"0.5642211",
"0.5619749",
"0.560745",
"0.56046283",
"0.55720204",
"0.5560454",
"0.55238473",
"0.55217636",
"0.5505254",
"0.5504668",
"0.5472965",
"0.54700935",
"0.5468653",
"0.5459576",
"0.5453409",
"0.5448142"
] |
0.73905337
|
0
|
Now count the number of photos already in the database for this post
|
function how_many_photos($data)
{
global $db;
$query = 'SELECT spotlight_post_id FROM gv_spotlight_post_image WHERE (spotlight_image_block = 0) AND spotlight_post_id = ' . $data;
$result = mysql_query($query, $db) or die(mysql_error($db));
if(mysql_num_rows($result) > 0)
{
$number_of_images = mysql_num_rows($result);
}
else {
$number_of_images = 0;
}
return $number_of_images;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function record_count_photo(){\n $sql = $this->db->query(\"select * from `gallery` where status='1' and publish='1' and type='1'\");\n return $sql->num_rows();\n }",
"public function count()\n {\n return $this->getImages()->count();\n }",
"public function countGalleryImageLikes() {\n\t\t$sql = \"SELECT\tCOUNT(*) AS count\n\t\t\tFROM\twcf\".$this->dbNo.\"_rating\n\t\t\tWHERE\tobjectName = ?\n\t\t\t\tAND userID <> ?\n\t\t\t\tAND rating NOT IN (?, ?)\";\n\t\t$statement = $this->database->prepareStatement($sql);\n\t\t$statement->execute(array('com.woltlab.wcf.user.gallery.photo', 0, 0, 3));\n\t\t$row = $statement->fetchArray();\n\t\treturn $row['count'];\n\t}",
"public function numFotos(){\n\n\t\t\t$sentencia = \"SELECT count(*) AS total FROM fotos\";\n\t\t\t$total= $this->db->query($sentencia)->row()->total; // converir fila y total\n\t\t\t\t\t\t\n\t\t\treturn intval($total); // asegurarnos que sea entero\n\n\t\t}",
"public function getPostCount();",
"public function count_homepage_photos(){\n $sql=\"SELECT COUNT(*) FROM photos WHERE img_navigacija_id=2\";\n $result=self::$connect->query($sql);\n while($row=$result->fetch(PDO::FETCH_NUM)){\n return $row[0];\n }\n }",
"function get_object_count()\r\n {\r\n return $this->get_browser()->count_photo_gallery_publications($this->get_condition());\r\n }",
"function count_pictures() {\n global $connexion, $config;\n $nb_images = $connexion->query('SELECT COUNT(id) FROM image')->fetchColumn();\n return $nb_images;\n}",
"function count_posts()\n {\n $this->Admin_model->procedure = 'COUNT_POSTS';\n $rs = $this->Admin_model->get_media();\n return $rs;\n }",
"public function countTemporyImages(){\n $count = $this->_tableGw->select()->count();\n return $count;\n }",
"function count_gallery()\n{\n\trequire_once('../conf/config.php');\n\t//Connect to mysql server\n\t$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);\n\tif(!$link)\n\t{\n\t\tdie('Failed to connect to server: ' . mysql_error());\n\t}\n\t//Select database\n\t$db = mysql_select_db(DB_DATABASE);\n\tif(!$db)\n\t{\n\t\tdie(\"Unable to select database\");\n\t}\n\t//\n\t$query=\"select count(*) cnt from gallery\";\n\t$result = mysql_query($query) or die(\"<b>A fatal MySQL error occured</b>.\\n<br />Query: \" . $query . \"<br />\\nError: (\" . mysql_errno() . \") \" . mysql_error());\n\twhile ($row = mysql_fetch_assoc($result))\n\t{\n\t\textract($row);\n\t}\n\treturn $cnt;\n}",
"function total_images_uploaded() {\n\tglobal $dB;\n\t$uploaded_qry = $dB->query_fetch_single(\"SELECT count(*) as total FROM chv_images;\");\n\treturn $uploaded_qry[\"total\"];\n}",
"function countPosts(){\n\t\t\treturn $this->db->count_all('post');\n\t\t}",
"function count_published_files() {\n $result = $this->pdo->query('SELECT COUNT(*) FROM files WHERE publishedfile = 1');\n $temp = $result->fetchColumn();\n if( !$temp ){ $temp = 0; }\n return $temp;\n }",
"protected function imageCount()\n\t{\n\t\t$this->score += $this->store['image_count'] * $this->config->data()['imageCount'];\n\t}",
"public function gallery_record_count() \n\t{\n\t $query = $this->db->query(\"SELECT * FROM gallery_tbl WHERE gallery_is_deleted=0\");\n return $query->num_rows();\n }",
"function itemCount(){\r\n\t\tif( $this->_itemCount === null ){\r\n\t\t\tglobal $database;\r\n\t\t\t\r\n\t\t\t$gid = $this->id;\r\n\t\t\t$database->setQuery(\"SELECT COUNT(1) FROM #__rsgallery2_files WHERE gallery_id='$gid' AND published = '1'\");\r\n\t\t\t$this->_itemCount = $database->loadResult();\r\n\t\t}\r\n\t\treturn $this->_itemCount;\r\n\t}",
"function post_count() {\n global $wpdb;\n return $wpdb->get_var(\"SELECT count(id)\n FROM $wpdb->posts\n WHERE post_type = 'post'\n AND post_status = 'publish'\");\n}",
"private function _count_posts() {\n\t\tglobal $wpdb;\n\t\t$results = $wpdb->get_results( 'SELECT FOUND_ROWS() as cnt', OBJECT );\n\t\treturn $results[0]->cnt;\n\t}",
"public function countUserPosts(){\n\n return $this->getModel()->where('user_id', '=', Auth::id())->count();\n }",
"function tp_count_post_views () {\t\n // Garante que vamos tratar apenas de posts\n if ( is_single() ) {\n \n // Precisamos da variável $post global para obter o ID do post\n global $post;\n \n // Se a sessão daquele posts não estiver vazia\n if ( empty( $_SESSION[ 'tp_post_counter_' . $post->ID ] ) ) {\n \n // Cria a sessão do posts\n $_SESSION[ 'tp_post_counter_' . $post->ID ] = true;\n \n // Cria ou obtém o valor da chave para contarmos\n $key = 'tp_post_counter';\n $key_value = get_post_meta( $post->ID, $key, true );\n \n // Se a chave estiver vazia, valor será 1\n if ( empty( $key_value ) ) { // Verifica o valor\n $key_value = 1;\n update_post_meta( $post->ID, $key, $key_value );\n } else {\n // Caso contrário, o valor atual + 1\n $key_value += 1;\n update_post_meta( $post->ID, $key, $key_value );\n } // Verifica o valor\n \n } // Checa a sessão\n \n } // is_single\n \n return;\n \n }",
"public function get_count() {\n\t\tglobal $wpdb;\n\t\t$count = $wpdb->get_var( $wpdb->prepare( \"SELECT COUNT(*) FROM {$wpdb->prefix}posts WHERE post_type=%s AND post_excerpt='' \", 'attachment' )); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- Query is safe, see above.\n\t\treturn $count;\n\t}",
"public function get_nb_pictures(){\n $return = array();\n $sql = sprintf(\"SELECT count(*) FROM miki_album_picture WHERE id_album = %d\",\n mysql_real_escape_string($this->id));\n $result = mysql_query($sql);\n $row = mysql_fetch_array($result);\n return $row[0];\n }",
"public function getImagesCount()\n {\n return $this->imagesCount;\n }",
"function get_page_count() {\n global $connexion, $config;\n $nb_images = $connexion->query('SELECT COUNT(id) FROM image')->fetchColumn();\n $nb_pages = ceil($nb_images / $config['nb_pictures_page']);\n return $nb_pages;\n}",
"public function count(\\Tuiter\\Models\\Post $post): int\n {\n return $this->collection->count(array(\"postId\"=>$post->getPostId()));\n }",
"function click_count($Photo_to_view, $username) {\n $sql = 'SELECT COUNT(*) FROM click_count WHERE photo_id ='.$Photo_to_view.' AND viewed_by = \\''.$username.'\\'';\n $results = get_sql_results($sql);\n $row = array_shift($results);\n $col = array_shift($row);\n \n /*\n If $col = 0, then the user has never clicked this photo before, mark that the user has viewed this photo\n If $col = 1, then the user has seen this photo before, nothing needs to be done, continue displaying the photo\n */\n if($col==0){\n $sql = 'INSERT INTO click_count VALUES('.$Photo_to_view.',\\''.$username.'\\')';\n perform_sql($sql);\n $sql = 'SELECT total_views FROM clicks_per_photo WHERE photo_id ='.$Photo_to_view;\n perform_sql($sql);\n $results = get_sql_results($sql);\n if(count($results) == 0){ \t//If there are no record of this photo's total click count, init it\n $sql = 'INSERT INTO clicks_per_photo VALUES('.$Photo_to_view.',1)';\n perform_sql($sql);\n }\n else{\t\t\t\t//If there is a record of this photo's total click count, +1\n $row = array_shift($results);\n $col = array_shift($row);\n $col = $col + 1;\n $sql = 'UPDATE clicks_per_photo set total_views='.$col.' WHERE photo_id='.$Photo_to_view;\n perform_sql($sql);\n }\n }\n}",
"public function _count();",
"function CountNumPosts($search_string) {\n $sql = \"SELECT count(*) FROM \".GALLERY_POST_TABLE.\" T WHERE \".CreateSQLClauses($search_string).\";\";\n if (!sql_query_into($result, $sql, 1)) return -1; // Get 1 row containing the count.\n $row = $result->fetch_assoc();\n return $row['count(*)'];\n}",
"function obtener_cantidad_post($post_por_pagina, $conexion) {\n $inicio = (pagina_actual() > 1) ? pagina_actual() * $post_por_pagina - $post_por_pagina : 0;\n $sentencia = $conexion->prepare(\"SELECT COUNT(idImg) FROM imagenes ORDER BY idImg DESC\");\n $sentencia->execute();\n return $sentencia->fetchAll();\n}"
] |
[
"0.780966",
"0.7443742",
"0.717413",
"0.7172642",
"0.71261954",
"0.71117663",
"0.7102031",
"0.7006374",
"0.69846845",
"0.68399876",
"0.6803296",
"0.6783839",
"0.6729155",
"0.67218703",
"0.67039055",
"0.67036545",
"0.6691771",
"0.6659499",
"0.66453946",
"0.66396224",
"0.66366315",
"0.6618709",
"0.6607897",
"0.660429",
"0.65744114",
"0.65478",
"0.6513799",
"0.65009135",
"0.6465973",
"0.64555776"
] |
0.75709695
|
1
|
Log financial transaction and this function do so: Generate different types of financial transactions such as Deposit, Withdraw, Profit, Charge and Refund.
|
public static function logFinancialTransaction($transactionDetails = []){
if(isset($transactionDetails['user_id']) && isset($transactionDetails['type'])){
$FinancialTransaction = new FinancialTransaction;
$FinancialTransaction->user_id = $transactionDetails['user_id'];
$FinancialTransaction->no = md5(uniqid(rand(), true));
$FinancialTransaction->type = $transactionDetails['type'];
$FinancialTransaction->amount = (isset($transactionDetails['amount'])) ? $transactionDetails['amount'] : 0;
$FinancialTransaction->order_id = (isset($transactionDetails['order_id'])) ? $transactionDetails['order_id'] : null;
$FinancialTransaction->service_id = (isset($transactionDetails['service_id'])) ? $transactionDetails['service_id'] : null;
$FinancialTransaction->save();
User::logTransactionUpdateBalance($FinancialTransaction->user_id,$FinancialTransaction->type,$FinancialTransaction->amount);
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function logIndividualTransaction( $paymentLogObj, $txStatus, $type, $array )\n {\n //foreach ( $this->txClasses as $type => $array ){\n $level = $type. 'Level';\n $typekey = strtolower($type);\n foreach( $array as $id => $typeObject ){\n $levelObj = new $level();\n \n // common logs\n $this->payment_type_log['payment_log_id'] = $paymentLogObj->getString('id');\n $this->payment_type_log[ $typekey.'_id'] = $id;\n $this->payment_type_log[ $typekey.'_title'] = $typeObject->getString('title');\n $this->payment_type_log['discount_id'] = $typeObject->getString('discount_id');\n $this->payment_type_log['amount'] = $typeObject->getPrice();\n $this->payment_type_log['renewal_date'] = $txStatus ? $typeObject->getNextRenewalDate() : $typeObject->getString('renewal_date');\n $this->payment_type_log['level'] = $typeObject->getString('level');\n $this->payment_type_log['level_label'] = $levelObj->showLevel($typeObject->getString('level'));\n \n /**\n ** @ Discount code modification for Duration Type : Store in log\n */ \n\n $discountCodeObj = new DiscountCode($typeObject->getString('discount_id'));\n \n if(($discountCodeObj->type ==\"duration\") && ($discountCodeObj->status == \"A\") && $discountCodeObj->expire_date >= date('Y-m-d')){\n $amont = intval($discountCodeObj->amount);\n \n function mth($date_str, $months)\n {\n $date = new Datetime($date_str);\n $start_day = $date->format('j');\n\n $date->modify(\"+{$months} month\");\n $end_day = $date->format('j');\n\n if ($start_day != $end_day)\n $date->modify('last day of last month');\n\n return $date;\n }\n \n $amont = $amont + 12; //Add One Year\n\n $result = mth($typeObject->getString('renewal_date'), $amont);\n\n if ($typeObject->renewal_date == '0000-00-00'){\n $today = date(\"Y-m-d\");\n $result = mth($today, $amont);\n }\n\n \n $result = (array) $result;\n $d = $result['date'];\n $d = explode(\" \", $d);\n \n $this->payment_type_log['renewal_date'] = $d[0]; \n }\n\n\n // different logs\n $this->logForSeparateTypes( $typeObject, $levelObj, $typekey );\n \n $loggerName = 'Payment'.$type.'Log';\n $loggerObj = new $loggerName( $this->payment_type_log );\n // just to confirm.. not so necessary\n if ( $this->payment_type_log['payment_log_id'] ) {\n $loggerObj->save();\n }\n }\n //}\n }",
"function addTransaction($account, $expensetype, $amount, $type, $date){\n\t\t// check if input data is valid\n\t\tif($expensetype == null || strlen($expensetype) == 0){\n\t\t\tthrow new Exception (\"Please enter a valid transaction type.\");\n\t\t}\n\t\telse if ($amount == null || strlen($amount) == 0 || !(is_numeric($amount))){\n\t\t\tthrow new Exception (\"Please enter a valid amount.\");\n\t\t} \n\t\telse if ($date == null){\n\t\t\tthrow new Exception (\"Please enter a date.\");\n\t\t} else {\n\t\t\t$urlms = $this->urlms;\n\t\t\t$urlmsLab = $urlms->getLab_index(0);\n\t\t\t// find the account that receives a transaction\n\t\t\t$fundingAccount = $this->findFundingAccount($account);\n\t\t\t// create a new expense and add it to the account that was previously found using the input\n\t\t\t$newExpense = new Expense($amount, $date, $expensetype, $fundingAccount);\n\t\t\t$fundingAccount->addExpense($newExpense);\n\t\t\t\n\t\t\t// check if transaction is an expense or a fund\n\t\t\t// and add or substract from balance accordingly\n\t\t\tif($type == \"expense\"){\n\t\t\t\t$fundingAccount->setBalance($fundingAccount->getBalance() - $newExpense->getAmount());\n\t\t\t\t$newExpense->setAmount(-$amount);\n\t\t\t} \n\t\t\telse if ($type == \"fund\"){\n\t\t\t\t$fundingAccount->setBalance($fundingAccount->getBalance() + $newExpense->getAmount());\n\t\t\t}\n\t\t\telse{\n\t\t\t\tthrow new Exception (\"Please choose a valid type of transaction.\");\n\t\t\t}\n\t\t\t// Write data\n\t\t\t//$persistence = new Persistence();\n\t\t\t$this->persistence->writeDataToStore($urlms);\n\t\t\t\n\t\t\t?>\n\t\t\n\t\t\t<!-- Refresh back to funding view -->\n\t\t\t<HTML>\n\t\t\t\t<meta http-equiv=\"refresh\" content=\"0; URL='../view/FundingView.php'\" />\n\t\t\t\t<p>New transation item successfully added!</p>\n\t\t\t\t<a href=\"../view/FundingView.php\">Back</a>\n\t\t\t</HTML><?php\n\t\t}\n\t}",
"function generateFinancialReport($accountType){\n\t\t$count = 0;\n\t\t$urlms = $this->urlms;\n\t\t$fundingAccount = $this->findFundingAccount($accountType);\n\t\t\n\t\t// echo a table with appropriate columns in it\n\t\techo \"\n\t\t<div class=\\\"container\\\">\n\t\t\t<h3>\".$accountType.\"</h3> \n\t\t<table class=\\\"table table-hover\\\" style=\\\"width: 100%;\\\">\n\t\t\n\t\t<thread>\n\t\t<tr>\n\t\t<th>Type</th>\n\t\t<th>Amount</th>\n\t\t<th>Date</th>\n\t\t\n\t\t</tr>\n\t\t</thread>\n\t\t<tbody>\";\n\t\t\n\t\t// get the account's expenses and generate a row in the table for each expense, with correct information\n\t\t$expenses = $fundingAccount->getExpenses();\n\t\tforeach ($expenses as $e){\n\t\t\t$count ++;\n\t\t\techo \"<tr>\n\t\t\t\t\t<td>\" .$e->getType().\"</td>\n\t\t\t\t\t<td>$\". number_format($e->getAmount(), 2, \".\" , \",\" ) .\"</td>\n\t\t\t\t\t<td>\" . $e->getDate() . \"</td>\n\t\t\t\t</tr>\";}\n\t\t\techo \"</tbody></table>\";\n\t\t\t$_SESSION['fundingAccount'] = $fundingAccount;\n\t\t\t$_SESSION['urlms'] = $urlms;\n\t\t\t?>\n\t\t\t<!-- Section for editing an expense -->\n\t\t\t<html>\n\t\t\t<div class=\"container\">\n\t\t\t\t<form action=\"../controller/InfoUpdater.php\" method=\"get\">\n\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t<br>\n\t\t\t\t\t<h3>Edit Expense</h3>\n\t\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"editExpense\" />\n\t\t\t\t\t\t<div class=\"row\">\n\t\t\t\t\t\t\t<div class=\"col-sm-6\">\n\t\t\t\t\t\t\t\t<label for=\"ExpenseType\">Expense Type</label> \n\t\t\t\t\t\t\t\t<input type=\"text\" class=\"form-control\" name=\"expensename\" id=\"expenseName\" aria-describedby=\"nameHelp\" placeholder=\"Enter Expense Type\"> \n\t\t\t\t\t\t\t\t<small id=\"nameHelp\" class=\"form-text text-muted\">Enter old type of expense.</small> <br>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"row\">\n\t\t\t\t\t\t\t<div class=\"col-sm-6\">\n\t\t\t\t\t\t\t\t<label for=\"newExpenseType\">New Expense Type</label> \n\t\t\t\t\t\t\t\t<input type=\"text\" class=\"form-control\" name=\"newexpensename\" id=\"expenseName\" aria-describedby=\"nameHelp\" placeholder=\"Enter New Expense Type\"> \n\t\t\t\t\t\t\t\t<small id=\"nameHelp\" class=\"form-text text-muted\">Enter new type of expense.</small> <br>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div class=\"col-sm-6\">\n\t\t\t\t\t\t\t\t<label for=\"newAmount\">New Amount</label> \n\t\t\t\t\t\t\t\t<input type=\"text\" class=\"form-control\" name=\"newexpenseamount\" id=\"expenseAmount\" aria-describedby=\"nameHelp\" placeholder=\"Enter New Expense Amount\"> \n\t\t\t\t\t\t\t\t<small id=\"nameHelp\" class=\"form-text text-muted\">Enter new amount of expense.</small> <br>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"row\">\n\t\t\t\t\t\t\t<div class=\"col-sm-6\">\n\t\t\t\t\t\t\t\t<label for=\"ExpenseType\">New Date</label> \n\t\t\t\t\t\t\t\t<input type=\"text\" class=\"form-control\" name=\"newexpensedate\" id=\"expenseName\" aria-describedby=\"nameHelp\" placeholder=\"Enter Expense Date\"> \n\t\t\t\t\t\t\t\t<small id=\"nameHelp\" class=\"form-text text-muted\">Enter new date of expense.</small> <br>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t<input class=\"btn btn-danger\" type=\"submit\" value=\"Edit expense!\" />\n\t\t\t\t</div>\n\t\t\t\t\t<br>\n\t\t\t\t</form>\n\t\t\t\t\n\t\t\t\t<div class=\"row\">\n\t\t\t\t\t<div class=\"col-sm-2\">\n\t\t\t\t\t\t<a href=\"../view/FundingView.php\" style=\"color: white; text-decoration: none;\">\n\t\t\t\t\t\t\t<button type=\"button\" class=\"btn btn-danger\" data-toggle=\"tooltip\"\n\t\t\t\t\t\t\t\tdata-placement=\"bottom\" title=\"Go back to homepage\">Back</button>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</html><?php\n\t\treturn $count;\n\t}",
"function write_customer_trans($trans_type, $trans_no, $debtor_no, $BranchNo,\n $date_, $reference, $Total, $discount = 0, $Tax = 0, $Freight = 0, $FreightTax = 0,\n $sales_type = 0, $order_no = 0, $ship_via = 0, $due_date = \"\",\n $AllocAmt = 0, $rate = 0, $dimension_id = 0, $dimension2_id = 0,\n $payment_terms = null, $tax_included = 0, $prep_amount = 0,$inv_trans_total=0,$is_paper_edit=false)\n{\n\n $display_customer = $_SESSION['Items']->display_customer;\n $customer_trn = $_SESSION['Items']->customer_trn;\n $customer_mobile = $_SESSION['Items']->customer_mobile;\n $customer_email = $_SESSION['Items']->customer_email;\n $customer_ref = $_SESSION['Items']->customer_ref;\n $barcode = $_SESSION['Items']->barcode;\n\n $credit_card_charge = $_SESSION['credit_card_charge'];\n $payment_method = $_SESSION['payment_method'];\n unset($_SESSION['credit_card_charge']);\n unset($_SESSION['payment_method']);\n\n $created_by = $_SESSION['wa_current_user']->user;\n\n $new = $trans_no == 0;\n $curr = get_customer_currency($debtor_no);\n if ($rate == 0)\n $rate = get_exchange_rate_from_home_currency($curr, $date_);\n\n $SQLDate = date2sql($date_);\n if ($due_date == \"\")\n $SQLDueDate = \"0000-00-00\";\n else\n $SQLDueDate = date2sql($due_date);\n\n if ($trans_type == ST_BANKPAYMENT)\n $Total = -$Total;\n\n if ($new || !exists_customer_trans($trans_type, $trans_no)) {\n if ($new) {\n $trans_no = get_next_trans_no($trans_type);\n\n if($trans_type == 10 && !$is_paper_edit) {\n $reference = get_next_invoice_ref($dimension_id);\n $_SESSION['Items']->reference = $reference;\n }\n\n }\n\n $sql = \"INSERT INTO \" . TB_PREF . \"debtor_trans (\n\t\ttrans_no, type,\n\t\tdebtor_no, branch_code,\n\t\ttran_date, due_date,\n\t\treference, tpe,\n\t\torder_, ov_amount, ov_discount,\n\t\tov_gst, ov_freight, ov_freight_tax,\n\t\trate, ship_via, alloc,\n\t\tdimension_id, dimension2_id, payment_terms, tax_included, prep_amount,\n\t\tdisplay_customer,customer_trn,customer_mobile,customer_email,customer_ref,barcode,\n\t\tcredit_card_charge,payment_method,inv_total,created_by \n\t\t) VALUES (\" . db_escape($trans_no) . \", \" . db_escape($trans_type) . \",\n\t\t\" . db_escape($debtor_no) . \", \" . db_escape($BranchNo) . \",\n\t\t'$SQLDate', '$SQLDueDate', \" . db_escape($reference) . \",\n\t\t\" . db_escape($sales_type) . \", \" . db_escape($order_no) . \", $Total, \" . db_escape($discount) . \", $Tax,\n\t\t\" . db_escape($Freight) . \",\n\t\t$FreightTax, $rate, \" . db_escape($ship_via) . \", $AllocAmt,\n\t\t\" . db_escape($dimension_id) . \", \" . db_escape($dimension2_id) . \", \n\t\t\" . db_escape($payment_terms, true) . \", \n\t\t\" . db_escape($tax_included) . \", \n\t\t\" . db_escape($prep_amount) . \",\n\t\t\" . db_escape($display_customer) . \",\n\t\t\" . db_escape($customer_trn) . \",\n\t\t\" . db_escape($customer_mobile) . \",\n\t\t\" . db_escape($customer_email) . \",\n\t\t\" . db_escape($customer_ref) . \",\n\t\t\" . db_escape($barcode) . \",\n\t\t\" . db_escape($credit_card_charge) . \",\n\t\t\" . db_escape($payment_method) . \",\n\t\t$inv_trans_total,$created_by)\";\n } else { // may be optional argument should stay unchanged ?\n $sql = \"UPDATE \" . TB_PREF . \"debtor_trans SET\n\t\tdebtor_no=\" . db_escape($debtor_no) . \" , branch_code=\" . db_escape($BranchNo) . \",\n\t\ttran_date='$SQLDate', due_date='$SQLDueDate',\n\t\treference=\" . db_escape($reference) . \", tpe=\" . db_escape($sales_type) . \", order_=\" . db_escape($order_no) . \",\n\t\tov_amount=$Total, \n\t\tinv_total=$inv_trans_total, \n\t\tov_discount=\" . db_escape($discount) . \", ov_gst=$Tax,\n\t\tov_freight=\" . db_escape($Freight) . \", ov_freight_tax=$FreightTax, rate=$rate,\n\t\tship_via=\" . db_escape($ship_via) . \", alloc=$AllocAmt,\n\t\t\n\t\tdimension2_id=\" . db_escape($dimension2_id) . \",\n\t\tpayment_terms=\" . db_escape($payment_terms, true) . \",\n\t\ttax_included=\" . db_escape($tax_included) . \",\n\t\tprep_amount =\" . db_escape($prep_amount) . \",\n\t\tdisplay_customer =\" . db_escape($display_customer) . \",\n\t\tcustomer_trn =\" . db_escape($customer_trn) . \",\n\t\tcustomer_mobile =\" . db_escape($customer_mobile) . \",\n\t\tcustomer_email =\" . db_escape($customer_email) . \",\n\t\tcustomer_ref =\" . db_escape($customer_ref) . \" \n\t\tWHERE trans_no=\" . db_escape($trans_no) . \" AND type=\" . db_escape($trans_type);\n }\n db_query($sql, \"The debtor transaction record could not be inserted\");\n\n\n// display_error(print_r($display_customer ,true));\n\n\n if ($trans_type != ST_JOURNAL) // skip for journal entries\n add_audit_trail($trans_type, $trans_no, $date_, $new ? '' : trans(\"Updated.\"));\n\n return $trans_no;\n}",
"public function DoTransaction(){\t\t\n\t\tif($this->IsLoggedIn('cashier')){\t\t\t\n\t\t\tif(isset($_POST) && !empty($_POST)){\n\t\t\t\t$customer_id = $_POST['txn_data']['txn_customer_id'];\t\t\t\t\t\t\t\n\t\t\t\t$count=1;\n\t\t\t\tforeach($_POST['cart_data'] as $key => $value)\n\t\t\t\t{\n\t\t\t\t\tif($key){\n\t\t\t\t\t\t$count++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// end\n\t\t\t\t$business_admin_id = $this->session->userdata['logged_in']['business_outlet_id'];\n\t\t\t\t$result = $this->CashierModel->BillingTransaction($_POST,$this->session->userdata['logged_in']['business_outlet_id'],$this->session->userdata['logged_in']['business_admin_id']);\n\n\t\t\t\tif($result['success'] == 'true'){\n\t\t\t\t\t$transcation_detail = $this->CashierModel->GetBilledServicesByTxnId($result['res_arr']['res_arr']['insert_id']);\n\t\t\t\t\t\n\t\t\t\t\t$cart_data['transaction_id'] = $result['res_arr']['res_arr']['insert_id'];\n\t\t\t\t\t$cart_data['outlet_admin_id'] = $business_admin_id;\t\t\t\t\t\n\t\t\t\t\t$cart_data['transaction_time'] = $transcation_detail['res_arr'][0]['txn_datetime'];\n\t\t\t\t\t$cart_data['cart_data'] = json_encode($_POST['cart_data']);\n\t\t\t\t\t$cart_detail = $this->CashierModel->Insert($cart_data,'mss_transaction_cart');\n\t\t\t\t\tif($cart_detail['success'] == 'true'){\n\t\t\t\t\t\t$this->session->set_userdata('loyalty_point',$transcation_detail['res_arr'][0]['txn_loyalty_points']);\n\t\t\t\t\t\t$this->session->set_userdata('cashback',$transcation_detail['res_arr'][0]['txn_loyalty_cashback']);\n\t\t\t\t\t\t$detail_id = $cart_detail['res_arr']['insert_id'];\n\t\t\t\t\t\t$bill_url = base_url().\"Cashier/generateBill/$customer_id/\".base64_encode($detail_id);\n\t\t\t\t\t\t$bill_url = str_replace(\"https\", \"http\", $bill_url);\n\t\t\t\t\t\t$bill_url = shortUrl($bill_url);\n\t\t\t\t\t}\n\n\t\t\t\t\t//1.Unset the payment session\n\t\t \t\t\tif(isset($this->session->userdata['payment'])){\n\t\t \t\t\t\t$this->session->unset_userdata('payment');\n\t\t\t\t\t }\n\t\t\t\t\t //j\n\t\t\t\t\t //Memebership Package Loyalty Calculation\n if(isset($this->session->userdata['cart'][$customer_id]))\n { \n $data = $this->CashierModel->GetCustomerPackages($customer_id);\n if($data['success'] == 'false')\n {\n // $this->PrettyPrintArray(\"Customer Does not have special membership\");\n }\n else{\n if(!empty($data['res_arr']))\n {\n if(isset($this->session->userdata['cart'][$customer_id]))\n {\n $curr_sess_cart = $this->session->userdata['cart'][$customer_id];\n $cart_data = array();\n $i = 0;\n $j = 0;\n $total_product = 0;\n $total_points = 0;\n for($j;$j<count($curr_sess_cart);$j++)\n {\n $service_details = $this->CashierModel->DetailsById($curr_sess_cart[$j]['service_id'],'mss_services','service_id');\n if(isset($service_details['res_arr']))\n {\n // print_r($service_details['res_arr']);\n if($service_details['res_arr']['service_type'] == 'otc')\n {\n $total_product += $curr_sess_cart[$j]['service_total_value'];\n $total_points+= ($curr_sess_cart[$j]['service_total_value']*$data['res_arr'][$i]['service_discount'])/100;\n $curr_sess_cart[$j] += ['service_discount'=>$data['res_arr'][$i]['service_discount']];\n \n array_push($cart_data,$curr_sess_cart[$j]);\n // array_push($cart_data,$data['res_arr'][$i]['service_discount']);\n }\n }\n }\n \n if(!empty($cart_data))\n {\n foreach($cart_data as $key=>$value)\n {\n }\n }\n $update = array(\n 'total_points' => $total_points,\n 'txn_id' => $result['res_arr']['res_arr']['insert_id'],\n 'customer_id' => $customer_id\n );\n $result_2 = $this->CashierModel->SpecialLoyaltyPoints($update,$this->session->userdata['logged_in']['business_outlet_id'],$this->session->userdata['logged_in']['business_admin_id']);\n // $this->PrettyPrintArray($cart_data);\n // exit;\n }\n }\n \n }\n \n }\n\t\t\t\t\t //end\n \n // 2.Then unset the cart session\n\t\t \t\t\tif(isset($this->session->userdata['cart'][$customer_id])){\n\t\t \t\t\t\t$curr_sess_cart_data = $this->session->userdata['cart'];\n\t\t \t\t\t\tunset($curr_sess_cart_data[''.$customer_id.'']);\n\t\t \t\t\t\t$this->session->set_userdata('cart',$curr_sess_cart_data);\n\t\t \t\t\t}\n if(isset($this->session->userdata['recommended_ser'][$customer_id])){\n\t\t\t\t\t\t$curr_sess_cart_data = $this->session->userdata['recommended_ser'];\n\t\t\t\t\t\tunset($curr_sess_cart_data[''.$customer_id.'']);\n\t\t\t\t\t\t$this->session->set_userdata('recommended_ser',$curr_sess_cart_data);\n\t\t\t\t\t}\n\t\t\t\t\t//3.Then unset the customer session from POS\n\t\t \t\t\tif(isset($this->session->userdata['POS'])){\n\t\t \t\t\t\t$curr_sess_cust_data = $this->session->userdata['POS'];\n\t\t \t\t\t\t\n\t\t \t\t\t\t$key = array_search($customer_id, array_column($curr_sess_cust_data, 'customer_id'));\n\t\t \t\t\t\t\n\t\t \t\t\t\tunset($curr_sess_cust_data[$key]);\n\t\t \t\t\t\t$curr_sess_cust_data = array_values($curr_sess_cust_data);\n\t\t \t\t\t\t\n\t\t \t\t\t\t$this->session->set_userdata('POS',$curr_sess_cust_data);\n\t\t \t\t\t}\n\n\t\t \t\t\t//These 2 call will be used for the further enhancement of message sending architecture.\n\t\t \t\t\t$outlet_details = $this->GetCashierDetails();\n\t\t\t\t\t$customer_details = $this->GetCustomerBilling($_POST['customer_pending_data']['customer_id']);\n\t\t\t\t\t//4.Send a msg\n\t\t\t\t\t$this->session->set_userdata('bill_url',$bill_url);\n\t\t\t\t\t$sms_status = $this->db->select('*')->from('mss_business_outlets')->where('business_outlet_id',$this->session->userdata['logged_in']['business_outlet_id'])->get()->row_array();\n\t\t\t\t\t\t// $this->PrettyPrintArray($sms_status);\n\t\t\t\t\tif($sms_status['business_outlet_sms_status']==1 && $sms_status['whats_app_sms_status']==0){\n\t\t\t\t\t\tif($_POST['send_sms'] === 'true' && $_POST['cashback']>0){\n\t\t\t\t\t\t\tif($_POST['txn_data']['txn_value']==0){\n\t\t\t\t\t\t\t$this->SendPackageTransactionSms($_POST['txn_data']['sender_id'],$_POST['txn_data']['api_key'],$_POST['customer_pending_data']['customer_mobile'],$_POST['cart_data'][0]['salon_package_name'],$count,$customer_details['customer_name'],$_POST['cart_data'][0]['service_count'],$outlet_details['business_outlet_google_my_business_url'],$customer_details['customer_rewards']);\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t$this->SendSms($_POST['txn_data']['sender_id'],$_POST['txn_data']['api_key'],$_POST['customer_pending_data']['customer_mobile'],$_POST['txn_data']['txn_value'],$outlet_details['business_outlet_name'],$customer_details['customer_name'],$outlet_details['business_outlet_google_my_business_url'],$customer_details['customer_rewards']);\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\tif($_POST['send_sms'] === 'true' && $_POST['cashback']==0){\n\t\t\t\t\t\t\tif($_POST['txn_data']['txn_value']==0){\n\t\t\t\t\t\t\t$this->SendPackageTransactionSms($_POST['txn_data']['sender_id'],$_POST['txn_data']['api_key'],$_POST['customer_pending_data']['customer_mobile'],$_POST['cart_data'][0]['salon_package_name'],$count,$customer_details['customer_name'],$_POST['cart_data'][0]['service_count'],$outlet_details['business_outlet_google_my_business_url'],$customer_details['customer_rewards']);\n\t\t\t\t\t\t\t}else{\t\t\n\t\t\t\t\t\t\t$this->SendSms($_POST['txn_data']['sender_id'],$_POST['txn_data']['api_key'],$_POST['customer_pending_data']['customer_mobile'],$_POST['txn_data']['txn_value'],$outlet_details['business_outlet_name'],$customer_details['customer_name'],$outlet_details['business_outlet_google_my_business_url'],$customer_details['customer_rewards']);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}elseif($sms_status['business_outlet_sms_status']==1 && $sms_status['whats_app_sms_status']==1){\n\t\t\t\t\t\t$this->SendSms($_POST['txn_data']['sender_id'],$_POST['txn_data']['api_key'],$_POST['customer_pending_data']['customer_mobile'],$_POST['txn_data']['txn_value'],$outlet_details['business_outlet_name'],$customer_details['customer_name'],$outlet_details['business_outlet_google_my_business_url'],$customer_details['customer_rewards']);\n\n\t\t\t\t\t\t$this->SendWhatsAppSms($sms_status['client_id'],$sms_status['whatsapp_userid'],$sms_status['whatsapp_key'],$_POST['customer_pending_data']['customer_mobile'],$_POST['txn_data']['txn_value'],$outlet_details['business_outlet_name'],$customer_details['customer_name'],$outlet_details['business_outlet_google_my_business_url'],$customer_details['customer_rewards']);\n\n\t\t\t\t\t}elseif($sms_status['business_outlet_sms_status']==0 && $sms_status['whats_app_sms_status']==1 ){\n\t\t\t\t\t\t$this->SendWhatsAppSms($sms_status['client_id'],$sms_status['whatsapp_userid'],$sms_status['whatsapp_key'],$_POST['customer_pending_data']['customer_mobile'],$_POST['txn_data']['txn_value'],$outlet_details['business_outlet_name'],$customer_details['customer_name'],$outlet_details['business_outlet_google_my_business_url'],$customer_details['customer_rewards']);\n\t\t\t\t\t}\n\t\t\t\t\t//\n \n\t\t\t\t\t$this->ReturnJsonArray(true,false,\"Transaction is successful!\");\n\t\t\t\t\tdie;\n\t\t\t\t}\n\t\t\t\telseif ($result['error'] == 'true') {\n\t\t\t\t\t$this->ReturnJsonArray(false,true,$result['message']);\n\t\t\t\t\tdie;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\t$this->LogoutUrl(base_url().\"Cashier/\");\n\t\t}\n\t}",
"public function AddTransactionWithDraw($data){\n \t$this->_name='cs_withdraw';\r\n \t$session_user=new Zend_Session_Namespace('auth');\n \t$user_id = $session_user->user_id;\r\n \tif(empty($data['withdraw_dollar'])){\r\n \t\t$w_dollar = 0;\r\n \t}else{\r\n \t\t$w_dollar =$data['withdraw_dollar'] ;\r\n \t\t$rs_dollar = $this->getMoneyInAccountBySender($data['sender'],1);\r\n \t\t$this->updateOldDeposit($w_dollar,$rs_dollar);\r\n \t}\r\n \tif(empty($data['withdraw_bath'])){\r\n \t\t$w_bath = 0;\r\n \t}else{\r\n \t\t$w_bath =$data['withdraw_bath'];\r\n \t\t$rs_bath = $this->getMoneyInAccountBySender($data['sender'],2);\r\n \t\t$this->updateOldDeposit($w_bath,$rs_bath);\r\n \t}\r\n \tif(empty($data['withdraw_riel'])){\r\n \t\t$w_riel = 0;\r\n \t}else{\r\n \t\t$w_riel = $data['withdraw_riel'];\r\n \t\t$rs_riel = $this->getMoneyInAccountBySender($data['sender'],3);\r\n \t\t$this->updateOldDeposit($w_riel,$rs_riel);\r\n \t}\r\n \t$this->_name='cs_withdraw';\r\n \t$data = array(\r\n \t\t\t'sender_id'=>$data['sender'],\r\n \t\t\t'invoice'=>$data['invoice_no'],\r\n \t\t\t'wd_amountdollar'=>$w_dollar,\r\n \t\t\t'wd_amountbath'=>$w_bath,\r\n \t\t\t'wd_amountriel'=>$w_riel,\r\n \t\t\t'user_id'=>$user_id,\r\n \t\t\t'create_date'=>$data['send_date'],\r\n \t);\r\n \t$id = $this->insert($data);\n \t\n \t$process = 0;\r\n \t$amount = 0;\r\n \t$dbc = new Application_Model_DbTable_DbCapital();\r\n \tfor($i=1; $i<4; $i++){//for add capital detail and update current capital by staff\r\n \t\tif(!empty($w_dollar) AND $i==1){\r\n \t\t\t$process = 1;\r\n \t\t\t$curr_type = 1;\r\n \t\t\t$amount = $w_dollar;\r\n \t\t}elseif(!empty($w_bath) AND $i==2){\r\n \t\t\t$process = 1;\r\n \t\t\t$curr_type = 2;\r\n \t\t\t$amount = $w_bath;\r\n \t\t}elseif(!empty($w_riel) AND $i==3){\r\n \t\t\t$process = 1;\r\n \t\t\t$curr_type = 3;\r\n \t\t\t$amount = $w_riel;\r\n \t\t}\r\n \t\tif($process==1){//with draw tran_type = 7\r\n \t\t\t$_arr = array(\r\n \t\t\t\t\t'tran_id' \t=>$id,\r\n \t\t\t\t\t'tran_type' =>7,\r\n \t\t\t\t\t'curr_type'\t=>$curr_type,\r\n \t\t\t\t\t'amount'\t=>-$amount,//cos withdraw money to customer\r\n \t\t\t\t\t'user_id'\t=>$user_id\r\n \t\t\t);\r\n \t\r\n \t\t\t$dbc->addMoneyToCapitalDetail($_arr);\r\n \t\t\t \r\n \t\t\t$rs = $dbc->DetechCapitalExist($user_id, $curr_type,null);\r\n \t\t\tif(!empty($rs)){//update old user\r\n \t\t\t\t$arr = array(\r\n \t\t\t\t\t\t'amount'=>$rs['amount']-$amount\r\n \t\t\t\t);\r\n \t\t\t\t$dbc->updateCurrentBalanceById($rs['id'],$arr);\r\n \t\t\t}else{\r\n \t\t\t\t$date = date(\"Y-m-d H:i:s\");\r\n \t\t\t\t$arr =array(\r\n \t\t\t\t\t\t'amount'=>-$amount,\r\n \t\t\t\t\t\t'currencyType'=>$curr_type,\r\n \t\t\t\t\t\t'userid'=>$user_id,\r\n \t\t\t\t\t\t'statusDate'=>$date\r\n \t\t\t\t);\r\n \t\t\t\t$dbc->AddCurrentBalanceById($arr);\r\n \t\t\t}\r\n \t\r\n \t\t}\r\n \t\t \r\n \t\t$process = 0;\r\n \t}\n }",
"function handleIncomingFundsERP(\n $tid, $created, $serialnumber, $paymentmethod_id, $amount\n ) {\n debug_print(\"Entry: handlingIncomingFundsERP ( tid = $tid )\");\n\n debug_print(\"Creating debtor transaction record\");\n\n $paymentmethod = loadPaymentMethod($paymentmethod_id);\n if ($paymentmethod === false)\n return false;\n\n $meter = loadMeterInformation($serialnumber);\n if ($meter === false)\n return false;\n\n $account = loadAccount($meter['account_id']);\n if ($account === false)\n return false;\n\n $branch = loadCustomerBranch($account['customerbranch_id']);\n if ($branch === false)\n return false;\n\n $branchcode = $branch['code'];\n $new_date = date('Y-m-d', strtotime($created));\n $period_id = fgetPeriod_id($new_date, __FILE__, __LINE__);\n $reference = substr($paymentmethod['code'], 0, 7) . ' ' . $tid;\n $salesorder_id = 0;\n $gst = 0.00;\n $freight = 0.00;\n $rate = 1.00;\n $invtext = '';\n $settled = 0;\n $discount = 0;\n $invtext = 'ReceivedMeter:' . $serialnumber . '(' . $branchcode . ')';\n $invtextevent = 'Received';\n $invtextserialnumber = $serialnumber;\n $invtextbranchcode = $branchcode;\n $meter_id = $meter['meter_id'];\n $posted = 1;\n\n $dtid = insertDebtorTrans(\n $tid, $paymentmethod['transactiontype_id'], $account['customerbranch_id'], $created, $period_id, $reference, $salesorder_id, \n (-($amount)), $gst, $freight, $rate, $invtext, $settled, $discount, $invtextevent, $invtextserialnumber, $invtextbranchcode, $meter_id\n );\n\n debug_print(\"Creating GL transaction records\");\n\n $vatapplicable_id = 5;\n\n if (doesGlExist($paymentmethod['erpglaccountcredit']) &&\n doesGlExist($paymentmethod['erpglaccountdebit'])) {\n $rc = insertGLTrans(\n $paymentmethod['transactiontype_id'], $tid, $new_date, $period_id, $invtext, $posted, $vatapplicable_id, $postings = array(\n array($paymentmethod['erpglaccountcredit'] => -$amount),\n array($paymentmethod['erpglaccountdebit'] => $amount)\n )\n );\n }\n\n debug_print(\"Returning transaction id $tid\");\n debug_print(\"Exit: handleIncomingFundsERP\");\n return $tid;\n }",
"public function transaction($type = '') {\n if ($this->checkLogin('C') == '') {\n redirect(COMPANY_NAME);\n } else {\n $invoice_id = $this->input->post('invoice_id');\n $transaction_id = $this->input->post('transaction_id');\n $paid_date = $this->input->post('paid_date');\n $paid_details = $this->input->post('paid_details');\n $billingArr = $this->revenue_model->get_all_details(BILLINGS, array('invoice_id' => floatval($invoice_id)));\n if ($billingArr->num_rows() > 0) {\n $driver_id = $billingArr->row()->driver_id;\n $txn_type = '';\n $billArr = array();\n if ($type == 'received') {\n $amount = $billingArr->row()->driver_pay_amount;\n $txn_type = 'CREDIT';\n $billArr = array('driver_paid' => 'Yes');\n } else if ($type == 'paid') {\n $amount = $billingArr->row()->site_pay_amount;\n $txn_type = 'DEBIT';\n $billArr = array('site_paid' => 'Yes');\n }\n $txn_date = strtotime($paid_date);\n\n if ($txn_type != '') {\n $txn_arr = array('invoice_id' => (string) $invoice_id,\n 'driver_id' => (string) $driver_id,\n 'txn_type' => (string) $txn_type,\n 'txn_id' => (string) $transaction_id,\n 'txn_date' => MongoDATE($txn_date),\n 'txn_details' => (string) $paid_details,\n );\n $this->revenue_model->simple_insert(PAYMENT_TRANSACTION, $txn_arr);\n if (!empty($billArr)) {\n $this->revenue_model->update_details(BILLINGS, $billArr, array('_id' => MongoID((string) $billingArr->row()->_id)));\n }\n $this->setErrorMessage('success', 'transaction updated successfully','admin_revenue_transaction_update');\n }else{\n\t\t\t\t\t$this->setErrorMessage('error', 'transaction updation failed','admin_revenue_transaction_update_failed');\n\t\t\t\t}\n } else {\n $this->setErrorMessage('error', 'transaction updation failed','admin_revenue_transaction_update_failed');\n }\n echo \"<script>window.history.go(-1);</script>\";\n exit;\n }\n }",
"function handle_transaction()\n\t{\t\n\t\tif ((file_exists(get_file_base().'/data_custom/ecommerce.log')) && (is_writable_wrap(get_file_base().'/data_custom/ecommerce.log')))\n\t\t{\n\t\t\t$myfile=fopen(get_file_base().'/data_custom/ecommerce.log','at');\n\t\t\tfwrite($myfile,serialize($_POST).chr(10));\n\t\t\tfclose($myfile);\n\t\t}\n\n\t\t// assign posted variables to local variables\n\t\t$purchase_id=post_param('custom','-1');\n\n\t\t$txn_type=post_param('txn_type',NULL);\n\n\t\tif ($txn_type=='cart')\n\t\t{\t\n\t\t\trequire_lang('shopping');\n\t\t\t$item_name=do_lang('CART_ORDER',$purchase_id);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$item_name=(substr(post_param('txn_type',''),0,6)=='subscr')?'':post_param('item_name','');\n\t\t}\n\n\t\t$payment_status=post_param('payment_status',''); // May be blank for subscription\n\t\t$reason_code=post_param('reason_code','');\n\t\t$pending_reason=post_param('pending_reason','');\n\t\t$memo=post_param('memo','');\n\t\t$mc_gross=post_param('mc_gross',''); // May be blank for subscription\n\t\t$tax=post_param('tax','');\n\t\tif (($tax!='') && (intval($tax)>0) && ($mc_gross!='')) $mc_gross=float_to_raw_string(floatval($mc_gross)-floatval($tax));\n\t\t$mc_currency=post_param('mc_currency',''); // May be blank for subscription\n\t\t$txn_id=post_param('txn_id',''); // May be blank for subscription\n\t\t$parent_txn_id=post_param('parent_txn_id','-1');\n\t\t$receiver_email=post_param('receiver_email',null);\n\t\tif ($receiver_email===null) $receiver_email=post_param('business');\n\n\t\t// post back to PayPal system to validate\n\t\tif (!ecommerce_test_mode())\n\t\t{\n\t\t\trequire_code('files');\n\t\t\t$pure_post=isset($GLOBALS['PURE_POST'])?$GLOBALS['PURE_POST']:$_POST;\n\t\t\t$x=0;\n\t\t\t$res=mixed();\n\t\t\tdo\n\t\t\t{\n\t\t\t\t$res=http_download_file('https://'.(ecommerce_test_mode()?'www.sandbox.paypal.com':'www.paypal.com').'/cgi-bin/webscr',NULL,false,false,'ocPortal',$pure_post+array('cmd'=>'_notify-validate'));\n\t\t\t\t$x++;\n\t\t\t}\n\t\t\twhile ((is_null($res)) && ($x<3));\n\t\t\tif (is_null($res)) my_exit(do_lang('IPN_SOCKET_ERROR'));\n\t\t\tif (!(strcmp($res,'VERIFIED')==0))\n\t\t\t{\n\t\t\t\tif (post_param('txn_type','')=='send_money') exit('Unexpected'); // PayPal has been seen to mess up on send_money transactions, making the IPN unverifiable\n\t\t\t\tmy_exit(do_lang('IPN_UNVERIFIED').' - '.$res.' - '.flatten_slashed_array($pure_post),strpos($res,'<html')!==false);\n\t\t\t}\n\t\t}\n\n\t\t$txn_type=str_replace('-','_',post_param('txn_type'));\n\t\tif ($txn_type=='subscr-modify')\n\t\t{\n\t\t\t$payment_status='SModified';\n\t\t\t$txn_id=post_param('subscr_id').'-m';\n\t\t}\n\t\telseif ($txn_type=='subscr_signup')\n\t\t{\n\t\t\t$payment_status='Completed';\n\t\t\t$mc_gross=post_param('mc_amount3');\n\t\t\tif (post_param_integer('recurring')!=1) my_exit(do_lang('IPN_SUB_RECURRING_WRONG'));\n\t\t\t$txn_id=post_param('subscr_id');\n\t\t}\n\t\telseif ($txn_type=='subscr_eot' || $txn_type=='recurring_payment_suspended_due_to_max_failed_payment')\n\t\t{\n\t\t\t$payment_status='SCancelled';\n\t\t\t$txn_id=post_param('subscr_id').'-c';\n\t\t}\n\t\telseif ($txn_type=='subscr_payment' || $txn_type=='subscr_failed' || $txn_type=='subscr_cancel')\n\t\t{\n\t\t\texit();\n\t\t}\n\n\t\t$primary_paypal_email=get_value('primary_paypal_email');\n\n\t\tif (!is_null($primary_paypal_email))\n\t\t{\n\t\t\tif ($receiver_email!=$primary_paypal_email) my_exit(do_lang('IPN_EMAIL_ERROR'));\n\t\t} else\n\t\t{\n\t\t\tif ($receiver_email!=$this->_get_payment_address()) my_exit(do_lang('IPN_EMAIL_ERROR'));\n\t\t}\n\n\t\tif (addon_installed('shopping'))\n\t\t{\n\t\t\tif (preg_match('#'.str_replace('xxx','.*',preg_quote(do_lang('shopping:CART_ORDER','xxx'),'#')).'#',$item_name)!=0)\n\t\t\t{\n\t\t\t\t$this->store_shipping_address($purchase_id);\n\t\t\t}\n\t\t}\n\n\t\treturn array($purchase_id,$item_name,$payment_status,$reason_code,$pending_reason,$memo,$mc_gross,$mc_currency,$txn_id,$parent_txn_id);\n\t}",
"private function transactions()\n {\n $invoiceModel = new InvoiceModel();\n $transactions = $invoiceModel->getAllInvoices();\n\n $csvData = [];\n $csvData[] = [\"Invoice ID\", \"Company Name\", \"Invoice Amount\"];\n if (!empty($transactions)) {\n foreach ($transactions as $transaction) {\n $csvData[] = [$transaction[\"id\"], $transaction[\"client\"], $transaction[\"invoice_amount_plus_vat\"]];\n }\n }\n\n $this->getCsvFile($csvData, \"transactions_\" . time() . \".csv\");\n }",
"public function generateExpenses()\n {\n \t//Iva\n \t$iva_expense = new Expense();\n \t$iva_expense->type = 'iva';\n \t$iva_expense->value = ($this->value * $this->iva_percetage)/100;\n \t$iva_expense->exchange_rate_cop = $this->exchange_rate_cop;\n \t$iva_expense->income_id = $this->id;\n \t$iva_expense->currency_id = $this->currency_id;\n \t$iva_expense->save();\n\n \t//Trsoft utility, se calcula con el valor después de descontar el iva\n\t\t$trsoft_utility_expense = new Expense();\n\t\t$trsoft_utility_expense->type = 'trsoft utility';\n\t\t//En la compra de una licencia la utilidad de trsoft aumenta\n\t\tif($this->type == 'license'){\n\t\t\t$trsoft_utility_expense->value = (\n\t\t\t\t//Valor despues de restarle el iva\n\t\t\t\t($this->value - $iva_expense->value) \n\t\t\t\t//Se calcula el % de utilidad de TrSoft, se separa la utilidad de socios\n\t\t\t\t* (100 - $this->partners_utility)\n\t\t\t)/100;\n\t\t}else if($this->type == 'commission'){\n\t\t\t//Cuando se paga una comisión la utiliad de TrSoft es la establecida\n\t\t\t$trsoft_utility_expense->value = (($this->value - $iva_expense->value) * $this->trsoft_utility)/100;\n\t\t}\n\n\t\t$trsoft_utility_expense->exchange_rate_cop = $this->exchange_rate_cop;\n\t\t$trsoft_utility_expense->state = 'paid out';\n\t\t$trsoft_utility_expense->income_id = $this->id;\n\t\t$trsoft_utility_expense->currency_id = $this->currency_id;\n\t\t$trsoft_utility_expense->save(); \n\n \t//Partners utility, se calcula con el valor después de descontar el iva\n\t\t$partners_utility_expense = new Expense();\n\t\t$partners_utility_expense->type = 'partners utility';\n\t\t$partners_utility_expense->value = (($this->value - $iva_expense->value) * $this->partners_utility)/100;\n\t\t$partners_utility_expense->exchange_rate_cop = $this->exchange_rate_cop;\n\t\t$partners_utility_expense->income_id = $this->id;\n\t\t$partners_utility_expense->currency_id = $this->currency_id;\n\t\t$partners_utility_expense->save(); \t\n\n\t\t//Si es el pago de una comisión se deben generar los egresos\n\t\t//para pago de comisión de traders y desarrollador\n\t\tif($this->type == 'commission'){\n\n\t\t}\n }",
"public function actionTransaction(){\n $user_id = \\Yii::$app->user->getID();\n $user = User::findIdentity($user_id);\n $transactionsIn = Transaction::find()->joinWith('order')->joinWith('post')->joinWith('withdraw')->where([\n 'payment_status'=>'completed', \n 'post_services.owner_id'=>\\Yii::$app->user->getId(),\n ])->all();\n $transactionsOut = Transaction::find()->joinWith('order')->joinWith('post')->where([\n 'payment_status'=>'completed', \n 'accepted_orders.user_id'=>\\Yii::$app->user->getId(),\n ])->all();\n return $this->render('transactions', ['transactionsIn'=>$transactionsIn, 'transactionsOut'=>$transactionsOut, 'user'=>$user]);\n }",
"function cashTransactionInsert($generals_id, $data, $totalProductCost, $otherProductCost, $newCylinderProductCost, $mrid)\n {\n //58 account receiable head debit\n\n $singleLedger = array(\n 'generals_id' => $generals_id,\n 'date' => date('Y-m-d', strtotime($this->input->post('saleDate'))),\n 'form_id' => '5',\n 'dist_id' => $this->dist_id,\n 'account' => '58',\n 'debit' => $this->input->post('netTotal'), //sales - discount= grand + vat =newNettotal\n 'updated_by' => $this->admin_id,\n );\n $this->db->insert('generalledger', $singleLedger);\n //59 Prompt Given Discounts\n if (!empty($data['discount'])) :\n $singleLedger = array(\n 'generals_id' => $generals_id,\n 'date' => date('Y-m-d', strtotime($this->input->post('saleDate'))),\n 'form_id' => '5',\n 'dist_id' => $this->dist_id,\n 'account' => '59',\n 'debit' => $data['discount'],\n 'updated_by' => $this->admin_id,\n );\n $this->db->insert('generalledger', $singleLedger);\n endif;\n //49 Sales head credit\n $singleLedger = array(\n 'generals_id' => $generals_id,\n 'date' => date('Y-m-d', strtotime($this->input->post('saleDate'))),\n 'form_id' => '5',\n 'dist_id' => $this->dist_id,\n 'account' => '49',\n 'credit' => array_sum($this->input->post('price')),\n 'updated_by' => $this->admin_id,\n );\n $this->db->insert('generalledger', $singleLedger);\n //60 Sales tax/vat head credit\n if (!empty($data['vatAmount'])):\n $singleLedger = array(\n 'generals_id' => $generals_id,\n 'date' => date('Y-m-d', strtotime($this->input->post('saleDate'))),\n 'form_id' => '5',\n 'dist_id' => $this->dist_id,\n 'account' => '60',\n 'credit' => $data['vatAmount'],\n 'updated_by' => $this->admin_id,\n );\n $this->db->insert('generalledger', $singleLedger);\n endif;\n //7501 Cost of Goods-Retail head debit\n if (!empty($totalProductCost)):\n $singleLedger = array(\n 'generals_id' => $generals_id,\n 'date' => date('Y-m-d', strtotime($this->input->post('saleDate'))),\n 'form_id' => '5',\n 'dist_id' => $this->dist_id,\n 'account' => '62',\n 'debit' => $totalProductCost,\n 'updated_by' => $this->admin_id,\n );\n $this->db->insert('generalledger', $singleLedger);\n endif;\n //52 account Inventory head credit\n if (!empty($otherProductCost)):\n $singleLedger = array(\n 'generals_id' => $generals_id,\n 'date' => date('Y-m-d', strtotime($this->input->post('saleDate'))),\n 'form_id' => '5',\n 'dist_id' => $this->dist_id,\n 'account' => '52',\n 'credit' => $otherProductCost,\n 'updated_by' => $this->admin_id,\n );\n $this->db->insert('generalledger', $singleLedger);\n endif;\n //cylinder product stock.\n if (!empty($newCylinderProductCost)) {\n $singleLedger = array(\n 'generals_id' => $generals_id,\n 'date' => date('Y-m-d', strtotime($this->input->post('saleDate'))),\n 'form_id' => '5',\n 'dist_id' => $this->dist_id,\n 'account' => '173',\n 'credit' => $newCylinderProductCost,\n 'updated_by' => $this->admin_id,\n );\n $this->db->insert('generalledger', $singleLedger);\n }\n\n //loader account head credit\n //transportation account head credit\n //loader and transportation account receiaveable head debit against credit\n $loaderAmount = $this->input->post('loaderAmount');\n $transportationAmount = $this->input->post('transportationAmount');\n if (!empty($loaderAmount)) {\n $singleLedger = array(\n 'generals_id' => $generals_id,\n 'date' => date('Y-m-d', strtotime($this->input->post('saleDate'))),\n 'form_id' => '5',\n 'dist_id' => $this->dist_id,\n 'account' => '391',\n 'credit' => $loaderAmount,\n 'updated_by' => $this->admin_id,\n );\n $this->db->insert('generalledger', $singleLedger);\n }\n if (!empty($transportationAmount)) {\n $singleLedger = array(\n 'generals_id' => $generals_id,\n 'date' => date('Y-m-d', strtotime($this->input->post('saleDate'))),\n 'form_id' => '5',\n 'dist_id' => $this->dist_id,\n 'account' => '392',\n 'credit' => $transportationAmount,\n 'updated_by' => $this->admin_id,\n );\n $this->db->insert('generalledger', $singleLedger);\n }\n\n\n //customer payment ledger\n $generals_data = array(\n 'form_id' => '7',\n 'customer_id' => $this->input->post('customer_id'),\n 'dist_id' => $this->dist_id,\n 'mainInvoiceId' => $generals_id,\n 'voucher_no' => $this->input->post('voucherid'),\n 'date' => date('Y-m-d', strtotime($this->input->post('saleDate'))),\n 'credit' => $this->input->post('netTotal'),\n 'narration' => $this->input->post('narration'),\n 'updated_by' => $this->admin_id,\n 'created_at' => $this->timestamp\n );\n $generalPaymentId = $this->Common_model->insert_data('generals', $generals_data);\n //1301 Cash in Hand head debit\n $singleLedger = array(\n 'generals_id' => $generalPaymentId,\n 'date' => date('Y-m-d', strtotime($this->input->post('saleDate'))),\n 'form_id' => '5',\n 'dist_id' => $this->dist_id,\n 'account' => '54',\n 'debit' => $this->input->post('netTotal'),\n 'updated_by' => $this->admin_id,\n );\n $this->db->insert('generalledger', $singleLedger);\n //58 Account Receivable head credit\n $singleLedger = array(\n 'generals_id' => $generalPaymentId,\n 'date' => date('Y-m-d', strtotime($this->input->post('saleDate'))),\n 'form_id' => '5',\n 'dist_id' => $this->dist_id,\n 'account' => '58',\n 'credit' => $this->input->post('netTotal'),\n 'updated_by' => $this->admin_id,\n );\n $this->db->insert('generalledger', $singleLedger);\n //client vendor ledger\n $customerLedger1 = array(\n 'ledger_type' => 1,\n 'trans_type' => 'Sales Payment',\n 'history_id' => $generalPaymentId,\n 'trans_type' => $this->input->post('voucherid'),\n 'client_vendor_id' => $this->input->post('customer_id'),\n 'dist_id' => $this->dist_id,\n 'updated_by' => $this->admin_id,\n 'amount' => $this->input->post('netTotal'),\n 'cr' => $this->input->post('netTotal'),\n 'date' => date('Y-m-d', strtotime($this->input->post('saleDate')))\n );\n $this->db->insert('client_vendor_ledger', $customerLedger1);\n //money Receite General\n $moneyReceit = array(\n 'date' => date('Y-m-d', strtotime($this->input->post('saleDate'))),\n 'invoiceID' => json_encode($this->input->post('voucherid')),\n 'totalPayment' => $this->input->post('netTotal'),\n 'receitID' => $mrid,\n 'mainInvoiceId' => $generals_id,\n 'dist_id' => $this->dist_id,\n 'customerid' => $this->input->post('customer_id'),\n 'narration' => $this->input->post('narration'),\n 'updated_by' => $this->admin_id,\n 'paymentType' => 1\n );\n $this->db->insert('moneyreceit', $moneyReceit);\n }",
"function insert_transaction($subscriptionid = 0, $projectid = 0, $buynowid = 0, $user_id = 0, $p2b_user_id = 0, $storeid = 0, $orderid = 0, $description = '', $amount, $paid, $status, $invoicetype, $paymethod, $createdate, $duedate, $paiddate, $custommessage, $archive, $ispurchaseorder = 0, $returnid = 0, $transactionidx = '', $isdeposit = 0, $iswithdraw = 0, $dontprocesstax = 0)\n {\n global $ilance, $ilconfig;\n $subscriptionid = isset($subscriptionid) ? intval($subscriptionid) : '0';\n $projectid = isset($projectid) ? intval($projectid) : '0';\n $buynowid = isset($buynowid) ? intval($buynowid) : '0';\n $user_id = isset($user_id) ? intval($user_id) : '0';\n $p2b_user_id = isset($p2b_user_id) ? intval($p2b_user_id) : '0';\n $storeid = isset($storeid) ? intval($storeid) : '0';\n $orderid = isset($orderid) ? intval($orderid) : '0';\n $description = isset($description) ? $description : 'No transaction description provided';\n $amount = isset($amount) ? $amount : '0.00';\n $paid = isset($paid) ? $paid : '0.00';\n $status = isset($status) ? $status : 'unpaid';\n $invoicetype = isset($invoicetype) ? $invoicetype : 'debit';\n $paymethod = isset($paymethod) ? $paymethod : 'account';\n $ipaddress = IPADDRESS;\n $referer = REFERRER;\n $createdate = DATETIME24H;\n $duedate = isset($duedate) ? $duedate : DATETIME24H;\n $paiddate = isset($paiddate) ? $paiddate : '';\n $custommessage = isset($custommessage) ? $custommessage : 'No memo or administrative comments';\n $archive = isset($archive) ? intval($archive) : '0';\n $ispurchaseorder = isset($ispurchaseorder) ? $ispurchaseorder : '0';\n // withdraw and deposit related transactions\n $iswithdraw \t = isset($iswithdraw) \t ? intval($iswithdraw) : '0';\n $isdeposit \t = isset($isdeposit) \t ? intval($isdeposit) : '0';\n $totalamount = '0.00';\n $transactionid = (isset($transactionidx) AND !empty($transactionidx)) ? $transactionidx : $ilance->accounting_payment->construct_transaction_id();\n $currencyid = $this->currencyid == '0' ? $ilconfig['globalserverlocale_defaultcurrency'] : $this->currencyid;\n $ilance->db->query(\"\n INSERT INTO \" . DB_PREFIX . \"invoices\n (invoiceid, currency_id, subscriptionid, projectid, buynowid, user_id, p2b_user_id, storeid, orderid, description, amount, paid, totalamount, status, paymethod, ipaddress, referer, createdate, duedate, paiddate, custommessage, transactionid, archive, ispurchaseorder, isdeposit, iswithdraw)\n VALUES(\n NULL,\n '\" . intval($currencyid) . \"',\n '\" . intval($subscriptionid) . \"',\n '\" . intval($projectid) . \"',\n '\" . intval($buynowid) . \"',\n '\" . intval($user_id) . \"',\n '\" . intval($p2b_user_id) . \"',\n '\" . intval($storeid) . \"',\n '\" . intval($orderid) . \"',\n '\" . $ilance->db->escape_string($description) . \"',\n '\" . $ilance->db->escape_string($amount) . \"',\n '\" . $ilance->db->escape_string($paid) . \"',\n '\" . $ilance->db->escape_string($totalamount) . \"',\n '\" . $ilance->db->escape_string($status) . \"',\n '\" . $ilance->db->escape_string($paymethod) . \"',\n '\" . $ilance->db->escape_string($ipaddress) . \"',\n '\" . $ilance->db->escape_string($referer) . \"',\n '\" . $ilance->db->escape_string($createdate) . \"',\n '\" . $ilance->db->escape_string($duedate) . \"',\n '\" . $ilance->db->escape_string($paiddate) . \"',\n '\" . $ilance->db->escape_string($custommessage) . \"',\n '\" . $ilance->db->escape_string($transactionid) . \"',\n '\" . $ilance->db->escape_string($archive) . \"',\n '\" . intval($ispurchaseorder) . \"',\n '\" . intval($isdeposit) . \"',\n '\" . intval($iswithdraw) . \"')\n \", 0, null, __FILE__, __LINE__); \n // fetch new last invoice id\n $invoiceid = $ilance->db->insert_id();\n \n // do we skip the taxation support for this transaction?\n // we do this in some situations where the tax needs to be applied before the txn is created\n // for situations like escrow fees that we must already know how much to charge the customer for taxes\n // if we don't do this then the txn may have double taxes added to the overall amount\n // and situations like this usually mean that an unpaid transaction is being created (and tax) is\n // auto-applied\n \n // taxation support: is user taxable for this invoice type?\n // this code block will run if a transaction being created is unpaid waiting for payment from the customer\n if ($ilance->tax->is_taxable($user_id, $invoicetype) AND isset($dontprocesstax) AND $dontprocesstax == 0)\n {\n // fetch tax amount to charge for this invoice type\n $taxamount = $ilance->tax->fetch_amount($user_id, $amount, $invoicetype, 0);\n // fetch total amount to hold within the \"totalamount\" field\n $totalamount = ($amount + $taxamount);\n // fetch tax bit to display when outputing tax infos\n $taxinfo = $ilance->tax->fetch_amount($user_id, $amount, $invoicetype, 1);\n // portfolio invoicetypes are actually debit payments so treat it like so\n if ($invoicetype == 'portfolio')\n {\n $invoicetype = 'debit';\n }\n // in cases where an escrow payment is being made, and taxes are involved for commission fees,\n // we will update our paid amount to the (total amount w/taxes) if our total amount is not the same\n // as the amount we're paying. we do this because the invoice overview menu will show something like:\n // Amount Paid: $250.00 but the Total Amount is $300.00 (taxes already applied and paid via escrow)\n $extra = '';\n if ($totalamount != $paid AND $totalamount > 0 AND $status == 'paid')\n {\n $extra = \"paid = '\" . $totalamount . \"',\";\n }\n // member is taxable for this invoice type\n $ilance->db->query(\"\n UPDATE \" . DB_PREFIX . \"invoices\n SET istaxable = '1',\n $extra\n totalamount = '\" . sprintf(\"%01.2f\", $totalamount) . \"',\n taxamount = '\" . sprintf(\"%01.2f\", $taxamount) . \"',\n taxinfo = '\" . $ilance->db->escape_string($taxinfo) . \"',\n invoicetype = '\" . $invoicetype . \"'\n WHERE invoiceid = '\" . intval($invoiceid) . \"'\n AND user_id = '\" . intval($user_id) . \"'\n \", 0, null, __FILE__, __LINE__);\n }\n else\n {\n // portfolio invoicetypes are actually debit payments so treat it like so\n if ($invoicetype == 'portfolio')\n {\n $invoicetype = 'debit';\n }\n // in cases where an escrow payment is being made, and taxes are involved for commission fees,\n // we will update our paid amount to the (total amount w/taxes) if our total amount is not the same\n // as the amount we're paying. we do this because the invoice overview menu will show something like:\n // Amount Paid: $250.00 but the Total Amount is $300.00 (taxes already applied and paid via escrow)\n $extra = '';\n if ($totalamount != $paid AND $totalamount > 0 AND $status == 'paid')\n {\n $extra = \"paid = '\".$totalamount.\"',\";\n }\n // customer not taxable > update totalamount value\n $ilance->db->query(\"\n UPDATE \" . DB_PREFIX . \"invoices\n SET totalamount = '\" . sprintf(\"%01.2f\", $amount) . \"',\n $extra\n invoicetype = '\" . $invoicetype . \"'\n WHERE invoiceid = '\" . intval($invoiceid) . \"'\n AND user_id = '\" . intval($user_id) . \"'\n \", 0, null, __FILE__, __LINE__);\n } \n if (isset($returnid) AND $returnid > 0)\n {\n return intval($invoiceid);\n }\n }",
"function CreateDeposit() {\r\n $conn = conn();\r\n\r\n $sql = \"INSERT INTO `deposit`(`CompanyId`, `DepositAmount`, `PreviousBalance`, `CurrentBalance`, `Comments`, `RecEntered`, `RecEnteredBy`) VALUES \"\r\n . \"('$this->CompanyId','$this->DepositAmount','$this->PreviousBalance','$this->CurrentBalance','$this->Comments',NOW(), '$this->ReEnteredBy')\";\r\n if ($conn->exec($sql)) {\r\n $this->auditok = 1;\r\n } else {\r\n $this->auditok = 0;\r\n }\r\n $conn = NULL;\r\n }",
"function create_growsumo_transaction($grsm_cust_tran_data){\n $CI =& get_instance();\n $ch = curl_init('https://api.growsumo.com/v1/customers/'.$grsm_cust_tran_data['cust_key'].'/transactions');\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json'));\n $auth = GROWSUMO_PK.':'.GROWSUMO_SK;\n $data = json_encode(array('key' => $grsm_cust_tran_data['tran_key'],'product_key'=>'crc_masterclass','amount' => $grsm_cust_tran_data['amount'],'currency' => 'USD'));\n curl_setopt($ch, CURLOPT_USERPWD, $auth);\n curl_setopt($ch, CURLOPT_POSTFIELDS, $data);\n $response = curl_exec($ch);\n curl_close($ch); \n \n if($response === false || $response['http_code'] != 200) {\n if (curl_error($ch)) {\n $response .= \"\\n \". curl_error($ch); \n @mail('[email protected]','Failed creating growsumo transaction',$response.\"<br> Data:\".print_r($grsm_cust_tran_data));\n }\n }\n $transaction_log_array = array(\n 'customer_email'=>$grsm_cust_tran_data['cust_email'],\n 'amount'=>$grsm_cust_tran_data['amount'],\n 'transaction_key'=>$grsm_cust_tran_data['tran_key'],\n 'cust_key'=>$grsm_cust_tran_data['cust_key'],\n 'partner_key'=>$grsm_cust_tran_data['cust_ref'],\n 'status'=>$response\n );\n $CI->common_repository->insertGenData(DB_DEFAULT, 'cro_growsumo_transaction_logs',$transaction_log_array);\n\n }",
"function creditTransactionInsert($generals_id, $data, $totalProductCost, $otherProductCost, $newCylinderProductCost)\n {\n //58 account receiable head debit\n\n $singleLedger = array(\n 'generals_id' => $generals_id,\n 'date' => date('Y-m-d', strtotime($this->input->post('saleDate'))),\n 'form_id' => '5',\n 'dist_id' => $this->dist_id,\n 'account' => '58',\n 'debit' => $this->input->post('netTotal'), //sales - discount= grand + vat =newNettotal\n 'updated_by' => $this->admin_id,\n );\n $this->db->insert('generalledger', $singleLedger);\n\n\n //59 Prompt Given Discounts\n if (!empty($data['discount'])):\n $singleLedger = array(\n 'generals_id' => $generals_id,\n 'date' => date('Y-m-d', strtotime($this->input->post('saleDate'))),\n 'form_id' => '5',\n 'dist_id' => $this->dist_id,\n 'account' => '59',\n 'debit' => $data['discount'],\n 'updated_by' => $this->admin_id,\n );\n $this->db->insert('generalledger', $singleLedger);\n endif;\n //49 Sales head credit\n $singleLedger = array(\n 'generals_id' => $generals_id,\n 'date' => date('Y-m-d', strtotime($this->input->post('saleDate'))),\n 'form_id' => '5',\n 'dist_id' => $this->dist_id,\n 'account' => '49',\n 'credit' => array_sum($this->input->post('price')),\n 'updated_by' => $this->admin_id,\n );\n $this->db->insert('generalledger', $singleLedger);\n //60 Sales tax/vat head credit\n if (!empty($data['vatAmount'])):\n $singleLedger = array(\n 'generals_id' => $generals_id,\n 'date' => date('Y-m-d', strtotime($this->input->post('saleDate'))),\n 'form_id' => '5',\n 'dist_id' => $this->dist_id,\n 'account' => '60',\n 'credit' => $data['vatAmount'],\n 'updated_by' => $this->admin_id,\n );\n $this->db->insert('generalledger', $singleLedger);\n endif;\n //62 Cost of Goods-Retail head debit\n if (!empty($totalProductCost)):\n $singleLedger = array(\n 'generals_id' => $generals_id,\n 'date' => date('Y-m-d', strtotime($this->input->post('saleDate'))),\n 'form_id' => '5',\n 'dist_id' => $this->dist_id,\n 'account' => '62',\n 'debit' => $totalProductCost,\n 'updated_by' => $this->admin_id,\n );\n $this->db->insert('generalledger', $singleLedger);\n endif;\n //52 account Inventory head credit\n if (!empty($otherProductCost)):\n $singleLedger = array(\n 'generals_id' => $generals_id,\n 'date' => date('Y-m-d', strtotime($this->input->post('saleDate'))),\n 'form_id' => '5',\n 'dist_id' => $this->dist_id,\n 'account' => '52',\n 'credit' => $otherProductCost,\n 'updated_by' => $this->admin_id,\n );\n $this->db->insert('generalledger', $singleLedger);\n endif;\n //cylinder product stock.\n if (!empty($newCylinderProductCost)) {\n $singleLedger = array(\n 'generals_id' => $generals_id,\n 'date' => date('Y-m-d', strtotime($this->input->post('saleDate'))),\n 'form_id' => '5',\n 'dist_id' => $this->dist_id,\n 'account' => '173',\n 'credit' => $newCylinderProductCost,\n 'updated_by' => $this->admin_id,\n );\n $this->db->insert('generalledger', $singleLedger);\n }\n //loader account head credit\n //transportation account head credit\n //loader and transportation account receiaveable head debit against credit\n\n $loaderAmount = $this->input->post('loaderAmount');\n $transportationAmount = $this->input->post('transportationAmount');\n if (!empty($loaderAmount)) {\n $singleLedger = array(\n 'generals_id' => $generals_id,\n 'date' => date('Y-m-d', strtotime($this->input->post('saleDate'))),\n 'form_id' => '5',\n 'dist_id' => $this->dist_id,\n 'account' => '391',\n 'credit' => $loaderAmount,\n 'updated_by' => $this->admin_id,\n );\n $this->db->insert('generalledger', $singleLedger);\n }\n if (!empty($transportationAmount)) {\n $singleLedger = array(\n 'generals_id' => $generals_id,\n 'date' => date('Y-m-d', strtotime($this->input->post('saleDate'))),\n 'form_id' => '5',\n 'dist_id' => $this->dist_id,\n 'account' => '392',\n 'credit' => $transportationAmount,\n 'updated_by' => $this->admin_id,\n );\n $this->db->insert('generalledger', $singleLedger);\n }\n }",
"function logTransaction($text){\n\t$fp = fopen (PAYPAL_LOG_FILE , 'a');\n\tfwrite ($fp, $text . \"\\n\");\n\tfclose ($fp );\n\tchmod (PAYPAL_LOG_FILE , 0600);\n}",
"function chawa_db_transactions_data() {\n\tglobal $wpdb;\n\t\n\t$table_name = $wpdb->prefix . 'chawa_transactions';\n\t\n\t$wpdb->insert(\n\t\t$table_name, \n\t\tarray(\n\t\t\t'transaction_id' => 'chawa_000000000000000000000000',\n\t\t\t'transaction_type' => 'DEBIT',\n\t\t\t'transaction_status' => 'status',\n\t\t\t'source_id' => 'src_000000000000000000000000',\n\t\t\t'source_status' => 'status',\n\t\t\t'charge_id' => 'py_000000000000000000000000',\n\t\t\t'charge_status' => 'status',\n\t\t\t'user_id' => 0,\n\t\t\t'amount' => 0,\n\t\t\t'recurring' => FALSE,\n\t\t\t'time' => current_time('mysql')\n\t\t) \n\t);\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}",
"function cc_bill($cc_info, $member, $amount, \n $currency, $product_description, \n $charge_type, $invoice, $payment){\n global $config;\n $log = array();\n //////////////////////// cc_bill /////////////////////////\n\n srand(time());\n if ($charge_type == CC_CHARGE_TYPE_TEST) \n $amount = \"1.00\";\n $vars = array(\n \"type\" => 'sale',\n \"username\" => $this->config['login'],\n \"password\" => $this->config['pass'],\n \"orderid\" => $payment['payment_id'],\n \"amount\" => $amount,\n \"orderdescription\" => $product_description\n );\n if($charge_type == CC_CHARGE_TYPE_RECURRING){\n $vars['customer_vault_id'] = $member['data']['inspirepay_customer_vault_id'];\n }else{\n $vars +=array(\n \"ccnumber\" => $cc_info['cc_number'],\n \"ccexp\" => $cc_info['cc-expire'],\n \"email\" => $member['email'],\n \"firstname\" => $cc_info['cc_name_f'],\n \"lastname\" => $cc_info['cc_name_l'],\n \"address1\" => $cc_info['cc_street'],\n \"city\" => $cc_info['cc_city'],\n \"state\" => $cc_info['cc_state'],\n \"zip\" => $cc_info['cc_zip'],\n \"country\" => $cc_info['cc_country'],\n \"ipaddress\" => $member['remote_addr'] ? $member['remote_addr'] : $_SERVER['REMOTE_ADDR'],\n \"phone\" => $cc_info['cc_phone']\n );\n if ($cc_info['cc_code'])\n $vars['cvv'] = $cc_info['cc_code'];\n }\n \n // prepare log record\n $vars_l = $vars; \n if($vars['ccnumber'])\n $vars_l['ccnumber'] = $cc_info['cc'];\n if ($vars['cvv'])\n $vars_l['cvv'] = preg_replace('/./', '*', $vars['cvv']);\n $log[] = $vars_l;\n /////\n $res = $this->run_transaction($vars);\n $log[] = $res;\n\n if ($res['response'] == '1'){ \n if ($charge_type == CC_CHARGE_TYPE_TEST)\n $this->void_transaction($res['transactionid'], $log);\n return array(CC_RESULT_SUCCESS, \"\", $res['transactionid'], $log);\n } elseif ($res['response'] == '2') {\n return array(CC_RESULT_DECLINE_PERM, $res['responsetext'], \"\", $log);\n } else {\n return array(CC_RESULT_INTERNAL_ERROR, $res['responsetext'], \"\", $log);\n }\n }",
"public function store(Request $request)\n {\n @ini_set('max_execution_time', 0);\n\t\t@set_time_limit(0);\n\n\t\t$validator = Validator::make($request->all(), [\n\t\t\t'type' => 'required',\n\t\t\t'amount' => 'required|numeric',\n\t\t\t'account_id' => 'required',\n\t\t\t'user_id' => 'required'\n\t\t]);\n\t\t\n\t\tif ($validator->fails()) {\n\t\t\tif($request->ajax()){ \n\t\t\t return response()->json(['result'=>'error','message'=>$validator->errors()->all()]);\n\t\t\t}else{\n\t\t\t\treturn redirect()->route('deposit.create')\n\t\t\t\t\t\t\t->withErrors($validator)\n\t\t\t\t\t\t\t->withInput();\n\t\t\t}\t\t\t\n\t\t}\n\t\t\t\n\n\t\tDB::beginTransaction();\n\n $deposit = new Deposit();\n\t $deposit->method = 'Manual';\n\t $deposit->type = $request->input('type');\n\t\t$deposit->amount = $request->input('amount');\n\t\t$deposit->account_id = $request->input('account_id');\n\t\t$deposit->note = $request->input('note');\n\t\t$deposit->status = 1;\n\t\t$deposit->user_id = $request->input('user_id');\n\t\n $deposit->save();\n\t\t\n\t\t//Create Transaction\n\t\t$transaction = new Transaction();\n\t $transaction->user_id = $request->input('user_id');\n\t\t$transaction->amount = $request->input('amount');\n\t\t$transaction->account_id = $request->input('account_id');\n\t\t$transaction->dr_cr = 'cr';\n\t\t$transaction->type = $request->input('type');\n\t\t$transaction->status = 'complete';\n\t\t$transaction->note = $request->input('note');\n\t\t$transaction->ref_id = $deposit->id;\n\t\t$transaction->created_by = Auth::user()->id;\n\t\t$transaction->updated_by = Auth::user()->id;\n\t\n $transaction->save();\n\n if($request->input('type') == 'wire_transfer'){\n\t //Generate Fee \n\t\t\t$fee = generate_fee( $request->amount, $transaction->account->account_type->iwt_fee, $transaction->account->account_type->iwt_fee_type );\n\n\t\t\tif($fee > 0) {\n\t\t\t\t$fee_debit = new Transaction();\n\t\t\t\t$fee_debit->user_id = $request->input('user_id');\n\t\t\t\t$fee_debit->amount = $fee;\n\t\t\t\t$fee_debit->account_id = $request->input('account_id');\n\t\t\t\t$fee_debit->dr_cr = 'dr';\n\t\t\t\t$fee_debit->type = 'fee';\n\t\t\t\t$fee_debit->status = 'complete';\n\t\t\t\t$fee_debit->parent_id = $debit->id;\n\t\t\t\t$fee_debit->note = _lang('Incoming Wire Transfer Fee');\n\t\t\t\t$fee_debit->created_by = Auth::id();\n\t\t\t\t$fee_debit->updated_by = Auth::id();\n\t\t\t\t$fee_debit->save();\n\t\t\t}\n\t\t}\n\n\t\t//Make Commission\n\t\tif( $transaction->user->refer_user_id != null ){\n $percentage = get_option('user_referral_commission', 0);\n\n if( $percentage > 0 ){\n $commission = new \\App\\ReferralCommission();\n $commission->currency_id = $transaction->account->account_type->currency_id;\n $commission->amount = ($transaction->amount / 100) * $percentage;\n $commission->status = 1;\n $commission->user_id = $transaction->user->refer_user_id;\n $commission->save();\n }\n\t\t}\n\n\t\t//Send Message Notification\n\t\t/*$message_object = new \\stdClass();\n\t\t$message_object->first_name = $transaction->user->first_name;\n\t\t$message_object->last_name = $transaction->user->last_name;\n\t\t$message_object->account = $transaction->account->account_number;\n\t\t$message_object->currency = $transaction->account->account_type->currency->name;\n\t\t$message_object->amount = $transaction->amount;\n\t\t$message_object->date = $transaction->created_at->toDateTimeString();\n\t\t*/\n\t\t\n\t\t//Registering Event\n\t\tevent(new \\App\\Events\\DepositMoney($transaction));\n\n\t\t//send_message($request->user_id, get_option('deposit_subject'), get_option('deposit_message'), $message_object);\n\n\t\tDB::commit();\n\t\t\n\t\t//Prefix Output\n\t\tif($deposit->status == 0){\n\t\t\t$deposit->status = \"<span class='badge badge-warning'>\"._lang('Pending').\"</span>\";\n\t\t}else if($deposit->status == 1){\n\t\t\t$deposit->status = \"<span class='badge badge-success'>\"._lang('Completed').\"</span>\";\n\t\t}else if($deposit->status == 2){\n\t\t\t$deposit->status = \"<span class='badge badge-danger'>\"._lang('Canceled').\"</span>\";\n\t\t}\n\t\t\n\t\t$deposit->type = ucwords(str_replace('_',' ',$deposit->type));\n\t\t$deposit->account_id = $deposit->account->account_number.' ('.$deposit->account->account_type->currency->name.')';\n\t\t$deposit->user_id = $deposit->user->first_name.' '.$deposit->user->last_name;\n\t\t$deposit->amount = decimalPlace($deposit->amount);\n\t\t\n\t\t\n \n\t\tif(! $request->ajax()){\n return redirect()->route('deposit.create')->with('success', _lang('Deposit made sucessfully'));\n }else{\n\t\t return response()->json(['result'=>'success','action'=>'store','message'=>_lang('Deposit made sucessfully'),'data'=>$deposit]);\n\t\t}\n \n }",
"function add_money() {\n\t\t$coupon_id = $_REQUEST['coupon_id'];\n\t\t$coupon_amount = $_REQUEST['coupon_amount'];\n\t\t$user_id = $_REQUEST['recharge_user_id'];\n\t\t$user_amount = $_REQUEST['recharge_amount'];\n\t\t$transaction_id = $_REQUEST['transection_id'];\n\t\t$final_amount = $coupon_amount + $user_amount;\n\t\t//\t$wt_type=$_POST['wt_type']; //1- debit in account, 2- credit in account\n\t\t$wt_type = 1;\n\t\t// credit\n\t\t$current_date = date(\"Y-m-d h:i:sa\");\n\t\t$wt_category = 1;\n\t\t// 1-Add moeny, 2-Recharge\n\t\t$w_category = 6;\n\t\t$w_desc = \"Amount Recieved when add money \" . $user_amount . \" with get amount \" . $coupon_amount;\n\t\t$wt_desc = \"Add Money\";\n\t\tif (!empty($user_id) && !empty($user_amount) && !empty($transaction_id)) {\n\t\t\t$records = $this -> conn -> get_table_row_byidvalue('user', 'user_id', $user_id);\n\t\t\t$wallet_amount = $records['0']['wallet_amount'];\n\t\t\t$user_wallet = $wallet_amount + $final_amount;\n\t\t\t$add_money = $this -> conn -> insertnewrecords('wallet_transaction', 'wt_user_id, wt_datetime,wt_type,wt_amount,wt_category,transaction_id,wt_desc', '\"' . $user_id . '\",\"' . $current_date . '\",\"' . $wt_type . '\",\"' . $user_amount . '\",\"' . $wt_category . '\",\"' . $transaction_id . '\",\"' . $wt_desc . '\"');\n\t\t\tif (!empty($add_money)) {\n\t\t\t\tif (!empty($coupon_id)) {\n\n\t\t\t\t\t$add_money = $this -> conn -> insertnewrecords('coupon_details', 'coupon_id, user_id,coupon_apply_date', '\"' . $coupon_id . '\",\"' . $user_id . '\",\"' . $current_date . '\"');\n\t\t\t\t\tif ($add_money) {\n\t\t\t\t\t\t$records_coupon = $this -> conn -> get_table_row_byidvalue('offer_coupon', 'coupon_id', $coupon_id);\n\t\t\t\t\t\t\n\t\t\t\t\t\t$coupon_count = $records_coupon['0']['coupon_limit'];\n\t\t\t\t\t\tif($coupon_count>0){\n\t\t\t\t\t\t\t$data_coupon['coupon_limit'] = $coupon_count - 1;\n\t\t\t\t\t\t$update_toekn = $this -> conn -> updatetablebyid('offer_coupon', 'coupon_id', $coupon_id, $data_coupon);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t$transaction_ids = strtotime(\"now\") . mt_rand(10000000, 99999999);\n\t\t\t\t\t\t$walletrecharge = $this -> conn -> insertnewrecords('wallet_transaction', 'wt_user_id,wt_datetime,wt_type,wt_amount,wt_category,transaction_id,wt_desc,cashbackrecord_id', '\"' . $user_id . '\",\"' . $current_date . '\",\"' . $wt_type . '\",\"' . $coupon_amount . '\",\"' . $w_category . '\",\"' . $transaction_ids . '\",\"' . $w_desc . '\",\"' . $transaction_id . '\"');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$data['wallet_amount'] = $user_wallet;\n\t\t\t\t$update_toekn = $this -> conn -> updatetablebyid('user', 'user_id', $user_id, $data);\n\t\t\t\t$post = array(\"status\" => \"true\", 'message' => \"Add amount successfully\", \"transaction_id\" => $transaction_id, 'add_amount' => $user_amount, 'wallet_amount' => $user_wallet, 'transaction_date' => $current_date);\n\n\t\t\t} else {\n\t\t\t\t$post = array('status' => \"false\", \"message\" => \"Transaction Failed\");\n\t\t\t}\n\t\t} else {\n\t\t\t$post = array('status' => \"false\", \"message\" => \"Missing parameter\", 'recharge_user_id' => $user_id, 'recharge_amount' => $user_amount, 'transection_id' => $transection_id);\n\t\t}\n\t\techo $this -> json($post);\n\t}",
"public function add_to_expense(Request $request) {\n\n Log::info(\"TransactionController->add_to_expense :- Inside \");\n //dd($request->all());\n\n $organization_id = Session::get('organization_id');\n $organization = Organization::findOrFail($organization_id);\n\n $entry = [];\n \n $other_transaction = Transaction::where('id', $request->id)->first();\n\n //dd($other_transaction);\n\n //return false;\n\n\n $transaction_type_name = AccountVoucher::where('id', $other_transaction->transaction_type_id)->first()->name;\n\n $type = null;\n $type_name = \"Transaction\";\n\n if($transaction_type_name == \"purchase_order\") {\n $type = \"sale_order\";\n $type_name = \"Sale Order\";\n } else if($transaction_type_name == \"purchases\") {\n $type = \"sales\";\n $type_name = \"Invoice\";\n } else if($transaction_type_name == \"goods_receipt_note\") {\n $type = \"delivery_note\";\n $type_name = \"Delivery Note\";\n } else if($transaction_type_name == \"sale_order\") {\n $type = \"purchase_order\";\n $type_name = \"Purchase Order\";\n } else if($transaction_type_name == \"sales\" || $transaction_type_name == \"job_invoice\" || $transaction_type_name == \"job_invoice_cash\") {\n $type = \"purchases\";\n $type_name = \"Purchases\";\n } else if($transaction_type_name == \"delivery_note\") {\n $type = \"goods_receipt_note\";\n $type_name = \"Goods Receipt Note\";\n }\n\n if($type != null) {\n\n $transaction_type = AccountVoucher::where('name', 'journal')->where('organization_id', $organization_id)->first();\n\n $other_organization = Organization::findOrFail($other_transaction->organization_id);\n\n $people_exist = People::where('business_id', $other_organization->business_id)\n ->where('organization_id', $organization_id)\n ->first();\n\n if($people_exist == null) {\n\n $business = Business::find($other_organization->business_id);\n\n $business_address_type = BusinessAddressType::find($business->address_type)->id;\n\n $business_communication_address = BusinessCommunicationAddress::select('mobile_no', 'address', 'city_id', 'pin');\n\n $people = new People();\n $people->user_type = 1;\n $people->business_id = $person->id;\n $people->company = $business->alias;\n $people->display_name = $business->alias;\n $people->mobile_no = $business_communication_address->mobile_no;\n $people->organization_id = $organization_id;\n $people->save();\n\n Custom::add_addon('records');\n Custom::add_addon('customer');\n\n if($people->id) {\n $people_address = new PeopleAddress();\n $people_address->people_id = $people->id;\n $people_address->address_type = 0;\n $people_address->address = $business_communication_address->address;\n $people_address->city_id = $business_communication_address->city_id;\n $people_address->pin = $business_communication_address->pin;\n $people_address->save();\n }\n } else {\n $people = $people_exist;\n }\n\n $account_ledgers = AccountLedger::select('account_ledgers.id');\n $account_ledgers->where('business_id', $people->business_id);\n $business_id = $people->business_id;\n $person_id = null;\n\n $account_ledger = $account_ledgers->first();\n\n $impersonal_ledger = AccountLedgerType::where('name', 'impersonal')->first();\n\n if($account_ledger != null){\n $customer_ledger = $account_ledger->id;\n }\n else {\n if($transaction_type->name == \"purchases\") {\n $ledgergroup = AccountGroup::where('name', 'sundry_creditor')->where('organization_id', $organization_id)->first();\n $customer_ledger = Custom::create_ledger($people->display_name, $organization, $people->display_name, $impersonal_ledger->id, $person_id, $business_id, $ledgergroup->id, date('Y-m-d'), 'credit', '0.00', Session::get('ledger_approval'), '1', $organization_id, false);\n } \n else if($transaction_type->name == \"sales\" || $transaction_type->name == \"job_invoice\" || $transaction_type_name == \"job_invoice\") {\n\n $ledgergroup = AccountGroup::where('name', 'sundry_debtor')->where('organization_id', $organization_id)->first();\n\n $customer_ledger = Custom::create_ledger($people->display_name, $organization, $people->display_name, $impersonal_ledger->id, $person_id, $business_id, $ledgergroup->id, date('Y-m-d'), 'debit', '0.00', Session::get('ledger_approval'), '1', $organization_id, false);\n }\n\n }\n\n\n $purchase_account = AccountLedger::where('name', 'purchases')->where('organization_id', $organization_id)->first()->id;\n\n //Item is expense, All expenses are debit\n //Vendor gives the item, Credit the giver\n $entry[] = ['debit_ledger_id' => $purchase_account, 'credit_ledger_id' => $customer_ledger, 'amount' => $other_transaction->total];\n\n usort($entry, function ($item1, $item2) {\n return $item1['debit_ledger_id'] - $item2['debit_ledger_id'];\n });\n\n Custom::add_entry(date('Y-m-d'), $entry, null, $transaction_type->name, $organization_id, 0, false,null, null, null,$other_transaction->id);\n\n //$transaction->entry_id = Custom::add_entry(($transaction->date != null) ? Carbon::parse($transaction->date)->format('Y-m-d') : date('Y-m-d'), $entry, null, $transaction_type->name, $organization_id, 1, false, null, null, null, $request->input('reference_id'), null, null, $transaction->payment_mode_id); \n\n }\n\n $other_transaction->notification_status = 2;\n $other_transaction->save();\n Log::info(\"TransactionController->add_to_expense :- return \");\n\n\n return response()->json(['status' => 1, 'message' => $transaction_type->display_name.config('constants.flash.added'), 'data' => ['url' => route('transaction.index', [$type])]]);\n\n }",
"function report()\n {\n if ($this->acl->otentikasi2($this->title) == TRUE){\n\n $vendor = $this->input->post('cvendor');\n $cur = $this->input->post('ccurrency');\n \n $start = $this->input->post('start');\n $end = $this->input->post('end');\n $acc = $this->input->post('cacc');\n\n $data['currency'] = strtoupper($cur);\n $data['start'] = tglin($start);\n $data['end'] = tglin($end);\n $data['rundate'] = tglin(date('Y-m-d'));\n $data['log'] = $this->decodedd->log;\n\n// $data['purchase_returns'] = $this->model->report($cur,$vendor,$start,$end,$acc)->result();\n \n $reports = null;\n foreach ($this->model->report($cur,$vendor,$start,$end,$acc)->result() as $res) {\n $reports[] = array (\"id\"=>$res->id, \n \"date\"=> tglin($res->dates),\n \"no\"=> \"PR-00\".$res->no,\n \"account\"=>floatval($res->price),\n \"vendor\"=>$res->prefix.' '.$res->name,\n \"amount\"=>floatval($res->total-$res->tax),\n \"tax\"=>floatval($res->tax),\n \"cost\"=>floatval($res->costs),\n \"balance\"=>floatval($res->total-$res->costs),\n \"status\"=> $this->xstatus($res->status)\n ); \n }\n \n $total = $this->model->total($cur,$vendor,$start,$end,$acc);\n $data['total'] = floatval($total['total'] - $total['tax']);\n $data['tax'] = floatval($total['tax']);\n $data['costs'] = floatval($total['costs']);\n $data['balance'] = floatval($total['total'] + $total['costs']);\n $data['items'] = $reports;\n \n $this->output = $data;\n \n }else { $this->reject_token('Invalid Token or Expired..!'); }\n $this->response('content');\n \n }",
"function head() {\n global $_lib;\n\n $query = \"select max(RemittanceDaySequence) from invoicein where RemittanceSendtDateTime='\" . $_lib['sess']->get_session('Date') . \"' and Active=1\";\n #print \"Finn h¿yeste dag sekvens: $query\";\n $daysequence = $_lib['storage']->get_row(array('query' => $query));\n\n $query = \"select max(RemittanceSequence) from invoicein where Active=1\";\n #print \"Finn h¿yeste sekvens: $query\";\n $sequence = $_lib['storage']->get_row(array('query' => $query));\n \n #print \"<h2>Her kommer remitteringsfila på TelePay 2.0.1 formatet</h2>\";\n $transaction = new stdClass();\n $this->transaction->RemittanceSequence = $daysequence->RemittanceSequence + 1; #M kalkuleres og settes\n $this->transaction->RemittanceDaySequence = $daysequence->RemittanceDaySequence; #M kalkuleres og settes\n\n #$this->transaction->BatchID = 99; #M kalkuleres og settes\n $this->transaction->Date = $_lib['sess']->get_session('Date');\n $this->transaction->Datetime = $_lib['sess']->get_session('Datetime');\n $this->transaction->VersionSoftware = '00001.00 LODO';\n \n $old_pattern = array(\"/[^0-9]/\");\n $new_pattern = array(\"\");\n $this->transaction->CustomerOrgNumber = strtolower(preg_replace($old_pattern, $new_pattern , $_lib['sess']->get_companydef('OrgNumber'))); \n $this->transaction->CustomerName = $_lib['sess']->get_companydef('CompanyName');\n $this->transaction->Database = $_SETUP['DB_NAME']['0'];\n \n $this->transaction->NumTransactions = 0;\n $this->transaction->TotalAmount = 0;\n $this->transaction->NumRecords = 0; \n\n if(!$InvoiceO->CustomerBankAccount) { #Sjekke lengde og modulus p kontonummer ogs\n $_lib['message']->Add(\"Betalerkonto mangler\");\n return;\n }\n if(!$this->transaction->CustomerOrgNumber) {\n $_lib['message']->Add(\"Orgnummer/personnummer mangler på betaler\");\n return;\n }\n }",
"function add_money(){\n\t\t$coupon_id=$_REQUEST['coupon_id'];\n\t\t$coupon_amount=$_REQUEST['coupon_amount'];\n\t\t$user_id=$_REQUEST['recharge_user_id'];\n\t\t$user_amount=$_REQUEST['recharge_amount'];\n\t\t$final_amount=$coupon_amount+$user_amount;\n\t//\t$wt_type=$_POST['wt_type']; //1- debit in account, 2- credit in account\n\t\t$wt_type=1; // credit\n\t\t$current_date=date(\"Y-m-d h:i:sa\");\n\t\t$wt_category=1; // 1-Add moeny, 2-Recharge\n\t\t$w_category=6; // Amount Recieved when coupon code apply\n\t\t//$card_no=$_REQUEST['card_number'];\n\t\t//$cvv_no=$_REQUEST['cvv_no'];\n\t\t$w_desc=\"Amount Recieved when add money \".$user_amount .\" with get amount \".$coupon_amount;\n\t\t\t$transaction_id= strtotime(\"now\").mt_rand(10000000, 99999999);\n\t\t//$transaction_id =$_POST['recharge_transaction_id']; // if wt_category=1 then payment gateway transaction id and 2 for recharge id;\n\t\t$wt_desc=\"Add Money\"; // description of transaction like as add moeny, recharge;\n\t\tif(!empty($user_id) && !empty($user_amount) && !empty($transaction_id)){\n\t\t\t$records = $this -> conn -> get_table_row_byidvalue('user', 'user_id', $user_id);\n\t\t\t$wallet_amount = $records['0']['wallet_amount'];\n\t\t\t$user_wallet=$wallet_amount + $final_amount;\n\t\t\t\t\t$add_money = $this -> conn -> insertnewrecords('wallet_transaction','wt_user_id, wt_datetime,wt_type,wt_amount,wt_category,transaction_id,wt_desc', '\"' . $user_id . '\",\"' . $current_date . '\",\"' . $wt_type . '\",\"' . $user_amount . '\",\"' . $wt_category . '\",\"' . $transaction_id . '\",\"' . $wt_desc . '\"');\n\t\t\tif(!empty($add_money)){\n\t\t\t\tif(!empty($coupon_id)){\n\t\t\t\t\t\n\t\t\t\t\t$add_money = $this -> conn -> insertnewrecords('coupon_details','coupon_id, user_id,coupon_apply_date', '\"' . $coupon_id . '\",\"' . $user_id . '\",\"' . $current_date . '\"');\n\t\t\t\t\tif($add_money){\n\t\t\t\t\t\t$transaction_ids= strtotime(\"now\").mt_rand(10000000, 99999999);\n\t\t\t\t\t\t$walletrecharge = $this -> conn -> insertnewrecords('wallet_transaction','wt_user_id,wt_datetime,wt_type,wt_amount,wt_category,transaction_id,wt_desc,cashbackrecord_id', '\"' . $user_id . '\",\"' . $current_date . '\",\"' . $wt_type . '\",\"' . $coupon_amount . '\",\"' . $w_category . '\",\"' .$transaction_ids . '\",\"' . $w_desc . '\",\"' . $transaction_id . '\"');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\t $data['wallet_amount']=$user_wallet;\n\t\t\t\t\t$update_toekn=$this -> conn -> updatetablebyid('user','user_id',$user_id, $data);\n\t\t\t\t\t$post = array(\"status\" => \"true\",'message'=>\"Add amount successfully\", \"transaction_id\" =>$transaction_id,'add_amount'=>$user_amount,'wallet_amount'=>$user_wallet,'transaction_date'=>$current_date,'card_no'=>$card_no);\n\t\t\t\t\t\n\t\t\t}else{\n\t\t\t\t$post = array('status' => \"false\",\"message\" => \"Transaction Failed\");\n\t\t\t}\n\t\t}else{\n\t\t$post = array('status' => \"false\",\"message\" => \"Missing parameter\",'recharge_user_id'=>$user_id,'recharge_amount'=>$user_amount,'card_number'=>$card_no,'cvv_no'=>$cvv_no);\n\t\t}\n\t\techo $this -> json($post);\n\t}",
"function applyWallet($Adv,$amount,$lastrate,$transferAmount){ \r\n\t$wallet = Wallet::get(array(\"id_user\" => $_SESSION[\"gak_id\"]));\r\n\t$totalToman = $amount*$lastrate + $lastrate*$transferAmount;\r\n\tif ($wallet->amount < $totalToman){\r\n\t\t$_SESSION['result']=\" موجودی کیف پول شما از مبلغ درخواست کمتر است. \";\r\n\t\t$_SESSION['alert']=\"warning\";\r\n\t\theader(\"location: /dinero/deal?amount=\".$_GET['amount'].\"&id=\".$_GET['id'].\"&balance=low\");\r\n\t}else{\r\n\t\t//update wallet and add transaction\r\n\t\t//insert\r\n\t\t$insert_wallettransaction=array(\r\n\t\t\t\t\"id_wallet\" => $wallet->id,\r\n\t\t\t\t\"type\" => \"withdraw\",\r\n\t\t\t\t\"amount\" => $totalToman,\r\n\t\t\t\t\"status\" => \"confirm\",\r\n\t\t\t\t\"time\" => date(\"Y-m-d H:i:s\")\r\n\t\t);\r\n\t\t$walletTransaction = Wallettransactions::insert($insert_wallettransaction);\r\n\t\t//update\r\n\t\t$arr_update=array(\r\n\t\t\t\t\"id\" => $wallet->id,\r\n\t\t\t\t\"amount\" => $wallet->amount - $totalToman\r\n\t\t);\r\n\t\tWallet::update($arr_update);\r\n\t\t//log\r\n\t\tAccountkitlog::insert(array(\"iduser\" => $_SESSION[\"gak_id\"],\r\n\t\t\t\t\"date\" => date(\"Y-m-d H:i:s\"), \"title\" => \"walletWithdraw\"));\r\n\t\t//trade\r\n\t\t\r\n\t\t$arr_insert=array(\r\n\t\t\t\t\"id_buyer\" => $_SESSION[\"gak_id\"],\r\n\t\t\t\t\"id_seller\" => $Adv->id_user,\r\n\t\t\t\t\"id_adv\" => $Adv->id,\r\n\t\t\t\t\"amount\" => $amount,\r\n\t\t\t\t\"exchange_rate\" => $lastrate,\r\n\t\t\t\t\"time\" => date(\"Y-m-d H:i:s\"),\r\n\t\t\t\t\"trade_status\" => \"buyerpaid\",\r\n\t\t\t\t\"buyerpay_status\" => \"confirm\",\r\n\t\t\t\t\"sellerpay_status\" => \"pending\",\r\n\t\t\t\t\"buyerpay_details\" => \"id:\".$walletTransaction.\"|Payment:Wallet|refID:\".date(\"YmdHis\"),\r\n\t\t\t\t\"sellerpay_details\" => \"\"\r\n\t\t);\r\n\t\t$Trade = Dinerotrade::insert($arr_insert);\r\n\t\t\r\n\t\t//update text transaction wallet\r\n\t\tWallettransactions::update(array(\"id\"=>$walletTransaction, \"text\"=>\"Withdraw from wallet, Trade #\".$Trade*951753 ));\r\n\t\t\r\n\t\t//update adv\r\n\t\t$updateAmount = $Adv->amount - $amount;\r\n\t\t$arr_update=array(\r\n\t\t\t\t\"id\" => $Adv->id,\r\n\t\t\t\t\"amount\" => $updateAmount\r\n\t\t);\r\n\t\tDineroadv::update($arr_update);\r\n\t\t\r\n\t\t//user logs\r\n\t\tAccountkitlog::insert(array(\r\n\t\t\t\t\"iduser\" => $_SESSION[\"gak_id\"],\r\n\t\t\t\t\"date\" => date(\"Y-m-d H:i:s\"),\r\n\t\t\t\t\"title\" => \"tradePaid\"));\r\n\t\t\t\r\n\t\t//send emails and sms\r\n\t\t$checkTrade=Dinerotrade::get(array(\"id\" => $Trade,\"id_buyer\" => $_SESSION[\"gak_id\"]));\r\n\t\t$seller = AccountKit::get(array(\"id\" => $checkTrade->id_seller));\r\n\t\t$buyer = AccountKit::get(array(\"id\" => $checkTrade->id_buyer));\r\n\t\t$sellerFullname = Acountkitparam::get(array(\"iduser\" => $checkTrade->id_seller, \"type\" => \"fullname\"));\r\n\t\t$buyerFullname = Acountkitparam::get(array(\"iduser\" => $checkTrade->id_buyer, \"type\" => \"fullname\"));\r\n\t\t$buyerBankname= Acountkitparam::get(array(\"iduser\" => $checkTrade->id_buyer, \"type\" => \"bankname\"));\r\n\t\t$buyerIban= Acountkitparam::get(array(\"iduser\" => $checkTrade->id_buyer, \"type\" => \"iban\"));\r\n\t\t$transferAmount = findTransferAmount($checkTrade->amount);\r\n\t\t$token = $GLOBALS['GCMS_SETTING']['dinero']['smstoken'];\r\n\t\t$params = array(\r\n\t\t\t\t'to' => $seller->number,\r\n\t\t\t\t'from' => 'Info',\r\n\t\t\t\t'message' => \"Trade for \".$checkTrade->amount .\"€ \"\r\n\t\t\t\t.\"https://24dinero.com/\"\r\n\t\t\t\t,\r\n\t\t);\r\n\t\t//sms_send($params,$token);\r\n\t\t\r\n\t\t//start send email\r\n\t\t$bodyStatusDineroSeller= '\r\n\t\t\t\t\t\t<div>\r\n <a href=\"#\"\r\n style=\"background-color:#D84A38;padding:10px;color:#ffffff;display:inline-block;font-family:tahoma;font-size:13px;font-weight:bold;line-height:33px;text-align:center;text-decoration:none;-webkit-text-size-adjust:none;\">\r\n\t\t\t\t\t\t\t\tدرخواست انتقال یورو، لطفا سریعا اقدام کنید\r\n\t\t\t\t\t\t\t </a>\r\n </div>\r\n\t\t\t\t\t';\r\n\t\t\r\n\t\t$bodyInfoSeller= \"\r\n\t\t\t\t <div>\r\n\t\t\t\t\r\nPayment has confirmed for your advertisements on 24dinero.com.\r\n <br>\r\nTransfer amount:\".$checkTrade->amount .\"€ <br>\r\nBank: \".$buyerBankname->text.\"<br>\r\nBeneficiary Name: \".$buyerFullname->text.\"<br>\r\nIBAN: \".$buyerIban->text.\"<br>\r\n\t\t\r\nYou can confirm or cancel the transaction on the following link: <br>\r\n\t\t\r\n<a href=\\\"https://\".$_SERVER['HTTP_HOST'].\"/dinero/transact/\".$checkTrade->id.\"\\\">\r\n\t\t\t\t\t\thttps://\".$_SERVER['HTTP_HOST'].\"/dinero/transact/\".$checkTrade->id.\"\r\n\t\t\t\t\t\t</a>\r\n\t\t\t\t\t\t\t\t\r\n </div>\r\n\t\t\t\t\t\";\r\n\t\t$bodyTransactionSeller= '\r\n\t\t\t\t\t<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"600\" class=\"w320\" style=\"height:100%;\">\r\n <tr>\r\n <td valign=\"top\" class=\"mobile-padding\" style=\"padding:20px;\">\r\n <table cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">\r\n <tr>\r\n <td style=\"padding-right:20px\">\r\n <b>Euro request</b>\r\n </td>\r\n <td style=\"padding-right:20px\">\r\n <b>Euro Rate</b>\r\n </td>\r\n <td>\r\n <b>Total Toman</b>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style=\"padding-top:5px;padding-right:20px; border-top:1px solid #E7E7E7; \">\r\n '.number_format($checkTrade->amount).'\r\n </td>\r\n <td style=\"padding-top:5px;padding-right:20px; border-top:1px solid #E7E7E7;\">\r\n '.number_format($checkTrade->exchange_rate).'\r\n </td>\r\n <td style=\"padding-top:5px; border-top:1px solid #E7E7E7;\" class=\"mobile\">\r\n '.number_format($checkTrade->exchange_rate*$checkTrade->amount).'\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style=\"padding-top:5px;padding-right:20px; border-top:1px solid #E7E7E7; \">\r\n\t\t\t\t\t\t'.number_format(floor($checkTrade->amount*2.5/100)).' <br>\r\n ٪2.5 Commission\r\n </td>\r\n <td style=\"padding-top:5px;padding-right:20px; border-top:1px solid #E7E7E7;\">\r\n '.number_format($checkTrade->exchange_rate).'\r\n </td>\r\n <td style=\"padding-top:5px; border-top:1px solid #E7E7E7;\" class=\"mobile\">\r\n '.number_format((floor($checkTrade->amount*2.5/100)) * $checkTrade->exchange_rate).'\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style=\"padding-top:5px;padding-right:20px; border-top:1px solid #E7E7E7; \">\r\n \t\t\r\n </td>\r\n <td style=\"padding-top:5px;padding-right:20px; border-top:1px solid #E7E7E7;\">\r\n Total amount:\r\n </td>\r\n <td style=\"padding-top:5px; border-top:1px solid #E7E7E7;\" class=\"mobile\">\r\n <b>'.number_format($checkTrade->exchange_rate*$checkTrade->amount+ (floor($checkTrade->amount*2.5/100)) * $checkTrade->exchange_rate).'</b>\r\n </td>\r\n </tr>\r\n </table>\r\n <table cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">\r\n <tr>\r\n <td style=\"padding-top:35px;\">\r\n <table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\r\n <tr>\r\n \t\t\r\n <td style=\"padding:0px 0 15px 30px;\" class=\"mobile-block\">\r\n <table cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">\r\n \t\t\r\n <tr>\r\n <td>Euro Request: </td>\r\n <td> €'.number_format($checkTrade->amount).'</td>\r\n </tr>\r\n \t\t\r\n <tr>\r\n <td>Due by: </td>\r\n <td> '.date(\"Y-m-d\").'</td>\r\n </tr>\r\n </table>\r\n </td>\r\n </tr>\r\n \t\t\r\n </table>\r\n </td>\r\n </tr>\r\n </table>\r\n </td>\r\n </tr>\r\n </table>\r\n\t\t\t\t\t';\r\n\t\t$bodyStatusDineroBuyer= '\r\n\t\t\t\t\t\t<div>\r\n <a href=\"#\"\r\n style=\"background-color:#016910;padding:10px;color:#ffffff;display:inline-block;font-family:tahoma;font-size:13px;font-weight:bold;line-height:33px;text-align:center;text-decoration:none;-webkit-text-size-adjust:none;\">\r\n\t\t\t\t\t\t\t\tدرخواست انتقال یورو\r\n\t\t\t\t\t\t\t </a>\r\n </div>\r\n\t\t\t\t\t';\r\n\t\t\r\n\t\t$bodyInfoBuyer= \"\r\n\t\t\t\t <div>\r\n\t\t\t\t\r\nPayment has confirmed for your trade on 24dinero.com.\r\n <br>\r\nTransfer amount:\".$checkTrade->amount .\"€ <br>\r\nBank: \".$buyerBankname->text.\"<br>\r\nBeneficiary Name: \".$buyerFullname->text.\"<br>\r\nIBAN: \".$buyerIban->text.\"<br>\r\n\t\t\r\nYou can follow the transaction on the following link: <br>\r\n\t\t\r\n<a href=\\\"https://\".$_SERVER['HTTP_HOST'].\"/dinero/trade/\".$checkTrade->id.\"\\\">\r\n\t\t\t\t\t\thttps://\".$_SERVER['HTTP_HOST'].\"/dinero/trade/\".$checkTrade->id.\"\r\n\t\t\t\t\t\t</a>\r\n\t\t\t\t\t\t\t\t\r\n </div>\r\n\t\t\t\t\t\";\r\n\t\t$bodyTransactionBuyer= '\r\n\t\t\t\t\t<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"600\" class=\"w320\" style=\"height:100%;\">\r\n <tr>\r\n <td valign=\"top\" class=\"mobile-padding\" style=\"padding:20px;\">\r\n <table cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">\r\n <tr>\r\n <td style=\"padding-right:20px\">\r\n <b>Euro request</b>\r\n </td>\r\n <td style=\"padding-right:20px\">\r\n <b>Euro Rate</b>\r\n </td>\r\n <td>\r\n <b>Total Toman</b>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style=\"padding-top:5px;padding-right:20px; border-top:1px solid #E7E7E7; \">\r\n '.number_format($checkTrade->amount).'\r\n </td>\r\n <td style=\"padding-top:5px;padding-right:20px; border-top:1px solid #E7E7E7;\">\r\n '.number_format($checkTrade->exchange_rate).'\r\n </td>\r\n <td style=\"padding-top:5px; border-top:1px solid #E7E7E7;\" class=\"mobile\">\r\n '.number_format($checkTrade->exchange_rate*$checkTrade->amount).'\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style=\"padding-top:5px;padding-right:20px; border-top:1px solid #E7E7E7; \">\r\n\t\t\t\t\t\t'.number_format($transferAmount).' <br>\r\n Transfer Amount\r\n </td>\r\n <td style=\"padding-top:5px;padding-right:20px; border-top:1px solid #E7E7E7;\">\r\n '.number_format($checkTrade->exchange_rate).'\r\n </td>\r\n <td style=\"padding-top:5px; border-top:1px solid #E7E7E7;\" class=\"mobile\">\r\n '.number_format($transferAmount* $checkTrade->exchange_rate).'\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style=\"padding-top:5px;padding-right:20px; border-top:1px solid #E7E7E7; \">\r\n \t\t\r\n </td>\r\n <td style=\"padding-top:5px;padding-right:20px; border-top:1px solid #E7E7E7;\">\r\n Total amount:\r\n </td>\r\n <td style=\"padding-top:5px; border-top:1px solid #E7E7E7;\" class=\"mobile\">\r\n <b>'.number_format($checkTrade->exchange_rate*$checkTrade->amount+ $transferAmount* $checkTrade->exchange_rate).'</b>\r\n </td>\r\n </tr>\r\n </table>\r\n <table cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">\r\n <tr>\r\n <td style=\"padding-top:35px;\">\r\n <table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\r\n <tr>\r\n \t\t\r\n <td style=\"padding:0px 0 15px 30px;\" class=\"mobile-block\">\r\n <table cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">\r\n \t\t\r\n <tr>\r\n <td>Euro Request: </td>\r\n <td> €'.number_format($checkTrade->amount).'</td>\r\n </tr>\r\n \t\t\r\n <tr>\r\n <td>Due by: </td>\r\n <td> '.date(\"Y-m-d\").'</td>\r\n </tr>\r\n </table>\r\n </td>\r\n </tr>\r\n \t\t\r\n </table>\r\n </td>\r\n </tr>\r\n </table>\r\n </td>\r\n </tr>\r\n </table>\r\n\t\t\t\t\t';\r\n\t\t//sendingblue email\r\n\t\trequire_once(__COREROOT__.\"/module/dinero/libs/Mailin.php\");\r\n\t\trequire_once(__COREROOT__.\"/module/dinero/controller/emailTemplate.php\");\r\n\t\t$mailin = new Mailin('https://api.sendinblue.com/v2.0',$GLOBALS['GCMS_SETTING']['dinero']['sendinblueAPIKey']);\r\n\t\t//seller\r\n\t\t$maildata = array( \"to\" => array($seller->email=> $sellerFullname->text),\r\n\t\t\t\t\"from\" => array($GLOBALS['GCMS_SETTING']['dinero']['sendinblueSenderEmail']),\r\n\t\t\t\t\"subject\" => \"Trade Paid \".$_SERVER['HTTP_HOST'],\r\n\t\t\t\t\"html\" => emailTemp($bodyStatusDineroSeller,$bodyInfoSeller,$bodyTransactionSeller),\r\n\t\t\t\t\"headers\" => array(\"Content-Type\"=> \"text/html; charset=iso-8859-1\",\"X-param1\"=> \"value1\", \"X-param2\"=> \"value2\",\"X-Mailin-custom\"=>\"my custom value\", \"X-Mailin-IP\"=> \"102.102.1.2\", \"X-Mailin-Tag\" => \"My tag\")\r\n\t\t);\r\n\t\t$mailin->send_email($maildata);\r\n\t\t//buyer\r\n\t\t$maildata = array( \"to\" => array($buyer->email=> $buyerFullname->text),\r\n\t\t\t\t\"from\" => array($GLOBALS['GCMS_SETTING']['dinero']['sendinblueSenderEmail']),\r\n\t\t\t\t\"subject\" => \"Trade Paid \".$_SERVER['HTTP_HOST'],\r\n\t\t\t\t\"html\" => emailTemp($bodyStatusDineroBuyer,$bodyInfoBuyer,$bodyTransactionBuyer),\r\n\t\t\t\t\"headers\" => array(\"Content-Type\"=> \"text/html; charset=iso-8859-1\",\"X-param1\"=> \"value1\", \"X-param2\"=> \"value2\",\"X-Mailin-custom\"=>\"my custom value\", \"X-Mailin-IP\"=> \"102.102.1.2\", \"X-Mailin-Tag\" => \"My tag\")\r\n\t\t);\r\n\t\t$mailin->send_email($maildata);\r\n\t\t//\\\\\\\\\\end send email\r\n\t\t\r\n\t\t$_SESSION['result']=\"پرداخت شما با موفقیت انجام شد\";\r\n\t\t$_SESSION['alert']=\"success\";\r\n\t\theader(\"location: /dinero/trade/\".$Trade);\r\n\t\t\r\n\t}\r\n\t\r\n}",
"public function store(Request $request)\n {\n $this->validate($request, [\n 'transaction_date' => 'required',\n 'transaction_code' => 'required',\n 'account_number' => 'required',\n 'amount' => 'required|numeric',\n 'narration' => 'required',\n 'created_by' => 'required',\n 'payment_to' => 'required'\n ]);\n \n $transaction = new Transaction();\n $lastTrans = \\App\\Transaction::all()->pop();\n if (!empty($lastTrans)) {\n $lastId= $lastTrans->id;\n } else {\n $lastId=0;\n }\n if ($request->transaction_code==\"DOB\") {\n $transaction->balance=$request->amount;\n $transaction->amount_paid=0;\n } else {\n $transaction->amount_paid=$request->amount;\n $transaction->balance=0;\n }\n \n $transaction->trn_ref_no = \"MPost\" . \"-\" .$request->payment_to . \"-\" .($lastId +1);\n $transaction->transaction_date = $request->transaction_date;\n $transaction->product_type = null;\n $transaction->liters = 0;\n $transaction->rate = null;\n $transaction->total_cost = null;\n $transaction->narration = $request->narration;\n $transaction->account_number=$request->account_number;\n $transaction->transaction_code = $request->transaction_code;\n $customer=Customer::where(\"customer_number\", $request->payment_to)->get();\n if (isset($customer[0]->customer_name)) {\n $customerName= $customer[0]->customer_name;\n } else {\n $customerName=\"\";\n }\n $transaction->customer_name = $customerName;\n \n \n $transaction->shortages = 0;\n \n $supplier=\"\";\n $supplier=Supplier::where(\"supplier_number\", $request->payment_to)->get();\n if (isset($supplier[0]->supplier_name)) {\n $supplierName=$supplier[0]->supplier_name;\n } else {\n $supplierName=\"\";\n }\n \n $transaction->supplier_name = $supplierName;\n \n \n $transaction->unit_price = 0;\n $transaction->payment_mode = \"N/A\";\n //$transaction->approved_by\n\n $transaction->save();\n Session::flash('flash_message', 'Record successfully added!');\n\n return redirect()->back();\n }",
"public function storledger($account_id,$account_type2,$acc_type,$debit,$credit,$transection,$ref_id,$date){\n //initialize $balance variable\n \n //checking if dueamount not = 0 to store supplier ledger\n $this->assetledger($account_id,$account_type2,$acc_type,$debit,$credit,$transection,$ref_id,$date);\n $this->liabilityledger($account_id,$account_type2,$acc_type,$debit,$credit,$transection,$ref_id,$date);\n $this->capitalledger($account_id,$account_type2,$acc_type,$debit,$credit,$transection,$ref_id,$date);\n $this->incomeledger($account_id,$account_type2,$acc_type,$debit,$credit,$transection,$ref_id,$date);\n $this->expensledger($account_id,$account_type2,$acc_type,$debit,$credit,$transection,$ref_id,$date);\n \n }"
] |
[
"0.60463804",
"0.59674126",
"0.5940975",
"0.5824471",
"0.5780594",
"0.57514435",
"0.5678832",
"0.5644947",
"0.5624733",
"0.5618825",
"0.55744594",
"0.5569388",
"0.55449396",
"0.55279714",
"0.55158436",
"0.5509225",
"0.5498737",
"0.54945636",
"0.5472877",
"0.54546386",
"0.5449325",
"0.54472995",
"0.5445723",
"0.5435182",
"0.54343194",
"0.5412942",
"0.5397033",
"0.5392736",
"0.53915465",
"0.53910923"
] |
0.67400306
|
0
|
Update user balance after logging the transaction
|
private static function logTransactionUpdateBalance($userId,$transactionType,$amount){
if($transactionType != 'charge'){
// Update User Balance
$User = User::where('id',$userId)->select('id','balance')->first();
if($transactionType == 'withdraw'){
$User->balance = $User->balance - $amount;
}
if(in_array($transactionType,['refund','profit'])){
$User->balance = $User->balance + $amount;
}
if($User->balance < 0){
$User->balance = 0;
}
$User->save();
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"private function updateBalance()\n {\n if (!auth()->user()->hasRole('admin')) {\n auth()->user()->update([\n 'credit' => auth()->user()->credit - $this->totalCost()\n ]);\n }\n }",
"public function update_user_balance($user_id)\n\t\t{\n\t\t\t$this->is_login();\n\t\t\t$form_field = 'user_balance_'.$user_id;\n\t\t\tif($this->input->post($form_field))\n\t\t\t{\n\t\t\t\t$user_data['credit'] = $this->input->post($form_field);\n\t\t\t\t$this->load->model('user_profiles', 'up');\n\t\t\t\t$this->up->update($user_id, $user_data);\n\t\t\t}\n\t\t\tredirect('/admin/user_list','refresh');\n\t\t}",
"function updateUserBalance($user, $sum){\r\n global $pdo;\r\n $stmt = $pdo->prepare('UPDATE users SET UserBalance = UserBalance + :UserBalance WHERE UserID = :UserID');\r\n $stmt->execute(array(':UserBalance' => $sum, ':UserID' => $user));\r\n}",
"protected function updateUserProfileInfo($user_id, $bid_amount){\n\t\t$user_model=UserInfo::model()->findByPk($user_id);\n\t\tif($user_model!==null){\n\t\t\t$user_model->total_debits = ($user_model->total_debits + $bid_amount);\n\t\t\t$user_model->closing_balance = ($user_model->closing_balance - $bid_amount);\n\t\t\t$user_model->save();\n\t\t\treturn $user_model->closing_balance;\n\t\t}\n\t}",
"public function update(User $user) {\n \t$this->validate(request(), [\n \t\t'balance' => array('required', 'regex:/^\\d*(\\.\\d{2})?$/')\n \t]);\n\n \t$req = request()->all()['balance'];\n \t$new = $user->balance + $req;\n\n \t$user->update(['balance' => $new]);\n \treturn redirect('users/');\n }",
"public function updateUserAccountBalance($targetUser, $addedAmt, $userID){\n //get user's accout balance\n $accBal = intval($this->UserAaccBalance($targetUser));\n //add it to the amount funded\n $newBal = $accBal + $addedAmt;\n //update back the user bal\n $newBalFields=[\n 'balance'=>$newBal\n ];\n if(!$this->update($userID, $newBalFields)) //LOG ERROR ACTION\n return false;\n return true;\n }",
"public function update($amount)\n {\n $currentBalance = auth()->user()->balance->amount;\n $newAmount = $currentBalance + $amount;\n auth()->user()->balance()->update(['amount' => $newAmount]);\n }",
"function updateBalance($balance){\r\n //$db = new Database();\r\n // $conn = $db->getConnect();\r\n \r\n //run query to get balance\r\n $sql = \"UPDATE `SAVING` SET BALANCE= $balance\";\r\n $result = $this->conn->query($sql);\r\n \r\n if ($result){ \r\n //update successful\r\n //$conn->close();\r\n return 1;\r\n }\r\n else{\r\n // update failed\r\n //$conn->close();\r\n return 0;\r\n }\r\n }",
"function _updateTransaction($ItemUser)\r\n {\r\n //add amount to wallet\r\n $data['Transaction']['user_id'] = $ItemUser['user_id'];\r\n $data['Transaction']['foreign_id'] = ConstUserIds::Admin;\r\n $data['Transaction']['class'] = 'SecondUser';\r\n $data['Transaction']['amount'] = $ItemUser['discount_amount'];\r\n $data['Transaction']['transaction_type_id'] = ConstTransactionTypes::AddedToWallet;\r\n $data['Transaction']['payment_gateway_id'] = $ItemUser['payment_gateway_id'];\r\n $transaction_id = $this->User->Transaction->log($data);\r\n if (!empty($transaction_id)) {\r\n $this->User->updateAll(array(\r\n 'User.available_balance_amount' => 'User.available_balance_amount +' . $ItemUser['discount_amount']\r\n ) , array(\r\n 'User.id' => $ItemUser['user_id']\r\n ));\r\n }\r\n //Buy item transaction\r\n $transaction['Transaction']['user_id'] = $ItemUser['user_id'];\r\n $transaction['Transaction']['foreign_id'] = $ItemUser['id'];\r\n $transaction['Transaction']['class'] = 'ItemUser';\r\n $transaction['Transaction']['amount'] = $ItemUser['discount_amount'];\r\n $transaction['Transaction']['transaction_type_id'] = (!empty($ItemUser['is_gift'])) ? ConstTransactionTypes::ItemGift : ConstTransactionTypes::BuyItem;\r\n $transaction['Transaction']['payment_gateway_id'] = $ItemUser['payment_gateway_id'];\r\n if (!empty($ItemUser['rate'])) {\r\n $transaction['Transaction']['currency_id'] = $ItemUser['currency_id'];\r\n $transaction['Transaction']['converted_currency_id'] = $ItemUser['converted_currency_id'];\r\n $transaction['Transaction']['converted_amount'] = $ItemUser['authorize_amt'];\r\n $transaction['Transaction']['rate'] = $ItemUser['rate'];\r\n }\r\n $this->User->Transaction->log($transaction);\r\n //user update\r\n $this->User->updateAll(array(\r\n 'User.available_balance_amount' => 'User.available_balance_amount -' . $ItemUser['discount_amount']\r\n ) , array(\r\n 'User.id' => $ItemUser['user_id']\r\n ));\r\n }",
"public function updateBankerCredit()\n {\n $user = User::whereHas(\"roles\", function($q){$q->where(\"name\", \"Banker\");})->first();\n\n $total = Credit::where('credit_type', 0)->sum('value');\n $user->free_credits = $total;\n $total = Credit::where('credit_type', 1)->sum('value');\n $user->paid_credits = $total;\n $user->save();\n }",
"public static function syncAccountBalance($user){\n if (!($user instanceof \\Users)) {\n $user = \\Users::retrieveById($user);\n }\n\n if (!$user) {\n return false;\n }\n\n if (!$user->getAccountNo()) {\n return false;\n }\n\n $logger = \\SeuDo\\Logger::factory('accountant');\n\n $accountInfo = \\SeuDo\\Accountant\\Util::getUserAccountDetail($user);\n\n if ($accountInfo['balance'] != $user->getAccountBalance()) {\n $user->setAccountBalance($accountInfo['balance']);\n if ($user->save()) {\n $user->dispatch('onAccountBalanceChanged', new \\SeuDo\\Event\\User($user));\n $logger->info('Sync user accountant balance. Account no: ' .$user->getAccountNo());\n return true;\n } else {\n $context = (!$user->isValid())? $user->getValidationFailuresMessage(\"\\n\") : '';\n $logger->error('Fail to save user account balance. ' .$context);\n return false;\n }\n }\n\n return true;\n }",
"public function addBalance(KittyInterface $kitty, UserInterface $user, $balance);",
"public function balance($user_name)\n {\n $vitals = $this->private_user_data($user_name, 'vitals');\n return $vitals->balance;\n }",
"public function UpdateAccountBalances () \r\n {\r\n $table = \"BALANCE\";\r\n $query = \"DROP TABLE IF EXISTS ${table}\";\r\n Balance::Event ($query, \"\");\r\n if (!mysql_query($query, self::$db)) \r\n {\r\n Balance::Error (\"Can't remove old ${table} table\", mysql_error(self::$db));\r\n return (false);\r\n }\r\n $query = \"CREATE TEMPORARY TABLE ${table} SELECT ReceiptID AS AccountID, SUM(Total) As Receipts, (0) AS Payments FROM Transaction GROUP BY ReceiptID ORDER BY ReceiptID\";\r\n Balance::Event ($query, \"\");\r\n if (!mysql_query($query, self::$db)) \r\n {\r\n Balance::Error (\"Can't compute ${table} table Receipts\", mysql_error(self::$db));\r\n return (false);\r\n }\r\n $query = \"INSERT INTO ${table} SELECT PaymentID AS AccountID, (0) AS Receipts, SUM(Total) AS Payments FROM Transaction GROUP BY PaymentID ORDER BY PaymentID\";\r\n Balance::Event ($query, \"\");\r\n if (!mysql_query($query, self::$db)) \r\n {\r\n Balance::Error (\"Can't compute ${table} table Payments\", mysql_error(self::$db));\r\n return (false);\r\n }\r\n $query = \"UPDATE Account SET Receipts=(0.00), Payments=(0.00), Balance=(0.00)\";\r\n Balance::Event ($query, \"\");\r\n if (!mysql_query($query, self::$db)) \r\n {\r\n Balance::Error (\"Can't clear Account table balances\", mysql_error(self::$db));\r\n return (false);\r\n }\r\n $query = \"UPDATE Account INNER JOIN ${table} ON ID=AccountID SET Account.Receipts=${table}.Receipts\";\r\n Balance::Event ($query, \"\");\r\n if (!mysql_query($query, self::$db)) \r\n {\r\n Balance::Error (\"Can't update Account table Receipts\", mysql_error(self::$db));\r\n return (false);\r\n }\r\n $query = \"UPDATE Account INNER JOIN ${table} ON ID=AccountID SET Account.Payments=${table}.Payments\";\r\n Balance::Event ($query, \"\");\r\n if (!mysql_query($query, self::$db)) \r\n {\r\n Balance::Error (\"Can't update Account table Payments\", mysql_error(self::$db));\r\n return (false);\r\n }\r\n $query = \"DROP TABLE IF EXISTS ${table}\";\r\n Balance::Event ($query, \"\");\r\n if (!mysql_query($query, self::$db)) \r\n {\r\n Balance::Error (\"Can't remove new ${table} table\", mysql_error(self::$db));\r\n return (false);\r\n }\r\n return (true);\r\n }",
"function deposit($amount) {\n $this->balance += $amount;\n }",
"function withdrawal($account, $amount, $id_user) {\r\n\r\n //Crear la conexión\r\n $base = conection();\r\n\r\n //Verificar que el usuario tenga disponible ese dinero\r\n $sql = \"SELECT balance, pending FROM users WHERE id = :id_user\";\r\n\r\n //Preparar consulta\r\n $result = $base->prepare($sql);\r\n\r\n //Ejecutar consulta\r\n $result->execute(array(\":id_user\"=>$id_user));\r\n\r\n //Contar registros encontrados\r\n $count = $result->rowCount();\r\n \r\n //Verificar si se ingresó el registro\r\n if ($count > 0) {\r\n\r\n while ($row=$result->fetch(PDO::FETCH_ASSOC)) {\r\n $balance = $row[\"balance\"];\r\n $pending = $row[\"pending\"];\r\n }\r\n\r\n if ($balance >= $amount) {\r\n\r\n //Restamos el dienro al usuario\r\n $new_balance = $balance - $amount;\r\n $new_pending = $pending + $amount;\r\n \r\n //Actualizamos el balance del usuario y agregamos el dinero pendiente\r\n $sql_new_balance = \"UPDATE `users` SET `balance`= :balance, `pending`= :pending WHERE id = :id_user\";\r\n\r\n //Preparar consulta\r\n $result_new_balance = $base->prepare($sql_new_balance);\r\n\r\n //Ejecutar consulta\r\n $result_new_balance->execute(array(\":balance\"=>$new_balance, \":pending\"=>$new_pending, \":id_user\"=>$id_user));\r\n\r\n //Actualizamos el balance del usuario y agregamos el dinero pendiente\r\n $sql_withdrawal = \"INSERT INTO `withdrawal`(`account`, `amount`, `date`, `id_user`) VALUES (:account, :amount , NOW(), :id_user)\";\r\n\r\n //Preparar consulta\r\n $result_withdrawal = $base->prepare($sql_withdrawal);\r\n\r\n //Ejecutar consulta\r\n $result_withdrawal->execute(array(\":account\"=>$account, \":amount\"=>$amount, \":id_user\"=>$id_user));\r\n\r\n $count_withdrawal = $result_withdrawal->rowCount();\r\n\r\n if ($count_withdrawal > 0) {\r\n\r\n //Enviar email\r\n $msg = \"The user with the id $id_user has requested a withdrawal in the amount of $amount for their Payeer account $account\";\r\n \r\n mail(\"[email protected]\", \"New Withdrawal request - $id_user\", $msg);\r\n\r\n return \"<b>Your withdrawal request has been sent</b>\\nIn less than 24 hours your order will be processed\";\r\n }\r\n\r\n }else {\r\n return \"You don't have enough funds\";\r\n }\r\n \r\n }else {\r\n return \"fatal error 3\";\r\n }\r\n\r\n}",
"public function update_account() {\n global $dbconfig;\n\n $user_id = $this->params['user_id'];\n $status = isset($this->params['status']) ? $this->params['status'] : BLOCKED;\n $account_dbobj = $this->params['account_dbobj'];\n $user_status = BLOCKED;\n $store_status = PENDING;\n\n if($status === ACTIVATED) {\n $user_status = CREATED;\n $store_status = PENDING;\n }\n\n // update users table\n $user_obj = new User($account_dbobj, $user_id);\n $user_obj->setStatus($status);\n $user_obj->save();\n\n $user = BaseModel::findCachedOne($dbconfig->account->name . \".user?id=$user_id\");\n if(!empty($user['store_id'])){\n $store_id = $user['store_id'];\n // store need to manually launch\n $store_obj = new Store($account_dbobj, $store_id);\n if($store_obj->getId()) {\n $store_obj->setStatus($store_status);\n $store_obj->save();\n if($store_status != ACTIVATED){\n GlobalProductsMapper::deleteProductsInStore($account_dbobj, $store_id);\n }\n }\n }\n }",
"function deposit($connection,$amount,$accno){\r\n try {\r\n $connection->beginTransaction();\r\n\r\n $accno = $_SESSION['accno'];\r\n $sql = \"UPDATE _accounts SET balance= :balance WHERE accno = :account\";\r\n $statement = $connection->prepare($sql);\r\n\r\n\r\n $final_bal = $amount + Services::getforAccountsBalance($connection,$accno);\r\n //do not deposit to self\r\n if($accno ==$_SESSION['accno']){\r\n return false;\r\n };\r\n //update balance\r\n $statement->execute(array(':balance' => $final_bal,':account'=>$accno));\r\n\r\n if($statement->rowCount()<1){\r\n return false;\r\n }\r\n //update transaction history\r\n $insert_sql = \"INSERT INTO _transactionshistory (accno,date,debit,credit,\r\n balance) VALUES(:accno,:date,:debit,:credit,:balance)\";\r\n $stmt = $connection->prepare($insert_sql);\r\n $stmt->execute(array(':accno'=>$accno,':date'=>date(\"Y/m/d\"),':debit'=>0,':credit'=>$amount,':balance'=>$final_bal));\r\n //$stmt = $connection->prepare($insert_sql);\r\n // if($stmt->rowCount()<1){\r\n // echo \"Insert failed\";\r\n // }else{\r\n // echo \"string\";\r\n // }\r\n $connection->commit();\r\n return true;\r\n } catch (Exception $e) {\r\n\r\n $connection->rollBack();\r\n return false;\r\n }\r\n\r\n }",
"function addToAccountBalance($username,$soldValue,$stockTicker)\n{\n \n $mysql_server = '192.168.1.101';\n \n $mysqli = new mysqli($mysql_server, \"badgers\", \"honey\", \"user_info\");\n \n $findBalQry = \"SELECT * FROM bank WHERE username='$username'\";\n $findBalResult = $mysqli->query($findBalQry);\n \n $oldBalance = 0;\n \n if($findBalResult->num_rows > 0){\n while ($row = $findBalResult->fetch_assoc()){\n \n $oldBalance = $row['balance'];\n }\n }\n $newBalance = $oldBalance + $soldValue;\n \n $UpdateQry = \"UPDATE bank SET balance='$newBalance' where username='$username'\";\n $result = $mysqli->query($UpdateQry);\n \n //Print Values for Tests\n //var_dump($oldBalance);\n //var_dump($newBalance);\n \n}",
"public function account_updated(){\n $this->log();\n http_response_code(200);\n ob_end_flush();\n }",
"public function updated(Transaction $transaction)\n {\n if ($transaction->is_complete) {\n $paymentPlan = $transaction->payment_plan;\n $points = $paymentPlan->apply_bonus ? $paymentPlan->priceWithBonus : $paymentPlan->price;\n $currentBalance = $transaction->user()->first()->balance()->first();\n $currentBalance->update(['points' => $points + $currentBalance->points]);\n }\n }",
"public function testBalance()\n {\n $this->assertInternalType('float', $this->kittyUser->getBalance());\n $this->assertEquals(0.00, $this->kittyUser->getBalance());\n $returnedKittyUser = $this->kittyUser->setBalance(13.37);\n $this->assertSame($this->kittyUser, $returnedKittyUser);\n $this->assertEquals(13.37, $this->kittyUser->getBalance());\n }",
"public static function changeAccountBalance(\\Users $user, $new_balance) {\n if ($user->getAccountBalance() != $new_balance) {\n $user->setAccountBalance($new_balance);\n return $user->save(false);\n }\n\n return true;\n }",
"function updateBalance($sender, $recipient, $amount) {\n $senderBalance = selectAccountById($sender)->BALANCE;\n $recipientBalance = selectAccountById($recipient)->BALANCE;\n\n $newSenderBalance = $senderBalance - $amount;\n $newRecipientbalance = $recipientBalance + $amount;\n\n $connection = openDb();\n\n //Using prepared statements and parameterized queries:\n $sql = \"UPDATE accounts SET BALANCE = ? WHERE ID = ?\";\n $stmt = $connection->stmt_init();\n if(!$stmt->prepare($sql)) {\n return false;\n }\n $stmt->bind_param(\"di\",$newSenderBalance,$sender);\n\n if (!executeNonQuery($stmt, $connection)) {\n return false;\n }\n\n $connection = openDb();\n\n //Using prepared statements and parameterized queries:\n $sql = \"UPDATE accounts SET BALANCE = ? WHERE ID = ?\";\n $stmt = $connection->stmt_init();\n if(!$stmt->prepare($sql)) {\n return false;\n }\n $stmt->bind_param(\"ss\",$newRecipientbalance,$recipient);\n\n return executeNonQuery($stmt, $connection);\n}",
"function update_balance($token, $add, $ico_id, $value){\n global $conn;\n\n $rarray = array();\n $id = get_user_id($token);\n $stanje = get_ico_balance($id,$ico_id);\n $scam_balance = get_scam_balance($token);\n \n try {\n \n if(empty($stanje)==1){\n $final_sum = $add*$value;\n if($scam_balance > $final_sum) {\n echo \"usao je da doda\";\n $stmt = $conn->prepare(\"INSERT INTO ico_user (user_id, ico_id, balance) VALUES (?, ?, ?)\");\n $stmt->bind_param(\"iii\", $id, $ico_id, $add);\n $stmt->execute();\n update_scam_balance($token, $final_sum);\n } else {\n echo \"Nemate dovoljno tokena\";\n }\n }\n else{\n\n $sum = $add*$value;\n $final_sum = $stanje + $sum;\n\n if($scam_balance > $sum) {\n $stmt = $conn->prepare(\"UPDATE ico_user SET balance= ? WHERE user_id=? AND ico_id=?\");\n $stmt->bind_param(\"iii\", $sum,$id,$ico_id); \n $stmt->execute();\n update_scam_balance($token, $sum);\n } else {\n $stanje = \"Nemate dovoljno tokena.\";\n $rarray['stanje'] = json_encode($stanje);\n }\n }\n \n } catch (Exception $e) {\n echo 'Caught exception: ', $e->getMessage(), \"\\n\";\n\n }\n \n return json_encode($rarray);\n \n}",
"private function updateWallet ($vendor, $transaction) {\n $commission = $this->calculateCommission($transaction->type, $vendor->user_id, $transaction->amount);\n $distCommission = $this->calculateCommission($transaction->type, $vendor->parent_id, $transaction->amount);\n $superDistId = Vendor::where('user_id', $vendor->parent_id)->first()->parent_id;\n $superDistCommission = $this->calculateCommission($transaction->type, $superDistId, $transaction->amount);\n\n\n // Perform Wallet Updations for Amount Transacted\n if ($transaction->type == 1 || $transaction->type == 2) {\n $vendor->balance += $transaction->type == 1 ? -$transaction->amount : ($transaction->type == 2 ? $transaction->amount : 0);\n $amount_wallet_transaction = WalletTransaction::create([\n 'user_id' => $vendor->id,\n 'transaction_type' => $transaction->type == 1 ? 0 : ($transaction->type == 2 ? 1 : null),\n 'amount' => $transaction->amount,\n 'balance' => $vendor->balance\n ]);\n\n $key = $transaction->type == 1 ? 'debit_id' : ($transaction->type == 2 ? 'credit_id' : '');\n\n AepsWalletAction::create([\n 'user_id' => $vendor->id,\n 'amount' => $transaction->amount,\n 'status' => 1,\n $key => $amount_wallet_transaction->id,\n 'transaction_id' => $transaction->id,\n 'transaction_type' => $transaction->type,\n 'commission' => false\n ]);\n\n $dipl_vendor = Vendor::where('type', 8)->lockForUpdate()->first();\n $dipl_vendor->balance += $transaction->type == 1 ? -$transaction->amount : ($transaction->type == 2 ? $transaction->amount : 0);\n $dipl_vendor->save();\n $dipl_amount_wallet_transaction = WalletTransaction::create([\n 'user_id' => $dipl_vendor->id,\n 'transaction_type' => $transaction->type == 1 ? 0 : ($transaction->type == 2 ? 1 : null),\n 'amount' => $transaction->amount,\n 'balance' => $dipl_vendor->balance\n ]);\n\n AepsWalletAction::create([\n 'user_id' => $dipl_vendor->id,\n 'amount' => $transaction->amount,\n 'status' => 1,\n $key => $dipl_amount_wallet_transaction->id,\n 'transaction_id' => $transaction->id,\n 'transaction_type' => $transaction->type,\n 'commission' => false\n ]);\n\n }\n\n $dipl_vendor = Vendor::where('type', 8)->lockForUpdate()->first();\n\n // Perform Wallet Updations for Commission\n if ($commission && $dipl_vendor->commission && $vendor->commission) {\n if ($commission['rate_type'] == 1)\n $vendor->balance += $commission['rate'];\n if ($commission['rate_type'] == 2)\n $vendor->balance += $transaction->amount * $commission['rate']/100;\n $commission_wallet_transaction = WalletTransaction::create([\n 'user_id' => $vendor->id,\n 'transaction_type' => 1,\n 'amount' => $commission['rate'],\n 'balance' => $vendor->balance\n ]);\n\n AepsWalletAction::create([\n 'user_id' => $vendor->id,\n 'amount' => $commission['rate'],\n 'status' => 1,\n 'credit_id' => $commission_wallet_transaction->id,\n 'transaction_id' => $transaction->id,\n 'transaction_type' => $transaction->type,\n 'commission' => true\n ]);\n }\n\n if ($distCommission && $dipl_vendor->commission) {\n $distributor = Vendor::where('user_id', $vendor->parent_id)->lockForUpdate()->first();\n if ($distributor && $distributor->commission == 1) {\n if ($distCommission['rate_type'] == 1)\n $distributor->balance += $distCommission['rate'];\n if ($distCommission['rate_type'] == 2)\n $distributor->balance += $transaction->amount * $distCommission['rate']/100;\n $commission_wallet_transaction = WalletTransaction::create([\n 'user_id' => $distributor->id,\n 'transaction_type' => 1,\n 'amount' => $distCommission['rate'],\n 'balance' => $distributor->balance\n ]);\n\n $distributor->save();\n\n AepsWalletAction::create([\n 'user_id' => $distributor->id,\n 'amount' => $distCommission['rate'],\n 'status' => 1,\n 'credit_id' => $commission_wallet_transaction->id,\n 'transaction_id' => $transaction->id,\n 'transaction_type' => $transaction->type,\n 'commission' => true\n ]);\n } \n }\n\n if ($superDistCommission && $dipl_vendor->commission) {\n $superDistributor = Vendor::where('user_id', $superDistId)->lockForUpdate()->first();\n if ($superDistributor && $superDistributor->commission == 1) {\n if ($superDistCommission['rate_type'] == 1)\n $superDistributor->balance += $superDistCommission['rate'];\n if ($superDistCommission['rate_type'] == 2)\n $superDistributor->balance += $transaction->amount * $superDistCommission['rate']/100;\n $commission_wallet_transaction = WalletTransaction::create([\n 'user_id' => $superDistributor->id,\n 'transaction_type' => 1,\n 'amount' => $superDistCommission['rate'],\n 'balance' => $superDistributor->balance\n ]);\n\n $superDistributor->save();\n\n AepsWalletAction::create([\n 'user_id' => $superDistributor->id,\n 'amount' => $superDistCommission['rate'],\n 'status' => 1,\n 'credit_id' => $commission_wallet_transaction->id,\n 'transaction_id' => $transaction->id,\n 'transaction_type' => $transaction->type,\n 'commission' => true\n ]);\n }\n \n }\n\n return $vendor->balance;\n }",
"function updateSavingsBalance($db_link, $cust_id){\n\t\t$sql_savbal_upd = \"UPDATE savbalance SET savbal_balance = (SELECT SUM(sav_amount) FROM savings WHERE cust_id = $cust_id) WHERE cust_id = $cust_id\";\n\t\t$query_savbal_upd = mysqli_query($db_link, $sql_savbal_upd);\n\t\tcheckSQL($db_link, $query_savbal_upd, $db_link);\n\t}",
"public function updateTotal() {\n //get the scans for this user\n $scans = $this->scans();\n //create running total\n $newTotal = 0; \n //for each scan, add the total pups and virus to the total\n foreach ($scans as $scan) {\n $newTotal += $scan->pups + $scan->troj_mal;\n }\n //sets and saves the new total for this user\n $this->total = $newTotal;\n $this->save();\n }",
"public function update(WalletRequest $request)\n {\n $validated = $request->validated();\n\n $amount = $request->balance;\n\n try{\n\n $wallet = Wallet::with('user')->where('user_id', Auth::id())->firstOrFail();\n\n if(!(Auth::id() === $wallet->user->id))\n {\n throw new \\Exception('Access Denied');\n }\n\n $wallet->topUpBalance($wallet, $amount, new Transaction);\n\n return redirect()->route('accounts.index');\n\n }catch(\\Exception $e){\n\n return redirect()->back()->withErrors(['error' => $e->getMessage()]);\n\n }\n }",
"public function updateInvoiceBalance(\\PDO $dbh, $paymentAmount, $user) {\n\t\t// positive payment amounts reduce a balance.\n\t\t// Neg payments increase a bal.\n\t\tif ($this->idInvoice > 0) {\n\n\t\t\t$balAmt = $this->invRs->Balance->getStoredVal ();\n\t\t\t$newBal = $balAmt - $paymentAmount;\n\n\t\t\t$this->invRs->Balance->setNewVal ( $newBal );\n\n\t\t\t$attempts = $this->invRs->Payment_Attempts->getStoredVal ();\n\t\t\t$this->invRs->Payment_Attempts->setNewVal ( ++ $attempts );\n\n\t\t\tif ($newBal == 0) {\n\t\t\t\t$this->invRs->Status->setNewVal ( InvoiceStatus::Paid );\n\t\t\t} else {\n\t\t\t\t$this->invRs->Status->setNewVal ( InvoiceStatus::Unpaid );\n\t\t\t}\n\n\t\t\t$this->invRs->Last_Updated->setNewVal ( date ( 'Y-m-d H:i:s' ) );\n\t\t\t$this->invRs->Updated_By->setNewVal ( $user );\n\n\t\t\tEditRS::update ( $dbh, $this->invRs, array (\n\t\t\t\t\t$this->invRs->idInvoice\n\t\t\t) );\n\t\t\tEditRS::updateStoredVals ( $this->invRs );\n\t\t} else {\n\t\t\tthrow new PaymentException( 'Cannot make payments on a blank invoice record. ' );\n\t\t}\n\t}"
] |
[
"0.78866696",
"0.7121748",
"0.69715625",
"0.68346554",
"0.66857535",
"0.66464335",
"0.65720725",
"0.6536411",
"0.65247357",
"0.65052557",
"0.64810747",
"0.64774835",
"0.6409805",
"0.6324399",
"0.6255594",
"0.6225928",
"0.6223625",
"0.62147725",
"0.62111217",
"0.6205999",
"0.6184893",
"0.6134085",
"0.61178946",
"0.6100149",
"0.6008948",
"0.5987946",
"0.59792364",
"0.5979054",
"0.5962269",
"0.59470457"
] |
0.71761644
|
1
|
Delete CF Pro DB Table
|
function caldera_forms_pro_drop_tables(){
global $wpdb;
$table_name = $wpdb->prefix . 'cf_pro_messages';
$sql = "DROP TABLE IF EXISTS $table_name";
$wpdb->query($sql);
delete_option('cf_pro_db_v');
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function delete($table);",
"function cp_delete_db_tables() {\r\n global $wpdb, $app_db_tables;\r\n\r\n echo '<p class=\"info\">';\r\n\r\n foreach ( $app_db_tables as $key => $value ) {\r\n $sql = \"DROP TABLE IF EXISTS \". $wpdb->prefix . $value;\r\n $wpdb->query($sql);\r\n\r\n printf( __(\"Table '%s' has been deleted.\", 'appthemes'), $value);\r\n echo '<br/>';\r\n }\r\n\r\n echo '</p>';\r\n}",
"public function deleteTable(){\n\t \n\t\tglobal $wpdb;\n\n\t\t$wpdb->query('DELETE FROM wp_nouveautes_test WHERE datep_nouveaute > \"2014-04-13\"');\n\n\t\t$wpdb->query('DELETE FROM wp_custom_categories_test WHERE term_id > 247');\n\t\t\t\t \n\t\t$wpdb->query('TRUNCATE TABLE wp_subcategories_test');\n\t\t\n\t\t$wpdb->query('TRUNCATE TABLE wp_extracategories_test');\n\t\t\n\t\t$wpdb->query('TRUNCATE TABLE wp_updated');\n\t\t \t\t \n\t}",
"public function delete_shipping_rules_table() {\n global $wpdb;\n\n //Name of the database\n $table_name = $wpdb->prefix . self::SHIPPING_RULES_TABLE_NAME;\n\n if( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) exit();\n global $wpdb;\n $wpdb->query( \"DROP TABLE IF EXISTS \" . $table_name );\n }",
"public function delete_tables()\n\t{\n\t\tglobal $wpdb;\n\t\t$wpdb->query( 'DROP TABLE '.self::$site_table.';' );\n\t}",
"public function destroy()\n {\n $db = XenForo_Application::get('db');\n $db->query('DROP TABLE `' . self::DB_TABLE . '`');\n }",
"public function deleteDatabaseStructure( );",
"public function deleteTables()\n {\n $db = Core::$db;\n\n $db->query(\"DROP TABLE IF EXISTS {PREFIX}module_form_builder_forms\");\n $db->execute();\n\n $db->query(\"DROP TABLE IF EXISTS {PREFIX}module_form_builder_form_placeholders\");\n $db->execute();\n\n $db->query(\"DROP TABLE IF EXISTS {PREFIX}module_form_builder_form_templates\");\n $db->execute();\n\n $db->query(\"DROP TABLE IF EXISTS {PREFIX}module_form_builder_templates\");\n $db->execute();\n\n $db->query(\"DROP TABLE IF EXISTS {PREFIX}module_form_builder_template_sets\");\n $db->execute();\n\n $db->query(\"DROP TABLE IF EXISTS {PREFIX}module_form_builder_template_set_placeholders\");\n $db->execute();\n\n $db->query(\"DROP TABLE IF EXISTS {PREFIX}module_form_builder_template_set_placeholder_opts\");\n $db->execute();\n\n $db->query(\"DROP TABLE IF EXISTS {PREFIX}module_form_builder_template_set_resources\");\n $db->execute();\n }",
"function deleteDatabase()\n{\n // codes to perform during unistallation\n $free_book_table = $GLOBALS['wpdb']->prefix . 'free_books';\n $sale_book_table = $GLOBALS['wpdb']->prefix . 'sale_books';\n $GLOBALS['wpdb']->query(\"DROP TABLE IF EXISTS `\" . $free_book_table . \"`\");\n $GLOBALS['wpdb']->query(\"DROP TABLE IF EXISTS `\" . $sale_book_table . \"`\");\n}",
"private function delete_tables()\n {\n global $wpdb;\n\n // this needs to occur at this level, and not in the\n foreach ($this->tables as $tablename) {\n $sql = 'DROP TABLE IF EXISTS ' . $tablename;\n $wpdb->query($sql);\n }\n }",
"public function deleteTable() {\n global $database;\n $database->query('DROP TABLE IF EXISTS `'.$this->getTableName().'`');\n if ($database->is_error()) {\n $this->setError(sprintf('[%s - %s] %s', __METHOD__, __LINE__, $database->get_error()));\n return false;\n }\n return true;\n }",
"function lp_delete_table(){\r\n\tglobal $wpdb;\r\n\t$charset_collation = $wpdb->get_charset_collate();\r\n\t$table_name = $wpdb->prefix.'like_post';\r\n\r\n $sql = \"DROP TABLE IF EXISTS $table_name;\";\r\n $wpdb->query($sql);\r\n\r\n delete_option('lp_showing_year');\r\n}",
"function Sql_DB_Delete($db=\"\")\n {\n $query=$this->DB_Delete_Query($db);\n $this->DB_Query($query);\n }",
"public static function dbClearTable($table){\n\t\tif (App::runningUnitTests()) {\n\t\t\tif (DB::table($table)->count() != 0) {\n\t\t\t\t//Turn foreign key checks off <- USE WITH CAUTION!\n\t\t\t\tDB::statement('SET FOREIGN_KEY_CHECKS=0;');\n\t\t\t\t//Delete all entries & reset indexes\n\t\t\t\tDB::table($table)->truncate();\n\t\t\t\t//Turn foreign key checks on <- SHOULD RESET ANYWAY BUT JUST TO MAKE SURE!\n\t\t\t\tDB::statement('SET FOREIGN_KEY_CHECKS=1;');\n\t\t\t}\n\t\t}\n\t}",
"function delete() {\n\t\t$sqlStatements = array();\n\t\t$sqlStatements[] = \"DROP TABLE IF EXISTS tags\";\n\t\t$sqlStatements[] = \"DROP TABLE IF EXISTS siteViews\";\n\t\texecuteSqlStatements($sqlStatements);\n\t}",
"public function deleteDBTables()\n\t{\n\t\t$TableID = $this->input->post('TableID');\n\t\t$TableData = $this->system_structure_m->deleteDBTables($TableID);\n\t\techo $TableData;\n\t}",
"public function limparTabela(){\r\n\t\t$sql = 'DELETE FROM oficina';\r\n\t\t$consulta = $conexao->prepare($sql);\r\n\t\t$consulta->execute();\r\n\t}",
"public function delete_table($opt = null)\n\t{\n\t\tif (!$opt) $opt = array();\n\t\t\n\t\treturn $this->authenticate('DeleteTable', $opt);\n\t}",
"protected static function dropTable(): void\n {\n $pdo = static::getDb();\n $pdo->query('DROP TABLE IF EXISTS ' . Store\\MySQL::DEFAULT_TABLE);\n }",
"function _delete ($table_name) {\n\t\treturn \"DELETE FROM `{$table_name}`\";\n\t}",
"function deletePlaceDescriptionTable($con){\n\t$sql = \"DROP TABLE IF EXISTS csgp07_13_14 . Place_description\";\n\tif(mysqli_query($con, $sql)){\n\t\techo \"Table Place Description deleted successfully\\n\";\n\t}\n\telse{\n\t\techo \"Could Not Delete Place Description Table\" . mysqli_error($con);\n\t}\n}",
"function deletePhotoTable($con){\n\t$sql = \"DROP TABLE IF EXISTS csgp07_13_14 . Photo\";\n\tif(mysqli_query($con, $sql)){\n\t\techo \"Table Photo deleted successfully\\n\";\n\t}\n\telse{\n\t\techo \"Could Not Delete Photo Table\" . mysqli_error($con);\n\t}\t\n}",
"public static function uninstall() {\n $sql = 'DROP TABLE IF EXISTS `'.self::tableName.'`;';\n db_query($sql);\n }",
"function dropTable($table);",
"function lightboxPhotoswipeDeleteTables()\n{\n global $wpdb;\n \n $table_name = $wpdb->prefix . 'lightbox_photoswipe_img'; \n $sql = \"DROP TABLE IF EXISTS $table_name\";\n $wpdb->query($sql);\n}",
"public function delete() {\n\t\tif ($this->checkDependencies() == true ) {\n\t\t\t$sql = \"DELETE FROM \".$this->tablename.\" where \".$this->idcol.\" = \".$this->page->ctrl['record'];\n\t\t\t$this->dbc->exec($sql);\n\t\t}\n\t}",
"function mhm_memberpress_clickbank_db_deactivate() {\n\tglobal $wpdb;\n\n\t$table_name = $wpdb->prefix . \"mhm_memberpress_clickbank_memberpress_products\";\n\t$sql = \"DROP TABLE IF EXISTS \".$table_name;\n\t$results = $wpdb->query( $sql );\n\n\n}",
"public function dropTable()\n\t{\n\t\t$table = $this->getTableName();\n\n\t\t// Does the table exist?\n\t\tif (blx()->db->getSchema()->getTable('{{'.$table.'}}'))\n\t\t{\n\t\t\tblx()->db->createCommand()->dropTable($table);\n\t\t}\n\t}",
"public function deleteTables () {\n $this->usersDB->deleteTables();\n $this->categoriesDB->deleteTables();\n $this->itemsDB->deleteTables();\n }",
"function sql_deleteTable() {\n global $database;\n $thisQuery = \"DROP TABLE \".TABLE_PREFIX.\"mod_dirlist\";\n $oldErrorReporting = error_reporting(0);\n $database->query($thisQuery);\n error_reporting($oldErrorReporting);\n if ($database->is_error()) {\n $this->errorPlace = 'sql_deleteTable()';\n $this->error = $database->get_error();\n return false; }\n else {\n return true; }\n }"
] |
[
"0.71563727",
"0.71361417",
"0.7114313",
"0.71037966",
"0.69856507",
"0.6984767",
"0.6881291",
"0.68637085",
"0.683493",
"0.6819857",
"0.6793198",
"0.67764807",
"0.67654276",
"0.6747497",
"0.67440975",
"0.6733918",
"0.66952956",
"0.6691924",
"0.66807246",
"0.6667285",
"0.66346866",
"0.6627041",
"0.6626115",
"0.66167563",
"0.66041195",
"0.65884036",
"0.6573999",
"0.6559159",
"0.6541346",
"0.65090376"
] |
0.72045606
|
0
|
Database changes for Caldera Forms Pro
|
function caldera_forms_pro_db_delta_1(){
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
global $wpdb;
$charset_collate = '';
if ( ! empty( $wpdb->charset ) ) {
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
}
if ( ! empty( $wpdb->collate ) ) {
$charset_collate .= " COLLATE $wpdb->collate";
}
$table = "CREATE TABLE `" . $wpdb->prefix . "cf_pro_messages` (
`ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`cfp_id` bigint(20) unsigned DEFAULT NULL,
`entry_id` bigint(20) unsigned DEFAULT NULL,
`hash` varchar(255) DEFAULT NULL,
`type` varchar(255) DEFAULT NULL,
PRIMARY KEY ( `ID` )
) " . $charset_collate . ";";
dbDelta( $table );
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function acfedu_create_fill_db() {\n\t\t\t\t$this->acfedu_check_table();\n\t\t\t\trequire_once( ABSPATH . 'wp-admin/includes/upgrade.php' );\n\t\t\t\tob_start();\n\t\t\t\tglobal $wpdb;\n //require_once( 'lib/import_nl.php' );\n //require_once( 'lib/import_be.php' );\n //require_once( 'lib/import_lux.php' );\n require_once( 'lib/import_id.php' );\n\t\t\t\t$sql = ob_get_clean();\n\t\t\t\tdbDelta( $sql );\n\t\t\t}",
"public function db_update() {}",
"public function saveToDb()\n\t{\n\t\t$db = \\App\\Db::getInstance('admin');\n\t\t$tablesData = array_intersect_key($this->getData(), $this->changes);\n\t\tforeach ($tablesData as $key => $value) {\n\t\t\t$db->createCommand()->update($this->baseTable, ['value' => $value], ['type' => $this->type, 'name' => $key])->execute();\n\t\t}\n\t}",
"function updateDB() {\n global $DB;\n\n if (array_key_exists('model', $this->ptcdUpdates)) {\n $manufacturer = Dropdown::getDropdownName(\"glpi_dropdown_manufacturer\",\n $this->getValue('FK_glpi_enterprise'));\n $this->ptcdUpdates['model'] = Dropdown::importExternal(\"PrinterModel\",\n $this->ptcdUpdates['model'], 0,\n array('manufacturer'=>$manufacturer));\n }\n parent::updateDB();\n // update last_fusioninventory_update even if no other update\n $this->setValue('last_fusioninventory_update', date(\"Y-m-d H:i:s\"));\n $this->oFusionInventory_printer->updateDB();\n // ports\n $this->savePorts();\n // cartridges\n $this->saveCartridges();\n // history\n if (is_null($this->oFusionInventory_printer_history->getValue('ID'))) {\n // update only if counters not already set for today\n $this->oFusionInventory_printer_history->updateDB();\n }\n }",
"public function updateDB()\n {\n\n }",
"public function change(): void\n {\n $leads = $this->table('leads');\n $leads->addColumn('id_proyecto', 'integer')\n ->addColumn('status', 'integer')\n ->addColumn('comentarios', 'text')\n ->addColumn('created_at', 'timestamp')\n ->addColumn('updated_at', 'timestamp')\n ->addForeignKey('id_proyecto', 'proyectos', 'id', ['delete' => 'NO_ACTION', 'update' => 'NO_ACTION'])\n ->create();\n\n $datos = $this->table('datos');\n $datos->addColumn('id_lead', 'integer')\n ->addColumn('campo', 'string', ['limit' => 250])\n ->addColumn('valor', 'string', ['limit' => 250])\n ->addColumn('created_at', 'timestamp')\n ->addColumn('updated_at', 'timestamp')\n ->addForeignKey('id_lead', 'leads', 'id', ['delete' => 'CASCADE', 'update' => 'CASCADE'])\n ->create();\n }",
"public function save_upgrade() {\n\t\tglobal $wpdb;\n\n\t\tif ( !isset( $_REQUEST['action'] ) || !isset( $_GET['page'] ) )\n\t\t\treturn;\n\n\t\tif ( 'visual-form-builder-pro' !== $_GET['page'] )\n\t\t\treturn;\n\n\t\tif ( 'vfb-upgrade' !== $_REQUEST['action'] )\n\t\t\treturn;\n\n\t\t// Set database names of free version\n\t\t$vfb_fields = $wpdb->prefix . 'visual_form_builder_fields';\n\t\t$vfb_forms = $wpdb->prefix . 'visual_form_builder_forms';\n\t\t$vfb_entries = $wpdb->prefix . 'visual_form_builder_entries';\n\n\t\t// Get all forms, fields, and entries\n\t\t$forms = $wpdb->get_results( \"SELECT * FROM $vfb_forms ORDER BY form_id\" );\n\n\t\t// Truncate the tables in case any forms or fields have been added\n\t\t$wpdb->query( \"TRUNCATE TABLE $this->form_table_name\" );\n\t\t$wpdb->query( \"TRUNCATE TABLE $this->field_table_name\" );\n\t\t$wpdb->query( \"TRUNCATE TABLE $this->entries_table_name\" );\n\n\t\t// Setup email design defaults\n\t\t$email_design = array(\n\t\t\t'format' \t\t\t\t=> 'html',\n\t\t\t'link_love' \t\t\t=> 'yes',\n\t\t\t'footer_text' \t\t\t=> '',\n\t\t\t'background_color' \t\t=> '#eeeeee',\n\t\t\t'header_text'\t\t\t=> '',\n\t\t\t'header_image' \t\t\t=> '',\n\t\t\t'header_color' \t\t\t=> '#810202',\n\t\t\t'header_text_color' \t=> '#ffffff',\n\t\t\t'fieldset_color' \t\t=> '#680606',\n\t\t\t'section_color' \t\t=> '#5C6266',\n\t\t\t'section_text_color' \t=> '#ffffff',\n\t\t\t'text_color' \t\t\t=> '#333333',\n\t\t\t'link_color' \t\t\t=> '#1b8be0',\n\t\t\t'row_color' \t\t\t=> '#ffffff',\n\t\t\t'row_alt_color' \t\t=> '#eeeeee',\n\t\t\t'border_color' \t\t\t=> '#cccccc',\n\t\t\t'footer_color' \t\t\t=> '#333333',\n\t\t\t'footer_text_color' \t=> '#ffffff',\n\t\t\t'font_family' \t\t\t=> 'Arial',\n\t\t\t'header_font_size' \t\t=> 32,\n\t\t\t'fieldset_font_size' \t=> 20,\n\t\t\t'section_font_size' \t=> 15,\n\t\t\t'text_font_size' \t\t=> 13,\n\t\t\t'footer_font_size' \t\t=> 11\n\t\t);\n\n\t\t// Migrate all forms, fields, and entries\n\t\tforeach ( $forms as $form ) :\n\n\t\t\t// Set email header text default as form subject\n\t\t\t$email_design['header_text'] = $form->form_email_subject;\n\n\t\t\t$data = array(\n\t\t\t\t'form_id' \t\t\t\t\t\t=> $form->form_id,\n\t\t\t\t'form_key' \t\t\t\t\t\t=> $form->form_key,\n\t\t\t\t'form_title' \t\t\t\t\t=> $form->form_title,\n\t\t\t\t'form_email_subject' \t\t\t=> $form->form_email_subject,\n\t\t\t\t'form_email_to' \t\t\t\t=> $form->form_email_to,\n\t\t\t\t'form_email_from' \t\t\t\t=> $form->form_email_from,\n\t\t\t\t'form_email_from_name' \t\t\t=> $form->form_email_from_name,\n\t\t\t\t'form_email_from_override' \t\t=> $form->form_email_from_override,\n\t\t\t\t'form_email_from_name_override' => $form->form_email_from_name_override,\n\t\t\t\t'form_success_type' \t\t\t=> $form->form_success_type,\n\t\t\t\t'form_success_message' \t\t\t=> $form->form_success_message,\n\t\t\t\t'form_notification_setting' \t=> $form->form_notification_setting,\n\t\t\t\t'form_notification_email_name' \t=> $form->form_notification_email_name,\n\t\t\t\t'form_notification_email_from' \t=> $form->form_notification_email_from,\n\t\t\t\t'form_notification_email' \t\t=> $form->form_notification_email,\n\t\t\t\t'form_notification_subject' \t=> $form->form_notification_subject,\n\t\t\t\t'form_notification_message' \t=> $form->form_notification_message,\n\t\t\t\t'form_notification_entry' \t\t=> $form->form_notification_entry,\n\t\t\t\t'form_email_design' \t\t\t=> serialize( $email_design ),\n\t\t\t\t'form_label_alignment' \t\t\t=> '',\n\t\t\t\t'form_verification' \t\t\t=> 1,\n\t\t\t\t'form_entries_allowed' \t\t\t=> '',\n\t\t\t\t'form_entries_schedule'\t\t\t=> '',\n\t\t\t\t'form_unique_entry'\t\t\t\t=> 0\n\t\t\t);\n\n\t\t\t$wpdb->insert( $this->form_table_name, $data );\n\n\t\t\t$fields = $wpdb->get_results( $wpdb->prepare( \"SELECT * FROM $vfb_fields WHERE form_id = %d ORDER BY field_id\", $form->form_id ) );\n\t\t\t// Copy each field and data\n\t\t\tforeach ( $fields as $field ) {\n\n\t\t\t\t$data = array(\n\t\t\t\t\t'field_id' \t\t\t=> $field->field_id,\n\t\t\t\t\t'form_id' \t\t\t=> $field->form_id,\n\t\t\t\t\t'field_key' \t\t=> $field->field_key,\n\t\t\t\t\t'field_type' \t\t=> $field->field_type,\n\t\t\t\t\t'field_name' \t\t=> $field->field_name,\n\t\t\t\t\t'field_description' => $field->field_description,\n\t\t\t\t\t'field_options' \t=> $field->field_options,\n\t\t\t\t\t'field_sequence' \t=> $field->field_sequence,\n\t\t\t\t\t'field_validation' \t=> $field->field_validation,\n\t\t\t\t\t'field_required' \t=> $field->field_required,\n\t\t\t\t\t'field_size' \t\t=> $field->field_size,\n\t\t\t\t\t'field_css' \t\t=> $field->field_css,\n\t\t\t\t\t'field_layout' \t\t=> $field->field_layout,\n\t\t\t\t\t'field_parent' \t\t=> $field->field_parent,\n\t\t\t\t\t'field_default'\t\t=> $field->field_default,\n\t\t\t\t);\n\n\t\t\t\t$wpdb->insert( $this->field_table_name, $data );\n\t\t\t}\n\n\t\t\t$entries = $wpdb->get_results( $wpdb->prepare( \"SELECT * FROM $vfb_entries WHERE form_id = %d ORDER BY entries_id\", $form->form_id ) );\n\n\t\t\t// Copy each entry\n\t\t\tforeach ( $entries as $entry ) {\n\n\t\t\t\t$data = array(\n\t\t\t\t\t'form_id' \t\t\t=> $entry->form_id,\n\t\t\t\t\t'data' \t\t\t\t=> $entry->data,\n\t\t\t\t\t'subject' \t\t\t=> $entry->subject,\n\t\t\t\t\t'sender_name' \t\t=> $entry->sender_name,\n\t\t\t\t\t'sender_email' \t\t=> $entry->sender_email,\n\t\t\t\t\t'emails_to' \t\t=> $entry->emails_to,\n\t\t\t\t\t'date_submitted' \t=> $entry->date_submitted,\n\t\t\t\t\t'ip_address'\t \t=> $entry->ip_address\n\t\t\t\t);\n\n\t\t\t\t$wpdb->insert( $this->entries_table_name, $data );\n\t\t\t}\n\n\t\tendforeach;\n\n\t\t// Automatically deactivate free version of Visual Form Builder, if active\n\t\tif ( is_plugin_active( 'visual-form-builder/visual-form-builder.php' ) )\n\t\t\tdeactivate_plugins( '/visual-form-builder/visual-form-builder.php' );\n\n\t\t// Set upgrade as complete so admin notice closes\n\t\tupdate_option( 'vfb_db_upgrade', 1 );\n\t}",
"function updateDatabase()\n\t{\n\t\tglobal $ilCtrlStructureReader;\n\n\t\t$ilCtrlStructureReader->setIniFile($this->setup->getClient()->ini);\n\n\t\tinclude_once \"./Services/Database/classes/class.ilDBUpdate.php\";\n\t\tinclude_once \"./Services/AccessControl/classes/class.ilRbacAdmin.php\";\n\t\tinclude_once \"./Services/AccessControl/classes/class.ilRbacReview.php\";\n\t\tinclude_once \"./Services/AccessControl/classes/class.ilRbacSystem.php\";\n\t\tinclude_once \"./Services/Tree/classes/class.ilTree.php\";\n\t\tinclude_once \"./Services/Xml/classes/class.ilSaxParser.php\";\n\t\tinclude_once \"./Services/Object/classes/class.ilObjectDefinition.php\";\n\n\t\t// #9019: init timezone\t\t\n\t\t$tz = $this->setup->ini->readVariable(\"server\",\"timezone\");\n\t\tif ($tz != \"\")\n\t\t{\n\t\t\tif (function_exists('date_default_timezone_set'))\n\t\t\t{\n\t\t\t\tdate_default_timezone_set($tz);\n\t\t\t}\n\t\t\tdefine (\"IL_TIMEZONE\", $tz);\n\t\t}\n\n\t\t// referencing db handler in language class\n\t\t$ilDB = $this->setup->getClient()->db;\n\t\t$this->lng->setDbHandler($ilDB);\n\n\t\t// run dbupdate\n\t\t$dbupdate = new ilDBUpdate($ilDB);\n\t\t$dbupdate->applyUpdate((int) $_POST[\"update_break\"]);\n\n\t\tif ($dbupdate->updateMsg == \"no_changes\")\n\t\t{\n\t\t\t$message = $this->lng->txt(\"no_changes\").\". \".$this->lng->txt(\"database_is_uptodate\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$sep = \"\";\n\t\t\tforeach ($dbupdate->updateMsg as $row)\n\t\t\t{\n\t\t\t\tif ($row[\"msg\"] == \"update_applied\")\n\t\t\t\t{\n\t\t\t\t\t$a_message.= $sep.$row[\"nr\"];\n\t\t\t\t\t$sep = \", \";\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$e_message.= \"<br/>\".$this->lng->txt($row[\"msg\"]).\": \".$row[\"nr\"];\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ($a_message != \"\")\n\t\t\t{\n\t\t\t\t$a_message = $this->lng->txt(\"update_applied\").\": \".$a_message;\n\t\t\t}\n\t\t}\n\n\t\tilUtil::sendInfo($a_message.$e_message, true);\n\t\tilUtil::redirect(\"setup.php?cmd=displayDatabase\");\n\t}",
"function updateDB() {\n if (array_key_exists('model', $this->ptcdUpdates)) {\n $manufacturer = Dropdown::getDropdownName(\"glpi_dropdown_manufacturer\",\n $this->getValue('FK_glpi_enterprise'));\n $this->ptcdUpdates['model'] = Dropdown::importExternal(\"NetworkEquipmentModel\",\n $this->ptcdUpdates['model'], 0,\n array('manufacturer'=>$manufacturer));\n }\n if (array_key_exists('firmware', $this->ptcdUpdates)) {\n $this->ptcdUpdates['firmware'] = Dropdown::importExternal(\"NetworkEquipmentFirmware\",\n $this->ptcdUpdates['firmware']);\n }\n if (array_key_exists('location', $this->ptcdUpdates)) {\n $this->ptcdUpdates['location'] = Dropdown::importExternal(\"Location\",\n $this->ptcdUpdates['location']);\n }\n\n parent::updateDB();\n // update last_fusioninventory_update even if no other update\n $this->setValue('last_fusioninventory_update', date(\"Y-m-d H:i:s\"));\n $this->oFusionInventory_networking->updateDB();\n // ports\n $this->savePorts();\n }",
"public function database() {\n\t\t$this->_check();\n\t\t$d['title_for_layout'] = __(\"Database creation\");\n\t\t$this->set($d);\n\t}",
"public function acfedu() {\n\t\t\t\tif ( false == get_option( 'acfedu_preserve_settings' ) ) {\n\t\t\t\t\t$this->acfedu_create_fill_db();\n\t\t\t\t}\n\t\t\t}",
"protected function _updatefields() {}",
"function glv_create_tables(){\r\n global $wpdb;\r\n \r\n //el nombre de la tabla, utilizamos el prefijo de wordpress\r\n $table_forms = $wpdb->prefix.'glv_forms'; \r\n\r\n //sql con el statement de la tabla \r\n $glv_form = \"CREATE TABLE \".$table_forms.\"(\r\n for_id int(11) NOT NULL AUTO_INCREMENT,\r\n for_name varchar(100) DEFAULT NULL,\r\n for_value text DEFAULT NULL,\r\n for_date date,\r\n UNIQUE KEY for_id (for_id)\r\n )\";\r\n\r\n //upgrade contiene la función dbDelta la cuál revisará si existe la tabla o no\r\n require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );\r\n \r\n //creamos la tabla\r\n dbDelta($glv_form);\r\n }",
"public static function setup_db()\r\n {\r\n $installed_ver = get_option( CART_CONVERTER . \"_db_version\" );\r\n\r\n // prevent create table when re-active plugin\r\n if ( $installed_ver != CART_CONVERTER_DB_VERSION ) {\r\n CartModel::setup_db();\r\n EmailModel::setup_db();\r\n //MailTemplateModel::setup_db();\r\n \r\n add_option( CART_CONVERTER . \"_db_version\", CART_CONVERTER_DB_VERSION );\r\n }\r\n }",
"public function change()\n {\n \n $this->execute('DELETE FROM cotz_cotizaciones_catalogo WHERE id = 12');\n \n $this->execute(\"UPDATE cotz_cotizaciones_catalogo SET valor='Abierta', etiqueta='abierta' WHERE id = '7'\");\n $this->execute(\"UPDATE cotz_cotizaciones_catalogo SET valor='Ganada', etiqueta='ganada' WHERE id = '9'\");\n $this->execute(\"UPDATE cotz_cotizaciones_catalogo SET valor='Perdida', etiqueta='perdida' WHERE id = '10'\");\n $this->execute(\"UPDATE cotz_cotizaciones_catalogo SET valor='Anulada', etiqueta='anulada' WHERE id = '11'\");\n \n $this->execute(\"UPDATE cotz_cotizaciones SET estado='abierta' WHERE estado = 'aprobado'\");\n $this->execute(\"UPDATE cotz_cotizaciones SET estado='ganada' WHERE estado = 'ganado'\");\n $this->execute(\"UPDATE cotz_cotizaciones SET estado='perdida' WHERE estado = 'perdido'\");\n $this->execute(\"UPDATE cotz_cotizaciones SET estado='anulada' WHERE estado = 'anulado'\");\n }",
"public function updateDb()\n {\n\n // make sure this is a valid new entry\n if ($this->isValid()) {\n\n // check for duplicate\n $vals = sprintf(\"Level = %d\",$this->level);\n $sql = \" update Admins set $vals where Email = '$this->email';\";\n Dbc::getReader()->Exec($sql);\n }\n else\n print \"<br> Invalid entry. STOP! ($sql)<br>\";\n }",
"function afterCreateTable(){\n $aData = array(\n array( \"Intranet\", \"INTR\", 1 ),\n array( \"Document Management\", \"DOCU\" ),\n array( \"Email\", \"EMAI\" ),\n array( \"General\", \"GENE\" )\n );\n \n foreach( $aData as $row ){\n $this->id = 0;\n $this->aFields[\"name\"]->value = $row[0];\n $this->aFields[\"code\"]->value = $row[1];\n \n // Default option\n if( array_key_exists( 2, $row ) ) $this->aFields[\"is_default\"]->value = $row[2];\n else $this->aFields[\"is_default\"]->value = 0;\n \n $this->save();\n }\n \n // Make everything point to the default\n $sql = \"SELECT id FROM issue_system WHERE is_default = 1\";\n $db = new DB();\n $db->query( $sql );\n $row = $db->fetchRow();\n $sql = \"UPDATE issue SET issue_system_id = \".$row[\"id\"];\n $db->query( $sql );\n \n }",
"public static function install_database_for_addons(){\n\t\t$sqls = self::get_table_queries_for_addons();\n require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );\n foreach($sqls as $sql){\n error_log(print_r(dbDelta( $sql ), true));\n }\n\t}",
"protected function beforeSaveInDB(){}",
"function updateDatabase($form, $myvalues)\n {\n return TRUE;\n }",
"function db_upgrade_all($iOldDBVersion) {\n /// This function does anything necessary to upgrade\n /// older versions to match current functionality\n global $modifyoutput;\n Yii::app()->loadHelper('database');\n\n $sUserTemplateRootDir = Yii::app()->getConfig('usertemplaterootdir');\n $sStandardTemplateRootDir = Yii::app()->getConfig('standardtemplaterootdir');\n echo str_pad(gT('The LimeSurvey database is being upgraded').' ('.date('Y-m-d H:i:s').')',14096).\".<br /><br />\". gT('Please be patient...').\"<br /><br />\\n\";\n\n $oDB = Yii::app()->getDb();\n $oDB->schemaCachingDuration=0; // Deactivate schema caching\n $oTransaction = $oDB->beginTransaction();\n try\n {\n if ($iOldDBVersion < 111)\n {\n // Language upgrades from version 110 to 111 because the language names did change\n\n $aOldNewLanguages=array('german_informal'=>'german-informal',\n 'cns'=>'cn-Hans',\n 'cnt'=>'cn-Hant',\n 'pt_br'=>'pt-BR',\n 'gr'=>'el',\n 'jp'=>'ja',\n 'si'=>'sl',\n 'se'=>'sv',\n 'vn'=>'vi');\n foreach ($aOldNewLanguages as $sOldLanguageCode=>$sNewLanguageCode)\n {\n alterLanguageCode($sOldLanguageCode,$sNewLanguageCode);\n }\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>111),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 112) {\n // New size of the username field (it was previously 20 chars wide)\n $oDB->createCommand()->alterColumn('{{users}}','users_name',\"string(64) NOT NULL\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>112),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 113) {\n //Fixes the collation for the complete DB, tables and columns\n\n if (Yii::app()->db->driverName=='mysql')\n {\n $sDatabaseName=getDBConnectionStringProperty('dbname');\n fixMySQLCollations();\n modifyDatabase(\"\",\"ALTER DATABASE `$sDatabaseName` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;\");echo $modifyoutput; flush();@ob_flush();\n }\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>113),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 114) {\n $oDB->createCommand()->alterColumn('{{saved_control}}','email',\"string(320) NOT NULL\");\n $oDB->createCommand()->alterColumn('{{surveys}}','adminemail',\"string(320) NOT NULL\");\n $oDB->createCommand()->alterColumn('{{users}}','email',\"string(320) NOT NULL\");\n $oDB->createCommand()->insert('{{settings_global}}',array('stg_name'=>'SessionName','stg_value'=>randomChars(64,'ABCDEFGHIJKLMNOPQRSTUVWXYZ!\"$%&/()=?`+*~#\",;.:abcdefghijklmnopqrstuvwxyz123456789')));\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>114),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 126) {\n\n addColumn('{{surveys}}','printanswers',\"string(1) default 'N'\");\n addColumn('{{surveys}}','listpublic',\"string(1) default 'N'\");\n\n upgradeSurveyTables126();\n upgradeTokenTables126();\n\n // Create quota table\n $oDB->createCommand()->createTable('{{quota}}',array(\n 'id' => 'pk',\n 'sid' => 'integer',\n 'qlimit' => 'integer',\n 'name' => 'string',\n 'action' => 'integer',\n 'active' => 'integer NOT NULL DEFAULT 1'\n ));\n\n // Create quota_members table\n $oDB->createCommand()->createTable('{{quota_members}}',array(\n 'id' => 'pk',\n 'sid' => 'integer',\n 'qid' => 'integer',\n 'quota_id' => 'integer',\n 'code' => 'string(5)'\n ));\n $oDB->createCommand()->createIndex('sid','{{quota_members}}','sid,qid,quota_id,code',true);\n\n\n // Create templates_rights table\n $oDB->createCommand()->createTable('{{templates_rights}}',array(\n 'uid' => 'integer NOT NULL',\n 'folder' => 'string NOT NULL',\n 'use' => 'integer',\n 'PRIMARY KEY (uid, folder)'\n ));\n\n // Create templates table\n $oDB->createCommand()->createTable('{{templates}}',array(\n 'folder' => 'string NOT NULL',\n 'creator' => 'integer NOT NULL',\n 'PRIMARY KEY (folder)'\n ));\n\n // Rename Norwegian language codes\n alterLanguageCode('no','nb');\n\n addColumn('{{surveys}}','htmlemail',\"string(1) default 'N'\");\n addColumn('{{surveys}}','tokenanswerspersistence',\"string(1) default 'N'\");\n addColumn('{{surveys}}','usecaptcha',\"string(1) default 'N'\");\n addColumn('{{surveys}}','bounce_email','text');\n addColumn('{{users}}','htmleditormode',\"string(7) default 'default'\");\n addColumn('{{users}}','superadmin',\"integer NOT NULL default '0'\");\n addColumn('{{questions}}','lid1',\"integer NOT NULL default '0'\");\n\n alterColumn('{{conditions}}','value',\"string\",false,'');\n alterColumn('{{labels}}','title',\"text\");\n\n $oDB->createCommand()->update('{{users}}',array('superadmin'=>1),\"create_survey=1 AND create_user=1 AND move_user=1 AND delete_user=1 AND configurator=1\");\n $oDB->createCommand()->update('{{conditions}}',array('method'=>'=='),\"(method is null) or method='' or method='0'\");\n\n dropColumn('{{users}}','move_user');\n\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>126),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 127) {\n modifyDatabase(\"\",\"create index answers_idx2 on {{answers}} (sortorder)\"); echo $modifyoutput;\n modifyDatabase(\"\",\"create index assessments_idx2 on {{assessments}} (sid)\"); echo $modifyoutput;\n modifyDatabase(\"\",\"create index assessments_idx3 on {{assessments}} (gid)\"); echo $modifyoutput;\n modifyDatabase(\"\",\"create index conditions_idx2 on {{conditions}} (qid)\"); echo $modifyoutput;\n modifyDatabase(\"\",\"create index conditions_idx3 on {{conditions}} (cqid)\"); echo $modifyoutput;\n modifyDatabase(\"\",\"create index groups_idx2 on {{groups}} (sid)\"); echo $modifyoutput;\n modifyDatabase(\"\",\"create index question_attributes_idx2 on {{question_attributes}} (qid)\"); echo $modifyoutput;\n modifyDatabase(\"\",\"create index questions_idx2 on {{questions}} (sid)\"); echo $modifyoutput;\n modifyDatabase(\"\",\"create index questions_idx3 on {{questions}} (gid)\"); echo $modifyoutput;\n modifyDatabase(\"\",\"create index questions_idx4 on {{questions}} (type)\"); echo $modifyoutput;\n modifyDatabase(\"\",\"create index quota_idx2 on {{quota}} (sid)\"); echo $modifyoutput;\n modifyDatabase(\"\",\"create index saved_control_idx2 on {{saved_control}} (sid)\"); echo $modifyoutput;\n modifyDatabase(\"\",\"create index user_in_groups_idx1 on {{user_in_groups}} (ugid, uid)\"); echo $modifyoutput;\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>127),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 128) {\n upgradeTokens128();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>128),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 129) {\n addColumn('{{surveys}}','startdate',\"datetime\");\n addColumn('{{surveys}}','usestartdate',\"string(1) NOT NULL default 'N'\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>129),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 130)\n {\n addColumn('{{conditions}}','scenario',\"integer NOT NULL default '1'\");\n $oDB->createCommand()->update('{{conditions}}',array('scenario'=>'1'),\"(scenario is null) or scenario=0\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>130),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 131)\n {\n addColumn('{{surveys}}','publicstatistics',\"string(1) NOT NULL default 'N'\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>131),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 132)\n {\n addColumn('{{surveys}}','publicgraphs',\"string(1) NOT NULL default 'N'\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>132),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 133)\n {\n addColumn('{{users}}','one_time_pw','binary');\n // Add new assessment setting\n addColumn('{{surveys}}','assessments',\"string(1) NOT NULL default 'N'\");\n // add new assessment value fields to answers & labels\n addColumn('{{answers}}','assessment_value',\"integer NOT NULL default '0'\");\n addColumn('{{labels}}','assessment_value',\"integer NOT NULL default '0'\");\n // copy any valid codes from code field to assessment field\n switch (Yii::app()->db->driverName){\n case 'mysql':\n case 'mysqli':\n $oDB->createCommand(\"UPDATE {{answers}} SET assessment_value=CAST(`code` as SIGNED) where `code` REGEXP '^-?[0-9]+$'\")->execute();\n $oDB->createCommand(\"UPDATE {{labels}} SET assessment_value=CAST(`code` as SIGNED) where `code` REGEXP '^-?[0-9]+$'\")->execute();\n // copy assessment link to message since from now on we will have HTML assignment messages\n $oDB->createCommand(\"UPDATE {{assessments}} set message=concat(replace(message,'/''',''''),'<br /><a href=\\\"',link,'\\\">',link,'</a>')\")->execute();\n break;\n case 'sqlsrv':\n case 'dblib':\n case 'mssql':\n try{\n $oDB->createCommand(\"UPDATE {{answers}} SET assessment_value=CAST([code] as int) WHERE ISNUMERIC([code])=1\")->execute();\n $oDB->createCommand(\"UPDATE {{labels}} SET assessment_value=CAST([code] as int) WHERE ISNUMERIC([code])=1\")->execute();\n } catch(Exception $e){};\n // copy assessment link to message since from now on we will have HTML assignment messages\n alterColumn('{{assessments}}','link',\"text\",false);\n alterColumn('{{assessments}}','message',\"text\",false);\n $oDB->createCommand(\"UPDATE {{assessments}} set message=replace(message,'/''','''')+'<br /><a href=\\\"'+link+'\\\">'+link+'</a>'\")->execute();\n break;\n case 'pgsql':\n $oDB->createCommand(\"UPDATE {{answers}} SET assessment_value=CAST(code as integer) where code ~ '^[0-9]+'\")->execute();\n $oDB->createCommand(\"UPDATE {{labels}} SET assessment_value=CAST(code as integer) where code ~ '^[0-9]+'\")->execute();\n // copy assessment link to message since from now on we will have HTML assignment messages\n $oDB->createCommand(\"UPDATE {{assessments}} set message=replace(message,'/''','''')||'<br /><a href=\\\"'||link||'\\\">'||link||'</a>'\")->execute();\n break;\n default: die('Unknown database type');\n }\n // activate assessment where assessment rules exist\n $oDB->createCommand(\"UPDATE {{surveys}} SET assessments='Y' where sid in (SELECT sid FROM {{assessments}} group by sid)\")->execute();\n // add language field to assessment table\n addColumn('{{assessments}}','language',\"string(20) NOT NULL default 'en'\");\n // update language field with default language of that particular survey\n $oDB->createCommand(\"UPDATE {{assessments}} SET language=(select language from {{surveys}} where sid={{assessments}}.sid)\")->execute();\n // drop the old link field\n dropColumn('{{assessments}}','link');\n\n // Add new fields to survey language settings\n addColumn('{{surveys_languagesettings}}','surveyls_url',\"string\");\n addColumn('{{surveys_languagesettings}}','surveyls_endtext','text');\n // copy old URL fields ot language specific entries\n $oDB->createCommand(\"UPDATE {{surveys_languagesettings}} set surveyls_url=(select url from {{surveys}} where sid={{surveys_languagesettings}}.surveyls_survey_id)\")->execute();\n // drop old URL field\n dropColumn('{{surveys}}','url');\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>133),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 134)\n {\n // Add new tokens setting\n addColumn('{{surveys}}','usetokens',\"string(1) NOT NULL default 'N'\");\n addColumn('{{surveys}}','attributedescriptions','text');\n dropColumn('{{surveys}}','attribute1');\n dropColumn('{{surveys}}','attribute2');\n upgradeTokenTables134();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>134),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 135)\n {\n alterColumn('{{question_attributes}}','value','text');\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>135),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 136) //New Quota Functions\n {\n addColumn('{{quota}}','autoload_url',\"integer NOT NULL default 0\");\n // Create quota table\n $aFields = array(\n 'quotals_id' => 'pk',\n 'quotals_quota_id' => 'integer NOT NULL DEFAULT 0',\n 'quotals_language' => \"string(45) NOT NULL default 'en'\",\n 'quotals_name' => 'string',\n 'quotals_message' => 'text NOT NULL',\n 'quotals_url' => 'string',\n 'quotals_urldescrip' => 'string',\n );\n $oDB->createCommand()->createTable('{{quota_languagesettings}}',$aFields);\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>136),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 137) //New Quota Functions\n {\n addColumn('{{surveys_languagesettings}}','surveyls_dateformat',\"integer NOT NULL default 1\");\n addColumn('{{users}}','dateformat',\"integer NOT NULL default 1\");\n $oDB->createCommand()->update('{{surveys}}',array('startdate'=>NULL),\"usestartdate='N'\");\n $oDB->createCommand()->update('{{surveys}}',array('expires'=>NULL),\"useexpiry='N'\");\n dropColumn('{{surveys}}','useexpiry');\n dropColumn('{{surveys}}','usestartdate');\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>137),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 138) //Modify quota field\n {\n alterColumn('{{quota_members}}','code',\"string(11)\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>138),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 139) //Modify quota field\n {\n upgradeSurveyTables139();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>139),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 140) //Modify surveys table\n {\n addColumn('{{surveys}}','emailresponseto','text');\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>140),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 141) //Modify surveys table\n {\n addColumn('{{surveys}}','tokenlength','integer NOT NULL default 15');\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>141),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 142) //Modify surveys table\n {\n upgradeQuestionAttributes142();\n $oDB->createCommand()->alterColumn('{{surveys}}','expires',\"datetime\");\n $oDB->createCommand()->alterColumn('{{surveys}}','startdate',\"datetime\");\n $oDB->createCommand()->update('{{question_attributes}}',array('value'=>0),\"value='false'\");\n $oDB->createCommand()->update('{{question_attributes}}',array('value'=>1),\"value='true'\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>142),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 143)\n {\n addColumn('{{questions}}','parent_qid','integer NOT NULL default 0');\n addColumn('{{answers}}','scale_id','integer NOT NULL default 0');\n addColumn('{{questions}}','scale_id','integer NOT NULL default 0');\n addColumn('{{questions}}','same_default','integer NOT NULL default 0');\n dropPrimaryKey('answers');\n addPrimaryKey('answers', array('qid','code','language','scale_id'));\n\n $aFields = array(\n 'qid' => \"integer NOT NULL default 0\",\n 'scale_id' => 'integer NOT NULL default 0',\n 'sqid' => 'integer NOT NULL default 0',\n 'language' => 'string(20) NOT NULL',\n 'specialtype' => \"string(20) NOT NULL default ''\",\n 'defaultvalue' => 'text',\n );\n $oDB->createCommand()->createTable('{{defaultvalues}}',$aFields);\n addPrimaryKey('defaultvalues', array('qid','specialtype','language','scale_id','sqid'));\n\n // -Move all 'answers' that are subquestions to the questions table\n // -Move all 'labels' that are answers to the answers table\n // -Transscribe the default values where applicable\n // -Move default values from answers to questions\n upgradeTables143();\n\n dropColumn('{{answers}}','default_value');\n dropColumn('{{questions}}','lid');\n dropColumn('{{questions}}','lid1');\n\n $aFields = array(\n 'sesskey' => \"string(64) NOT NULL DEFAULT ''\",\n 'expiry' => \"datetime NOT NULL\",\n 'expireref' => \"string(250) DEFAULT ''\",\n 'created' => \"datetime NOT NULL\",\n 'modified' => \"datetime NOT NULL\",\n 'sessdata' => 'text'\n );\n $oDB->createCommand()->createTable('{{sessions}}',$aFields);\n addPrimaryKey('sessions',array('sesskey'));\n $oDB->createCommand()->createIndex('sess2_expiry','{{sessions}}','expiry');\n $oDB->createCommand()->createIndex('sess2_expireref','{{sessions}}','expireref');\n // Move all user templates to the new user template directory\n echo \"<br>\".sprintf(gT(\"Moving user templates to new location at %s...\"),$sUserTemplateRootDir).\"<br />\";\n $hTemplateDirectory = opendir($sStandardTemplateRootDir);\n $aFailedTemplates=array();\n // get each entry\n while($entryName = readdir($hTemplateDirectory)) {\n if (!in_array($entryName,array('.','..','.svn')) && is_dir($sStandardTemplateRootDir.DIRECTORY_SEPARATOR.$entryName) && !isStandardTemplate($entryName))\n {\n if (!rename($sStandardTemplateRootDir.DIRECTORY_SEPARATOR.$entryName,$sUserTemplateRootDir.DIRECTORY_SEPARATOR.$entryName))\n {\n $aFailedTemplates[]=$entryName;\n };\n }\n }\n if (count($aFailedTemplates)>0)\n {\n echo \"The following templates at {$sStandardTemplateRootDir} could not be moved to the new location at {$sUserTemplateRootDir}:<br /><ul>\";\n foreach ($aFailedTemplates as $sFailedTemplate)\n {\n echo \"<li>{$sFailedTemplate}</li>\";\n }\n echo \"</ul>Please move these templates manually after the upgrade has finished.<br />\";\n }\n // close directory\n closedir($hTemplateDirectory);\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>143),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 145)\n {\n addColumn('{{surveys}}','savetimings',\"string(1) NULL default 'N'\");\n addColumn('{{surveys}}','showXquestions',\"string(1) NULL default 'Y'\");\n addColumn('{{surveys}}','showgroupinfo',\"string(1) NULL default 'B'\");\n addColumn('{{surveys}}','shownoanswer',\"string(1) NULL default 'Y'\");\n addColumn('{{surveys}}','showqnumcode',\"string(1) NULL default 'X'\");\n addColumn('{{surveys}}','bouncetime','integer');\n addColumn('{{surveys}}','bounceprocessing',\"string(1) NULL default 'N'\");\n addColumn('{{surveys}}','bounceaccounttype',\"string(4)\");\n addColumn('{{surveys}}','bounceaccounthost',\"string(200)\");\n addColumn('{{surveys}}','bounceaccountpass',\"string(100)\");\n addColumn('{{surveys}}','bounceaccountencryption',\"string(3)\");\n addColumn('{{surveys}}','bounceaccountuser',\"string(200)\");\n addColumn('{{surveys}}','showwelcome',\"string(1) default 'Y'\");\n addColumn('{{surveys}}','showprogress',\"string(1) default 'Y'\");\n addColumn('{{surveys}}','allowjumps',\"string(1) default 'N'\");\n addColumn('{{surveys}}','navigationdelay',\"integer default 0\");\n addColumn('{{surveys}}','nokeyboard',\"string(1) default 'N'\");\n addColumn('{{surveys}}','alloweditaftercompletion',\"string(1) default 'N'\");\n\n\n $aFields = array(\n 'sid' => \"integer NOT NULL\",\n 'uid' => \"integer NOT NULL\",\n 'permission' => 'string(20) NOT NULL',\n 'create_p' => \"integer NOT NULL default 0\",\n 'read_p' => \"integer NOT NULL default 0\",\n 'update_p' => \"integer NOT NULL default 0\",\n 'delete_p' => \"integer NOT NULL default 0\",\n 'import_p' => \"integer NOT NULL default 0\",\n 'export_p' => \"integer NOT NULL default 0\"\n );\n $oDB->createCommand()->createTable('{{survey_permissions}}',$aFields);\n addPrimaryKey('survey_permissions', array('sid','uid','permission'));\n\n upgradeSurveyPermissions145();\n\n // drop the old survey rights table\n $oDB->createCommand()->dropTable('{{surveys_rights}}');\n\n // Add new fields for email templates\n addColumn('{{surveys_languagesettings}}','email_admin_notification_subj',\"string\");\n addColumn('{{surveys_languagesettings}}','email_admin_responses_subj',\"string\");\n addColumn('{{surveys_languagesettings}}','email_admin_notification',\"text\");\n addColumn('{{surveys_languagesettings}}','email_admin_responses',\"text\");\n\n //Add index to questions table to speed up subquestions\n $oDB->createCommand()->createIndex('parent_qid_idx','{{questions}}','parent_qid');\n\n addColumn('{{surveys}}','emailnotificationto',\"text\");\n\n upgradeSurveys145();\n dropColumn('{{surveys}}','notification');\n alterColumn('{{conditions}}','method',\"string(5)\",false,'');\n\n $oDB->createCommand()->renameColumn('{{surveys}}','private','anonymized');\n $oDB->createCommand()->update('{{surveys}}',array('anonymized'=>'N'),\"anonymized is NULL\");\n alterColumn('{{surveys}}','anonymized',\"string(1)\",false,'N');\n\n //now we clean up things that were not properly set in previous DB upgrades\n $oDB->createCommand()->update('{{answers}}',array('answer'=>''),\"answer is NULL\");\n $oDB->createCommand()->update('{{assessments}}',array('scope'=>''),\"scope is NULL\");\n $oDB->createCommand()->update('{{assessments}}',array('name'=>''),\"name is NULL\");\n $oDB->createCommand()->update('{{assessments}}',array('message'=>''),\"message is NULL\");\n $oDB->createCommand()->update('{{assessments}}',array('minimum'=>''),\"minimum is NULL\");\n $oDB->createCommand()->update('{{assessments}}',array('maximum'=>''),\"maximum is NULL\");\n $oDB->createCommand()->update('{{groups}}',array('group_name'=>''),\"group_name is NULL\");\n $oDB->createCommand()->update('{{labels}}',array('code'=>''),\"code is NULL\");\n $oDB->createCommand()->update('{{labelsets}}',array('label_name'=>''),\"label_name is NULL\");\n $oDB->createCommand()->update('{{questions}}',array('type'=>'T'),\"type is NULL\");\n $oDB->createCommand()->update('{{questions}}',array('title'=>''),\"title is NULL\");\n $oDB->createCommand()->update('{{questions}}',array('question'=>''),\"question is NULL\");\n $oDB->createCommand()->update('{{questions}}',array('other'=>'N'),\"other is NULL\");\n\n alterColumn('{{answers}}','answer',\"text\",false);\n alterColumn('{{answers}}','assessment_value','integer',false , '0');\n alterColumn('{{assessments}}','scope',\"string(5)\",false , '');\n alterColumn('{{assessments}}','name',\"text\",false);\n alterColumn('{{assessments}}','message',\"text\",false);\n alterColumn('{{assessments}}','minimum',\"string(50)\",false , '');\n alterColumn('{{assessments}}','maximum',\"string(50)\",false , '');\n // change the primary index to include language\n if (Yii::app()->db->driverName=='mysql') // special treatment for mysql because this needs to be in one step since an AUTOINC field is involved\n {\n modifyPrimaryKey('assessments', array('id', 'language'));\n }\n else\n {\n dropPrimaryKey('assessments');\n addPrimaryKey('assessments',array('id','language'));\n }\n\n\n alterColumn('{{conditions}}','cfieldname',\"string(50)\",false , '');\n dropPrimaryKey('defaultvalues');\n alterColumn('{{defaultvalues}}','specialtype',\"string(20)\",false , '');\n addPrimaryKey('defaultvalues', array('qid','specialtype','language','scale_id','sqid'));\n\n alterColumn('{{groups}}','group_name',\"string(100)\",false , '');\n alterColumn('{{labels}}','code',\"string(5)\",false , '');\n dropPrimaryKey('labels');\n alterColumn('{{labels}}','language',\"string(20)\",false , 'en');\n addPrimaryKey('labels', array('lid', 'sortorder', 'language'));\n alterColumn('{{labelsets}}','label_name',\"string(100)\",false , '');\n alterColumn('{{questions}}','parent_qid','integer',false ,'0');\n alterColumn('{{questions}}','title',\"string(20)\",false , '');\n alterColumn('{{questions}}','question',\"text\",false);\n try { setTransactionBookmark(); $oDB->createCommand()->dropIndex('questions_idx4','{{questions}}'); } catch(Exception $e) { rollBackToTransactionBookmark();}\n\n alterColumn('{{questions}}','type',\"string(1)\",false , 'T');\n try{ $oDB->createCommand()->createIndex('questions_idx4','{{questions}}','type');} catch(Exception $e){};\n alterColumn('{{questions}}','other',\"string(1)\",false , 'N');\n alterColumn('{{questions}}','mandatory',\"string(1)\");\n alterColumn('{{question_attributes}}','attribute',\"string(50)\");\n alterColumn('{{quota}}','qlimit','integer');\n\n $oDB->createCommand()->update('{{saved_control}}',array('identifier'=>''),\"identifier is NULL\");\n alterColumn('{{saved_control}}','identifier',\"text\",false);\n $oDB->createCommand()->update('{{saved_control}}',array('access_code'=>''),\"access_code is NULL\");\n alterColumn('{{saved_control}}','access_code',\"text\",false);\n alterColumn('{{saved_control}}','email',\"string(320)\");\n $oDB->createCommand()->update('{{saved_control}}',array('ip'=>''),\"ip is NULL\");\n alterColumn('{{saved_control}}','ip',\"text\",false);\n $oDB->createCommand()->update('{{saved_control}}',array('saved_thisstep'=>''),\"saved_thisstep is NULL\");\n alterColumn('{{saved_control}}','saved_thisstep',\"text\",false);\n $oDB->createCommand()->update('{{saved_control}}',array('status'=>''),\"status is NULL\");\n alterColumn('{{saved_control}}','status',\"string(1)\",false , '');\n $oDB->createCommand()->update('{{saved_control}}',array('saved_date'=>'1980-01-01 00:00:00'),\"saved_date is NULL\");\n alterColumn('{{saved_control}}','saved_date',\"datetime\",false);\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>''),\"stg_value is NULL\");\n alterColumn('{{settings_global}}','stg_value',\"string\",false , '');\n\n alterColumn('{{surveys}}','admin',\"string(50)\");\n $oDB->createCommand()->update('{{surveys}}',array('active'=>'N'),\"active is NULL\");\n\n alterColumn('{{surveys}}','active',\"string(1)\",false , 'N');\n\n alterColumn('{{surveys}}','startdate',\"datetime\");\n alterColumn('{{surveys}}','adminemail',\"string(320)\");\n alterColumn('{{surveys}}','anonymized',\"string(1)\",false , 'N');\n\n alterColumn('{{surveys}}','faxto',\"string(20)\");\n alterColumn('{{surveys}}','format',\"string(1)\");\n alterColumn('{{surveys}}','language',\"string(50)\");\n alterColumn('{{surveys}}','additional_languages',\"string\");\n alterColumn('{{surveys}}','printanswers',\"string(1)\",true , 'N');\n alterColumn('{{surveys}}','publicstatistics',\"string(1)\",true , 'N');\n alterColumn('{{surveys}}','publicgraphs',\"string(1)\",true , 'N');\n alterColumn('{{surveys}}','assessments',\"string(1)\",true , 'N');\n alterColumn('{{surveys}}','usetokens',\"string(1)\",true , 'N');\n alterColumn('{{surveys}}','bounce_email',\"string(320)\");\n alterColumn('{{surveys}}','tokenlength','integer',true , 15);\n\n $oDB->createCommand()->update('{{surveys_languagesettings}}',array('surveyls_title'=>''),\"surveyls_title is NULL\");\n alterColumn('{{surveys_languagesettings}}','surveyls_title',\"string(200)\",false);\n alterColumn('{{surveys_languagesettings}}','surveyls_endtext',\"text\");\n alterColumn('{{surveys_languagesettings}}','surveyls_url',\"string\");\n alterColumn('{{surveys_languagesettings}}','surveyls_urldescription',\"string\");\n alterColumn('{{surveys_languagesettings}}','surveyls_email_invite_subj',\"string\");\n alterColumn('{{surveys_languagesettings}}','surveyls_email_remind_subj',\"string\");\n alterColumn('{{surveys_languagesettings}}','surveyls_email_register_subj',\"string\");\n alterColumn('{{surveys_languagesettings}}','surveyls_email_confirm_subj',\"string\");\n alterColumn('{{surveys_languagesettings}}','surveyls_dateformat','integer',false , 1);\n\n $oDB->createCommand()->update('{{users}}',array('users_name'=>''),\"users_name is NULL\");\n $oDB->createCommand()->update('{{users}}',array('full_name'=>''),\"full_name is NULL\");\n alterColumn('{{users}}','users_name',\"string(64)\",false , '');\n alterColumn('{{users}}','full_name',\"string(50)\",false);\n alterColumn('{{users}}','lang',\"string(20)\");\n alterColumn('{{users}}','email',\"string(320)\");\n alterColumn('{{users}}','superadmin','integer',false , 0);\n alterColumn('{{users}}','htmleditormode',\"string(7)\",true,'default');\n alterColumn('{{users}}','dateformat','integer',false , 1);\n try{\n setTransactionBookmark();\n $oDB->createCommand()->dropIndex('email','{{users}}');\n }\n catch(Exception $e)\n {\n // do nothing\n rollBackToTransactionBookmark();\n }\n\n $oDB->createCommand()->update('{{user_groups}}',array('name'=>''),\"name is NULL\");\n $oDB->createCommand()->update('{{user_groups}}',array('description'=>''),\"description is NULL\");\n alterColumn('{{user_groups}}','name',\"string(20)\",false);\n alterColumn('{{user_groups}}','description',\"text\",false);\n\n try { $oDB->createCommand()->dropIndex('user_in_groups_idx1','{{user_in_groups}}'); } catch(Exception $e) {}\n try { addPrimaryKey('user_in_groups', array('ugid','uid')); } catch(Exception $e) {}\n\n addColumn('{{surveys_languagesettings}}','surveyls_numberformat',\"integer NOT NULL DEFAULT 0\");\n\n $oDB->createCommand()->createTable('{{failed_login_attempts}}',array(\n 'id' => \"pk\",\n 'ip' => 'string(37) NOT NULL',\n 'last_attempt' => 'string(20) NOT NULL',\n 'number_attempts' => \"integer NOT NULL\"\n ));\n upgradeTokens145();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>145),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 146) //Modify surveys table\n {\n upgradeSurveyTimings146();\n // Fix permissions for new feature quick-translation\n try { setTransactionBookmark(); $oDB->createCommand(\"INSERT into {{survey_permissions}} (sid,uid,permission,read_p,update_p) SELECT sid,owner_id,'translations','1','1' from {{surveys}}\")->execute(); echo $modifyoutput; flush();@ob_flush();} catch(Exception $e) { rollBackToTransactionBookmark();}\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>146),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 147)\n {\n addColumn('{{users}}','templateeditormode',\"string(7) NOT NULL default 'default'\");\n addColumn('{{users}}','questionselectormode',\"string(7) NOT NULL default 'default'\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>147),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 148)\n {\n addColumn('{{users}}','participant_panel',\"integer NOT NULL default 0\");\n\n $oDB->createCommand()->createTable('{{participants}}',array(\n 'participant_id' => 'string(50) NOT NULL',\n 'firstname' => 'string(40) default NULL',\n 'lastname' => 'string(40) default NULL',\n 'email' => 'string(80) default NULL',\n 'language' => 'string(40) default NULL',\n 'blacklisted' => 'string(1) NOT NULL',\n 'owner_uid' => \"integer NOT NULL\"\n ));\n addPrimaryKey('participants', array('participant_id'));\n\n $oDB->createCommand()->createTable('{{participant_attribute}}',array(\n 'participant_id' => 'string(50) NOT NULL',\n 'attribute_id' => \"integer NOT NULL\",\n 'value' => 'string(50) NOT NULL'\n ));\n addPrimaryKey('participant_attribute', array('participant_id','attribute_id'));\n\n $oDB->createCommand()->createTable('{{participant_attribute_names}}',array(\n 'attribute_id' => 'autoincrement',\n 'attribute_type' => 'string(4) NOT NULL',\n 'visible' => 'string(5) NOT NULL',\n 'PRIMARY KEY (attribute_id,attribute_type)'\n ));\n\n $oDB->createCommand()->createTable('{{participant_attribute_names_lang}}',array(\n 'attribute_id' => 'integer NOT NULL',\n 'attribute_name' => 'string(30) NOT NULL',\n 'lang' => 'string(20) NOT NULL'\n ));\n addPrimaryKey('participant_attribute_names_lang', array('attribute_id','lang'));\n\n $oDB->createCommand()->createTable('{{participant_attribute_values}}',array(\n 'attribute_id' => 'integer NOT NULL',\n 'value_id' => 'pk',\n 'value' => 'string(20) NOT NULL'\n ));\n\n $oDB->createCommand()->createTable('{{participant_shares}}',array(\n 'participant_id' => 'string(50) NOT NULL',\n 'share_uid' => 'integer NOT NULL',\n 'date_added' => 'datetime NOT NULL',\n 'can_edit' => 'string(5) NOT NULL'\n ));\n addPrimaryKey('participant_shares', array('participant_id','share_uid'));\n\n $oDB->createCommand()->createTable('{{survey_links}}',array(\n 'participant_id' => 'string(50) NOT NULL',\n 'token_id' => 'integer NOT NULL',\n 'survey_id' => 'integer NOT NULL',\n 'date_created' => 'datetime NOT NULL'\n ));\n addPrimaryKey('survey_links', array('participant_id','token_id','survey_id'));\n // Add language field to question_attributes table\n addColumn('{{question_attributes}}','language',\"string(20)\");\n upgradeQuestionAttributes148();\n fixSubquestions();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>148),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 149)\n {\n $aFields = array(\n 'id' => 'integer',\n 'sid' => 'integer',\n 'parameter' => 'string(50)',\n 'targetqid' => 'integer',\n 'targetsqid' => 'integer'\n );\n $oDB->createCommand()->createTable('{{survey_url_parameters}}',$aFields);\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>149),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 150)\n {\n addColumn('{{questions}}','relevance','TEXT');\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>150),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 151)\n {\n addColumn('{{groups}}','randomization_group',\"string(20) NOT NULL default ''\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>151),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 152)\n {\n $oDB->createCommand()->createIndex('question_attributes_idx3','{{question_attributes}}','attribute');\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>152),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 153)\n {\n $oDB->createCommand()->createTable('{{expression_errors}}',array(\n 'id' => 'pk',\n 'errortime' => 'string(50)',\n 'sid' => 'integer',\n 'gid' => 'integer',\n 'qid' => 'integer',\n 'gseq' => 'integer',\n 'qseq' => 'integer',\n 'type' => 'string(50)',\n 'eqn' => 'text',\n 'prettyprint' => 'text'\n ));\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>153),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 154)\n {\n $oDB->createCommand()->addColumn('{{groups}}','grelevance',\"text\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>154),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 155)\n {\n addColumn('{{surveys}}','googleanalyticsstyle',\"string(1)\");\n addColumn('{{surveys}}','googleanalyticsapikey',\"string(25)\");\n try { setTransactionBookmark(); $oDB->createCommand()->renameColumn('{{surveys}}','showXquestions','showxquestions');} catch(Exception $e) { rollBackToTransactionBookmark();}\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>155),\"stg_name='DBVersion'\");\n }\n\n\n if ($iOldDBVersion < 156)\n {\n try\n {\n $oDB->createCommand()->dropTable('{{survey_url_parameters}}');\n }\n catch(Exception $e)\n {\n // do nothing\n }\n $oDB->createCommand()->createTable('{{survey_url_parameters}}',array(\n 'id' => 'pk',\n 'sid' => 'integer NOT NULL',\n 'parameter' => 'string(50) NOT NULL',\n 'targetqid' => 'integer',\n 'targetsqid' => 'integer'\n ));\n\n $oDB->createCommand()->dropTable('{{sessions}}');\n if (Yii::app()->db->driverName=='mysql')\n {\n $oDB->createCommand()->createTable('{{sessions}}',array(\n 'id' => 'string(32) NOT NULL',\n 'expire' => 'integer',\n 'data' => 'longtext'\n ));\n }\n else\n {\n $oDB->createCommand()->createTable('{{sessions}}',array(\n 'id' => 'string(32) NOT NULL',\n 'expire' => 'integer',\n 'data' => 'text'\n ));\n }\n\n addPrimaryKey('sessions', array('id'));\n addColumn('{{surveys_languagesettings}}','surveyls_attributecaptions',\"TEXT\");\n addColumn('{{surveys}}','sendconfirmation',\"string(1) default 'Y'\");\n\n upgradeSurveys156();\n\n // If a survey has an deleted owner, re-own the survey to the superadmin\n $oDB->schema->refresh();\n Survey::model()->refreshMetaData();\n $surveys = Survey::model();\n $surveys = $surveys->with(array('owner'))->findAll();\n foreach ($surveys as $row)\n {\n if (!isset($row->owner->attributes))\n {\n Survey::model()->updateByPk($row->sid,array('owner_id'=>1));\n }\n }\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>156),\"stg_name='DBVersion'\");\n $oTransaction->commit();\n $oTransaction=$oDB->beginTransaction();\n }\n\n if ($iOldDBVersion < 157)\n {\n // MySQL DB corrections\n try { setTransactionBookmark(); $oDB->createCommand()->dropIndex('questions_idx4','{{questions}}'); } catch(Exception $e) { rollBackToTransactionBookmark();}\n\n alterColumn('{{answers}}','assessment_value','integer',false , '0');\n dropPrimaryKey('answers');\n alterColumn('{{answers}}','scale_id','integer',false , '0');\n addPrimaryKey('answers', array('qid','code','language','scale_id'));\n alterColumn('{{conditions}}','method',\"string(5)\",false , '');\n alterColumn('{{participants}}','owner_uid','integer',false);\n alterColumn('{{participant_attribute_names}}','visible','string(5)',false);\n alterColumn('{{questions}}','type',\"string(1)\",false , 'T');\n alterColumn('{{questions}}','other',\"string(1)\",false , 'N');\n alterColumn('{{questions}}','mandatory',\"string(1)\");\n alterColumn('{{questions}}','scale_id','integer',false , '0');\n alterColumn('{{questions}}','parent_qid','integer',false ,'0');\n\n alterColumn('{{questions}}','same_default','integer',false , '0');\n alterColumn('{{quota}}','qlimit','integer');\n alterColumn('{{quota}}','action','integer');\n alterColumn('{{quota}}','active','integer',false , '1');\n alterColumn('{{quota}}','autoload_url','integer',false , '0');\n alterColumn('{{saved_control}}','status',\"string(1)\",false , '');\n try { setTransactionBookmark(); alterColumn('{{sessions}}','id',\"string(32)\",false); } catch(Exception $e) { rollBackToTransactionBookmark();}\n alterColumn('{{surveys}}','active',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','anonymized',\"string(1)\",false,'N');\n alterColumn('{{surveys}}','format',\"string(1)\");\n alterColumn('{{surveys}}','savetimings',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','datestamp',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','usecookie',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','allowregister',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','allowsave',\"string(1)\",false , 'Y');\n alterColumn('{{surveys}}','autonumber_start','integer' ,false, '0');\n alterColumn('{{surveys}}','autoredirect',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','allowprev',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','printanswers',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','ipaddr',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','refurl',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','publicstatistics',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','publicgraphs',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','listpublic',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','htmlemail',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','sendconfirmation',\"string(1)\",false , 'Y');\n alterColumn('{{surveys}}','tokenanswerspersistence',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','assessments',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','usecaptcha',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','usetokens',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','tokenlength','integer',false, '15');\n alterColumn('{{surveys}}','showxquestions',\"string(1)\", true , 'Y');\n alterColumn('{{surveys}}','showgroupinfo',\"string(1) \", true , 'B');\n alterColumn('{{surveys}}','shownoanswer',\"string(1) \", true , 'Y');\n alterColumn('{{surveys}}','showqnumcode',\"string(1) \", true , 'X');\n alterColumn('{{surveys}}','bouncetime','integer');\n alterColumn('{{surveys}}','showwelcome',\"string(1)\", true , 'Y');\n alterColumn('{{surveys}}','showprogress',\"string(1)\", true , 'Y');\n alterColumn('{{surveys}}','allowjumps',\"string(1)\", true , 'N');\n alterColumn('{{surveys}}','navigationdelay','integer', false , '0');\n alterColumn('{{surveys}}','nokeyboard',\"string(1)\", true , 'N');\n alterColumn('{{surveys}}','alloweditaftercompletion',\"string(1)\", true , 'N');\n alterColumn('{{surveys}}','googleanalyticsstyle',\"string(1)\");\n\n alterColumn('{{surveys_languagesettings}}','surveyls_dateformat','integer',false , 1);\n try { setTransactionBookmark(); alterColumn('{{survey_permissions}}','sid',\"integer\",false); } catch(Exception $e) { rollBackToTransactionBookmark();}\n try { setTransactionBookmark(); alterColumn('{{survey_permissions}}','uid',\"integer\",false); } catch(Exception $e) { rollBackToTransactionBookmark();}\n alterColumn('{{survey_permissions}}','create_p', 'integer',false , '0');\n alterColumn('{{survey_permissions}}','read_p', 'integer',false , '0');\n alterColumn('{{survey_permissions}}','update_p','integer',false , '0');\n alterColumn('{{survey_permissions}}','delete_p' ,'integer',false , '0');\n alterColumn('{{survey_permissions}}','import_p','integer',false , '0');\n alterColumn('{{survey_permissions}}','export_p' ,'integer',false , '0');\n\n alterColumn('{{survey_url_parameters}}','targetqid' ,'integer');\n alterColumn('{{survey_url_parameters}}','targetsqid' ,'integer');\n\n alterColumn('{{templates_rights}}','use','integer',false );\n\n alterColumn('{{users}}','create_survey','integer',false, '0');\n alterColumn('{{users}}','create_user','integer',false, '0');\n alterColumn('{{users}}','participant_panel','integer',false, '0');\n alterColumn('{{users}}','delete_user','integer',false, '0');\n alterColumn('{{users}}','superadmin','integer',false, '0');\n alterColumn('{{users}}','configurator','integer',false, '0');\n alterColumn('{{users}}','manage_template','integer',false, '0');\n alterColumn('{{users}}','manage_label','integer',false, '0');\n alterColumn('{{users}}','dateformat','integer',false, 1);\n alterColumn('{{users}}','participant_panel','integer',false , '0');\n alterColumn('{{users}}','parent_id','integer',false);\n try { setTransactionBookmark(); alterColumn('{{surveys_languagesettings}}','surveyls_survey_id',\"integer\",false); } catch(Exception $e) { rollBackToTransactionBookmark(); }\n alterColumn('{{user_groups}}','owner_id',\"integer\",false);\n dropPrimaryKey('user_in_groups');\n alterColumn('{{user_in_groups}}','ugid',\"integer\",false);\n alterColumn('{{user_in_groups}}','uid',\"integer\",false);\n\n // Additional corrections for Postgres\n try{ setTransactionBookmark(); $oDB->createCommand()->createIndex('questions_idx3','{{questions}}','gid');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); $oDB->createCommand()->createIndex('conditions_idx3','{{conditions}}','cqid');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); $oDB->createCommand()->createIndex('questions_idx4','{{questions}}','type');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); $oDB->createCommand()->dropIndex('user_in_groups_idx1','{{user_in_groups}}');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); $oDB->createCommand()->dropIndex('{{user_name_key}}','{{users}}');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); $oDB->createCommand()->createIndex('users_name','{{users}}','users_name',true);} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); addPrimaryKey('user_in_groups', array('ugid','uid'));} catch(Exception $e) { rollBackToTransactionBookmark(); };\n\n alterColumn('{{participant_attribute}}','value',\"string(50)\", false);\n try{ setTransactionBookmark(); alterColumn('{{participant_attribute_names}}','attribute_type',\"string(4)\", false);} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); dropColumn('{{participant_attribute_names_lang}}','id');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); addPrimaryKey('participant_attribute_names_lang',array('attribute_id','lang'));} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); $oDB->createCommand()->renameColumn('{{participant_shares}}','shared_uid','share_uid');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n alterColumn('{{participant_shares}}','date_added',\"datetime\", false);\n alterColumn('{{participants}}','firstname',\"string(40)\");\n alterColumn('{{participants}}','lastname',\"string(40)\");\n alterColumn('{{participants}}','email',\"string(80)\");\n alterColumn('{{participants}}','language',\"string(40)\");\n alterColumn('{{quota_languagesettings}}','quotals_name',\"string\");\n try{ setTransactionBookmark(); alterColumn('{{survey_permissions}}','sid','integer',false); } catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); alterColumn('{{survey_permissions}}','uid','integer',false); } catch(Exception $e) { rollBackToTransactionBookmark(); };\n alterColumn('{{users}}','htmleditormode',\"string(7)\",true,'default');\n\n // Sometimes the survey_links table was deleted before this step, if so\n // we recreate it (copied from line 663)\n if (!tableExists('{survey_links}')) {\n $oDB->createCommand()->createTable('{{survey_links}}',array(\n 'participant_id' => 'string(50) NOT NULL',\n 'token_id' => 'integer NOT NULL',\n 'survey_id' => 'integer NOT NULL',\n 'date_created' => 'datetime NOT NULL'\n ));\n addPrimaryKey('survey_links', array('participant_id','token_id','survey_id'));\n }\n alterColumn('{{survey_links}}','date_created',\"datetime\",true);\n alterColumn('{{saved_control}}','identifier',\"text\",false);\n alterColumn('{{saved_control}}','email',\"string(320)\");\n alterColumn('{{surveys}}','adminemail',\"string(320)\");\n alterColumn('{{surveys}}','bounce_email',\"string(320)\");\n alterColumn('{{users}}','email',\"string(320)\");\n\n try{ setTransactionBookmark(); $oDB->createCommand()->dropIndex('assessments_idx','{{assessments}}');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); $oDB->createCommand()->createIndex('assessments_idx3','{{assessments}}','gid');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n\n try{ setTransactionBookmark(); $oDB->createCommand()->dropIndex('ixcode','{{labels}}');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); $oDB->createCommand()->dropIndex('{{labels_ixcode_idx}}','{{labels}}');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); $oDB->createCommand()->createIndex('labels_code_idx','{{labels}}','code');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n\n\n\n if (Yii::app()->db->driverName=='pgsql')\n {\n try{ setTransactionBookmark(); $oDB->createCommand(\"ALTER TABLE ONLY {{user_groups}} ADD PRIMARY KEY (ugid); \")->execute;} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); $oDB->createCommand(\"ALTER TABLE ONLY {{users}} ADD PRIMARY KEY (uid); \")->execute;} catch(Exception $e) { rollBackToTransactionBookmark(); };\n }\n\n // Additional corrections for MSSQL\n alterColumn('{{answers}}','answer',\"text\",false);\n alterColumn('{{assessments}}','name',\"text\",false);\n alterColumn('{{assessments}}','message',\"text\",false);\n alterColumn('{{defaultvalues}}','defaultvalue',\"text\");\n alterColumn('{{expression_errors}}','eqn',\"text\");\n alterColumn('{{expression_errors}}','prettyprint',\"text\");\n alterColumn('{{groups}}','description',\"text\");\n alterColumn('{{groups}}','grelevance',\"text\");\n alterColumn('{{labels}}','title',\"text\");\n alterColumn('{{question_attributes}}','value',\"text\");\n alterColumn('{{questions}}','preg',\"text\");\n alterColumn('{{questions}}','help',\"text\");\n alterColumn('{{questions}}','relevance',\"text\");\n alterColumn('{{questions}}','question',\"text\",false);\n alterColumn('{{quota_languagesettings}}','quotals_quota_id',\"integer\",false);\n alterColumn('{{quota_languagesettings}}','quotals_message',\"text\",false);\n alterColumn('{{saved_control}}','refurl',\"text\");\n alterColumn('{{saved_control}}','access_code',\"text\",false);\n alterColumn('{{saved_control}}','ip',\"text\",false);\n alterColumn('{{saved_control}}','saved_thisstep',\"text\",false);\n alterColumn('{{saved_control}}','saved_date',\"datetime\",false);\n alterColumn('{{surveys}}','attributedescriptions',\"text\");\n alterColumn('{{surveys}}','emailresponseto',\"text\");\n alterColumn('{{surveys}}','emailnotificationto',\"text\");\n\n alterColumn('{{surveys_languagesettings}}','surveyls_description',\"text\");\n alterColumn('{{surveys_languagesettings}}','surveyls_welcometext',\"text\");\n alterColumn('{{surveys_languagesettings}}','surveyls_email_invite',\"text\");\n alterColumn('{{surveys_languagesettings}}','surveyls_email_remind',\"text\");\n alterColumn('{{surveys_languagesettings}}','surveyls_email_register',\"text\");\n alterColumn('{{surveys_languagesettings}}','surveyls_email_confirm',\"text\");\n alterColumn('{{surveys_languagesettings}}','surveyls_attributecaptions',\"text\");\n alterColumn('{{surveys_languagesettings}}','email_admin_notification',\"text\");\n alterColumn('{{surveys_languagesettings}}','email_admin_responses',\"text\");\n alterColumn('{{surveys_languagesettings}}','surveyls_endtext',\"text\");\n alterColumn('{{user_groups}}','description',\"text\",false);\n\n\n\n alterColumn('{{conditions}}','value','string',false,'');\n alterColumn('{{participant_shares}}','can_edit',\"string(5)\",false);\n\n alterColumn('{{users}}','password',\"binary\",false);\n dropColumn('{{users}}','one_time_pw');\n addColumn('{{users}}','one_time_pw','binary');\n\n\n $oDB->createCommand()->update('{{question_attributes}}',array('value'=>'1'),\"attribute = 'random_order' and value = '2'\");\n\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>157),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 158)\n {\n LimeExpressionManager::UpgradeConditionsToRelevance();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>158),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 159)\n {\n alterColumn('{{failed_login_attempts}}', 'ip', \"string(40)\",false);\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>159),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 160)\n {\n alterLanguageCode('it','it-informal');\n alterLanguageCode('it-formal','it');\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>160),\"stg_name='DBVersion'\");\n }\n if ($iOldDBVersion < 161)\n {\n addColumn('{{survey_links}}','date_invited','datetime NULL default NULL');\n addColumn('{{survey_links}}','date_completed','datetime NULL default NULL');\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>161),\"stg_name='DBVersion'\");\n }\n if ($iOldDBVersion < 162)\n {\n /* Fix participant db types */\n alterColumn('{{participant_attribute}}', 'value', \"text\", false);\n alterColumn('{{participant_attribute_names_lang}}', 'attribute_name', \"string(255)\", false);\n alterColumn('{{participant_attribute_values}}', 'value', \"text\", false);\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>162),\"stg_name='DBVersion'\");\n }\n if ($iOldDBVersion < 163)\n {\n //Replace by <script type=\"text/javascript\" src=\"{TEMPLATEURL}template.js\"></script> by {TEMPLATEJS}\n\n $replacedTemplate=replaceTemplateJS();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>163),\"stg_name='DBVersion'\");\n\n }\n\n if ($iOldDBVersion < 164)\n {\n upgradeTokens148(); // this should have bee done in 148 - that's why it is named this way\n // fix survey tables for missing or incorrect token field\n upgradeSurveyTables164();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>164),\"stg_name='DBVersion'\");\n\n // Not updating settings table as upgrade process takes care of that step now\n }\n\n if ($iOldDBVersion < 165)\n {\n $oDB->createCommand()->createTable('{{plugins}}', array(\n 'id' => 'pk',\n 'name' => 'string NOT NULL',\n 'active' => 'boolean'\n ));\n $oDB->createCommand()->createTable('{{plugin_settings}}', array(\n 'id' => 'pk',\n 'plugin_id' => 'integer NOT NULL',\n 'model' => 'string',\n 'model_id' => 'integer',\n 'key' => 'string',\n 'value' => 'text'\n ));\n alterColumn('{{surveys_languagesettings}}','surveyls_url',\"text\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>165),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 166)\n {\n $oDB->createCommand()->renameTable('{{survey_permissions}}', '{{permissions}}');\n dropPrimaryKey('permissions');\n alterColumn('{{permissions}}', 'permission', \"string(100)\", false);\n $oDB->createCommand()->renameColumn('{{permissions}}','sid','entity_id');\n alterColumn('{{permissions}}', 'entity_id', \"string(100)\", false);\n addColumn('{{permissions}}','entity',\"string(50)\");\n $oDB->createCommand(\"update {{permissions}} set entity='survey'\")->query();\n addColumn('{{permissions}}','id','pk');\n $oDB->createCommand()->createIndex('idxPermissions','{{permissions}}','entity_id,entity,permission,uid',true);\n\n upgradePermissions166();\n dropColumn('{{users}}','create_survey');\n dropColumn('{{users}}','create_user');\n dropColumn('{{users}}','delete_user');\n dropColumn('{{users}}','superadmin');\n dropColumn('{{users}}','configurator');\n dropColumn('{{users}}','manage_template');\n dropColumn('{{users}}','manage_label');\n dropColumn('{{users}}','participant_panel');\n $oDB->createCommand()->dropTable('{{templates_rights}}');\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>166),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 167)\n {\n addColumn('{{surveys_languagesettings}}', 'attachments', 'text');\n addColumn('{{users}}', 'created', 'datetime');\n addColumn('{{users}}', 'modified', 'datetime');\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>167),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 168)\n {\n addColumn('{{participants}}', 'created', 'datetime');\n addColumn('{{participants}}', 'modified', 'datetime');\n addColumn('{{participants}}', 'created_by', 'integer');\n $oDB->createCommand('update {{participants}} set created_by=owner_uid')->query();\n alterColumn('{{participants}}', 'created_by', \"integer\", false);\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>168),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 169)\n {\n // Add new column for question index options.\n addColumn('{{surveys}}', 'questionindex', 'integer not null default 0');\n // Set values for existing surveys.\n $oDB->createCommand(\"update {{surveys}} set questionindex = 0 where allowjumps <> 'Y'\")->query();\n $oDB->createCommand(\"update {{surveys}} set questionindex = 1 where allowjumps = 'Y'\")->query();\n\n // Remove old column.\n dropColumn('{{surveys}}', 'allowjumps');\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>169),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 170)\n {\n // renamed advanced attributes fields dropdown_dates_year_min/max\n $oDB->createCommand()->update('{{question_attributes}}',array('attribute'=>'date_min'),\"attribute='dropdown_dates_year_min'\");\n $oDB->createCommand()->update('{{question_attributes}}',array('attribute'=>'date_max'),\"attribute='dropdown_dates_year_max'\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>170),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 171)\n {\n try {\n dropColumn('{{sessions}}','data');\n }\n catch (Exception $e) {\n \n }\n switch (Yii::app()->db->driverName){\n case 'mysql':\n case 'mysqli':\n addColumn('{{sessions}}', 'data', 'longbinary');\n break;\n case 'sqlsrv':\n case 'dblib':\n case 'mssql':\n addColumn('{{sessions}}', 'data', 'VARBINARY(MAX)');\n break;\n case 'pgsql':\n addColumn('{{sessions}}', 'data', 'BYTEA');\n break;\n default: die('Unknown database type');\n }\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>171),\"stg_name='DBVersion'\");\n }\n if ($iOldDBVersion < 172)\n {\n switch (Yii::app()->db->driverName){\n case 'pgsql':\n // Special treatment for Postgres as it is too dumb to convert a string to a number without explicit being told to do so ... seriously?\n alterColumn('{{permissions}}', 'entity_id', \"INTEGER USING (entity_id::integer)\", false);\n break;\n case 'sqlsrv':\n case 'dblib':\n case 'mssql':\n try{ setTransactionBookmark(); $oDB->createCommand()->dropIndex('permissions_idx2','{{permissions}}');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); $oDB->createCommand()->dropIndex('idxPermissions','{{permissions}}');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n alterColumn('{{permissions}}', 'entity_id', \"INTEGER\", false);\n $oDB->createCommand()->createIndex('permissions_idx2','{{permissions}}','entity_id,entity,permission,uid',true);\n break;\n default:\n alterColumn('{{permissions}}', 'entity_id', \"INTEGER\", false);\n }\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>172),\"stg_name='DBVersion'\");\n }\n if ($iOldDBVersion < 173)\n {\n addColumn('{{participant_attribute_names}}','defaultname',\"string(50) NOT NULL default ''\");\n upgradeCPDBAttributeDefaultNames173();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>173),\"stg_name='DBVersion'\");\n }\n if ($iOldDBVersion < 174)\n {\n alterColumn('{{participants}}', 'email', \"string(254)\");\n alterColumn('{{saved_control}}', 'email', \"string(254)\");\n alterColumn('{{surveys}}', 'adminemail', \"string(254)\");\n alterColumn('{{surveys}}', 'bounce_email', \"string(254)\");\n switch (Yii::app()->db->driverName){\n case 'sqlsrv':\n case 'dblib':\n case 'mssql': dropUniqueKeyMSSQL('email','{{users}}');\n }\n alterColumn('{{users}}', 'email', \"string(254)\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>174),\"stg_name='DBVersion'\");\n }\n if ($iOldDBVersion < 175)\n {\n switch (Yii::app()->db->driverName){\n case 'pgsql':\n // Special treatment for Postgres as it is too dumb to convert a boolean to a number without explicit being told to do so\n alterColumn('{{plugins}}', 'active', \"INTEGER USING (active::integer)\", false);\n break;\n default:\n alterColumn('{{plugins}}', 'active', \"integer\",false,'0');\n }\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>175),\"stg_name='DBVersion'\");\n }\n if ($iOldDBVersion < 176)\n {\n upgradeTokens176();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>176),\"stg_name='DBVersion'\");\n }\n if ($iOldDBVersion < 177)\n {\n if ( Yii::app()->getConfig('auth_webserver') === true ) {\n // using auth webserver, now activate the plugin with default settings.\n if (!class_exists('Authwebserver', false)) {\n $plugin = Plugin::model()->findByAttributes(array('name'=>'Authwebserver'));\n if (!$plugin) {\n $plugin = new Plugin();\n $plugin->name = 'Authwebserver';\n $plugin->active = 1;\n $plugin->save();\n $plugin = App()->getPluginManager()->loadPlugin('Authwebserver', $plugin->id);\n $aPluginSettings = $plugin->getPluginSettings(true);\n $aDefaultSettings = array();\n foreach ($aPluginSettings as $key => $settings) {\n if (is_array($settings) && array_key_exists('current', $settings) ) {\n $aDefaultSettings[$key] = $settings['current'];\n }\n }\n $plugin->saveSettings($aDefaultSettings);\n } else {\n $plugin->active = 1;\n $plugin->save();\n }\n }\n }\n upgradeSurveys177();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>177),\"stg_name='DBVersion'\");\n }\n if ($iOldDBVersion < 178)\n {\n if (Yii::app()->db->driverName=='mysql' || Yii::app()->db->driverName=='mysqli')\n {\n modifyPrimaryKey('questions', array('qid','language'));\n }\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>178),\"stg_name='DBVersion'\");\n }\n if ($iOldDBVersion < 179)\n {\n upgradeSurveys177(); // Needs to be run again to make sure\n upgradeTokenTables179();\n alterColumn('{{participants}}', 'email', \"string(254)\", false);\n alterColumn('{{participants}}', 'firstname', \"string(150)\", false);\n alterColumn('{{participants}}', 'lastname', \"string(150)\", false);\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>179),\"stg_name='DBVersion'\");\n }\n if ($iOldDBVersion < 180)\n {\n $aUsers = User::model()->findAll();\n $aPerm = array(\n 'entity_id' => 0,\n 'entity' => 'global',\n 'uid' => 0,\n 'permission' => 'auth_db',\n 'create_p' => 0,\n 'read_p' => 1,\n 'update_p' => 0,\n 'delete_p' => 0,\n 'import_p' => 0,\n 'export_p' => 0\n );\n\n foreach ($aUsers as $oUser)\n {\n if (!Permission::model()->hasGlobalPermission('auth_db','read',$oUser->uid))\n {\n $oPermission = new Permission;\n foreach ($aPerm as $k => $v)\n {\n $oPermission->$k = $v;\n }\n $oPermission->uid = $oUser->uid;\n $oPermission->save();\n }\n }\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>180),\"stg_name='DBVersion'\");\n \n }\n if ($iOldDBVersion < 181)\n {\n upgradeTokenTables181();\n upgradeSurveyTables181();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>181),\"stg_name='DBVersion'\");\n } \n if ($iOldDBVersion < 182)\n {\n fixKCFinder182();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>182),\"stg_name='DBVersion'\");\n } \n $oTransaction->commit();\n // Activate schema caching\n $oDB->schemaCachingDuration=3600;\n // Load all tables of the application in the schema\n $oDB->schema->getTables();\n // clear the cache of all loaded tables\n $oDB->schema->refresh();\n }\n catch(Exception $e)\n {\n $oTransaction->rollback();\n // Activate schema caching\n $oDB->schemaCachingDuration=3600;\n // Load all tables of the application in the schema\n $oDB->schema->getTables();\n // clear the cache of all loaded tables\n $oDB->schema->refresh();\n echo '<br /><br />'.gT('An non-recoverable error happened during the update. Error details:').\"<p>\".htmlspecialchars($e->getMessage()).'</p><br />';\n return false;\n }\n fixLanguageConsistencyAllSurveys();\n echo '<br /><br />'.sprintf(gT('Database update finished (%s)'),date('Y-m-d H:i:s')).'<br /><br />';\n return true;\n}",
"public function change()\n {\n $this->table('change_history')\n ->setComment('数据修改记录')\n ->setEngine('InnoDB')\n ->addColumn('model_type','string', ['comment' => '数据模型类名'])\n ->addColumn('model_id', 'integer', ['comment' => '数据ID'])\n ->addColumn('before', 'text', ['comment' => '修改前内容'])\n ->addColumn('after', 'text', ['comment' => '修改后内容'])\n ->addColumn('method', 'string', ['comment' => '请求方式'])\n ->addColumn('url', 'text', ['comment' => '请求url'])\n ->addColumn('param', 'text', ['comment' => '请求参数'])\n ->addFingerPrint()\n ->create();\n }",
"private function freshInstall() {\n\n // Drop the old database *sniffle* goodbye!\n $this->query(\"DROP DATABASE IF EXISTS \" . Config::SQL_DB);\n\n // Create the parent database.\n $this->query(\"CREATE DATABASE \" . Config::SQL_DB);\n $this->query(\"USE \" . Config::SQL_DB);\n\n // Create users table.\n $this->query(\"CREATE TABLE Users (\"\n . \"user VARCHAR(25), \"\n . \"pass VARCHAR(64) NOT NULL, \"\n . \"join_date DATETIME NOT NULL, \"\n . \"PRIMARY KEY(user), \"\n . \"INDEX USING HASH (user)\"\n . \")\");\n\n // Create admin user account.\n $this->insertUser(Config::ADMIN_USER, Config::ADMIN_PASS);\n\n /**\n * Creates the Pages table.\n * When a user is deleted using the function deleteUser, \n * it goes through the function ifAuthorUpdatePagesTable\n * where the expert of the pages field is found and \n * that user then replaces the user that was deleted as the\n * author of the page. This means that the only time a user\n * attribute in this table will actually be deleted is when \n * there are no other people writing on this topic. Therefore,\n * the content is not useful and the page is deleted.\n */\n $this->query(\"CREATE TABLE Pages (\"\n . \"id MEDIUMINT AUTO_INCREMENT, \"\n . \"title VARCHAR(255) NOT NULL, \"\n . \"user VARCHAR(25), \"\n . \"created_date DATETIME NOT NULL, \"\n . \"cached_data MEDIUMTEXT NOT NULL, \"\n . \"PRIMARY KEY (id), \"\n . \"FOREIGN KEY (user) REFERENCES Users(user) ON DELETE CASCADE, \"\n . \"INDEX USING HASH (id)\"\n . \")\");\n\n // Create the changes table.\n $this->query(\"CREATE TABLE Changes (\"\n . \"id MEDIUMINT AUTO_INCREMENT, \"\n . \"approved BOOLEAN, \"\n . \"contrib_diff MEDIUMTEXT NOT NULL, \"\n . \"change_date DATETIME NOT NULL, \"\n . \"user VARCHAR(25) , \"\n . \"page_id MEDIUMINT NOT NULL, \"\n . \"PRIMARY KEY (id), \"\n . \"FOREIGN KEY (user) REFERENCES Users(user) ON DELETE SET NULL, \"\n . \"FOREIGN KEY (page_id) REFERENCES Pages(id) ON DELETE CASCADE, \"\n . \"INDEX USING BTREE (page_id, change_date)\"\n . \")\");\n \n // Create the keywords table.\n $this->query(\"CREATE TABLE Keywords (\"\n . \"page_id MEDIUMINT NOT NULL, \"\n . \"word VARCHAR(25) NOT NULL, \"\n . \"PRIMARY KEY (page_id, word), \"\n . \"FOREIGN KEY (page_id) REFERENCES Pages(id) ON DELETE CASCADE, \"\n . \"INDEX USING HASH (word)\"\n . \")\");\n\n /**\n * Creates the Expert table.\n * When a user is deleted using the function deleteUser, \n * it goes through the function ifExpertUpdateExpertsTable\n * where a new expert replaces the deleted expert before the\n * actual user is deleted. This means that the only time the \n * foreign key user will be deleted is when there are no other\n * users writing on this topic, therefore the field can be\n * removed from the expert table.\n */\n $this->query(\"CREATE TABLE Expert (\"\n . \"user VARCHAR(25) NOT NULL, \"\n . \"word VARCHAR(25) NOT NULL, \"\n . \"PRIMARY KEY (word), \"\n . \"FOREIGN KEY (user) REFERENCES Users(user) ON DELETE CASCADE, \" \n . \"FOREIGN KEY (word) REFERENCES Keywords(word) ON DELETE CASCADE, \"\n . \"INDEX USING HASH (word)\"\n . \")\");\n\n // Create the views table.\n $this->query(\"CREATE TABLE Views (\"\n . \"user VARCHAR(25), \"\n . \"page_id MEDIUMINT, \"\n . \"rating TINYINT NOT NULL, \"\n . \"comment VARCHAR(255), \"\n . \"viewed_date DATETIME NOT NULL, \"\n . \"PRIMARY KEY (user, page_id), \"\n . \"FOREIGN KEY (user) REFERENCES Users(user) ON DELETE CASCADE, \"\n . \"FOREIGN KEY (page_id) REFERENCES Pages(id) ON DELETE CASCADE, \"\n . \"INDEX USING HASH (page_id)\"\n . \")\");\n\n //Creates the references table\n $this->query(\"CREATE TABLE Reference (\"\n . \"page_id MEDIUMINT NOT NULL, \"\n . \"ref_id MEDIUMINT NOT NULL, \"\n . \"PRIMARY KEY (page_id, ref_id), \"\n . \"FOREIGN KEY (page_id) REFERENCES Pages(id) ON DELETE CASCADE, \"\n . \"FOREIGN KEY (ref_id) REFERENCES Pages(id) ON DELETE CASCADE, \"\n . \"INDEX USING HASH (page_id)\"\n . \")\");\n }",
"public function save() {\n\t\t$sql = \"UPDATE \".$this->tablename.\" SET \";\n\t\t$last = $this->columns[count($this->columns)-1]['db_name'];\n\t\tforeach ($this->columns as $col) {\n\t\t\tswitch($col['type']){\n\t\t\t\tcase 'D':\t//Date, Time, Char, Password, Image all need quotes around the value\n\t\t\t\tcase 'T':\n\t\t\t\tcase 'C':\n\t\t\t\tcase 'I':\n\t\t\t\tcase 'X':\n\t\t\t\tcase 'M':\n\t\t\t\tcase 'E':\n\t\t\t\t\t$sql .= $col['db_name'].\" = '\".$this->data[0][$col['db_name']].\"'\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'P':\n\t\t\t\t\t$sql .= $col['db_name'].\" = AES_ENCRYPT('\".$this->data[0][$col['db_name']].\"','\".la_aes_key.\"')\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'N':\t// Number, checkBox, Select, Radio don't need quotes\n\t\t\t\tcase 'B':\n\t\t\t\tcase 'S':\n\t\t\t\tcase 'R':\n\t\t\t\t\t$sql .= $col['db_name'].' = '.$this->data[0][$col['db_name']];\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif ($col['db_name'] != $last) {\n\t\t\t\t$sql .= ',';\n\t\t\t}\n\t\t}\n\t\t$sql .= \" WHERE \".$this->idcol.\"=\".$this->page->ctrl['record'];\n\t\t$this->error->debug($sql);\n\t\t$this->dbc->exec($sql);\n\t\treturn true;\n\t}",
"static private function regenerate_database()\n {\n self::$quick = false; // Disable quick mode.\n\n self::greeting();\n self::database_backup(); // Backup database, just in case.\n\n if(self::check_duplicates()) {\n self::link_naked_arxiv(); // Link naked arXiv IDs.\n\n self::log(\"Initiating database regeneration from INSPIRE.\");\n $stats = self::inspire_regenerate(\"SELECT inspire FROM records WHERE (inspire != '' AND inspire IS NOT NULL)\");\n\n if (sizeof($stats->found) > 0)\n self::log(sizeof($stats->found) . \" records were regenerated.\");\n if (sizeof($stats->lost) > 0)\n self::log(sizeof($stats->lost) . \" records were not found on INSPIRE: \" . implode(\", \", $stats->lost) . \".\");\n\n self::fetch_missing_bibtex();\n }\n\n self::wrapup();\n }",
"public function resetDatabase(): void\n {\n $this->exec('DELETE FROM fo_forms');\n $this->exec('ALTER TABLE fo_forms AUTO_INCREMENT=1000');\n }",
"function augmentDatabase() {\r\n\t}",
"function update()\n {\n $this->dbInit();\n if ( isset( $this->ID ) )\n {\n query( \"UPDATE Grp set Name='$this->Name', Description='$this->Description',\n\t\tUserAdmin='$this->UserAdmin',\n \t\tUserGroupAdmin='$this->UserGroupAdmin',\n\t\tPersonTypeAdmin='$this->PersonTypeAdmin',\n\t\tCompanyTypeAdmin='$this->CompanyTypeAdmin',\n\t\tPhoneTypeAdmin='$this->PhoneTypeAdmin',\n\t\tAddressTypeAdmin='$this->AddressTypeAdmin' WHERE ID='$this->ID'\" );\n }\n }",
"public function crudUpdated()\n {\n }",
"private function initializeDatabase()\n\t{\n\t\tConfiguration::updateValue('SEUR_URLWS_SP', 'https://ws.seur.com/WSEcatalogoPublicos/servlet/XFireServlet/WSServiciosWebPublicos?wsdl');\n\t\tConfiguration::updateValue('SEUR_URLWS_R', 'https://ws.seur.com/webseur/services/WSCrearRecogida?wsdl');\n\t\tConfiguration::updateValue('SEUR_URLWS_E', 'https://ws.seur.com/webseur/services/WSConsultaExpediciones?wsdl');\n\t\tConfiguration::updateValue('SEUR_URLWS_A', 'https://ws.seur.com/webseur/services/WSConsultaAlbaranes?wsdl');\n\t\tConfiguration::updateValue('SEUR_URLWS_ET', 'http://cit.seur.com/CIT-war/services/ImprimirECBWebService?wsdl');\n\t\tConfiguration::updateValue('SEUR_URLWS_M', 'http://cit.seur.com/CIT-war/services/DetalleBultoPDFWebService?wsdl');\n\n\t\t/* Global configuration */\n\t\tConfiguration::updateValue('SEUR_Configured', 0);\n\t\tConfiguration::updateValue('SEUR_PRINTER_NAME', 'Generic / Text Only');\n\t\tConfiguration::updateValue('SEUR_REMCAR_CARGO', 5.5);\n\t\tConfiguration::updateValue('SEUR_REMCAR_CARGO_MIN', 0);\n\n\t\tif (Context::getContext()->shop->isFeatureActive() == true)\n\t\t{\n\t\t\t$fields = '(`id_seur_configuration`, `international_orders`, `seur_cod`, `pos`, `notification_advice_radio`, `notification_distribution_radio`, `print_type`, `tarifa`, `pickup`, `advice_checkbox`, `distribution_checkbox`, `id_shop`)';\n\t\t\t$values = '(NULL, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1)';\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$fields = '(`id_seur_configuration`, `international_orders`, `seur_cod`, `pos`, `notification_advice_radio`, `notification_distribution_radio`, `print_type`, `tarifa`, `pickup`, `advice_checkbox`, `distribution_checkbox`)';\n\t\t\t$values = '(NULL, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0)';\n\t\t}\n\n\t\t$seur_configuration = 'INSERT INTO `'._DB_PREFIX_.'seur_configuration` '.$fields.' VALUES '.$values.';';\n\n\t\t$seur_merchant = 'INSERT INTO `'._DB_PREFIX_.'seur_merchant`\n\t\t\t(`id_seur_datos`, `user`, `pass`, `cit`, `ccc`, `nif_dni`, `name`, `first_name`, `franchise`, `company_name`, `street_type`, `street_name`, `street_number`, `staircase`, `floor`, `door`, `post_code`, `town`, `state`, `country`, `phone`, `fax`, `email`)\n\t\t\tVALUES (NULL, \"USER\", \"PASS\", \"CCC\", \"CIT\", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);';\n\n\t\treturn Db::getInstance()->Execute($seur_configuration) && Db::getInstance()->Execute($seur_merchant);\n\t}"
] |
[
"0.667003",
"0.6266795",
"0.62314975",
"0.60145044",
"0.5988631",
"0.5968694",
"0.5961604",
"0.5943612",
"0.59321356",
"0.5898862",
"0.58901805",
"0.58589816",
"0.58292437",
"0.5823162",
"0.5791756",
"0.575661",
"0.57564574",
"0.57402",
"0.5738109",
"0.5721223",
"0.57087857",
"0.57010096",
"0.57002723",
"0.5699668",
"0.56977624",
"0.5654043",
"0.56530565",
"0.56475484",
"0.5642924",
"0.56297785"
] |
0.64875215
|
1
|
Get the URL for the Caldera Forms Pro App
|
function caldera_forms_pro_app_url(){
if( ! defined( 'CF_PRO_APP_URL' ) ){
/**
* Default URL for CF Pro App
*/
define( 'CF_PRO_APP_URL', 'https://app.calderaformspro.com' );
}
/**
* Filter URL for Caldera Forms Pro app
*
* Useful for local dev or running your own instance of app
*
* @since 0.0.1
*
* @param string $url The root URL for app
*/
return untrailingslashit( apply_filters( 'caldera_forms_pro_app_url', CF_PRO_APP_URL ) );
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function getAppUrl() {\r\n\r\n $url = getHost() . getAppPath();\r\n\r\n return $url;\r\n\r\n }",
"public function getAppUrl(){\n return (app()->environment('local')) ? 'https://dev.adapt.libretexts.org' : config('app.url');\n }",
"public function get_redirect_uri() {\n\n\t\treturn admin_url( 'admin.php?page=gf_settings&subview=gravityformsdropbox', 'https' );\n\n\t}",
"public function getDeveloperUrl()\n {\n return 'http://absoluteweb.solutions';\n }",
"public static function arprocUrl() {\n\t\treturn self::pw('pages')->get('pw_template=arproc')->url;\n\t}",
"public function buildFrontendUri() {}",
"protected function _getFormUrl() {\n $params = array();\n if (Mage::app()->getStore()->isCurrentlySecure()) {\n // Modern browsers require the Ajax request protocol to match the protocol used for initial request,\n // so force Magento to generate a secure URL if the request was secure.\n $params['_forced_secure'] = true;\n }\n return $this->getUrl('cloudiq/callme/request', $params);\n }",
"public function getFormAction()\n {\n return $this->is_sandbox ? self::TESTING_URL : self::PRODUCTION_URL;\n }",
"public function getUrl() {\n\t\t$this->getRublon()->log(__METHOD__);\n\t\treturn $this->getRublon()->getAPIDomain() .\n\t\t\tself::URL_PATH_CODE .\n\t\t\turlencode($this->getUrlParamsString());\n\t}",
"static public function getFull()\n {\n return 'https://' . Config::get('app.Host') . $_SERVER['REQUEST_URI'];\n }",
"protected function url()\n\t{\n\t\treturn Phpfox::getLib('url');\t\n\t}",
"public function getURL(): string\n {\n return $this->url.$this->apiVersion.'/';\n }",
"public static function getServiceURL() \n\t{\n\t\tacPhpCas::setReporting();\n\t\treturn phpCAS::getServiceURL();\n\t}",
"public function getFormAction()\n {\n return $this->getUrl('zirconprocessing/catalogrequest');\n }",
"public function url(){\n $protocol = \"http://\";\n if ( !empty( $_SERVER['HTTPS'] ) ) {\n $protocol = \"https://\";\n }\n $url = $protocol . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];\n return $url;\n }",
"static function obtenerUrlActual() {\n $url = Util::crearUrl($_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);\n return $url;\n }",
"static public function selfURL()\r\n {\r\n //global $cfgSite;\r\n $cfgSite = Warecorp_Config_Loader::getInstance()->getAppConfig('cfg.site.xml');\r\n $s = empty($_SERVER[\"HTTPS\"]) ? '' : ($_SERVER[\"HTTPS\"] == \"on\") ? \"s\" : \"\";\r\n $protocol = self::strleft(strtolower($_SERVER[\"SERVER_PROTOCOL\"]), \"/\").$s;\r\n if ($cfgSite->use_port_in_URL == '1') {\r\n $port = ($_SERVER[\"SERVER_PORT\"] == \"80\") ? \"\" : (\":\".$_SERVER[\"SERVER_PORT\"]);\r\n } else {$port = '';}\r\n return $protocol.\"://\".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI'];\r\n }",
"protected function get_endpoint_url() {\n\n\t\t$args = http_build_query( array( 'apikey' => $this->api_key ) );\n\t\t$base = $this->route . $this->app_id;\n\t\t$url = \"$base?$args\";\n\n\t\treturn $url;\n\t}",
"public static function generateURL()\n {\n return $_SERVER['REQUEST_SCHEME'].'://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];\n }",
"public function getURL();",
"public function getURL();",
"public function getURL()\n {\n return Config::get('URL') . 'auth/unl/';\n }",
"public function getFrontPageUrl();",
"public function getURL ();",
"public static function _url() {\n\t\treturn self::pw('pages')->get('pw_template=mpm')->url;\n\t}",
"protected function getUrl(){\n\t\treturn $this->apiUrl . $this->apiVersion . '/';\n\t}",
"private function getApiUrl()\n {\n if (!empty($this->options['api-url'])) {\n return $this->options['api-url'];\n }\n if (!empty(getenv('WPC_API_URL'))) {\n return getenv('WPC_API_URL');\n }\n return '';\n }",
"public function getUrl ()\n {\n $url = $this->_config['formAction'] . '?';\n \n foreach ($this->_params as $key => $value) {\n if ($value != '') {\n $url .= $key . '=' . $value . '&';\n }\n }\n \n $url .= 'SHASign=' . $this->getSha1Sign();\n \n return $url;\n }",
"public function UrlBase(){\n\t\treturn URL_APP;\n\t}",
"public function getCraApiUrl()\n\t{\n\t\treturn $this->config->getApiUrl();\n\t}"
] |
[
"0.74120367",
"0.68687624",
"0.6782437",
"0.6771919",
"0.6740096",
"0.67041826",
"0.6643197",
"0.6628814",
"0.6614428",
"0.6544503",
"0.6537374",
"0.65324444",
"0.65194553",
"0.6470543",
"0.6465585",
"0.6415601",
"0.64127135",
"0.6396804",
"0.6392746",
"0.6391639",
"0.6391639",
"0.638437",
"0.63828707",
"0.6379666",
"0.63731104",
"0.6371062",
"0.6361222",
"0.63448894",
"0.634455",
"0.63440675"
] |
0.82464993
|
0
|
get category id for "webonary", if it doesn't exist, create it.
|
function get_category_id() {
global $wpdb;
$sql = "SELECT term_id
FROM $wpdb->terms
WHERE name LIKE 'webonary'";
$catid = $wpdb->get_var( $sql);
return $catid;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"private function _storeCreatedCategoryId() {\r\n $I = $this->BackendTester;\r\n\r\n $I->click('.row-title');\r\n\r\n $tagId = null;\r\n\r\n $url = $I->grabFromCurrentUrl();\r\n\r\n $url = substr($url, strpos($url, '?') + 1);\r\n\r\n parse_str($url, $array);\r\n\r\n if (isset($array['tag_ID']))\r\n $tagId = $array['tag_ID'];\r\n\r\n $I->setVar('category_id', $tagId);\r\n\r\n return $tagId;\r\n }",
"public function getWebCategoryID()\n {\n return $this->webCategoryID;\n }",
"private function newId() {\n $exist_nums = App::getDb()->query('SELECT idCat FROM categories ORDER BY idCat');\n $exist_nums = $exist_nums->fetchAll(PDO::FETCH_OBJ);\n $new_id = 1;\n foreach($exist_nums as $nums) {\n if($nums->idCat != $new_id) break;\n $new_id++;\n }\n return $new_id;\n }",
"public function addNew() {\n\t global $db, $log, $cache;\n\n\n\n\t // DB Checks !!!\n\n\n\n\t\t// Add a new category\n\t\t$cat_ID = $db->insert('projects_categories', array(\n\t\t\t\"user_ID\" => currentUserID()\n\t\t));\n\n\n\t\t// Site log\n\t\tif ($cat_ID) $log->info(\"Project Category #$cat_ID Added: Untitled | User #\".currentUserID());\n\n\n\t\t// INVALIDATE THE CACHES\n\t\tif ($cat_ID) $cache->deleteKeysByTag('project_categories');\n\n\n\t\t// Return the category ID\n\t\treturn $cat_ID;\n\n\t}",
"public function get_category_id() {\n return (int)get_config('block_homework_diary', 'course_category');\n }",
"private function getCategoryID() {\n return 0;\n }",
"function getNewsCategoryId( $title ) {\n\tglobal $newsPid, $newsTstamp;\n\n\t// parse title - some have numerics\n\t// 01. Dies academicus => Dies academicus\n\t$title\t\t\t\t\t\t= preg_replace( '#^(\\d+)?(\\.)?(\\s+)?#', '', $title );\n\n\t// Don't create empty title categories\n\tif ( empty( $title ) ) {\n\t\treturn false;\n\t}\n\n\t// look for prior insert\n\t$query\t\t\t\t\t\t= \"\n\t\tSELECT uid FROM tt_news_cat WHERE title = '{$title}'\n\t\";\n\t$result\t\t\t\t\t\t= mysql_query( $query );\n\tif ( $result && $row = mysql_fetch_assoc( $result )) {\n\t\tmysql_free_result( $result );\n\t\treturn $row['uid'];\n\t} else {\n\t\t$insertValues\t\t\t= array(\n\t\t\t'pid'\t\t\t\t=> $newsPid,\n\t\t\t'title'\t\t\t\t=> $title,\n\t\t\t'crdate'\t\t\t=> $newsTstamp,\n\t\t\t'tstamp'\t\t\t=> $newsTstamp,\n\t\t);\n\t\t$insertSql\t\t\t\t= \"INSERT INTO tt_news_cat SET \";\n\t\t$insertValuesSet\t\t= array();\n\t\tforeach ( $insertValues as $key => $value ) {\n\t\t\t$insertValuesSet[]\t= $key . '=\"' . mysql_escape_string( $value ) . '\"';\n\t\t}\n\t\t$insertSql\t\t\t\t.= implode( ',', $insertValuesSet );\n\n\t\tmysql_query( $insertSql );\n\n\t\techo 'Category inserted' . ' : '; print_r($title); echo '<br />';\t\n\t\treturn mysql_insert_id();\n\t}\n}",
"public function createCategory();",
"function alaya_cat_id($cate_slug){\n $category=get_term_by('slug',$cate_slug,'category');\n if($category){\n\t $cate_id = $category->term_id;\n\t $cate_id = apply_filters('alaya_cat_id', $cate_id);\n\t return $cate_id;\n\t}\n}",
"public static function getCategoryId($category, $subcategory)\n {\n switch ($category) {\n case 'filmvideo':\n switch ($subcategory) {\n case 'animation':\n $category_id = self::CATEGORY_FILMVIDEO_ANIMATION;\n break;\n case 'animationserie':\n $category_id = self::CATEGORY_FILMVIDEO_ANIMATIONSERIE;\n break;\n case 'concert':\n $category_id = self::CATEGORY_FILMVIDEO_CONCERT;\n break;\n case 'documentaire':\n $category_id = self::CATEGORY_FILMVIDEO_DOCUMENTAIRE;\n break;\n case 'emissiontv':\n $category_id = self::CATEGORY_FILMVIDEO_EMISSIONTV;\n break;\n case 'film':\n $category_id = self::CATEGORY_FILMVIDEO_FILM;\n break;\n case 'serietv':\n $category_id = self::CATEGORY_FILMVIDEO_SERIETV;\n break;\n case 'spectacle':\n $category_id = self::CATEGORY_FILMVIDEO_SPECTACLE;\n break;\n case 'sport':\n $category_id = self::CATEGORY_FILMVIDEO_SPORT;\n break;\n case 'videoclips':\n $category_id = self::CATEGORY_FILMVIDEO_VIDEOCLIP;\n break;\n default:\n $category_id = self::CATEGORY_FILMVIDEO;\n break;\n }\n break;\n case 'audio':\n switch ($subcategory) {\n case 'karaoke':\n $category_id = self::CATEGORY_AUDIO_KARAOKE;\n break;\n case 'musique':\n $category_id = self::CATEGORY_AUDIO_MUSIQUE;\n break;\n case 'podcastradio':\n $category_id = self::CATEGORY_AUDIO_PODCASTRADIO;\n break;\n case 'samples':\n $category_id = self::CATEGORY_AUDIO_SAMPLES;\n break;\n default:\n $category_id = self::CATEGORY_AUDIO;\n break;\n }\n break;\n case 'application':\n switch ($subcategory) {\n case 'autre':\n $category_id = self::CATEGORY_APPLICATION_AUTRE;\n break;\n case 'formation':\n $category_id = self::CATEGORY_APPLICATION_FORMATION;\n break;\n case 'linux':\n $category_id = self::CATEGORY_APPLICATION_LINUX;\n break;\n case 'macos':\n $category_id = self::CATEGORY_APPLICATION_MACOS;\n break;\n case 'smartphone':\n $category_id = self::CATEGORY_APPLICATION_SMARTPHONE;\n break;\n case 'tablette':\n $category_id = self::CATEGORY_APPLICATION_TABLETTE;\n break;\n case 'windows':\n $category_id = self::CATEGORY_APPLICATION_WINDOWS;\n break;\n default:\n $category_id = self::CATEGORY_APPLICATION;\n break;\n }\n break;\n case 'jeuvideo':\n switch ($subcategory) {\n case 'autre':\n $category_id = self::CATEGORY_JEUVIDEO_AUTRE;\n break;\n case 'linux':\n $category_id = self::CATEGORY_JEUVIDEO_LINUX;\n break;\n case 'macos':\n $category_id = self::CATEGORY_JEUVIDEO_MACOS;\n break;\n case 'microsoft':\n $category_id = self::CATEGORY_JEUVIDEO_MICROSOFT;\n break;\n case 'nintendo':\n $category_id = self::CATEGORY_JEUVIDEO_NINTENDO;\n break;\n case 'smartphone':\n $category_id = self::CATEGORY_JEUVIDEO_SMARTPHONE;\n break;\n case 'sony':\n $category_id = self::CATEGORY_JEUVIDEO_SONY;\n break;\n case 'tablette':\n $category_id = self::CATEGORY_JEUVIDEO_TABLETTE;\n break;\n case 'windows':\n $category_id = self::CATEGORY_JEUVIDEO_WINDOWS;\n break;\n default:\n $category_id = self::CATEGORY_JEUVIDEO;\n break;\n }\n break;\n case 'ebook':\n switch ($subcategory) {\n case 'audio':\n $category_id = self::CATEGORY_EBOOK_AUDIO;\n break;\n case 'bds':\n $category_id = self::CATEGORY_EBOOK_BDS;\n break;\n case 'comics':\n $category_id = self::CATEGORY_EBOOK_COMICS;\n break;\n case 'livres':\n $category_id = self::CATEGORY_EBOOK_LIVRES;\n break;\n case 'mangas':\n $category_id = self::CATEGORY_EBOOK_MANGAS;\n break;\n case 'presse':\n $category_id = self::CATEGORY_EBOOK_PRESSE;\n break;\n default:\n $category_id = self::CATEGORY_EBOOK;\n break;\n }\n break;\n case 'emulation':\n switch ($subcategory) {\n case 'emulateurs':\n $category_id = self::CATEGORY_EMULATION_EMULATEURS;\n break;\n case 'roms':\n $category_id = self::CATEGORY_EMULATION_ROMS;\n break;\n default:\n $category_id = self::CATEGORY_EMULATION;\n break;\n }\n break;\n case 'gps':\n switch ($subcategory) {\n case 'applications':\n $category_id = self::CATEGORY_GPS_APPLICATIONS;\n break;\n case 'cartes':\n $category_id = self::CATEGORY_GPS_CARTES;\n break;\n case 'divers':\n $category_id = self::CATEGORY_GPS_DIVERS;\n break;\n default:\n $category_id = self::CATEGORY_GPS;\n break;\n }\n break;\n case 'xxx':\n switch ($subcategory) {\n case 'films':\n $category_id = self::CATEGORY_XXX_FILMS;\n break;\n case 'hentai':\n $category_id = self::CATEGORY_XXX_HENTAI;\n break;\n case 'images':\n $category_id = self::CATEGORY_XXX_IMAGES;\n break;\n default:\n $category_id = self::CATEGORY_XXX;\n break;\n }\n break;\n default:\n $category_id = false;\n break;\n }\n\n return $category_id;\n }",
"function init_category($title) {\n $category = ORM::for_table('pw_category')->create();\n $category->cat_title = $title;\n $category->save();\n return $category;\n}",
"public static function createCategory($data)\n {\n DB::beginTransaction();\n try{\n $query = \"INSERT INTO categories(name) VALUES (:name)\";\n DB::insert($query, ['name' => $data->name]);\n $result = DB::select('SELECT LAST_INSERT_ID() AS newid');\n $id = $result[0]->newid;\n DB::commit();\n return $id;\n\n }catch(\\Exception $e) {\n DB::rollback();\n return false;\n }\n\n\n\n\n\n }",
"function get_category_id( $cat_name ){\n\t$term = get_term_by( 'name', $cat_name, 'category' );\n\treturn $term->term_id;\n}",
"function get_category_id( $cat_name ){\n\t$term = get_term_by( 'name', $cat_name, 'category' );\n\treturn $term->term_id;\n}",
"function retrieve_category_id($name) {\n\tglobal $wpdb;\n\t\n\t// Query the term_id of the category needed\n\t$query = \"SELECT wpt.term_id FROM `wp_terms` AS wpt\"\n \t\t. \" JOIN `wp_term_taxonomy` AS wptt\"\n \t\t. \"\t\tON wpt.term_id = wptt.term_id\"\n \t\t. \" WHERE wptt.taxonomy = 'category' AND name = %s\";\n\t$sql = $wpdb->prepare($query, $name);\n\t$id = $wpdb->get_results($sql)[0]->term_id;\n\treturn $id;\n\t\n}",
"function addCategory($object) {\n $object->Item->ShopId = 'yourReturnedCategoryIdOnMarketplace_'.rand(1000, 9999); \n}",
"function get_cat_ID($cat_name)\n {\n }",
"function get_omfg_category_id($cat_name){\n\t$term = get_term_by('name', $cat_name, 'omfg_mobile_themes');\n\treturn $term->term_id;\n}",
"static function get_primary_category_id() {\n if (empty(self::$post->ID)) {\n return get_queried_object_id();\n }\n return self::$primary_category;\n }",
"function app_category($cat_name = NULL, $parent_cat_id) {\n\tif (get_cat_ID($cat_name ) == 0) {\n\t\treturn wp_create_category($cat_name, $parent_cat_id);\n\t}\n\telse {\n\t\treturn get_cat_ID($cat_name);\n\t}\n}",
"function fs_get_category_id( $cat_name ) {\r\n\t$term = get_term_by( 'name', $cat_name, 'category' );\r\n\treturn $term->term_id;\r\n}",
"static public function CreateCategory ($categoryname,$categorycolor){\n\n // Insert category into database\n try {\n $resCreateCategory = DB::table('categories')->insertGetId(\n ['name' => $categoryname,\n 'color' => $categorycolor]\n );\n } catch (\\Exception $e) {\n return \"1\";\n }\n\n }",
"public function getCategory_id()\n {\n return $this->category_id;\n }",
"public function getCategory_id()\n {\n return $this->category_id;\n }",
"public function getCategory_id()\n {\n return $this->category_id;\n }",
"public function get_category_id(){\n\t\treturn $this->_categoryid;\n\t}",
"public function save() {\n if (self::getCategoryById($this->id) == null) {\n // should create\n $sql = \"INSERT INTO category (name) VALUES ('%s') RETURNING id;\";\n $auth_user = User::getUserById(1);\n $sql = sprintf($sql, pg_escape_string($this->name));\n $results = self::$connection->execute($sql);\n $this->id = $results[0][\"id\"];\n } else {\n // should update\n $sql = \"UPDATE category SET name='%s' WHERE id=%d\";\n $sql = sprintf($sql, pg_escape_string($this->name), addslashes($this->id));\n self::$connection->execute($sql);\n }\n }",
"public function getIdCategoryDefault(){\n\n /*TODO refactor*/ \n $idDefault = '3';\n\n $rootCategoryId = Mage::app()->getStore(\"default\")->getRootCategoryId() ;\n\n if(isset($rootCategoryId) && $rootCategoryId > 0)\n $idDefault = $rootCategoryId + 1 ;\n\n return $idDefault ;\n }",
"public function getCategoryId();",
"public function getCategory ( $_id ) {\r\n if ( $_id != 0 ) {\r\n $category = $this->categoryService->getWithParents( $_id );\r\n }\r\n // Creating a new one\r\n else{\r\n $category = new Category();\r\n }\r\n return $category;\r\n }"
] |
[
"0.6831304",
"0.6494425",
"0.58421314",
"0.56527704",
"0.5624264",
"0.5618385",
"0.5596672",
"0.5527521",
"0.5525293",
"0.54324156",
"0.54211",
"0.54027176",
"0.535397",
"0.535397",
"0.5336657",
"0.53000164",
"0.52918816",
"0.5287301",
"0.5285006",
"0.5277634",
"0.5235722",
"0.5190263",
"0.517429",
"0.517429",
"0.517429",
"0.5155356",
"0.51521933",
"0.51390606",
"0.511173",
"0.51071036"
] |
0.6921728
|
0
|
// Install the SIL dictionary infrastructure if needed.
|
function install_sil_dictionary_infrastructure() {
create_search_tables();
create_reversal_tables();
set_options();
set_field_sortorder();
//upload_stylesheet();
register_semantic_domains_taxonomy();
register_part_of_speech_taxonomy();
register_language_taxonomy();
register_webstrings_taxonomy();
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function install() {}",
"public function loadInstaller() {\n\n $objManager = new class_module_packagemanager_manager();\n $arrModules = $objManager->getAvailablePackages();\n\n $this->arrMetadata = array();\n foreach($arrModules as $objOneModule)\n if($objOneModule->getBitProvidesInstaller())\n $this->arrMetadata[] = $objOneModule;\n\n $this->arrMetadata = $objManager->sortPackages($this->arrMetadata, true);\n\n }",
"function install(){}",
"public function install()\n {\n Configuration::updateValue('WI_WEATHER_ENABLED', '0');\n Configuration::updateValue('WI_WEATHER_PROVIDER', '');\n Configuration::updateValue('WI_WEATHER_KEY', '');\n Configuration::updateValue('WI_WEATHER_CITY', '');\n return parent::install() &&\n $this->registerHook('header') &&\n $this->registerHook('backOfficeHeader') &&\n $this->registerHook('displayNav') &&\n $this->registerHook('displayNav1');\n }",
"public static function install(){\n\t}",
"public function install();",
"public function install();",
"function uninstall_sil_dictionary_infrastructure () {\n\n\t// Remove all the old dictionary entries.\n\t//DANGEROUS, this would remove all the posts, if somebody doesn't migrate the posts to pages\n\t//remove_entries();\n\n\t// Uninstall the custom table(s) and taxonomies.\n\tunregister_custom_taxonomies();\n\tuninstall_custom_tables();\n}",
"public function install() {\r\n \r\n }",
"protected function install(){ return true;}",
"function install()\n {\n }",
"public function install()\n {\n }",
"public function install()\n {\n }",
"public function install(){\r\n\t\t\r\n\t}",
"public function installOrAuthenticate(Request $req) {\n\n\n // check for code from shopify (this happen on new install)\n if($req->has('code')) {\n\n $shop_url = $req->input('shop');\n $code = $req->input('code');\n\n Log::info('New install: ' . $shop_url);\n\n $shopify = App::make('ShopifyAPI', [\n 'API_KEY' => env('API_KEY'),\n 'API_SECRET' => env('API_SECRET'),\n 'SHOP_DOMAIN' => $shop_url,\n ]);\n\n\n // attempt to get the access token\n $accessToken = '';\n try {\n\n // oauth verification\n $verify = $shopify->verifyRequest($req->all());\n if(!$verify) {\n Log::error('Unable to verify oauth authentication');\n return ;\n }\n\n $accessToken = $shopify->getAccessToken($code);\n if(!$accessToken) {\n throw new Error('Access Token Error!');\n }\n }\n catch(Exception $e) {\n Log::error($e->getMessage());\n return ;\n }\n\n\n // check to see if we already have the shop record stored\n $shop = Shop::where('permanent_domain', $shop_url)->first();\n\n if(!$shop) {\n // add a new shop record\n $shop = new Shop;\n }\n\n // save or update shop data\n $shop->setDomain($shop_url);\n $shop->access_token = $accessToken;\n $shop->save();\n\n $this->updateShopInfo($shop);\n\n\n // create webhook for uninstall (will do later)\n $webhookData = [\n 'webhook' => [\n 'topic' => 'app/uninstalled',\n 'address' => env('DOMAIN') . '/uninstall',\n 'format' => 'json',\n ],\n ];\n\n // always with the try catches for api call, past experiences and all lol\n try {\n $shopify->setup(['ACCESS_TOKEN' => $shop->access_token]);\n $shopify->call(['URL' => '/admin/webhooks.json', 'METHOD' => 'POST', 'DATA' => $webhookData]);\n }\n catch(Exception $e) {\n Log::error('Something weird with webhooks... ' . $e->getMessage());\n }\n\n // store shop in session, of course, duh\n Session::put('shop', $shop->permanent_domain);\n\n return redirect('/dashboard'); // or something idk yet\n\n }\n else { // authenticating from store apps screen, after first install\n\n $shop_url = $req->has('shop') ? $req->input('shop') : Session::get('shop');\n //if(!$shop_url) {\n // return 'Session ended: go back to apps and reopen the application';\n //}\n\n $shop = Shop::where('permanent_domain', $shop_url)->first();\n if($shop) {\n\n // so everything seems to have gone good\n // update shop info (in case it has changed)\n $this->updateShopInfo($shop);\n\n // store the shop in the session, so authentication will persist\n Session::put('shop', $shop->permanent_domain);\n\n return redirect('/dashboard'); // or something idk yet\n\n }\n else {\n\n // no shop at this point means something weird happened\n Log::error('Something weird happened with the authentication of ' . $shop_url);\n\n // lets redirect them back to the install url\n $shopify = App::make('ShopifyAPI', [\n 'API_KEY' => env('API_KEY'),\n 'SHOP_DOMAIN' => $shop_url,\n ]);\n \n return redirect($shopify->installURL(['permissions' => ['read_themes', 'write_themes'], 'redirect' => env('DOMAIN') . '/auth']));\n }\n }\n }",
"public function install() {\n\n\n }",
"public function preInstall()\n {\n }",
"public function install()\n\t{\n\t\tif (Shop::isFeatureActive()) {\n\t\t\tShop::setContext(Shop::CONTEXT_ALL);\n\t\t}\n\n\t\t//initialize empty settings\n\t\tConfiguration::updateValue('CLERK_PUBLIC_KEY', '');\n\t\tConfiguration::updateValue('CLERK_PRIVATE_KEY', '');\n\n\t\tConfiguration::updateValue('CLERK_SEARCH_ENABLED', 0);\n\t\tConfiguration::updateValue('CLERK_SEARCH_TEMPLATE', '');\n\n\t\tConfiguration::updateValue('CLERK_LIVESEARCH_ENABLED', 0);\n\t\tConfiguration::updateValue('CLERK_LIVESEARCH_INCLUDE_CATEGORIES', 0);\n\t\tConfiguration::updateValue('CLERK_LIVESEARCH_TEMPLATE', '');\n\n\t\tConfiguration::updateValue('CLERK_POWERSTEP_ENABLED', 0);\n\t\tConfiguration::updateValue('CLERK_POWERSTEP_TEMPLATES', '');\n\n\t\treturn parent::install() &&\n $this->registerHook('top') &&\n\t\t\t$this->registerHook('footer') &&\n\t\t\t$this->registerHook('displayOrderConfirmation');\n\t}",
"public function install()\n {\n if (static::currentErrorHandler($this->isolator()) === $this) {\n throw new Exception\\AlreadyInstalledException;\n }\n\n static::pushErrorHandler($this, $this->isolator());\n }",
"public function handler_install()\n {\n return true; // Handler always there\n }",
"public function install(){\n\n\t\t$model = Advertikon::getCurrentModel();\n\n\t\ttry {\n\t\t\t$this->_checkCompatibility();\n\t\t}\n\t\tcatch( Exception\\Transport $e ) {\n\t\t\t$this->errorPage( $e->getData() , 424 , 'Failed Dependency' );\n\t\t}\n\n\t\t$this->_install();\n\n\t\t$config = Advertikon::getXmlConfig();\n\t\t$settingsModel = Advertikon::getExtendedModel( 'setting_setting' );\n\t\t$settings = $model->stripPrefix( $settingsModel->getSetting() );\n\t\t$model->merge( $settings , $config->getValues( '/' ) );\n\t\t$settingsModel->editSetting( $settings );\n\n\t\t//mark the extension as installed\n\t\tAdvertikon::getExtendedModel( 'setting_setting' )->setSettingValue( 'installed' , 1 );\n\t}",
"private function _install() {\r\n// `id` int(11) NOT NULL,\r\n// `language_id` int(11) NOT NULL,\r\n// `human_name` mediumtext NOT NULL,\r\n// `machine_name` varchar(255) NOT NULL,\r\n// `is_active` enum('0','1') NOT NULL,\r\n// PRIMARY KEY(`id`)\r\n// ) ENGINE=InnoDB DEFAULT CHARSET=utf8;\r\n// CREATE TABLE IF NOT EXISTS `security_attributes_values` (\r\n// `id` int(11) NOT NULL,\r\n// `user_id` int(11) NOT NULL,\r\n// `attribute_id` int(11) NOT NULL,\r\n// `value` mediumtext NOT NULL,\r\n// PRIMARY KEY(`id`)\r\n// ) ENGINE=InnoDB DEFAULT CHARSET=utf8;\r\n }",
"function xmldb_vocabulario_install_recovery() {\n}",
"protected function addInitialExtensionInformation()\n {\n $repository = ExtensionInformationRepositoryFactory::create();\n $packages = $this->packageManager->getAvailablePackages();\n $repository->addExtensionInformation($packages);\n }",
"protected function afterInstall()\n {\n }",
"public function install() {\n\t\t\t$date = Symphony::Configuration()->get('date_format', 'region');\n\t\t\t$time = Symphony::Configuration()->get('time_format', 'region');\n\t\t\t$separator = Symphony::Configuration()->get('datetime_separator', 'region');\n\n\t\t\t// Store current date and time settings\n\t\t\tSymphony::Configuration()->set('date_format', $date, 'lang-Finnish-storage');\n\t\t\tSymphony::Configuration()->set('time_format', $time, 'lang-Finnish-storage');\n\t\t\tSymphony::Configuration()->set('datetime_separator', $separator, 'lang-Finnish-storage');\n\t\t\tSymphony::Configuration()->write();\n\t\t}",
"public function beforeInstall()\n\t{}",
"public function install(){\n\n $this->registerHook('getListRegistrar');\n $this->registerHook('getRegistrar');\n\n return parent::install();\n }",
"function insta_f_install(){\n}",
"public function install () {\n\t\t$this->_log_version_number();\n\t}"
] |
[
"0.5524984",
"0.55036944",
"0.54925716",
"0.5361281",
"0.5335393",
"0.5169431",
"0.5169431",
"0.5149602",
"0.51007533",
"0.5085973",
"0.5083907",
"0.50509095",
"0.50509095",
"0.50461096",
"0.50419873",
"0.5041909",
"0.5038159",
"0.5034772",
"0.49359745",
"0.49204338",
"0.4904329",
"0.48567665",
"0.4855778",
"0.4842629",
"0.4811762",
"0.4804399",
"0.48019728",
"0.47948837",
"0.47902662",
"0.47816488"
] |
0.7032753
|
0
|
// Provide a taxonomy for semantic domains in an online dictionary.
|
function register_semantic_domains_taxonomy () {
$labels = array(
'name' => _x( 'Semantic Domains', 'taxonomy general name' ),
'singular_name' => _x( 'Semantic Domain', 'taxonomy singular name' ),
'search_items' => __( 'Search Domains' ),
'all_items' => __( 'All Semantic Domains' ),
'parent_item' => __( 'Parent Semantic Domain' ),
'parent_item_colon' => __( 'Parent Semantic Domain:' ),
'edit_item' => __( 'Edit Semantic Domain' ),
'update_item' => __( 'Update Semantic Domain' ),
'add_new_item' => __( 'Add New Semantic Domain' ),
'new_item_name' => __( 'New Semantic Domain Name' ),
'menu_name' => __( 'Semantic Domain' ),
);
register_taxonomy(
'sil_semantic_domains',
'post',
array(
'hierarchical' => false,
'labels' => $labels,
'update_count_callback' => '_update_post_term_count',
'query_var' => true,
'rewrite' => true,
'public' => true,
'show_ui' => true
)
) ;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function taxonomy();",
"function get_taxonomy($taxonomy)\n {\n }",
"function rew_genreic_taxonomy(){\n\n\t$args= array(\n\t\t'label'=>'Services'\n\t\t);\n\tregister_taxonomy( 'services', array('apartment', 'villa', 'land', 'store'), $args );\n}",
"function humcore_create_taxonomies() {\n\t// Add new taxonomy, make it hierarchical (like categories).\n\t$labels = array(\n\t\t'name' => _x( 'Subjects', 'taxonomy general name', 'humcore_domain' ),\n\t\t'singular_name' => _x( 'Subject', 'taxonomy singular name', 'humcore_domain' ),\n\t\t'search_items' => __( 'Search Subjects', 'humcore_domain' ),\n\t\t'all_items' => __( 'All Subjects', 'humcore_domain' ),\n\t\t'parent_item' => __( 'Parent Subject', 'humcore_domain' ),\n\t\t'parent_item_colon' => __( 'Parent Subject:', 'humcore_domain' ),\n\t\t'edit_item' => __( 'Edit Subject', 'humcore_domain' ),\n\t\t'update_item' => __( 'Update Subject', 'humcore_domain' ),\n\t\t'add_new_item' => __( 'Add New Subject', 'humcore_domain' ),\n\t\t'new_item_name' => __( 'New Subject Name', 'humcore_domain' ),\n\t\t'menu_name' => __( 'Subjects', 'humcore_domain' ),\n\t);\n\n\t$args = array(\n\t\t'public' => false,\n\t\t'hierarchical' => true,\n\t\t'labels' => $labels,\n\t\t'show_ui' => true,\n\t\t'show_admin_column' => false,\n\t\t'query_var' => false,\n\t\t'rewrite' => false,\n\t);\n\n\tregister_taxonomy( 'humcore_deposit_subject', array( 'humcore_deposit' ), $args );\n\tregister_taxonomy_for_object_type( 'humcore_deposit_subject', 'humcore_deposit' );\n\n\t// Add new taxonomy, NOT hierarchical (like tags).\n\t$labels = array(\n\t\t'name' => _x( 'Tags', 'taxonomy general name', 'humcore_domain' ),\n\t\t'singular_name' => _x( 'Tag', 'taxonomy singular name', 'humcore_domain' ),\n\t\t'search_items' => __( 'Search Tags', 'humcore_domain' ),\n\t\t'popular_items' => __( 'Popular Tags', 'humcore_domain' ),\n\t\t'all_items' => __( 'All Tags', 'humcore_domain' ),\n\t\t'parent_item' => null,\n\t\t'parent_item_colon' => null,\n\t\t'edit_item' => __( 'Edit Tag', 'humcore_domain' ),\n\t\t'update_item' => __( 'Update Tag', 'humcore_domain' ),\n\t\t'add_new_item' => __( 'Add New Tag', 'humcore_domain' ),\n\t\t'new_item_name' => __( 'New Tag Name', 'humcore_domain' ),\n\t\t'separate_items_with_commas' => __( 'Separate tags with commas', 'humcore_domain' ),\n\t\t'add_or_remove_items' => __( 'Add or remove tags', 'humcore_domain' ),\n\t\t'choose_from_most_used' => __( 'Choose from the most used tags', 'humcore_domain' ),\n\t\t'not_found' => __( 'No tags found.', 'humcore_domain' ),\n\t\t'menu_name' => __( 'Tags', 'humcore_domain' ),\n\t);\n\n\t$args = array(\n\t\t'public' => false,\n\t\t'hierarchical' => false,\n\t\t'labels' => $labels,\n\t\t'show_ui' => true,\n\t\t'show_admin_column' => false,\n\t\t'update_count_callback' => '_update_post_term_count',\n\t\t'query_var' => false,\n\t\t'rewrite' => false,\n\t);\n\n\tregister_taxonomy( 'humcore_deposit_tag', array( 'humcore_deposit' ), $args );\n\tregister_taxonomy_for_object_type( 'humcore_deposit_tag', 'humcore_deposit' );\n\n}",
"function genres_artist_taxonomy() {\n\n $labels = array(\n 'name' => _x( 'Genre Name', 'Taxonomy Genre name', 'text-domain' ),\n 'singular_name' => _x( 'Genres Name', 'Taxonomy Genres name', 'text-domain' ),\n 'search_items' => __( 'Search Genre Name', 'text-domain' ),\n 'popular_items' => __( 'Popular Genre Name', 'text-domain' ),\n 'all_items' => __( 'All Genre Name', 'text-domain' ),\n 'parent_item' => __( 'Parent Genres Name', 'text-domain' ),\n 'parent_item_colon' => __( 'Parent Genres Name', 'text-domain' ),\n 'edit_item' => __( 'Edit Genres Name', 'text-domain' ),\n 'update_item' => __( 'Update Genres Name', 'text-domain' ),\n 'add_new_item' => __( 'Add New Genres Name', 'text-domain' ),\n 'new_item_name' => __( 'New Genres Name Name', 'text-domain' ),\n 'add_or_remove_items' => __( 'Add or remove Genre Name', 'text-domain' ),\n 'choose_from_most_used' => __( 'Choose from most used text-domain', 'text-domain' ),\n 'menu_name' => __( 'Genres Name', 'text-domain' ),\n );\n\n $args = array(\n 'labels' => $labels,\n 'public' => true,\n 'show_in_nav_menus' => true,\n 'show_admin_column' => false,\n 'hierarchical' => true,\n 'show_tagcloud' => true,\n 'show_ui' => true,\n 'query_var' => true,\n 'rewrite' => true,\n 'query_var' => true,\n 'capabilities' => array(),\n );\n\n register_taxonomy( 'genres_artist', array( 'artist' ), $args );\n}",
"static function importTaxonomies( $taxonomy_map ) {\n\t\t\n\t\techo_now( 'Importing categories and tags...' );\n\t\t\n\t\t# Import Drupal vocabularies as WP taxonomies\n\t\t\n\t\t$vocab_map = array();\n\t\t\n\t\t$dr_tax_prefix = '';\n\t\t\n\t\tif( isset( drupal()->vocabulary ) )\n\t\t\t$dr_tax_prefix = '';\n\t\telse if( isset( drupal()->taxonomy_vocabulary ) )\n\t\t\t$dr_tax_prefix = 'taxonomy_';\n\t\t\n\t\t$dr_tax_vocab = $dr_tax_prefix . 'vocabulary';\n\t\t\n\t\t$vocabs = drupal()->$dr_tax_vocab->getRecords();\n\t\t\n\t\tforeach( $vocabs as $vocab ) {\n\t\t\t\n\t\t\tif( 'skip' == $taxonomy_map[ $vocab['name'] ] )\n\t\t\t\tcontinue;\n\t\t\t\n\t\t\tif( 'asis' == $taxonomy_map[ $vocab['name'] ] ) {\n\t\t\t\t\n\t\t\t\techo_now( 'Registering taxonomy for: ' . str_replace(' ','-',strtolower( $vocab['name'] ) ) );\n\t\t\t\t\n\t\t\t\t$vocab_map[ (int)$vocab['vid'] ] = str_replace(' ','-',strtolower( $vocab['name'] ) );\n\t\t\t\t\n\t\t\t\tregister_taxonomy(\n\t\t\t\t\tstr_replace(' ','-',strtolower( $vocab['name'] ) ),\n\t\t\t\t\tarray( 'post', 'page' ),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'label' => $vocab['name'],\n\t\t\t\t\t\t'hierarchical' => (bool)$vocab['hierarchy']\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t\t\n\t\t\t} else {\n\t\t\t\t\n\t\t\t\techo_now( 'Converting taxonomy: ' . str_replace(' ','-',strtolower( $vocab['name'] ) ) . ' to: ' . $taxonomy_map[ $vocab['name'] ] );\n\t\t\t\t$vocab_map[ (int)$vocab['vid'] ] = $taxonomy_map[ $vocab['name'] ];\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\t# Import Drupal terms as WP terms\n\t\t\n\t\t$term_vocab_map = array();\n\t\t\n\t\t$term_data_table = $dr_tax_prefix . 'term_data';\n\t\t$term_hierarchy_table = $dr_tax_prefix. 'term_hierarchy';\n\t\t\n\t\t$terms = drupal()->$term_data_table->getRecords();\n\t\t\n\t\tforeach( $terms as $term ) {\n\n\t\t\t$parent = drupal()->$term_hierarchy_table->parent->getValue(\n\t\t\t\tarray(\n\t\t\t\t\t'tid' => $term['tid']\n\t\t\t\t)\n\t\t\t);\n\t\t\t\n\t\t\tif( ! array_key_exists( (int)$term['vid'], $vocab_map ) )\n\t\t\t\tcontinue;\n\n\t\t\tif( apply_filters( 'import_term_skip_term', false, $term, $vocab_map[ (int)$term['vid'] ] ) )\n\t\t\t\tcontinue;\n\n\t\t\t$term_vocab_map[ $term['tid'] ] = $vocab_map[ (int)$term['vid'] ];\n\t\t\t\n//\t\t\techo 'Creating term: ' . $term['name'] . ' from: ' . $term['tid'] . \"<br>\\n\";\n\t\t\t\n\t\t\t$term_result = wp_insert_term(\n\t\t\t\t$term['name'],\n\t\t\t\t$vocab_map[ (int)$term['vid'] ],\n\t\t\t\tarray(\n\t\t\t\t\t'description' => $term['description'],\n\t\t\t\t\t'parent' => (int)$parent\n\t\t\t\t)\n\t\t\t);\n\t\t\t\n\t\t\tif( is_wp_error( $term_result ) ) {\n\t\t\t\t\n\t\t\t\techo 'WARNING - Got error creating term: ' . $term['name']; \n\t\t\t\t\n\t\t\t\tif( in_array( 'term_exists', $term_result->get_error_codes() ) ) {\n\t\t\t\t\t\n\t\t\t\t\techo_now( ' -- term already exists as: ' . $term_result->get_error_data() );\n\t\t\t\t\t$term_id = (int)$term_result->get_error_data();\n\n\t\t\t\t\tself::$term_to_term_map[ (int)$term['tid'] ] = $term_id;\n\t\t\t\t\t\n\t\t\t\t} else {\n\t\t\t\t\t\n\t\t\t\t\techo_now( ' -- error was: ' . print_r( $term_result, true ) );\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t$term_id = $term_result['term_id'];\n\t\t\t\n\t\t\tself::$term_to_term_map[ (int)$term['tid'] ] = $term_id;\n\t\t\t\n\t\t}\n\t\t\n\t\t# Attach terms to posts\n\t\t\n\t\tif( isset( drupal()->term_node ) )\n\t\t\t$term_node_table = 'term_node';\n\t\telse if( isset( drupal()->taxonomy_index ) )\n\t\t\t$term_node_table = 'taxonomy_index';\n\t\t\n\t\t$term_assignments = drupal()->$term_node_table->getRecords();\n\t\t\n\t\tforeach( $term_assignments as $term_assignment ) {\n\t\t\t\n\t\t\tif( ! array_key_exists( $term_assignment['tid'], $term_vocab_map ) )\n\t\t\t\tcontinue;\n\n\t\t\tif( ! array_key_exists( (int)$term_assignment['tid'], self::$term_to_term_map ) )\n\t\t\t\tcontinue;\n\t\t\t\n\t\t\tif( ! array_key_exists( $term_assignment['nid'], self::$node_to_post_map ) )\n\t\t\t\tcontinue;\n\t\t\t\n//\t\t\techo 'Adding term: ' . (int)$term_assignment['tid'] . ' from: ' . self::$term_to_term_map[ (int)$term_assignment['tid'] ] . ' to: ' . self::$node_to_post_map[ $term_assignment['nid'] ] . \"<br>\\n\";\n\t\t\t\n\t\t\t$term_result = wp_set_object_terms(\n\t\t\t\tself::$node_to_post_map[ $term_assignment['nid'] ],\n\t\t\t\tarray( (int)self::$term_to_term_map[ (int)$term_assignment['tid'] ] ),\n\t\t\t\t$term_vocab_map[ $term_assignment['tid'] ],\n\t\t\t\ttrue\n\t\t\t);\n\t\t\t\n\t\t\tif( is_wp_error( $term_result ) )\n\t\t\t\tdie( 'Got error setting object term: ' . print_r( $term_result, true ) );\n\n\t\t\tif( empty( $term_result ) )\n\t\t\t\tdie('Failed to set object term properly.');\n\n\t\t}\n\t\t\n\t\tdo_action( 'imported_taxonomies' );\n\t\t\n\t}",
"function mds_custom_taxonomy() {\n $args = array(\n\n /**\n * Include a description of the taxonomy.\n */\n 'description' => '', // string (default is NONE)\n\n /**\n * A plural descriptive name for the taxonomy marked for translation.\n * Default: overridden by $labels->name\n */\n 'label' => __( 'Custom Taxonomies' ), // string (default overridden by $labels->name).\n\n /**\n * Labels used when displaying the taxonomy in the admin and sometimes on the front end.\n */\n 'labels' => array(\n 'name'\t\t\t\t => __( 'Custom Taxonomies' ),\n 'singular_name'\t\t\t => __( 'Custom Taxonomy' ),\n 'menu_name'\t\t\t => __( 'Custom Taxonomy'),\n 'all_items'\t\t\t => __( 'All Custom Taxonomies' ),\n 'view_item' => __( 'View Custom Taxonomy' ),\n 'edit_item'\t\t\t => __( 'Edit Custom Taxonomy' ),\n 'update_item'\t\t\t => __( 'Update Custom Taxonomy'),\n 'add_new_item'\t\t\t => __( 'Add New Custom Taxonomy'),\n 'new_item_name'\t\t\t => __( 'New Single Custom Taxonomy'),\n 'parent_item'\t\t\t => __( 'Parent Custom Taxonomy' ),\n 'parent_item_colon'\t\t => __( 'Parent Custom Taxonomy' ),\n 'search_items'\t\t\t => __( 'Search Custom Taxonomy' ),\n 'popular_items'\t\t\t => __( 'Popular Custom Taxonomy' ),\n 'separate_items_with_commas' => __( 'Separate Custom Taxonomy with commas' ),\n 'add_or_remove_items'\t => __( 'Add or remove Custom Taxonomy'),\n 'choose_from_most_used'\t => __( 'Choose from most used Custom Taxonomy'),\n 'not_found' => __( 'No Custom Taxonomy found.' )\n ),\n\n /**\n * If the taxonomy should be publicly queryable. This\n * argument is sort of a catchall for many of the following arguments.\n */\n 'public' => true, // bool (default is TRUE)\n\n /**\n * Whether to generate a default UI for managing this taxonomy.\n */\n 'show_ui' => true, // bool (defaults to 'public').\n\n /**\n * Whether taxonomy items are available for selection in navigation menus.\n */\n 'show_in_nav_menus' => true, // bool (defaults to 'public').\n\n /**\n * Whether to allow the Tag Cloud widget to use this taxonomy.\n */\n 'show_tagcloud' => false,// bool (defaults to 'show_ui').\n\n /**\n * Whether to show the taxonomy in the quick/bulk edit panel.\n */\n 'show_in_quick_edit' => true, // bool (defaults to 'show_ui').\n\n /**\n * Whether to allow automatic creation of taxonomy columns on associated post-types table.\n */\n 'show_admin_column' => false,// bool (default is FALSE)\n\n /**\n * Provide a callback function name for the meta box display.\n * No meta box is shown if set to false\n */\n 'meta_box_cb' => null, //callback function (default is NULL)\n\n /**\n * Is this taxonomy hierarchical (have descendants) like categories or not hierarchical like tags.\n */\n 'hierarchical' => false,// bool (default is FALSE)\n\n /**\n * A function name that will be called when the count of an associated $object_type, such as post, is updated.\n * Works much like a hook.\n */\n\n 'update_count_callback' => '', //string (default is NONE)\n\n /**\n * Sets the query_var key for this taxonomy. If set to TRUE, the post type name will be used.\n * You can also set this to a custom string to control the exact key.\n */\n 'query_var' => 'custom-taxonomy', // bool|string (defaults to TRUE - post type name)\n\n\n /**\n * How the URL structure should be handled with this post type. You can set this to an\n * array of specific arguments or true|false. If set to FALSE, it will prevent rewrite\n * rules from being created.\n */\n 'rewrite' => array(\n\n /* The slug to use for individual posts of this type. */\n 'slug' => 'custom-post-type', // string (defaults to taxonomy's name slug)\n\n /* Allowing permalinks to be prepended with front base*/\n 'with_front' => false, // bool (defaults to TRUE)\n\n /* true or false allow hierarchical urls*/\n 'hierarchical' => false, // bool (defaults to FALSE)\n\n /* Assign an endpoint mask to this permalink. */\n 'ep_mask' => EP_PERMALINK, // const (defaults to EP_NONE)\n ),\n\n /**\n * Provides more precise control over the capabilities than the defaults. By default, WordPress\n * will use the 'capability_type' argument to build these capabilities. More often than not,\n * this results in many extra capabilities that you probably don't need.\n */\n 'capabilities' => array( ),\n\n /**\n * Whether this taxonomy should remember the order in which terms are added to objects.\n */\n 'sort' => false, // bool (default is NONE)\n );\n\n /**\n * Set up the arguments for the post type where taxonomy will be displayed.\n * Can be a custom post type or any of the registered post types: post, page, attachment, revision, nav_menu_item\n */\n $args_post_type = array(\n 'custom-post-type'\n );\n\n register_taxonomy(\n 'custom-taxonomy', //Taxonomy name. Max of 32 characters. Uppercase and spaces not allowed.\n $args_post_type, //Name of the post type for the taxonomy,\n $args\n );\n\n}",
"public function initial_taxonomy() {\n $labels = array(\n 'name' => __( 'Taxonomies', Settings::$text_domain ),\n 'singular_name' => __( 'Taxonomy', Settings::$text_domain ),\n 'menu_name' => __( 'Taxonomies', Settings::$text_domain ),\n 'name_admin_bar' => __( 'Taxonomies', Settings::$text_domain ),\n 'add_new' => __( 'Add New', Settings::$text_domain ),\n 'add_new_item' => __( 'Add New Taxonomy', Settings::$text_domain ),\n 'new_item' => __( 'New Taxonomy', Settings::$text_domain ),\n 'edit_item' => __( 'Edit Taxonomy', Settings::$text_domain ),\n 'view_item' => __( 'View Taxonomy', Settings::$text_domain ),\n 'all_items' => __( 'Taxonomies', Settings::$text_domain ),\n 'search_items' => __( 'Search Taxonomies', Settings::$text_domain ),\n 'parent_item_colon' => __( 'Parent Taxonomies:', Settings::$text_domain ),\n 'not_found' => __( 'No taxonomy found.', Settings::$text_domain ),\n 'not_found_in_trash' => __( 'No taxonomies found in Trash.', Settings::$text_domain )\n );\n\n $args = array(\n 'labels' => $labels,\n 'public' => true,\n 'publicly_queryable' => true,\n 'show_ui' => true,\n 'show_in_menu' => 'tools.php',\n 'show_in_nav_menus' => false,\n 'query_var' => true,\n 'capability_type' => 'post',\n 'has_archive' => false,\n 'hierarchical' => false,\n 'menu_position' => null,\n 'taxonomies' => array( '' ),\n 'menu_icon' => 'dashicons-category',\n 'supports' => array('title')\n );\n\n register_post_type( Settings::$main_taxonomy_name, $args );\n\n $taxonomy_factory = new Taxonomy_Factory();\n $taxonomy_factory->register_all_taxonomies();\n\n //Configura o número de posts por página\n add_action('pre_get_posts', array($taxonomy_factory, 'set_posts_per_page'));\n }",
"function add_educational_audience() {\n\t$types = array('post','page','attachment','nav_menu_item', 'learning_resource');\n register_taxonomy('asn_educational_audience', $types, array(\n 'hierarchical' => false,\n 'labels' => array(\n 'name' => _x( 'Educational Audience', 'taxonomy general name' ),\n 'singular_name' => _x( 'Educational Audience', 'taxonomy singular name' ),\n 'search_items' => __( 'Search Educational Audiences' ),\n 'all_items' => __( 'All Educational Audiences' ),\n 'parent_item' => __( 'Parent Educational Audience' ),\n 'parent_item_colon' => __( 'Parent Educational Audience:' ),\n 'edit_item' => __( 'Edit Educational Audience' ),\n 'update_item' => __( 'Update Educational Audience' ),\n 'add_new_item' => __( 'Add New Educational Audience' ),\n 'new_item_name' => __( 'New Educational Audience Name' ),\n 'menu_name' => __( 'Educational Audience' ),\n ),\n //Slugs used for this taxonomy\n 'rewrite' => array(\n 'slug' => 'educational_audience', \n 'with_front' => false,\n 'hierarchical' => false \n ),\n ));\n}",
"public function get_taxonomy(){\r\n\t\t$this->tax_obj = get_taxonomy( $this->taxonomy );\r\n\t}",
"public function getTaxonomyTerms();",
"public function taxonomyName($taxonomy = null);",
"function strl_services_tags_taxonomy() {\n\t$singular_label = __( 'service tag', 'strl' );\n\t$plural_label = __( 'service tags', 'strl' );\n\t$labels = strl_generate_taxonomy_labels( $singular_label, $plural_label );\n\n\t$args = array(\n\t\t'hierarchical' => false,\n\t\t'labels' => $labels,\n\t\t'show_ui' => true,\n\t\t'show_admin_column' => true,\n\t\t'query_var' => true,\n\t);\n\n\tregister_taxonomy( 'service_tags', 'services', $args );\n}",
"function my_register_taxonomies() {\r\n\t}",
"function create_my_taxonomies()\n{\n register_taxonomy('utilities', 'post', array('hierarchical' => true, 'label' => 'Utilities'));\n}",
"function add_custom_taxonomies() {\n // Add new taxonomy\n $types = array('post','page','attachment','nav_menu_item', 'learning_resource');\n register_taxonomy('asn_index', $types, array(\n 'hierarchical' => true,\n 'labels' => array(\n 'name' => _x( 'ASN Index', 'taxonomy general name' ),\n 'singular_name' => _x( 'Competency', 'taxonomy singular name' ),\n 'search_items' => __( 'Search Competencies' ),\n 'all_items' => __( 'All Competencies' ),\n 'parent_item' => __( 'Parent Competency' ),\n 'parent_item_colon' => __( 'Parent Competency:' ),\n 'edit_item' => __( 'Edit Competency' ),\n 'update_item' => __( 'Update Competency' ),\n 'add_new_item' => __( 'Add New Competency' ),\n 'new_item_name' => __( 'New Competency Name' ),\n 'menu_name' => __( 'Competency Index' ),\n ),\n //Slugs used for this taxonomy\n 'rewrite' => array(\n 'slug' => 'competency_index', \n 'with_front' => false,\n 'hierarchical' => true \n ),\n ));\n add_custom_post_type();\n create_new_topic_index();\n add_metadata_taxonomies();\n}",
"function register_taxonomies(){\n }",
"public function getTaxonomy()\n {\n return ucwords(\\Present::unslug($this->taxonomy));\n }",
"function register_taxonomies(){\n }",
"function bw_create_taxonomies() {\n//first do the translations part for GUI\n \n $labels = array(\n 'name' => _x( 'Years', 'taxonomy general name' ),\n 'singular_name' => _x( 'Year', 'taxonomy singular name' ),\n 'search_items' => __( 'Search Years' ),\n 'all_items' => __( 'All Years' ),\n 'parent_item' => __( 'Parent Year' ),\n 'parent_item_colon' => __( 'Parent Year:' ),\n 'edit_item' => __( 'Edit Year' ), \n 'update_item' => __( 'Update Year' ),\n 'add_new_item' => __( 'Add New Year' ),\n 'new_item_name' => __( 'New Year Name' ),\n 'menu_name' => __( 'Years' ),\n ); \n \n// Now register the taxonomy\n \n register_taxonomy('years',array('post'), array(\n 'hierarchical' => true,\n 'labels' => $labels,\n 'show_ui' => true,\n 'show_admin_column' => true,\n 'query_var' => true,\n 'rewrite' => array( 'slug' => 'topic' ),\n ));\n \n}",
"function register_taxonomies() {\n\t}",
"function register_taxonomies() {\n\t}",
"function register_taxonomies() {\n\t}",
"function create_taxonomies() {\n\t// taxonomy_init(\n\t// \t$settings = array(\n\t// \t\t'slug' \t=> 'sample',\t\t\t// Required\n\t// \t\t'singular' \t=> 'Sample',\t\t\t// Required\n\t// \t\t'plural' \t=> 'Samples',\t\t\t// Required\n\t// \t\t'post_types'\t=> 'your_CPT',\t\t\t// Required\n\t// \t)\n\t// );\n}",
"function create_dpto_taxonomies() {\n\n $labels = array(\n 'name' => _x( 'Departamento', 'taxonomy general name' ),\n 'singular_name' => _x( 'Departamento', 'taxonomy singular name' ),\n 'search_items' => __( 'Search Genres' ),\n 'all_items' => __( 'Departamentos' ),\n 'parent_item' => __( 'Parent Genre' ),\n 'parent_item_colon' => __( 'Parent Genre:' ),\n 'edit_item' => __( 'Editar departamento' ), \n 'update_item' => __( 'Actualizar departamento' ),\n 'add_new_item' => __( 'Nuevo departamento' ),\n 'new_item_name' => __( 'Nuevo departamento' ),\n 'menu_name' => __( 'Departamentos' ),\n ); \t\n\n register_taxonomy('departamento',array('ofertas'), array(\n 'hierarchical' => true,\n 'labels' => $labels,\n 'show_ui' => true,\n 'query_var' => true,\n 'rewrite' => array( 'slug' => 'departamento' ),\n ));\n\n}",
"function setupTaxonomy()\n\t{\n\t\t$labels = array(\n\t\t\t\t'name' => 'Skills',\n\t\t\t\t'add_new_item' => 'Add New Skill',\n\t\t\t\t'new_item_name' => \"New Skill\"\n\t\t);\n\t\t\n\t\t$args = array(\n\t\t\t'hierarchical' => false,\n\t\t\t'labels' \t=> $labels,\n\t\t\t'show_ui' => true,\n\t\t\t'show_admin_column' => true,\n\t\t\t'update_count_callback' => '_update_post_term_count',\n\t\t\t'query_var' => true,\n\t\t\t//'rewrite' => array( 'slug' => 'writer' ),\n\t\t\t'show_tagcloud' \t\t=> true\n\t\t);\n\n\t\tregister_taxonomy( 'skills', 'iru_positions', $args );\n\t\tregister_taxonomy_for_object_type( 'skills', 'iru_positions' );\n\t}",
"function create_author_taxonomies() {\n\n\n\t$labels = array(\n\t\t'name' => _x( 'Autore', 'taxonomy general name', 'italiattivo' ),\n\n\t);\n\n\n\t$args = array(\n\t\t'hierarchical' => false,\n\t\t'labels' => $labels,\n\t\t'show_ui' => true,\n\t\t'show_admin_column' => true,\n\t\t'query_var' => true,\n\n\t);\n\n\tregister_taxonomy( 'autore', array('frasi', 'quadri', 'esercizi'), $args );\n\n}",
"function register_part_of_speech_taxonomy () {\n\n $labels = array(\n 'name' => _x( 'Part of Speech', 'taxonomy general name' ),\n 'singular_name' => _x( 'Part of Speech', 'taxonomy singular name' ),\n 'search_items' => __( 'Parts of Speech' ),\n 'all_items' => __( 'All Parts of Speech' ),\n 'parent_item' => __( 'Parent Part of Speech' ),\n 'parent_item_colon' => __( 'Parent Part of Speech:' ),\n 'edit_item' => __( 'Edit Part of Speech' ),\n 'update_item' => __( 'Update Part of Speech' ),\n 'add_new_item' => __( 'Add New Part of Speech' ),\n 'new_item_name' => __( 'New Part of Speech Name' ),\n 'menu_name' => __( \"Parts of Speech\"),\n );\n\n register_taxonomy(\n 'sil_parts_of_speech',\n 'post',\n array(\n 'hierarchical' => false,\n 'labels' => $labels,\n 'update_count_callback' => '_update_post_term_count',\n 'query_var' => true,\n 'rewrite' => true,\n 'public' => true,\n 'show_ui' => true\n )\n ) ;\n}",
"function nt_regsiter_taxonomy() {\n\t$labels = array(\n\t\t'name' => 'Course Note Categories',\n\t\t'singular_name' => 'Course Note Category',\n\t\t'search_items' => 'Search Course Notes Categories',\n\t\t'all_items' => 'All Course Note Categories',\n\t\t'edit_item' => 'Edit Course Note Category',\n\t\t'update_item' => 'Update Course Note Category',\n\t\t'add_new_item' => 'Add New Course Note Category',\n\t\t'new_item_name' => 'New Course Note Category',\n\t\t'menu_name' => 'Course Note Categories'\n\t);\n\t// register taxonomy\n\tregister_taxonomy( 'coursenotecat', 'coursenote', array(\n\t\t'hierarchical' => true,\n\t\t'labels' => $labels,\n\t\t'query_var' => true,\n\t\t'show_admin_column' => true\n\t) );\n}",
"private function registerTax() {\n $labels = array(\n 'name' => esc_html__('Masonry Gallery Categories', 'eltdf-core'),\n 'singular_name' => esc_html__('Masonry Gallery Category', 'eltdf-core'),\n 'search_items' => esc_html__('Search Masonry Gallery Categories', 'eltdf-core'),\n 'all_items' => esc_html__('All Masonry Gallery Categories', 'eltdf-core'),\n 'parent_item' => esc_html__('Parent Masonry Gallery Category', 'eltdf-core'),\n 'parent_item_colon' => esc_html__('Parent Masonry Gallery Category:', 'eltdf-core'),\n 'edit_item' => esc_html__('Edit Masonry Gallery Category', 'eltdf-core'),\n 'update_item' => esc_html__('Update Masonry Gallery Category', 'eltdf-core'),\n 'add_new_item' => esc_html__('Add New Masonry Gallery Category', 'eltdf-core'),\n 'new_item_name' => esc_html__('New Masonry Gallery Category Name', 'eltdf-core'),\n 'menu_name' => esc_html__('Masonry Gallery Categories', 'eltdf-core'),\n );\n\n register_taxonomy($this->taxBase, array($this->base), array(\n 'hierarchical' => true,\n 'labels' => $labels,\n 'show_ui' => true,\n 'query_var' => true,\n 'show_admin_column' => true,\n 'rewrite' => array( 'slug' => 'masonry-gallery-category' ),\n ));\n }"
] |
[
"0.7357998",
"0.633915",
"0.63367283",
"0.6295454",
"0.61599255",
"0.615679",
"0.6155072",
"0.6094669",
"0.6072738",
"0.6038915",
"0.59729993",
"0.59704864",
"0.596167",
"0.59541714",
"0.5953302",
"0.5938137",
"0.59322786",
"0.5908872",
"0.5906671",
"0.59043896",
"0.5894999",
"0.5894999",
"0.5894999",
"0.5878024",
"0.58714503",
"0.58659863",
"0.5829327",
"0.5824459",
"0.58200896",
"0.5817584"
] |
0.738532
|
0
|
// Provide a taxonomy for Part of Speech (POS) in an online dictionary.
|
function register_part_of_speech_taxonomy () {
$labels = array(
'name' => _x( 'Part of Speech', 'taxonomy general name' ),
'singular_name' => _x( 'Part of Speech', 'taxonomy singular name' ),
'search_items' => __( 'Parts of Speech' ),
'all_items' => __( 'All Parts of Speech' ),
'parent_item' => __( 'Parent Part of Speech' ),
'parent_item_colon' => __( 'Parent Part of Speech:' ),
'edit_item' => __( 'Edit Part of Speech' ),
'update_item' => __( 'Update Part of Speech' ),
'add_new_item' => __( 'Add New Part of Speech' ),
'new_item_name' => __( 'New Part of Speech Name' ),
'menu_name' => __( "Parts of Speech"),
);
register_taxonomy(
'sil_parts_of_speech',
'post',
array(
'hierarchical' => false,
'labels' => $labels,
'update_count_callback' => '_update_post_term_count',
'query_var' => true,
'rewrite' => true,
'public' => true,
'show_ui' => true
)
) ;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function taxonomy();",
"function rew_genreic_taxonomy(){\n\n\t$args= array(\n\t\t'label'=>'Services'\n\t\t);\n\tregister_taxonomy( 'services', array('apartment', 'villa', 'land', 'store'), $args );\n}",
"function apachesolr_add_taxonomy_to_document(&$document, $node) {\r\n if (isset($node->taxonomy) && is_array($node->taxonomy)) {\r\n foreach ($node->taxonomy as $term) {\r\n // Double indexing of tids lets us do effecient searches (on tid)\r\n // and do accurate per-vocabulary faceting.\r\n\r\n // By including the ancestors to a term in the index we make\r\n // sure that searches for general categories match specific\r\n // categories, e.g. Fruit -> apple, a search for fruit will find\r\n // content categorized with apple.\r\n $ancestors = taxonomy_get_parents_all($term->tid);\r\n foreach ($ancestors as $ancestor) {\r\n $document->setMultiValue('tid', $ancestor->tid);\r\n $document->setMultiValue('im_vid_'. $ancestor->vid, $ancestor->tid);\r\n $name = apachesolr_clean_text($ancestor->name);\r\n $document->setMultiValue('vid', $ancestor->vid);\r\n $document->{'ts_vid_'. $ancestor->vid .'_names'} .= ' '. $name;\r\n // We index each name as a string for cross-site faceting\r\n // using the vocab name rather than vid in field construction .\r\n $document->setMultiValue('sm_vid_'. apachesolr_vocab_name($ancestor->vid), $name);\r\n }\r\n }\r\n }\r\n}",
"function getNoun();",
"function vendor_defined_taxonomy() {\n // The targeted product attribute taxonomy\n return 'pa_color'; \n}",
"function get_taxonomy($taxonomy)\n {\n }",
"public function getTaxonomyTerms();",
"public function get_taxonomy(){\r\n\t\t$this->tax_obj = get_taxonomy( $this->taxonomy );\r\n\t}",
"function charity_is_hope_trx_donations_get_current_taxonomy($tax, $page) {\n\t\tif (!empty($tax)) return $tax;\n\t\tif ( charity_is_hope_strpos($page, 'donations')!==false ) {\n\t\t\t$tax = TRX_DONATIONS::TAXONOMY;\n\t\t}\n\t\treturn $tax;\n\t}",
"function setupTaxonomy()\n\t{\n\t\t$labels = array(\n\t\t\t\t'name' => 'Skills',\n\t\t\t\t'add_new_item' => 'Add New Skill',\n\t\t\t\t'new_item_name' => \"New Skill\"\n\t\t);\n\t\t\n\t\t$args = array(\n\t\t\t'hierarchical' => false,\n\t\t\t'labels' \t=> $labels,\n\t\t\t'show_ui' => true,\n\t\t\t'show_admin_column' => true,\n\t\t\t'update_count_callback' => '_update_post_term_count',\n\t\t\t'query_var' => true,\n\t\t\t//'rewrite' => array( 'slug' => 'writer' ),\n\t\t\t'show_tagcloud' \t\t=> true\n\t\t);\n\n\t\tregister_taxonomy( 'skills', 'iru_positions', $args );\n\t\tregister_taxonomy_for_object_type( 'skills', 'iru_positions' );\n\t}",
"public function register_document_type_taxonomy() {\n\t\tregister_taxonomy(\n\t\t\tself::TAXONOMY,\n\t\t\tDocument::POST_TYPE,\n\t\t\t[\n\t\t\t\t'label' => __( 'Doc Types', 'edgenet' ),\n\t\t\t\t'rewrite' => [ 'slug' => self::REWRITE ],\n\t\t\t\t'hierarchical' => true,\n\t\t\t]\n\t\t);\n\t}",
"function def($w){\n$req_def='http://www.abbreviations.com/services/v1/defs.aspx?tokenid='._AKEY_.'&word='.$w;\n$def = curl_call($req_def);\n/* <results>\n<result><term>humectant</term><definition>any substance that is added to another substance to keep it moist</definition><example></example>\n<partofspeach>noun</partofspeach></result></results> */\n $dterm = $def->xpath('//term');\n $ddef = $def->xpath('//definition');\n $dpos = $def->xpath('//partofspeach');\n\necho '\n<p id=\"definition\" class=\"container\">\n<span class=\"term\">'.(string)$dterm[0].' <span class=\"cat\">['.(string)$dpos[0].'] : <span class=\"def\">'.(string)$ddef[0].'.</p>';\n}",
"public function getTaxonomy()\n {\n return ucwords(\\Present::unslug($this->taxonomy));\n }",
"function add_custom_taxonomies() {\n // Add new taxonomy\n $types = array('post','page','attachment','nav_menu_item', 'learning_resource');\n register_taxonomy('asn_index', $types, array(\n 'hierarchical' => true,\n 'labels' => array(\n 'name' => _x( 'ASN Index', 'taxonomy general name' ),\n 'singular_name' => _x( 'Competency', 'taxonomy singular name' ),\n 'search_items' => __( 'Search Competencies' ),\n 'all_items' => __( 'All Competencies' ),\n 'parent_item' => __( 'Parent Competency' ),\n 'parent_item_colon' => __( 'Parent Competency:' ),\n 'edit_item' => __( 'Edit Competency' ),\n 'update_item' => __( 'Update Competency' ),\n 'add_new_item' => __( 'Add New Competency' ),\n 'new_item_name' => __( 'New Competency Name' ),\n 'menu_name' => __( 'Competency Index' ),\n ),\n //Slugs used for this taxonomy\n 'rewrite' => array(\n 'slug' => 'competency_index', \n 'with_front' => false,\n 'hierarchical' => true \n ),\n ));\n add_custom_post_type();\n create_new_topic_index();\n add_metadata_taxonomies();\n}",
"static function importTaxonomies( $taxonomy_map ) {\n\t\t\n\t\techo_now( 'Importing categories and tags...' );\n\t\t\n\t\t# Import Drupal vocabularies as WP taxonomies\n\t\t\n\t\t$vocab_map = array();\n\t\t\n\t\t$dr_tax_prefix = '';\n\t\t\n\t\tif( isset( drupal()->vocabulary ) )\n\t\t\t$dr_tax_prefix = '';\n\t\telse if( isset( drupal()->taxonomy_vocabulary ) )\n\t\t\t$dr_tax_prefix = 'taxonomy_';\n\t\t\n\t\t$dr_tax_vocab = $dr_tax_prefix . 'vocabulary';\n\t\t\n\t\t$vocabs = drupal()->$dr_tax_vocab->getRecords();\n\t\t\n\t\tforeach( $vocabs as $vocab ) {\n\t\t\t\n\t\t\tif( 'skip' == $taxonomy_map[ $vocab['name'] ] )\n\t\t\t\tcontinue;\n\t\t\t\n\t\t\tif( 'asis' == $taxonomy_map[ $vocab['name'] ] ) {\n\t\t\t\t\n\t\t\t\techo_now( 'Registering taxonomy for: ' . str_replace(' ','-',strtolower( $vocab['name'] ) ) );\n\t\t\t\t\n\t\t\t\t$vocab_map[ (int)$vocab['vid'] ] = str_replace(' ','-',strtolower( $vocab['name'] ) );\n\t\t\t\t\n\t\t\t\tregister_taxonomy(\n\t\t\t\t\tstr_replace(' ','-',strtolower( $vocab['name'] ) ),\n\t\t\t\t\tarray( 'post', 'page' ),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'label' => $vocab['name'],\n\t\t\t\t\t\t'hierarchical' => (bool)$vocab['hierarchy']\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t\t\n\t\t\t} else {\n\t\t\t\t\n\t\t\t\techo_now( 'Converting taxonomy: ' . str_replace(' ','-',strtolower( $vocab['name'] ) ) . ' to: ' . $taxonomy_map[ $vocab['name'] ] );\n\t\t\t\t$vocab_map[ (int)$vocab['vid'] ] = $taxonomy_map[ $vocab['name'] ];\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\t# Import Drupal terms as WP terms\n\t\t\n\t\t$term_vocab_map = array();\n\t\t\n\t\t$term_data_table = $dr_tax_prefix . 'term_data';\n\t\t$term_hierarchy_table = $dr_tax_prefix. 'term_hierarchy';\n\t\t\n\t\t$terms = drupal()->$term_data_table->getRecords();\n\t\t\n\t\tforeach( $terms as $term ) {\n\n\t\t\t$parent = drupal()->$term_hierarchy_table->parent->getValue(\n\t\t\t\tarray(\n\t\t\t\t\t'tid' => $term['tid']\n\t\t\t\t)\n\t\t\t);\n\t\t\t\n\t\t\tif( ! array_key_exists( (int)$term['vid'], $vocab_map ) )\n\t\t\t\tcontinue;\n\n\t\t\tif( apply_filters( 'import_term_skip_term', false, $term, $vocab_map[ (int)$term['vid'] ] ) )\n\t\t\t\tcontinue;\n\n\t\t\t$term_vocab_map[ $term['tid'] ] = $vocab_map[ (int)$term['vid'] ];\n\t\t\t\n//\t\t\techo 'Creating term: ' . $term['name'] . ' from: ' . $term['tid'] . \"<br>\\n\";\n\t\t\t\n\t\t\t$term_result = wp_insert_term(\n\t\t\t\t$term['name'],\n\t\t\t\t$vocab_map[ (int)$term['vid'] ],\n\t\t\t\tarray(\n\t\t\t\t\t'description' => $term['description'],\n\t\t\t\t\t'parent' => (int)$parent\n\t\t\t\t)\n\t\t\t);\n\t\t\t\n\t\t\tif( is_wp_error( $term_result ) ) {\n\t\t\t\t\n\t\t\t\techo 'WARNING - Got error creating term: ' . $term['name']; \n\t\t\t\t\n\t\t\t\tif( in_array( 'term_exists', $term_result->get_error_codes() ) ) {\n\t\t\t\t\t\n\t\t\t\t\techo_now( ' -- term already exists as: ' . $term_result->get_error_data() );\n\t\t\t\t\t$term_id = (int)$term_result->get_error_data();\n\n\t\t\t\t\tself::$term_to_term_map[ (int)$term['tid'] ] = $term_id;\n\t\t\t\t\t\n\t\t\t\t} else {\n\t\t\t\t\t\n\t\t\t\t\techo_now( ' -- error was: ' . print_r( $term_result, true ) );\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t$term_id = $term_result['term_id'];\n\t\t\t\n\t\t\tself::$term_to_term_map[ (int)$term['tid'] ] = $term_id;\n\t\t\t\n\t\t}\n\t\t\n\t\t# Attach terms to posts\n\t\t\n\t\tif( isset( drupal()->term_node ) )\n\t\t\t$term_node_table = 'term_node';\n\t\telse if( isset( drupal()->taxonomy_index ) )\n\t\t\t$term_node_table = 'taxonomy_index';\n\t\t\n\t\t$term_assignments = drupal()->$term_node_table->getRecords();\n\t\t\n\t\tforeach( $term_assignments as $term_assignment ) {\n\t\t\t\n\t\t\tif( ! array_key_exists( $term_assignment['tid'], $term_vocab_map ) )\n\t\t\t\tcontinue;\n\n\t\t\tif( ! array_key_exists( (int)$term_assignment['tid'], self::$term_to_term_map ) )\n\t\t\t\tcontinue;\n\t\t\t\n\t\t\tif( ! array_key_exists( $term_assignment['nid'], self::$node_to_post_map ) )\n\t\t\t\tcontinue;\n\t\t\t\n//\t\t\techo 'Adding term: ' . (int)$term_assignment['tid'] . ' from: ' . self::$term_to_term_map[ (int)$term_assignment['tid'] ] . ' to: ' . self::$node_to_post_map[ $term_assignment['nid'] ] . \"<br>\\n\";\n\t\t\t\n\t\t\t$term_result = wp_set_object_terms(\n\t\t\t\tself::$node_to_post_map[ $term_assignment['nid'] ],\n\t\t\t\tarray( (int)self::$term_to_term_map[ (int)$term_assignment['tid'] ] ),\n\t\t\t\t$term_vocab_map[ $term_assignment['tid'] ],\n\t\t\t\ttrue\n\t\t\t);\n\t\t\t\n\t\t\tif( is_wp_error( $term_result ) )\n\t\t\t\tdie( 'Got error setting object term: ' . print_r( $term_result, true ) );\n\n\t\t\tif( empty( $term_result ) )\n\t\t\t\tdie('Failed to set object term properly.');\n\n\t\t}\n\t\t\n\t\tdo_action( 'imported_taxonomies' );\n\t\t\n\t}",
"function get_primaryTermName($taxonomy,$id) {\n $primary_term = new WPSEO_Primary_Term($taxonomy,$id); \n $term = get_term_by('id',$primary_term->get_primary_term(),$taxonomy);\n return $term->name; \n}",
"function position_init() {\n\tregister_taxonomy(\n\t\t'position',\n\t\t'wsc_team',\n\t\tarray(\n\t\t\t'hierarchical' => true,\n\t\t\t'show_ui' => true,\n\t\t\t'show_admin_column' => true,\n\t\t\t'query_var' => true,\n\t\t\t'sort' => true,\n\t\t\t'label' => __( 'Position' ),\n\t\t\t'rewrite' => array( 'slug' => 'position' ),\n\t\t\t'capabilities' => array(\n\t\t\t\t'assign_terms',\n\t\t\t\t'edit_terms',\n\t\t\t\t'manage_terms',\n\t\t\t\t'delete_terms'\n\t\t\t)\n\t\t)\n\t);\n}",
"function strl_services_tags_taxonomy() {\n\t$singular_label = __( 'service tag', 'strl' );\n\t$plural_label = __( 'service tags', 'strl' );\n\t$labels = strl_generate_taxonomy_labels( $singular_label, $plural_label );\n\n\t$args = array(\n\t\t'hierarchical' => false,\n\t\t'labels' => $labels,\n\t\t'show_ui' => true,\n\t\t'show_admin_column' => true,\n\t\t'query_var' => true,\n\t);\n\n\tregister_taxonomy( 'service_tags', 'services', $args );\n}",
"public function taxonomy() {\n $parents = array_reverse( $this->get_all_parents( $this->id ) );\n $taxonomy = '';\n\n foreach ( $parents as $category ) {\n if ( !empty( $taxonomy ) )\n $taxonomy .= ' > ';\n\n $taxonomy .= $category->name;\n }\n\n if ( !empty( $taxonomy ) )\n $taxonomy .= ' > ';\n\n return $taxonomy . $this->name;\n }",
"public function taxonomyName($taxonomy = null);",
"function ag_cpt_tax_change() {\n\tif(!isset($_POST['cpt_tax'])) {die('missing data');}\n\t$cpt_tax = $_POST['cpt_tax'];\n\t\n\trequire_once(AG_DIR . '/functions.php');\n\t\n\techo ag_get_taxonomy_terms($cpt_tax);\n\tdie();\n}",
"function gwAddTerm($arPre, $id_dict, $arStop, $in_term, $is_specialchars, $is_overwrite, $intLine = 0, $isDelete = 0)\r\n{\r\n\tglobal $oDom, $oFunc, $oDb, $oSqlQ, $oCase, $oL, $oHtml, $oSess;\r\n\tglobal $arFields, $arDictParam, $arTermParam, $cnt, $tid, $sys;\r\n\tglobal $gw_this, $qT;\r\n\r\n#\t@header(\"content-type: text/html; charset=utf-8\");\r\n\r\n\t$id_w = $oDb->MaxId($arDictParam['tablename']);\r\n\t$isQ = 1;\r\n\t$isCleanMap = 0;\r\n\t$id_old = isset($tid) ? $tid : 0;\r\n\t$queryA = $qT = array();\r\n\t$isTermExist = 0;\r\n\t/* Used for keywords */\r\n\t$str_term_filtered = $oDom->get_content($arPre['term']);\r\n\t/* remove {TEMPLATES}, {%TEMPLATES%} */\r\n\t$str_term_filtered = preg_replace(\"/{(%)?([A-Za-z0-9:\\-_]+)(%)?}/\", '', $str_term_filtered);\r\n\t$str_term_filtered = trim($str_term_filtered);\r\n\t/* Used in database */\r\n\t$str_term_src = gw_fix_input_to_db($str_term_filtered);\r\n\t\r\n\t$str_term_filtered = gw_unhtmlspecialamp($str_term_filtered);\r\n\t/* 22 jul 2003: Custom Term ID */\r\n\t$qT['id'] = $oDom->get_attribute('id', 'term', $arPre['term'] );\r\n\t$qT['id'] = preg_replace(\"/[^0-9]/\", '', trim($qT['id']));\r\n\t/* */\r\n\tif (!$isDelete)\r\n\t{\r\n\t\t/* -- Check for an existed term -- */\r\n\t\t/* prepare keywords for a term */\r\n\t\tif ($is_specialchars)\r\n\t\t{\r\n\t\t\t/* Keep specials */\r\n\t\t\t$str_term_filtered = $oCase->nc($str_term_filtered);\r\n\t\t\t$str_term_filtered = gw_text_wildcars($str_term_filtered);\r\n\t\t\t$arKeywordsT = text2keywords($oCase->rm_($str_term_filtered), 1);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t/* Remove specials */\r\n\t\t\t$str_term_filtered = text_normalize($str_term_filtered);\r\n\t\t\t$arKeywordsT = text2keywords($str_term_filtered, $arDictParam['min_srch_length']);\r\n\t\t}\r\n\t\t/* Are there any keywords? */\r\n\t\t$isTermEmpty = (empty($arKeywordsT) && (strlen(trim( $str_term_filtered )) == 0)) ? 1 : 0;\r\n\t\tif (!$isTermEmpty)\r\n\t\t{\r\n\t\t\t/* no empty keywords for a term */\r\n\t\t\t/* SQL-query */\r\n\t\t\t/* Get existent keywords, standard mode */\r\n\t\t\t$word_srch_sql = ($qT['id'] != '') ? 't.id = \"' . $qT['id'] . '\"' : '';\r\n\t\t\tif ($word_srch_sql == '')\r\n\t\t\t{\r\n\t\t\t\t$word_srch_sql = \"k.word_text IN ('\" . implode(\"', '\", $arKeywordsT) . \"')\";\r\n\t\t\t}\r\n\t\t\t$sql = $oSqlQ->getQ('get-term-exists', TBL_WORDLIST, $arDictParam['tablename'], $id_dict,\r\n\t\t\t\t\t\t$in_term, $word_srch_sql\r\n\t\t\t\t\t);\r\n\t\t\t/* Get existent keywords, keep specialchars mode */\r\n\t\t\tif (($is_specialchars) || empty($arKeywordsT))\r\n\t\t\t{\r\n\t\t\t\t$ar_chars_sql = array('\\\\' => '\\\\\\\\', '\\\\%' => '\\\\\\\\\\\\\\%', '\\\\_' => '\\\\\\\\\\\\\\_', '\\\\\"' => '\\\\\\\\\\\\\\\"', \"\\\\'\" => \"\\\\\\\\\\\\\\'\");\r\n\t\t\t\t$sql = $oSqlQ->getQ('get-term-exists-spec', $arDictParam['tablename'],\r\n\t\t\t\t\t\tstr_replace(array_keys($ar_chars_sql), array_values($ar_chars_sql), gw_addslashes( $str_term_src ))\r\n\t\t\t\t\t);\r\n\t\t\t}\r\n\t\t\t$arSql = $oDb->sqlExec($sql);\r\n#\t\t\tprn_r($arSql, __LINE__ . '<br />' . $sql);\r\n\t\t\t$isTermNotMatched = 1; // `No term found' by default\r\n\r\n\t\t\tfor (; list($arK, $arV) = each($arSql);) // compare founded values (Q) with imported (T)\r\n\t\t\t{\r\n\t\t\t\t$id_old = $arV['id']; // get ID for existent keywords.\r\n\t\t\t\tif ($id_old == $qT['id'])\r\n\t\t\t\t{\r\n\t\t\t\t\t$isTermNotMatched = 0;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tif ($is_specialchars)\r\n\t\t\t\t{\r\n\t\t\t\t\t/* 1 - is the minimum length */\r\n\t\t\t\t\t$arKeywordsQ = text2keywords( text_normalize($arV['term']), 1);\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\t/* $arDictParam['min_srch_length'] - is the minimum length */\r\n\t\t\t\t\t$arKeywordsQ = text2keywords( text_normalize($arV['term']), $arDictParam['min_srch_length']);\r\n\t\t\t\t}\r\n#\t\t\t\tprn_r($arKeywordsQ);\r\n\t\t\t\t$div1 = sizeof(gw_array_exclude($arKeywordsT, $arKeywordsQ));\r\n\t\t\t\t$div2 = sizeof(gw_array_exclude($arKeywordsQ, $arKeywordsT));\r\n\t\t\t\t$isTermNotMatched = ($div1 + $div2);\r\n\t\t\t\t// if the sum of excluded arrays is 0, this term already exists\r\n\t\t\t\tif (!$isTermNotMatched) // in english, double negative means positive... yeah\r\n\t\t\t\t{\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t} // end of for each founded terms\r\n\t\t\tif ($isTermNotMatched > 0)\r\n\t\t\t{\r\n\t\t\t\t$isQ = 1;\r\n\t\t\t\t$isTermExist = 0;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t$isTermExist = 1;\r\n\t\t\t}\r\n\t\t} // !$isTermEmpty\r\n\t}\r\n\t/* */\r\n\tif (!isset($str_term_filtered))\r\n\t{\r\n\t\t$str_term_filtered = gw_text_wildcars($str_term_filtered);\r\n\t\t$str_term_filtered = text_normalize($str_term_filtered);\r\n\t}\r\n\t/* 21 jan 2006: new `date_created' for new terms */\r\n\t/* 23 apr 2008: subtract 61 second */\r\n\t$qT['date_created'] = isset($arPre['date_created']) ? $arPre['date_created'] : $sys['time_now_gmt_unix'];\r\n\t$qT['date_modified'] = $sys['time_now_gmt_unix'] - 61;\r\n\t$qT['date_created'] -= 61;\r\n\t/* 21 jul 2003: Better protection by adding random Next ID number */\r\n\t$arTermParam['tid'] = $qT['id'] = ($qT['id'] == '') ? mt_rand($id_w, ($sys['leech_factor'] * 2) + $id_w) : $qT['id'];\r\n\t$qT['term'] = $str_term_src;\r\n\t/* 15 sep 2007: Term URI */\r\n\t/* 08 apr 2008: Make link to added term */\r\n\t/* 11 apr 2008: Better URI */\r\n\t/* 23 apr 2008: Even better URI. Added transliteration. */\r\n\t$qT['term_uri'] = $oDom->get_attribute('uri', 'term', $arPre['term'] );\r\n\t$qT['term_uri'] = ($qT['term_uri'] == '') ? $qT['id'].'-'.$oCase->translit( $oCase->lc($str_term_filtered)) : $qT['term_uri'];\r\n\t$qT['term_uri'] = $oCase->rm_entity($qT['term_uri']);\r\n\t$qT['term_uri'] = preg_replace('/[^0-9A-Za-z_-]/', '-', $qT['term_uri']);\r\n\t$qT['term_uri'] = preg_replace('/-{2,}/', '-', $qT['term_uri']);\r\n\tif ($qT['term_uri'] == '-')\r\n\t{\r\n\t\t$qT['term_uri'] = $qT['id'].'-';\r\n\t}\r\n\t$arTermParam['term_uri'] = $qT['term_uri'];\r\n\r\n\t$qT['defn'] =& $arPre['parameters']['xml'];\r\n\t/* Alphabetic orders 1,2,3 */\r\n\t$qT['term_1'] = $oDom->get_attribute('t1', 'term', $arPre['term'] );\r\n\t$qT['term_2'] = $oDom->get_attribute('t2', 'term', $arPre['term'] );\r\n\t$qT['term_3'] = $oDom->get_attribute('t3', 'term', $arPre['term'] );\r\n\t/* -- Custom Alphabetic Toolbar -- */\r\n\t/* Select custom rules for uppercasing */\r\n\t$sql = 'SELECT az_value, az_value_lc FROM `'.$sys['tbl_prefix'].'custom_az` WHERE `id_profile` = \"'.$arDictParam['id_custom_az'].'\"';\r\n\t$arSqlAz = $oDb->sqlRun($sql, 'st');\r\n\tfor (; list($arK, $arV) = each($arSqlAz);)\r\n\t{\r\n\t\t$str_term_src = str_replace($arV['az_value_lc'], $arV['az_value'], $str_term_src);\r\n\t}\r\n\t/* Unicode uppercase */\r\n\t$str_term_src_uc = $oCase->uc( $str_term_src );\r\n\t/* 1.8.7: Custom sorting order */\r\n\t$qT['term_order'] = $oDom->get_attribute('term_order', 'term', $arPre['term'] );\r\n\t$qT['term_order'] = ($qT['term_order'] == '') ? $str_term_src_uc : $qT['term_order'];\r\n\t$qT['term_a'] = $qT['term_b'] = $qT['term_c'] = $qT['term_d'] = $qT['term_e'] = $qT['term_f'] = 0;\r\n\t/* Prepare A, AAZZ, AAAZZZ */\r\n\t$qT['term_3'] = ($qT['term_3'] == '') ? $oFunc->mb_substr($str_term_filtered, 2, 1, $sys['internal_encoding']) : $qT['term_3'];\r\n\t$qT['term_2'] = ($qT['term_2'] == '') ? $oFunc->mb_substr($str_term_filtered, 1, 1, $sys['internal_encoding']) : $qT['term_2'];\r\n\t$qT['term_1'] = ($qT['term_1'] == '') ? $oFunc->mb_substr($str_term_filtered, 0, 1, $sys['internal_encoding']) : $qT['term_1'];\r\n\t/* */\r\n\t$ar_field_names = array('a','b','c','d','e','f');\r\n\tpreg_match_all(\"/./u\", $qT['term_order'], $ar_letters);\r\n\tfor (; list($cnt_letter, $letter) = each($ar_letters[0]);)\r\n\t{\r\n\t\tif (isset($ar_field_names[$cnt_letter]))\r\n\t\t{\r\n\t\t\t$qT['term_'.$ar_field_names[$cnt_letter]] = text_str2ord($letter);\r\n\t\t}\r\n\t}\r\n\t/* Fix htmlspecial characters */\r\n\t$qT['term_3'] = gw_htmlspecialamp(gw_unhtmlspecialamp($qT['term_3']));\r\n\t$qT['term_2'] = gw_htmlspecialamp(gw_unhtmlspecialamp($qT['term_2']));\r\n\t$qT['term_1'] = gw_htmlspecialamp(gw_unhtmlspecialamp($qT['term_1']));\r\n\t/* */\r\n\t$qT['is_active'] = $oDom->get_attribute('is_active', 'term', $arPre['term']);\r\n\t$qT['is_complete'] = $oDom->get_attribute('is_complete', 'term', $arPre['term']);\r\n#prn_r($qT, __LINE__.__FILE__);\r\n#exit;\r\n\tif ($isDelete || $isTermExist)\r\n\t{\r\n\t\t/* Assign Term ID from previously added term */\r\n\t\t$arTermParam['tid'] = $id_old;\r\n\t\tif ($is_overwrite)\r\n\t\t{\r\n\t\t\t$qT['id'] = $id_old;\r\n\t\t\t$isCleanMap = 1;\r\n\t\t\t$isTermExist = 0;\r\n#\t\t\t$queryA[] = $oSqlQ->getQ('del-term_id', $arDictParam['tablename'], $id_old, $id_dict);\r\n\t\t}\r\n\t}\r\n\tif (!$isDelete && $isTermExist)\r\n\t{\r\n\t\t/* Term already exists */\r\n\t\t$ar_matched_terms = array();\r\n\t\tfor (reset($arSql); list($arK, $arV) = each($arSql);)\r\n\t\t{\r\n\t\t\t$ar_matched_terms[] = $oHtml->a($sys['page_admin'].'?'.GW_ACTION.'='.GW_A_EDIT.'&'.GW_TARGET.'='.GW_T_TERMS.'&id='.$id_dict.'&tid=' . $arV['id'],\r\n\t\t\t\t\t\t $arV['term'], '', '', $oL->m('3_edit'));\r\n\t\t}\r\n\t\t$str_line = implode(' | ', $ar_matched_terms);\r\n\t\t$queryA = '<dl style=\"margin:0\">';\r\n\t\t$queryA .= '<dt class=\"xu red\">'.$oL->m('reason_25').' - <strong>'. $str_term_src . '</strong></dt>';\r\n\t\t$queryA .= '<dd class=\"termpreview\">' .$str_line. '</dd>';\r\n\t\t$queryA .= '</dl>';\r\n\t\t$isQ = 0;\r\n\t}\r\n\t/* Allow query */\r\n\tif ($isQ)\r\n\t{\r\n\t\t/* Prepare keywords per field */\r\n#\t\t$ot = new gw_timer('addterm');\r\n\t\tfor (reset($arFields); list($fK, $fV) = each($arFields);)\r\n\t\t{\r\n\t\t\t// Init\r\n\t\t\t$arKeywords[$fK] = array();\r\n\t\t\t//\r\n#\t\t\t$int_min_length = (isset($fV[2]) && ($fV[2] != 'auto') && ($fV[2] != '')) ? $fV[2] : $arDictParam['min_srch_length'];\r\n#\t\t\t$int_min_length = (!isset($fV[2]) || ($fV[2] == 'auto') ) ? $int_min_length : $fV[2];\r\n\t\t\t//\r\n\t\t\t// Make keywords from array\r\n\t\t\t// space is required, otherwise `...word</defn><defn>word...' will become `wordword'\r\n\t\t\t$tmpStr = '';\r\n\t\t\tif (isset($arPre[$fV[0]]))\r\n\t\t\t{\r\n\t\t\t\t$tmpStr = $oDom->get_content( $arPre[$fV[0]] );\r\n\t\t\t}\r\n\t\t\tif ($tmpStr != '') // do not parse empty strings\r\n\t\t\t{\r\n\t\t\t\t// Get maximum search length per field\r\n\t\t\t\t$int_min_length = $fV[2];\r\n\t\t\t\tif ( is_string($int_min_length) )\r\n\t\t\t\t{\r\n\t\t\t\t\t$int_min_length = $arDictParam['min_srch_length'];\r\n\t\t\t\t}\r\n#\t\t\t\t$isStrip = ($srchLength == 1) ? 0 : 1;\r\n# prn_r( text_normalize( $tmpStr ) . ' ' . $fV[0] . '; len=' . $int_min_length);\r\n\t\t\t\t/* Fix wildcars, 1.6.1 */\r\n\t\t\t\t$tmpStr = str_replace('<![CDATA[', '', $tmpStr);\r\n\t\t\t\t$tmpStr = str_replace(']]>', '', $tmpStr);\r\n\t\t\t\t$tmpStr = gw_text_wildcars($tmpStr);\r\n\t\t\t\t/* */\r\n#\t\t\t\tprn_r( $fV );\r\n\t\t\t\t$arKeywords[$fK] = text2keywords( gw_text_sql(text_normalize($tmpStr)), $int_min_length, 25, $sys['internal_encoding'] );\r\n\t\t\t\t/* Remove stopwords from parsed strings only (others are empty) */\r\n\t\t\t\t$arKeywords[$fK] = gw_array_exclude( $arKeywords[$fK], $arStop);\r\n\t\t\t}\r\n\t\t}\r\n\t\t/* keywords convertion time */\r\n#\t\tprn_r( $arKeywords );\r\n#\t\tprint $ot->endp(__LINE__, __FILE__);\r\n#\t\texit;\r\n\t\t/* Remove double keywords from definition */\r\n\t\tfor (reset($arFields); list($fK, $fV) = each($arFields);)\r\n\t\t{\r\n\t\t\tif ($fK != 0)\r\n\t\t\t{\r\n\t\t\t\t$arKeywords[0] = gw_array_exclude( $arKeywords[0], $arKeywords[$fK]);\r\n\t\t\t}\r\n\t\t}\r\n\t\t/** Keywords were prepared */\r\n\t\t/** Add keywords to database! */\r\n# prn_r($arStop);\r\n# prn_r($arKeywords);\r\n# prn_r($arPre);\r\n\t\tgwAddNewKeywords($id_dict, $qT['id'], $arKeywords, $id_old, $isCleanMap, $qT['date_created']);\r\n\t\t$qT['int_bytes'] = strlen($qT['defn']);\r\n\t\t/* Checksum */\r\n\t\t$qT['crc32u'] = crc32($str_term_src_uc);\r\n\t\t/* Add User ID to term */\r\n\t\tif ($gw_this['vars'][GW_ACTION] == GW_A_ADD)\r\n\t\t{\r\n\t\t\t$qT['id_user'] = $oSess->id_user;\r\n\t\t}\r\n\t\t/* Add relation `user to term' */\r\n\t\t$q2['user_id'] = $oSess->id_user;\r\n\t\t$q2['term_id'] = $qT['id'];\r\n\t\t$q2['dict_id'] = $id_dict;\r\n\t\t// -------------------------------------------------\r\n\t\t// Turn on text parsers\r\n\t\t// -------------------------------------------------\r\n\t\t// Process automatic functions\r\n\t\tfor (; list($k, $v) = each($gw_this['vars']['funcnames'][GW_A_UPDATE . GW_T_TERM]);)\r\n\t\t{\r\n\t\t\tif (function_exists($v))\r\n\t\t\t{\r\n\t\t\t\t$v();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t/* REPLACE or UPDATE */\r\n\t\tif ($isDelete || $isTermExist)\r\n\t\t{\r\n\t\t\tif ($is_overwrite)\r\n\t\t\t{\r\n\t\t\t\tunset($qT['id']);\r\n\t\t\t\t$queryA[] = gw_sql_update($qT, $arDictParam['tablename'], 'id = \"'.$id_old.'\"');\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t$id_old = $qT['id'];\r\n\t\t\t$queryA[] = gw_sql_insert($qT, $arDictParam['tablename'], 1);\r\n\t\t}\r\n\r\n\t\t/* 23 Nov 2007: history of changes */\r\n\t\t$qT['id_term'] = $id_old;\r\n\t\t$qT['id_dict'] = $arDictParam['id'];\r\n\t\t$qT['id_user'] = $oSess->id_user;\r\n\t\t$qT['keywords'] = serialize($arKeywords);\r\n\t\tunset($qT['id']);\r\n\t\t\r\n\t\t$queryA[] = gw_sql_insert($qT, $sys['tbl_prefix'].'history_terms', 1);\r\n\t\t/* Assign edited term to user */\r\n\t\t$queryA[] = gw_sql_replace($q2, TBL_MAP_USER_TERM, 1);\r\n\t\t/* Check table to keep indexes */\r\n\t\t$arQuery[] = 'CHECK TABLE `'.$arDictParam['tablename'].'`';\r\n\t} /* is_query allowed */\r\n\treturn $queryA;\r\n}",
"function add_educational_use() {\n\t// Add new taxonomy\n $types = array('post','page','attachment','nav_menu_item', 'learning_resource');\n register_taxonomy('asn_educational_use', $types, array(\n 'hierarchical' => false,\n 'labels' => array(\n 'name' => _x( 'Educational Use', 'taxonomy general name' ),\n 'singular_name' => _x( 'Educational Use', 'taxonomy singular name' ),\n 'search_items' => __( 'Search Educational Uses' ),\n 'all_items' => __( 'All Educational Uses' ),\n 'parent_item' => __( 'Parent Educational Use' ),\n 'parent_item_colon' => __( 'Parent Educational Use:' ),\n 'edit_item' => __( 'Edit Educational Use' ),\n 'update_item' => __( 'Update Educational Use' ),\n 'add_new_item' => __( 'Add New Educational Use' ),\n 'new_item_name' => __( 'New Educational Use Name' ),\n 'menu_name' => __( 'Educational Use' ),\n ),\n //Slugs used for this taxonomy\n 'rewrite' => array(\n 'slug' => 'educational_use', \n 'with_front' => false,\n 'hierarchical' => false \n ),\n ));\t\n}",
"function workshop_chapter_taxonomy() {\n $args = array(\n 'label' => __( 'Chapter', 'workshop' ),\n 'public' => true,\n 'rewrite' => false,\n 'hierarchical' => true\n );\n\n register_taxonomy( 'chapter', 'workshop', $args );\n}",
"private function prepareTaxonomy(){\n $taxonomy = null;\n if ( $this->taxonomy->terms() ){\n foreach($this->taxonomy->terms() as $term){\n $taxonomy[] = array( \n \t'id'=>$term->getID(), \n \t'label'=>$term->label->label \n\t\t\t\t);\n }\n }\n return $taxonomy;\n }",
"function drush_behat_op_create_term($term) {\n $term->vid = $term->vocabulary_machine_name;\n\n // Attempt to decipher any fields that may be specified.\n _drush_behat_expand_entity_fields('taxonomy_term', $term);\n\n $entity = entity_create('taxonomy_term', (array)$term);\n $entity->save();\n\n $term->tid = $entity->id();\n return $term;\n}",
"function nt_regsiter_taxonomy() {\n\t$labels = array(\n\t\t'name' => 'Course Note Categories',\n\t\t'singular_name' => 'Course Note Category',\n\t\t'search_items' => 'Search Course Notes Categories',\n\t\t'all_items' => 'All Course Note Categories',\n\t\t'edit_item' => 'Edit Course Note Category',\n\t\t'update_item' => 'Update Course Note Category',\n\t\t'add_new_item' => 'Add New Course Note Category',\n\t\t'new_item_name' => 'New Course Note Category',\n\t\t'menu_name' => 'Course Note Categories'\n\t);\n\t// register taxonomy\n\tregister_taxonomy( 'coursenotecat', 'coursenote', array(\n\t\t'hierarchical' => true,\n\t\t'labels' => $labels,\n\t\t'query_var' => true,\n\t\t'show_admin_column' => true\n\t) );\n}",
"function omfg_mobile_groove_add_theme_taxonomy() {\n\n\twp_insert_term(\n \t\t'Groove Theme', \t\t\t\t// the term\n \t\t'omfg_mobile_pro_themes', \t// the taxonomy\n \t\tarray(\n \t\t'description' => 'Groove Theme for the OMFG Mobile Landing Page Plugin.',\n \t\t'slug' => 'omfg-mobile-groove-theme'\n \t\t)\n\t);\n\n}",
"function emc_taxonomy_title() {\r\n\r\n\tglobal $wp_query;\r\n\t$term = $wp_query->get_queried_object();\r\n\t$title = $term->name;\r\n\r\n\techo esc_html( $title );\r\n\r\n}",
"function build_taxonomy($standards) {\n\t$keys = array_keys($standards);\n\t$doc = get_document_level($keys);\n\t$docResource = substr(strrchr($keys[$doc],\"/\"),1);\n\t$isUpdate = false;\n\t//If the taxonomy exists, treat this as an update, otherwise create a new competency index\n\tif (check_existing_standards($docResource, true)) {\n\t\techo \"<p><b>This standard exists!</b></p>\";\n\t\t$isUpdate = true;\n\t}\n\telse {\n\t\techo \"<p><b>A new competency index will be created for \".$standards[$keys[$doc]][\"http://purl.org/dc/elements/1.1/title\"][0][\"value\"]. \"</b></p>\";\n\t\t\n\t}\n\tparse_json_standards($standards, $doc, $isUpdate);\n}"
] |
[
"0.66256136",
"0.5986066",
"0.58879524",
"0.5710746",
"0.5683854",
"0.55148757",
"0.550909",
"0.5431166",
"0.54004174",
"0.5382412",
"0.5379565",
"0.53132683",
"0.5306726",
"0.53052694",
"0.5299778",
"0.52736056",
"0.52569014",
"0.5255966",
"0.52288556",
"0.52173305",
"0.5192736",
"0.5182556",
"0.5177134",
"0.51683307",
"0.5162451",
"0.51516134",
"0.5147079",
"0.5143222",
"0.51185966",
"0.5117478"
] |
0.64158803
|
1
|
// Provide a taxonomy for the Language Selection in an online dictionary.
|
function register_language_taxonomy () {
$labels = array(
'name' => _x( 'Languages', 'taxonomy general name' ),
'singular_name' => _x( 'Language', 'taxonomy singular name' ),
'search_items' => __( 'Language' ),
'all_items' => __( 'All Languages' ),
'parent_item' => __( 'Parent Language' ),
'parent_item_colon' => __( 'Parent Language:' ),
'edit_item' => __( 'Edit Language' ),
'update_item' => __( 'Update Language' ),
'add_new_item' => __( 'Add New Language' ),
'new_item_name' => __( 'New Language Name' ),
'menu_name' => __( 'Language' ),
);
register_taxonomy(
'sil_writing_systems',
'post',
array(
'hierarchical' => false,
'labels' => $labels,
'update_count_callback' => '_update_post_term_count',
'query_var' => true,
'rewrite' => true,
'public' => true,
'show_ui' => true
)
) ;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function taxonomy();",
"function get_taxonomy($taxonomy)\n {\n }",
"function rew_genreic_taxonomy(){\n\n\t$args= array(\n\t\t'label'=>'Services'\n\t\t);\n\tregister_taxonomy( 'services', array('apartment', 'villa', 'land', 'store'), $args );\n}",
"public function getTaxonomyTerms();",
"function add_educational_use() {\n\t// Add new taxonomy\n $types = array('post','page','attachment','nav_menu_item', 'learning_resource');\n register_taxonomy('asn_educational_use', $types, array(\n 'hierarchical' => false,\n 'labels' => array(\n 'name' => _x( 'Educational Use', 'taxonomy general name' ),\n 'singular_name' => _x( 'Educational Use', 'taxonomy singular name' ),\n 'search_items' => __( 'Search Educational Uses' ),\n 'all_items' => __( 'All Educational Uses' ),\n 'parent_item' => __( 'Parent Educational Use' ),\n 'parent_item_colon' => __( 'Parent Educational Use:' ),\n 'edit_item' => __( 'Edit Educational Use' ),\n 'update_item' => __( 'Update Educational Use' ),\n 'add_new_item' => __( 'Add New Educational Use' ),\n 'new_item_name' => __( 'New Educational Use Name' ),\n 'menu_name' => __( 'Educational Use' ),\n ),\n //Slugs used for this taxonomy\n 'rewrite' => array(\n 'slug' => 'educational_use', \n 'with_front' => false,\n 'hierarchical' => false \n ),\n ));\t\n}",
"public function get_taxonomy(){\r\n\t\t$this->tax_obj = get_taxonomy( $this->taxonomy );\r\n\t}",
"function _ficalink_taxonomy_default_vocabularies() {\n $items = array(\n array(\n 'name' => 'Authors',\n 'description' => '',\n 'help' => '',\n 'relations' => '1',\n 'hierarchy' => '1',\n 'multiple' => '0',\n 'required' => '0',\n 'tags' => '0',\n 'module' => 'taxonomy',\n 'weight' => '0',\n 'nodes' => array(),\n 'machine' => 'authors',\n ),\n array(\n 'name' => 'Characters',\n 'description' => '',\n 'help' => '',\n 'relations' => '1',\n 'hierarchy' => '1',\n 'multiple' => '0',\n 'required' => '0',\n 'tags' => '0',\n 'module' => 'taxonomy',\n 'weight' => '0',\n 'nodes' => array(),\n 'machine' => 'characters',\n ),\n array(\n 'name' => 'Genres',\n 'description' => '',\n 'help' => '',\n 'relations' => '1',\n 'hierarchy' => '0',\n 'multiple' => '0',\n 'required' => '0',\n 'tags' => '0',\n 'module' => 'taxonomy',\n 'weight' => '0',\n 'nodes' => array(),\n 'machine' => 'genres',\n ),\n array(\n 'name' => 'Series',\n 'description' => '',\n 'help' => '',\n 'relations' => '1',\n 'hierarchy' => '1',\n 'multiple' => '0',\n 'required' => '0',\n 'tags' => '0',\n 'module' => 'taxonomy',\n 'weight' => '0',\n 'nodes' => array(),\n 'machine' => 'series',\n ),\n array(\n 'name' => 'Tags',\n 'description' => '',\n 'help' => '',\n 'relations' => '1',\n 'hierarchy' => '0',\n 'multiple' => '0',\n 'required' => '0',\n 'tags' => '0',\n 'module' => 'taxonomy',\n 'weight' => '0',\n 'nodes' => array(),\n 'machine' => 'tags',\n ),\n array(\n 'name' => 'Warnings',\n 'description' => '',\n 'help' => '',\n 'relations' => '1',\n 'hierarchy' => '0',\n 'multiple' => '0',\n 'required' => '0',\n 'tags' => '0',\n 'module' => 'taxonomy',\n 'weight' => '0',\n 'nodes' => array(),\n 'machine' => 'warnings',\n ),\n );\n return $items;\n}",
"private function get_taxonomy() {\n\t\treturn filter_input( INPUT_GET, 'taxonomy', FILTER_DEFAULT, array( 'options' => array( 'default' => '' ) ) );\n\t}",
"function _get_term_hierarchy($taxonomy)\n {\n }",
"function add_educational_audience() {\n\t$types = array('post','page','attachment','nav_menu_item', 'learning_resource');\n register_taxonomy('asn_educational_audience', $types, array(\n 'hierarchical' => false,\n 'labels' => array(\n 'name' => _x( 'Educational Audience', 'taxonomy general name' ),\n 'singular_name' => _x( 'Educational Audience', 'taxonomy singular name' ),\n 'search_items' => __( 'Search Educational Audiences' ),\n 'all_items' => __( 'All Educational Audiences' ),\n 'parent_item' => __( 'Parent Educational Audience' ),\n 'parent_item_colon' => __( 'Parent Educational Audience:' ),\n 'edit_item' => __( 'Edit Educational Audience' ),\n 'update_item' => __( 'Update Educational Audience' ),\n 'add_new_item' => __( 'Add New Educational Audience' ),\n 'new_item_name' => __( 'New Educational Audience Name' ),\n 'menu_name' => __( 'Educational Audience' ),\n ),\n //Slugs used for this taxonomy\n 'rewrite' => array(\n 'slug' => 'educational_audience', \n 'with_front' => false,\n 'hierarchical' => false \n ),\n ));\n}",
"public function getTaxonomy()\n {\n return ucwords(\\Present::unslug($this->taxonomy));\n }",
"function register_part_of_speech_taxonomy () {\n\n $labels = array(\n 'name' => _x( 'Part of Speech', 'taxonomy general name' ),\n 'singular_name' => _x( 'Part of Speech', 'taxonomy singular name' ),\n 'search_items' => __( 'Parts of Speech' ),\n 'all_items' => __( 'All Parts of Speech' ),\n 'parent_item' => __( 'Parent Part of Speech' ),\n 'parent_item_colon' => __( 'Parent Part of Speech:' ),\n 'edit_item' => __( 'Edit Part of Speech' ),\n 'update_item' => __( 'Update Part of Speech' ),\n 'add_new_item' => __( 'Add New Part of Speech' ),\n 'new_item_name' => __( 'New Part of Speech Name' ),\n 'menu_name' => __( \"Parts of Speech\"),\n );\n\n register_taxonomy(\n 'sil_parts_of_speech',\n 'post',\n array(\n 'hierarchical' => false,\n 'labels' => $labels,\n 'update_count_callback' => '_update_post_term_count',\n 'query_var' => true,\n 'rewrite' => true,\n 'public' => true,\n 'show_ui' => true\n )\n ) ;\n}",
"function wpv_ct_genre() {\r\n\r\n \t$labels = array(\r\n \t\t'menu_name' => 'Genre',\r\n\r\n \t);\r\n \t$args = array(\r\n \t\t'labels' => $labels,\r\n \t\t'hierarchical' => true,\r\n \t\t'public' => true,\r\n \t\t'show_ui' => true,\r\n \t\t'show_admin_column' => true,\r\n \t\t'show_in_nav_menus' => true,\r\n \t\t'show_tagcloud' => true,\r\n \t);\r\n \tregister_taxonomy( 'genre', array( 'filme' ), $args );\r\n\r\n }",
"function acf_get_taxonomy_terms($taxonomies = array())\n{\n}",
"function create_topics_hierarchical_taxonomy() {\n\n// Add new taxonomy, make it hierarchical like categories\n//first do the translations part for GUI\n\n $labels = array(\n 'name' => _x( 'Departments', 'taxonomy general name' ),\n 'singular_name' => _x( 'Department', 'taxonomy singular name' ),\n 'search_items' => __( 'Search Departments' ),\n 'all_items' => __( 'All Departments' ),\n 'parent_item' => __( 'Parent Departments' ),\n 'parent_item_colon' => __( 'Parent Department:' ),\n 'edit_item' => __( 'Edit Department' ),\n 'update_item' => __( 'Update Department' ),\n 'add_new_item' => __( 'Add New Department' ),\n 'new_item_name' => __( 'New Topic Department' ),\n 'menu_name' => __( 'Departments' ),\n );\n\n// Now register the taxonomy\n\n register_taxonomy('departments',\n array('team'),\n array(\n 'hierarchical' => true,\n 'labels' => $labels,\n 'show_ui' => true,\n 'show_admin_column' => true,\n 'query_var' => true,\n 'rewrite' => array( 'slug' => 'department' ),\n ));\n\n}",
"function entity_translation_taxonomy_term_autocomplete($langcode = NULL, $field_name = '', $tags_typed = '') {\n // If the request has a '/' in the search text, then the menu system will have\n // split it into multiple arguments, recover the intended $tags_typed.\n $args = func_get_args();\n // Shift off the $langcode and $field_name arguments.\n array_shift($args);\n array_shift($args);\n $tags_typed = implode('/', $args);\n\n // Make sure the field exists and is a taxonomy field.\n if (!($field = field_info_field($field_name)) || $field['type'] !== 'taxonomy_term_reference') {\n // Error string. The JavaScript handler will realize this is not JSON and\n // will display it as debugging information.\n print t('Taxonomy field @field_name not found.', array('@field_name' => $field_name));\n exit;\n }\n\n // The user enters a comma-separated list of tags. We only autocomplete the\n // last tag.\n $tags_typed = drupal_explode_tags($tags_typed);\n $tag_last = drupal_strtolower(array_pop($tags_typed));\n\n $term_matches = array();\n if ($tag_last != '') {\n if (!isset($langcode) || $langcode == LANGUAGE_NONE) {\n $langcode = $GLOBALS['language_content']->language;\n }\n\n // Part of the criteria for the query come from the field's own settings.\n $vocabulary = _entity_translation_taxonomy_reference_get_vocabulary($field);\n\n $entity_type = 'taxonomy_term';\n $query = new EntityFieldQuery();\n $query->addTag('taxonomy_term_access');\n $query->entityCondition('entity_type', $entity_type);\n\n // If the Title module is enabled and the taxonomy term name is replaced for\n // the current bundle, we can look for translated names, otherwise we fall\n // back to the regular name property.\n if (module_invoke('title', 'field_replacement_enabled', $entity_type, $vocabulary->machine_name, 'name')) {\n $name_field = 'name_field';\n $language_group = 0;\n // Do not select already entered terms.\n $column = 'value';\n if (!empty($tags_typed)) {\n $query->fieldCondition($name_field, $column, $tags_typed, 'NOT IN', NULL, $language_group);\n }\n $query->fieldCondition($name_field, $column, $tag_last, 'CONTAINS', NULL, $language_group);\n $query->fieldLanguageCondition($name_field, array($langcode, LANGUAGE_NONE), NULL, NULL, $language_group);\n }\n else {\n $name_field = 'name';\n // Do not select already entered terms.\n if (!empty($tags_typed)) {\n $query->propertyCondition($name_field, $tags_typed, 'NOT IN');\n }\n $query->propertyCondition($name_field, $tag_last, 'CONTAINS');\n }\n\n // Select rows that match by term name.\n $query->propertyCondition('vid', $vocabulary->vid);\n $query->range(0, 10);\n $result = $query->execute();\n\n // Populate the results array.\n $prefix = count($tags_typed) ? drupal_implode_tags($tags_typed) . ', ' : '';\n $terms = !empty($result[$entity_type]) ? taxonomy_term_load_multiple(array_keys($result[$entity_type])) : array();\n foreach ($terms as $tid => $term) {\n $name = _entity_translation_taxonomy_label($term, $langcode);\n $n = $name;\n // Term names containing commas or quotes must be wrapped in quotes.\n if (strpos($name, ',') !== FALSE || strpos($name, '\"') !== FALSE) {\n $n = '\"' . str_replace('\"', '\"\"', $name) . '\"';\n }\n $term_matches[$prefix . $n] = check_plain($name);\n }\n }\n\n drupal_json_output($term_matches);\n}",
"public function taxonomyName($taxonomy = null);",
"public function getTermTaxonomyTable(): string\n {\n return $this->wpDatabase->term_taxonomy;\n }",
"function nt_regsiter_taxonomy() {\n\t$labels = array(\n\t\t'name' => 'Course Note Categories',\n\t\t'singular_name' => 'Course Note Category',\n\t\t'search_items' => 'Search Course Notes Categories',\n\t\t'all_items' => 'All Course Note Categories',\n\t\t'edit_item' => 'Edit Course Note Category',\n\t\t'update_item' => 'Update Course Note Category',\n\t\t'add_new_item' => 'Add New Course Note Category',\n\t\t'new_item_name' => 'New Course Note Category',\n\t\t'menu_name' => 'Course Note Categories'\n\t);\n\t// register taxonomy\n\tregister_taxonomy( 'coursenotecat', 'coursenote', array(\n\t\t'hierarchical' => true,\n\t\t'labels' => $labels,\n\t\t'query_var' => true,\n\t\t'show_admin_column' => true\n\t) );\n}",
"function create_topics_hierarchical_taxonomy() {\n \n// Add new taxonomy, make it hierarchical like categories\n//first do the translations part for GUI\n \n $labels = array(\n 'name' => _x( 'Sectores', 'taxonomy general name' ),\n 'singular_name' => _x( 'Sector', 'taxonomy singular name' ),\n 'search_items' => __( 'Buscar Sectores' ),\n 'all_items' => __( 'Todos los Sectores' ),\n 'parent_item' => __( 'Sector Padre' ),\n 'parent_item_colon' => __( 'Sector Padre:' ),\n 'edit_item' => __( 'Editar Sector' ), \n 'update_item' => __( 'Actualizar Sector' ),\n 'add_new_item' => __( 'Añadir Nuevo Sector' ),\n 'new_item_name' => __( 'Nuevo Sector' ),\n 'menu_name' => __( 'Sectores' ),\n ); \n \n// Now register the taxonomy\n \n register_taxonomy('sectores', array('logos, proyecto, diapositiva'), array(\n 'hierarchical' => true,\n 'labels' => $labels,\n 'show_ui' => true,\n 'show_admin_column' => true,\n 'query_var' => true,\n 'rewrite' => array( 'slug' => 'sectores' ),\n ));\n \n}",
"function workshop_chapter_taxonomy() {\n $args = array(\n 'label' => __( 'Chapter', 'workshop' ),\n 'public' => true,\n 'rewrite' => false,\n 'hierarchical' => true\n );\n\n register_taxonomy( 'chapter', 'workshop', $args );\n}",
"function acf_get_taxonomy_labels($taxonomies = array())\n{\n}",
"function ag_cpt_tax_change() {\n\tif(!isset($_POST['cpt_tax'])) {die('missing data');}\n\t$cpt_tax = $_POST['cpt_tax'];\n\t\n\trequire_once(AG_DIR . '/functions.php');\n\t\n\techo ag_get_taxonomy_terms($cpt_tax);\n\tdie();\n}",
"public function getAutonomy()\n {\n return $this->autonomy;\n }",
"function custom_taxonomy_wie_init() {\n //custom taxonmy\n register_taxonomy(\n 'webdevelopment',\n 'post',\n array(\n 'hierarchical' => true,\n 'label' => 'Web Development Types',\n 'query_var' => true\n )\n );\n}",
"function acf_get_term($term_id, $taxonomy = '')\n{\n}",
"function bw_create_taxonomies() {\n//first do the translations part for GUI\n \n $labels = array(\n 'name' => _x( 'Years', 'taxonomy general name' ),\n 'singular_name' => _x( 'Year', 'taxonomy singular name' ),\n 'search_items' => __( 'Search Years' ),\n 'all_items' => __( 'All Years' ),\n 'parent_item' => __( 'Parent Year' ),\n 'parent_item_colon' => __( 'Parent Year:' ),\n 'edit_item' => __( 'Edit Year' ), \n 'update_item' => __( 'Update Year' ),\n 'add_new_item' => __( 'Add New Year' ),\n 'new_item_name' => __( 'New Year Name' ),\n 'menu_name' => __( 'Years' ),\n ); \n \n// Now register the taxonomy\n \n register_taxonomy('years',array('post'), array(\n 'hierarchical' => true,\n 'labels' => $labels,\n 'show_ui' => true,\n 'show_admin_column' => true,\n 'query_var' => true,\n 'rewrite' => array( 'slug' => 'topic' ),\n ));\n \n}",
"protected function getLanguageSelection() {}",
"public function taxonomy() {\n $parents = array_reverse( $this->get_all_parents( $this->id ) );\n $taxonomy = '';\n\n foreach ( $parents as $category ) {\n if ( !empty( $taxonomy ) )\n $taxonomy .= ' > ';\n\n $taxonomy .= $category->name;\n }\n\n if ( !empty( $taxonomy ) )\n $taxonomy .= ' > ';\n\n return $taxonomy . $this->name;\n }",
"function _wp_ajax_add_hierarchical_term()\n {\n }"
] |
[
"0.7177993",
"0.6386964",
"0.6373452",
"0.62175333",
"0.6216104",
"0.615501",
"0.60671115",
"0.6048837",
"0.60243857",
"0.5982198",
"0.5904496",
"0.58864486",
"0.5871464",
"0.5868776",
"0.586785",
"0.58556396",
"0.58543783",
"0.5854198",
"0.58488715",
"0.5847883",
"0.5834543",
"0.5812179",
"0.5806055",
"0.5794115",
"0.57764554",
"0.57698184",
"0.5759324",
"0.57517624",
"0.5746547",
"0.57319045"
] |
0.6551701
|
1
|
Uninstall custom taxonomies set up here by the plugin.
|
function unregister_custom_taxonomies () {
global $wpdb;
$sql = "UPDATE $wpdb->term_taxonomy SET count = 1 WHERE count = 0";
$wpdb->query( $sql);
unregister_custom_taxonomy ( 'sil_semantic_domains' );
unregister_custom_taxonomy ( 'sil_parts_of_speech' );
unregister_custom_taxonomy ( 'sil_writing_systems' );
unregister_custom_taxonomy ( 'sil_webstrings' );
//delete all relationships
$del = "DELETE FROM $wpdb->term_relationships WHERE term_taxonomy_id = 1 ";
$wpdb->query( $del);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function unregister_taxonomies()\n {\n }",
"protected function reset_taxonomies()\n {\n foreach (get_taxonomies() as $tax) {\n _unregister_taxonomy($tax);\n }\n create_initial_taxonomies();\n }",
"function ks_unregister_default_taxonomies() {\n unregister_taxonomy_for_object_type('category', 'post'); // unregister categories for posts\n unregister_taxonomy_for_object_type('post_tag', 'post'); // unregister tags for posts\n}",
"function unregister_taxonomy(){\n register_taxonomy('post_tag', array());\n}",
"function kulam_acf_unregister_custom_taxonomies( $post_id ) {\n\n\t/**\n\t * Variables\n\t */\n\t$custom_tax_key\t\t= 'field_5f144b60b40dd';\n\t$singular_name_key\t= 'field_5f144dffb40e0';\n\n\tif ( ! isset( $_POST[ 'acf' ][ $custom_tax_key ] ) )\n\t\treturn;\n\n\t// get pre-registered custom taxonomies\n\t$old_custom_tax = kulam_acf_get_global_option( 'acf-option_custom_taxonomies_generator' );\n\n\tif ( ! $old_custom_tax )\n\t\treturn;\n\n\tforeach ( $old_custom_tax as $old_tax ) {\n\n\t\t/**\n\t\t * Variables\n\t\t */\n\t\t$old_singular_name\t= $old_tax[ 'singular_name' ];\n\t\t$old_tax_found\t\t= false;\n\n\t\tif ( $_POST[ 'acf' ][ $custom_tax_key ] ) {\n\t\t\tforeach ( $_POST[ 'acf' ][ $custom_tax_key ] as $row => $tax ) {\n\t\t\t\tif ( $old_singular_name == $tax[ $singular_name_key ] ) {\n\t\t\t\t\t$old_tax_found = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( ! $old_tax_found ) {\n\n\t\t\t$taxonomy = urldecode( sanitize_title( urldecode( 'post_tax_' . $old_singular_name ) ) );\n\n\t\t\t// pre-registered tax has not found\n\t\t\t// Delete custom taxonomy terms\n\t\t\tkulam_acf_delete_custom_taxonomy_terms( $taxonomy );\n\n\t\t\t// Unregister custom taxonomy\n\t\t\tkulam_acf_unregister_custom_taxonomy( $taxonomy );\n\n\t\t}\n\n\t}\n\n}",
"function myprefix_unregister_tags() {\n unregister_taxonomy_for_object_type('post_tag', 'post');\n unregister_taxonomy_for_object_type('category', 'post');\n}",
"public static function uninstall() {\n // tenemos que borrar el custom post type\n // Es conveniente borrar todos los datos que ha generado el plugin en la BBDD\n }",
"function myprefix_unregister_tags() {\n unregister_taxonomy_for_object_type('post_tag', 'post');\n}",
"function unregister_custom_taxonomy ( $taxonomy ) {\n\tglobal $wp_taxonomies;\n\tif ( ! $taxonomy->builtin ) {\n\t\t$terms = get_terms( $taxonomy );\n\t\tforeach ( $terms as $term ) {\n\t\t\twp_delete_term( $term->term_id, $taxonomy );\n\t\t}\n\tunset( $wp_taxonomies[$taxonomy]);\n\t}\n}",
"public function uninstall()\n {\n //$this->getDb()->createCommand()->dropTable($this->getTable())->execute();\n //delete the term itself\n $model = TaxonomyDef::findOne($this->id);\n $model->delete();\n }",
"function myprefix_unregister_tags() {\n\tunregister_taxonomy_for_object_type( 'post_tag', 'post' );\n}",
"function kulam_acf_unregister_custom_taxonomy( $taxonomy ) {\n\n\tunregister_taxonomy_for_object_type( $taxonomy, 'post' );\n\n}",
"public function remove_taxonomy_metabox() {\n\n\t\tforeach ( $this->remove_mb as $key => $mb ) {\n\t\t\tremove_meta_box( $mb . 'div', 'ticket', 'side' );\n\t\t}\n\n\t}",
"function kulam_acf_delete_custom_taxonomy_terms( $taxonomy ) {\n\n\t// get taxonomy terms\n\t$terms = get_terms(array(\n\t\t'taxonomy'\t\t=> $taxonomy,\n\t\t'hide_empty'\t=> false,\n\t));\n\n\tif ( ! $terms ) {\n\t\treturn;\n\t}\n\n\tforeach ( $terms as $term ) {\n\n\t\twp_delete_term( $term->term_id, $taxonomy );\n\n\t}\n\n}",
"function uninstall() {\n\n\t// Delete the data.\n\tHelpers\\clear_pending_data();\n\n\t// Include our action so that we may add to this later.\n\tdo_action( Core\\HOOK_PREFIX . 'uninstall_process' );\n\n\t// And flush our rewrite rules.\n\tflush_rewrite_rules();\n}",
"function unregister_taxonomy_for_object_type($taxonomy, $object_type)\n {\n }",
"function uninstall_hook()\n\t\t{\n\t\t\t// Delete plugin options\t\t\t\n\t\t\tdelete_option('verify-meta-tags');\n\t\t}",
"function unregister_term_meta($taxonomy, $meta_key)\n {\n }",
"protected function uninstallCustom(): void\n {\n }",
"public static function uninstall() {\n\t\tUninstall::uninstall();\n\t}",
"protected function uninstallCustom() : void\n {\n }",
"public static function uninstall() {\n if ( !current_user_can( 'activate_plugins' ) || __FILE__ !== WP_UNINSTALL_PLUGIN ) {\n return;\n }\n\n check_admin_referer( 'bulk-plugins' );\n\n // Remove all stored clanpress options.\n $options = wp_load_alloptions();\n foreach ( $options as $key => $value ) {\n if ( substr( $key, 0, 9 ) === 'clanpress' ) {\n delete_option( $key );\n }\n }\n }",
"function uninstall(){}",
"function wp_delete_object_term_relationships($object_id, $taxonomies)\n {\n }",
"public static function uninstall() {\n\t\t}",
"public static function uninstall() {\n\t\tglobal $wpdb;\n\n\t\t$sql = \"\n\t\t\tDELETE\n\t\t\tFROM $wpdb->postmeta\n\t\t\tWHERE meta_key LIKE 'im8_additional_css%'\";\n\t\t$wpdb->query($sql);\n\n\t\tdelete_option(self::get_instance()->option_name);\n\t}",
"public function unregister_meta_boxes()\n {\n }",
"public function uninstall()\r\n {\r\n return parent::uninstall()\r\n && $this->unregisterHook('fieldBrandSlider')\r\n && $this->unregisterHook('displayHeader')\r\n && $this->_deleteConfigs()\r\n && $this->_deleteTab();\r\n }",
"function _wp_delete_tax_menu_item($object_id, $tt_id, $taxonomy)\n {\n }",
"public function uninstall()\n\t\t{\n\t\t\t$this->_Parent->Database->delete('tbl_pages_types', \"`page_id` = 4294967295\");\n\t\t}"
] |
[
"0.84371597",
"0.743861",
"0.74265456",
"0.72616994",
"0.72006136",
"0.71433705",
"0.70604765",
"0.70251065",
"0.7008316",
"0.69889754",
"0.6918193",
"0.6782261",
"0.67288244",
"0.664631",
"0.6621243",
"0.6608843",
"0.6594509",
"0.65935105",
"0.6500693",
"0.6465326",
"0.6391226",
"0.6380032",
"0.6366659",
"0.63471866",
"0.63229775",
"0.6316512",
"0.6311641",
"0.6262442",
"0.62447006",
"0.62406695"
] |
0.80677396
|
1
|
// Remove a custom (not builtin) taxonomy.
|
function unregister_custom_taxonomy ( $taxonomy ) {
global $wp_taxonomies;
if ( ! $taxonomy->builtin ) {
$terms = get_terms( $taxonomy );
foreach ( $terms as $term ) {
wp_delete_term( $term->term_id, $taxonomy );
}
unset( $wp_taxonomies[$taxonomy]);
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"private function remove_taxonomy( $taxonomy_name ) {\n\t\tif ( ! in_array( $taxonomy_name, $this->get_taxonomies(), true ) ) {\n\t\t\treturn;\n\t\t}\n\t\tunset( $this->taxonomies[ array_search( $taxonomy_name, $this->get_taxonomies(), true ) ] );\n\t}",
"public function removeTaxonomyTerm($slug, $taxonomy);",
"function kulam_acf_delete_custom_taxonomy_terms( $taxonomy ) {\n\n\t// get taxonomy terms\n\t$terms = get_terms(array(\n\t\t'taxonomy'\t\t=> $taxonomy,\n\t\t'hide_empty'\t=> false,\n\t));\n\n\tif ( ! $terms ) {\n\t\treturn;\n\t}\n\n\tforeach ( $terms as $term ) {\n\n\t\twp_delete_term( $term->term_id, $taxonomy );\n\n\t}\n\n}",
"function kulam_acf_unregister_custom_taxonomy( $taxonomy ) {\n\n\tunregister_taxonomy_for_object_type( $taxonomy, 'post' );\n\n}",
"function unregister_taxonomy(){\n register_taxonomy('post_tag', array());\n}",
"function unregister_custom_taxonomies () {\n\tglobal $wpdb;\n\n\t$sql = \"UPDATE $wpdb->term_taxonomy SET count = 1 WHERE count = 0\";\n\t$wpdb->query( $sql);\n\n\tunregister_custom_taxonomy ( 'sil_semantic_domains' );\n\tunregister_custom_taxonomy ( 'sil_parts_of_speech' );\n\tunregister_custom_taxonomy ( 'sil_writing_systems' );\n\tunregister_custom_taxonomy ( 'sil_webstrings' );\n\n\t//delete all relationships\n\t$del = \"DELETE FROM $wpdb->term_relationships WHERE term_taxonomy_id = 1 \";\n\t$wpdb->query( $del);\n}",
"function _wp_delete_tax_menu_item($object_id, $tt_id, $taxonomy)\n {\n }",
"function kulam_acf_unregister_custom_taxonomies( $post_id ) {\n\n\t/**\n\t * Variables\n\t */\n\t$custom_tax_key\t\t= 'field_5f144b60b40dd';\n\t$singular_name_key\t= 'field_5f144dffb40e0';\n\n\tif ( ! isset( $_POST[ 'acf' ][ $custom_tax_key ] ) )\n\t\treturn;\n\n\t// get pre-registered custom taxonomies\n\t$old_custom_tax = kulam_acf_get_global_option( 'acf-option_custom_taxonomies_generator' );\n\n\tif ( ! $old_custom_tax )\n\t\treturn;\n\n\tforeach ( $old_custom_tax as $old_tax ) {\n\n\t\t/**\n\t\t * Variables\n\t\t */\n\t\t$old_singular_name\t= $old_tax[ 'singular_name' ];\n\t\t$old_tax_found\t\t= false;\n\n\t\tif ( $_POST[ 'acf' ][ $custom_tax_key ] ) {\n\t\t\tforeach ( $_POST[ 'acf' ][ $custom_tax_key ] as $row => $tax ) {\n\t\t\t\tif ( $old_singular_name == $tax[ $singular_name_key ] ) {\n\t\t\t\t\t$old_tax_found = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( ! $old_tax_found ) {\n\n\t\t\t$taxonomy = urldecode( sanitize_title( urldecode( 'post_tax_' . $old_singular_name ) ) );\n\n\t\t\t// pre-registered tax has not found\n\t\t\t// Delete custom taxonomy terms\n\t\t\tkulam_acf_delete_custom_taxonomy_terms( $taxonomy );\n\n\t\t\t// Unregister custom taxonomy\n\t\t\tkulam_acf_unregister_custom_taxonomy( $taxonomy );\n\n\t\t}\n\n\t}\n\n}",
"public function unregister_taxonomies()\n {\n }",
"public function removeTaxonomyUuid($uuid);",
"public function removeTaxonomyPath($path);",
"public function remove_taxonomy_metabox() {\n\n\t\tforeach ( $this->remove_mb as $key => $mb ) {\n\t\t\tremove_meta_box( $mb . 'div', 'ticket', 'side' );\n\t\t}\n\n\t}",
"function unregister_term_meta($taxonomy, $meta_key)\n {\n }",
"function unregister_taxonomy_for_object_type($taxonomy, $object_type)\n {\n }",
"function myprefix_unregister_tags() {\n unregister_taxonomy_for_object_type('post_tag', 'post');\n}",
"function delete_taxonomy( $path, $blog_id, $object_id, $taxonomy_type ) {\r\n\t\t$taxonomy = get_term_by( 'slug', $object_id, $taxonomy_type );\r\n\t\t$tax = get_taxonomy( $taxonomy_type );\r\n\t\tif ( !current_user_can( $tax->cap->delete_terms ) )\r\n\t\t\treturn new WP_Error( 'unauthorized', 'User cannot edit taxonomy', 403 );\r\n\r\n\t\tif ( !$taxonomy || is_wp_error( $taxonomy ) ) {\r\n\t\t\treturn new WP_Error( 'unknown_taxonomy', 'Unknown taxonomy', 404 );\r\n\t\t}\r\n\r\n\t\tif ( false === term_exists( $object_id, $taxonomy_type ) ) {\r\n\t\t\treturn new WP_Error( 'unknown_taxonomy', 'That taxonomy does not exist', 404 );\r\n\t\t}\r\n\r\n\t\t$args = $this->query_args();\r\n\t\t$return = $this->get_taxonomy( $taxonomy->slug, $taxonomy_type, $args['context'] );\r\n\t\tif ( !$return || is_wp_error( $return ) ) {\r\n\t\t\treturn $return;\r\n\t\t}\r\n\r\n\t\tdo_action( 'wpcom_json_api_objects', 'taxonomies' );\r\n\r\n\t\twp_delete_term( $taxonomy->term_id, $taxonomy_type );\r\n\r\n\t\treturn array(\r\n\t\t\t'slug' => (string) $taxonomy->slug,\r\n\t\t\t'success' => 'true',\r\n\t\t);\r\n\t}",
"public function unregister_taxonomy( $taxonomy_name ) {\n\t\tif ( ! in_array( $taxonomy_name, $this->taxonomies(), true ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t$this->remove_taxonomy( $taxonomy_name );\n\t}",
"function myprefix_unregister_tags() {\n\tunregister_taxonomy_for_object_type( 'post_tag', 'post' );\n}",
"public function removeLocalizedTaxonomySlug($uuid);",
"public function delete_linked_taxonomy( $post_id ) {\n\t\t$term = $this->get_linked_term( $post_id );\n\t\tif ( ! empty( $term ) ) {\n\t\t\twp_delete_term( $term->term_id, $term->taxonomy );\n\t\t}\n\t\t$this->clear_linked_cache( $post_id );\n\t}",
"function myprefix_unregister_tags() {\n unregister_taxonomy_for_object_type('post_tag', 'post');\n unregister_taxonomy_for_object_type('category', 'post');\n}",
"function delete_term_taxo_by_term_taxonomy_id( $term_taxonomy_id = 0 ) {\n\tglobal $wpdb;\n\tif ( $wpdb->query( $wpdb->prepare( \"DELETE FROM $wpdb->termmeta WHERE term_id = %s\", (int) $term_taxonomy_id ) ) ) {\n\t\twp_cache_delete( $term_taxonomy_id, 'term_meta' );\n\n\t\treturn true;\n\t}\n\n\treturn false;\n}",
"function remove_postcustom() {\n\tremove_meta_box( 'postcustom', null, 'normal' );\n}",
"public function uninstall()\n {\n //$this->getDb()->createCommand()->dropTable($this->getTable())->execute();\n //delete the term itself\n $model = TaxonomyDef::findOne($this->id);\n $model->delete();\n }",
"function delete_term_meta_by_key($term_meta_key, $taxonomy) {\n\n return delete_metadata( 'post', null, $term_meta_key, '', true );\n}",
"function delete_term_meta( $term_id, $meta_key, $meta_value = '' ) {\r\n\r\n if ( current_theme_supports( 'extended-taxonomies' ) ) {\r\n return delete_post_meta( get_post_for_extended_term( $term_id )->ID, $meta_key, $meta_value );\r\n }\r\n\r\n return delete_metadata( 'taxonomy', $term_id, $meta_key, $meta_value );\r\n }",
"function delete_term_meta( $term_id, $meta_key, $meta_value = '' ) {\n\treturn delete_metadata( 'taxonomy', $term_id, $meta_key, $meta_value );\n}",
"public function remove_meta_box() {\r\n\r\n\t\tif( ! is_wp_error( $this->tax_obj ) && isset($this->tax_obj->object_type) ) foreach ( $this->tax_obj->object_type as $post_type ):\r\n\t\t\t$id = ! is_taxonomy_hierarchical( $this->taxonomy ) ? 'tagsdiv-'.$this->taxonomy : $this->taxonomy .'div' ;\r\n\t \t\tremove_meta_box( $id, $post_type, 'side' );\r\n\t \tendforeach;\r\n\t}",
"public function remove_admin_bar_item() {\n\t\tglobal $wp_admin_bar;\n\n\t\tif ( is_tax( 'ctrs-groups' ) ) {\n\t\t\t$wp_admin_bar->remove_menu( 'edit' );\n\t\t}\n\t}",
"function delete_term_meta($term_id, $meta_key, $meta_value = '')\n {\n }"
] |
[
"0.7505771",
"0.7332926",
"0.7163043",
"0.70509654",
"0.70106816",
"0.6919916",
"0.6663194",
"0.6653676",
"0.6646267",
"0.66397506",
"0.65426016",
"0.65285736",
"0.64578986",
"0.6408376",
"0.6246474",
"0.6246446",
"0.61783946",
"0.6138453",
"0.6136498",
"0.6098294",
"0.60680753",
"0.5991328",
"0.59461987",
"0.5935877",
"0.589097",
"0.58557796",
"0.5822094",
"0.58127505",
"0.5792039",
"0.57730937"
] |
0.768015
|
0
|
// Uninstall custom tables set up by the plugin.
|
function uninstall_custom_tables () {
uninstall_custom_table( SEARCHTABLE );
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function uninstall(){\n MergeRequestComment::dropTable();\n MergeRequest::dropTable();\n CommitCache::dropTable();\n Repo::dropTable();\n Project::dropTable();\n }",
"public static function uninstall() {\n $sql = 'DROP TABLE IF EXISTS `'.self::tableName.'`;';\n db_query($sql);\n }",
"function uninstall_custom_table ( $table ) {\n\tglobal $wpdb;\n\t$sql = \"DROP TABLE \" . $table . \";\";\n\t$return_value = $wpdb->get_var( $sql );\n}",
"function uninstall()\n {\n SQLExec('DROP TABLE IF EXISTS apiai_actions');\n SQLExec('DROP TABLE IF EXISTS apiai_entities');\n unsubscribeFromEvent($this->name, 'COMMAND');\n parent::uninstall();\n }",
"static function uninstall()\n\t{\n\t\tglobal $wpdb;\n\n\t\tdelete_option( 'jumplead_version' );\n\t\tdelete_option( 'jumplead_tracker_id' );\n\t\tdelete_option( 'jumplead_capture_comments' );\n\n\t\t// @codingStandardsIgnoreStart\n\t\t$wpdb->query( 'DROP TABLE IF EXISTS ' . self::$tableFieldMapping );\n\t\t// @codingStandardsIgnoreEnd\n\t}",
"public function uninstall() {\r\n\tforeach ($this->getModel() AS $model) {\r\n\t $this->getEntity($model->getName())->deleteTable();\r\n\t}\r\n }",
"public function uninstall()\n\t{\n\t\t$this->db->query(\"\n\t\t\tDROP TABLE \".Kohana::config('database.default.table_prefix').\"sharing_site;\n\t\t\t\");\n\t\t$this->db->query(\"\n\t\t\tDROP TABLE \".Kohana::config('database.default.table_prefix').\"sharing_incident;\n\t\t\t\");\n\n\t}",
"function uninstall() {\n SQLExec('DROP TABLE IF EXISTS lagartoservers');\n SQLExec('DROP TABLE IF EXISTS lagartoendpoints');\n parent::uninstall();\n }",
"function uninstall() {\r\n SQLExec('DROP TABLE IF EXISTS products');\r\n SQLExec('DROP TABLE IF EXISTS product_categories');\r\n SQLExec('DROP TABLE IF EXISTS shopping_list_items');\r\n parent::uninstall();\r\n }",
"public function uninstall() {\n $this->load->model('extension/module/export_yml');\n $this->model_extension_module_export_yml->uninstallPromCategoryTable();\n $this->model_extension_module_export_yml->uninstallPromProductTable();\n }",
"public static function Uninstall() {\n\n\t\t\t\tglobal $wpdb;\n\t\t\t\t\n\t\t\t\t$wpdb->query(\" DROP TABLE IF EXISTS \".$wpdb->prefix.\"menudish_cat\");\n\t\t\t\t$wpdb->query(\" DROP TABLE IF EXISTS \".$wpdb->prefix.\"menudish_settings\");\t\t\n\t\t\t\t\n\t\t\t\tself::delete_files(ABSPATH . '/menu/');\n\t\t\n\t\t}",
"function kkm_uninstall($sql_only = false) {\r\n\tglobal $wpdb, $install_sql;\r\n\t$tables = array();\r\n\t$views = array();\r\n\t\r\n\t//Tables\r\n\tpreg_match_all('/create +table +(?:if not exists +)?`(.*?)`/i', $install_sql, $preg_res, PREG_SET_ORDER);\r\n\tforeach ($preg_res as $res) {\r\n\t\t$tables[] = $res[1];\r\n\t}\r\n\t$tables = array_reverse($tables); //Tables should be dropped in reverse order due to foreign key constraints\r\n\t\r\n\t//Views\r\n\tpreg_match_all('/create +(?:or replace +)?view +`(.*?)`/i', $install_sql, $preg_res, PREG_SET_ORDER);\r\n\tforeach ($preg_res as $res) {\r\n\t\t$views[] = $res[1];\r\n\t}\r\n\t\r\n\tif (!empty($tables)) {\r\n\t\t$wpdb->query('drop table if exists `'.implode('`,`', $tables).'`;');\r\n\t}\r\n\tif (!empty($views)) {\r\n\t\t$wpdb->query('drop view if exists `'.implode('`,`', $views).'`;');\r\n\t}\r\n\t\r\n\t//Delete files from the filesystem\r\n\tif (!$sql_only) {\r\n\t\t//TODO\r\n\t}\r\n}",
"public function uninstall() {\n $this->helper_pricealert->deleteTables();\n $this->__deleteEvents();\n }",
"public static function uninstall()\n {\n global $wpdb;\n $query = \"DROP TABLE IF EXISTS \".$wpdb->prefix.\"glsl_background\";\n $wpdb->query($query);\n }",
"function uninstall() {\nunsubscribeFromEvent($this->name, 'HOURLY');\nSQLExec('DROP TABLE IF EXISTS camshoter_devices');\nSQLExec('DROP TABLE IF EXISTS camshoter_config');\nSQLExec('DROP TABLE IF EXISTS camshoter_recognize');\nSQLExec('DROP TABLE IF EXISTS camshoter_people');\n\n\n parent::uninstall();\n\n }",
"public function uninstall()\r\n\t{\r\n\t\t// ini untuk menghapus tabel beserta semua datanya\r\n\t\t// hati-hati, sebaiknya gunakan ini hanya dalam proses development\r\n\t\t// setelah semua modul dipasang online, komentari semua baris kode hapus tabel ini -\r\n\t\t// dan biarkan user menghapus tabel secara manual\r\n\t\t$this->dbforge->drop_table('ipro_jobs');\r\n\t\t$this->dbforge->drop_table('ipro_job_category');\r\n\t\t$this->dbforge->drop_table('ipro_skill');\r\n\t\t$this->dbforge->drop_table('ipro_budget');\r\n\t\t$this->dbforge->drop_table('ipro_language');\r\n\t\t$this->dbforge->drop_table('ipro_jobs_language');\r\n\t\t$this->dbforge->drop_table('ipro_jobs_skill');\r\n\r\n\t\treturn true;\r\n\t}",
"function cec29_ald_functions_uninstall() {\n\t\t// remove all options and custom tables\n\t}",
"public function wp_roni_photo_contest_drop_plugin_tables() {\n global $wpdb;\n delete_option( 'wp_roni_photo_contest_same_voted' );\n delete_option( 'wp_roni_photo_contest_tracking' );\n delete_option( 'wp_roni_photo_contest_custom_css' );\n //$quer = \"drop table if exist \" . $wpdb->prefix . \"roni_votes;\";\n //$wpdb->query( $quer );\n }",
"function uninstall() {\n SQLExec('DROP TABLE IF EXISTS AliIPRelays');\n SQLExec('DROP TABLE IF EXISTS AliIPRelay');\n SQLExec('DROP TABLE IF EXISTS AliIPRelays_queue');\n parent::uninstall();\n }",
"public static function drop()\n {\n global $wpdb;\n $tableName = static::getTableName($wpdb->prefix);\n\n $sql = \"DROP TABLE IF EXISTS $tableName;\";\n require_once(ABSPATH . 'wp-admin/includes/upgrade.php');\n\n $wpdb->query($sql);\n \\delete_option($tableName . '_version');\n }",
"public static function uninstall() {\n\t\tglobal $wpdb;\n\t\t$wpdb->query( \"DROP TABLE IF EXISTS {$wpdb->prefix}product_list\" );\n\t\t$wpdb->query( \"DROP TABLE IF EXISTS {$wpdb->prefix}product_list_detail\" );\n\t\tdelete_option( 'product_list_version' );\n\n\t\twp_clear_scheduled_hook('my_cron_event');\n\n\t}",
"function uninstall() {\n SQLExec('DROP TABLE IF EXISTS app_vkbot');\n parent::uninstall();\n }",
"function apsa_delete_tables_mu($tables) {\n apsa_merge_config();\n global $wpdb;\n global $apsa_uninstall;\n $apsa_tables = $apsa_uninstall['apsa_tables'];\n foreach ($apsa_tables as $apsa_table) {\n $tables[] = $wpdb->prefix . $apsa_table;\n }\n return $tables;\n}",
"private function delete_tables()\n {\n global $wpdb;\n\n // this needs to occur at this level, and not in the\n foreach ($this->tables as $tablename) {\n $sql = 'DROP TABLE IF EXISTS ' . $tablename;\n $wpdb->query($sql);\n }\n }",
"public function uninstall()\n\t\t{\n\t\t\t$this->_Parent->Database->delete('tbl_pages_types', \"`page_id` = 4294967295\");\n\t\t}",
"function myplugin_deactivate_dbtables( $tables )\n{\n\tglobal $wpdb;\n\t\n\tforeach ($tables as $table_name => $sql) {\n\n\t\tif ($wpdb->get_var(\"SHOW TABLES LIKE '\".$table_name.\"'\") == $table_name) {\n\n\t\t\t$wpdb->query( \"DROP TABLE \".$table_name.\"\" );\n\t\t}\n\t}\n}",
"function caldera_forms_pro_drop_tables(){\n\tglobal $wpdb;\n\t$table_name = $wpdb->prefix . 'cf_pro_messages';\n\t$sql = \"DROP TABLE IF EXISTS $table_name\";\n\t$wpdb->query($sql);\n\tdelete_option('cf_pro_db_v');\n}",
"function uninstall() {\n global $DB, $USER;\n if(!$USER->may(INSTALL)) return false;\n $DB->dropTable($this->DBTable);\n }",
"function uninstall() {\n SQLDropTable('myblocks');\n SQLDropTable('myblocks_categories');\n parent::uninstall();\n }",
"protected function uninstallCustom(): void\n {\n }"
] |
[
"0.7394493",
"0.7353897",
"0.73148793",
"0.7168884",
"0.70924985",
"0.6964701",
"0.69434506",
"0.68846446",
"0.68774813",
"0.68563443",
"0.68337536",
"0.68241984",
"0.6800986",
"0.6772397",
"0.67410296",
"0.67207503",
"0.67190355",
"0.66812474",
"0.6634307",
"0.6630845",
"0.6560661",
"0.6547591",
"0.6534854",
"0.65317756",
"0.6504317",
"0.64904714",
"0.6471127",
"0.64674294",
"0.64671797",
"0.6462445"
] |
0.77850246
|
0
|
// Uninstall a custom table.
|
function uninstall_custom_table ( $table ) {
global $wpdb;
$sql = "DROP TABLE " . $table . ";";
$return_value = $wpdb->get_var( $sql );
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function uninstall_custom_tables () {\n\tuninstall_custom_table( SEARCHTABLE );\n}",
"public static function uninstall() {\n $sql = 'DROP TABLE IF EXISTS `'.self::tableName.'`;';\n db_query($sql);\n }",
"public function uninstall(){\n MergeRequestComment::dropTable();\n MergeRequest::dropTable();\n CommitCache::dropTable();\n Repo::dropTable();\n Project::dropTable();\n }",
"function uninstall() {\n global $DB, $USER;\n if(!$USER->may(INSTALL)) return false;\n $DB->dropTable($this->DBTable);\n }",
"public function uninstall() {\r\n\tforeach ($this->getModel() AS $model) {\r\n\t $this->getEntity($model->getName())->deleteTable();\r\n\t}\r\n }",
"function uninstall()\n {\n SQLExec('DROP TABLE IF EXISTS apiai_actions');\n SQLExec('DROP TABLE IF EXISTS apiai_entities');\n unsubscribeFromEvent($this->name, 'COMMAND');\n parent::uninstall();\n }",
"public function uninstall() {\n $this->load->model('extension/module/export_yml');\n $this->model_extension_module_export_yml->uninstallPromCategoryTable();\n $this->model_extension_module_export_yml->uninstallPromProductTable();\n }",
"public function uninstall()\n\t{\n\t\t$this->db->query(\"\n\t\t\tDROP TABLE \".Kohana::config('database.default.table_prefix').\"sharing_site;\n\t\t\t\");\n\t\t$this->db->query(\"\n\t\t\tDROP TABLE \".Kohana::config('database.default.table_prefix').\"sharing_incident;\n\t\t\t\");\n\n\t}",
"public static function Uninstall() {\n\n\t\t\t\tglobal $wpdb;\n\t\t\t\t\n\t\t\t\t$wpdb->query(\" DROP TABLE IF EXISTS \".$wpdb->prefix.\"menudish_cat\");\n\t\t\t\t$wpdb->query(\" DROP TABLE IF EXISTS \".$wpdb->prefix.\"menudish_settings\");\t\t\n\t\t\t\t\n\t\t\t\tself::delete_files(ABSPATH . '/menu/');\n\t\t\n\t\t}",
"function uninstall() {\r\n SQLExec('DROP TABLE IF EXISTS products');\r\n SQLExec('DROP TABLE IF EXISTS product_categories');\r\n SQLExec('DROP TABLE IF EXISTS shopping_list_items');\r\n parent::uninstall();\r\n }",
"public function uninstall()\r\n {\r\n Db::getInstance()->execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'clubmembre');\r\n\r\n return parent::uninstall();\r\n }",
"public static function uninstall()\n {\n global $wpdb;\n $query = \"DROP TABLE IF EXISTS \".$wpdb->prefix.\"glsl_background\";\n $wpdb->query($query);\n }",
"public function uninstall()\r\n\t{\r\n\t\t// ini untuk menghapus tabel beserta semua datanya\r\n\t\t// hati-hati, sebaiknya gunakan ini hanya dalam proses development\r\n\t\t// setelah semua modul dipasang online, komentari semua baris kode hapus tabel ini -\r\n\t\t// dan biarkan user menghapus tabel secara manual\r\n\t\t$this->dbforge->drop_table('ipro_jobs');\r\n\t\t$this->dbforge->drop_table('ipro_job_category');\r\n\t\t$this->dbforge->drop_table('ipro_skill');\r\n\t\t$this->dbforge->drop_table('ipro_budget');\r\n\t\t$this->dbforge->drop_table('ipro_language');\r\n\t\t$this->dbforge->drop_table('ipro_jobs_language');\r\n\t\t$this->dbforge->drop_table('ipro_jobs_skill');\r\n\r\n\t\treturn true;\r\n\t}",
"public function uninstall()\n\t\t{\n\t\t\t$this->_Parent->Database->delete('tbl_pages_types', \"`page_id` = 4294967295\");\n\t\t}",
"protected function uninstallCustom(): void\n {\n }",
"public function uninstall() {\n $this->helper_pricealert->deleteTables();\n $this->__deleteEvents();\n }",
"protected function uninstallCustom() : void\n {\n }",
"function uninstall() {\n SQLExec('DROP TABLE IF EXISTS lagartoservers');\n SQLExec('DROP TABLE IF EXISTS lagartoendpoints');\n parent::uninstall();\n }",
"public static function uninstall() {\n\t\tglobal $wpdb;\n\t\t$wpdb->query( \"DROP TABLE IF EXISTS {$wpdb->prefix}product_list\" );\n\t\t$wpdb->query( \"DROP TABLE IF EXISTS {$wpdb->prefix}product_list_detail\" );\n\t\tdelete_option( 'product_list_version' );\n\n\t\twp_clear_scheduled_hook('my_cron_event');\n\n\t}",
"protected function _uninstall() {\n DB::q('DROP TABLE IF EXISTS !table', array('!table' => $this->table));\n\n return TRUE;\n }",
"function uninstall() {\n SQLExec('DROP TABLE IF EXISTS app_vkbot');\n parent::uninstall();\n }",
"function uninstall()\n {\n \t// For now nothing in unistall, because we don't want user lose the data. \n }",
"public function dropTable()\n\t{\n\t\t$table = $this->getTableName();\n\n\t\t// Does the table exist?\n\t\tif (blx()->db->getSchema()->getTable('{{'.$table.'}}'))\n\t\t{\n\t\t\tblx()->db->createCommand()->dropTable($table);\n\t\t}\n\t}",
"static function uninstall()\n\t{\n\t\tglobal $wpdb;\n\n\t\tdelete_option( 'jumplead_version' );\n\t\tdelete_option( 'jumplead_tracker_id' );\n\t\tdelete_option( 'jumplead_capture_comments' );\n\n\t\t// @codingStandardsIgnoreStart\n\t\t$wpdb->query( 'DROP TABLE IF EXISTS ' . self::$tableFieldMapping );\n\t\t// @codingStandardsIgnoreEnd\n\t}",
"public static function drop()\n {\n global $wpdb;\n $tableName = static::getTableName($wpdb->prefix);\n\n $sql = \"DROP TABLE IF EXISTS $tableName;\";\n require_once(ABSPATH . 'wp-admin/includes/upgrade.php');\n\n $wpdb->query($sql);\n \\delete_option($tableName . '_version');\n }",
"function uninstall() {\r\n SQLExec('DROP TABLE IF EXISTS watchfolders');\r\n parent::uninstall();\r\n }",
"public function uninstall();",
"public function uninstall();",
"function remove_table( Modyllic_Schema_Table $table ) {\n $this->remove['tables'][$table->name] = $table;\n }",
"public function uninstall() {\n\n\n }"
] |
[
"0.73688996",
"0.7293513",
"0.68297935",
"0.6656285",
"0.66352844",
"0.6629389",
"0.66157573",
"0.6554082",
"0.64667493",
"0.6444726",
"0.6432928",
"0.64077246",
"0.6364412",
"0.6318164",
"0.62566656",
"0.6235323",
"0.62310904",
"0.62210387",
"0.6216122",
"0.618903",
"0.6178472",
"0.6178434",
"0.61773807",
"0.61738753",
"0.6173534",
"0.6166479",
"0.6133175",
"0.6133175",
"0.6128207",
"0.6089059"
] |
0.7839316
|
0
|
affiche le detail du cocktail $cocktail
|
public function view($cocktail) {
$this->set('cocktail', $this->Cocktails->get($cocktail));
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getCocktail($id){\r\n $cocktails = array();\r\n $con = $this->db->getConnection();\r\n foreach(mysqli_query($con, 'SELECT * FROM cocktail_details WHERE idcoccktail_details='.$id)as $key){\r\n $titel = $key['c_name'];\r\n $description = $key['c_description'];\r\n $id = $key['idcoccktail_details'];\r\n $image = $key['c_image'];\r\n $cat = $key['category'];\r\n $ingredients = array();\r\n foreach (mysqli_query($con, 'Select i.ingredient, a.amount from cocktails join ingredients i on fk_ingredient_id=idingredients join amounts a on fk_amounts_id=idamounts where fk_detail_id='.$id.';') as $co) {\r\n $ingredients[] = array($co['ingredient'],$co['amount']);\r\n }\r\n $rating = 0;\r\n $count = 0;\r\n foreach (mysqli_query($con, 'SELECT * FROM rating where fk_cocktail='.$id.';') as $co) {\r\n $rating = $rating + $co['rating'];\r\n $count++;\r\n }\r\n if ($count != 0) {\r\n $rating = round($rating/$count);\r\n }else{\r\n $rating = 0;\r\n }\r\n $getcat = mysqli_fetch_assoc(mysqli_query($con, 'SELECT category_name FROM categories where idcategories='.$cat.';'));\r\n $category = $getcat['category_name'];\r\n $cocktail = new Cocktail($id, $titel, $description, $image, $ingredients, $category, $rating);\r\n }\r\n return $cocktail;\r\n $this->con->closeConnection();\r\n }",
"function car_detail() {\n return \"This car has \" . $this->wheel_count . \" wheels\";\n\n }",
"public function cocktail()\n {\n $cocktail = Exercise::where('category_id', '=', '5')->latest()->paginate(10);\n if (empty($cocktail)) {\n return redirect(route('exercises.index'));\n }\n return view('exercises.cocktail', compact('cocktail'));\n }",
"public function cocktailPreview(Website_Model_Recipe $recipe,$top10Position = null, $selectable = false, $preselected = null) {\r\n\t\t$log = Zend_Registry::get('logger');\r\n\t\t$log->log('cocktailPreview, ID: '.$recipe->id,Zend_Log::DEBUG);\r\n\t\t$format = Zend_Controller_Front::getInstance()->getRequest()->getParam('format');\r\n\t\t// no dojo/js for touch devices\r\n\t\tif($format != 'mobile'){\r\n\t\t\t$this->view->addHelperPath('Zend/Dojo/View/Helper/', 'Zend_Dojo_View_Helper');\r\n\t\t\t$this->view->dojo()->enable()->requireModule('dijit.Tooltip');\r\n\t\t}\r\n\t\t$photos = Website_Model_Photo::photosByRecipeId($recipe->id,1);\r\n\t\tZend_View_Helper_CocktailPreview::$alreadyDisplayed[$recipe->id] = \r\n\t\t\tZend_View_Helper_CocktailPreview::$alreadyDisplayed[$recipe->id] + 1;\r\n\t\t\r\n\t\tif(!Wb_Controller_Plugin_Layout::requestFromTouchDevice()){\r\n\t\t$this->view->headScript()->captureStart(); ?>\r\ndojo.addOnLoad(function() {\r\n\trecipe<?php print $recipe->id.'_'.\r\n\tZend_View_Helper_CocktailPreview::$alreadyDisplayed[$recipe->id];?>Tooltip = new dijit.Tooltip({\r\n\t\tconnectId: [\"recipe<?php print $recipe->id.'_'.\r\n\tZend_View_Helper_CocktailPreview::$alreadyDisplayed[$recipe->id] ;?>\"],\r\n\t\tlabel: \"<div class=\\\"textLeft\\\"><?php\r\n$components = $recipe->getComponents();\r\nif (is_array ( $components )) {\r\n\tforeach ( $components as $component ) {\r\n\t\tprint $component->amount ;\r\n\t\tprint ' ' ;\r\n\t\tprint $component->unit;\r\n\t\tprint ' ' ;\r\n\t\tprint $component->getIngredient()->name ;\r\n\t\tprint '<br />' ;\r\n\t}\r\n}\r\n?></div>\"\r\n\t});\r\n});\r\n<?php\r\n$this->view->headScript()->captureEnd();\r\n\t\t} // end no JS for touch devices\r\n\t\t\r\n$uniqueName = $recipe->getUniqueName();\r\n?>\r\n<div class=\"cocktail<?php if($selectable){ ?> center selectable<?php } ?>\"><?php \r\n\tif(!$selectable){ ?><a\r\n\t\thref=\"<?php \r\n\t\t\tprint $this->view->url(array('module'=>'website','controller'=>'recipe',\r\n\t\t\t'action'=>'get','id'=>$uniqueName),'recipe',true); ?>?format=<?php \r\n\t\t\tprint Zend_Controller_Front::getInstance()->getRequest()->getParam('format'); ?>\"><?php \r\n\t} else { ?><label for=\"recipe_<?php print $recipe->id; ?>\"><?php } ?><img\r\n\tstyle=\"height: 100px;\" alt=\"<?php print $recipe->name; ?>\"\r\n\tsrc=\"<?php print $this->view->baseUrl();\r\n\tif(isset($photos[0]) && $photos[0]->id){\r\n\t\tprint '/img/recipes/'.$this->view->escape($photos[0]->fileName);\r\n\t} else { \r\n\t\tprint '/img/glasses/'.$recipe->getGlass()->getPhoto()->originalFileName;\r\n\t} ?>\" /><?php if(!$selectable){ ?></a><?php }\r\n\tif(!Wb_Controller_Plugin_Layout::requestFromTouchDevice() && !$selectable){ ?><a id=\"recipe<?php print $recipe->id.'_'.\r\n\tZend_View_Helper_CocktailPreview::$alreadyDisplayed[$recipe->id]; ?>\"\r\n\thref=\"<?php print $this->view->url(array('module'=>'website',\r\n\t\t'controller'=>'recipe','action'=>'get','id'=>$uniqueName),'recipe',true); ?>?format=<?php \r\n\tprint Zend_Controller_Front::getInstance()->getRequest()->getParam('format'); ?>\"\r\n\ttitle=\"<?php echo $this->view->escape(str_replace('\\\\','',$recipe->name)) ?>\"><img alt=\"Info\"\r\n\tsrc=\"<?php print $this->view->baseUrl(); ?>/img/info.png\" \r\n\tstyle=\"vertical-align: top;\" height=\"17\" width=\"20\" /></a><?php } ?><br /><?php \r\n\tif(!$selectable){ ?><a\r\n\t\thref=\"<?php print $this->view->url(array('module'=>'website',\r\n\t\t\t'controller'=>'recipe','action'=>'get','id'=>$uniqueName),'recipe',true); ?>?format=<?php \r\n\t\tprint Zend_Controller_Front::getInstance()->getRequest()->getParam('format'); ?>\"><?php \r\n\t} else { \r\n\t}\r\n\tif($top10Position) {\r\n\t\tprint '#'.$top10Position.' - ';\r\n\t}\r\n\techo $this->view->escape(str_replace('\\\\','',$recipe->name));\r\n\tif($recipe->isAlcoholic==0){\r\n\t\t\techo ' (alkoholfrei)';\r\n\t}\r\n\tif($recipe->isOriginal==1){\r\n\t\techo ' (orig.)';\r\n\t}\r\n\tif(isset($mode) && $mode=='top10') {\r\n\t\t//print ' - Bewertung: '.number_format($cocktail->bewertungs_summe/$cocktail->bewertungs_anzahl,2,',',NULL);\r\n\t}\r\n\tif(!$selectable){ \r\n\t\t?></a><?php \r\n\t} else {\r\n\t\tif($format != 'mobile'){ \r\n\t\t?> <span id=\"recipe<?php \r\n\t\tprint $recipe->id.'_'.\r\n\tZend_View_Helper_CocktailPreview::$alreadyDisplayed[$recipe->id]; ?>\"\r\n\thref=\"<?php print $this->view->url(array('module'=>'website',\r\n\t\t'controller'=>'recipe','action'=>'get','id'=>$uniqueName),'recipe',true); ?>?format=<?php \r\n\tprint Zend_Controller_Front::getInstance()->getRequest()->getParam('format'); ?>\"\r\n\ttitle=\"<?php echo $this->view->escape(str_replace('\\\\','',$recipe->name)) ?>\" class=\"pointer\"><img alt=\"Info\"\r\n\t\tsrc=\"<?php print $this->view->baseUrl(); ?>/img/info.png\" \r\n\t\tstyle=\"vertical-align: top;\" height=\"17\" width=\"20\" /></span><?php \r\n\t\t}\r\n\t\t?></label><br />\r\n\t\t<input type=\"checkbox\" name=\"recipe2menu[]\" value=\"<?php print $recipe->id; ?>\" \r\n\t\t<?php if($preselected[$recipe->id]) { print ' checked=\"checked\"'; } ?> id=\"recipe_<?php print $recipe->id; ?>\" /><?php \r\n\t} ?></div><?php \r\n\t$log->log('cocktailPreview, exiting',Zend_Log::DEBUG);\r\n}",
"public function getItemBreakdown() {\n echo 'Cone type: '.$this->coneType['name'].'- $'.number_format($this->coneType['price'], 2).\"\\n\";\n echo \"Flavors used:\\n\";\n foreach ($this->scoops as $scoop) {\n echo ' '.$scoop['name'].' - $'.number_format($scoop['price'], 2).\"\\n\";\n }\n echo \"\\n\\n\";\n }",
"function MainBodyContent()\n\t{\n\t\t$this->VarDump($this->cat->details);\n\t}",
"function displayBoilerDetails(){\n $mS = Steam_MeasurementSystem::getInstance();\n $translator = Zend_Registry::get('Zend_Translate');\n $details = \"<table class='data'>\n <tr><th>\".$translator->_('Blowdown Rate').\"</th><td>\".number_format(100*$this->blowdownRate,1).\" \".$mS->label('%').\"</td></tr>\n <tr><th>\".$translator->_('Boiler Energy').\"</th><td>\".$mS->displayEnergyflowLabeled($this->boilerEnergy).\"</td></tr>\n <tr><th>\".$translator->_('Combustion Efficiency').\"</th><td>\".number_format(100*$this->boilerEff,1).\" \".$mS->label('%').\"</td></tr>\n <tr><th>\".$translator->_('Fuel Energy').\"</th><td>\".$mS->displayEnergyflowLabeled($this->fuelEnergy).\"</td></tr>\n </table>\";\n return $details;\n }",
"public function setCreditInfo() {\n\t\t$this->creditInfo = $this->photo['title'] . \" by \" . $this->userName;\n\t}",
"Public function displayInfo(){ \r\n\t\t\techo \"The info about the dress.\"; \r\n\t\t\techo $this->color; \r\n\t\t\techo $this->fabric ; \r\n\t\t\techo $this->design;\r\n\t\t\techo self::MEDIUM;\r\n\t\t}",
"public function desc_view($observer)\r\n\t{\r\n\t\t$company_id=Mage::helper('insync_company')\r\n\t\t->getCustomerCompany(Mage::getSingleton('customer/session')->getCustomer()->getId());\r\n\t\tif($company_id){\r\n\t\t\t$event = $observer->getEvent();\r\n\t\t\t$product = $event->getProduct();\r\n\r\n\t\t\t$website_id=Mage::getModel('core/store')->load($product->getData('store_id'))->getWebsiteId();\r\n\t\t\t$product_id=$product->getEntityId();\r\n\t\t\t$qty=\"1\";\r\n\r\n\r\n\t\t\t// process percentage discounts only for simple products\r\n\t\t\tif ($product->getSuperProduct() && $product->getSuperProduct()->isConfigurable()) {\r\n\t\t\t} else {\r\n\r\n\t\t\t\tif(!empty($website_id) && !empty($company_id) && !empty($product_id) ){\r\n\t\t\t\t\t$new_price=\"\";\r\n\t\t\t\t\t// Product specific price\r\n\t\t\t\t\t$prod_price = Mage::helper('insync_companyrule')->getNewPrice($website_id,$company_id,$product_id,$qty);\r\n\t\t\t\t\t// Category specific price\r\n\t\t\t\t\t$cat_price=Mage::helper('insync_companyrule')->getCategoryPrice($product_id,$product->getFinalPrice(),$company_id,$website_id);\r\n\t\t\t\t\t// Get applicable price\r\n\t\t\t\t\t$new_price=Mage::helper('insync_companyrule')->getMinPrice($prod_price,$cat_price,$product->getFinalPrice());\r\n\r\n\t\t\t\t\tif($new_price!=''){\r\n\t\t\t\t\t\t// compare prices\r\n\t\t\t\t\t\t$product->setFinalPrice($new_price);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn $this;\r\n\t}",
"public function cocktails()\n {\n return $this->belongsToMany('App\\Cocktail', 'cki', 'cki_id_ingredient', 'cki_id_cocktail');\n }",
"function displayCO($con_id,$dat_id,$skin,$count=0)\r\n\t{\r\n\t\tglobal $myPT;\r\n\t\t$myPT->displayCO($con_id,$dat_id,$skin,$count);\r\n\t}",
"public function show(Cargos $cargos)\n {\n //\n }",
"public function show(IngredientCocktail $ingredientCocktail)\n {\n $this->authorize('admin.ingredient-cocktail.show', $ingredientCocktail);\n\n // TODO your code goes here\n }",
"function printCompanyInfo() {\n if(!$this->valid):\n return;\n endif;\n \n echo \"Name: \".$this->name.\"<br>\";\n echo \"Brief: \".$this->brief.\"<br>\";\n echo \"Description: \".$this->description.\"<br>\";\n echo \"Date-founded: \".$this->date_founded.\"<br>\";\n echo \"Headquarter: \".$this->headquarter.\"<br>\";\n echo \"Website: \".$this->website.\"<br>\";\n echo \"Games: \".$this->games.\"<br>\";\n echo \"Images: \".\"<img src=$this->imageURL></img><br>\";\n echo \"Num-likes: \".$this->num_likes.\"<br>\";\n }",
"static function car_detail() {\n echo Cars::$wheel_count;\n echo \"<br>\";\n echo Cars::$door_count;\n echo \"<br>6\";\n }",
"public function getBrief() {\n\t\t$baseUrl = \"http://\" . $_SERVER['SERVER_NAME'] . Director::BaseURL();\n\t\t$themeDir = $baseUrl . 'themes/' . SSViewer::current_theme();\n\t\t$html = '<div class=\"brief\">\n\t\t\t\t\t<div class=\"cell\" >'.$this->statusButton().'</div>\n\t\t\t\t\t<div class=\"cell weather\"><img src=\"'.$themeDir.'/images/weather_report/'.$this->getWeatherBrief().'.png\" alt=\"weather-icon\" /></div>\n\t\t\t\t\t<div class=\"cell temp\">'.$this->getWeatherTempurature().'°</div>\n\t\t\t\t\t<div class=\"cell snowfall\">\n\t\t\t\t\t\tLast Snowfall<br />\n\t\t\t\t\t\t<span class=\"amount\">'.$this->getLatestFall().'cm</span><br />\n\t\t\t\t\t\t\ton '.$this->getLatestFallDate().'\n\t\t\t\t\t</div>\n\t\t\t\t</div>';\n\t\treturn $html;\n\t}",
"public function show(Cateogire $cateogire)\n {\n //\n }",
"public function printcreditmemoAction()\n {\n// $this->_title(\"Invoice No.\" . $order_id);\n// $this->loadLayout();\n// $this->renderLayout();\n\n $creditmemo = $this->_initCreditmemo();\n if ($creditmemo) {\n if ($creditmemo->getInvoice()) {\n $this->_title($this->__(\"View Memo for #%s\", $creditmemo->getInvoice()->getIncrementId()));\n } else {\n $this->_title($this->__(\"View Memo\"));\n }\n\n $this->loadLayout();\n $this->renderLayout();\n } else {\n echo 'Error when processing!!!!';\n }\n }",
"function showCouponStyleContentThumbnail($detailsURL, $previewBase, $imageBase, $thumbnailInfo) {\n\t$image = $thumbnailInfo->filename;\n\t$thumbnailURL = $previewBase ? \"$previewBase/$image\" : $image;\n\t$imageURL = $imageBase ? \"$imageBase/$image\" : $image;\n\t$customer = $thumbnailInfo->name;\n\t$store = getPropertyValue($thumbnailInfo, 'store');\n\t$fullAddress = array(\n\t\tgetPropertyValue($thumbnailInfo, 'address'), \n\t\tgetPropertyValue($thumbnailInfo, 'city'), \n\t\tgetPropertyValue($thumbnailInfo, 'state'), \n\t\tgetPropertyValue($thumbnailInfo, 'zip')\n\t);\n\t$address = join(' ', $fullAddress);\n?>\n\t<div id=\"container76\" class=\"coupcontainer reset-15 col-xs-12 col-md-6 col-lg-4\">\n\t\t<div class=\"cp_img\">\n\t\t\t<a href=\"<?=$detailsURL?>\" title=\"<?=$customer?>\" class=\"screenshot\" rel=\"<?=$thumbnailURL?>\">\n\t\t\t\t<img src=\"<?=$imageURL?>\" alt=\"<?=$customer?>\" class=\"img-responsive\" style=\"width:100%;\"> \n\t\t\t</a>\n </div>\n <div class=\"couppicr panel panel-default\">\n\t\t\t<div class=\"coupcontl panel-body\">\n\t\t\t\t<div class=\"cp_info\">\n\t\t\t\t\t<div class=\"couptit ellipsis\">\n\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t<a href=\"<?=$detailsURL?>\" title=\"<?=$customer?> - <?=$store?>\">\n\t\t\t\t\t\t\t\t<?=$customer?>\n\t\t\t\t\t\t\t</a>\n </span>\n </div>\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<small class=\"coupaddress\">\n\t\t\t\t\t\t\t<?=$address?>\n\t\t\t\t\t\t</small>\n </div>\n </div>\n </div>\n </div>\n </div>\n<?php\n}",
"public function recap(){\n\t\techo \"----- INFO\" . $this->getNom() . \" ----- <br>\";\n\t\techo $this->getNom() . \" a \" . $this->getVie() . ' points de vie <br>';\n\t}",
"public function getAllCocktails($cat,$from): array{\r\n $cocktails = array();\r\n $con = $this->db->getConnection();\r\n $query = '';\r\n if ($cat!= 0) {\r\n $query = 'SELECT * FROM cocktail_details WHERE category='.$cat.' LIMIT '.$from.', 15';\r\n }else{\r\n $query = 'SELECT * FROM cocktail_details LIMIT '.$from.', 15';\r\n }\r\n foreach(mysqli_query($con, $query)as $key){\r\n $titel = $key['c_name'];\r\n $description = $key['c_description'];\r\n $id = $key['idcoccktail_details'];\r\n $image = $key['c_image'];\r\n $cat = $key['category'];\r\n $ingredients = array();\r\n foreach (mysqli_query($con, 'Select i.ingredient, a.amount from cocktails join ingredients i on fk_ingredient_id=idingredients join amounts a on fk_amounts_id=idamounts where fk_detail_id='.$id.';') as $co) {\r\n $ingredients[] = array($co['ingredient'],$co['amount']);\r\n }\r\n $rating = 0;\r\n $count = 0;\r\n foreach (mysqli_query($con, 'SELECT * FROM rating where fk_cocktail='.$id.';') as $co) {\r\n $rating = $rating + $co['rating'];\r\n $count++;\r\n }\r\n if ($count != 0) {\r\n $rating = round($rating/$count);\r\n }else{\r\n $rating = 0;\r\n }\r\n $getcat = mysqli_fetch_assoc(mysqli_query($con, 'SELECT category_name FROM categories where idcategories='.$cat.';'));\r\n $category = $getcat['category_name'];\r\n $cocktails[] = new Cocktail($id, $titel, $description, $image, $ingredients, $category, $rating);\r\n }\r\n return $cocktails;\r\n $this->con->closeConnection();\r\n }",
"public function mostrarInfo()\n {\n // $datos.= \"Cuatrimestre\".$this->cuatrimestre;\n // return parent::mostrarInfo().\" \".$datos;\n }",
"function car_detail() {\n echo $this->wheel_count;\n echo \"<br>\";\n echo $this->door_count;\n echo \"<br>\";\n echo $this->seat_count;\n }",
"function info() {\n\t \treturn $this->description;\n\t }",
"function honeycomb_credit() {\n\t\t?>\n\t\t<div class=\"site-info\">\n\t\t\t<?php echo esc_html( apply_filters( 'honeycomb_copyright_text', $content = '© ' . get_bloginfo( 'name' ) . ' ' . date( 'Y' ) ) ); ?>\n\t\t\t<?php if ( apply_filters( 'honeycomb_credit_link', true ) ) { ?>\n\t\t\t<br /> <?php echo __(sprintf( esc_attr__( '%1$s powered by %2$s.', 'honeycomb' ), 'Honeycomb', '<a href=\"https://wp-property-hive.com\" title=\"Property Hive - The Leading WordPress Platform For Estate Agency Websites\" rel=\"author\">Property Hive</a>' ), 'propertyhive'); ?>\n\t\t\t<?php } ?>\n\t\t</div><!-- .site-info -->\n\t\t<?php\n\t}",
"public function show(){\n $data=$this->cart->contents();\n echo \"<pre>\";\n print_r($data);\n echo \"</pre>\";\n\t}",
"public function getCreditComment();",
"public function hookDisplayBackOfficeTop()\n {\n $objectifCoach = array();\n $this->context->controller->addCSS($this->_path . 'views/css/compteur.css', 'all');\n $this->context->controller->addJS($this->_path . 'views/js/compteur.js');\n $objectifCoach[] = CaTools::getObjectifCoach($this->context->employee->id);\n $objectif = CaTools::isProjectifAtteint($objectifCoach);\n $objectif[0]['appels'] = (isset($_COOKIE['appelKeyyo'])) ? (int)$_COOKIE['appelKeyyo'] : '0';\n\n $this->smarty->assign(array(\n 'objectif' => $objectif[0]\n ));\n return $this->display(__FILE__, 'compteur.tpl');\n }",
"public function mostrarInfo(Coche $miObjeto){\n if(is_object($miObjeto)){\n $informacion = \"<h1>Informacion del coche</h1>\";\n $informacion .= \"<br/> Modelo: \".$miObjeto->modelo;\n $informacion .= \"<br/> Color: \".$miObjeto->color;\n $informacion .= \"<br/> Marca: \".$miObjeto->marca;\n $informacion .= \"<br/> Caballos: \".$miObjeto->caballos;\n $informacion .= \"<br/> Velocidad: \".$miObjeto->velocidad;\n $informacion .= \"<br/> Plazas: \".$miObjeto->plazas; \n }else{\n $informacion = \"Tu dato es este: \n $miObjeto\";\n }\n\n\n return $informacion;\n }"
] |
[
"0.6276121",
"0.60229695",
"0.5954305",
"0.5857318",
"0.56042",
"0.55494034",
"0.54885584",
"0.54659456",
"0.5464022",
"0.54589",
"0.5447622",
"0.53956836",
"0.53699887",
"0.53479254",
"0.53452706",
"0.5290255",
"0.5284558",
"0.5278124",
"0.52720845",
"0.5268075",
"0.5256777",
"0.52498263",
"0.52351177",
"0.51879376",
"0.51548856",
"0.5150907",
"0.51456064",
"0.514071",
"0.51314306",
"0.51259977"
] |
0.7225833
|
0
|
Filter Events on type and action.
|
protected static function filterEvents(array $events, $type, $action) {
return array_filter($events, function($m) use ($type, $action) {
return $m->type === $type && $m->action === $action;
});
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function withAction($type)\n {\n return $this->filter(function($visit) use($type) {\n return $visit->hasAction($type);\n });\n }",
"protected function _run_filters($type)\n {\n $filters = array_merge_recursive((new ApplicationController())->_filters(), $this->_filters());\n \n if (isset($filters[$type])) {\n /**\n * Here we have to filter duped methods. We can't use array_unique\n * because the the methods could be like ['method_name', 'only' => [ actions ... ]]\n * and that will generate \"Array to string conversion\" error.\n */\n $ran_methods = [];\n foreach ($filters[$type] as $params) {\n if (($method = $this->_can_run_filter_method($params, $type)) && !in_array($method, $ran_methods)) {\n $this->$method();\n $ran_methods[] = $method;\n }\n }\n }\n }",
"function getSupportedFilters() {\n return array('event' => array(\n 'event_type_id' => array(\n 'form_field_name' => 'event_type_id',\n 'operator' => 'IN',\n ))\n );\n }",
"public function getEvents(array $filters = array());",
"protected static function getEventData(array $events, $type, $action) {\n $events = static::filterEvents($events, $type, $action);\n $data = [];\n foreach ($events as $event) {\n $data[] = [\n 'event' => $event->event,\n 'selector' => $event->selector,\n ];\n }\n return $data;\n }",
"public function filter($event, $subject = null, $params = array());",
"private function getEvents($type)\r\n {\r\n if ($type == Stat::TYPE_INQUIRY) {\r\n $inqs = $this->container->get('jcs.ds')->getGroup('inquiry');\r\n return !empty($inqs) ? $inqs : [];\r\n }\r\n elseif ($type == Stat::TYPE_FAMILY_HELP) {\r\n $events = $this->container->getParameter('stat_events');\r\n\r\n return isset($events[$type]) ? $events[$type] : [];\r\n }\r\n }",
"function getFilterType(){\n\t$data = M('event');\n\t$type_set = Array();\n\t$result = $data->group('type')->order('type asc')->select();\n\tforeach($result as $value)\n\t\tarray_push($type_set, $value['type']);\n\n\treturn $type_set;\n}",
"private function filterEvents( $filter_string , $events ){\n\t\t$filters = explode(',' , $filter_string );\n\n\t\t$events_filtered = array();\n\t\tforeach ($events as $event) {\n\t\t\tif(isset($event['original']))\n\t\t\t\t$event_text = $event['original'];\n\t\t\telse\n\t\t\t\t$event_text = $event['summary'];\n\t\t\t$fits = FALSE;\n\t\t\tforeach( $filters as $filter ){\n\t\t\t\t$filter_without_semicolons = str_replace([' :',':'], '', $filter );\n\n\t\t\t\tif(stristr($event_text,$filter) || stristr(str_replace(' :',':',$event_text), $filter) || strtolower(substr(trim($event_text), 0, strlen($filter_without_semicolons))) === strtolower($filter_without_semicolons) ){\n\t\t\t\t\t// stripping the category from the title\n\t\t\t\t\t$prefixes = [ $filter , str_replace(':',' :',$filter) ];\n\t\t\t\t\tforeach($prefixes as $prefix){\n\t\t\t\t\t\tif (substr(strtolower($event_text), 0, strlen($prefix)) == strtolower($prefix)) {\n \t\t\t\t\t\t// $event_text = substr($event_text, strlen($prefix));\n \t\t\t\t\t\t// $event['category'] = str_replace(':','',strtolower($prefix));\n \t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// echo 'fits filter '.$filter.'<br>';\n\t\t\t\t\t// $event['summary'] = $event_text;\n\t\t\t\t\t$fits = TRUE;\n\t\t\t\t\t$analyse_summary = Event::filterType($event_text);\n\t\t\t\t\t$event['original'] = $event_text;\n\t\t\t\t\t$event['summary'] = $analyse_summary['summary'];\n\t\t\t\t\t$event['city'] = isset($analyse_summary['city'])?$analyse_summary['city']:'';\n\t\t\t\t\t$event['category'] = isset($analyse_summary['type'])?$analyse_summary['type']:'';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Adding some info to help\n\t\t\tif(!isset($event['start']['dateTime']) && isset($event['start']['date'])){\n\t\t\t\t$event['start']['dateTime'] = $event['start']['date'];\n\t\t\t}\n\t\t\t$datetime = new \\Datetime($event['start']['dateTime']);\n\t\t\t$event['start']['weekday'] = $datetime->format('N');\n\n\t\t\t// Adding the picture\n\t\t\t// $creator_email = isset($event['creator']['email'])?$event['creator']['email']:null;\n\t\t\t$organizer_id = isset($event['extendedProperties']['shared']['organizer_id'])?$event['extendedProperties']['shared']['organizer_id']:null;\n\t\t\t\n\t\t\tif(!is_null($organizer_id) && !isset($event['school'])){\n\t\t\t\t\n\t\t\t\t$school = School::findOne($organizer_id);\n\n\t\t\t\tif($school){\n\t\t\t\t\t$event['email'] = $school->email;\n\t\t\t\t\t$event['school'] = array();\n\t\t\t\t\t$event['school']['picture'] = $school->getPictureUrl();\n\t\t\t\t\t$event['school']['thumb'] = $school->getThumbUrl();\n\t\t\t\t\t$event['school']['name'] = $school->name;\n\t\t\t\t\tif(isset($school->website))\n\t\t\t\t\t\t$event['school']['url'] = $school->website;\n\t\t\t\t\telse if(isset($school->facebook))\n\t\t\t\t\t\t$event['school']['url'] = $school->facebook;\n\t\t\t\t\tif($school->email){\n\t\t\t\t\t\t$event['email'] = $school->email;\n\t\t\t\t\t}\n\t\t\t\t\tif($school->active == false){\n\t\t\t\t\t\t$fits = FALSE;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(isset($event['extendedProperties']['shared']['disabled']) && $event['extendedProperties']['shared']['disabled'] == 1){\n\t\t\t\t$fits = FALSE;\n\t\t\t}\n\t\t\tif( $fits == TRUE ){\n\t\t\t\t$events_filtered[$event['id']] = $event;\n\t\t\t}\n\n\t\t}\n\t\treturn $events_filtered;\n\t}",
"public function _fetch_incidents_set_params()\n\t{\n\t\t$params = Event::$data;\n\n\t\t// ---------- BEGIN HACKY IMPLEMENTATION (used on homepage map)\n\t\tif(!isset($_GET['plugin_actionable_filter']) OR !is_array($_GET['plugin_actionable_filter'])) {\n\t\t\t// If we're doing the hacky fake media trick, run this.\n\t\t\t// Look for fake media type\n\t\t\tif ($filters = $this->_check_media_type())\n\t\t\t{\n\t\t\t\t// Remove media type filter based on fake actionable media type\n\t\t\t\t// @todo make this work with normal media filters too\n\t\t\t\t$sql = 'i.id IN (SELECT DISTINCT incident_id FROM '.Kohana::config('database.default.table_prefix').'media WHERE media_type IN ('.implode(',',$this->_check_media_type()).'))';\n\t\t\t\t$key = array_search($sql, $params);\n\n\t\t\t\tif ($key !== FALSE)\n\t\t\t\t{\n\t\t\t\t\tunset($params[$key]);\n\t\t\t\t}\n\n\t\t\t\t$actionable_sql = array();\n\t\t\t\tforeach ($filters as $filter)\n\t\t\t\t{\n\t\t\t\t\t// Cast the $filter to int just in case\n\t\t\t\t\t$filter = intval($filter);\n\n\t\t\t\t\t// Add filter based on actionable status.\n\t\t\t\t\tswitch ($filter)\n\t\t\t\t\t{\n\t\t\t\t\t\tcase '102':\n\t\t\t\t\t\t\t$actionable_sql[] = 'i.id IN (SELECT DISTINCT incident_id FROM '.Kohana::config('database.default.table_prefix').'actionable\n\t\t\t\t\t\t\t\tWHERE actionable = 1 AND action_taken = 0)';\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase '103':\n\t\t\t\t\t\t\t$actionable_sql[] = 'i.id IN (SELECT DISTINCT incident_id FROM '.Kohana::config('database.default.table_prefix').'actionable\n\t\t\t\t\t\t\t\tWHERE actionable = 2 AND action_taken = 0)';\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase '104':\n\t\t\t\t\t\t\t$actionable_sql[] = 'i.id IN (SELECT DISTINCT incident_id FROM '.Kohana::config('database.default.table_prefix').'actionable\n\t\t\t\t\t\t\t\tWHERE actionable = 1 AND action_taken = 1)';\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (count($actionable_sql) > 0)\n\t\t\t\t{\n\t\t\t\t\t$actionable_sql = '('.implode(' OR ',$actionable_sql).')';\n\t\t\t\t\t$params[] = $actionable_sql;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tEvent::$data = $params;\n\t\t\treturn;\n\t\t}\n\t\t// ---------- END HACKY IMPLEMENTATION (used on homepage map)\n\n\t\t// This is the Non-hacky way of filtering reports\n\n\t\t$actionable_ids = $_GET['plugin_actionable_filter'];\n\t\t$actionable_sql = array();\n\t\tforeach($actionable_ids AS $id) {\n\t\t\t$actionable_sql[] = 'i.id IN (SELECT DISTINCT incident_id FROM '.Kohana::config('database.default.table_prefix').'actionable\n\t\t\t\t\t\tWHERE actionable = '.intval($id).' AND action_taken = 0)';\n\t\t}\n\n\t\tif (count($actionable_sql) > 0)\n\t\t{\n\t\t\t$actionable_sql = '('.implode(' OR ',$actionable_sql).')';\n\t\t\t$params[] = $actionable_sql;\n\t\t}\n\n\t\tEvent::$data = $params;\n\t}",
"function after_filter($action, $args) {\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 call_filters($type)\n\t{\n\t\t$loaded_route = $this->router->get_active_route();\n\t\t$filter_list = Route::get_filters($loaded_route, $type);\n\n\t\tforeach ($filter_list as $filter_data)\n\t\t{\n\t\t\t$param_list = $this->__filter_params;\n\n\t\t\t$callback = $filter_data['filter'];\n\t\t\t$params = $filter_data['parameters'];\n\n\t\t\t// check if callback has parameters\n\t\t\tif ( ! is_null($params))\n\t\t\t{\n\t\t\t\t// separate the multiple parameters in case there are defined\n\t\t\t\t$params = explode(':', $params);\n\n\t\t\t\t// search for uris defined as parameters, they will be marked as {(.*)}\n\t\t\t\tforeach ($params as &$p)\n\t\t\t\t{\n\t\t\t\t\tif (preg_match('/\\{(.*)\\}/', $p, $match_p))\n\t\t\t\t\t{\n\t\t\t\t\t\t$p = $this->uri->segment($match_p[1]);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t$param_list = array_merge($param_list, $params);\n\t\t\t}\n\n\t\t\tif (class_exists('Closure') and method_exists('Closure', 'bind'))\n\t\t\t{\n\t\t\t\t$callback = Closure::bind($callback, $this);\n\t\t\t}\n\n\t\t\tcall_user_func_array($callback, $param_list);\n\t\t}\n\n\t\tlog_message('debug', \"\\\"{$type}\\\" Filter Called\");\n\t}",
"public function beforeFilter(Event $event) \n {\n }",
"public function filterTest($event) {\n\t\t$event->data['request']->params['eventName'] = $event->name();\n\t}",
"public function beforeFilter(Event $event)\n {\n }",
"private function filters() {\n\n\n\t}",
"public function filters()\n {\n $filters = array(\n 'postOnly + delete',\n );\n\n return CMap::mergeArray($filters, parent::filters());\n }",
"public function filters()\n {\n $filters = array(\n 'postOnly + delete',\n );\n\n return CMap::mergeArray($filters, parent::filters());\n }",
"abstract public function filters();",
"protected function handleGetFiltered() {\n\t\t\tif ($this->verifyRequest('GET') && $this->verifyParams()) {\n\t\t\t\textract($this->getResultParams());\n\t\t\t\t\n\t\t\t\t$strFilterBy = $this->objUrl->getFilter('by');\n\t\t\t\t$mxdFilter = str_replace('.' . $this->strFormat, '', $this->objUrl->getSegment(3));\n\t\t\t\t\n\t\t\t\tif ($strFilterBy == 'username') {\n\t\t\t\t\tAppLoader::includeUtility('DataHelper');\n\t\t\t\t\t$mxdFilter = DataHelper::getUserIdByUsername($mxdFilter);\n\t\t\t\t\t$strFilterBy = 'userid';\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif ($strFilterBy == 'userid') {\n\t\t\t\t\t$blnCached = $this->loadFromCache($strNamespace = sprintf(AppConfig::get('UserEventNamespace'), $mxdFilter));\n\t\t\t\t} else {\n\t\t\t\t\t$blnCached = $this->loadFromCache();\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (empty($blnCached)) {\n\t\t\t\t\t$objUserEvent = $this->initModel();\n\t\t\t\t\tswitch ($strFilterBy) {\n\t\t\t\t\t\tcase 'userid':\n\t\t\t\t\t\t\t$blnResult = $objUserEvent->loadByUserId($mxdFilter, $arrFilters, false);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif ($blnResult) {\n\t\t\t\t\t\t$this->blnSuccess = true;\n\t\t\t\t\t\tif ($objUserEvent->count()) {\n\t\t\t\t\t\t\t$this->arrResult = array(\n\t\t\t\t\t\t\t\t'events' => $this->formatEvents($objUserEvent),\n\t\t\t\t\t\t\t\t'total' => $objUserEvent->count()\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$this->arrResult = array(\n\t\t\t\t\t\t\t\t'events' => array(),\n\t\t\t\t\t\t\t\t'total' => 0\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\tif (isset($blnCached)) { \n\t\t\t\t\t\t\tif (isset($strNamespace)) {\n\t\t\t\t\t\t\t\t$this->saveToCache($this->intCacheExpire, $strNamespace);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t$this->saveToCache($this->intCacheExpire);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttrigger_error(AppLanguage::translate('There was an error loading the event data'));\n\t\t\t\t\t\t$this->error();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$this->error(400);\n\t\t\t}\n\t\t}",
"public function loadMultipleByEvent($event, $type = 'outgoing');",
"public function getSplitEventType(): array\n {\n return $this->getSplitFilters($this->event_type_filter);\n }",
"public function createFilter();",
"function _culturefeed_search_ui_format_types_filter($types) {\n switch($types) {\n case 'event':\n return 'type:event';\n break;\n case 'actor':\n return 'type:actor';\n break;\n case 'event_actor':\n return 'type:event OR type:actor';\n break;\n case 'event_production_actor':\n return 'type:event OR type:production OT type:actor';\n break;\n default:\n // Return filter that was previously hardcoded.\n return 'type:event OR type:production';\n break;\n }\n}",
"public function filter($name, $action, $priority = 10, $accepted_args = 1);",
"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 }",
"public function _fetch_incidents_set_params()\n\t{\n\t\t$params = Event::$data;\n\t\t\n\t\t// Look for fake media type\n\t\tif ($filters = $this->_check_media_type())\n\t\t{\n\t\t\t\n\t\t\t$actionable_sql = array();\n\t\t\tforeach ($filters as $filter)\n\t\t\t{\n\t\t\t\t// Cast the $filter to int just in case\n\t\t\t\t$filter = intval($filter);\n\t\t\t\t\n\t\t\t\t// Add filter based on actionable status.\n\t\t\t\tswitch ($filter)\n\t\t\t\t{\n\t\t\t\t\tcase '101':\n\t\t\t\t\t\t$actionable_sql[] = 'i.id IN (SELECT DISTINCT incident_id FROM '.Kohana::config('database.default.table_prefix').'actionable\n\t\t\t\t\t\t\tWHERE (actionable = 1 OR actionable = 2 OR actionable = 0) AND (action_taken = 0 OR action_taken = 1))';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase '102':\n\t\t\t\t\t\t$actionable_sql[] = 'i.id IN (SELECT DISTINCT incident_id FROM '.Kohana::config('database.default.table_prefix').'actionable\n\t\t\t\t\t\t\tWHERE (actionable = 1 OR actionable =2) AND action_taken = 0)';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase '103':\n\t\t\t\t\t\t$actionable_sql[] = 'i.id IN (SELECT DISTINCT incident_id FROM '.Kohana::config('database.default.table_prefix').'actionable\n\t\t\t\t\t\t\tWHERE actionable = 2 AND action_taken = 0)';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase '104':\n\t\t\t\t\t\t$actionable_sql[] = 'i.id IN (SELECT DISTINCT incident_id FROM '.Kohana::config('database.default.table_prefix').'actionable\n\t\t\t\t\t\t\tWHERE action_taken = 1)';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase '105':\n\t\t\t\t\t\t$actionable_sql[] = 'i.id IN (SELECT DISTINCT incident_id FROM '.Kohana::config('database.default.table_prefix').'actionable\n\t\t\t\t\t\t\tWHERE action_taken = 2)';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase '106':\n\t\t\t\t\t\t$actionable_sql[] = 'i.id IN (SELECT DISTINCT incident_id FROM '.Kohana::config('database.default.table_prefix').'actionable\n\t\t\t\t\t\t\tWHERE actionable = 0)';\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (count($actionable_sql) > 0)\n\t\t\t{\n\t\t\t\t$actionable_sql = '('.implode(' OR ',$actionable_sql).')';\n\t\t\t\t$params[] = $actionable_sql;\n\t\t\t}\n\t\t}\n\n\t\tEvent::$data = $params;\n/*\n\t\techo \"<LEIF>\";\n\t\tvar_dump(Event::$data);\n\t\techo \"</LEIF>\";\n*/\n\t}",
"public function _add_incident_filters()\n\t{\n\t\t$params = Event::$data;\n\t\t$params = array_merge($params, $this->params);\n\t\tEvent::$data = $params;\n\t}",
"function obj_do_cx_events_list_filter( $events ) {\n\t$months = evt_helper_get_year_months( $events );\n $types = evt_helper_get_event_types( $events );\n $search_term = evt_helper_get_search_term();\n $reset_display = 'none';\n if ('' !== $search_term ) {\n $reset_display = 'block';\n }\n\t?>\n\t<div class=\"event-list-filter__wrap\">\n <!-- <div class=\"event-search-form-wrap\">\n <form method=\"get\" action=\"/events/\">\n <div class=\"event-search-form-inner\">\n <input type=\"search\" value=\"<?php echo $search_term; ?>\" name=\"evtq\" placeholder=\"Search\" class=\"input-search\" />\n <button class=\"btn-search\">\n <i class=\"fa fa-search\" aria-hidden=\"true\"></i>\n </button>\n </div>\n </form>\n </div> -->\n <div class=\"select-wrap\">\n\t\t\t<select name=\"event-list__month\" id=\"event-list__month\">\n\t\t\t\t<option value=\"all\">When</option>\n\t\t\t\t<?php foreach ( $months as $abbr => $month ) : ?>\n\t\t\t\t\t<option value=\"<?php echo $abbr; ?>\"><?php echo $month; ?></option>\n\t\t\t\t<?php endforeach; ?>\n\t\t\t</select>\n\t\t</div>\n\t\t<div class=\"select-wrap\">\n\t\t\t<select name=\"event-list__type\" id=\"event-list__type\">\n\t\t\t\t<option value=\"all\">Type</option>\n\t\t\t\t<?php foreach ( $types as $abbr => $type ) : ?>\n\t\t\t\t\t<option value=\"<?php echo $abbr; ?>\"><?php echo $type; ?></option>\n\t\t\t\t<?php endforeach; ?>\n\t\t\t</select>\n\t\t</div>\n\t\t<div class=\"filter-reset\" style=\"display:<?php echo $reset_display; ?>\">Reset</div>\n </div>\n <span style=\"display: none;\" class=\"no-events-shown-message grande-text\">No results seem to match your search. Adjust the filters to see what other events may be relevant for you.</span>\n\t<?php\n}"
] |
[
"0.6470973",
"0.60970163",
"0.6093109",
"0.6033326",
"0.59747356",
"0.5947887",
"0.5860879",
"0.57912797",
"0.5768657",
"0.57123065",
"0.5705815",
"0.5677767",
"0.5553431",
"0.55365056",
"0.5460435",
"0.5432366",
"0.5429818",
"0.54180694",
"0.54180694",
"0.5417235",
"0.5412817",
"0.54104924",
"0.539076",
"0.5378171",
"0.5369039",
"0.5366473",
"0.53635997",
"0.5359808",
"0.53551173",
"0.53306264"
] |
0.765489
|
0
|
[WIP] Choose the current chain. This function searches the active chain for a ApplicationIdentity. [TODO] We look if previous chains are completed by the identity and if the chain requirements are met.
|
public static function getActiveChain(array $chains, ApplicationIdentity $identity) {
foreach ($chains as $chain) {
if ($chain->isFinished($identity->id)) { // Check if this chain is finished.
continue;
}
$previous_unfinished_chain = array_filter($chain->previousChains, function($chain) use ($identity){
return !$chain->isFinished($identity->id);
});
if (empty($previous_unfinished_chain)) {
return $chain;
}
}
return null;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function triggerChain(/* ... */)\n {\n if ($this->haltSequence()) {\n return false;\n }\n\n if (null !== $this->_parent) {\n\n // Ensure we are in an active state\n if (self::STATE_ACTIVE !== $this->getState()) {\n $this->setState(self::STATE_ACTIVE);\n }\n $this->_parent->trigger();\n return $this->_parent->getResults();\n }\n }",
"private function getActiveOpenEnrollment() {\n\n $openEnrollment = $this->getDoctrine()->getRepository( 'IIABMagnetBundle:OpenEnrollment' )->findOneBy( array(\n 'active' => '1' ,\n ) );\n\n if( $openEnrollment == null ) {\n return $this->redirect( $this->generateUrl( 'iiab_magnet_program_processing_view_all' ) );\n } else {\n return $openEnrollment;\n }\n }",
"public static function brokerCurrent()\n {\n $objCache = Base_Cache::getHandler();\n $thisClassName = get_called_class();\n $createIfNotExist = false;\n if (isset($objCache->arrCache[$thisClassName]['current'])\n && $objCache->arrCache[$thisClassName]['current'] != null\n && $objCache->arrCache[$thisClassName]['current'] != false\n ) {\n return $objCache->arrCache[$thisClassName]['current'];\n }\n $objRequest = Container_Request::getRequest();\n $arrSession = $objRequest->get_arrSession();\n if (isset($arrSession['intUserAuthID'])) {\n try {\n $objDatabase = Container_Database::getConnection();\n $sql = \"SELECT * FROM userauth WHERE intUserAuthID = ? LIMIT 1\";\n $query = $objDatabase->prepare($sql);\n $query->execute(array($arrSession['intUserAuthID']));\n $result = $query->fetchObject($thisClassName);\n if ($result != false) {\n $objCache->arrCache[$thisClassName]['id'][$result->getKey('intUserID')] = $result;\n $objCache->arrCache[$thisClassName]['current'] = $result;\n } else {\n unset($_SESSION['intUserAuthID']);\n }\n return $result;\n } catch (Exception $e) {\n throw $e;\n }\n } elseif (isset($arrSession['OPENID_AUTH'])) {\n $key = 'openid';\n $value = sha1(Container_Config::getSecureByID('salt', 'Not Yet Set!!!')->getKey('value') . $arrSession['OPENID_AUTH']['url']);\n $createIfNotExist = true;\n } elseif ($objRequest->get_strUsername() != null && $objRequest->get_strPassword() != null) {\n $key = 'basicauth';\n $value = $objRequest->get_strUsername() . ':' . sha1(Container_Config::getSecureByID('salt', 'Not Yet Set!!!')->getKey('value') . $objRequest->get_strPassword());\n } elseif (Base_GeneralFunctions::getValue($objRequest->get_arrRqstParameters(), 'code', false, true) \n && Base_GeneralFunctions::getValue($objRequest->get_arrRqstParameters(), 'code') != '%'\n ) {\n $key = 'codeonly';\n $value = '%:' . Base_GeneralFunctions::getValue($objRequest->get_arrRqstParameters(), 'code');\n } elseif (Base_GeneralFunctions::getValue($objRequest->get_arrRqstParameters(), 'username', false, true)\n && Base_GeneralFunctions::getValue($objRequest->get_arrRqstParameters(), 'password', false, true)\n ) {\n $key = 'basicauth';\n $value = Base_GeneralFunctions::getValue($objRequest->get_arrRqstParameters(), 'username') . ':' . sha1(Container_Config::getSecureByID('salt', 'Not Yet Set!!!')->getKey('value') . Base_GeneralFunctions::getValue($objRequest->get_arrRqstParameters(), 'password'));\n if (Base_GeneralFunctions::getValue($objRequest->get_arrRqstParameters(), 'register', false, true)) {\n $createIfNotExist = true;\n }\n }\n if (isset($key)) {\n try {\n $objDatabase = Container_Database::getConnection();\n $sql = \"SELECT * FROM userauth WHERE enumAuthType = ? and strAuthValue like ? LIMIT 1\";\n $query = $objDatabase->prepare($sql);\n $query->execute(array($key, $value));\n $result = $query->fetchObject($thisClassName);\n if ($result != false) {\n $objCache->arrCache[$thisClassName]['id'][$result->getKey('intUserID')] = $result;\n $_SESSION['intUserAuthID'] = $result->getKey('intUserAuthID');\n $objCache->arrCache[$thisClassName]['current'] = $result;\n if ($key == 'onetime') {\n $sql = \"DELETE FROM userauth WHERE $key = ? LIMIT 1\";\n $query = $objDatabase->prepare($sql);\n $query->execute(array($value));\n }\n $_SESSION['login'] = 'return';\n unset($_SESSION['OPENID_AUTH']);\n } else {\n if ($createIfNotExist === true) {\n $result = new Object_User(true);\n if ($result != false && isset($result->objUserAuthTemp)) {\n $_SESSION['intUserAuthID'] = $result->objUserAuthTemp->getKey('intUserAuthID');\n $_SESSION['login'] = 'first';\n }\n return $result->objUserAuthTemp;\n } else {\n throw new Exception_AuthenticationFailed('User does not exist or password is incorrect.');\n }\n }\n return $result;\n } catch (Exception $e) {\n throw $e;\n }\n } else {\n return false;\n }\n }",
"public function startChain(){\n\t\treturn $this;\n\t}",
"public function startChain(){\n\t\treturn $this;\n\t}",
"public function getCallChainId()\n {\n if (array_key_exists(\"callChainId\", $this->_propDict)) {\n return $this->_propDict[\"callChainId\"];\n } else {\n return null;\n }\n }",
"public function startChain() {\n\t\treturn $this;\n\t}",
"public function getChain() {\n return $this->chain;\n }",
"public function setAppChain(AppChain $appChain)\n {\n $this->appChain = $appChain;\n }",
"public function getAnApplicant($application_id);",
"function getWaitListedApplications()\r\n {\r\n $db = db_connect();\r\n $sql = \"SELECT account.* FROM account, application WHERE account.accountID = application.accountID AND \r\n account.role = :role: AND application.applicationStatus = :applicationStatus: ORDER BY \r\n account.accountID DESC\";\r\n\r\n //Send query then store the results\r\n $results = $db->query($sql, [\r\n 'role' => 0,\r\n 'applicationStatus' => 'W'\r\n ]);\r\n\r\n return $results;\r\n }",
"public function chain()\n {\n $response = SubstrateBase::APIHandler('system_'.__FUNCTION__);\n $this->_chain = $response['result'];\n return response()->json($this->_chain);\n }",
"public function getCurrentApplicants()\n {\n $builder = $this->createQueryBuilder('a');\n $subQueryBuilder = $this->_em->createQueryBuilder();\n $subQuery = $subQueryBuilder\n ->select('apl')\n ->from('MentorshipMasterBundle:Application', 'apl')\n ->where('apl.applicant = a')\n ->andWhere('apl.finishedAt IS NULL')\n ->getQuery();\n $query = $builder\n ->where($builder->expr()->exists($subQuery->getDQL()))\n ->getQuery();\n $cacheId = self::getCacheId(self::CACHE_ID_ACTIVE_APPLICANTS_SET);\n $query->useResultCache(true, 3600, $cacheId);\n return $query->getResult();\n }",
"public function activate(){\r\n\t\t$id = $this->uri->segment(3);\r\n\t\t$code = $this->uri->segment(4);\r\n\r\n\t\t//fetch requests details\r\n\t\t$request = $this->requests_model->getRequestById($id);\r\n \r\n\r\n\t\t//if code matches\r\n\t\tif($request['code'] == $code){\r\n\t\t\t//update user active status\r\n\t\t\t// $data['activate'] = true;\r\n\t\t\t$query = $this->accounts_model->updateActivate($id);\r\n\r\n\t\t\tif($query){\r\n\r\n\t\t\t\t$row = $this->accounts_model->getCheckUser($request['email']);\r\n\r\n\t\t\t\t$this->session->set_userdata('is_user', $row['type']);\r\n\t\t\t\t$this->session->set_userdata('myName', \t$row['firstname'].\" \".$row['lastname']);\r\n\t\t\t\t$this->session->set_userdata('myEmail', $row['email']);\r\n\t\t\t\t$this->session->set_userdata('myId', \t$row['id']);\r\n\t\t\t\t$this->session->set_userdata('myRole', \t$row['role']);\r\n\r\n\t\t\t\t$this->session->set_flashdata('msg', 'User activated successfully');\r\n\t\t\t\tredirect('main');\r\n\r\n\t\t\t}\r\n\t\t\telse{\r\n\r\n\t\t\t\t$this->session->set_flashdata('error_msg', 'Something went wrong in activating account');\r\n\t\t\t\tredirect('login'); \r\n\t\t\t}\r\n\t\t}\r\n\t\telse{\t\t\t\r\n\t\t\t$this->session->set_flashdata('error_msg', 'Cannot activate account. Code didnt match');\r\n\t\t\tredirect('login'); \r\n\t\t}\r\n \r\n\t}",
"public function chain() {\n\t\t\treturn $this->chain;\n\t\t}",
"public function activate(){\r\n\t\t$uid = $_GET[\"uid\"];\r\n\t\t$hash = $_GET[\"hash\"];\r\n\r\n\t\tif(User::activateUser($uid, $hash)){\r\n\t\t\techo \"active\";\r\n\t\t\tUser::loginSystem(User::fromUid($uid));\r\n\t\t}\r\n\t\tPage::redirect(\"/index\");\r\n\t}",
"public function retrieveInactiveApplications()\n {\n return $this->start()->uri(\"/api/application\")\n ->urlParameter(\"inactive\", true)\n ->get()\n ->go();\n }",
"public function testChainedPaymentShopIdInPrimaryReciever()\n {\n $applane_integration = new ApplaneIntegrationControllerTest();\n $user_info = $applane_integration->getLoginUser();\n $access_token = $user_info['access_token'];\n $user_id = $user_info['user_id'];\n $type = $this->getContainer()->getParameter('chained_payment_fee_payer');\n $shop_id = $this->getContainer()->getParameter('chained_payment_primary_shop_id');\n $item_type = $this->getContainer()->getParameter('item_type_shop');\n $paypal_service = $this->getContainer()->get('paypal_integration.payment_transaction');\n $fee_payer = $paypal_service->getPaypalFeePayer($type,$shop_id,$item_type);\n $expected_fee_payer = $this->getContainer()->getParameter('primary_reciever');\n \n $this->assertEquals($expected_fee_payer,$fee_payer);\n }",
"function activeLink($name=null,$tree=false)\n {\n\n\n\n if ( $tree and $name == 'setup' )\n {\n\n $setupArray = ['client-types','resources','teams','costs'];\n\n if ( in_array(request()->segment(1) ,$setupArray) )\n {\n return 'active selected';\n }\n return '';\n\n\n }\n\n if ( $tree and $name == 'reports' )\n {\n $reportArray = ['opportunity-report','activity-report','proposal-report','invoice-report'];\n\n if ( in_array(request()->segment(1) ,$reportArray) )\n {\n return 'active selected';\n }\n return '';\n\n\n }\n\n if ( !is_null($name) and request()->segment(1) == $name )\n {\n if ( $tree )\n {\n return 'current-page';\n }\n\n return 'active selected';\n }\n\n\n }",
"public function setChain($chain) {\n $this->chain = $chain;\n return $this;\n }",
"public function get_chain()\n {\n return $this->_chain;\n }",
"public function getActiveAuth() {\n\tif (!$this->activecontainer) {return false;}\n\treturn $this->activecontainer;\n}",
"function getMyApplication()\n {\n if (Yii::$app->user->isGuest) {\n return new Applications;\n }\n $model = $this->getApplications()->where('user_id=:uid', [\n 'uid' => Yii::$app->user->id,\n ])->one();\n\n return $model ? $model : new Applications();\n }",
"protected function getCurrentOfficeUser()\n {\n if ($this->currentUser) {\n return $this->currentUser;\n }\n\n $user = $this->getUser();\n\n if (!$user) {\n return null;\n }\n\n $userRepository = $this->getDoctrine()->getManager()->getRepository('TerramarSalesBundle:OfficeUser');\n\n $this->currentUser = $userRepository->findOneBy(array('user' => $user->getId()));\n\n if (!$this->currentUser) {\n throw new \\RuntimeException('This action requires that the current user be assigned to a company');\n }\n\n return $this->currentUser;\n }",
"function getAcceptedApplications()\r\n {\r\n $db = db_connect();\r\n $sql = \"SELECT account.* FROM account, application WHERE account.accountID = application.accountID AND \r\n account.role = :role: AND application.applicationStatus = :applicationStatus: ORDER BY \r\n account.accountID DESC\";\r\n\r\n //Send query then store the results\r\n $results = $db->query($sql, [\r\n 'role' => 0,\r\n 'applicationStatus' => 'A'\r\n ]);\r\n\r\n return $results;\r\n }",
"public function active($id=null, $hash=null) {\n\t\t$usuario = new \\KBackend\\Model\\User();\n\t\tif(!is_null($id) || !is_null($hash)){\n\t\t\tif ($usuario->active($id, $hash)) {\n\t\t\t\tRedirect::toAction('active');\n\t\t\t} else {\n\t\t\t\tView::response('error');\n\t\t\t}\t\t\t\n\t\t}\n }",
"public function syncByIdentifier($identifier) {\n // Look up all org identities associated with this identifier, which also have\n // an associated Org Identity Source with sync_on_user_login set. For each\n // matching identifier, perform a sync.\n \n $args = array();\n $args['conditions']['Identifier.identifier'] = $identifier;\n $args['conditions']['Identifier.status'] = SuspendableStatusEnum::Active;\n $args['conditions']['Identifier.login'] = true;\n // But actually what we want is any Org Identity associated with any\n // CO Person associated with $identifier.\n // That's a lot of nesting!\n $args['contain']['OrgIdentity']['CoOrgIdentityLink']['CoPerson']['CoOrgIdentityLink']['OrgIdentity']['OrgIdentitySourceRecord'] = 'OrgIdentitySource';\n \n $ids = $this->Co->CoPerson->Identifier->find('all', $args);\n \n // The set of Org Identities we want is buried in the result. Note we can get more\n // than one result in $ids since we're querying across COs, but within the result\n // we should only get one CO's worth of stuff.\n \n foreach($ids as $id) {\n if(!empty($id['OrgIdentity']['CoOrgIdentityLink'][0]['CoPerson']['CoOrgIdentityLink'])) {\n // This is the set of Org Identities within this CO that $identifier is associated with\n \n foreach($id['OrgIdentity']['CoOrgIdentityLink'][0]['CoPerson']['CoOrgIdentityLink'] as $lnk) {\n if(!empty($lnk['OrgIdentity']['OrgIdentitySourceRecord']['OrgIdentitySource']['id'])\n && $lnk['OrgIdentity']['OrgIdentitySourceRecord']['OrgIdentitySource']['sync_on_user_login']) {\n // This is an OrgIdentity that was created from a source, and that source\n // is set to sync, so do the sync.\n \n try {\n $ret = $this->syncOrgIdentity($lnk['OrgIdentity']['OrgIdentitySourceRecord']['OrgIdentitySource']['id'],\n $lnk['OrgIdentity']['OrgIdentitySourceRecord']['sorid'],\n // The actor is implicitly the CO Person associated with this record\n $id['OrgIdentity']['CoOrgIdentityLink'][0]['CoPerson']['id']);\n \n if($ret['status'] != 'unchanged') {\n // Cut a history record\n $this->OrgIdentitySourceRecord->OrgIdentity->HistoryRecord->record($id['OrgIdentity']['CoOrgIdentityLink'][0]['CoPerson']['id'],\n null,\n $lnk['OrgIdentity']['id'],\n $id['OrgIdentity']['CoOrgIdentityLink'][0]['CoPerson']['id'],\n ($ret['status'] == 'removed'\n ? ActionEnum::OrgIdRemovedSource\n : ActionEnum::OrgIdEditedSource),\n _txt('rs.ois.sync.login'));\n }\n }\n catch(Exception $e) {\n // XXX We don't want to break the loop on an exception, and it's not really\n // clear what we should do with it. We log it so we don't lose it entirely,\n // but perhaps we should register as a Notification to admins? Or render a\n // popup to the user logging in?\n $this->log(_txt('er.ois.sync.login', array($identifier, $e->getMessage())));\n }\n }\n }\n }\n }\n }",
"public static function findUserForIdentity($identity) {\n\t\t$query=OCP\\DB::prepare('SELECT `userid` FROM `*PREFIX*preferences` WHERE `appid`=? AND `configkey`=? AND `configvalue`=?');\n\t\t$result=$query->execute(array('user_openid','identity',$identity))->fetchAll();\n\t\tif(count($result)>0) {\n\t\t\treturn $result[0]['userid'];\n\t\t}else{\n\t\t\treturn false;\n\t\t}\n\t}",
"public function findApplicationModel($appId) {\n\t\t$applicationModelFinder = CActiveRecord::model($this->getApplicationModelClassName());\n\n\t\treturn $applicationModelFinder->findByPk($appId, $this->getApplicationFindCondition());\n\t}",
"public function select_program(){\n $this->block_for_test();\n if($this->session->has_userdata('APPLICATION_ID')) {\n $APPLICATION_ID = $this->session->userdata('APPLICATION_ID');\n\n $user = $this->session->userdata($this->SessionName);\n $user = $this->User_model->getUserById($user['USER_ID']);\n\n $data['user'] = $user;\n $data['APPLICATION_ID'] = $APPLICATION_ID;\n $application = $this->Application_model->getApplicationByUserAndApplicationId($user['USER_ID'], $APPLICATION_ID);\n \n // prePrint($application);\n // if($application['PROGRAM_TYPE_ID'] == 1){\n //redirect(base_url('form/add_evening_category'));\n //exit();\n // }\n if($application['STATUS_ID']==FINAL_SUBMIT_STATUS_ID){\n redirect(base_url('form/application_form'));\n exit();\n }\n if($application['STATUS_ID']>FINAL_SUBMIT_STATUS_ID){\n redirect(base_url('form/dashboard'));\n }\n if ($application) {\n // if($application['PROGRAM_TYPE_ID']==2){\n // redirect(base_url('form/add_evening_category')); \n // }\n //form close from bachelor\n $this->close_registration_for_bachelor($application);\n \n \n $form_data = $this->User_model->getUserFullDetailById($user['USER_ID'],$APPLICATION_ID);\n\n $degree_list = array(\n 'BACHELOR'=>array('PROGRAM_TYPE_ID'=>1,'DEGREE_ID'=>3),\n 'MASTER'=>array('PROGRAM_TYPE_ID'=>2,'DEGREE_ID'=>array(4,5,6))\n );\n\n //$form_data = json_decode($application['FORM_DATA'],true);\n $bool = false;\n $valid_qualification = null;\n if($application['PROGRAM_TYPE_ID']==$degree_list['BACHELOR']['PROGRAM_TYPE_ID']){\n // echo \"bach\";\n foreach ($form_data['qualifications'] as $qualification){\n if($qualification['DEGREE_ID'] ==$degree_list['BACHELOR']['DEGREE_ID']){\n $bool = true;\n $valid_qualification = $qualification;\n break;\n }\n }\n\n\n }\n else if($application['PROGRAM_TYPE_ID']==$degree_list['MASTER']['PROGRAM_TYPE_ID']){\n //echo \"master\";\n //4\n // prePrint($form_data['qualifications']);\n\n\n\n foreach ($form_data['qualifications'] as $k=>$qualification){\n if(in_array($qualification['DEGREE_ID'] ,$degree_list['MASTER']['DEGREE_ID'])){\n $bool = true;\n if($k==0){\n $valid_qualification = $qualification;\n }\n if($qualification['DEGREE_ID']>$valid_qualification['DEGREE_ID']){\n $valid_qualification = $qualification;\n }\n\n //break;\n }\n }\n }\n\n\n $form_fees = $this->Admission_session_model->getFormFeesBySessionAndCampusId($application['SESSION_ID'], $application['CAMPUS_ID']);\n\n if ($form_fees) {\n// $valid_upto = getDateCustomeView($application['ADMISSION_END_DATE'], 'd-m-Y');\n//\n// if ($application['ADMISSION_END_DATE'] < date('Y-m-d')) {\n// exit(\"Sorry your challan is expired..\");\n// }\n\n\n $data['profile_url'] = $this->profile;\n\n if($bool&&$valid_qualification!=null){\n\n // $result = $this->Application_model->getMinorMappingByDisciplineId($valid_qualification['DISCIPLINE_ID']);\n\n\n\n $data['DISCIPLINE_ID'] = $valid_qualification['DISCIPLINE_ID'];\n\n $applicantsMinors = $this->Application_model->getApplicantsMinorsByApplicationIdAndDisciplineID($APPLICATION_ID,$valid_qualification['DISCIPLINE_ID']);\n $minorMappingIds = array();\n\n foreach ($applicantsMinors as $applicantsMinor)\n {\n $minorMappingIds[]=$applicantsMinor['MINOR_MAPPING_ID'];\n }\n \n if(count($minorMappingIds)==0){\n echo \"Please Must select Minor Subject\";\n $error = \"<div class='text-danger'> Please Must select Minor Subject</div>\";\n $alert = array('MSG'=>$error,'TYPE'=>'ALERT');\n $this->session->set_flashdata('ALERT_MSG',$alert);\n redirect(base_url('form/select_subject'));\n exit();\n }\n $list_of_categoy = $this->Application_model->getApplicantCategory($APPLICATION_ID, $user['USER_ID']);\n if(count($list_of_categoy)==0){\n echo \"Please Must Save Category\";\n $error = \"<div class='text-danger'> Please Must Save category</div>\";\n $alert = array('MSG'=>$error,'TYPE'=>'ALERT');\n $this->session->set_flashdata('ALERT_MSG',$alert);\n redirect(base_url('form/select_category'));\n exit();\n }\n $is_valid = 0;\n foreach($list_of_categoy as $cat_obj){\n\t\t\t\t\t\t if($cat_obj['FORM_CATEGORY_ID']==7){\n\t\t\t\t\t\t $is_valid = 1; \n\t\t\t\t\t\t }\n\t\t\t\t\t\t \n\t\t\t\t\t\t }\n $valid_program_list = $this->Prerequisite_model->getPrerequisiteByMinorMappingIdList($minorMappingIds);\n\n $prog_list_by_shift = $this->Administration->getProgListByShiftAndProgTypeAndCampusId (1,$application['PROGRAM_TYPE_ID'],$application['CAMPUS_ID']);\n \n //prePrint($prog_list_by_shift);\n //exit();\n \n $valid_exact_program = array();\n foreach($prog_list_by_shift as $prog_list){\n foreach ($valid_program_list as $valid_program){\n if($prog_list['PROG_LIST_ID']==$valid_program['PROG_LIST_ID']){\n $valid_exact_program[]=$valid_program;\n }\n }\n }\n \n $CHOOSEN_PROGRAM_LIST = $this->Application_model->getChoiceByUserAndApplicationAndShiftId($user['USER_ID'],$APPLICATION_ID,$MORNING_SHIFT=1);\n $lat_info = $this->Application_model->getLatInfoByUserAndApplicationId($user['USER_ID'],$APPLICATION_ID);\n \n $program_list = $this->Administration->getProgramByTypeID($application['PROGRAM_TYPE_ID'],$MORNING_SHIFT=1);\n \n \n //prePrint($prog_list_by_shift);\n //prePrint($program_list);\n \n //exit();\n \n $program_list = $prog_list_by_shift; \n \n \n $CHOOSEN_PROGRAM_LIST_NEW = array();\n foreach($CHOOSEN_PROGRAM_LIST as $cho){\n if($cho['IS_SPECIAL_CHOICE']=='N'){\n array_push($CHOOSEN_PROGRAM_LIST_NEW,$cho);\n }\n }\n $data['VALID_PROGRAM_LIST'] =$valid_exact_program;\n $data['PROGRAM_LIST'] =$program_list;\n $data['PROGRAM_TYPE_ID'] =$application['PROGRAM_TYPE_ID'];\n $data['CHOOSEN_PROGRAM_LIST'] =$CHOOSEN_PROGRAM_LIST_NEW;\n $data['lat_info'] =$lat_info;\n // $data['user'] =$form_data;\n $data['form_data'] =$form_data;\n $data['application'] =$application;\n $data['category'] =$list_of_categoy;\n $data['is_evening_category']=$is_valid;\n \n $precentage = ($valid_qualification['OBTAINED_MARKS']*100/$valid_qualification['TOTAL_MARKS']);\n $data['precentage'] =round($precentage,2);\n\n \n $this->load->view('include/header', $data);\n $this->load->view('include/preloder');\n $this->load->view('include/side_bar', $data);\n $this->load->view('include/nav', $data);\n $this->load->view('select_program', $data);\n $this->load->view('include/footer_area', $data);\n $this->load->view('include/footer', $data);\n\n }else{\n redirect(base_url().\"candidate/add_inter_qualification\");\n echo \"Invalid Degree Please must add appropriate degree\";\n }\n // prePrint($application);\n\n\n\n } else {\n echo \"fees not found\";\n }\n\n } else {\n echo \"this application id is not associate with you\";\n }\n }else{\n echo \"Application Id Not Found\";\n }\n }"
] |
[
"0.46931055",
"0.45957494",
"0.4522103",
"0.4471946",
"0.4471946",
"0.44540426",
"0.443538",
"0.44094595",
"0.440937",
"0.43831",
"0.4279744",
"0.42424798",
"0.42409447",
"0.42391118",
"0.42353335",
"0.42059788",
"0.4157942",
"0.41276988",
"0.41215456",
"0.41125888",
"0.40998673",
"0.40628535",
"0.4042861",
"0.40426323",
"0.40375802",
"0.40298307",
"0.40168935",
"0.40091014",
"0.4005092",
"0.39932615"
] |
0.66226965
|
0
|
List origins List configured origins for a user
|
public function origins()
{
return $this->get('/user/load_balancers/origins');
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getAllowedOrigins() {\n return $this->params['allowedOrigins'];\n }",
"function get_allowed_http_origins()\n {\n }",
"public function setOrigins($value)\n {\n return $this->set('Origins', $value);\n }",
"public function setOrigins($value)\n {\n return $this->set('Origins', $value);\n }",
"public function setOrigins($value)\n {\n return $this->set('Origins', $value);\n }",
"private function origins()\n {\n if(array_has($_SERVER, 'HTTP_ORIGIN')){\n foreach (config('cors.origins') as $origin) {\n if ($_SERVER['HTTP_ORIGIN'] == $origin) {\n header('Access-Control-Allow-Origin: ' . $_SERVER['HTTP_ORIGIN']);\n break;\n }\n }\n\n if(config('cors.origins') == ['*']){\n header('Access-Control-Allow-Origin: ' . $_SERVER['HTTP_ORIGIN']);\n }\n }\n\n\n if(!array_has($_SERVER, 'HTTP_ORIGIN') &&\n env('APP_ENV') != 'local' &&\n config('cors.local') != 'true' &&\n config('cors.internal') == false){\n\n abort(403);\n }\n }",
"protected function get_default_origins() {\n\t\t$origins = array(\n\t\t\t'origin' => array(\n\t\t\t\t(object) array(\n\t\t\t\t\t'id' => 'csv',\n\t\t\t\t\t'name' => __( 'CSV File', 'the-events-calendar' ),\n\t\t\t\t),\n\t\t\t),\n\t\t);\n\n\t\treturn $origins;\n\t}",
"public function get_origins( $return_error = false ) {\n\t\t$origins = $this->get_default_origins();\n\n\t\t$response = $this->get( 'origin' );\n\t\t$error = null;\n\n\t\t// If we have an WP_Error or a bad response we return only CSV and set some error data\n\t\tif ( is_wp_error( $response ) || empty( $response->status ) ) {\n\t\t\t$error = $response;\n\n\t\t\treturn $return_error ? array( $origins, $error ) : $origins;\n\t\t}\n\n\t\tif ( $response && 'success' === $response->status ) {\n\t\t\t$origins = array_merge( $origins, (array) $response->data );\n\t\t}\n\n\t\treturn $return_error\n\t\t\t? array( $origins, $error )\n\t\t\t: $origins;\n\t}",
"public function origins(): ContactsOrigins\n {\n if (is_null($this->originsEndpoint)) {\n $this->originsEndpoint = new ContactsOrigins($this->api);\n }\n return $this->originsEndpoint;\n }",
"public static function listOriginAccessIdentities()\n\t{\n\t\t// TODO: Implement listOriginAccessIdentities() method.\n\t}",
"public function getOriginUrlParts() {\n\t\treturn $this->_originUrlParts;\n\t}",
"public function getEthnicOriginList() {\n return $this->_get(7);\n }",
"public function setAllowedOrigins(array $allowedOrigins): self\n {\n $this->allowedOrigins = $allowedOrigins;\n $this->hasData = true;\n return $this;\n }",
"function getCoinOrigins() {\n global $COIN_ORIGINS_SQL;\n \n $SQL = $COIN_ORIGINS_SQL;\n $result = mysql_query($SQL);\n \n $origins = array();\n if (mysql_num_rows($result) == 0) {\n return $origins;\n }\n\n while($row = mysql_fetch_array($result)) {\n \n $info = array();\n \n $id = $row['coid'];\n $name = $row['name'];\n \n $info['id'] = $id;\n $info['name'] = $name;\n \n array_push($origins, $info);\n }\n \n return $origins;\n}",
"public function adminIndexListOrigine()\n {\n $origine = Origine::paginate(10);\n return view('admin.list.origine', compact('origine'));\n }",
"public function getClientURLs()\n {\n return $this->clientURLs;\n }",
"function listSources() {\n\t\n\t}",
"public function getOriginAllowableValues()\n {\n return [\n self::ORIGIN_AUTHORED,\n self::ORIGIN_GENERATED,\n self::ORIGIN_IMPORTED,\n ];\n }",
"public function getUrls(): array;",
"public function getUrls(): array;",
"public function listSources() {\n $this->resolve();\n return $this->sources;\n }",
"public function request( array $origins = null, array $destinations = null ): array\n {\n if( $origins )\n $this->addAddresses( $origins );\n\n if( $destinations )\n $this->addAddresses( $destinations, 'destinations' );\n\n $this->validate();\n\n $url = Settings::URL . \\http_build_query( $this->params );\n $url .= '&origins=' . $this->convertAddresses( $this->origins );\n $url .= '&destinations=' . $this->convertAddresses( $this->destinations );\n\n \\curl_setopt( $this->client, \\CURLOPT_URL, $url );\n $response = \\curl_exec( $this->client );\n\n return $this->getResponse( $response );\n }",
"function get_http_origin()\n {\n }",
"public function getUriList();",
"abstract protected function yieldCrossOriginResourceSharingHosts(): Generator;",
"public function getUrls()\r\n {\r\n }",
"public function get_curies()\n {\n }",
"public static function allowedDomains()\n {\n return [\n // '*', // star allows all domains\n 'http://export.mysite',\n 'http://localhost:3000',\n 'http://localhost:3030',\n 'http://localhost:3033',\n \"http://alex.dmitxe.ru\",\n \"https://alex.dmitxe.ru\",\n \"http://alex.dmitxe.ru:3333\",\n \"https://xn--80ahyfc6d7ba.xn--80aabfyii3adadgocjt5p1b.xn--p1ai\",\n \"https://xn--80aabfyii3adadgocjt5p1b.xn--p1ai\"\n\n \n \n ];\n }",
"public function get_sites() {\n return $this->linkemperor_exec(null, null,\"/api/v2/customers/sites.json\");\n }",
"public function getPoolSourceslist()\n\t{\n\t\treturn($this->getProperty('sourceslist'));\n\t}"
] |
[
"0.7011769",
"0.67797923",
"0.6674397",
"0.66733825",
"0.66733825",
"0.66301066",
"0.6336242",
"0.63339126",
"0.63177675",
"0.6204805",
"0.59686744",
"0.5915987",
"0.5743858",
"0.57243156",
"0.55870456",
"0.55344105",
"0.5526637",
"0.5414796",
"0.5340577",
"0.5340577",
"0.5319382",
"0.5291419",
"0.5261374",
"0.5250907",
"0.5250122",
"0.51903105",
"0.5176171",
"0.51674145",
"0.51523894",
"0.5132651"
] |
0.80445385
|
0
|
Delete an origin Delete a configured origin
|
public function delete_origin($identifier)
{
return $this->delete('/user/load_balancers/origins/'.$identifier);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function delete() {}",
"public function delete() {}",
"public function delete() {}",
"public function delete() {}",
"public function delete();",
"public function delete();",
"public function delete();",
"public function delete();",
"public function delete();",
"public function delete();",
"public function delete();",
"public function delete();",
"public function delete();",
"public function delete();",
"public function delete();",
"public function delete();",
"public function delete();",
"public function delete();",
"public function delete();",
"public function testDeleteBucketCors()\n\t{\n\t\t$expectedResult = $this->commonDeleteTestOperations(\"?cors\");\n\t\t$this->assertThat(\n\t\t\t$this->object->delete->deleteBucketCors($this->options->get(\"testBucket\")),\n\t\t\t$this->equalTo($expectedResult)\n\t\t);\n\t}",
"public function delete_delete(){\n $response = $this->PersonM->delete_person(\n $this->delete('id')\n );\n $this->response($response);\n }",
"public final function delete() {\n }",
"function delete()\n {\n $this->_api->doRequest(\"DELETE\", \"{$this->getBaseApiPath()}\");\n }",
"function delete()\n {\n $this->_api->doRequest(\"DELETE\", \"{$this->getBaseApiPath()}\");\n }",
"final public function delete() {\n global $config; \n # Borrar el elemento de la base de datos\n $this->db->query(\"DELETE FROM guarderia_2 WHERE id_guarderia = $this->id\");\n # Redireccionar a la página principal del controlador\n $this->functions->redir($config['site']['url'] . 'sedes/&success=true');\n }",
"public static function delete() {\n\n\n\t\t}",
"public function delete(): void;",
"public function destroy(Corporate $corporate)\n {\n dd('delete corporate');\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 delete()\n {\n $this->socrates->deleteSite($this->id);\n }"
] |
[
"0.606933",
"0.6068186",
"0.606803",
"0.606803",
"0.5933492",
"0.5933492",
"0.5933492",
"0.5933492",
"0.5933492",
"0.5933492",
"0.5933492",
"0.5933492",
"0.5933492",
"0.5933492",
"0.5933492",
"0.5933492",
"0.5933492",
"0.5933492",
"0.5933492",
"0.58560365",
"0.57481307",
"0.56976455",
"0.5670306",
"0.5670306",
"0.56474006",
"0.56370234",
"0.55925554",
"0.5583979",
"0.5528802",
"0.552562"
] |
0.6769604
|
0
|
Returns the rbac array
|
public function getRbac(): array
{
return [
'permissions' => [
Role\Administrator::class => [
'admin/post/admin',
'admin/form/admin',
'admin/user/view/resultset'
]
]
];
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getRbac(): array\r\n {\r\n return [\r\n 'permissions' => [\r\n Role\\Administrator::class => [\r\n 'exclusive/json/messagetutor',\r\n 'exclusive/json/certificateprintfree'\r\n ]\r\n ]\r\n ];\r\n }",
"public function getRules(): array\n {\n if (Auth::id()==1){\n return [\n ['disk' => 'projects', 'path' => '*', 'access' => 2],\n ];\n }\n return \\DB::table('acl_rules')\n ->where('user_id', $this->getUserID())\n ->get(['disk', 'path', 'access'])\n ->map(function ($item) {\n return get_object_vars($item);\n })\n ->all();\n }",
"public function getBcc(): iterable;",
"public function getAuthorizations(): array;",
"abstract public function getAccessRights(): array;",
"public function getArray() {\n \treturn array(\n \t\t\t'id' => $this->id,\n \t\t\t'name' => $this->name,\n \t\t\t'path' => $this->path,\n \t\t\t'description' => $this->description,\n \t\t\t'version' => $this->version,\n \t\t\t'groups' => $this->groups,\n \t\t\t'enabled' => $this->enabled\n \t);\n }",
"function botsToArray()\n\t{\n\t\t$bots = NULL;\n\t\t\n\t\tif( $natSort = filesNatSort(XDCCDIR) )\n\t\t\tforeach( $natSort as $file )\n\t\t\t\t$bots[] = $file;\n\t\t\t\t\n\t\treturn $bots ? $bots : NULL;\n\t}",
"public function getChrArray()\n {\n if (empty($this->bidichrarr)) {\n $this->bidichrarr = $this->conv->ordArrToChrArr($this->bidiordarr);\n }\n return $this->bidichrarr;\n }",
"public function getRoles(): array;",
"public function asArray() : array\n {\n return $this->card;\n }",
"public function toArray(): array\n {\n return $this->rut;\n }",
"function getAdmittedRolesArray() {\n\n if ($this->connectToMySql()) {\n $query = sprintf(\"SELECT id_ruolo, ruolo FROM scuola.ruoli_utenti ORDER BY id_ruolo\");\n\n // Perform Query\n $result = mysql_query($query);\n //$array = mysql_fetch_assoc($result);\n }\n $this->closeConnection();\n return $result;\n }",
"abstract public function getAllowedBLZ(): array;",
"public function asArray()\n {\n return $this->compile();\n }",
"public function getAllowedBLZ(): array\n {\n return [];\n }",
"protected function buildJSAbbreviationArray() {}",
"public function arr() {\n\t\t\treturn \\uri\\generate::to_array($this->object);\n\t\t}",
"public function get_rabiescertificate()\n\t{\n\t\t$query = $this->db->get('tblrabiescertificate');\n\t\treturn $query->result_array(); \n\t}",
"public function getRoles(): array\n { \n\n $roles = [];\n if($this->organization){\n switch($this->organization->getPlan()){\n case 3:\n $roles[] = 'ROLE_FREE';\n break;\n case 2:\n $roles[] = 'ROLE_PREMIUM';\n break;\n case 1:\n $roles[] = 'ROLE_ENTERPRISE';\n break;\n }\n }\n\n switch($this->role){\n case 4:\n $roles[] = 'ROLE_COLLABORATOR';\n break;\n case 3:\n $roles[] = 'ROLE_ACTIVITY_MANAGER';\n break;\n case 2:\n $roles[] = 'ROLE_ADMIN';\n break;\n case 1:\n $roles[] = 'ROLE_SUPER_ADMIN';\n break;\n case 0:\n $roles[] = 'ROLE_ROOT';\n break;\n }\n\n return $roles;\n\n }",
"public function getConstrains(): array;",
"public function residue () :array\n {\n return [\n\n ];\n }",
"private function getAclResources()\n {\n if ($this->aclResources !== null) {\n return $this->aclResources;\n }\n $aclFiles = Files::init()->getConfigFiles('acl.xml', []);\n $xmlResources = [];\n array_map(function ($file) use (&$xmlResources) {\n $config = simplexml_load_file($file[0]);\n $nodes = $config->xpath('.//resource/@id') ?: [];\n foreach ($nodes as $node) {\n $xmlResources[(string)$node] = $node;\n }\n }, $aclFiles);\n $this->aclResources = $xmlResources;\n return $this->aclResources;\n }",
"public function asArray()\n {\n $result = [];\n\n if (isset($this->a)) {\n $result['a'] = $this->a;\n }\n\n if (isset($this->b)) {\n $result['b'] = $this->b;\n } elseif (isset($this->f)) {\n $result['f'] = $this->f;\n } elseif (isset($this->rf)) {\n $result['rf'] = $this->rf;\n }\n\n if (isset($this->code)) {\n $result['code'] = $this->code;\n }\n\n if (isset($this->name)) {\n $result['name'] = $this->name;\n }\n\n return $result;\n }",
"public function toArray(): array {\n return [\n 'securitySchemes' => $this->securityDefinitions(),\n ];\n }",
"public function getRolesArray(): array {\n $roles = array();\n foreach ($this->roles as $role){\n $roles[] = $role->getRoleName();\n }\n return $roles;\n }",
"private function toArray()\n {\n \treturn array(\n \t\t'Locus'\t\t\t\t=> $this->getLoucs(),\n \t\t'Length'\t\t\t=> $this->getLength(),\n \t\t'Strandedness'\t\t=> $this->getStrandedness(),\n \t\t'mulType'\t\t\t=> $this->getMulType(),\n \t\t'Topology'\t\t\t=> $this->getTopology(),\n \t\t'PriAccession'\t\t=> $this->getPriAccession(),\n \t\t'AccessionVersion'\t=> $this->getAccessionVersion(),\n \t\t'OtherSeqIds'\t\t=> $this->getOtherSeqIds(),\n \t\t'Organism'\t\t\t=> $this->getOrganism(),\n \t\t'Taxonomy'\t\t\t=> $this->getTaxonomy(),\n \t\t'Source'\t\t\t=> $this->getSource(),\n \t\t'Refferences'\t\t=> $this->getRefs(),\n \t\t'Comment'\t\t\t=> $this->getComment(),\n \t\t'Features'\t\t\t=> $this->getFeatures(),\n \t\t'Sequence'\t\t\t=> $this->getSequence()\n \t);\n }",
"public function acuityArray()\n {\n return array(\n \t\t\t '0'=>'Not recorded',\n '93'=>'6/5',\n '89'=>'6/6',\n '80'=>'6/9',\n '74'=>'6/12',\n '65'=>'6/18',\n '59'=>'6/24',\n '50'=>'6/36',\n '39'=>'6/60',\n '30'=>'3/60',\n '4'=>'CF',\n '3'=>'HM',\n '2'=>'PL',\n '1'=>'NPL');\n }",
"public function getRamasRemotas(){\n $sramas = $this->ejecuta('git branch -r');\n $ramas = explode(\"\\n\", $sramas);\n\n $filtradas = [];\n foreach($ramas as $idx => $r) {\n //if(strpos($r, $rama_actual) !== false) continue;\n list($origin,$local) = explode(\"/\", $r);\n $r = str_replace('*','',$r);\n $filtradas[] = trim($r);\n }\n\n $ramas = $filtradas;\n return $ramas;\n }",
"public function getAsArray()\n\t{\n\t\t\n\t\t$path = $this->get();\n\t\t\n\t\treturn self::toArray($path);\n\t\t\n\t}",
"public function toArray(): array\n\t{\n\t\treturn\n\t\t\t[\n\t\t\t\t\"id\" => $this->getId(),\n\t\t\t\t\"name\" => $this->name,\n\t\t\t\t\"completable\" => $this->completable,\n\t\t\t\t\"classes\" => $this->classes\n\t\t\t];\n\t}"
] |
[
"0.6302483",
"0.58428776",
"0.5727601",
"0.56825304",
"0.5657874",
"0.56540906",
"0.5619036",
"0.5610783",
"0.5537393",
"0.55009675",
"0.5498977",
"0.5474394",
"0.545602",
"0.54446715",
"0.543116",
"0.5429838",
"0.5428819",
"0.5418803",
"0.5399927",
"0.53974736",
"0.53812045",
"0.5356377",
"0.53462875",
"0.5326229",
"0.53239954",
"0.53105724",
"0.52984655",
"0.52906686",
"0.5274968",
"0.5263411"
] |
0.5908892
|
1
|
Creates an input array based on file object and information.
|
protected static function createInput($file, $file_info) {
$input = array(
'fid' => $file->fid,
'display' => 1,
);
if (!empty($file_info['description'])) {
$input['description'] = $file_info['description'];
}
return $input;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"private function readFileAsArray()\n {\n return file($this->getFolder() . $this->filename);\n }",
"public function makeArray() {\n\t\tif ( $this->file == '' ) {\n\t\t\tif ( $this->rawdata == '' ) {\n\t\t\t\techo \"No filename specified, aborting\";\n\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} else {\n\t\t\tif ( ! file_exists( $this->file ) ) {\n\t\t\t\techo \"File $this->file does not exist, aborting\";\n\n\t\t\t\treturn false;\n\t\t\t} else {\n\t\t\t\t$this->rawdata = file_get_contents( $this->file );\n\t\t\t}\n\t\t}\n\n\t\tif ( $this->rawdata == '' ) {\n\t\t\techo \"No data in file, aborting\";\n\n\t\t\treturn false;\n\t\t}\n\n\t\t$this->parse2array();\n\n\t\treturn true;\n\t}",
"public function fromFile(string $filename): array;",
"public function get_contents_array($file)\n {\n }",
"public function get_contents_array($file)\n {\n }",
"public function get_contents_array($file)\n {\n }",
"public function get_contents_array($file)\n {\n }",
"public function get_contents_array($file)\n {\n }",
"private function _setFileObject() {\n try {\n $fileArry = $_FILES;\n $_FILES = array();\n\n $fName = $fType = $fTmpName = $fErr = $fSize = array();\n foreach ($fileArry as $key => $val) {\n $fArr = explode('_', $key);\n $fKey = $fArr[0];\n $fPos = $fArr[1];\n\n $fName[] = $val['name'];\n $fType[] = $val['type'];\n $fTmpName[] = $val['tmp_name'];\n $fErr[] = $val['error'];\n $fSize[] = $val['size'];\n\n $_FILES[$fKey] = array(\n 'name' => $fName,\n 'type' => $fType,\n 'tmp_name' => $fTmpName,\n 'error' => $fErr,\n 'size' => $fSize\n );\n }\n } catch (Exception $ex) {\n throw new Exception('Error in _setFileObject function - ' . $ex);\n }\n }",
"function load_input_file_into_php_array() {\n#This shows the file the directory of the data info\n$file_string = file_get_contents(\"data/input.json\");\n#Adding true will ensure objects are changed to associative arrays\n$file_array = json_decode($file_string, true);\n #Prints out a message to the command line when function is excecuted\nprint \"Loading...\\n\";\n#Returning the variable will prevent a value of \"null\" showing up\n return $file_array;\n}",
"public function fileToArray(string $filename): array;",
"public static function prepareFile(array $params) {\n if(!isset($params['image']) && !isset($params['file'])) {\n return false;\n }\n $type = isset($params['image']) ? 'image' : 'file';\n return [\n [\n 'name' => $type,\n 'contents' => fopen($params[$type], 'r')\n ]\n ];\n }",
"function arrayfile_to_array($filepath) {\n// It is assumed that the file being read is a serialized array (created using array_to_arrayfile)\n $fsize = @filesize($filepath);\n if ($fsize > 0) {\n $fp = fopen($filepath, \"r\");\n $encoded = fread($fp, $fsize);\n fclose($fp);\n return unserialize($encoded);\n } else\n return array();\n}",
"public function GetFileFormatArray()\n {\n }",
"public static function createFromArray(array $fileInfo)\n\t{\n\t\t$file = new File();\n\t\t\n\t\t$file->setName(isset($fileInfo['name'])?$fileInfo['name']:null);\n\t\t$file->setSize(isset($fileInfo['size'])?$fileInfo['size']:0);\n\t\t$file->setType(isset($fileInfo['type'])?$fileInfo['type']:null);\n\t\t$file->setTmpName(isset($fileInfo['tmp_name'])?$fileInfo['tmp_name']:null);\n\t\t$file->setError(isset($fileInfo['error'])?$fileInfo['error']:0);\n\t\t\n\t\treturn $file;\n\t}",
"private function createFilesFromArray($request, $array)\n {\n foreach ($array as $key => $value) {\n if ($file = $this->client->getResourceHandler($value)) {\n $request->files[] = new FileReference([\n 'field' => $key,\n 'file' => $file,\n ]);\n } elseif (is_array($value)) {\n foreach ($value as $id => $_value) {\n if ($file = $this->client->getResourceHandler($_value)) {\n $request->files[] = new FileReference([\n 'field' => $key,\n 'id' => $id,\n 'file' => $file,\n ]);\n }\n }\n }\n }\n }",
"public static function makeFromFile(string $file): array {\n\n // get catalog update identifier\n list($catalogUpdateIdentifier,$suffix) = explode('.',basename($file));\n\n // get date of catalog update (don't use simplexml, the file might be very large)\n $dateOfCatalogUpdate = new Carbon(self::getDateOfCatalogUpdate($file));\n\n // get number of items in file to make a progress bar\n $numberOfItems = substr_count(file_get_contents($file),'<product>');\n $progress = ConsoleOutput::progress($numberOfItems);\n\n // holds all products\n $products = [];\n $productHandler = function($product) use ($progress,&$products,$dateOfCatalogUpdate, $catalogUpdateIdentifier) {\n\n ConsoleOutput::advance($progress);\n\n try {\n // create Object from ONIX message\n $libriProduct = self::create($product);\n\n if(!is_null($libriProduct)) {\n $libriProduct->DateOfData = $dateOfCatalogUpdate;\n $libriProduct->LibriUpdate = $catalogUpdateIdentifier;\n $products[] = $libriProduct;\n }\n\n } catch (MissingDataException $e) {\n ConsoleOutput::error($e->getMessage());\n Log::warning($e->getMessage());\n }\n };\n\n try {\n\n $parser = new Parser(); // create instance of PINOpar Parser\n $parser->setProductHandler($productHandler); // define a product handler which will be called for each <product> tag\n $parser->useFile($file);\n $parser->parse();\n ConsoleOutput::finish($progress);\n\n } catch(PONIpar\\XMLException $e) {\n\n // error in ONIXMessage, e.g. missing <ProductIdentifier>\n // todo: find a way to continue parsing the onixmessage\n ConsoleOutput::error($e->getMessage());\n Log::warning($e->getMessage());\n\n } catch(Exception $e) {\n\n ConsoleOutput::error($e->getMessage());\n Log::error($e->getMessage());\n // todo: find a way to continue parsing after caught exception\n\n }\n\n // clear $products from null values\n $products = array_filter($products, function($item) {\n return !is_null($item);\n });\n\n return $products;\n }",
"function arrayfile_to_array($filepath){\n $fsize = filesize($filepath);\n if ($fsize > 0) {\n $fp = fopen($filepath, \"r\");\n $encoded = fread($fp, $fsize);\n fclose($fp);\n return unserialize($encoded);\n }\n }",
"public static function getAsArray($file)\n\t{\n\t\t$info = self::getInfo($file);\n\t\tif (!$info['exists'] || !$info['readable'])\n\t\t{\n\t\t\tthrow new \\Exception ('File does not exist or is not readable');\n\t\t}\n\t\treturn file($file);\n\n\t}",
"function readFileLinesIntoArray( $fileHandle, $inputArray ){\r\n\twhile (!feof($fileHandle)) { //feof - file, end of file\r\n\t\t$line_of_text = fgets($fileHandle);\r\n\t\tarray_push( $inputArray, $line_of_text );\r\n\t}//end while\r\n\treturn $inputArray;\r\n}",
"function reArrayFiles($file)\n\t\t{\n\t\t $file_ary = array();\n\t\t $file_count = count($file['name']);\n\t\t $file_key = array_keys($file);\n\n\t\t for($i=0;$i<$file_count;$i++)\n\t\t {\n\t\t foreach($file_key as $val)\n\t\t {\n\t\t $file_ary[$i][$val] = $file[$val][$i];\n\t\t }\n\t\t }\n\t\t return $file_ary;\n\t\t}",
"public static function arrayWithContentsOfFile($file_path)\n {\n return new RsoArray(json_decode(file_get_contents($file_path), true));\n }",
"protected function createFileObject(array $array)\n {\n if (! isset($array['name'])) {\n $output = [];\n\n foreach ($array as $key => $values) {\n if (! is_array($values)) {\n continue;\n }\n $output[$key] = $this->createFileObject($values);\n }\n\n return $output;\n }\n\n return new ReplaceUploadedFile(\n $array['tmp_name'] ?? null,\n $array['name'] ?? null,\n $array['type'] ?? null,\n $array['size'] ?? null,\n $array['error'] ?? null\n );\n }",
"private function makeObjects($array) {\n\t\t$ret = array();\n\t\tforeach ($array as $k => $v) {\n\t\t\tif (is_array($v)) {\n\t\t\t\t$ret[$k] = $this->makeObjects($v);\n\t\t\t} else {\n\t\t\t\treturn new UploadedFile($array);\n\t\t\t}\n\t\t}\n\t\treturn $ret;\n\t}",
"function cjpopups_reArrayFiles(&$file_post)\n{\n $file_ary = array();\n $file_count = count($file_post['name']);\n $file_keys = array_keys($file_post);\n\n for ($i=0; $i<$file_count; $i++) {\n foreach ($file_keys as $key) {\n $file_ary[$i][$key] = $file_post[$key][$i];\n }\n }\n return $file_ary;\n}",
"protected function fileProcess($value) {\n $value = (array) file_load($value);\n return array(\n 'id' => $value['fid'],\n 'self' => file_create_url($value['uri']),\n 'filemime' => $value['filemime'],\n 'filesize' => $value['filesize'],\n 'width' => $value['width'],\n 'height' => $value['height'],\n 'styles' => $value['image_styles'],\n );\n }",
"function reArrayFiles(&$file_post) {\n\n $file_ary = array();\n $file_count = count($file_post['name']);\n $file_keys = array_keys($file_post);\n\n for ($i=0; $i<$file_count; $i++) {\n foreach ($file_keys as $key) {\n $file_ary[$i][$key] = $file_post[$key][$i];\n }\n }\n\n return $file_ary;\n}",
"protected function processFileArray($key, $fileInfo)\n {\n if (is_array($fileInfo['name'])) {\n foreach ($fileInfo['name'] as $subKey => $name) {\n if (is_numeric($subKey)) {\n $this->createFile($fileInfo, $key);\n break;\n } elseif (is_array($fileInfo['name'][$subKey])) {\n foreach ($fileInfo['name'][$subKey] as $subSubKey => $subName) {\n $this->createFile($fileInfo, $key, $subKey, $subSubKey);\n }\n } else {\n $this->createFile($fileInfo, $key, $subKey);\n }\n }\n } else {\n $this->createFile($fileInfo, $key);\n }\n }",
"public static function processFile( string $src, ) : array {\n\t\t$mime\t= static::adjustMime( $src );\n\t\t\n\t\treturn [\n\t\t\t'src'\t\t=> $src,\n\t\t\t'mime'\t\t=> $mime,\n\t\t\t'filename'\t=> \\basename( $src ),\n\t\t\t'filesize'\t=> \\filesize( $src ),\n\t\t\t'description'\t=> '',\n\t\t\t\n\t\t\t// Process thumbnail if needed\n\t\t\t'thumbnail'\t=>\n\t\t\t\t\\in_array( $mime, static::$thumbnail_types ) ? \n\t\t\t\tstatic::createThumbnail( $src, $mime ) : ''\n\t\t];\n\t}",
"protected function addFileFieldArray(&$metadata)\n {\n if($metadata['type']==\"text\"){\n $metadata['data']['file'] = [];\n }\n }"
] |
[
"0.6659954",
"0.62189347",
"0.6205825",
"0.6043903",
"0.60436535",
"0.60436535",
"0.60436535",
"0.6043602",
"0.6020455",
"0.5991392",
"0.5946452",
"0.59069204",
"0.59042436",
"0.586646",
"0.58592397",
"0.5858874",
"0.5822001",
"0.5819114",
"0.5796382",
"0.5795307",
"0.57840675",
"0.5695959",
"0.5680779",
"0.56623316",
"0.5624894",
"0.56223",
"0.5615556",
"0.56064975",
"0.5579235",
"0.55589616"
] |
0.65666825
|
1
|
Get the name of the triggering element based on the field name and the input array.
|
protected static function getTriggeringElementName($field_name, $input) {
$triggering_element_name = $field_name . '_' . LANGUAGE_NONE . '_' . (sizeof(
$input
) - 1) . '_upload_button';
return $triggering_element_name;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function get_trigger_name() {\n\t\treturn Clean::string( $this->get_meta( 'trigger_name' ) );\n\t}",
"protected function getInputName(){\n if($this->_name===null)\n $this->defineNameId();\n return $this->_name;\n }",
"public function getElementName();",
"public function get_field_name();",
"public function fieldName($name) {\n\t\treturn self::FORM_NAME.'['.$name.']';\n\t}",
"function getFieldName($n){\n\t\t$field = $this->fields[$n]['Field'];\n\t\treturn $field;\n\t}",
"public function getFieldName($field) {\n return $field['name'];\n }",
"public function getInputName()\n\t{\n\t\treturn $this->inputName;\n\t}",
"public function get_input_name() {\n\t\treturn 'input_' . md5( 'recaptchav3' . gf_recaptcha()->get_version() . $this->formId );\n\t}",
"public function getInputName() {\n return $this->inputName;\n\t }",
"function form__field_id($field) {\n return 'Input' . ucfirst(strtolower(str_replace('_', ' ', str_replace('[', '', str_replace(']', '', $field)))));\n}",
"public function getCustomEventName();",
"public function getFieldName() {}",
"public function getInputNames();",
"function _getFullName() {\n\t\treturn \"document.{$this->form_name}.elements['{$this->field_name}']\";\n\t}",
"public static function getFieldName($field_name)\n {\n preg_match('/\\[([a-zA-Z0-9_-]+)]/', $field_name, $matches);\n return (isset($matches[1])) ? $matches[1] : $field_name;\n }",
"public function getElementName($name);",
"public function get_field_name($field_name) {\n\t\treturn 'widget-' . $this->id_base . '[' . $this->number . '][' . $field_name . ']';\n\t}",
"abstract protected function get_event_name();",
"public function name($field) {\n\t\treturn $field;\n\t}",
"public function get_field_name($field_name)\n {\n }",
"protected function getNameInput()\n {\n return Str::singular(parent::getNameInput());\n }",
"public function getFormName();",
"public function getFormName();",
"public function getDbFieldName($field_name);",
"function get_field_name( $str ){\n\t\treturn 'field-'.$this->id_base.'['.$this->number.']['.$str.']';\n\t}",
"public function getInput($name);",
"abstract protected function getFormName();",
"public function getName()\n {\n return 'formEvent';\n }",
"public function getField($field_name);"
] |
[
"0.6288559",
"0.6186045",
"0.60864276",
"0.6007038",
"0.58979744",
"0.58470035",
"0.5840798",
"0.57785344",
"0.5714716",
"0.5694819",
"0.567604",
"0.5667586",
"0.56617886",
"0.56435",
"0.5627257",
"0.5601392",
"0.55555177",
"0.55555063",
"0.5525391",
"0.5488028",
"0.5476943",
"0.5441131",
"0.5410917",
"0.5410917",
"0.5409888",
"0.5393516",
"0.5362894",
"0.5345913",
"0.5314972",
"0.5299326"
] |
0.7675703
|
0
|
Gets aggregation information for a given object
|
function aggregate_info($object)
{
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function aggregation_info($object)\n{\n}",
"public function getAggregations();",
"public function getAggregate()\n {\n return $this->aggregate;\n }",
"public function getAggregation()\n {\n return $this->aggregation;\n }",
"public function getAggregations()\n {\n return Arr::get($this->meta, 'aggregations', []);\n }",
"public function getAggregations()\n {\n return $this->aggregations;\n }",
"public function GetAggregates(){\n $this->current();\n return $this->aggs;\n }",
"function aggregate($object, $class_name)\n{\n}",
"public function aggregateType();",
"public function getAggregateType();",
"public function getElasticaAggregations()\n {\n return $this->elasticaAggregations;\n }",
"public function getRawAggregation()\n {\n return $this->getFreshAggregation();\n }",
"public function getFreshAggregation()\n {\n // If no aggregation has been specified, return empty array\n if (!$this->aggregation) {\n return array();\n }\n\n // Compile wheres\n $wheres = $this->compileWheres();\n\n // Construct query\n $params = array();\n $params['body']['query']['filtered']['filter'] = $wheres;\n $params['index'] = $this->index;\n $params['type'] = $this->from;\n $params['body']['aggs'] = $this->aggregation;\n\n // Execute query\n $results = $this->connection->search($params);\n\n if (!isset($results['aggregations'])) {\n return [];\n }\n return $results['aggregations'];\n }",
"Public Function GetAggregateStats()\n\t{\n\t\t$Temp = $this->GetAllAdwordsStats();\n\t\t$this->AdwordsTotal = $Temp;\n\t\t$this->AddToTotal($Temp);\n\t\t\n\t\t$Temp = $this->GetAllYahooStats();\n\t\t$this->YahooTotal = $Temp;\n\t\t$this->AddToTotal($Temp);\n\t\t\n\t\t$Temp = $this->GetAllMSNStats();\n\t\t$this->MSNTotal = $Temp;\n\t\t$this->AddToTotal($Temp);\n\t}",
"public function getAggregateMetricResults()\n {\n return $this->aggregate_metric_results;\n }",
"public function getAggregateId()\n {\n return $this->aggregate_id;\n }",
"public function allGoods()\n {\n $query = [];\n $unwind = [\n '$unwind' => '$awards',\n ];\n array_push($query, $unwind);\n $groupBy = [\n '$group' => [\n '_id' => '$awards.items.classification.description',\n 'count' => ['$sum' => 1],\n ],\n ];\n array_push($query, $groupBy);\n $result = OcdsRelease::raw(\n function ($collection) use ($query) {\n return $collection->aggregate($query);\n }\n );\n\n return ($result);\n\n }",
"function statistics_extended_objects_count($object_subtypes,$container_guid=null,$owner_guid=null,$object_type='object'){\r\n\tif(!is_array($object_types)){\r\n\t\t$object_types = array($object_subtypes);\r\n\t}\r\n\t$resp = array();\r\n\tforeach($object_subtypes as $object_subtype){\r\n\t\t$resp[$object_subtype] = statistics_extended_object_count($object_subtype,$owner_guid,$container_guid,$object_type);\r\n\t}\r\n\treturn $resp;\r\n}",
"function statistics_extended_object_count($object_subtype,$owner_guid,$container_guid=null,$object_type='object'){\r\n\t$options = array(\r\n\t\t'types'=>$object_type,\r\n\t\t'subtypes'=>$object_subtype,\r\n\t\t'count'=>true,\r\n\t);\r\n\tif($owner_guid!=null){\r\n\t\t$options['owner_guids']=$owner_guid;\r\n\t}\r\n\tif($container_guid!=null){\r\n\t\t$options['container_guids']=$container_guid;\r\n\t}\r\n\r\n\t$count = elgg_get_entities($options);\r\n\t$count = trigger_plugin_hook(\"cop_statistics:object:count\", \"object\",$options,$count);\r\n\treturn $count;\r\n}",
"public function getGroup ()\n {\n return $this->getObject();\n }",
"static function getUserSummary($obj) {\n // Although the bookings field is not in use,\n // I've kept it to maintain compatibility with current Millenium responses\n\n return [\n 'recordNumber' => self::getAlmaBarCode($obj),\n 'bookings' => \"\",\n 'fines' => self::getField($obj, 'fees'),\n 'holds' => self::getField($obj, 'requests'),\n 'checkedOutItems' => self::getField($obj, 'loans')\n ];\n }",
"protected function get_database_aggregate()\n {\n if (!$this->_database_aggregate)\n {\n require_once DIR_FS_CATALOG . 'includes/modules/payment/payneteasyform/paynet_database_aggregate.php';\n $this->_database_aggregate = new PaynetDatabaseAggregate;\n }\n\n return $this->_database_aggregate;\n }",
"public function select_aggregate($aggregations) {\n\t\t$sql = $this->select(null)->aggregate($aggregations)->sql();\n\t\t$db = $this->db;\n\t\t$results = (array) $db::execute($sql);\n\t\treturn $results[\"fields\"];\n\t}",
"public function aggregation($query) {\n $url = $this->urlWrapper() . URLResources::QUERY_AGGREGATION;\n return $this->makeRequest($url, \"POST\", 0, $query);\n }",
"protected function getGeneralObjectInfo($object)\n {\n return sprintf(\"%s #%s\", get_class($object), spl_object_hash($object));\n }",
"function opensky_get_obj_subcollection_infos(AbstractObject $object) {\n module_load_include('inc', 'islandora_basic_collection', 'includes/utilities');\n\n $params = array(\n 'object' => $object,\n 'page_size' => -1,\n 'model' => \"<info:fedora/islandora:collectionCModel>\",\n );\n\n $map_results = function($o) {\n return array (\n 'pid' => $o['object']['value'],\n 'uri' => $o['object']['uri'],\n 'title' => $o['title']['value'],\n );\n };\n $query_info = islandora_basic_collection_get_query_info($params);\n $results = $object->repository->ri->query($query_info['query'], $query_info['type']);\n return array_map($map_results, $results);\n}",
"public function getChildrenAggregationData()\n {\n $out = [];\n\n $mapping = [\n 'product' => [\n 'properties' => [\n 'title' => [\n 'type' => 'string',\n ],\n ],\n ],\n 'comment' => [\n '_parent' => [\n 'type' => 'product',\n ],\n '_routing' => [\n 'required' => true,\n ],\n 'properties' => [\n 'sub_title' => [\n 'type' => 'string',\n ],\n ],\n ],\n ];\n\n // Case #0 simple terms aggregation.\n $aggregation = new TermsAggregation('test_terms_agg');\n $aggregation->setField('comment.sub_title');\n\n $result = [\n 'doc_count' => 2,\n 'agg_test_terms_agg' => [\n 'buckets' => [\n [\n 'key' => 'bar',\n 'doc_count' => 1,\n ],\n [\n 'key' => 'foo',\n 'doc_count' => 1,\n ],\n ],\n ],\n ];\n\n $out[] = [\n $aggregation,\n $result,\n $mapping,\n ];\n\n return $out;\n }",
"public function hasAggregation() {\n return $this->_has(1);\n }",
"public function getAggregateId()\n {\n }",
"public function &getGroupBy();"
] |
[
"0.7978132",
"0.7067564",
"0.6797081",
"0.6693649",
"0.65677035",
"0.64635307",
"0.64427024",
"0.64077115",
"0.5940156",
"0.59228295",
"0.5869769",
"0.58090305",
"0.5767733",
"0.5715524",
"0.5583498",
"0.5509671",
"0.5475969",
"0.5464699",
"0.5408493",
"0.54033256",
"0.5374575",
"0.5343084",
"0.5340923",
"0.53197336",
"0.5292246",
"0.52836466",
"0.52788675",
"0.5272037",
"0.52530026",
"0.5208798"
] |
0.7609567
|
1
|
Gets aggregation information for a given object
|
function aggregation_info($object)
{
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function aggregate_info($object)\n{\n}",
"public function getAggregations();",
"public function getAggregate()\n {\n return $this->aggregate;\n }",
"public function getAggregation()\n {\n return $this->aggregation;\n }",
"public function getAggregations()\n {\n return Arr::get($this->meta, 'aggregations', []);\n }",
"public function getAggregations()\n {\n return $this->aggregations;\n }",
"public function GetAggregates(){\n $this->current();\n return $this->aggs;\n }",
"function aggregate($object, $class_name)\n{\n}",
"public function aggregateType();",
"public function getAggregateType();",
"public function getElasticaAggregations()\n {\n return $this->elasticaAggregations;\n }",
"public function getRawAggregation()\n {\n return $this->getFreshAggregation();\n }",
"public function getFreshAggregation()\n {\n // If no aggregation has been specified, return empty array\n if (!$this->aggregation) {\n return array();\n }\n\n // Compile wheres\n $wheres = $this->compileWheres();\n\n // Construct query\n $params = array();\n $params['body']['query']['filtered']['filter'] = $wheres;\n $params['index'] = $this->index;\n $params['type'] = $this->from;\n $params['body']['aggs'] = $this->aggregation;\n\n // Execute query\n $results = $this->connection->search($params);\n\n if (!isset($results['aggregations'])) {\n return [];\n }\n return $results['aggregations'];\n }",
"Public Function GetAggregateStats()\n\t{\n\t\t$Temp = $this->GetAllAdwordsStats();\n\t\t$this->AdwordsTotal = $Temp;\n\t\t$this->AddToTotal($Temp);\n\t\t\n\t\t$Temp = $this->GetAllYahooStats();\n\t\t$this->YahooTotal = $Temp;\n\t\t$this->AddToTotal($Temp);\n\t\t\n\t\t$Temp = $this->GetAllMSNStats();\n\t\t$this->MSNTotal = $Temp;\n\t\t$this->AddToTotal($Temp);\n\t}",
"public function getAggregateMetricResults()\n {\n return $this->aggregate_metric_results;\n }",
"public function getAggregateId()\n {\n return $this->aggregate_id;\n }",
"public function allGoods()\n {\n $query = [];\n $unwind = [\n '$unwind' => '$awards',\n ];\n array_push($query, $unwind);\n $groupBy = [\n '$group' => [\n '_id' => '$awards.items.classification.description',\n 'count' => ['$sum' => 1],\n ],\n ];\n array_push($query, $groupBy);\n $result = OcdsRelease::raw(\n function ($collection) use ($query) {\n return $collection->aggregate($query);\n }\n );\n\n return ($result);\n\n }",
"function statistics_extended_objects_count($object_subtypes,$container_guid=null,$owner_guid=null,$object_type='object'){\r\n\tif(!is_array($object_types)){\r\n\t\t$object_types = array($object_subtypes);\r\n\t}\r\n\t$resp = array();\r\n\tforeach($object_subtypes as $object_subtype){\r\n\t\t$resp[$object_subtype] = statistics_extended_object_count($object_subtype,$owner_guid,$container_guid,$object_type);\r\n\t}\r\n\treturn $resp;\r\n}",
"function statistics_extended_object_count($object_subtype,$owner_guid,$container_guid=null,$object_type='object'){\r\n\t$options = array(\r\n\t\t'types'=>$object_type,\r\n\t\t'subtypes'=>$object_subtype,\r\n\t\t'count'=>true,\r\n\t);\r\n\tif($owner_guid!=null){\r\n\t\t$options['owner_guids']=$owner_guid;\r\n\t}\r\n\tif($container_guid!=null){\r\n\t\t$options['container_guids']=$container_guid;\r\n\t}\r\n\r\n\t$count = elgg_get_entities($options);\r\n\t$count = trigger_plugin_hook(\"cop_statistics:object:count\", \"object\",$options,$count);\r\n\treturn $count;\r\n}",
"public function getGroup ()\n {\n return $this->getObject();\n }",
"static function getUserSummary($obj) {\n // Although the bookings field is not in use,\n // I've kept it to maintain compatibility with current Millenium responses\n\n return [\n 'recordNumber' => self::getAlmaBarCode($obj),\n 'bookings' => \"\",\n 'fines' => self::getField($obj, 'fees'),\n 'holds' => self::getField($obj, 'requests'),\n 'checkedOutItems' => self::getField($obj, 'loans')\n ];\n }",
"protected function get_database_aggregate()\n {\n if (!$this->_database_aggregate)\n {\n require_once DIR_FS_CATALOG . 'includes/modules/payment/payneteasyform/paynet_database_aggregate.php';\n $this->_database_aggregate = new PaynetDatabaseAggregate;\n }\n\n return $this->_database_aggregate;\n }",
"public function select_aggregate($aggregations) {\n\t\t$sql = $this->select(null)->aggregate($aggregations)->sql();\n\t\t$db = $this->db;\n\t\t$results = (array) $db::execute($sql);\n\t\treturn $results[\"fields\"];\n\t}",
"public function aggregation($query) {\n $url = $this->urlWrapper() . URLResources::QUERY_AGGREGATION;\n return $this->makeRequest($url, \"POST\", 0, $query);\n }",
"protected function getGeneralObjectInfo($object)\n {\n return sprintf(\"%s #%s\", get_class($object), spl_object_hash($object));\n }",
"function opensky_get_obj_subcollection_infos(AbstractObject $object) {\n module_load_include('inc', 'islandora_basic_collection', 'includes/utilities');\n\n $params = array(\n 'object' => $object,\n 'page_size' => -1,\n 'model' => \"<info:fedora/islandora:collectionCModel>\",\n );\n\n $map_results = function($o) {\n return array (\n 'pid' => $o['object']['value'],\n 'uri' => $o['object']['uri'],\n 'title' => $o['title']['value'],\n );\n };\n $query_info = islandora_basic_collection_get_query_info($params);\n $results = $object->repository->ri->query($query_info['query'], $query_info['type']);\n return array_map($map_results, $results);\n}",
"public function getChildrenAggregationData()\n {\n $out = [];\n\n $mapping = [\n 'product' => [\n 'properties' => [\n 'title' => [\n 'type' => 'string',\n ],\n ],\n ],\n 'comment' => [\n '_parent' => [\n 'type' => 'product',\n ],\n '_routing' => [\n 'required' => true,\n ],\n 'properties' => [\n 'sub_title' => [\n 'type' => 'string',\n ],\n ],\n ],\n ];\n\n // Case #0 simple terms aggregation.\n $aggregation = new TermsAggregation('test_terms_agg');\n $aggregation->setField('comment.sub_title');\n\n $result = [\n 'doc_count' => 2,\n 'agg_test_terms_agg' => [\n 'buckets' => [\n [\n 'key' => 'bar',\n 'doc_count' => 1,\n ],\n [\n 'key' => 'foo',\n 'doc_count' => 1,\n ],\n ],\n ],\n ];\n\n $out[] = [\n $aggregation,\n $result,\n $mapping,\n ];\n\n return $out;\n }",
"public function hasAggregation() {\n return $this->_has(1);\n }",
"public function getAggregateId()\n {\n }",
"public function &getGroupBy();"
] |
[
"0.7609567",
"0.7067564",
"0.6797081",
"0.6693649",
"0.65677035",
"0.64635307",
"0.64427024",
"0.64077115",
"0.5940156",
"0.59228295",
"0.5869769",
"0.58090305",
"0.5767733",
"0.5715524",
"0.5583498",
"0.5509671",
"0.5475969",
"0.5464699",
"0.5408493",
"0.54033256",
"0.5374575",
"0.5343084",
"0.5340923",
"0.53197336",
"0.5292246",
"0.52836466",
"0.52788675",
"0.5272037",
"0.52530026",
"0.5208798"
] |
0.7978132
|
0
|
Checks whether an entity is registered in the identity map of this UnitOfWork.
|
public function isInIdentityMap($entity)
{
$oid = spl_object_hash($entity);
if (!isset($this->entityIdentifiers[$oid])) {
return false;
}
/** @var EntityMetadata $classMetadata */
$classMetadata = $this->manager->getClassMetadata(get_class($entity));
$idHash = implode(' ', $this->entityIdentifiers[$oid]);
if ($idHash === '') {
return false;
}
return isset($this->identityMap[$classMetadata->rootEntityName][$idHash]);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"protected function _hasIdentity($id) {\r\n \treturn array_key_exists($id, $this->_identityMap);\r\n }",
"public function hasIdentity() : bool\n {\n return !empty($this->identity);\n }",
"public static function hasIdentity() {\n\t\treturn Core_Store::has('identity');\n\t}",
"public function hasIdentity()\r\n {\r\n return $this->getAuthService()->hasIdentity();\r\n }",
"public function hasIdentity() {\n return $this->authenticate()->getIdentity() !== NULL;\n }",
"public function hasIdentity()\n {\n return $this->_auth->hasIdentity();\n }",
"public function isInIdentityMap($document)\n {\n $oid = spl_object_hash($document);\n if ( ! isset($this->documentIdentifiers[$oid])) {\n return false;\n }\n $classMetadata = $this->dm->getClassMetadata(get_class($document));\n $id = $this->documentIdentifiers[$oid];\n if ( ! $classMetadata->isEmbeddedDocument) {\n $id = $classMetadata->getPHPIdentifierValue($id);\n }\n if ($id === '') {\n return false;\n }\n\n return isset($this->identityMap[$classMetadata->rootDocumentName][$id]);\n }",
"public function hasIdentity()\n {\n return !empty($this->storage[$this->storageKey]);\n }",
"public function isInIdentityMap(object $object): bool\n {\n return $this->objectIdentityMap->contains($object);\n }",
"public function isRegistered(){\n return isset($this->data['id']);\n }",
"public function entityExists($entity)\n {\n return $this->getEntityIdentifier($entity) ? true : false;\n }",
"public function hasId(): bool\n {\n return $this->getEntityDao()->hasId();\n }",
"public function exists($entity): bool;",
"public function addToIdentityMap($entity)\n {\n /** @var EntityMetadata $classMetadata */\n $classMetadata = $this->manager->getClassMetadata(get_class($entity));\n $idHash = implode(' ', $this->entityIdentifiers[spl_object_hash($entity)]);\n\n if ($idHash === '') {\n throw new \\InvalidArgumentException('Entitty does not have valid identifiers to be stored at identity map');\n }\n\n $className = $classMetadata->rootEntityName;\n\n if (isset($this->identityMap[$className][$idHash])) {\n return false;\n }\n\n $this->identityMap[$className][$idHash] = $entity;\n\n return true;\n }",
"public function hasIdentity($provider = null)\n {\n return !$this->getStorage()->isEmpty($provider);\n }",
"public function hasIdentity()\n {\n return $this->modelSession && $this->modelSession['id']\n ? true : false;\n }",
"public function isScheduledForInsert($entity)\n {\n return isset($this->entityInsertions[spl_object_hash($entity)]);\n }",
"public function check ()\n\t{\n\t\treturn !empty($this->getIdentity());\n\t}",
"public function valid()\n {\n return key($this->entities) !== null;\n }",
"public function contains(Storable $entity): bool\n {\n return in_array($entity, $this->registry, true);\n }",
"public static function hasAssociatedEntity()\n {\n return static::$associatedEntity !== null;\n }",
"public function isEntityIdInUse($entityid, &$message)\n {\n // Check if the entity id is already used on letest revision\n $st = $this->execute(\n 'SELECT count(*) AS count\n FROM '. self::$prefix .'entity je\n WHERE `entityid` = ?\n AND `revisionid` = (SELECT MAX(revisionid) FROM '.self::$prefix.'entity WHERE eid = je.eid);',\n array($entityid)\n );\n\n // @todo It would be better to let db class throw an exception\n if ($st === false) {\n $message = 'error_db';\n return true;\n }\n\n $row = $st->fetchAll(PDO::FETCH_ASSOC);\n if ($row[0]['count'] > 0) {\n $message = 'error_entity_exists';\n return true;\n }\n\n return false;\n }",
"public function hasEntity($name);",
"public function validateGiftregistryEntityAction()\n {\n $id = $this->_request->getParam('id', $this->_request->getParam('entity_id'));\n if ($id) {\n $websiteId = $this->_objectManager->create(\n \\Magento\\GiftRegistry\\Model\\Entity::class\n )->getResource()->getWebsiteIdByEntityId(\n $id\n );\n if (!in_array($websiteId, $this->_role->getWebsiteIds())) {\n $this->_forward();\n return false;\n }\n } else {\n $this->_forward();\n return false;\n }\n return true;\n }",
"public function exist(BaseEntity $entity): bool\n {\n return $this->entityManager\n ->getRepository($entity->getClassName())\n ->find($entity) ? true : false;\n }",
"public function hasEntitiesList()\n {\n return $this->Entities !== null;\n }",
"public function removeFromIdentityMap($entity)\n {\n $oid = spl_object_hash($entity);\n $classMetadata = $this->manager->getClassMetadata(get_class($entity));\n $idHash = implode(' ', $this->entityIdentifiers[$oid]);\n if ($idHash === '') {\n throw new \\InvalidArgumentException('Entity has no identity');\n }\n $className = $classMetadata->getRootEntityName();\n if (isset($this->identityMap[$className][$idHash])) {\n unset($this->identityMap[$className][$idHash]);\n unset($this->readOnlyObjects[$oid]);\n\n //$this->entityStates[$oid] = self::STATE_DETACHED;\n return true;\n }\n\n return false;\n }",
"public function hasId()\n {\n return $this->id !== null;\n }",
"public function hasIdentity() {\n $objAuth = Zend_Auth::getInstance();\n \n // Verifica se já está autenticado\n if ($objAuth->hasIdentity()) {\n \treturn true;\n } else {\n \tif(Zf_Util_Cookie::cookieExists( Zend_Registry::get('admin_config')->resources->cookie->name )) {\n \t\t\n \t}\n }\n }",
"public function hasId(): bool\n {\n return $this->id !== null;\n }"
] |
[
"0.668908",
"0.6675529",
"0.6666879",
"0.66195655",
"0.65654486",
"0.6562997",
"0.6448229",
"0.6399473",
"0.63772565",
"0.6297024",
"0.624825",
"0.62006736",
"0.6179675",
"0.61719424",
"0.61330223",
"0.61286944",
"0.6080472",
"0.6072597",
"0.606885",
"0.59992844",
"0.59635013",
"0.59447247",
"0.5868298",
"0.577957",
"0.572738",
"0.57237023",
"0.571971",
"0.57111424",
"0.5686998",
"0.56764895"
] |
0.7468485
|
0
|
INTERNAL: Registers an entity as managed.
|
public function registerManaged($entity, array $id, \stdClass $data = null)
{
$oid = spl_object_hash($entity);
$this->entityIdentifiers[$oid] = $id;
$this->entityStates[$oid] = self::STATE_MANAGED;
$this->originalEntityData[$oid] = $data;
$this->addToIdentityMap($entity);
if ($entity instanceof NotifyPropertyChanged && (!$entity instanceof Proxy || $entity->__isInitialized())) {
$entity->addPropertyChangedListener($this);
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"protected function manageEntity($entity) {\n\t\t$primaryKey = $this->getPrimaryKey($entity);\n\t\t$key = $this->getEntityKey(get_class($entity), $primaryKey);\n\n\t\tif (isset($this->managedEntities[$key])) {\n\t\t\t$managedEntity = $this->managedEntities[$key];\n\t\t}\n\t\telse {\n\t\t\t$managedEntity = new Customweb_Database_Entity_ManagedEntity();\n\t\t\t$this->managedEntities[$key] = $managedEntity;\n\t\t}\n\n\t\t$managedEntity->setEntity($entity)->setEntityPrimaryKey($primaryKey)->setEntityValues($this->getDatabaseValuesFromEntity($entity));\n\t\treturn $managedEntity;\n\t}",
"public function persist($entity)\n {\n }",
"public function postPersist($entity);",
"public function prePersist($entity);",
"abstract public function store(Entity $oMappedEntity);",
"public function registerManaged($document, $id, array $data)\n {\n $oid = spl_object_hash($document);\n if ($id === null) {\n $this->documentIdentifiers[$oid] = $oid;\n } else {\n $this->documentIdentifiers[$oid] = $id;\n }\n $this->documentStates[$oid] = self::STATE_MANAGED;\n $this->originalDocumentData[$oid] = $data;\n $this->addToIdentityMap($document);\n }",
"public function onEntityRepositoryAttach(IEntity $entity): void;",
"public function add($entity)\n {\n $this->getObjectManager()->persist($entity);\n $this->getObjectManager()->flush();\n }",
"public function add($entity, $flush = false);",
"protected function persist($entity)\n {\n if (!$this->em()->isOpen()) {\n $this->getDoctrine()->resetManager();\n }\n\n $this->em()->persist($entity);\n $this->em()->flush();\n\n }",
"public function saveEntity($entity)\n\t{\n\t\t$entityManager = $this->getDoctrine()->getManager();\n\t $entityManager->persist($entity);\n\t $entityManager->flush();\n\t}",
"public function pushEntity($entity): void\n {\n /** @var EntityRepository $repository */\n $repository = Prime::repository($entity);\n $mapper = $repository->mapper();\n\n $isReadOnly = $mapper->isReadOnly();\n $mapper->setReadOnly(false);\n\n $repository->disableEventNotifier();\n $repository->insert($entity);\n $repository->enableEventNotifier();\n\n $mapper->setReadOnly($isReadOnly);\n }",
"public function addPersistEntity($entity)\n {\n $this->persistEntities[] = $entity;\n }",
"public function onEntityAttach(IEntity $entity): void;",
"public function add(object $entity): void\n {\n }",
"public function saveModel($entity){\n $this->entityManager->persist($entity);\n $this->entityManager->flush();\n }",
"protected function persistAndFlush($entity)\n\t{\n\t\t$this->em->persist($entity);\n\t\t$this->em->flush();\n\t}",
"public function addEntity($entity) {\n $this->entityManager->merge($entity);\n $this->entityManager->flush();\n }",
"private function createEntity()\n {\n $this->entity = $this->container->make($this->entity());\n }",
"protected function saveEntity($entity)\n {\n $this->om->persist($entity);\n $this->om->flush($entity);\n }",
"public function persist($entity)\n {\n $visited = [];\n $this->doPersist($entity, $visited);\n }",
"protected function persistAndFlush($entity)\n {\n $this->persist($entity);\n $this->flush();\n }",
"public function update($entity)\n {\n $this->getObjectManager()->persist($entity);\n $this->getObjectManager()->flush();\n }",
"public function persistEntity($obj)\n\t{\n\t\t$this->db->persistEntity($obj);\n\t}",
"public function add($entity)\n {\n $entity->setMarkedAsUpdated(true);\n $this->entities[] = $entity;\n }",
"protected function saveNew($entity)\n {\n $this->em->persist($entity);\n $this->update();\n }",
"public function add($entity);",
"function pcptab_civicrm_managed(&$entities) {\n _pcptab_civix_civicrm_managed($entities);\n}",
"public function persist()\n {\n\n $this->persistor->persist(\n $this->event,\n $this->relatedEntities,\n $this->eventRequest->getApplication(),\n $this->eventRequest->getAccount(),\n $this->eventRequest->getProduct(),\n $this->eventRequest->appendCustomer\n );\n\n }",
"public function persist(Entity\\Base $entity)\n {\n $this->getEntityManager()->persist($entity);\n }"
] |
[
"0.6636056",
"0.637053",
"0.6343942",
"0.6319556",
"0.61010575",
"0.60283864",
"0.59603876",
"0.5879334",
"0.58499306",
"0.5815679",
"0.58040404",
"0.57976866",
"0.5773069",
"0.577154",
"0.57192945",
"0.57081985",
"0.5707316",
"0.5650304",
"0.56032914",
"0.55732864",
"0.556935",
"0.5559421",
"0.5550352",
"0.55277556",
"0.55253124",
"0.5484108",
"0.5475784",
"0.5465657",
"0.54624116",
"0.545727"
] |
0.7063601
|
0
|
INTERNAL: Registers an entity in the identity map. Note that entities in a hierarchy are registered with the class name of the root entity.
|
public function addToIdentityMap($entity)
{
/** @var EntityMetadata $classMetadata */
$classMetadata = $this->manager->getClassMetadata(get_class($entity));
$idHash = implode(' ', $this->entityIdentifiers[spl_object_hash($entity)]);
if ($idHash === '') {
throw new \InvalidArgumentException('Entitty does not have valid identifiers to be stored at identity map');
}
$className = $classMetadata->rootEntityName;
if (isset($this->identityMap[$className][$idHash])) {
return false;
}
$this->identityMap[$className][$idHash] = $entity;
return true;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"protected function _setIdentity($id, $entity) {\r\n\t\tif (!$this->_hasIdentity($id)) {\r\n\t\t\t$this->_identityMap[$id] = $entity;\r\n\t\t}\r\n\t}",
"public function register(IEntity &$entity) {\n\t\tif ($entity->getId() == NULL) {\n\t\t\tthrow new InvalidArgumentException(\"The entity has no ID, so it can not be registered.\");\n\t\t}\n\t\tif ($this->isRegistered($entity->getId())) {\n\t\t\tthrow new InvalidStateException(\"The entity with id [\".$entity->getId().\"] is already registered.\");\n\t\t}\n\t\t$this->registered[$entity->getId()] = $entity;\n\t}",
"public function registerManaged($entity, array $id, \\stdClass $data = null)\n {\n $oid = spl_object_hash($entity);\n\n $this->entityIdentifiers[$oid] = $id;\n $this->entityStates[$oid] = self::STATE_MANAGED;\n $this->originalEntityData[$oid] = $data;\n\n $this->addToIdentityMap($entity);\n\n if ($entity instanceof NotifyPropertyChanged && (!$entity instanceof Proxy || $entity->__isInitialized())) {\n $entity->addPropertyChangedListener($this);\n }\n }",
"public static function StoreById($entity)\n {\n if(!isset(StorageManager::$entities[$entity->Alias]))\n {\n StorageManager::$entities[$entity->Alias] = array();\n }\n\n StorageManager::$entities[$entity->Alias][$entity->IdEntite] = $entity;\n }",
"public static function registerEntity( $handle, $id, array $entity = null ) {\n\t\tself::$activeHandles[ $handle ] = $id;\n\t\tself::$activeIds[ $id ] = $handle;\n\t\tif ( $entity ) {\n\t\t\tself::$entityOutput[ $handle ] = $entity;\n\t\t}\n\t}",
"abstract public function store(Entity $oMappedEntity);",
"public function persist($entity)\n {\n $visited = [];\n $this->doPersist($entity, $visited);\n }",
"public function add($entity)\r\n {\r\n \t$cacheKey = $this->getCacheKey($entity->getPrimaryKey());\r\n \t$this->_entities[$cacheKey] = $entity;\r\n }",
"function entityID($entity){\n\t\t$entity = strtolower($entity);\n\t\t// Check local copy\n\t\tif(in_array($entity,$this->entities)) return $this->entities[$entity];\n\t\t\n\t\t// Check DB\n\t\tglobal $sess;\n\t\t$db = $sess->db();\n\t\t$entityID = $db->queryUniqueValue('SELECT id FROM `entities` WHERE `name` LIKE \\''.addslashes($entity).'\\'');\n\t\tif(!$entityID){\n\t\t\t// Create new entity\n\t\t\t$db->preparedInsert('entities',array('name'=>$entity));\n\t\t\t$entityID = $db->lastInsertedId();\n\t\t}\n\t\t// Store in local cache\n\t\t$this->entities[$entity] = $entityID;\t\n\t\treturn $entityID;\n\t}",
"public function registerEntityClass(string $tableName, string $className): void\n {\n $this->ensureNameMapsLoaded();\n\n $this->tableToClassesMap[$tableName][] = $className;\n $this->classToTableMap[$className] = $tableName;\n }",
"public function associate($entity)\n {\n // The Mapper will retrieve this association within the object model, we won't be using\n // the foreign key attribute inside the parent Entity.\n //\n //$this->parent->setEntityAttribute($this->foreignKey, $entity->getEntityAttribute($this->otherKey));\n //\n // Instead, we'll just add the object to the Entity's attribute\n\n $this->parent->setEntityAttribute($this->relation, $entity->getEntityObject());\n }",
"public function add($entity);",
"public function persist($entity)\n {\n }",
"public function prePersist($entity);",
"function jo($entity) {\n $entity->setEntityId(($entity->getEntityId() +1));\n }",
"public function add(object $entity): void\n {\n }",
"public static function Store($entity, $entities)\n {\n $key = StorageManager::GetKey($entity);\n\n if(!isset(StorageManager::$entities[$entity->Alias]))\n {\n StorageManager::$entities[$entity->Alias] = array();\n }\n\n StorageManager::$entities[$entity->Alias][$key] = $entities;\n }",
"public function addEntity($entity) {\n $this->entityManager->merge($entity);\n $this->entityManager->flush();\n }",
"public function add($entity)\n {\n $this->getObjectManager()->persist($entity);\n $this->getObjectManager()->flush();\n }",
"public function addEntity(Entity $entity): void\n {\n $this->entities[] = $entity;\n }",
"public function addPersistEntity($entity)\n {\n $this->persistEntities[] = $entity;\n }",
"public function pushEntity($entity): void\n {\n /** @var EntityRepository $repository */\n $repository = Prime::repository($entity);\n $mapper = $repository->mapper();\n\n $isReadOnly = $mapper->isReadOnly();\n $mapper->setReadOnly(false);\n\n $repository->disableEventNotifier();\n $repository->insert($entity);\n $repository->enableEventNotifier();\n\n $mapper->setReadOnly($isReadOnly);\n }",
"public function Add($entity) {\n }",
"public function register()\n {\n foreach ($this->entities as $entity) {\n $this->{'bind' . $entity . 'Repository'}();\n }\n }",
"public function persist(IEntity $entity): void\n\t{\n\t\t$this->beginTransaction();\n\t\t$data = $this->entityToArray($entity);\n\t\t$data = $this->getConventions()->convertEntityToStorage($data);\n\n\t\tif (!$entity->isPersisted()) {\n\t\t\t$this->processInsert($entity, $data);\n\n\t\t} else {\n\t\t\t$primary = [];\n\t\t\t$id = (array) $entity->getPersistedId();\n\t\t\tforeach ($entity->getMetadata()->getPrimaryKey() as $key) {\n\t\t\t\t$primary[$key] = array_shift($id);\n\t\t\t}\n\t\t\t$primary = $this->getConventions()->convertEntityToStorage($primary);\n\n\t\t\t$this->processUpdate($entity, $data, $primary);\n\t\t}\n\t}",
"public function Add(&$entity)\n {\n \n }",
"public function postPersist($entity);",
"public function registerRealformByIdentifier(string $identifier);",
"public function add($entity, $flush = false);",
"public function setEntity( $entity )\n {\n \n $this->entity = $entity;\n \n }"
] |
[
"0.6522343",
"0.64110535",
"0.63374376",
"0.6332165",
"0.6260412",
"0.59668255",
"0.5817355",
"0.5755678",
"0.5683277",
"0.5683215",
"0.5667081",
"0.5665453",
"0.55974174",
"0.55548805",
"0.5552634",
"0.55501425",
"0.55439764",
"0.55387795",
"0.5502401",
"0.54966146",
"0.5488247",
"0.54701567",
"0.5458401",
"0.5444019",
"0.54429966",
"0.5414741",
"0.5412599",
"0.53051406",
"0.5295261",
"0.5270754"
] |
0.6772329
|
0
|
Gets the original data of an entity. The original data is the data that was present at the time the entity was reconstituted from the database.
|
public function getOriginalEntityData($entity)
{
$oid = spl_object_hash($entity);
if (isset($this->originalEntityData[$oid])) {
return $this->originalEntityData[$oid];
}
return [];
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getOriginalData(): array\n {\n return $this->originalData;\n }",
"public function getOriginal()\n {\n return $this->original;\n }",
"public function getOriginal() {\n return $this->original;\n }",
"public function getEntityClone()\n {\n return $this->entity;\n }",
"public function getOriginalData($key = null) {\n return SL::getDeepArrayValue($this->_original_data, $key);\n }",
"public function getOriginalEntity(): ?EntityInterface {\n return $this->entity->original ?? NULL;\n }",
"public function backupOriginalAttributes()\n {\n $this->backup_original = $this->getRawOriginal() ?: [];\n\n return $this->getOriginal();\n }",
"function getOriginal()\n {\n }",
"protected function getOriginalAll()\n {\n return $this->original;\n }",
"protected static function old_data(): mixed\n\t{\n\t\treturn self::$query->old_data;\n\t}",
"public function getRevisionData()\n {\n return $this->getData();\n }",
"protected function getTransformedData()\n {\n return $this->transformedData;\n }",
"public function getOriginalModelInfo()\n {\n return $this->original_model_info;\n }",
"public function getOriginalDocumentData($document)\n {\n $oid = spl_object_hash($document);\n if (isset($this->originalDocumentData[$oid])) {\n return $this->originalDocumentData[$oid];\n }\n return array();\n }",
"function fetch_data_old()\n\t{\n\t\treturn $this->data_old;\n\t}",
"abstract protected function getOriginalContent();",
"function getEntity() {\n if (!empty($this->entity_id) && !empty($this->entity_type) && entity_get_info($this->entity_type)) {\n // Create an array because array_shift passes in by reference.\n $entities = entity_load($this->entity_type, array($this->entity_id));\n return array_shift($entities);\n }\n }",
"public function getOldData()\n {\n return $this->oldPhone;\n }",
"public function getOriginalInstance()\n {\n return $this->imageObj;\n }",
"public function getOriginalContentField()\n {\n $model = $this->owner->getCustomisedObj();\n if (!$model) {\n $model = $this->owner->data();\n }\n if (!$model) {\n return null;\n }\n\n $field = $this->contentField();\n if (!$model->hasField($field)) {\n return null;\n }\n\n return $model->getField($field);\n }",
"public function get_data() {\n $data = parent::get_data();\n if ($data !== null) {\n }\n return $data;\n }",
"public function getOriginalAmount()\n {\n return $this->originalAmount;\n }",
"private function getData()\n {\n if (isset($this->data)) {\n return $this->data;\n }\n\n return $this->data = Entry::find($this->context->get('id'));\n }",
"public function getData()\n {\n $data = parent::getData();\n\n return $data;\n }",
"public function getNormalizedData()\n {\n return parent::getNormalizedData();\n }",
"public function getSavedData()\n {\n\n return $this->savedData;\n\n }",
"public function getReconstitutedEntities() {}",
"public function getOriginalFileContent()\n {\n return $this->originalFileContent;\n }",
"public function dataModified()\n\t{\n\t\treturn $this->_dataModified;\n\t}",
"public function getOriginalTable() {}"
] |
[
"0.73852265",
"0.7259668",
"0.724517",
"0.682989",
"0.6662281",
"0.65547687",
"0.65545535",
"0.6517549",
"0.6515324",
"0.6491624",
"0.643813",
"0.641724",
"0.6384538",
"0.63562614",
"0.6303087",
"0.6195125",
"0.6190197",
"0.60893416",
"0.6074006",
"0.6031239",
"0.6006399",
"0.59943",
"0.5969051",
"0.5963699",
"0.59592086",
"0.5941529",
"0.5923694",
"0.59110427",
"0.59072083",
"0.58893317"
] |
0.7742355
|
0
|
Notifies this UnitOfWork of a property change in an entity.
|
public function propertyChanged($entity, $propertyName, $oldValue, $newValue)
{
$oid = spl_object_hash($entity);
$class = $this->manager->getClassMetadata(get_class($entity));
$isAssocField = $class->hasAssociation($propertyName);
if (!$isAssocField && !$class->hasField($propertyName)) {
return; // ignore non-persistent fields
}
// Update changeset and mark entity for synchronization
$this->entityChangeSets[$oid][$propertyName] = [$oldValue, $newValue];
if (!isset($this->scheduledForSynchronization[$class->getRootEntityName()][$oid])) {
$this->scheduleForDirtyCheck($entity);
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function propertyChanged(object $sender, string $propertyName, $oldValue, $newValue);",
"public function updated($property)\n {\n $this->validateOnly($property);\n }",
"public function propertyChanged($document, $propertyName, $oldValue, $newValue)\n {\n $oid = spl_object_hash($document);\n $class = $this->dm->getClassMetadata(get_class($document));\n\n if ( ! isset($class->fieldMappings[$propertyName])) {\n return; // ignore non-persistent fields\n }\n\n // Update changeset and mark document for synchronization\n $this->documentChangeSets[$oid][$propertyName] = array($oldValue, $newValue);\n if ( ! isset($this->scheduledForDirtyCheck[$class->rootDocumentName][$oid])) {\n $this->scheduleForDirtyCheck($document);\n }\n }",
"public function propertyChanged(object $object, string $propertyName, mixed $oldValue, mixed $newValue): void\n {\n if (! $this->isInIdentityMap($object)) {\n return;\n }\n\n if (! $this->isScheduledForUpdate($object)) {\n $this->update($object);\n }\n\n $this->objectChangeSets->addObjectChange(\n $object,\n new Change($propertyName, $oldValue, $newValue),\n );\n }",
"private function changed()\n {\n $this->isDirty = true;\n }",
"public function onFlush($entity, $uowEntityState, UnitOfWork $uow);",
"protected function notify($event, WorkflowEntityInterface $entity)\n {\n foreach ($this->observers as $observer) {\n $observer->$event($entity);\n }\n }",
"public function setChanged(\\DateTime $changed)\n {\n $this->entity->setChanged($changed);\n }",
"public function identifierChanged($sender, $propertyName, $oldValue, $newValue): void;",
"function notify()\n {\n foreach ($this->observers as $obKey => $obValue) {\n $obValue->update($this);\n }\n }",
"public function __set($property, $value)\n {\n switch ($property) {\n\n case 'name':\n if(!empty($value) && is_string($value)) {\n $this->name = $value;\n $this->changed = true;\n break;\n } else {\n echo 'Wrong type of property, it should be string';\n break;\n }\n \n case 'status':\n if(!empty($value) && is_int($value)) {\n $this->status = $value;\n $this->changed = true;\n break;\n } else {\n echo 'Wrong type of property, it should be integer';\n break;\n }\n \n }\n }",
"public function setChanged()\n {\n\n $this->_changed = true;\n\n }",
"public function measurementsChanged()\n {\n $this->notifyObservers();\n }",
"public function __set($property, $value) {}",
"public function setChanged($changed = true) { $this->changed = $changed; }",
"public function hasChanged($fieldName=null) {}",
"public function notify()\n {\n foreach ($this->observers as $value) {\n $value->update($this);\n }\n }",
"public function measurementsChanged(): void\n {\n $this->notifyObservers();\n }",
"protected final function _markModified()\n {\n DomainWatcher::addModifiedObject($this);\n }",
"public function appendAffectedObjectProperty(PropertyInterface $property)\n {\n $this->affectedObjectProperties[] = $property;\n }",
"public function setChanged($changed) {\n $this->changed = $changed;\n }",
"public function onFlush(OnFlushEventArgs $event) {\n\n $em = $event->getEntityManager();\n $uow = $em->getUnitOfWork();\n\n foreach($uow->getScheduledEntityUpdates() as $entity) {\n\n if($entity instanceof SaleEntity || $entity instanceof SaleItemEntity) {\n\n $changeSet = $uow->getEntityChangeSet($entity);\n\n // Add state change/transition record.\n if(isset($changeSet['state'][1]) && $changeSet['state'][0]->getId() != $changeSet['state'][1]->getId()) {\n\n $beforeState = $changeSet['state'][0];\n $afterState = $changeSet['state'][1];\n\n if($entity instanceof SaleEntity) {\n $transition = new SaleWorkflowTransition();\n $transition->setSale($entity);\n } else {\n $transition = new SaleItemWorkflowTransition();\n $transition->setSaleItem($entity);\n }\n\n $transition->setBeforeState($beforeState);\n $transition->setAfterState($afterState);\n $transition->setCreatedAt(Carbon::now());\n $transition->setUpdatedAt(Carbon::now());\n\n $uow->persist($transition);\n\n $meta = $em->getClassMetadata(get_class($transition));\n $uow->computeChangeSet($meta, $transition);\n\n }\n\n }\n\n }\n\n }",
"public function notify() {\n\t\tforeach($this->_observers as $key => $val) {\n\t\t\t$val->update($this);\n\t\t}\n\t}",
"protected function sendOrderChangeNotification()\n {\n if ($this->getSendNotificationFlag()) {\n \\XLite\\Core\\Mailer::getInstance()->sendOrderAdvancedChangedCustomer($this->getOrder());\n }\n }",
"public function notify() {\n $this->observers->rewind();\n while($this->observers->valid()) {\n $object = $this->observers->current();\n // dump($object);die;\n $object->update($this);\n $this->observers->next();\n }\n }",
"public function setProperty($property)\n\t{\n\t\t$this->property = $property;\n\t}",
"public function setProperty($property)\n\t{\n\t\t$this->property = $property;\n\t}",
"public function is_dirty($property) {\r\n return $this->orm->is_dirty($property);\r\n }",
"public function __set($propertyName, $propertyValue){\n \t$this->properties[$propertyName] = $propertyValue;\n }",
"public function notify()\n {\n $eventName = $this->getEventName();\n if (empty($this->observers[$eventName])) {\n $observerNames = Model::factory('Observer')->getByEventName($eventName);\n foreach ($observerNames as $observerName) {\n $this->observers[$eventName][] = new $observerName();\n }\n }\n if (!empty($this->observers[$eventName])) {\n foreach ($this->observers[$eventName] as $observer) {\n $observer->update($this);\n }\n }\n }"
] |
[
"0.64920473",
"0.63100195",
"0.6232073",
"0.5822203",
"0.5549439",
"0.5541194",
"0.55407304",
"0.5459349",
"0.5405653",
"0.53943324",
"0.53728664",
"0.5364635",
"0.528458",
"0.5268358",
"0.52394074",
"0.5231893",
"0.5226518",
"0.5203795",
"0.5201926",
"0.5185117",
"0.51436484",
"0.5127484",
"0.5117914",
"0.5101759",
"0.50628537",
"0.5055172",
"0.5055172",
"0.50487995",
"0.5040868",
"0.50382686"
] |
0.67336714
|
0
|
Persists an entity as part of the current unit of work.
|
public function persist($entity)
{
$visited = [];
$this->doPersist($entity, $visited);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function persist($entity)\n {\n }",
"protected function saveEntity($entity)\n {\n $this->om->persist($entity);\n $this->om->flush($entity);\n }",
"public function saveEntity($entity)\n\t{\n\t\t$entityManager = $this->getDoctrine()->getManager();\n\t $entityManager->persist($entity);\n\t $entityManager->flush();\n\t}",
"protected function persist($entity)\n {\n if (!$this->em()->isOpen()) {\n $this->getDoctrine()->resetManager();\n }\n\n $this->em()->persist($entity);\n $this->em()->flush();\n\n }",
"public function save()\n {\n $entities = $this->entities;\n Database::getInstance()->doTransaction(\n function() use ($entities)\n {\n foreach ($entities as $entity)\n {\n if ($entity->getMarkedAsDeleted())\n {\n $entity->delete();\n } \n else if ($entity->getMarkedAsUpdated())\n {\n $entity->saveWithDetails();\n }\n }\n }\n );\n }",
"public function persist(IEntity $entity): void\n\t{\n\t\t$this->beginTransaction();\n\t\t$data = $this->entityToArray($entity);\n\t\t$data = $this->getConventions()->convertEntityToStorage($data);\n\n\t\tif (!$entity->isPersisted()) {\n\t\t\t$this->processInsert($entity, $data);\n\n\t\t} else {\n\t\t\t$primary = [];\n\t\t\t$id = (array) $entity->getPersistedId();\n\t\t\tforeach ($entity->getMetadata()->getPrimaryKey() as $key) {\n\t\t\t\t$primary[$key] = array_shift($id);\n\t\t\t}\n\t\t\t$primary = $this->getConventions()->convertEntityToStorage($primary);\n\n\t\t\t$this->processUpdate($entity, $data, $primary);\n\t\t}\n\t}",
"public function save($entity);",
"public function save($entity);",
"public function save($entity);",
"protected function persistAndFlush($entity)\n\t{\n\t\t$this->em->persist($entity);\n\t\t$this->em->flush();\n\t}",
"protected function persistAndFlush($entity)\n {\n $this->persist($entity);\n $this->flush();\n }",
"public function persist();",
"public function save()\n {\n $this->persist($this->state);\n }",
"public function persist() {}",
"public function postPersist($entity);",
"public function store()\n {\n if( $this->isPersistent() )\n {\n $this->update();\n }\n else\n {\n $this->insert();\n }\n }",
"public function save(Entity $entity): void\n {\n $this->db->save($entity);\n }",
"public function save($entity, $context) {\n unset($entity->id);\n $entity->is_new = TRUE;\n entity_save($this->entityType, $entity);\n }",
"public function saveModel($entity){\n $this->entityManager->persist($entity);\n $this->entityManager->flush();\n }",
"public function persist()\n {\n\n $this->persistor->persist(\n $this->event,\n $this->relatedEntities,\n $this->eventRequest->getApplication(),\n $this->eventRequest->getAccount(),\n $this->eventRequest->getProduct(),\n $this->eventRequest->appendCustomer\n );\n\n }",
"public function persist()\n {\n $uid = $this->getIdentifier() == 0 ? 'NEW' . rand(100000, 999999) : $this->getIdentifier();\n $data = [\n trim(static::$storageTableName) => [\n $uid => $this->getPersistableDataArray()\n ]\n ];\n // New records always must have a pid\n if ($this->getIdentifier() == 0) {\n $data[trim(static::$storageTableName)][$uid]['pid'] = 0;\n }\n /** @var \\TYPO3\\CMS\\Core\\DataHandling\\DataHandler $tce */\n $tce = \\TYPO3\\CMS\\Core\\Utility\\GeneralUtility::makeInstance(\\TYPO3\\CMS\\Core\\DataHandling\\DataHandler::class);\n $tce->start($data, []);\n $tce->process_datamap();\n }",
"public function markAsPersisted(): void;",
"protected function saveNew($entity)\n {\n $this->em->persist($entity);\n $this->update();\n }",
"public static function StoreById($entity)\n {\n if(!isset(StorageManager::$entities[$entity->Alias]))\n {\n StorageManager::$entities[$entity->Alias] = array();\n }\n\n StorageManager::$entities[$entity->Alias][$entity->IdEntite] = $entity;\n }",
"public function save(GameLocation $entity)\n {\n $em = $this->getEntityManager();\n\n $em->persist($entity);\n $em->flush();\n }",
"public function addPersistEntity($entity)\n {\n $this->persistEntities[] = $entity;\n }",
"public function save()\n {\n $this->checkForNecessaryProperties();\n\n $this->update($this->getCurrentId(), $this->data);\n }",
"public function saveHokodoEntity(HokodoEntityInterface $hokodoEntity): void;",
"public function update($entity)\n {\n $this->getObjectManager()->persist($entity);\n $this->getObjectManager()->flush();\n }",
"public function persistEntity($obj)\n\t{\n\t\t$this->db->persistEntity($obj);\n\t}"
] |
[
"0.7265586",
"0.7156946",
"0.70419127",
"0.69679856",
"0.69319594",
"0.67965704",
"0.67898655",
"0.67898655",
"0.67898655",
"0.6765103",
"0.67482007",
"0.6705553",
"0.6699121",
"0.6672648",
"0.6661682",
"0.6654727",
"0.6630365",
"0.6603087",
"0.65842164",
"0.6575525",
"0.65632033",
"0.650214",
"0.6501493",
"0.64965093",
"0.6488022",
"0.6472126",
"0.647127",
"0.6458888",
"0.6450506",
"0.643724"
] |
0.74323505
|
0
|
Schedules an entity for insertion into the database. If the entity already has an identifier, it will be added to the identity map.
|
public function scheduleForInsert($entity)
{
$oid = spl_object_hash($entity);
if (isset($this->entityUpdates[$oid])) {
throw new \InvalidArgumentException('Dirty entity cannot be scheduled for insertion');
}
if (isset($this->entityDeletions[$oid])) {
throw new \InvalidArgumentException('Removed entity scheduled for insertion');
}
if (isset($this->originalEntityData[$oid]) && !isset($this->entityInsertions[$oid])) {
throw new \InvalidArgumentException('Managed entity scheduled for insertion');
}
if (isset($this->entityInsertions[$oid])) {
throw new \InvalidArgumentException('Entity scheduled for insertion twice');
}
$this->entityInsertions[$oid] = $entity;
if (isset($this->entityIdentifiers[$oid])) {
$this->addToIdentityMap($entity);
}
if ($entity instanceof NotifyPropertyChanged) {
$entity->addPropertyChangedListener($this);
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function insert($entity){\n\t\ttry {\n\t\t\t$data = $entity->toArray();\n\t\t\t$this->callBehavior('beforeInsert',$data);\n\t\t\t$this->convertId($data);\n\t\t\t$result = $this->collection->insertOne($data);\n\t\t\t$data['_id'] = $result->getInsertedId();\n\t\t\t//$this->doIntegrateIn($data);\n\t\t\t$this->callBehavior('afterInsert',$data);\n\t\t} catch (Exception $e) {\n\t\t\tthrow $e;\n\t\t}\n\t}",
"public function insert()\n {\n $this->id = insert($this);\n }",
"public function insert(stubObject $entity);",
"public function insert() {\r\n\t\t$this->getMapper()->insert($this);\r\n\t}",
"public function prePersist($entity);",
"public function isScheduledForInsert($entity)\n {\n return isset($this->entityInsertions[spl_object_hash($entity)]);\n }",
"public function register(IEntity &$entity) {\n\t\tif ($entity->getId() == NULL) {\n\t\t\tthrow new InvalidArgumentException(\"The entity has no ID, so it can not be registered.\");\n\t\t}\n\t\tif ($this->isRegistered($entity->getId())) {\n\t\t\tthrow new InvalidStateException(\"The entity with id [\".$entity->getId().\"] is already registered.\");\n\t\t}\n\t\t$this->registered[$entity->getId()] = $entity;\n\t}",
"public function pushEntity($entity): void\n {\n /** @var EntityRepository $repository */\n $repository = Prime::repository($entity);\n $mapper = $repository->mapper();\n\n $isReadOnly = $mapper->isReadOnly();\n $mapper->setReadOnly(false);\n\n $repository->disableEventNotifier();\n $repository->insert($entity);\n $repository->enableEventNotifier();\n\n $mapper->setReadOnly($isReadOnly);\n }",
"public function insert(DataObject $entity){\n }",
"function _create($entity)\n {\n $retval = FALSE;\n $id = $this->object->_wpdb()->insert($this->object->get_table_name(), $this->object->_convert_to_table_data($entity));\n if ($id) {\n $key = $this->object->get_primary_key_column();\n $retval = $entity->{$key} = intval($this->object->_wpdb()->insert_id);\n }\n return $retval;\n }",
"public function scheduleForUpdate($entity)\n {\n $oid = spl_object_hash($entity);\n if (!isset($this->entityIdentifiers[$oid])) {\n throw new \\InvalidArgumentException('Entity has no identity');\n }\n if (isset($this->entityDeletions[$oid])) {\n throw new \\InvalidArgumentException('Entity is removed');\n }\n if (!isset($this->entityUpdates[$oid]) && !isset($this->entityInsertions[$oid])) {\n $this->entityUpdates[$oid] = $entity;\n }\n }",
"public function insert(AbstractEntity $entity)\n\t{\n\t\tif(!$this->isValidEntity($entity))\n\t\t{\n\t\t\tthrow new \\Exception('The specified entity ('. get_class($entity) .') is not allowed for this mapper ('. get_called_class() .')');\n\t\t}\n\t\t\n\t\t$aTableSource = array_merge($this->_acceptedFields, $this->_cascadeFields);\n\t\t\n\t\t$aTables\t= $this->extractTables($aTableSource);\n\t\t$aData\t\t= $this->filterOnlyAcceptedFields($entity->toArray());\n\t\t\n\t\t$insertId = $this->_adapter->insert($aTables, $aData);\n\t\t\n\t\tif($insertId)\n\t\t{\n\t\t\t$entity->id = $insertId;\n\t\t}\n\t\t\n\t\tif($this->_adapter->getAffectedRows() > 0)\n\t\t{\n\t\t\treturn $entity;\n\t\t} else {\n\t\t\tthrow new \\Exception('Insertion to database for entity ('. get_class($entity) . ') failed');\n\t\t}\n\t}",
"public function insert(PhpORM_Entity $entity)\n {\n $table = $this->getTable();\n $data = $entity->toArray();\n\n return $table->insert($data);\n }",
"public function addToIdentityMap($entity)\n {\n /** @var EntityMetadata $classMetadata */\n $classMetadata = $this->manager->getClassMetadata(get_class($entity));\n $idHash = implode(' ', $this->entityIdentifiers[spl_object_hash($entity)]);\n\n if ($idHash === '') {\n throw new \\InvalidArgumentException('Entitty does not have valid identifiers to be stored at identity map');\n }\n\n $className = $classMetadata->rootEntityName;\n\n if (isset($this->identityMap[$className][$idHash])) {\n return false;\n }\n\n $this->identityMap[$className][$idHash] = $entity;\n\n return true;\n }",
"public function add($entity)\n {\n $this->getObjectManager()->persist($entity);\n $this->getObjectManager()->flush();\n }",
"abstract public function insertId();",
"abstract public function insertId();",
"abstract public function insertId();",
"public function add($entity)\r\n {\r\n \t$cacheKey = $this->getCacheKey($entity->getPrimaryKey());\r\n \t$this->_entities[$cacheKey] = $entity;\r\n }",
"protected function performInsert()\n {\n $attributes = $this->getAttributes();\n $updatedField = $this->getApi()->{'create'.ucfirst($this->getEntity())}($attributes);\n $this->fill($updatedField);\n $this->exists = true;\n $this->wasRecentlyCreated = true;\n\n return true;\n }",
"public function store()\n {\n if (!$this->id) { // Insert\n $this->insertObject();\n } else { // Update\n $this->updateObject();\n }\n }",
"public function add($entity);",
"public function scheduleForDelete($entity)\n {\n $oid = spl_object_hash($entity);\n if (isset($this->entityInsertions[$oid])) {\n if ($this->isInIdentityMap($entity)) {\n $this->removeFromIdentityMap($entity);\n }\n unset($this->entityInsertions[$oid], $this->entityStates[$oid]);\n\n return; // entity has not been persisted yet, so nothing more to do.\n }\n if (!$this->isInIdentityMap($entity)) {\n return;\n }\n $this->removeFromIdentityMap($entity);\n unset($this->entityUpdates[$oid]);\n if (!isset($this->entityDeletions[$oid])) {\n $this->entityDeletions[$oid] = $entity;\n $this->entityStates[$oid] = self::STATE_REMOVED;\n }\n }",
"abstract public function InsertId();",
"public function persist(IEntity $entity): void\n\t{\n\t\t$this->beginTransaction();\n\t\t$data = $this->entityToArray($entity);\n\t\t$data = $this->getConventions()->convertEntityToStorage($data);\n\n\t\tif (!$entity->isPersisted()) {\n\t\t\t$this->processInsert($entity, $data);\n\n\t\t} else {\n\t\t\t$primary = [];\n\t\t\t$id = (array) $entity->getPersistedId();\n\t\t\tforeach ($entity->getMetadata()->getPrimaryKey() as $key) {\n\t\t\t\t$primary[$key] = array_shift($id);\n\t\t\t}\n\t\t\t$primary = $this->getConventions()->convertEntityToStorage($primary);\n\n\t\t\t$this->processUpdate($entity, $data, $primary);\n\t\t}\n\t}",
"public function add($entity)\n {\n $entity->setMarkedAsUpdated(true);\n $this->entities[] = $entity;\n }",
"public function _insert()\n\t {\n\t \t$this->notifyObservers(__FUNCTION__);\n\t }",
"function jo($entity) {\n $entity->setEntityId(($entity->getEntityId() +1));\n }",
"protected function postInsert($entity) {\n ManagerHolder::get('StoreInventory')->createDefault($entity['id'], str_replace('Manager', '', self::class));\n }",
"public function add($entity, $flush = false);"
] |
[
"0.6443065",
"0.61004496",
"0.60026985",
"0.5821815",
"0.57523113",
"0.57495934",
"0.57228684",
"0.57188046",
"0.56368434",
"0.5620079",
"0.5605891",
"0.5591211",
"0.5554549",
"0.55505383",
"0.5524627",
"0.55125505",
"0.55125505",
"0.55125505",
"0.5487709",
"0.5443964",
"0.53865093",
"0.53583455",
"0.53528553",
"0.53499955",
"0.5341226",
"0.53321564",
"0.53099734",
"0.53054994",
"0.53024024",
"0.5287662"
] |
0.7246645
|
0
|
Checks whether an entity is scheduled for insertion.
|
public function isScheduledForInsert($entity)
{
return isset($this->entityInsertions[spl_object_hash($entity)]);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function isScheduledForInsert($document)\n {\n return isset($this->documentInsertions[spl_object_hash($document)]);\n }",
"public function isEntityScheduled($entity)\n {\n $oid = spl_object_hash($entity);\n\n return isset($this->entityInsertions[$oid])\n || isset($this->entityUpdates[$oid])\n || isset($this->entityDeletions[$oid]);\n }",
"public function hasPendingInsertions()\n {\n return ! empty($this->documentInsertions);\n }",
"public function BeforeInsertRecord()\n\t{\n\t\tif(!$this->CheckStartFinishDate()) return false;\n\t\tif(!$this->CheckDateOverlapping()) return false;\n\t\treturn true;\n\t}",
"protected function performInsert()\n {\n $attributes = $this->getAttributes();\n $updatedField = $this->getApi()->{'create'.ucfirst($this->getEntity())}($attributes);\n $this->fill($updatedField);\n $this->exists = true;\n $this->wasRecentlyCreated = true;\n\n return true;\n }",
"private function isInsertQuery()\n\t{\n\t\treturn $this->insert_table != null;\n\t}",
"public function isScheduledForUpdate($entity)\n {\n return isset($this->entityUpdates[spl_object_hash($entity)]);\n }",
"private function isInsertOperation ()\n {\n if ( $this->model->getOriginal('id') != $this->model->getAttribute('id') ) return true;\n\n return false;\n }",
"public function isScheduledForDelete($entity)\n {\n return isset($this->entityDeletions[spl_object_hash($entity)]);\n }",
"public function beforeSave($insert) {\n if (parent::beforeSave($insert)) {\n $now = new \\DateTime();\n $this->date = $now->format('Y-m-d');\n $this->time = $now->format('H:i:s');\n return true;\n } else {\n return false;\n }\n }",
"public function scheduleForInsert($entity)\n {\n $oid = spl_object_hash($entity);\n if (isset($this->entityUpdates[$oid])) {\n throw new \\InvalidArgumentException('Dirty entity cannot be scheduled for insertion');\n }\n if (isset($this->entityDeletions[$oid])) {\n throw new \\InvalidArgumentException('Removed entity scheduled for insertion');\n }\n if (isset($this->originalEntityData[$oid]) && !isset($this->entityInsertions[$oid])) {\n throw new \\InvalidArgumentException('Managed entity scheduled for insertion');\n }\n if (isset($this->entityInsertions[$oid])) {\n throw new \\InvalidArgumentException('Entity scheduled for insertion twice');\n }\n $this->entityInsertions[$oid] = $entity;\n if (isset($this->entityIdentifiers[$oid])) {\n $this->addToIdentityMap($entity);\n }\n if ($entity instanceof NotifyPropertyChanged) {\n $entity->addPropertyChangedListener($this);\n }\n }",
"abstract protected function isSyncRequired($entity);",
"public function isDocumentScheduled($document)\n {\n $oid = spl_object_hash($document);\n return isset($this->documentInsertions[$oid]) ||\n isset($this->documentUpdates[$oid]) ||\n isset($this->documentDeletions[$oid]);\n }",
"public function isAllowPkInsert()\n {\n return $this->allowPkInsert;\n }",
"public function isScheduled()\n {\n return $this->publish_status == Status::SCHEDULED;\n }",
"public function testInsertValidSchedule() {\n\t\t$numRows = $this->getConnection()->getRowCount(\"schedule\");\n\n\t\t$schedule = new Schedule(null, $this->company->getCompanyId(), $this->VALID_SCHEDULEDAYOFWEEK1, $this->VALID_SCHEDULEENDTIME1, $this->VALID_SCHEDULELOCATIONADDRESS1, $this->VALID_SCHEDULELOCATIONNAME1, $this->VALID_SCHEDULESTARTTIME1);\n\n\t\t$schedule->insert($this->getPDO());\n\n\t\t//make sure this data in sql matches what we have above.....\n\n\t\t$pdoSchedule = Schedule::getScheduleByScheduleId($this->getPDO(), $schedule->getScheduleId());\n\n\t\t//grab the data from mySQL and enforce the fields match our expectations\n\t\t$this->assertEquals($numRows + 1, $this->getConnection()->getRowCount(\"schedule\"));\n\n\t\t$this->assertEquals($pdoSchedule->getScheduleCompanyId(), $this->company->getCompanyId());\n\t\t$this->assertEquals($pdoSchedule->getScheduleDayOfWeek(), $this->VALID_SCHEDULEDAYOFWEEK1);\n\t\t$this->assertEquals($pdoSchedule->getScheduleEndTime(), $this->VALID_SCHEDULEENDTIME1);\n\t\t$this->assertEquals($pdoSchedule->getScheduleLocationAddress(), $this->VALID_SCHEDULELOCATIONADDRESS1);\n\t\t$this->assertEquals($pdoSchedule->getScheduleLocationName(), $this->VALID_SCHEDULELOCATIONNAME1);\n\t\t$this->assertEquals($pdoSchedule->getScheduleStartTime(), $this->VALID_SCHEDULESTARTTIME1);\n\n\t}",
"public function isScheduledForDirtyCheck($entity)\n {\n $rootEntityName = $this->manager->getClassMetadata(get_class($entity))->getRootEntityName();\n\n return isset($this->scheduledForSynchronization[$rootEntityName][spl_object_hash($entity)]);\n }",
"protected function _canRun()\r\n\t{\r\n\t\t$start\t= strtotime($this->_scheduleStart);\r\n\t\t$stop\t= strtotime($this->_scheduleStop);\r\n\t\t$now\t= time();\r\n\t\t\r\n\t\tif($now > $start && $now < $stop) {\r\n\t\t\treturn true;\r\n\t\t} else {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}",
"public function ableToExecute()\n {\n $log = $this->getCommandLog();\n if ($log) {\n return $log->last_succeed_time >= $log->started_at || $log->ended_at >= $log->started_at;\n }\n return true;\n }",
"public function isScheduledForUpsert($document)\n {\n return isset($this->documentUpserts[spl_object_hash($document)]);\n }",
"private function check()\n {\n foreach ($this->scheduler->getQueuedJobs() as $job) {\n if ($job->isDue(new DateTime()) === true) {\n\n $this->executeIfNotOverlapped($job);\n }\n }\n }",
"public function is_there_scheduled_sms() {\r\n\t\t\t$query = 'SELECT `messageid` FROM `scheduled_sms` WHERE `is_sent` = 0 AND `scheduled_time` < now();';\r\n\t\t\t$statement = $this->con->prepare($query);\r\n\t\t\t$statement->execute();\r\n\t\t\t$valid = ($statement->rowCount() >= 1);\r\n\t\t\t$statement->closeCursor();\r\n\t\t\treturn $valid;\r\n\t\t}",
"public function hasTimestampEnabled(): bool\n {\n return $this->getEntityDao()->hasTimestampEnabled();\n }",
"public function transaction(): bool\r\n {\r\n return $this->instance->inTransaction() === true;\r\n }",
"protected function performPrePersistCallback()\n {\n // echo 'inserting a record ...';\n $this->validate();\n \n return true;\n }",
"public function isUnderTransaction();",
"public function testInsertInvalidScheduleItem() {\n // create a ScheduleItem with a non null scheduleItem id and watch it fail\n $scheduleItem = new ScheduleItem(5786,$this->VALID_SCHEDULE_ITEM_DESCRIPTION, $this->VALID_SCHEDULE_ITEM_NAME,$this->VALID_SCHEDULE_START_TIME, $this->VALID_SCHEDULE_END_TIME, $this->VALID_USER_ID);\n $scheduleItem->insert($this->getPDO());\n }",
"public function getScheduledStatus()\n {\n if ( !$this->owner->isPublished() ) {\n return false;\n }\n $embargo = $this->owner->dbObject(\"Embargo\");\n //Debug::dump(($this->owner->Embargo)? true: false);\n if ( $this->owner->Embargo && $embargo->InFuture() ) {\n return true;\n }\n\n return false;\n }",
"public function isPersisted();",
"public function isPersisted();"
] |
[
"0.7285275",
"0.71066797",
"0.66633147",
"0.64562505",
"0.6384283",
"0.6182333",
"0.6043015",
"0.58971435",
"0.5877219",
"0.5859772",
"0.5808111",
"0.57987124",
"0.577737",
"0.57031256",
"0.5689808",
"0.567592",
"0.5605905",
"0.5516943",
"0.54877526",
"0.5467171",
"0.5461221",
"0.5447153",
"0.54456824",
"0.5433034",
"0.5426128",
"0.5414964",
"0.5377818",
"0.53483546",
"0.5341875",
"0.5341875"
] |
0.82172245
|
0
|
Schedules an entity for being updated.
|
public function scheduleForUpdate($entity)
{
$oid = spl_object_hash($entity);
if (!isset($this->entityIdentifiers[$oid])) {
throw new \InvalidArgumentException('Entity has no identity');
}
if (isset($this->entityDeletions[$oid])) {
throw new \InvalidArgumentException('Entity is removed');
}
if (!isset($this->entityUpdates[$oid]) && !isset($this->entityInsertions[$oid])) {
$this->entityUpdates[$oid] = $entity;
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function scheduleForDirtyCheck($entity)\n {\n $rootClassName =\n $this->manager->getClassMetadata(get_class($entity))->getRootEntityName();\n $this->scheduledForSynchronization[$rootClassName][spl_object_hash($entity)] = $entity;\n }",
"public function update(Entity $entity);",
"function update(IContract $entity);",
"public function setSchedule(Schedule $schedule): UpdateScheduleService;",
"public function update($entity);",
"public function update($entity);",
"public function update(IEntity $entity);",
"public function update($entity)\n {\n \n }",
"public function Update($entity) {\n }",
"public function update(stubObject $entity);",
"protected function updateEntity($entity)\n {\n }",
"protected function schedule(Schedule $schedule)\n {\n $schedule->call(function () {\n DB::transaction(function () {\n $actions = Action::where('state', 'started')->lockForUpdate()->get();\n\n foreach ($actions as $action){\n $user_point = $action->user->userPoint->lockForUpdate()->first();\n\n $user_point->update([\n 'approval_point' => ($user_point->approval_point + $action->point),\n 'pending_point' => ($user_point->pending_point - $action->point),\n ]);\n\n $action->update([\n 'state' => 'approval'\n ]);\n }\n });\n })->hourly();\n\n }",
"public function update($entity, $flush = false);",
"public function update($entity){ \n //TODO: Implement update record.\n }",
"public function refreshUpdated() {\n $this->setUpdated(new \\DateTime(\"now\"));\n}",
"public function updated(TechnicalVendorSchedule $technical_vendor_schedule)\n {\n //\n }",
"public function update($entity) {\n $this->updateRecord([\n 'created-on' => $entity->getCreatedOn(),\n 'last-updated' => $entity->getLastUpdated(),\n 'title' => $entity->getTitle(),\n 'description' => $entity->getDescription(),\n 'body' => $entity->getBody(),\n ], [\n 'id' => $entity->getId(),\n ]);\n }",
"public function update(DataObject $entity){\n }",
"protected function performUpdate() {}",
"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 }",
"public function update(Request $request, schedule $schedule)\n {\n //\n }",
"public function testUpdateInvalidSchedule() {\n\n\t\t$schedule = new Schedule(null, $this->company->getCompanyId(), $this->VALID_SCHEDULEDAYOFWEEK1, $this->VALID_SCHEDULEENDTIME1, $this->VALID_SCHEDULELOCATIONADDRESS1, $this->VALID_SCHEDULELOCATIONNAME1, $this->VALID_SCHEDULESTARTTIME1);\n\n\t\t$schedule->update($this->getPDO());\n\t}",
"protected function tryScheduleSync($entity)\n {\n $key = spl_object_hash($entity);\n\n if (isset($this->scheduledSyncMap[$key])) {\n return;\n }\n\n $this->scheduledSyncMap[$key] = true;\n\n if ($this->isTwoWaySyncEnabled($entity)) {\n $this->scheduleSync($entity);\n }\n }",
"public function _update()\n {\n $this->updatedAt = new \\DateTime();\n }",
"public static function update($entity)\n {\n return static::mapper()->update($entity);\n }",
"public function updateScheduled(int $id, array $attributes): ResponseInterface;",
"public function testUpdateValidSchedule() {\n\t\t$numRows = $this->getConnection()->getRowCount(\"schedule\");\n\n\t\t$schedule = new Schedule(null, $this->company->getCompanyId(), $this->VALID_SCHEDULEDAYOFWEEK1, $this->VALID_SCHEDULEENDTIME1, $this->VALID_SCHEDULELOCATIONADDRESS1, $this->VALID_SCHEDULELOCATIONNAME1, $this->VALID_SCHEDULESTARTTIME1);\n\n\t\t$schedule->insert($this->getPDO());\n\n\t\t//edit the info for the schedule object...se we can see if it changes properly\n\n\t\t$schedule->setScheduleDayOfWeek($this->VALID_SCHEDULEDAYOFWEEK2);\n\t\t$schedule->setScheduleEndTime($this->VALID_SCHEDULEENDTIME2);\n\t\t$schedule->setScheduleLocationAddress($this->VALID_SCHEDULELOCATIONADDRESS2);\n\t\t$schedule->setScheduleLocationName($this->VALID_SCHEDULELOCATIONNAME2);\n\t\t$schedule->setScheduleStartTime($this->VALID_SCHEDULESTARTTIME2);\n\n\t\t$schedule->update($this->getPDO());\n\n\t\t$pdoSchedule = Schedule::getScheduleByScheduleId($this->getPDO(), $schedule->getScheduleId());\n\n\t\t//Make sure there is a row in there and run the 2nd set of information\n\n\t\t$this->assertEquals($numRows + 1, $this->getConnection()->getRowCount(\"schedule\"));\n\n\t\t$this->assertEquals($pdoSchedule->getScheduleDayOfWeek(), $this->VALID_SCHEDULEDAYOFWEEK2);\n\t\t$this->assertEquals($pdoSchedule->getScheduleEndTime(), $this->VALID_SCHEDULEENDTIME2);\n\t\t$this->assertEquals($pdoSchedule->getScheduleLocationAddress(), $this->VALID_SCHEDULELOCATIONADDRESS2);\n\t\t$this->assertEquals($pdoSchedule->getScheduleLocationName(), $this->VALID_SCHEDULELOCATIONNAME2);\n\t\t$this->assertEquals($pdoSchedule->getScheduleStartTime(), $this->VALID_SCHEDULESTARTTIME2);\n\n\t}",
"public function isScheduledForUpdate($entity)\n {\n return isset($this->entityUpdates[spl_object_hash($entity)]);\n }",
"public function update($entity)\n {\n $this->getObjectManager()->persist($entity);\n $this->getObjectManager()->flush();\n }",
"public function postUpdate($entity);"
] |
[
"0.65676475",
"0.6516831",
"0.6245709",
"0.62366974",
"0.62163025",
"0.62163025",
"0.62041485",
"0.61678916",
"0.6134816",
"0.6092333",
"0.5997191",
"0.598751",
"0.5986676",
"0.596645",
"0.5929924",
"0.5923015",
"0.581971",
"0.578057",
"0.5729374",
"0.57184106",
"0.5679011",
"0.56652457",
"0.5641546",
"0.5640352",
"0.5613281",
"0.560968",
"0.5577645",
"0.55634284",
"0.5555236",
"0.5543887"
] |
0.7133237
|
0
|
INTERNAL: Schedules an entity for deletion.
|
public function scheduleForDelete($entity)
{
$oid = spl_object_hash($entity);
if (isset($this->entityInsertions[$oid])) {
if ($this->isInIdentityMap($entity)) {
$this->removeFromIdentityMap($entity);
}
unset($this->entityInsertions[$oid], $this->entityStates[$oid]);
return; // entity has not been persisted yet, so nothing more to do.
}
if (!$this->isInIdentityMap($entity)) {
return;
}
$this->removeFromIdentityMap($entity);
unset($this->entityUpdates[$oid]);
if (!isset($this->entityDeletions[$oid])) {
$this->entityDeletions[$oid] = $entity;
$this->entityStates[$oid] = self::STATE_REMOVED;
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"protected function entityDelete(){\n // TODO: deal with errors\n // delete from api\n $deleted = $this->resourceService()->delete($this->getId());\n }",
"public function delete(DimeEntityInterface $entity);",
"public function delete($entity);",
"public function delete()\n {\n $entities = $this->entities;\n Database::getInstance()->doTransaction(\n function() use ($entities)\n {\n foreach ($entities as $entity)\n {\n $entity->delete();\n }\n }\n );\n }",
"public function scheduleOrphanRemoval($entity)\n {\n $this->orphanRemovals[spl_object_hash($entity)] = $entity;\n }",
"function time_tracker_activity_delete($entity) {\n entity_get_controller('time_tracker_activity')->delete($entity);\n}",
"public function delete($entity){ \n //TODO: Implement remove record.\n }",
"public function delete($entity)\n {\n $this->getObjectManager()->remove($entity);\n $this->getObjectManager()->flush();\n }",
"function delete(IContract $entity);",
"public function delete($entity)\n {\n \n }",
"protected function deleteTask() {}",
"protected function performDestroy(Model $entity): void\n {\n $entity->delete();\n }",
"public function deleteEntity($entity): void\n {\n /** @var EntityRepository $repository */\n $repository = Prime::repository($entity);\n $mapper = $repository->mapper();\n\n $isReadOnly = $mapper->isReadOnly();\n $mapper->setReadOnly(false);\n\n $repository->disableEventNotifier();\n $repository->delete($entity);\n $repository->enableEventNotifier();\n\n $mapper->setReadOnly($isReadOnly);\n }",
"protected function performForceDestroy(Model $entity): void\n {\n $entity->forceDelete();\n }",
"public function delete(): void\n {\n $this->record(new AgendaWasDeleted($this->identity));\n }",
"public function delete($entity) {\n $this->deleteRecord([\n 'id' => $entity->getId(),\n ]);\n }",
"public function Delete($entity) {\n }",
"public function scheduleForDelete($document)\n {\n $oid = spl_object_hash($document);\n\n if (isset($this->documentInsertions[$oid])) {\n if ($this->isInIdentityMap($document)) {\n $this->removeFromIdentityMap($document);\n }\n unset($this->documentInsertions[$oid]);\n return; // document has not been persisted yet, so nothing more to do.\n }\n\n if ( ! $this->isInIdentityMap($document)) {\n return; // ignore\n }\n\n $this->removeFromIdentityMap($document);\n $this->documentStates[$oid] = self::STATE_REMOVED;\n\n if (isset($this->documentUpdates[$oid])) {\n unset($this->documentUpdates[$oid]);\n }\n if ( ! isset($this->documentDeletions[$oid])) {\n $this->documentDeletions[$oid] = $document;\n }\n }",
"public function forceDeleted(TechnicalVendorSchedule $technical_vendor_schedule)\n {\n //\n }",
"public function delete()\n {\n $this->job->delete();\n }",
"public function delete($entity)\n {\n $this->getEventDispatcher()->dispatch(\n TrackingHistoryEvents::PRE_DELETE,\n new TrackingHistoryEvent($entity)\n );\n\n parent::delete($entity);\n\n $this->getEventDispatcher()->dispatch(\n TrackingHistoryEvents::POST_DELETE,\n new TrackingHistoryEvent($entity)\n );\n }",
"public function taskDelete(): void\n {\n $directory = $this->getDirectory();\n if (!$directory) {\n throw new RuntimeException('Not Found', 404);\n }\n\n $object = null;\n try {\n $object = $this->getObject();\n if ($object && $object->exists()) {\n $authorized = $object instanceof FlexAuthorizeInterface\n ? $object->isAuthorized('delete', 'admin', $this->user)\n : $directory->isAuthorized('delete', 'admin', $this->user);\n\n if (!$authorized) {\n throw new RuntimeException($this->admin::translate('PLUGIN_ADMIN.INSUFFICIENT_PERMISSIONS_FOR_TASK') . ' delete.', 403);\n }\n\n $object->delete();\n\n $this->admin->setMessage($this->admin::translate('PLUGIN_FLEX_OBJECTS.CONTROLLER.TASK_DELETE_SUCCESS'));\n if ($this->currentRoute->withoutGravParams()->getRoute() === $this->referrerRoute->getRoute()) {\n $redirect = dirname($this->currentRoute->withoutGravParams()->toString(true));\n } else {\n $redirect = $this->referrerRoute->toString(true);\n }\n\n $this->setRedirect($redirect);\n\n $this->grav->fireEvent('onFlexAfterDelete', new Event(['type' => 'flex', 'object' => $object]));\n }\n } catch (RuntimeException $e) {\n $this->admin->setMessage($this->admin::translate(['PLUGIN_FLEX_OBJECTS.CONTROLLER.TASK_DELETE_FAILURE', $e->getMessage()]), 'error');\n\n $this->setRedirect($this->referrerRoute->toString(true), 302);\n }\n }",
"public function delete(string $entityId): void;",
"public function delete()\n {\n persistableCollection::getInstance($this->resourceName)->deleteObject($this);\n }",
"public function delete(DataObject $entity){\n }",
"public function afterDelete(&$id, Entity $entity) { }",
"public function delete(IndexableEntity $entity);",
"public function delete(EntityInterface $Entity);",
"public function delete(){\n $this->delete_from('task');\n }",
"public function delete($entity) : bool;"
] |
[
"0.68122494",
"0.65605605",
"0.65043515",
"0.64815325",
"0.6442284",
"0.6427097",
"0.6423082",
"0.63825256",
"0.6365594",
"0.6331141",
"0.62899256",
"0.6255598",
"0.6242541",
"0.62094575",
"0.6176845",
"0.6167791",
"0.6164634",
"0.6157725",
"0.606684",
"0.60524666",
"0.6050603",
"0.6037169",
"0.6032882",
"0.60140276",
"0.6005233",
"0.6002861",
"0.6002491",
"0.5993832",
"0.5990638",
"0.5981922"
] |
0.78132856
|
0
|
Checks whether an entity is registered as removed/deleted with the unit of work.
|
public function isScheduledForDelete($entity)
{
return isset($this->entityDeletions[spl_object_hash($entity)]);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function isDeleteGranted($entity): bool;",
"public function isDeletable($entity);",
"abstract public function isUndeleting();",
"abstract public function isUndeleting();",
"public function isRemoved() : bool\n {\n return $this->trashed();\n }",
"public function isRemoved(): bool;",
"public function isDeletedOrReleased();",
"public function exists()\n\t{\n\t\treturn ! $this->hasBeenRemoved;\n\t}",
"public function postFlush(PostFlushEventArgs $args)\n {\n $removed = $this->container->get('session')->get('entity_removed');\n if ($removed === null) {\n return true;\n }\n $id = $removed['id'];\n $entity = $removed['entity'];\n // The log() function flushes. Flushing will call this event handler.\n // So make sure the stored entity is nulled.\n $this->container->get('session')->set('entity_removed', null);\n $class = get_class($entity);\n if (in_array($class, $this->ignoredClasses)) {\n return true;\n }\n\n $this->doctrineLog($args,\n array(\n 'action' => 'deleted',\n 'level' => 'doctrine',\n 'entity' => $entity,\n 'id' => $id,\n ));\n return true;\n }",
"public function exists($entity): bool;",
"public function isRemoved(): bool\n {\n return $this->state == self::STATE_REMOVED;\n }",
"public function isDeletable($entity):bool\n {\n return true;\n }",
"protected function canDelete()\n {\n if (!Validate::isLoadedObject($this)) {\n return true;\n }\n\n /** @var Gamifications $module */\n $module = Module::getInstanceByName('gamifications');\n $em = $module->getEntityManager();\n\n /** @var GamificationsRewardRepository $rewardRepository */\n $rewardRepository = $em->getRepository(__CLASS__);\n $isInUse = $rewardRepository->isRewardInUse($this->id);\n\n return !$isInUse;\n }",
"public function isDeleted() {}",
"abstract protected function isSyncRequired($entity);",
"public function isDeleted() {}",
"public function canBeRemoved() {}",
"public function isDeleted();",
"public function isDeleted();",
"public function delete($entity) : bool;",
"public function canBeDeleted() : bool\n\t{\n\t\t$countUsers = $this->users()->lockForUpdate()->count();\n\t\t$isFuture = $this->flight_at->isFuture();\n\n\t\tif ($countUsers === 0 && $isFuture) {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}",
"public function isEntityScheduled($entity)\n {\n $oid = spl_object_hash($entity);\n\n return isset($this->entityInsertions[$oid])\n || isset($this->entityUpdates[$oid])\n || isset($this->entityDeletions[$oid]);\n }",
"public function isDeleted(): bool;",
"public function isDeleted(): bool;",
"public function isScheduledForUpdate($entity)\n {\n return isset($this->entityUpdates[spl_object_hash($entity)]);\n }",
"protected function canRemove() {}",
"private function isSoftDeleted(): bool\n {\n return $this->resource::softDeletes() && $this->model->trashed();\n }",
"public function isScheduledForDirtyCheck($entity)\n {\n $rootEntityName = $this->manager->getClassMetadata(get_class($entity))->getRootEntityName();\n\n return isset($this->scheduledForSynchronization[$rootEntityName][spl_object_hash($entity)]);\n }",
"public function valid()\n {\n return key($this->entities) !== null;\n }",
"public function isDeleted()\n\t{\n\t\treturn ($this->get('state') == static::ANSWERS_STATE_DELETE);\n\t}"
] |
[
"0.652623",
"0.641413",
"0.63785315",
"0.63785315",
"0.63507855",
"0.63302785",
"0.6311879",
"0.62787884",
"0.6256839",
"0.624097",
"0.62399167",
"0.6162394",
"0.615992",
"0.6154813",
"0.6154338",
"0.6153625",
"0.6144432",
"0.6038848",
"0.6038848",
"0.6001546",
"0.5986203",
"0.5942261",
"0.5938103",
"0.5938103",
"0.5920318",
"0.5895026",
"0.58792853",
"0.5836279",
"0.58259726",
"0.5819038"
] |
0.70188916
|
0
|
Checks whether an entity is scheduled for insertion, update or deletion.
|
public function isEntityScheduled($entity)
{
$oid = spl_object_hash($entity);
return isset($this->entityInsertions[$oid])
|| isset($this->entityUpdates[$oid])
|| isset($this->entityDeletions[$oid]);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function isScheduledForInsert($entity)\n {\n return isset($this->entityInsertions[spl_object_hash($entity)]);\n }",
"public function isScheduledForUpdate($entity)\n {\n return isset($this->entityUpdates[spl_object_hash($entity)]);\n }",
"public function isScheduledForDelete($entity)\n {\n return isset($this->entityDeletions[spl_object_hash($entity)]);\n }",
"public function isScheduledForDirtyCheck($entity)\n {\n $rootEntityName = $this->manager->getClassMetadata(get_class($entity))->getRootEntityName();\n\n return isset($this->scheduledForSynchronization[$rootEntityName][spl_object_hash($entity)]);\n }",
"abstract protected function isSyncRequired($entity);",
"public function isScheduledForInsert($document)\n {\n return isset($this->documentInsertions[spl_object_hash($document)]);\n }",
"public function isDocumentScheduled($document)\n {\n $oid = spl_object_hash($document);\n return isset($this->documentInsertions[$oid]) ||\n isset($this->documentUpdates[$oid]) ||\n isset($this->documentDeletions[$oid]);\n }",
"public function isScheduled()\n {\n return $this->publish_status == Status::SCHEDULED;\n }",
"public function hasPendingInsertions()\n {\n return ! empty($this->documentInsertions);\n }",
"public function getScheduledStatus()\n {\n if ( !$this->owner->isPublished() ) {\n return false;\n }\n $embargo = $this->owner->dbObject(\"Embargo\");\n //Debug::dump(($this->owner->Embargo)? true: false);\n if ( $this->owner->Embargo && $embargo->InFuture() ) {\n return true;\n }\n\n return false;\n }",
"public function hasPendingActions()\r\n {\r\n }",
"private function check()\n {\n foreach ($this->scheduler->getQueuedJobs() as $job) {\n if ($job->isDue(new DateTime()) === true) {\n\n $this->executeIfNotOverlapped($job);\n }\n }\n }",
"public function isScheduledForUpdate($document)\n {\n return isset($this->documentUpdates[spl_object_hash($document)]);\n }",
"protected function _canRun()\r\n\t{\r\n\t\t$start\t= strtotime($this->_scheduleStart);\r\n\t\t$stop\t= strtotime($this->_scheduleStop);\r\n\t\t$now\t= time();\r\n\t\t\r\n\t\tif($now > $start && $now < $stop) {\r\n\t\t\treturn true;\r\n\t\t} else {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}",
"public function hasUpdate();",
"public function ableToExecute()\n {\n $log = $this->getCommandLog();\n if ($log) {\n return $log->last_succeed_time >= $log->started_at || $log->ended_at >= $log->started_at;\n }\n return true;\n }",
"public function getIsPublishScheduled()\n {\n /** @var DBDatetime $publishTime */\n $publishTime = $this->owner->dbObject('PublishOnDate');\n\n if ($publishTime->InFuture()) {\n return true;\n }\n\n if ((int) $this->owner->PublishJobID !== 0) {\n return true;\n }\n\n return false;\n }",
"public function isScheduledForDelete($document)\n {\n return isset($this->documentDeletions[spl_object_hash($document)]);\n }",
"function check_sched_enabled() {\n\t\t$t = time();\n\t\tif (\n\t\t\t$this->get_sched()\n\t\t\t&& $t >= $this->get_sched_t_s()\n\t\t\t&& $t <= $this->get_sched_t_e()\n\t\t) {\n\t\t\t// Scheduling active -> enable.\n\t\t\t$this->set_enabled(TRUE);\n\t\t\t$this->write();\n\t\t} else if ($this->get_sched()){\n\t\t\t// Scheduling inactive -> disable.\n\t\t\t$this->set_enabled(FALSE);\n\t\t\t$this->write();\n\t\t}\n\t}",
"function Event_Type_Is_Scheduled($schedule, $type)\n{\n\tforeach ($schedule as $event)\n\t{\n\t\tif ( ($event->event_name_short == $type || $event->event_name == $type)\n\t\t&& $event->status == 'scheduled')\n\t\t{\n\t\t\treturn TRUE;\n\t\t}\n\t}\n\n\treturn FALSE;\n}",
"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 shouldExecute()\n\t{\n\t\t// date range check\n\t\tif( strtotime($this->start_date) > utc_time() || strtotime($this->end_date) < utc_time() ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// time range check, for the current day-of-week\n\t\t$dow_abbrevs = [null, 'mon', 'tues', 'wed', 'thurs', 'fri', 'sat', 'sun'];\n\t\t$dow_int = utc_date()->format('N');\t// 1 = mon, 7 = sun\n\t\t$dow = $dow_abbrevs[$dow_int];\n\t}",
"public function check_scheduled_coupon_actions() {\n\n\t\t\tcheck_ajax_referer( 'wc-sc-check-coupon-scheduled-actions', 'security' );\n\n\t\t\t$coupon_id = ( ! empty( $_POST['coupon_id'] ) ) ? wc_clean( wp_unslash( $_POST['coupon_id'] ) ) : ''; // phpcs:ignore\n\n\t\t\t$response = array(\n\t\t\t\t'has_scheduled_actions' => 'no',\n\t\t\t);\n\n\t\t\tif ( ! empty( $coupon_id ) ) {\n\t\t\t\t$coupon = new WC_Coupon( $coupon_id );\n\t\t\t\tif ( is_a( $coupon, 'WC_Coupon' ) ) {\n\t\t\t\t\t$scheduled_actions_ids = get_post_meta( $coupon_id, 'wc_sc_scheduled_actions_ids', true );\n\t\t\t\t\tif ( is_array( $scheduled_actions_ids ) && ! empty( $scheduled_actions_ids ) ) {\n\t\t\t\t\t\t$response['has_scheduled_actions'] = 'yes';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\twp_send_json( $response );\n\t\t}",
"public function onFlush(OnFlushEventArgs $args): void\n {\n $token = $this->getTokenStorage()->getToken();\n\n if (null === $token || $token instanceof ConsoleToken || !$this->getPermissionManager()->isEnabled()) {\n return;\n }\n\n $uow = $args->getEntityManager()->getUnitOfWork();\n $this->getObjectFilter()->beginTransaction();\n\n $this->checkAllScheduledByAction($uow->getScheduledEntityInsertions(), 'create');\n $this->checkAllScheduledByAction($uow->getScheduledEntityUpdates(), 'edit');\n $this->checkAllScheduledByAction($uow->getScheduledEntityDeletions(), 'delete');\n\n $this->getObjectFilter()->commit();\n }",
"public function wp_cron_scheduled_check()\n {\n }",
"static function canUpdate() {\n // as users can update their onw items\n return Session::haveRightsOr(self::$rightname, [\n CREATE,\n UPDATE,\n self::MANAGE_BG_EVENTS\n ]);\n }",
"public function isUnderTransaction();",
"public function isScheduledForUpsert($document)\n {\n return isset($this->documentUpserts[spl_object_hash($document)]);\n }",
"public function isExpectsToExecute() {\n return $this->state->getCode() == TaskState::ExpectsToExecute;\n }",
"public function isEvent()\n {\n return isset($this->status_changed) && ! is_null($this->status_changed);\n }"
] |
[
"0.7501643",
"0.7228504",
"0.6750008",
"0.6629385",
"0.65199625",
"0.6465619",
"0.64119124",
"0.62285113",
"0.6079999",
"0.59875816",
"0.59359205",
"0.58828944",
"0.5831366",
"0.5778416",
"0.57631904",
"0.5685744",
"0.56377876",
"0.56197417",
"0.55845076",
"0.5577598",
"0.5492672",
"0.5485806",
"0.5479838",
"0.54284316",
"0.54269326",
"0.54237515",
"0.5417094",
"0.5416512",
"0.5414618",
"0.5411226"
] |
0.78194445
|
0
|
INTERNAL: Removes an entity from the identity map. This effectively detaches the entity from the persistence management of Doctrine.
|
public function removeFromIdentityMap($entity)
{
$oid = spl_object_hash($entity);
$classMetadata = $this->manager->getClassMetadata(get_class($entity));
$idHash = implode(' ', $this->entityIdentifiers[$oid]);
if ($idHash === '') {
throw new \InvalidArgumentException('Entity has no identity');
}
$className = $classMetadata->getRootEntityName();
if (isset($this->identityMap[$className][$idHash])) {
unset($this->identityMap[$className][$idHash]);
unset($this->readOnlyObjects[$oid]);
//$this->entityStates[$oid] = self::STATE_DETACHED;
return true;
}
return false;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function remove($entity) {\n $this->entityManager->remove($entity);\n $this->entityManager->flush($entity);\n }",
"public function remove($entity)\n {\n $this->em->remove($entity);\n $this->em->flush();\n }",
"public function remove($entity)\r\n {\r\n \t$cacheKey = $this->getCacheKey($entity->getPrimaryKey());\r\n \tunset($this->_entities[$cacheKey]);\r\n \t$this->getCache()->remove($cacheKey);\r\n }",
"public function removeEntity($entity)\n\t{\n\t\t$entityManager = $this->getDoctrine()->getManager();\n\t $entityManager->remove($entity);\n\t $entityManager->flush();\n\t}",
"private function remove()\n {\n $this->checkPersister();\n\n $this->persister->beginTransaction();\n foreach ($this as $entity) {\n if (!empty($entity)) {\n $this->persister->remove($entity);\n }\n }\n\n $this->persister->commitTransaction();\n }",
"protected function remove($entity)\n {\n if (!$this->em()->isOpen()) {\n $this->getDoctrine()->resetManager();\n }\n\n $this->em()->remove($entity);\n $this->em()->flush();\n }",
"public static function removeIdentity() {\n\t\tCore_Store::remove('identity');\n\t}",
"public function delete($entity) {\r\n\t\tif($entity instanceof Model_Abstract) {\r\n\t\t\t$id = $entity->getIdentityValue();\r\n\t\t}\r\n\t\telse {\r\n\t\t\t$id = $entity;\r\n\t\t}\r\n\t\t// Need to unset the entity in the identity map if it exists\r\n\t\t$this->_unsetIdentity($id);\r\n\t\t \r\n\t\t$rowset = $this->_getGateway()->find($id);\r\n\t\tif($rowset->count() > 0) {\r\n\t\t\t$row = $rowset->current();\r\n\t\t\t$result = $row->delete();\r\n\t\t}\r\n\t}",
"public function postRemove($entity);",
"public function preRemove($entity);",
"public function remove($entity)\n {\n $visited = [];\n $this->doRemove($entity, $visited);\n }",
"public function delete($entity)\n {\n $this->getObjectManager()->remove($entity);\n $this->getObjectManager()->flush();\n }",
"abstract public function delete(Entity $oMappedEntity);",
"public function deleteModel($entity){\n $this->entityManager->remove($entity);\n $this->entityManager->flush();\n }",
"public function remove(Entity\\Base $entity)\n {\n $this->getEntityManager()->remove($entity);\n }",
"public static function unRegisterEntity( $handle ) {\n\t\tunset( self::$activeIds[ self::$activeHandles[ $handle ] ] );\n\t\tunset( self::$activeHandles[ $handle ] );\n\t}",
"public static function DeleteById($entity)\n {\n //When the precedent is GetById\n if(isset(StorageManager::$entities[$entity->Alias]))\n {\n unset(StorageManager::$entities[$entity->Alias][$entity->IdEntite]);\n }\n\n //When the precedent request is getByArg\n $stores = StorageManager::Find($entity);\n\n if(count($store) > 0 )\n {\n foreach($stores as $store)\n {\n if(isset($store::$entities))\n {\n unset($store::$entities[$entity->Alias][$entity->IdEntite]);\n }\n }\n }\n }",
"public function unregister(IEntity &$entity) {\n\t\tif ($entity->getId() == NULL) {\n\t\t\tthrow new InvalidStateException(\"The entity has no ID, so it can not be unregistered.\");\n\t\t}\n\t\tif (!$this->isRegistered($entity->getId())) {\n\t\t\tthrow new InvalidStateException(\"The entity with id [$id] is not registered.\");\n\t\t}\n\t\tif (get_class($entity) != $this->entityClass) {\n\t\t\tthrow new InvalidArgumentException(\"The entity has to instance of [$this->entityClass], [\" . get_class($entity) . \"] given.\");\n\t\t}\n\t\tunset($this->registered[$entity->getId()]);\n\t}",
"public function scheduleForDelete($entity)\n {\n $oid = spl_object_hash($entity);\n if (isset($this->entityInsertions[$oid])) {\n if ($this->isInIdentityMap($entity)) {\n $this->removeFromIdentityMap($entity);\n }\n unset($this->entityInsertions[$oid], $this->entityStates[$oid]);\n\n return; // entity has not been persisted yet, so nothing more to do.\n }\n if (!$this->isInIdentityMap($entity)) {\n return;\n }\n $this->removeFromIdentityMap($entity);\n unset($this->entityUpdates[$oid]);\n if (!isset($this->entityDeletions[$oid])) {\n $this->entityDeletions[$oid] = $entity;\n $this->entityStates[$oid] = self::STATE_REMOVED;\n }\n }",
"public function remove()\n {\n $this->_getBackend()->remove($this->_id);\n }",
"public function delete($entity){ \n //TODO: Implement remove record.\n }",
"public function deleteEntity($entity): void\n {\n /** @var EntityRepository $repository */\n $repository = Prime::repository($entity);\n $mapper = $repository->mapper();\n\n $isReadOnly = $mapper->isReadOnly();\n $mapper->setReadOnly(false);\n\n $repository->disableEventNotifier();\n $repository->delete($entity);\n $repository->enableEventNotifier();\n\n $mapper->setReadOnly($isReadOnly);\n }",
"public function undelete(EntityAccess $entity): void\n {\n $entityManager = $this->entityFactory->getEntityManager();\n \n $metadata = $entityManager->getClassMetaData(get_class($entity));\n $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);\n $metadata->setIdGenerator(new AssignedGenerator());\n \n $versionField = $metadata->versionField;\n $metadata->setVersioned(false);\n $metadata->setVersionField(null);\n \n $entityManager->persist($entity);\n $entityManager->flush();\n \n $metadata->setVersioned(true);\n $metadata->setVersionField($versionField);\n }",
"public function delete() {\r\n\t\t$this->getMapper()->delete($this);\r\n\t}",
"public function remove($entityClass, $entityId)\n {\n $key = $this->buildKey($entityClass, $entityId);\n $this->collection->removeKey($key);\n unset($this->keys[$key]);\n }",
"public function removeFromIdentityMap($document)\n {\n $oid = spl_object_hash($document);\n $classMetadata = $this->dm->getClassMetadata(get_class($document));\n \n // Check if id is registered first\n if (!isset($this->documentIdentifiers[$oid])) {\n return false;\n }\n $id = $this->documentIdentifiers[$oid];\n\n if ( ! $classMetadata->isEmbeddedDocument) {\n $id = $classMetadata->getPHPIdentifierValue($id);\n }\n if ($id === '') {\n throw new \\InvalidArgumentException(\"The given document has no identity.\");\n }\n $className = $classMetadata->rootDocumentName;\n if (isset($this->identityMap[$className][$id])) {\n unset($this->identityMap[$className][$id]);\n $this->documentStates[$oid] = self::STATE_DETACHED;\n return true;\n }\n\n return false;\n }",
"public function clear() { $this->em->clear(); }",
"protected function _unsetIdentity($id) {\r\n\t\tif ($this->_hasIdentity($id)) {\r\n\t\t\tunset($this->_identityMap[$id]);\r\n\t\t}\r\n\t}",
"public function clear() { $this->_em->clear(); }",
"public function clear()\n {\n $this->_em->clear($this->_class->rootEntityName);\n }"
] |
[
"0.7267839",
"0.7161556",
"0.7087875",
"0.68914974",
"0.6699348",
"0.6645745",
"0.66303474",
"0.6623875",
"0.6512815",
"0.6447999",
"0.6407389",
"0.63041",
"0.6263506",
"0.61878633",
"0.61696035",
"0.61103743",
"0.6033797",
"0.6032359",
"0.59503365",
"0.5939949",
"0.5894022",
"0.5890417",
"0.5877056",
"0.5868583",
"0.5797949",
"0.5797381",
"0.57355773",
"0.5732822",
"0.5707103",
"0.5703178"
] |
0.71743983
|
1
|
Gets the changeset for an entity.
|
public function & getEntityChangeSet($entity)
{
$oid = spl_object_hash($entity);
$data = [];
if (!isset($this->entityChangeSets[$oid])) {
return $data;
}
return $this->entityChangeSets[$oid];
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getEntityChangeSet()\n {\n return $this->entityChangeSet;\n }",
"public function getChanges();",
"public function getChanges();",
"public function getChanged()\n {\n return $this->entity->getChanged();\n }",
"public function getDocumentChangeSet($document)\n {\n $oid = spl_object_hash($document);\n if (isset($this->documentChangeSets[$oid])) {\n return $this->documentChangeSets[$oid];\n }\n return array();\n }",
"public function getChange()\n {\n return $this->get(self::_CHANGE);\n }",
"public function getAffectedEntityVersions($entity)\n {\n $ret = [];\n\n if ($this->isManaged(get_class($entity))) {\n foreach ($this->affectedVersions as list($affectedEntity, $version)) {\n if (get_class($entity) === get_class($affectedEntity)) {\n $ret[]= $version;\n }\n }\n }\n\n return $ret;\n }",
"public function getChange();",
"public function getEntityClone()\n {\n return $this->entity;\n }",
"public function getEntity()\n {\n return $this->entity;\n }",
"public function getEntity()\n {\n return $this->entity;\n }",
"public function getEntity()\n {\n return $this->entity;\n }",
"public function getEntity()\r\n {\r\n return $this->entity;\r\n }",
"public function getObjectChangeSet(object $object): ChangeSet\n {\n return $this->objectChangeSets->getObjectChangeSet($object);\n }",
"public function getEntity()\n {\n return $this->_entity;\n }",
"public function getObjectForChange(): ObjectForChange\n {\n return $this->objectForChange;\n }",
"public function getEntity() {\n return $this->entity;\n }",
"public function entity() {\n\t\t$assoc = ($this->association) ? $this->association : $this->model;\n\t\tif (!empty($this->entityPath)) {\n\t\t\t$path = explode('.', $this->entityPath);\n\t\t\t$count = count($path);\n\t\t\tif ($count !== 3) {\n\t\t\t\treturn parent::entity();\n\t\t\t}\n\t\t\treturn Set::filter($path);\n\t\t}\n\t\treturn parent::entity();\n\t}",
"public function GetEntity(){\n\t\treturn $this->_entity;\n\t}",
"public function getEntities()\n {\n return $this->entities;\n }",
"public function getEntity()\n\t{\n\t \treturn $this->entity;\n\t}",
"public function getDataChangesList() {\n return DataChangeRecord::get()->filter([\n 'ChangeRecordID' => $this->owner->ID,\n 'ChangeRecordClass' => $this->owner->ClassName\n ]);\n }",
"public function entity()\r\n {\r\n return $this->entity;\r\n }",
"public function entity() {\n\t\t\treturn $this->entity;\n\t\t}",
"public function getEntities() {\n return $this->entities;\n }",
"public function changes()\r\n\t{\r\n\t\t$Change = App::make('Change');\r\n\r\n\t\treturn $Change::where('fmodel', 'GalleryItem')\r\n\t\t\t\t \t ->where('fid', $this->id)\r\n\t\t\t\t \t ->with('user')\r\n\t\t\t\t \t ->orderBy('created_at', 'DESC')\r\n\t\t\t\t \t ->get();\r\n\t}",
"public function getEntity( )\n {\n\n return $this->entity;\n\n }",
"public function getChanges()\n {\n $this->conn->initialize();\n $response = $this->conn->getClient()->request(\"/{$this->name}/_changes\");\n\n if (false === $response->isSuccessful()) {\n throw new \\RuntimeException('Request wasn\\'t successfull');\n }\n\n return JSONEncoder::decode($response->getContent());\n }",
"public function entity ()\n {\n return $this->_entity;\n }",
"public function getEntities()\n {\n return $this->_entities;\n }"
] |
[
"0.7138202",
"0.60301816",
"0.60301816",
"0.5950051",
"0.56234515",
"0.56115717",
"0.5517315",
"0.5429107",
"0.5399836",
"0.53871214",
"0.53871214",
"0.53871214",
"0.53533167",
"0.53494984",
"0.534666",
"0.53421867",
"0.5318921",
"0.53169423",
"0.5228007",
"0.51339304",
"0.51293343",
"0.5116172",
"0.50901335",
"0.50884724",
"0.50876164",
"0.5077082",
"0.50615185",
"0.5043711",
"0.50433385",
"0.49977326"
] |
0.74802804
|
0
|
Computes all the changes that have been done to entities and collections since the last commit and stores these changes in the _entityChangeSet map temporarily for access by the persisters, until the UoW commit is finished.
|
public function computeChangeSets()
{
// Compute changes for INSERTed entities first. This must always happen.
$this->computeScheduleInsertsChangeSets();
// Compute changes for other MANAGED entities. Change tracking policies take effect here.
foreach ($this->identityMap as $className => $entities) {
$class = $this->manager->getClassMetadata($className);
// Skip class if instances are read-only
if ($class->isReadOnly()) {
continue;
}
// If change tracking is explicit or happens through notification, then only compute
// changes on entities of that type that are explicitly marked for synchronization.
switch (true) {
case ($class->isChangeTrackingDeferredImplicit()):
$entitiesToProcess = $entities;
break;
case (isset($this->scheduledForSynchronization[$className])):
$entitiesToProcess = $this->scheduledForSynchronization[$className];
break;
default:
$entitiesToProcess = [];
}
foreach ($entitiesToProcess as $entity) {
// Ignore uninitialized proxy objects
if ($entity instanceof Proxy && !$entity->__isInitialized__) {
continue;
}
// Only MANAGED entities that are NOT SCHEDULED FOR INSERTION OR DELETION are processed here.
$oid = spl_object_hash($entity);
if (!isset($this->entityInsertions[$oid]) &&
!isset($this->entityDeletions[$oid]) &&
isset($this->entityStates[$oid])
) {
$this->computeChangeSet($class, $entity);
}
}
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function commit(): void\n {\n $this->eventDispatcher->dispatchPreFlush();\n\n if (\n $this->objectsToPersist === [] &&\n $this->objectsToUpdate === [] &&\n $this->objectsToRemove === []\n ) {\n return; // Nothing to do.\n }\n\n $objects = array_merge(\n $this->objectsToPersist,\n $this->objectsToUpdate,\n $this->objectsToRemove,\n );\n $this->eventDispatcher->dispatchPreFlushLifecycleCallbacks($objects);\n\n $this->eventDispatcher->dispatchOnFlush();\n\n $this->persister->executePersists();\n $this->persister->executeUpdates();\n $this->persister->executeRemoves();\n\n $this->eventDispatcher->dispatchPostFlush();\n\n $this->objectsToPersist = [];\n $this->objectsToUpdate = [];\n $this->objectsToRemove = [];\n $this->objectChangeSets = new ChangeSets();\n }",
"public function computeChangeSets()\n {\n $this->computeScheduleInsertsChangeSets();\n\n // Compute changes for other MANAGED documents. Change tracking policies take effect here.\n foreach ($this->identityMap as $className => $documents) {\n $class = $this->dm->getClassMetadata($className);\n if($class->isEmbeddedDocument) {\n // Embedded documents should only compute by the document itself which include the embedded document.\n // This is done separately later.\n // @see computeChangeSet()\n // @see computeAssociationChanges()\n continue;\n }\n\n // If change tracking is explicit or happens through notification, then only compute\n // changes on documents of that type that are explicitly marked for synchronization.\n $documentsToProcess = ! $class->isChangeTrackingDeferredImplicit() ?\n (isset($this->scheduledForDirtyCheck[$className]) ?\n $this->scheduledForDirtyCheck[$className] : array())\n : $documents;\n\n foreach ($documentsToProcess as $document) {\n // Ignore uninitialized proxy objects\n if (/* $document is readOnly || */ $document instanceof Proxy && ! $document->__isInitialized__) {\n continue;\n }\n // Only MANAGED documents that are NOT SCHEDULED FOR INSERTION are processed here.\n $oid = spl_object_hash($document);\n if ( ! isset($this->documentInsertions[$oid]) && isset($this->documentStates[$oid])) {\n $this->computeChangeSet($class, $document);\n }\n }\n }\n }",
"public function commit($entity = null)\n {\n // Compute changes done since last commit.\n if ($entity === null) {\n $this->computeChangeSets();\n } elseif (is_object($entity)) {\n $this->computeSingleEntityChangeSet($entity);\n } elseif (is_array($entity)) {\n foreach ((array)$entity as $object) {\n $this->computeSingleEntityChangeSet($object);\n }\n }\n if (!($this->entityInsertions ||\n $this->entityDeletions ||\n $this->entityUpdates ||\n $this->collectionUpdates ||\n $this->collectionDeletions ||\n $this->orphanRemovals)\n ) {\n return; // Nothing to do.\n }\n if ($this->orphanRemovals) {\n foreach ($this->orphanRemovals as $orphan) {\n $this->remove($orphan);\n }\n }\n // Now we need a commit order to maintain referential integrity\n $commitOrder = $this->getCommitOrder();\n\n // Collection deletions (deletions of complete collections)\n // foreach ($this->collectionDeletions as $collectionToDelete) {\n // //fixme: collection mutations\n // $this->getCollectionPersister($collectionToDelete->getMapping())->delete($collectionToDelete);\n // }\n if ($this->entityInsertions) {\n foreach ($commitOrder as $class) {\n $this->executeInserts($class);\n }\n }\n if ($this->entityUpdates) {\n foreach ($commitOrder as $class) {\n $this->executeUpdates($class);\n }\n }\n // Extra updates that were requested by persisters.\n if ($this->extraUpdates) {\n $this->executeExtraUpdates();\n }\n // Collection updates (deleteRows, updateRows, insertRows)\n foreach ($this->collectionUpdates as $collectionToUpdate) {\n //fixme: decide what to do with collection mutation if API does not support this\n //$this->getCollectionPersister($collectionToUpdate->getMapping())->update($collectionToUpdate);\n }\n // Entity deletions come last and need to be in reverse commit order\n if ($this->entityDeletions) {\n for ($count = count($commitOrder), $i = $count - 1; $i >= 0 && $this->entityDeletions; --$i) {\n $this->executeDeletions($commitOrder[$i]);\n }\n }\n\n // Take new snapshots from visited collections\n foreach ($this->visitedCollections as $coll) {\n $coll->takeSnapshot();\n }\n\n // Clear up\n $this->entityInsertions =\n $this->entityUpdates =\n $this->entityDeletions =\n $this->extraUpdates =\n $this->entityChangeSets =\n $this->collectionUpdates =\n $this->collectionDeletions =\n $this->visitedCollections =\n $this->scheduledForSynchronization =\n $this->orphanRemovals = [];\n }",
"public function flushAllChanges()\r\n {\r\n $this->em->flush();\r\n }",
"public function flushChanges()\n {\n $this->om->flush();\n }",
"private function computeScheduleInsertsChangeSets()\n {\n foreach ($this->entityInsertions as $entity) {\n $class = $this->manager->getClassMetadata(get_class($entity));\n $this->computeChangeSet($class, $entity);\n }\n }",
"public function calculateChangeSet()\n {\n $set = [];\n foreach ($this->current as $key => $current) {\n $original = isset($this->original[$key]) ? $this->original[$key] : null;\n $set[$key]['old'] = $original;\n $set[$key]['new'] = $current;\n }\n foreach ($this->remove as $key) {\n $set[$key]['old'] = $this->original[$key];\n $set[$key]['new'] = null;\n }\n ksort($set);\n return $set;\n }",
"private function computeScheduleInsertsChangeSets()\n {\n foreach ($this->documentInsertions as $document) {\n $class = $this->dm->getClassMetadata(get_class($document));\n\n $this->computeChangeSet($class, $document);\n }\n }",
"abstract protected function commit_changes($changes);",
"public function flush()\r\n {\r\n foreach ($this->_collections as $key => $coll) {\r\n $coll->takeSnapshot();\r\n }\r\n foreach ($this->_tables as $table) {\r\n $table->setAttribute(Doctrine::ATTR_LOAD_REFERENCES, true);\r\n }\r\n $this->_initializedRelations = null;\r\n $this->_collections = null;\r\n $this->_tables = null;\r\n }",
"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 }",
"public function flush() {\n if ($this->c_owner) {\n if ($this->update('owner', $this->owner, Project::$tableName)) {\n $this->c_owner = false;\n }\n }\n if ($this->c_name) {\n if ($this->update('name', $this->name, Project::$tableName)) {\n $this->c_name = false;\n }\n }\n if ($this->c_description) {\n if ($this->update('description', $this->description, Project::$tableName)) {\n $this->c_description = false;\n }\n }\n \n if ($this->c_deadline) {\n if ($this->update('deadline', $this->deadline, Project::$tableName)) {\n $this->c_deadline = false;\n }\n }\n if ($this->c_time) {\n if ($this->update('time', $this->time, Project::$tableName)) {\n $this->c_time = false;\n }\n }\n }",
"public function ApplyChanges()\n {\n parent::ApplyChanges();\n\n // Update data\n $this->Update();\n }",
"public function getEntityChangeSet()\n {\n return $this->entityChangeSet;\n }",
"private function getCommitOrder(array $entityChangeSet = null)\n {\n if ($entityChangeSet === null) {\n $entityChangeSet = array_merge($this->entityInsertions, $this->entityUpdates, $this->entityDeletions);\n }\n $calc = $this->getCommitOrderCalculator();\n // See if there are any new classes in the changeset, that are not in the\n // commit order graph yet (don't have a node).\n // We have to inspect changeSet to be able to correctly build dependencies.\n // It is not possible to use IdentityMap here because post inserted ids\n // are not yet available.\n /** @var ApiMetadata[] $newNodes */\n $newNodes = [];\n foreach ((array)$entityChangeSet as $entity) {\n $class = $this->manager->getClassMetadata(get_class($entity));\n if ($calc->hasNode($class->getName())) {\n continue;\n }\n $calc->addNode($class->getName(), $class);\n $newNodes[] = $class;\n }\n // Calculate dependencies for new nodes\n while ($class = array_pop($newNodes)) {\n foreach ($class->getAssociationMappings() as $assoc) {\n if (!($assoc['isOwningSide'] && $assoc['type'] & ApiMetadata::TO_ONE)) {\n continue;\n }\n $targetClass = $this->manager->getClassMetadata($assoc['targetEntity']);\n if (!$calc->hasNode($targetClass->getName())) {\n $calc->addNode($targetClass->getName(), $targetClass);\n $newNodes[] = $targetClass;\n }\n $calc->addDependency($targetClass->getName(), $class->name, (int)empty($assoc['nullable']));\n // If the target class has mapped subclasses, these share the same dependency.\n if (!$targetClass->getSubclasses()) {\n continue;\n }\n foreach ($targetClass->getSubclasses() as $subClassName) {\n $targetSubClass = $this->manager->getClassMetadata($subClassName);\n if (!$calc->hasNode($subClassName)) {\n $calc->addNode($targetSubClass->name, $targetSubClass);\n $newNodes[] = $targetSubClass;\n }\n $calc->addDependency($targetSubClass->name, $class->name, 1);\n }\n }\n }\n\n return $calc->sort();\n }",
"protected function commit()\n {\n $commit = function(Control $ctrl) use(&$commit)\n {\n $this->vs[$ctrl->attr('id')] = $ctrl->getVS();\n $this->controls[$ctrl->attr('id')] = $ctrl;\n if ($ctrl instanceof Panel)\n {\n foreach ($ctrl as $uniqueID => $child)\n {\n $commit($child);\n }\n }\n };\n foreach ($this->controls as $ctrl) $commit($ctrl);\n }",
"abstract protected function getEntitiesToSync();",
"public function afterCommitCallback()\n {\n parent::afterCommitCallback();\n Mage::getSingleton('index/indexer')->processEntityAction(\n $this, self::ENTITY, Mage_Index_Model_Event::TYPE_SAVE\n );\n return $this;\n }",
"public function afterCommitCallback()\n {\n parent::afterCommitCallback();\n\n /** @var \\Mage_Index_Model_Indexer $indexer */\n $indexer = Mage::getSingleton('index/indexer');\n $indexer->processEntityAction($this, self::ENTITY, Mage_Index_Model_Event::TYPE_SAVE);\n\n return $this;\n }",
"protected function processComputingQueue()\n {\n if (!$this->computingQueue instanceof SplObjectStorage) {\n return;\n }\n\n foreach ($this->computingQueue as $entity) {\n $this->computeOrRecomputeEntityChangeSet($entity);\n }\n $this->computingQueue->removeAll($this->computingQueue);\n }",
"public function postFlush(): void\n {\n try {\n foreach ($this->createdObjects as $object) {\n $this->publishUpdate($object, $this->createdObjects[$object], 'create');\n }\n\n foreach ($this->updatedObjects as $object) {\n $this->publishUpdate($object, $this->updatedObjects[$object], 'update');\n }\n\n foreach ($this->deletedObjects as $object) {\n $this->publishUpdate($object, $this->deletedObjects[$object], 'delete');\n }\n } finally {\n $this->reset();\n }\n }",
"function commitChanges() {\r\n\t\tglobal $file;\r\n\t\tglobal $expenses;\r\n\r\n\t\tsortExpensesDate();\r\n\t\trenumber(&$expenses);\r\n\r\n\t\t$xmlString = toXML();\r\n\r\n\t\t$fp = fopen($file.\".bak\", \"w\");\r\n\t\tflock($fp, LOCK_EX);\r\n\t\tfputs($fp, $xmlString);\r\n\t\tflock($fp, LOCK_UN);\r\n\t\tfclose($fp);\r\n\r\n\t\tswapFiles();\r\n\t}",
"public function ApplyChanges()\n {\n parent::ApplyChanges();\n\n }",
"protected function doAfterContainerSave() {\n if (!$this->isPersistent()) $this->origNodeId = $this->container->getPrimaryKey();\n \n if (!$this->lockStore) $this->endStore(true);\n \n $this->updateFromContainer();\n }",
"private function commitAll(): void\n {\n while ($this->transactionNestingLevel !== 0) {\n if ($this->autoCommit === false && $this->transactionNestingLevel === 1) {\n // When in no auto-commit mode, the last nesting commit immediately starts a new transaction.\n // Therefore we need to do the final commit here and then leave to avoid an infinite loop.\n $this->commit();\n\n return;\n }\n\n $this->commit();\n }\n }",
"public function analyzeModifications()\n {\n $this->logManager->logMessage(lang('Revision.analyzeModifications'));\n\n foreach ($this->files as $file) {\n // Compare the previous snapshot with the new snapshot from update.\n $oldCopy = $this->workspace . 'oldSnapshot' . \\DIRECTORY_SEPARATOR . $file['destination'];\n $project = $this->config->rootPath . $file['destination'];\n $doCopy = true;\n\n // If hashes are different, this can be new or modified.\n if (! FileManager::areIdenticalFiles($oldCopy, $file['origin'])\n || ($this->config->fallThroughToProject && ! FileManager::areIdenticalFiles($project, $file['origin']))\n ) {\n $newCopy = $this->workspace . 'newSnapshot' . \\DIRECTORY_SEPARATOR . $file['destination'];\n\n try {\n if (! is_file($oldCopy) || ! is_file($project)) {\n $this->fileManager->createdFiles[] = $file['destination']; // @codeCoverageIgnore\n } elseif (is_file($file['origin'])) {\n $this->fileManager->modifiedFiles[] = $file['destination'];\n } else {\n // @codeCoverageIgnoreStart\n $this->fileManager->deletedFiles[] = $file['destination'];\n $doCopy = false;\n // @codeCoverageIgnoreEnd\n }\n\n if ($doCopy) {\n $this->filesystem->copy($file['origin'], $newCopy, true);\n }\n\n // @codeCoverageIgnoreStart\n } catch (IOExceptionInterface $e) {\n $this->logManager->logMessage($e->getMessage(), 'error');\n // @codeCoverageIgnoreEnd\n }\n }\n }\n\n // Log the update results\n $cc = \\count($this->fileManager->createdFiles);\n $mc = \\count($this->fileManager->modifiedFiles);\n $dc = \\count($this->fileManager->deletedFiles);\n\n $cs = 1 === $cc ? lang('Revision.fileSingular') : lang('Revision.filePlural');\n $ms = 1 === $mc ? lang('Revision.fileSingular') : lang('Revision.filePlural');\n $ds = 1 === $dc ? lang('Revision.fileSingular') : lang('Revision.filePlural');\n\n $this->logManager->logMessage([\n lang('Revision.createdFilesAfterUpdate', [$cc, $cs]),\n lang('Revision.modifiedFilesAfterUpdate', [$mc, $ms]),\n lang('Revision.deletedFilesAfterUpdate', [$dc, $ds]),\n ]);\n }",
"public function applyChanges()\n {\n $em = $this->doctrine->getManager();\n $em->flush();\n\n // TODO: Can we be sure that the changes are available in the DB now?\n $ch = $this->getMasterRabbit()->channel();\n $msg = new AMQPMessage(\"sync\");\n $ch->basic_publish($msg, \"\", $this->name . \"_master\");\n }",
"public function updateGitHooks()\n {\n $tasks = [];\n $hooks = ['pre-commit'];\n \n foreach($hooks as $hook) {\n $tasks += $this->getAppendingTasks($hook);\n }\n\n return $this->collectionBuilder()->addTaskList($tasks);\n }",
"public function flush()\n {\n $this->unitOfWork->commit();\n }",
"protected function doInitialize()\n {\n // Has NEW objects added through add(). Remember them.\n $newObjects = [];\n if ($this->isDirty) {\n $newObjects = $this->collection->toArray();\n }\n $this->collection->clear();\n $this->manager->getUnitOfWork()->loadCollection($this);\n $this->takeSnapshot();\n // Reattach NEW objects added through add(), if any.\n if ($newObjects) {\n foreach ($newObjects as $obj) {\n $this->collection->add($obj);\n }\n $this->isDirty = true;\n }\n }"
] |
[
"0.67323756",
"0.65784436",
"0.65124637",
"0.5842119",
"0.58298814",
"0.5798723",
"0.56928986",
"0.5655057",
"0.56357795",
"0.56027126",
"0.55588394",
"0.5493468",
"0.54738575",
"0.54607826",
"0.5354258",
"0.53215307",
"0.52805936",
"0.5276481",
"0.52614564",
"0.525702",
"0.52445054",
"0.5200688",
"0.519713",
"0.51856",
"0.5175668",
"0.51440114",
"0.51401275",
"0.5127293",
"0.51014435",
"0.50853556"
] |
0.7001201
|
0
|
INTERNAL: Schedules an orphaned entity for removal. The remove() operation will be invoked on that entity at the beginning of the next commit of this UnitOfWork.
|
public function scheduleOrphanRemoval($entity)
{
$this->orphanRemovals[spl_object_hash($entity)] = $entity;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function scheduleForDelete($entity)\n {\n $oid = spl_object_hash($entity);\n if (isset($this->entityInsertions[$oid])) {\n if ($this->isInIdentityMap($entity)) {\n $this->removeFromIdentityMap($entity);\n }\n unset($this->entityInsertions[$oid], $this->entityStates[$oid]);\n\n return; // entity has not been persisted yet, so nothing more to do.\n }\n if (!$this->isInIdentityMap($entity)) {\n return;\n }\n $this->removeFromIdentityMap($entity);\n unset($this->entityUpdates[$oid]);\n if (!isset($this->entityDeletions[$oid])) {\n $this->entityDeletions[$oid] = $entity;\n $this->entityStates[$oid] = self::STATE_REMOVED;\n }\n }",
"public function scheduleOrphanRemoval($document)\n {\n $this->orphanRemovals[spl_object_hash($document)] = $document;\n }",
"private function remove()\n {\n $this->checkPersister();\n\n $this->persister->beginTransaction();\n foreach ($this as $entity) {\n if (!empty($entity)) {\n $this->persister->remove($entity);\n }\n }\n\n $this->persister->commitTransaction();\n }",
"public function preRemove($entity);",
"public function scheduleForDelete($document)\n {\n $oid = spl_object_hash($document);\n\n if (isset($this->documentInsertions[$oid])) {\n if ($this->isInIdentityMap($document)) {\n $this->removeFromIdentityMap($document);\n }\n unset($this->documentInsertions[$oid]);\n return; // document has not been persisted yet, so nothing more to do.\n }\n\n if ( ! $this->isInIdentityMap($document)) {\n return; // ignore\n }\n\n $this->removeFromIdentityMap($document);\n $this->documentStates[$oid] = self::STATE_REMOVED;\n\n if (isset($this->documentUpdates[$oid])) {\n unset($this->documentUpdates[$oid]);\n }\n if ( ! isset($this->documentDeletions[$oid])) {\n $this->documentDeletions[$oid] = $document;\n }\n }",
"public function deleteObject(){\n $qry = new DeleteEntityQuery($this);\n $this->getContext()->addQuery($qry);\n //$this->removeFromParentCollection();\n }",
"public function postRemove($entity);",
"public function remove($entity) {\n $this->entityManager->remove($entity);\n $this->entityManager->flush($entity);\n }",
"protected function remove($entity)\n {\n if (!$this->em()->isOpen()) {\n $this->getDoctrine()->resetManager();\n }\n\n $this->em()->remove($entity);\n $this->em()->flush();\n }",
"public function remove($entity)\n {\n $this->em->remove($entity);\n $this->em->flush();\n }",
"protected function performForceDestroy(Model $entity): void\n {\n $entity->forceDelete();\n }",
"protected function performDestroy(Model $entity): void\n {\n $entity->delete();\n }",
"public function clear() { $this->em->clear(); }",
"public function remove()\n {\n $this->_getBackend()->remove($this->_id);\n }",
"public function removeEntity($entity)\n\t{\n\t\t$entityManager = $this->getDoctrine()->getManager();\n\t $entityManager->remove($entity);\n\t $entityManager->flush();\n\t}",
"public function clear() { $this->_em->clear(); }",
"public function destroyObjectPermanently(\n PhabricatorDestructionEngine $engine) {\n\n $this->openTransaction();\n $this->delete();\n $this->saveTransaction();\n }",
"public function destroyObjectPermanently(\n PhabricatorDestructionEngine $engine) {\n\n $this->openTransaction();\n $this->delete();\n $this->saveTransaction();\n }",
"public function clear()\n {\n $this->_em->clear($this->_class->rootEntityName);\n }",
"public function doPermissionFix(PreFlushEventArgs $event)\n {\n if ($this->getState() === null) {\n $uow = $event->getObjectManager()->getUnitOfWork();\n\n // this entity should always be in the identity map or else this event should not be\n // triggered. But still check it anyways in case someone, for some unknown reasons,\n // triggers this callback manually.\n\n if ($uow->isInIdentityMap($this)) {\n $uow->scheduleOrphanRemoval($this);\n }\n }\n }",
"function __destruct()\n {\n $this->entityManager->flush();\n }",
"public function orphanRemoval()\n {\n $this->mapping['orphanRemoval'] = true;\n\n return $this;\n }",
"public function preRemove(LifecycleEventArgs $args)\n {\n $entity = $args->getEntity();\n if ($this->entityConnector->isWorkflowAware($entity)) {\n $workflowItem = $this->entityConnector->getWorkflowItem($entity);\n if ($workflowItem) {\n $args->getEntityManager()->remove($workflowItem);\n }\n }\n }",
"public function delete() \n {\n DomainWatcher::addDeletedObject($this);\n }",
"public function delete($entity)\n {\n $this->getObjectManager()->remove($entity);\n $this->getObjectManager()->flush();\n }",
"public function remove($entity)\r\n {\r\n \t$cacheKey = $this->getCacheKey($entity->getPrimaryKey());\r\n \tunset($this->_entities[$cacheKey]);\r\n \t$this->getCache()->remove($cacheKey);\r\n }",
"public function delete()\n {\n $this->queue->delete($this);\n }",
"public function delete()\n {\n $entities = $this->entities;\n Database::getInstance()->doTransaction(\n function() use ($entities)\n {\n foreach ($entities as $entity)\n {\n $entity->delete();\n }\n }\n );\n }",
"public function delete(): void\n {\n $this->instances->demo()->runHook($this->root(), 'delete:before', $this);\n\n Dir::remove($this->root());\n $this->instances->delete($this->id);\n\n $this->instances->demo()->runHook($this->root(), 'delete:after', $this);\n }",
"public function delete() {\n // Fail due to double delete\n assert(!$this->hasBeenDeleted);\n\n // Initialize delete record cache, if nonextant\n if (!isset(self::$deleteRecordPreparedStatementCache)) {\n self::$deleteRecordPreparedStatementCache = array();\n }\n \n // Initiate implicit tx, if nonextant explicit tx \n $is_implicit_tx = false;\n if (self::$numTransactions == 0) {\n $is_implicit_tx = true; \n self::beginTx();\n }\n\n // Fail due to invalid database connection\n assert(isset(self::$databaseHandle));\n\n // Delete this record and all child records \n $table_name = static::getFullyQualifiedTableName();\n \n try {\n // Fetch prepared statement from cache, if present. Otherwise, create it.\n if (isset(self::$deleteRecordPreparedStatementCache[$table_name])) {\n // Fetch delete query from cache\n $delete_record_stmt = self::$deleteRecordPreparedStatementCache[$table_name];\n } else {\n $fully_qualified_table_name = static::getFullyQualifiedTableName();\n $delete_query = \"DELETE FROM {$fully_qualified_table_name} \"\n . $this->genPrimaryKeyWhereClause();\n\n $delete_record_stmt = self::$databaseHandle->prepare($delete_query);\n self::$deleteRecordPreparedStatementCache[$table_name] = $delete_record_stmt;\n }\n \n // Delete children, schedule assets for deletion\n $this->deleteChildren();\n self::$assetDeletors = array_merge(self::$assetDeletors, $this->getAssets());\n\n // Bind record's 'id' to delete-query\n $this->bindId($delete_record_stmt);\n\n // Remove record\n $delete_record_stmt->execute();\n } catch (PDOException $e) {\n self::$databaseHandle->rollback();\n die(\"\\nERROR: \" . $e->getMessage() . \"\\n\");\n }\n\n // Close implicit transaction\n if ($is_implicit_tx) {\n self::endTx();\n }\n\n // Indicate object's deletion\n $this->hasBeenDeleted = true;\n }"
] |
[
"0.6263458",
"0.60353696",
"0.57199657",
"0.5636486",
"0.53558457",
"0.52486706",
"0.52469325",
"0.5242715",
"0.51846224",
"0.51770914",
"0.50095665",
"0.49347878",
"0.49297535",
"0.49146298",
"0.49129447",
"0.48956",
"0.48462284",
"0.48233566",
"0.48118144",
"0.48082808",
"0.48039103",
"0.47824866",
"0.47738877",
"0.4758882",
"0.47514287",
"0.47276133",
"0.4722137",
"0.4713164",
"0.47040784",
"0.47012284"
] |
0.68756914
|
0
|
Schedules an entity for dirtychecking at committime.
|
public function scheduleForDirtyCheck($entity)
{
$rootClassName =
$this->manager->getClassMetadata(get_class($entity))->getRootEntityName();
$this->scheduledForSynchronization[$rootClassName][spl_object_hash($entity)] = $entity;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function scheduleForDirtyCheck($document)\n {\n $rootClassName = $this->dm->getClassMetadata(get_class($document))->rootDocumentName;\n $this->scheduledForDirtyCheck[$rootClassName][spl_object_hash($document)] = $document;\n }",
"public function onFlush(OnFlushEventArgs $args): void\n {\n $token = $this->getTokenStorage()->getToken();\n\n if (null === $token || $token instanceof ConsoleToken || !$this->getPermissionManager()->isEnabled()) {\n return;\n }\n\n $uow = $args->getEntityManager()->getUnitOfWork();\n $this->getObjectFilter()->beginTransaction();\n\n $this->checkAllScheduledByAction($uow->getScheduledEntityInsertions(), 'create');\n $this->checkAllScheduledByAction($uow->getScheduledEntityUpdates(), 'edit');\n $this->checkAllScheduledByAction($uow->getScheduledEntityDeletions(), 'delete');\n\n $this->getObjectFilter()->commit();\n }",
"public function commit(): void\n {\n $this->eventDispatcher->dispatchPreFlush();\n\n if (\n $this->objectsToPersist === [] &&\n $this->objectsToUpdate === [] &&\n $this->objectsToRemove === []\n ) {\n return; // Nothing to do.\n }\n\n $objects = array_merge(\n $this->objectsToPersist,\n $this->objectsToUpdate,\n $this->objectsToRemove,\n );\n $this->eventDispatcher->dispatchPreFlushLifecycleCallbacks($objects);\n\n $this->eventDispatcher->dispatchOnFlush();\n\n $this->persister->executePersists();\n $this->persister->executeUpdates();\n $this->persister->executeRemoves();\n\n $this->eventDispatcher->dispatchPostFlush();\n\n $this->objectsToPersist = [];\n $this->objectsToUpdate = [];\n $this->objectsToRemove = [];\n $this->objectChangeSets = new ChangeSets();\n }",
"public function isScheduledForDirtyCheck($entity)\n {\n $rootEntityName = $this->manager->getClassMetadata(get_class($entity))->getRootEntityName();\n\n return isset($this->scheduledForSynchronization[$rootEntityName][spl_object_hash($entity)]);\n }",
"public function flush()\n {\n $this->unitOfWork->commit();\n }",
"public function onFlush(OnFlushEventArgs $event)\n {\n $this->scheduledSyncMap = [];\n $this->entityManager = $event->getEntityManager();\n\n // check for logged user is for confidence that data changes mes from UI, not from sync process.\n if (!$this->tokenAccessor->hasUser()) {\n return;\n }\n\n $this->scheduleEntitiesSync($this->getEntitiesToSync());\n\n $this->scheduledSyncMap = [];\n $this->entityManager = null;\n }",
"public function afterSaveCommit(): void\n {\n }",
"public function completable()\n {\n $this->status = self::STATUS_COMPLETABLE;\n $this->save();\n\n\t\t$this->fireModelEvent('completable');\n }",
"public function queue()\n {\n $em = $this->getEntityManager();\n\n $task = new EventConsequenceTask();\n $task->setConsequence($this->entity);\n\n $em->persist($task);\n $em->flush();\n }",
"public function applyChanges()\n {\n $em = $this->doctrine->getManager();\n $em->flush();\n\n // TODO: Can we be sure that the changes are available in the DB now?\n $ch = $this->getMasterRabbit()->channel();\n $msg = new AMQPMessage(\"sync\");\n $ch->basic_publish($msg, \"\", $this->name . \"_master\");\n }",
"public function commitEvents();",
"public function save()\n {\n $entities = $this->entities;\n Database::getInstance()->doTransaction(\n function() use ($entities)\n {\n foreach ($entities as $entity)\n {\n if ($entity->getMarkedAsDeleted())\n {\n $entity->delete();\n } \n else if ($entity->getMarkedAsUpdated())\n {\n $entity->saveWithDetails();\n }\n }\n }\n );\n }",
"public function markAsPersisted(): void;",
"public function commitUpdate();",
"public function flushAllChanges()\r\n {\r\n $this->em->flush();\r\n }",
"public function committed();",
"protected function tryScheduleSync($entity)\n {\n $key = spl_object_hash($entity);\n\n if (isset($this->scheduledSyncMap[$key])) {\n return;\n }\n\n $this->scheduledSyncMap[$key] = true;\n\n if ($this->isTwoWaySyncEnabled($entity)) {\n $this->scheduleSync($entity);\n }\n }",
"public function onFlush(OnFlushEventArgs $event) {\n\n $em = $event->getEntityManager();\n $uow = $em->getUnitOfWork();\n\n foreach($uow->getScheduledEntityUpdates() as $entity) {\n\n if($entity instanceof SaleEntity || $entity instanceof SaleItemEntity) {\n\n $changeSet = $uow->getEntityChangeSet($entity);\n\n // Add state change/transition record.\n if(isset($changeSet['state'][1]) && $changeSet['state'][0]->getId() != $changeSet['state'][1]->getId()) {\n\n $beforeState = $changeSet['state'][0];\n $afterState = $changeSet['state'][1];\n\n if($entity instanceof SaleEntity) {\n $transition = new SaleWorkflowTransition();\n $transition->setSale($entity);\n } else {\n $transition = new SaleItemWorkflowTransition();\n $transition->setSaleItem($entity);\n }\n\n $transition->setBeforeState($beforeState);\n $transition->setAfterState($afterState);\n $transition->setCreatedAt(Carbon::now());\n $transition->setUpdatedAt(Carbon::now());\n\n $uow->persist($transition);\n\n $meta = $em->getClassMetadata(get_class($transition));\n $uow->computeChangeSet($meta, $transition);\n\n }\n\n }\n\n }\n\n }",
"public function _isDirty() {}",
"public function scheduleForDelete($entity)\n {\n $oid = spl_object_hash($entity);\n if (isset($this->entityInsertions[$oid])) {\n if ($this->isInIdentityMap($entity)) {\n $this->removeFromIdentityMap($entity);\n }\n unset($this->entityInsertions[$oid], $this->entityStates[$oid]);\n\n return; // entity has not been persisted yet, so nothing more to do.\n }\n if (!$this->isInIdentityMap($entity)) {\n return;\n }\n $this->removeFromIdentityMap($entity);\n unset($this->entityUpdates[$oid]);\n if (!isset($this->entityDeletions[$oid])) {\n $this->entityDeletions[$oid] = $entity;\n $this->entityStates[$oid] = self::STATE_REMOVED;\n }\n }",
"public static function commit()\n {\n }",
"public function testNothingModifiedLastRunSet()\n {\n $this->_cs->updateLastRun($this->_name);\n sleep(2);\n\n $check = $this->_cs->checkEntitiesChanged($this->_name, array(self::ENTITY_NAME));\n $this->assertFalse($check);\n }",
"public function flushChanges()\n {\n $this->om->flush();\n }",
"public function alive()\n {\n $this->assert();\n $this->task->setState($this->task->getState());\n $this->taskRepository->update($this->task);\n }",
"public function postFlush(): void\n {\n try {\n foreach ($this->createdObjects as $object) {\n $this->publishUpdate($object, $this->createdObjects[$object], 'create');\n }\n\n foreach ($this->updatedObjects as $object) {\n $this->publishUpdate($object, $this->updatedObjects[$object], 'update');\n }\n\n foreach ($this->deletedObjects as $object) {\n $this->publishUpdate($object, $this->deletedObjects[$object], 'delete');\n }\n } finally {\n $this->reset();\n }\n }",
"public function onFlush($entity, $uowEntityState, UnitOfWork $uow);",
"public function commit()\n {\n if ($this->hasActiveTransaction) {\n parent::commit();\n $this->hasActiveTransaction = false;\n }\n }",
"public function testflush()\n {\n self::assertTrue($this->object->flush());\n }",
"public function scheduleForUpdate($entity)\n {\n $oid = spl_object_hash($entity);\n if (!isset($this->entityIdentifiers[$oid])) {\n throw new \\InvalidArgumentException('Entity has no identity');\n }\n if (isset($this->entityDeletions[$oid])) {\n throw new \\InvalidArgumentException('Entity is removed');\n }\n if (!isset($this->entityUpdates[$oid]) && !isset($this->entityInsertions[$oid])) {\n $this->entityUpdates[$oid] = $entity;\n }\n }",
"public function commit() {}"
] |
[
"0.5977011",
"0.5935937",
"0.5903814",
"0.5819824",
"0.5568772",
"0.5543887",
"0.5423974",
"0.53767806",
"0.53666484",
"0.5348927",
"0.53122973",
"0.52771056",
"0.5264366",
"0.5207867",
"0.51983625",
"0.51818347",
"0.51775837",
"0.5162352",
"0.5151088",
"0.5133162",
"0.51241547",
"0.511091",
"0.51040566",
"0.50870687",
"0.50797397",
"0.5057577",
"0.50533885",
"0.50433",
"0.5014476",
"0.5002651"
] |
0.73611385
|
0
|
Merges the state of the given detached entity into this UnitOfWork.
|
public function merge($entity)
{
$visited = [];
return $this->doMerge($entity, $visited);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function merge(Entity\\Base $entity)\n {\n $this->getEntityManager()->merge($entity);\n }",
"private function doMerge($entity, array &$visited, $prevManagedCopy = null, array $assoc = [])\n {\n $oid = spl_object_hash($entity);\n if (isset($visited[$oid])) {\n $managedCopy = $visited[$oid];\n if ($prevManagedCopy !== null) {\n $this->updateAssociationWithMergedEntity($entity, $assoc, $prevManagedCopy, $managedCopy);\n }\n\n return $managedCopy;\n }\n $class = $this->manager->getClassMetadata(get_class($entity));\n // First we assume DETACHED, although it can still be NEW but we can avoid\n // an extra db-roundtrip this way. If it is not MANAGED but has an identity,\n // we need to fetch it from the db anyway in order to merge.\n // MANAGED entities are ignored by the merge operation.\n $managedCopy = $entity;\n if ($this->getEntityState($entity, self::STATE_DETACHED) !== self::STATE_MANAGED) {\n // Try to look the entity up in the identity map.\n $id = $class->getIdentifierValues($entity);\n // If there is no ID, it is actually NEW.\n if (!$id) {\n $managedCopy = $this->newInstance($class);\n $this->persistNew($class, $managedCopy);\n } else {\n $flatId = ($class->containsForeignIdentifier())\n ? $this->identifierFlattener->flattenIdentifier($class, $id)\n : $id;\n $managedCopy = $this->tryGetById($flatId, $class->getRootEntityName());\n if ($managedCopy) {\n // We have the entity in-memory already, just make sure its not removed.\n if ($this->getEntityState($managedCopy) == self::STATE_REMOVED) {\n throw new \\InvalidArgumentException('Removed entity cannot be merged');\n }\n } else {\n // We need to fetch the managed copy in order to merge.\n $managedCopy = $this->manager->find($class->getName(), $flatId);\n }\n if ($managedCopy === null) {\n // If the identifier is ASSIGNED, it is NEW, otherwise an error\n // since the managed entity was not found.\n if (!$class->isIdentifierNatural()) {\n throw new \\OutOfBoundsException('Entity not found');\n }\n $managedCopy = $this->newInstance($class);\n $class->setIdentifierValues($managedCopy, $id);\n $this->persistNew($class, $managedCopy);\n }\n }\n\n $visited[$oid] = $managedCopy; // mark visited\n if ($this->isLoaded($entity)) {\n if ($managedCopy instanceof Proxy && !$managedCopy->__isInitialized()) {\n $managedCopy->__load();\n }\n $this->mergeEntityStateIntoManagedCopy($entity, $managedCopy);\n }\n if ($class->isChangeTrackingDeferredExplicit()) {\n $this->scheduleForDirtyCheck($entity);\n }\n }\n if ($prevManagedCopy !== null) {\n $this->updateAssociationWithMergedEntity($entity, $assoc, $prevManagedCopy, $managedCopy);\n }\n // Mark the managed copy visited as well\n $visited[spl_object_hash($managedCopy)] = $managedCopy;\n $this->cascadeMerge($entity, $managedCopy, $visited);\n\n return $managedCopy;\n }",
"public function onFlush($entity, $uowEntityState, UnitOfWork $uow);",
"public function addEntity($entity) {\n $this->entityManager->merge($entity);\n $this->entityManager->flush();\n }",
"public function merge() {\n $this->getObjectManager()->merge($this);\n return $this;\n }",
"public function mergeEntity(\n $table,\n Entity $entity,\n TableServiceOptions $options = null\n ) {\n return $this->mergeEntityAsync($table, $entity, $options)->wait();\n }",
"private function updateAssociationWithMergedEntity($entity, array $association, $previousManagedCopy, $managedCopy)\n {\n $assocField = $association['fieldName'];\n $prevClass = $this->manager->getClassMetadata(get_class($previousManagedCopy));\n if ($association['type'] & ApiMetadata::TO_ONE) {\n $prevClass->getReflectionProperty($assocField)->setValue($previousManagedCopy, $managedCopy);\n\n return;\n }\n /** @var array $value */\n $value = $prevClass->getReflectionProperty($assocField)->getValue($previousManagedCopy);\n $value[] = $managedCopy;\n if ($association['type'] == ApiMetadata::ONE_TO_MANY) {\n $class = $this->manager->getClassMetadata(get_class($entity));\n $class->getReflectionProperty($association['mappedBy'])->setValue($managedCopy, $previousManagedCopy);\n }\n }",
"public function update($entity, $flush = false);",
"public function merge(self $merge)\n {\n /** @var Config $value */\n foreach ($merge as $key => $value) {\n if (array_key_exists($key, $this->data)) {\n if (is_int($key)) {\n $this->data[] = $value;\n } elseif ($value instanceof self && $this->data[$key] instanceof self) {\n $this->data[$key]->merge($value);\n } else {\n if ($value instanceof self) {\n $this->data[$key] = new self($value->toArray());\n } else {\n $this->data[$key] = $value;\n }\n }\n } else {\n if ($value instanceof self) {\n $this->data[$key] = new self($value->toArray());\n } else {\n $this->data[$key] = $value;\n }\n }\n }\n\n return $this;\n }",
"private function doMerge($document, array &$visited, $prevManagedCopy = null, $assoc = null)\n {\n $oid = spl_object_hash($document);\n if (isset($visited[$oid])) {\n return; // Prevent infinite recursion\n }\n\n $visited[$oid] = $document; // mark visited\n\n $class = $this->dm->getClassMetadata(get_class($document));\n\n // First we assume DETACHED, although it can still be NEW but we can avoid\n // an extra db-roundtrip this way. If it is not MANAGED but has an identity,\n // we need to fetch it from the db anyway in order to merge.\n // MANAGED documents are ignored by the merge operation.\n if ($this->getDocumentState($document, self::STATE_DETACHED) == self::STATE_MANAGED) {\n $managedCopy = $document;\n } else {\n $id = null;\n if (!$class->isEmbeddedDocument) {\n // Try to look the entity up in the identity map.\n $id = $class->getIdentifierValue($document);\n }\n\n // If there is no ID, it is actually NEW.\n if ( ! $id) {\n $managedCopy = $class->newInstance();\n $this->persistNew($class, $managedCopy);\n } else {\n $managedCopy = $this->tryGetById($id, $class->rootDocumentName);\n if ($managedCopy) {\n // We have the entity in-memory already, just make sure its not removed.\n if ($this->getDocumentState($managedCopy) == self::STATE_REMOVED) {\n throw new InvalidArgumentException('Removed entity detected during merge.'\n . ' Can not merge with a removed entity.');\n }\n } else {\n // We need to fetch the managed copy in order to merge.\n $managedCopy = $this->dm->find($class->name, $id);\n }\n\n if ($managedCopy === null) {\n // If the identifier is ASSIGNED, it is NEW, otherwise an error\n // since the managed entity was not found.\n $managedCopy = $class->newInstance();\n $class->setIdentifierValue($managedCopy, $id);\n $this->persistNew($class, $managedCopy);\n }\n }\n\n if ($class->isVersioned) {\n $managedCopyVersion = $class->reflFields[$class->versionField]->getValue($managedCopy);\n $documentVersion = $class->reflFields[$class->versionField]->getValue($document);\n // Throw exception if versions don't match.\n if ($managedCopyVersion != $documentVersion) {\n throw LockException::lockFailedVersionMissmatch($documentVersion, $managedCopyVersion);\n }\n }\n\n // Merge state of $document into existing (managed) entity\n foreach ($class->reflFields as $name => $prop) {\n if ( ! isset($class->fieldMappings[$name]['embedded']) && ! isset($class->fieldMappings[$name]['reference'])) {\n $prop->setValue($managedCopy, $prop->getValue($document));\n } else {\n $assoc2 = $class->fieldMappings[$name];\n if ($assoc2['type'] === 'one') {\n $other = $prop->getValue($document);\n if ($other === null) {\n $prop->setValue($managedCopy, null);\n } else if ($other instanceof Proxy && !$other->__isInitialized__) {\n // do not merge fields marked lazy that have not been fetched.\n continue;\n } else if ( ! isset($assoc2['embedded']) && ! $assoc2['isCascadeMerge']) {\n if ($this->getDocumentState($other, self::STATE_DETACHED) == self::STATE_MANAGED) {\n $prop->setValue($managedCopy, $other);\n } else {\n $targetDocument = isset($assoc2['targetDocument']) ? $assoc2['targetDocument'] : get_class($other);\n $targetClass = $this->dm->getClassMetadata($targetDocument);\n $id = $targetClass->getIdentifierValue($other);\n $proxy = $this->dm->getProxyFactory()->getProxy($targetDocument, $id);\n $prop->setValue($managedCopy, $proxy);\n $this->registerManaged($proxy, $id, array());\n }\n }\n } else {\n $mergeCol = $prop->getValue($document);\n if ($mergeCol instanceof PersistentCollection && ! $mergeCol->isInitialized()) {\n // do not merge fields marked lazy that have not been fetched.\n // keep the lazy persistent collection of the managed copy.\n continue;\n }\n\n if (null === $mergeCol) {\n // consider unset properties as empty collections\n $mergeCol = new ArrayCollection();\n }\n\n foreach ($mergeCol as $entry) {\n $targetDocument = isset($assoc2['targetDocument']) ? $assoc2['targetDocument'] : get_class($entry);\n $targetClass = $this->dm->getClassMetadata($targetDocument);\n if ($targetClass->isEmbeddedDocument) {\n $this->registerManaged($entry, null, array());\n } else {\n $id = $targetClass->getIdentifierValue($entry);\n $this->registerManaged($entry, $id, array());\n }\n }\n\n if ( ! $mergeCol instanceof PersistentCollection) {\n if ( ! $mergeCol instanceof Collection) {\n $mergeCol = new ArrayCollection($mergeCol);\n }\n $mergeCol = new PersistentCollection($mergeCol, $this->dm, $this, $this->cmd);\n $mergeCol->setInitialized(true);\n } else {\n $mergeCol->setDocumentManager($this->dm);\n }\n $mergeCol->setOwner($managedCopy, $assoc2);\n $mergeCol->setDirty(true); // mark for dirty checking\n $prop->setValue($managedCopy, $mergeCol);\n }\n }\n if ($class->isChangeTrackingNotify()) {\n // Just treat all properties as changed, there is no other choice.\n $this->propertyChanged($managedCopy, $name, null, $prop->getValue($managedCopy));\n }\n }\n if ($class->isChangeTrackingDeferredExplicit()) {\n $this->scheduleForDirtyCheck($document);\n }\n }\n\n if ($prevManagedCopy !== null) {\n $assocField = $assoc->sourceFieldName;\n $prevClass = $this->dm->getClassMetadata(get_class($prevManagedCopy));\n if ($assoc->isOneToOne()) {\n $prevClass->reflFields[$assocField]->setValue($prevManagedCopy, $managedCopy);\n } else {\n $prevClass->reflFields[$assocField]->getValue($prevManagedCopy)->unwrap()->add($managedCopy);\n if ($assoc->isOneToMany()) {\n $class->reflFields[$assoc->mappedBy]->setValue($managedCopy, $prevManagedCopy);\n }\n }\n }\n\n // Mark the managed copy visited as well\n $visited[spl_object_hash($managedCopy)] = true;\n\n $this->cascadeMerge($document, $managedCopy, $visited);\n\n return $managedCopy;\n }",
"public function add($entity, $flush = false);",
"public function merge_with(&$other)\n {\n }",
"public function onEntityRepositoryAttach(IEntity $entity): void;",
"public function detach(Entity\\Base $entity)\n {\n $this->getEntityManager()->detach($entity);\n }",
"public function flush()\n {\n $this->entityManager->flush();\n }",
"public function detach($entity)\n {\n $visited = [];\n $this->doDetach($entity, $visited);\n }",
"protected function _dataMerge( $row )\n\t{\n\t\tif ( $row instanceof Zend_Db_Table_Row )\n\t\t\t$row = $row->toArray();\n\t\t\n\t\t$this->_data = array_merge($this->_data, $row);\n\t\t\n\t\tif (array_key_exists('user_id', $this->_data))\n\t\t\t$this->ownerUserId = $this->_data['user_id'];\n\t}",
"public function merge(Zend_Config $merge)\n {\n foreach($merge as $key => $item) {\n if(array_key_exists($key, $this->_data)) {\n if($item instanceof Zend_Config && $this->$key instanceof Zend_Config) {\n $this->$key = $this->$key->merge(new Zend_Config($item->toArray(), !$this->readOnly()));\n } else {\n $this->$key = $item;\n }\n } else {\n if($item instanceof Zend_Config) {\n $this->$key = new Zend_Config($item->toArray(), !$this->readOnly());\n } else {\n $this->$key = $item;\n }\n }\n }\n\n return $this;\n }",
"private function cascadeMerge($entity, $managedCopy, array &$visited)\n {\n $class = $this->manager->getClassMetadata(get_class($entity));\n $associationMappings = array_filter(\n $class->getAssociationMappings(),\n function($assoc) {\n return $assoc['isCascadeMerge'];\n }\n );\n foreach ($associationMappings as $assoc) {\n $relatedEntities = $class->getReflectionProperty($assoc['field'])->getValue($entity);\n if ($relatedEntities instanceof Collection) {\n if ($relatedEntities === $class->getReflectionProperty($assoc['field'])->getValue($managedCopy)) {\n continue;\n }\n if ($relatedEntities instanceof ApiCollection) {\n // Unwrap so that foreach() does not initialize\n $relatedEntities = $relatedEntities->unwrap();\n }\n foreach ($relatedEntities as $relatedEntity) {\n $this->doMerge($relatedEntity, $visited, $managedCopy, $assoc);\n }\n } else {\n if ($relatedEntities !== null) {\n $this->doMerge($relatedEntities, $visited, $managedCopy, $assoc);\n }\n }\n }\n }",
"public function flush() {\r\n\t$this->em->flush();\r\n }",
"public function refresh()\n {\n $this->entityManager->refresh($this);\n }",
"public function merge($merge)\n {\n if (!(is_array($merge) || ($merge instanceof Traversable))) {\n throw new Exception\\InvalidArgumentException(sprintf(\n '%s: expects an array, or Traversable argument; received \"%s\"',\n __METHOD__, (is_object($merge) ? get_class($merge) : gettype($merge))\n ));\n }\n\n foreach ($merge as $key => $value) {\n if (array_key_exists($key, $this->data)) {\n if (is_int($key)) {\n $this->data[] = $value;\n } elseif ($value instanceof self && $this->data[$key] instanceof self) {\n $this->data[$key]->merge($value);\n } elseif (is_array($value) && is_array($this->data[$key])) {\n $this->data[$key] = array_merge($this->data[$key], $value);\n } else {\n if ($value instanceof self) {\n $this->data[$key] = new static($value->toArray());\n } else {\n $this->data[$key] = $value;\n }\n }\n } else {\n if ($value instanceof self) {\n $this->data[$key] = new static($value->toArray());\n } else {\n $this->data[$key] = $value;\n }\n\n $this->count++;\n }\n }\n\n return $this;\n }",
"public function postLoad($entity);",
"public function flush()\n {\n $this->unitOfWork->commit();\n }",
"public function merge() {}",
"public function flush($entity = null)\n {\n $this->getEntityManager()->flush($entity);\n }",
"public function mergeWith(SyncItem $donor, ObjectManager $em){\n $masterData = $this->getCurrentData();\n $donorData = $donor->getCurrentData();\n\n //Duplicate the master's data so the master's data doesn't get altered in the history data\n $updateData = clone $masterData;\n\n //Add current data sets to the HistoryData\n $masterData->setStatus(-1);\n $donorData->setStatus(-1);\n $this->addHistoryData($masterData);\n $this->addHistoryData($donorData);\n\n //Add donor's history to the master's history\n $donorHistory = $donor->getHistoryData();\n foreach($donorHistory as $history){\n $this->addHistoryData($history);\n }\n\n\n //Compare the grades of the data in the master and the donor. If the donor has better data\n //Than the master at any point, transfer the data.\n //Would have been significantly easier with arrays. Impossible because the dataStrings are\n //stored as variables, rather than in a single array.\n\n if($donorData->getDataString0() != null &&\n $updateData->gradeData(0) > $donorData->gradeData(0)\n ){\n $updateData->setDataString0($donorData->getDataString0());\n }\n if($donorData->getDataString1() != null &&\n $updateData->gradeData(1) > $donorData->gradeData(1)\n ){\n $updateData->setDataString1($donorData->getDataString1());\n }\n if($donorData->getDataString2() != null &&\n $updateData->gradeData(2) > $donorData->gradeData(2)\n ){\n $updateData->setDataString2($donorData->getDataString2());\n }\n if($donorData->getDataString3() != null &&\n $updateData->gradeData(3) > $donorData->gradeData(3)\n ){\n $updateData->setDataString3($donorData->getDataString3());\n }\n if($donorData->getDataString4() != null &&\n $updateData->gradeData(4) > $donorData->gradeData(4)\n ){\n $updateData->setDataString4($donorData->getDataString4());\n }\n if($donorData->getDataString5() != null &&\n $updateData->gradeData(5) > $donorData->gradeData(5)\n ){\n $updateData->setDataString5($donorData->getDataString5());\n }\n\n //Set new time\n $time = new DateTime();\n $updateData->setCreated($time);\n\n //Set status of the data\n if($updateData->getOverallGrade() == 'A'){\n $updateData->setStatus(1);\n }else{\n $updateData->setStatus(0);\n }\n $em->persist($updateData);\n\n //Update the data and the grade of the master\n $this->setCurrentData($updateData);\n $this->setGrade();\n\n $em->persist($this);\n }",
"public function merge($thing) {\n\t\t$this->document = self::_merge($this->document, $thing);\n\t}",
"protected function saveState(): void\n {\n $em = $this->getEntityManager();\n $em->flush();\n }",
"public function flush()\n {\n $this->getEntityManager()->flush();\n }"
] |
[
"0.537416",
"0.52054185",
"0.51281387",
"0.51172996",
"0.49679905",
"0.45818436",
"0.45211044",
"0.4445057",
"0.4426262",
"0.4390852",
"0.43806064",
"0.437861",
"0.4327283",
"0.42889795",
"0.4283029",
"0.42300662",
"0.41841108",
"0.4179513",
"0.41724002",
"0.4163155",
"0.41610515",
"0.41434512",
"0.41433412",
"0.4138493",
"0.41344404",
"0.41319653",
"0.41267797",
"0.41030863",
"0.4102522",
"0.40965533"
] |
0.53297096
|
1
|
Resolve metadata against source data and root class
|
private function resolveSourceMetadataForClass(\stdClass $data, $class)
{
$metadata = $this->manager->getClassMetadata($class);
$discriminatorValue = $metadata->getDiscriminatorValue();
if ($metadata->getDiscriminatorField()) {
$property = $metadata->getDiscriminatorField()['fieldName'];
if (isset($data->$property)) {
$discriminatorValue = $data->$property;
}
}
$map = $metadata->getDiscriminatorMap();
if (!array_key_exists($discriminatorValue, $map)) {
throw MappingException::unknownDiscriminatorValue($discriminatorValue, $class);
}
$realClass = $map[$discriminatorValue];
return $this->manager->getClassMetadata($realClass);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"private function buildClassMeta()\n {\n // Search meta informations before going to reflection and then, ast parsing\n foreach ($this->data as $line) {\n $line = trim($line);\n\n // Namespace search\n if (preg_match(self::NAMESPACE_PATTERN, $line, $matches) === 1) {\n $this->context->setCurrentNamespace(trim($matches[1]));\n continue;\n }\n\n // Class name\n if (preg_match(self::DEFINITION_PATTERN, $line, $matches) === 1) {\n $this->context->setClassName(trim($matches[1]));\n break; // Stop after class found, let the reflection do the next job\n }\n\n // Uses\n if (preg_match(self::USE_PATTERN, $line, $matches) === 1) {\n $this->context->addUse($matches[1]);\n continue;\n }\n }\n }",
"protected function loadMetaData() {}",
"abstract public function getCorrespondingMetaData();",
"private function loadMetadata() {\n\t\t$this->pMeta = $this->em->getClassMetadata('OcProduct');\n\t\t$this->pdMeta = $this->em->getClassMetadata('OcProductDescription');\n\t}",
"protected function resolveMetadata($class)\n {\n $classFqns = array_reverse(class_parents($class));\n $classFqns[] = $class;\n $metadatas = [];\n $addedClasses = [];\n\n try {\n foreach ($classFqns as $classFqn) {\n foreach ($this->doResolve($classFqn, $addedClasses) as $metadata) {\n $metadatas[] = $metadata;\n }\n }\n } catch (Exception\\CircularReferenceException $e) {\n throw new Exception\\CircularReferenceException(sprintf($e->getMessage(), $class), $e->getCode(), $e->getPrevious());\n }\n\n if (0 === \\count($metadatas)) {\n throw new Exception\\ClassNotMappedException($class);\n }\n\n $metadata = null;\n foreach ($metadatas as $data) {\n if (null === $metadata) {\n $metadata = $data;\n } else {\n $metadata->merge($data);\n }\n }\n\n $this->resolvedMetadatas[$class] = $metadata;\n }",
"function loadClassMetadata(Mapping\\ClassMetadataInterface $metadata);",
"protected function loadMetadata(): void\n {\n $config = new Storage;\n\n foreach ($this->metadataDirs as $dir) {\n $configs = glob($dir . '/*' . $config->getReader()->getFileExt());\n\n foreach ($configs as $file) {\n $config->load($file);\n\n if ($config['class']) {\n $this->metadata[$config['class']] = $config->getObj();\n } else {\n throw new RuntimeException(sprintf('ActiveRecord `class` definition missed in %s metadata file', $file));\n }\n }\n }\n }",
"protected function setup_metadata() {\n\t\tif ( $this->get_meta_type() ) {\n\t\t\t$this->fill( $this->get_metadata() );\n\t\t}\n\t}",
"abstract protected function getClassMetadata(string $resourceClass): ClassMetadata;",
"abstract function resolve($class);",
"public function getMetadata() {}",
"public function getMetadata() {}",
"public function getMetadata();",
"public function getMetadata();",
"public function getMetadata();",
"protected function processSourceTree () {\n\t\t$this->processFileTree();\n\t\tforeach (get_declared_interfaces() as $interface) {\n\t\t$ref = new ReflectionClass($interface);\n\t\t\tif ($ref->isUserDefined()) {\n\t\t\t\t$this->classes[] = $ref;\n\t\t\t}\n\t\t}\n\t\tforeach (get_declared_classes() as $class) {\n\t\t\t$ref = new ReflectionClass($class);\n\t\t\tif ($ref->isUserDefined() && !preg_match('/^Spd/', $class)) {\n\t\t\t\t$this->classes[] = $ref;\n\t\t\t}\n\t\t}\n\t}",
"protected function getMetaDataRepository() {}",
"protected function getMetaDataRepository() {}",
"public function getClassMetadata(): ClassMetadata;",
"public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)\n {\n $classMetadata = $eventArgs->getClassMetadata();\n if ($this->isEntitySupported($classMetadata)) {\n foreach ($this->mapping[$classMetadata->getName()] as $type=>$mappings){\n $this->addMapping($classMetadata, $mappings, $type);\n }\n }\n }",
"public function loadMetadataForClass($className, ClassMetadata $metadata)\n {\n $element = $this->getElement($className);\n\n switch ($element['type']) {\n case 'entity':\n if (array_key_exists('repositoryClass', $element)) {\n $metadata->setCustomRepositoryClass($element['repositoryClass']);\n }\n break;\n case 'mappedSuperclass':\n $metadata->isMappedSuperclass = true;\n $metadata->setCustomRepositoryClass(\n array_key_exists('repositoryClass', $element) ? $element['repositoryClass'] : null\n );\n break;\n }\n\n // Configure API\n if (array_key_exists('api', $element)) {\n if (array_key_exists('factory', $element['api'])) {\n $metadata->apiFactory = $element['api']['factory'];\n }\n }\n\n // Evaluate discriminatorColumn\n if (isset($element['discriminatorField'])) {\n $discrColumn = $element['discriminatorField'];\n $metadata->setDiscriminatorField(\n [\n 'name' => isset($discrColumn['name']) ? (string)$discrColumn['name'] : null,\n 'type' => isset($discrColumn['type']) ? (string)$discrColumn['type'] : 'string',\n ]\n );\n } else {\n // $metadata->setDiscriminatorField(['name' => 'dtype', 'type' => 'string']);\n }\n // Evaluate discriminatorMap\n if (isset($element['discriminatorMap'])) {\n $metadata->setDiscriminatorMap($element['discriminatorMap']);\n }\n\n // Configure Client\n if (array_key_exists('client', $element)) {\n if (array_key_exists('name', $element['client'])) {\n $metadata->clientName = $element['client']['name'];\n }\n\n $methodProvider = null;\n if (array_key_exists('methods', $element['client'])) {\n $methodProvider = new MethodProvider($element['client']['methods']);\n }\n if (array_key_exists('entityPath', $element['client'])) {\n $pathSeparator =\n array_key_exists('entityPathSeparator', $element['client']) ?\n $element['client']['entityPathSeparator'] : EntityMethodProvider::DEFAULT_PATH_SEPARATOR;\n $methodProvider =\n new EntityMethodProvider($element['client']['entityPath'], $pathSeparator, $methodProvider);\n }\n\n if (null === $methodProvider && null === $metadata->methodProvider) {\n throw MappingException::noMethods();\n }\n\n if (null !== $methodProvider) {\n $metadata->methodProvider = $methodProvider;\n }\n }\n\n // Configure fields\n if (array_key_exists('fields', $element)) {\n foreach ($element['fields'] as $field => $mapping) {\n $mapping = $this->fieldToArray($field, $mapping);\n $metadata->mapField($mapping);\n }\n }\n\n // Configure identifiers\n $associationIds = [];\n if (array_key_exists('id', $element)) {\n // Evaluate identifier settings\n $defaults = ['generator' => ['strategy' => 'NATURAL']];\n foreach ($element['id'] as $name => $idElement) {\n if (isset($idElement['associationKey']) && (bool)$idElement['associationKey'] === true) {\n $associationIds[$name] = true;\n continue;\n }\n\n $mapping = $this->fieldToArray($name, $idElement);\n\n $mapping['id'] = true;\n $idElement = array_replace_recursive($defaults, $idElement);\n\n $mapping['generator']['strategy'] =\n constant(ApiMetadata::class . '::GENERATOR_TYPE_' . $idElement['generator']['strategy']);\n\n $metadata->mapIdentifier($mapping);\n }\n }\n\n foreach (['oneToOne', 'manyToOne', 'oneToMany', 'manyToMany'] as $type) {\n if (array_key_exists($type, $element)) {\n $associations = $element[$type];\n foreach ($associations as $name => $association) {\n $this->mapAssociation($metadata, $type, $name, $association, $associationIds);\n }\n }\n }\n }",
"public function prepareMetaData() {\n if ($this->mt instanceof folksoPageDataMeta) {\n return $this->mt;\n }\n\n if (! $this->ptags instanceof folksoPagetags) {\n $this->ptags = new folksoPagetags($this->loc, $this->url);\n }\n\n\n $this->mt = $this->ptags->buildMeta();\n if (! $this->e13 instanceof folksoEanList) {\n $this->e13 = new folksoEanList($this->loc, $this->url);\n }\n // this is supposed to be a reference. it had better be!\n $this->mt->e13 = $this->e13;\n return $this->mt;\n }",
"public function loadClassMetadata(LoadClassMetadataEventArgs $event)\n {\n $metadata = $event->getClassMetadata();\n $className = $metadata->name;\n\n if ($className && $className === $metadata->rootEntityName && array_key_exists($className, $this->map)) {\n $discriminatorMap = $metadata->discriminatorMap;\n $discriminatorMap = $discriminatorMap + $this->map[$className];\n $metadata->setDiscriminatorMap($discriminatorMap);\n }\n }",
"public function loadClassMetadata(LoadClassMetadataEventArgs $args)\n {\n $cm = $args->getClassMetadata();\n\n if (isset($this->classes[$cm->name])) {\n $mapping = [\n 'targetEntity' => $this->classes[$cm->name],\n 'fieldName' => 'data',\n 'mappedBy' => 'entity',\n 'cascade' => ['persist', 'remove'],\n 'orphanRemoval' => true,\n ];\n\n $cm->mapOneToMany($mapping);\n } elseif (in_array($cm->name, $this->classes)) {\n $mapping = [\n 'targetEntity' => array_search($cm->name, $this->classes),\n 'fieldName' => 'entity',\n 'inversedBy' => 'data',\n ];\n\n $cm->mapManyToOne($mapping);\n\n $cm->table['uniqueConstraints']['eav_data_idx'] = [\n 'columns' => ['entity_id', 'key'],\n ];\n }\n }",
"public function loadClassMetadata(EventArgs $args)\n {\n $meta = $args->getClassMetadata();\n\n try {\n $configuration = $this->getAnnotationParser()\n ->configureMetadata($meta)\n ->parse();\n } catch (ConfigurationException $e) {\n $configuration = false;\n }\n if ($configuration) {\n $this->configuration = $configuration;\n }\n\n }",
"protected function initMetadata($data, $metadata) {}",
"public function getMetadataForClass(string $class)\n {\n if (!isset($this->resolvedMetadatas[$class])) {\n $this->resolveMetadata($class);\n }\n\n return $this->resolvedMetadatas[$class];\n }",
"public function getMetaData();",
"public function getExpectedMetadata()\n {\n $metadata = [\n 'name' => null,\n 'class' => __CLASS__,\n 'config' => [],\n 'hash' => 'test',\n 'properties' => [\n 'boolean_property' => [\n 'name' => 'boolean_property',\n 'class' => Boolean::class,\n 'config' => [\n 'default' => true,\n ],\n 'hash' => 'test',\n ],\n 'int_property' => [\n 'name' => 'int_property',\n 'class' => Integer::class,\n 'config' => [\n 'nullable' => false,\n 'default' => 100,\n 'min' => 10,\n 'max' => 1000,\n ],\n 'hash' => 'test',\n ],\n 'string_property' => [\n 'name' => 'string_property',\n 'class' => Str::class,\n 'config' => [],\n 'hash' => 'test',\n ],\n 'generic_property' => [\n 'name' => 'generic_property',\n 'class' => Str::class,\n 'config' => [\n 'default' => 'some value',\n ],\n 'hash' => 'test',\n ],\n 'child_struct_with_explicit_class' => [\n 'name' => 'child_struct_with_explicit_class',\n 'class' => BasicStruct::class,\n 'config' => [],\n 'hash' => 'test',\n ],\n 'child_struct_with_inline_definition' => [\n 'name' => 'child_struct_with_inline_definition',\n 'class' => null,\n 'config' => [],\n 'hash' => 'test',\n 'properties' => [\n 'a' => [\n 'name' => 'a',\n 'class' => Boolean::class,\n 'config' => [],\n 'hash' => 'test',\n ],\n 'b' => [\n 'name' => 'b',\n 'class' => Integer::class,\n 'config' => [],\n 'hash' => 'test',\n ],\n 'c' => [\n 'name' => 'c',\n 'class' => Str::class,\n 'config' => [],\n 'hash' => 'test',\n ],\n 's' => [\n 'name' => 's',\n 'class' => null,\n 'config' => [],\n 'hash' => 'test',\n 'properties' => [\n 'min' => [\n 'name' => 'min',\n 'class' => Integer::class,\n 'config' => [\n 'default' => 0,\n ],\n 'hash' => 'test',\n ],\n 'max' => [\n 'name' => 'max',\n 'class' => Integer::class,\n 'config' => [\n 'default' => 100,\n ],\n 'hash' => 'test',\n ],\n ],\n ],\n ],\n ],\n ],\n ];\n /** @var $child MetadataTestcaseInterface */\n $child = new $metadata['properties']['child_struct_with_explicit_class']['class'];\n $meta = $child->getExpectedMetadata();\n $metadata['properties']['child_struct_with_explicit_class']['properties'] = $meta['properties'];\n return $metadata;\n }",
"public function getMetadata()\n {\n $this->getFtpMetadata();\n\n parent::getMetadata();\n\n /**\n * Discovery creates an array of Files and Directories based on Path\n */\n if ($this->exists === true) {\n $this->discovery($this->path);\n }\n\n $this->getSize();\n\n return;\n }"
] |
[
"0.6504423",
"0.61981577",
"0.6108959",
"0.59350705",
"0.5810916",
"0.5757832",
"0.57424384",
"0.5677481",
"0.5537659",
"0.54829776",
"0.5475047",
"0.5475047",
"0.54701215",
"0.54701215",
"0.54701215",
"0.5460253",
"0.5415837",
"0.5415837",
"0.54051197",
"0.53791827",
"0.537209",
"0.5290515",
"0.5284661",
"0.5182798",
"0.5161962",
"0.5161845",
"0.51263",
"0.51206774",
"0.5102666",
"0.5097121"
] |
0.6387338
|
1
|
Computes the changesets of all entities scheduled for insertion.
|
private function computeScheduleInsertsChangeSets()
{
foreach ($this->entityInsertions as $entity) {
$class = $this->manager->getClassMetadata(get_class($entity));
$this->computeChangeSet($class, $entity);
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"private function computeScheduleInsertsChangeSets()\n {\n foreach ($this->documentInsertions as $document) {\n $class = $this->dm->getClassMetadata(get_class($document));\n\n $this->computeChangeSet($class, $document);\n }\n }",
"public function computeChangeSets()\n {\n // Compute changes for INSERTed entities first. This must always happen.\n $this->computeScheduleInsertsChangeSets();\n // Compute changes for other MANAGED entities. Change tracking policies take effect here.\n foreach ($this->identityMap as $className => $entities) {\n $class = $this->manager->getClassMetadata($className);\n // Skip class if instances are read-only\n if ($class->isReadOnly()) {\n continue;\n }\n // If change tracking is explicit or happens through notification, then only compute\n // changes on entities of that type that are explicitly marked for synchronization.\n switch (true) {\n case ($class->isChangeTrackingDeferredImplicit()):\n $entitiesToProcess = $entities;\n break;\n case (isset($this->scheduledForSynchronization[$className])):\n $entitiesToProcess = $this->scheduledForSynchronization[$className];\n break;\n default:\n $entitiesToProcess = [];\n }\n foreach ($entitiesToProcess as $entity) {\n // Ignore uninitialized proxy objects\n if ($entity instanceof Proxy && !$entity->__isInitialized__) {\n continue;\n }\n // Only MANAGED entities that are NOT SCHEDULED FOR INSERTION OR DELETION are processed here.\n $oid = spl_object_hash($entity);\n if (!isset($this->entityInsertions[$oid]) &&\n !isset($this->entityDeletions[$oid]) &&\n isset($this->entityStates[$oid])\n ) {\n $this->computeChangeSet($class, $entity);\n }\n }\n }\n }",
"public function computeChangeSets()\n {\n $this->computeScheduleInsertsChangeSets();\n\n // Compute changes for other MANAGED documents. Change tracking policies take effect here.\n foreach ($this->identityMap as $className => $documents) {\n $class = $this->dm->getClassMetadata($className);\n if($class->isEmbeddedDocument) {\n // Embedded documents should only compute by the document itself which include the embedded document.\n // This is done separately later.\n // @see computeChangeSet()\n // @see computeAssociationChanges()\n continue;\n }\n\n // If change tracking is explicit or happens through notification, then only compute\n // changes on documents of that type that are explicitly marked for synchronization.\n $documentsToProcess = ! $class->isChangeTrackingDeferredImplicit() ?\n (isset($this->scheduledForDirtyCheck[$className]) ?\n $this->scheduledForDirtyCheck[$className] : array())\n : $documents;\n\n foreach ($documentsToProcess as $document) {\n // Ignore uninitialized proxy objects\n if (/* $document is readOnly || */ $document instanceof Proxy && ! $document->__isInitialized__) {\n continue;\n }\n // Only MANAGED documents that are NOT SCHEDULED FOR INSERTION are processed here.\n $oid = spl_object_hash($document);\n if ( ! isset($this->documentInsertions[$oid]) && isset($this->documentStates[$oid])) {\n $this->computeChangeSet($class, $document);\n }\n }\n }\n }",
"public function calculateChangeSet()\n {\n $set = [];\n foreach ($this->current as $key => $current) {\n $original = isset($this->original[$key]) ? $this->original[$key] : null;\n $set[$key]['old'] = $original;\n $set[$key]['new'] = $current;\n }\n foreach ($this->remove as $key) {\n $set[$key]['old'] = $this->original[$key];\n $set[$key]['new'] = null;\n }\n ksort($set);\n return $set;\n }",
"abstract protected function getEntitiesToSync();",
"public function execute()\n {\n $insertedEntities = array();\n foreach ($this->quantities as $class => $number) {\n for ($i=0; $i < $number; $i++) {\n $insertedEntities[$class][]= $this->entities[$class]->execute($this->mandango, $insertedEntities);\n }\n }\n $this->mandango->flush();\n\n return $insertedEntities;\n }",
"public function flushAllChanges()\r\n {\r\n $this->em->flush();\r\n }",
"public function getChanges();",
"public function getChanges();",
"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 }",
"public function getScheduledDocumentInsertions()\n {\n return $this->documentInsertions;\n }",
"public function syncTransactions(): void\n\t{\n\t\tif (!$this->checkTransactions()) {\n\t\t\treturn;\n\t\t}\n\n\t\t$transactions = $this->getTransactionList();\n\n\t\t/** @var array<\\Eshop\\DB\\Order> $orders */\n\t\t$orders = $this->orderRepository->many()->setIndex('this.code')->toArrayOf('uuid');\n\t\t/** @var array<\\Eshop\\DB\\EHubTransaction> $existingTransactions */\n\t\t$existingTransactions = $this->EHubTransactionRepository->many()->toArray();\n\n\t\t$newTransactionsValues = [];\n\n\t\tforeach ($transactions as $transaction) {\n\t\t\t$transactionPK = DIConnection::generateUuid('eHubTransactionId', $transaction['id']);\n\t\t\t$transactionValues = [\n\t\t\t\t'order' => null,\n\t\t\t];\n\n\t\t\tif (isset($existingTransactions[$transactionPK])) {\n\t\t\t\t$transactionValues = $existingTransactions[$transactionPK]->toArray();\n\t\t\t}\n\n\t\t\t$transactionValues['transactionId'] = $transaction['id'];\n\t\t\t$transactionValues['status'] = $transaction['status'];\n\t\t\t$transactionValues['createdTs'] = (new Carbon($transaction['dateTime']))->format('Y-m-d G:i');\n\t\t\t$transactionValues['clickDateTime'] = (new Carbon($transaction['clickDateTime']))->format('Y-m-d G:i');\n\t\t\t$transactionValues['orderAmount'] = (float) $transaction['orderAmount'];\n\t\t\t$transactionValues['originalOrderAmount'] = $transaction['originalOrderAmount'] ?? null;\n\t\t\t$transactionValues['originalCurrency'] = $transaction['originalCurrency'] ?? null;\n\t\t\t$transactionValues['commission'] = isset($transaction['commission']) ? (float) $transaction['commission'] : null;\n\t\t\t$transactionValues['type'] = $transaction['type'];\n\t\t\t$transactionValues['orderId'] = $transaction['orderId'] ?? null;\n\t\t\t$transactionValues['couponCode'] = $transaction['couponCode'] ?? null;\n\t\t\t$transactionValues['newCustomer'] = $transaction['newCustomer'] ?? null;\n\n\t\t\tif (isset($orders[$transaction['orderId']])) {\n\t\t\t\t$transactionValues['order'] = $orders[$transaction['orderId']];\n\t\t\t}\n\n\t\t\t$newTransactionsValues[] = $transactionValues;\n\t\t}\n\n\t\t$this->EHubTransactionRepository->syncMany($newTransactionsValues);\n\t}",
"protected function getEntityIdsReferencingReadyUpdates() {\n $entity_ids = [];\n if ($field_ids = $this->getReferencingFieldIds()) {\n $entity_storage = $this->entityTypeManager->getStorage($this->updateEntityType());\n foreach ($field_ids as $field_id) {\n\n $query = $entity_storage->getQuery('AND');\n $this->addActiveUpdateConditions($query, \"$field_id.entity.\");\n $entity_ids += $query->execute();\n }\n }\n return $entity_ids;\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 }",
"public function & getEntityChangeSet($entity)\n {\n $oid = spl_object_hash($entity);\n $data = [];\n if (!isset($this->entityChangeSets[$oid])) {\n return $data;\n }\n\n return $this->entityChangeSets[$oid];\n }",
"public function flush()\r\n {\r\n foreach ($this->_collections as $key => $coll) {\r\n $coll->takeSnapshot();\r\n }\r\n foreach ($this->_tables as $table) {\r\n $table->setAttribute(Doctrine::ATTR_LOAD_REFERENCES, true);\r\n }\r\n $this->_initializedRelations = null;\r\n $this->_collections = null;\r\n $this->_tables = null;\r\n }",
"public function flushChanges()\n {\n $this->om->flush();\n }",
"public function run() {\n\n $entities = Entity::all();\n\n Transaction::factory()->count(60)->make()->each(function ($transaction) use ($entities) {\n $entity = $entities->random();\n $entity->transactions()->save($transaction);\n });\n }",
"public function establish_loaded_changeset()\n {\n }",
"public static function updateAll()\r\n\t{\r\n\t}",
"public function change()\n {\n\n $time = new Time('+4 hours'); \n\n $usersTable = TableRegistry::get('Users');\n $schedulerTable = TableRegistry::get('Scheduler');\n $usersData = $usersTable->find()->where('active',1)->toArray();\n foreach($usersData as $user){\n\n $schedule = $schedulerTable->newEntity();\n $schedule->user_id = $user['id'];\n $schedule->marketplace_id = 1;\n $schedule->job_interval = 4;\n $schedule->next_occurrence = $time;\n $schedule->type = 'Crawler';\n $schedule->meta_data = serialize([]);\n $schedule->created = Time::now();;\n $schedule->updated = Time::now();;\n $scheduleData = $schedulerTable->save($schedule);\n\n $schedule1 = $schedulerTable->newEntity();\n $schedule1->user_id = $user['id'];\n $schedule1->marketplace_id = 2;\n $schedule1->job_interval = 4;\n $schedule1->next_occurrence = $time;\n $schedule1->meta_data = serialize([]);\n $schedule1->type = 'Crawler';\n $schedule1->created = Time::now();;\n $schedule1->updated = Time::now();;\n $scheduleData = $schedulerTable->save($schedule1);\n\n }\n }",
"public function applyChanges()\n {\n $em = $this->doctrine->getManager();\n $em->flush();\n\n // TODO: Can we be sure that the changes are available in the DB now?\n $ch = $this->getMasterRabbit()->channel();\n $msg = new AMQPMessage(\"sync\");\n $ch->basic_publish($msg, \"\", $this->name . \"_master\");\n }",
"protected function getUpdateStatements() {}",
"public function getChangedEntries();",
"private function perfomOperations($insert, $update, $remove)\n {\n $bulkOperations = [];\n foreach ($insert as $id => $document) {\n $repository = $this->getObjectRepository($document);\n if ($repository instanceof GridFSRepository) {\n $repository->insertOne($document);\n unset($insert[$id]);\n } else {\n $query = $repository->insertOne($document, ['getQuery' => true]);\n $repositoryId = spl_object_hash($repository);\n $bulkOperations[$repositoryId] = isset($bulkOperations[$repositoryId]) ? $bulkOperations[$repositoryId] : $repository->createBulkWriteQuery();\n $bulkOperations[$repositoryId]->addQuery($query);\n }\n }\n\n foreach ($update as $id => $document) {\n $repository = $this->getObjectRepository($document);\n $query = $repository->updateOne($document, [], ['getQuery' => true]);\n $repositoryId = spl_object_hash($repository);\n $bulkOperations[$repositoryId] = isset($bulkOperations[$repositoryId]) ? $bulkOperations[$repositoryId] : $repository->createBulkWriteQuery();\n $bulkOperations[$repositoryId]->addQuery($query);\n }\n\n foreach ($remove as $id => $document) {\n $repository = $this->getObjectRepository($document);\n if ($repository instanceof GridFSRepository) {\n $repository->deleteOne($document);\n unset($remove[$id]);\n } else {\n $query = $repository->deleteOne($document, ['getQuery' => true]);\n $repositoryId = spl_object_hash($repository);\n $bulkOperations[$repositoryId] = isset($bulkOperations[$repositoryId]) ? $bulkOperations[$repositoryId] : $repository->createBulkWriteQuery();\n $bulkOperations[$repositoryId]->addQuery($query);\n }\n }\n\n foreach (array_merge($insert, $update, $remove) as $id => $document) {\n $repository = $this->getObjectRepository($document);\n $event = new PreFlushEvent($this, $repository, $document);\n $this->eventDispatcher->dispatch($event, $event::NAME);\n }\n\n foreach ($bulkOperations as $bulkOperation) {\n $bulkOperation->execute();\n }\n\n foreach (array_merge($insert, $update) as $id => $document) {\n $repository = $this->getObjectRepository($document);\n $event = new PostFlushEvent($this, $repository, $document);\n $this->eventDispatcher->dispatch($event, $event::NAME);\n $repository->cacheObject($document);\n }\n\n $this->flush();\n }",
"public function flushAll();",
"public function getChangeset(): array\n\t{\n\t\t$changes = [];\n\n\t\tforeach ($this->getNonMetadataFields() as $key => $value) {\n\t\t\tif (! isset($this->initialFieldValues[$key]) || $value !== $this->initialFieldValues[$key]) {\n\t\t\t\t$changes[$key] = $value;\n\t\t\t}\n\t\t}\n\n\t\treturn $changes;\n\t}",
"public function persistAll() {}",
"public function ApplyChanges()\n {\n parent::ApplyChanges();\n\n }",
"public function storeAll(iterable $snapshots): void;"
] |
[
"0.8103692",
"0.75419444",
"0.6774082",
"0.61141384",
"0.60324174",
"0.5676234",
"0.5670448",
"0.55054337",
"0.55054337",
"0.54555905",
"0.529142",
"0.51799786",
"0.51190394",
"0.5113744",
"0.51107645",
"0.5099031",
"0.5069252",
"0.5060243",
"0.50539273",
"0.50276953",
"0.4964529",
"0.4918786",
"0.49114862",
"0.48937893",
"0.4890258",
"0.48858848",
"0.48632967",
"0.4850613",
"0.48297232",
"0.48236632"
] |
0.84592605
|
0
|
Computes the changes of an association.
|
private function computeAssociationChanges($assoc, $value)
{
if ($value instanceof Proxy && !$value->__isInitialized__) {
return;
}
if ($value instanceof ApiCollection && $value->isDirty()) {
$coid = spl_object_hash($value);
$this->collectionUpdates[$coid] = $value;
$this->visitedCollections[$coid] = $value;
}
// Look through the entities, and in any of their associations,
// for transient (new) entities, recursively. ("Persistence by reachability")
// Unwrap. Uninitialized collections will simply be empty.
$unwrappedValue = ($assoc['type'] & ApiMetadata::TO_ONE) ? [$value] : $value->unwrap();
$targetClass = $this->manager->getClassMetadata($assoc['targetEntity']);
$targetClassName = $targetClass->getName();
foreach ($unwrappedValue as $key => $entry) {
if (!($entry instanceof $targetClassName)) {
throw new \InvalidArgumentException('Invalid association');
}
$state = $this->getEntityState($entry, self::STATE_NEW);
if (!($entry instanceof $assoc['targetEntity'])) {
throw new \UnexpectedValueException('Unexpected association');
}
switch ($state) {
case self::STATE_NEW:
if (!$assoc['isCascadePersist']) {
throw new \InvalidArgumentException('New entity through relationship');
}
$this->persistNew($targetClass, $entry);
$this->computeChangeSet($targetClass, $entry);
break;
case self::STATE_REMOVED:
// Consume the $value as array (it's either an array or an ArrayAccess)
// and remove the element from Collection.
if ($assoc['type'] & ApiMetadata::TO_MANY) {
unset($value[$key]);
}
break;
case self::STATE_DETACHED:
// Can actually not happen right now as we assume STATE_NEW,
// so the exception will be raised from the DBAL layer (constraint violation).
throw new \InvalidArgumentException('Detached entity through relationship');
break;
default:
// MANAGED associated entities are already taken into account
// during changeset calculation anyway, since they are in the identity map.
}
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function calculateChangeSet()\n {\n $set = [];\n foreach ($this->current as $key => $current) {\n $original = isset($this->original[$key]) ? $this->original[$key] : null;\n $set[$key]['old'] = $original;\n $set[$key]['new'] = $current;\n }\n foreach ($this->remove as $key) {\n $set[$key]['old'] = $this->original[$key];\n $set[$key]['new'] = null;\n }\n ksort($set);\n return $set;\n }",
"public function getChanges();",
"public function getChanges();",
"public function computeChangeSets()\n {\n $this->computeScheduleInsertsChangeSets();\n\n // Compute changes for other MANAGED documents. Change tracking policies take effect here.\n foreach ($this->identityMap as $className => $documents) {\n $class = $this->dm->getClassMetadata($className);\n if($class->isEmbeddedDocument) {\n // Embedded documents should only compute by the document itself which include the embedded document.\n // This is done separately later.\n // @see computeChangeSet()\n // @see computeAssociationChanges()\n continue;\n }\n\n // If change tracking is explicit or happens through notification, then only compute\n // changes on documents of that type that are explicitly marked for synchronization.\n $documentsToProcess = ! $class->isChangeTrackingDeferredImplicit() ?\n (isset($this->scheduledForDirtyCheck[$className]) ?\n $this->scheduledForDirtyCheck[$className] : array())\n : $documents;\n\n foreach ($documentsToProcess as $document) {\n // Ignore uninitialized proxy objects\n if (/* $document is readOnly || */ $document instanceof Proxy && ! $document->__isInitialized__) {\n continue;\n }\n // Only MANAGED documents that are NOT SCHEDULED FOR INSERTION are processed here.\n $oid = spl_object_hash($document);\n if ( ! isset($this->documentInsertions[$oid]) && isset($this->documentStates[$oid])) {\n $this->computeChangeSet($class, $document);\n }\n }\n }\n }",
"private function computeAssociationChanges($parentDocument, $mapping, $value)\n {\n $isNewParentDocument = isset($this->documentInsertions[spl_object_hash($parentDocument)]);\n $class = $this->dm->getClassMetadata(get_class($parentDocument));\n $topOrExistingDocument = (!$isNewParentDocument || !$class->isEmbeddedDocument);\n\n if ($value instanceof PersistentCollection && $value->isDirty() && $mapping['isOwningSide'] && ($topOrExistingDocument || $mapping['strategy'] === 'set')) {\n if (!in_array($value, $this->collectionUpdates, true)) {\n $this->collectionUpdates[] = $value;\n }\n $this->visitedCollections[] = $value;\n } else if ($value instanceof PersistentCollection && $value->isDirty() && $mapping['isOwningSide']) {\n $this->visitedCollections[] = $value;\n }\n\n if ( ! isset($mapping['embedded']) && ! $mapping['isCascadePersist']) {\n return; // \"Persistence by reachability\" only if persist cascade specified\n }\n\n if ($mapping['type'] === 'one') {\n if ($value instanceof Proxy && ! $value->__isInitialized__) {\n return; // Ignore uninitialized proxy objects\n }\n $value = array($value);\n } elseif ($value instanceof PersistentCollection) {\n $value = $value->unwrap();\n }\n $count = 0;\n foreach ($value as $key => $entry) {\n $targetClass = $this->dm->getClassMetadata(get_class($entry));\n $state = $this->getDocumentState($entry, self::STATE_NEW);\n $oid = spl_object_hash($entry);\n\n // Handle \"set\" strategy for multi-level hierarchy\n $pathKey = $mapping['strategy'] !== 'set' ? $count : $key;\n $path = $mapping['type'] === 'many' ? $mapping['name'].'.'.$pathKey : $mapping['name'];\n\n $count++;\n if ($state == self::STATE_NEW) {\n if ( ! $targetClass->isEmbeddedDocument && ! $mapping['isCascadePersist']) {\n throw new \\InvalidArgumentException(\"A new document was found through a relationship that was not\"\n . \" configured to cascade persist operations: \" . self::objToStr($entry) . \".\"\n . \" Explicitly persist the new document or configure cascading persist operations\"\n . \" on the relationship.\");\n }\n $this->persistNew($targetClass, $entry);\n $this->setParentAssociation($entry, $mapping, $parentDocument, $path);\n $this->computeChangeSet($targetClass, $entry);\n } else if ($state == self::STATE_MANAGED && $targetClass->isEmbeddedDocument) {\n $this->setParentAssociation($entry, $mapping, $parentDocument, $path);\n $this->computeChangeSet($targetClass, $entry);\n } else if ($state == self::STATE_REMOVED) {\n return new \\InvalidArgumentException(\"Removed document detected during flush: \"\n . self::objToStr($entry).\". Remove deleted documents from associations.\");\n } else if ($state == self::STATE_DETACHED) {\n // Can actually not happen right now as we assume STATE_NEW,\n // so the exception will be raised from the DBAL layer (constraint violation).\n throw new \\InvalidArgumentException(\"A detached document was found through a \"\n . \"relationship during cascading a persist operation.\");\n }\n }\n }",
"public function updateAssociatedRecords()\n\t{\n\t\t$fkObject = $this->getContext()->getPropertyValue();\n\t\t$source = $this->getSourceRecord();\n\t\t$fkeys = $this->findForeignKeys($fkObject, $source);\n\t\tforeach($fkeys as $fKey => $srcKey)\n\t\t\t$fkObject->setColumnValue($fKey, $source->getColumnValue($srcKey));\n\t\treturn $fkObject->save();\n\t}",
"public function computeChangeSets()\n {\n // Compute changes for INSERTed entities first. This must always happen.\n $this->computeScheduleInsertsChangeSets();\n // Compute changes for other MANAGED entities. Change tracking policies take effect here.\n foreach ($this->identityMap as $className => $entities) {\n $class = $this->manager->getClassMetadata($className);\n // Skip class if instances are read-only\n if ($class->isReadOnly()) {\n continue;\n }\n // If change tracking is explicit or happens through notification, then only compute\n // changes on entities of that type that are explicitly marked for synchronization.\n switch (true) {\n case ($class->isChangeTrackingDeferredImplicit()):\n $entitiesToProcess = $entities;\n break;\n case (isset($this->scheduledForSynchronization[$className])):\n $entitiesToProcess = $this->scheduledForSynchronization[$className];\n break;\n default:\n $entitiesToProcess = [];\n }\n foreach ($entitiesToProcess as $entity) {\n // Ignore uninitialized proxy objects\n if ($entity instanceof Proxy && !$entity->__isInitialized__) {\n continue;\n }\n // Only MANAGED entities that are NOT SCHEDULED FOR INSERTION OR DELETION are processed here.\n $oid = spl_object_hash($entity);\n if (!isset($this->entityInsertions[$oid]) &&\n !isset($this->entityDeletions[$oid]) &&\n isset($this->entityStates[$oid])\n ) {\n $this->computeChangeSet($class, $entity);\n }\n }\n }\n }",
"public function change($changes);",
"public function getChange();",
"function collections_update($item, $selected, $existing, $relationship) {\n$display .= 'collections_update ...<br>';\t\n\t$add = array_diff($selected, $existing);\n\t$rem = array_diff($existing, $selected);\n$display .= '$relationship: '.$relationship.'<br>';\n\t\n\t$add = array_unique($add);\n\t$add = array_values($add);\n\t$rem = array_unique($rem);\n\t$rem = array_values($rem);\n\t$guid_two = $item->getguid();\n\t\n\tforeach($add as $i){\n\t\t$guid_one = $i;\n\t\tif(!check_entity_relationship($guid_one, $relationship, $guid_two)){\n\t\t\tadd_entity_relationship($guid_one, $relationship, $guid_two);\n\t\t}\t\t\n\t}\n\tforeach($rem as $i){\n\t\t$guid_one = $i;\n\t\tremove_entity_relationship($guid_one, $relationship, $guid_two);\n\t}\n}",
"public function getAffectations()\n\t{\n\t\treturn $this->affectations;\n\t}",
"function calculate_changes(&$fields, &$db_rec, &$sage_rec)\n{\n global $FIELD_MAP, $NULLIFY_INSTATE;\n\n $changes = ['notes'=> [], 'abbrevs'=> [], 'sqldata'=> []];\n\n foreach ($fields as $abbr) {\n $dbfld = $FIELD_MAP[$abbr]['db'];\n $sagefld = $FIELD_MAP[$abbr]['sage'];\n $db_val = get($db_rec, $dbfld, 'NULL');\n $sage_val = get($sage_rec, $sagefld, 'NULL');\n if (is_array($sage_val)) {\n $sage_val = get($sage_val, 'district', 'NULL');\n }\n\n if ($db_val != $sage_val) {\n if ($sage_val != 'NULL' || in_array($abbr, $NULLIFY_INSTATE)) {\n // If the SAGE value for the current field is \"null\" (and the original\n // value was not null), then the field will be nullified only if it's\n // one of the four primary district fields (CD, SD, AD, or ED).\n if ($sage_val == 'NULL') {\n $sage_val = 0;\n }\n $changes['abbrevs'][] = $abbr;\n $changes['sqldata'][$dbfld] = $sage_val;\n $changes['notes'][] = \"$abbr:$db_val=>$sage_val\";\n }\n else {\n $changes['notes'][] = \"$abbr:$db_val~=$db_val\";\n }\n }\n else {\n $changes['notes'][] = \"$abbr:$db_val==$sage_val\";\n }\n }\n\n return $changes;\n}",
"public function ApplyChanges()\n {\n parent::ApplyChanges();\n\n }",
"protected function _changed()\n {\n // Clean up caches\n $this->_subClasses = array();\n $this->_notSubClasses = array();\n }",
"public function update_simple_assocs()\n {\n Logger::getInstance()->po_log(\"PO:update_simple_assocs\");\n\n foreach( $this->hasOne as $attr => $type )\n {\n $obj = $this->attributeValues[ $attr ]; // Valor es un objeto (puede ser null!)\n\n // El objeto debe estar cargado para poder pedirle el id\n if ( $obj !== PersistentObject::NOT_LOADED_ASSOC )\n {\n $refAttrName = DatabaseNormalization::simpleAssoc( $attr );\n if ($obj)\n {\n // Si es MTI, el id de cualquier clase parcial será el mismo.\n $this->attributeValues[ $refAttrName ] = $obj->getId(); // seteo ref_id, ej. \"email_id\"\n }\n else\n {\n $this->attributeValues[ $refAttrName ] = NULL; // Si no hay objeto, la referencia es NULL.\n }\n }\n }\n }",
"protected function calculateChange()\n {\n $difference = (int) $this->value['value'] - (int) $this->previous;\n\n // Prevent division by zero\n if ($difference !== 0) {\n $this->change = round(($difference / $this->value['value']) * 100, 2);\n } else {\n $this->change = 0;\n }\n\n if($this->previous && (int) $this->previous > 0){\n $this->changeLabel = abs($this->change) . '% ' . ($this->change > 0? 'Increase' : 'Decrease');\n }else{\n $this->changeLabel = 'No Prior Data';\n }\n }",
"private function changelog_calculate_edit_diff () {\n\t\t//old object - checkboxes that are not present, set them as 0\n\t\tforeach($this->object_old as $k=>$v) {\n\t\t\tif(!isset($this->object_new[$k]) && $v==\"1\") {\n\t\t\t\t$this->object_new[$k] = 0;\n\t\t\t}\n\t\t}\n\t\tforeach ($this->object_new as $k=>$v) {\n\t\t\tif(!isset($this->object_old[$k]) && $v==\"1\") {\n\t\t\t\t$this->object_old[$k] = 0;\n\t\t\t}\n\t\t}\n\t\t// ip address - old needs to be transformed to dotted format\n\t\t$this->object_old['ip_addr'] = $this->Subnets->transform_address($this->object_old['ip_addr'], \"dotted\");\n\t\t$this->object_new['ip_addr'] = $this->Subnets->transform_address($this->object_new['ip_addr'], \"dotted\");\n\n\t\t// check each value\n\t\tforeach($this->object_new as $k=>$v) {\n\t\t\t//change\n\t\t\tif($this->object_old[$k]!=$v && ($this->object_old[$k] != str_replace(\"\\'\", \"'\", $v)))\t{\n\t\t\t\t//empty\n\t\t\t\tif(strlen(@$this->object_old[$k])==0)\t{ $this->object_old[$k] = \"NULL\"; }\n\t\t\t\tif(strlen(@$v)==0)\t\t\t\t\t\t{ $v = \"NULL\"; }\n\n\t\t\t\t//tag change\n\t\t\t\tif($k == 'state') \t\t\t\t{ $v = $this->changelog_format_tag_diff ($k, $v); }\n\t\t\t\t//section change\n\t\t\t\telseif($k == 'sectionIdNew') \t{ $v = $this->changelog_format_section_diff ($k, $v); }\n\t\t\t\t//master subnet change\n\t\t\t\telseif($k == \"masterSubnetId\") \t{ $v = $this->changelog_format_master_subnet_diff ($k, $v); }\n\t\t\t\t//device change\n\t\t\t\telseif($k == 'switch') \t\t\t{ $v = $this->changelog_format_device_diff ($k, $v); }\n\t\t\t\t//vlan\n\t\t\t\telseif($k == 'vlanId') \t\t\t{ $v = $this->changelog_format_vlan_diff ($k, $v); }\n\t\t\t\t//vrf\n\t\t\t\telseif($k == 'vrfId') \t\t\t{ $v = $this->changelog_format_vrf_diff ($k, $v); }\n\t\t\t\t//master section change\n\t\t\t\telseif($k == 'masterSection') \t{ $v = $this->changelog_format_master_section_diff ($k, $v); }\n\t\t\t\t//permission change\n\t\t\t\telseif($k == \"permissions\") \t{ $v = $this->changelog_format_permission_diff ($k, $v); }\n\t\t\t\t// make booleans\n\t\t\t\t$v = $this->changelog_make_booleans ($k, $v);\n\t\t\t\t//set log\n\t\t\t\tif ($k!==\"id\")\n\t\t\t\t$log[\"$k\"] = $this->object_old[$k].\" => $v\";\n\t\t\t}\n\t\t}\n\t\t// result\n\t\treturn $log;\n\t}",
"function map( SqlEntity $entity , SqlEntity $changes )\r\n\t{\r\n\t\t// MAP ATTRIBUTES\r\n\r\n\t\t$foundAttributes = array();\r\n\t\t$this->_changes = array();\r\n\t\tforeach( $entity->Attributes as $name => $attr )\r\n\t\t{\r\n\t\t\tif( !is_string( $name ))\r\n\t\t\t\t$name = $attr->InnerName;\r\n\r\n\t\t\t$changeAttr = null;\r\n\t\t\tif( array_key_exists( $name, $changes->Attributes ) )\r\n\t\t\t\t//&& !$changes->Attributes[ $name ]->isReference() )\r\n\t\t\t{\r\n\t\t\t\t$changeAttr = $changes->Attributes[ $name ];\r\n\t\t\t\t$foundAttributes[ $name ] = $changedAttr;\r\n\t\t\t}\r\n\t\t\t//else\r\n\t\t\t\t// TODO: CHECK DIRTY NAME ON CHANGED ATTRIBUTE FOR MATCH WITH OLD ATTRIBUTE\r\n\r\n\t\t\t$changedAttribute = $this->mapAttribute( $attr, $changeAttr );\r\n\t\t\tif( $changedAttribute !== null )\r\n\t\t\t\t$entity->Attributes[ $name ] = $changedAttribute;\r\n\t\t}\r\n\r\n\t\t$newAttributes = array_diff_key( $changes->Attributes, $foundAttributes );\r\n\r\n\t\tforeach( $newAttributes as $attr )\r\n\t\t{\r\n\t\t\t$entity->Attributes[ $attr->InnerName ] = $this->mapAttribute( null, $attr );\r\n\t\t}\r\n\r\n\t\t// MAP RELATIONS\r\n\t\t$relationshipMapper = new SQLRelationshipMapper();\r\n\t\t$entity = $relationshipMapper->map( $entity );\r\n\r\n\t\t$foundRelations = array();\r\n\t\tforeach( $entity->Relations as $name => $relation )\r\n\t\t{\r\n\t\t\tif( !is_string( $name ))\r\n\t\t\t\t$name = $relation->Name;\r\n\r\n\t\t\t$changeRelation = null;\r\n\t\t\tif( array_key_exists( $name, $changes->Relations ) )\r\n\t\t\t{\r\n\t\t\t\t$changeRelation = $changes->Relations[ $name ];\r\n\t\t\t\t$foundRelations[ $name ] = $changeRelation;\r\n\t\t\t}\r\n\r\n\t\t\t$changedRelation = $this->mapRelation( $relation, $changeRelation );\r\n\t\t\tif( $changedRelation !== null )\r\n\t\t\t\t$entity->Relations[ $name ] = $changeRelation;\r\n\t\t}\r\n\r\n\t\t$newRelations = array_diff_key( $changes->Relations, $foundRelations );\r\n\r\n\t\tforeach( $newRelations as $relation )\r\n\t\t{\r\n\t\t\t$entity->Relations[ $relation->Name ] = $this->mapRelation( null, $relation );\r\n\t\t}\r\n\r\n\t\treturn $entity;\r\n\t}",
"public function getChanges(): array\n {\n $changes = [];\n\n foreach ($this->changedAttributesName() as $key) {\n $changes[$key] = $this->originals[$key];\n }\n\n return $changes;\n }",
"public function changes()\r\n\t{\r\n\t\t$Change = App::make('Change');\r\n\r\n\t\treturn $Change::where('fmodel', 'GalleryItem')\r\n\t\t\t\t \t ->where('fid', $this->id)\r\n\t\t\t\t \t ->with('user')\r\n\t\t\t\t \t ->orderBy('created_at', 'DESC')\r\n\t\t\t\t \t ->get();\r\n\t}",
"protected function processSyncOperations(Array $subjectsAndPredicatesOfChange, $contextAlias)\n {\n foreach($this->getSyncOperations() as $op)\n {\n /** @var \\Tripod\\Mongo\\Composites\\IComposite $composite */\n $composite = $this->tripod->getComposite($op);\n $opSubjects = $composite->getImpactedSubjects($subjectsAndPredicatesOfChange,$contextAlias);\n if (!empty($opSubjects)) {\n foreach($opSubjects as $subject)\n {\n /* @var $subject ImpactedSubject */\n $t = new \\Tripod\\Timer();\n $t->start();\n\n // Call update on the subject, rather than the composite directly, in case the change was to\n // another pod\n $subject->update($subject);\n\n $t->stop();\n\n $this->timingLog(MONGO_ON_THE_FLY_MR,array(\n \"duration\"=>$t->result(),\n \"storeName\"=>$subject->getStoreName(),\n \"podName\"=>$subject->getPodName(),\n \"resourceId\"=>$subject->getResourceId()\n ));\n $this->getStat()->timer(MONGO_ON_THE_FLY_MR,$t->result());\n }\n }\n }\n\n }",
"function DBChange($Old,$New,$Both,$Table){\n foreach ($Both as $DiffRow) {\n $Diff = array_diff($New[$DiffRow[DmrID]],$Old[$DiffRow[DmrID]]);\n if ($Diff) {\n $ChangeQuery = BuildSqlUpdate($DiffRow,$Table,\"`DmrID`='\".$DiffRow[DmrID].\"'\").\"\\n\";\n print $Query.\"\\n\";\n mysql_query($ChangeQuery) or die(mysql_error());\n foreach ($Diff as $DifferentItemKey => $DifferentItemVal) {\n $DiffArray = array('DmrID' => $DiffRow[DmrID],'FieldName' => $DifferentItemKey,\n 'OldValue' => $DifferentItemVal,'NewValue' => $Old[$DiffRow[DmrID]][$DifferentItemKey]);\n LogChange($DiffArray,\"CHANGE\",$Table);\n }\n }\n }\n}",
"public function ApplyChanges()\n {\n parent::ApplyChanges();\n\n // Update data\n $this->Update();\n }",
"private function processManyToAnyAssociation(\n $sourceChange,\n $entityClass,\n $fieldName,\n $sourceEntityClass,\n $sourceEntityId,\n &$map\n ) {\n list($old, $new) = $sourceChange;\n\n $new = $this->extractValue($new, 'inserted');\n foreach ($new['inserted'] as $insert) {\n $this->processInsert($map, $insert, $entityClass, $fieldName, $sourceEntityClass, $sourceEntityId);\n }\n\n $old = $this->extractValue($old, 'deleted');\n foreach ($old['deleted'] as $delete) {\n $this->processDelete($map, $delete, $entityClass, $fieldName, $sourceEntityClass, $sourceEntityId);\n }\n }",
"function changed_properties() {\r\n \t$changed = array();\r\n \tforeach($this->_frozen_properties as $var => $val) {\r\n \t\tif ($this->$var != $this->_frozen_properties[$var])// This property has changed:\r\n \t\t\t$changed[$var] = $val;\r\n \t}\r\n \treturn $changed;\r\n }",
"private function computeScheduleInsertsChangeSets()\n {\n foreach ($this->documentInsertions as $document) {\n $class = $this->dm->getClassMetadata(get_class($document));\n\n $this->computeChangeSet($class, $document);\n }\n }",
"public function changed ()\n\t{\n\t\treturn new Vector($this->changed_properties);\n\t}",
"function updateProperties($mutations);",
"private function tree_apply_changes($changes) {\n global $db;\n\n foreach ($changes as $id => $change) {\n $change[\"ID_KAT\"] = $id;\n if ($updateid = $db->update($this->table, $change))\n unset($this->cache_nodes[$updateid]);\n }\n\n return $this->tree_create_nestedset();\n }",
"public function __clone()\n {\n foreach ($this->_associations as $i => $association) {\n $this->_associations[$i] = clone $association;\n }\n }"
] |
[
"0.6044678",
"0.56390655",
"0.56390655",
"0.56258863",
"0.5405964",
"0.53600514",
"0.5335398",
"0.5168286",
"0.50743836",
"0.50736433",
"0.5017359",
"0.5008192",
"0.48589176",
"0.48439872",
"0.4829796",
"0.4821199",
"0.4816102",
"0.47909385",
"0.47648874",
"0.4757226",
"0.4755734",
"0.4744496",
"0.4720895",
"0.47187957",
"0.47047204",
"0.4674085",
"0.46566075",
"0.46460456",
"0.46376097",
"0.4593614"
] |
0.6343458
|
0
|
Cascades a refresh operation to associated entities.
|
private function cascadeRefresh($entity, array &$visited)
{
$class = $this->manager->getClassMetadata(get_class($entity));
$associationMappings = array_filter(
$class->getAssociationMappings(),
function($assoc) {
return $assoc['isCascadeRefresh'];
}
);
foreach ($associationMappings as $assoc) {
$relatedEntities = $class->getReflectionProperty($assoc['fieldName'])->getValue($entity);
switch (true) {
case ($relatedEntities instanceof ApiCollection):
// Unwrap so that foreach() does not initialize
$relatedEntities = $relatedEntities->unwrap();
// break; is commented intentionally!
case ($relatedEntities instanceof Collection):
case (is_array($relatedEntities)):
foreach ($relatedEntities as $relatedEntity) {
$this->doRefresh($relatedEntity, $visited);
}
break;
case ($relatedEntities !== null):
$this->doRefresh($relatedEntities, $visited);
break;
default:
// Do nothing
}
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function refresh()\n {\n $this->entityManager->refresh($this);\n }",
"public function refresh()\n {\n // Several refresh() calls might happen during one request. If that is the case, the Resource Manager can't know\n // that the first created resource object doesn't have to be persisted / published anymore. Thus we need to\n // delete the resource manually in order to avoid orphaned resource objects:\n if ($this->resource !== null) {\n $this->resourceManager->deleteResource($this->resource);\n }\n\n parent::refresh();\n $this->renderResource();\n }",
"public function refresh()\n {\n foreach($this->records as $rec) {\n $rec->refresh($this->conn);\n }\n }",
"public function refresh() {\n\t\t$this->refreshAll($this->categoryID);\n\t}",
"public function refresh() {}",
"private function refreshEntities()\n {\n if ($this->config->get('speed_analyzer.enabled') !== null) {\n $this->structureManager->clearCacheAndProxies();\n }\n }",
"private function cascadeRefresh($document, array &$visited)\n {\n $class = $this->dm->getClassMetadata(get_class($document));\n foreach ($class->fieldMappings as $mapping) {\n if (isset($mapping['reference']) && ! $mapping['isCascadeRefresh']) {\n continue;\n }\n if (isset($mapping['embedded'])) {\n $relatedDocuments = $class->reflFields[$mapping['fieldName']]->getValue($document);\n if (($relatedDocuments instanceof Collection || is_array($relatedDocuments))) {\n if ($relatedDocuments instanceof PersistentCollection) {\n // Unwrap so that foreach() does not initialize\n $relatedDocuments = $relatedDocuments->unwrap();\n }\n foreach ($relatedDocuments as $relatedDocument) {\n $this->cascadeRefresh($relatedDocument, $visited);\n }\n } elseif ($relatedDocuments !== null) {\n $this->cascadeRefresh($relatedDocuments, $visited);\n }\n } elseif (isset($mapping['reference'])) {\n $relatedDocuments = $class->reflFields[$mapping['fieldName']]->getValue($document);\n if (($relatedDocuments instanceof Collection || is_array($relatedDocuments))) {\n if ($relatedDocuments instanceof PersistentCollection) {\n // Unwrap so that foreach() does not initialize\n $relatedDocuments = $relatedDocuments->unwrap();\n }\n foreach ($relatedDocuments as $relatedDocument) {\n $this->doRefresh($relatedDocument, $visited);\n }\n } elseif ($relatedDocuments !== null) {\n $this->doRefresh($relatedDocuments, $visited);\n }\n }\n }\n }",
"public function refresh()\n {\n }",
"public function refresh($entity)\n {\n $visited = [];\n $this->doRefresh($entity, $visited);\n }",
"public function _cache_refresh_all()\n {\n }",
"abstract public function refresh();",
"public function refresh($object);",
"public function refresh(): void;",
"public function flush()\r\n {\r\n foreach ($this->_collections as $key => $coll) {\r\n $coll->takeSnapshot();\r\n }\r\n foreach ($this->_tables as $table) {\r\n $table->setAttribute(Doctrine::ATTR_LOAD_REFERENCES, true);\r\n }\r\n $this->_initializedRelations = null;\r\n $this->_collections = null;\r\n $this->_tables = null;\r\n }",
"public function flushChanges()\n {\n $this->om->flush();\n }",
"public function refresh() {\n $this->getObjectManager()->refresh($this);\n return $this;\n }",
"public function refresh();",
"public function refresh();",
"public function refresh()\n {\n $this->_totalCount = null;\n $this->_models = null;\n $this->_keys = null;\n }",
"public function forceRefresh()\n {\n $this->dataLoaded = false;\n $this->interfaces = [];\n }",
"public function flushUpdates();",
"public function refreshUpdated()\n {\n $this->setUpdated(new \\DateTime());\n }",
"public function afterFetch()\n {\n $this->deepRefToObj();\n }",
"abstract protected function needRefresh();",
"public function refresh() {\n \tif( $this->fetchData ) {\n \t\t\n \t\t// send data to view\n \t\t$this->set(array(\n \t\t\t'data' => $this->Reading->find('all'),\n \t\t\t'_serialize', array('data')));\n \t}\n\n }",
"public function refresh(): void\n {\n $this->query('SELECT 1')->execute();\n }",
"public function flushAllChanges()\r\n {\r\n $this->em->flush();\r\n }",
"private function doRefresh($entity, array &$visited)\n {\n $oid = spl_object_hash($entity);\n if (isset($visited[$oid])) {\n return; // Prevent infinite recursion\n }\n $visited[$oid] = $entity; // mark visited\n $class = $this->manager->getClassMetadata(get_class($entity));\n if ($this->getEntityState($entity) !== self::STATE_MANAGED) {\n throw new \\InvalidArgumentException('Entity not managed');\n }\n $this->getEntityPersister($class->getName())->refresh(\n array_combine($class->getIdentifierFieldNames(), $this->entityIdentifiers[$oid]),\n $entity\n );\n $this->cascadeRefresh($entity, $visited);\n }",
"public function rebuildAuthorizations()\n {\n $roleRepository = $this->entityManager->getRepository('Edweld\\AclBundle\\Entity\\Role');\n\n // Clear\n $this->entityManager->createQuery('DELETE Edweld\\AclBundle\\Entity\\Authorization')->execute();\n $this->entityManager->clear('Edweld\\AclBundle\\Entity\\Authorization');\n\n // Regenerate\n foreach ($roleRepository->findAll() as $role) {\n /** @var Role $role */\n $role->createAuthorizations($this);\n }\n $this->entityManager->flush();\n $this->entityManager->clear();\n }",
"public function refreshConfig()\n {\n $this->_data = $this->_reader->read();\n $this->merge($this->_dbReader->get());\n }"
] |
[
"0.6763053",
"0.62119687",
"0.59637463",
"0.58446914",
"0.57453054",
"0.5700165",
"0.56867725",
"0.5543405",
"0.54974896",
"0.5497484",
"0.54800206",
"0.5472978",
"0.54582626",
"0.5439263",
"0.5416681",
"0.53853506",
"0.5363833",
"0.5363833",
"0.53207237",
"0.53110844",
"0.5303486",
"0.5262646",
"0.52368206",
"0.5208885",
"0.517328",
"0.5161918",
"0.51550233",
"0.5139243",
"0.50989896",
"0.5079328"
] |
0.6430365
|
1
|
Cascades a detach operation to associated entities.
|
private function cascadeDetach($entity, array &$visited)
{
$class = $this->manager->getClassMetadata(get_class($entity));
$associationMappings = array_filter(
$class->getAssociationMappings(),
function($assoc) {
return $assoc['isCascadeDetach'];
}
);
foreach ($associationMappings as $assoc) {
$relatedEntities = $class->getReflectionProperty($assoc['fieldName'])->getValue($entity);
switch (true) {
case ($relatedEntities instanceof ApiCollection):
// Unwrap so that foreach() does not initialize
$relatedEntities = $relatedEntities->unwrap();
// break; is commented intentionally!
case ($relatedEntities instanceof Collection):
case (is_array($relatedEntities)):
foreach ($relatedEntities as $relatedEntity) {
$this->doDetach($relatedEntity, $visited);
}
break;
case ($relatedEntities !== null):
$this->doDetach($relatedEntities, $visited);
break;
default:
// Do nothing
}
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function detach() {}",
"public function detach() {}",
"public function detach();",
"public function detach()\n {\n // dummy implementation\n }",
"public function detach()\n {\n // TODO\n }",
"public function detach($entity)\n {\n $visited = [];\n $this->doDetach($entity, $visited);\n }",
"function detach();",
"public function detach(Classes\\DetachRequest $arg) {\n\t\treturn $this->makeSoapCall(\"detach\", $arg);\n\t}",
"private function doDetach($entity, array &$visited, $noCascade = false)\n {\n $oid = spl_object_hash($entity);\n if (isset($visited[$oid])) {\n return; // Prevent infinite recursion\n }\n $visited[$oid] = $entity; // mark visited\n switch ($this->getEntityState($entity, self::STATE_DETACHED)) {\n case self::STATE_MANAGED:\n if ($this->isInIdentityMap($entity)) {\n $this->removeFromIdentityMap($entity);\n }\n unset(\n $this->entityInsertions[$oid],\n $this->entityUpdates[$oid],\n $this->entityDeletions[$oid],\n $this->entityIdentifiers[$oid],\n $this->entityStates[$oid],\n $this->originalEntityData[$oid]\n );\n break;\n case self::STATE_NEW:\n case self::STATE_DETACHED:\n return;\n }\n if (!$noCascade) {\n $this->cascadeDetach($entity, $visited);\n }\n }",
"private function cascadeDetach($document, array &$visited)\n {\n $class = $this->dm->getClassMetadata(get_class($document));\n foreach ($class->fieldMappings as $mapping) {\n if ( ! isset($mapping['embedded']) && ! $mapping['isCascadeDetach']) {\n continue;\n }\n if (isset($mapping['embedded'])) {\n $relatedDocuments = $class->reflFields[$mapping['fieldName']]->getValue($document);\n if (($relatedDocuments instanceof Collection || is_array($relatedDocuments))) {\n if ($relatedDocuments instanceof PersistentCollection) {\n // Unwrap so that foreach() does not initialize\n $relatedDocuments = $relatedDocuments->unwrap();\n }\n foreach ($relatedDocuments as $relatedDocument) {\n $this->cascadeDetach($relatedDocument, $visited);\n }\n } elseif ($relatedDocuments !== null) {\n $this->cascadeDetach($relatedDocuments, $visited);\n }\n } elseif (isset($mapping['reference'])) {\n $relatedDocuments = $class->reflFields[$mapping['fieldName']]->getValue($document);\n if (($relatedDocuments instanceof Collection || is_array($relatedDocuments))) {\n if ($relatedDocuments instanceof PersistentCollection) {\n // Unwrap so that foreach() does not initialize\n $relatedDocuments = $relatedDocuments->unwrap();\n }\n foreach ($relatedDocuments as $relatedDocument) {\n $this->doDetach($relatedDocument, $visited);\n }\n } elseif ($relatedDocuments !== null) {\n $this->doDetach($relatedDocuments, $visited);\n }\n }\n }\n }",
"public function detachAll() {}",
"public function detach()\n {\n $this->fclose();\n }",
"public function detach()\n {\n if ($this->getBack()) {\n $this->getBack()->setNext($this->getNext());\n }\n\n if ($this->getNext()) {\n $this->getNext()->setBack($this->getBack());\n }\n }",
"public function detach(): int;",
"public function detachArticles()\n {\n $this->model->articles()->detach();\n }",
"public function detach($document);",
"public function detach(Collection|Model $model): void\n {\n if ($model instanceof Collection) {\n $model->each(fn (Model $m) => $this->detach($m));\n\n return;\n }\n\n $this->file_attachments()\n ->where([\n 'model_type' => get_class($model),\n 'model_id' => $model->getKey(),\n ])\n ->delete();\n }",
"public function detach(): void\n\t{\n\t\t$this->events->detach($this->type, $this->hook);\n\t}",
"private function doDetach($document, array &$visited)\n {\n $oid = spl_object_hash($document);\n if (isset($visited[$oid])) {\n return; // Prevent infinite recursion\n }\n\n $visited[$oid] = $document; // mark visited\n\n switch ($this->getDocumentState($document, self::STATE_DETACHED)) {\n case self::STATE_MANAGED:\n $this->removeFromIdentityMap($document);\n unset($this->documentInsertions[$oid], $this->documentUpdates[$oid],\n $this->documentDeletions[$oid], $this->documentIdentifiers[$oid],\n $this->documentStates[$oid], $this->originalDocumentData[$oid],\n $this->parentAssociations[$oid]);\n break;\n case self::STATE_NEW:\n case self::STATE_DETACHED:\n return;\n }\n\n $this->cascadeDetach($document, $visited);\n }",
"public function detachDefect($defectAttachmentId);",
"public function detachFiles() {\r\n\t\t$this->_attachedFiles = null;\r\n\t}",
"public function detach($document)\n {\n $visited = array();\n $this->doDetach($document, $visited);\n }",
"public function detach()\r\n {\r\n $this->_parentNode->removeChild($this);\r\n }",
"public function detach()\n\t{\n\t\tif (null !== $this->shmId) {\n\t\t\tshmop_close($this->shmId);\n\t\t\t$this->shmId = null;\n\t\t}\n\t}",
"public function detach(Entity\\Base $entity)\n {\n $this->getEntityManager()->detach($entity);\n }",
"public function testTagDetach()\n {\n $workflow = factory(WorkflowEloquent::class)->create([\n 'user_id' => $this->user->getKey(),\n ]);\n $action1 = factory(ActionEloquent::class)->create([\n 'action_type' => ActionEloquent::ACTION_TYPE_EXECUTE,\n 'target_class' => 'tagger',\n 'target_field' => 'detach',\n 'value' => 'detach_tag',\n ]);\n $workflow->actions()->sync([$action1->getKey() ]); //, $action2->getKey()\n $object = factory(ObjectEloquent::class)->create([\n 'workflow_id' => $workflow->getKey(),\n 'object_class' => 'tags.id',\n 'object_type' => $this->tag->getKey(),\n ]);\n\n \n // rule\n $rule1 = factory(RuleEloquent::class)->create([\n 'name' => 'detach tag person',\n 'workflow_id' => $workflow->getKey(),\n 'rule_type' => RuleEloquent::FIELD_TYPE_NUMBER,\n 'operator' => RuleEloquent::OPERATOR_EQUAL,\n 'field_name' => 'person_contexts.stage_id',\n 'value' => $this->stageId,\n 'runnable_once' => 1, // only once\n ]);\n\n $action1->rules()->sync([ $rule1->getKey()]);\n\n // run action runner\n $kernel = $this->app->make(Kernel::class);\n $status = $kernel->handle(\n $input = new ArrayInput(array(\n 'command' => 'workflow:action-run',\n 'workflow' => $workflow->getKey(),\n 'action' => $action1->getKey(),\n )),\n $output = new BufferedOutput\n );\n //echo $output->fetch();\n $this->assertEquals($status, 0);\n\n // check status\n $this->seeInDatabase('action_logs',[\n 'action_id' => $action1->getKey(),\n 'workflow_id' => $workflow->getKey(),\n 'status' => LogInterface::LOG_STATUS_SUCCESS,\n 'object_class' => $this->person->getLoggableType(), //$leadContext->getLoggableType(),\n 'object_id' => $this->person->getKey(), //$leadContext->getKey(),\n 'user_id' => $this->user->getKey(),\n ]);\n\n // check tag\n $this->notSeeInDatabase('taggables',[\n 'user_id' => $this->user->getKey(),\n 'tag_id' => $this->tag->getKey(),\n 'taggable_id' => $this->person->getKey(),\n 'taggable_type' => 'persons',\n ]);\n \n $this->cleanUpRecords(new PersonObserver, $this->person);\n }",
"private function cascadeRemove($entity, array &$visited)\n {\n $class = $this->manager->getClassMetadata(get_class($entity));\n $associationMappings = array_filter(\n $class->getAssociationMappings(),\n function($assoc) {\n return $assoc['isCascadeRemove'];\n }\n );\n $entitiesToCascade = [];\n foreach ($associationMappings as $assoc) {\n if ($entity instanceof Proxy && !$entity->__isInitialized__) {\n $entity->__load();\n }\n $relatedEntities = $class->getReflectionProperty($assoc['fieldName'])->getValue($entity);\n switch (true) {\n case ($relatedEntities instanceof Collection):\n case (is_array($relatedEntities)):\n // If its a PersistentCollection initialization is intended! No unwrap!\n foreach ($relatedEntities as $relatedEntity) {\n $entitiesToCascade[] = $relatedEntity;\n }\n break;\n case ($relatedEntities !== null):\n $entitiesToCascade[] = $relatedEntities;\n break;\n default:\n // Do nothing\n }\n }\n foreach ($entitiesToCascade as $relatedEntity) {\n $this->doRemove($relatedEntity, $visited);\n }\n }",
"public function detach()\n {\n return null;\n }",
"public function detach($ids = [], $touch = true)\n {\n list($idsOnly) = $this->getIdsWithAttributes($ids);\n\n $this->parent->fireModelEvent('pivotDetaching', true, $this, $idsOnly);\n if (Schema::hasColumn($this->getTable(), 'deleted_at')) {\n if (is_array($ids)) {\n foreach($ids as $id) {\n $this->updateExistingPivot($id, $this->attributes, false);\n }\n } else {\n $this->updateExistingPivot($ids, $this->attributes, false);\n }\n } else {\n MorphToMany::detach($ids, $touch);\n }\n $this->parent->fireModelEvent('pivotDetached', false, $this, $idsOnly);\n }",
"public function __destruct()\r\n {\r\n \t// iterate over the entities and persist them in cache\r\n \tforeach ($this->_entities as $entity) {\r\n \t\t$cacheKey = $this->getCacheKey($entity->getPrimaryKey());\r\n \t\t$this->getCache()->save($entity->disconnect(), $cacheKey, array(self::CACHE_TAG));\r\n \t}\r\n }"
] |
[
"0.64814556",
"0.64814556",
"0.6362998",
"0.6245605",
"0.61283934",
"0.6068809",
"0.6064371",
"0.5967138",
"0.59405965",
"0.5847652",
"0.5805864",
"0.5777674",
"0.576583",
"0.5698203",
"0.56083053",
"0.55781007",
"0.5526837",
"0.5519002",
"0.54118913",
"0.536327",
"0.5361435",
"0.53241664",
"0.53044134",
"0.5293667",
"0.52693766",
"0.524131",
"0.52316016",
"0.52087635",
"0.516541",
"0.5160559"
] |
0.65800816
|
0
|
Executes any extra updates that have been scheduled.
|
private function executeExtraUpdates()
{
foreach ($this->extraUpdates as $oid => $update) {
list ($entity, $changeset) = $update;
$this->entityChangeSets[$oid] = $changeset;
$this->getEntityPersister(get_class($entity))->update($entity);
}
$this->extraUpdates = [];
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"protected function performUpdate() {}",
"public function runDefaultUpdates()\n {\n }",
"private function _updateCronStats()\n\t{\n\t $this->load->model('tasks');\n\t $this->tasks->updateCronStats();\n\t}",
"public function cron_action()\n\t{\n\n\t\t// process any recently updated inventory\n\t\t$this->inventory_batch();\n\t\t\n\t\t// process any recently shipped orders\n\t\t$this->shipping_batch();\n\n\t\t// process any recently processing orders\n\t\t$this->processing_batch();\n\n\t\t// process any product updates\n\t\t$this->product_batch(); \n\n\t\t// clean up any old records from the queues\n\t\t$this->cleanup();\n\t\texit('done');\n\n\t}",
"public function background_update() {\n\t\tadd_action( 'wp_update_plugins', [ $this, 'get_meta_plugins' ] );\n\t\tadd_action( 'wp_update_themes', [ $this, 'get_meta_themes' ] );\n\t\tadd_action( 'gu_get_remote_plugin', [ $this, 'run_cron_batch' ], 10, 1 );\n\t\tadd_action( 'gu_get_remote_theme', [ $this, 'run_cron_batch' ], 10, 1 );\n\t}",
"public static function munim_schedule_status_update() {\n\t\tif ( ! wp_next_scheduled( 'munim_update_estimate_status' ) ) {\n\t\t\twp_schedule_event( time(), 'daily', 'munim_update_estimate_status' );\n\t\t}\n\t}",
"public function execute() {\n global $CFG;\n\n require_once($CFG->dirroot . '/course/lib.php');\n\n // Specific list of plugins that need to be refreshed. If not set, then all mod plugins will be refreshed.\n $pluginstorefresh = null;\n if (isset($this->get_custom_data()->plugins)) {\n $pluginstorefresh = $this->get_custom_data()->plugins;\n }\n\n // Is course id set?\n if (isset($this->get_custom_data()->courseid)) {\n $courseid = $this->get_custom_data()->courseid;\n } else {\n $courseid = 0;\n }\n\n $pluginmanager = core_plugin_manager::instance();\n $modplugins = $pluginmanager->get_plugins_of_type('mod');\n foreach ($modplugins as $plugin) {\n // Check if a specific list of plugins is defined and check if it contains the plugin that is currently being evaluated.\n if (!empty($pluginstorefresh) && !in_array($plugin->name, $pluginstorefresh)) {\n // This plugin is not in the list, move on to the next one.\n continue;\n }\n // Refresh events.\n mtrace('Refreshing events for ' . $plugin->name);\n course_module_bulk_update_calendar_events($plugin->name, $courseid);\n }\n }",
"function updates()\n\t{\n\t\t$this->ipsclass->input['step']++;\n\t\t$uninstall = ( $this->ipsclass->input['un'] == 1 ) ? \"&un=1\" : \"\";\n\t\t\n\t\t$object = ( $this->tasks['updates'] == 1 ) ? 'Database Update' : 'Database Updates';\n\t\t$operation = ( $this->ipsclass->input['un'] ) ? 'reverted' : 'executed';\n\t\t\n\t\tforeach ( $this->xml_array['updates_group']['update'] as $k => $v )\n\t\t{\n\t\t\tif ( !$this->ipsclass->input['un'] )\n\t\t\t{\n\t\t\t\t$this->ipsclass->DB->do_update( \"{$v['table']['VALUE']}\", array( \"{$v['key']['VALUE']}\" => \"{$v['new_value']['VALUE']}\" ), \"{$v['where']['VALUE']}\" );\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif ( $v['old_value'] )\n\t\t\t\t{\n\t\t\t\t\t$this->ipsclass->DB->do_update( \"{$v['table']['VALUE']}\", array( \"{$v['key']['VALUE']}\" => \"{$v['old_value']['VALUE']}\" ), \"{$v['where']['VALUE']}\" );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t$this->ipsclass->admin->redirect( \"{$this->ipsclass->form_code}&code=work&mod={$this->ipsclass->input['mod']}&step={$this->ipsclass->input['step']}{$uninstall}&st={$this->ipsclass->input['st']}\", \"{$this->xml_array['mod_info']['title']['VALUE']}<br />{$this->tasks['updates']} {$object} {$operation}....\" );\n\t}",
"protected function schedule(Schedule $schedule)\n {\n //https://laravel.com/docs/5.4/scheduling\n \\Log::info(\"SCHEDULING for day \".DatesHelper::getCurrentDay().' DATE : '.DatesHelper::getCurrentDate());\n //->timezone('America/New_York');\n // $schedule->command('update:info')\n // ->everyMinute();\n\n\n $schedule->call(function() {\\Log::info('Update exchange ...');CoinbaseHelper::updateExchangeRate();})->everyTenMinutes();\n $schedule->call(function() {\\Log::info('Check invoices ...');UpdateInfo::checkInvoices();})->everyMinute();\n $schedule->call(function() {\\Log::info('Check digital check ...');UpdateInfo::checkCheckbook();})->everyMinute();\n\n\n $schedule->command('update:ranking')->dailyAt('10:00')->timezone('America/New_York')->when(function(){\n \\Log::info('Checking conditions for update::ranking weekly');\n if (DatesHelper::getCurrentDay() === 'Tuesday') {\n \\Log::info('Condition is true for update:ranking weekly');\n return true;\n }\n \\Log::info('Condition is false for update:ranking weekly');\n return false;\n });\n\n $schedule->command('update:info')->hourlyAt(11)->timezone('America/New_York')->when(function(){\n \\Log::info('Checking conditions for update::info hourly');\n if (DatesHelper::getCurrentDay() === 'Tuesday' || DatesHelper::getCurrentDay() === 'Wednesday' ||\n DatesHelper::getCurrentDay() === 'Friday' ) {\n \\Log::info('Condition is true for update:info hourly');\n return true;\n }\n \\Log::info('Condition is false for update:info hourly');\n return false;\n });\n\n $schedule->command('update:info')->everyFiveMinutes()->timezone('America/New_York')->when(function(){\n \\Log::info('Checking conditions for update::info everyFiveMinutes');\n if (DatesHelper::getCurrentDay() === 'Tuesday' || DatesHelper::getCurrentDay() === 'Wednesday' ||\n DatesHelper::getCurrentDay() === 'Friday' ) {\n return false;\n Log::info('Condition is false for update:info everyFiveMinutes');\n }\n \\Log::info('Condition is true for update:info everyFiveMinutes');\n return true;\n });\n\n $schedule->command('timeframe:update')->hourly()->timezone('America/New_York')->when(function(){\n \\Log::info(\"Checking condition for timeframe:update hourly ...\");\n if (DatesHelper::getCurrentDay() === 'Thursday' || DatesHelper::getCurrentDay() === 'Friday' ||\n DatesHelper::getCurrentDay() === 'Saturday' || DatesHelper::getCurrentDay() === 'Sunday'){\n \\Log::info(\"Condition for timeframe:update hourly for day condition is false\");\n return false;\n }\n\n $current = TimeFrame::getCurrentTimeFrame();\n\n if (!$current){\n \\Log::info('Condition for timeframe:update hourly for non-existing current timeframe is true');\n return true;\n }\n\n \\Log::info('Retrieving games which are not in HISTORY state for timeframe:update hourly');\n //\n $games = Game::where('status', '!=', 'HISTORY')->get();\n $fps = FantasyPlayer::where('updated', '=', false)->get();\n\n \\Log::info('Retrieved games which are not in HISTORY state for timeframe:update hourly');\n if ($games->count() === 0 && $fps->count() === 0){\n \\Log::info('Condition for timeframe:update hourly for !HISTORY games is true');\n return true;\n }\n\n \\Log::info('Condition for timeframe:update hourly false');\n return false;\n });\n\n $schedule->command('games:update')->withoutOverlapping()->twiceDaily(6, 18)->timezone('America/New_York')->when(function() {\n \\Log::info('Condition for games:update twiceDaily is met');\n return true;\n });\n\n $schedule->command('games:update')->withoutOverlapping()->everyFiveMinutes()->timezone('America/New_York')->when(function(){\n \\Log::info('Checking conditions for games:update everyFiveMinutes');\n //if (DatesHelper::getCurrentDay() === 'Tuesday' || DatesHelper::getCurrentDay() === 'Monday' ||\n if( DatesHelper::getCurrentDay() === 'Wednesday') {\n \\Log::info('Condition for games:update everyFiveMinuets for day condition is false '.DatesHelper::getCurrentDay());\n return false;\n }\n\n \\Log::info('Retrieving games in progress for games:update command everyFiveMinutes');\n $gamesInProgress = Game::where('status', '=', 'LIVE')->get();\n \\Log::info('Retrieved games in progress for games:update command everyFiveMinutes'.$gamesInProgress);\n if ($gamesInProgress->count() > 0){\n \\Log::info('Condition for games:update everyFiveMinutes for games in progress is true ');\n return true;\n }\n \\Log::info('Condition for games:update everyFiveMinutes is false');\n });\n\n $schedule->command('playerInfo:update')->withoutOverlapping()->twiceDaily(6, 18)->timezone('America/New_York')->when(function(){\n \\Log::info('Checking conditions for playerInfo:update twiceDaily');\n if (DatesHelper::getCurrentDay() === 'Tuesday' || DatesHelper::getCurrentDay() === 'Monday' ||\n DatesHelper::getCurrentDay() === 'Wednesday' || DatesHelper::getCurrentDay() === 'Friday' ) {\n \\Log::info('Condition for playerInfo:update twiceDaily for day is true '.DatesHelper::getCurrentDay());\n return true;\n }\n\n \\Log::info('Condition for playerInfo:update twiceDaily is false');\n return false;\n });\n\n $schedule->command('playerInfo:update')->withoutOverlapping()->hourly()->timezone('America/New_York')->when(function(){\n \\Log::info('Checking condition for playerInfo:update hourly ');\n if (DatesHelper::getCurrentDay() === 'Thursday' || DatesHelper::getCurrentDay() === 'Sunday' ||\n DatesHelper::getCurrentDay() === 'Saturday') {\n \\Log::info('Condition for playerInfo:update hourly for day condition is true');\n return true;\n }\n\n \\Log::info('Condition for playerInfo:update hourly is false');\n return false;\n });\n\n $schedule->command('playerStats:update')->twiceDaily(16, 22)->timezone('America/New_York');\n\n $schedule->command('playerStats:update')->hourly()->timezone('America/New_York')->when(function(){\n \\Log::info('Checking condition for playerStats:update hourly');\n\n if (DatesHelper::getCurrentDay() === 'Tuesday') {\n \\Log::info('Checking condition palyerStats:update hourly for Tuesday');\n $timeframe = TimeFrame::getPreviousTimeFrame();\n if (!$timeframe){\n \\Log::info('Condition for playerStats:update hourly for previous timeframe is false');\n return false;\n }\n\n $key = $timeframe->retrieveKey();\n \\Log::info('Condition playerStats:update hourly checking players with key '.$key);\n $fps = FantasyPlayer::where('id', 'like', '%'.$key.'%')->where('updated', '=', false)->get();\n \\Log::info('Condition playerStats:update hourly successfully retrieved players with key '.$key);\n if ($fps && $fps->count() > 0){\n \\Log::info('Condition playerStats:update hourly there are players which are not updated, so condition is true');\n return true;\n }\n\n \\Log::info('Condition playerStats:update hourly condition is false');\n return false;\n }\n });\n\n /*$schedule->command('fantasyData:pull')->everyMinute()->timezone('America/New_York')->when(function(){\n \\Log::info('Checking condition for fantasyData:pull everyThirtyMinutes');\n if (DatesHelper::getCurrentDay() !== 'Tuesday') {\n \\Log::info('Condition for fantasyData:pull everyThirtyMinutes day condition is Tuesday');\n $timeframe = TimeFrame::getCurrentTimeFrame();\n if ($timeframe->count() === 0){\n \\Log::info('Condition for fantasyData:pull hourly for current timeframe is false');\n return false;\n }\n\n \\Log::info('Condition fantasyData:pull everyFiveMinutes retrieving games in progress');\n $gamesInProgress = Game::where('status', '=', 'LIVE')->get();\n \\Log::info('Condition fantasyData:pull everyFiveMinutes received games in progress');\n if ($gamesInProgress->count() > 0){\n \\Log::info('Condition fantasyData:pull everyFiveMinutes there are games in progress');\n return true;\n }\n\n return false;\n }\n });*/\n\n $schedule->command('liveStats:update')->everyThirtyMinutes()->timezone('America/New_York')->when(function(){\n \\Log::info('Checking condition for liveStats:update everyThirtyMinutes');\n if (DatesHelper::getCurrentDay() !== 'Tuesday' && DatesHelper::getCurrentDay() !== 'Wednesday' &&\n DatesHelper::getCurrentDay() !== 'Friday') {\n \\Log::info('Condition for liveStats:update everyThirtyMinutes day condition is Tuesday');\n $timeframe = TimeFrame::getCurrentTimeFrame();\n if (!$timeframe){\n \\Log::info('Condition for liveStats:update hourly for current timeframe is false');\n return false;\n }\n\n \\Log::info('Condition liveStats:update everyFiveMinutes retrieving games in progress');\n $gamesInProgress = Game::where('status', '=', 'LIVE')->get();\n \\Log::info('Condition liveStats:update everyFiveMinutes received games in progress');\n if ($gamesInProgress && $gamesInProgress->count() > 0){\n \\Log::info('Condition liveStats:update everyFiveMinutes there are games in progress');\n return true;\n }\n\n return false;\n }\n });\n\n\n\n // $schedule->command('playerStats:update')->timezone('America/New_York')->hourly()->when(function(){\n\n //$schedule->command('update:info')->everyMinute();\n\n\n\n//->withoutOverlapping();\n\n\n\n }",
"public function doUpdate() {\n\t\ttry {\n\t\t\tcall_user_func_array( $this->doUpdateFunction, $this->arguments );\n\t\t} catch ( Exception $ex ) {\n\t\t\t$this->exceptionHandler->handleException( $ex, 'data-update-failed',\n\t\t\t\t'A data update callback triggered an exception' );\n\t\t}\n\t}",
"public static function updateAll()\r\n\t{\r\n\t}",
"public function fetchUpdates()\n\t{\n\t}",
"function wp_schedule_update_checks()\n {\n }",
"function postUpdate()\n\t{\n\t\t$this->write();\n\n\t\tif ($this->subaction === 'schedule_conf') {\n\t\t\texec(\"sh /script/fix-cron-backup\");\n\n\t\t}\n\t}",
"protected function listUpdates() {}",
"abstract protected function getAllUpdates();",
"function after_update() {}",
"function complete_update() {\n // Extract the relevant day of the week for which to update link times\n // N.B. php function: 6=Saturday, 7=Sunday, 1=Monday\n // \t postgres function: 6=Saturday, 0=Sunday, 1=Monday\n $dow = date('N',strtotime('yesterday', $this->backup_time)) % 7;\n\n echo \"Deleting stale information\".\"\\n\";\n $this->delete_stale_information($dow);\n echo \"Stale information deleted. Starting to process new average times\".\"\\n\";\n\n for($hod = 0; $hod < 24; $hod++) { // for each hour of the day\n $journey_times = $this->extract_journey_times($dow, $hod);\n $this->insert_into_database($journey_times, $dow, $hod);\n echo \"Update complete for hour \".$hod.\"\\n\";\n }\n }",
"abstract public function mass_update();",
"protected function processUpdates()\n {\n $this->importStaticData();\n }",
"public function _update()\n\t {\n\t \t$this->notifyObservers(__FUNCTION__);\n\t }",
"public function cronprocess(){\n \t\n\t $query = $this->distributiondata->getbyattribute('status',0);\n\t\t\tif ($query->num_rows() > 0){\n\t\t\t\tforeach ($query->result() as $row){\n\t\t\t\t\t if ($this->process($row->list_id)===true){\n\t\t\t\t\t \t $darray = array('status'=>1);\n\t\t\t\t\t \t $this->distributiondata->update($row->list_id,$darray);\n\t\t\t\t\t \t echo \"Processed: \".$row->title.\" files<br>\";\n\t\t\t\t\t }\n\t\t\t\t\t \n\t\t\t\t }\n\t\t\t}else {\n\t\t\t\techo \"No pending distribution list\";\n\t\t\t}\n\t\t\n\t\t\n\t}",
"public function after_update() {}",
"public function updateAll() {\n $this->Corporations->update();\n $this->MemberTracking->update();\n $this->Facilities->update();\n $this->Industry->update();\n $this->Markets->update();\n $this->Contracts->update();\n $this->Wallet->update();\n $this->Assets->update();\n $this->Killmails->update();\n }",
"public static function scheduleUpdate()\n {\n $next_refresh = wp_next_scheduled('amwscpf_update_feeds_hook');\n if (!$next_refresh)\n wp_schedule_event(time(), 'refresh_interval', 'amwscpf_update_feeds_hook');\n }",
"function cron()\n\t{\n\t\tglobal $wpdb,\n\t\t\t\t\t $wgobd_importer_helper,\n\t\t\t\t\t $wgobd_events_helper,\n\t\t\t\t\t $wgobd_settings_controller;\n\n\t\t// ====================\n\t\t// = Select all feeds =\n\t\t// ====================\n\t\t$table_name = $wpdb->prefix . 'wgobd_event_feeds';\n\t\t$sql = \"SELECT * FROM {$table_name}\";\n\t\t$feeds = $wpdb->get_results( $sql );\n\n\t\t// ===============================\n\t\t// = go over each iCalendar feed =\n\t\t// ===============================\n\t\tforeach( $feeds as $feed ) {\n\t\t // flush the feed\n\t\t $wgobd_settings_controller->flush_ics_feed( false, $feed->feed_url );\n\t\t // import the feed\n\t\t\t$wgobd_importer_helper->parse_ics_feed( $feed );\n\t\t}\n\t}",
"abstract protected function getScheduledObjectUpdates($uow);",
"public function schedule(){\n $this->executeAllTransferts();\n }",
"function do_undismiss_core_update()\n {\n }",
"public function execute()\n\t{\n\t\t$this->executeCall();\n\t\t$this->executeReminder();\n\t}"
] |
[
"0.69985986",
"0.67624193",
"0.67423105",
"0.64693314",
"0.6465017",
"0.6463421",
"0.6435094",
"0.642019",
"0.6291091",
"0.628212",
"0.6276596",
"0.6226876",
"0.6201103",
"0.6176452",
"0.61495537",
"0.6146459",
"0.613451",
"0.61288965",
"0.6125122",
"0.612488",
"0.6080202",
"0.60465807",
"0.6035849",
"0.6032383",
"0.603097",
"0.6030737",
"0.6020527",
"0.6019514",
"0.6005598",
"0.598966"
] |
0.7026912
|
0
|
Tests if an entity is loaded must either be a loaded proxy or not a proxy
|
private function isLoaded($entity)
{
return !($entity instanceof Proxy) || $entity->__isInitialized();
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function testIsLoaded()\n {\n $this->fixtures('users', 'articles');\n $user = User::find($this->users('derek')->id);\n\n $this->assertFalse($user->reflectOnAssociation('Articles')->isLoaded());\n $user->articles;\n $this->assertTrue($user->reflectOnAssociation('Articles')->isLoaded());\n }",
"public function isLoaded() {\n return is_object($this->result);\n }",
"public function isLazyLoad()\n {\n return $this->isLazyLoad;\n }",
"public function isLazyLoadableObject()\n {\n return $this->lazyLoadable;\n }",
"public function isEagerLoaded(): bool;",
"public static function isProxied()\n {\n return Migration::isLoadingMigrations();\n }",
"public function hasIsProxified()\n {\n return $this->IsProxified !== null;\n }",
"public function checkIfCanLoad()\r\n\t{\r\n\t\treturn true;\r\n\t}",
"public function has_lazy_load() {\n\t\treturn $this->get_meta_value( static::LAZY_LOAD_META_KEY ) === '1';\n\t}",
"public function isLazy(): bool\n {\n }",
"public function isLazy(): bool;",
"public function isUsingProxy()\n {\n return ((int)$this->use_proxy === 1);\n }",
"private function _isLoaded() {\n return (bool) $this->id;\n }",
"public function can_fetch() {\n\t\treturn ($this->connection !== null) && ($this->connection !== false) && ($this->request !== false) && ($this->storage !== false);\n\t}",
"public function isLoaded();",
"public function isLazyLoadEnabled()\n {\n $skin = \\XLite\\Core\\Database::getRepo('XLite\\Model\\Module')->getCurrentSkinModule();\n\n return $skin ? $skin->callModuleMethod('isUseLazyLoad') : false;\n }",
"public function isLoaded(): bool\n {\n return $this->options['load'] || in_array($this->getMethod(), [self::INLOAD, self::POSTLOAD], true);\n }",
"public function isEntity() : bool\n {\n return is_array($this->fields) && !empty($this->fields);\n }",
"protected function isLoaded(){\n\t\treturn $this->lodaed;\n\t}",
"protected function testLazyLoad()\n {\n $em = $this->getEntityManager();\n $repo = $em->getRepository('Entity\\Page');\n $pages = $repo->findAll();\n echo 'Page Count ' . count($pages) . \"\\n\";\n foreach($pages as $page)\n {\n echo get_class($page) . \"\\n\";\n $pageBaskets = $page->getPageBaskets();\n foreach($pageBaskets as $pageBasket)\n {\n echo get_class($pageBasket) . \"\\n\";\n }\n }\n \n }",
"public function is_loaded()\n {\n return !!$this->_cursor;\n }",
"public function hasEntityClass(): bool\n {\n return $this->hasDataItem('entity');\n }",
"public function hasProxyTitle()\n {\n return $this->ProxyTitle !== null;\n }",
"public function isHydrated() {\n\t\treturn !empty($this->originalData);\t\t\n\t}",
"public function testSetLoaded()\n {\n $this->useMockLogger();\n $this->fixtures('users', 'articles');\n\n $user = User::find($this->users('derek')->id);\n $user->setAssociationLoaded('Articles');\n $this->clearLog();\n\n // make sure it doesn't query qgain\n $user->articles;\n $this->assertNotLogged('Article Load');\n }",
"private function isLoaded()\r\n {\r\n return $this->loaded;\r\n }",
"public static function isLoaded();",
"public function hasEntity($name);",
"public function isAgentsLoaded()\n {\n return null !== $this->collAgents;\n }",
"private static function _is_loadable()\n\t{\n\t\t$allowed_in_admin = apply_filters('bwp_minify_allowed_in_admin', false);\n\n\t\tif (is_admin() && !$allowed_in_admin)\n\t\t\treturn false;\n\n\t\tif (!did_action('template_redirect'))\n\t\t\treturn true;\n\n\t\t// ignore Geomashup\n\t\tif (!empty($_GET['geo_mashup_content'])\n\t\t\t&& 'render-map' == $_GET['geo_mashup_content'])\n\t\t\treturn false;\n\n\t\t// ignore AEC (Ajax Edit Comment)\n\t\tif (!empty($_GET['aec_page']))\n\t\t\treturn false;\n\n\t\t// ignore Simple:Press forum plugin\n\t\tif (defined('SPVERSION') && function_exists('sp_get_option'))\n\t\t{\n\t\t\t$sp_page = sp_get_option('sfpage');\n\t\t\tif (is_page($sp_page))\n\t\t\t\treturn false;\n\t\t}\n\n\t\t// @since 1.3.1 ignore Maintenance plugin\n\t\tif (bwp_is_maintenance_on())\n\t\t{\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}"
] |
[
"0.64571166",
"0.6063503",
"0.6030817",
"0.60101473",
"0.59696347",
"0.5918695",
"0.591067",
"0.5909854",
"0.5898748",
"0.5893923",
"0.5883377",
"0.57855",
"0.56316155",
"0.55966824",
"0.55866694",
"0.5580257",
"0.5565966",
"0.55561364",
"0.55313534",
"0.5478892",
"0.54506344",
"0.54281753",
"0.54225874",
"0.5400433",
"0.53954715",
"0.5348805",
"0.5329105",
"0.5309342",
"0.5282542",
"0.5276513"
] |
0.7593043
|
0
|
$join = sprintf('LEFT JOIN `%1$sproin` ON `%1$spro`.`id` = `%1$sproin`.`jpid`
|
public function _complex_join()
{
// LEFT JOIN `%1$sauth_group` on `%1$spro`.`depid` = `%1$sauth_group`.`id`
// LEFT JOIN (SELECT a.* FROM `%1$sproout` as a INNER JOIN (SELECT max(`id`) as id FROM `%1$sproout` group by `jpid`) as b on a.id = b.id) as `%1$sproout` on `%1$spro`.`id` = `%1$sproout`.`jpid`
// LEFT JOIN `%1$scust` on `%1$spro`.`cid` = `%1$scust`.`id`', C('DB_PREFIX'));
$join = sprintf('LEFT JOIN `%1$sproin` ON `%1$spro`.`id` = `%1$sproin`.`jpid`
LEFT JOIN `%1$sauth_group` on `%1$spro`.`depid` = `%1$sauth_group`.`id`
LEFT JOIN `%1$sproout` on `%1$sproout`.`jpid` = `%1$spro`.`id`
LEFT JOIN `%1$sproout` tmp_out on tmp_out.`jpid` = `%1$sproout`.`jpid` and tmp_out.`id` > `%1$sproout`.`id`
LEFT JOIN `%1$scust` on `%1$spro`.`cid` = `%1$scust`.`id`', C('DB_PREFIX'));
return $join;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function cf_search_join( $join ) {\n\t global $wpdb;\n\n\t if ( is_search() ) { \n\t $join .=' LEFT JOIN '.$wpdb->postmeta. ' ON '. $wpdb->posts . '.ID = ' . $wpdb->postmeta . '.post_id ';\n\t }\n\t \n\t return $join;\n\t}",
"function buildJoin()\n\t{\n\t\tif ($this->table_obj_reference)\n\t\t{\n\t\t\t// Use inner join instead of left join to improve performance\n\t\t\treturn \"JOIN \".$this->table_obj_reference.\" ON \".$this->table_tree.\".child=\".$this->table_obj_reference.\".\".$this->ref_pk.\" \".\n\t\t\t\t \"JOIN \".$this->table_obj_data.\" ON \".$this->table_obj_reference.\".\".$this->obj_pk.\"=\".$this->table_obj_data.\".\".$this->obj_pk.\" \";\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// Use inner join instead of left join to improve performance\n\t\t\treturn \"JOIN \".$this->table_obj_data.\" ON \".$this->table_tree.\".child=\".$this->table_obj_data.\".\".$this->obj_pk.\" \";\n\t\t}\n\t}",
"function map_joins($join){\n //\n //return field to str\n return $join->to_str();\n }",
"function cf_search_join( $join ) {\n\t\tglobal $wpdb;\n\n\t\tif ( is_search() ) {\n\t\t\t$join .= ' LEFT JOIN ' . $wpdb->postmeta . ' ON ' . $wpdb->posts . '.ID = ' . $wpdb->postmeta . '.post_id ';\n\t\t}\n\n\t\treturn $join;\n\t}",
"protected function buildJoinClause() {\r\n\t\t$sql='';\r\n\t\tif (count($this->_salt_joins)>0) {\r\n\t\t\tforeach($this->_salt_joins as $alias => $join) {\r\n\t\t\t\t$sql.=' '.$join['type'].' JOIN '.$join['table'].' ON '.implode(' ', $join['on']);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn $sql;\r\n\t}",
"function cf_search_join( $join ) {\n global $wpdb;\n\n if ( is_search() ) { \n $join .=' LEFT JOIN '.$wpdb->postmeta. ' ON '. $wpdb->posts . '.ID = ' . $wpdb->postmeta . '.post_id ';\n }\n\n return $join;\n}",
"function cf_search_join( $join ) {\n global $wpdb;\n if ( is_search() ) {\n $join .=' LEFT JOIN '.$wpdb->postmeta. ' ON '. $wpdb->posts . '.ID = ' . $wpdb->postmeta . '.post_id ';\n }\n return $join;\n}",
"function joins($join = '')\n{\n if ($join != '') {\n $a = ' '.$join.' ';\n }\n\n\t\n return $a;\n}",
"function cf_search_join($join) {\n global $wpdb;\n\n if (is_search()) {\n $join .=' LEFT JOIN ' . $wpdb->postmeta . ' ON ' . $wpdb->posts . '.ID = ' . $wpdb->postmeta . '.post_id ';\n }\n\n return $join;\n}",
"function dt_core_join_left_filter( $parts ) {\n\tif( isset($parts['join']) && !empty($parts['join']) ) {\n\t\t$parts['join'] = str_replace( 'INNER', 'LEFT', $parts['join']);\n\t}\n\treturn $parts;\n}",
"public function makeSearchJoin($join)\n {\n global $wpdb;\n\n if (is_search()) {\n\n $join .= ' LEFT JOIN ' . $wpdb->postmeta . ' ON ' . $wpdb->posts . '.ID = ' . $wpdb->postmeta . '.post_id ';\n\n foreach ($this->getAvailableMetaKeysForFilters() as $values) {\n if (isset($_GET[$values]) && !empty($_GET[$values])) {\n $join .= \" LEFT JOIN $wpdb->postmeta as $values ON $wpdb->posts.ID = $values.post_id\";\n\n }\n }\n\n }\n\n return $join;\n }",
"private static function sqlJoining() : string {\n $relations = self::getsRelationsHasOne();\n\n $baseTable = static::tableName();\n $baseProperties = self::getProperties();\n foreach ($baseProperties as &$property) {\n $property = $baseTable . '.' . $property;\n }\n $colsFromBaseTabel = implode(', ', $baseProperties);\n $colsFromJoinedTables = '';\n foreach ($relations as $relation) {\n $modelNamespace = '\\\\' . $relation['model'];\n $modelTableName = $modelNamespace::tableName();\n $modelProperties = $modelNamespace::getProperties();\n foreach ($modelProperties as $key => &$value) {\n $value = $modelTableName . '.' . $value . ' AS ' . $modelTableName . '_' . $value;\n }\n $colsFromJoinedTables .= ', ' . implode(', ', $modelProperties);\n\n }\n $sql = 'SELECT ' . $colsFromBaseTabel . ' ' . $colsFromJoinedTables . ' FROM ' . $baseTable;\n\n foreach ($relations as $relation) {\n $modelNamespace = '\\\\' . $relation['model'];\n $modelTableName = $modelNamespace::tableName();\n $sql .= ' INNER JOIN ' . $modelTableName . ' ON ' . $baseTable . '.' . $relation['column'] . ' = ' . $modelTableName . '.' . $relation['joined-table-column'];\n }\n\n return $sql . ' WHERE ' . $baseTable . '.';\n }",
"private function sql_join($filter, $structure) {\n\t\t$sql = \"\";\n\t\t$table = $structure['table'];\n\t\t$class = $structure['class'];\n\t\t$pool_class = $class . 'Pool_Model';\n\t\t$full_structure = $pool_class::get_full_structure();\n\t\tforeach ($structure['relations'] as $relation) {\n\t\t\tlist($foreign_key, $foreign_table, $key) = $relation;\n\t\t\t$foreign_structure = $full_structure[$foreign_table];\n\t\t\t$ftable = $foreign_structure['table'];\n\t\t\t$join_expr = ' LEFT JOIN '.$ftable.' AS '.$key;\n\t\t\t$join_expr .= ' ON '.implode(' AND ',array_map(function($fk,$lk) use($key,$table) {\n\t\t\t\treturn \"$key.$fk = $table.$lk\";\n\t\t\t}, $foreign_structure['key'], $foreign_key));\n\t\t\t$sql .= $join_expr;\n\t\t}\n\t\treturn $sql;\n\t}",
"function joinClause( $join ) {\n\t global $wpdb;\n\t $join .= \" INNER JOIN $wpdb->postmeta dm ON (dm.post_id = $wpdb->posts.ID AND dm.meta_key = '$this->orderby') \";\n\t return $join;\n\t}",
"function to_str(){\n //\n //Get the name of the entity \n $ename= $this->entity->name;\n //\n //The type of the join eg inner join, outer join\n $join_str=\"$this->type\"\n //\n //The on clause\n . \"\\t `$ename` \\tON \\t{$this->get_ons()}\";\n return $join_str;\n }",
"public function get_additional_joins()\n {\n return 'LEFT JOIN isys_catg_its_type_list AS cat_rel\n\t\t\tON cat_rel.isys_catg_its_type_list__isys_obj__id = obj_main.isys_obj__id';\n }",
"function custom_search_join($join) {\r\n if ( is_search() && isset($_GET['s'])) {\r\n global $wpdb;\r\n $join = \" LEFT JOIN $wpdb->postmeta ON $wpdb->posts.ID = $wpdb->postmeta.post_id \";\r\n }\r\n return($join);\r\n}",
"protected function _getFetchJoins() {\n\t\treturn 'LEFT JOIN series se ON se.series_id = s.series_id\n\t\t\tLEFT JOIN series_settings stpl ON (se.series_id = stpl.series_id AND stpl.setting_name = ? AND stpl.locale = ?)\n\t\t\tLEFT JOIN series_settings stl ON (se.series_id = stl.series_id AND stl.setting_name = ? AND stl.locale = ?)\n\t\t\tLEFT JOIN series_settings sapl ON (se.series_id = sapl.series_id AND sapl.setting_name = ? AND sapl.locale = ?)\n\t\t\tLEFT JOIN series_settings sal ON (se.series_id = sal.series_id AND sal.setting_name = ? AND sal.locale = ?)';\n\t}",
"function carton_exclude_order_comments_from_feed_join( $join ) {\n\tglobal $wpdb;\n\n if ( ! $join )\n \t$join = \" LEFT JOIN $wpdb->posts ON $wpdb->comments.\\\"comment_post_ID\\\" = $wpdb->posts.\\\"ID\\\" \";\n\n return $join;\n}",
"public function build_join( $joins ) {\n $sql = '';\n\n if ( empty( $joins ) ) {\n return $sql;\n }\n\n foreach ( $joins as $index => $join ) {\n if ( ! is_array( $join ) ) {\n continue;\n }\n\n $table = $join['table'] . '_' . $index;\n\n $sql .= ' ' . strtoupper( $join['type'] ) . ' JOIN ' . $join['table'] . ' AS ' . $table;\n $sql .= $this->build_join_on( $join, $table );\n\n $this->query_args['fields'] = wp_parse_args(\n $this->query_args['fields'],\n $this->build_join_fields( $join, $table )\n );\n }\n\n return $sql;\n }",
"function MWX__join ($join)\n{\n global $wpdb;\n\n if (current_user_can ('edit_users'))\n return $join;\n\n return $join .= \" LEFT JOIN $wpdb->postmeta ON $wpdb->posts.ID = $wpdb->postmeta.post_id AND $wpdb->postmeta.meta_key = 'maturity'\";\n}",
"protected function get_join_sql(array $filters=array()) {\n $joinsql = parent::get_join_sql($filters);\n $joinsql[] = 'LEFT JOIN {'.clusterassignment::TABLE.'} clstass\n ON clstass.clusterid='.$this->usersetid.'\n AND clstass.userid = element.id';\n return $joinsql;\n }",
"public function getJoins() {\n\t\t$sql = \"\";\n\t\tif (count($this->join) > 0) {\n\t\t\tforeach ($this->join as $j) {\n\t\t\t\t$sj = $j[2];\n\t\t\t\t$sql .= \" \".$j[0].\" JOIN \".$sj->getFrom().\" ON \".$sj->getTable().\".`\".$j[3].\"`=\".$this->getTable().\".`\".$j[1].\"`\";\n\t\t\t\t$sql .= $sj->getJoins();\n\t\t\t}\n\n\n\t\t}\n\t\treturn $sql;\n\t}",
"private function getJoinStr($joins=array()){\n\t\t$str = array();\n\t\tforeach($joins ?: $this->joins as $j){\n\t\t\tlist($table, $on, $type) = $j;\n\t\t\tswitch($type){\n\t\t\t\tcase self::LEFT_JOIN:\n\t\t\t\t\t$str[] = 'LEFT JOIN';\n\t\t\t\t\tbreak;\n\t\t\t\tcase self::RIGHT_JOIN:\n\t\t\t\t\t$str[] = 'RIGHT JOIN';\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase self::INNER_JOIN:\n\t\t\t\tdefault:\n\t\t\t\t\t$str[] = 'INNER JOIN';\n\t\t\t}\n\n\t\t\t$str[] = self::escapeKey($table);\n\t\t\tif($on){\n\t\t\t\t$str[] = \"ON $on\";\n\t\t\t}\n\t\t}\n\t\treturn join(\"\", $str);\n\t}",
"function joinQuery()\n {\n }",
"private static function joinSql($conj, $left, $right) {\n\n $left = trim($left);\n $right = trim($right);\n\n $leftLen = strlen($left);\n $rightLen = strlen($right);\n\n if (!($leftLen || $rightLen)) {\n return '';\n } else if ($leftLen && !$rightLen) {\n return $left;\n } else if ($rightLen && !$leftLen) {\n return $right;\n }\n\n if (!is_array($conj)) {\n return '(' . $left . ') ' . $conj . ' (' . $right . ')';\n }\n\n $left = \"($left) \";\n\n foreach($conj as $c) {\n $left .= \"$c (\";\n $right .= ')';\n }\n\n return $left . $right;\n }",
"function join_log() {\n\t\treturn $this->db->join('(SELECT * FROM (SELECT APP_PROCESS_LOG.PROCESS_NAME, APP_PROCESS_LOG.PRNO, APP_PROCESS_LOG.PRITEM, APP_PROCESS_LOG.PTM_NUMBER, APP_PROCESS_LOG.PTV_VENDOR_CODE, APP_PROCESS_LOG.STATUS, ROW_NUMBER() OVER (PARTITION BY PRITEM, PRNO, PTM_NUMBER ORDER BY CREATED_DATE DESC) ROWNO FROM APP_PROCESS_LOG WHERE PROCESS_NAME=\\'VERIFIKASI\\') WHERE ROWNO = 1) APP_PROCESS_LOG', 'APP_PROCESS_LOG.PRNO = PRC_SAP_SYNC.PRNO AND \"APP_PROCESS_LOG\".\"PRITEM\" = \"PRC_SAP_SYNC\".\"PRITEM\"', 'left', FALSE);\n\t}",
"private function formatJoins()\n\t{\n\t\t$value = '';\n\t\tforeach ($this->joins as $join)\n\t\t{\n\t\t\t$value .= ' ' . $join['type'];\n\t\t\t$value .= ' ' . $join['table'];\n\t\t\tif ($join['alias'] != '') $value .= ' AS ' . $join['alias'];\n\t\t\tif ($join['use_index'] != '') $value .= ' USE INDEX ' . $join['use_index'];\n\t\t\tif ($join['ignore_index'] != '') $value .= ' IGNORE INDEX ' . $join['ignore_index'];\n\t\t\tif ($join['on_statement'] != '') $value .= ' ON ' . $join['on_statement'];\n\t\t\tif ($join['using_statement'] != '') $value .= ' USING ' . $join['using_statement'];\n\t\t}\n\t\treturn $value;\n\t}",
"public function joinMaker($join) {\n $newJoin = [];\n for ($i = 0; $i < count($join); $i++) {\n $actualJoin = '';\n\n $joinType = $join[$i]['joinType'];\n $joinTable = $join[$i]['joinTable'];\n\n $actualJoin = $joinType.' '.$joinTable.' '.substr($joinTable, 0, 1);\n $actualJoin .= ' On '; \n $actualJoin .= substr($this->table, 0, 1).'.'.$join[$i]['mainTableIdColumn'];\n $actualJoin .= ' = ';\n $actualJoin .= substr($joinTable, 0, 1).'.'.$join[$i]['joinTableIdColumn'];\n \n array_push($newJoin, $actualJoin);\n }\n\n return $newJoin;\n }",
"public function leftJoin() {\r\n\t\t$args = func_get_args();\r\n\t\t$name = array_shift($args);\r\n\t\t$joined = array_shift($args);\r\n\t\tif (!$name) $name = '___' . $joined;\r\n\t\t//if (count(array_keys(self::$_joinStack, $joined)) > 1) {\r\n\t\tif (in_array($joined, self::$_joinStack)) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tself::$_joinStack[] = get_class($this);\r\n\t\tself::$_joinStack[] = $joined;\r\n\t\t$model = null;\r\n\t\tif (is_string($joined)) {\r\n\t\t\tif (is_subclass_of($joined, 'Dbi_Model')) {\r\n\t\t\t\t$model = new $joined();\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (is_subclass_of($joined, 'Dbi_Model')) {\r\n\t\t\t\t$model = $joined;\r\n\t\t\t}\r\n\t\t}\r\n\t\tarray_pop(self::$_joinStack);\r\n\t\tarray_pop(self::$_joinStack);\r\n\t\tif (is_null($model)) {\r\n\t\t\tthrow new Exception('Queries can only join models.');\r\n\t\t}\r\n\t\t$this->_leftJoins[] = array(\r\n\t\t\t'name' => $name,\r\n\t\t\t'model' => $model,\r\n\t\t\t'args' => $args\r\n\t\t);\r\n\t}"
] |
[
"0.63686854",
"0.62781894",
"0.62722456",
"0.62631947",
"0.6263082",
"0.6184429",
"0.6172312",
"0.6146117",
"0.6114368",
"0.6112975",
"0.6015659",
"0.59717846",
"0.596488",
"0.5917945",
"0.59033847",
"0.5886063",
"0.5858558",
"0.58541864",
"0.58515996",
"0.5779577",
"0.5753033",
"0.573254",
"0.5714987",
"0.57099164",
"0.56933993",
"0.56833315",
"0.56808937",
"0.5668051",
"0.5665145",
"0.56568897"
] |
0.6943945
|
0
|
Compiles a name for use in a query. Works with names for tables, columns, and keys.
|
public static function compileName($columnName) {
$columnName = trim($columnName, '`');
return '`' . $columnName . '`';
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function compileValue(SQLValue $expr)\r\n\t{\r\n\t\tif (!$this->isParametrized) {\r\n\t\t\treturn ($expr->generate($this->generator));\r\n\t\t}\r\n\t\t$name = $this->createParamName();\r\n\r\n\t\t$this->params[] = new DBParam($name,\r\n\t\t\tSQLValue::getDbParamType($expr->value, $expr->type),\r\n\t\t\tSQLValue::getDbParamValue($expr->value, $expr->type, $this->generator));\r\n\t\treturn $name;\r\n\t}",
"function getCreateSql($name, $compiler) {\n return $compiler->visit($this);\n }",
"private static function buildNameParametersSQL() {\n $namedParams = '';\n foreach (static::$tableSchema as $columnName => $type) {\n $namedParams .= $columnName . ' = :' . $columnName . ', ';\n }\n return trim($namedParams, ', ');\n }",
"public function quoteSimpleTableName($name)\n\t{\n\t\treturn '`'.$name.'`';\n\t}",
"abstract protected function generateName();",
"public function forName();",
"protected function buildClass($name)\n {\n $array = explode('\\\\', $name);\n $tableArr = preg_split(\"/(?=[A-Z])/\", $array[count($array) - 1]);\n array_shift($tableArr);\n if (strpos($tableArr[count($tableArr) - 1], 'Model') !== false) {\n array_pop($tableArr);\n }\n $tableNameArr = array_map('strtolower', $tableArr);\n $replace['TableName'] = implode('_', $tableNameArr);\n\n return str_replace(\n array_keys($replace), array_values($replace), parent::buildClass($name)\n );\n }",
"private function escapeTable($name)\n {\n if (strpos($name, '.') || strpos($name, '`') || strpos($name, ' ')) {\n return $name;\n }\n\n return '`'.$name.'`';\n }",
"private function resolveBindName()\n {\n $table = (self::$plural) ? Inflector::singularize($this->table) : $this->table;\n return $table . '_' . $this->key;\n }",
"function sql_table($name) {\n global $MYSQL_PREFIX;\n\n if ($MYSQL_PREFIX) {\n return $MYSQL_PREFIX . 'nucleus_' . $name;\n } else {\n return 'nucleus_' . $name;\n }\n}",
"function quoteIdentifier($name)\n {\n return $this->conn->quoteIdentifier($name);\n }",
"public function quoteSimpleColumnName(string $name): string;",
"public function name($name);",
"public function quoteTableName($name)\n {\n return $name;\n }",
"public function getCompiledName()\n\t{\n\t\treturn \"{$this->getFingerprint()}.{$this->type}\";\n\t}",
"function generatePlaceHolderName($name)\r\n\t{\r\n\t\treturn ':'.$name;\r\n\t}",
"public function quoteSimpleColumnName($name)\n\t{\n\t\treturn '`'.$name.'`';\n\t}",
"public function quoteSimpleTableName(string $name): string;",
"public function getTableName($name){\n return $name.\"_\".$this->table_prefix;\n }",
"protected function generate_key($name)\n {\n return \"_avia_builder_template_\".str_replace(\" \", \"_\", strtolower($name));\n }",
"public function quoteSimpleTableName($name)\n {\n return '[' . $name . ']';\n }",
"public function quoteColumnName($name)\n {\n return $name;\n }",
"public static function tableize($name)\n {\n $name = str_replace('\\\\', '', $name);\n\n return (ends_with($name, 'Closure') ? snake_case($name) : snake_case(str_plural($name)));\n }",
"public static function tableize($name)\n {\n $name = str_replace('\\\\', '', $name);\n\n return static::endsWith($name, 'Closure')\n ? static::snake($name)\n : static::snake(static::plural($name));\n }",
"public function compileFunction()\n {\n $params = func_get_args();\n $name = array_shift($params);\n array_pop($params);\n if (function_exists($name)) {\n return $name . '('. join(\", \", $params) . ')';\n }\n }",
"private function nameify($name) {\n return sprintf('%s[%s]', $this->namebase(), $name);\n }",
"public function compile()\n {\n if (null !== $this->type) {\n $sql = strtoupper($this->type).' JOIN';\n } else {\n $sql = 'JOIN';\n }\n\n $sql .= ' '.$this->quoter->quoteTable($this->table);\n\n if (!empty($this->using)) {\n $sql .= ' USING ('.implode(', ', array_map(array($this->quoter, 'quoteColumn'), $this->using)).')';\n } else {\n $conditions = array();\n\n foreach ($this->on as $condition) {\n list($c1, $op, $c2) = $condition;\n\n if ($op) {\n $op = ' '.strtoupper($op);\n }\n\n $conditions[] = $this->quoter->quoteColumn($c1).$op.' '.$this->quoter->quoteColumn($c2);\n }\n\n $sql .= ' ON ('.implode(' AND ', $conditions).')';\n }\n\n return $sql;\n }",
"protected function buildClass($name)\n {\n $namespace = $this->getNamespace($name);\n $default_replace = str_replace(\"use $namespace\\Controller;\\n\", '', parent::buildClass($name));\n //return str_replace(\"Now_Entity\", \"Creator_\" . $this->argument(\"name\"), $default_replace);\n return str_replace(\"Now_Entity\", $this->argument(\"name\"), $default_replace);\n }",
"public static function clause($name)\n {\n $name = trim($name);\n $argc = func_num_args();\n $value = $argc > 1 ? func_get_arg(1): null;\n // ? mark expression with variable number of args\n if (is_scalar($name) && strpos($name, '?') !== false)\n return call_user_func_array('self::parse', func_get_args());\n else\n // single field name without operator, so default to =\n if (is_scalar($name) && strpos($name, ' ') === false && $argc > 1)\n return sprintf('%s = %s', self::quote_name($name), self::quote($value));\n else\n // single field with trailing operator and separate value\n if (is_scalar($name) && strpos($name, ' ') !== false && $argc > 1)\n {\n list ($field, $op) = preg_split('/\\s+/', $name);\n return sprintf('%s %s %s', self::quote_name($field), $op, self::quote($value));\n }\n else\n // only one arg and may be raw SQL, don't touch it\n return strval($name);\n }",
"public function name($name)\n\t{\n\t\t$open = reset($this->_quotes);\n\t\t$close = next($this->_quotes);\n\n\t\tlist($first, $second) = $this->_splitFieldname($name);\n\t\tif ($first) {\n\t\t\treturn \"{$open}{$first}{$close}.{$open}{$second}{$close}\";\n\t\t}\n\t\treturn preg_match('/^[a-z0-9_-]+$/i', $name) ? \"{$open}{$name}{$close}\" : $name;\n\t}"
] |
[
"0.60792863",
"0.5982909",
"0.59472996",
"0.5836055",
"0.5807949",
"0.5755057",
"0.5734987",
"0.571613",
"0.5678705",
"0.5674679",
"0.56605804",
"0.5655016",
"0.5639867",
"0.56138676",
"0.5560365",
"0.5554068",
"0.5541797",
"0.55361134",
"0.54985964",
"0.5492446",
"0.5479122",
"0.54710585",
"0.5463212",
"0.5462625",
"0.5458237",
"0.5450603",
"0.5441857",
"0.54351085",
"0.54044855",
"0.5389604"
] |
0.6323051
|
0
|
Compiles a string with surrounding quotes.
|
public static function compileString($value) {
$value = str_replace(chr(39), chr(92) . chr(39), $value);
return "'{$value}'";
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public static function intoQuote($string){ return \"'\".$string.\"'\"; }",
"public function quoteAndEscape(string $str): string;",
"static function quote($s){\r\n return '\"' . str_replace('\"', '\\\"', $s) . '\"';\r\n }",
"private function quoted(string $value): string\n {\n return sprintf('\\'%s\\'', $value);\n }",
"function bab_pm_quote($str)\n{\n return '\"' . str_replace('\"', '\"\"', $str) . '\"';\n}",
"function quote($s) { \n return \"'\".str_replace('\\\\\"', '\"', addslashes($s)).\"'\"; \n }",
"function OneTwoQuoteToCode($str) {\n\t$from = array(\"'\", \"\\\"\");\n\t$to = array(\"‘\", \""\");\t\n\treturn str_replace($from, $to, $str);\n}",
"protected function quote ( $str ) {\n\n\t\tif(strpos($str, '\"')) {\n\t\t\t$str = str_replace('\"', '\\\"', $str);\n\t\t\t$str = '\"'.$str.'\"';\n\t\t}\n\t\telseif(strpos($str, \"'\")) {\n\t\t\t$str = str_replace(\"'\", \"\\'\", $str);\n\t\t\t$str = \"'\".$str.\"'\";\n\t\t}\n\n\t\treturn $str;\n }",
"function ps_escape_string($str, $as_token = false, $esc_quotes = false) {\n $s = '';\n foreach (str_split($str) as $c) {\n if (($i = strpos(\"\\n\\r\\t\\10\\f\\\\()\", $c)) !== false)\n $c = '\\\\' . 'nrtbf\\\\()'[$i]; // postscript escapes, see PLRM 3.2.2 Literals\n elseif (($o = ord($c)) < 0x20 || $o >= 0x7F)\n $c = sprintf('\\\\%03o', $o); // control & non-ASCII\n elseif ($esc_quotes && $c == '\"')\n $c = '\\\\042'; // octal escape \" (for gs v9 parameters)\n $s .= $c;\n }\n return $as_token ? \"($s)\" : $s;\n}",
"static function squote($s){\r\n return \"'\" . str_replace(\"'\", '\\'', $s) . \"'\";\r\n }",
"private function quote($string)\n {\n return \"'\" . addcslashes($string, \"'\") . \"'\";\n }",
"function changesqlquote($str,$rep=\"'\")\r\n{\r\n\treturn str_replace(\"`\", $rep, $str);\r\n}",
"private function quote($string,$param=''){\n\t\tif(empty($param)){\n\t\t\treturn \"'$string'\";\n\t\t}\n\t\treturn $string;\n\t}",
"static public function addSingleQuotes($arg) \n { \n /* single quote and escape single quotes and backslashes */ \n return \"'\" . addcslashes($arg, \"'\\\\\") . \"'\"; \n }",
"function escape_sq($str)\n{\n $esc_str = str_replace(\"'\", \"''\", $str);\n return $esc_str;\n}",
"function reemplazar_comillas($string){\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\n\treturn $string;\n}",
"function Quote( $text ) {\n\t\treturn '\\'' . getEscaped( $text ) . '\\'';\n\t}",
"public static function quote($s){\r\n\t\treturn LEFT_QUOTES . $s . RIGHT_QUOTES;\r\n\t}",
"public static function compileString($value)\n {\n }",
"public function quote($stringValue);",
"protected function pSingleQuotedString(string $string): string\n {\n return '\\'' . \\preg_replace(\"#'|\\\\\\\\(?=[\\\\\\\\']|$)#\", '\\\\\\\\$0', $string) . '\\'';\n }",
"function qstr($string, $magic_quotes=false)\n\t{\t\n\t\tif (!$magic_quotes) {\n\t\t\treturn \"'\".str_replace(\"'\", \"''\", $string).\"'\";\n\t\t}\n\t\t$string = str_replace(\"\\\\'\", \"''\", str_replace('\\\\\\\\', '\\\\', str_replace('\\\\\"', '\"', $string)));\n\t\treturn \"'\" . $string . \"'\";\n\t}",
"protected function quote($literal)\n {\n return \"'\" . addslashes($literal) . \"'\";\n }",
"public function addDoubleQuotes($str){\n\t\treturn '\"'.$str.'\"';\n\t}",
"private function createQuote($string) {\n\t\t$string = $this->cleanString($string);\n\t\t$string = '</p><div class=\"quote\">'.$string.'</div><p>';\n\t\treturn $string;\n\t}",
"function add_quotes($str) {\n if (is_string($str)) {\n return sprintf(\"'%s'\", $str);\n } elseif (is_null($str)) {\n return sprintf(\"%s\", \"null\");\n } else {\n return sprintf(\"%s\", $str);\n }\n}",
"private function escapeString(string $value): string\n {\n return str_replace(\"'\", \"''\", $value);\n }",
"public function quoteAndEscape(string $str): string\n {\n return $this->stringQuotingCharacter . $this->escape($str) . $this->stringQuotingCharacter;\n }",
"public function quote($string)\n {\n return $string;\n }",
"public static function escapeSql($str)\n {\n return StringUtils::replace($str, '\\'', '\\'\\'');\n }"
] |
[
"0.72523683",
"0.65105623",
"0.6499554",
"0.632125",
"0.63108873",
"0.62722194",
"0.62494767",
"0.6243703",
"0.62319124",
"0.61714923",
"0.61131537",
"0.61055887",
"0.6068739",
"0.60152364",
"0.6005905",
"0.6003071",
"0.6001343",
"0.5998134",
"0.5993074",
"0.5947801",
"0.5935402",
"0.5930548",
"0.59234214",
"0.58981943",
"0.5894013",
"0.58885163",
"0.5875721",
"0.5867563",
"0.58548754",
"0.58420455"
] |
0.7268459
|
0
|
Compiles an array of column names into a formatted SQL list, such as (`col`, `col`).
|
public static function compileColumnList(array $columns) {
$compiled = array();
foreach ($columns as $column) {
$compiled[] = static::compileName($column);
}
return '(' . implode(', ', $compiled) . ')';
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"private function toSqlCols($cols)\r\n\t{\r\n\t\tif (is_array($cols)) {\r\n\t\t\t$c = array();\r\n\t\t\tforeach ($cols as $col)\r\n\t\t\t\t$c[] = \"[$col]\";\r\n\t\t\t$cols = implode(', ', $c);\r\n\t\t}\r\n\r\n\t\treturn $cols;\r\n\t}",
"protected function getColumnsSQLDeclaration(array $columns)\n {\n $columnsDeclaration = array();\n\n foreach ($columns as $column) {\n $columnsDeclaration[] = $this->getColumnSQLDeclaration($column);\n }\n\n return implode(', ', $columnsDeclaration);\n }",
"public function columnsWithValues()\n {\n // $sqlQuery = str_replace(\"&\", ', ',$query);\n $keys = array_keys($this->attributes);\n $values = array_values($this->attributes);\n $sql = null;\n for ($i = 0; $i < sizeof($this->attributes); $i++) {\n $sql .= $keys[$i]. '=';\n if (is_string($values[$i])) {\n $sql .= '\"'.$values[$i].'\"';\n } else { \n $sql .= $values[$i];\n }\n if ($i != sizeof($values) - 1) {\n $sql .= ', ';\n }\n } \n return $sql;\n }",
"protected function parseColumns(array $columns): string\n {\n // define string\n $sql = '';\n\n if (!empty($columns)) {\n $i = 0;\n foreach ($columns as $column => $label) {\n // add trailing comma\n $sql .= ($i != 0 ? ', ' : '');\n\n // check for AS syntax\n if (is_int($column)) {\n list($table, $column) = $this->parseColumn($label);\n $label = $column;\n } else {\n list($table, $column) = $this->parseColumn($column);\n }\n\n // Build SQL\n $sql .= $table . '.' . $column . ' AS ' . $table . self::COLUMN_SEPERATOR . $column . self::ALIAS_SEPERATOR . $label;\n\n $i++;\n }\n } else {\n // Empty column selection are not supported - there breaking the parsing\n $this->log(new ConnectionException('Empty column selections are not supported!'), Environment::E_LEVEL_ERROR);\n\n // return an empty string if exceptions are disabled\n return '';\n }\n\n // return string\n return $sql;\n }",
"function columnSql(array $cd)\n {\n $line = array();\n $line[] = parent::columnSql($cd);\n\n /*\n if ($table['foreign keys'][$name]) {\n foreach ($table['foreign keys'][$name] as $foreignTable => $foreignColumn) {\n $line[] = 'references';\n $line[] = $this->quoteIdentifier($foreignTable);\n $line[] = '(' . $this->quoteIdentifier($foreignColumn) . ')';\n }\n }\n */\n\n return implode(' ', $line);\n }",
"public function generateColumns(): string\n {\n $columns = [];\n foreach ($this->columns as $column) {\n $snip = $column->generateSnippet($this->queryType, $this->dbc);\n if (!empty($snip)) {\n $columns[] = $snip;\n }\n }\n return implode(', ', $columns);\n }",
"private static function buildNameParametersSQL() {\n $namedParams = '';\n foreach (static::$tableSchema as $columnName => $type) {\n $namedParams .= $columnName . ' = :' . $columnName . ', ';\n }\n return trim($namedParams, ', ');\n }",
"protected final function prepareCols(&$array)\n {\n\n foreach ($array as $index => $value)\n {\n if ((array_key_exists(\"table\", $array)))\n {\n unset($array[\"table\"]);\n }\n elseif ($value == null || $value == \"\")\n {\n unset($array[$index]);\n }\n }\n return implode(\",\", array_keys($array));\n\n }",
"public function getSqlStatments() \n\t{\n\t\tfor ($i=0; $i < count($this->array_result); $i++) { \n\t\t\t$this->array_sql[] = \"SHOW COLUMNS FROM \".$this->array_result[$i].\"\";\n\t\t}\n\t\treturn $this->array_sql;\n\t}",
"function db_tableby_to_sqladd($arr){\t\n\tif ( is_array( $arr ) ) {\n\t\t$s='';\n\t\tforeach ( $arr as $k => $v ) {\n\t\t\t$s.=DB_PRE.$k.' as '.$v.',';\n\t\t}\n\t\treturn $s;\n\t}elseif(strpos( $arr,',' )>0) \t{\n\t\treturn DB_PRE.str_replace(',',','.DB_PRE,$arr);\t\t\n\t}else {\n\t\tif (strpos( $arr,DB_PRE )>0){\n\t\t\treturn $arr;\n\t\t}else{\n\t\t\treturn DB_PRE.$arr;\n\t\t}\t\t\n\t}\n}",
"static private function BuildSQLColumns( $columns, $addQuotes = true, $showAlias = true )\r\n\t{\r\n\t\tif( $addQuotes )\r\n\t\t{\r\n\t\t\t$quote = '`';\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t$quote = '';\r\n\t\t}\r\n\t\tswitch( gettype( $columns ) )\r\n\t\t{\r\n\t\t\tcase 'array':\r\n\t\t\t\t$sql = '';\r\n\t\t\t\tforeach( $columns as $key => $value )\r\n\t\t\t\t{\r\n\t\t\t\t\t// Build the columns\r\n\t\t\t\t\tif( strlen( $sql ) == 0 )\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$sql = $quote . $value . $quote;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$sql .= \", \" . $quote . $value . $quote;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif( $showAlias && is_string( $key ) && ( !empty( $key ) ) )\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$sql .= ' AS \"' . $key . '\"';\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\treturn $sql;\r\n\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\tcase 'string':\r\n\t\t\t\treturn $quote . $columns . $quote;\r\n\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\tdefault:\r\n\t\t\t\treturn false;\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}",
"private function convertColumnsPdo(\n array $array_keys,\n String $pattern = '',\n Bool $double = false\n ): String {\n $columns = array();\n foreach($array_keys as $key)\n {\n $pdoColumn = $double ? \"$key\" . \"$pattern\" . \"$key\" : \"$pattern\" . \"$key\";\n array_push($columns, $pdoColumn);\n }\n\n return implode(\", \", $columns);\n }",
"function ColumnNames($columnNames = null);",
"public function getColumnNames()\r\n\t\t{\r\n\t\t\t$nameColumns = $this->getColumnsArray();\r\n\t\t\treturn implode(\",\", $nameColumns);//Retornando uma lista de colunas separadas por vígula\r\n\t\t}",
"private function buildSelectColumns()\n {\n $columns = array();\n\n foreach ($this->query['select'] as $column => $as) {\n // Normal column select\n if (is_numeric($column)) {\n $columns[] = $this->columnName($as);\n }\n // Alias\n else {\n $columns[] = $this->columnName($column) . \" AS `{$as}`\";\n }\n }\n\n // Join columns and return\n return implode(', ', $columns);\n }",
"public function getUpdateColumns(array $values): string\n {\n $columns = [];\n\n foreach ($values as $key => $value) {\n $columns[] = $this->wrap($key).' = '.$this->parameter($value);\n }\n\n return implode(', ', $columns);\n }",
"function arrayIntoString_sql(array $arr)\n {\n $str = \"\";\n foreach ($arr as $k => $v) {\n $str .= (count($arr) - 1 != $k)\n ? \"'\". $v . \"', \"\n : \"'\". $v . \"'\";\n }\n return $str;\n }",
"function arrayToSQLString ($arr) {\r\n $sql = \"\";\r\n foreach ($arr as $key => $value) {\r\n $sql = $sql . $value . ',';\r\n }\r\n $sql = rtrim($sql,',');\r\n return $sql;\r\n}",
"private function genColModifyScripts($stmts)\n {\n $query = \"\";\n $i = 0;\n foreach ($stmts as $name => $stmt) {\n $query .= \"\\nCHANGE `$name` `$name` $stmt\";\n if ($i < count($stmts) - 1) {\n $query .= ',';\n }\n $i++;\n }\n return $query;\n }",
"private function setFields()\n\t{\t\n\t\t$sql = '';\n\t\t\n\t\tforeach (array_keys($this->data) as $key)\n\t\t{\n\t\t\t$sql .= '`' . $key . '` = ? , ';\n\t\t}\n\t\t\n\t\t$sql = rtrim($sql, ', ');\n\t\t\n\t\treturn $sql;\n\t}",
"function implode_column_quoted($glue, $column, $arr, $quote =\"'\") {\n $values = array();\n foreach ($arr as $row) {\n $value = lavnn($column, $row, '');\n if ($value != '')\n $values[] = $value;\n }\n return $quote . implode($quote . $glue . $quote, $values) . $quote;\n}",
"private function formatSelectCommand( $cols = '*', $extra = null )\n {\n $sql = 'SELECT ' . $cols . ' FROM ' . $this->table_name;\n\n if ( $extra != null )\n $sql .= ' ' . $extra;\n\n return $sql;\n }",
"public static function stringizeOrderBy($array)\n {\n //normalize single column orderBy statement\n if (is_string(reset($array)))\n {\n $array = array($array);\n } \n \n $columnsOrderBy = array();\n \n foreach ($array as $orderBy)\n {\n// var_dump($orderBy);\n $columnsOrderBy[] = $orderBy['column'] . ' ' . $orderBy['direction'];\n }\n \n return implode(', ', $columnsOrderBy);\n }",
"public function getColumnList($columns, $delim=',')\n\t{\n\t\t$list = array();\n\t\tforeach ($columns as $col) {\n\t\t\tif ($col instanceof Column) {\n\t\t\t\t$col = $col->getName();\n\t\t\t}\n\t\t\t$list[] = $this->quoteIdentifier($col);\n\t\t}\n\t\treturn implode($delim, $list);\n\t}",
"protected function compileColumns(Builder $query, array $columns)\n {\n if (!is_null($query->aggregate)) {\n return;\n }\n\n $select = $query->distinct ? 'select distinct ' : 'select ';\n\n return $select . $this->columnIze($columns);\n }",
"private function makeOrderingSQL($order_by) {\n $all_columns = \"\";\n if (is_array($order_by))\n {\n foreach ($order_by as $column_name)\n\t{\n\t $all_columns .= $column_name . ', ';\n\t}\n $all_columns = rtrim($all_columns, ', ');\n }\n else\n {\n $all_columns = $order_by;\n }\n return 'ORDER BY ' . $all_columns;\n}",
"private function setFields(): string\n {\n $sql = '';\n\n foreach (array_keys($this->data) as $key) {\n $sql .= '`' . $key . '` = ? , ';\n }\n return rtrim($sql, ', ');\n }",
"protected function buildSQLValuesFrom(array $rows): string\n {\n $values = collect($rows)->reduce(function ($valuesString, $row) {\n return $valuesString .= '(' . rtrim(str_repeat(\"?,\", count($row)), ',') . '),';\n }, '');\n\n return rtrim($values, ',');\n }",
"public function getColumnString()\n\t{\n\t\t$columns = '';\n\n\t\tfor($i = 0, $len = count($this->column); $i < $len; $i++)\n\t\t{\n\t\t\t$columns .= $this->column[$i]->getName();\n\n\t\t\tif($i != $len-1)\n\t\t\t{\n\t\t\t\t$columns .= \", \";\n\t\t\t}\n\t\t}\n\n\t\treturn $columns;\n\t}",
"protected function getColsAsFields(array $cols = array())\n {\n $cols_fields = $this->getColsFields();\n\n if ($cols_fields && ! $cols) {\n $cols = array_keys($cols_fields);\n }\n\n $list = [];\n foreach ($cols as $col) {\n $list[] = \"{$col} AS {$cols_fields[$col]}\";\n }\n\n return $list;\n }"
] |
[
"0.7278298",
"0.67235565",
"0.66791713",
"0.65615034",
"0.65477085",
"0.65350795",
"0.6462377",
"0.6440771",
"0.641424",
"0.63921005",
"0.63232553",
"0.63107604",
"0.63018453",
"0.6246741",
"0.6186771",
"0.61735237",
"0.61245364",
"0.6099124",
"0.60884875",
"0.60819983",
"0.6080882",
"0.60726005",
"0.605887",
"0.60403156",
"0.60362023",
"0.5989982",
"0.5936315",
"0.59150344",
"0.5911334",
"0.5903681"
] |
0.7032936
|
1
|
Compiles a default value into a string that can be inserted directly into an SQL query without any further escaping. Returns false for invalid values.
|
public static function compileDefault($value) {
if (is_null($value)) {
return 'NULL';
}
if (is_bool($value)) {
return $value ? 'TRUE' : 'FALSE';
}
if (is_numeric($value)) {
return "'{$value}'";
}
if (is_string($value)) {
if ($value === 'CURRENT_TIMESTAMP') {
return $value;
}
$value = str_replace(chr(39), chr(92) . chr(39), $value);
return "'{$value}'";
}
return false;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"private function defaultValueExpression($sqlsr_type, $default) {\n // The actual expression depends on the target data type as it might require conversions.\n $result = is_string($default) ? \"'\" . addslashes($default) . \"'\" : $default;\n if (DatabaseUtils::GetMSSQLType($sqlsr_type) == 'varbinary') {\n $default = addslashes($default);\n $result = \"CONVERT({$sqlsr_type}, '{$default}')\";\n }\n return $result;\n }",
"function _set_null_default_value($value) {\n\t\tif ($value == '') {\n\t\t\treturn \"NULL\";\n\t\t} else {\n\t\t\treturn \"'\".$value.\"'\";\n\t\t}\n\t}",
"public function getDefaultValueString()\n {\n $defaultValue = $this->getDefaultValue();\n if ($defaultValue !== null) {\n if ($this->isNumericType()) {\n $dflt = (float) $defaultValue->getValue();\n } elseif ($this->isTextType() || $this->getDefaultValue()->isExpression()) {\n $dflt = \"'\" . str_replace(\"'\", \"\\'\", $defaultValue->getValue()) . \"'\";\n } elseif ($this->getType() == PropelTypes::BOOLEAN) {\n $dflt = $this->booleanValue($defaultValue->getValue()) ? 'true' : 'false';\n } else {\n $dflt = \"'\" . $defaultValue->getValue() . \"'\";\n }\n } else {\n $dflt = \"null\";\n }\n\n return $dflt;\n }",
"private function parseDefaultExpression(?string $default): ?string\n {\n if ($default === null) {\n return $default;\n }\n\n return str_replace(\"''\", \"'\", $default);\n }",
"protected function getDefaultValue( $value )\n\t{\n\t\tif ( $value instanceof Expression )\n\t\t{\n\t\t\treturn $value;\n\t\t}\n\n\t\tif ( is_bool( $value ) )\n\t\t{\n\t\t\treturn \"'\" . (int) $value . \"'\";\n\t\t}\n\n\t\treturn \"'\" . strval( $value ) . \"'\";\n\t}",
"public function getDefaultValueDeclarationSQL($field)\n {\n if (isset($field['default'])) {\n if (isset($field['type'])) {\n if ((string) $field['type'] == 'Boolean') {\n return \" DEFAULT \" . $this->convertBooleans($field['default']);\n }\n }\n }\n\n return parent::getDefaultValueDeclarationSQL($field);\n }",
"function getValueOrNull($value) {\n global $db;\n if(strlen($value) == 0) return \"NULL\";\n else return \"'\".$db->validate($value).\"'\";\n}",
"function _sql_validate_value($var)\n\t{\n\t\tif (is_null($var))\n\t\t{\n\t\t\treturn 'NULL';\n\t\t}\n\t\telse if (is_string($var))\n\t\t{\n\t\t\treturn \"'\" . $this->sql_escape($var) . \"'\";\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn (is_bool($var)) ? intval($var) : $var;\n\t\t}\n\t}",
"protected static function getDefault($value)\n\t{\n\t\tif (is_array($value)) {\n\t\t\t$value = isset($value[0]) ? $value[0] : '';\n\t\t\treturn \"array(\" . $value . \")\";\n\t\t}\n\t\tif (is_bool($value)) {\n\t\t\treturn ($value) ? \"true\" : \"false\";\n\t\t}\n\t\tif (is_null($value)) {\n\t\t\treturn \"null\";\n\t\t}\n\t\treturn '\"' . $value . '\"';\n\t}",
"function db_field_set_default(&$ret, $table, $field, $default) {\n if ($default == NULL) {\n $default = 'NULL';\n }\n else {\n $default = is_string($default) ? \"'$default'\" : $default;\n }\n\n $ret[] = update_sql('ALTER TABLE {'. $table .'} ALTER COLUMN '. $field .' SET DEFAULT '. $default);\n}",
"public function getDefaultSql(): string|null\n {\n return null;\n }",
"function wpv_default($value, $default) {\n\tif (empty($value))\n\t\treturn $default;\n\treturn $value;\n}",
"function defval (&$val,$default_val) {\r\n\t\tif (!isset($val) || ''==$val) {\r\n\t\t\t$val=$default_val;\r\n\t\t} elseif ('NULL' == $val) {\r\n\t\t\t$val='';\r\n\t\t}\r\n\r\n\t\tif (ereg(\"^%([^\\[]+)\\[(.+)\\]%$\",$val,$regs) ) {\r\n\t\t\t$val=$this->{$regs[1]}[$regs[2]];\r\n\t\t}\r\n\t}",
"protected function get_formatted_default(): string\n\t{\n\t\t$default = $this->default;\n\n\t\tif (!$default)\n\t\t{\n\t\t\treturn '';\n\t\t}\n\n\t\tswitch ($default)\n\t\t{\n\t\t\tcase 'CURRENT_TIMESTAMP':\n\n\t\t\t\treturn \"DEFAULT $default\";\n\n\t\t\tdefault:\n\n\t\t\t\treturn \"DEFAULT '$default'\";\n\t\t}\n\t}",
"function prepSQL($theValue, $theType, $theDefinedValue = \"\", $theNotDefinedValue = \"\") {\n $theValue = str_replace('\\'', ' ', $theValue);\n $theValue = str_replace('\\r\\n', '<br>', $theValue);\n if ($theType == \"date\") {\n $theValue = str_replace('/', '-', $theValue);\n if (!$this->valid_date($theValue)) {\n trim($theValue);\n list($d, $m, $y) = explode('-', $theValue);\n $mk = mktime(0, 0, 0, $m, $d, $y);\n $theValue = strftime('%Y-%m-%d', $mk);\n }\n }\n switch ($theType) {\n case \"text\":\n $theValue = ($theValue != \"\") ? \"'\" . $theValue . \"'\" : \"NULL\";\n break;\n case \"long\":\n case \"int\":\n $theValue = ($theValue != \"\") ? intval($theValue) : 0;\n break;\n case \"double\":\n $theValue = ($theValue != \"\") ? \"'\" . floatval($theValue) . \"'\" : \"NULL\";\n break;\n case \"date\":\n $theValue = ($theValue != \"\") ? \"'\" . $theValue . \"'\" : \"NULL\";\n break;\n case \"defined\":\n $theValue = ($theValue != \"\") ? $theDefinedValue : $theNotDefinedValue;\n break;\n }\n return $theValue;\n }",
"public function testDefaultStringForStringWithQuotes()\n {\n $this->assertEquals(\n static::TEST_STRING . static::TEST_STRING . static::TEST_STRING,\n StringUtils::defaultString(static::TEST_STRING, StringUtils::NULL_STR, static::TEST_STRING)\n );\n }",
"private function defaults_text($defaultVal)\r\n\t{\r\n\t\treturn $defaultVal;\r\n\t}",
"function kalium_vc_loop_param_set_default_value( &$query, $field, $value = '' ) {\n\tif ( ! preg_match( '/(\\|?)' . preg_quote( $field ) . ':/', $query ) ) {\n\t\t$query .= \"|{$field}:{$value}\";\n\t}\n\n\treturn ltrim( '|', $query );\n}",
"protected static function display_default($defaultvalue) {\n if ($defaultvalue === null) {\n return '-';\n } else {\n return \"'\" . s($defaultvalue) . \"'\";\n }\n }",
"function define_default($param, $value) {\n\t\t//\n\t}",
"public function getDefaultValue();",
"public function getDefaultValue();",
"function default_value(&$var, $def = null) {\n return isset($var)?$var:$def;\n}",
"function coalescenull($value, $default1) {\n if (is_null($value)) {\n return $default1;\n } else {\n return $value;\n }\n }",
"public static function defaultify($value)\n {\n if (is_array($value)) {\n foreach ($value as &$v) {\n $v === '' and $v = static::literal('DEFAULT');\n }\n\n return $value;\n }\n return $value === '' ? static::literal('DEFAULT') : $value;\n }",
"function get_value_or_default($value,$default='')\n{\n\treturn (!empty($value)) ? $default : $value;\n}",
"function coalesce($value, $default1=null, $default2=false, $default3=false, $default4=false) {\n return isnull(isnull(isnull(isnull($value, $default1), $default2), $default3), $default4);\n }",
"function sqlvalue($val, $quote)\r\n{\r\n\tif ($quote)\r\n \t$tmp = sqlstr($val);\r\n \telse\r\n \t$tmp = $val;\r\n \tif ($tmp == \"\")\r\n \t$tmp = \"NULL\";\r\n \telseif ($quote)\r\n \t$tmp = \"'\".$tmp.\"'\";\r\n \r\n \treturn $tmp;\r\n}",
"function sqlvalue($val, $quote)\r\n{\r\n\tif ($quote)\r\n \t$tmp = sqlstr($val);\r\n \telse\r\n \t$tmp = $val;\r\n \tif ($tmp == \"\")\r\n \t$tmp = \"NULL\";\r\n \telseif ($quote)\r\n \t$tmp = \"'\".$tmp.\"'\";\r\n \r\n \treturn $tmp;\r\n}",
"public function getDefaultValue() {}"
] |
[
"0.6780953",
"0.6366684",
"0.6020631",
"0.6000684",
"0.5993202",
"0.5954548",
"0.5844232",
"0.57530683",
"0.5708392",
"0.56852174",
"0.5684584",
"0.5618648",
"0.5581451",
"0.55813175",
"0.558121",
"0.55788606",
"0.5572104",
"0.55510205",
"0.55494875",
"0.5514948",
"0.5507277",
"0.5507277",
"0.54821",
"0.5476305",
"0.5475473",
"0.5471669",
"0.5457628",
"0.5453547",
"0.5453547",
"0.54468626"
] |
0.7489219
|
0
|
Compiles a comment into an escaped, quoted string.
|
public static function compileComment($comment) {
$comment = str_replace(chr(39), chr(92) . chr(39), $comment);
return "'{$comment}'";
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function comment($comment)\n\t{\n\t\treturn $comment ? \"/* {$comment} */\" : null;\n\t}",
"public function getEscapedComment()\n {\n return $this->Comment;\n }",
"public function formatComment(string $comment): string;",
"function plc_comment_display( $comment_to_display ) {\n\n\t// Put the single quotes back in\n\t$comment_to_display = str_replace( ''', \"'\", $comment_to_display );\n\n\treturn $comment_to_display;\n}",
"protected function get_formatted_comment(): string\n\t{\n\t\treturn $this->comment ? \"`$this->comment`\" : '';\n\t}",
"public function normaliseComment(string $comment): string;",
"public function getCommentHTML() {\n return str_replace(\"\\n\", \"<br />\", trim(str_replace(array(\"/*\", \"*\"), array(\"\", \"\"), $this->getComment())));\n }",
"function rawComment($commentid) {\n\t$commentid = intval($commentid);\n\treturn(dbFirstResult(\"SELECT text FROM comments WHERE id=$commentid\"));\n}",
"public static function parseComment($comment, $strict = true)\n {\n $result = str_replace(['\\n', '\\r'], '. ', preg_replace('~\\R~u', '', $comment));\n\n if ($strict && $comment != $result) {\n throw new \\Exception('Comment must not contain linefeed characters');\n }\n\n // Hash and brackets\n $result = preg_replace('/[#<>]/', '', $result);\n\n if ($strict && $comment != $result) {\n throw new \\Exception('Comment must not contain hash or bracket characters');\n }\n\n return $result;\n }",
"public function FormattedComment() {\n\t\treturn $this->FormattedText($this->Comment);\n\t}",
"private function readCommentString(): string\n {\n $length = strcspn($this->data, \"\\n\\r\", $this->position);\n\n return substr($this->data, ($this->position += $length) - $length, $length);\n }",
"private function encloseTextInComment($header)\n {\n $comment = \"/*\\n\";\n $lines = explode(\"\\n\", str_replace(\"\\r\", '', $header));\n foreach ($lines as $line) {\n $comment .= rtrim(' * '.$line).\"\\n\";\n }\n $comment .= ' */';\n\n return $comment;\n }",
"function generateComment(&$eventData, $comment)\n {\n $eventData['comment'] = \"-- $comment --<br>\\n\" . $eventData['comment'];\n }",
"public function getComment()\n {\n $value = $this->get(self::COMMENT);\n return $value === null ? (string)$value : $value;\n }",
"private function preproc($comment) {\n \n // remove comment boarders\n $comment = preg_replace(\n \n // patterns\n array(\n \"/\\n/\", // save our newlines, as they're considered part of '\\s' in regex\n \"/\\s*\\/+\\**\\s+/i\", // /* or /** or /*** or //*.. and trailing spaces\n \"/^\\s*\\*\\**\\/?\\s*/im\", // *'s and trailing spaces on a new line\n \"/\\{\\s*@\\w*.*\\}/i\", // ignore inline tags\n \"/____ezpdonl____/\", // and then put the newlines back in\n ),\n\n // replacement\n array(\n \"____ezpdonl____\",\n \" \", \n \" \", \n \"\", \n \"\\n\"\n ), \n \n $comment\n );\n \n return $comment;\n }",
"public function getComment()\n {\n $value = $this->get(self::comment);\n return $value === null ? (string)$value : $value;\n }",
"function comment2Code($comment)\n\t{\n\t\t$comment = trim($comment);\n\t\t$comment = stripslashes($comment);\n /* ENT_QUOTES convers both ' and \" */\n\t\t$comment = htmlspecialchars($comment, ENT_QUOTES);\n\n\t\t/* Check to see if text exists before first ``` */\n\t\tif(strpos($comment, \"```\") !== 0)\n\t\t\t$comment = \"<p class='text-white'>\" . $comment;\n\n\t\t/* Check for opening ``` and closing ``` */\n\t\tif(checkBackticks($comment))\n {\n\t\t\t/* Comment/Code wrapper */\n\t\t\t$exCodeStart = \"<div class='exBoxComment mb-3 mt-2'>\"\n\t\t\t\t\t\t .\"<figure class='code'>\"\n\t\t\t\t\t\t .\"<pre><table class='table borderless my-auto'>\"\n\t\t\t\t\t\t .\"<tr><td><pre class='co-g'>\";\n\t\t\t$exCodeEnd = \"</pre></td></tr></table></pre></figure></div>\";\n\n\t\t\t/* Insert </p> before <div> */\n\t\t\t/* Encapsulate code with appropriate HTML tags in place of ``` */\n\t\t\t$openOrClose = 0;\n\t\t\twhile(($pos = strpos($comment, \"```\")) !== FALSE)\n {\n\t\t\t\t/* Opening ``` */\n\t\t\t\tif($openOrClose % 2 === 0)\n {\n\t\t\t\t\t/*\n\t\t\t\t\t\tThere is text before the code section\n\t\t\t\t\t\tHowever, in the case of two code sections back to back, there\n\t\t\t\t\t\twill be an empty <p class='text-white'></p> between them\n\t\t\t\t\t*/\n\t\t\t\t\tif($pos !== 0)\n\t\t\t\t\t\t$comment = substr_replace($comment, \"</p>\", $pos, 0);\n\t\t\t\t\t$comment = substr_replace($comment, $exCodeStart, strpos($comment, \"```\"), 3);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\t$comment = substr_replace($comment, $exCodeEnd, strpos($comment, \"```\"), 3);\n\t\t\t\t++$openOrClose;\n\t\t\t}\n\n\t\t\t/* Indicate how many code sections there are (will be a multiple of 2) */\n\t\t\t$openOrClose = $openOrClose / 2;\n\n\t\t\t/* Insert <p class='text-white'> after </div> to match with above </p> */\n\t\t\t$pos = 0;\n\t\t\twhile($openOrClose-- > 0)\n {\n\t\t\t\t$pos = strpos($comment, \"</div>\", $pos+1);\n\t\t\t\t$comment = substr_replace($comment, \"<p class='text-white'>\", $pos + 6, 0);\n\t\t\t}\n\t\t\t$comment .= \"</p>\";\n\n\t\t\t/* Remove trailing <p class='text-white'> </p> if no text after last code section */\n\t\t\tif(preg_match(\"/^[\\s\\S]+<p class='text-white'>[\\s]*<\\/p>$/m\", $comment))\n {\n\t\t\t\t$comment = substr($comment, 0, strrpos($comment, \"<p\"));\n\t\t\t}\n\n\t\t\treturn $comment;\n\t\t}\n\t\telse\n\t\t\treturn $comment . \"</p>\";\n\t}",
"public static function setComment($comment)\n {\n self::$comment = str_replace([\"\\r\", \"\\n\"], '', $comment);\n }",
"protected function compileComments($value)\n {\n // comment with < %-- --% > or {{-- --}}\n\n $pattern = sprintf('/%s#((.|\\s)*?)%s/', $this->contentTags[0], $this->contentTags[1]);\n\n $value = preg_replace($pattern, '<?php /* $1 */ ?>', $value);\n\n $pattern = sprintf('/%s--((.|\\s)*?)--%s/', '{{', '}}');\n\n $value = preg_replace($pattern, '<?php /* $1 */ ?>', $value);\n\n return $value;\n }",
"public function comment($value = null)\n\t{\n\t\tif ($value != null)\n\t\t{\n\t\t\t$this->_comment = $value;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn $this->_comment;\n\t\t}\n\t}",
"public function preprocessor($docComment)\n {\n if (0 === strncmp($docComment, '/**', 3)) { //\n $docComment = substr($docComment, 3);\n if ($this->keepPosition) {\n $docComment = str_repeat(' ', 3) . $docComment;\n } else {\n $docComment = ltrim($docComment);\n }\n }\n if ('*/' == substr($docComment, -2)) {\n $docComment = substr($docComment, 0, -2);\n if ($this->keepPosition) {\n $docComment .= str_repeat(' ', 2);\n } else {\n $docComment = rtrim($docComment);\n }\n }\n if ($this->keepPosition) {\n $phpdoc = preg_replace('#^([ \\t]*)\\*\\*?([ \\t]{0,1})#um', '\\1 \\2', $docComment);\n } else {\n $phpdoc = preg_replace('#^[ \\t]*\\*\\*?[ \\t]*#um', '', $docComment);\n }\n\n return str_replace([\"\\r\", \"\\r\\n\"], \"\\n\", $phpdoc);\n }",
"public function _createTableCommentSql($table,$comment)\r\n {\r\n return 'COMMENT ON TABLE '. $this->conn->quoteIdentifier($table, true). ' IS '.$this->conn->quote($comment, 'text').'';\r\n }",
"protected static function getInfoCommentString($text)\r\n\t{\r\n\t\treturn \"\\n// \" . $text;\r\n\t}",
"private function print_comment($comment, $context) {\n global $DB, $CFG, $COURSE;\n\n $output = '';\n\n $user = $DB->get_record('user', array('id' => $comment->userid));\n\n $deleteurl = new moodle_url('/mod/wavefront/comment.php', array('id' => $comment->wavefrontid, 'delete' => $comment->id));\n\n $output .= '<table cellspacing=\"0\" width=\"50%\" class=\"boxaligncenter datacomment forumpost\">'.\n '<tr class=\"header\"><td class=\"picture left\">'.\n $this->output->user_picture($user, array('courseid' => $COURSE->id)).'</td>'.\n '<td class=\"topic starter\" align=\"left\"><a name=\"c'.$comment->id.'\"></a><div class=\"author\">'.\n '<a href=\"'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&course='.$COURSE->id.'\">'.\n fullname($user, has_capability('moodle/site:viewfullnames', $context)).'</a> - '.userdate($comment->timemodified).\n '</div></td></tr>'.\n '<tr><td class=\"left side\">'.\n // TODO: user_group picture?\n '</td><td class=\"content\" align=\"left\">'.\n format_text($comment->commenttext, FORMAT_MOODLE).\n '<div class=\"commands\">'.\n (has_capability('mod/wavefront:edit', $context) ? html_writer::link($deleteurl, get_string('delete')) : '').\n '</div>'.\n '</td></tr></table>';\n\n return $output;\n }",
"private function comment()\n {\n // Comments always begin with a / character.\n $this->nextOrFail('/');\n\n if ($this->currentByte === '/') {\n $this->inlineComment();\n } elseif ($this->currentByte === '*') {\n $this->blockComment();\n } else {\n $this->throwSyntaxError('Unrecognized comment');\n }\n }",
"public function comments(string $comments): self\r\n {\r\n $comments = str_replace(\"'\", \"\\'\", $comments);\r\n $this->comments = $comments;\r\n return $this;\r\n }",
"protected function _emitComment($ast) {\n echo \"/{$ast['value']}/\\n\";\n }",
"protected function _emitComment($ast) {\n echo \"/{$ast['value']}/\\n\";\n }",
"public function setComment(string $comment): Mailcode_Commands_Command;",
"public function getRawComment()\n\t{\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 = Foundry::view( 'comments', false );\n\n\t\t// Check for permission first\n\t\t$access = Foundry::access();\n\n\t\tif( !$access->allowed( 'comments.read' ) )\n\t\t{\n\t\t\t$view->setMessage( JText::_( 'COM_EASYSOCIAL_COMMENTS_NOT_ALLOWED_TO_READ' ) , SOCIAL_MSG_ERROR );\n\t\t\treturn $view->call( __FUNCTION__ );\n\t\t}\n\n\t\t$id = JRequest::getInt( 'id', 0 );\n\n\t\t$table = Foundry::table( 'comments' );\n\n\t\t$state = $table->load( $id );\n\n\t\tif( !$state )\n\t\t{\n\t\t\t$view->setMessage( $table->getError(), SOCIAL_MSG_ERROR );\n\t\t\treturn $view->call( __FUNCTION__ );\n\t\t}\n\n\t\t$comment = $table->comment;\n\n\t\t$stringLib = Foundry::get( 'string' );\n\n\t\t$comment = $stringLib->escape( $comment );\n\n\n\t\t$view->call( __FUNCTION__, $comment );\n\t}"
] |
[
"0.69216824",
"0.6765353",
"0.6728773",
"0.6547503",
"0.62745464",
"0.61995023",
"0.59058577",
"0.57617533",
"0.5729033",
"0.56692404",
"0.56359535",
"0.56106603",
"0.5607741",
"0.5588188",
"0.5586519",
"0.555171",
"0.5538503",
"0.5520631",
"0.5507768",
"0.54783267",
"0.54201984",
"0.5417671",
"0.5396375",
"0.53919023",
"0.53679585",
"0.5345828",
"0.5345714",
"0.5345714",
"0.53301305",
"0.5326194"
] |
0.8124401
|
0
|
Gets the category of a column (textual, numeric, date) given its blueprinted type name.
|
public static function getColumnCategory($type) {
foreach (static::getColumns() as $category => $columns) {
foreach ($columns as $columnType) {
if ($columnType === $type) {
return $category;
}
}
}
return null;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function get_category_type()\n {\n return $this->m_cat_dao->get_category_type();\n }",
"public function get_category_type()\n {\n return C__CMDB__CATEGORY__TYPE_SPECIFIC;\n }",
"public function getCategorieType() {\n\t\tif (empty($this->_oType)) {\n\t\t\t$this->_oType = FactoryType::getFromTableType($this->getType());\n\t\t}\n\t\treturn $this->_oType->getNom();\n\t}",
"public function getCategory()\n {\n return $this->readOneof(2);\n }",
"public function category() {\n\t\treturn static::get_thrive_basic_label();\n\t}",
"public function column_category( $request ) {\n\t\trequire_once( WP_PLUGIN_DIR . '/wordcamp-payments/classes/payment-request.php' );\n\t\t$categories = WCP_Payment_Request::get_payment_categories();\n\t\t$selected_category = get_post_meta( $request->ID, '_camppayments_payment_category', true );\n\n\t\treturn isset( $categories[ $selected_category ] ) ? $categories[ $selected_category ] : '';\n\t}",
"function get_column_type ($table_name, $column_name) { \n\n\t$column_row_arr = NULL;\n\t\n\t// Get the array of meta data for the table\n\tlist($errArr, $columns_arr) = show_columns($table_name);\n if ( count($columns_arr) > 0) {\n \t// Loop through metadata\n \tforeach ($columns_arr as $columns_row)\n \t{\n \t\tif ($columns_row[DFT_FIELD] == $column_name) {\n \t\t\t$column_row_arr = $columns_row;\n \t\t\tbreak; // column name is found in meta data \n \t\t}\n \t}\n }\n\treturn $column_row_arr;\n}",
"public function getCategory()\n {\n\t\treturn self::$categories[ $this->category ];\n }",
"function get_category($type_code=''){\n\t\t\t$this->db->select('category.*,type.name as type_name');\n\t\t\t$this->db->from('category');\n\t\t\t$this->db->join('type','category.type_code=type.code');\n\t\t\t$this->db->where('category.type_code',$type_code);\n\t\t\treturn $this->db->get()->result();\n\t\t}",
"public function category() {\n\t\treturn $this->get_category();\n\t}",
"public function getProduct_category () {\n\t$preValue = $this->preGetValue(\"product_category\"); \n\tif($preValue !== null && !\\Pimcore::inAdmin()) { \n\t\treturn $preValue;\n\t}\n\t$data = $this->getClass()->getFieldDefinition(\"product_category\")->preGetData($this);\n\treturn $data;\n}",
"public function fetch_complaint_type_desc($CM_COMPLAINT_TYPE){\n\t\t$this->db->select('CC_NAME');\n\t\t$this->db->where('CC_NO',$CM_COMPLAINT_TYPE);\n\t\t$query = $this->db->get('COMPLAINT_CATEGORY');\n \t\t$row = $query->row();\n\t\tif (isset($row))\n\t\t return $row->CC_NAME;\n\t}",
"function getChoiceCategoryType(){\n\n\t\t$query = $this->db->get('tbl_choice_category_type');\n\t\treturn $query->result();\n\t}",
"public static function getCategory()\n {\n return self::$category;\n }",
"function category(){\n\t\trequire('quizrooDB.php');\n\t\t$query = sprintf(\"SELECT cat_name FROM q_quiz_cat WHERE cat_id = %d\", GetSQLValueString($this->fk_quiz_cat, \"int\"));\n\t\t$getQuery = mysql_query($query, $quizroo) or die(mysql_error());\n\t\t$row_getQuery = mysql_fetch_assoc($getQuery);\n\t\treturn $row_getQuery['cat_name'];\n\t}",
"public function getCategory($name);",
"public function category() {\n\t\treturn static::get_thrive_advanced_label();\n\t}",
"public function getCategory()\n\t{\n\t\treturn $this->data['category'];\n\t}",
"public function fetchCategoriesName() {\n $sql = \"SELECT id, category FROM category\";\n return $this->getAllColumns($sql, 'id');\n }",
"public static function categorize_column($string) {\n if (preg_match('/^LEVEL[0-9]+$/i', $string)) {\n return 1; // level\n } elseif (self::is_date($string)) {\n return 0; // timepoint\n } else {\n return -1; // metadata\n }\n }",
"public function getCat()\n {\n $query = $this->db->get('categories');\n\n return $query->result();\n }",
"public function get_category_detail($column_name = 'id', $value)\n {\n\n if ($column_name === 'id') {\n $term = Category::find($value);\n } else {\n $term = Category::where($column_name, $value)->limit(1)->first();\n }\n\n return $term;\n }",
"public function get_cat_name() {\n $c = $this->cat;\n $tmp = \"\";\n switch($c) {\n case 1:\n $tmp = \"News\";\n break;\n case 2:\n $tmp = \"Eventi\";\n break;\n case 3:\n $tmp = \"Pubblicazioni\";\n break;\n }\n return $tmp;\n }",
"function getCategory() {\n // Load categories.\n $categories = userpoints_get_categories();\n return isset($categories[$this->getTid()]) ? $categories[$this->getTid()] : $categories[userpoints_get_default_tid()];\n }",
"function vcex_get_post_type_cat_tax( $post_type = '' ) {\n\tif ( function_exists( 'wpex_get_post_type_cat_tax' ) ) {\n\t\treturn wpex_get_post_type_cat_tax( $post_type );\n\t}\n\n\tif ( ! $post_type ) {\n\t\t$post_type = get_post_type();\n\t}\n\n\tswitch ( $post_type ) {\n\t\tcase 'post':\n\t\t\t$tax = 'category';\n\t\t\tbreak;\n\t\tcase 'portfolio':\n\t\t\t$tax = 'portfolio_category';\n\t\t\tbreak;\n\t\tcase 'staff':\n\t\t\t$tax = 'staff_category';\n\t\t\tbreak;\n\t\tcase 'testimonials':\n\t\t\t$tax = 'testimonials_category';\n\t\t\tbreak;\n\t\tdefault:\n\t\t\t$tax = '';\n\t}\n\n\t/**\n\t * Filters the post type category taxonomy name.\n\t *\n\t * @param string $tax\n\t */\n\t$tax = (string) apply_filters( 'wpex_get_post_type_cat_tax', $tax, $post_type );\n\n\treturn $tax;\n}",
"public function get_category_type()\n {\n return C__CMDB__CATEGORY__TYPE_GLOBAL;\n }",
"public function get_category_type()\n {\n return C__CMDB__CATEGORY__TYPE_GLOBAL;\n }",
"public function get_category_type()\n {\n return C__CMDB__CATEGORY__TYPE_GLOBAL;\n }",
"public function get_category_type()\n {\n return C__CMDB__CATEGORY__TYPE_GLOBAL;\n }",
"public function getCategory();"
] |
[
"0.6457734",
"0.6379305",
"0.6168145",
"0.6022669",
"0.6014673",
"0.6008629",
"0.5989536",
"0.5978963",
"0.5950525",
"0.5927305",
"0.5905874",
"0.5893543",
"0.58657724",
"0.5853428",
"0.5843605",
"0.5810279",
"0.57974505",
"0.5795899",
"0.5791327",
"0.57889146",
"0.57365704",
"0.5731705",
"0.5715836",
"0.5703732",
"0.56601137",
"0.5651006",
"0.5651006",
"0.5651006",
"0.5651006",
"0.56488824"
] |
0.7468524
|
0
|
Returns true if the column type is numeric.
|
public static function isNumeric($type) {
foreach (static::getColumns() as $category => $columns) {
foreach ($columns as $columnType) {
if ($columnType === $type) {
return $category == 'numeric';
}
}
}
return false;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function isNumericType()\n {\n return PropelTypes::isNumericType($this->getType());\n }",
"public function getIsNumeric() {\n $numerics = array(\"float\", \"integer\", \"int\");\n return is_numeric(array_search($this->getType(), $numerics));\n }",
"public function isNumeric()\n {\n return is_numeric($this->value);\n }",
"public function isNumeric();",
"public static function isDbTypeNumeric($db_type)\n {\n if ($db_type == 'int' || $db_type == 'double' || $db_type == 'smallint' || $db_type == 'tinyint') {\n return true;\n }\n\n return false;\n }",
"public function isNumericType($type)\n {\n return DataTypes::isNumericType($type);\n }",
"public function isNumeric()\n {\n return (1 == $this->_numeric);\n }",
"protected function is_numeric( $data_type ) {\n\t\t\treturn ( 'number' === WPDA::get_type( $data_type ) );\n\t\t}",
"public function isNumeric()\n {\n if ($this->isEmpty()) {\n return false;\n }\n\n foreach ($this->getKeys() as $key) {\n if (!is_int($key)) {\n return false;\n }\n }\n\n return true;\n }",
"private function isNumeric()\n {\n foreach (array_keys($this->options) as $key) {\n if (!is_int($key)) {\n return false;\n }\n }\n\n return true;\n }",
"public function isNum(): bool\n {\n return \\wasm_valtype_is_num($this->inner);\n }",
"function isNumeric ($s) {\r\n return is_numeric($s);\r\n }",
"function isNumeric ($value)\r\n{\r\n\treturn is_numeric ($value);\r\n}",
"public function isPhpPrimitiveNumericType()\n {\n return PropelTypes::isPhpPrimitiveNumericType($this->getPhpType());\n }",
"public function isFieldNumericType(Field $field)\n {\n if ($field->getType()) {\n return DataTypes::isNumericType($field->getType());\n }\n\n return $this->getSource()->isNumericType($field->getDataType());\n }",
"function isNum($s){return is_numeric($s) ? true : false;}",
"function isNumber ($value)\r\n{\r\n\treturn is_double ($value);\r\n}",
"private function process_numeric($value)\n {\n return is_numeric($value);\n }",
"public function isNumeric($field) {\n\t\treturn (is_numeric($_POST[$field['name']]));\n\t}",
"public function isnumeric($amount){\n\t\tif(!empty($amount) && !is_numeric($amount)){ \n\t\t\treturn true;\n\t\t}\n }",
"public function isnumeric($amount){\n\t\tif(!empty($amount) && !is_numeric($amount)){ \n\t\t\treturn true;\n\t\t}\n\t}",
"public function number($value): bool\n {\n return is_numeric($value);\n }",
"static function is_numeric($array){\n\t\tforeach($array as $k=>$v){\n\t\t\tif(!is_int($k)){\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}",
"public static function isNumeric($n) {\n if (is_numeric($n))\n return true;\n else\n return false;\n }",
"function isNumericType($type)\n{\n return(eregi('int',$type) or $type==\"real\" or $type==\"float\" or $type==\"double\" or $type==\"decimal\");\n}",
"function est_entier($valeur): bool {\n return is_numeric($valeur);\n}",
"private function isNumericArray($array) {\n foreach ($array as $a => $b) {\n if (!is_int($a)) {\n return false;\n }\n }\n\n return true;\n }",
"public static function isNumeric($value)\n {\n $value = strval($value);\n if (preg_match('/^[-+.]?\\d+/', $value))\n return true;\n else\n return false;\n }",
"static public function isNumeric($value)\n {\n return (preg_match('#^[0-9]+$#', (string)$value) === 1);\n }",
"public function validate_numeric($param) {\n return is_numeric($param);\n }"
] |
[
"0.8315964",
"0.7860035",
"0.7836113",
"0.7780998",
"0.77245474",
"0.77174217",
"0.76333416",
"0.7574416",
"0.7382834",
"0.7369741",
"0.6885642",
"0.67460024",
"0.67167914",
"0.6701593",
"0.6645853",
"0.66162807",
"0.64955556",
"0.6483195",
"0.64769495",
"0.6441551",
"0.6420557",
"0.6419996",
"0.6411592",
"0.63310593",
"0.6275405",
"0.6238505",
"0.619048",
"0.6184108",
"0.6119733",
"0.61114067"
] |
0.8054228
|
1
|
Returns true if the column type is a variablelength string of some kind.
|
public static function isVariableLength($type) {
return ($type == 'char' || $type == 'string' || $type == 'varbinary');
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"private function isVariableLengthType($type) {\n $types = [\n 'nvarchar' => TRUE,\n 'ntext' => TRUE,\n 'varchar' => TRUE,\n 'varbinary' => TRUE,\n 'image' => TRUE,\n ];\n return isset($types[$type]);\n }",
"public function supportsVarcharWithoutSize();",
"public function getIsString() {\n return $this->getType() == \"string\";\n }",
"public function isString(): bool\n {\n return $this->phpType === self::STRING;\n }",
"public function hasLength(): bool;",
"public function isString()\n {\n return \\is_string($this->value);\n }",
"private function canBeStored(string $value): bool\n {\n return strlen($value) <= 255;\n }",
"protected function is_length($type) {\r\n if (isset($this->types[$type]['length']))\r\n return $this->types[$type]['length'];\r\n return false;\r\n }",
"public function hasStringField()\n {\n return $this->get(self::STRING_FIELD) !== null;\n }",
"function has_length_exactly( $value, $exact ) {\n $length = strlen( $value );\n return $length == $exact;\n}",
"function has_length_exactly($value, $exact) {\r\n $length = strlen($value);\r\n return $length == $exact;\r\n}",
"public function hasStringValue(){\n return $this->_has(3);\n }",
"public function isValueString() {\n\t\treturn $this->isValueString;\n\t}",
"function is_stringable($var): bool\n {\n if (is_array($var)) {\n try {\n return (bool)array_to_string($var);\n } catch (LogicException $e) {\n return false;\n }\n }\n\n return !is_null($var) && (is_scalar($var) || method_exists($var, '__toString'));\n }",
"function has_length_exactly($value, $exact) {\n $length = strlen($value);\n return $length == $exact;\n}",
"function isStringify($var)\n {\n return ( (!is_array($var)) && (\n (!is_object($var) && @settype($var, 'string') !== false) ||\n (is_object($var) && method_exists($var, '__toString' ))\n ));\n }",
"protected function typeString(Fluent $column)\n {\n return 'varchar';\n }",
"protected function type_string(Magic $column)\n {\n return 'VARCHAR(' . $column->length . ')';\n }",
"protected function type_string(Magic $column)\n {\n return 'VARCHAR';\n }",
"function has_max_length($value, $max) {\r\n\treturn strlen($value) <= $max;\r\n}",
"public function hasStringValue(){\n return $this->_has(1);\n }",
"public static function isLength($var, $length) {\n\n if (is_array($var)) {\n return count($var) == $length;\n\n }\n else {\n return strlen($var) == $length;\n\n }\n\n }",
"public function hasVariableType() {\n return $this->_has(4);\n }",
"public function hasVariableType() {\n return $this->_has(4);\n }",
"protected function typeString(Magic $column)\n {\n return 'VARCHAR';\n }",
"public function hasLen()\n {\n return $this->get(self::LEN) !== null;\n }",
"function has_max_length($value, $max) {\n\treturn strlen($value) <= $max;\n}",
"function has_max_length($value, $max) {\n\treturn strlen($value) <= $max;\n}",
"public function testDataTypeWithLengthSpecified()\n {\n $tableName = 'ramp_tabletest1';\n $table = new Application_Model_DbTable_Table($tableName);\n $metaInfo = $table->info(Zend_Db_Table_Abstract::METADATA);\n $whichField = 'name';\n\n $field = new Application_Model_Field($whichField, array(),\n $metaInfo[$whichField]);\n\n $this->assertTrue($field->isInTable());\n $this->assertTrue($field->isInDB());\n $this->assertFalse($field->isEnum());\n $this->assertSame(\"varchar\", $field->getDataType());\n $this->assertSame(\"100\", $field->getLength());\n $this->_assertWholelyLocal($field);\n $this->_assertMetaInfoValues($tableName, $whichField, $field);\n }",
"public static function is_string_of_length($value, $min_length = 0, $max_length = -1) {\r\n\t\tif (is_null($value)) {\r\n\t\t\t$value = '';\r\n\t\t}\r\n\t\t$ret = is_string($value);\r\n\t\tif ($ret) {\r\n\t\t\t$ret = $ret && ( GyroString::length($value) >= $min_length);\r\n\t\t\tif ($max_length > 0) {\r\n\t\t\t\t$ret = $ret && ( GyroString::length($value) <= $max_length); \r\n\t\t\t} \r\n\t\t}\r\n\t\treturn $ret;\r\n\t}"
] |
[
"0.769176",
"0.6732441",
"0.6483562",
"0.64379513",
"0.6245261",
"0.61399895",
"0.6084246",
"0.60545033",
"0.60292286",
"0.59807783",
"0.5966519",
"0.595777",
"0.59317267",
"0.59146625",
"0.5890587",
"0.5887303",
"0.58830994",
"0.58511865",
"0.58499676",
"0.5834758",
"0.58009624",
"0.5795366",
"0.57773894",
"0.57773894",
"0.5769682",
"0.5765373",
"0.57353985",
"0.57353985",
"0.5727563",
"0.5725791"
] |
0.76214814
|
1
|
Gets the SQL key statement for a given type (primary, index, unique, foreign).
|
public static function getKey($type) {
$type = strtolower(str_replace('drop', '', $type));
if ($type === 'primary') return 'PRIMARY KEY';
if ($type === 'index') return 'INDEX';
if ($type === 'unique') return 'UNIQUE';
return 'FOREIGN KEY';
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function key($sql);",
"abstract public static function get_column_key(): string;",
"public function getKeyType();",
"protected function key(Table $table, Magic $command, $type)\n {\n return 'ALTER TABLE ' . $this->wrap($table) . ' ADD ' . $type . ' '\n . $command->name . '(' . $this->columnize($command->columns) . ')';\n }",
"function generateKey($id, $type);",
"protected function get_key( $lock_type ) {\n\t\treturn sprintf( 'action_scheduler_lock_%s', $lock_type );\n\t}",
"public static function primaryKey() {\n return (new static)->getKeyName();\n }",
"public function key()\n\t{\n\t\tif (empty($this->key) && !empty($this->definition->primary))\n\t\t{\n\t\t\t$keys = array_values(\n\t\t\t\tarray_filter(\n\t\t\t\t\tpreg_split('~[\\s,]+~', $this->definition->primary)\n\t\t\t\t)\n\t\t\t);\n\t\t\t$keys = array_map(\n\t\t\t\tfunction ($key) {\n\t\t\t\t\treturn Normalise::toVariable($key);\n\t\t\t\t},\n\t\t\t\t$keys\n\t\t\t);\n\n\t\t\t$this->key = count($keys) > 1 ? $keys : array_shift($keys);\n\t\t}\n\n\t\tif (empty($this->key) && $this->has('id'))\n\t\t{\n\t\t\t$this->key = 'id';\n\t\t}\n\n\t\treturn $this->key;\n\t}",
"private function pk_column(){\n\t\tif( in_array(static::$table_name, Model_Kiwi::$composite_key_tables) ){\n\t\t\treturn \"composite_key\";\n\t\t}\n\t\t//if the primary key of the table has been defined in config - return that else use convention\n\t\tif( in_array( static::$table_name, array_keys(Model_Kiwi::$kiwi_pk_hash))){\n\t\t\treturn Model_Kiwi::$kiwi_pk_hash[ static::$table_name ];\n\t\t}\n\t\treturn Model_Kiwi::singularize(static::$table_name) . '_id';\n\t}",
"public function getKeyType()\n {\n return $this->keyType;\n }",
"private final function sqlKey($key)\n {\n return SSql::escape(self::propertyToDbName($key), self::getSSqlName($this->setup_name));\n }",
"public function get_key_type() {\n return 0;\n }",
"protected function getKeyType($constraintType)\n {\n switch ($constraintType) {\n case 'PRIMARY KEY':\n return ObjectModel::PRIMARY_KEY;\n case 'UNIQUE':\n return ObjectModel::UNIQUE_KEY;\n case 'FOREIGN KEY':\n return ObjectModel::FOREIGN_KEY;\n default:\n return ObjectModel::KEY;\n }\n }",
"public function getKeyType(): string\n {\n return 'string';\n }",
"protected function getPrimaryKeyName(): string\n {\n return $this->query->getModel()->getKeyName();\n }",
"public function keyType(): ?string;",
"protected function getKeyTableConstraintNameKeyword()\n\t{\n\t\t$constraint = $this->getConstraint();\n\n\t\tif ($constraint instanceof PrimaryKeyTableConstraint)\n\t\t{\n\t\t\t$table = $this->getTable();\n\t\t\tforeach ($constraint->getColumns() as $column)\n\t\t\t{\n\t\t\t\tif (!($column instanceof ColumnDescriptionInterface))\n\t\t\t\t\t$column = $table->getColumns()->get($column);\n\t\t\t\tif ($column->has(K::COLUMN_FLAGS))\n\t\t\t\t{\n\t\t\t\t\tif ($column->get(K::COLUMN_FLAGS) &\n\t\t\t\t\t\tK::COLUMN_FLAG_AUTO_INCREMENT)\n\t\t\t\t\t\treturn 'unique';\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn parent::getKeyTableConstraintNameKeyword();\n\t}",
"public function getKeyField()\n {\n $class = get_class($this);\n $parts = explode('\\\\', $class);\n $name = $parts[count($parts)-1];\n return strtolower($name) . '_id';\n }",
"private static function genPrimaryKeyWhereClause() {\n return \"WHERE \" . self::ID_KEY . \"=\" . self::transformForPreparedStatement(self::ID_KEY);\n }",
"public function generate()\n {\n $sql = new Str();\n $sql->append('`' . $this->key . '`')\n ->append(' INT');\n\n if(!is_null($this->length))\n {\n $sql->append('(' . $this->length . ')');\n }\n\n if($this->unsigned)\n {\n $sql->append(' UNSIGNED');\n }\n\n if($this->not_null)\n {\n $sql->append(' NOT NULL');\n }\n\n if($this->autoincrement)\n {\n $sql->append(' AUTO_INCREMENT');\n }\n\n if($this->primary_key)\n {\n $sql->append(' PRIMARY KEY');\n }\n\n return $sql->get();\n }",
"public function getSql()\n {\n $columns = implode(\", \", $this->columns);\n\n $result = \"\";\n $result = \"CONSTRAINT $this->name \\n\\t\\tPRIMARY KEY ( \\n\\t\\t\\t$columns \\n\\t\\t)\";\n\n return $result;\n }",
"public function getSQLDefinition()\n {\n // Index columns are always of the same type\n if ($this->columnName == IESDataColumnType::INDEX_COLUMN_NAME) {\n return \"{$this->columnName} INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY\";\n }\n\n $type = \"\";\n $nullSuffix = $this->nullable ? \"NULL\" : \"NOT NULL\";\n\n if ($this->dataType == IESDataColumnType::STRING) {\n $type = \"VARCHAR({$this->getColumnLength()})\";\n } else if ($this->dataType == IESDataColumnType::BOOLEAN) {\n $type = \"BIT\";\n } else if ($this->dataType == IESDataColumnType::FLOAT) {\n $type = \"DECIMAL(13,4)\";\n } else if ($this->dataType == IESDataColumnType::INTEGER) {\n $subType = $this->getIntegerSubType();\n\n if ($subType == IESDataColumnIntegerTypes::SIGNED_BYTE)\n $type = \"TINYINT SIGNED\";\n else if ($subType == IESDataColumnIntegerTypes::SIGNED_SHORT)\n $type = \"SMALLINT SIGNED\";\n else if ($subType == IESDataColumnIntegerTypes::SIGNED_INTEGER)\n $type = \"INTEGER SIGNED\";\n else if ($subType == IESDataColumnIntegerTypes::SIGNED_LONG)\n $type = \"BIGINT SIGNED\";\n else if ($subType == IESDataColumnIntegerTypes::UNSIGNED_BYTE)\n $type = \"TINYINT UNSIGNED\";\n else if ($subType == IESDataColumnIntegerTypes::UNSIGNED_SHORT)\n $type = \"SMALLINT UNSIGNED\";\n else if ($subType == IESDataColumnIntegerTypes::UNSIGNED_INTEGER)\n $type = \"INTEGER UNSIGNED\";\n else if ($subType == IESDataColumnIntegerTypes::UNSIGNED_LONG)\n $type = \"BIGINT UNSIGNED\";\n }\n\n return \"`{$this->columnName}` {$type} {$nullSuffix}\";\n }",
"function primary_key()\r\n\t{\r\n\t\treturn 'key';\r\n\t}",
"public function key()\n {\n throw new PDOException('key() method is not implemented for Oci8PDO_Statement');\n }",
"function getPKType($table)\n{\n $field_list = getTableFields($table);\n foreach($field_list as $f) {\n if ($f['Key' == 'PRI']) {\n return $f['Type'];\n }\n }\n return \"\";\n}",
"public function getPrimaryKey()\n\t{\n $indexes = $this->getIndexes();\n\n foreach ($indexes as $index){\n if ($index['Key_name'] == \"PRIMARY\"){\n return $index;\n }\n }\n\n \t\t\n\t}",
"public function getKey(): string {\n return $this->getType() . $this->getId() . $this->getLang() . $this->getRevisionId() ?? '';\n }",
"public function key()\n\t{\n\t\treturn $this->datasource->key();\n\t}",
"public function getKeyType()\n {\n return 'string';\n }",
"public function getKeyType()\n {\n return 'string';\n }"
] |
[
"0.71035993",
"0.628179",
"0.62336385",
"0.61148244",
"0.6080039",
"0.6023662",
"0.6014099",
"0.6009108",
"0.5984038",
"0.59428936",
"0.58642584",
"0.58292806",
"0.5819313",
"0.5816611",
"0.5811589",
"0.5790188",
"0.5779277",
"0.57571805",
"0.57498467",
"0.57401025",
"0.5734521",
"0.57012707",
"0.56707734",
"0.5666803",
"0.5666243",
"0.5648245",
"0.5637918",
"0.56327546",
"0.5625456",
"0.5625456"
] |
0.743866
|
0
|
Before setting, we check if the name is filled and/or already exists. Also checkboxes.
|
public function beforeSet() {
$name = $this->getProperty('name');
if (empty($name)) {
$this->addFieldError('name',$this->modx->lexicon('required'));
}
$test = $this->getProperty('test');
if (empty($test)) {
$this->addFieldError('name','Required parameter test is not specified.');
}
$testObject = $this->modx->getObject('sabTest', $test);
if (!$testObject) {
$this->addFieldError('name','Parent test not found.');
}
$element = $this->getProperty('element');
$elementType = $testObject->get('type');
$elementObj = $this->modx->getObject($elementType, $element);
if (!$elementObj) {
$this->addFieldError('element', 'Element does not exist.');
}
/* Set checkbox */
$this->setCheckbox('active', true);
return parent::beforeSet();
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function _putSetCheckField($name){\n\t\tif(!isset($this->pkeyID) || isset($this->rc4key)) return;\n\t\techo \"<input type=\\\"hidden\\\" name=\\\"formitable_setcheck[]\\\" value=\\\"$name\\\"/>\\n\\n\";\n\t}",
"public function fill_fields() {\n if (isset($this->id) && isset($this->name)) {\n /* already filled */\n return true;\n } else if (isset($this->id)) {\n $stmt = $this->pdo->prepare(\"select name from $this->table where id = :id\");\n $stmt->bindValue(':id', $this->id);\n $stmt->execute();\n $res = $stmt->fetchAll();\n if (count($res) != 1) {\n return false;\n } else {\n $this->name = $res[0][0];\n return true;\n }\n } else if (isset($this->name)) {\n $stmt = $this->pdo->prepare(\"select id from $this->table where name = :name\");\n $stmt->bindValue(':name', $this->name);\n $stmt->execute();\n $res = $stmt->fetchAll();\n if (count($res) != 1) {\n return false;\n } else {\n $this->id = $res[0][0];\n return true;\n }\n } else {\n return false;\n }\n }",
"function __isset($name){\n\t\treturn false;\n\t\t$is_empty=true;\n\t\tforeach ($this as $key => $value) {\n\t\t\tif(!empty($value)){\n\t\t\t\t$is_empty = false;\n\t\t\t\ttrigger_error(\"Not Empty: [\".$key.\"]\".$value.\"\", E_USER_WARNING);\n\t\t\t}else{\n\t\t\t\ttrigger_error(\"Empty: [\".$key.\"]\".$value.\"\", E_USER_WARNING);\n\t\t\t}\n\t\t}\n\t\tif($is_empty){\n\t\t\treturn false;\n\t\t}else{\n\t\t\treturn true;\n\t\t}\n\t}",
"public function beforeSet()\n {\n $name = trim($this->getProperty('name'));\n if (empty($name)) {\n $this->modx->error->addField('name', $this->modx->lexicon('vueextra_item_err_name'));\n } elseif ($this->modx->getCount($this->classKey, ['name' => $name])) {\n $this->modx->error->addField('name', $this->modx->lexicon('vueextra_item_err_ae'));\n }\n\n return parent::beforeSet();\n }",
"public function checkInputExists($name);",
"private function __validate_name() {\n if (isset($this->initial_data[\"name\"])) {\n if ($this->get_limiter_id_by_name($this->initial_data[\"name\"], true)) {\n $this->parent_id = $this->get_limiter_id_by_name($this->initial_data[\"name\"]);\n } else {\n $this->errors[] = APIResponse\\get(4209);\n }\n } else {\n $this->errors[] = APIResponse\\get(4167);\n }\n }",
"function set_CheckedValue($name)\n {\n if (isset($_POST[$name]) && $_POST[$name] == \"Include\") {\n return 1;\n }\n return 0;\n }",
"public function valid()\n {\n return !empty($this->name);\n }",
"final protected\tfunction\thasName($name)\n\t\t{\n\t\t\t$this->_name\t=\t$name;\n\t\t}",
"final protected\tfunction\thasName($name)\n\t\t{\n\t\t\t$this->_name\t=\t$name;\n\t\t}",
"public function beforeSave(){\n $existing_flag = false;\n if(!isset($this->data['Voucher']['id'])){\n $this->data['Voucher']['name'] = $this->_detemine_voucher_name(); \n } \n }",
"public function __isset($name)\n\t{\n\t\treturn ( isset( $this->newFields[$name] ) || isset( $this->fields[$name] ) );\n\t}",
"protected function prepareForValidation(): void\n {\n $name = strtoupper(trim((string) $this->get('name')));\n\n $this->merge(compact('name'));\n }",
"private function __validate_name() {\n if (isset($this->initial_data[\"name\"])) {\n if ($this->get_limiter_id_by_name($this->initial_data[\"name\"], true)) {\n $this->id = $this->get_limiter_id_by_name($this->initial_data[\"name\"]);\n } else {\n $this->errors[] = APIResponse\\get(4209);\n }\n } else {\n $this->errors[] = APIResponse\\get(4167);\n }\n }",
"public function __isset($name)\n {\n if (in_array($name, [\n 'display_name',\n 'email',\n ])) {\n return true;\n } else {\n return parent::__isset($name);\n }\n }",
"public function onBeforeSave()\n\t{\n\t\tif ($this->id == NULL && ee('Model')->get('hop_new_relic:Hnp_settings')->filter('name', $this->name)->count() != 0)\n\t\t{\n\t\t\tthrow new \\Exception('Hnp_settings cannot be saved, a setting with that name already exists.');\n\t\t}\n\t}",
"public function validate_required($name)\n\t{\n\t\treturn array_key_exists($name, $this->datas) && $this->datas[$name] != '';\n\t}",
"public function checkControlExists($name);",
"public function checkSetup()\n {\n if ($this->itemType == \"\") {\n die(\"No itemType provided!\");\n }\n if ($this->classPathBase == \"\") {\n die(\"No classPathBase provided!\");\n }\n if ($this->listView == \"\" && empty($this->listNames)) {\n die(\"Provide either a list view OR fields!\");\n }\n if ($this->createView == \"\" && empty($this->editSettings)) {\n die(\"No create view OR editSettings provided!\");\n }\n\n if (! empty($this->editSettings)) {\n $fields = ['label','type'];\n foreach ($this->editSettings as $key => $es) {\n foreach ($fields as $f) {\n if (empty($es[$f])) {\n die(\"An edit parameter - {$f} - is missing or blank in your config for \\\"{$key}\\\".\");\n }\n }\n }\n }\n }",
"public function testMissingParameterAddCheckName() {\n $check = $this->default_check;\n $check['name'] = null;\n $this->pingdom->addCheck($check);\n }",
"function __checkDuplicateName()\n {\n $result = $this->find('first', array('conditions' => array('name' => $this->data[$this->name]['name'])));\n if ($result) {\n $this->errorMessage='Duplicate name found. Please change the name.';\n return false;\n }\n\n return true;\n }",
"function wikia_facebook_validateChooseNameForm( &$specialConnect ){\n\twfProfileIn(__METHOD__);\n\n\t$allowDefault = true;\n\tglobal $wgRequest;\n\t$email = $wgRequest->getVal('wpEmail');\n\tif( ($email == \"\") || (!User::isValidEmailAddr( $email )) ) {\n\t\t$specialConnect->sendPage('chooseNameForm', 'facebook-invalid-email');\n\t\t$allowDefault = false;\n\t}\n\n\twfProfileOut(__METHOD__);\n\treturn $allowDefault;\n}",
"public function setName($name) {\n\t\tif(!empty($name)){\n\t\t\t$this->name = trim($name);\n\t\t} elseif(!empty($_POST['name'])) {\n\t\t\t$this->name = trim($_POST['name']);\n\t\t}\n\t}",
"public function afterValidate() {\n if (empty($_POST['name_en'])) {\n $this->addError('name_en', Yii::t('base', 'You should fill displayed attribute name for at least English language'));\n }\n return parent::afterValidate();\n }",
"public function __isset($name)\n {\n }",
"public function __isset($name)\n {\n }",
"public function __isset($name)\n {\n }",
"public function __isset($name)\n {\n }",
"public function __isset($name)\n {\n }",
"public function __isset($name)\n {\n }"
] |
[
"0.6484913",
"0.64230275",
"0.62466365",
"0.62430656",
"0.61921746",
"0.6178758",
"0.61631763",
"0.61541563",
"0.6118622",
"0.6118622",
"0.6058164",
"0.6039329",
"0.60214317",
"0.60192937",
"0.6005009",
"0.5909454",
"0.5904746",
"0.58916193",
"0.58874726",
"0.588599",
"0.5855734",
"0.58478445",
"0.58451885",
"0.5840465",
"0.5832602",
"0.5832602",
"0.5832602",
"0.5832028",
"0.5832028",
"0.58311194"
] |
0.64966315
|
0
|
Get aggregate for different database operations for order
|
protected function get_database_aggregate()
{
if (!$this->_database_aggregate)
{
require_once DIR_FS_CATALOG . 'includes/modules/payment/payneteasyform/paynet_database_aggregate.php';
$this->_database_aggregate = new PaynetDatabaseAggregate;
}
return $this->_database_aggregate;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getAggregate()\n {\n return $this->aggregate;\n }",
"public function aggregateType();",
"public function aggregate(): void;",
"function testAutoAggregate() \r\n\t{\r\n\t\t$dbh = $this->dbh;\r\n\r\n\t\t// sum\r\n\t\t// ------------------------------------------------------\r\n\t\t$objTask = new CAntObject($dbh, \"task\", null, $this->user);\r\n\t\t$objTask->setValue(\"name\", \"utest - aggregate test\");\r\n\t\t$tid = $objTask->save();\r\n\t\tunset($objTest);\r\n\t\t$objTime1 = new CAntObject($dbh, \"time\", null, $this->user);\r\n\t\t$objTime1->setValue(\"hours\", 1);\r\n\t\t$objTime1->setValue(\"task_id\", $tid);\r\n\t\t$objTime1->save();\r\n\t\t$objTime2 = new CAntObject($dbh, \"time\", null, $this->user);\r\n\t\t$objTime2->setValue(\"task_id\", $tid);\r\n\t\t$objTime2->setValue(\"hours\", 1);\r\n\t\t$objTime2->save();\r\n\r\n\t\t// The task cost_action should be set to 2\r\n\t\t$objTask = new CAntObject($dbh, \"task\", $tid, $this->user);\r\n\t\t//$this->assertEquals($objTask->getValue(\"cost_actual\"), 2); 07/10/2012 Marl - Uncomment this test after fixing the \"Task Time Log\" bug issue\r\n\r\n\t\t// Cleanup\r\n\t\t$objTime1->removeHard();\r\n\t\t$objTime2->removeHard();\r\n\t\t$objTask->removeHard();\r\n\r\n\t\t// avg\r\n\t\t// ------------------------------------------------------\r\n\t\t$objPro = new CAntObject($dbh, \"product\", null, $this->user);\r\n\t\t$objPro->setValue(\"name\", \"ptest - aggregate test\");\r\n\t\t$pid = $objPro->save();\r\n\t\tunset($objTest);\r\n\t\t$objReview1 = new CAntObject($dbh, \"product_review\", null, $this->user);\r\n\t\t$objReview1->setValue(\"rating\", 1);\r\n\t\t$objReview1->setValue(\"product\", $pid);\r\n\t\t$objReview1->save();\r\n\t\t$objReview2 = new CAntObject($dbh, \"product_review\", null, $this->user);\r\n\t\t$objReview2->setValue(\"rating\", 3);\r\n\t\t$objReview2->setValue(\"product\", $pid);\r\n\t\t$objReview2->save();\r\n\r\n\t\t// The product rating should be an avg of 2\r\n\t\t$objPro = new CAntObject($dbh, \"product\", $pid, $this->user);\r\n\t\t//$this->assertEquals($objPro->getValue(\"rating\"), 2); 07/10/2012 Marl - Uncomment this test after fixing the \"Task Time Log\" bug issue\r\n\r\n\t\t// Cleanup\r\n\t\t$objReview1->removeHard();\r\n\t\t$objReview2->removeHard();\r\n\t\t$objPro->removeHard();\r\n\t}",
"public function getAggregations();",
"public function isAggregate();",
"public function GetAggregates(){\n $this->current();\n return $this->aggs;\n }",
"public function aggregateId();",
"public function getAggregateType();",
"public function getOperation()\n {\n $objDataBase = $this->_connectSuperDataBase();\n\n $objDataBase->executeQueryStoreProcedure('get_Operations');\n\n\t $row = $objDataBase->exploreAllArraySelect();\n\n if (!isset($row)) {\n $row[0]['Pk_operation'] = 1;\n $row[0]['name'] = Class_Config::get('operation');\n $row[0]['domain'] = Class_Config::get('domain');\n }\n\t\n\n return $row;\n }",
"public function getColumnAggregationOperations()\n {\n return $this->columnAggregationOperations;\n }",
"public function testAggregateNoOrderByIfNoLimit()\n {\n $query = new SQLSelect();\n $query->setFrom('\"SQLSelectTest_DO\"');\n $query->setOrderBy('Common');\n $query->setLimit([]);\n\n $aggregate = $query->aggregate('MAX(\"ID\")');\n $limit = $aggregate->getLimit();\n $this->assertEquals([], $aggregate->getOrderBy());\n $this->assertEquals([], $limit);\n\n $query = new SQLSelect();\n $query->setFrom('\"SQLSelectTest_DO\"');\n $query->setOrderBy('Common');\n $query->setLimit(2);\n\n $aggregate = $query->aggregate('MAX(\"ID\")');\n $limit = $aggregate->getLimit();\n $this->assertEquals(['Common' => 'ASC'], $aggregate->getOrderBy());\n $this->assertEquals(['start' => 0, 'limit' => 2], $limit);\n }",
"public function getAggregateId()\n {\n }",
"public function allGoods()\n {\n $query = [];\n $unwind = [\n '$unwind' => '$awards',\n ];\n array_push($query, $unwind);\n $groupBy = [\n '$group' => [\n '_id' => '$awards.items.classification.description',\n 'count' => ['$sum' => 1],\n ],\n ];\n array_push($query, $groupBy);\n $result = OcdsRelease::raw(\n function ($collection) use ($query) {\n return $collection->aggregate($query);\n }\n );\n\n return ($result);\n\n }",
"public function getAggregations()\n {\n return Arr::get($this->meta, 'aggregations', []);\n }",
"public function getAggregation()\n {\n return $this->aggregation;\n }",
"public function aggregate($aggregator, $columns)\n\t{\n\t\t// We'll set the aggregate value so the grammar does not try to compile\n\t\t// a SELECT clause on the query. If an aggregator is present, it's own\n\t\t// grammar function will be used to build the SQL syntax.\n\t\t$this->aggregate = compact('aggregator', 'columns');\n\n\t\t$sql = $this->grammar->select($this);\n\n\t\t$result = $this->connection->singleColumn($sql, $this->bindings);\n\n\t\t// Reset the aggregate so more queries can be performed using the same\n\t\t// instance. This is helpful for getting aggregates and then getting\n\t\t// actual results from the query such as during paging.\n\t\t$this->aggregate = null;\n\n\t\treturn $result;\n\t}",
"public function aggregateId(): string;",
"public function getAggregateId()\n {\n return $this->aggregate_id;\n }",
"public function testConvertToEloquentWithAggregates()\n {\n $queryString = 'sum=amount';\n list($eloquentConditions, $aggregates) = $this->parser->parse($queryString)->convertToEloquent();\n $expected = [\n 'function' => 'sum',\n 'field' => 'amount'\n ];\n $this->assertEquals($expected, $aggregates);\n }",
"function summary_query() {\r\n $this->get_query_fields();\r\n \r\n // No way to do summaries on more than one field at a time.\r\n if (count($this->query_fields) > 1) {\r\n return;\r\n }\r\n \r\n $field = $this->query_fields[0]['field'];\r\n $date_handler = $this->query_fields[0]['date_handler'];\r\n \r\n // Get the SQL format for this granularity, like Y-m,\r\n // and use that as the grouping value.\r\n $format = $date_handler->views_formats($this->options['granularity'], 'sql');\r\n $this->formula = $date_handler->sql_format($format, $date_handler->sql_field($field['fullname']));\r\n \r\n // Add the computed field.\r\n $this->base_alias = $this->name_alias = $this->query->add_field(NULL, $this->formula, $field['query_name']);\r\n \r\n return $this->summary_basics(FALSE);\r\n }",
"public function aggregate($function, $columns = ['*'])\n {\n // added orders to ignore...\n $results = $this->cloneWithout(['orders', 'columns'])\n ->cloneWithoutBindings(['select'])\n ->setAggregate($function, $columns)\n ->get($columns);\n\n if (! $results->isEmpty()) {\n return array_change_key_case((array) $results[0])['aggregate'];\n }\n }",
"public function getAggregations()\n {\n return $this->aggregations;\n }",
"public function testOrderByContainingAggregateAndLimitOffset()\n {\n $query = new SQLSelect();\n $query->setSelect(['\"Name\"', '\"Meta\"']);\n $query->setFrom('\"SQLSelectTest_DO\"');\n $query->setOrderBy(['MAX(\"Date\")']);\n $query->setGroupBy(['\"Name\"', '\"Meta\"']);\n $query->setLimit('1', '1');\n\n $records = [];\n foreach ($query->execute() as $record) {\n $records[] = $record;\n }\n\n $this->assertCount(1, $records);\n\n $this->assertEquals('Object 2', $records[0]['Name']);\n $this->assertEquals('2012-05-01 09:00:00', $records['0']['_SortColumn0']);\n }",
"Public Function GetAggregateStats()\n\t{\n\t\t$Temp = $this->GetAllAdwordsStats();\n\t\t$this->AdwordsTotal = $Temp;\n\t\t$this->AddToTotal($Temp);\n\t\t\n\t\t$Temp = $this->GetAllYahooStats();\n\t\t$this->YahooTotal = $Temp;\n\t\t$this->AddToTotal($Temp);\n\t\t\n\t\t$Temp = $this->GetAllMSNStats();\n\t\t$this->MSNTotal = $Temp;\n\t\t$this->AddToTotal($Temp);\n\t}",
"public function getAggregateQuery($conjunction = 'AND') {\n return \\Drupal::service($this->getQueryServiceName())->get($this->entityType, $conjunction);\n }",
"function aggregate_info($object)\n{\n}",
"function aggregate($object, $class_name)\n{\n}",
"public function getRawAggregation()\n {\n return $this->getFreshAggregation();\n }",
"function getAllActiveRecord($column_name,$order){\n\t \t$sql = \"SELECT *,SUM(stage='288') As sum1, SUM(stage='289') As sum2, SUM(stage='291') As sum3, SUM(stage='293') As sum4, COUNT(DISTINCT cand_id) As count2,synonym.parentname As compa, a1.parentname As loca FROM pof LEFT JOIN pof_candidates ON pof.pof_id=pof_candidates.pofid LEFT JOIN synonym ON synonym.s_id=pof.client_id LEFT JOIN synonym As a1 ON a1.s_id=pof.location LEFT JOIN pof_cons ON pof.pof_id=pof_cons.pos_id LEFT JOIN (SELECT * FROM events_tt WHERE is_alloc='1' GROUP BY pof_id) As was ON pof.pof_id=was.pof_id LEFT JOIN allocation ON was.alloc_id=allocation.id LEFT JOIN companies_grade ON pof.grade=companies_grade.gid WHERE (pof.pos_status='wip_urgent' OR pof.pos_status='wip_active') AND pof.is_allocated='1' AND pof.not_pursue='0' GROUP BY pof.pof_id ORDER BY \".$column_name.\" \".$order.\";\";\n\t \t$q = $this->db->query($sql);\n\t\tif($q->num_rows() > 0)\n\t\t{\n\t\t\tforeach($q->result() as $row)\n\t\t\t{\n\t\t\t\t$data[] = $row;\n\t\t\t}\n\t\t\treturn $data;\n\t\t}\n\t\t\n\t}"
] |
[
"0.6446513",
"0.61793935",
"0.6124606",
"0.6105195",
"0.5973641",
"0.5873181",
"0.57432675",
"0.5713687",
"0.5696598",
"0.5511034",
"0.55021685",
"0.5482137",
"0.5465045",
"0.5435647",
"0.5410749",
"0.5398023",
"0.5391063",
"0.53397965",
"0.5296877",
"0.5292283",
"0.52916",
"0.5273774",
"0.5268361",
"0.5259097",
"0.5244143",
"0.52421886",
"0.5240582",
"0.52331084",
"0.52038956",
"0.51595914"
] |
0.61804867
|
1
|
Get aggregate for payment by Paynet
|
protected function get_payment_aggregate()
{
if (!$this->_payment_aggregate)
{
require_once DIR_FS_CATALOG . 'includes/modules/payment/payneteasyform/paynet_payment_aggregate.php';
$this->_payment_aggregate = new PaynetPaymentAggregate;
}
return $this->_payment_aggregate;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"protected function getPaymentAggregate(array $paymentConfig)\r\n {\r\n static $paynetProcessorAggregate = null;\r\n\r\n if (!$paynetProcessorAggregate)\r\n {\r\n $paynetProcessorAggregate = new static::$aggregateClass($paymentConfig);\r\n }\r\n\r\n return $paynetProcessorAggregate;\r\n }",
"public function getActualTotalValues($clientId, $start, $end)\r\n {\r\n /*\r\n WHEN payment_type in (3,6) THEN sum(amount) as payment_sent,\r\n WHEN payment_type in (7) THEN sum(amount) as credit_note_received,\r\n WHEN payment_type in (8) THEN sum(amount) as credit_note_sent,\r\n WHEN payment_type in (9) THEN sum(amount) as ingress_reset,\r\n WHEN payment_type in (11) THEN sum(amount) as debit_note_received,\r\n WHEN payment_type in (12) THEN sum(amount) as debit_note_sent\r\n */\r\n\r\n $sql = <<<SQL\r\nSELECT\r\n(CASE WHEN payment_type in (4,5) THEN sum(amount) END) as payment_received,\r\n(CASE WHEN payment_type in (3,6) THEN sum(amount) END) as payment_sent,\r\n(CASE WHEN payment_type in (7) THEN sum(amount) END) as credit_note_received,\r\n(CASE WHEN payment_type in (8) THEN sum(amount) END) as credit_note_sent,\r\n(CASE WHEN payment_type in (9) THEN sum(amount) END) as ingress_reset,\r\n(CASE WHEN payment_type in (11) THEN sum(amount) END) as debit_note_received,\r\n(CASE WHEN payment_type in (12) THEN sum(amount) END) as debit_note_sent\r\nFROM client_payment\r\nWHERE client_id = {$clientId} AND payment_time BETWEEN '{$start}' AND '{$end}'\r\nGROUP BY payment_type\r\nSQL;\r\n $result = $this->query($sql);\r\n\r\n $startDate = date('Y-m-d', strtotime($start));\r\n $endDate = date('Y-m-d', strtotime($end));\r\n $dateArr = $this->_app_get_date_result_admin($startDate, $endDate, 'cdr_report_detail2%');\r\n $firstSql = '';\r\n $secondSql = '';\r\n\r\n foreach ($dateArr as $value) {\r\n $tableDate = \"cdr_report_detail\" . $value;\r\n $union = \"\";\r\n\r\n if (!empty($firstSql)) {\r\n $union = \" union all \";\r\n }\r\n $firstSql .= \" {$union} SELECT\r\nsum(egress_call_cost) as egress_call_cost\r\nfrom {$tableDate}\r\nwhere report_time between '{$start}' and '{$end}' and egress_client_id = {$clientId}\r\n\";\r\n $secondSql .= \" {$union} SELECT\r\nsum(ingress_call_cost) as ingress_call_cost\r\nfrom {$tableDate}\r\nwhere report_time between '{$start}' and '{$end}' and ingress_client_id = {$clientId}\r\n\";\r\n }\r\n\r\n $sql = <<<SQL\r\nSELECT\r\nsum(egress_call_cost) as egress_call_cost\r\nFROM ({$firstSql}) as t1\r\nSQL;\r\n $res = $this->query($sql);\r\n\r\n if ($res) {\r\n $result[0][0]['egress_call_cost'] = $res[0][0]['egress_call_cost'];\r\n }\r\n $sql = <<<SQL\r\nSELECT\r\nsum(ingress_call_cost) as ingress_call_cost\r\nFROM ({$secondSql}) as t1\r\nSQL;\r\n $res = $this->query($sql);\r\n\r\n if ($res) {\r\n $result[0][0]['ingress_call_cost'] = $res[0][0]['ingress_call_cost'];\r\n }\r\n\r\n return $result;\r\n }",
"public function paymentReport($payments, $type, $limit = 7)\n {\n $paymentTotal = null;\n switch ($type) {\n case 1:\n $paymentTotal = $this->getPaymentTotal($payments->get());\n break;\n case 2:\n $total = array();\n $periods = CarbonPeriod::create(Carbon::now()->subdays($limit), Carbon::now());\n if (isset($periods)) {\n foreach ($periods as $period) {\n $period_payments = $payments->whereDate('created_at', $period)->get();\n $total[$period->toFormattedDateString()] = $this->getPaymentTotal($period_payments);\n }\n $paymentTotal = $total;\n break;\n }\n case 3:\n $total = array();\n $payment_ids = $payments->pluck('id')->toArray();\n $year = isset($payment_ids) ? (count($payment_ids) > 0 ? Payment::find($payment_ids[0])->created_at->year : Carbon::now()->year) : Carbon::now()->year;\n foreach (range(1, 12) as $month) {\n $total[Carbon::create($year, $month, 1)->format('F')] = $this->getPaymentTotal(Payment::whereIn('id', $payment_ids)->whereMonth('created_at', $month)->get());\n }\n $paymentTotal = $total;\n break;\n case 4:\n $current_year = Carbon::now()->year;\n $payment_ids = $payments->pluck('id')->toArray();\n foreach (range(($current_year - $limit), ($current_year + $limit)) as $year) {\n $year_payments = Payment::whereIn('id', $payment_ids)->whereYear('created_at', $year)->get();\n $total[$year] = $this->getPaymentTotal($year_payments);\n }\n $paymentTotal = $total;\n break;\n default:\n $paymentTotal = $this->getPaymentTotal($payments->get());\n break;\n }\n return $paymentTotal;\n }",
"abstract public function getPaymentConfig($payment);",
"protected function get_database_aggregate()\n {\n if (!$this->_database_aggregate)\n {\n require_once DIR_FS_CATALOG . 'includes/modules/payment/payneteasyform/paynet_database_aggregate.php';\n $this->_database_aggregate = new PaynetDatabaseAggregate;\n }\n\n return $this->_database_aggregate;\n }",
"function get_sale_grouplastby_ccode($lastmonthdate) {\r\n\tglobal $db;\r\n\t$M_R_query=\"SELECT merchants.currency_code, YEAR(transaction_alipay.trans_datetime) AS year, MONTH(transaction_alipay.trans_datetime) AS month, COUNT(DISTINCT transaction_alipay.id_transaction_id) AS transcount, SUM(transaction_alipay.total_fee) AS transamount FROM merchants JOIN transaction_alipay ON transaction_alipay.merchant_id = merchants.mer_map_id AND transaction_alipay.transaction_type IN ('1','s1') AND transaction_alipay.result_code='SUCCESS' AND transaction_alipay.trade_status='TRADE_SUCCESS' AND MONTH(transaction_alipay.trans_datetime) = MONTH('$lastmonthdate') GROUP BY year, month, merchants.currency_code\";\r\n\t$transactionsDetails = $db->rawQuery($M_R_query);\r\n\treturn $transactionsDetails;\t\r\n}",
"protected function getAggregateRootClass()\n {\n return PaymentAggregate::class;\n }",
"abstract public function getPaymentDrivers();",
"function get_tax_cash_summary($from, $to)\n{\n\n $sql = \"SELECT SUM(gross_output) gross_output,\n SUM(net_output) net_output,\n SUM(payable) payable,\n SUM(gross_input) gross_input,\n SUM(net_input) net_input,\n SUM(collectible) collectible,\n rate,\n id,\n name\n FROM (\".tax_cash_sql($from, $to).\") taxrec\n GROUP BY id, name, rate\";\n//display_error($sql);\n return db_query($sql,\"Cannot retrieve tax summary\");\n}",
"function get_sale_groupby_ccode($currentdate) {\r\n\tglobal $db;\r\n\t$M_R_query=\"SELECT merchants.currency_code, YEAR(transaction_alipay.trans_datetime) AS year, MONTH(transaction_alipay.trans_datetime) AS month, COUNT(DISTINCT transaction_alipay.id_transaction_id) AS transcount, SUM(transaction_alipay.total_fee) AS transamount FROM merchants JOIN transaction_alipay ON transaction_alipay.merchant_id = merchants.mer_map_id AND transaction_alipay.transaction_type IN ('1','s1') AND transaction_alipay.result_code='SUCCESS' AND transaction_alipay.trade_status='TRADE_SUCCESS' AND MONTH(transaction_alipay.trans_datetime) = MONTH('$currentdate') GROUP BY year, month, merchants.currency_code\";\r\n\t$transactionsDetails = $db->rawQuery($M_R_query);\r\n\treturn $transactionsDetails;\t\r\n}",
"public function prepareSummaryRecord($type = 'overall')\r\r\n {\r\r\n $payments = [];\r\r\n if ($type == 'online') {\r\r\n $payments['all'] = $this->getRecordsCount('online');\r\r\n $payments['success'] = $this->getRecordsCount('online', 'success');\r\r\n $payments['cancelled'] = $this->getRecordsCount('online', 'cancelled');\r\r\n $payments['pending'] = $this->getRecordsCount('online', 'pending');\r\r\n } else if ($type == 'offline') {\r\r\n $payments['all'] = $this->getRecordsCount('offline');\r\r\n $payments['success'] = $this->getRecordsCount('offline', 'success');\r\r\n $payments['cancelled'] = $this->getRecordsCount('offline', 'cancelled');\r\r\n $payments['pending'] = $this->getRecordsCount('offline', 'pending');\r\r\n }\r\r\n return $payments;\r\r\n }",
"public function returnPaymentType($start_date,$end_date){\n\t\t$mcoCash = new Application_Model_DbTable_McoCash();\n\t\t$select = $mcoCash->select()->setIntegrityCheck(false);\n\t\t$select ->from(array(\"mc\" => \"mco_cash\"), array('type','amount' => new Zend_Db_Expr('SUM(amount)'),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'full_composition' => new Zend_Db_Expr('CAST(SUM(value*amount) as DECIMAL(11,3))'),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'liquid_composition' => new Zend_Db_Expr('(SUM(CASE\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t WHEN type = \"IOM\" THEN \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t CAST((((value- 1.449)*amount)-(((value- 1.449)*amount)*0.0037)) as DECIMAL(11,2))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t WHEN type = \"IMO\" THEN \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t CAST((((value- 1.449)*amount)-(((value- 1.449)*amount)*0.0037)) as DECIMAL(11,2))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t ELSE CAST((value*amount)-((value*amount)*0.0037) as DECIMAL(11,2)) END))'),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'cbtu_transfer' => new Zend_Db_Expr('SUM(CASE \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t WHEN type = \"IOM\" THEN CAST(1.449*amount as DECIMAL(11,2))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t WHEN type = \"IMO\" THEN CAST(1.449*amount as DECIMAL(11,2))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t ELSE 0 END)')))\n\t\t->joinInner(array('m' => 'mco'), 'm.id=mc.mco_id')\n\t\t->where('date_operation >= ?', Application_Model_General::dateToUs($start_date))\n\t\t->where('date_operation <= ?', Application_Model_General::dateToUs($end_date))\n\t\t->where('status=1')\n\t\t->group('type');\n\t\treturn $mcoCash->fetchAll($select);\n\t}",
"private function getPayum()\n {\n return $this->get('payum');\n }",
"function payment() {\n\t\t$url = 'https://www.instawallet.org/api/v1/w/' . $wallet_id . '/payment';\n\t\t$json = file_get_contents($url);\n\t\treturn json_decode($json);\n\t}",
"public function get_pay($params) {\n }",
"public function toArray($request)\n {\n $user_id = $this->user_id;\n \n $totalPl = Statement::where('user_id',$user_id)->where('plan_id',$this->plan_id)->where('is_pay',0)->sum('pl');\n $totalInvested = Order::where('user_id',$user_id)->where('plan_id',$this->plan_id)->where('type',1)->sum('amount');\n $total_charges = Statement::where('user_id',$user_id)->where('plan_id',$this->plan_id)->where('is_pay',0)->sum('total_commission');\n $charges = Statement::where('user_id',$user_id)->where('plan_id',$this->plan_id)->where('is_pay',0)->sum('chg');\n \n if($this->type == 1){\n \n return [\n 'id' =>$this->id,\n 'title' => ucfirst($this->plan->title),\n 'description' => $this->plan->description,\n 'currentAmount' => $this->plan->closing_balance >= 0 ? '+'.number_format($this->plan->closing_balance + $this->plan->amount,2):number_format($this->plan->closing_balance + $this->plan->amount,2),\n 'amount' => $this->amount,\n 'tag' => Tag::collection($this->plan->tagList),\n 'category' => Category::collection($this->plan->categoryList),\n 'type' => $this->plan->type,\n 'pl_amount' => $this->plan->closing_balance >= 0 ? '+'.number_format($this->plan->closing_balance,2):number_format($this->plan->closing_balance,2),\n 'pl_percentage' => $this->plan->closing_balance >= 0 ? '+'.number_format(($this->plan->closing_balance/$this->plan->amount) * 100,2).'%':number_format(($this->plan->closing_balance/$this->plan->amount) * 100,2).'%',\n 'funds'=>number_format($this->amount,2),\n 'currentValue'=>Helper::__numberFormat($totalPl + $totalInvested),\n 'pl'=>$totalPl >= 0 ? '+'.Helper::__numberFormat($totalPl) :Helper::__numberFormat($totalPl),\n 'chg'=>$charges >= 0 ? '+'.Helper::__numberFormat($charges).'%' :Helper::__numberFormat($charges).'%',\n 'qty'=>number_format(($this->qty),2),\n 'buyAvg' => number_format($this->plan->amount,2),\n 'statements' => PlanLog::collection(static::$planLog),\n \"profitChart\"=> static::$profitChart,\n \"lossChart\"=> static::$lossChart,\n 'total_charges' => $total_charges >= 0 ? '+'.Helper::__numberFormat($total_charges) :Helper::__numberFormat($total_charges).'%',\n ];\n }else{\n return [\n 'id' =>$this->id,\n 'title' => ucfirst($this->plan->title),\n 'description' => $this->plan->description,\n 'currentAmount' => $this->plan->closing_balance >= 0 ? '+'.number_format($this->plan->closing_balance + $this->plan->amount,2):number_format($this->plan->closing_balance + $this->plan->amount,2),\n 'amount' => $this->amount,\n 'tag' => Tag::collection($this->plan->tagList),\n 'category' => Category::collection($this->plan->categoryList),\n 'type' => $this->plan->type,\n 'pl_amount' => $this->plan->closing_balance >= 0 ? '+'.number_format($this->plan->closing_balance,2):number_format($this->plan->closing_balance,2),\n 'pl_percentage' => $this->plan->closing_balance >= 0 ? '+'.number_format(($this->plan->closing_balance/$this->plan->amount) * 100,2).'%':number_format(($this->plan->closing_balance/$this->plan->amount) * 100,2).'%',\n 'funds'=>number_format($this->amount,2),\n 'currentValue'=>Helper::__numberFormat($totalPl + $totalInvested),\n 'pl'=>$totalPl >= 0 ? '+'.Helper::__numberFormat($totalPl) :Helper::__numberFormat($totalPl),\n 'chg'=>$charges >= 0 ? '+'.Helper::__numberFormat($charges).'%' :Helper::__numberFormat($charges).'%',\n 'qty'=>number_format(($this->qty),2),\n 'buyAvg' => number_format($this->plan->amount,2),\n 'statements' => PlanLog::collection(static::$planLog),\n \"profitChart\"=> static::$profitChart,\n \"lossChart\"=> static::$lossChart,\n 'total_charges' => $total_charges >= 0 ? '+'.Helper::__numberFormat($total_charges) :Helper::__numberFormat($total_charges).'%',\n ];\n }\n \n }",
"public function getPaymentMethod()\n {\n // get pusat\n $pusatCode = m_company::where('c_type', 'PUSAT')->select('c_id')->first();\n $pusatCode = $pusatCode->c_id;\n\n $data = m_paymentmethod::where('pm_isactive', 'Y')\n ->whereHas('getAkun', function ($q) use ($pusatCode) {\n $q->where('ak_comp', $pusatCode);\n })\n ->with('getAkun')\n ->get();\n\n return response()->json([\n 'data' => $data\n ]);\n }",
"public function getPayments()\n {\n return $this->hasMany(Payment::className(), ['cust_id' => 'id']);\n }",
"public function getPaymentData($orden){\n\n $query = $this->db->query(\"SELECT numeroOrden,SUM((compra.cantidad*productos.precio))AS costoProducto,SUM(compra.costoEnvio)AS costoEnvio, SUM((compra.cantidad*productos.precio))+SUM(compra.costoEnvio) AS subtotal FROM compra INNER JOIN productos ON compra.producto = productos.id_producto where numeroOrden='\".$orden.\"' GROUP BY numeroOrden\");\n\n return $query->row();\n\n }",
"public function getPaindingPurchasePayments(){\n\t\t\n\t\t$this->db->select('PP.*, PO.purc_order_number, S.supl_comp');\n\t\t$this->db->from('purchase_order_payments AS PP');\n\t\t$this->db->join(\"purchase_orders AS PO\", \"PP.purc_order_id = PO.purc_order_id\");\n\t\t$this->db->join(\"suppliers AS S\", \"S.supl_id = PP.supplier_id\");\n\t\t$this->db->where(\"PP.status\", 'Pending');\n\t\t$this->db->order_by('PP.reminder_date');\n\t\t$query_pending_payments = $this->db->get();\n\t\t// echo $this->db->last_query();die;\n\t\tif($query_pending_payments->num_rows()>0)\n\t\t{\n\t\t\treturn $query_pending_payments->result_array();\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn array();\n\t\t}\n\t\t\n\t}",
"public function query()\n {\n $query = AffiliatePayout::where(['affiliate_user_id'=>Auth::user()->id])->with('paymentMethod');\n //dd($query->get());\n return $this->applyScopes($query);\n }",
"function lab_payment_calculation($appliaction)\n{\n\tif ($appliaction->application_type == 1) {\n\t\t$payment_array['form_chargis'] = 200;\n\t\t$payment_array['registration_chargis'] = 500;\n\t\t$payment_array['renual_charges'] = 250*2;\n\t\t$payment_array['total_amount'] = $payment_array['form_chargis'] + $payment_array['registration_chargis'] + $payment_array['renual_charges'];\n\t} else {\n\t\t$peneltyOnTotalMonth = getDiffrentBetweenTwoDatesInMonth($appliaction->date_of_expiry_certificate,date('Y-m-d'));\n\t\t$payment_array['form_chargis'] = 100;\n\t\t$payment_array['registration_chargis'] = 250*3 + $peneltyOnTotalMonth*100;\n\t\t$payment_array['total_amount'] = $payment_array['form_chargis'] + $payment_array['registration_chargis'];\n\t}\n\treturn json_decode(json_encode($payment_array));\n}",
"function returnPayments($date){\n $dbc = connect();\n $stmt = $dbc->prepare(\"SELECT SUM(`amount`) AS payments FROM `data_transactions`\n WHERE `transaction_date` = :transaction_date AND `type` = 'P'\");\n $stmt->bindParam(':transaction_date', $date);\n $stmt->execute();\n $result = $stmt->fetch(PDO::FETCH_ASSOC);\n\n return (!is_null($result['payments']) ? $result['payments'] : 0); //return 0 if no payments were made that day\n}",
"public function getTotalPaid();",
"public function getPaymentIndex();",
"public function getPaymentRequest()\n {\n $my_groups_id = Group::where('user_id',auth()->user()->id)->pluck('id');\n $requests_collection = BankTransferRequirement::whereIn('group_id', $my_groups_id);\n\n $requests_count = $requests_collection->count();\n $requests = $requests_collection->orderBy('created_at', 'DESC')->get();\n\n return response()->json([\n 'items' => $requests,\n 'message' => __('messages.fetch_data_msg'),\n 'status' => true\n ]);\n\n }",
"public function captureInvoice(Varien_Object $payment)\n {\n\n\n $transaction = Mage::getModel('sales/order_payment_transaction')->getCollection()\n ->addAttributeToFilter('order_id', array('eq' => $payment->getOrder()->getEntityId()))->getLastItem();\n $addData = $transaction->getAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS);\n $transaction_id = $addData['transID'];\n\n\n if(empty($transaction_id)){\n $transaction_id = Mage::getSingleton('core/session')->getTransactionID();\n\n }\n if (empty($transaction_id)) {\n Mage::helper('paynovapayment')->log(\"Error. Missing transaction ID from order and cannot do capture.\");\n Mage::throwException(Mage::helper('paynovapayment')->__('Error. Missing transaction ID.'));\n }\n\n\n $invoice = $payment->getCurrentInvoice();\n $transInformation = $payment->getTransaction($transaction_id)->getAdditionalInformation();\n\n\n\n $order_id = $transInformation['raw_details_info']['order_id'];\n $order_number = $transInformation['raw_details_info']['order_number'];\n\n $order = Mage::getModel('sales/order');\n\n $order->loadByIncrementId($order_number);\n\n $res['orderId'] = $order_id;\n $res['transactionId'] = $transaction_id;\n $res['totalAmount'] = $invoice->getGrandTotal();\n $res['invoiceId'] = $transaction_id;\n\n $items = $invoice->getAllItems();\n\n\n $itemcount= count($items);\n $data = array();\n $i=0;\n $linenumber=1;\n\n $unitMeasure = Mage::getStoreConfig('paynovapayment/advanced_settings/product_unit');\n if (empty($unitMeasure)){\n $unitMeasure = \"pcs\";\n }\n $shippingname = Mage::getStoreConfig('paynovapayment/advanced_settings/shipping_name');\n if (empty($shippingname)){\n $shippingname = \"Shipping\";\n }\n $shippingsku = Mage::getStoreConfig('paynovapayment/advanced_settings/shipping_sku');\n if (empty($shippingsku)){\n $shippingsku = \"Shipping\";\n }\n\n foreach ($items as $itemId => $item)\n {\n\n $orderItem = $item->getOrderItem();\n\n $product = Mage::helper('catalog/product')->getProduct($item->getSku(), Mage::app()->getStore()->getId(), 'sku');\n $productUrl = Mage::getUrl($product->getUrlPath());\n $description = $product->getShortDescription();\n if (empty($description)){\n $description = $orderItem->getName();\n }\n $itemtype = $orderItem->getProductType();\n\n\n $lineqty = intval($item->getQty());\n // if product has parent - get parent qty\n\n\n if ($item->getParentItemID() AND $item->getParentItemID()>0){\n $parentQuoteItem = Mage::getModel(\"sales/quote_item\")->load($item->getParentItemID());\n $parentqty = intval($parentQuoteItem->getQty());\n $lineqty = $lineqty * $parentqty;\n }\n\n\n $lineprice = $orderItem->getPrice();\n $linetax = $orderItem->getTaxPercent();\n $unitAmountExcludingTax = $orderItem->getPrice();\n $linetaxamount = ($lineqty*$lineprice)*($linetax/100);\n $linetotalamount = $lineqty*$unitAmountExcludingTax+$linetaxamount;\n\n\n // If item has discount\n if ($orderItem->getDiscountAmount() AND $orderItem->getDiscountAmount()>0 )\n {\n $linediscountamount = $orderItem->getDiscountAmount();\n $itemdiscount = $linediscountamount/$lineqty;\n $unitAmountExcludingTax = $lineprice-$itemdiscount;\n $linetaxamount = ($lineqty*$unitAmountExcludingTax)*($linetax/100);\n $total1 = $lineqty*$unitAmountExcludingTax;\n $linetotalamount = $total1+$linetaxamount;\n $linetax1 = $lineqty*$unitAmountExcludingTax;\n $linetax2 = $linetax/100;\n $linetaxamount = $linetax1*$linetax2;\n }\n\n $res['lineItems'][$itemId]['id'] = $linenumber;\n $res['lineItems'][$itemId]['articleNumber'] = substr($orderItem->getSku(),0,50);\n $res['lineItems'][$itemId]['name'] = $item->getName();\n $res['lineItems'][$itemId]['quantity'] = $lineqty;\n $res['lineItems'][$itemId]['unitMeasure'] = $unitMeasure;\n $res['lineItems'][$itemId]['description'] = $description;\n $res['lineItems'][$itemId]['productUrl'] = $productUrl;\n\n\n if ($itemtype ==\"bundle\") {\n $res['lineItems'][$itemId]['unitAmountExcludingTax'] =0;\n $res['lineItems'][$itemId]['taxPercent'] = 0;\n $res['lineItems'][$itemId]['totalLineTaxAmount'] = 0;\n $res['lineItems'][$itemId]['totalLineAmount'] = 0;\n } else {\n $res['lineItems'][$itemId]['unitAmountExcludingTax'] = round($unitAmountExcludingTax,2);\n $res['lineItems'][$itemId]['taxPercent'] = round($linetax,2);\n $res['lineItems'][$itemId]['totalLineTaxAmount'] = round($linetaxamount,2);\n $res['lineItems'][$itemId]['totalLineAmount'] = round($linetotalamount,2);\n }\n\n $i++;\n $linenumber++;\n }\n if ($order->getShippingAmount() AND $order->getShippingAmount()>0) {\n $quoteid = $order->getQuoteId();\n $quote = Mage::getModel('sales/quote')->load($quoteid);\n $itemId++;\n $res['lineItems'][$itemId]['id'] = $linenumber;\n $res['lineItems'][$itemId]['articleNumber'] = substr($shippingsku,0,50);\n $res['lineItems'][$itemId]['name'] = $shippingname;\n $res['lineItems'][$itemId]['quantity'] = 1;\n $res['lineItems'][$itemId]['unitMeasure'] = $unitMeasure;\n $res['lineItems'][$itemId]['unitAmountExcludingTax'] = round($order->getShippingAmount(),2);\n $res['lineItems'][$itemId]['taxPercent'] = Mage::helper('paynovapayment')->getShippingTaxPercentFromQuote($quote);\n $res['lineItems'][$itemId]['totalLineTaxAmount'] = round($order->getShippingTaxAmount(),2);\n $res['lineItems'][$itemId]['totalLineAmount'] = round($order->getShippingInclTax(),2);\n $res['lineItems'][$itemId]['description'] = $description;\n $res['lineItems'][$itemId]['productUrl'] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);;\n }\n\n\n\n $output=$this->setCurlCall($res, '/orders/'.$order_id.'/transactions/'.$transaction_id.'/finalize/'.$res['totalAmount']);\n\n\n $order->save();\n\n $status = $output->status;\n if($status->statusKey == 'PAYMENT_COMPLETED'){\n\n $status->isSuccess = true;\n $output->transactionId = 'Order has been finalized';\n\n }\n\n if($status->isSuccess){\n\n $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING);\n\n $order->save();\n\n $payment->setStatus(self::STATUS_APPROVED)\n ->setTransactionId($output->transactionId)\n ->setIsTransactionClosed(0);\n return $status->isSuccess;\n\n }else{\n\n $error=$status->statusMessage;\n\n\n $order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, Mage_Sales_Model_Order::STATE_PENDING_PAYMENT,\n Mage::helper('paynovapayment')->__($error)\n );\n $order->save();\n\n Mage::throwException(\"$error\");\n\n $this->_redirect('checkout/onepage');\n\n }\n\n }",
"function get_payment_rate($subtotal) {}",
"private final function _getPayments(order $order) {\n\t\t$payments = array();\n\t\tforeach ($order->payments->records as $payment) {\n\t\t\tif (PAYMENT_TYPES_PBB_BANK == $payment->payment_option_id) {\n\t\t\t\t$payments = $payment;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn $payments;\n\t}",
"function clinic_payment_calculation($appliaction)\n{\n\tif ($appliaction->application_type == 1) {\n\t\t$payment_array['form_chargis'] = 200;\n\t\t$payment_array['registration_chargis'] = 500;\n\t\t$payment_array['renual_charges'] = 250*2;\n\t\t$payment_array['total_amount'] = $payment_array['form_chargis'] + $payment_array['registration_chargis'] + $payment_array['renual_charges'];\n\t} else {\n\t\t$peneltyOnTotalMonth = getDiffrentBetweenTwoDatesInMonth($appliaction->date_of_expiry_certificate,date('Y-m-d'));\n\t\t$payment_array['form_chargis'] = 100;\n\t\t$payment_array['registration_chargis'] = 250*3 + $peneltyOnTotalMonth*100;\n\t\t$payment_array['total_amount'] = $payment_array['form_chargis'] + $payment_array['registration_chargis'];\n\t}\n\treturn json_decode(json_encode($payment_array));\n}"
] |
[
"0.65933335",
"0.5753663",
"0.5714264",
"0.56978005",
"0.565608",
"0.565327",
"0.5620532",
"0.5576142",
"0.55756605",
"0.5554249",
"0.5542535",
"0.5535124",
"0.5522467",
"0.55125666",
"0.5470977",
"0.5453741",
"0.5441059",
"0.5418857",
"0.5409308",
"0.53870887",
"0.53605825",
"0.5345511",
"0.5341449",
"0.5330903",
"0.53159815",
"0.5313277",
"0.5301767",
"0.5290557",
"0.52886516",
"0.52802575"
] |
0.72095317
|
0
|
Returns validators for XML_ID field.
|
public static function validateXmlId()
{
return array(
new Main\Entity\Validator\Length(null, 255),
);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public static function validateXmlId()\n\t{\n\t\treturn array(\n\t\t\tnew Main\\Entity\\Validator\\Length(null, 255),\n\t\t);\n\t}",
"public static function validateXmlId()\n{\n return array(\n new Main\\Entity\\Validator\\Length(null, 50),\n );\n}",
"public static function validateFieldId()\n\t{\n\t\treturn array(\n\t\t\tnew Entity\\Validator\\Length(null, 50),\n\t\t);\n\t}",
"public static function validateDialogId()\n\t{\n\t\treturn array(\n\t\t\tnew Main\\Entity\\Validator\\Length(null, 50),\n\t\t);\n\t}",
"public function getValidIdAttributes(): array\n {\n return [\n 'Starts with _' => [\n 'extension_id_0001.xsd', '_foo', \n ], \n 'Starts with letter' => [\n 'extension_id_0002.xsd', 'f', \n ], \n 'Contains letter' => [\n 'extension_id_0003.xsd', 'foo', \n ], \n 'Contains digit' => [\n 'extension_id_0004.xsd', 'f00', \n ], \n 'Contains .' => [\n 'extension_id_0005.xsd', 'f.bar', \n ], \n 'Contains -' => [\n 'extension_id_0006.xsd', 'f-bar', \n ], \n 'Contains _' => [\n 'extension_id_0007.xsd', 'f_bar', \n ], \n 'Surrounded by whitespaces' => [\n 'extension_id_0008.xsd', 'foo_bar', \n ], \n ];\n }",
"public static function validateLid()\n\t{\n\t\treturn array(\n\t\t\tnew Main\\Entity\\Validator\\Length(null, 2),\n\t\t);\n\t}",
"public static function validators() {\n return [\n 'application_id' => 'validateApplicationId',\n 'is_default' => 'validateIsDefault',\n 'role' => 'validateRole',\n 'type' => 'validateType',\n '_issues' => 'validateIssues'\n ];\n }",
"public function getValidIdAttributes(): array\n {\n return [\n 'Starts with _' => [\n 'attribute_id_0001.xsd', '_foo', \n ], \n 'Starts with letter' => [\n 'attribute_id_0002.xsd', 'f', \n ], \n 'Contains letter' => [\n 'attribute_id_0003.xsd', 'foo', \n ], \n 'Contains digit' => [\n 'attribute_id_0004.xsd', 'f00', \n ], \n 'Contains .' => [\n 'attribute_id_0005.xsd', 'f.bar', \n ], \n 'Contains -' => [\n 'attribute_id_0006.xsd', 'f-bar', \n ], \n 'Contains _' => [\n 'attribute_id_0007.xsd', 'f_bar', \n ], \n 'Surrounded by whitespaces' => [\n 'attribute_id_0008.xsd', 'foo_bar', \n ], \n ];\n }",
"public static function validateLid()\n {\n return array(\n new Main\\Entity\\Validator\\Length(null, 2),\n );\n }",
"public static function validateLid()\n {\n return array(\n new Main\\Entity\\Validator\\Length(null, 2),\n );\n }",
"public static function validateExchangeId()\n{\n return array(\n new Main\\Entity\\Validator\\Length(null, 196),\n );\n}",
"public static function validateSiteId()\n\t{\n\t\treturn array(\n\t\t\tnew Main\\Entity\\Validator\\Length(null, 2),\n\t\t);\n\t}",
"public static function validators() {\n return [\n 'tenant_id' => 'validateTenantId',\n 'expires_in' => 'validateExpiresIn',\n 'scopes' => 'validateScopes'\n ];\n }",
"public function getValidators();",
"public function getValidators();",
"public function getValidators();",
"public static function validators() {\n return [\n 'status' => 'validateStatus',\n 'quota' => 'validateQuota'\n ];\n }",
"public static function validateElementCode()\n {\n return array(\n new Main\\Entity\\Validator\\Length(null, 256),\n );\n }",
"public static function validators() {\n return [\n 'status' => 'validateStatus',\n 'time' => 'validateTime'\n ];\n }",
"public function idParamSchema() {\n return $this->schema(['id:i' => 'The numeric ID of a token.'], 'in');\n }",
"public function getValidators() {}",
"public function getValidators()\n {\n $validators = parent::getValidators();\n if ($this->internalValue != null) {\n if ($this->internalMultiSelect) {\n // field may contain more than one value\n $validators[] = new CsvListValidator(array('message' => $this->internalValidationMessage,\n 'domain'=>array_keys($this->internalOptionList)));\n } else {\n // single value selection\n $validators[] = new InclusionIn(array('message' => $this->internalValidationMessage,\n 'domain'=>array_keys($this->internalOptionList)));\n }\n }\n return $validators;\n }",
"public static function validateSiteId()\n{\n return array(\n new Main\\Entity\\Validator\\Length(null, 2),\n );\n}",
"public function getValidator();",
"public function getValidator();",
"public function _validateModelsIds()\n {\n $inputs = [\n 'placementId' => $this->_placementId,\n 'deviceId' => $this->_deviceId,\n 'appPackage' => $this->_appPackage,\n 'requestId' => $this->_requestId\n ];\n \n $rules = [\n 'placementId' => 'exists:ad_placement,id',\n 'deviceId' => 'exists:devices,id',\n 'appPackage' => 'exists:applications,package_id',\n 'requestId' => 'exists:sdk_requests,id'\n ];\n\n return Validator::make($inputs, $rules);\n }",
"function getValidationRules() {\n\t\treturn array(\n\t\t\t'_ID' => array(\n\t\t\t\t'number' => array(),\n\t\t\t),\n\t\t\t'_EventID' => array(\n\t\t\t\t'number' => array(),\n\t\t\t),\n\t\t\t'_SourceID' => array(\n\t\t\t\t'number' => array(),\n\t\t\t),\n\t\t\t'_UserID' => array(\n\t\t\t\t'number' => array(),\n\t\t\t),\n\t\t\t'_HasEvent' => array(\n\t\t\t\t'inArray' => array('values' => array(self::HASEVENT_0, self::HASEVENT_1),),\n\t\t\t),\n\t\t);\n\t}",
"public function getValidators()\n\t{\n\t\treturn array();\n\t}",
"public function getUpdateValidators()\n {\n $validators = $this->getCreateValidators();\n $validators['author_type_id'] = new sfValidatorDoctrineChoice(array(\n 'model' => Doctrine_Core::getTable('Deadline')->getRelation('AuthorType')->getAlias(),\n 'required' => false,\n ));\n $validators['subreddit_id'] = new sfValidatorDoctrineChoice(array(\n 'model' => Doctrine_Core::getTable('Deadline')->getRelation('Subreddit')->getAlias(),\n 'required' => false,\n ));\n return $validators;\n }",
"public static function validateCode()\n\t{\n\t\treturn array(\n\t\t\tnew Main\\Entity\\Validator\\Length(null, 255),\n\t\t);\n\t}"
] |
[
"0.76855516",
"0.71343017",
"0.64530236",
"0.63647896",
"0.599423",
"0.5977315",
"0.59028876",
"0.5890399",
"0.58618265",
"0.58618265",
"0.5829755",
"0.5725654",
"0.5651362",
"0.5587296",
"0.5587296",
"0.5587296",
"0.5549857",
"0.55476856",
"0.55189764",
"0.5464241",
"0.54586816",
"0.5421964",
"0.5378965",
"0.5346118",
"0.5346118",
"0.5220799",
"0.521464",
"0.5197606",
"0.51885664",
"0.51466525"
] |
0.7569767
|
1
|
Paints the end of the test with a summary of the passes and failures.
|
function paintFooter($test_name) {
$colour = ($this->getFailCount() + $this->getExceptionCount() > 0 ? "red" : "green");
print "<div id=\"results\" style=\"background-color: $colour;\">";
print $this->getTestCaseProgress() . "/" . $this->getTestCaseCount();
print " test cases complete:\n";
print "<b>" . $this->getPassCount() . "</b> passes, ";
print "<b>" . $this->getFailCount() . "</b> fails and ";
print "<b>" . $this->getExceptionCount() . "</b> exceptions.";
print "</div>\n";
print "</body>\n</html>\n";
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function _summary() {\n $text = $this->_failed ? 'TESTS FAILED!' : 'TESTS PASSED';\n $result = $this->_colors->getColoredString($text, $this->_colorsPalete[!$this->_failed]);\n $this->_log($result);\n }",
"public function showTestResults() {\n echo \"Tests: {$this->tests}\\n\";\n echo \"Pass: {$this->pass}\\n\";\n echo \"Fail: {$this->fail}\\n\";\n }",
"public function testRunFinished(\\unittest\\TestSuite $suite, \\unittest\\TestResult $result) {\n $this->writeStatus();\n $this->out->writeLine();\n\n // Summary output\n $this->out->writeLinef(\n \"\\n%s: %d/%d run (%d skipped), %d succeeded, %d failed\",\n $result->failureCount() > 0 ? 'FAIL' : 'OK',\n $result->runCount(),\n $result->count(),\n $result->skipCount(),\n $result->successCount(),\n $result->failureCount()\n );\n foreach ($result->metrics() as $name => $metric) {\n $this->out->writeLine($name, ': ', $metric->formatted());\n }\n }",
"function paintFail($message) {\n parent::paintFail($message);\n\t\t\t\t\t\t$breadcrumb = $this->getTestList();\n\t\t\t\t\t\tarray_shift($breadcrumb);\n\t\t\t\t\t\t\n\t\t\t\t\t\tprint \"<div><span class=\\\"red\\\">Fail:</span> <strong>\";\n\t\t\t\t\t\tprint implode(\" -> \", $breadcrumb);\n\t\t\t\t\t\tprint \" </strong><br />\\n<span class=\\\"fail\\\">\" . $this->_htmlEntities($message) . \"</span></div>\\n\";\n\t\t\t\t}",
"public function _reportSummary($summary)\n {\n $passed = $summary->passed();\n $skipped = $summary->skipped();\n $pending = $summary->pending();\n $excluded = $summary->excluded();\n $failed = $summary->failed();\n $errored = $summary->errored();\n $expectation = $summary->expectation();\n $total = $summary->executable();\n\n $this->write(\"Expectations : \");\n $this->write(\"{$expectation} Executed\");\n $this->write(\"\\n\");\n $this->write(\"Specifications : \");\n $this->write(\"{$pending} Pending\", 'cyan');\n $this->write(\", \");\n $this->write(\"{$excluded} Excluded\", 'yellow');\n $this->write(\", \");\n $this->write(\"{$skipped} Skipped\", 'light-grey');\n $this->write(\"\\n\\n\");\n $this->write('Passed ' . ($passed), 'green');\n $this->write(\" of {$total} \");\n\n if ($failed + $errored) {\n $this->write('FAIL ', 'red');\n $this->write('(');\n $comma = false;\n if ($failed) {\n $this->write('FAILURE: ' . $failed, 'red');\n $comma = true;\n }\n if ($errored) {\n if ($comma) {\n $this->write(', ');\n }\n $this->write('EXCEPTION: ' . $errored, 'magenta');\n }\n $this->write(')');\n } else {\n $this->write('PASS', 'green');\n }\n $time = number_format(microtime(true) - $this->_start, 3);\n $memory = $this->readableSize($summary->memoryUsage());\n $this->write(\" in {$time} seconds (using {$memory}B)\");\n $this->write(\"\\n\\n\");\n\n $this->_reportFocused($summary);\n }",
"function paintMethodEnd($test_name) {\r\n $this->_scorer->paintMethodEnd($test_name);\r\n }",
"protected function _report()\n {\n // report summary\n $done = $this->_info['done'];\n $plan = $this->_info['plan'];\n $time = $this->_info['time'];\n \n $this->_log(\"$done/$plan tests, $time seconds\");\n \n $tmp = array();\n $show = array('fail', 'todo', 'skip', 'pass');\n foreach ($show as $type) {\n $count = count($this->_info[$type]);\n $tmp[] = \"$count $type\";\n }\n $this->_log(implode(', ', $tmp));\n }",
"public function pass($message) {\n exit('<div style=\"display: inline-block; color: #3c763d; background: #dff0d8; border: solid 1px #d6e9c6; font-family: Helvetica, Arial; size: 16px; padding: 15px;\">Test failed: ' . $message . '</div>');\n }",
"public function testIterationEnd(): void\n {\n foreach ($this->variant as $iteration) {\n foreach (TestUtil::createResults(10, 10) as $result) {\n $iteration->setResult($result);\n }\n }\n $this->variant->computeStats();\n\n $this->logger->variantEnd($this->variant);\n $display = $this->output->fetch();\n $this->assertStringContainsString(\n '1 (σ = 0.000ms ) -2σ [ █ ] +2σ summary',\n $display\n );\n }",
"public function printFooter(\\PHPUnit_Framework_TestResult $result)\n {\n $testCount = $result->count();\n $assertionCount = $this->numAssertions;\n $failureCount = $result->failureCount();\n $errorCount = $result->errorCount();\n $incompleteCount = $result->notImplementedCount();\n $skipCount = $result->skippedCount();\n $riskyCount = $result->riskyCount();\n\n $resultStatus = ($errorCount + $failureCount) ? 'KO' : 'OK';\n $resultMessage = sprintf('Results %s. ', $resultStatus) .\n $this->formatCounters(\n $testCount,\n $assertionCount,\n $failureCount,\n $errorCount,\n $incompleteCount,\n $skipCount,\n $riskyCount\n )\n ;\n\n $context = array(\n 'operation' => __FUNCTION__,\n 'status' => $resultStatus,\n 'testCount' => $testCount,\n 'assertionCount' => $assertionCount,\n 'failureCount' => $failureCount,\n 'errorCount' => $errorCount,\n 'incompleteCount' => $incompleteCount,\n 'skipCount' => $skipCount,\n 'riskyCount' => $riskyCount,\n );\n\n $this->logger->notice($resultMessage, $context);\n }",
"private function writeStatus(Test $test= null) {\n if ($test) {\n $this->cur++;\n $color= self::CODE_BLUE;\n } else if ($this->status) {\n $this->cur= $this->sum;\n $color= self::CODE_GREEN;\n } else {\n $color= self::CODE_RED;\n }\n \n // Create status bar\n $done= floor($this->cur / $this->sum * self::PROGRESS_WIDTH);\n $status= sprintf('Running %-3d of %d ▐%s▌ %01d 📛▕ %01d ❌▕ %01d ⚡▕ %01d ⏩▕ %01d ⌛',\n $this->cur,\n $this->sum,\n str_repeat('█', $done).str_repeat(' ', self::PROGRESS_WIDTH - $done),\n $this->stats['failed'],\n $this->stats['errored'],\n $this->stats['warned'],\n $this->stats['skipped'],\n $this->stats['notrun']\n );\n\n // Format output so it's 72 characters wide (8 for status, 2 spaces padding)\n $this->out->writef(\n \"\\r\\033[%sm %s%s❯ %s \\033[0m\",\n $color,\n $status,\n str_repeat(' ', 60 - iconv_strlen($status, 'utf-8')),\n $this->status ? 'PASSING' : 'FAILURE!'\n );\n }",
"public function endSkip(/* ... */)\n {\n if ($this->getTestResult() !== self::FAIL) {\n $this->setTestResult(self::PASS);\n }\n }",
"public function onFinish(ResultsCollection $results)\n {\n $this->console->writeLine();\n\n // Display information that the check has been aborted.\n if ($this->stopped) {\n $this->console->writeLine('Diagnostics aborted because of a failure.', Color::RED);\n }\n\n // Display a summary line\n if ($results->getFailureCount() == 0 && $results->getWarningCount() == 0 && $results->getUnknownCount() == 0) {\n $line = 'OK (' . $this->total . ' diagnostic checks)';\n $this->console->writeLine(\n str_pad($line, $this->width - 1, ' ', STR_PAD_RIGHT),\n Color::NORMAL, Color::GREEN\n );\n } elseif ($results->getFailureCount() == 0) {\n $line = $results->getWarningCount() . ' warnings, ';\n $line .= $results->getSuccessCount() . ' successful checks';\n\n if ($results->getSkipCount() > 0) {\n $line .= ', ' . $results->getSkipCount() . ' skipped checks';\n }\n\n if ($results->getUnknownCount() > 0) {\n $line .= ', ' . $results->getUnknownCount() . ' unknown check results';\n }\n\n $line .= '.';\n\n $this->console->writeLine(\n str_pad($line, $this->width - 1, ' ', STR_PAD_RIGHT),\n Color::NORMAL, Color::YELLOW\n );\n } else {\n $line = $results->getFailureCount() . ' failures, ';\n $line .= $results->getWarningCount() . ' warnings, ';\n $line .= $results->getSuccessCount() . ' successful checks';\n\n if ($results->getSkipCount() > 0) {\n $line .= ', ' . $results->getSkipCount() . ' skipped checks';\n }\n\n if ($results->getUnknownCount() > 0) {\n $line .= ', ' . $results->getUnknownCount() . ' unknown check results';\n }\n\n $line .= '.';\n\n $this->console->writeLine(\n str_pad($line, $this->width, ' ', STR_PAD_RIGHT),\n Color::NORMAL, Color::RED\n );\n }\n\n $this->console->writeLine();\n }",
"public function suiteFooter(xTestRunner $testRunner)\r\n {\r\n\r\n }",
"public function testFailed(\\unittest\\TestFailure $failure) {\n $this->status= false;\n $this->stats['failed']++;\n $this->writeFailure($failure);\n }",
"function atTestEnd($test_method, &$test) {\n foreach ($this->expected_counts as $method => $expectation) {\n $test->assert($expectation, $this->getCallCount($method));\n }\n foreach ($this->max_counts as $method => $expectation) {\n if ($expectation->test($this->getCallCount($method))) {\n $test->assert($expectation, $this->getCallCount($method));\n }\n }\n }",
"function succ_test_html($test_counter, $test_name){\n echo \"<font size=\\\"2\\\" color=\\\"green\\\">$test_counter. $test_name TEST : passed</font><br>\\n\";\n }",
"function paintFail($message) {\r\n $this->_scorer->paintFail($message);\r\n }",
"public function endTestSuite(\\PHPUnit_Framework_TestSuite $suite)\n {\n $this->endedSuites++;\n\n $suiteName = $suite->getName();\n\n $context = array(\n 'suiteName' => $suiteName,\n 'testCount' => $this->stats[$suiteName]['tests'],\n 'assertionCount' => $this->stats[$suiteName]['assertions'],\n 'failureCount' => $this->stats[$suiteName]['failures'],\n 'errorCount' => $this->stats[$suiteName]['errors'],\n 'incompleteCount' => $this->stats[$suiteName]['incompletes'],\n 'skipCount' => $this->stats[$suiteName]['skips'],\n 'riskyCount' => $this->stats[$suiteName]['risky'],\n 'operation' => __FUNCTION__,\n );\n\n $this->logger->notice(\n sprintf(\"TestSuite '%s' ended.\", $suiteName),\n $context\n );\n }",
"public function run () {\r\n print \"\\n\";\r\n \r\n # Console spacing.\r\n foreach ( $this->tests as $test ) {\r\n if ( strlen( $test->name() ) > $this->longest_test_name_length )\r\n $this->longest_test_name_length = strlen( $test->name() );\r\n }\r\n \r\n foreach ( $this->tests as $test ) {\r\n $test->run();\r\n $this->print_test( $test );\r\n }\r\n \r\n $this->print_summary_stats();\r\n }",
"public function printResults() {\n $assertions = $this->getAssertions();\n $failures = $this->getFailures();\n $errors = $this->getErrors();\n return \"Assertions: \" . $assertions . \", Failures: \" . $failures . \" and \" . $errors . \" errors.\";\n }",
"public function fail($message) {\n exit('<div style=\"display: inline-block; color: #a94442; background: #f2dede; border: solid 1px #ebccd1; font-family: Helvetica, Arial; size: 16px; padding: 15px;\">Test failed: ' . $message . '</div>');\n }",
"public static function tearDownAfterClass()\n {\n echo PHP_EOL, 'Result: ', self::$ok, ' detected', PHP_EOL;\n }",
"public function benchmarkEnd()\n\t{\n\t\tif ($this->startTime == 0) {\n\t\t\treturn 'Benchmark not started';\n\t\t}\n\n\t\treturn \"Completed in \".(round(microtime(true) * 1000) - $this->startTime).\" ms\";\n\t}",
"function generate_html_tail(){\n $all_tests = $GLOBALS['total_counter'];\n $ok_tests = $GLOBALS['passed_counter'];\n $fail = $GLOBALS['failed_counter'];\n\n if($all_tests > 0){\n $success_rate = ($ok_tests / $all_tests)* 100;\n }\n else{\n $success_rate = 0;\n }\n\n echo \" </table><br>\\n\";\n echo \" <h3>Summary:</h3>\\n\";\n echo \" <table style=\\\"width: 300px\\\">\\n\";\n echo \" <tr>\\n\";\n echo \" <td>Number of tests</td>\\n\";\n echo \" <td>$all_tests</td>\\n\";\n echo \" </tr>\\n\";\n echo \" <tr>\\n\";\n echo \" <td>Successful tests</td>\\n\";\n echo \" <td>$ok_tests</td>\\n\";\n echo \" </tr>\\n\";\n echo \" <tr>\\n\";\n echo \" <td>Failed tests</td>\\n\";\n echo \" <td>$fail</td>\\n\";\n echo \" </tr>\\n\";\n echo \" <tr>\\n\";\n echo \" <td>Success rate</td>\\n\";\n echo \" <td>$success_rate%</td>\\n\";\n echo \" </tr>\\n\";\n echo \" </table>\\n\";\n echo \" </body>\\n\";\n echo \"</html>\\n\";\n}",
"public function testBlueScreen()\n {\n\n $tracy = new Tracy();\n\n /*\n |------------------------------------------------------------\n | Expectation\n |------------------------------------------------------------\n */\n\n /*\n |------------------------------------------------------------\n | Assertion\n |------------------------------------------------------------\n */\n\n $tracy->renderBlueScreen(new Exception());\n }",
"protected function markTestAsPassed()\n {\n $this->assertTrue(true, 'Test case did not throw an exception and passed.');\n }",
"public function testFailure()\n {\n $this->_package->fail(\"Failed test\");\n $this->assertFalse($this->_result->wasSuccessful());\n }",
"public function testFailure()\n {\n $this->assertTrue(false, 'A test case has failed as expected.');\n }",
"public function endTestSuite(\\PHPUnit_Framework_TestSuite $suite)\n\t{\n\t\t\n\t}"
] |
[
"0.7444343",
"0.68625915",
"0.66298187",
"0.6584047",
"0.6504653",
"0.64116",
"0.63056314",
"0.6161622",
"0.6137382",
"0.60925907",
"0.6057485",
"0.60488147",
"0.60270494",
"0.6016302",
"0.60101306",
"0.59871894",
"0.5986292",
"0.5920685",
"0.5901865",
"0.58979255",
"0.5887284",
"0.58022445",
"0.5773551",
"0.57340264",
"0.5715688",
"0.5673817",
"0.5654143",
"0.5639375",
"0.5590364",
"0.5579711"
] |
0.78120774
|
0
|
Paints the test failure with a breadcrumbs trail of the nesting test suites below the top level test.
|
function paintFail($message) {
parent::paintFail($message);
$breadcrumb = $this->getTestList();
array_shift($breadcrumb);
print "<div><span class=\"red\">Fail:</span> <strong>";
print implode(" -> ", $breadcrumb);
print " </strong><br />\n<span class=\"fail\">" . $this->_htmlEntities($message) . "</span></div>\n";
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function testBlueScreen()\n {\n\n $tracy = new Tracy();\n\n /*\n |------------------------------------------------------------\n | Expectation\n |------------------------------------------------------------\n */\n\n /*\n |------------------------------------------------------------\n | Assertion\n |------------------------------------------------------------\n */\n\n $tracy->renderBlueScreen(new Exception());\n }",
"function paintError($message) {\n parent::paintError($message);\n\t\t\t\t\t\tprint \"<div><span class=\\\"red\\\">Exception:</span> <strong>\";\n\t\t\t\t\t\t$breadcrumb = $this->getTestList();\n\t\t\t\t\t\tarray_shift($breadcrumb);\n\t\t\t\t\t\tprint implode(\" -> \", $breadcrumb);\n\t\t\t\t\t\tprint \"</strong><br />\\n<span class=\\\"exception\\\">\" . $this->_htmlEntities($message) . \"</span></div>\\n\";\n\t\t\t\t}",
"public function fail($message) {\n exit('<div style=\"display: inline-block; color: #a94442; background: #f2dede; border: solid 1px #ebccd1; font-family: Helvetica, Arial; size: 16px; padding: 15px;\">Test failed: ' . $message . '</div>');\n }",
"public function testFailed(\\unittest\\TestFailure $failure) {\n $this->status= false;\n $this->stats['failed']++;\n $this->writeFailure($failure);\n }",
"function paintFooter($test_name) {\n $colour = ($this->getFailCount() + $this->getExceptionCount() > 0 ? \"red\" : \"green\");\n print \"<div id=\\\"results\\\" style=\\\"background-color: $colour;\\\">\";\n print $this->getTestCaseProgress() . \"/\" . $this->getTestCaseCount();\n print \" test cases complete:\\n\";\n print \"<b>\" . $this->getPassCount() . \"</b> passes, \";\n print \"<b>\" . $this->getFailCount() . \"</b> fails and \";\n print \"<b>\" . $this->getExceptionCount() . \"</b> exceptions.\";\n print \"</div>\\n\";\n print \"</body>\\n</html>\\n\";\n }",
"public function testFailure()\n {\n $this->assertTrue(false, 'A test case has failed as expected.');\n }",
"function paintFail($message) {\r\n $this->_scorer->paintFail($message);\r\n }",
"public function testFailure()\n {\n $this->_package->fail(\"Failed test\");\n $this->assertFalse($this->_result->wasSuccessful());\n }",
"public function pass($message) {\n exit('<div style=\"display: inline-block; color: #3c763d; background: #dff0d8; border: solid 1px #d6e9c6; font-family: Helvetica, Arial; size: 16px; padding: 15px;\">Test failed: ' . $message . '</div>');\n }",
"public function testCaseFailureFrontEnd()\n {\n $this->browse(function (Browser $browser) {\n $browser->visit('/contact')\n ->type('fullname', 'john doe')\n ->type('phone', '12321321')\n ->type('email', '[email protected]')\n ->type('message', 'Demo message')\n ->press('singlebutton')\n ->assertSee('The phone must be 10 digits.',10);\n });\n $this->browse(function (Browser $browser) {\n $browser->visit('/contact')\n ->type('fullname', 'john doe')\n ->type('phone', '12321321')\n ->type('email', 'shanti.gola@s')\n ->type('message', 'Demo message')\n ->click('button')\n ->assertSee('The email must be a valid email address.');\n });\n\n\n }",
"public function testDbFailedAction()\n {\n $this->renderToSegment('body');\n }",
"public function testBreadcrumb() {\n $page = $this->getSession()->getPage();\n\n $this->drupalPlaceBlock('system_breadcrumb_block');\n\n $this->drupalLogin($this->drupalCreateUser([\n 'configure any layout',\n 'administer node display',\n 'administer content types',\n 'access administration pages',\n ]));\n\n // From the manage display page, go to manage the layout.\n $this->drupalGet('admin/structure/types/manage/bundle_with_section_field/display/default');\n $this->submitForm(['layout[enabled]' => TRUE], 'Save');\n $this->submitForm(['layout[allow_custom]' => TRUE], 'Save');\n $page->clickLink('Manage layout');\n\n $breadcrumb_titles = [];\n foreach ($page->findAll('css', '.breadcrumb a') as $link) {\n $breadcrumb_titles[$link->getText()] = $link->getAttribute('href');\n }\n $base_path = base_path();\n $expected = [\n 'Home' => $base_path,\n 'Administration' => $base_path . 'admin',\n 'Structure' => $base_path . 'admin/structure',\n 'Content types' => $base_path . 'admin/structure/types',\n 'Bundle with section field' => $base_path . 'admin/structure/types/manage/bundle_with_section_field',\n 'Manage display' => $base_path . 'admin/structure/types/manage/bundle_with_section_field/display/default',\n 'External link' => 'http://www.example.com',\n ];\n $this->assertSame($expected, $breadcrumb_titles);\n }",
"public function testFailAssertionFailureTolerate(): void\n {\n $process = $this->phpbench(\n 'run benchmarks/set5/AssertFailBench.php --tolerate-failure'\n );\n $this->assertExitCode(0, $process);\n }",
"public function testFailure()\n {\n $this->assertFileExists('/home/albert/PhpstormProjects/is601b');\n }",
"public function testFailAssertionFailure(): void\n {\n $process = $this->phpbench(\n 'run benchmarks/set5/AssertFailBench.php'\n );\n $this->assertExitCode(2, $process);\n }",
"public function seeFailNow() {\n return $this->getScenario()->runStep(new \\Codeception\\Step\\Assertion('seeFailNow', func_get_args()));\n }",
"public function error() {\n // The tests cover errors, so there will be plenty to sift through\n // $msg = func_get_arg(0);\n // $err = 'API ERROR: ' . $msg . PHP_EOL;\n\n // $objs = func_get_args();\n // array_splice($objs, 0, 1);\n\n // ob_start();\n // foreach($objs as $obj) {\n // var_dump($obj);\n // }\n // $strings = ob_get_clean();\n\n // file_put_contents('tests.log', [$err, $strings], FILE_APPEND);\n }",
"public function _summary() {\n $text = $this->_failed ? 'TESTS FAILED!' : 'TESTS PASSED';\n $result = $this->_colors->getColoredString($text, $this->_colorsPalete[!$this->_failed]);\n $this->_log($result);\n }",
"public function testBreadcrumb() {\n\t\t$this->assertNull($this->Html->getCrumbs());\n\n\t\t$this->Html->addCrumb('First', '#first');\n\t\t$this->Html->addCrumb('Second', '#second');\n\t\t$this->Html->addCrumb('Third', '#third');\n\n\t\t$result = $this->Html->getCrumbs();\n\t\t$expected = array(\n\t\t\tarray('a' => array('href' => '#first')),\n\t\t\t'First',\n\t\t\t'/a',\n\t\t\t'»',\n\t\t\tarray('a' => array('href' => '#second')),\n\t\t\t'Second',\n\t\t\t'/a',\n\t\t\t'»',\n\t\t\tarray('a' => array('href' => '#third')),\n\t\t\t'Third',\n\t\t\t'/a',\n\t\t);\n\t\t$this->assertTags($result, $expected);\n\n\t\t$result = $this->Html->getCrumbs(' > ');\n\t\t$expected = array(\n\t\t\tarray('a' => array('href' => '#first')),\n\t\t\t'First',\n\t\t\t'/a',\n\t\t\t' > ',\n\t\t\tarray('a' => array('href' => '#second')),\n\t\t\t'Second',\n\t\t\t'/a',\n\t\t\t' > ',\n\t\t\tarray('a' => array('href' => '#third')),\n\t\t\t'Third',\n\t\t\t'/a',\n\t\t);\n\t\t$this->assertTags($result, $expected);\n\n\t\t$this->Html->addCrumb('Fourth', null);\n\n\t\t$result = $this->Html->getCrumbs();\n\t\t$expected = array(\n\t\t\tarray('a' => array('href' => '#first')),\n\t\t\t'First',\n\t\t\t'/a',\n\t\t\t'»',\n\t\t\tarray('a' => array('href' => '#second')),\n\t\t\t'Second',\n\t\t\t'/a',\n\t\t\t'»',\n\t\t\tarray('a' => array('href' => '#third')),\n\t\t\t'Third',\n\t\t\t'/a',\n\t\t\t'»',\n\t\t\t'Fourth'\n\t\t);\n\t\t$this->assertTags($result, $expected);\n\n\t\t$result = $this->Html->getCrumbs('-', 'Start');\n\t\t$expected = array(\n\t\t\tarray('a' => array('href' => '/')),\n\t\t\t'Start',\n\t\t\t'/a',\n\t\t\t'-',\n\t\t\tarray('a' => array('href' => '#first')),\n\t\t\t'First',\n\t\t\t'/a',\n\t\t\t'-',\n\t\t\tarray('a' => array('href' => '#second')),\n\t\t\t'Second',\n\t\t\t'/a',\n\t\t\t'-',\n\t\t\tarray('a' => array('href' => '#third')),\n\t\t\t'Third',\n\t\t\t'/a',\n\t\t\t'-',\n\t\t\t'Fourth'\n\t\t);\n\t\t$this->assertTags($result, $expected);\n\t}",
"protected function breadcrumbTest() {\n // Breadcrumb should show Keywords: orange > Type: article, item.\n $initial_query = ['search_api_fulltext' => 'foo', 'test_param' => 1];\n $this->drupalGet('search-api-test-fulltext', ['query' => $initial_query]);\n\n $this->clickLink('item');\n $this->assertSession()->linkExists('Type: item');\n\n $this->clickLink('article');\n $this->assertSession()->linkExists('Type: article, item');\n\n $this->clickLink('orange');\n $this->assertSession()->linkExists('Keywords: orange');\n $this->assertSession()->linkExists('Type: article, item');\n\n $this->clickLink('Type: article, item');\n\n $this->assertSession()->linkExists('Keywords: orange');\n $this->assertSession()->linkExists('Type: article, item');\n $this->checkFacetIsActive('orange');\n $this->checkFacetIsActive('item');\n $this->checkFacetIsActive('article');\n\n $this->clickLink('Keywords: orange');\n $this->assertSession()->linkExists('Keywords: orange');\n $this->assertSession()->linkNotExists('Type: article, item');\n $this->checkFacetIsActive('orange');\n $this->checkFacetIsNotActive('item');\n $this->checkFacetIsNotActive('article');\n\n // Check that the current url still has the initial parameters.\n $curr_url = UrlHelper::parse($this->getUrl());\n foreach ($initial_query as $key => $value) {\n $this->assertArrayHasKey($key, $curr_url['query']);\n $this->assertEquals($value, $curr_url['query'][$key]);\n }\n }",
"public function afterStepScreenShotOnFailure(AfterStepScope $scope)\n {\n $currentSuite = self::$currentSuite;\n $stepPassed = $scope->getTestResult()->isPassed();\n\n //if test has failed, and is not an api test, get screenshot\n if(!$stepPassed)\n {\n $driver = $this->getSession()->getDriver();\n if (!$driver instanceof Selenium2Driver) {\n return;\n }\n\n //create filename string\n $fileName = BehatFormatter::buildScreenshotName(\n $currentSuite,\n $scope->getFeature()->getTitle(),\n $this->currentScenario->getLine(),\n $scope->getStep()->getLine()\n );\n\n /*\n * Determine destination folder!\n * This must be equal to the printer output path.\n * How the fuck do I get that in here???\n *\n * Fuck it, create a temporary folder for the screenshots and\n * let the Printer copy those to the assets folder.\n * Spend too many time here! And output is not the contexts concern, it's the printers concern.\n */\n\n $temp_destination = getcwd().DIRECTORY_SEPARATOR.\".tmp_behatFormatter\";\n if (! is_dir($temp_destination)) {\n mkdir($temp_destination, 0777, true);\n }\n\n $this->saveScreenshot($fileName, $temp_destination);\n }\n\n // Let us save the page source code on errors:\n // It helps us debug the test.\n if(!$stepPassed && self::$htmlSourceErrorOutput)\n {\n //create filename string\n $fileName = $currentSuite.\".\".basename($scope->getFeature()->getFile()).'.'.$scope->getStep()->getLine().'.html';\n $fileName = str_replace('.feature', '', $fileName);\n\n $htmlContent = sprintf('<!DOCTYPE html><html>%s</html>', $this->getSession()->getPage()->getHtml());\n\n $temp_destination = getcwd().DIRECTORY_SEPARATOR.\".tmp_behatFormatter\";\n if (! is_dir($temp_destination)) {\n mkdir($temp_destination, 0777, true);\n }\n\n file_put_contents(implode(DIRECTORY_SEPARATOR, array($temp_destination, $fileName)), $htmlContent);\n }\n\n }",
"function gradereport_failed_myprofile_navigation(core_user\\output\\myprofile\\tree $tree, $user, $iscurrentuser, $course) {\n if (empty($course)) {\n // We want to display these reports under the site context.\n $course = get_fast_modinfo(SITEID)->get_course();\n }\n $systemcontext = context_system::instance();\n $usercontext = context_user::instance($user->id);\n $coursecontext = context_course::instance($course->id);\n if (grade_report_overview::check_access($systemcontext, $coursecontext, $usercontext, $course, $user->id)) {\n $url = new moodle_url('/grade/report/failed/index.php', array('userid' => $user->id));\n $node = new core_user\\output\\myprofile\\node('reports', 'grades', get_string('gradesoverview', 'gradereport_overview'),\n null, $url);\n $tree->add_node($node);\n }\n}",
"protected function _reportFailure($log)\n {\n $this->_indent++;\n $type = $log->type();\n switch ($type) {\n case \"failed\":\n foreach ($log->children() as $expectation) {\n if ($expectation->type() !== 'failed') {\n continue;\n }\n\n $data = $expectation->data();\n $isExternal = isset($data['external']) && $data['external'];\n\n if ($isExternal) {\n $this->write(\"expectation failed in \", 'red');\n } else {\n $this->write(\"expect->{$expectation->matcherName()}() failed in \", 'red');\n }\n\n $this->write(\"`{$expectation->file()}` \");\n $this->write(\"line {$expectation->line()}\", 'red');\n $this->write(\"\\n\\n\");\n\n if ($isExternal) {\n $this->write($data['description']);\n $this->write(\"\\n\\n\");\n } else {\n $this->_reportDiff($expectation);\n }\n }\n break;\n case \"errored\":\n $backtrace = Debugger::backtrace(['trace' => $log->exception()]);\n $trace = reset($backtrace);\n $file = $trace['file'];\n $line = $trace['line'];\n\n $this->write(\"an uncaught exception has been thrown in \", 'magenta');\n $this->write(\"`{$file}` \");\n $this->write(\"line {$line}\", 'magenta');\n $this->write(\"\\n\\n\");\n\n $this->write('message:', 'yellow');\n $this->_reportException($log->exception());\n $this->prefix($this->format(' ', 'n;;magenta') . ' ');\n $this->write(Debugger::trace(['trace' => $backtrace]));\n $this->prefix('');\n $this->write(\"\\n\\n\");\n break;\n }\n $this->_indent--;\n }",
"function PHPUnit_TestFailure(&$failedTest, &$thrownException) {\n $this->_failedTest = &$failedTest;\n $this->_thrownException = &$thrownException;\n }",
"public function failScreenshots(StepEvent $event)\n {\n if($event->getResult() == StepEvent::FAILED)\n {\n $scenarioName = str_replace(\" \", \"_\", $event->getStep()->getParent()->getTitle());\n $this->saveScreenshot(sprintf(\"fail_%s_%s.png\", time(), $scenarioName));\n }\n }",
"public function test_extended_error_controller()\n {\n \\Staq::App()->run();\n $this->expectOutputHtmlContent('error 404');\n }",
"public function fail($msg) {\n $this->tests++;\n $this->fail++;\n echo \"[FAIL] {$msg}\\n\";\n }",
"public function testFailAssertionOverride(): void\n {\n $process = $this->phpbench(\n 'run benchmarks/set5/AssertFailBench.php --assert=\"1 < 2\"'\n );\n $this->assertExitCode(0, $process);\n }",
"public function testGetErrorMessagesAfterValidationFailure()\n {\n $this->validator->isValid(-211);\n $this->assertCount(1, $this->validator->errors());\n }",
"function DumpResultRows($ResultArray,$BackgroundColor,$Color,$Text,$Odd=false)\n{\n\tif (count($ResultArray)):?>\n<tr style='background-color:<?php exho ($BackgroundColor);?>;color:<?php exho ($Color)?>;font-weight:bold;'>\n<td colspan='4' >\n\t<?php exho (count($ResultArray)); \n\techo \" {$Text}\";\n\t?>\n\t\n</td>\n</tr>\n<?php \n\t\t$n=0;\n\t\tforeach ($ResultArray as $test)\n\t\t{\n\t\t\techo \"<tr>\";\n\t\t\techo \"<td width='50' align='center'>\\n\\t\\t\";\n\t\t\techo ++$n;\n\t\t\techo \"\\n</td>\";\n\t\t\t$t=$test->failedTest();\n\t\t\techo \"<td>\\n\\t\\t\";\n\t\t\techo get_class($t);\n\t\t\techo \" :: \";\n\t\t\techo $t->getName();\n\t\t\techo \"\\n</td>\";\n\t\t\techo \"<td>\\n\\t\\t\";\n\t\t\t$e=new Exception();\n \t\t\techo $test->getExceptionAsString();\n\t\t\techo \"</td>\";\n\t\t\techo \"<td>\\n\\t\\t\";\n\t\t\t$trace=($test->thrownException()->getTrace());\n\t\t\tif ($Odd)\n\t\t\t{\n\t\t\t\t$file=$trace[0]['file'];\n\t\t\t\t$line=$trace[0]['line'];\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (isset($trace[3]['file']))\n\t\t\t\t{\n\t\t\t\t\t$file=$trace[3]['file'];\n\t\t\t\t\t$line=$trace[3]['line'];\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\t$file=$line=null;\n\t\t\t}\n\t\t\tif ($file!==null)\n\t\t\t{\n\t\t\t\t$dir=substr($file, 0,strlen(jf::root()));\n\t\t\t\t$dir=substr($file,0,strpos($file,DIRECTORY_SEPARATOR,strlen($dir)+1));\n\t\t\t\t$dir=substr($file,0,strpos($file,DIRECTORY_SEPARATOR,strlen($dir)+1));\n\t\t\t\t$filename=substr($file,strlen($dir)+1);\n\t\t\t\techo $dir.\"/<strong>{$filename}</strong> :{$line}\";\n\t\t\t}\n\t\t\telse\n\t\t\t\techo \"File: Could not determine, probably because of fatal error.\";\n\t\t\t\n\t\t\techo \"\\n</td>\\n\";\n\t\t\techo \"</tr>\\n\";\n\t\t}\n\t\t?>\n\t<?php \n\tendif;\t\n}"
] |
[
"0.601981",
"0.59630036",
"0.58524895",
"0.58375275",
"0.56649286",
"0.560354",
"0.5579519",
"0.5525216",
"0.5463562",
"0.53190404",
"0.52708405",
"0.52101594",
"0.5205633",
"0.5204799",
"0.51420987",
"0.5140156",
"0.51288825",
"0.51245034",
"0.50245214",
"0.50097895",
"0.49899215",
"0.4981797",
"0.4964192",
"0.4956242",
"0.49432135",
"0.49294823",
"0.4925838",
"0.49110258",
"0.49018908",
"0.4883779"
] |
0.74110144
|
0
|
Paints a PHP error or exception.
|
function paintError($message) {
parent::paintError($message);
print "<div><span class=\"red\">Exception:</span> <strong>";
$breadcrumb = $this->getTestList();
array_shift($breadcrumb);
print implode(" -> ", $breadcrumb);
print "</strong><br />\n<span class=\"exception\">" . $this->_htmlEntities($message) . "</span></div>\n";
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"protected function renderAsError() {}",
"abstract public function error();",
"public static function error($text) {\n self::colorPrint(self::RED, $text);\n }",
"function paintError($message) {\r\n $this->_scorer->paintError($message);\r\n }",
"public function error();",
"function error(){}",
"function customError($errno, $errstr)\n {\n echo \"<b>Error:</b> [$errno] $errstr\";\n }",
"function customError($errno, $errstr)\n {\n echo \"<b>Error:</b> [$errno] $errstr\";\n }",
"public static function customErrorMsg()\n {\n echo \"\\n<p>An error occured, The error has been reported.</p>\";\n exit();\n }",
"function error($output)\n{\n output(\"<error>$output</error>\");\n}",
"abstract protected function echoExceptionWeb($exception);",
"function throwError($exceptionItem){\n\techo \"\n\t\n\t<p style='font-family:arial;color:red;font-size:20px;'> Error parsing : . $exceptionItem->error_message \n\t\n\t</p>\"; // catch this in the parse method and do $e->getMessage() to show it.\n\n\t//break; // try and break the current loop\n\n\n}",
"private static function _displayError($e) {\n\t\t\n\t\tif(!self::_initError($e->getMessage(), $e->getFile(), $e->getLine())) {\n\t\t\theader($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error', true, 500);\n\t\t\techo \"<pre><h1>Exception</h1>\" . $e->getMessage() . \" (\". $e->getCode() .\")\";\n\t\t\techo \"<br>\". $e->getFile() . \" | Line: \". $e->getLine();\n\t\t\techo \"<br><br>Trace:<br>\" . $e->getTraceAsString();\n\t\t\techo \"<br><br><hr>\". $_SERVER[\"SERVER_SIGNATURE\"] . \" © SBJ Framework\";\n\t\t\techo \"</pre>\";\t\n\t\t}\n\t\t\n\t\texit();\n\t}",
"public function showError();",
"public function error(string $text);",
"abstract public function display( $error );",
"function throw_user_error($error_code, $error_text) {\n http_response_code($error_code);\n echo $error_text;\n exit;\n}",
"public function error() {\n require_once($_SERVER['DOCUMENT_ROOT'] . '../PHPIncludes/pageLinkScriptsCSS.php');\n\n $pageRequirements = new pageLinkScriptsCSS();\n\n $pageRequirements->add(\"css\", ['error.css']);\n\n $pageRequirements->add(\"title\", 'The Sky Is Falling');\n\n callStructural('header','std',$pageRequirements);\n\n require_once('views/pages/error.php');\n\n //Render the page footer:\n callStructural(\"footer\", 'std', $pageRequirements); \n\n }",
"function report_error( $msg ) {\n $status_encoded = json_encode( \"error\" );\n $msg_encoded = json_encode( '<b><em style=\"color:red;\" >Error:</em></b> '.$msg );\n print <<< HERE\n{\n \"ResultSet\": {\n \"Status\": {$status_encoded},\n \"Message\": {$msg_encoded}\n }\n}\nHERE;\n exit;\n}",
"function errorHandler($errno, $errstr, $errfile, $errline)\n{\n\tif (error_reporting() == 0)\n\t{\n\t\treturn;\n\t}\n\n\t$errorType = array (\n E_ERROR => 'ERROR',\n E_WARNING => 'WARNING',\n E_PARSE => 'PARSING ERROR',\n E_NOTICE => 'NOTICE',\n E_CORE_ERROR => 'CORE ERROR',\n E_CORE_WARNING => 'CORE WARNING',\n E_COMPILE_ERROR => 'COMPILE ERROR',\n E_COMPILE_WARNING => 'COMPILE WARNING',\n E_USER_ERROR => 'USER ERROR',\n E_USER_WARNING => 'USER WARNING',\n E_USER_NOTICE => 'USER NOTICE',\n E_STRICT => 'STRICT NOTICE',\n E_RECOVERABLE_ERROR => 'RECOVERABLE ERROR'\n );\n\n\t$fatalArray = array(E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR, E_RECOVERABLE_ERROR);\n\n\t$oKrullHtml =& krullHtml::getInstance();\n\n\tif(!in_array($errno,$fatalArray))\n\t{\n\t\tif($errno == E_USER_ERROR)\n\t\t{\n\t\t\t$oKrullHtml->clean(true);\n\t\t\t$oKrullHtml->addMsgBox(KRULL_COLORBOX_RED, $errorType[$errno].' : '.basename($errfile).' ,'.$errline, $errstr);\n\t\t\t$oKrullHtml->buildHtmlDocument();\n\t\t\techo $oKrullHtml->getMainBuffer();\n\t\t\texit;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$oKrullHtml->addMsgBox(KRULL_COLORBOX_ORANGE, $errorType[$errno].' : '.basename($errfile).' ,'.$errline, $errstr);\n\t\t}\n\t}\n\telse\n\t{\n\t\techo $errorType[$errno].'::'.$errstr.'; A la ligne'.$errline.' dans le fichier'.$errfile.'.'.\"\\n\";\n\t}\n}",
"function PHPErro($ErrNo, $ErrMsg, $ErrFile, $ErrLine) {\r\n $CssClass = ($ErrNo == E_USER_NOTICE ? WS_INFOR : ($ErrNo == E_USER_WARNING ? WS_ALERT : ($ErrNo == E_USER_ERROR ? WS_ERROR : $ErrNo)));\r\n echo \"<p class=\\\"trigger {$CssClass}\\\">\";\r\n echo \"<b>Erro na Linha: {$ErrLine} ::</b> {$ErrMsg} <br>\";\r\n echo \"<small>{$ErrFile}</small>\";\r\n echo \"<span class=\\\"ajax_close\\\">{$ErrMsg}</span></p>\";\r\n\r\n if ($ErrNo == E_USER_ERROR):\r\n die;\r\n endif;\r\n}",
"public function error() {\n require_once($_SERVER['DOCUMENT_ROOT'] . '../PHPIncludes/pageLinkScriptsCSS.php');\n\n $pageRequirements = new pageLinkScriptsCSS();\n\n $pageRequirements->add(\"css\", ['error.css']);\n\n $pageRequirements->add(\"title\", 'The Sky Is falling');\n\n callStructural('header','std',$pageRequirements);\n\n require_once('views/pages/error.php');\n\n //Render the page footer:\n callStructural(\"footer\", 'std', $pageRequirements); \n\n\n }",
"function error($message);",
"function error ($message, $link='') {\n\n global $CFG, $SESSION, $THEME;\n debugging('error() is a deprecated function, please call print_error() instead of error()', DEBUG_DEVELOPER);\n $message = clean_text($message); // In case nasties are in here\n\n /**\n * TODO VERY DIRTY HACK USED FOR UNIT TESTING UNTIL PROPER EXCEPTION HANDLING IS IMPLEMENTED\n */\n if (defined('UNITTEST')) {\n // Errors in unit test become exceptions, so you can unit test\n // code that might call error().\n throw new Exception('error() call: '. $message.($link!=='' ? ' ['.$link.']' : ''));\n }\n\n if (defined('FULLME') && FULLME == 'cron') {\n // Errors in cron should be mtrace'd.\n mtrace($message);\n die;\n }\n\n if (! defined('HEADER_PRINTED')) {\n //header not yet printed\n @header('HTTP/1.0 404 Not Found');\n print_header(get_string('error'));\n } else {\n print_container_end_all(false, $THEME->open_header_containers);\n }\n\n echo '<br />';\n print_simple_box($message, '', '', '', '', 'errorbox');\n\n debugging('Stack trace:', DEBUG_DEVELOPER);\n\n // in case we are logging upgrade in admin/index.php stop it\n if (function_exists('upgrade_log_finish')) {\n upgrade_log_finish();\n }\n\n if (empty($link) and !defined('ADMIN_EXT_HEADER_PRINTED')) {\n if ( !empty($SESSION->fromurl) ) {\n $link = $SESSION->fromurl;\n unset($SESSION->fromurl);\n } else {\n $link = $CFG->wwwroot .'/';\n }\n }\n\n if (!empty($link)) {\n print_continue($link);\n }\n\n print_footer();\n\n for ($i=0;$i<512;$i++) { // Padding to help IE work with 404\n echo ' ';\n }\n\n die;\n}",
"function handle_error($exception) {\n try {\n print $this->encode(array(\n 'error' => $exception->getMessage(),\n 'message' => $exception->getMessage(), // Should be a i18n end user message\n 'data' => @$exception->data,\n 'status' => @$exception->status\n ));\n } catch(Exception $e) {\n echo 'Error: '.$e->getmessage();\n }\n }",
"static function error ($error, $data=null) {\n\t\tView::render ('error', array ('error'=>$error));\n\t\ttrigger_error (print_r (array ($error, $data), true));\n\t\texit ();\n\t}",
"function error($message) {\n die(\"{\\\"error\\\":\\\"$message\\\"}\");\n }",
"function sysError( $err = NULL, $errHeader = NULL, $errTitle = NULL ){\n\t\n\tglobal $output, $sys;\n\t\n\t$err = ( $err === NULL ) ? \"We apologize for the trouble! Please try again later.\" : $err;\n\t\n\tif( defined( \"NO_STYLING\" ) && NO_STYLING == true )\n\t\t// Ajax generated error - do not return HTML\n\t\tdie( $err );\n\t\n\t$errHeader = ( $errHeader === NULL ) ? \"We've hit an error\" : $errHeader;\n\t$errTitle = ( $errTitle === NULL ) ? \"Oops!\" : $errTitle;\n\t\n\t$output['message']['title'] = $errHeader;\n\t$output['message']['text'] = $err;\n\t\n\t$screen = new Screen();\n\t$screen->show( 'master/error_message.tpl', $errTitle );\n\t\n\texit();\n\t\n}",
"static function showError($errno, $errstr, $errfile, $errline, $errcontext, $errtype) {\n\t\tif(!headers_sent()) {\n\t\t\t$errText = \"$errtype: \\\"$errstr\\\" at line $errline of $errfile\";\n\t\t\t$errText = str_replace(array(\"\\n\",\"\\r\"),\" \",$errText);\n\t\t\tif(!headers_sent()) header($_SERVER['SERVER_PROTOCOL'] . \" 500 $errText\");\n\t\t\t\n\t\t\t// if error is displayed through ajax with CliDebugView, use plaintext output\n\t\t\tif(Director::is_ajax()) header('Content-Type: text/plain');\n\t\t}\n\t\t\n\t\t// Legacy error handling for customized prototype.js Ajax.Base.responseIsSuccess()\n\t\t// if(Director::is_ajax()) echo \"ERROR:\\n\";\n\t\t\n\t\t$reporter = self::create_debug_view();\n\t\t\n\t\t// Coupling alert: This relies on knowledge of how the director gets its URL, it could be improved.\n\t\t$httpRequest = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_REQUEST['url'];\n\t\tif(isset($_SERVER['REQUEST_METHOD'])) $httpRequest = $_SERVER['REQUEST_METHOD'] . ' ' . $httpRequest;\n\n\t\t$reporter->writeHeader($httpRequest);\n\t\t$reporter->writeError($httpRequest, $errno, $errstr, $errfile, $errline, $errcontext);\n\n\t\t$lines = file($errfile);\n\n\t\t// Make the array 1-based\n\t\tarray_unshift($lines,\"\");\n\t\tunset($lines[0]);\n\n\t\t$offset = $errline-10;\n\t\t$lines = array_slice($lines, $offset, 16, true);\n\t\t$reporter->writeSourceFragment($lines, $errline);\n\n\t\t$reporter->writeTrace($lines);\n\t\t$reporter->writeFooter();\n\t\texit(1);\n\t}",
"function returnError($message, $code)\n{\n throw new \\Exception($message, $code);\n}"
] |
[
"0.67150915",
"0.6558363",
"0.627476",
"0.62548786",
"0.62189686",
"0.6160931",
"0.6124619",
"0.6124619",
"0.61100054",
"0.60511816",
"0.60426193",
"0.6037098",
"0.6029367",
"0.6003699",
"0.60025007",
"0.5934317",
"0.59163636",
"0.5903851",
"0.59000987",
"0.588922",
"0.584969",
"0.5838322",
"0.58307636",
"0.583037",
"0.58270115",
"0.5817327",
"0.58096486",
"0.5796826",
"0.5785315",
"0.5784726"
] |
0.6653525
|
1
|
Paints formatted text such as dumped variables.
|
function paintFormattedMessage($message) {
print '<span class="pre">' . $this->_htmlEntities($message) . '</span>';
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function formatting()\n\t{\n\t\tmd('sketchpad::help/output/formatting');\n\t}",
"public function render()\n {\n $this->output->writeln('');\n\n $lineLength = $this->getTerminalWidth();\n\n $lines = explode(PHP_EOL, wordwrap($this->message, $lineLength - (strlen($this->blockStyles[$this->style]['prefix']) + 3), PHP_EOL, true));\n array_unshift($lines, ' ');\n array_push($lines, ' ');\n\n foreach ($lines as $i => $line) {\n $prefix = str_repeat(' ', strlen($this->blockStyles[$this->style]['prefix']));\n if ($i === 1) {\n $prefix = $this->blockStyles[$this->style]['prefix'];\n }\n\n $line = sprintf(' %s %s', $prefix, $line);\n $this->output->writeln(sprintf('<%s>%s%s</>', $this->blockStyles[$this->style]['style'], $line, str_repeat(' ', $lineLength - Helper::strlenWithoutDecoration($this->output->getFormatter(), $line))));\n }\n\n $this->output->writeln('');\n }",
"function draw_stat($text)\n{\n\tpf(htmlspecialchars($text));\n}",
"function string() {\n $styles = [];\n if ($this->fg !== null) {\n $styles []= $this->fg;\n }\n\n if ($this->bg !== null) {\n $styles []= $this->bg;\n }\n\n $styles = array_merge($styles, $this->format);\n\n if (empty($styles)) {\n return $this->str;\n } else {\n $escape = \"\\e[\" . join(';', $styles) . 'm';\n return $escape . $this->str . \"\\e[\" . self::ANSI_OFF . 'm';\n }\n }",
"function gdl_print_style( $selector, $content ){\n\t\tgdl_write_data( $selector . '{ ' . $content . '} ');\n\t}",
"public function formatGraphics() {\n }",
"function debug_data($text, $color = '')\n{\n\tswitch ($color)\n\t{\n\t\tcase 'red': $color = 31; break;\n\t\tcase 'green': $color = 32; break;\n\t\tcase 'orange': $color = 33; break;\n\t\tcase 'blue': $color = 34; break;\n\t}\n\tif ($color)\n\t{\n\t\techo \"\\033[\".$color.\"m\";\n\t}\n\techo $text.\"\\n\";\n\tif ($color)\n\t{\n\t\techo \"\\033[0m\";\n\t}\n\tflush();\n\t// ob_flush();\n}",
"public static function renderText();",
"public function getFormatContent(): string\n {\n $this->label = rtrim($this->label,';');\n return \"\\e[{$this->label}m{$this->content}\\e[0m\";\n }",
"function display_text($file) {\n\tglobal $lines;\n\tob_start();\n\tshow_source($file);\n\t$filecontents = ob_get_contents();\n\tob_end_clean();\n\t$filecontents = str_replace('<code>', '', $filecontents);\n\t$filecontents = str_replace('</code>', '', $filecontents);\n\t$filecontents = str_replace(\"\\n\", '', $filecontents);\n\t$filecontents = explode('<br />', $filecontents);\n\t$lines = count($filecontents);\n\t$iLen = strlen($lines);\n\tfor($i = 0; $i < $lines; $i++) {\n\t\t$sGap = ($iLen - strlen($i+1));\n\t\t$filecontents[$i] = '<span style=\"color: #999999\">'.str_repeat(' ', $sGap).($i+1).' </span>'.$filecontents[$i].\"<br />\\n\";\n\t}\n\t$filecontents = implode('', $filecontents);\n\treturn \"\\n$filecontents\\n\";\n}",
"public static function printAsHTML( $text ) {\n /*\n ESC[x;yH\tmove to x,y\n ESC[2J\tclear\n ESC[0J\tline clear\n ESC[0m\tnormal mode\n ESC[1m\tbold\n ESC[4m\tunderbar\n ESC[5m\tblink\n ESC[7m\tcolor reverse\n */\n $control = self::getControlCode(); \n $result = \"\";\n $lines = explode(\"\\n\", $text);\n $tags = array();\n foreach ( $lines as $line ) {\n $tmpLine = $line;\n $length = mb_strlen($line);\n for ( $i = 0; $i < $length; $i++ ) {\n $result = array();\n if ( preg_match('/<([\\/]*[a-zA-Z0-9\\=\"\\' ]+)>/', $tmpLine, $result, 0, $i) ) {\n $code = strtolower($result[1]);\n $content = $code;\n $offset = mb_strpos($tmpLine, '<'.$code.'>', $i);\n $i = $offset - 1;\n $colors = \"\";\n if ( $offset === false ) break;\n //FONT?\n if ( mb_strpos($code, 'font') === 0 ) {\n if ( mb_strpos($code, 'bgcolor') !== false ) {\n preg_match('/bgcolor\\=[\"|\\']([a-zA-Z]+)[\"|\\']/', $code, $result2);\n $bgKey = $result2[1];\n $color = isset(self::$bgColorMap[$bgKey]) ? self::$bgColorMap[$bgKey] : null;\n if ($color) {\n $color = $control . '[' . $color;\n }\n $colors = $color;\n $code = str_replace('bgcolor', '', $code);\n $tags['font'][] = $color;\n }\n if ( mb_strpos($code, 'color') !== false ) {\n preg_match('/color\\=[\"|\\']([a-zA-Z]+)[\"|\\']/', $code, $result2);\n $coKey = $result2[1];\n $color = isset(self::$colorMap[$coKey]) ? self::$colorMap[$coKey] : null;\n if ($color) {\n $color = $control . '[' . $color;\n }\n $colors .= $color;\n $tags['font'][] = $color;\n }\n $tmpLine = mb_substr($tmpLine, 0, $offset) . $colors . mb_substr($tmpLine, $offset + mb_strlen('<>' . $content));\n }\n //B?\n else if ( $code === 'b' || $code === 'strong' ) {\n $tmpLine = mb_substr($tmpLine, 0, $offset) . $control . '[1m' . mb_substr($tmpLine, $offset + mb_strlen('<>' . $code));\n $tmpLine = str_replace('<' . $code . '>', '', $tmpLine);\n $tags['b'][] = $control . '[1m';\n }\n //U?\n else if ( $code === 'u' ) {\n $tmpLine = mb_substr($tmpLine, 0, $offset) . $control . '[4m' . mb_substr($tmpLine, $offset + mb_strlen('<>' . $code));\n $tmpLine = str_replace('<' . $code . '>', '', $tmpLine);\n $tags['u'][] = $control . '[4m';\n }\n //BLINK?\n else if ( $code === 'blink' ) {\n $tmpLine = mb_substr($tmpLine, 0, $offset) . $control . '[5m' . mb_substr($tmpLine, $offset + mb_strlen('<>' . $code));\n $tmpLine = str_replace('<' . $code . '>', '', $tmpLine);\n $tags['blink'][] = $control . '[5m';\n }\n //REVERSE? (No exists html tags for color reversal, it's be temporary tag)\n else if ( $code === 'r' || $code === 'reverse' ) {\n $tmpLine = mb_substr($tmpLine, 0, $offset) . $control . '[7m' . mb_substr($tmpLine, $offset + mb_strlen('<>' . $code));\n $tmpLine = str_replace('<' . $code . '>', '', $tmpLine);\n $tags['reverse'][] = $control . '[7m';\n }\n //tag close.\n else if ( $code === '/font' ) {\n $next = \"\";\n unset($tags['font']);\n foreach ( $tags as $tag => $vals) {\n foreach ( $vals as $val ) {\n $next .= $val;\n }\n }\n $tmpLine = mb_substr($tmpLine, 0, $offset) . $control . '[0m' . $next . mb_substr($tmpLine, $offset + mb_strlen('<>' . $code));\n $tmpLine = str_replace('<' . $code . '>', '', $tmpLine);\n }\n else if ( $code === '/b' || $code === '/strong' ) {\n $next = \"\";\n unset($tags['b']);\n foreach ( $tags as $tag => $vals) {\n foreach ( $vals as $val ) {\n $next .= $val;\n }\n }\n $tmpLine = mb_substr($tmpLine, 0, $offset) . $control . '[0m' . $next . mb_substr($tmpLine, $offset + mb_strlen('<>' . $code));\n $tmpLine = str_replace('<' . $code . '>', '', $tmpLine);\n }\n else if ( $code === '/u' ) {\n $next = \"\";\n unset($tags['u']);\n foreach ( $tags as $tag => $vals) {\n foreach ( $vals as $val ) {\n $next .= $val;\n }\n }\n $tmpLine = mb_substr($tmpLine, 0, $offset) . $control . '[0m' . $next . mb_substr($tmpLine, $offset + mb_strlen('<>' . $code));\n $tmpLine = str_replace('<' . $code . '>', '', $tmpLine);\n }\n else if ( $code === '/blink' ) {\n $next = \"\";\n unset($tags['blink']);\n foreach ( $tags as $tag => $vals) {\n foreach ( $vals as $val ) {\n $next .= $val;\n }\n }\n $tmpLine = mb_substr($tmpLine, 0, $offset) . $control . '[0m' . $next . mb_substr($tmpLine, $offset + mb_strlen('<>' . $code));\n $tmpLine = str_replace('<' . $code . '>', '', $tmpLine);\n }\n else if ( $code === '/r' || $code === '/reverse' ) {\n $next = \"\";\n unset($tags['reverse']);\n foreach ( $tags as $tag => $vals) {\n foreach ( $vals as $val ) {\n $next .= $val;\n }\n }\n $tmpLine = mb_substr($tmpLine, 0, $offset) . $control . '[0m' . $next . mb_substr($tmpLine, $offset + mb_strlen('<>' . $code));\n $tmpLine = str_replace('<' . $code . '>', '', $tmpLine);\n }\n else {\n $i = $offset + mb_strlen('<>' . $code) - 1;\n }\n }\n $length = mb_strlen($tmpLine);\n }\n $result = $tmpLine;\n }\n echo $result . $control . \"[0m\\n\";\n }",
"function textOut($x, $y, $text)\r\n {\r\n $this->forceFont();\r\n echo \"$this->_canvas.drawString(\\\"$text\\\", $x, $y);\\n\";\r\n }",
"function printMessage(string $message, int $styleIndex = 0)\n{\n $styles = [\"\\e[0m\", \"\\e[32m\", \"\\e[33m\", \"\\e[31m\"];\n echo \"{$styles[$styleIndex]}{$message}{$styles[0]}\\n\";\n}",
"function pa($value)\n{\n print_r(\"<pre style='background-color: #f1f1f1; color: black; text-align: left; padding: 1rem;'>\");\n print_r($value);\n print_r(\"</pre>\");\n}",
"function dumpContents()\r\n {\r\n\r\n $attributes = $this->_getCommonAttributes();\r\n\r\n //TODO [Perez][JLeon] Do we leave this method?\r\n // call the OnShow event if assigned so the Text property can be changed\r\n if ($this->_onshow != null)\r\n {\r\n $this->callEvent('onshow', array());\r\n }\r\n\r\n $avalue = $this->_text;\r\n $avalue=str_replace('\"','"',$avalue);\r\n $type = \"progress\";\r\n if ($this->_type == pbsMeterBar)\r\n $type = \"meter\";\r\n echo \"<$type id=\\\"$this->_name\\\" value=\\\"$avalue\\\" $attributes>$this->_text</$type>\";\r\n\r\n }",
"public function graphic()\n {\n return \"die-\" . $this->value;\n }",
"protected function printText($text)\n {\n // search for color tags\n $matches = array();\n $pattern = \"#<<[0-9]+>>#\";\n preg_match_all($pattern, $text, $matches);\n $matches = $matches[0];\n\n $text = preg_split($pattern, $text);\n $text = array_filter($text, function($var) {\n // string \"0\" is rejected by default\n // so we test the string length instead\n if (is_string($var)) {\n return strlen($var) > 0;\n } else {\n return !empty($var);\n }\n });\n $text = array_reverse(array_reverse($text));\n\n // if the text does not begin with a color tag, we add one with default color\n if (count($text) > count($matches)) {\n array_unshift($matches, \"<<0>>\");\n }\n\n // print colored text\n $written = 0;\n\n foreach ($text as $k => $t) {\n $color = array_key_exists($k, $matches) ? (int) substr($matches[$k], 2) : 0;\n $length = strlen($t);\n $written += $length;\n\n $this->printRawText($t, $color);\n }\n\n return $written;\n }",
"function paintFormattedMessage($message) {\r\n $this->_scorer->paintFormattedMessage($message);\r\n }",
"public function print()\n {\n if (!headers_sent()) {\n header(\"Content-Type: text/html\");\n }\n\n $data = \"\";\n $args = func_get_args();\n foreach ($args as $arg) {\n $data .= $this->processLine($arg);\n }\n\n echo \"<style>$this->style</style>\";\n echo \"$data\";\n echo \"<script type='text/javascript'>$this->scripts</script>\";\n }",
"public function getColorfulText()\n {\n $output = \"\\033[1;31m--[ Agile Toolkit Exception ]---------------------------\\n\";\n $output .= get_class($this).\": \\033[47m\".$this->getMessage().\"\\033[0;31m\".\n ($this->getCode() ? ' [code: '.$this->getCode().']' : '');\n\n foreach ($this->params as $key => $val) {\n $key = str_pad($key, 19, ' ', STR_PAD_LEFT);\n $output .= \"\\n\".$key.': '.$this->toString($val);\n }\n\n $output .= \"\\n\\033[0mStack Trace: \";\n\n $in_atk = true;\n $escape_frame = false;\n\n foreach ($this->getMyTrace() as $call) {\n if (!isset($call['file'])) {\n $call['file'] = '';\n } elseif (\n $in_atk &&\n strpos($call['file'], '/data/src/') === false &&\n strpos($call['file'], '/core/src/') === false &&\n strpos($call['file'], '/dsql/src/') === false\n ) {\n $escape_frame = true;\n $in_atk = false;\n }\n\n $file = str_pad(substr($call['file'], -40), 40, ' ', STR_PAD_LEFT);\n\n $line = str_pad(@$call['line'], 4, ' ', STR_PAD_LEFT);\n\n $output .= \"\\n\\033[0;34m\".$file.\"\\033[0m\";\n $output .= \":\\033[0;31m\".$line.\"\\033[0m\";\n\n if (isset($call['object'])) {\n $name = (!isset($call['object']->name)) ? get_class($call['object']) : $call['object']->name;\n $output .= \" - \\033[0;32m\".$name.\"\\033[0m\";\n }\n\n $output .= \" \\033[0;32m\";\n\n if (isset($call['class'])) {\n $output .= $call['class'].'::';\n }\n\n if ($escape_frame) {\n $output .= \"\\033[0,31m\".$call['function'];\n $escape_frame = false;\n\n $args = [];\n foreach ($call['args'] as $arg) {\n $args[] = $this->toString($arg);\n }\n\n $output .= \"\\n\".str_repeat(' ', 20).\"\\033[0,31m(\".implode(', ', $args);\n } else {\n $output .= \"\\033[0,33m\".$call['function'].'(';\n }\n\n $output .= ')';\n }\n\n if ($p = $this->getPrevious()) {\n $output .= \"\\n\\033[0mCaused by Previous Exception:\\n\";\n $output .= \"\\033[1;31m\".get_class($p).': '.$p->getMessage().\"\\033[0;31m\".\n ($p->getCode() ? ' [code: '.$p->getCode().']' : '');\n }\n\n // next print params\n\n $output .= \"\\n\\033[1;31m--------------------------------------------------------\\n\";\n\n return $output.\"\\033[0m\";\n }",
"function print_late_styles()\n {\n }",
"public function render()\n {\n $percentage = (double) ($this->value / $this->total);\n\n $progress = floor($percentage * $this->size);\n $output = \"\\r[\" . str_repeat('=', $progress);\n if ($progress < $this->size) {\n $output .= \">\" . str_repeat(' ', $this->size - $progress);\n } else {\n $output .= '=';\n }\n $output .= sprintf('] %s%% %s/%s', round($percentage * 100, 0), $this->value, $this->total);\n\n if ($this->showRemainingTime) {\n $speed = (time() - $this->startTime) / $this->value;\n $remaining = number_format(round($speed * ($this->total - $this->value), 2), 2);\n $output .= \" $remaining sec remaining\";\n }\n\n return $output;\n }",
"public static function formatting_process() {}",
"protected function outputFormatted($text = '', array $arguments = [], $leftPadding = 0)\n {\n $this->output->outputFormatted($text, $arguments, $leftPadding);\n }",
"function salam(){echo\"\n\n\\e[34m \\e[38;5;208m,----. .--------------+ \\e[93m+ \\e[93m+ \\e[93m+\n\\e[34m ____ \\e[38;5;208m/ \\ __ / \\e[34m_____ \\e[38;5;208m/ \\e[93m+ \\e[93m+ \\e[93m+ \\e[93m+ \\e[93m+\n\\e[34m /\\ \\ \\e[38;5;208m/ \\( )/ -\\e[34m/\\ \\ \\e[38;5;208m/ \\e[93m+ \\e[93m+ \\e[93m+\n\\e[34m /::\\ \\ \\e[38;5;208m/ ,' \\/ ; --\\e[34m/::\\ \\ \\e[93m+ \\e[32m ///, //// \\e[93m+ \\e[93m+\n\\e[34m /::::\\ \\ \\e[38;5;208m/ / : : ---\\e[34m/::::\\ \\ \\e[93m+ \\e[93m+ \\e[32m \\ /, / >. \\e[93m+ \\e[93m+ \\e[93m+\n\\e[34m /::::::\\ \\ \\e[38;5;208m/ `; '---\\e[34m/::::::\\ \\ \\e[93m+ \\e[93m+ \\e[93m+ \\e[32m \\ /, _/ /. \\e[93m+\n\\e[34m /:::/\\:::\\ \\ \\e[38;5;208m //..\\\\ \\e[34m/:::/\\:::\\ \\ \\e[32m \\_ /_/ /.\\e[36mVersion \\e[93m+\n\\e[34m /:::/ \\:::\\ \\ \\e[38;5;208mUU====UU\\e[34m/:::/__\\:::\\ \\ \\e[93m+ \\e[93m+ \\e[32m \\__/_ < \\e[36m3.1 \\e[93m+\n\\e[34m /:::/ \\:::\\ \\ \\e[38;5;208m /||\\\\ \\e[34m\\:::\\ \\:::\\ \\ \\e[93m+ \\e[32m/<<< \\_\\_ \\e[93m+ \\e[93m+ \\e[93m+ \n\\e[34m /:::/ / \\:::\\ \\ \\e[38;5;208m``'``\\e[34m__\\:::\\ \\:::\\ \\ \\e[93m+ \\e[93m+ \\e[32m /\\e[91m,\\e[32m)^>>_._ \\ \\e[93m+\n\\e[34m /:::/ / \\:::\\ \\ /\\ \\:::\\ \\:::\\ \\ \\e[93m+ \\e[32m (/ \\\\ /\\\\\\ \\e[93m+\n\\e[34m/:::/____/ \\:::\\____\\_/::\\ \\:::\\ \\:::\\____\\ \\e[38;5;208m)\\e[93m+ \\e[93m+ \\e[32m // ```` \\e[93m+\n\\e[36m\\:::\\ \\ \\::/ / \\:::\\ \\:::\\ \\::/ / \\e[38;5;208m(\\) \\e[93m+ \\e[93m+ \\e[38;5;208m) \\e[32m(\\e[93m+\\e[32m(` \\e[93m+ \\e[93m+\n\\e[36m \\:::\\ \\ \\/____/ \\:::\\ \\:::\\ \\/____/ \\e[38;5;208m))/(\\) \\e[93m+ \\e[38;5;208m( )/( ( ( \\e[93m+ \n\\e[36m \\:::\\ \\ \\:::\\ \\:::\\ \\ \\e[38;5;208m(/(( ))\\ ( )( )\\()) )\\( )( ( \\e[93m+\n\\e[36m \\:::\\ \\ \\:::\\ \\:::\\____\\ \\e[38;5;208m) (_) (_)()/\\( (()\\ ((_)\\ /((_)(()\\ \\e[93m+\n\\e[36m \\:::\\ \\ \\:::\\ /:::/ / \\e[93m + \\e[38;5;208m )| \\ (_) ((_)| |(_)(_)) ((_) \\e[93m+\n\\e[36m \\:::\\ \\ \\:::\\/:::/ / \\e[91m| |) |/ _ \\| '_|| / / / -_) | '_| \\e[93m+\n\\e[36m \\:::\\ \\ \\::::::/ / \\e[93m + \\e[91m|___/ \\___/|_| |_\\_\\ \\___| |_| \\e[93m+\n\\e[36m \\:::\\____\\ \\::::/ / \\e[93m + \\e[97m©2020 \\e[93mCoded By - Mr.7ev3n \\e[93m+\n\\e[36m \\::/ / \\::/ / \\e[97m~ \\e[35mN93NT0T H4X0R \\e[97m~ \\e[93m+\n\\e[36m \\/____/ \\/____/ \\e[93m + \\e[97m~~ \\e[35mINDONESIAN H4X0R LITE \\e[97m~~ \\e[93m+\n\";\n}",
"public function render(): string\n\t{\n\t\treturn implode(' ', array_filter([\n\n\t\t\t$this->formatted_type,\n\t\t\t$this->formatted_attributes,\n\t\t\t$this->formatted_charset,\n\t\t\t$this->formatted_null,\n\t\t\t$this->formatted_auto_increment,\n\t\t\t$this->formatted_default,\n\t\t\t$this->formatted_comment\n\n\t\t]));\n\t}",
"public function render()\n\t{\n\t\t$this->printer->render();\n\t}",
"public static function colorPrint($color, $text) {\n print $color . $text . self::WHITE . \"\\n\";\n }",
"protected function _drawText()\n {\n $x = $this->_width*0.05;\n $y = $this->_height*0.96;\n\n $text_color=ImageColorAllocate($this->_image, 0x00, 0x00, 0x00);\n\n $fontsize = $this->scale*7;\n $kerning = $fontsize*1;\n\n for($i=0;$i<strlen($this->number);$i++)\n {\n imagettftext($this->_image, $fontsize, 0, $x, $y, $text_color, $this->font, $this->number[$i]);\n if($i==0 || $i==6)\n $x += $kerning*0.5;\n $x += $kerning;\n }\n }",
"public static function dump()\n {\n $html = \"\";\n\n foreach( func_get_args() as $value )\n {\n $html .= \"<div style=\\\"background: #ffc; margin: 20px; padding: 20px;\\\"> \\n\";\n $html .= \" <pre> \\n\";\n $html .= \" \" . print_r( $value, true ) .\" \\n\";\n $html .= \" </pre> \\n\";\n $html .= \"</div> \\n\";\n }\n echo trim( $html );\n exit;\n }"
] |
[
"0.664852",
"0.6417214",
"0.6341305",
"0.6264086",
"0.6251728",
"0.62476915",
"0.61549574",
"0.61076474",
"0.6071911",
"0.6067075",
"0.5946674",
"0.5925868",
"0.59111005",
"0.5908813",
"0.58934796",
"0.5862229",
"0.58467776",
"0.5846657",
"0.58154523",
"0.58023196",
"0.5788617",
"0.5780364",
"0.5773855",
"0.5757269",
"0.57392615",
"0.57257736",
"0.57047695",
"0.56934",
"0.56511396",
"0.56348044"
] |
0.64823216
|
1
|
Create a reference to an item
|
public function createRef(mixed $item): string;
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function createNewItem();",
"protected function createItem()\n {\n return $this->_setUpNewNode(\n new Item()\n );\n }",
"static public function factory($item)\n\t{\n\t\treturn new Item($item);\n\t}",
"public function getNewItem():Item {\r\n\t\t$item = new Item($this);\r\n\t\t$this->items[] = $item;\r\n\t\treturn $item;\r\n\t}",
"public function createNewItem() {\n\t\treturn new FeedItem($this->type);\n\t}",
"public function createNewItem()\n {\n $Item = new FeedItem($this->version);\n return $Item;\n }",
"function createItemLink($itemid, $extra = '') {\n return createLink('item', array('itemid' => $itemid, 'extra' => $extra) );\n}",
"public function createItem (Item $item) {\n $this->itemsDB->create($item);\n $item->setId($this->retrieveLastItemId());\n }",
"public function createItem($item) {\n\t\treturn tdb::insert(self::$tablename,$item);\n\t}",
"public function createNewItem()\n {\n return null;\n }",
"public function createItem($data);",
"public function ITEM($itemid) { $this->__construct($itemid); }",
"public function __construct($id, $item);",
"public function createItem( $preparedItem ) {\n\t}",
"public function addItem(Collection $collection, ItemCreateStruct $itemCreateStruct): Item;",
"abstract protected function createItem(string $name): Item;",
"abstract protected function createItemBase( array $values = [], array $listItems = [], array $refItems = [] );",
"function add($item);",
"public function add($item);",
"public function add($item);",
"function create_external_item_instance($external_item_intance)\r\n {\r\n return $this->create($external_item_intance);\r\n }",
"private function makeNewItem( $file )\r\n {\r\n $item = new Item();\r\n $item->setKey ( $file['key'] );\r\n $item->setReal ( $file['real'] );\r\n $item->setUri ( $file['uri'] );\r\n $item->setName ( $file['name'] );\r\n $item->setExtension ( $file['extension'] );\r\n $item->setType ( $file['type'] );\r\n $item->setSize ( $file['size'] );\r\n $item->setMtime ( $file['mtime'] );\r\n $item->resetSearchKeys( UrlManager::baseIndexPath() );\r\n return $item;\r\n }",
"abstract public function add_item();",
"public function create()\n {\n // Not needed cause this is coming from the item listing\n }",
"function register($item)\n {\n if (is_a($item, 'DVD') || is_a($item, 'Magazine') || is_a($item, 'Book')) {\n $item->setID(sizeof($this->collection) + 1);\n array_push($this->collection, $item);\n }\n }",
"public function __construct($item) {\n\t\t$this->item = $item;\n\t}",
"function createItem($item) {\n\t\tglobal $dbh;\n\t\t$stmt = $dbh->prepare('INSERT INTO ITEM VALUES (NULL, ?, ?, ?, ?)');\n\t\t$success = $stmt->execute(array($item['content'],\n\t\t\t\t\t\t\t\t\t\t$item['image'],\n\t\t\t\t\t\t\t\t\t\t$item['checked'],\n\t\t\t\t\t\t\t\t\t\t$item['listID']));\n\t\treturn $success;\n\t}",
"public function create(array $data): ChainableItemInterface;",
"public function createNewItem()\n {\n return new Phone(\n new TouchKeyboardB(),\n new TouchDisplayB(),\n 'Slyva',\n 'S2'\n );\n }",
"public function createNewItem()\n {\n return new Phone(\n new TouchKeyboardA(),\n new TouchDisplayA(),\n 'Abrykos',\n 'A2'\n );\n }"
] |
[
"0.7110566",
"0.69071543",
"0.65728295",
"0.65686893",
"0.65166664",
"0.65071255",
"0.64549434",
"0.64392424",
"0.6415871",
"0.6367542",
"0.63601637",
"0.6334513",
"0.6302035",
"0.6287497",
"0.6259955",
"0.6237168",
"0.6211163",
"0.61404705",
"0.60798806",
"0.60798806",
"0.6050198",
"0.6046001",
"0.6032613",
"0.60099524",
"0.60040075",
"0.6001864",
"0.60003906",
"0.5998471",
"0.59956586",
"0.5981346"
] |
0.76023394
|
0
|
Get the value of sigla
|
public function getSigla()
{
return $this->sigla;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getSigla($html = false) {\n\t\tif($this->getDisciplina(false) === null)\n\t\t\treturn null;\n\t\treturn $this->getDisciplina()->getSigla($html);\n\t}",
"public function getSiglaunidad()\n {\n return $this->siglaunidad;\n }",
"public function getSig()\n {\n return $this->sig;\n }",
"public function getSiglaUfCtps() {\n return $this->sSiglaUfCtps;\n }",
"public function getUfIdentidadeSigla() {\n return $this->sUfIdentidadeSigla;\n }",
"public function getSigAlgo()\n {\n return $this->sig_algo;\n }",
"function sigaloneval($origerr,$numplaces){\n\n\t\t$x=round($origerr*(pow(10,(($numplaces-1)-floor(log10($origerr)))))) * pow(10,(floor(log10($origerr)))-($numplaces-1));\n\t\n\t\treturn($x);\n\n\t}",
"public function getSifra()\n {\n return $this->sifra;\n }",
"public function getSifra()\n {\n return $this->sifra;\n }",
"public function setSigla(string $sigla)\n {\n $this->sigla = $sigla;\n }",
"function sigorigval($origval,$origerr,$numplaces){\n\n\t\t//Math from Noah McLean at MIT\n\n\t\t$x=round($origval*pow(10,(($numplaces-1)-floor(log10(2*$origerr))))) * pow(10,((floor(log10(2*$origerr))))-($numplaces-1));\n\t\n\t\treturn($x);\n\n\t}",
"public function value();",
"public function value();",
"public function value();",
"function sign()\r\n {\r\n return $this->Sign;\r\n }",
"public function &getValue();",
"public function getValue();",
"public function getValue();",
"public function getValue();",
"public function getValue();",
"public function getValue();",
"public function getValue();",
"public function getValue();",
"public function getValue();",
"public function getValue();",
"public function getValue();",
"public function getValue();",
"public function getValue();",
"public function getValue();",
"public function getValue();"
] |
[
"0.65596807",
"0.6495078",
"0.59951806",
"0.59473",
"0.58122236",
"0.5648063",
"0.55172443",
"0.5407703",
"0.53971636",
"0.53933156",
"0.53543425",
"0.53219277",
"0.53219277",
"0.53219277",
"0.5302642",
"0.5291449",
"0.5276865",
"0.5276865",
"0.5276865",
"0.5276865",
"0.5276865",
"0.5276865",
"0.5276865",
"0.5276865",
"0.5276865",
"0.5276865",
"0.5276865",
"0.5276865",
"0.5276865",
"0.5276865"
] |
0.8082754
|
1
|
Get the value of CNPJ
|
public function getCNPJ()
{
return $this->CNPJ;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getCodcaj(){\n\t\treturn $this->codcaj;\n\t}",
"public function getCni()\n {\n return $this->cni;\n }",
"public function getNuCNPJ()\n {\n return isset($this->nuCNPJ) ? $this->nuCNPJ : null;\n }",
"public function consultaCNPJ($cnpj = ''){\n\t\t\t$CNPJ_WS = 'http://receitaws.com.br/v1/cnpj/';\n\t\t\t$URL = $CNPJ_WS.$cnpj;\n\t\t\treturn json_decode( file_get_contents($URL) );\n\t\t}",
"function getCodcvv()\n {\n return $this->codcvv;\n }",
"public function getPvC()\n {\n return $this->pv_c;\n }",
"public function getC()\n {\n return $this->C;\n }",
"public function getNcm()\n {\n return $this->ncm;\n }",
"public function getValue();",
"public function getValue();",
"public function getValue();",
"public function getValue();",
"public function getValue();",
"public function getValue();",
"public function getValue();",
"public function getValue();",
"public function getValue();",
"public function getValue();",
"public function getValue();",
"public function getValue();",
"public function getValue();",
"public function getValue();",
"public function getValue();",
"public function getValue();",
"public function getValue();",
"public function getValue();",
"public function getValue();",
"public function getValue();",
"public function getValue();",
"public function formataCnpj($cnpj){\n $cnpj_formatado = substr($cnpj, 0, 2) . '.' . substr($cnpj, 2, 3) . '.' . substr($cnpj, 5, 3) . '/' . substr($cnpj, 8, 4) . '-' . substr($cnpj, 12, 2);\n \n return $cnpj_formatado;\n }"
] |
[
"0.6471755",
"0.64038754",
"0.6402528",
"0.6333007",
"0.5967163",
"0.5950158",
"0.59228194",
"0.5884882",
"0.5830677",
"0.5830677",
"0.5830677",
"0.5830677",
"0.5830677",
"0.5830677",
"0.5830677",
"0.5830677",
"0.5830677",
"0.5830677",
"0.5830677",
"0.5830677",
"0.5830677",
"0.5830677",
"0.5830677",
"0.5830677",
"0.5830677",
"0.5830677",
"0.5830677",
"0.5830677",
"0.5830677",
"0.5825145"
] |
0.6556659
|
0
|
Purpose: This function will make a SELECT DISTINCT on the makes. The result will be used to fill the html form select options for the select make dropdown in the UI. Inputs: None. Output: An associative array of results, or an exception.
|
public function findDistinctMake() {
// Try to run the SQL query.
try {
$this->query = $this->db->query("SELECT DISTINCT make FROM inventory ORDER BY make;");
$result = $this->query->fetchAll(\PDO::FETCH_ASSOC);
return $result;
} catch(\PDOException $e) {
exit($e->getMessage());
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function distinct($params=''){\n\t\t$this->_connect();\n\t\tif($this->_schema){\n\t\t\t$table = $this->_schema.'.'.$this->_source;\n\t\t} else {\n\t\t\t$table = $this->_source;\n\t\t}\n\t\t$numberArguments = func_num_args();\n\t\t$params = Utils::getParams(func_get_args(), $numberArguments);\n\t\tif(!isset($params['column'])){\n\t\t\t$params['column'] = $params['0'];\n\t\t} else {\n\t\t\tif(!$params['column']) {\n\t\t\t\t$params['column'] = $params['0'];\n\t\t\t}\n\t\t}\n\t\t$select = 'SELECT DISTINCT '.$params['column'].' FROM '.$table;\n\t\tif(isset($params['conditions'])&&$params['conditions']) {\n\t\t\t$select.=' WHERE '.$params[\"conditions\"];\n\t\t}\n\t\tif(isset($params['order'])&&$params['order']) {\n\t\t\t$select.=' ORDER BY '.$params[\"order\"].' ';\n\t\t} else {\n\t\t\t$select.=' ORDER BY 1 ';\n\t\t}\n\t\tif(isset($params['limit'])&&$params['limit']) {\n\t\t\t$select = $this->_limit($select, $params['limit']);\n\t\t}\n\t\t$results = array();\n\t\t$this->_db->setFetchMode(DbBase::DB_NUM);\n\t\tforeach($this->_db->fetchAll($select) as $result){\n\t\t\t$results[] = $result[0];\n\t\t}\n\t\t$this->_db->setFetchMode(DbBase::DB_ASSOC);\n\t\treturn $results;\n\t}",
"function genreopties(){\r\n\t\tglobal $pdo;\r\n\t\t\t//maken sql query\r\n\t\t$sql = \"SELECT DISTINCT genre_name FROM Genre\";\r\n\t\t\t//afschieten query\r\n\t\t$result = $pdo->query($sql)->fetchAll(PDO::FETCH_ASSOC);\r\n\t\t\r\n\t\tforeach($result as $row){\r\n\t\t\tforeach($row as $genre){\r\n\t\t\t\techo '<option value='.$genre.'>'.$genre.'</option>';\r\n\t\t\t}\r\n\t\t}\r\n\t}",
"function displayOptions(){\n global $dbConn;\n $sql = 'SELECT DISTINCT (category) FROM p1_quotes';\n $statement = $dbConn->prepare($sql); \n $statement->execute();\n $records = $statement->fetchAll();\n foreach ($records as $record) {\n echo '<option>' . $record[\"category\"] . '</option>';\n }\n}",
"function\tdropdown_list($dbconn) {\n\t$sqlcom=\"select distinct spec_id,name from info;\";\n\t$dbres = pg_exec($dbconn, $sqlcom );\n\tif ( ! $dbres ) {echo \"Error : \" + pg_errormessage( $dbconn ); exit();} \n\t$row=0;\n\t$rowmax=pg_NumRows($dbres);\n\tprint \"<form method=\\\"post\\\" action=\\\"libSpec.php\\\"><select name=\\\"organism\\\" onchange=\\\"this.form.submit();\\\">\\n<option value=\\\"select\\\">Select an organism...</option>\\n\"; \n\twhile ($row<$rowmax) {\n\t $do = pg_Fetch_Object($dbres, $row);\n\t $name=$do->name;\n\t print \"<option value=\\\"$name\\\">$name</option>\\n\";\n\t $row++;\n\t}\n\tprint(\"</select></form>\\n\\n\");\n}",
"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}",
"public function distinct(){\r\n\r\n if(starts_with($this->queryString, 'SELECT')){\r\n\r\n $this->queryString = str_replace(' <;distinct>', ' DISTINCT', $this->queryString);\r\n \r\n } \r\n return $this;\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 }",
"function buildVehiclesSelect($vehicles) {\r\n $prodList = '<select name=\"invId\" id=\"invId\">';\r\n $prodList .= \"<option>Choose a Vehicle</option>\";\r\n foreach ($vehicles as $vehicle) {\r\n $prodList .= \"<option value='$vehicle[invId]'>$vehicle[invMake] $vehicle[invModel]</option>\";\r\n }\r\n $prodList .= '</select>';\r\n return $prodList;\r\n }",
"function pmp_dist_default_distributor_input() {\n\t$sdk = new SDKWrapper();\n\t$pmp_things = $sdk->query2json('queryDocs', array(\n\t\t'profile' => 'user',\n\t\t'limit' => 9999\n\t));\n\n\t$settings = get_option('pmp_dist_settings');\n\t$guids = $settings['pmp_dist_default_distributor'];\n\t?>\n\t<select id=\"pmp_dist_default_distributor\" name=\"pmp_dist_settings[pmp_dist_default_distributor][]\" class=\"chosen\" multiple>\n\t\t<?php foreach ($pmp_things['items'] as $user) { ?>\n\t\t<option <?php if ( in_array($user['attributes']['guid'], $guids) ) { ?>selected<?php } ?> value=\"<?php echo $user['attributes']['guid']; ?>\"><? echo $user['attributes']['title']; ?></option>\n\t\t<?php } ?>\n\t</select>\n\t<script type=\"text/javascript\">\n\t\t(function() {\n\t\t\tvar $ = jQuery;\n\n\t\t\t$(document).ready(function() {\n\t\t\t\t$('select.chosen').chosen({disable_search_threshold: 10});\n\t\t\t});\n\t\t})();\n\t</script>\n\n<?php\n}",
"public function getDistinct() {\n\t\tif(is_null($this->distinct)) {\n\t\t\t$query = \"\";\n\t\t\t$query .= 'SELECT DISTINCT ';\n\t\t\t$query .= $this->getCodeField() . ' AS code, ';\n\t\t\t$query .= $this->getLabelField() . ' AS label';\n\t\t\t$query .= ' FROM ' . $this->getDatasourceName();\n\t\t\t$has_where = false;\n\t\t\tif(is_array($this->filter_value) && !in_array('-1', $this->filter_value)) {\n\t\t\t\t$select = \"\";\n\t\t\t\t$first = true;\n\t\t\t\tforeach($this->filter_value as $value) {\n\t\t\t\t\t$first ? $first = false : $select .= \",\";\n\t\t\t\t\t$select .= \"'\" . $value . \"'\";\n\t\t\t\t}\n\t\t\t\t$query .= ' WHERE ' . $this->getCodeField() . ' IN (' . $select . ')';\n\t\t\t\t$has_where = true;\n\t\t\t}\n\t\t\t$query .= ' ORDER BY ' . $this->getLabelField();\n\t\t\t$this->exploitResultset($this->execute($query));\n\t\t}\n\t\treturn $this->distinct;\n\t}",
"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 SelectValuesUnidad($db_conx) {\r\n $sql = \"SELECT uni_codigo, uni_descrip FROM tunidad ORDER BY uni_descrip ASC\";\r\n $query = mysqli_query($db_conx, $sql);\r\n\r\n $n_filas = $query->num_rows;\r\n $data = '<select class=\"unidadmedico\" multiple=\"multiple\" id=\"cmbunidad\">';\r\n $c = 0;\r\n while ($c < $n_filas) {\r\n $row = mysqli_fetch_array($query);\r\n $data .= '<option value=\"' . $row[0] . '\">' . $row[1] . '</option>';\r\n $c++;\r\n }\r\n $data .= '</select>';\r\n echo $data;\r\n}",
"function getKats($akt) {\r\n $katAR = array();\r\n $kats = '';\r\n $erg = db_query(\"SELECT DISTINCT `news_kat` FROM `prefix_news`\");\r\n while ($row = db_fetch_object($erg)) {\r\n $katAr[ ] = $row->news_kat;\r\n }\r\n $katAr[ ] = 'Allgemein';\r\n $katAr = array_unique($katAr);\r\n foreach ($katAr as $a) {\r\n if (trim($a) == trim($akt)) {\r\n $sel = ' selected';\r\n } else {\r\n $sel = '';\r\n }\r\n $kats .= '<option' . $sel . '>' . $a . '</option>';\r\n }\r\n return ($kats);\r\n}",
"function select_make_data($make_id)\n\t{\n\t\tglobal $db;\n\n\t\t$sql = \"SELECT make, id FROM \" . GARAGE_MAKES_TABLE . \" WHERE id = '$make_id' \";\n\n\t\tif( !($result = $db->sql_query($sql)) )\n\t\t{\n\t\t\tmessage_die(GENERAL_ERROR, 'Could Not Select Make', '', __LINE__, __FILE__, $sql);\n\t\t}\n\n\t\t$row = $db->sql_fetchrow($result);\n\t\t$db->sql_freeresult($result);\n\n\t\treturn $row;\n\t}",
"public function getManufacturersForDropdown() {\n $manufacturers = $this->orderby('name','ASC')->get();\n $manufacturers_for_dropdown = [];\n foreach($manufacturers as $manufacturer) {\n $manufacturers_for_dropdown[$manufacturer->id] = $manufacturer->name;\n }\n return $manufacturers_for_dropdown;\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 getAllProducerToSelect()\n {\n return $this->all()->toSelect('id', 'translation.name', $this->getCurrentLanguage());\n }",
"function createKeywordList($which, $original)\n{\n $sql = \"SELECT * FROM ReadingRoomSearchTerms order by Term\";\n $rows = simple_query($sql);\n\n $result = \"<select name=\\\"title\".$which.\"\\\">\";\n $result .= \"<OPTION value=\\\"None\\\"> </option>\";\n\n foreach ($rows as $term) {\n $result .= \"<OPTION value='\".$term['Term'].\"'\";\n $result .= (!strcmp($term['Term'], $original)) ? \" selected\" : \"\";\n $result .= \">\".$term['Term'].\"(\".$term['Number'].\")</option>\";\n }\n \n $result .= \"</select>\";\n return $result;\n}",
"function createUserList()\n{\n $sql = \"select netid,name from Statdir ORDER BY name\";\n $results = simple_query($sql);\n\n $result = \"<select name=\\\"ci_user\\\">\";\n $result .= \"<OPTION value=\\\"Me\\\">Me</option>\";\n\n foreach ($results as $name) {\n if (preg_match('/^\\s*$/', $name['name'])) continue;\n $result .= \"<OPTION value='\"\n .$name['netid']\n .\"'>\"\n .$name['name']\n .\"</option>\";\n }\n \n $result .= \"</select>\";\n return $result;\n}",
"public static function distinct();",
"function do_select_list_suppliers($aname, $avalue) {\n\t# Dim some Vars:\n\t\tglobal $_CCFG, $_TCFG, $_DBCFG, $db_coin, $_UVAR, $_LANG, $_SERVER, $_nl, $_sp;\n\n\t# Set Query for select.\n\t\t$query\t = 'SELECT s_id, s_company, s_name_first, s_name_last FROM '.$_DBCFG['suppliers'];\n\t\t$query\t.= \" WHERE s_email <> ''\";\n\t\t$query\t.= ' ORDER BY s_company ASC, s_name_last ASC, s_name_first ASC';\n\t\t$result\t = $db_coin->db_query_execute($query);\n\t\t$numrows\t = $db_coin->db_query_numrows($result);\n\n\t# Build form field output\n\t\t$_out .= '<select class=\"select_form\" name=\"'.$aname.'\" size=\"1\">'.$_nl;\n\t\t$_out .= '<option value=\"0\">'.$_LANG['_BASE']['Please_Select'].'</option>'.$_nl;\n\t\t$_out .= '<option value=\"-1\"';\n\t\tIF ($avalue == -1) {$_out .= ' selected';}\n\t\t$_out .= '>'.$_LANG['_MAIL']['All_Active_Suppliers'].'</option>'.$_nl;\n\n\t# Process query results to list individual suppliers\n\t\twhile(list($s_id, $s_company, $s_name_first, $s_name_last) = $db_coin->db_fetch_row($result)) {\n\t\t\t$_more = '';\n\n\t\t# Add supplier info, indenting if additional emails present\n\t\t\t$_out .= '<option value=\"'.$s_id.'\"';\n\t\t\tIF ($s_id == $avalue) {$_out .= ' selected';}\n\t\t\t$_out .= '>';\n\t\t\t$_out .= $s_company.' - '.$s_name_last.', '.$s_name_first.'</option>'.$_nl;\n\n\t\t# Grab any additional emails for this client, so they are all together in the list\n\t\t\t$_more = do_select_list_suppliers_additional_emails($s_id, $s_company);\n\n\t\t# Add \"All\" option, if necessary\n\t\t\tIF ($_more) {\n\t\t\t\tIF (substr_count($_more, '<option') > 1) {\n\t\t\t\t\t$_out .= '<option value=\"contacts|'.$cl_id.'\">'.$_sp.$_sp.$_sp.$s_company.' - '.$s_name_last.', '.$s_name_first.' ('.$_LANG['_BASE']['All_Contacts'].')</option>'.$_nl;\n\t\t\t\t}\n\t\t\t\t$_out .= $_more;\n\t\t\t}\n\t\t}\n\t\t$_out .= '</select>'.$_nl;\n\t\treturn $_out;\n}",
"public function distinct();",
"function get_college_programs() {\n $list = \"\";\n $list.=\"<select id='programs' style='width:155px;' required>\";\n $list.=\"<option value='0' selected>Program</option>\";\n $query = \"select * from mdl_course where category=5 and cost>0 and visible=1\";\n $result = $this->db->query($query);\n foreach ($result->result() as $row) {\n $list.=\"<option value='$row->id'>$row->fullname</option>\";\n }\n $list.=\"</select>\";\n\n return $list;\n }",
"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 SelectValuesUnidadFiltro($db_conx) {\r\n $sql = \"SELECT uni_codigo, uni_descrip FROM tunidad ORDER BY uni_descrip ASC\";\r\n $query = mysqli_query($db_conx, $sql);\r\n\r\n $n_filas = $query->num_rows;\r\n $data = '<select style=\"width:207px;\" id=\"cmbuni\">';\r\n $data .= '<option value=\"0\">Todos</option>';\r\n $c = 0;\r\n while ($c < $n_filas) {\r\n $row = mysqli_fetch_array($query);\r\n $data .= '<option value=\"' . $row[0] . '\">' . $row[1] . '</option>';\r\n $c++;\r\n }\r\n $data .= '</select>';\r\n echo $data;\r\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 getCompetitors()\n {\n \n $db=new mysql; $db->connect();\n $records=array();\n \n if($stmt=$db->conn->prepare('select distinct brandAAIAID from interchange order by brandAAIAID'))\n {\n $stmt->execute();\n $db->result = $stmt->get_result();\n while($row = $db->result->fetch_assoc())\n {\n $records[]=array('brandAAIAID'=>$row['brandAAIAID'],'name'=>$this->brandName($row['brandAAIAID']));\n }\n }\n $db->close();\n return $records; \n }",
"public static function getManufacturerDropdownArray() {\n global $lC_Database, $lC_Language;\n \n $manufacturers_array = array(array('id' => '', 'text' => $lC_Language->get('filter_all_manufacturers')));\n $Qmanufacturers = $lC_Database->query('select manufacturers_id, manufacturers_name from :table_manufacturers order by manufacturers_name');\n $Qmanufacturers->bindTable(':table_manufacturers', TABLE_MANUFACTURERS);\n $Qmanufacturers->execute();\n while ($Qmanufacturers->next()) {\n $manufacturers_array[] = array('id' => $Qmanufacturers->valueInt('manufacturers_id'),\n 'text' => $Qmanufacturers->value('manufacturers_name'));\n }\n \n return $manufacturers_array; \n }",
"public function populateSuburbDropdown() {\n\n $qry = $this->db->prepare('SELECT DISTINCT SUBURB FROM n8598177.items;');\n $qry->execute();\n\n echo('\n <select name=\"search-suburb\" class=\"suburb-select-box\">\n <option disabled selected value=\"\">Suburb...</option>\n ');\n foreach ($qry as $hotspot) {\n echo '<option value=\"' . $hotspot['SUBURB'] . '\">' . $hotspot['SUBURB'] . '</option>';\n }\n echo '</select>';\n }",
"function nf_makeDropDownWithSelected($idCol, $displayCol, $table, $matchvalue,$where='',$suppressSelectTag=0){\n $retval = '';\n $matched = 0;\n $result = DB_query( \"SELECT $idCol,$displayCol FROM $table $where\" );\n $nrows = DB_numRows( $result );\n\n for( $i = 0; $i < $nrows; $i++ ){\n $A = DB_fetchArray($result);\n $retval .='<option value=\"' . $A[0] . '\"';\n if($matchvalue == $A[0]){\n $retval .=\" selected=\\\"selected\\\" \";\n $matched=1;\n }\n $retval .='>' . $A[1] . '</option>';\n }\n if(!$suppressSelectTag){\n $retval .= '</select>';\n }\n if($matched){\n if(!$suppressSelectTag){\n $retval = '<select name=\"' . str_replace(\".\",\"\",$idCol . $displayCol) . '\"><option value=\"' . $value . '\" >' . $label . '</option>' . $retval;\n } else {\n $retval = '<option value=\"' . $value . '\" >' . $label . '</option>' . $retval;\n }\n } else{\n if(!$suppressSelectTag){\n $retval = '<select name=\"' . str_replace(\".\",\"\",$idCol . $displayCol) . '\"><option value=\"' . $value . '\" >' . $label . '</option>' . $retval;\n } else {\n $retval = '<option value=\"' . $value . '\" >' . $label . '</option>' . $retval;\n }\n }\n return $retval;\n}"
] |
[
"0.57166976",
"0.5695816",
"0.56835824",
"0.5583975",
"0.55825436",
"0.5581544",
"0.5538708",
"0.5488304",
"0.5487612",
"0.5487096",
"0.54698807",
"0.5431122",
"0.5425997",
"0.5421101",
"0.5403755",
"0.5362288",
"0.5355529",
"0.53241444",
"0.53171057",
"0.5287446",
"0.52649796",
"0.5202235",
"0.5186888",
"0.518334",
"0.5166278",
"0.51639926",
"0.5158649",
"0.5157338",
"0.51182777",
"0.5097709"
] |
0.70353496
|
0
|
Purpose: This function will make a SELECT DISTINCT on the colors. The result will be used to fill the html form select options for the select color dropdown in the UI. Inputs: None. Output: An associative array of results, or an exception.
|
public function findDistinctColor() {
// Try to run the SQL query.
try {
$this->query = $this->db->query("SELECT DISTINCT color FROM inventory ORDER BY color;");
$result = $this->query->fetchAll(\PDO::FETCH_ASSOC);
return $result;
} catch(\PDOException $e) {
exit($e->getMessage());
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function colorList() {\n $colorArr = (new \\yii\\db\\Query())\n ->select(['color'])\n ->from('product_variation')\n ->where(['!=', 'color', ''])\n ->groupBy(['color'])\n ->all();\n return $colorArr;\n }",
"public function colorsCombo()\n\t{\n\t\t$colors = getSetting('good_colors');\n\t\t$array = [];\n\t\tif(!$colors or !is_array($colors)) {\n\t\t\treturn [];\n\t\t}\n\n\t\tforeach($colors as $color) {\n\t\t\t$array[] = [$color, trans(\"colors.$color\")];\n\t\t}\n\n\t\treturn $array;\n\t}",
"public static function getColors()\n {\n $db = DataBase::connect();\n\n $result = $db->query('SELECT * FROM `color`');\n\n $colors = [];\n\n $i = 1;\n\n while($row = $result->fetch()) {\n $colors[$i]['color'] = $row['color'];\n $colors[$i]['ukr_title'] = $row['ukr_title'];\n $colors[$i]['upper_ukr_title'] = $row['upper_ukr_title'];\n $colors[$i]['default'] = $row['default'];\n\n $i++;\n }\n return $colors;\n }",
"private function getColors(): array\n {\n $colors = $this->website->getConfiguration()->getColors();\n $choices = [];\n foreach ($colors as $color) {\n if ($color->getCategory() === \"background\" && $color->getIsActive()) {\n $choices[$color->getAdminName()] = $color->getSlug();\n $this->colors[$color->getSlug()] = $color->getColor();\n }\n }\n return $choices;\n }",
"public function post_rating_colors()\n\t{\n\t\t\n\t\t$query = $this->db->query(\"SELECT `average`, `color` FROM `post_rating_colors`\");\n\t\t\n\t\t// echo $this->db->last_query();\n\t\t// print_r($query->result_array()\t);\n\t\t// die();\n\t\tif ($query->num_rows() > 0)\n\t\t{\n\t\t\t$all_colors = array();\n\t\t\tforeach ($query->result_array() as $value) {\n\t\t\t\t$all_colors[$value['average']] = $value['color'];\n\t\t\t}\n\t\t\treturn $all_colors;\n\t\t}\n\t}",
"function alm_filters_color_callback() {\n\n\t $options = get_option( 'alm_settings' );\n\n\t\tif(!isset($options['_alm_filters_color']))\n\t\t $options['_alm_filters_color'] = '0';\n\n\t $color = $options['_alm_filters_color'];\n\n\t\t $selected0 = '';\n\t\t if($color == 'default') $selected0 = 'selected=\"selected\"';\n\n\t\t $selected1 = '';\n\t\t if($color == 'blue') $selected1 = 'selected=\"selected\"';\n\n\t\t $selected2 = '';\n\t\t if($color == 'red') $selected2 = 'selected=\"selected\"';\n\n\t\t $selected3 = '';\n\t\t if($color == 'green') $selected3 = 'selected=\"selected\"';\n\n\n\t $html = '<label for=\"alm_settings_filters_color\">'.__('Choose the color of your filter elements', 'ajax-load-more-filters').'.</label><br/>';\n\t $html .= '<select id=\"alm_settings_filters_color\" name=\"alm_settings[_alm_filters_color]\">';\n\t $html .= '<option value=\"default\" ' . $selected0 .'>'. __('Default', 'ajax-load-more-filters') .'</option>';\n\t $html .= '<option value=\"blue\" ' . $selected1 .'>'. __('Blue', 'ajax-load-more-filters') .'</option>';\n\t $html .= '<option value=\"red\" ' . $selected2 .'>'. __('Red', 'ajax-load-more-filters') .'</option>';\n\t $html .= '<option value=\"green\" ' . $selected3 .'>'. __('Green', 'ajax-load-more-filters') .'</option>';\n\t $html .= '</select>';\n\n\t $html .= '<div class=\"clear\"></div>';\n\n\t $html .= '<div class=\"ajax-load-more-wrap alm-filters alm-filters-container filters-'.$color.'\"><span class=\"pages\">'.__('Preview', ALM_NAME) .'</span>';\n\n \t\t// Checkbox\n\t \t\t$html .= '<div class=\"alm-filter\" style=\"padding: 5px 0 20px; margin: 0; clear: both;\">';\n\t \t\t\t$html .= '<li class=\"alm-filter--checkbox\"><div class=\"alm-filter--link field-checkbox active\" data-type=\"checkbox\" data-value=\"design\">'. __('Checked', 'ajax-load-more-filters') .'</div></li>';\n\t \t\t\t$html .= '<li class=\"alm-filter--checkbox\"><div class=\"alm-filter--link field-checkbox\" data-type=\"checkbox\" data-value=\"design\">'. __('Unchecked', 'ajax-load-more-filters') .'</div></li>';\n\t \t$html .= '</div>';\n\n \t\t// Radio\n\t \t\t$html .= '<div class=\"alm-filter\" style=\"padding: 10px 0 0; margin: 0; clear: both;\">';\n\t \t\t\t$html .= '<li class=\"alm-filter--radio\"><div class=\"alm-filter--link field-radio active\" data-type=\"radio\" data-value=\"design\">'. __('Checked', 'ajax-load-more-filters') .'</div></li>';\n\t \t\t\t$html .= '<li class=\"alm-filter--checkbox\"><div class=\"alm-filter--link field-radio\" data-type=\"radio\" data-value=\"design\">'. __('Unchecked', 'ajax-load-more-filters') .'</div></li>';\n\t \t$html .= '</div>';\n\n \t\t// Button\n\t \t\t$html .= '<div class=\"alm-filters\" style=\"padding: 20px 0 5px; margin: 0; clear: both; min-width: 240px;\">';\n\t \t\t\t$html .= '<div class=\"alm-filters--submit\" style=\"margin: 0;\"><button type=\"button\" class=\"alm-filters--button\" style=\"margin: 0;\">'. apply_filters('alm_filters_button_text', __('Submit', 'ajax-load-more')) .'</button></div>';\n\t \t$html .= '</div>';\n\n\t $html .= '</div>';\n\n\n\t echo $html;\n\t?>\n\n\t<script>\n\n \t// Filter Preview\n \tvar colorArrayFilters = \"filters-default filters-red filters-green filters-blue\";\n \tjQuery(\"select#alm_settings_filters_color\").change(function() {\n \t\tvar color = jQuery(this).val();\n\t\t\tjQuery('.ajax-load-more-wrap.alm-filters').removeClass(colorArrayFilters);\n\t\t\tjQuery('.ajax-load-more-wrap.alm-filters').addClass('filters-'+color);\n\t\t});\n\t\tjQuery(\"select#alm_settings_filters_color\").click(function(e){\n\t\t\te.preventDefault();\n\t\t});\n\n\t\t// Check if Disable CSS === true\n\t\tif(jQuery('input#alm_filters_disable_css_input').is(\":checked\")){\n\t jQuery('select#alm_settings_filters_color').parent().parent().hide(); // Hide button color\n \t}\n\n \t// On load\n \tjQuery('input#alm_filters_disable_css_input').change(function() {\n \t\tvar el = jQuery(this);\n\t if(el.is(\":checked\")) {\n\t \tel.parent().parent('tr').next('tr').hide(); // Hide color\n\t }else{\n\t \tel.parent().parent('tr').next('tr').show(); // show color\n\t }\n\t });\n\n </script>\n\n\t<?php\n\t}",
"public function getColor1()\n {\n $sql = \"SELECT color_hex\n FROM site_color where site_color_id = 1\";\n\n $statement = $this->_dbh->prepare($sql);\n\n //$statement->bindParam(':color1', $color1);\n $statement->execute();\n //echo $statement;\n return $statement->fetchAll(PDO::FETCH_ASSOC);\n }",
"function ffw_port_color_select_callback( $args ) {\n global $ffw_port_settings;\n\n if ( isset( $ffw_port_settings[ $args['id'] ] ) )\n $value = $ffw_port_settings[ $args['id'] ];\n else\n $value = isset( $args['std'] ) ? $args['std'] : '';\n\n $html = '<select id=\"ffw_port_settings_' . $args['section'] . '[' . $args['id'] . ']\" name=\"ffw_port_settings_' . $args['section'] . '[' . $args['id'] . ']\"/>';\n\n foreach ( $args['options'] as $option => $color ) :\n $selected = selected( $option, $value, false );\n $html .= '<option value=\"' . $option . '\" ' . $selected . '>' . $color['label'] . '</option>';\n endforeach;\n\n $html .= '</select>';\n $html .= '<label for=\"ffw_port_settings_' . $args['section'] . '[' . $args['id'] . ']\"> ' . $args['desc'] . '</label>';\n\n echo $html;\n}",
"public function getColorArray($limit=null){\n $return_arr = array();\n $query = sprintf(\" SELECT * FROM %s ORDER BY creation_date DESC \",self::DB_TABLE);\n $db = Db::instance();\n $result = $db->lookup($query);\n if(!mysql_num_rows($result))\n return null;\n else {\n while($row = mysql_fetch_assoc($result)) {\n $row_array['id'] = $row['id']; //add id to row\n $row_array['username'] = $row['username']; //add username to the row\n $row_array['color'] = $row['color']; //add color to the row\n array_push($return_arr,$row_array); //push to the array\n }\n return $return_arr;\n }\n }",
"public function processColor()\n {\n $colorCalculator = new Color(self::$_query);\n $data = $colorCalculator->processQuery();\n\n return $data;\n }",
"public function chooseAvailableColors(){\n // if(!count($todayChosenColors) > 0) return Color::all();\n\n // ! Return Only Available Colors for today\n $availableColors = DB::table(\"colors\")->select('*')\n ->whereNOTIn('id',function($query){\n $query->select('color_id')->from('user_colors')->whereDate('created_at', \\Carbon\\Carbon::today());\n })->get();\n return $availableColors;\n }",
"public function colorList() {}",
"function GetAllDataProductColor($param = [])\n {\n if (isset($param['search_value']) && $param['search_value'] != '') {\n $this->db->group_start();\n $i = 0;\n foreach ($param['search_field'] as $row => $val) {\n if ($val['searchable'] == 'true') {\n if ($i == 0) {\n $this->db->like('LCASE(`'.$val['data'].'`)', strtolower($param['search_value']));\n } else {\n $this->db->or_like('LCASE(`'.$val['data'].'`)', strtolower($param['search_value']));\n }\n $i++;\n }\n }\n $this->db->group_end();\n }\n if (isset($param['row_from']) && isset($param['length'])) {\n $this->db->limit($param['length'], $param['row_from']);\n }\n if (isset($param['order_field'])) {\n if (isset($param['order_sort'])) {\n $this->db->order_by($param['order_field'], $param['order_sort']);\n } else {\n $this->db->order_by($param['order_field'], 'desc');\n }\n } else {\n $this->db->order_by('a.id', 'desc');\n }\n $data = $this->db\n ->select('*, a.id')\n ->where('a.is_delete', 0)\n ->get('t5_product_color a')\n ->result_array();\n\n return $data;\n }",
"public static function distinct();",
"public function getColor2()\n {\n $sql = \"SELECT color_hex\n FROM site_color where site_color_id = 2\";\n\n $statement = $this->_dbh->prepare($sql);\n\n// $statement->bindParam(':color2', $color2);\n $statement->execute();\n return $statement->fetchAll(PDO::FETCH_ASSOC);\n }",
"function GetAllColors () {\n $colors = array (\"#00FFFF\",\"#000000\",\"#0000FF\",\"#8A2BE2\",\"#A52A2A\",\"#DEB887\",\"#5F9EA0\",\"#7FFF00\",\"#D2691E\",\"#FF7F50\",\"#6495ED\",\"#00FFFF\",\"#00008B\",\"#008B8B\",\"#B8860B\",\"#A9A9A9\",\"#006400\",\"#BDB76B\",\"#8B008B\",\"#556B2F\",\"#FF8C00\",\"#9932CC\",\"#8B0000\",\"#E9967A\",\"#8FBC8F\",\"#483D8B\",\"#2F4F4F\",\"#2F4F4F\",\"#00CED1\",\"#9400D3\",\"#FF1493\",\"#00BFFF\",\"#696969\",\"#696969\",\"#1E90FF\",\"#B22222\",\"#228B22\",\"#FF00FF\",\"#FFD700\",\"#DAA520\",\"#808080\",\"#808080\",\"#008000\",\"#ADFF2F\",\"#FF69B4\",\"#CD5C5C\",\"#4B0082\",\"#7CFC00\",\"#ADD8E6\",\"#F08080\",\"#E0FFFF\",\"#D3D3D3\",\"#90EE90\",\"#FFB6C1\",\"#FFA07A\",\"#20B2AA\",\"#87CEFA\",\"#778899\",\"#778899\",\"#B0C4DE\",\"#00FF00\",\"#32CD32\",\"#FF00FF\",\"#800000\",\"#66CDAA\",\"#0000CD\",\"#BA55D3\",\"#9370D8\",\"#3CB371\",\"#7B68EE\",\"#00FA9A\",\"#48D1CC\",\"#C71585\",\"#191970\",\"#FFE4E1\",\"#FFE4B5\",\"#000080\",\"#808000\",\"#6B8E23\",\"#FFA500\",\"#FF4500\",\"#DA70D6\",\"#EEE8AA\",\"#98FB98\",\"#AFEEEE\",\"#D87093\",\"#FFDAB9\",\"#CD853F\",\"#FFC0CB\",\"#DDA0DD\",\"#B0E0E6\",\"#800080\",\"#FF0000\",\"#BC8F8F\",\"#4169E1\",\"#8B4513\",\"#FA8072\",\"#F4A460\",\"#2E8B57\",\"#A0522D\",\"#C0C0C0\",\"#87CEEB\",\"#6A5ACD\",\"#708090\",\"#708090\",\"#00FF7F\",\"#4682B4\",\"#D2B48C\",\"#008080\",\"#D8BFD8\",\"#FF6347\",\"#40E0D0\",\"#EE82EE\",\"#F5DEB3\",\"#FFFFFF\",\"#F5F5F5\",\"#FFFF00\",\"#9ACD32\");\n return($colors);\n}",
"public function getColor3()\n {\n $sql = \"SELECT color_hex\n FROM site_color where site_color_id = 3\";\n\n $statement = $this->_dbh->prepare($sql);\n\n// $statement->bindParam(':color3', $color3);\n $statement->execute();\n return $statement->fetchAll(PDO::FETCH_ASSOC);\n }",
"function queryColor($id){\n $db=connectDB();\n $sqlcmd=\"SELECT colorID FROM productcolor WHERE ID=?\"; // injection preventing\n $sql=$db->prepare($sqlcmd);\n $sql->execute(array($id));\n $colorid=$sql->fetchall(PDO::FETCH_COLUMN,0);\n\n//get colornames\n $cid=join(\",\",$colorid);\n $sqlcmd=\"SELECT colorname FROM color WHERE colorID IN ({$cid})\";\n $sql=$db->prepare($sqlcmd); \n $sql->execute();\n $colorname=$sql->fetchall(PDO::FETCH_COLUMN,0);\n \n return $colorname;\n}",
"public function distinct();",
"function createColors($options, $box, $defaultColor)\n{\n\t// Setup return string, and insert opening tags\n\t$result = \"\";\n\t$result = $result . \"<label for=\\\"$box\\\">Choose Color</label>\\n\";\n\t$result = $result . \"<select name=\\\"$box\\\" id=\\\"$box\\\">\\n\";\n\t\n\t// Determine if a color has been chosen previously\n\tif (isset($_REQUEST[$box]))\n\t\t$currentColor = $_REQUEST[$box];\n\telse\n\t\t$currentColor = $defaultColor;\n\n\t// Populate each option\n\tforeach($options as $name => $text)\n\t{\n\t\t$selected = ($currentColor == $name) ? 'selected' : \"\";\n\t\t$result = $result . \"\\t<option value=\\\"$name\\\" $selected>$text</option>\\n\";\t\t\n\t}\n\t\n\t$result = $result . \"</select>\\n\";\n\treturn $result;\n}",
"function get_primary_colors() {\n $colors = array(\n 'ff0000' => 'Red',\n '00ff00' => 'Green',\n '0000ff' => 'Blue',\n );\n $temp = array();\n foreach($colors as $k => $v) {\n $temp[] = '\"'.$k.'\", '.'\"'.$v.'\"';\n }\n return join(', ', $temp);\n}",
"function all()\n\t{\n\t\t//get all elements (set the $elements variable with a Colors array)\n\t\treturn $this->db->all('color');\n\t}",
"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 displayOptions(){\n global $dbConn;\n $sql = 'SELECT DISTINCT (category) FROM p1_quotes';\n $statement = $dbConn->prepare($sql); \n $statement->execute();\n $records = $statement->fetchAll();\n foreach ($records as $record) {\n echo '<option>' . $record[\"category\"] . '</option>';\n }\n}",
"function colores_drop_list(){\n\n$sql =\"SELECT * FROM colores ;\";\n$result = $this->database->query($sql);\n$result = $this->database->result;\nwhile($row = mysql_fetch_array($result)){\n$id= $row['id_color'];\n$name= $row['nombre_color'];\necho '<option value='.$id.'>'.$name.'</option>';\n}\n}",
"public static function renderSelect();",
"function print_backgroundcolor_weather_list($text_color){\n\n\t $color_weather_list =array(\n\t \"#FF0000\" => \"Red\",\n\t \"#CC033C\" => \"Crimson\",\n\t \"#FF6F00\" => \"Orange\",\n\t \"#F9F99F\" => \"Golden\",\n\t \"#FFFCCC\" => \"Almond\",\n\t \"#F6F6CC\" => \"Beige\",\n\t \"#209020\" => \"Green\",\n\t \"#c3e44f\" => \"Light Green\",\n\t \"#963939\" => \"Brown\",\n\t \"#00FF00\" => \"Lime\",\n \t \"#99CCFF\" => \"Light Blue\",\n\t \"#000090\" => \"Navy\",\n\t \"#FE00FF\" => \"Indigo\",\n\t \"#F99CF9\" => \"Pink\",\n\t \"#993CF3\" => \"Violet\",\n\t \"#000000\" => \"Black\",\n\t \"#FFFFFF\" => \"White\",\n\t \"#DDDDDD\" => \"Grey\",\n\t \"#666666\" => \"Gray\",\n\t \"#F6F9F9;\" => \"Silver\");\n\n\n\t echo \"\\n\";\n\tforeach($color_weather_list as $key=>$tcolor)\n\t{\n\t\t$check_value = \"\";\n\t\tif ($text_color == $key)\n\t \t\t$check_value = ' SELECTED ';\n\n\t\t$white_text = \"\";\n\t\tif ($key == \"#000000\" OR $key == \"#000090\" OR $key == \"#666666\" OR $key == \"#0000FF\" )\n\t \t\t$white_text = ';color:#FFFFFF ';\n\t\techo '<option value=\"'.$key.'\" style=\"background-color:'.$key. $white_text .'\" '.$check_value .'>'.$tcolor.'</option>';\n\t\techo \"\\n\";\n\t}\n\n}",
"function get_all_colors()\n{\n\t$colors = array(\n\t\t\"000000\" => \"Black\",\n\t\t\"0000FF\" => \"Blue\",\n\t\t\"804000\" => \"Brown\",\n\t\t\"736F6E\" => \"Gray\",\n\t\t\"00FF00\" => \"Green\",\n\t\t\"FF8040\" => \"Orange\",\n\t\t\"FF00FF\" => \"Pink\",\n\t\t\"8E35EF\" => \"Purple\",\n\t\t\"FF0000\" => \"Red\",\n\t\t\"FFFF00\" => \"Yellow\",\n\t\t\"FFFFFF\" => \"White\",\n\t);\n\treturn $colors;\n}",
"function LUPE_criar_lista_rs($rs, $NomeCombo, $size = '', $JS = '', $Style = '', $multiple = true)\r\n{\r\n\r\n $multiple = $multiple ? 'multiple' : '';\r\n $tam_lst = $size == '' ? mssql_num_rows($rs) : $size;\r\n\r\n if ($size == '') {\r\n $tam_lst = $tam_lst < 6 ? 6 : $tam_lst;\r\n $tam_lst = $tam_lst > 15 ? 15 : $tam_lst;\r\n }\r\n\r\n echo \"<select id='$NomeCombo' name='$NomeCombo' size='$tam_lst' $multiple $JS style='$Style'>\\n\";\r\n\r\n if (mssql_num_rows($rs) > 0) {\r\n mssql_data_seek($rs, 0);\r\n\r\n While ($row = mssql_fetch_array($rs)) {\r\n echo \"<option value='\".$row[0].\"'>\";\r\n\r\n for ($x = 1; $x < mssql_num_fields($rs); $x++) {\r\n echo $row[$x];\r\n if ($x < mssql_num_fields($rs) - 1)\r\n echo ' - ';\r\n }\r\n echo\"</option>\\n\";\r\n }\r\n }\r\n\r\n echo '</select>';\r\n\r\n return 0;\r\n}",
"public function getDistinct() {\n\t\tif(is_null($this->distinct)) {\n\t\t\t$query = \"\";\n\t\t\t$query .= 'SELECT DISTINCT ';\n\t\t\t$query .= $this->getCodeField() . ' AS code, ';\n\t\t\t$query .= $this->getLabelField() . ' AS label';\n\t\t\t$query .= ' FROM ' . $this->getDatasourceName();\n\t\t\t$has_where = false;\n\t\t\tif(is_array($this->filter_value) && !in_array('-1', $this->filter_value)) {\n\t\t\t\t$select = \"\";\n\t\t\t\t$first = true;\n\t\t\t\tforeach($this->filter_value as $value) {\n\t\t\t\t\t$first ? $first = false : $select .= \",\";\n\t\t\t\t\t$select .= \"'\" . $value . \"'\";\n\t\t\t\t}\n\t\t\t\t$query .= ' WHERE ' . $this->getCodeField() . ' IN (' . $select . ')';\n\t\t\t\t$has_where = true;\n\t\t\t}\n\t\t\t$query .= ' ORDER BY ' . $this->getLabelField();\n\t\t\t$this->exploitResultset($this->execute($query));\n\t\t}\n\t\treturn $this->distinct;\n\t}"
] |
[
"0.6460079",
"0.625679",
"0.6078464",
"0.57327944",
"0.5732005",
"0.5722445",
"0.5713622",
"0.5701819",
"0.5690327",
"0.5672947",
"0.5647895",
"0.5643541",
"0.5513786",
"0.5491133",
"0.54826903",
"0.54767793",
"0.5465096",
"0.54569453",
"0.5398698",
"0.5393996",
"0.53903395",
"0.53465784",
"0.53292084",
"0.53220904",
"0.53172797",
"0.5299809",
"0.52843493",
"0.5275996",
"0.5235959",
"0.5229422"
] |
0.6842466
|
0
|
Purpose: This function will make a SELECT DISTINCT on the type. The result will be used to fill the html form select options for the select color dropdown in the UI. Inputs: None. Output: An associative array of results, or an exception.
|
public function findDistinctType() {
// Try to run the SQL query.
try {
$this->query = $this->db->query("SELECT DISTINCT type FROM inventory ORDER BY type;");
$result = $this->query->fetchAll(\PDO::FETCH_ASSOC);
return $result;
} catch(\PDOException $e) {
exit($e->getMessage());
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function displayOptions(){\n global $dbConn;\n $sql = 'SELECT DISTINCT (category) FROM p1_quotes';\n $statement = $dbConn->prepare($sql); \n $statement->execute();\n $records = $statement->fetchAll();\n foreach ($records as $record) {\n echo '<option>' . $record[\"category\"] . '</option>';\n }\n}",
"public static function renderSelect();",
"function getSingleField_typeSelect($fieldConf, $tcaFieldConf) {\n\n\t\t$itemsArr = is_array ($tcaFieldConf['items']) ? $tcaFieldConf['items'] : array();\n\t\tif (isset ($tcaFieldConf['itemsProcFunc'])) {\n\t\t\t$params=array();\n\t\t\t$params['items'] = &$itemsArr;\n\t\t\t\t// NOTE: Some important parameters are missing (table, fieldname etc.), so this won't work with every userfunction like expected. \n\t\t\tt3lib_div::callUserFunction($tcaFieldConf['itemsProcFunc'], $params, $this);\n\t\t}\n\n\t\t\t// Create list of options:\n\t\t$optionsArr = array();\n\t\tforeach ($itemsArr as $keyValueArr) {\n\t\t\tif (is_array ($keyValueArr)) {\n\t\t\t\t$selected = ($this->sessionData['data'][$fieldConf['table']][$fieldConf['name']] == $keyValueArr[1]) ? ' selected=\"selected\"' : '';\n\t\t\t\t$optionsArr[] = '<option value=\"'.htmlspecialchars($keyValueArr[1]).'\"'.$selected.'>'.htmlspecialchars($this->LANG->sL($keyValueArr[0])).'</option>';\t\n\t\t\t}\n\t\t}\t\n\n\t\t\t// Add the various parameters according to TCA configuration:\n\t\t$params = array(\n\t\t\t'name' => isset ($fieldConf['overridename']) ? $fieldConf['overridename'] : $this->prefixId.'[data]['.$fieldConf['table'].']['.$fieldConf['name'].']',\n\t\t\t'id' => isset ($fieldConf['overrideid']) ? $fieldConf['overrideid'] : $this->prefixId.'[data]['.$fieldConf['table'].']['.$fieldConf['name'].']',\n\t\t\t'tabindex' => ($this->fieldTabIndex += 10),\n\t\t\t'class' => 'tx-frontendformslib-field tx-frontendformslib-field-' . (intval($fieldConf['config']['tx_frontendformslib_swaphorizontally']) ? 'switched': 'normal'),\n\t\t);\n\n\t\t$output = '\n\t\t\t<select '.$this->implode_assoc_r('=\"', '\" ', $params).'\">\n\t\t\t\t'.implode(chr(10), $optionsArr).'\n\t\t\t</select>\n\t\t';\n\n\t\treturn $output;\n\t}",
"function get_select($parent = NULL, $nothing_value = NULL)\n\t{\n \t\t$data = array();\n\t\t\n\t\tif ( ! is_null($nothing_value))\n\t\t\t$data = array('' => $nothing_value);\n\n\t\tif ( ! is_null($parent))\n\t\t\t$this->{$this->db_group}->where('parent', $parent);\n\n \t\t$this->{$this->db_group}->order_by('ordering', 'ASC');\n\t\t\t\n\t\t$query = $this->{$this->db_group}->get($this->table);\n\n\t\tif($query->num_rows() > 0)\n\t\t{\n\t\t\t$result = $query->result_array();\n\t\t\t\n\t\t\tforeach($result as $item)\n\t\t\t{\n\t\t\t\t$data[$item['id_type']] = $item['title'];\n\t\t\t}\n\t\t}\t\t\t\n\n\t\treturn $data;\n\t}",
"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 }",
"public function getTypes(){\r\n \r\n $options[\"\"] = \"--Select--\";\r\n //Query all users(Lecturers) not assigned to other departments\r\n $types = $this->em->getRepository(\"\\Application\\Entity\\Assessmenttype\")->findBy(array(\"systemGenerated\"=>0));\r\n \r\n foreach($types as $type ){\r\n $options[$type->getPkAtid()] = $type->getTypeName();\r\n }\r\n \r\n return $options;\r\n }",
"public function getDistinct() {\n\t\tif(is_null($this->distinct)) {\n\t\t\t$query = \"\";\n\t\t\t$query .= 'SELECT DISTINCT ';\n\t\t\t$query .= $this->getCodeField() . ' AS code, ';\n\t\t\t$query .= $this->getLabelField() . ' AS label';\n\t\t\t$query .= ' FROM ' . $this->getDatasourceName();\n\t\t\t$has_where = false;\n\t\t\tif(is_array($this->filter_value) && !in_array('-1', $this->filter_value)) {\n\t\t\t\t$select = \"\";\n\t\t\t\t$first = true;\n\t\t\t\tforeach($this->filter_value as $value) {\n\t\t\t\t\t$first ? $first = false : $select .= \",\";\n\t\t\t\t\t$select .= \"'\" . $value . \"'\";\n\t\t\t\t}\n\t\t\t\t$query .= ' WHERE ' . $this->getCodeField() . ' IN (' . $select . ')';\n\t\t\t\t$has_where = true;\n\t\t\t}\n\t\t\t$query .= ' ORDER BY ' . $this->getLabelField();\n\t\t\t$this->exploitResultset($this->execute($query));\n\t\t}\n\t\treturn $this->distinct;\n\t}",
"public function fetchFormOptions($type)\n {\n $settings = $this->types[$type];\n\n /* @var $model Model */\n $model = app()->make($settings['model']);\n\n // Now we've got an instance of the query builder we can interact\n // with it via it's api to do things such as...\n $query = $model->newQuery();\n\n // Such as attach model scopes! for filtering/restricting results.\n if (isset($settings['scopes']) && is_array($settings['scopes'])) {\n $query->scopes($settings['scopes']);\n }\n\n $results = $query->get()->transform(function ($item) use ($settings) {\n return [\n 'value' => data_get($item, $settings['value']),\n 'label' => data_get($item, $settings['label']),\n ];\n })->sortBy('label')->values();\n\n if (data_get($settings, 'allow_none')) {\n $results->prepend([\n 'value' => data_get($settings, 'none_value', ''),\n 'label' => data_get($settings, 'none_label', 'None'),\n ]);\n }\n\n // Return all the entries once they've been transformed into a sensible format.\n return $results;\n }",
"public function selectAllInfo($type = null)\n {\n if (empty($type)) {\n return QcTool::orderBy('name', 'ASC')->select('*');\n } else {\n return QcTool::where('type', $type)->orderBy('name', 'ASC')->select('*');\n }\n }",
"public function getSelect();",
"public function getSelect();",
"function categoria($productos) {\r\n $opciones = array(); \r\n foreach($productos->producto as $producto) {\r\n $opciones[] = $producto->categoria;\r\n }\r\n //eliminar los duplicados para mostrar el select con las opciones\r\n $opciones = array_unique($opciones);\r\n\r\n //crear las opciones del select sin repetidos\r\n for ($i=0; $i < count($opciones); $i++) { \r\n echo \"<option value='\" . $opciones[$i] . \"'>\" . ucwords($opciones[$i]) . \"</option>\";\r\n }\r\n }",
"public function distinct(){\r\n\r\n if(starts_with($this->queryString, 'SELECT')){\r\n\r\n $this->queryString = str_replace(' <;distinct>', ' DISTINCT', $this->queryString);\r\n \r\n } \r\n return $this;\r\n }",
"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 }",
"public static function distinct();",
"function mk_ddPostSelected($table='', $col='', $type='', $count=0, $str='', $dropDown = ''){\n\t#POST TYPE begin\n\t#returns an array -- $db, $table, $column\n\t#We use constant DB_NAME here because db name is not the same locally as it is globally/live on web. \t#Local it's maTest - live it's dbchampions.\n\t$enum = get_enum(DB_NAME, $table, $col);\n\n\t#name dropdown\n\t$arrPostType[] = $col;\n\n\t#clean up array/shorten descriptions if needed -- $enum returns $arrPostType[]\n\tforeach($enum as $item){\n\t\t#remove data after a certain character\n\t\t#$cut_position = strpos($item, ' '); // remove the +1 if you don't want the ' ' included\n\t\t#$item = substr($item, 0, $cut_position);\n\n\t\t// Assign each value to the array as you cycle through\n\t\t$arrPostType[] = $item;\n\t}\n\n\t#to iterate the dropdown\n\t#$count \t\t= 0;\n\t$val \t\t= $col;\n\t#$dropDown = '';\n\t#populate select\n\tforeach($arrPostType as $item)\n\t{#if we have value match\n\t\tif(($count==$val) || ($type==$item) ){\n\t\t\t$dropDown .= '<option value=\"'. $count++ .'\" selected=\"selected\">'. $item .'</option>';\n\t\t}else{#don't have a match\n\t\t\t$dropDown .= '<option value=\"'. $count++ .'\">'. $item .'</option>';\n\t\t}\n\t}\n\t$str .= $dropDown;\n\n\t$str .= '</select>';\n\n\treturn $str;\n\n}",
"function gen_selectoption($table,$selected,$type,$what,$show_count=null)\n{\n global $connection, $dbtable, $trace, $lg, $optionselected, $tblenum, $tblstring, $this_is, $nRowsThis_is, $nRowsThis_isy, $nRowsThis_isn, $fieldis, $toutString, $achoisirString;\n $selectoptions = '';\n if (is_array($table)) {\n if (in_array($selected,array('ajout','0','',null)))\n $selectoptions = '<option value=\"\"> >> '.$achoisirString.' </option>';\n foreach($table as $key) {\n $key = html_encode($key);\n ${\n $key.\"String\"} = sql_getone($tblstring, \" WHERE stringlang='$lg' AND stringtype='general' AND stringtitle='$key' \", \"stringentry\");\n if ($key == $selected) $this_select = $optionselected;\n else $this_select = '';\n $selectoptions .= '<option value=\"'.$key.'\"'.$this_select.'>'.(sql_stringit(($what!=''?$what:'general'),$key)!=''?sql_stringit(($what!=''?$what:'general'),$key):(${\n $key.\"String\"}==''?$key:${\n $key.\"String\"})).'</option>';\n }\n } else if ($table == $tblenum) {\n $read = mysqli_query($connection, \"\n\t\t\t\t\t\tSELECT * FROM $table\n\t\t\t\t\t\tWHERE enumstatut='Y'\n\t\t\t\t\t\tAND enumtype LIKE '%$type%'\n\t\t\t\t\t\tAND enumwhat LIKE '%$what%'\n\t\t\t\t\t\t\");\n $nRows = sql_nrows($table, \"\n\t\t\t\t\t\t\tWHERE enumstatut='Y'\n\t\t\t\t\t\t\tAND enumtype LIKE '%$type%'\n\t\t\t\t\t\t\tAND enumwhat LIKE '%$what%'\n\t\t\t\t\t\t\t\");\n if (in_array($selected,array('ajout','0','',null))) {\n $selectoptions = '<option value=\"\"> >> '.$achoisirString.' </option>';\n for ($i=0;$i<$nRows;$i++) {\n $row = mysqli_fetch_array($read);\n $selectoptions .= '<option value=\"'.$row[\"enumtitre\"].'\"> '.sql_stringit(($what==''?'general':$what),$row[\"enumtitre\"]).' </option>';\n }\n } else {\n if (isset($nRowsThis_is) && ($show_count!=null))\n $selectoptions = '<option'.($selected==$toutString?$optionselected:'').' value=\"'.$toutString.'\"> ('.$nRowsThis_is.') '.$toutString.' </option>';\n for ($i=0;$i<$nRows;$i++) {\n $row = mysqli_fetch_array($read);\n $row_enumtitre = $row[\"enumtitre\"];\n if ($row[\"enumtitre\"] == $selected) $this_select = $optionselected;\n else $this_select = '';\n $editwhat = sql_getone($tblstring, \" WHERE stringlang='$lg' AND stringtype='$what' AND stringtitle='$row_enumtitre' \", \"stringentry\");\n $sql_this = \" WHERE \".$fieldis.$what.\"='$row_enumtitre' \";\n $countwhat = sql_nrows($dbtable,$sql_this);\n $selectoptions .= '<option value=\"'.$row_enumtitre.'\" '.$this_select.'>'.($show_count!=null?($countwhat==''?'(0)':'('.$countwhat.')'):'').' '.$editwhat.' </option>';\n }\n }\n } else if ($table == $tblstring) {\n $selectoptions = '';\n if ($selected == '')\t$selectoptions = '<option value=\"\"> >> '.$achoisirString.' </option>'\t;\n $whereq = \" WHERE stringtype='$what' $type \";\n $read = mysqli_query($connection, \" SELECT * FROM $table $whereq \");\n $nRows = sql_nrows($table,$whereq);\n for ($i=0;$i<$nRows;$i++) {\n $row = mysqli_fetch_array($read);\n if ($row[\"stringentry\"] == $selected) {\n $this_select = $optionselected;\n } else {\n $this_select = '';\n }\n $selectoptions .= '<option value=\"'.$row[\"stringentry\"].'\" '.$this_select.'> '.$row[\"stringentry\"].' </option>';\n }\n } else {\n $selectoptions = '';\n if (in_array($selected,array('ajout','0','',null)))\n $selectoptions = '<option value=\"\"> >> '.$achoisirString.' </option>'\t;\n $rid = (in_array($what.\"rid\",sql_fields($table,'array'))?'r':'').\"id\";\n $whereq = \" WHERE \".$what.\"statut='Y' \".($rid=='rid'?\" AND \".$what.\"lang='$lg' \":'').\" $type \";\n $read = mysqli_query($connection, \" SELECT * FROM $table $whereq \");\n $nRows = sql_nrows($table,$whereq);\n for ($i=0;$i<$nRows;$i++) {\n $row = mysqli_fetch_array($read);\n if ($row[$what.$rid] == $selected) {\n $this_select = $optionselected;\n } else {\n $this_select = '';\n }\n if (!isset($row[$what.\"util\"])) {\n if (!isset($row[$what.\"nom\"])) {\n if (!isset($row[$what.\"titre\"])) {\n if (!isset($row[$what.\"title\"])) {\n $row_nomoutitre = $row[$what.$rid];\n } else {\n $row_nomoutitre = $row[$what.\"title\"];\n }\n } else {\n $row_nomoutitre = $row[$what.\"titre\"];\n }\n } else {\n $row_nomoutitre = (isset($row[$what.\"prenom\"])?(isset($row[$what.\"gendre\"])?sql_stringit($tblenum,$row[$what.\"gendre\"],'gendre').\" \":'').$row[$what.\"prenom\"].\" \":'').$row[$what.\"nom\"];\n }\n } else {\n $row_nomoutitre = $row[$what.\"util\"];\n }\n $selectoptions .= '<option value=\"'.$row[$what.$rid].'\" '.$this_select.'> '.$row_nomoutitre.' </option>';\n }\n }\n return $selectoptions;\n}",
"function Val1()\n {\n\t \t\n global $DataBase;\n\t\t\n\t\t$strQuery = \"SELECT CityID,city FROM cities WHERE 1 LIMIT 0, 1000 \"; \n $DataBase->query($strQuery);\n\t\t$nResult = $DataBase->fetch_all();\n $Record_Type = $DataBase->fetch_row();\n\t\t$Count = $Record_Type[0];\n\t\t\n\t\tforeach($nResult as $val)\n\t\t{\n\t\t\t$CID\t= $val[0];\n\t\t\t$Name\t\t= $val[1];\n\t\t\t$options = $options . \"<option value=$CID>$Name</option>\";\n \n }// End OF Foreach Loop\n\t\treturn $options;\n\t\t\n }",
"public function distinct();",
"function SelectValuesUnidad($db_conx) {\r\n $sql = \"SELECT uni_codigo, uni_descrip FROM tunidad ORDER BY uni_descrip ASC\";\r\n $query = mysqli_query($db_conx, $sql);\r\n\r\n $n_filas = $query->num_rows;\r\n $data = '<select class=\"unidadmedico\" multiple=\"multiple\" id=\"cmbunidad\">';\r\n $c = 0;\r\n while ($c < $n_filas) {\r\n $row = mysqli_fetch_array($query);\r\n $data .= '<option value=\"' . $row[0] . '\">' . $row[1] . '</option>';\r\n $c++;\r\n }\r\n $data .= '</select>';\r\n echo $data;\r\n}",
"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}",
"function SelectValuesUnidadFiltro($db_conx) {\r\n $sql = \"SELECT uni_codigo, uni_descrip FROM tunidad ORDER BY uni_descrip ASC\";\r\n $query = mysqli_query($db_conx, $sql);\r\n\r\n $n_filas = $query->num_rows;\r\n $data = '<select style=\"width:207px;\" id=\"cmbuni\">';\r\n $data .= '<option value=\"0\">Todos</option>';\r\n $c = 0;\r\n while ($c < $n_filas) {\r\n $row = mysqli_fetch_array($query);\r\n $data .= '<option value=\"' . $row[0] . '\">' . $row[1] . '</option>';\r\n $c++;\r\n }\r\n $data .= '</select>';\r\n echo $data;\r\n}",
"function LUPE_criar_lista_rs($rs, $NomeCombo, $size = '', $JS = '', $Style = '', $multiple = true)\r\n{\r\n\r\n $multiple = $multiple ? 'multiple' : '';\r\n $tam_lst = $size == '' ? mssql_num_rows($rs) : $size;\r\n\r\n if ($size == '') {\r\n $tam_lst = $tam_lst < 6 ? 6 : $tam_lst;\r\n $tam_lst = $tam_lst > 15 ? 15 : $tam_lst;\r\n }\r\n\r\n echo \"<select id='$NomeCombo' name='$NomeCombo' size='$tam_lst' $multiple $JS style='$Style'>\\n\";\r\n\r\n if (mssql_num_rows($rs) > 0) {\r\n mssql_data_seek($rs, 0);\r\n\r\n While ($row = mssql_fetch_array($rs)) {\r\n echo \"<option value='\".$row[0].\"'>\";\r\n\r\n for ($x = 1; $x < mssql_num_fields($rs); $x++) {\r\n echo $row[$x];\r\n if ($x < mssql_num_fields($rs) - 1)\r\n echo ' - ';\r\n }\r\n echo\"</option>\\n\";\r\n }\r\n }\r\n\r\n echo '</select>';\r\n\r\n return 0;\r\n}",
"function bls_sf_selectForTypes() {\n\tbls_ut_backTrace(\"bls_sf_selectForTypes\");\n\tglobal $bls_sf_location;\n\n\techo \"<select name=\\\"s_pkg_srctype\\\">\";\n\tforeach ($bls_sf_location as $key => $val) {\n\t\techo \"<option value=\\\"$key\\\">$val</option>\";\n\t}\n\techo \"</select>\";\n}",
"function vendor_type_list($search=0) {\n // internal arrays are the rows selected \n if(is_array($search)) { \n //if(count($search) == 1) { \n // $search = $search[0]; \n //} else { \n foreach($search as $key => $val) { \n $search[$key] = \"id=$val\"; \n } \n $query = \"SELECT * FROM vendor_type \"; \n $query .= \"WHERE \" . implode(\" OR \",$search) . \" \"; \n $query .= \"ORDER BY id\"; \n //} \n } else if(is_numeric($search)) { \n if($search == \"34\") { \n $query = \"SELECT * FROM vendor_type \"; \n $query .= \"WHERE id=6 OR id=4 OR id=5 \"; \n $query .= \"ORDER BY id\"; \n } else { \n $query = \"SELECT * FROM vendor_type \"; \n $query .= \"WHERE id=1 OR id=3 OR id=2 OR id=4 OR id=5 \"; \n $query .= \"ORDER BY id\"; \n } \n } else { \n $query = \"SELECT * FROM vendor_type ORDER BY id\"; \n } \n \n $result = $this->db->getAll($query); \n \n if(count($result) > 1) \n $ret_stack[0] = array(\"id\" => 0, \"type_num\" => 0, \"name\" => \"All\", \"plural\" => \"All\"); \n /*\n while($row = $this->db->fetch_array($result)) { \n $ret_stack[$row['id']] = $row; \n } */ \n\n foreach($result as $obj) {\n $ret_stack[$obj['id']] = $obj;\n }\n\n unset($result);\n \n return($ret_stack); \n }",
"function genreopties(){\r\n\t\tglobal $pdo;\r\n\t\t\t//maken sql query\r\n\t\t$sql = \"SELECT DISTINCT genre_name FROM Genre\";\r\n\t\t\t//afschieten query\r\n\t\t$result = $pdo->query($sql)->fetchAll(PDO::FETCH_ASSOC);\r\n\t\t\r\n\t\tforeach($result as $row){\r\n\t\t\tforeach($row as $genre){\r\n\t\t\t\techo '<option value='.$genre.'>'.$genre.'</option>';\r\n\t\t\t}\r\n\t\t}\r\n\t}",
"public function get_types() {\n\n $q = $this->db->query('SELECT DISTINCT `rgl_type` , `vtr_type` \n FROM `t_reglements` \n LEFT JOIN `v_types_reglements` ON `vtr_id` = `rgl_type` ');\n if ($q->num_rows() > 0) {\n $resultat = $q->result();\n return $resultat;\n }\n else {\n return array();\n }\n }",
"protected function getSelectOptions()\n\t{\n\t\t$arrReturn = array();\n\t\t$arrFields = deserialize( $this->get('defaultMulti') );\n\t\tif( empty($arrFields) )\n\t\t{\n\t\t\t$arrFields = array('rating','tstamp','helpful','not_helpful');\n\t\t}\n\t\t\n\t\tforeach($arrFields as $f)\n\t\t{\n\t\t\t$arrReturn[$f.'[asc]'] \t= $GLOBALS['TL_LANG']['MSC']['ratings_filter'][$f]['asc'];\n\t\t\t$arrReturn[$f.'[desc]'] = $GLOBALS['TL_LANG']['MSC']['ratings_filter'][$f]['desc'];\n\t\t}\n\t\t\n\t\treturn $arrReturn;\n\t}",
"public function allTagsForSingleType(){\n\t\t$seedType = $_POST['seedType'];\n\t\t$sql = \n\t\t\t\"SELECT type.type_name, tag.tag_name, tag.tag_id\n\t\t\tFROM type\n\t\t\tINNER JOIN typetag ON type.type_id = typetag.type_id\n\t\t\tINNER JOIN tag ON typetag.tag_id = tag.tag_id\n\t\t\tWHERE type.type_name= :seedType\";\n\t\t$stmt = $this->databaseConnection->dbConnection->prepare($sql);\n\t\t$stmt->bindParam(':seedType', $seedType);\n\t\t$stmt->execute();\n\t\t$arrayThing = [];\n\t\twhile($row = $stmt->fetch(PDO::FETCH_ASSOC)){\n\t\t\t//echo \"type \" . $row['type_name'] . \"<br>\";\n\t\t\tarray_push($arrayThing, $row['tag_name'] . \"-\" . $row['tag_id']);\n\t\t}\n\t\t$myJSON = json_encode($arrayThing);\n\t\techo $myJSON;\n\t}",
"function _getTypeSelect($options=\"\") {\r\n\t\t$retval = \"<tr>\\n\";\r\n\t\t$retval .= \"<td>\".__('Video type', $this->textdomain_name).\":</td>\\n\";\r\n\t\t$retval .= \"<td>\";\r\n\t\t$retval .= \"<select name=\\\"lynkvp_type\\\" onchange=\\\"javascript:\";\r\n\t\t$retval .= \"document.getElementById('Thumbnail_title').style.display=(this.value=='flv'?'block':'none');\";\r\n\t\t$retval .= \"document.getElementById('Thumbnail_image').style.display=(this.value=='flv'?'block':'none');\";\r\n\t\t$retval .= \"\\\">\";\r\n\t\t$retval .= \" <option value=\\\"0\\\"\".$this->_setOptionSelected($_POST['lynkvp_type'],'0').\">\".__('Select video type', $this->textdomain_name).\"</option>\";\r\n\t\t$retval .= \" <option value=\\\"asf\\\"\".$this->_setOptionSelected($_POST['lynkvp_type'],'asf').\">.asf</option>\";\r\n\t\t$retval .= \" <option value=\\\"avi\\\"\".$this->_setOptionSelected($_POST['lynkvp_type'],'avi').\">.avi</option>\";\r\n\t\t$retval .= \" <option value=\\\"mp4\\\"\".$this->_setOptionSelected($_POST['lynkvp_type'],'mp4').\">.mp4</option>\";\r\n\t\t$retval .= \" <option value=\\\"mpg\\\"\".$this->_setOptionSelected($_POST['lynkvp_type'],'mpg').\">.mpg</option>\";\r\n\t\t$retval .= \" <option value=\\\"mov\\\"\".$this->_setOptionSelected($_POST['lynkvp_type'],'mov').\">.mov</option>\";\r\n\t\t$retval .= \" <option value=\\\"rm\\\"\" .$this->_setOptionSelected($_POST['lynkvp_type'],'rm'). \">.rm</option>\";\r\n\t\t$retval .= \" <option value=\\\"swf\\\"\".$this->_setOptionSelected($_POST['lynkvp_type'],'swf').\">.swf</option>\";\r\n\t\t$retval .= (file_exists(dirname(__FILE__).'/'.$this->flvplayer) ? \" <option value=\\\"flv\\\"\".$this->_setOptionSelected($_POST['lynkvp_type'],'flv').\">.flv</option>\" : '');\r\n\t\t$retval .= \" <option value=\\\"wmv\\\"\".$this->_setOptionSelected($_POST['lynkvp_type'],'wmv').\">.wmv</option>\";\r\n\t\t$retval .= \" <option value=\\\"3gp\\\"\".$this->_setOptionSelected($_POST['lynkvp_type'],'3gp').\">.3gp</option>\";\r\n\t\t$retval .= \" </select>\";\r\n\t\t$retval .= \"</td>\\n\";\r\n\t\t$retval .= \"</tr>\\n\";\r\n\r\n\t\t$retval .= \"<tr>\\n\";\r\n\t\t$retval .= \"<td><span id=\\\"Thumbnail_title\\\" style=\\\"display:\".($_POST['lynkvp_type']!='flv'?'none':'block').\"\\\">\".__('Thumbnail', $this->textdomain_name).\":</span></td>\";\r\n\t\t$retval .= \"<td><span id=\\\"Thumbnail_image\\\" style=\\\"display:\".($_POST['lynkvp_type']!='flv'?'none':'block').\"\\\"><input type=\\\"file\\\" name=\\\"lynkvp_image_file\\\" /> \\n\";\r\n\t\t$retval .= __('<strong>or</strong>', $this->textdomain_name).\" \".__('URL', $this->textdomain_name).\": http://<input type=\\\"text\\\" name=\\\"lynkvp_image_url\\\" style=\\\"width:400px;\\\" value=\\\"\".$_POST['lynkvp_image'].\"\\\" /></span></td>\\n\";\r\n\t\t$retval .= \"</tr>\\n\";\r\n\r\n\t\treturn $retval;\r\n\t}"
] |
[
"0.6045898",
"0.60306185",
"0.59637743",
"0.595104",
"0.59418565",
"0.5927572",
"0.58593273",
"0.58183444",
"0.58067745",
"0.5695604",
"0.5695604",
"0.568088",
"0.5675605",
"0.56661767",
"0.565912",
"0.56306535",
"0.5592963",
"0.55874366",
"0.5585786",
"0.5573867",
"0.55678153",
"0.55663306",
"0.55380565",
"0.5498308",
"0.549086",
"0.5490667",
"0.54867196",
"0.5473135",
"0.5471773",
"0.5465212"
] |
0.605072
|
0
|
Purpose: This function will make a SELECT DISTINCT on the drivetrain. The result will be used to fill the html form select options for the select color dropdown in the UI. Inputs: None. Output: An associative array of results, or an exception.
|
public function findDistinctDrivetrain() {
// Try to run the SQL query.
try {
$this->query = $this->db->query("SELECT DISTINCT drive FROM inventory ORDER BY drive;");
$result = $this->query->fetchAll(\PDO::FETCH_ASSOC);
return $result;
} catch(\PDOException $e) {
exit($e->getMessage());
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function distinct(){\r\n\r\n if(starts_with($this->queryString, 'SELECT')){\r\n\r\n $this->queryString = str_replace(' <;distinct>', ' DISTINCT', $this->queryString);\r\n \r\n } \r\n return $this;\r\n }",
"function getKats($akt) {\r\n $katAR = array();\r\n $kats = '';\r\n $erg = db_query(\"SELECT DISTINCT `news_kat` FROM `prefix_news`\");\r\n while ($row = db_fetch_object($erg)) {\r\n $katAr[ ] = $row->news_kat;\r\n }\r\n $katAr[ ] = 'Allgemein';\r\n $katAr = array_unique($katAr);\r\n foreach ($katAr as $a) {\r\n if (trim($a) == trim($akt)) {\r\n $sel = ' selected';\r\n } else {\r\n $sel = '';\r\n }\r\n $kats .= '<option' . $sel . '>' . $a . '</option>';\r\n }\r\n return ($kats);\r\n}",
"public static function distinct();",
"public function distinct();",
"function SelectValuesUnidad($db_conx) {\r\n $sql = \"SELECT uni_codigo, uni_descrip FROM tunidad ORDER BY uni_descrip ASC\";\r\n $query = mysqli_query($db_conx, $sql);\r\n\r\n $n_filas = $query->num_rows;\r\n $data = '<select class=\"unidadmedico\" multiple=\"multiple\" id=\"cmbunidad\">';\r\n $c = 0;\r\n while ($c < $n_filas) {\r\n $row = mysqli_fetch_array($query);\r\n $data .= '<option value=\"' . $row[0] . '\">' . $row[1] . '</option>';\r\n $c++;\r\n }\r\n $data .= '</select>';\r\n echo $data;\r\n}",
"function displayOptions(){\n global $dbConn;\n $sql = 'SELECT DISTINCT (category) FROM p1_quotes';\n $statement = $dbConn->prepare($sql); \n $statement->execute();\n $records = $statement->fetchAll();\n foreach ($records as $record) {\n echo '<option>' . $record[\"category\"] . '</option>';\n }\n}",
"function genreopties(){\r\n\t\tglobal $pdo;\r\n\t\t\t//maken sql query\r\n\t\t$sql = \"SELECT DISTINCT genre_name FROM Genre\";\r\n\t\t\t//afschieten query\r\n\t\t$result = $pdo->query($sql)->fetchAll(PDO::FETCH_ASSOC);\r\n\t\t\r\n\t\tforeach($result as $row){\r\n\t\t\tforeach($row as $genre){\r\n\t\t\t\techo '<option value='.$genre.'>'.$genre.'</option>';\r\n\t\t\t}\r\n\t\t}\r\n\t}",
"public function getDistinct() {\n\t\tif(is_null($this->distinct)) {\n\t\t\t$query = \"\";\n\t\t\t$query .= 'SELECT DISTINCT ';\n\t\t\t$query .= $this->getCodeField() . ' AS code, ';\n\t\t\t$query .= $this->getLabelField() . ' AS label';\n\t\t\t$query .= ' FROM ' . $this->getDatasourceName();\n\t\t\t$has_where = false;\n\t\t\tif(is_array($this->filter_value) && !in_array('-1', $this->filter_value)) {\n\t\t\t\t$select = \"\";\n\t\t\t\t$first = true;\n\t\t\t\tforeach($this->filter_value as $value) {\n\t\t\t\t\t$first ? $first = false : $select .= \",\";\n\t\t\t\t\t$select .= \"'\" . $value . \"'\";\n\t\t\t\t}\n\t\t\t\t$query .= ' WHERE ' . $this->getCodeField() . ' IN (' . $select . ')';\n\t\t\t\t$has_where = true;\n\t\t\t}\n\t\t\t$query .= ' ORDER BY ' . $this->getLabelField();\n\t\t\t$this->exploitResultset($this->execute($query));\n\t\t}\n\t\treturn $this->distinct;\n\t}",
"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 }",
"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 createUserList()\n{\n $sql = \"select netid,name from Statdir ORDER BY name\";\n $results = simple_query($sql);\n\n $result = \"<select name=\\\"ci_user\\\">\";\n $result .= \"<OPTION value=\\\"Me\\\">Me</option>\";\n\n foreach ($results as $name) {\n if (preg_match('/^\\s*$/', $name['name'])) continue;\n $result .= \"<OPTION value='\"\n .$name['netid']\n .\"'>\"\n .$name['name']\n .\"</option>\";\n }\n \n $result .= \"</select>\";\n return $result;\n}",
"function\tdropdown_list($dbconn) {\n\t$sqlcom=\"select distinct spec_id,name from info;\";\n\t$dbres = pg_exec($dbconn, $sqlcom );\n\tif ( ! $dbres ) {echo \"Error : \" + pg_errormessage( $dbconn ); exit();} \n\t$row=0;\n\t$rowmax=pg_NumRows($dbres);\n\tprint \"<form method=\\\"post\\\" action=\\\"libSpec.php\\\"><select name=\\\"organism\\\" onchange=\\\"this.form.submit();\\\">\\n<option value=\\\"select\\\">Select an organism...</option>\\n\"; \n\twhile ($row<$rowmax) {\n\t $do = pg_Fetch_Object($dbres, $row);\n\t $name=$do->name;\n\t print \"<option value=\\\"$name\\\">$name</option>\\n\";\n\t $row++;\n\t}\n\tprint(\"</select></form>\\n\\n\");\n}",
"function SelectValuesUnidadFiltro($db_conx) {\r\n $sql = \"SELECT uni_codigo, uni_descrip FROM tunidad ORDER BY uni_descrip ASC\";\r\n $query = mysqli_query($db_conx, $sql);\r\n\r\n $n_filas = $query->num_rows;\r\n $data = '<select style=\"width:207px;\" id=\"cmbuni\">';\r\n $data .= '<option value=\"0\">Todos</option>';\r\n $c = 0;\r\n while ($c < $n_filas) {\r\n $row = mysqli_fetch_array($query);\r\n $data .= '<option value=\"' . $row[0] . '\">' . $row[1] . '</option>';\r\n $c++;\r\n }\r\n $data .= '</select>';\r\n echo $data;\r\n}",
"function getClientsDropdown(){\n\t\t $data = array();\n\t\t $this->db->from('company');\n\t\t $this->db->where('client',1);\n\t\t $this->db->order_by('comp','ASC');\n\t\t $q = $this->db->get();\n\t\t foreach($q->result() as $row)\n\t\t {\n\t\t $data[$row->comp]=$row->comp;\n\t\t }\n\t\t return $data;\n\t }",
"public function distinct($params=''){\n\t\t$this->_connect();\n\t\tif($this->_schema){\n\t\t\t$table = $this->_schema.'.'.$this->_source;\n\t\t} else {\n\t\t\t$table = $this->_source;\n\t\t}\n\t\t$numberArguments = func_num_args();\n\t\t$params = Utils::getParams(func_get_args(), $numberArguments);\n\t\tif(!isset($params['column'])){\n\t\t\t$params['column'] = $params['0'];\n\t\t} else {\n\t\t\tif(!$params['column']) {\n\t\t\t\t$params['column'] = $params['0'];\n\t\t\t}\n\t\t}\n\t\t$select = 'SELECT DISTINCT '.$params['column'].' FROM '.$table;\n\t\tif(isset($params['conditions'])&&$params['conditions']) {\n\t\t\t$select.=' WHERE '.$params[\"conditions\"];\n\t\t}\n\t\tif(isset($params['order'])&&$params['order']) {\n\t\t\t$select.=' ORDER BY '.$params[\"order\"].' ';\n\t\t} else {\n\t\t\t$select.=' ORDER BY 1 ';\n\t\t}\n\t\tif(isset($params['limit'])&&$params['limit']) {\n\t\t\t$select = $this->_limit($select, $params['limit']);\n\t\t}\n\t\t$results = array();\n\t\t$this->_db->setFetchMode(DbBase::DB_NUM);\n\t\tforeach($this->_db->fetchAll($select) as $result){\n\t\t\t$results[] = $result[0];\n\t\t}\n\t\t$this->_db->setFetchMode(DbBase::DB_ASSOC);\n\t\treturn $results;\n\t}",
"public function getSelect();",
"public function getSelect();",
"function createKeywordList($which, $original)\n{\n $sql = \"SELECT * FROM ReadingRoomSearchTerms order by Term\";\n $rows = simple_query($sql);\n\n $result = \"<select name=\\\"title\".$which.\"\\\">\";\n $result .= \"<OPTION value=\\\"None\\\"> </option>\";\n\n foreach ($rows as $term) {\n $result .= \"<OPTION value='\".$term['Term'].\"'\";\n $result .= (!strcmp($term['Term'], $original)) ? \" selected\" : \"\";\n $result .= \">\".$term['Term'].\"(\".$term['Number'].\")</option>\";\n }\n \n $result .= \"</select>\";\n return $result;\n}",
"function get_faculty_selections($con) {\n\t$facs = get_faculties($con);\n\t$sel = '<option value=\"\"></option>';\n\tforeach ($facs as $id => $name) {\n\t\t$sel .= '<option value=\"'.$id.'\">'.$name.'</option>';\n\t}\n\treturn $sel;\n}",
"function fillCountrySelect(){\n global $db;\n\n $query = \"SELECT DISTINCT countryname FROM place ORDER BY countryname\";\n $results = $db->query($query)->fetchAll(PDO::FETCH_ASSOC);\n\n foreach ($results as $result){\n if (isset($_GET[\"CountrySubmit\"]) && $result[\"countryname\"] == $_GET[\"Country\"]) {\n echo \"<option value='{$result[\"countryname\"]}' selected>{$result[\"countryname\"]}</option>\";\n }\n else {\n echo \"<option value='{$result[\"countryname\"]}'>{$result[\"countryname\"]}</option>\";\n }\n\n }\n\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 static function renderSelect();",
"function construirComboSoloDatos($result) {\n\t\n\t$cadena = \"\";\n\tforeach($result as $opcion) {\t\t\n\t\t$cadena .= \"<option value=\\\"\". $opcion[\"codigo\"] .\"\\\">\" . $opcion[\"texto\"] . \"</option>\";\n\t}\n\t\n\treturn $cadena;\t\n}",
"public function distinct($distinct = TRUE);",
"public function populateSuburbDropdown() {\n\n $qry = $this->db->prepare('SELECT DISTINCT SUBURB FROM n8598177.items;');\n $qry->execute();\n\n echo('\n <select name=\"search-suburb\" class=\"suburb-select-box\">\n <option disabled selected value=\"\">Suburb...</option>\n ');\n foreach ($qry as $hotspot) {\n echo '<option value=\"' . $hotspot['SUBURB'] . '\">' . $hotspot['SUBURB'] . '</option>';\n }\n echo '</select>';\n }",
"function listadocategoria() {\n $query9 = \"SELECT * FROM intranet_roadmap_categorias\";\n $result9 = (array) json_decode(miBusquedaSQL($query9), true) ;\n foreach ($result9 as $pr9) {\n $proyectos .= '<option value=\"'.$pr9['id_categoria'].'\">'.$pr9['nombre'].'</option> \n';\n }\n return $proyectos;\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 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 }",
"function get_college_programs() {\n $list = \"\";\n $list.=\"<select id='programs' style='width:155px;' required>\";\n $list.=\"<option value='0' selected>Program</option>\";\n $query = \"select * from mdl_course where category=5 and cost>0 and visible=1\";\n $result = $this->db->query($query);\n foreach ($result->result() as $row) {\n $list.=\"<option value='$row->id'>$row->fullname</option>\";\n }\n $list.=\"</select>\";\n\n return $list;\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 }"
] |
[
"0.59757555",
"0.57617146",
"0.5754932",
"0.5726799",
"0.568613",
"0.5663578",
"0.5657392",
"0.5632119",
"0.5605863",
"0.55974066",
"0.5554469",
"0.5536863",
"0.5495137",
"0.5470445",
"0.545103",
"0.53739995",
"0.53739995",
"0.5360976",
"0.53507566",
"0.5326012",
"0.53219163",
"0.5320239",
"0.5291524",
"0.5286296",
"0.5263497",
"0.52319443",
"0.52276295",
"0.5214577",
"0.5212791",
"0.5194177"
] |
0.6227452
|
0
|
Purpose: This function handles all SELECT querys. The defualt behavior is to SELECT all items from the inventory table. If an array is passed in, the query will search based on the provided conditions. If there is more than one search critiria, the query will add and AND for each additonal WHERE condition. The query is created using the PDO prepare statement. Inputs: An associative array. Keys = column name. Values = condition. Output: An associative array of results, or an exception.
|
public function findByCriteria($searchArray) {
// Get the array's keys so we can iterate through the array with indexs.
$this->keys = array_keys($searchArray);
// Fill an array with values from the key/value pairs to use with PDO prepare.
for($i = 0; $i < count($searchArray); $i++) {
$this->values[] = $searchArray[$this->keys[$i]];
}
// If the array is empty, return all rows from the inventory.
if(count($searchArray) == 0) {
// If there is ORDER BY critiria.
if(isset($_GET['orderByMake'])) {
if($_GET['orderByMake'] == 0){
// Build the query.
$this->query = "SELECT * FROM inventory ORDER BY make ASC;";
} else if ($_GET['orderByMake'] == 1) {
// Build the query.
$this->query = "SELECT * FROM inventory ORDER BY make DESC;";
}
} else if (isset($_GET['orderByModel'])) {
if($_GET['orderByModel'] == 0){
// Build the query.
$this->query = "SELECT * FROM inventory ORDER BY model ASC;";
} else if ($_GET['orderByModel'] == 1) {
// Build the query.
$this->query = "SELECT * FROM inventory ORDER BY model DESC;";
}
} else if (isset($_GET['orderByYear'])) {
if($_GET['orderByYear'] == 0){
// Build the query.
$this->query = "SELECT * FROM inventory ORDER BY year ASC;";
} else if ($_GET['orderByYear'] == 1) {
// Build the query.
$this->query = "SELECT * FROM inventory ORDER BY year DESC;";
}
} else if (isset($_GET['orderByColor'])) {
if($_GET['orderByColor'] == 0){
// Build the query.
$this->query = "SELECT * FROM inventory ORDER BY color ASC;";
} else if ($_GET['orderByColor'] == 1) {
// Build the query.
$this->query = "SELECT * FROM inventory ORDER BY color DESC;";
}
} else if (isset($_GET['orderByMileage'])) {
if($_GET['orderByMileage'] == 0){
// Build the query.
$this->query = "SELECT * FROM inventory ORDER BY mileage ASC;";
} else if ($_GET['orderByMileage'] == 1) {
// Build the query.
$this->query = "SELECT * FROM inventory ORDER BY mileage DESC;";
}
} else if (isset($_GET['orderByType'])) {
if($_GET['orderByType'] == 0){
// Build the query.
$this->query = "SELECT * FROM inventory ORDER BY type ASC;";
} else if ($_GET['orderByType'] == 1) {
// Build the query.
$this->query = "SELECT * FROM inventory ORDER BY type DESC;";
}
} else if (isset($_GET['orderByPrice'])) {
if($_GET['orderByPrice'] == 0){
// Build the query.
$this->query = "SELECT * FROM inventory ORDER BY price ASC;";
} else if ($_GET['orderByPrice'] == 1) {
// Build the query.
$this->query = "SELECT * FROM inventory ORDER BY price DESC;";
}
} else if (isset($_GET['orderByTransmission'])) {
if($_GET['orderByTransmission'] == 0){
// Build the query.
$this->query = "SELECT * FROM inventory ORDER BY transmission ASC;";
} else if ($_GET['orderByTransmission'] == 1) {
// Build the query.
$this->query = "SELECT * FROM inventory ORDER BY transmission DESC;";
}
} else if (isset($_GET['orderByDrive'])) {
if($_GET['orderByDrive'] == 0){
// Build the query.
$this->query = "SELECT * FROM inventory ORDER BY drive ASC;";
} else if ($_GET['orderByDrive'] == 1) {
// Build the query.
$this->query = "SELECT * FROM inventory ORDER BY drive DESC;";
}
} else { // If no ORDER BY criteria is set.
$this->query = "SELECT * FROM inventory;";
}
// Try to run the SQL query.
try {
$this->query = $this->db->query($this->query);
$result = $this->query->fetchAll(\PDO::FETCH_ASSOC);
return $result;
} catch(\PDOException $e) {
exit($e->getMessage());
}
// If the array contains key/value pairs, search based on provided key/values.
} else {
// Add the first search criteria to the query depending on operator.
if($this->keys[0] == "yearFrom") { // Year > x.
$this->query .= " year >= ?";
} else if($this->keys[0] == "yearTo") { // Year < x.
$this->query .= " year <= ?";
} else if($this->keys[0] == "mileageFrom") { // Mileage > x.
$this->query .= " mileage >= ?";
} else if($this->keys[0] == "mileageTo") { // Mileage < x.
$this->query .= " mileage <= ?";
} else if($this->keys[0] == "priceFrom") { // Price > x.
$this->query .= " price >= ?";
} else if($this->keys[0] == "priceTo") { // Price < x.
$this->query .= " price <= ?";
} else {
$this->query .= $this->keys[0] . " = ?";
}
// For any additional search conditions add an "AND" to the criteria.
for($i = 1; $i < count($searchArray); $i++) {
if($this->keys[$i] == "yearFrom") { // Year > x.
$this->query .= " AND year >= ?";
} else if($this->keys[$i] == "yearTo") { // Year < x.
$this->query .= " AND year <= ?";
} else if($this->keys[$i] == "mileageFrom") { // Mileage > x.
$this->query .= " AND mileage >= ?";
} else if($this->keys[$i] == "mileageTo") { // Mileage < x.
$this->query .= " AND mileage <= ?";
} else if($this->keys[$i] == "priceFrom") { // Price > x.
$this->query .= " AND price >= ?";
} else if($this->keys[$i] == "priceTo") { // Price < x.
$this->query .= " AND price <= ?";
} else {
$this->query .= " AND " . $this->keys[$i] . " = ?";
}
}
// If there is ORDER BY critiria.
if(isset($_GET['orderByMake'])) {
if($_GET['orderByMake'] == 0){
// Build the query.
$this->query .= " ORDER BY make ASC;";
} else if ($_GET['orderByMake'] == 1) {
// Build the query.
$this->query .= " ORDER BY make DESC;";
}
} else if (isset($_GET['orderByModel'])) {
if($_GET['orderByModel'] == 0){
// Build the query.
$this->query .= " ORDER BY model ASC;";
} else if ($_GET['orderByModel'] == 1) {
// Build the query.
$this->query .= " ORDER BY model DESC;";
}
} else if (isset($_GET['orderByYear'])) {
if($_GET['orderByYear'] == 0){
// Build the query.
$this->query .= " ORDER BY year ASC;";
} else if ($_GET['orderByYear'] == 1) {
// Build the query.
$this->query .= " ORDER BY year DESC;";
}
} else if (isset($_GET['orderByColor'])) {
if($_GET['orderByColor'] == 0){
// Build the query.
$this->query .= " ORDER BY color ASC;";
} else if ($_GET['orderByColor'] == 1) {
// Build the query.
$this->query .= " ORDER BY color DESC;";
}
} else if (isset($_GET['orderByMileage'])) {
if($_GET['orderByMileage'] == 0){
// Build the query.
$this->query .= " ORDER BY mileage ASC;";
} else if ($_GET['orderByMileage'] == 1) {
// Build the query.
$this->query .= " ORDER BY mileage DESC;";
}
} else if (isset($_GET['orderByType'])) {
if($_GET['orderByType'] == 0){
// Build the query.
$this->query .= " ORDER BY type ASC;";
} else if ($_GET['orderByType'] == 1) {
// Build the query.
$this->query .= " ORDER BY type DESC;";
}
} else if (isset($_GET['orderByPrice'])) {
if($_GET['orderByPrice'] == 0){
// Build the query.
$this->query .= " ORDER BY price ASC;";
} else if ($_GET['orderByPrice'] == 1) {
// Build the query.
$this->query .= " ORDER BY price DESC;";
}
} else if (isset($_GET['orderByTransmission'])) {
if($_GET['orderByTransmission'] == 0){
// Build the query.
$this->query .= " ORDER BY transmission ASC;";
} else if ($_GET['orderByTransmission'] == 1) {
// Build the query.
$this->query .= " ORDER BY transmission DESC;";
}
} else if (isset($_GET['orderByDrive'])) {
if($_GET['orderByDrive'] == 0){
// Build the query.
$this->query .= " ORDER BY drive ASC;";
} else if ($_GET['orderByDrive'] == 1) {
// Build the query.
$this->query .= " ORDER BY drive DESC;";
}
}
// After the query has been built add a semicolon to the end.
$this->query .= ";";
// Try to run the SQL query.
try {
$this->query = $this->db->prepare($this->query);
$this->query->execute($this->values);
$result = $this->query->fetchAll(\PDO::FETCH_ASSOC);
// Check if no results where returned.
if($this->query->rowCount() == 0) {
$result = "Sorry, we did not find any matches.";
}
return $result;
} catch(\PDOException $e) {
exit($e->getMessage());
}
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function select($tableName, $conditions = \"\", array $datasCond = array(), array $fieldsList = array()){\r\n //We try to perform the task\r\n try{\r\n //We check if any database is opened\r\n if (!$this->checkOpenDB()) {\r\n throw new Exception(\"There isn't any opened DataBase !\");\r\n }\r\n \r\n //Process fields to select\r\n if(count($fieldsList) == 0)\r\n $fields = \"*\";\r\n else {\r\n $fields = implode(\", \", $fieldsList);\r\n }\r\n\r\n //Generating SQL\r\n $sql = \"SELECT \".$fields.\" FROM \".$tableName.\" \".$conditions;\r\n $selectOBJ = $this->db->prepare($sql);\r\n $selectOBJ->execute($datasCond);\r\n \r\n //Preparing return\r\n $return = array();\r\n foreach($selectOBJ as $process){\r\n $result = array();\r\n \r\n //Processing datas\r\n foreach($process as $name => $data){\r\n //We save the data only if it is not an integer\r\n if (!is_int($name)) {\r\n $result[$name] = $data;\r\n }\r\n }\r\n \r\n //Saving result\r\n $return[] = $result;\r\n }\r\n \r\n //Returning result\r\n return $return;\r\n }\r\n catch(Exception $e){\r\n exit($this->echoException($e));\r\n }\r\n catch(PDOException $e){\r\n exit($this->echoPDOException($e));\r\n }\r\n }",
"public function select($table,$conditions = array()){\r\n\r\n $sql = 'SELECT *'; \r\n $sql .= ' FROM '.$table;\r\n\r\n if(is_array($conditions) && count($conditions)>0){\r\n $sql .= ' WHERE ';\r\n $i = 0;\r\n foreach($conditions as $key => $value){\r\n $pre = ($i > 0)?' AND ':'';\r\n $sql .= $pre.$key.\" = '\".$value.\"'\";\r\n $i++;\r\n }\r\n }\r\n \r\n $query = $this->db->prepare($sql);\r\n\r\n $query->execute(); \r\n \r\n $data = $query->fetchAll();\r\n\r\n return $data;\r\n }",
"public function select($tables, array $columns, array $conditions = [], array $options = []): array;",
"function performSQLSelect($tableName, $filter) {\n $conn = $GLOBALS[\"connection\"];\n\n $sql = \"SELECT * FROM \" . $tableName;\n if ($filter <> NULL) {\n $sql = $sql . \" WHERE \";\n\n foreach ($filter as $key => $value) {\n $whereClause[] = $key . \"='\" . $value . \"'\";\n }\n\n $sql = $sql . implode(\" AND \", $whereClause);\n }\n $result = mysqli_query($conn, $sql);\n if (!$result) {\n printCallstackAndDie();\n }\n $results = NULL;\n while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {\n $results[] = $row;\n }\n\n\n return $results;\n}",
"public function select($tables, array $columns, array $conditions = [], array $options = []): array\n {\n // SELECT\n $sql = 'SELECT';\n\n // COLUMNS\n $sql .= ' ' . $this->parseColumns($columns);\n\n // FROM\n $sql .= ' FROM ' . $this->parseTables($tables);\n\n // WHERE\n if (!empty($conditions)) {\n $sql .= ' WHERE ' . $this->parseConditions($conditions) . ' ';\n }\n\n // ADDITIONAL OPTIONS\n if (!empty($options)) {\n $sql .= $this->parseOptions($options);\n }\n\n // adding end ;\n $sql .= ';';\n\n // execute SQL\n $result = $this->execute($sql);\n\n if ($result !== false) {\n // Parse result\n return PDOParser::parse($result);\n } else {\n // Throw an exception on error\n $this->log(\n new ConnectionException('Failed to select data from ' . json_encode($tables) . '!',\n // log the PDO error as an own exception\n new ConnectionException(\n json_encode(\n array_merge(\n ['query' => $this->getLastQuery()],\n $this->getLastError()\n )\n )\n )\n ),\n Environment::E_LEVEL_ERROR\n );\n\n // return an empty array if exceptions are disabled\n return [];\n }\n }",
"function select_query_i($table, $fields, $where, $orderby = \"\", $orderbyorder = \"\", $limit = \"\", $innerjoin = \"\") {\n global $CONFIG;\n global $query_count;\n global $mysqli_errors;\n global $ramysqli;\n\n if (!$fields) {\n $fields = \"*\";\n }\n $query = \"SELECT \" . $fields . \" FROM \" . db_make_safe_field($table);\n\n if ($innerjoin) {\n $query .= \" INNER JOIN \" . db_escape_string($innerjoin) . \"\";\n }\n\n if ($leftjoin) {\n $query .= \" LEFT OUTER JOIN \" . db_escape_string($innerjoin) . \"\";\n }\n\n if ($where) {\n if (is_array($where)) {\n $criteria = array();\n foreach ($where as $origkey => $value) {\n $key = db_make_safe_field($origkey);\n if (is_array($value)) {\n if ($key == \"default\") {\n $key = \"`default`\";\n }\n\n if ($value['sqltype'] == \"LIKE\") {\n $criteria[] = \"\" . $key . \" LIKE '%\" . db_escape_string($value['value']) . \"%'\";\n continue;\n }\n if ($value['sqltype'] == \"NULL\") {\n $criteria[] = \"\" . $key . \" IS NULL\";\n continue;\n }\n\n if ($value['sqltype'] == \"NEQ\") {\n $criteria[] = \"\" . $key . \"!='\" . db_escape_string($value['value']) . \"'\";\n continue;\n }\n\n if ($value['sqltype'] == \">\" && db_is_valid_amount($value['value'])) {\n $criteria[] = \"\" . $key . \">\" . $value['value'];\n continue;\n }\n\n if ($value['sqltype'] == \"<\" && db_is_valid_amount($value['value'])) {\n $criteria[] = \"\" . $key . \"<\" . $value['value'];\n continue;\n }\n\n if ($value['sqltype'] == \"<=\" && db_is_valid_amount($value['value'])) {\n $criteria[] = \"\" . $origkey . \"<=\" . $value['value'];\n continue;\n }\n\n if ($value['sqltype'] == \">=\" && db_is_valid_amount($value['value'])) {\n $criteria[] = \"\" . $origkey . \">=\" . $value['value'];\n continue;\n }\n\n if ($value['sqltype'] == \"TABLEJOIN\") {\n $criteria[] = \"\" . $key . \"=\" . db_escape_string($value['value']) . \"\";\n continue;\n }\n\n if ($value['sqltype'] == \"IN\") {\n $criteria[] = \"\" . $key . \" IN (\" . db_build_in_array($value['values']) . \")\";\n continue;\n }\n\n exit(\"Invalid input condition\");\n continue;\n }\n\n if (substr($key, 0, 3) == \"MD5\") {\n $key = explode(\"(\", $origkey, 2);\n $key = explode(\")\", $key[1], 2);\n $key = db_make_safe_field($key[0]);\n $key = \"MD5(\" . $key . \")\";\n } else {\n $key = db_build_quoted_field($key);\n }\n\n $criteria[] = \"\" . $key . \"='\" . db_escape_string($value) . \"'\";\n }\n\n $query .= \" WHERE \" . implode(\" AND \", $criteria);\n } else {\n $query .= \" WHERE \" . $where;\n }\n }\n\n\n if ($orderby) {\n $orderbysql = tokenizeOrderby($orderby, $orderbyorder);\n $query .= \" ORDER BY \" . implode(\",\", $orderbysql);\n }\n\n\n if ($limit) {\n if (strpos($limit, \",\")) {\n $limit = explode(\",\", $limit);\n $limit = (int) $limit[0] . \",\" . (int) $limit[1];\n } else {\n $limit = (int) $limit;\n }\n\n $query .= \" LIMIT \" . $limit;\n }\n $result = mysqli_query($ramysqli, $query);\n if (!$result && ($CONFIG['SQLErrorReporting'] || $mysqli_errors)) {\n logActivity(\"SQL Error: \" . mysqli_error($ramysqli) . \" - Full Query: \" . $query);\n }\n\n ++$query_count;\n return $result;\n}",
"function select($where = false){\n $query=\"SELECT * FROM \". $this->tableName ;\n $separator=\" WHERE \";\n if ($where){\n foreach ( $where as $key => $value){\n\t$query .= $separator . $key . \" = '\" . $value . \"'\";\n\t$separator = \" AND \";\n }\n }\n $query .= \";\";\n \n $results = array();\n $res = $this->dbh->query($query);\n while ($row = $res->fetch_assoc()){\n array_push($results, $row);\n }\n return $results;\n }",
"Private function where($tableName,array $conditions,array $options = array()){\n\t\tif(empty ($options))$options = array('prepend' => true ,'join' => ' AND ');\n\t\tif(!isset($options['join'])) $options['join'] = ' AND ';\n\t\t$ops = $this->_operators;\n\t\t$schema = $this->schema[$tableName];\n\t\t$conditions = $this->addSlashesDeep($conditions);\n\t\tswitch (true) {\n\t\t\tcase empty($conditions):\n\t\t\t\treturn '';\n\t\t\tcase is_string($conditions):\n\t\t\t\treturn ($options['prepend']) ? \" WHERE {$conditions}\" : $conditions;\n\t\t\tcase !is_array($conditions):\n\t\t\t\treturn '';\n\t\t}\n\t\t$result = array();\n\n if(count($conditions) > 0 && count($schema) > 0){\n foreach ($conditions as $key => $value) {\n $schema[$key] = isset($schema[$key]) ? $schema[$key] : array();\n switch (true) {\n case strtolower($key) == 'or':\n case strtolower($key) == 'and':\n $result[] = $this->where($tableName,$value,array('prepend' => FALSE,'join' => \" {$key} \"));\n break;\n case (is_numeric($key) && is_array($value)):\n $result[] = $this->where($tableName,$value,array('prepend' => FALSE));\n break;\n case (is_numeric($key) && is_string($value)):\n $result[] = $value;\n break;\n case (is_string($key) && is_array($value) && isset($ops[key($value)])):\n foreach ($value as $op => $val) {\n $result[] = $this->_operator($tableName,$key, array($op => $val), $schema[$key]);\n }\n break;\n case (is_string($key) && is_array($value)):\n $value = join(', ', $this->value($value, $schema[$key]));\n $result[] = \"{$tableName}.{$key} IN ({$value})\";\n break;\n case (is_string($key) && is_string($value) && strpos($value,'%') !== FALSE):\n if(array_key_exists ($key,$this->schema[$tableName])){\n $result[] = \"{$tableName}.{$key} LIKE '{$value}'\";\n }\n else{\n $result[] = \"{$key} LIKE '{$value}'\";\n }\n //$result[] = \"{$tableName}.{$key} LIKE '{$value}'\";\n break;\n default:\n $value = $this->value($value, $schema[$key]);\n $result[] = $tableName.\".\".$key.\" = \".$value;\n break;\n }\n }\n }\n\n\t\tif(count($result)>1){\n\t\t\t$result = \"(\".join($options['join'], $result).\")\";\n\t\t}else{\n\t\t\t$result = join($options['join'], $result);\n\t\t}\n\t\treturn ($options['prepend'] && !empty($result)) ? \"WHERE {$result}\" : $result;\n\t}",
"public function getSpecific($cols, $conditions, $table) \n {\n $values = array();\n $prepReq = \"SELECT\";\n foreach ($cols as $col) \n\t\t\t{ \n\t\t\t$prepReq = $prepReq.\" \".$col.\",\"; \n\t\t\t}\n $prepReq = substr_replace($prepReq ,\"\",-1) . \" FROM \" . $table; //remove last coma and add contents\n\t\t\t\n if(sizeof($conditions) != 0) \n\t\t\t{\n $prepReq = $prepReq . \" WHERE\";\n foreach ($conditions as $condition) \n\t\t\t\t{ \n $prepReq = $prepReq.\" \".$condition[0].\" = ? and\"; \n array_push($values, $condition[1]);\n }\n $prepReq = substr_replace($prepReq ,\"\",-4); //remove last \" AND\"\n }\n\t\t\t\n $req = $this->db->prepare($prepReq);\n $req->execute($values);\n $res = $req->fetchAll(PDO::FETCH_ASSOC);\n return $res;\n\n }",
"public function cpSelect($tablename,$value1=0,$value2=0) {\n /*\n * Prepare the select statement\n */\n $sql=\"SELECT * FROM $tablename\";\n if($value1!=0)\n { $key1= key($value1);\n $sql.=\" where $key1='$value1[$key1]'\";\n }\n if($value1!=0 && $value2!=0) \n {\n $key2= key($value2);\n $sql.=\" AND $key2='$value2[$key2]'\";\n }\n \n $sth = $this->dbh->prepare($sql);\n $sth->execute();\n $result = $sth->fetchAll(PDO::FETCH_ASSOC);\n return $result;\n \n}",
"function select($chosenElements, $table, $conditionsElement, $conditionsResults) {\n\n if(!is_array($chosenElements)) {\n throw new Exception(\"Vybírané prvky musí být pole.\");\n }else if(!is_string($table)) {\n throw new Exception(\"Tabulka musí být zadaná jako string.\");\n }else if(!is_array($conditionsElement)){\n throw new Exception(\"Podmínkové prvky musí být pole.\");\n }else if(!is_array($conditionsResults)){\n throw new Exception(\"Podmínkové prvky musí být pole.\");\n }else if(count($conditionsElement) !== count($conditionsResults)) {\n throw new Exception(\"Podmínkové prvky musí být stejně dlouhé.\");\n }\n $connect = NULL;\n /**Pripojeni do databaze */\n try {\n $connect = require(\"connect.php\");\n }catch(Exception $e) {\n throw $e;\n }\n \n $chosenElements = implode(\",\", $chosenElements);\n /**Podmnky jsou zadavany otazniky pro obranu pred SQL utokum */\n $conditions = implode(\"=? AND \",$conditionsElement);\n $conditions .= '=?';\n\n /**Kontrola poctu podminek */\n if(count($conditionsElement) === 0 && count($conditionsResults) === 0) {\n /**Formatovani metody */\n $statement = $connect->prepare('SELECT '.$chosenElements.' FROM '.$table);\n if(!$statement->execute($conditionsResults)) {\n throw new Exception(\"Chyba při SELECT dotazu.\");\n }\n return $statement->fetchAll();\n }\n\n $statement = $connect->prepare('SELECT '.$chosenElements.' FROM '.$table.' WHERE '.$conditions);\n if(!$statement->execute($conditionsResults)) {\n throw new Exception(\"Chyba při SELECT dotazu.\");\n }\n \n return $statement->fetchAll();\n}",
"public function Select($cond)\r\n\t\r\n {\r\n\t\tglobal $db;\r\n if($cond==\"\")\r\n {\r\n $sql = \"SELECT * FROM \".$this->TableName;\r\n } else\r\n {\t\r\n\t\t \t\r\n\t\t $sql = \"SELECT * FROM \". $this->TableName.\" \".$cond;\r\n }\r\n try{\r\n $query = $db->prepare($sql);\r\n $query->execute();\r\n $arr['rows'] = $query->fetchAll(PDO::FETCH_ASSOC);\r\n $arr['err'] = false;\r\n } catch(PDOException $e){\r\n $arr['err'] = true;\r\n $arr['msg'] = $e->getMessage(); \r\n } \r\n return $arr;\r\n }",
"public function _select ($table, $fields_array = array(), $where_params_array = array(), $order_array = array(), $limit = null, $offset = null)\n {\n // if not set a wildcard to return everything\n if ( !empty ($fields_array) )\n {\n\n $fields = implode (', ', $fields_array);\n }\n else\n {\n\n $fields = '*';\n }\n\n // create the basic query\n $query = \"\n\t\tSELECT {$fields}\n\t\tFROM {$table}\n\t\t\";\n\n $bind_params_array = array();\n\n // if there are any WHERE parameters then add them to the query and the bind params array\n if ( !empty ($where_params_array) )\n {\n\n $query .= \"WHERE\n \";\n $count = 0;\n foreach ($where_params_array as $key => $value) {\n\n $bind_params_array[$count] = $value;\n\n if ( $count > 0 )\n {\n $query .= \" AND \";\n }\n $query .= \"`{$key}` = ?\n \";\n $count++;\n }\n }\n\n // if an order by setting has been received then add it to the query\n if ( !empty ($order_array) )\n {\n\n $query.= \"ORDER BY\n \";\n foreach ($order_array as $key => $value) {\n\n $query.= \"{$key} {$value},\n \";\n }\n $query = rtrim (trim ($query), ',');\n }\n\n // if an LIMIT setting has been received then add it to the query\n if ( is_numeric ($limit) )\n {\n $query.= \"\n LIMIT {$limit}\n \";\n }\n\n // if an OFFSET setting has been received then add it to the query\n if ( $limit !== null && $offset != null )\n {\n if ( !is_int ($offset) )\n {\n\n throw new Exception ('Non integer passed to function as OFFSET value');\n return false;\n }\n\n $query.= \"\n OFFSET {$offset}\n \";\n }\n\n return $this->queryDatabase ($query, $bind_params_array, true);\n }",
"private function Select()\n {\n $return = false;\n $action = $this->Action();\n $columns = $this->Columns();\n $table = $this->Table();\n $where = (Checker::isArray($this->Where(), false))?$this->Where():array(Where::QUERY => \"\", Where::VALUES => array());\n $order = (Checker::isString($this->Order()))?$this->Order():\"\";\n $limit = (Checker::isInt($this->Limit()))?\" LIMIT \".$this->Limit():\"\";\n if($columns && $table && Checker::isArray($where, false))\n {\n $return[Where::QUERY] = \"$action $columns FROM $table\".$where[Where::QUERY].\"$order$limit\";\n\n if(Checker::isArray($where, false) && isset($where[Where::VALUES])) $return[Where::VALUES] = $where[Where::VALUES];\n else $return[Where::VALUES] = array();\n }\n return $return;\n }",
"public function getRows($table,$conditions = array()){\r\n $sql = 'SELECT ';\r\n $sql .= array_key_exists(\"select\",$conditions)?$conditions['select']:'*';\r\n $sql .= ' FROM '.$table;\r\n if(array_key_exists(\"where\",$conditions)){\r\n $sql .= ' WHERE ';\r\n $i = 0;\r\n foreach($conditions['where'] as $key => $value){\r\n $pre = ($i > 0)?' AND ':'';\r\n $sql .= $pre.$key.\" = '\".$value.\"'\";\r\n $i++;\r\n }\r\n }\r\n\r\n if(array_key_exists(\"order_by\",$conditions)){\r\n $sql .= ' ORDER BY '.$conditions['order_by'];\r\n }\r\n\r\n if(array_key_exists(\"join\",$conditions)){\r\n $sql .= ' JOIN ';\r\n $i = 0;\r\n foreach($conditions['join'] as $key => $value){\r\n $pre = ($i > 0)?' AND ':'';\r\n $sql .= $pre.$key.\" = '\".$value.\"'\";\r\n $i++;\r\n }\r\n }\r\n\r\n if(array_key_exists(\"start\",$conditions) && array_key_exists(\"limit\",$conditions)){\r\n $sql .= ' LIMIT '.$conditions['start'].','.$conditions['limit'];\r\n }elseif(!array_key_exists(\"start\",$conditions) && array_key_exists(\"limit\",$conditions)){\r\n $sql .= ' LIMIT '.$conditions['limit'];\r\n }\r\n\r\n $query = $this->db->prepare($sql);\r\n $query->execute();\r\n\r\n if(array_key_exists(\"return_type\",$conditions) && $conditions['return_type'] != 'all'){\r\n switch($conditions['return_type']){\r\n case 'count':\r\n $data = $query->rowCount();\r\n break;\r\n case 'single':\r\n $data = $query->fetch(PDO::FETCH_ASSOC);\r\n break;\r\n default:\r\n $data = '';\r\n }\r\n }else{\r\n if($query->rowCount() > 0){\r\n $data = $query->fetchAll();\r\n }\r\n }\r\n return !empty($data)?$data:false;\r\n }",
"function buildSelect($db_name,$table_name,$columns,$where_select){\n\n\t$query_select = \"SELECT \";\n\t//FILL COLUMNS FOR GET\n\tforeach ($columns as $c) {\n\t\t$query_select .= $c;\n\t\tif(array_search($c,$columns) != count($columns) - 1) $query_select .= \",\";\n\t}\n\tif($where_select != \"*\"){//GET \n\t\t//INTERMEDIATE\n\t\t$query_select .= \" FROM $table_name WHERE \";\n\t\t//FILL VALUES WHERE\n\t\tend($where_select);\n\t\t$last_key = key($where_select);\n\t\tforeach ($where_select as $key => $value) {\n\t\t\t$query_select .= $key . \"=\" . \":\" . $key;\n\t\t\tif($key != $last_key) $query_select .= \" AND \";\n\t\t}\n\t\texecuteQuery(\"USE $db_name\");\n\t\treturn executeQuery($query_select,$where_select);\n\t}\n\telse{//GET ALL SELECT\n\t\t//INTERMEDIATE\n\t\t$query_select .= \" FROM $table_name\";\n\t\texecuteQuery(\"USE $db_name\");\n\t\treturn executeQuery($query_select,\"*\");\n\t}\n\n}",
"function query($stmt,$values) {\n\t\ttry {\n\t\t $qStmt = $this->dbconn->prepare($stmt);\n\t\t\t$qStmt->execute($values);\n\t\t\treturn $qStmt->fetchAll();\n\t\t} catch(PDOException $e) {\n\t\t\treturn $e;\n\t\t}\n\t}",
"function get_all_array($db,$tblname,$options=NULL)\n{\n if (isset($options)) {\n foreach ($options as $key => $value) {\n switch ($key) {\n case 'columns':\n\tif (is_array($value)) {\n\t $columns = $value;\n\t} else {\n\t $columns[] = $value;\n\t}\n\tbreak;\n case 'sort':\n\tif (is_array($value)) {\n\t $orderparts = $value;\n\t} else {\n\t $orderparts[] = $value;\n\t}\n\tbreak;\n\t\n case 'where':\n\tif (is_array($value)) {\n\t $whereparts = $value;\n\t} else {\n\t $whereparts[] = $value;\n\t}\n\tbreak;\n\t\n default:\n\t# code...\n\t break;\n }\n }\n }\n \n $sql_a = Array(); /* initialize the sql query */\n $sql_a[] = \"SELECT\";\n $sql_a[] = (!empty($columns) ? join(\", \",$columns) : \"*\");\n $sql_a[] = \"FROM $tblname\";\n if (!empty($whereparts)) $sql_a[] = \" WHERE \".join(\" AND \",$whereparts);\n if (!empty($orderparts)) $sql_a[] = \" ORDER BY \".join(\",\",$orderparts);\n $sql_s = join(\" \",$sql_a);\n $result=$db->query($sql_s) or\n die(\"In \".__FILE__.\"@\".__LINE__.\" \".__FUNCTION__.\n\t\"Fatal error in query: $sql: (\".$db->errno.\") \".$db->error);\n $all_rows = Array();\n if ($result->num_rows > 0) {\n while ($row = $result->fetch_assoc()) {\n $all_rows[] = $row;\n }\n }\n $result->free();\n return $all_rows;\n}",
"public static function doSelect($sql, $values = array(), $useRedis = true, $redisKey = \"\", $autoErroResponder = false , $fetchAll = true, $fetchStyle = PDO::FETCH_ASSOC)\n {\n\n //mitonim az redis estefade konim\n if(Config::$REDISENABLED) {\n\n }\n $conn = MyPDO::getInstance();\n $stmt = $conn->prepare($sql);\n $result = null;\n if($values != NULL) {\n foreach ($values as $key => $value) {\n $stmt->bindValue($key + 1, $value);\n }\n }\n try {\n $stmt->execute();\n if ($fetchAll) {\n $result = $stmt->fetchAll($fetchStyle);\n } else {\n $result = $stmt->fetch($fetchStyle);\n }\n return $result;\n } catch (\\PDOException $ex) {\n if($autoErroResponder) new Errors(\"Internal Server Error\" , false , Config::$DEBUG_MODE?$ex:\"\" );\n else return $ex;\n }\n }",
"public function select($table = NULL, $values = NULL, $condition = 1, $db = 'DB', $fetch = 'fetch')\n\t{\n\t\tif($table == NULL || $values == NULL)\n\t\t\treturn false;\n\t\t$this->$db();\n\t\t$values = implode(',', $values);\n\t\t$sql = \"SELECT $values FROM $table WHERE $condition\";\n\t\t$query = $this->$db->prepare($sql);\n\t\t$query->execute();\n\t\t$result = array();\n\t\twhile ( $row = $query->fetch() ) {\n\t\t\tarray_push( $result, $row );\n }\n\t\t$this->$db = null;\n\t\treturn $result;\n\t}",
"public function queryByField($conditions = array(), $params=array(), $columns = \"*\", $order = array()) {\n \n \tif ( is_array($columns) ) {\n \t\t$columns = implode(\",\", $columns);\n \t}\n \n \t$dbkey = $this->getDbKey();\n \t$selectObj = Yii::app()->$dbkey->createCommand()\n \t->select($columns)\n \t->from($this->tableName());\n \t\n \tif (! empty($conditions) ) {\n \t\t$selectObj->where($conditions, $params);\n \t}\n \n \tif (! empty($order) ) {\n \t\t$selectObj->order($order);\n \t}\n\n \tif ( strpos($columns, \",\") === false &&\n \tstrpos($columns, \"*\") === false ) {\n \t\t$result = $selectObj->queryColumn();\n \t} else {\n \t\t$result = $selectObj->queryAll();\n \t}\n \treturn $result;\n }",
"public function select($rawQuery, $params = array()):array{\n\t\t//Optem a query do SELET mais os parametros.\n\t\t$stmt = $this->query($rawQuery, $params);\n\t\t//Retorno dos dados da tabela.\n\t\treturn $stmt->fetchAll(PDO::FETCH_ASSOC);\n\t}",
"public function getAll($sql, $params=[]){\n try \n {\n $stmt = $this->dbh->prepare($sql);\n $stmt->execute($params);\n return $stmt->fetchAll();\n \n } catch (PDOException $e) \n {\n throw new Exception($e->getMessage());\n }\n\n }",
"function selectItems($select, $from, $where = 1, $value = array(), $order = 1, $limit = NULL){\n\t\tglobal $con;\n\t\t$limit = $limit != NULL ? ' LIMIT ' . $limit : '';\n\n\t\t$stmt = $con->prepare('SELECT ' . $select . ' FROM ' . $from . ' WHERE ' . $where . ' ORDER BY ' . $order . ' ' . $limit);\n\t\t$stmt->execute($value);\n\t\treturn $stmt->fetchAll();\n\t}",
"public static function fetchArrays(array $conditions, array $orderBy = [], bool $critical = false)\n {\n $entity = new static(); // @phpstan-ignore-line\n $selectQuery = new Select($entity->getDatabaseName(), $critical);\n $selectQuery->select((array) \\array_combine($entity->getAllFieldsAliases(), $entity->getAllFieldsRealNames()));\n $selectQuery->from($entity->getTableName());\n if (\\count($conditions) > 0) {\n $where = array();\n foreach ($conditions as $key => $value) {\n $realName = \\constant(static::class . '::FIELD_' . \\strtoupper(Helper::codifyName($key)));\n $where[$realName] = ':where' . \\ucfirst($key);\n $selectQuery->bind('where' . \\ucfirst($key), $value);\n }\n $selectQuery->where($where);\n }\n if (\\count($orderBy) > 0) {\n $orders = array();\n foreach ($orderBy as $key => $value) {\n $realName = \\constant(static::class . '::FIELD_' . \\strtoupper(Helper::codifyName($key)));\n $orders[$realName] = \\strtoupper(\\ucfirst($value));\n }\n $selectQuery->orderBy($orders);\n }\n if ($selectQuery->execute() === false) {\n return false;\n }\n $data = $selectQuery->fetchAll();\n\n return $data;\n }",
"protected function prepare($conditions) {\n\t\tif(is_array($conditions) && !empty($conditions)) {\n\t\t\t$result = array(0 => \"\");\n\t\t\tforeach($conditions as $key=>$value) {\n\t\t\t\t$join = \"\";\n\t\t\t\tif(!empty($result[0])) { $join = \" AND \"; }\n\t\t\t\tif(!empty($result[0])) { $result[0] .= $join; }\n\n\t\t\t\t//Change from IN to single if only one element\n\t\t\t\tif(is_array($value) && sizeof($value) == 1) { $value = array_values($value); $value = $value[0]; } \n\t\t\t\t//Handle empty arrays\n\t\t\t\tif(is_array($value) && empty($value)) { continue; } \t\t\t\t\t\n\n\t\t\t\t//Handle special cases\n\t\t\t\tif(!is_array($value) && preg_match('!IS (NOT )?NULL!sim',$value)) {\n\t\t\t\t\t$result[0] .= \"$key $value\";\n\t\t\t\t}\n\t\t\t\t//Handle array of values\n\t\t\t\telse if(is_array($value)) {\n\t\t\t\t\t$instr = str_repeat('?,', count($value) - 1) . '?';\n\t\t\t\t\t$result[0] .= \"$key IN ($instr)\";\n\t\t\t\t\tforeach($value as $v) { $result[] = $v; }\n\t\t\t\t//Handle single value\n\t\t\t\t} else {\n\t\t\t\t\t$result[0] .= \"$key = ?\";\n\t\t\t\t\t$result[] = $value;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(empty($result[0])) { return array(); }\n\t\t\treturn $result;\n\t\t}\n\t\treturn $conditions;\n\t}",
"function query($select,$from,$where){\n\trequire '../../access.php';\n\n\t// Clean all the values posted.\n\t$select = strip_tags(charCheck($select));\n\t$from = strip_tags(charCheck($from));\n\t$where = strip_tags(whereCheck(charCheck($where)));\n\n\t// SET A DEFAULT QUERY\n\tif(empty($select)){\n\t\t$select = '*';\t\t\n\t}\n\tif(empty($from)){\n\t\t$from = 'employees';\n\t}\n\n\t// assemble the input info to SQL\n\t$query = \"SELECT $select FROM $from $where\";\n\t$result = mysqli_query($LinkID, $query);\n\t//uncomment for debugging\n\t//echo mysqli_error($LinkID);\n\n\n\n\t//parse the result into an associative array\n\t$things=mysqli_fetch_assoc($result);\n\t\n\t\n\tforeach (array_keys($things) as $key){\n\t\t$keys[]= $key;\n\t}\n\t\n\t//while there are rows of data write a new value to \n\twhile ($things=mysqli_fetch_assoc($result)) {\t\n\t\t$values[] = $things;\n\t}\n\n\t//append the keys to the array\n\t$list['titles'] = $keys;\n\t\n\t//append the values onto the end of the associative array\n\t$list['values'] = $values;\n\n\t//return the result\n\treturn $list;\n}",
"function selecting($table='', $fields='*', ...$get_args) { \n\t\t$getfromtable = $this->fromtable;\n\t\t$getselect_result = $this->select_result; \n\t\t$getisinto = $this->isinto;\n \n\t\t$this->fromtable = null;\n\t\t$this->select_result = true;\t\n\t\t$this->isinto = false;\t\n \n $skipwhere = false;\n $wherekeys = $get_args;\n $where = '';\n\t\t\n if ( ! isset($table) || $table=='' ) {\n $this->setParamaters();\n return false;\n }\n \n $columns = $this->to_string($fields);\n \n\t\tif (isset($getfromtable) && ! $getisinto) \n\t\t\t$sql=\"CREATE TABLE $table AS SELECT $columns FROM \".$getfromtable;\n elseif (isset($getfromtable) && $getisinto) \n\t\t\t$sql=\"SELECT $columns INTO $table FROM \".$getfromtable;\n else \n\t\t\t$sql=\"SELECT $columns FROM \".$table;\n\n if (!empty($get_args)) {\n\t\t\tif (is_string($get_args[0])) {\n $args_by = '';\n $groupbyset = false; \n $havingset = false; \n $orderbyset = false; \n\t\t\t\tforeach ($get_args as $where_groupby_having_orderby) {\n if (strpos($where_groupby_having_orderby,'WHERE')!==false ) {\n $args_by .= $where_groupby_having_orderby;\n $skipwhere = true;\n } elseif (strpos($where_groupby_having_orderby,'GROUP BY')!==false ) {\n $args_by .= ' '.$where_groupby_having_orderby;\n $groupbyset = true;\n } elseif (strpos($where_groupby_having_orderby,'HAVING')!==false ) {\n if ($groupbyset) {\n $args_by .= ' '.$where_groupby_having_orderby;\n $havingset = true;\n } else {\n $this->setParamaters();\n return false;\n }\n } elseif (strpos($where_groupby_having_orderby,'ORDER BY')!==false ) {\n $args_by .= ' '.$where_groupby_having_orderby; \n $orderbyset = true;\n }\n }\n if ($skipwhere || $groupbyset || $havingset || $orderbyset) {\n $where = $args_by;\n $skipwhere = true;\n }\n\t\t\t}\t\t\n\t\t} else {\n $skipwhere = true;\n } \n \n if (! $skipwhere)\n $where = $this->where( ...$wherekeys);\n \n if (is_string($where)) {\n $sql .= $where;\n if ($getselect_result) \n return (($this->getPrepare()) && !empty($this->getParamaters())) ? $this->get_results($sql, OBJECT, true) : $this->get_results($sql); \n else \n return $sql;\n } else {\n $this->setParamaters();\n return false;\n } \n }",
"private function query()\n {\n $lStart = microtime(true);\n\n //arguments should be query (with placeholders) followed by an array of key-value pairs\n $args = func_get_args();\n $args = array_shift($args);\n $query = array_shift($args);\n $params = $args ? array_shift($args) : [];\n\n $sth = $this->pdo->prepare($query);\n if (!$sth) {\n //prepare failed\n $this->handlePrepareError($sth, $query, $params);\n }\n\n //explicitly bind parameters as int/string so IN() doens't get quoted\n foreach ($params as $key => $value) {\n if (is_numeric($value)) {\n $sth->bindValue($key, $value, PDO::PARAM_INT);\n } elseif (is_bool($value)) {\n $sth->bindValue($key, $value, PDO::PARAM_BOOL);\n } elseif (is_null($value)) {\n $sth->bindValue($key, $value, PDO::PARAM_NULL);\n } else {\n $sth->bindValue($key, $value, PDO::PARAM_STR);\n }\n }\n\n //query invalid\n if(!$sth->execute()) {\n $this->handleExecuteError($sth, $query, $params);\n }\n $this->queryTimer += microtime(true) - $lStart;\n $this->queryCount++;\n\n $query = preg_replace('/^\\s+/', '', $query);\n if(str_starts_with(strtolower($query), 'select')) {\n //return results for SELECT\n return $sth;\n\n } elseif(str_starts_with(strtolower($query), 'insert')) {\n //return insert id for INSERT\n $id = $this->pdo->lastInsertId();\n return ($id ?: true);\n\n } else {\n //return TRUE for DELETE, UPDATE\n //NB: don't return affected rows for UPDATE since 0 affected will be interpreted as query failed)\n return true;\n }\n }",
"public function GetRows($table,$conditions = array()){\n\t\t$sql = 'SELECT ';\n\t\t$sql .= array_key_exists(\"select\",$conditions)?$conditions['select']:'*';\n\t\t$sql .= ' FROM '.$table;\n\t\tif(array_key_exists(\"where\",$conditions)){\n\t\t\t$sql .= ' WHERE ';\n\t\t\t$i = 0;\n\t\t\tforeach($conditions['where'] as $key => $value){\n\t\t\t\t$pre = ($i > 0)?' AND ':'';\n\t\t\t\t$sql .= $pre.$key.\" = '\".$value.\"'\";\n\t\t\t\t$i++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(array_key_exists(\"order_by\",$conditions)){\n\t\t\t$sql .= ' ORDER BY '.$conditions['order_by']; \n\t\t}\n\t\t\n\t\tif(array_key_exists(\"start\",$conditions) && array_key_exists(\"limit\",$conditions)){\n\t\t\t$sql .= ' LIMIT '.$conditions['start'].','.$conditions['limit']; \n\t\t}elseif(!array_key_exists(\"start\",$conditions) && array_key_exists(\"limit\",$conditions)){\n\t\t\t$sql .= ' LIMIT '.$conditions['limit']; \n\t\t}\n\t\t\n\t\t$query = $this->db->prepare($sql);\n\t\t$query->execute();\n\t\t\n\t\tif(array_key_exists(\"return_type\",$conditions) && $conditions['return_type'] != 'all'){\n\t\t\tswitch($conditions['return_type']){\n\t\t\t\tcase 'count':\n\t\t\t\t\t$data = $query->rowCount();\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'single':\n\t\t\t\t\t$data = $query->fetch(PDO::FETCH_ASSOC);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\t$data = '';\n\t\t\t}\n\t\t}else{\n\t\t\tif($query->rowCount() > 0){\n\t\t\t\t$data = $query->fetchAll();\n\t\t\t}\n\t\t}\n\t\treturn !empty($data)?$data:false;\n\t}"
] |
[
"0.610713",
"0.6051703",
"0.6007628",
"0.5873731",
"0.5862356",
"0.5837299",
"0.5800902",
"0.5780353",
"0.57364345",
"0.57087195",
"0.5707506",
"0.5611663",
"0.55950236",
"0.5592639",
"0.5511398",
"0.5495048",
"0.5484556",
"0.54836875",
"0.5483001",
"0.5467322",
"0.5452266",
"0.5442403",
"0.5438344",
"0.5422572",
"0.54225165",
"0.5416115",
"0.5405456",
"0.5396952",
"0.5395344",
"0.5391757"
] |
0.6722774
|
0
|
TODO: Implement searchBook() method.
|
public function searchBook(string $bookName)
{
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public static function search_books_general($books, $search) {\n\t\t$books_filter = $books;\n\t\t// dd($result);\n\t\tif ($search->year != '0') {\n\t\t\t$books_filter = BooksBModel::filter_books_by_year($books_filter, $search->year);\n\t\t\t// dd($books_filter);\n\t\t} \n\t\tif ($search->status != '0') {\n\t\t\t$search->status = (int)$search->status;\n\t\t\t$search->status = $search->status - 1;\n\t\t\t$books_filter = BooksBModel::filter_books_by_status($books_filter, $search->status);\n\t\t\t// dd($books_filter);\n\t\t}\n\t\tif ($search->chap != '0') {\n\t\t\t$search->chap = (int)$search->chap;\n\t\t\t$books_filter = BooksBModel::filter_books_by_chap($books_filter, $search->chap);\n\t\t\t// dd($books_filter);\n\t\t}\n\t\tif ($search->author != '') {\n\t\t\t$books_filter = BooksBModel::filter_books_by_author($books_filter, $search->author);\n\t\t\t// dd($books_filter);\n\t\t}\n\t\tif ($search->character != '') {\n\t\t\t$books_filter = BooksBModel::filter_books_by_character($books_filter, $search->character);\n\t\t\t// dd($books_filter);\n\t\t}\n\t\tif ($search->trans != '') {\n\t\t\t$books_filter = BooksBModel::filter_books_by_trans($books_filter, $search->trans);\n\t\t\t// dd($books_filter);\n\t\t}\n\t\tif ($search->sort == '0'){\n\t\t\tif ($search->order == '0')\n\t\t\t\t$books_filter = collect($books_filter)->sortBy('update_at')->toArray();\n\t\t\telseif ($search->order == '1')\n\t\t\t\t$books_filter = collect($books_filter)->sortBy('update_at')->reverse()->toArray();\n\t\t}\n\t\telseif ($search->sort == '1'){\n\t\t\tif ($search->order == '0')\n\t\t\t\t$books_filter = collect($books_filter)->sortBy('name')->toArray();\n\t\t\telseif ($search->order == '1')\n\t\t\t\t$books_filter = collect($books_filter)->sortBy('name')->reverse()->toArray();\n\t\t}\n\t\telseif ($search->sort == '2') {\n\t\t\tif ($search->order == '0')\n\t\t\t\t$books_filter = collect($books_filter)->sortBy('view')->toArray();\n\t\t\telseif ($search->order == '1')\n\t\t\t\t$books_filter = collect($books_filter)->sortBy('view')->reverse()->toArray();\n\t\t}\n\t\t$result = [];\n\t\tif (count($books_filter)>12) {\n\t\t\tfor ($i=0; $i < 12; $i++) { \n\t\t\t\t$result[$i] = $books_filter[$i];\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn $books_filter;\n\t}",
"public function searchBook()\n\t{\n\t\tif (cookie('staffAccount') != '') {\n\t\t\t$text = $_POST['text'];\n\t\t\t$type = $_POST['type'];\n\t \t\t//$return = array();\n\t\t\t$book = D('Book_species');\n\t\t\t$sql = \"SELECT * FROM lib_book_species as a join\n\t\t\t\t\t(SELECT COUNT(*) as number, isbn FROM lib_book_unique \n\t\t\t \t\twhere book_id not in(select book_id from lib_remove)\n\t\t\t \t\tGROUP BY isbn) AS b using(isbn)\n\t\t\t \t\twhere {$type} like '%{$text}%' and number!=0 ORDER BY species_id DESC;\";\n\t\t\tif ($type == 1) {\n\t\t\t\t$bkid = intval($text);\n\t\t\t\t$sql = \"select * from lib_book_species join (select isbn,count(*)\n\t\t\t\t \t\tas number from lib_book_unique group by isbn) as a using(isbn) \n\t\t\t\t\t\twhere isbn in (select isbn from lib_book_unique \n\t\t\t\t\t\twhere book_id = {$bkid}) and {$bkid} not in \n\t\t\t\t\t\t(select book_id from lib_remove)\";\n\t\t\t}\n\n\n\t\t\t$return = $book->query($sql);\n\t\t\tif ($return) {\n\t\t\t\t$json = json_encode(array(\n\t\t\t\t\t'code' => 'success',\n\t\t\t\t\t'data' => json_encode($return)\n\t\t\t\t));\n\t\t\t\techo $json;\n\t\t\t} else {\n\t\t\t\t$json = json_encode(array(\n\t\t\t\t\t'code' => 'fail',\n\t\t\t\t\t'msg' => 'No result!'\n\t\t\t\t));\n\t\t\t\techo $json;\n\t\t\t}\n\t\t} else {\n\t\t\t$json = json_encode(array(\n\t\t\t\t'code' => 'fail',\n\t\t\t\t'msg' => 'Please Login!'\n\t\t\t));\n\t\t\techo $json;\n\t\t}\n\n\t}",
"public function get_book();",
"public function search()\n\t{\t\t\n\t\t$data = array();\n\t\t\n\t\tif($this->input->get()){\n\t\t\t\n\t\t\t$post_data = $this->input->get();\n\t\t\tif(isset($post_data['isbn']) && isset($post_data['author']) && isset($post_data['title']))\n\t\t\t{\n\t\t\t\t$post_data = array('isbn' => $post_data['isbn'],\n\t\t\t\t\t\t\t\t\t'author' => $post_data['author'],\n\t\t\t\t\t\t\t\t\t'title' => $post_data['title'],\n\t\t\t\t\t\t\t\t\t'title_condition' => $post_data['title_condition'],\n\t\t\t\t\t\t\t\t\t'isbn_condition' => $post_data['isbn_condition']\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\n\t\t\t\t$validation = true;\n\t\t\t\tif(empty($post_data['isbn']) && empty($post_data['author']) && empty($post_data['title']))\n\t\t\t\t\t$validation = $this->form_validation->set_data($post_data)\n\t\t\t\t\t\t\t->set_rules('isbn', 'ISBN or Title or Author', 'required')->run();\n\t\t\t\t\n\t\t\t\tif ($validation == TRUE)\n\t\t\t\t{\n\t\t\t\t\t$this->load->model('library/search', 'search');\n\t\t\t\t\t$data['result'] = $this->search->searchResults();\n\t\t\t\t\t$base_url = base_url(\"library/books/search\");\n\t\t\t\t\t$rows = count($data['result']);\n\t\t\t\t\t$data['post_data'] = $post_data;\n\t\t\t\t\tif($rows){\n\t\t\t\t\t\t$this->session->set_flashdata('error_msg','');\n\t\t\t\t\t\t$data['pagination'] = $this->createPageLinks($base_url,$rows);\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$this->session->set_flashdata('error_msg','Sorry the book you are looking for is not available!'); \n\t\t\t\t\t}\n\t\t\t\t\t$this->load->library('table');\n\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t$this->load->template('library/search_books',$data);\n\t}",
"public function search();",
"public function search();",
"function search() {}",
"function search_textbooks($db, $title, $isbn, $author)\n{\n\t$titlekey = \"\"; //sql colomn name\n\t$isbnkey = \"\"; //sql column name \n\t$authorkey = \"\"; //sql column name\n\t$titlevalue = \"\"; // sql column value\n\t$isbnvalue = \"\"; // sql column value\n\t$authorvalue = \"\"; // sql column value\n\n\t/* All empty strings returns nothing */\n\tif($title == \"\" && $isbn == \"\" && $author == \"\")\n\t{\n\t\t$titlekey = \"1\";\n\t\t$isbnkey = \"1\";\n\t\t$authorkey = \"1\";\n\t\t$titlevalue = \"0\";\n\t\t$isbnvalue = \"0\";\n\t\t$authorvalue = \"0\";\n\t}\n\telse // If not an empty search\n\t{\n\n\t\tif($title == \"\") // No search by title\n\t\t{\n\t\t\t$titlekey = '1';\n\t\t\t$titlevalue = '1';\n\t\t}\n\t\telse // Include search by title\n\t\t{\n\t\t\t$titlekey = 'title';\n\t\t\t$titlevalue = \"%\".$title.\"%\"; \n\t\t}\n\n\t\tif($isbn == \"\") // No search by isbn\n\t\t{\n\t\t\t$isbnkey = '1';\n\t\t\t$isbnvalue = '1';\n\t\t}\n\t\telse // include search by isbn\n\t\t{\n\t\t\t$isbnkey = 'isbn';\n\t\t\t$isbnvalue = \"%\".$isbn.\"%\";\n\t\t}\n\n\t\tif($author == \"\") // no search by author\n\t\t{\n\t\t\t$authorkey = '1';\n\t\t\t$authorvalue = '1';\n\t\t}\n\t\telse // include search by author\n\t\t{\n\t\t\t$authorkey = 'author';\n\t\t\t$authorvalue = \"%\".$author.\"%\";\n\t\t}\n\t}\n\n\t\t/* Run the query */\n\t\t$sql = \"SELECT * FROM textbooks where \n\t\t\t\t\t\t\".$titlekey.\" LIKE :title and \".$isbnkey.\" LIKE :isbn and \n\t\t\t\t\t\t\".$authorkey.\" LIKE :author and removed=0\n\t\t\t\t\t\tORDER BY date_time DESC\";\n\n\t\t$st = $db->prepare($sql);\n\t\t$st->execute(array(':title' => $titlevalue, ':isbn'=>$isbnvalue, ':author'=>$authorvalue));\n\t\t$us = $st->fetchAll();\n\t\treturn $us;\n}",
"function search_textbook_range($db, $title, $isbn, $author, $numstart, $numresults)\n{\n\t$titlekey = \"\"; //sql colomn name\n\t$isbnkey = \"\"; //sql column name \n\t$authorkey = \"\"; //sql column name\n\t$titlevalue = \"\"; // sql column value\n\t$isbnvalue = \"\"; // sql column value\n\t$authorvalue = \"\"; // sql column value\n\n\t/* All empty strings returns nothing */\n\tif($title == \"\" && $isbn == \"\" && $author == \"\")\n\t{\n\t\t$titlekey = \"1\";\n\t\t$isbnkey = \"1\";\n\t\t$authorkey = \"1\";\n\t\t$titlevalue = \"0\";\n\t\t$isbnvalue = \"0\";\n\t\t$authorvalue = \"0\";\n\t}\n\telse // If not an empty search\n\t{\n\n\t\tif($title == \"\") // No search by title\n\t\t{\n\t\t\t$titlekey = '1';\n\t\t\t$titlevalue = '1';\n\t\t}\n\t\telse // Include search by title\n\t\t{\n\t\t\t$titlekey = 'title';\n\t\t\t$titlevalue = \"%\".$title.\"%\"; \n\t\t}\n\n\t\tif($isbn == \"\") // No search by isbn\n\t\t{\n\t\t\t$isbnkey = '1';\n\t\t\t$isbnvalue = '1';\n\t\t}\n\t\telse // include search by isbn\n\t\t{\n\t\t\t$isbnkey = 'isbn';\n\t\t\t$isbnvalue = \"%\".$isbn.\"%\";\n\t\t}\n\n\t\tif($author == \"\") // no search by author\n\t\t{\n\t\t\t$authorkey = '1';\n\t\t\t$authorvalue = '1';\n\t\t}\n\t\telse // include search by author\n\t\t{\n\t\t\t$authorkey = 'author';\n\t\t\t$authorvalue = \"%\".$author.\"%\";\n\t\t}\n\t}\n\n\t\t/* Run the query */\n\t\t$sql = \"SELECT * FROM textbooks where \n\t\t\t\t\t\t\".$titlekey.\" LIKE :title and \".$isbnkey.\" LIKE :isbn and \n\t\t\t\t\t\t\".$authorkey.\" LIKE :author and removed=0\n\t\t\t\t\t\tORDER BY date_time DESC LIMIT $numstart, $numresults\";\n\n\t\t$st = $db->prepare($sql);\n\t\t$st->execute(array(':title' => $titlevalue, ':isbn'=>$isbnvalue, ':author'=>$authorvalue));\n\t\t$us = $st->fetchAll();\n\t\treturn $us;\n}",
"public function search(){}",
"public function getBook($isbn);",
"function search()\n\t{}",
"function search()\n\t{}",
"public static function bookSearch($data = NULL) {\n $search_book = \"SELECT \"\n . \"c.category_name, \"\n . \"a.book_title, \"\n . \"a.id_book, \"\n . \"b.author_name, \"\n . \"a.book_image, \"\n . \"a.book_subject, \"\n . \"a.book_ISBN, \"\n . \"a.book_price, \"\n . \"a.book_discount \"\n . \"FROM books a \"\n . \"JOIN authors b ON a.id_author=b.id_author \"\n . \"JOIN categories c ON a.id_category=c.id_category \";\n \n if($data == 'free')\n {\n $search_book .= \"JOIN books_paid bp ON a.id_book = bp.id_book WHERE bp.id_user=99 AND bp.books_visibility=1 \";\n }\n else if($data == 'discount')\n {\n $search_book .= \"WHERE a.book_discount IS NOT NULL \";\n }\n else if($data != NULL)\n {\n extract($data);\n $search_book .= \"WHERE a.book_title LIKE '%\" . $book_search . \"%' \"\n . \"OR a.book_subject LIKE '%\" . $book_search . \"%' \"\n . \"OR a.book_ISBN LIKE '%\" . $book_search . \"%' \"\n . \"OR b.author_name LIKE '%\" . $book_search . \"%' \"\n . \"OR c.category_name LIKE '%\" . $book_search . \"%' \";\n }\n \n $search_book .= \"GROUP BY a.id_book \"\n . \"ORDER BY a.book_title;\";\n\n if ($result = DB::getInstance()->query($search_book)) {\n if ($result->num_rows > 0) {\n return $result->fetch_all(MYSQLI_ASSOC);\n }\n } else {\n return false;\n }\n }",
"public function search(book $book,$id)\n {\n $books = book::Where('name', $id)->orWhere('genre', $id)->get();\n return view('book.search')->with('books',$books)->with('key',$id);\n }",
"public function search()\n\t{\n\t\t\n\t}",
"public function createCorrespondingBookModelForSearch() {\n\t\t$searchModel = new Book('search');\n\t\t$searchModel->unsetAttributes();\n\t\t\n\t\t$searchInput = $this->searchInput;\n\t\t\n\t\tif ($searchInput==\"Suggestions\") {\n\t\t\t$searchModel->title = null;\n\t\t} else {\n\t\t\t$searchModel->title = $searchInput;\n\t\t}\n\t\treturn $searchModel;\n\t}",
"function get($search) {\r\n\t\tglobal $wpdb;\r\n\t\t$conds = array(); \r\n\t\tforeach($search as $key => $value) {\r\n\t\t\tif( array_key_exists($key, $this->fields) ){\r\n\t\t\t\t$value = $wpdb->escape($value);\r\n\t\t\t\t$conds[] = \"`$key`='$value'\";\r\n\t\t\t} \r\n\t\t}\r\n\t\t$sql = \"SELECT * FROM \". $wpdb->EM_BOOKINGS_TABLE .\" WHERE \" . implode(' AND ', $conds) ;\r\n\t\t$result = $wpdb->get_row($sql, ARRAY_A);\r\n\t\tif($result){\r\n\t\t\t$this->to_object($result);\r\n\t\t\treturn true;\t\r\n\t\t}else{\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}",
"public function search()\r\n\t{\r\n\t\t// @todo Please modify the following code to remove attributes that should not be searched.\r\n\r\n\t\t$criteria=new CDbCriteria;\r\n\r\n\t\t$criteria->compare('t.book_id',$this->book_id,true);\r\n\t\tif(isset($_GET['type']) && $_GET['type'] == 'publish') {\r\n\t\t\t$criteria->compare('t.publish',1);\r\n\t\t} elseif(isset($_GET['type']) && $_GET['type'] == 'unpublish') {\r\n\t\t\t$criteria->compare('t.publish',0);\r\n\t\t} elseif(isset($_GET['type']) && $_GET['type'] == 'trash') {\r\n\t\t\t$criteria->compare('t.publish',2);\r\n\t\t} else {\r\n\t\t\t$criteria->addInCondition('t.publish',array(0,1));\r\n\t\t\t$criteria->compare('t.publish',$this->publish);\r\n\t\t}\r\n\t\tif(isset($_GET['publisher'])) {\r\n\t\t\t$criteria->compare('t.publisher_id',$_GET['publisher']);\r\n\t\t} else {\r\n\t\t\t$criteria->compare('t.publisher_id',$this->publisher_id);\r\n\t\t}\r\n\t\t$criteria->compare('t.isbn',$this->isbn,true);\r\n\t\t$criteria->compare('t.title',$this->title,true);\r\n\t\t$criteria->compare('t.description',$this->description,true);\r\n\t\t$criteria->compare('t.cover',$this->cover,true);\r\n\t\t$criteria->compare('t.edition',$this->edition,true);\r\n\t\t$criteria->compare('t.publish_city',$this->publish_city,true);\r\n\t\t$criteria->compare('t.publish_year',$this->publish_year,true);\r\n\t\t$criteria->compare('t.paging',$this->paging,true);\r\n\t\t$criteria->compare('t.sizes',$this->sizes,true);\r\n\t\tif($this->creation_date != null && !in_array($this->creation_date, array('0000-00-00 00:00:00', '0000-00-00')))\r\n\t\t\t$criteria->compare('date(t.creation_date)',date('Y-m-d', strtotime($this->creation_date)));\r\n\t\t$criteria->compare('t.creation_id',$this->creation_id,true);\r\n\t\tif($this->modified_date != null && !in_array($this->modified_date, array('0000-00-00 00:00:00', '0000-00-00')))\r\n\t\t\t$criteria->compare('date(t.modified_date)',date('Y-m-d', strtotime($this->modified_date)));\r\n\t\t$criteria->compare('t.modified_id',$this->modified_id,true);\r\n\t\t\r\n\t\t// Custom Search\r\n\t\t$criteria->with = array(\r\n\t\t\t'publisher' => array(\r\n\t\t\t\t'alias'=>'publisher',\r\n\t\t\t\t'select'=>'publisher_name'\r\n\t\t\t),\r\n\t\t\t'creation' => array(\r\n\t\t\t\t'alias'=>'creation',\r\n\t\t\t\t'select'=>'displayname'\r\n\t\t\t),\r\n\t\t\t'modified' => array(\r\n\t\t\t\t'alias'=>'modified',\r\n\t\t\t\t'select'=>'displayname'\r\n\t\t\t),\r\n\t\t);\r\n\t\t$criteria->compare('publisher.publisher_name',strtolower($this->publisher_search), true);\r\n\t\t$criteria->compare('creation.displayname',strtolower($this->creation_search), true);\r\n\t\t$criteria->compare('modified.displayname',strtolower($this->modified_search), true);\r\n\r\n\t\tif(!isset($_GET['BookMasters_sort']))\r\n\t\t\t$criteria->order = 't.book_id DESC';\r\n\r\n\t\treturn new CActiveDataProvider($this, array(\r\n\t\t\t'criteria'=>$criteria,\r\n\t\t\t'pagination'=>array(\r\n\t\t\t\t'pageSize'=>30,\r\n\t\t\t),\r\n\t\t));\r\n\t}",
"function controlSearch($result){\n\t\t$bookIDs = $this->getBookIDs($result);\n\t\t$bookObjects = array();\n\n\t\tfor($i = 0; $i < count($bookIDs); $i++){\n\t\t\t$bookObject = constructBook($bookIDs[$i]);\n\t\t\t$bookObjects[$i] = $bookObject;\n\t\t}\n\t\t\n\t\t$currentPatronID = $_SESSION['currentPatronID'];\n\t\t$currentPatron = constructPatron($currentPatronID);\n\t\t$patronDep = $currentPatron->getDepartment();\n\n\t\t$suggestedBooks = $this->executeSuggestion($patronDep);\n\t\t\n\t\t$result_one=$this->displaySearch($bookObjects, $suggestedBooks);\n\t\t\n\t\treturn $result_one;\n\t}",
"function search_inventory($db, $seller_id, $title, $isbn, $author)\n{\n\t/* Copy and pasted code from \"search_textbooks\" I can't just wrap it in another function because of how the\n\t\t\t\tprepared statement works */\n\t$titlekey = \"\"; //sql colomn name\n\t$isbnkey = \"\"; //sql column name \n\t$authorkey = \"\"; //sql column name\n\t$titlevalue = \"\"; // sql column value\n\t$isbnvalue = \"\"; // sql column value\n\t$authorvalue = \"\"; // sql column value\n\n\t/* All empty strings returns nothing */\n\tif($title == \"\" && $isbn == \"\" && $author == \"\")\n\t{\n\t\t$titlekey = \"1\";\n\t\t$isbnkey = \"1\";\n\t\t$authorkey = \"1\";\n\t\t$titlevalue = \"0\";\n\t\t$isbnvalue = \"0\";\n\t\t$authorvalue = \"0\";\n\t}\n\telse // If not an empty search\n\t{\n\n\t\tif($title == \"\") // No search by title\n\t\t{\n\t\t\t$titlekey = '1';\n\t\t\t$titlevalue = '1';\n\t\t}\n\t\telse // Include search by title\n\t\t{\n\t\t\t$titlekey = 'title';\n\t\t\t$titlevalue = \"%\".$title.\"%\"; \n\t\t}\n\n\t\tif($isbn == \"\") // No search by isbn\n\t\t{\n\t\t\t$isbnkey = '1';\n\t\t\t$isbnvalue = '1';\n\t\t}\n\t\telse // include search by isbn\n\t\t{\n\t\t\t$isbnkey = 'isbn';\n\t\t\t$isbnvalue = \"%\".$isbn.\"%\";\n\t\t}\n\n\t\tif($author == \"\") // no search by author\n\t\t{\n\t\t\t$authorkey = '1';\n\t\t\t$authorvalue = '1';\n\t\t}\n\t\telse // include search by author\n\t\t{\n\t\t\t$authorkey = 'author';\n\t\t\t$authorvalue = \"%\".$author.\"%\";\n\t\t}\n\t}\n\t\t/* Run the query */\n\t\t$sql = \"SELECT * FROM textbooks where \".$titlekey.\" LIKE :title and \n\t\t\".$isbnkey.\" LIKE :isbn and \".$authorkey.\" \n\t\tLIKE :author and seller_id = :seller_id ORDER BY date_time DESC\";\n\n\t\t$st = $db->prepare($sql);\n\t\t$st->execute(array(':title' => $titlevalue, ':isbn'=>$isbnvalue, ':author'=>$authorvalue, ':seller_id'=>$seller_id));\n\t\t$us = $st->fetchAll();\n\t\treturn $us;\n}",
"function searchBookByISBN($books, $isbn){\n for($i=0; $i< count($books); $i++){\n if (strcmp(trim($books[$i][\"isbn\"]), trim($isbn)) == 0){\n return $books[$i];\n }\n }\n return NULL;\n}",
"public function search()\n {\n $title = \\Request::get('title');\n $authors = \\Request::get('authors');\n $isbn = \\Request::get('isbn');\n if (empty($title) && empty($authors) && empty($isbn)) {\n $books = [];\n } else {\n $books = Book::where('title', 'like', '%' . $title . '%')\n ->where('authors', 'like', '%' . $authors . '%')\n ->where('isbn', 'like', '%' . $isbn . '%')->orderBy('title')->get();\n }\n return view('user.books', compact('books'));\n }",
"public function getBookByISBN($isbn) {\n\t\t$this->xpp = new \\XMLReader();\n\t\t\n\t\tif ($this->xpp->open('http://books.google.com/books/feeds/volumes?q=' . urlencode($isbn))) {\n\t\t\t$this->moveToEntry();\n\t\t\t\n\t\t\t$found = false;\n\t\t\twhile ($this->xpp->name == \"entry\") {\n\t\t\t\t$book = $this->parseBook();\n\t\t\t\t\n\t\t\t\t// if book is found \n\t\t\t\tif (isset($book['identifier']) &&\n\t\t\t\t\t(strlen($isbn) == 10 && isset($book['identifier']['ISBN']) && $book['identifier']['ISBN'] == $isbn) || // ISBN\n\t\t\t\t\t(strlen($isbn) == 13 && isset($book['identifier']['ISBN2']) && $book['identifier']['ISBN2'] == $isbn)) // ISBN2\n\t\t\t\t{\n\t\t\t\t\t$found = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn (!isset($book) || !$found) ? null : $book;\n\t}",
"public function ajaxSearch()\r\n {\r\n $this->load->model('book_model', 'bookManager');\r\n\r\n $books = array();\r\n $search = $this->input->get('search');\r\n $idCustomer = $this->session->userdata('member-id');\r\n $dataBooks = $this->bookManager->getBooksSearch($search);\r\n \r\n $k = 0;\r\n foreach ($dataBooks as $data) {\r\n if (stripos($data->author, trim($search))) {\r\n $books['list'][$k]['name'] = $data->author;\r\n $k++;\r\n }\r\n if (stripos($data->title, trim($search))) {\r\n $books['list'][$k]['name'] = $data->title;\r\n $k++;\r\n }\r\n if (stripos($data->genre, trim($search))) {\r\n $books['list'][$k]['name'] = $data->genre;\r\n $k++;\r\n }\r\n \r\n if ($k > 7) {\r\n break;\r\n }\r\n }\r\n\r\n echo json_encode($books);\r\n die;\r\n }",
"public function search()\n\t{\n\t\t$keyword = $this->input->get('keyword');\n\t\t$data['books'] = $this->search_model->search($keyword);\n\t\t$data['keyword'] = $keyword;\n\t\t$this->load->view('search', $data);\n\t}",
"public function getBook()\n\t{\n\t\treturn $this->getKeyValue('book'); \n\n\t}",
"public function getAllBooks(){\n $query = \"SELECT * FROM Book;\";\n return $this->getBookDetail($query);\n }",
"public function search($search);",
"public function search_lookbook() {\n\n\t\tif ( ! current_user_can( 'manage_woocommerce' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t$keyword = isset($_GET['keyword'])? sanitize_text_field($_GET['keyword']):'';\n\n\t\tif ( empty( $keyword ) ) {\n\t\t\tdie();\n\t\t}\n\t\t$arg = array(\n\t\t\t'post_status' => 'publish',\n\t\t\t'post_type' => 'woocommerce-lookbook',\n\t\t\t'posts_per_page' => 50,\n\t\t\t's' => $keyword\n\n\t\t);\n\t\t$the_query = new WP_Query( $arg );\n\t\t$found_products = array();\n\t\tif ( $the_query->have_posts() ) {\n\t\t\twhile ( $the_query->have_posts() ) {\n\t\t\t\t$the_query->the_post();\n\n\t\t\t\t$product = array( 'id' => get_the_ID(), 'text' => get_the_title() );\n\t\t\t\t$found_products[] = $product;\n\t\t\t}\n\t\t}\n\t\twp_send_json( $found_products );\n\t\tdie;\n\t}"
] |
[
"0.69732594",
"0.6918285",
"0.6834619",
"0.6824576",
"0.67595804",
"0.67595804",
"0.67555624",
"0.67026967",
"0.6656089",
"0.66160285",
"0.6592387",
"0.65790975",
"0.65790975",
"0.65676326",
"0.6549379",
"0.65281063",
"0.6496789",
"0.6489736",
"0.6475925",
"0.643165",
"0.6400739",
"0.638989",
"0.6369766",
"0.63376695",
"0.63100314",
"0.6294963",
"0.62940204",
"0.62833583",
"0.6255492",
"0.6250562"
] |
0.7817797
|
0
|
TODO: Implement listBookByCategory() method.
|
public function listBookByCategory(string $bookCategory)
{
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getBookCategories() {\n return $this->hasMany(BookCategory::className(), ['book_id' => 'id']);\n }",
"public function getBookList()\n {\n return $this->bookDao->getBookList();\n }",
"public function getAllBooks(){\n $query = \"SELECT * FROM Book;\";\n return $this->getBookDetail($query);\n }",
"public function show(booksCategory $booksCategory)\n {\n //\n }",
"public function getBookList() \n {\n return array( \n \"Balagurusamy\" => new Book(\"Balagurusamy\", \"Balagurusamy\", \"C programming\"), \n \"CMM in Practice\" => new Book(\"CMM in Practice\", \"Pankaj Jalote\", \"\"), \n \"PHP for Dummies\" => new Book(\"PHP for Dummies\", \"Some Smart Guy\", \"\") \n ); \n }",
"public static function filter_books_by_category($books, $category_list) {\n\t\t$result = [];\n\t\t$category_array = json_decode($category_list);\n\t\t// dd($category_array);\n\t\tforeach ($books as $book) {\n\t\t\tforeach ($category_array as $category) {\n\t\t\t\t$category_check = CategoriesQModel::get_category_by_name($category);\n\t\t\t\t$category_id = $category_check->id;\n\t\t\t\t$books_category = BooksCategoryQModel::get_books_by_category_id($category_id);\n\t\t\t\tforeach ($books_category as $book_category) {\n\t\t\t\t\tif ($book->id == $book_category->id_book) {\n\t\t\t\t\t\tarray_push($result, $book);\n\t\t\t\t\t\tbreak 2;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t\treturn $result;\n\t}",
"public function getBookList()\n\t{\n\t\treturn array(\n\t\t\t\"1\" => new Book(\"Être et Temps\", \"9782070707393\", 1, 1, 1),\n\t\t\t\"2\" => new Book(\"Finnegans Wake\", \"9782070402250\", 2, 2, 2),\n\t\t\t\"3\" => new Book(\"Critique de la raison pure\", \"9782070325757\", 3, 3, 3)\n\t\t);\n\t}",
"public function getBookList() {\n\n $booklist = array();\n\n foreach ($this->db-> query(\"SELECT * FROM book\") as $row) {\n \n array_push($booklist, new Book($row['title'], $row['author'], $row['description'], $row['id']));\n }\n\n return $booklist;\n }",
"public function get_book();",
"public function index(Request $request)\n {\n $bookQuery = Book::query();\n if ($request->category_id) {\n $category_id = $request->category_id;\n $category = Category::find($category_id);\n $bookQuery = $category->books();\n }\n\n \n return BookResource::collection($bookQuery->paginate(12));\n }",
"public function listBooks ($session) {\n\n // get dummy data if books don't exist\n if (!$session->has('books')) {\n $this->dummyData($session);\n }\n\n return $session->get('books');\n\n }",
"public function filter(Category $category)\n {\n return response()->json(BookResource::collection($category->books), 200);\n }",
"public function listBooks()\n {\n //list all books in database\n $sql2 = \"SELECT * from book\";\n $userBooks = mysql_fetch_array(mysql_query($sql2));\n return $userBooks; \n }",
"public function allBooks ()\n {\n $books = $this->book->findAll();\n $this->show('admin/allbooks', ['books' => $books]);\n }",
"public function getBooks()\n\t{\n\t\treturn $this->books;\n\t}",
"public function index()\n {\n return BookResources::collection(Book::with(['user','categories','authors'])->get());\n }",
"public function getAllBooks() {\n \n $allBooks = Libro::all();\n\n return $allBooks;\n }",
"public function getBooks()\n {\n $page = isset($_GET['page']) ? $_GET['page'] : 1;\n $this->limit = isset($_GET['limit']) ? $_GET['limit'] : $this->limit;\n $offset = $this->limit * ($page - 1);\n\n\n if (USE_ONE_TABLE) {\n $this->table = 'books_authors';\n $sql = \"SELECT * FROM $this->table WHERE `deleted` is NULL LIMIT :limit OFFSET :offset\";\n } else {\n $this->table = 'relations';\n $sql = \"SELECT books.id, book_name, GROUP_CONCAT(name_author SEPARATOR ', ') as 'author' , year, num_pages, about_book, deleted, views, clicks, image\n FROM books \n JOIN relations ON book_id = books.id\n JOIN authors ON authors.id = author_id\n WHERE deleted is NULL \n GROUP BY id\n LIMIT :limit OFFSET :offset\";\n }\n\n $params = [\n [\":limit\", $this->limit, \\PDO::PARAM_INT],\n [\":offset\", $offset, \\PDO::PARAM_INT]\n ];\n return $this->bindAndQuery($sql, $params);\n }",
"public function listLentBooks()\n {\n if (!$this->isLogged()) {\n header('Location: index.php');\n }\n\n $idUser = $this->user['id_user'];\n\n if (isset($_GET['page']) AND !empty($_GET['page'])) {\n $currentPage = (int) $this->cleanParam($_GET['page']);\n }\n else {\n $currentPage = 1;\n }\n\n $lentBookCount = $this->bookManager->lentBookCount($idUser);\n\n $perPage = 12;\n\n $pages = ceil($lentBookCount / $perPage);\n\n $first = ($currentPage * $perPage) - $perPage;\n\n if (isset($_GET['f']) AND !empty($_GET['f'])) {\n $filter = $this->cleanParam($_GET['f']);\n if($filter === \"title\") {\n $sortKey = \"title_book\";\n } else if ($filter === \"author\") {\n $sortKey = \"author_book\";\n } else if ($filter === \"all\") {\n $sortKey = \"date_add_book\";\n } else {\n $sortKey = \"date_add_book\";\n }\n }\n else {\n $sortKey = \"date_add_book\";\n }\n\n if(isset($_POST['button_search_engine'])) {\n if(isset($_POST['content_search']) && !empty($_POST['content_search'])) {\n $wishBook = 0;\n $lendBook = 1;\n $content = $this->cleanParam($_POST['content_search']);\n\n $searchBooks = $this->bookManager->listSearchBooks($idUser, $wishBook, $lendBook, $content);\n $countedBooksSearch = count($searchBooks);\n } \n } \n\n $listLentBooks = $this->bookManager->listLentBooks($idUser, $sortKey, $first, $perPage);\n\n if ($listLentBooks === false) {\n header('Location: index.php?action=error404');\n }\n\n require('App/View/listLentBooks.php');\n }",
"public function booklist()\n {\n $book = Post::where('key', 'book')->get();\n return view('backends.booklist')->with('book', $book);\n }",
"public function getBooks(){\n $sql = \"SELECT * FROM book;\";\n $res = mysqli_query($this->link, $sql);\n $books = mysqli_fetch_all($res);\n return $books;\n }",
"public function getbooksbycategory($categoryid){\n\t\tif($categoryid!=1){\n\t\t\t$this->db->where('Category_Id', $categoryid);\n\t\t}\n\t\telse{\n\t\t\t$this->db->group_by('Product_Id');\n\t\t}\n\t\t$this->db->select('Product_Id,ProductName,ProductAuther,ProductRetailPrice,ProductSellingPrice,ProductDiscount,ProductLanguage,ProductBinding,ProductThumbImage,CategoryName');\n\t\t$this->db->from('tbl_product_category');\n\t\t$this->db->join('tbl_products', 'tbl_product_category.Product_Id = tbl_products.ProductId', 'inner');\n\t\t$this->db->join('tbl_category', 'tbl_product_category.Category_Id = tbl_category.CategoryId', 'inner');\n\t\t$query = $this->db->get();\n\t\treturn $query->result();\n\t}",
"public function getAllBooks(){\n return $this->libros;\n }",
"public function getBooks()\n {\n return $this->hasMany(Book::className(), ['author_id' => 'id']);\n }",
"public function index()\n\t{\n\n\t\t$book_list = Books::select('book_id', 'title', 'author', 'description', 'book_categories.category')\n\t\t\t->join('book_categories', 'book_categories.id', '=', 'books.category_id')\n\t\t\t->orderBy('book_id')->get();\n\t\t// dd($book_list);\n\t\t// $this->filterQuery($book_list);\n\n\t\t// $book_list = $book_list->get();\n\n\t\tfor ($i = 0; $i < count($book_list); $i++) {\n\n\t\t\t$id = $book_list[$i]['book_id'];\n\t\t\t$conditions = array(\n\t\t\t\t'book_id'\t\t\t=> $id,\n\t\t\t\t'available_status'\t=> 1\n\t\t\t);\n\n\t\t\t$book_list[$i]['total_books'] = Issue::select()\n\t\t\t\t->where('book_id', '=', $id)\n\t\t\t\t->count();\n\n\t\t\t$book_list[$i]['avaliable'] = Issue::select()\n\t\t\t\t->where($conditions)\n\t\t\t\t->count();\n\t\t}\n\n\t\treturn $book_list;\n\t}",
"private function getBooksByCategories(array $args = []): BookCollection\n {\n// if (empty($args['categories'])) {\n return new BookCollection();\n/* }\n\n try {\n $bookModel = new BookModel($this->container);\n } catch (\\Exception $e) {\n return new BookCollection();\n }\n\n return $bookModel->findBooksByCategories($args['categories']); */\n }",
"public function GetBookCategory($id){\n $category_item =DB::table('category')-> join('category_item','category.id','=','category_item.category_id')->where('category.id','=',$id)->select('category_item.*')->get();\n $categoryitem = Category_Item::find($id);\n // get all list publisher\n $publisher = DB::table('publisher')->get();\n // get all list author\n $author = DB::table('author')->get();\n //get all list category\n $category = DB::table('category')->get();\n // get list book arcording to book and categoryitem\n $bookcategory = DB:: table('book')->join('category_item','book.category_item_id','=','category_item.id')->orderBy('date_release', 'desc')->select('category_item.*','book.*')->paginate(50);\n $getcategoryitem=DB::table('category')-> join('category_item','category.id','=','category_item.category_id')->select('category_item.*')->get();\n return view('guest.click-category-item.book_category_item',['bookcategory'=>$bookcategory,'categoryitem'=>$categoryitem,'category'=>$category,'getcategoryitem'=>$getcategoryitem,'publisher'=>$publisher, 'author'=>$author,'category_item'=>$category_item]);\n }",
"public function getListingBooks()\n {\n return $this->listingBooks;\n }",
"public function getBooks($id) {\n }",
"public function bookIndex(): array\n {\n return $this->bookRepository->findAllUserBooks(\\Auth::user()->getUid());\n }"
] |
[
"0.692583",
"0.6805241",
"0.67611605",
"0.67281735",
"0.6658472",
"0.6503451",
"0.6453261",
"0.6349605",
"0.6200115",
"0.6173448",
"0.616176",
"0.61473954",
"0.611396",
"0.609604",
"0.6087827",
"0.6073469",
"0.6032806",
"0.6032066",
"0.60264146",
"0.59760785",
"0.5963027",
"0.5945667",
"0.59453666",
"0.5944011",
"0.5918543",
"0.5917522",
"0.5898324",
"0.5877153",
"0.5871524",
"0.58631927"
] |
0.80921745
|
0
|
Renders Bootstrap static form control. By default value will be HTMLencoded using [[encode()]], you may control this behavior via 'encode' option.
|
public static function staticControl($value, $options = [])
{
static::addCssClass($options, 'form-control-static');
$value = (string) $value;
if (isset($options['encode'])) {
$encode = $options['encode'];
unset($options['encode']);
} else {
$encode = true;
}
return static::tag('p', $encode ? static::encode($value) : $value, $options);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function renderWidget()\n {\n if ($this->data !== null) {\n $this->htmlAttributes['value'] = $this->data;\n }\n\n // And to be sure to generate a proper html text input with the proper name...\n $this->htmlAttributes['type'] = $this->type;\n $this->htmlAttributes['name'] = $this->name;\n $this->htmlAttributes['id'] = $this->getId();\n\n $output = '<input ';\n\n $output .= $this->renderHtmlAttributes();\n\n $output .= '/>';\n\n return $output;\n }",
"public function getControl(): Nette\\Utils\\Html\n\t{\n\t\treturn parent::getControl()\n\t\t\t->setText((string) $this->getRenderedValue());\n\t}",
"public function doRender(){\r\n\t\t$label = ($this->label != '') ? Label::get($this)->doRender() : '';\r\n\t\t$javascriptValidationCode = $this->printJavascriptValidationCode();\r\n\r\n\t\treturn\r\n\t\t\t '<div class=\"'.$this->printWrapperClasses().'\">'\r\n\t\t\t\t.$label\r\n\t\t\t\t.'<div class=\"'.parent::WIDGETCLASS.(!empty($printJavascriptValidationCode) ? ' '.parent::JSENABLEDCLASS : '').'\">'\r\n\t\t\t\t\t.'<input'\r\n\t\t\t\t\t\t.$this->printId()\r\n\t\t\t\t\t\t.$this->printName()\r\n\t\t\t\t\t\t.' type=\"password\"'\r\n\t\t\t\t\t\t.' value=\"'.HtmlFormTools::auto_htmlspecialchars($this->text, $this->needsUtf8Safety()).'\"'\r\n\t\t\t\t\t\t.$this->printTitle()\r\n\t\t\t\t\t\t.$this->printSize()\r\n\t\t\t\t\t\t.$this->printMaxLength()\r\n\t\t\t\t\t\t.$this->printCssClasses()\r\n\t\t\t\t\t\t.$this->printJavascriptEventHandler()\r\n\t\t\t\t\t\t.$this->printTabindex()\r\n\t\t\t\t\t\t.$this->printReadonly()\r\n\t\t\t\t\t\t.$this->printDisabled()\r\n\t\t\t\t\t\t.$this->masterForm->printSlash()\r\n\t\t\t\t\t.'>'\r\n\t\t\t\t.'</div>'\r\n\t\t\t\t.$this->masterForm->printFloatBreak()\r\n\t\t\t.'</div>'\r\n\t\t\t.$javascriptValidationCode\r\n\t\t;\r\n\t}",
"public function staticInput($options = [])\n {\n $content = isset($this->staticValue) ? $this->staticValue : Html::getAttributeValue($this->model,\n $this->attribute);\n $this->form->addCssClass($options, ActiveForm::BS_FORM_CONTROL_STATIC);\n $this->parts['{input}'] = Html::tag('div', $content, $options);\n $this->_isStatic = true;\n\n return $this;\n }",
"public function html(){\n\t\treturn '<div class=\"form-group\">'.$this->label.$this->input.'</div>';\n\t}",
"public function setAsStaticForm() {\n\t\treturn $this->form_tag(implode('<br />', $this->_elements));\n\t}",
"public function render() : string\r\n {\r\n return '<input type=\"text\" />';\r\n }",
"function render_text() {\n\t\t?><input type=\"text\" id=\"<?php echo $this->slug ?>\" name=\"<?php echo $this->settings_page ?>[<?php echo $this->slug ?>]\" value=\"<?php echo $this->value ?>\" ><?php\n\t}",
"public function render()\n {\n return view('sendportal::components.text-field');\n }",
"public function render() {\n /* verify all fields except checkbox */\n if($this->required\n && $this->form->isSubmitted()\n && !$this->checkValue()) {\n $this->error = TRUE;\n $this->cssClass = 'error';\n }\n\n /* verify checkbox */\n $tempName = str_replace('[]', NULL, $this->name);\n\n if($this->required\n && $this->form->isSubmitted()\n && $this->type == 'checkbox'\n && !isset($_REQUEST[$tempName])) {\n $this->error = TRUE;\n $this->cssClass = 'error';\n }\n\n $html = NULL;\n $this->value = htmlspecialchars($this->value);\n\n $html .= '<input type=\"'.$this->type.'\" id=\"'.$this->id.'\" name=\"'.$this->name.'\" value=\"'.$this->value.'\"';\n $html .= (bool)$this->size ? ' size= \"'.$this->size.'\"' : NULL;\n $html .= (bool)$this->maxlength ? ' maxlength= \"'.$this->maxlength.'\"' : NULL;\n $html .= (bool)$this->size ? ' size=\"'.$this->size.'\"' : NULL;\n $html .= ($this->type == 'text' || $this->type == 'password') ? ' class=\"' . $this->cssClass .'\"' : NULL;\n $html .= ($this->type == 'submit') ? ' class=\"submit ' . $this->cssClass .'\"' : NULL;\n $html .= ($this->type == 'checkbox') ? ' class=\"checkbox ' . $this->cssClass .'\"' : NULL;\n $html .= ($this->type == 'radio') ? ' class=\"radio ' . $this->cssClass .'\"' : NULL;\n $html .= ($this->type == 'image') ? ' source=\"'.$this->source.'\"' : NULL;\n $html .= ($this->type == 'image' && (bool)$this->width && (bool)$this->height) ? ' style=\"width:'.$this->width.'px; height:'.$this->height.'px;\"' : NULL;\n $html .= (bool)$this->checked ? ' checked' : NULL;\n $html .= ' />';\n\n if (isset($this->label)) {\n $html .= '<span class=\"label\">' . $this->label . '</span>';\n }\n\n $this->html = ($this->type == 'hidden') ? $html : $this->wrap($html);\n }",
"public function getHtml()\n {\n $attributes = $this->getAttributes();\n $attributes['value'] = htmlspecialchars($this->getValue());\n $attributes['type'] = 'hidden';\n $attributesStr = $this->_buildAttributeStr($attributes);\n\n $html = '<input ' . $attributesStr . ' />';\n return $html;\n }",
"function render() {\n\t\tglobal $current_user, $user_identity;\n\n\t\t$r = '';\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\t\t$field_required = $this->get_attribute( 'required' );\n\t\t$placeholder = $this->get_attribute( 'placeholder' );\n\t\t$field_placeholder = ( ! empty( $placeholder ) ) ? \"placeholder='\" . esc_attr( $placeholder ) . \"'\" : '';\n\n\t\tif ( isset( $_POST[$field_id] ) ) {\n\t\t\t$this->value = stripslashes( (string) $_POST[$field_id] );\n\t\t} elseif (\n\t\t\tis_user_logged_in()\n\t\t\t&& ( ( defined( 'IS_WPCOM' ) && IS_WPCOM )\n\t\t\t || true === apply_filters( 'jetpack_auto_fill_logged_in_user', false )\n\t\t\t)\n\t\t) {\n\t\t\t// Special defaults for logged-in users\n\t\t\tswitch ( $this->get_attribute( 'type' ) ) {\n\t\t\tcase 'email';\n\t\t\t\t$this->value = $current_user->data->user_email;\n\t\t\t\tbreak;\n\t\t\tcase 'name' :\n\t\t\t\t$this->value = $user_identity;\n\t\t\t\tbreak;\n\t\t\tcase 'url' :\n\t\t\t\t$this->value = $current_user->data->user_url;\n\t\t\t\tbreak;\n\t\t\tdefault :\n\t\t\t\t$this->value = $this->get_attribute( 'default' );\n\t\t\t}\n\t\t} else {\n\t\t\t$this->value = $this->get_attribute( 'default' );\n\t\t}\n\n\t\t$field_value = Grunion_Contact_Form_Plugin::strip_tags( $this->value );\n\t\t$field_label = Grunion_Contact_Form_Plugin::strip_tags( $field_label );\n\n\t\tswitch ( $field_type ) {\n\t\tcase 'email' :\n\t\t\t$r .= \"\\n<div>\\n\";\n\t\t\t$r .= \"\\t\\t<label for='\" . esc_attr( $field_id ) . \"' class='grunion-field-label email\" . ( $this->is_error() ? ' form-error' : '' ) . \"'>\" . esc_html( $field_label ) . ( $field_required ? '<span>' . __( \"(required)\", 'jetpack' ) . '</span>' : '' ) . \"</label>\\n\";\n\t\t\t$r .= \"\\t\\t<input type='email' name='\" . esc_attr( $field_id ) . \"' id='\" . esc_attr( $field_id ) . \"' value='\" . esc_attr( $field_value ) . \"' class='email' \" . $field_placeholder . \" \" . ( $field_required ? \"required aria-required='true'\" : \"\" ) . \"/>\\n\";\n\t\t\t$r .= \"\\t</div>\\n\";\n\t\t\tbreak;\n\t\tcase 'textarea' :\n\t\t\t$r .= \"\\n<div>\\n\";\n\t\t\t$r .= \"\\t\\t<label for='contact-form-comment-\" . esc_attr( $field_id ) . \"' class='grunion-field-label textarea\" . ( $this->is_error() ? ' form-error' : '' ) . \"'>\" . esc_html( $field_label ) . ( $field_required ? '<span>' . __( \"(required)\", 'jetpack' ) . '</span>' : '' ) . \"</label>\\n\";\n\t\t\t$r .= \"\\t\\t<textarea name='\" . esc_attr( $field_id ) . \"' id='contact-form-comment-\" . esc_attr( $field_id ) . \"' rows='20' \" . $field_placeholder . \" \" . ( $field_required ? \"required aria-required='true'\" : \"\" ) . \">\" . esc_textarea( $field_value ) . \"</textarea>\\n\";\n\t\t\t$r .= \"\\t</div>\\n\";\n\t\t\tbreak;\n\t\tcase 'radio' :\n\t\t\t$r .= \"\\t<div><label class='grunion-field-label\" . ( $this->is_error() ? ' form-error' : '' ) . \"'>\" . esc_html( $field_label ) . ( $field_required ? '<span>' . __( \"(required)\", 'jetpack' ) . '</span>' : '' ) . \"</label>\\n\";\n\t\t\tforeach ( $this->get_attribute( 'options' ) as $option ) {\n\t\t\t\t$option = Grunion_Contact_Form_Plugin::strip_tags( $option );\n\t\t\t\t$r .= \"\\t\\t<label class='grunion-radio-label radio\" . ( $this->is_error() ? ' form-error' : '' ) . \"'>\";\n\t\t\t\t$r .= \"<input type='radio' name='\" . esc_attr( $field_id ) . \"' value='\" . esc_attr( $option ) . \"' class='radio' \" . checked( $option, $field_value, false ) . \" \" . ( $field_required ? \"required aria-required='true'\" : \"\" ) . \"/> \";\n\t\t\t\t$r .= esc_html( $option ) . \"</label>\\n\";\n\t\t\t\t$r .= \"\\t\\t<div class='clear-form'></div>\\n\";\n\t\t\t}\n\t\t\t$r .= \"\\t\\t</div>\\n\";\n\t\t\tbreak;\n\t\tcase 'checkbox' :\n\t\t\t$r .= \"\\t<div>\\n\";\n\t\t\t$r .= \"\\t\\t<label class='grunion-field-label checkbox\" . ( $this->is_error() ? ' form-error' : '' ) . \"'>\\n\";\n\t\t\t$r .= \"\\t\\t<input type='checkbox' name='\" . esc_attr( $field_id ) . \"' value='\" . esc_attr__( 'Yes', 'jetpack' ) . \"' class='checkbox' \" . checked( (bool) $field_value, true, false ) . \" \" . ( $field_required ? \"required aria-required='true'\" : \"\" ) . \"/> \\n\";\n\t\t\t$r .= \"\\t\\t\" . esc_html( $field_label ) . ( $field_required ? '<span>'. __( \"(required)\", 'jetpack' ) . '</span>' : '' ) . \"</label>\\n\";\n\t\t\t$r .= \"\\t\\t<div class='clear-form'></div>\\n\";\n\t\t\t$r .= \"\\t</div>\\n\";\n\t\t\tbreak;\n\t\tcase 'select' :\n\t\t\t$r .= \"\\n<div>\\n\";\n\t\t\t$r .= \"\\t\\t<label for='\" . esc_attr( $field_id ) . \"' class='grunion-field-label select\" . ( $this->is_error() ? ' form-error' : '' ) . \"'>\" . esc_html( $field_label ) . ( $field_required ? '<span>'. __( \"(required)\", 'jetpack' ) . '</span>' : '' ) . \"</label>\\n\";\n\t\t\t$r .= \"\\t<select name='\" . esc_attr( $field_id ) . \"' id='\" . esc_attr( $field_id ) . \"' class='select' \" . ( $field_required ? \"required aria-required='true'\" : \"\" ) . \">\\n\";\n\t\t\tforeach ( $this->get_attribute( 'options' ) as $option ) {\n\t\t\t\t$option = Grunion_Contact_Form_Plugin::strip_tags( $option );\n\t\t\t\t$r .= \"\\t\\t<option\" . selected( $option, $field_value, false ) . \">\" . esc_html( $option ) . \"</option>\\n\";\n\t\t\t}\n\t\t\t$r .= \"\\t</select>\\n\";\n\t\t\t$r .= \"\\t</div>\\n\";\n\t\t\tbreak;\n\t\tcase 'date' :\n\t\t\t$r .= \"\\n<div>\\n\";\n\t\t\t$r .= \"\\t\\t<label for='\" . esc_attr( $field_id ) . \"' class='grunion-field-label \" . esc_attr( $field_type ) . ( $this->is_error() ? ' form-error' : '' ) . \"'>\" . esc_html( $field_label ) . ( $field_required ? '<span>' . __( \"(required)\", 'jetpack' ) . '</span>' : '' ) . \"</label>\\n\";\n\t\t\t$r .= \"\\t\\t<input type='date' name='\" . esc_attr( $field_id ) . \"' id='\" . esc_attr( $field_id ) . \"' value='\" . esc_attr( $field_value ) . \"' class='\" . esc_attr( $field_type ) . \"' \" . ( $field_required ? \"required aria-required='true'\" : \"\" ) . \"/>\\n\";\n\t\t\t$r .= \"\\t</div>\\n\";\n\n\t\t\twp_enqueue_script( 'grunion-frontend', plugins_url( 'js/grunion-frontend.js', __FILE__ ), array( 'jquery', 'jquery-ui-datepicker' ) );\n\t\t\tbreak;\n\t\tdefault : // text field\n\t\t\t// note that any unknown types will produce a text input, so we can use arbitrary type names to handle\n\t\t\t// input fields like name, email, url that require special validation or handling at POST\n\t\t\t$r .= \"\\n<div>\\n\";\n\t\t\t$r .= \"\\t\\t<label for='\" . esc_attr( $field_id ) . \"' class='grunion-field-label \" . esc_attr( $field_type ) . ( $this->is_error() ? ' form-error' : '' ) . \"'>\" . esc_html( $field_label ) . ( $field_required ? '<span>' . __( \"(required)\", 'jetpack' ) . '</span>' : '' ) . \"</label>\\n\";\n\t\t\t$r .= \"\\t\\t<input type='text' name='\" . esc_attr( $field_id ) . \"' id='\" . esc_attr( $field_id ) . \"' value='\" . esc_attr( $field_value ) . \"' class='\" . esc_attr( $field_type ) . \"' \" . $field_placeholder . \" \" . ( $field_required ? \"required aria-required='true'\" : \"\" ) . \"/>\\n\";\n\t\t\t$r .= \"\\t</div>\\n\";\n\t\t}\n\n\t\treturn apply_filters( 'grunion_contact_form_field_html', $r, $field_label, ( in_the_loop() ? get_the_ID() : null ) );\n\t}",
"public function render() {\n $html = str_replace('{text}', $this->text, FORMWIZARD_SEPARATOR);\n $this->html = $html;\n }",
"function render_field() {\n return xFormTemplate::apply($this->template_field, $this->options);\n }",
"public function staticControl($options = [])\n {\n $this->adjustLabelFor($options);\n $this->parts['{input}'] = Html::activeStaticControl($this->model, $this->attribute, $options);\n return $this;\n }",
"public function render_content() {\n\n\t\t\t// Process the palette\n\t\t\tif ( is_array( $this->palette ) ) {\n\t\t\t\t$palette = implode( '|', $this->palette );\n\t\t\t} else {\n\t\t\t\t// Default to true.\n\t\t\t\t$palette = ( false === $this->palette || 'false' === $this->palette ) ? 'false' : 'true';\n\t\t\t}\n\n\t\t\t// Support passing show_opacity as string or boolean. Default to true.\n\t\t\t$show_opacity = ( false === $this->show_opacity || 'false' === $this->show_opacity ) ? 'false' : 'true';\n\n\t\t\t?>\n\t\t\t\t<label>\n\t\t\t\t\t<?php\n\t\t\t\t\t// Output the label and description if they were passed in.\n\t\t\t\t\tif ( isset( $this->label ) && '' !== $this->label ) {\n\t\t\t\t\t\techo '<span class=\"customize-control-title\">' . esc_html( sanitize_text_field( $this->label ) ) . '</span>';\n\t\t\t\t\t}\n\t\t\t\t\tif ( isset( $this->description ) && '' !== $this->description ) {\n\t\t\t\t\t\techo '<span class=\"description customize-control-description\">' . esc_html( sanitize_text_field( $this->description ) ) . '</span>';\n\t\t\t\t\t}\n\t\t\t\t\t?>\n\t\t\t\t</label>\n\t\t\t\t<input class=\"alpha-color-control\" type=\"text\" data-show-opacity=\"<?php echo esc_attr( $show_opacity ); ?>\" data-palette=\"<?php echo esc_attr( $palette ); ?>\" data-default-color=\"<?php echo esc_attr( $this->settings['default']->default ); ?>\" <?php $this->link(); ?> />\n\t\t\t<?php\n\t\t}",
"public function render()\n {\n $boton = '<button type=\"' . $this->_type . '\" value=\"' . $this->_value . '\"';\n if ($this->_form) {\n $boton .= ' form=\"' . $this->_form . '\" ';\n }\n if ($this->_name) {\n $boton .= ' name=\"' . $this->_name. '\" ';\n }\n if ($this->_autoFocus) {\n $boton .= ' autofocus=\"' . $this->_autoFocus. '\" ';\n }\n if ($this->_disabled) {\n $boton .= ' disabled ';\n }\n if ($this->getClass()) {\n $boton .= 'class=\"' . $this->getClass() . '\" ';\n }\n if ($this->_id) {\n $boton .= 'id=\"' . $this->_id . '\" ';\n }\n \n $boton .= '>' . $this->_value . '</button>' . \"\\n\";\n $boton = str_replace(\" \", \" \", $boton);\n return $boton;\n }",
"public function render()\n {\n return view('dainsys_components::components.input-field-addon');\n }",
"public function render()\n {\n return self::renderStatic(['padLength' => $this->arguments['padLength'], 'padString' => $this->arguments['padString'], 'padType' => $this->arguments['padType'], 'value' => $this->arguments['value']], $this->buildRenderChildrenClosure(), $this->renderingContext);\n }",
"public function generate()\n\t{\n\t\treturn sprintf('<input type=\"text\" name=\"%s\" id=\"ctrl_%s\" class=\"captcha mandatory%s\" value=\"\"%s%s',\n\t\t\t\t\t\t$this->strCaptchaKey,\n\t\t\t\t\t\t$this->strId,\n\t\t\t\t\t\t(($this->strClass != '') ? ' ' . $this->strClass : ''),\n\t\t\t\t\t\t$this->getAttributes(),\n\t\t\t\t\t\t$this->strTagEnding) . $this->addSubmit();\n\t}",
"public function toHtml(): HtmlString\n {\n $this->vars[\"__value\"] = collect($this->determineValue());\n\n return parent::toHtml();\n }",
"public function render() {\n if($this->required\n && $this->form->isSubmitted()\n && !$this->checkValue()) {\n $this->error = TRUE;\n $this->cssClass = 'error';\n }\n\n $this->value = htmlspecialchars($this->value);\n\n $html = '<textarea id=\"'.$this->id.'\" name=\"'.$this->name.'\"';\n $html .= (bool)$this->cols ? ' cols=\"'.$this->cols.'\"' : NULL;\n $html .= (bool)$this->rows ? ' rows=\"'.$this->rows.'\"' : NULL;\n $html .= (bool)$this->cssClass ? ' class=\"'.$this->cssClass.'\"' : NULL;\n $html .= '>'.$this->value.'</textarea>';\n\n $this->html = $this->wrap($html);\n }",
"public function render()\n {\n if (! $this->inline) {\n $this->addClass('form-text');\n }\n\n return view('bootstrap-blade::form-text');\n }",
"public static function render_field() {\n\t\t// Get hostname of current site.\n\t\t$hostname = wp_parse_url( site_url(), PHP_URL_HOST );\n\n\t\t// Get current CDN URL.\n\t\t$cdn_url = get_site_option( 'css_js_url_rewriter_cdn_url' );\n\n\t\t?>\n\t\t<label for=\"css_js_url_rewriter_cdn_url\">\n\t\t\t<input type=\"text\" id=\"css_js_url_rewriter_cdn_url\" class=\"regular-text ltr\" name=\"css_js_url_rewriter_cdn_url\" value=\"<?php echo esc_attr( $cdn_url ); ?>\" />\n\t\t</label>\n\t\t<br />\n\t\t<span class=\"description\">\n\t\t\t<?php\n\t\t\t/* translators: 1: Hostname of current site, 2: Hostname of current site */\n\t\t\techo sprintf( __( 'Hostname of CDN. That hostname must point to hostname of site, %1$s. Example of CDN hostname: <code>https://cdn.%2$s</code>.', 'css-js-url-rewriter' ), $hostname, $hostname ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped\n\t\t\t?>\n\t\t</span>\n\t\t<?php\n\t}",
"public function render()\n {\n return view('components.forms.label');\n }",
"public function render() {\n\t\tif ($this->getPage()) {\n\t\t\t$options = $this->getPage()->getOptions();\n\t\t} else {\n\t\t\t$options = [];\n\t\t}\n\t\techo $this->field->render($options);\n\t}",
"protected function renderInput()\n {\n Html::addCssClass($this->options, 'form-control');\n if (!empty($this->options['disabled'])) {\n Html::addCssClass($this->addonOptions, 'disabled-addon');\n }\n if (ArrayHelper::getValue($this->pluginOptions, 'template', true) === false) {\n if (isset($this->size)) {\n Html::addCssClass($this->options, 'input-' . $this->size);\n Html::addCssClass($this->addonOptions, 'inline-addon inline-addon-' . $this->size);\n } else {\n Html::addCssClass($this->addonOptions, 'inline-addon');\n }\n return $this->getInput('textInput') . Html::tag('span', $this->addon, $this->addonOptions);\n }\n Html::addCssClass($this->containerOptions, 'input-group');\n $asButton = ArrayHelper::remove($this->addonOptions, 'asButton', false);\n $buttonOptions = ArrayHelper::remove($this->addonOptions, 'buttonOptions', []);\n if ($asButton) {\n Html::addCssClass($this->addonOptions, 'input-group-btn picker');\n $buttonOptions['type'] = 'button';\n if (empty($buttonOptions['class'])) {\n Html::addCssClass($buttonOptions, 'btn btn-default');\n }\n $content = Html::button($this->addon, $buttonOptions);\n } else {\n Html::addCssClass($this->addonOptions, 'input-group-addon picker');\n $content = $this->addon;\n }\n $addon = Html::tag('span', $content, $this->addonOptions);\n if (isset($this->size)) {\n Html::addCssClass($this->containerOptions, 'input-group-' . $this->size);\n }\n return $this->getInput('textInput') . $addon;\n }",
"public function render_content() {\n\t\t\t?>\n\t\t\t<div class=\"slider-custom-control\">\n\t\t\t\t<span class=\"customize-control-title\"><?php echo esc_html( $this->label ); ?></span><input type=\"number\" id=\"<?php echo esc_attr( $this->id ); ?>\" name=\"<?php echo esc_attr( $this->id ); ?>\" value=\"<?php echo esc_attr( $this->value() ); ?>\" class=\"customize-control-slider-value\" <?php $this->link(); ?> />\n\t\t\t\t<div class=\"slider\" slider-min-value=\"<?php echo esc_attr( $this->input_attrs['min'] ); ?>\" slider-max-value=\"<?php echo esc_attr( $this->input_attrs['max'] ); ?>\" slider-step-value=\"<?php echo esc_attr( $this->input_attrs['step'] ); ?>\"></div><span class=\"slider-reset dashicons dashicons-image-rotate\" slider-reset-value=\"<?php echo esc_attr( $this->value() ); ?>\"></span>\n\t\t\t</div>\n\t\t\t<?php\n\t\t}",
"public function render_content()\n\t\t{ ?>\n\t\t\t<label><p style=\"margin-bottom:0;\">\n <span class=\"customize-control-title\" style=\"margin:0;display:inline-block;\"><?php echo esc_html( $this->label ); ?>\n </span>\n <span class=\"value\">\n <input name=\"<?php echo esc_attr( $this->id ); ?>\" type=\"text\" <?php $this->link(); ?> value=\"<?php echo esc_attr( $this->value() );?>\" class=\"slider-input\" />\n <span class=\"px\">px</span>\n </span></p></label> <?php // WPCS: XSS ok. ?>\n\t\t\t<div class=\"slider\"></div>\n\t\t<?php\n\t\t}",
"public function render()\n {\n return view('components.form.input');\n }"
] |
[
"0.66327214",
"0.65654373",
"0.6552395",
"0.6503784",
"0.64946693",
"0.6392062",
"0.6304865",
"0.62148374",
"0.61915475",
"0.6184212",
"0.6173534",
"0.612868",
"0.6124898",
"0.6106477",
"0.61028016",
"0.609409",
"0.60692894",
"0.60671264",
"0.6049449",
"0.60411155",
"0.6026531",
"0.60248786",
"0.6015044",
"0.5998252",
"0.5984776",
"0.59834635",
"0.59661496",
"0.5961819",
"0.59423584",
"0.5938259"
] |
0.692298
|
0
|
Generates a Bootstrap static form control for the given model attribute.
|
public static function activeStaticControl($model, $attribute, $options = [])
{
if (isset($options['value'])) {
$value = $options['value'];
unset($options['value']);
} else {
$value = static::getAttributeValue($model, $attribute);
}
return static::staticControl($value, $options);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function generateAttributeField($attribute){\r\r\n\t\treturn Yii::app()->controller->renderPartial(\r\r\n\t\t\t\t'ext.Portfolio.views.'.$attribute['type'],\r\r\n\t\t\t\tarray('attribute'=>$attribute),\r\r\n\t\t\t\ttrue\r\r\n\t\t);\r\r\n\t}",
"public function setAsStaticForm() {\n\t\treturn $this->form_tag(implode('<br />', $this->_elements));\n\t}",
"public function staticControl($options = [])\n {\n $this->adjustLabelFor($options);\n $this->parts['{input}'] = Html::activeStaticControl($this->model, $this->attribute, $options);\n return $this;\n }",
"public function staticInput($options = [])\n {\n $content = isset($this->staticValue) ? $this->staticValue : Html::getAttributeValue($this->model,\n $this->attribute);\n $this->form->addCssClass($options, ActiveForm::BS_FORM_CONTROL_STATIC);\n $this->parts['{input}'] = Html::tag('div', $content, $options);\n $this->_isStatic = true;\n\n return $this;\n }",
"public function generate()\n\t{\n\t\treturn sprintf('<input type=\"text\" name=\"%s\" id=\"ctrl_%s\" class=\"captcha mandatory%s\" value=\"\"%s%s',\n\t\t\t\t\t\t$this->strCaptchaKey,\n\t\t\t\t\t\t$this->strId,\n\t\t\t\t\t\t(($this->strClass != '') ? ' ' . $this->strClass : ''),\n\t\t\t\t\t\t$this->getAttributes(),\n\t\t\t\t\t\t$this->strTagEnding) . $this->addSubmit();\n\t}",
"public function generateActiveField($attribute)\n {\n $tableSchema = $this->getTableSchema();\n if ($tableSchema === false || !isset($tableSchema->columns[$attribute])) {\n if (preg_match('/^(password|pass|passwd|passcode)$/i', $attribute)) {\n return \"\\$form->field(\\$model, '$attribute')->passwordInput()\";\n } else {\n return \"\\$form->field(\\$model, '$attribute')\";\n }\n }\n $column = $tableSchema->columns[$attribute];\n\t\t\n\t\t/*\n\t\tHide created, modified, createdBy, modifiedBy, deleted, deletedBy\n\t\t*/\n\t\tif (preg_match('/^(created)$/i', $column->name) && $column->type === 'datetime') return '\"\"//'.$column->name.'';\n\t\tif (preg_match('/^(modified)$/i', $column->name) && $column->type === 'datetime') return '\"\"//'.$column->name.'';\n\t\tif (preg_match('/^(deleted)$/i', $column->name) && $column->type === 'datetime') return '\"\"//'.$column->name.'';\n\t\tif (preg_match('/^(createdBy)$/i', $column->name) && $column->type === 'integer') return '\"\"//'.$column->name.'';\n\t\tif (preg_match('/^(modifiedBy)$/i', $column->name) && $column->type === 'integer') return '\"\"//'.$column->name.'';\n\t\tif (preg_match('/^(deletedBy)$/i', $column->name) && $column->type === 'integer') return '\"\"//'.$column->name.'';\n\t\t\n\t\t$names = explode('_',$column->name);\n\t\tif(count($names>0) and in_array($names[0],['tbl','tb','ref'])){\n\t\t\t$new_name=substr($column->name,strlen($names[0]),strlen($column->name));\n\t\t\t$new_name=substr($new_name,0,strlen($new_name)-3);\n\t\t\t$new_name=\\yii\\helpers\\Inflector::camelize($new_name);\n\t\t\t//$new_name=lcfirst($new_name);\n\t\t\treturn \"'' ?>\\n\n\t\t\t<?php\n\t\t\t\\$data = ArrayHelper::map(\\backend\\models\\\\\".$new_name.\"::find()->select(['id','name'])->asArray()->all(), 'id', 'name');\n\t\t\techo \\$form->field(\\$model, '$attribute')->widget(Select2::classname(), [\n\t\t\t\t'data' => \\$data,\n\t\t\t\t'options' => ['placeholder' => 'Choose \".$new_name.\" ...'],\n\t\t\t\t'pluginOptions' => [\n\t\t\t\t'allowClear' => true\n\t\t\t\t],\n\t\t\t]);\";\n\t\t}\n\t\telse if ($column->type === 'smallint' or ($column->type === 'integer' && $column->size<=3)){\n\t\t if(preg_match('/^(gender)$/i', $column->name)){\n\t\t\t\treturn \"\\$form->field(\\$model, '$attribute')->widget(\\kartik\\widgets\\SwitchInput::classname(), [\n\t\t\t\t\t'pluginOptions' => [\n\t\t\t\t\t\t'onText' => 'Male',\n\t\t\t\t\t\t'offText' => 'Female',\n\t\t\t\t\t]\n\t\t\t\t])\";\n\t\t\t\t\n\t\t\t}\n\t\t\tif($column->size==1){\n\t\t\t\treturn \"\\$form->field(\\$model, '$attribute')->widget(\\kartik\\widgets\\SwitchInput::classname(), [\n\t\t\t\t\t'pluginOptions' => [\n\t\t\t\t\t\t'onText' => 'On',\n\t\t\t\t\t\t'offText' => 'Off',\n\t\t\t\t\t]\n\t\t\t\t])\";\n\t\t\t}\n\n\t\t\t$input = 'textInput';\n\t\t\treturn \"\\$form->field(\\$model, '$attribute')->$input(['maxlength' => $column->size])\";\n\t\t}\n\t\t\n if ($column->phpType === 'boolean') {\n return \"\\$form->field(\\$model, '$attribute')->widget(\\kartik\\widgets\\SwitchInput::classname(), [])\";\n } elseif ($column->type === 'text') {\n return \"\\$form->field(\\$model, '$attribute')->textarea(['rows' => 6])\";\n } else {\t\t\t\n\t\t\tif (preg_match('/^(email|mail)$/i', $column->name)) {\n\t\t\t\treturn \"\\$form->field(\\$model, '$attribute', [\n\t\t\t\t\t 'addon' => ['prepend' => ['content'=>'@']]\n\t\t\t\t ]);\";\n\t\t\t}\n\t\t\t\n\t\t\t// Usage with model and Active Form (with no default initial value)\n\t\t\tif ($column->type === 'date'){\n\t\t\t\treturn \"\\$form->field(\\$model, '$attribute')->widget(\\kartik\\datecontrol\\DateControl::classname(), [\n\t\t\t\t\t'type' => \\kartik\\datecontrol\\DateControl::FORMAT_DATE,\n\t\t\t\t]);\";\n\t\t\t}\n\t\t\t\n\t\t\tif ($column->type === 'datetime'){\n\t\t\t\treturn \"\\$form->field(\\$model, '$attribute')->widget(\\kartik\\datecontrol\\DateControl::classname(), [\n\t\t\t\t\t'type' => \\kartik\\datecontrol\\DateControl::FORMAT_DATETIME,\n\t\t\t\t]);\";\n\t\t\t}\n\t\t\t\n\t\t\tif ($column->type === 'time'){\n\t\t\t\treturn \"\\$form->field(\\$model, '$attribute')->widget(\\kartik\\datecontrol\\DateControl::classname(), [\n\t\t\t\t\t'type' => \\kartik\\datecontrol\\DateControl::FORMAT_TIME,\n\t\t\t\t]);\";\n\t\t\t}\n\t\t\t\n if (preg_match('/^(password|pass|passwd|passcode)$/i', $column->name)) {\n $input = 'passwordInput';\n } else {\n $input = 'textInput';\n }\n\t\t\t\n if (is_array($column->enumValues) && count($column->enumValues) > 0) {\n $dropDownOptions = [];\n foreach ($column->enumValues as $enumValue) {\n $dropDownOptions[$enumValue] = Inflector::humanize($enumValue);\n }\n return \"\\$form->field(\\$model, '$attribute')->dropDownList(\"\n . preg_replace(\"/\\n\\s*/\", ' ', VarDumper::export($dropDownOptions)).\", ['prompt' => ''])\";\t\t\t\n } elseif ($column->phpType !== 'string' || $column->size === null) {\n return \"\\$form->field(\\$model, '$attribute')->$input()\";\n\t\t\t} elseif ($column->phpType == 'string' && $column->size === 255 && \n\t\t\t\t\tpreg_match('/^(document|document1|document2|photo|image|picture|file)$/i', $column->name)) {\n return \"\\$form->field(\\$model, '$attribute')->widget(\\kartik\\widgets\\FileInput::classname(), [\n\t\t\t\t\t'pluginOptions' => [\n\t\t\t\t\t\t'previewFileType' => 'any',\n\t\t\t\t\t\t'showUpload' => false,\n\t\t\t\t\t\t]\n\t\t\t\t\t]);\";\n } else {\n return \"\\$form->field(\\$model, '$attribute')->$input(['maxlength' => $column->size])\";\n }\n }\n }",
"public function getControl()\n {\n $name = $this->getHtmlName();\n return Html::el()\n ->add(Html::el('input')->name($name . '[day]')->id($this->getHtmlId())->value($this->day))\n ->add(\\Nette\\Forms\\Helpers::createSelectBox(\n array(\"zimní měsíce\" => array(1 => \"leden\", 2), \"jarní měsíce\" => array(3 => 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)), array('selected?' => $this->month)\n )->name($name . '[month]'))\n ->add(Html::el('input')->name($name . '[year]')->value($this->year));\n }",
"public function generateActiveField($attribute)\n {\n $tableSchema = $this->getTableSchema();\n if ($tableSchema === false || !isset($tableSchema->columns[$attribute])) {\n if (preg_match('/^(password|pass|passwd|passcode)$/i', $attribute)) {\n return \"\\$form->field(\\$model, '$attribute')->passwordInput()\";\n }\n\n return \"\\$form->field(\\$model, '$attribute')\";\n }\n $column = $tableSchema->columns[$attribute];\n if ($column->phpType === 'boolean') {\n return \"\\$form->field(\\$model, '$attribute')->checkbox()\";\n }\n\n if ($column->type === 'text') {\n return \"\\$form->field(\\$model, '$attribute')->textarea(['rows' => 6])\";\n }\n\n if (preg_match('/^(password|pass|passwd|passcode)$/i', $column->name)) {\n $input = 'passwordInput';\n } else {\n $input = 'textInput';\n }\n\n if (is_array($column->enumValues) && count($column->enumValues) > 0) {\n $dropDownOptions = [];\n foreach ($column->enumValues as $enumValue) {\n $dropDownOptions[$enumValue] = Inflector::humanize($enumValue);\n }\n return \"\\$form->field(\\$model, '$attribute')->dropDownList(\"\n . preg_replace(\"/\\n\\s*/\", ' ', VarDumper::export($dropDownOptions)).\", ['prompt' => ''])\";\n }\n\n\n if ($column->phpType !== 'string' || $column->size === null) {\n return \"\\$form->field(\\$model, '$attribute')->$input()\";\n }\n\n return \"\\$form->field(\\$model, '$attribute')->$input(['maxlength' => true])\";\n }",
"public function getControl()\n\t{\n\t\t$control = parent::getControl();\n\t\t$control->addAttributes(array(\n\t\t\t'id' => $this->getHtmlId(),\n\t\t));\n\t\treturn $control;\n\t}",
"public function generate_control($args = array()){\n /*Generate a repeater*/\n if($this->is_repeater()){\n $repeater_settings = is_array($this->settings['repeater']) ? $this->settings['repeater'] : array();\n $this->rb_control_field = new RB_Repeater_Field($this->id, $this->value, $this->controls, $items_settings = array(\n 'collapsible' => true,\n ), $repeater_settings);\n }\n //Renders the controls in the controls array\n else if( $this->is_group() ){\n if( is_array($this->settings['controls']) ){\n $group_settings = isset($args['group_settings']) && is_array($args['group_settings']) ? $args['group_settings'] : array();\n $this->rb_control_field = new RB_Group_Field($this->id, $this->value, $this->settings['controls'], $group_settings);\n }\n }\n //Generates the controler when only one control was provided\n else{\n $control_settings = is_array($this->controls) ? reset($this->controls) : array();//First item in the controls array\n $control_settings['id'] = $this->id;\n $control_type = isset($control_settings['type']) && $control_settings['type'] ? $control_settings['type'] : 'RB_Input_Control';\n $this->rb_control_field = new RB_Single_Field($this->id, $this->value, $control_settings, $control_type);\n }\n }",
"public function getControl()\r\n\t{\r\n\t\t$control=parent::getControl();\r\n\t\t$control->class[]='tag-control';\r\n\r\n\t\tif ($this->delimiter!==NULL && Strings::trim($this->delimiter)!=='') {\r\n\t\t\t$control->attrs['data-tag-delimiter']=$this->delimiter;\r\n\t\t\t}\r\n\r\n\t\tif ($this->joiner!==NULL && Strings::trim($this->joiner)!=='') {\r\n\t\t\t$control->attrs['data-tag-joiner']=$this->joiner;\r\n\t\t\t}\r\n\t\r\n\t\tif ($this->suggestCallback!==NULL) {\r\n\t\t\t$form=$this->getForm();\r\n\t\t\tif (!$form || !$form instanceof Form) {\r\n\t\t\t\tthrow new \\Nette\\InvalidStateException('TagInput supports only Nette\\Application\\UI\\Form.');\r\n\t\t\t\t}\r\n\t\t\t$control->attrs['data-tag-suggest']=$form->presenter->link($this->renderName, array('word_filter' => '%__filter%'));\r\n\t\t\t}\r\n\r\n\t\treturn $control;\r\n\t}",
"public static function Display($attr)\n {\n return '<?php MyForms::display(); ?>';\n }",
"public static function input(Attribute $attribute){\n\t\t$name = \"name=\\\"model[{$attribute->getName()}]\\\"\";\n\t\t$nullable = $attribute->getNullable();\n\t\t$value = \"value=\\\"{$attribute->getValue()}\\\"\";\n\t\t$readonly = self::$editable ? \"\" : \"readonly\";\n\t\tif ($attribute->getAutoIncrement()) $readonly = \"readonly\";\n\t\t$inputUid = self::uid();\n\t\t$id = \"id=\\\"$inputUid\\\"\";\n\t\t$errorUid = self::uid();\n\t\t$onchange = \"onchange=\\\"var value=getElementById('$inputUid').value;var error = '';\";\n\t\t$onchangeEnd = \"getElementById('$errorUid').innerHTML=error;\\\"\";\n\t\t\t\t\n\t\t$html = \"\";\n\n\t\t/*\n\t\t * Varchar\n\t\t */\n\t\tif ($attribute instanceof Varchar) {\n\t\t\t$min = $attribute->getMinLength();\n\t\t\t$max = $attribute->getMaxLength();\n\t\t\t$maxlength = $max ? \"maxlength=\\\"$max\\\"\" : \"\";\n\t\t\t\n\t\t\t$onchange .= \"\";\n\t\t\tif ($min) $onchange .= \"if (value.length < $min) error += 'Zu kurz (min. $min)';\";\n\t\t\t$onchange .= $onchangeEnd;\n\n\t\t\t$html = \"<input $id type=\\\"text\\\" $name $maxlength $readonly $onchange $value>\";\n\n\t\t/*\n\t\t * Int\n\t\t */\n\t\t} elseif ($attribute instanceof Int) {\n\t\t\t$valueUid = self::uid();\n\t\t\t\n\t\t\tif($attribute->getMax() == false && $attribute->getMax() == false){\n\t\t\t\t$min = \"min=\\\"{$attribute->getMin()}\\\"\";\n\t\t\t\t$max = \"max=\\\"{$attribute->getMax()}\\\"\";\n\t\t\t\t$html = \"<input type=\\\"number\\\" $name $min $max $readonly $value />\";\n\t\t\t} else {\t\n\t\t\t\t$min = \"min=\\\"{$attribute->getMin()}\\\"\";\n\t\t\t\t$max = \"max=\\\"{$attribute->getMax()}\\\"\";\n\t\t\t\t$value = \"value=\\\"{$attribute->getMin()}\\\"\";\n\t\t\t\t$html = \"<span class=\\\"range\\\" style=\\\"background-color: #00CD00;\\\">\";\n\t\t\t\t$html .= \"<input $id type=\\\"range\\\" $name $min $max $readonly $value step=\\\"1\\\"\n\t\t\t\t\tonchange=\\\"\n\t\t\t\t\t\tvar value = document.getElementById('$inputUid').value;\n\t\t\t\t\t\tvar input = document.getElementById('$valueUid');\n\t\t\t\t\t\tinput.innerHTML = value\n\t\t\t\t\t\tvar colors = new Array('#00CD00','#7FFF00','#FFD700','#FF6347','#FF3030');\n\t\t\t\t\t\tinput.parentNode.style.backgroundColor = colors[parseInt(value)-1];\n\t\t\t\t\t\\\" />\";\n\t\t\t\t$html .= \"<span id=\\\"$valueUid\\\" >{$attribute->getMin()}</span>\";\n\t\t\t\t$html .= \"</span>\";\n\t\t\t}\n\t\t}\n\t\n\t\t\n\t\tself::$errorHTML = \"\";\n\t\tself::$errorHTML .= \"<span class=\\\"error\\\" id=\\\"$errorUid\\\">\";\n\t\tforeach ($attribute->getErrors() as $error)\n\t\t\tself::$errorHTML .= \"$error<br>\";\n\t\tself::$errorHTML .= \"</span>\";\n\t\t\n\t\t$attribute->getErrors();\n\t\t\n\t\treturn $html;\n\t}",
"public static function inputText($model,$attribute,$properties=array()) {\n// $attr = self::getNameValueID($model, $attribute);\n// $input_attributes = self::getInputAttributes($attr,$properties);\n// return '<input type=\"text\" ' . $input_attributes . ' />';\n return self::inputTag('text', $model, $attribute,$properties); \n }",
"public function getControl()\n\t{\n\t\t$control = parent::getControl();\n\t\tif (count($this->suggest) !== 0) {\n\t\t\t$control->attrs['data-tag-suggest'] = Environment::getApplication()->getPresenter()->link(self::$renderName, array($this->paramName => '%__filter%'));\n\t\t}\n\t\n\t\treturn $control;\n\t}",
"private static function inputTag($type,$model,$attribute,$properties=array()) {\n $attr = self::getNameValueID($model, $attribute);\n $input_attributes = self::getInputAttributes($attr,$properties);\n return '<input type=\"'.$type.'\" ' . $input_attributes . ' />';\n }",
"public function captchaBlock($model, $attribute, $htmlOptions = array())\r\n\t{\r\n\t\treturn $this->inputBlock('captcha', $model, $attribute, null, $htmlOptions);\r\n\t}",
"public function getControl()\n {\n $control = parent::getControl();\n $rules = json_encode($control->attrs['data-nette-rules']);\n\n $name = $this->getHtmlName();\n $result = Html::el('div')->addAttributes(['class' => 'input-date',]);\n\n $selectDay = $this->day ?: '';\n $selectMonth = $this->month ?: '';\n $selectYear = $this->year ?: '';\n\n return $result\n ->add(Nette\\Forms\\Helpers::createSelectBox(\n self::$days,\n ['selected?' => $selectDay,'disabled:' => ['' => TRUE],]\n )->addAttributes(['class' => 'form-control input-date-item', 'placeholder'=> 'den', 'data-nette-rules' => $rules])->name($name . '[day]'))\n ->add(Nette\\Forms\\Helpers::createSelectBox(\n self::$months,\n ['selected?' => $selectMonth,'disabled:' => ['' => TRUE],]\n )->addAttributes(['class' => 'form-control input-date-item', 'data-nette-rules' => $rules])->name($name . '[month]'))\n ->add(Nette\\Forms\\Helpers::createSelectBox(\n $this->getYears(),\n ['selected?' => $selectYear,'disabled:' => ['' => TRUE],]\n )->addAttributes(['class' => 'form-control input-date-item', 'data-nette-rules' => $rules])->name($name . '[year]'));\n }",
"public function getControl(): Html\n {\n $html = parent::getControl();\n $classNames = $html->getAttribute('class');\n $classNames['custom-select'] = true;\n $html->setAttribute('class', $classNames);\n return $html;\n }",
"public function control($fieldName, array $options = []) {\n $options = Hash::merge([\n 'type' => null,\n 'label' => null,\n 'error' => null,\n 'required' => null,\n 'options' => null,\n 'templates' => [],\n 'templateVars' => [],\n 'labelOptions' => true\n ], $options);\n $options = $this->_parseOptions($fieldName, $options);\n $class = '';\n switch ($options['type']) {\n case 'checkbox':\n case 'radio':\n $class = 'form-check-input';\n break;\n case 'text':\n case 'email':\n case 'number':\n case 'search':\n case 'textarea':\n $class = 'form-control';\n break;\n case 'password':\n $class = 'form-control';\n $options = Hash::merge($options, ['value' => '']);\n break;\n case 'select':\n if (isset($options['multiple']) && $options['multiple'] === 'checkbox') {\n $class = 'form-check-input';\n } else {\n $class = 'form-control';\n }\n break;\n case 'submit':\n $class = 'btn btn-primary';\n break;\n }\n if (isset($options['class'])) {\n if ($options['type'] !== 'submit') {\n $class .= ' ' . $options['class'];\n } else {\n $class = $options['class'];\n }\n }\n if (!empty($class)) {\n $options = Hash::merge($options, ['class' => $class]);\n }\n if (isset($options['checkInline'])) {\n if ($options['checkInline']) {\n $options = Hash::merge($options, ['templateVars' => ['checkInline' => ' form-check-inline']]);\n }\n unset($options['formCheckInline']);\n }\n if (!empty($options['help'])) {\n $options = Hash::merge($options, ['templateVars' => ['help' => $this->templater()->format('help', ['text' => $options['help']])]]);\n unset($options['help']);\n }\n if (isset($options['prepend'])) {\n $options = $this->_buildInputGroup('prepend', $options);\n unset($options['prepend']);\n }\n if (isset($options['append'])) {\n $options = $this->_buildInputGroup('append', $options);\n unset($options['append']);\n }\n if ($this->_template === 'horizontal') {\n if (isset($options) && is_string($options['label'])) {\n $options = Hash::merge($options, ['label' => ['text' => $options['label']]]);\n }\n if (!in_array($options['type'], ['checkbox', 'radio'])) {\n $options = Hash::merge($options, ['label' => ['class' => $this->_horizontal['left'] . ' col-form-label']]);\n }\n $options = Hash::merge($options, ['templateVars' => [\n 'left' => $this->_horizontal['left'],\n 'right' => $this->_horizontal['right'],\n ]]);\n }\n return parent::control($fieldName, $options);\n }",
"public function field($model, $attribute, $options = [])\n {\n return parent::field($model, $attribute, $options);\n }",
"public static function label($model,$attribute,$caption,$properties=array()) {\n $attr = self::getNameID($model, $attribute,false,true);\n $label_attributes = self::getInputAttributes($attr,$properties);\n $label = '<label ' . $label_attributes . '>';\n $label.= $caption .'</label>';\n return $label;\n }",
"public function field($model, $attribute, $options = [])\n {\n $config = $this->fieldConfig;\n if ($config instanceof \\Closure) {\n $config = call_user_func($config, $model, $attribute);\n }\n if (!isset($config['class'])) {\n $config['class'] = $this->fieldClass;\n }\n return Yii::createObject(ArrayHelper::merge($config, [\n 'model' => $model,\n 'attribute' => $attribute,\n 'form' => $this,\n 'options'=>['class'=>'layui-form-item']\n ],$options));\n }",
"protected function generateTag() {\n $this->callFormFactoryFunction('open',[$this->formTemplate['parameters']['id']],$this->formTemplate['methods']);\n\n parent::generateTag();\n\n }",
"public function client(IFormModel $model);",
"abstract public function generateFormField(FormMapper $formMapper);",
"static public function getInstance($type, $attr)\n {\n try {\n $name = (isset($attr['name'])) ? $attr['name'] : '';\n $value = (isset($attr['value'])) ? $attr['value'] : '';\n $matchValue = (isset($attr['matchValue'])) ? $attr['matchValue'] : '';\n $options = (isset($attr['options'])) ? $attr['options'] : '';\n $label = (isset($attr['label'])) ? $attr['label'] : '';\n $group = (isset($attr['group'])) ? $attr['group'] : '';\n $attrib = (isset($attr['attr'])) ? $attr['attr'] : '';\n $time = (isset($attr['time'])) ? $attr['time'] : '';\n $config = (isset($attr['config'])) ? $attr['config'] : '';\n\n Loader::loadClass($type, CLASS_DIR . '/blackcat/view/form/elements');\n\n switch ($type) {\n case 'InputText':\n $obj = new InputText($name, $value, $attrib, $label);\n break;\n\n case 'InputPassword':\n $obj = new InputPassword($name, $value, $attrib, $label);\n break;\n\n case 'InputHidden':\n $obj = new InputHidden($name, $value);\n break;\n\n case 'InputSubmit':\n $obj = new InputSubmit($name, $value, $attrib);\n break;\n\n case 'InputReset':\n $obj = new InputReset($name, $value, $attrib);\n break;\n\n case 'InputCheck':\n $obj = new InputCheck($name, $value, $matchValue, $attrib, $label);\n break;\n\n case 'InputRadio':\n $obj = new InputRadio($name, $value, $matchValue, $attrib, $label);\n break;\n\n case 'InputFile':\n $obj = new InputFile($name, $value, $attrib, $label);\n break;\n \n case 'InputDate':\n $obj = new InputDate($name, $value, $attrib, $time);\n break;\n \n case 'InputEditor':\n $obj = new InputEditor($name, $value, $config, $attrib); \n break;\n \n case 'Button':\n $obj = new Button($name, $value, $attrib);\n break;\n\n case 'TextArea':\n $obj = new TextArea($name, $value, $attrib);\n break;\n\n case 'SelectBox':\n $obj = new Selectbox($name, $options, $matchValue, $attrib, $group);\n break;\n\n default:\n $obj = NULL;\n break;\n }\n\n return $obj;\n } catch (IOException $e) { Error::store($e->getMessage()); }\n\n return null;\n }",
"public function textFieldBlock($model, $attribute, $htmlOptions = array())\r\n\t{\r\n\t\treturn $this->inputBlock('textfield', $model, $attribute, null, $htmlOptions);\r\n\t}",
"function set_width_form() {\n try {\n $app = Slim\\Slim::getInstance();\n $model = $app->request->params('model'); // cofiguration\n\n $gii = new easyuigii();\n $model = $gii->set_width_for_field_form_crud($model);\n\n $app->render(200, ['success' => true, 'model' => $model]);\n } catch (Exception $e) {\n $app->render(200, ['isError' => true, 'msg' => $e->getMessage()]);\n error_log(LogTime() . 'error - set width form ' . PHP_EOL, 3, 'logs/error.log');\n }\n}",
"public function staticContent($attribute, $label, $options = [])\n {\n $options = static::defaults($options);\n return $this->addSingleField(\n $attribute,\n $options[self::OPTIONS_VALIDATION],\n Widget::getStaticContentWidget($attribute, $label, $options)\n );\n }"
] |
[
"0.608995",
"0.6072806",
"0.6064155",
"0.5916348",
"0.5665211",
"0.5622263",
"0.5526703",
"0.54615134",
"0.542549",
"0.53038704",
"0.5235553",
"0.51859605",
"0.51811963",
"0.51720643",
"0.5163725",
"0.51371664",
"0.51358366",
"0.5106353",
"0.5095872",
"0.50933594",
"0.5079834",
"0.50730115",
"0.505447",
"0.5046628",
"0.50274086",
"0.50205904",
"0.5000593",
"0.49973863",
"0.4974637",
"0.4938845"
] |
0.6621575
|
0
|
Handles incoming ajax requests for which the user need not be authenticated. Forwards the request to plugin actions for the "context" portion of the URL. The following example would set the context of 'foo' and trigger the plugin action 'ajax_foo'. URL::get( 'ajax', 'context=foo' );
|
public function act_ajax()
{
/**
* Triggers the ajax plugin action for the context.
*
* @see AjaxHandler::act_ajax()
* @action ajax_{$context}
*/
Plugins::act( 'ajax_' . $this->handler_vars['context'], $this );
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function act_auth_ajax()\n\t{\n\t\t$user = User::identify();\n\t\tif ( $user->loggedin ) {\n\t\t\t/**\n\t\t\t * Triggers the ajax plugin action for the context if user is authenticated.\n\t\t\t *\n\t\t\t * @see act_auth_ajax()\n\t\t\t * @action ajax_auth_{$context}\n\t\t\t */\n\t\t\tPlugins::act( 'auth_ajax_' . $this->handler_vars['context'], $this );\n\t\t\texit;\n\t\t}\n\t}",
"public function handleAjaxRequest();",
"function handleRequest(){\n\n check_ajax_referer( 'mvc-ajax' );\n \n $class = apply_filters( 'mvc_theme_ajax_handle_class', $this->getControllerObject( $_POST['controller'] ), $_POST );\n\n if( !$this->no_priv ){\n if( !isset( $class->ajax_allow ) || !in_array( $_POST['method'], $class->ajax_allow ) ){\n echo 'This method has not been added to the ajax_allow allowed list';\n exit();\n } \n }\n\n $data = $class->{$_POST['method']}($_POST['args']);\n \n if( !is_string( $data ) ){\n echo json_encode( $data );\n } else {\n echo $data;\n }\n exit(); \n }",
"public static function handle_ajax() {\n\t\tHelpers::ajax_wrapper( array( self::class, 'ajax_handler_body' ) );\n\t}",
"abstract public function ajaxAction(): string;",
"public function onAfterRoute()\n\t{\n\t\t$this->app = JFactory::getApplication();\n\t\t// Instantiate the JDispatcher class\n\t\t$this->dispatcher = JDispatcher::getInstance();\n\t\t// Jinput\n\t\t$this->input = $this->app->input;\n\n\t\t// check request mode\n\t\t$request_mode = $this->params->get('ajax_mode','request_with');\n\t\tswitch ($request_mode)\n\t\t{\n\t\t\tcase 'variable':\n\t\t\t\t$request_param = $this->params->get('custom_request_variable','ajax');\n\t\t\t\t$request_param_value = $this->input->getCmd($request_param);\n\t\t\t\tif (!empty($request_param_value))\n\t\t\t\t\t$this->doAjax();\n\t\t\t\tbreak;\n\t\t\tcase 'option':\n\t\t\t\t// check option request\n\t\t\t\tif ($this->input->getCmd('component') == $this->params->get('custom_request_variable','com_ajax')) {\n\t\t\t\t\t$this->doAjax();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'request_with':\n\t\t\t\t$requestWith = strtolower($this->input->server->get('HTTP_X_REQUESTED_WITH'));\n\t\t\t\tif(!empty($requestWith) && $requestWith == 'xmlhttprequest') {\n\t\t\t\t\t$this->doAjax();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\tif (JFactory::getSession()->get('ajax', false)) {\n\t\t\t$this->doAjax();\n\t\t}\n\t}",
"function is_protected_ajax_action()\n {\n }",
"protected function requireAjax()\n {\n if (!request()->ajax()) {\n app()->abort(404);\n }\n }",
"function is_ajax_request()\n{\n return (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == \"XMLHttpRequest\");\n}",
"function is_ajax() {\n return isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest';\n}",
"function is_ajax() {\n return isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest';\n}",
"function isAjax() {\n return Yii::app()->request->isAjaxRequest || isset( $_GET[ 'ajax' ] ) || isset( $_POST[ 'ajax' ] );\n}",
"function is_ajax() {\n return isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest';\n}",
"function is_ajax() {\n return true;\n}",
"function is_ajax_request() {\n return !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest';\n }",
"function wp_doing_ajax()\n {\n }",
"public function testIsAjax()\n {\n $request = new Request([], [], [], [], [], ['HTTP_X_Requested_With' => 'XMLHttpRequest']);\n $context = new RequestContext();\n $context->fromRequest($request);\n\n $this->assertTrue($context->isAjax());\n }",
"function is_ajax() {\n\treturn !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest';\n}",
"public function ajax() {\n \n // Get action's get input\n $action = $this->CI->input->get('action');\n\n if ( !$action ) {\n $action = $this->CI->input->post('action');\n }\n \n try {\n\n // Call method if exists\n (new MidrubBaseAdminCollectionFrontendControllers\\Ajax)->$action();\n\n } catch (Exception $ex) {\n\n $data = array(\n 'success' => FALSE,\n 'message' => $ex->getMessage()\n );\n\n echo json_encode($data);\n\n }\n \n }",
"function is_ajax() { \r\n return isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'; \r\n }",
"function is_ajax() {\n\treturn isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest';\n}",
"function is_ajax() {\n\treturn isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest';\n}",
"public function maybe_load_module_on_ajax() {\n\n\t\t$action = ! empty( $_REQUEST['action'] ) ? $_REQUEST['action'] : false;\n\n\t\tif ( ! $action ) {\n\t\t\treturn;\n\t\t}\n\n\t\t$parts = explode( '/', $action );\n\n\t\tif ( empty( $parts[1] ) || Plugin::instance()->dashboard->page_slug !== $parts[0] ) {\n\t\t\treturn;\n\t\t}\n\n\t\t$module = $parts[1];\n\n\t\t$this->load_module( $module );\n\n\t}",
"function mtws_redirect_admin(){\n // check if Ajax request\n if( empty($_SERVER['HTTP_X_REQUESTED_WITH']) || strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) !== 'xmlhttprequest' ) {\n // proceed if was not Ajax request\n if ( ! current_user_can( 'edit_posts' ) ){\n wp_redirect( site_url() );\n exit; \n }\n }\n}",
"function ajax_serverActions()\n{\n\n $cc = new CapabilityCheck('serverActions', $_POST);\n if (!$cc->checkCapability()) {\n return;\n }\n\n check_ajax_referer('CPWP');\n\n $cpjm = new CPJobManager('serverActions', $_POST);\n $cpjm->RunJob();\n\n}",
"public static function ajax_callback(){\r\n\t\tif(empty($_GET['hid'])){ wp_die('hid is required'); }\r\n\t\tunset($_GET['action']);\r\n\t\tdie(file_get_contents(SpecialOffersSnippet::calculate_url($_GET)));\r\n\t}",
"private function ajaxController()\n {\n\n switch ($this->request['action']) {\n case 'add_task':\n $result = $this->addTask($this->request);\n break;\n case 'task_edit_popup':\n $result = $this->getEditTaskPopupData($this->request['task_id']);\n break;\n case 'edit_task':\n $result = $this->editTask($this->request);\n break;\n default:\n return false;\n }\n\n echo json_encode($result);\n exit();\n }",
"function url_admin_ajax(): string\n{\n return \\admin_url('admin-ajax.php');\n}",
"public function requestAction()\n {\n return $this->returnAjaxResponse(self::REQUEST);\n }",
"function is_ajax() {\n return isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest';\n }"
] |
[
"0.6681246",
"0.65743804",
"0.64121467",
"0.62781346",
"0.607757",
"0.60629994",
"0.6014194",
"0.5916005",
"0.58807355",
"0.5844196",
"0.5844196",
"0.5839921",
"0.5835449",
"0.57852805",
"0.57851267",
"0.57291883",
"0.57083184",
"0.56723",
"0.56322354",
"0.5627862",
"0.56240916",
"0.56240916",
"0.56198657",
"0.5610729",
"0.5595986",
"0.55858445",
"0.5552001",
"0.5533009",
"0.5525525",
"0.55173874"
] |
0.69010675
|
0
|
Handles incoming ajax requests for which the user must be authenticated. Forwards the request to plugin actions for the "context" portion of the URL.
|
public function act_auth_ajax()
{
$user = User::identify();
if ( $user->loggedin ) {
/**
* Triggers the ajax plugin action for the context if user is authenticated.
*
* @see act_auth_ajax()
* @action ajax_auth_{$context}
*/
Plugins::act( 'auth_ajax_' . $this->handler_vars['context'], $this );
exit;
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function handleRequest(){\n\n check_ajax_referer( 'mvc-ajax' );\n \n $class = apply_filters( 'mvc_theme_ajax_handle_class', $this->getControllerObject( $_POST['controller'] ), $_POST );\n\n if( !$this->no_priv ){\n if( !isset( $class->ajax_allow ) || !in_array( $_POST['method'], $class->ajax_allow ) ){\n echo 'This method has not been added to the ajax_allow allowed list';\n exit();\n } \n }\n\n $data = $class->{$_POST['method']}($_POST['args']);\n \n if( !is_string( $data ) ){\n echo json_encode( $data );\n } else {\n echo $data;\n }\n exit(); \n }",
"public function handleAjaxRequest();",
"public function act_ajax()\n\t{\n\t\t/**\n\t\t * Triggers the ajax plugin action for the context.\n\t\t *\n\t\t * @see AjaxHandler::act_ajax()\n\t\t * @action ajax_{$context}\n\t\t */\n\t\tPlugins::act( 'ajax_' . $this->handler_vars['context'], $this );\n\t}",
"public function ajaxAction() {\n $result = $this->_auth->authenticate($this->_adapter);\n if ($result->isValid()) {\n $this->_auth->getStorage()->write(array(\"identity\" => $result->getIdentity(), \"user\" => new Josh_Auth_User($this->_type, $result->getMessages())));\n\n $ident = $this->_auth->getIdentity();\n\n $loggedIn = $this->view->partial('partials/userLoggedIn.phtml', array('userObj' => $ident['user']));\n $alert = $this->view->partial('partials/alert.phtml', array('alert' => 'Successful Login', 'alertClass' => 'alert-success'));\n\n $html = array(\"#userButton\" => $loggedIn, \"alert\" => $alert);\n $this->jsonResponse('success', 200, $html);\n } else {\n $errorMessage = $result->getMessages();\n $alert = $this->view->partial('partials/alert.phtml', array('alert' => $errorMessage['error'], 'alertClass' => 'alert-error'));\n\n $html = array(\"alert\" => $alert);\n $this->jsonResponse('error', 401, $html, $errorMessage['error']);\n }\n }",
"function is_protected_ajax_action()\n {\n }",
"public static function handle_ajax() {\n\t\tHelpers::ajax_wrapper( array( self::class, 'ajax_handler_body' ) );\n\t}",
"function wp_ajax_logged_in()\n {\n }",
"public function onAfterRoute()\n\t{\n\t\t$this->app = JFactory::getApplication();\n\t\t// Instantiate the JDispatcher class\n\t\t$this->dispatcher = JDispatcher::getInstance();\n\t\t// Jinput\n\t\t$this->input = $this->app->input;\n\n\t\t// check request mode\n\t\t$request_mode = $this->params->get('ajax_mode','request_with');\n\t\tswitch ($request_mode)\n\t\t{\n\t\t\tcase 'variable':\n\t\t\t\t$request_param = $this->params->get('custom_request_variable','ajax');\n\t\t\t\t$request_param_value = $this->input->getCmd($request_param);\n\t\t\t\tif (!empty($request_param_value))\n\t\t\t\t\t$this->doAjax();\n\t\t\t\tbreak;\n\t\t\tcase 'option':\n\t\t\t\t// check option request\n\t\t\t\tif ($this->input->getCmd('component') == $this->params->get('custom_request_variable','com_ajax')) {\n\t\t\t\t\t$this->doAjax();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'request_with':\n\t\t\t\t$requestWith = strtolower($this->input->server->get('HTTP_X_REQUESTED_WITH'));\n\t\t\t\tif(!empty($requestWith) && $requestWith == 'xmlhttprequest') {\n\t\t\t\t\t$this->doAjax();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\tif (JFactory::getSession()->get('ajax', false)) {\n\t\t\t$this->doAjax();\n\t\t}\n\t}",
"public static function process_ajax_requests() {\n // check for required capabilities to perform action\n if ( ! current_user_can( 'activate_plugins' ) ) {\n wp_send_json(\n array(\n 'success' => false,\n 'message' => __( 'You don\\'t have sufficient user capabilities to do this.', 'laterpay' )\n )\n );\n }\n if ( function_exists( 'check_admin_referer' ) ) {\n check_admin_referer( 'laterpay_form' );\n }\n\n switch ( $_POST['form'] ) {\n // update presentation mode for paid content\n case 'paid_content_preview':\n $paid_content_preview_form = new LaterPay_Form_PaidContentPreview();\n\n if ( ! $paid_content_preview_form->is_valid( $_POST ) ) {\n wp_send_json(\n array(\n 'success' => false,\n 'message' => __( 'An error occurred when trying to save your settings. Please try again.', 'laterpay' )\n )\n );\n }\n\n $result = update_option( 'laterpay_teaser_content_only', $paid_content_preview_form->get_field_value( 'paid_content_preview' ) );\n\n if ( $result ) {\n if ( get_option( 'laterpay_teaser_content_only' ) ) {\n wp_send_json(\n array(\n 'success' => true,\n 'message' => __( 'Visitors will now see only the teaser content of paid posts.', 'laterpay' )\n )\n );\n }\n\n wp_send_json(\n array(\n 'success' => true,\n 'message' => __( 'Visitors will now see the teaser content of paid posts plus an excerpt of the real content under an overlay.', 'laterpay' )\n )\n );\n }\n break;\n\n // update rating functionality (on / off) for purchased items\n case 'ratings':\n $ratings_form = new LaterPay_Form_Rating();\n\n if ( ! $ratings_form->is_valid( $_POST ) ) {\n wp_send_json(\n array(\n 'success' => false,\n 'message' => __( 'An error occurred when trying to save your settings. Please try again.', 'laterpay' ),\n )\n );\n }\n\n $result = update_option( 'laterpay_ratings', !! $ratings_form->get_field_value( 'enable_ratings' ) );\n\n if ( $result ) {\n if ( get_option( 'laterpay_ratings' ) ) {\n wp_send_json(\n array(\n 'success' => true,\n 'message' => __( 'Visitors can now rate the posts they have purchased.', 'laterpay' ),\n )\n );\n }\n\n wp_send_json(\n array(\n 'success' => true,\n 'message' => __( 'The rating of posts has been disabled.', 'laterpay' ),\n )\n );\n }\n break;\n\n case 'purchase_button_position':\n $purchase_button_pos_form = new LaterPay_Form_PurchaseButtonPosition( $_POST );\n\n if ( ! $purchase_button_pos_form->is_valid( ) ) {\n wp_send_json(\n array(\n 'success' => false,\n 'message' => __( 'An error occurred when trying to save your settings. Please try again.', 'laterpay' ),\n )\n );\n }\n\n $result = update_option( 'laterpay_purchase_button_positioned_manually', !! $purchase_button_pos_form->get_field_value( 'purchase_button_positioned_manually' ) );\n\n if ( $result ) {\n if ( get_option( 'laterpay_purchase_button_positioned_manually' ) ) {\n wp_send_json(\n array(\n 'success' => true,\n 'message' => __( 'Purchase buttons are now rendered at a custom position.', 'laterpay' ),\n )\n );\n }\n\n wp_send_json(\n array(\n 'success' => true,\n 'message' => __( 'Purchase buttons are now rendered at their default position.', 'laterpay' ),\n )\n );\n }\n break;\n\n case 'time_passes_position':\n $time_passes_pos_form = new LaterPay_Form_TimePassPosition( $_POST );\n\n if ( ! $time_passes_pos_form->is_valid() ) {\n wp_send_json(\n array(\n 'success' => false,\n 'message' => __( 'An error occurred when trying to save your settings. Please try again.', 'laterpay' ),\n )\n );\n }\n\n $result = update_option( 'laterpay_time_passes_positioned_manually', !! $time_passes_pos_form->get_field_value( 'time_passes_positioned_manually' ) );\n\n if ( $result ) {\n if ( get_option( 'laterpay_time_passes_positioned_manually' ) ) {\n wp_send_json(\n array(\n 'success' => true,\n 'message' => __( 'Time passes are now rendered at a custom position.', 'laterpay' ),\n )\n );\n }\n\n wp_send_json(\n array(\n 'success' => true,\n 'message' => __( 'Time passes are now rendered at their default position.', 'laterpay' ),\n )\n );\n }\n break;\n\n default:\n break;\n }\n\n wp_send_json(\n array(\n 'success' => false,\n 'message' => __( 'An error occurred when trying to save your settings. Please try again.', 'laterpay' ),\n )\n );\n }",
"function ajax_login(){\r\n check_ajax_referer( 'ajax-login-nonce', 'security' );\r\n // Nonce is checked, get the POST data and sign user on\r\n \t// Call auth_user_login\r\n\tauth_user_login($_POST['email'], $_POST['password'], 'Login'); \r\n\t\r\n die();\r\n}",
"function add_google_ajax_actions(){\n add_action('wp_ajax_nopriv_vm_login_google', 'vm_login_google');\n}",
"public function ajax_frontend_call()\n {\n\n // Security check\n check_ajax_referer('referer_id', 'nonce');\n\n $response = 'OK';\n // Send response in JSON format\n // wp_send_json( $response );\n // wp_send_json_error();\n wp_send_json_success($response);\n\n die();\n }",
"function rtasset_activate_plugin_ajax() {\n\tif ( empty( $_POST['path'] ) ) {\n\t\tdie( __( 'ERROR: No slug was passed to the AJAX callback.', 'rt_biz' ) );\n\t}\n\tcheck_ajax_referer( 'rtasset_activate_plugin_' . $_POST['path'] );\n\n\tif ( ! current_user_can( 'activate_plugins' ) ) {\n\t\tdie( __( 'ERROR: You lack permissions to activate plugins.', 'rt_biz' ) );\n\t}\n\n\trtasset_activate_plugin( $_POST['path'] );\n\n\techo 'true';\n\tdie();\n}",
"function ajax_serverActions()\n{\n\n $cc = new CapabilityCheck('serverActions', $_POST);\n if (!$cc->checkCapability()) {\n return;\n }\n\n check_ajax_referer('CPWP');\n\n $cpjm = new CPJobManager('serverActions', $_POST);\n $cpjm->RunJob();\n\n}",
"function mtws_redirect_admin(){\n // check if Ajax request\n if( empty($_SERVER['HTTP_X_REQUESTED_WITH']) || strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) !== 'xmlhttprequest' ) {\n // proceed if was not Ajax request\n if ( ! current_user_can( 'edit_posts' ) ){\n wp_redirect( site_url() );\n exit; \n }\n }\n}",
"public function ajax_user_can()\n {\n }",
"function ajax_login() {\n\n\t\t\tcheck_ajax_referer( 'ajax-login-nonce', 'security' );\n\t\t\n\t\t\tself::auth_user_login($_POST['username'], $_POST['password'], __( 'Acceso', 'project045' ) );\n\t\t\n\t\t\tdie();\n\t\t}",
"public function ajax_user_can()\n {\n }",
"function ajax_user_can() {\n\t}",
"public function ajax_backend_call()\n {\n\n // Security check\n check_ajax_referer('referer_id', 'nonce');\n\n $response = 'OK';\n // Send response in JSON format\n // wp_send_json( $response );\n // wp_send_json_error();\n wp_send_json_success($response);\n\n die();\n }",
"abstract protected function _handleAuthRequest(Zend_Controller_Request_Abstract $request);",
"private function admin_ajax_routing() {\n\n\t\t// Load API injection\n\t\t$this->add_action( 'wp_ajax_flowdrive_get_profile', $this->api, 'getUserProfile');\n\t\t$this->add_action( 'wp_ajax_flowdrive_get_base_folders', $this->api, 'getBaseFolders');\n\t\t$this->add_action( 'wp_ajax_flowdrive_get_layer', $this->api, 'getLayer');\n\t\t$this->add_action( 'wp_ajax_flowdrive_compare', $this->api, 'compare');\n\t\t$this->add_action( 'wp_ajax_flowdrive_get_folder_contents', $this->api, 'getFolderContents');\n\t\t$this->add_action( 'wp_ajax_flowdrive_post_item', $this->api, 'postItem');\n\t}",
"public function init_ajax() {\n\n\t\tparent::init_ajax();\n\n\t\t// Add AJAX callback for retreiving folder contents.\n\t\tadd_action( 'wp_ajax_gfdropbox_folder_contents', array( $this, 'ajax_get_folder_contents' ) );\n\n\t\t// Add AJAX callback for de-authorizing with Dropbox.\n\t\tadd_action( 'wp_ajax_gfdropbox_deauthorize', array( $this, 'ajax_deauthorize' ) );\n\n\t\t// Add AJAX callback for checking app key/secret validity.\n\t\tadd_action( 'wp_ajax_gfdropbox_valid_app_key_secret', array( $this, 'ajax_is_valid_app_key_secret' ) );\n\n\t}",
"public function handle_ajax( ITSEC_Login_Interstitial_Session $session, array $data ) { }",
"public function init()\r\n { \r\n //date_default_timezone_set('America/Phoenix');\r\n $ajaxContext = $this->_helper->getHelper('AjaxContext');\r\n\t$ajaxContext->addActionContext('list', 'html')\r\n ->addActionContext('edit', 'html')\r\n ->addActionContext('dashboard', 'html')\r\n ->addActionContext('handler', 'html')\r\n ->initContext();\r\n $auth = Zend_Auth::getInstance();\r\n $action = Zend_Controller_Front::getInstance()->getRequest()->getActionName();\r\n $type = $this->getRequest()->getParam('type');\r\n if (!$auth->hasIdentity() && $action!='handler') {\r\n //echo \"THIS IS AN ERROR: \".$action;\r\n $this->_redirect('login', array('UseBaseUrl' => true));\r\n }\r\n }",
"function ajax_login(){\r\n check_ajax_referer( 'ajax-login-nonce', 'security' );\r\n\r\n // Nonce is checked, get the POST data and sign user on\r\n $info = array();\r\n $info['user_login'] = $_POST['username'];\r\n $info['user_password'] = $_POST['password'];\r\n $info['remember'] = true;\r\n\r\n $user_signon = wp_signon( $info, false );\r\n if ( is_wp_error($user_signon) ){\r\n echo json_encode(array('loggedin'=>false, 'message'=>__('Wrong username or password.')));\r\n } else {\r\n echo json_encode(array('loggedin'=>true, 'message'=>__('Login successful, redirecting...')));\r\n }\r\n\r\n die();\r\n}",
"function parseRequest() {\n global $wp_query, $wp;\n\n if( array_key_exists('xauth', $wp->query_vars) ) {\n if ($wp->query_vars['xauth'] == 'login') {\n $redirect_to = $wp->query_vars['redirect_to'];\n\n XAuthPlugin::loginPage($redirect_to);\n }\n }\n }",
"function ajax_login(){\n check_ajax_referer( 'ajax-login-nonce', 'security' );\n\n // Nonce is checked, get the POST data and sign user on\n $info = array();\n $info['user_login'] = $_POST['username'];\n $info['user_password'] = $_POST['password'];\n $info['remember'] = true;\n\n $user_signon = wp_signon( $info, false );\n if ( is_wp_error($user_signon) ){\n echo json_encode(array('loggedin'=>false, 'message'=>__('Wrong username or password.')));\n } else {\n echo json_encode(array('loggedin'=>true, 'message'=>__('Login successful, redirecting...')));\n }\n\n die();\n}",
"function ajax_login(){\n check_ajax_referer( 'ajax-login-nonce', 'security' );\n\n // Nonce is checked, get the POST data and sign user on\n $info = array();\n $info['user_login'] = $_POST['username'];\n $info['user_password'] = $_POST['password'];\n $info['remember'] = true;\n\n $user_signon = wp_signon( $info, false );\n if ( is_wp_error($user_signon) ){\n echo json_encode(array('loggedin'=>false, 'message'=>__('Invalid Login Info')));\n } else {\n echo json_encode(array('loggedin'=>true, 'message'=>__('Login successful, redirecting...')));\n }\n\n die();\n}",
"function ajax_login(){\n check_ajax_referer( 'ajax-login-nonce', 'security' );\n\n // Nonce is checked, get the POST data and sign user on\n $info = array();\n $info['user_login'] = $_POST['username'];\n $info['user_password'] = $_POST['password'];\n $info['remember'] = true;\n\n $user_signon = wp_signon( $info, false );\n if ( is_wp_error($user_signon) ){\n echo json_encode(array('loggedin'=>false, 'message'=>__('<p class=\"error\">Wrong username or password.</p>')));\n } else {\n echo json_encode(array('loggedin'=>true, 'message'=>__('Login successful, redirecting...')));\n }\n\n die();\n\t}"
] |
[
"0.64558387",
"0.6173198",
"0.6067804",
"0.5952167",
"0.5928823",
"0.5876278",
"0.5708022",
"0.56828135",
"0.56576234",
"0.5640286",
"0.561874",
"0.561108",
"0.55826503",
"0.5570699",
"0.55634767",
"0.5521187",
"0.552041",
"0.5519421",
"0.55112535",
"0.54625475",
"0.5458393",
"0.5425964",
"0.538577",
"0.5378555",
"0.537031",
"0.5358833",
"0.5349768",
"0.5347334",
"0.53315246",
"0.53155637"
] |
0.779768
|
0
|
Removes the primary designation from the primary domain in the site and environment.
|
public function remove($site_env)
{
$env = $this->getEnv($site_env);
$workflow = $env->getPrimaryDomainModel()->removePrimaryDomain();
$this->processWorkflow($workflow);
$this->log()->notice(
'Primary domain has been removed from {site}.{env}',
[
'site' => $this->getSiteById($site_env)->getName(),
'env' => $env->getName(),
]
);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function deleteProgramDomainId();",
"function revert_site() {\n if ( MAIN_SITE != \"\" ) {\n restore_current_blog();\n }\n}",
"public function delete()\n {\n $this->socrates->deleteSite($this->id);\n }",
"function deactivate_wp_primary_category() {\n\trequire_once plugin_dir_path( __FILE__ ) . 'includes/class-wp-primary-category-deactivator.php';\n\tWP_Primary_Category_Deactivator::deactivate();\n}",
"function afterDelete() {\n\t\tif ($this->isMultisite()) {\n\t\t\tif (isset($this->containModels)) {\n\t\t\t\t$this->contain($this->containModels);\n\t\t\t}\n\t\t\tforeach($this->sites as $site) {\n\t\t\t\t$this->useDbConfig = $site;\n\t\t\t\t$result = $this->find('first', array('fields' => $this->primaryKey,\n\t\t\t\t\t\t\t\t\t 'conditions' => array($this->primaryKey => $this->id)));\n\t\t\t\tif (!empty($result)) {\n\t\t\t\t\t$this->deleteFromFrontEnd($result, $site);\n\t\t\t\t}\n\t\t\t} \n\t\t}\n\t\t$this->useDbConfig = 'default';\n }",
"public function testDeleteDomain()\n {\n // TODO: implement\n $this->markTestIncomplete('Not implemented');\n }",
"function remove_from_parent()\n {\n foreach ($this->plugins as $name => $obj) {\n $this->updateServicesVars($name);\n if ($this->plugins[$name]->initially_was_account) {\n if (isset($this->plugins[$name]->krb_host_key) && $this->plugins[$name]->krb_host_key instanceof krbHostKeys) {\n $this->plugins[$name]->krb_host_key->remove_from_parent_by_prefix($this->plugins[$name]->krb_service_prefix);\n }\n $this->plugins[$name]->remove_from_parent();\n }\n }\n }",
"function remove_from_parent()\n {\n /* Cancel if there's nothing to do here */\n if (!$this->initially_was_account){\n return;\n }\n \n /* include global link_info */\n $ldap= $this->config->get_ldap_link();\n\n /* Remove and write to LDAP */\n plugin::remove_from_parent();\n\n /* Zero arrays */\n $this->attrs['scalixEmailAddress']= array();\n\n /* Unset fake boolean attributes from entry */\n foreach ($this->fakeBooleanAttributes as $val){\n $this->attrs[\"$val\"]= array();\n }\n\n /*unset scalixScalixObject*/\n $this->attrs['scalixScalixObject']=array();\n\n @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,$this->attributes, \"Save\");\n $ldap->cd($this->dn);\n $ldap->modify($this->attrs);\n if (!$ldap->success()){\n msg_dialog::display(_(\"LDAP error\"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_MOD, get_class()));\n }\n\n /* Optionally execute a command after we're done */\n $this->handle_post_events(\"remove\");\n }",
"function removedomain($user,$domain) {\n }",
"protected function RemovalObject()\n {\n $id = Request::PostData('delete');\n return $id ? new Site($id) : null;\n }",
"function wbf_projet_domaines_supprimer_callback($form, &$form_state){\r\n if ($form_state['dom_nums'] > 1) {\r\n $form_state['dom_nums']--;\r\n }\r\n $form_state['rebuild'] = TRUE;\r\n}",
"function modifyUITemplate( &$template, &$type ) {\n $template->set( 'usedomain', false );\n }",
"public function deleteLocal() \n {\n LocalDAC::deleteLocal($this);\n }",
"public function delIdentity()\n\t{\n\t\t// Verifier l'adhesion\n\t\t$q = new Bn_query('u2a', '_asso');\n\t\t$q->setFields('u2a_adherentid');\n\t\t$q->addWhere('u2a_userid='. $this->getVal('id', -1));\n\t\t$adheId = $q->getOne();\n\t\t$q->deleteRow();\n\t\t$q->setTables('adherents');\n\t\t$q->deleteRow('adhe_id=' . $adheId);\n\t}",
"function uninstall()\n\t{\n\t\t$GLOBALS['NO_DB_SCOPE_CHECK']=true;\n\t\t$GLOBALS['SITE_DB']->drop_if_exists('f_welcome_emails');\n\t\t$GLOBALS['NO_DB_SCOPE_CHECK']=false;\n\t}",
"public function decopersonnel()\n {\n $this->session-> unset_userdata('admin','info','id');\n $this ->session->sess_destroy();\n $this->template->display('acceuil');\n }",
"function del_relais($domain){\n\t\tglobal $bdd;\n\n\t\t$req = $bdd->prepare(\"DELETE FROM `relais_mail` WHERE `nom_domain` = :domain\");\n\t\t$req->execute(array('domain'=>$domain));\n\t\t$req->closeCursor();\n\t}",
"function deleteAssociatedDomain( $fqdn ) {\n\t\tglobal $wgAuth;\n\n\t\tif ( isset( $this->hostInfo[0]['associateddomain'] ) ) {\n\t\t\t$associateddomains = $this->hostInfo[0]['associateddomain'];\n\t\t\tarray_shift( $associateddomains );\n\t\t\t$index = array_search( $fqdn, $associateddomains );\n\t\t\tif ( $index === false ) {\n\t\t\t\t$wgAuth->printDebug( \"Failed to find ip address in arecords list\", NONSENSITIVE );\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tunset( $associateddomains[$index] );\n\t\t\t$values = array();\n\t\t\t$values['associateddomain'] = array();\n\t\t\tforeach ( $associateddomains as $associateddomain ) {\n\t\t\t\t$values['associateddomain'][] = $associateddomain;\n\t\t\t}\n\t\t\t$success = LdapAuthenticationPlugin::ldap_modify( $wgAuth->ldapconn, $this->hostDN, $values );\n\t\t\tif ( $success ) {\n\t\t\t\t$wgAuth->printDebug( \"Successfully removed $fqdn from $this->hostDN\", NONSENSITIVE );\n\t\t\t\t$this->domain->updateSOA();\n\t\t\t\t$this->fetchHostInfo();\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\t$wgAuth->printDebug( \"Failed to remove $fqdn from $this->hostDN\", NONSENSITIVE );\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}",
"public function removeDomain($key)\n {\n unset($this->domains[$key]);\n }",
"function remove_branding() {\n\n\t\tremove_action('thematic_header','thematic_brandingopen',1);\n\n\t\tremove_action('thematic_header','thematic_access',9);\n\n}",
"function fn_divido_uninstall()\n{\n db_query(\"DELETE FROM ?:payment_processors WHERE processor_script = ?s\", 'divido.php');\n}",
"public function unassignDepartment() {\n if($this->department)\n $this->department()->delete();\n }",
"public static function removeIdentity() {\n\t\tCore_Store::remove('identity');\n\t}",
"public function testDomainRemoveForceCommandSubsite()\n {\n\n $mainStoragePath = $this->laravelAppPath . DIRECTORY_SEPARATOR . 'storage';\n $sites = [\n 'site1.com',\n 'sub1.site1.com',\n 'sub2.site1.com',\n ];\n foreach ($sites as $currSite) {\n $this->artisan('domain:add', ['domain' => $currSite]);\n $this->assertFileExists(env_path('.env.'.$currSite));\n $this->assertDirectoryExists($mainStoragePath . DIRECTORY_SEPARATOR . domain_sanitized($currSite));\n }\n\n\n $site = 'sub1.site1.com';\n $argDomain = ['domain' => $site, '--force' => 1];\n $this->artisan('domain:remove', $argDomain);\n\n foreach ($sites as $currSite) {\n if ($site == $currSite) {\n $this->assertFileDoesNotExist(env_path('.env.'.$currSite));\n $this->assertDirectoryDoesNotExist($mainStoragePath . DIRECTORY_SEPARATOR . domain_sanitized($currSite));\n } else {\n $this->assertFileExists(env_path('.env.'.$currSite));\n $this->assertDirectoryExists($mainStoragePath . DIRECTORY_SEPARATOR . domain_sanitized($currSite));\n }\n }\n\n foreach ($sites as $currSite) {\n if ($site != $currSite) {\n $this->artisan('domain:remove', ['domain' => $currSite,'--force' => 1]);\n $this->assertFileDoesNotExist(env_path('.env.'.$currSite));\n $this->assertDirectoryDoesNotExist($mainStoragePath . DIRECTORY_SEPARATOR . domain_sanitized($currSite));\n }\n }\n\n }",
"function strip_domain($s) {\n\tglobal $olddomain; // eh.\n\t$s = str_replace($olddomain . '/',$olddomain,$s); // could cause bug if you have http://olddomain.com/olddomain/test.htm \n\t$s = str_replace('http://www.' . $olddomain,'',$s);\n\t$s = str_replace('http://' . $olddomain,'',$s);\n\treturn $s;\n}",
"public function deleteOrganiser() {\n $this->organiser = NULL;\n }",
"public function testDomainRemoveForceCommand()\n {\n $site = Arr::get($_SERVER, 'SERVER_NAME');\n if (!$site) {\n $this->assertTrue(true);\n return;\n }\n $argDomain = $site ? ['domain' => $site, '--force' => 1] : ['--force' => 1];\n\n $this->artisan('domain:remove', $argDomain);\n\n $this->assertFileDoesNotExist(env_path('.env.'.$site));\n\n $domainListed = Config::get('domain.domains');\n\n $this->assertArrayNotHasKey($site,$domainListed);\n\n //$this->assertDirectoryDoesNotExist(storage_path(domain_sanitized($site)));\n $this->assertDirectoryDoesNotExist(app()->exactDomainStoragePath());\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 projet_domaines_supprimer_callback($form, &$form_state){\r\n if ($form_state['dom_nums'] > 1) {\r\n $form_state['dom_nums']--;\r\n }\r\n $form_state['rebuild'] = TRUE;\r\n}",
"function get_clean_basedomain()\n {\n }"
] |
[
"0.5922458",
"0.52191365",
"0.52019805",
"0.517701",
"0.51651275",
"0.510533",
"0.50907826",
"0.5078112",
"0.5062974",
"0.5020007",
"0.49873912",
"0.4977154",
"0.49618155",
"0.495481",
"0.49510813",
"0.49257383",
"0.49056765",
"0.49053115",
"0.48840165",
"0.48735395",
"0.48718324",
"0.4861321",
"0.4855952",
"0.4853205",
"0.48377353",
"0.4836141",
"0.48209473",
"0.48026493",
"0.47978738",
"0.47944206"
] |
0.6447792
|
0
|
app_template Returns the admin page template data.
|
function app_template() {
$template = <<<HTML
HTML;
$navigation = app_template_navigation();
$dialogs = app_template_dialogs();
$data['blocks'] = empty($navigation) ? array($dialogs) : array($dialogs, $navigation);
$data['template'] = $template;
return $data;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function app_template_path() {\n return APP_Wrapping::$main_template;\n}",
"function index_template()\n {\n return 'photocrati-nextgen_admin#nextgen_admin_page';\n }",
"public function get_view_template() {\n\t\treturn '/admin/admin-policy';\n\t}",
"public function get_main_template() {\n\n\t\t\treturn $this->main_template;\n\n\t\t}",
"function admin_template(string $path): string\n {\n return Admin::app()->template($path);\n }",
"public static function getTemplatePage()\n {\n return self::$templatePage;\n }",
"function loadAdminPage($template, $data = null)\n {\n $data['template_name'] = $template;\n $data['data'] = $data;\n // $data = html_escape($this->security->xss_clean($data));\n $this->load->view('admin/master-template-admin', $data);\n }",
"function admin_configuration()\n{\n global $app;\n\n $app->render('admin_configuration.html', [\n 'page' => mkPage(getMessageString('admin'), 0, 2),\n 'mailers' => mkMailers(),\n 'ttss' => mkTitleTimeSortOptions(),\n 'isadmin' => is_admin()]);\n}",
"protected function getTemplate($data = array())\n {\n return $this->components->template()->get(\n 'app:admin/auth',\n $data\n );\n }",
"public function render_admin_page () {\n\t\tif (!Upfront_Permissions::current(Upfront_Permissions::BOOT)) wp_die(\"Nope.\");\n\n\t\tif (!class_exists('Thx_Sanitize')) require_once (dirname(__FILE__) . '/class_thx_sanitize.php');\n\t\tif (!class_exists('Thx_Template')) require_once (dirname(__FILE__) . '/class_thx_template.php');\n\n\t\tload_template(Thx_Template::plugin()->path('create_edit'));\n\t}",
"function updatePageAppInfo( $page, &$appData ) \n {\n \n $id = $page->getID();\n $name = $page->getPageName();\n $constName = $page->getPageConstantName();\n \n // include page definition in appfile\n $tag = ModuleCreator::TAG_PAGE_CONST;\n $data = ' /** const '.$constName.' Display the '.$name.' Page. */\n const '.$constName.' = \"P'.$id.'\";'.\"\\n\\n\".$tag;\n $appData = str_replace($tag, $data, $appData );\n \n \n // include loadData() entry\n $tag = ModuleCreator::TAG_APP_LOAD_PAGE;\n $data = ' /*\n * '.$name.'\n */\n case module[ModuleName]::'.$constName.':\n $this->load'.$name.'();\n break;'.\"\\n\\n\".$tag;\n \n $data = $this->replaceCommonTags( $data );\n $appData = str_replace($tag, $data, $appData );\n \n // if page is the Site Default then\n if ($page->isDefault() ) {\n \n // replace Default Constant Name Entry\n $tag = ModuleCreator::TAG_PAGE_DEFAULT_CONST;\n $data = $constName;\n $appData = str_replace($tag, $data, $appData );\n \n // replace Default Page Name Entry\n $tag = ModuleCreator::TAG_PAGE_DEFAULT_NAME;\n $data = $name;\n $appData = str_replace($tag, $data, $appData );\n \n }\n \n // include load page function\n $initCode = $this->getPageInitCode( $page );\n $tag = ModuleCreator::TAG_APP_LOAD_PAGE_FN;\n $data = $initCode.\"\\n\\n\\n\\n\".$tag;\n $appData = str_replace($tag, $data, $appData );\n \n \n // if page is an AdminBox Style \n if ($page->isAdminBoxStyle() ) {\n \n // get AdminBox Process Code template\n $pathToTemplates = $this->values[ ModuleCreator::KEY_PATH_RAD_ROOT ];\n $pathToTemplates .= 'data/code/';\n $contents = file_get_contents( $pathToTemplates.'formTrans_AdminBox.php' );\n $contents = $this->replaceCommonTags( $contents );\n \n \n // insert post processing info\n // Page Constant Name\n $tag = ModuleCreator::TAG_TRANSITION_SOURCE_CONSTNAME;\n $data = $page->getPageConstantName();\n $contents = str_replace($tag, $data, $contents );\n \n // StateVar manager Init Info\n $formDaObj = $page->getFormDAObj();\n $stateVar = $formDaObj->getFormInitStateVar();\n \n $tag = ModuleCreator::TAG_PAGE_ADMINBOX_MANAGERINIT;\n $data = $stateVar->getName();\n $contents = str_replace($tag, $data, $contents );\n \n // The loadPage call() \n $tag = ModuleCreator::TAG_PAGEINIT_NAME;\n $data = $page->getPageName();\n $contents = str_replace($tag, $data, $contents );\n \n \n // save data into App file \n $tag = ModuleCreator::TAG_TRANSITION_CODE;\n $data = $contents.\"\\n\\n\".$tag;\n $appData = str_replace($tag, $data, $appData);\n \n } // end if\n \n \n }",
"public function template()\n {\n if ($this->template === null) {\n return 'charcoal/app/handler/layout';\n }\n\n return $this->template;\n }",
"function call_admin_template($data = null){\n\t \t\n\t \t$this->load->view('template/admin_template_v', $data);\n\t }",
"public function getAdminEmailTemplate ()\n {\n $emailTemplate = $this->scopeConfig->getValue(\n 'b2bregistration/admin_notification/admin_email_templates',\n ScopeInterface::SCOPE_STORE\n );\n return $emailTemplate;\n }",
"public function getMainTpl(){\n return $this->templates['main'];\n }",
"public function adminAction(Application $app)\n {\n $articles = $app['dao.article']->findAll();\n $comments = $app['dao.comment']->findAll();\n $comsReports = $app['dao.comment']->findComReport();\n\n $subscribers = $app['dao.newsletter']->count();\n $allSubscribers = $app['dao.newsletter']->findAll();\n\n return $app['twig']->render('/admin/admin.html.twig', array(\n 'articles' => $articles,\n 'comments' => $comments,\n 'comsReports' => $comsReports,\n 'subscribers' => $subscribers,\n 'allSubscribers' => $allSubscribers\n ));\n }",
"public function getApppage()\n {\n return View::make('apppage');\n }",
"function admin_email_template() {\n\t\t$this->layout=\"admin\";\n\t\tConfigure::write('debug', 0);\n\t\t$staticdatas = $this->EmailTemplate->find('all');\n\t\t//print_r($staticdatas);die;\n\t\t$this->set('manageClass','selected');\n\t\t$this->set(\"staticdatas\",$staticdatas);\n\t}",
"function show_template() {\n\tglobal $template;\n\tprint_r($template);\n}",
"public function getTemplateAttribute(): string\n {\n return $this->meta->_wp_page_template ?: '';\n ;\n }",
"public function getTemplate(){\n\t\treturn $this->CustomTemplate ? $this->CustomTemplate : $this->config()->get('default_template');\n\t}",
"public function exec(Application $app)\n {\n return $app['twig']->render($app['utils']->getTemplateFile(\n '@phpManufaktur/Basic/Template',\n 'framework/account.twig'),\n array());\n }",
"protected function _setPageViewTemplate()\n {\n\n $fishpigWordpressModuleVersion = Mage::getConfig()->getNode('modules/Fishpig_Wordpress/version');\n\n if ($fishpigWordpressModuleVersion > 4) {\n parent::_setPageViewTemplate();\n } else {\n $page = $this->_initPage();\n\n $template = $page->getMetaValue('_wp_page_template');\n\n // This is the folder in Magento template\n $path = 'page/';\n\n //preg_match('/([^\\/]*)\\.php$/', $template, $match);\n //$filename = $path . $match[1] . '.phtml';\n // The extension is replaced with .phtml,\n // meaning that the directory structure is preserved.\n // (page-templates/templ.php will become $path . page-templates/templ.phtml)\n $filename = $path . str_replace('.php', '.phtml', $template);\n\n // This is to use Magento fallback system\n $params = array('_relative' => false);\n $area = $this->getLayout()->getBlock('root')->getArea();\n\n if ($area) {\n $params['_area'] = $area;\n }\n\n $templateName = Mage::getDesign()->getTemplateFilename($filename, $params);\n\n // If no other matches are found, Magento will eventually give a path in base/default, even if that template doesn't exist\n if (file_exists($templateName)) {\n $this->getLayout()->getBlock('root')->setTemplate($filename);\n }\n\n return $this;\n }\n }",
"public static function data_for_templates_manage_page($pagecontext) {\n global $PAGE;\n\n $params = self::validate_parameters(self::data_for_templates_manage_page_parameters(), array(\n 'pagecontext' => $pagecontext\n ));\n $context = self::get_context_from_params($params['pagecontext']);\n self::validate_context($context);\n\n $renderable = new output\\manage_templates_page($context);\n $renderer = $PAGE->get_renderer('tool_lp');\n\n $data = $renderable->export_for_template($renderer);\n\n return $data;\n }",
"public function render_admin_page() {\n $option_name = $this->name; \n include_once( dirname( __FILE__ ) . '/views/admin-page.php' );\n }",
"protected function get_template() {\n\t\treturn 'post';\n\t}",
"function defaultTemplate(){\n $this->addLocations(); // add addon files to pathfinder\n return array($this->template_file);\n }",
"function lqd_app_view_message_page_template( $template ) {\n\tglobal $wp_query;\n\tif( isset( $wp_query->query_vars['messages-app-view'] ) ) {\n\t\t$template = locate_template( array( 'template-messages-app-view.php' ) );\n\t}\n\treturn $template;\n}",
"protected function getTemplate() {\n\t\treturn new Template('Premanager', 'userForm');\n\t}",
"public function getPageData()\n {\n $pageData = parent::getPageData();\n $pageData['menu'] = 'sample';\n $pageData['title'] = 'bs4-components-twig';\n $pageData['icon'] = 'fa-magic';\n\n return $pageData;\n }"
] |
[
"0.6357304",
"0.61731267",
"0.5983396",
"0.5973712",
"0.5932058",
"0.59092027",
"0.58953977",
"0.5828253",
"0.5817194",
"0.5765328",
"0.5737841",
"0.572452",
"0.57112074",
"0.5711198",
"0.5677785",
"0.56397176",
"0.5622452",
"0.55985475",
"0.5579495",
"0.5570189",
"0.55534375",
"0.5523745",
"0.5509199",
"0.5508264",
"0.5478969",
"0.5470272",
"0.5470182",
"0.5456537",
"0.54480726",
"0.54452854"
] |
0.658392
|
0
|
app_template_dialogs Returns the custom dialog box HTML used in admin pages.
|
function app_template_dialogs() {
global $App;
$continue = __('continue');
$cancel = __('cancel');
$ok = __('ok');
$dialog_html = <<<HTML
<div id="modal-warning" class="abstract-modal-popup" data-overlay-theme="b">
<div data-role="header">
<h1 id="modal-warning-label"></h1>
</div>
<div id="modal-warning-body" class="ui-content" data-role="main"></div>
<div data-role="footer">
<a href="#" class="modal-warning-close" data-role="button" data-transition="flow">{$continue}</a>
</div>
</div>
<div id="modal-dialog" class="abstract-modal-popup" data-overlay-theme="b">
<div data-role="header">
<h1 id="modal-dialog-label"></h1>
</div>
<div id="modal-dialog-body" class="ui-content" data-role="main"></div>
<div data-role="footer">
<a href="#" class="modal-dialog-close" data-role="button" data-inline="true" data-transition="flow">{$continue}</a>
</div>
</div>
<div id="modal-confirm" class="abstract-modal-popup" data-overlay-theme="b">
<div data-role="header">
<h1 id="modal-confirm-label"></h1>
</div>
<div id="modal-confirm-body" class="ui-content" data-role="main"></div>
<div data-role="footer">
<a href="#" class="modal-confirm-cancel" data-role="button" data-inline="true" data-transition="flow">{$cancel}</a>
<a href="#" class="modal-confirm-ok" data-role="button" data-inline="true" data-transition="flow" data-theme="b">{$ok}</a>
</div>
</div>
HTML;
return array(
'selector' => $App->config('page_content_id'),
'pos_func' => 'insertAfter',
'html' => $dialog_html
);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function app_template() {\n\t$template = <<<HTML\n\n\n\nHTML;\n\n $navigation = app_template_navigation();\n $dialogs = app_template_dialogs();\n\t$data['blocks'] = empty($navigation) ? array($dialogs) : array($dialogs, $navigation);\n\t$data['template'] = $template;\n\treturn $data;\n}",
"public function modalContent() {\n\n $fields = array( __( 'Template Rule Settings', WPXDEFLECTOREXTENSIONTEMPLATE_TEXTDOMAIN ) => array() );\n $sKey = key( $fields );\n\n //------------------------------------------------------------------\n // GENERIC PARAM\n //------------------------------------------------------------------\n\n $helpContent = $this->helpContent( __( 'Choose the value of this generic param.', WPXDEFLECTOREXTENSIONTEMPLATE_TEXTDOMAIN ),\n __( 'Choose the value of this generic param. It is set only for process flowing, and it is not used anywhere in your WordPress environment.', WPXDEFLECTOREXTENSIONTEMPLATE_TEXTDOMAIN ) );\n\n $fields[$sKey][] = array(\n array(\n 'type' => WPDKUIControlType::CUSTOM,\n 'content' => $helpContent\n )\n );\n\n $fields[$sKey][] = array(\n array(\n 'type' => WPDKUIControlType::TEXT,\n 'name' => $this->_model->id() . '-generic-param',\n 'value' => $this->_model->genericParam(),\n 'label' => array(\n 'value' => __( 'Generic Param', WPXDEFLECTOREXTENSIONTEMPLATE_TEXTDOMAIN ),\n 'data' => array( 'placement' => 'right' )\n ),\n 'size' => 24,\n 'title' => __( 'Enter the value of this generic param. It is set only for process flowing, and it is not used anywhere in your WordPress environment.', WPXDEFLECTOREXTENSIONTEMPLATE_TEXTDOMAIN )\n )\n );\n\n $layout = new WPDKUIControlsLayout( $fields );\n\n // Build output buffer\n $outputBuffer = '<form name=\"' . $this->_model->id() . '-form\" method=\"POST\" action=\"\">' .\n $layout->html() .\n '</form>';\n\n return $outputBuffer;\n\n }",
"public function getMessageDialogContent(Application $app)\n {\n return $app['smarty']->fetch('sendMessageContainer.tpl');\n }",
"function options_page_html()\n\t\t{\n\t\t\tif (!current_user_can('manage_options')) {\n\t\t\t\twp_die(__('You do not have sufficient permissions to access this page.'));\n\t\t\t}\n\t\t\t\n\t\t\techo '<div class=\"wrap\">';\n\t\t\techo '<h2>';\n\t\t\techo 'Verify Meta Tags Plugin Options';\n\t\t\techo '</h2>';\n\t\t\techo '<form method=\"post\" action=\"options.php\">';\n\t\t\tsettings_fields('vmt-options-page');\n\t\t\tdo_settings_sections('vmt-options-page');\n\t\t\techo '<p class=submit>';\n\t\t\techo '<input type=\"submit\" class=\"button-primary\" value=\"' . __('Save Changes') . '\" />';\n\t\t\techo '</p>';\n\t\t\techo '</form>';\n\t\t\techo '</div>';\n\t\t}",
"function dw_quick_view() {\r\n\twc_get_template( 'dwqv-modal.php', array(), '', DWQV_DIR . 'templates/' );\r\n}",
"public function backupnow_modal_contents() {\n\t\treturn $this->include_template('wp-admin/settings/backupnow-modal.php', true);\n\t}",
"public function confirmPageTemplate( $data ) {\n\t\t\t?>\n <div id=\"WBCR\" class=\"wrap\">\n <div class=\"wbcr-factory-pages-000-impressive-page-template factory-bootstrap-000 factory-fontawesome-000\">\n <div id=\"wbcr-factory-confirm-dialog\">\n <h2><?php echo $data['title'] ?></h2>\n <p class=\"wbcr-factory-confirm-description\"><?php echo $data['description'] ?></p>\n\t\t\t\t\t\t<?php if ( isset( $data['hint'] ) ): ?>\n <p class=\"wbcr-factory-confirm-hint\"><?php echo $data['hint'] ?></p>\n\t\t\t\t\t\t<?php endif; ?>\n <div class='wbcr-factory-confirm-actions'>\n\t\t\t\t\t\t\t<?php foreach ( $data['actions'] as $action ) { ?>\n <a href='<?php echo $action['url'] ?>' class='<?php echo $action['class'] ?>'>\n\t\t\t\t\t\t\t\t\t<?php echo $action['title'] ?>\n </a>\n\t\t\t\t\t\t\t<?php } ?>\n </div>\n </div>\n </div>\n </div>\n\t\t\t<?php\n\t\t}",
"public function render_page() {\n $form_id=str_replace(' ','',$this->form_name).'Form';\n $form_field_ids=array();\n $html='';\n $associated_upload_field=NULL;\n foreach ($this->page_fields as $single_group) {\n foreach($single_group['fields'] as $single_field) {\n if($single_field['field_type']==\"upload\") {\n $associated_upload_field=$single_field;\n \n }\n }\n }\n \n //sort out the dialog first\n if($this->id_field != '') {\n \n $sql_result=$this->db->query($this->selector_query);\n $table_data=\"\";\n \n foreach($sql_result as $row) {\n $table_data.=\"<tr id='\".$row[$this->id_field].\"'>\";\n foreach($this->selector_field_list as $selector_field) {\n $table_data.=\"<td>\".$row[$selector_field].\"</td>\";\n }\n $table_data.=\"</tr>\";\n }\n \n $html.='<div id=\"'.str_replace(' ','_',$this->form_name).'_dialog\" title=\"Dialog Title\">';\n //put the html together for the selector and send it off with the JS\n $html.='<table id=\"'.str_replace(' ','_',$this->form_name).'_'.$this->id_field.'_selector\" class=\"display\" cellspacing=\"0\"\" width=\"100%\"><thead><tr>';\n foreach($this->selector_field_list as $field) {\n $html.='<th>'.$field.'</th>';\n }\n $html.='</tr></thead></tbody>'.$table_data.\"</tbody></table>\";\n $html.='</div>';\n }\n \n \n \n \n \n //add the start of the form using a table for layout\n $upload_warning_field_id=implode('_',array('content',$this->feature,str_replace(' ','_',$this->form_name),str_replace(' ','_',$associated_upload_field['field_name'])));\n $html.='\n <form id=\"'.$form_id.'\" method=\"POST\" >';\n if (!is_null($associated_upload_field)) {\n $html.='<div id=\"'.$upload_warning_field_id.'_dialog\"></div>';\n }\n $html.='\n <table class=\"page_container\">\n <tr><td colspan=\"2\"><h1>'.$this->form_name.'</h1></td></tr>';\n \n //iterate over the fields, and groups of fields, and render the form\n foreach ($this->page_fields as $single_group) {\n $sub_heading=ucwords($single_group['sub_heading']);\n \n //add the sub heading for this group of fields\n $html.='<tr><th colspan=\"2\" class=\"sub_heading\"><h2>'.$sub_heading.'</h2></th></tr>';\n \n //add the fields, including the sub headings, for this grouping\n foreach($single_group['fields'] as $single_field) {\n \n //set the id that will be used to extract data from this field in JS and define it on the page\n $input_id=implode('_',array('content',$this->feature,str_replace(' ','_',$this->form_name),str_replace(' ','_',$single_field['field_name'])));\n $form_field_ids[str_replace(' ','_',$single_field['field_name'])]=$input_id;\n //add each field into the HTML\n switch ($single_field['field_type']) {\n //for a text field, that is to be on a single row\n case 'text':\n $html.='<tr><th class=\"left_col\">'.ucwords($single_field['field_name']).'</th><td><input id=\"'.$input_id.'\" type=\"text\" style=\"width:'.$single_field['length'].'px;\" /></td></tr>\n <tr><th></th><td><span id=\"'.$input_id.'_error\"></span></td></tr>';\n break;\n \n //for a text field, that is to be on a single row\n case 'currency':\n $html.='<tr><th class=\"left_col\">'.ucwords($single_field['field_name']).' $</th><td><input id=\"'.$input_id.'\" type=\"text\" style=\"width:'.$single_field['length'].'px;\" /></td></tr>\n <tr><th></th><td><span id=\"'.$input_id.'_error\"></span></td></tr>';\n break;\n \n //for a text area which is supposed to be multiple rows and columns\n case 'textarea':\n $html.='<tr><th class=\"left_col\">'.ucwords($single_field['field_name']).'</th><td><textarea id=\"'.$input_id.'\" cols=\"'.$single_field['columns'].'\" rows=\"'.$single_field['rows'].'\"></textarea></td></tr>\n <tr><th></th><td><span id=\"'.$input_id.'_error\"></span></td></tr>';\n break;\n \n //for a label area which gets its content from another field\n case 'annotation':\n //TODO: test annotation types on something other than an upload field\n //'field_name'=>$field_name,\n //'field_type'=>'annotation',\n //'length'=>$field_length,\n //'lookup_no_match'=>$no_match_value,\n //'lookup_query'=>$lookup_query,\n //'anchor'=>$anchor\n $anchors=explode('|',$single_field['anchor']);\n $html.='<tr><th class=\"left_col\">'.ucwords($single_field['field_name']).'</th><td><input id=\"'.$input_id.'\" disabled type=\"text\" style=\"width:'.$single_field['length'].'px;\" /></td></tr>\n <tr><th></th><td><span id=\"'.$input_id.'_error\"></span></td></tr>';\n $lookup_data=$this->db->query($single_field['lookup_query']);\n \n if ($anchors[2]==\"mime_type\") {\n $anchor_id=implode('_',array('content',$this->feature,str_replace(' ','_',$this->form_name),str_replace(' ','_',$anchors[1]),'fileToUpload'));\n $annotation_js='\n var mime_type=$(\"#'.$anchor_id.'\")[0].files[0].type;\n var document_lookup={';\n foreach($lookup_data as $single_entry) {\n $annotation_js.='\"'.$single_entry['data_key'].'\":\"'.$single_entry['data_value'].'\",';\n }\n $annotation_js.='};\n var converted_type=document_lookup[mime_type];\n if (converted_type==null) {\n converted_type=\"'.$single_field['lookup_no_match'].'\";\n }\n $(\"#'.$input_id.'\").val(converted_type);';\n \n $this->annotations[]=$annotation_js;\n }\n \n \n break;\n \n //for an upload field which gets its content with a file input\n case 'upload':\n $html.='<tr><td>\n <input style=\"display:none\" type=\"file\" id=\"'.$input_id.'_fileToUpload\" />\n <label class=\"file_upload_label\" for=\"'.$input_id.'_fileToUpload\">'.$single_field['upload_button_text'].'</label>\n </td><td>\n <input id=\"'.$input_id.'_filename\" disabled type=\"text\" placeholder=\"'.$single_field['placeholder'].'\" style=\"width: '.$single_field['length'].'px;\" />\n </td></tr>';\n //need a maximum upload size hidden field somewhere\n $html.='<input type=\"hidden\" id=\"'.$input_id.'_max_filesize\" value=\"'.$single_field['max_size'].'\" />';\n \n //also need an error message container here\n $html.='<tr><td colspan=\"2\">\n <div id=\"'.$input_id.'_error_message_container\" class=\"ui-widget\">\n <div class=\"ui-state-error ui-corner-all\" style=\"padding: 0 .7em;\"> \n <p><span class=\"ui-icon ui-icon-alert\" style=\"float: left; margin-right: .3em;\"></span><strong>Alert:</strong><span id=\"'.$input_id.'_error_message\"></span></p>\n </div></div></td></tr>';\n \n break;\n \n //for a combo or drop down box which should have a lookup defined\n case 'combo':\n //'combodata'=>'salutation|salutation_id|description'\n $html.='<tr><th class=\"left_col\">'.ucwords($single_field['field_name']).'</th><td><select id=\"'.$input_id.'\">';\n $combo_fields=explode('|',$single_field['combodata']);\n $queryResult=$this->db->query(\"select * from \".$combo_fields[0]);\n foreach ($queryResult as $row) {\n $html.='<option value=\"'.$row[$combo_fields[1]].'\">'.ucwords($row[$combo_fields[2]]).'</option>';\n }\n $html.='</select></td></tr><tr><th></th><td><span id=\"'.$input_id.'_error\"></span></td></tr>';\n break;\n }\n }\n }\n \n //add the buttons\n $counter=1;\n foreach($this->buttons as $button) {\n \n //at the start, if the column count is odd, start a new line for the buttons\n if($counter%2!=0) {\n $html.='<tr>';\n }\n \n //right column check and set TD class\n $this_class='left_col button_row';\n if ($counter%2==0) {\n $this_class='right_col button_row';\n }\n \n //place the button\n $this_button_id=implode('',array(str_replace(' ','',$this->form_name), $button, 'Button')); //clientDeleteCancelButton\n if (in_array($button,$this->available_buttons)) {\n $html.='<td class=\"'.$this_class.'\"><button type=\"button\" id=\"'.$this_button_id.'\">'.ucwords($button).'</button></td>';\n }\n else {\n error_log(\"BasicForm: Unable to interpret button request from basic_form->render_page call, button requested was: \".$button);\n }\n \n //after the counter increases, if the counter is odd, we need to close this line of buttons\n $counter+=1;\n if($counter%2!=0) {\n $html.='</tr>';\n }\n }\n \n //finish off the button rows if there were an odd number of buttons, and the row ender above (inside the loop) didnt fire\n if($counter%2==0) {\n $html.='</tr>';\n }\n \n //close the table, set an identifier field if required, ie, a hidden id field for updates or removes from the DB and close the form.\n $html.='</table>';\n if($this->id_field != '') {\n $this_id=implode('_',array('content',$this->feature,str_replace(' ','_',$this->form_name),$this->id_field));\n $html.='<input id=\"'.$this_id.'\" type=\"hidden\" value=\"'.$this->id_field_value.'\" />';\n }\n $html.='</form>';\n \n //make the javascript part of the response\n $js='<script>\n $(document).ready(function () {\n ';\n \n //if a hidden id field has been added and a value set, then we need to render a selector window to populate the table correctly\n if($this->id_field != '') {\n $js.='\n \n //define the data table\n var table=$(\"#'.str_replace(' ','_',$this->form_name).'_'.$this->id_field.'_selector\").DataTable({paging: true, searching: true, destroy: true});\n \n //setup the dialog box for this use case\n $( \"#'.str_replace(' ','_',$this->form_name).'_dialog\" ).dialog({autoOpen: false,width: 700,modal: true,\n buttons: [\n {\n text: \"Select\",\n click: function() {\n var rowSelected=$(\".selected\").attr(\"id\");\n if (!rowSelected) {\n alert(\"You need to select a row by clicking on it first.\");\n }\n else {\n load_data_into_form(rowSelected);\n }\n }\n },\n {\n text: \"Cancel\",\n click: function() {\n $( this ).dialog( \"destroy\" ).remove();\n close_current_tab();\n }\n }\n ]\n });\n \n //toggle selected row\n $(\"#'.str_replace(' ','_',$this->form_name).'_'.$this->id_field.'_selector tbody\").on( \"click\", \"tr\", function () {\n if ( $(this).hasClass(\"selected\") ) {\n $(this).removeClass(\"selected\");\n }\n else {\n table.$(\"tr.selected\").removeClass(\"selected\");\n $(this).addClass(\"selected\");\n }\n });\n \n //load the record into the form\n function load_data_into_form(selected_id) {\n $.ajax({\n type: \"POST\",\n url: \"page_responder.php\",\n data:{\n page:\"'.$this->feature.'_Load_'.str_replace(' ','_',$this->form_name).'_Data\",\n '.$this->id_field.':selected_id,\n }\n })\n .done(function(e) {\n var data=JSON.parse(e);';\n \n \n \n \n \n $first_done=false;\n foreach($this->full_field_list as $field) {\n if($field==$this->id_field) {\n $js.='\n $(\"#content_'.$this->feature.'_'.str_replace(' ','_',$this->form_name).'_'.$field.'\").val(data[\"'.$field.'\"]);\n $(\"#content_'.$this->feature.'_'.str_replace(' ','_',$this->form_name).'_'.$field.'\").trigger(\"change\");';\n }\n else {\n $js.='$(\"#content_'.$this->feature.'_'.str_replace(' ','_',$this->form_name).'_'.$field.'\").val(data[\"'.$field.'\"]);';\n }\n $first_done=true;\n }\n $js.='$(\"#'.str_replace(' ','_',$this->form_name).'_dialog\").dialog( \"destroy\" ).remove();\n });\n }';\n \n $js.='\n $(\"#'.str_replace(' ','_',$this->form_name).'_dialog\").dialog(\"option\",\"title\",\"'.$this->selector_title.'\");\n $(\"#'.str_replace(' ','_',$this->form_name).'_dialog\").dialog(\"open\");\n ';\n }\n \n \n \n //add the validation function, if required\n $validate_page_name=implode('_',array($this->feature,'Validate',str_replace(' ','_',ucwords($this->form_name))));\n if (count($this->validators)>0) {\n $js.='\n function '.$validate_page_name.'_validate() {\n //hide all validation fields, in case they were populated last time\n ';\n foreach($form_field_ids as $field_name=>$field_id) {\n if (in_array($field_name,$this->validators)) {\n $js.='$(\"#'.$field_id.'_error\").hide();';\n }\n }\n $js.='\n var id_lookups={';\n foreach($form_field_ids as $field_name=>$field_id) {\n if (in_array($field_name,$this->validators)) {\n $js.='\"'.$field_name.'\":\"'.$field_id.'\",';\n }\n }\n $js.='};\n \n $.ajax({\n type: \"POST\",\n url: \"page_responder.php\",\n data: \n {\n page:\"'.$validate_page_name.'\",';\n foreach($form_field_ids as $field_name=>$field_id) {\n if (in_array($field_name,$this->validators)) {\n $js.=$field_name.':$(\"#'.$field_id.'\").val(),';\n }\n }\n $js.=' }\n })\n .done(function(e){\n //if e is true, then there is nothing to do, otherwise, \n var errors=JSON.parse(e);\n //if theres no errors, return true\n if (Object.keys(errors).length==0) {\n blind_submit();\n }\n //populate the error messages, and return false\n for (var error in errors) {\n if (errors.hasOwnProperty(error)) {\n var this_id=id_lookups[error];\n $(\"#\"+this_id+\"_error\").html(\"<p style=\\'color:red;\\'>\"+errors[error]+\"</p>\");\n $(\"#\"+this_id+\"_error\").show();\n }\n }\n });\n }\n ';\n }\n \n //add any button responders needed\n foreach ($this->buttons as $button) {\n if (in_array($button,$this->available_buttons)) {\n $button_id=implode('',array(str_replace(' ','',$this->form_name), $button, 'Button'));;\n \n //javascript response to the CANCEL button\n if ($button=='cancel') {\n $js.='\n $(\"#'.$button_id.'\").click(function() {\n close_current_tab();\n });';\n }\n //javascript response to the SAVE button\n if ($button=='save') {\n $page_string=implode('_',array($this->feature,'Submit',str_replace(' ','_',ucwords($this->form_name))));\n $js.='//handle the save button\n $(\"#'.$button_id.'\").click(function() {\n ';\n //if there is validation on this form, use the validation function generated above, otherwise use the blind submit\n if (count($this->validators)>0) {\n $js.=$validate_page_name.'_validate();\n });';\n }\n else {\n $js.='blind_submit();\n });';\n }\n \n //define the blind submit function\n $js.='\n function blind_submit() {\n $.ajax({\n type: \"POST\",\n url: \"page_responder.php\",\n data: \n {\n page:\"'.$page_string.'\",';\n foreach($form_field_ids as $field_name=>$field_id) {\n $js.=$field_name.':$(\"#'.$field_id.'\").val(),';\n }\n $js.=' }\n })\n .done(function(e){\n var tabs=$(\"div#tabs ul\").children();\n for (var i=0; i<tabs.length; i++) {\n if ($(\"div#tabs ul\").children()[i].getAttribute(\"aria-controls\")==\"about\") {\n $(\"div#about\").append(e);\n }\n }\n close_current_tab();\n });\n }';\n \n }\n \n //javascript repsponse to the DELETE button\n if ($button=='delete') {\n $page_string=implode('_',array($this->feature,'Delete',str_replace(' ','_',ucwords($this->form_name))));\n $js.='//handle the delete button\n $(\"#'.$button_id.'\").click(function() {\n ';\n //if there is validation on this form, use the validation function generated above, otherwise use the blind submit\n if (count($this->validators)>0) {\n $js.=$validate_page_name.'_validate();\n });';\n }\n else {\n $js.='blind_submit();\n });';\n } \n //define the blind submit function\n $js.='\n function blind_submit() {\n $.ajax({\n type: \"POST\",\n url: \"page_responder.php\",\n data: \n {\n page:\"'.$page_string.'\",';\n $js.=$this->id_field.':$(\"#'.implode('_',array('content',$this->feature,str_replace(' ','_',$this->form_name),$this->id_field)).'\").val(),';\n $js.=' }\n })\n .done(function(e){\n var tabs=$(\"div#tabs ul\").children();\n for (var i=0; i<tabs.length; i++) {\n if ($(\"div#tabs ul\").children()[i].getAttribute(\"aria-controls\")==\"about\") {\n $(\"div#about\").append(e);\n }\n }\n close_current_tab();\n });\n }';\n }\n \n //javascript response to an UPLOAD button, meant to be used in conjunction with a form containing a file upload field\n if($button=='upload') {\n $associated_upload_field=NULL;\n foreach ($this->page_fields as $single_group) {\n foreach($single_group['fields'] as $single_field) {\n if($single_field['field_type']==\"upload\") {\n $associated_upload_field=$single_field;\n \n }\n }\n }\n $field_id=implode('_',array('content',$this->feature,str_replace(' ','_',$this->form_name)));//,str_replace(' ','_',$associated_upload_field['field_name'])\n $upload_field_id=implode('_',array('content',$this->feature,str_replace(' ','_',$this->form_name),str_replace(' ','_',$associated_upload_field['field_name'])));\n $this_button_id=implode('',array(str_replace(' ','',$this->form_name), $button, 'Button'));\n $js.='\n //hide the error container at page load\n $(\"#'.$upload_field_id.'_error_message_container\").hide();\n \n //handle any hooks in the filename update changes\n $(\"#'.$upload_field_id.'_fileToUpload\").change(function(){\n if ($(\"#'.$upload_field_id.'_fileToUpload\")[0].files.length>0) {\n $(\"#'.$upload_field_id.'_filename\").val($(\"#'.$upload_field_id.'_fileToUpload\")[0].files[0].name);';\n \n //check for annotations\n foreach($this->annotations as $single_hook) {\n $js.=$single_hook;\n }\n \n $js.='}\n $(\"#'.$upload_field_id.'_error_message_container\").hide();\n });\n \n //handle the upload button\n $(\"#'.$button_id.'\").click(function(e) {\n e.preventDefault();\n if ($(\"#'.$upload_field_id.'_fileToUpload\")[0].files.length>0) {\n var file_size=$(\"#'.$upload_field_id.'_fileToUpload\")[0].files[0].size;\n var allowed_filesize=parseInt($(\"#'.$upload_field_id.'_max_filesize\").val());\n if(file_size<=allowed_filesize) {\n var mydata=new FormData();\n mydata.append(\"page\",\"'.implode('_',array($this->feature,'Submit',str_replace(' ','_',ucwords($this->form_name)))).'\");\n ';\n \n //add field submission data\n foreach ($this->page_fields as $single_group) {\n foreach($single_group['fields'] as $single_field) {\n if ($single_field['field_type']=='text' or $single_field['field_type']=='currency' or $single_field['field_type']=='textarea' or $single_field['field_type']=='annotation' or $single_field['field_type']=='combo') {\n $js.='mydata.append(\"'.str_replace(' ','_',$single_field['field_name']).'\",$(\"#'.$field_id.'_'.str_replace(' ','_',$single_field['field_name']).'\").val());';\n }\n if ($single_field['field_type']=='upload') {\n $js.='mydata.append(\"datafile\",$(\"#'.$upload_field_id.'_fileToUpload\")[0].files[0]);';\n }\n \n }\n }\n \n $js.='\n $( \"#'.$upload_field_id.'_dialog\" ).dialog({\n autoOpen: true,\n closeOnEscape: false,\n title: \"File uploading in progress...\",\n width: 400,\n height: 0,\n modal: true,\n });\n $.ajax({\n type: \"POST\",\n url: \"page_responder.php\",\n enctype: \"multipart/form-data\",\n data: mydata,\n cache: false,\n processData: false,\n contentType: false,\n })\n .done(function(e){\n //the response may start with an error string, or success string, we need to handle wither case appropriately\n $( \"#'.$upload_field_id.'_dialog\" ).dialog( \"destroy\" ).remove();\n if (e.length>=5 && e.substr(0,5)==\"error\") {\n $(\"#'.$upload_field_id.'_error_message\").html(e.substr(5));\n $(\"#'.$upload_field_id.'_error_message_container\").show();\n }\n else if (e.length>=7 && e.substr(0,7)==\"success\") {\n var tabs=$(\"div#tabs ul\").children();\n for (var i=0; i<tabs.length; i++) {\n if ($(\"div#tabs ul\").children()[i].getAttribute(\"aria-controls\")==\"about\") {\n $(\"div#about\").append(e.substr(7));\n }\n }\n close_current_tab();\n }\n });\n }\n else {\n var reported_file_size=file_size;\n if (file_size>1000 && file_size<=1000000) {\n reported_file_size=Math.round(file_size/1000);\n reported_file_size+=\"KB\";\n }\n else if(file_size>1000000 && file_size<=1000000000) {\n reported_file_size=(file_size/1000000).toFixed(1);\n reported_file_size+=\"MB\";\n }\n else if(file_size>1000000000 && file_size<=1000000000000) {\n reported_file_size=(file_size/1000000000).toFixed(1);\n reported_file_size+=\"GB\";\n }\n $(\"#'.$field_id.'_error_message\").html(\"Filesize of \"+reported_file_size+\" is too big\");\n $(\"#'.$field_id.'_error_message_container\").show();\n }\n }\n else {\n alert(\"Choose a file to upload first\");\n }\n });';\n }\n \n //javascript response to the UPDATE button\n if ($button=='update') {\n $page_string=implode('_',array($this->feature,'Update',str_replace(' ','_',ucwords($this->form_name))));\n $js.='//handle the update button\n $(\"#'.$button_id.'\").click(function() {\n ';\n //if there is validation on this form, use the validation function generated above, otherwise use the blind submit\n if (count($this->validators)>0) {\n $js.=$validate_page_name.'_validate();\n });';\n }\n else {\n $js.='blind_submit();\n });';\n } \n //define the blind submit function\n $js.='\n function blind_submit() {\n $.ajax({\n type: \"POST\",\n url: \"page_responder.php\",\n data: \n {\n page:\"'.$page_string.'\",';\n foreach($form_field_ids as $field_name=>$field_id) {\n $js.=$field_name.':$(\"#'.$field_id.'\").val(),';\n }\n $js.=$this->id_field.':$(\"#'.implode('_',array('content',$this->feature,str_replace(' ','_',$this->form_name),$this->id_field)).'\").val(),';\n $js.=' }\n })\n .done(function(e){\n var tabs=$(\"div#tabs ul\").children();\n for (var i=0; i<tabs.length; i++) {\n if ($(\"div#tabs ul\").children()[i].getAttribute(\"aria-controls\")==\"about\") {\n $(\"div#about\").append(e);\n }\n }\n close_current_tab();\n });\n };';\n }\n }\n else {\n error_log(\"BasicForm: Unable to interpret button request from basic_form->render_page call, button requested was: \".$button);\n }\n }\n \n //close off and finalise the JS\n $js.='});</script>';\n return $js.$html;\n }",
"protected function getDialogHelper() {}",
"function showForm() {\n \tglobal $pluginpath;\n \t\n \tif ($this->idt == \"\") {\n \t //user is creating new template\n \t\t$title = MF_NEW_TEMPLATE;\n \t\t$this->action = 'createtempl';\n\t\t$btnText = MF_CREATE_TEMPLATE_BUTTON; \n \t} else {\n \t //user is editing old template\n \t\t$title = \tMF_CHANGE_TEMPLATE;\n \t\t$this->action = 'changetempl';\n\t\t$btnText = MF_CHANGE_FORUM_BUTTON;\n \t}\n \t\n\t$this->doHtmlSpecChars();\n\t\t\n\tinclude \"admin/tempForm.php\";\n \t\n }",
"public function generate_html_forms()\n\t{\n\t\t$return_str = '<div class=\"bwp-wrap bwp-option-page-wrapper\" style=\"padding-bottom: 20px;\">' . \"\\n\";\n\t\tif (sizeof($this->form_tabs) >= 2)\n\t\t\t$return_str .= apply_filters('bwp_admin_form_icon', '<div class=\"icon32\" id=\"icon-options-general\"><br></div>' . \"\\n\");\n\t\telse\n\t\t\t$return_str .= '<div class=\"icon32\" id=\"icon-options-general\"><br></div>';\t\t\t\n\t\t\n\t\tif (sizeof($this->form_tabs) >= 2)\n\t\t{\n\t\t\t$count = 0;\n\t\t\t$return_str .= '<h2 class=\"bwp-option-page-tabs\">' . \"\\n\";\n\t\t\t$return_str .= apply_filters('bwp_admin_plugin_version', '') . \"\\n\";\n\t\t\tforeach ($this->form_tabs as $title => $link)\n\t\t\t{\n\t\t\t\t$count++;\n\t\t\t\t$active = ($count == $this->current_tab) ? ' nav-tab-active' : '';\n\t\t\t\t$return_str .= '<a class=\"nav-tab' . $active . '\" href=\"' . $link . '\">' . $title . '</a>' . \"\\n\";\n\t\t\t}\n\t\t\t$return_str .= '</h2>' . \"\\n\";\n\t\t}\n\t\telse if (!isset($this->form_tabs[0]))\n\t\t{\n\t\t\t$title = array_keys($this->form_tabs);\n\t\t\t$return_str .= '<h2>' . $title[0] . '</h2>' . \"\\n\";\n\t\t}\n\t\telse\n\t\t\t$return_str .= '<h2>' . $this->form_tabs[0] . '</h2>' . \"\\n\";\n\n\t\t$return_str .= '<div class=\"bwp-option-box clear\">' . \"\\n\";\n\n\t\t// Begin generating each form\n\t\tforeach ($this->forms as $form)\n\t\t{\n\t\t\t// If this form has 'divider' items, we need to split HTML fields appropriately\n\t\t\t$dividers = (isset($form->form['divider']) && is_array($form->form['divider'])) ? array_keys($form->form['divider']) : array();\n\t\t\t$form_style = (!empty($form->style)) ? ' style=\"' . $form->style . '\" ' : '';\n\t\t\t$multi_form_style = (!empty($form->style) && 0 < sizeof($dividers)) ? ' style=\"' . $form->style . '\" ' : '';\n\n\t\t\tif (0 == sizeof($dividers))\n\t\t\t{\n\t\t\t\t$return_str .= '<div class=\"bwp-option-box-inside\"' . $form_style . '>' . \"\\n\";\n\t\t\t\t$return_str .= apply_filters('bwp_opf_before_form_' . $form->form_name, '');\n\t\t\t\techo $return_str;\n\t\t\t\tdo_action('bwp_opa_before_form_' . $form->form_name, $form->form_name);\n\t\t\t}\n\t\t\telse\n\t\t\t\techo $return_str;\n\n\t\t\t$enctype = (!empty($form->form_enctype)) ? ' enctype=\"' . $form->form_enctype . '\" ' : '';\n\t\t\t$return_str = '<form class=\"bwp-option-page\" name=\"' . $form->form_name . '\" method=\"post\" action=\"\"' . $enctype . $multi_form_style . '>' . \"\\n\";\n\n\t\t\t// Nonce\n\t\t\t$return_str .= wp_nonce_field($form->form_name, \"_wpnonce\", false, false) . \"\\n\";\n\t\t\t$return_str .= apply_filters('bwp_opf_referrer_field_' . $form->form_name, wp_referer_field(false)) . \"\\n\";\n\n\t\t\t$return_str .= '<ul>' . \"\\n\";\n\n\t\t\tif (isset($form->form_items) && is_array($form->form_items))\n\t\t\t{\n\t\t\t\t// If this form needs to be divided, so be it\n\t\t\t\tif (0 < sizeof($dividers))\n\t\t\t\t{\n\t\t\t\t\t$return_str .= '<div class=\"bwp-option-box-inside\">' . \"\\n\";\n\t\t\t\t\t$return_str .= apply_filters('bwp_opf_before_form_' . $form->form_name, '');\n\t\t\t\t\techo $return_str;\n\t\t\t\t\tdo_action('bwp_opa_before_form_' . $form->form_name, $form->form_name);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\techo $return_str;\n\t\t\t\t// Reset the result\n\t\t\t\t$return_str = '';\n\t\t\t\t// Generate individual items\n\t\t\t\t$form_count = 0;\n\t\t\t\tforeach ($form->form_items as $key => $type)\n\t\t\t\t{\n\t\t\t\t\tif (!empty($form->form_item_names[$key]) && isset($form->form_item_labels[$key]))\n\t\t\t\t\t{\n\t\t\t\t\t\t$extra_classes = ('heading' == $type) ? ' bwp-li-heading' : ' bwp-li-item';\n\t\t\t\t\t\t// Before the field\n\t\t\t\t\t\techo $return_str;\n\t\t\t\t\t\tdo_action('bwp_opa_before_field_' . $form->form_name . '_' . $form->form_item_names[$key], $form->form_name);\n\t\t\t\t\t\t$return_str = '';\n\t\t\t\t\t\t// The field\n\t\t\t\t\t\t$return_str .= ('hidden' != $form->form_items[$key]) ? '<li class=\"clear' . $extra_classes . '\">' . $form->generate_html_fields($type, $form->form_item_names[$key]) . '</li>' : $form->generate_html_fields($type, $form->form_item_names[$key]) . \"\\n\";\n\t\t\t\t\t\t// After the field\n\t\t\t\t\t\techo $return_str;\n\t\t\t\t\t\tdo_action('bwp_opa_after_field_' . $form->form_name . '_' . $form->form_item_names[$key], $form->form_name);\n\t\t\t\t\t\t$return_str = '';\n\t\t\t\t\t\tif (in_array($form->form_item_names[$key], $dividers))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$form_count++;\n\t\t\t\t\t\t\techo $return_str;\n\t\t\t\t\t\t\tdo_action('bwp_opa_after_divided_form_' . $form->form_name . '_' . $form_count, $form->form_name);\n\t\t\t\t\t\t\t$return_str = '';\n\t\t\t\t\t\t\t$return_str .= apply_filters('bwp_opf_multi_submit_button_' . $form->form_name, '<p class=\"submit\"><input type=\"submit\" class=\"button-primary\" name=\"save_' . $form->form_name . '\" value=\"' . __('Save All Changes', $this->domain) . '\" /> <input type=\"submit\" class=\"button-secondary\" name=\"reset_' . $form->form_name . '\" value=\"' . __('Reset to Defaults', $this->domain) . '\" /></p>', $form_count) . \"\\n\";\n\t\t\t\t\t\t\t$return_str .= '</div>' . \"\\n\";\n\t\t\t\t\t\t\t$return_str .= '<div class=\"bwp-option-box-inside\">' . \"\\n\";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// If this form needs to be divided, add the final Save all changes button\n\t\t\t\tif (0 < sizeof($dividers))\n\t\t\t\t\t$return_str .= apply_filters('bwp_opf_multi_submit_button_' . $form->form_name, '<p class=\"submit\"><input type=\"submit\" class=\"button-primary\" name=\"save_' . $form->form_name . '\" value=\"' . __('Save All Changes', $this->domain) . '\" /> <input type=\"submit\" class=\"button-secondary\" name=\"reset_' . $form->form_name . '\" value=\"' . __('Reset to Defaults', $this->domain) . '\" /></p>', 'last') . \"\\n\";\n\t\t\t}\n\n\t\t\t$return_str .= '</ul>' . \"\\n\";\t\t\n\t\t\t$return_str .= apply_filters('bwp_opf_before_submit_button_' . $form->form_name, '');\n\t\t\techo $return_str;\n\t\t\tdo_action('bwp_opa_before_submit_button_' . $form->form_name, $form->form_name);\n\n\t\t\t$submit = apply_filters('bwp_opf_submit_button_' . $form->form_name, '<p class=\"submit\"><input type=\"submit\" class=\"button-primary\" name=\"save_' . $form->form_name . '\" value=\"' . __('Save Changes', $this->domain) . '\" /> <input type=\"submit\" class=\"button-secondary\" name=\"reset_' . $form->form_name . '\" value=\"' . __('Reset to Defaults', $this->domain) . '\" /></p>') . \"\\n\";\n\t\t\t$return_str = apply_filters('bwp_op_submit_button', $submit) . \"\\n\";\n\t\t\t$return_str .= '</form>' . \"\\n\";\n\n\t\t\tif (0 == sizeof($dividers))\n\t\t\t\t$return_str .= '</div>' . \"\\n\";\n\t\t}\n\n\t\t$return_str .= '<div class=\"clear\"><!-- --></div>' . \"\\n\";\n\t\t$return_str .= '</div>' . \"\\n\";\n\t\t$return_str .= '</div>' . \"\\n\";\n\n\t\techo $return_str;\n\t}",
"public function render_template_options_template() { ?>\n\n <script type=\"text/html\" id=\"tmpl-cv-builder-template-options\">\n\n <div class=\"cv-modal-content-padding\">\n\n <a class=\"cv-composer-large-option has-icon\" data-action=\"prepend\">\n <i class=\"icon-up-bold\"></i>\n <strong><?php _e( 'Add Before Existing Content', 'canvys' ); ?></strong>\n <span><?php _e( 'Insert the selected template before the existing page content.', 'canvys' ); ?></span>\n </a>\n <a class=\"cv-composer-large-option has-icon\" data-action=\"replace\">\n <i class=\"icon-stop\"></i>\n <strong><?php _e( 'Replace Existing Content', 'canvys' ); ?></strong>\n <span><?php _e( 'Replace the existing page content with the selected template.', 'canvys' ); ?></span>\n </a>\n <a class=\"cv-composer-large-option has-icon\" data-action=\"append\">\n <i class=\"icon-down-bold\"></i>\n <strong><?php _e( 'Add After Existing Content', 'canvys' ); ?></strong>\n <span><?php _e( 'Insert the selected template after the existing page content.', 'canvys' ); ?></span>\n </a>\n\n </div>\n\n </script>\n\n <?php }",
"public function custom_app_settings() {\n\n\t\t// Get plugin settings.\n\t\t$settings = $this->get_plugin_settings();\n\n\t\t// Get valid app key/secret state.\n\t\t$valid_app_key_secret = $this->is_valid_app_key_secret();\n\n\t\t// Open custom app table.\n\t\t$html = '<table class=\"form-table\">';\n\n\t\tob_start();\n\n\t\t// Display redirect URI.\n\t\t$this->single_setting_row(\n\t\t\tarray(\n\t\t\t\t'name' => '',\n\t\t\t\t'type' => 'text',\n\t\t\t\t'label' => esc_html__( 'OAuth Redirect URI', 'gravityformsdropbox' ),\n\t\t\t\t'class' => 'large',\n\t\t\t\t'value' => $this->get_redirect_uri(),\n\t\t\t\t'readonly' => true,\n\t\t\t\t'onclick' => 'this.select();',\n\t\t\t)\n\t\t);\n\n\t\t// Display custom app key.\n\t\t$this->single_setting_row(\n\t\t\tarray(\n\t\t\t\t'name' => 'customAppKey',\n\t\t\t\t'type' => 'text',\n\t\t\t\t'label' => esc_html__( 'App Key', 'gravityformsdropbox' ),\n\t\t\t\t'class' => 'medium',\n\t\t\t\t'feedback_callback' => array( $this, 'is_valid_app_key_secret' ),\n\t\t\t)\n\t\t);\n\n\t\t// Display custom app secret.\n\t\t$this->single_setting_row(\n\t\t\tarray(\n\t\t\t\t'name' => 'customAppSecret',\n\t\t\t\t'type' => 'text',\n\t\t\t\t'label' => esc_html__( 'App Secret', 'gravityformsdropbox' ),\n\t\t\t\t'class' => 'medium',\n\t\t\t\t'feedback_callback' => array( $this, 'is_valid_app_key_secret' ),\n\t\t\t)\n\t\t);\n\n\t\t$html .= ob_get_contents();\n\t\tob_end_clean();\n\n\t\t// Display auth button.\n\t\t$html .= '<tr><td></td><td>';\n\t\t$html .= sprintf(\n\t\t\t'<a href=\"%3$s\" class=\"button\" id=\"gform_dropbox_auth_button\" style=\"%2$s\">%1$s</a>',\n\t\t\tesc_html__( 'Click here to authenticate with Dropbox.', 'gravityformsdropbox' ),\n\t\t\t! rgar( $settings, 'customAppEnable' ) || ( rgar( $settings, 'customAppEnable' ) && ! $valid_app_key_secret ) ? 'display:none' : null,\n\t\t\trgar( $settings, 'customAppEnable' ) && $valid_app_key_secret ? $this->get_auth_url() : '#'\n\t\t);\n\t\t$html .= '</td></tr>';\n\n\t\t// Close custom app table.\n\t\t$html .= '</table>';\n\n\t\treturn $html;\n\n\t}",
"public function widgetPopupHtml()\n {\n $widgetId = ipRequest()->getQuery('widgetId');\n $widgetRecord = \\Ip\\Internal\\Content\\Model::getWidgetRecord($widgetId);\n $widgetData = $widgetRecord['data'];\n\n // Populate form with proper fields\n switch ($widgetRecord['name']) {\n case 'ContentSection':\n //create form prepopulated with current widget data\n $form = $this->contentSectionManagementForm($widgetData);\n break;\n case 'ThreeItemListSection':\n $form = $this->threeItemManagementForm($widgetData);\n break;\n\n case 'Slider':\n $form = $this->sliderManagementForm($widgetData);\n break;\n case 'TopThreeSection':\n $form = $this->topThreeSectionManagementForm($widgetData);\n break;\n case 'ThumbnailCard':\n $form = $this->cardManagementForm($widgetData);\n break;\n default:\n $err = new \\Ip\\Response\\Json([\n 'error' => 'Unknown widget',\n 'widget' => $widgetRecord\n ]);\n $err->setStatusCode(400);\n return $err;\n }\n\n //Render form and popup HTML\n $viewData = array(\n 'form' => $form\n );\n $popupHtml = ipView('view/editPopup.php', $viewData)->render();\n $data = array(\n 'popup' => $popupHtml\n );\n //Return rendered widget management popup HTML in JSON format\n return new \\Ip\\Response\\Json($data);\n }",
"protected function createDialog() {\n $dialog = parent::createDialog();\n $dialog->fields = $this->builder()->getFields();\n return $dialog;\n }",
"function bg_AddPluginMenuHtml() {\n global $bg_opts_apiKey, $bg_optionGroup, $bg_page;\n\n\tif ( !current_user_can( 'manage_options' ) ) {\n\t\twp_die( __( 'You do not have sufficient permissions to access this page.' ) );\n\t}\n\techo '<div class=\"wrap\">';\n\techo('<h2>BeyondGrammar Settings</h2>');\n\t\t\n\techo('\t<form action=\"options.php\" method=\"post\">');\n\tsettings_fields($bg_optionGroup);\n\tdo_settings_sections($bg_page);\n\techo(\"<input name='Submit' type='submit' class='button-primary' value='Save Changes' />\");\n\techo('</form>');\n\techo '</div>';\n}",
"protected function page_popup () {\n\t\t$skeleton = make::tpl ('skeleton.basic');\n\n\t\t/**\n\t\t * Fetch the body content template\n\t\t */\n\t\t$body = make::tpl ('body.login-widget.popup');\n\n\t\t/**\n\t\t * Fetch the page details\n\t\t */\n\t\t/*$page = new page('terms');*/\n\n\t\t/**\n\t\t * Build the output\n\t\t */\n\t\t$skeleton->assign (\n\t\t\tarray (\n\t\t\t\t'title'\t\t\t=> /*$page->title()*/'Login Widget',\n\t\t\t\t'keywords'\t\t=> /*$page->keywords()*/'',\n\t\t\t\t'description'\t=> /*$page->description()*/'',\n\t\t\t\t'body'\t\t\t=> $body\n\t\t\t)\n\t\t);\n\n\t\toutput::as_html($skeleton,true);\n\n\t}",
"public function renderAdminShortcuts() {\n\t\n\t\t$user = $this->wire('user');\n\t\t$config = $this->wire('config');\n\t\t\n\t\tif($user->isGuest() || !$user->hasPermission('page-edit')) return '';\n\t\n\t\t$language = $user->language && $user->language->id && !$user->language->isDefault() ? $user->language : null;\n\t\t$url = $config->urls->admin . 'page/add/';\n\t\t$out = '';\n\t\n\t\tforeach(wire('templates') as $template) {\n\t\t\t$parent = $template->getParentPage(true); \n\t\t\tif(!$parent) continue; \n\t\t\tif($parent->id) {\n\t\t\t\t// one parent possible\t\n\t\t\t\t$qs = \"?parent_id=$parent->id\";\n\t\t\t} else {\n\t\t\t\t// multiple parents possible\n\t\t\t\t$qs = \"?template_id=$template->id\";\n\t\t\t}\n\t\t\t$label = $template->label;\n\t\t\tif($language) $label = $template->get(\"label$language\");\n\t\t\tif(empty($label)) $label = $template->name; \n\t\t\t$out .= \"<li><a href='$url$qs'>$label</a></li>\";\n\t\t}\n\t\n\t\tif(empty($out)) return '';\n\t\n\t\t$label = $this->_('Add New'); \n\t\n\t\t$out =\t\"<div id='head_button'>\" . \t\n\t\t\t\"<button class='ui-button dropdown-toggle'><i class='fa fa-angle-down'></i> $label</button>\" . \n\t\t\t\"<ul class='dropdown-menu shortcuts'>$out</ul>\" . \n\t\t\t\"</div>\";\n\t\n\t\treturn $out; \n\t}",
"function get_comments_popup_template()\n {\n }",
"public function atmf_html_backend(){\n\n $template_loader = new Uou_Atmf_Load_Template();\n ob_start();\n $template = $template_loader->locate_template( 'popup.php' );\n\n if(is_user_logged_in() ){\n include( $template );\n }\n echo ob_get_clean();\n\n }",
"public function options_page_html() {\n // check user capabilities\n if ( ! current_user_can( 'manage_options' ) ) {\n return;\n }\n\n // add error/update messages\n\n // check if the user have submitted the settings\n // wordpress will add the \"settings-updated\" $_GET parameter to the url\n if ( isset( $_GET['settings-updated'] ) ) {\n // add settings saved message with the class of \"updated\"\n add_settings_error( 'settcalc_messages', 'settcalc_message', __( 'Settings Saved', 'settcalc' ), 'updated' );\n }\n\n // show error/update messages\n settings_errors( 'settcalc_messages' );\n ?>\n <div class=\"wrap\">\n <h1><?php echo esc_html( get_admin_page_title() ); ?></h1>\n <form action=\"options.php\" method=\"post\">\n <?php\n // output security fields for the registered setting \"wporg\"\n settings_fields( 'settcalc' );\n // output setting sections and their fields\n // (sections are registered for \"wporg\", each field is registered to a specific section)\n do_settings_sections( 'settcalc' );\n // output save settings button\n submit_button( 'Save Settings' );\n ?>\n </form>\n </div>\n <?php\n }",
"function htpmpro_options_page_html() {\r\n\t // check user capabilities\r\n\t if ( ! current_user_can( 'manage_options' ) ) {\r\n\t \treturn;\r\n\t }\r\n\r\n\t // show message when updated\r\n\t if ( isset( $_GET['settings-updated'] ) ) {\r\n\t \tadd_settings_error( 'htpmpro_messages', 'htpmpro_message', esc_html__( 'Settings Saved', 'htpmpro' ), 'updated' );\r\n\t }\r\n\t \r\n\t // show error/update messages\r\n\t settings_errors( 'htpmpro_messages' );\r\n\t ?>\r\n\t\t<div class=\"wrap\">\r\n\t\t\t<h1><?php echo esc_html( 'WP Plugin Manager' ); ?> <?php echo esc_html( get_admin_page_title() ); ?></h1>\r\n\t\t\t<form action=\"options.php\" method=\"post\">\r\n\t\t\t\t<?php\r\n\t\t\t\t\t// output general section and their fields\r\n\t\t\t\t\tdo_settings_sections( 'options_group_general' );\r\n\r\n\t\t\t\t\t// general option fields\r\n\t\t\t\t\tsettings_fields( 'options_group_general' );\r\n\r\n\t\t\t\t\t// output save settings button\r\n\t\t\t\t\tsubmit_button( 'Save Settings' );\r\n\t\t\t\t?>\r\n\t\t\t</form>\r\n\t\t</div>\r\n\t<?php\r\n}",
"function PKG_OptionPageRender($layout)\n{\n\tfor ($i=0; $i < count($layout); $i++)\n\t\t{\n\t\t\tswitch($layout[$i]['type'])\n\t\t\t\t{\n\t\t\t\t\tcase \"text\":\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\techo(\"<tr><td colspan=\\\"2\\\">\".$layout[$i]['text'].\"</td></tr>\\n\");\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t};\n\n\t\t\t\t\tcase \"line\":\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\techo(\"<tr><td colspan=\\\"2\\\"><hr></td></tr>\\n\");\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t};\n\n\t\t\t\t\tcase \"title\":\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\techo(\"<tr><td colspan=\\\"2\\\"><br><span class=\\\"title\\\">\".$layout[$i]['text'].\"</span><hr></td></tr>\\n\");\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t};\n\n\t\t\t\t\tcase \"infobox\":\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$infoBox = MSG_showMessageBoxHeader(\"infotable\",$layout[$i]['text'],700,true).MSG_showMessageBoxFooter(true);\n\t\t\t\t\t\t\techo(\"<tr><td colspan=\\\"2\\\">$infoBox</td></tr>\\n\");\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\tcase \"inputline\":\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t//Define the dialog element\n\t\t\t\t\t\t\t$layout[$i]['value'] = HTML_input($layout[$i]['name'], $layout['allvalues'][$layout[$i]['name']], $layout[$i]['size'], $layout[$i]['maxlength'], INPUT_TYPE_text);\n\n\t\t\t\t\t\t\t//Show it\n\t\t\t\t\t\t\techo(\"<tr><td>\".$layout[$i]['text'].\"</td><td>\".constant($layout[$i]['name']).\"</td></tr>\\n\");\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t};\n\n\n\t\t\t\t\tcase \"selection\":\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$arr = array();\n\n\t\t\t\t\t\t\t//Generate the array for the options\n\t\t\t\t\t\t\tfor ($nr=0; isset($layout[$i][\"option\".$nr]); $nr++)\n\t\t\t\t\t\t\t\t$arr[$layout[$i]['option'.$nr]] = $layout[$i]['option'.$nr];\n\n\t\t\t\t\t\t\t//Define the dialog element\n\t\t\t\t\t\t\t$layout[$i]['value'] = HTML_selection($layout[$i]['name'], $arr, SELTYPE_selection, true, $layout['allvalues'][$layout[$i]['name']]);\n\n\t\t\t\t\t\t\t//Show it\n\t\t\t\t\t\t\techo(\"<tr><td>\".$layout[$i]['text'].\"</td><td>\".constant($layout[$i]['name']).\"</td></tr>\\n\");\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t};\n\n\t\t\t\t\tcase \"textarea\":\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$layout[$i]['value'] = HTML_textArea($layout[$i]['name'], $layout[$i]['cols'], $layout[$i]['rows'], $layout['allvalues'][$layout[$i]['name']]);\n\n\t\t\t\t\t\t\t//Show it\n\t\t\t\t\t\t\techo(\"<tr><td>\".$layout[$i]['text'].\"</td><td>\".constant($layout[$i]['name']).\"</td></tr>\");\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t};\n\n\t\t\t\t};\n\t\t};\n}",
"function wcfm_options_page_html() {\n\t\tglobal $WCFM;\n\t\t// check user capabilities\n\t\tif ( ! current_user_can( 'manage_options' ) ) {\n\t\t return;\n\t\t}\n\t\t\n\t\t// add error/update messages\n\t\t\n\t\tif ( isset( $_GET['settings-updated'] ) ) {\n\t\t // add settings saved message with the class of \"updated\"\n\t\t add_settings_error( 'wcfm_messages', 'wcfm_message', __( 'Settings Saved', $WCFM->text_domain ), 'updated' );\n\t\t}\n\t\t\n\t\t// show error/update messages\n\t\tsettings_errors( 'wcfm_messages' );\n\t\t?>\n\t\t<div class=\"wrap\">\n\t\t<h1><?php echo esc_html( get_admin_page_title() ); ?></h1>\n\t\t<form action=\"options.php\" method=\"post\">\n\t\t\t<div style=\"float: left; display: inline-block; width: 60%;\">\n\t\t\t\t <?php \n\t\t\t\t\t settings_fields( 'wcfm' );\n\t\t\t\t\t do_settings_sections( 'wcfm' );\n\t\t\t\t\t submit_button( 'Save Settings' );\n\t\t\t\t ?>\n\t\t\t</div>\n\t\t\t\n\t\t\t<div class=\"wcfm_admin_message_wrapper\">\n\t\t\t\t<div class=\"wcfm_admin_message wcfm_admin_help_docs\">\n\t\t\t\t\t<h2>How can we help you?</h2>\n\t\t\t\t\t<ul style=\"list-style: outside; margin-left: 50px;\">\n\t\t\t\t\t <li><a target=\"_blank\" href=\"https://wclovers.com/blog/woocommerce-multivendor-marketplace-wcfm-marketplace/\">WCFM - Marketplace</a></li>\n\t\t\t\t\t <li><a target=\"_blank\" href=\"http://wclovers.com/knowledgebase/\">WCFM - Documentation</a></li>\n\t\t\t\t\t <li><a target=\"_blank\" href=\"https://wclovers.com/wcfm-tutorials/\">WCFM - Video Tutorial</a></li>\n\t\t\t\t\t\t<li><a target=\"_blank\" href=\"https://wclovers.com/blog/woocommerce-frontend-manager/\">WCFM - what will do for you?</a></li>\n\t\t\t\t\t\t<li><a target=\"_blank\" href=\"https://wclovers.com/blog/wcfm-dashboard-as-site-template/\">Customize WCFM Dashboard</a></li>\n\t\t\t\t\t\t<li><a target=\"_blank\" href=\"https://wclovers.com/blog/choose-best-woocommerce-multi-vendor-marketplace-plugin/\">Choose your Marketplace plugin</a></li>\n\t\t\t\t\t\t<li><a target=\"_blank\" href=\"https://wclovers.com/blog/location-products-wcfm/\">WCFM -> GEO my WP</a></li>\n\t\t\t\t\t</ul>\n\t\t\t\t</div>\n\t\t\t\t<?php if(!WCFM_Dependencies::wcfmvm_plugin_active_check()) { ?>\n\t\t\t\t\t<div class=\"wcfm_admin_message\">\n\t\t\t\t\t\t<h2>Setup vendor subscription in 5 minutes -</h2>\n\t\t\t\t\t\t<a class=\"primary membership_btn\" href=\"https://wordpress.org/plugins/wc-multivendor-membership/\" target=\"_blank\">WCFM - Membership</a>\n\t\t\t\t\t</div>\n\t\t\t\t<?php } ?>\n\t\t\t\t<?php if(!WCFM_Dependencies::wcfmu_plugin_active_check()) { ?>\n\t\t\t\t\t<div class=\"wcfm_admin_message\">\n\t\t\t\t\t\t<h2>Are you looking for something like this?</h2>\n\t\t\t\t\t\t<ul style=\"list-style: outside; margin-left: 50px;\">\n\t\t\t\t\t\t <li>Live Chat Module</li>\n\t\t\t\t\t\t\t<li>Support Ticket System</li>\n\t\t\t\t\t\t\t<li>Vendor Followers</li>\n\t\t\t\t\t\t\t<li>Store Invoice</li>\n\t\t\t\t\t\t\t<li>Product Importer</li>\n\t\t\t\t\t\t\t<li>Shipping Tracking</li>\n\t\t\t\t\t\t\t<li>Advanced Custom Fields</li>\n\t\t\t\t\t\t\t<li>GEO Map integration</li>\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t<a class=\"primary\" href=\"https://wclovers.com/product/woocommerce-frontend-manager-ultimate/\" target=\"_blank\">Click here to get all this...</a>\n\t\t\t\t\t</div>\n\t\t\t\t<?php } elseif(!WCFM_Dependencies::wcfma_plugin_active_check()) { ?>\n\t\t\t\t\t<div class=\"wcfm_admin_message\">\n\t\t\t\t\t\t<h2>How a store can even without Analytics?</h2>\n\t\t\t\t\t\t<ul style=\"list-style: outside; margin-left: 50px;\">\n\t\t\t\t\t\t\t<li>Analytics by Region</li>\n\t\t\t\t\t\t\t<li>Analytics by Store</li>\n\t\t\t\t\t\t\t<li>Analytics by Product</li>\n\t\t\t\t\t\t\t<li>Analytics by Category</li>\n\t\t\t\t\t\t\t<li>Analytics Comparison</li>\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t<a class=\"primary\" href=\"https://wclovers.com/product/woocommerce-frontend-manager-analytics/\" target=\"_blank\">Click here to get all this...</a>\n\t\t\t\t\t</div>\n\t\t\t\t<?php } ?>\n\t\t\t\t<div class=\"wcfm_admin_message wcfm_admin_support_docs\">\n\t\t\t\t\t<h2>All we want is Love!!</h2>\n\t\t\t\t\t<ul style=\"list-style: outside; margin-left: 50px;\">\n\t\t\t\t\t\t<li><a href=\"https://twitter.com/wcfmlovers\" target=\"_blank\">Get in touch</a></li>\n\t\t\t\t\t\t<li><a href=\"https://wordpress.org/support/plugin/wc-frontend-manager/reviews/\" target=\"_blank\">Be with US</a></li>\n\t\t\t\t\t</ul>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</form>\n\t\t</div>\n\t\t<?php\n }",
"protected function getTemplate(){\n\t\treturn 'invoice_form_html.tpl';\n\t}",
"public function dialogoMensaje(){\n\t \t$template = file_get_contents('tpl/dialogo_msg_tpl.html');\n\t \tprint($template);\n\t }",
"protected function getForm() {\n $lUpdate = ($this -> mPhraseTyp == 'product') ? 'yes' : 'no';\n $this -> setParam('ref_update', $lUpdate);\n\n $lRet = '<div id=\"job_form\" class=\"frm\">'.LF;\n\t$lRet.= $this -> getFieldForm();\n $lRet.= '</div>' . LF;\n \n /*if($this -> mCanBuild) {\n $lRet.= '<div id=\"save_dialog\" title=\"Publish PDF\" style=\"display:none;\">'.LF;\n\t $lRet.= '<input id=\"templateId\" type=\"hidden\" value=\"\" />'.LF;\n $lRet.= '<iframe src=\"\" onload=\"javascript:GetEditor()\" id=\"chiliEditor\" class=\"dn\" style=\"width:100%;height:100%;\"></iframe>'.LF;\n $lRet.= '</div>'.LF;\n }*/\n \n $lDlg = new CJob_Cms_Content_Dialog($this -> mJobId, $this -> mSrc, $this -> mJob);\n $lRet.= $lDlg -> getContent();\n \n $lRet.= $lDlg -> getModals();\n \n return $lRet;\n }",
"public static function get_validation_html_theme_main() {\n return sprintf( __( '<a href=\"%s\">Validate X to enable automatic updates</a>', '__x__' ), x_addons_get_link_home() );\n }",
"protected function getTemplate() {\n\t\treturn new Template('Premanager', 'userForm');\n\t}",
"public function render_admin_page () {\n\t\tif (!Upfront_Permissions::current(Upfront_Permissions::BOOT)) wp_die(\"Nope.\");\n\n\t\tif (!class_exists('Thx_Sanitize')) require_once (dirname(__FILE__) . '/class_thx_sanitize.php');\n\t\tif (!class_exists('Thx_Template')) require_once (dirname(__FILE__) . '/class_thx_template.php');\n\n\t\tload_template(Thx_Template::plugin()->path('create_edit'));\n\t}"
] |
[
"0.63498247",
"0.5821451",
"0.58023083",
"0.5711568",
"0.5575509",
"0.55612934",
"0.5549516",
"0.5520316",
"0.550973",
"0.54829264",
"0.5426216",
"0.5426116",
"0.54202145",
"0.5399814",
"0.53182054",
"0.53178173",
"0.52876526",
"0.52814466",
"0.52783185",
"0.52666575",
"0.524303",
"0.52346176",
"0.52279615",
"0.51806957",
"0.5176064",
"0.5164277",
"0.5146626",
"0.5143984",
"0.51300347",
"0.5129152"
] |
0.74880165
|
0
|
app_template_navigation Returns the navigation menu HTML based on user permissions.
|
function app_template_navigation() {
global $Auth, $App;
$user = $Auth->get_user_data();
$navigation = NULL;
if ( ! empty($user) ) {
$user_id = $user['is_super'] ? false : $user['user_id'];
$Menu = new AdminMenu($user_id, $user['is_super']);
$nav = $Menu->generate();
$navigation = array(
'selector' => $App->config('page_content_id'),
'pos_func' => 'insertAfter',
'html' => $nav['navigation'].$nav['search']
);
}
return $navigation;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function template_navigation() {\n\t\t$_ENV['menu'] = array();\n\t\t$_ENV['menu']['Main'] = _URL_;\n\t\tModule::includes('menus');\n\t\t$_ENV['menu']['Preferences'] = '?module=prefs';\n\t\t$_ENV['menu']['Logout'] = '?logout=true';\n\n\t\t$buffer = '<ul><li><h2>';\n\t\t$buffer .= array_key_exists('Menu',$_ENV['imgs']['menu']) \n\t\t\t? '<img src=\"'.$_ENV['imgs']['menu']['Menu'].'\" border=\"0\" /> ' : ' ';\n\t\t$buffer .= ' Main Menu</h2><ul>';\n\t\tforeach ($_ENV['menu'] as $module => $items) {\n\t\t\tif (is_array($items)) {\n\t\t\t\t$buffer .= '<li><a href=\"#\">';\n\t\t\t\t$buffer .= array_key_exists($module,$_ENV['imgs']['menu'])\n\t\t\t\t\t? '<img src=\"'.$_ENV['imgs']['menu'][$module].'\" border=\"0\" /> ' : ' ';\n\t\t\t\t$buffer .= $module.'</a><ul>';\n\t\t\t\tforeach ($items as $label => $url) {\n\t\t\t\t\t$buffer .= '<li><a href=\"'.$url.'\">';\n\t\t\t\t\t$buffer .= array_key_exists($label,$_ENV['imgs']['menu'])\n\t\t\t\t\t\t? '<img src=\"'.$_ENV['imgs']['menu'][$label].'\" border=\"0\" /> ' : ' ';\n\t\t\t\t\t$buffer .= $label.'</a></li>';\n\t\t\t\t}\n\t\t\t\t$buffer .= '</ul></li>';\n\t\t\t} else {\n\t\t\t\t$buffer .= '<li><a href=\"'.$items.'\">';\n\t\t\t\t$buffer .= array_key_exists($module,$_ENV['imgs']['menu'])\n\t\t\t\t\t? '<img src=\"'.$_ENV['imgs']['menu'][$module].'\" border=\"0\" /> ' : ' ';\n\t\t\t\t$buffer .= $module.' </a></li>';\n\t\t\t}\t\n\t\t}\n\t\t$buffer .= '</ul></li></ul>';\n\t\treturn $buffer;\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}",
"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 page_nav() {\n global $user;\n global $xtpl;\n \n $xtpl->assign('nav_base', trim(simpleid_url(' ', '', true)));\n \n if ($user != NULL) {\n if (isset($user['administrator']) && ($user['administrator'] == 1)) $xtpl->parse('main.nav.nav_admin');\n \n }\n $xtpl->parse('main.nav');\n}",
"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}",
"private function menu()\n {\n $data['links'] = ['create', 'read', 'update', 'delete'];\n\n return $this->view->render($data, 'home/menu');\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}",
"function side_navigation()\n\t{\n\t\t//side navigation\n\t\t$nav['dashboard'] = array(\n\t\t\t'name' => trans('admin_messages.dashboard'),\n\t\t\t'icon' => 'assessment',\n\t\t\t'has_permission' => true,\n\t\t\t'route' => route('admin.dashboard'),\n\t\t\t'active' => navigation_active('admin.dashboard'),\n\t\t);\n\n\t\t$nav['admin_management'] = array(\n\t\t\t'name' => trans('admin_messages.admin_user_management'),\n\t\t\t'icon' => 'supervised_user_circle',\n\t\t\t'has_permission' => checkPermission('view-admin'),\n\t\t\t'route' => route('admin.view_admin'),\n\t\t\t'active' => navigation_active('admin.view_admin')\n\t\t);\n\n\t\t$nav['role_management'] = array(\n\t\t\t'name' => trans('admin_messages.role_management'),\n\t\t\t'icon' => 'lock',\n\t\t\t'has_permission' => checkPermission('view-role'),\n\t\t\t'route' => route('admin.view_role'),\n\t\t\t'active' => navigation_active('admin.view_role')\n\t\t);\n\n\t\t$nav['user_management'] = array(\n\t\t\t'name' => trans('admin_messages.user_management'),\n\t\t\t'icon' => 'account_circle',\n\t\t\t'has_permission' => checkPermission('view-user'),\n\t\t\t'route' => route('admin.view_user'),\n\t\t\t'active' => navigation_active('admin.view_user')\n\t\t);\n\t\t\n\t\t$nav['driver_management'] = array(\n\t\t\t'name' => trans('admin_messages.driver_management'),\n\t\t\t'icon' => 'drive_eta',\n\t\t\t'has_permission' => checkPermission('view-driver'),\n\t\t\t'route' => route('admin.view_driver'),\n\t\t\t'active' => navigation_active('admin.view_driver')\n\t\t);\n\t\t\n\t\t$nav['home_banner'] = array(\n\t\t\t'name' => trans('admin_messages.home_banner'),\n\t\t\t'icon' => 'merge_type',\n\t\t\t'has_permission' => checkPermission('view-home_banner'),\n\t\t\t'route' => route('admin.home_banner'),\n\t\t\t'active' => navigation_active('admin.home_banner')\n\t\t);\n\t\t\n\t\t$nav['cuisine_management'] = array(\n\t\t\t'name' => trans('admin_messages.cuisine_management'),\n\t\t\t'icon' => 'category',\n\t\t\t'has_permission' => checkPermission('view-category'),\n\t\t\t'route' => route('admin.cuisine'),\n\t\t\t'active' => navigation_active('admin.cuisine')\n\t\t);\n\t\t\n\t\t$nav['restaurant_management'] = array(\n\t\t\t'name' => trans('admin_messages.store_management'),\n\t\t\t'icon' => 'restaurant',\n\t\t\t'has_permission' => checkPermission('view-restaurant'),\n\t\t\t'route' => route('admin.view_restaurant'),\n\t\t\t'active' => navigation_active('admin.view_restaurant')\n\t\t);\n\t\t\n\t\t$nav['send_message'] = array(\n\t\t\t'name' => trans('admin_messages.send_message'),\n\t\t\t'icon' => 'email',\n\t\t\t'has_permission' => checkPermission('manage-send_message'),\n\t\t\t'route' => route('admin.send_message'),\n\t\t\t'active' => navigation_active('admin.send_message')\n\t\t);\n\t\t\n\t\t$nav['order_management'] = array(\n\t\t\t'name' => trans('admin_messages.order_managemnt'),\n\t\t\t'icon' => 'add_shopping_cart',\n\t\t\t'has_permission' => checkPermission('manage-orders'),\n\t\t\t'route' => route('admin.order'),\n\t\t\t'active' => navigation_active('admin.order')\n\t\t);\n\t\t\n\t\t$nav['restaurant_payout_management'] = array(\n\t\t\t'name' => trans('admin_messages.store_payout_management'),\n\t\t\t'icon' => 'euro_symbol',\n\t\t\t'has_permission' => checkPermission('manage-payouts'),\n\t\t\t'route' => route('admin.payout', 1),\n\t\t\t'active' => navigation_active('admin.payout', 1)\n\t\t);\n\t\t\n\t\t$nav['driver_payout_management'] = array(\n\t\t\t'name' => trans('admin_messages.driver_payout_management'),\n\t\t\t'icon' => 'motorcycle',\n\t\t\t'has_permission' => checkPermission('manage-payouts'),\n\t\t\t'route' => route('admin.payout', 2),\n\t\t\t'active' => navigation_active('admin.payout', 2)\n\t\t);\n\t\t\n\t\t$nav['driver_owe_amount'] = array(\n\t\t\t'name' => trans('admin_messages.owe_amount'),\n\t\t\t'icon' => 'attach_money',\n\t\t\t'has_permission' => checkPermission('manage-owe_amount'),\n\t\t\t'route' => route('admin.owe_amount'),\n\t\t\t'active' => navigation_active('admin.owe_amount')\n\t\t);\n\t\t\n\t\t$nav['restaurant_owe_amount'] = array(\n\t\t\t'name' => trans('admin_messages.store_owe_amount'),\n\t\t\t'icon' => 'attach_money',\n\t\t\t'has_permission' => checkPermission('manage-restaurant_owe_amount'),\n\t\t\t'route' => route('admin.restaurant_owe_amount'),\n\t\t\t'active' => navigation_active('admin.restaurant_owe_amount')\n\t\t);\n\n\n\t\t$nav['penality'] = array(\n\t\t\t'name' => trans('admin_messages.penalty'),\n\t\t\t'icon' => 'thumb_down',\n\t\t\t'has_permission' => checkPermission('manage-penality'),\n\t\t\t'route' => route('admin.penality'),\n\t\t\t'active' => navigation_active('admin.penality')\n\t\t);\n\t\t\n\t\t$nav['promo_management'] = array(\n\t\t\t'name' => trans('admin_messages.promo_management'),\n\t\t\t'icon' => 'card_giftcard',\n\t\t\t'has_permission' => checkPermission('view-promo'),\n\t\t\t'route' => route('admin.promo'),\n\t\t\t'active' => navigation_active('admin.promo')\n\t\t);\n\t\t\n\t\t$nav['static_page_management'] = array(\n\t\t\t'name' => trans('admin_messages.static_page_management'),\n\t\t\t'icon' => 'description',\n\t\t\t'has_permission' => checkPermission('view-static_page'),\n\t\t\t'route' => route('admin.static_page'),\n\t\t\t'active' => navigation_active('admin.static_page')\n\t\t);\n\t\t\n\t\t$nav['home_slider'] = array(\n\t\t\t'name' => trans('admin_messages.home_slider'),\n\t\t\t'icon' => 'description',\n\t\t\t'has_permission' => checkPermission('view-restaurant_slider'),\n\t\t\t'route' => route('admin.view_home_slider'),\n\t\t\t'active' => navigation_active('admin.view_home_slider')\n\t\t);\n\t\t\n\t\t$nav['country_management'] = array(\n\t\t\t'name' => trans('admin_messages.country_management'),\n\t\t\t'icon' => 'language',\n\t\t\t'has_permission' => checkPermission('view-country'),\n\t\t\t'route' => route('admin.country'),\n\t\t\t'active' => navigation_active('admin.country')\n\t\t);\n\t\t\n\t\t$nav['currency_management'] = array(\n\t\t\t'name' => trans('admin_messages.currency_management'),\n\t\t\t'icon' => 'euro_symbol',\n\t\t\t'has_permission' => checkPermission('view-currency'),\n\t\t\t'route' => route('admin.currency'),\n\t\t\t'active' => navigation_active('admin.currency')\n\t\t);\n\t\t\n\t\t\n\t\t$nav['language_management'] = array(\n\t\t\t'name' => trans('admin_messages.language_management'),\n\t\t\t'icon' => 'translate',\n\t\t\t'has_permission' => checkPermission('view-language'),\n\t\t\t'route' => route('admin.languages'),\n\t\t\t'active' => navigation_active('admin.languages')\n\t\t);\n\t\t\n\t\t$nav['cancel_reason'] = array(\n\t\t\t'name' => trans('admin_messages.cancel_reason'),\n\t\t\t'icon' => 'cancel',\n\t\t\t'has_permission' => checkPermission('view-cancel_reason'),\n\t\t\t'route' => route('admin.order_cancel_reason'),\n\t\t\t'active' => navigation_active('admin.order_cancel_reason')\n\t\t);\n\t\t\n\t\t$nav['review_issue_type'] = array(\n\t\t\t'name' => trans('admin_messages.review_issue_type'),\n\t\t\t'icon' => 'report_problem',\n\t\t\t'has_permission' => checkPermission('view-review_issue_type'),\n\t\t\t'route' => route('admin.issue_type'),\n\t\t\t'active' => navigation_active('admin.issue_type')\n\t\t);\n\t\t\n\t\t$nav['review_vehicle_type'] = array(\n\t\t\t'name' => trans('admin_messages.manage_vehicle_type'),\n\t\t\t'icon' => 'drive_eta',\n\t\t\t'has_permission' => checkPermission('view-vehicle_type'),\n\t\t\t'route' => route('admin.vehicle_type'),\n\t\t\t'active' => navigation_active('admin.vehicle_type')\n\t\t);\n\t\t\n\t\t$nav['food_receiver'] = array(\n\t\t\t'name' => trans('admin_messages.food_receiver'),\n\t\t\t'icon' => 'receipt',\n\t\t\t'has_permission' => checkPermission('view-recipient'),\n\t\t\t'route' => route('admin.food_receiver'),\n\t\t\t'active' => navigation_active('admin.food_receiver')\n\t\t);\n\t\t\n\t\t$nav['help_category'] = array(\n\t\t\t'name' => trans('admin_messages.help_category'),\n\t\t\t'icon' => 'help',\n\t\t\t'has_permission' => checkPermission('view-help_category'),\n\t\t\t'route' => route('admin.help_category'),\n\t\t\t'active' => navigation_active('admin.help_category')\n\t\t);\n\t\t\n\t\t$nav['help_subcategory'] = array(\n\t\t\t'name' => trans('admin_messages.help_subcategory'),\n\t\t\t'icon' => 'help',\n\t\t\t'has_permission' => checkPermission('view-help_subcategory'),\n\t\t\t'route' => route('admin.help_subcategory'),\n\t\t\t'active' => navigation_active('admin.help_subcategory')\n\t\t);\n\t\t\n\t\t$nav['help'] = array(\n\t\t\t'name' => trans('admin_messages.help'),\n\t\t\t'icon' => 'help',\n\t\t\t'has_permission' => checkPermission('view-help'),\n\t\t\t'route' => route('admin.help'),\n\t\t\t'active' => navigation_active('admin.help')\n\t\t);\n\t\t\n\t\t$nav['site_setting'] = array(\n\t\t\t'name' => trans('admin_messages.site_setting'),\n\t\t\t'icon' => 'settings',\n\t\t\t'has_permission' => checkPermission('manage-site_setting'),\n\t\t\t'route' => route('admin.site_setting'),\n\t\t\t'active' => navigation_active('admin.site_setting')\n\t\t);\n\n\n\t\t$nav['support'] = array(\n\t\t\t'name' => trans('admin_messages.support'),\n\t\t\t'icon' => 'support_agent',\n\t\t\t'has_permission' => checkPermission('view-support'),\n\t\t\t'route' => route('admin.support'),\n\t\t\t'active' => navigation_active('admin.support')\n\t\t);\n\n\t\treturn $nav;\n\t}",
"protected function build_nav()\r\n {\r\n //$this->view = false;\r\n $this->load->model('privilege_model','nav');\r\n\r\n $roles = $this->user->get_roles($this->user_id);\r\n $nav_links = $this->nav->get($roles); \r\n\r\n $this->load->config('nav_icons');\r\n $nav_icons = $this->config->item('icons');\r\n $result = '<ul id=\"nav\">'; \r\n \r\n //loop over returned top level navs\r\n foreach($nav_links as $nav_link):\r\n\r\n if($nav_link->name == \"school-logo\"):\r\n\r\n if(!$this->user_details->is_parent): //parent can belong to multiple schools\r\n\r\n $result .= '<li class=\"'.$nav_link->name.'\">'.\r\n anchor('schools/profile/1', img(base_url('assets/imgs/xlogo.jpg')))\r\n .'</li>'; \r\n\r\n endif;// only add school logo if not a regular user\r\n else:\r\n \r\n //Preferential nav load\r\n $result .= '<li class=\"'.$nav_link->name.'\">'.\r\n anchor($nav_link->controller.'/'.$nav_link->method, ' ', array('class' => $nav_icons[$nav_link->name]))\r\n .''.\r\n anchor($nav_link->controller.'/'.$nav_link->method, ucfirst($nav_link->name))\r\n .'</li>'; \r\n //End preferential nav load \r\n\r\n endif;\r\n endforeach;\r\n\r\n $result .= '</ul>';\r\n return $result;\r\n }",
"function login_menu() {\n $asf = CAsdf::Instance();\n if($asf->user['isAuthenticated']) {\n $items = \"<a href='\" . create_url('user/profile') . \"'><img class='gravatar' src='\" . get_gravatar(20) . \"' alt=''> \" . $asf->user['acronym'] . \"</a> \";\n if($asf->user['hasRoleAdministrator']) {\n $items .= \"<a href='\" . create_url('acp') . \"'>acp</a> \";\n }\n $items .= \"<a href='\" . create_url('user/logout') . \"'>logout</a> \";\n } else {\n $items = \"<a href='\" . create_url('user/login') . \"'>login</a> \";\n }\n return \"<nav id='login-menu'>$items</nav>\";\n}",
"public function renderMenu($config = array()){\n $this->_setOptions($config);\n \n $translator = Zend_Registry::get('Zend_Translate');\n $trans = $translator->getAdapter();\n \n $navigation = App_Navigation::getInstance()->getNavigation($this->_navigationParams);\n \n $menu = array();\n foreach( $navigation as $tab ){\n if( isset($tab['controller']) ){\n $urlParams = array(\n 'controller' => $tab['controller']\n );\n if( isset($tab['action']) ){\n $urlParams['action'] = $tab['action'];\n }\n $url = $this->_assembleUrl($urlParams);\n if( isset($tab['active']) && $tab['active'] ){\n $tabLink = sprintf($this->_currentLinkTemplate, $url, \n $trans->translate($tab['label']));\n }else{\n $tabLink = sprintf($this->_linkTemplate, $url, \n $trans->translate($tab['label']));\n }\n }else{\n $tabLink = sprintf($this->_tabLinkTemplate, $trans->translate($tab['label']));\n }\n $links = array();\n if( isset($tab['pages']) ){\n foreach( $tab['pages'] as $page ){\n $urlParams = array(\n 'controller' => $page['controller']\n );\n if( isset($page['action']) ){\n $urlParams['action'] = $page['action'];\n }\n $url = $this->_assembleUrl($urlParams);\n if( isset($page['active']) && $page['active'] ){\n $links[] = sprintf($this->_currentLinkTemplate, $url, \n $trans->translate($page['label']));\n }else{\n $links[] = sprintf($this->_linkTemplate, $url, \n $trans->translate($page['label']));\n }\n }\n }\n if( isset($tab['active']) && $tab['active'] ){\n $li = '<li class=\"current\">' . PHP_EOL . $tabLink . PHP_EOL;\n $li .= ! empty($links) ? '<ul>' . PHP_EOL . '<li>' .\n implode('</li>' . PHP_EOL . '<li>', $links) . '</li>' . PHP_EOL .\n '</ul>' : '';\n $li .= '</li>';\n }else{\n $li = '<li>' . PHP_EOL . $tabLink . PHP_EOL;\n $li .= ! empty($links) ? '<ul>' . PHP_EOL . '<li>' .\n implode('</li>' . PHP_EOL . '<li>', $links) . '</li>' . PHP_EOL .\n '</ul>' : '';\n $li .= '</li>';\n }\n $menu[] = $li;\n }\n \n $xhtml = '<ul id=\"'.$this->_menuId.'\" class=\"'.$this->_menuClass.'\">' . PHP_EOL .\n implode(PHP_EOL, $menu) . PHP_EOL . '</ul>';\n return $xhtml;\n }",
"private function menu() {\n // Array Map: Key(Menu Elements) => Array(Bold, Not Dynamic tag)\n if(isset($_SESSION['isAdmin'])) {\n $data['menu'] = [\n 'dashboard' => [false, false],\n 'general' => [false, false],\n 'weather' => [false, false],\n 'themes' => [false, false],\n 'languages' => [false, false],\n 'info_pages' => [false, false],\n 'ads' => [false, false],\n 'password' => [false, false],\n 'logout' => [false, true]\n ];\n } else {\n $data['menu'] = [\n 'login' => [false, false],\n ];\n }\n\n // If on the current route, enable the Bold flag\n $data['menu'][$this->url[1]][0] = true;\n\n return $this->view->render($data, 'admin/menu');\n }",
"public function renderNavigation()\n {\n return view('nova::dashboard.navigation');\n }",
"public function navigation() {\n if(!isset($this->navigationZamowienia)) {\n $RepoZamowienia = $this->doctrine->getRepository('MarcinAdminBundle:Zamowienia');\n $this->navigationZamowienia = $RepoZamowienia->getStatistics();\n }\n if(!isset($this->navigationUser)) {\n $RepoUser = $this->doctrine->getRepository('MarcinAdminBundle:Username');\n $this->navigationUser = $RepoUser->getUsernamecount();\n }\n// if(!isset($this->navigationPage)) {\n// $RepoPage = $this->doctrine->getRepository('TomSiteBundle:Page');\n// $this->navigationPage = $RepoPage->getStatistics();\n// }\n// if(!isset($this->navigationSlider)) {\n// $RepoSlider = $this->doctrine->getRepository('TomSiteBundle:Slider');\n// $this->navigationSlider = $RepoSlider->getStatistics();\n// }\n// if(!isset($this->navigationSugestion)) {\n// $RepoSugestion = $this->doctrine->getRepository('TomSiteBundle:Sugestion');\n// $this->navigationSugestion = $RepoSugestion->getStatistics();\n// }\n \n return $this->environment->render('MarcinAdminBundle:Template:navigation.html.twig', array(\n 'navigation' => array(\n 'zamowienia' => array(\n 'count' => $this->navigationZamowienia\n ),\n 'username' => array(\n 'count' => $this->navigationUser\n )\n// ,\n// 'page' => array(\n// 'count' => $this->navigationPage\n// ),\n// 'slider' => array(\n// 'count' => $this->navigationSlider\n// ),\n// 'sugestion' => array(\n// 'count' => $this->navigationSugestion\n// )\n )\n ));\n }",
"public function getMenu()\r\n {\r\n $auth = $this->session->get('auth');\r\n if ($auth) {\r\n $this->_headerMenu['navbar-right']['session'] = array(\r\n 'caption' => 'Log Out',\r\n 'action' => 'end'\r\n );\r\n } else {\r\n unset($this->_headerMenu['navbar-left']['invoices']);\r\n }\r\n\r\n $controllerName = $this->view->getControllerName();\r\n foreach ($this->_headerMenu as $position => $menu) {\r\n echo '<div class=\"nav-collapse\">';\r\n echo '<ul class=\"nav navbar-nav ', $position, '\">';\r\n foreach ($menu as $controller => $option) {\r\n if ($controllerName == $controller) {\r\n echo '<li class=\"active\">';\r\n } else {\r\n echo '<li>';\r\n }\r\n echo $this->tag->linkTo($controller . '/' . $option['action'], $option['caption']);\r\n echo '</li>';\r\n }\r\n echo '</ul>';\r\n echo '</div>';\r\n }\r\n\r\n }",
"public function woocommerce_account_navigation() {\n\t\t\tastra_addon_get_template( 'woocommerce/templates/navigation.php' );\n\t\t}",
"function make_navigation_bar($user_entity, $page_name = NULL)\n{\n global $options;\n echo \"<div id='navigation'>\\n\";\n\n if (isset($options['captureui_addrs'])) {\n make_app_addrs_list();\n }\n\n // User is already logged in, so\n // - access user information and display welcome message\n // - display 'home', 'editprofile', and 'logout' links.\n\n if (isset($user_entity)) {\n if (isset($user_entity['stat']) && $user_entity['stat'] == 'ok') {\n if (isset($_COOKIE['app'])) {\n echo \"<span id='app_name'>\" . $_COOKIE['app'] . \"</span> \";\n }\n $user_entity = $user_entity['result'];\n\n if ($page_name != \"home\")\n echo \"<a href='.' id='home'>Home</a>\";\n\n echo \"Hello, \" . $user_entity['displayName'] . \"\";\n\n print ' | ';\n\n if ($options['edit_profile_with_fancybox']) {\n echo '<a href=\"profile_with_token_refresh.php\" id=\"profile_link\" class=\"iframe\">Edit Profile</a>';\n }\n else {\n if ($page_name != \"editprofile\") {\n echo \"<a href='editprofile.php' id='edit_profile'>Edit Your Profile</a>\";\n } else {\n echo \"Edit Your Profile\";\n }\n }\n\n // if ($page_name != \"rawprofile\") {\n // echo \" | <a href='rawprofile.php' id='raw_profile'>View Capture Profile</a>\";\n // } else {\n // echo \" | View Capture Profile\";\n // }\n\n if ($page_name != \"public_profile\") {\n echo \" | <a href='public_profile.php' id='public_profile'>View Public Profile</a>\";\n } else {\n echo \" | View Public Profile\";\n }\n } else {\n debug_out(\"*** Bad entity!<br>\\n\");\n debug_raw_data($user_entity);\n }\n\n if (isset($options['sso_server'])) {\n echo \" | <a href='#' id='logout' onClick='sso_logout()'>Sign Out</a>\";\n } else {\n echo \" | <a href='logout.php' id='logout'>Sign Out</a>\";\n }\n }\n\n // User is not logged in, so display signin link\n else {\n make_signin_link();\n }\n echo \"</div>\\n\";\n}",
"public function renderNavigation()\n {\n return view('nova-blog-tool::navigation');\n }",
"function public_nav_main()\n{\n $view = get_view();\n $nav = new Omeka_Navigation;\n $nav->loadAsOption(Omeka_Navigation::PUBLIC_NAVIGATION_MAIN_OPTION_NAME);\n $nav->addPagesFromFilter(Omeka_Navigation::PUBLIC_NAVIGATION_MAIN_FILTER_NAME);\n return $view->navigation()->menu($nav);\n}",
"public function createNavigation() {\n\t \n\t // 1. Gruppen auslesen\n\t\t$groups = array();\n\t\t$items = array();\n\t\n\t $items = $this->applicationHandler->getApplications(array(\n\t \t'groups' => true,\n\t \t'isVisible' => 1\n\t ));\n\n\t // 2. Elemente auslesen und parsen\n\t foreach ($items as $g) {\n\t \t\n\t \t$groupIsEmpty = true;\n\t \t$groupSelected = false;\n\n\t \tforeach ($g['cmtApplications'] as $r) {\n\t\n\t \t\t// Zugriffsrechte prüfen\n\t\t \tif (!$this->user->checkUserAccessRight($r['id'])) {\n\t\t \t\tcontinue;\t\n\t\t \t}\n\t\t \t\n\t\t\t\t// Da ist was drin in der Gruppe!\n\t\t\t\t$groupIsEmpty = false;\n\t\t\t\t$itemSelected = false;\n\t\t\t\t\t\t\n\t\t\t\t// Default-Einstellungen holen, sofern es welche gibt.\n\t\t\t\tif ($r['cmt_type'] == 'table') {\n\t\t\t\t\t$settingsPath = 'app_showtable/';\n\t\t\t\t} else {\n\t\t\t\t\t$a = explode('.', $r['cmt_include']);\n\t\t\t\t\t$settingsPath = $a[0].'/';\n\t\t\t\t\tunset ($a);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t$itemSettings = $r['cmt_tablesettings'];\n\t\t\t\t\n\t\t\t\tif (!isset($itemSettings['icon'])) {\n\t\t\t\t\t$itemSettings['icon'] = 'default';\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tswitch ($itemSettings['icon']) {\n\t\t\t\t\tcase 'otherIcon':\n\t\t\t\t \t$itemIcon = CMT_TEMPLATE.$itemSettings['iconPath'];\n\t\t\t\t \tbreak;\n\t\t\t\t\n\t\t\t\t\tcase 'none':\n\t\t\t\t\t\t$itemIcon = '';\n\t\t\t\t\t\tunset ($itemSettings['iconPath']);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tif (isset($itemSettings['iconPath']) && is_file(CMT_TEMPLATE.$settingsPath.$itemSettings['iconPath'])) {\n\t\t\t\t\t\t\t$itemIcon = CMT_TEMPLATE.$settingsPath.$itemSettings['iconPath'];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$itemIcon = CMT_TEMPLATE.'general/img/'.str_replace('table', $r['cmt_type'], 'cmt_defaulttableicon_16px.png');\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$itemSettings['icon'] = 'default';\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// Das 16px große Icon anzeigen\n\t\t\t\tif (!strstr($itemIcon, 'cmt_default')) {\n\t\t\t\t\t$iconParts = explode('.', (basename($itemIcon)));\n\t\t\t\t\t$itemIcon = dirname($itemIcon).'/'.array_shift($iconParts).'_16px.'.implode('.', $iconParts);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (!is_file($itemIcon)) {\n\t\t\t\t\t$itemIcon = CMT_TEMPLATE.'general/img/'.str_replace('table', $r['cmt_type'], 'cmt_defaulttableicon_16px.png');\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif ($r['id'] == $this->selectedApplicationID) {\n\t\t\t\t\t$itemSelected = true;\n\t\t\t\t\t$groupSelected = true;\n\t\t\t\t\t\n\t\t\t\t} else {\n\t\t\t\t\t$itemSelected = false;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// generate query variables\n\t\t\t\t$queryVars = '';\n\t\t\t\tif ($r['cmt_queryvars']) {\n\t\t\t\t\t$queryVars = str_replace(array(\"\\n\", \"\\r\"), array('&', ''), $r['cmt_queryvars']);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t$parserVars = array(\n\t\t\t\t\t'itemIcon' => $itemIcon,\n\t\t\t\t\t'itemName' => $r['cmt_showname'],\n\t\t\t\t\t'itemId' => $r['id'],\n\t\t\t\t\t'itemSelected' => $itemSelected,\n\t\t\t\t\t'groupSelected' => $groupSelected,\n\t\t\t\t\t'queryVars' => $queryVars\n\t\t\t\t);\n\t\t\t\t\n\t\t\t\t$this->parser->setMultipleParserVars($parserVars);\n\t\t\t\t$groupHtml .= $this->parser->parse($this->itemTemplate);\n\t \t}\n\t \t\n\t \t// Falls was in der Gruppe drin ist, dann anzeigen\n\t \tif (!$groupIsEmpty) {\n\t \t\t\n\t \t\t$groupSettings = $g['cmt_groupsettings'];\n\t \t\t\n\t \t\tif (!is_array($groupSettings)) {\n\t \t\t\t$groupSettings = array();\n\t \t\t}\n\t \t\t\n\t\t\t\t// Icon suchen\n\t\t\t switch ($groupSettings['icon']) {\n\t\t\t \tcase 'otherIcon':\n\t\t\t \t\t$groupIcon = CMT_TEMPLATE.$groupSettings['iconPath'];\n\t\t\t \t\tbreak;\n\t\t\t \t\t\n\t\t\t \tcase 'none':\n\t\t\t \t\t$groupIcon = '';\n\t\t\t \t\tbreak;\n\t\t\t \t\t\n\t\t\t \tdefault:\n\t\t\t \t\tif ($groupSettings['iconPath']) {\n\t\t\t \t\t\t$groupIcon = CMT_TEMPLATE.$groupSettings['iconPath'];\n\t\t\t \t\t} else {\n\t\t\t \t\t\t$groupIcon = CMT_TEMPLATE.'general/img/cmt_defaultgroupicon_32px.png';\n\t\t\t \t\t}\n\t\t\t \t\t$groupSettings['icon'] = 'default';\n\t\t\t \t\tbreak;\n\t\t\t }\n\t\t\t \n\t\t\t // Das 32px große Icon auswählen\n\t\t\t if (!strstr($groupIcon, 'cmt_defaultgroupicon_32px.png') && $groupIcon != '') {\n\t\t\t \t$iconParts = explode('.', (basename($groupIcon)));\n\t\t\t \t$groupIcon = dirname($groupIcon).'/'.array_shift($iconParts).'_32px.'.implode('.', $iconParts);\n\t\t\t }\n\t\t\t \n\t\t\t if ($groupIcon != '' && !is_file($groupIcon)) {\n\t\t\t \t$groupIcon = CMT_TEMPLATE.'general/img/cmt_defaultgroupicon_32px.png';\n\t\t\t }\n\t\t\t \n\t\t\t // Gruppentemplate parsen\n\t\t\t $this->parserVars = array(\n\t\t \t\t'groupIcon' => $groupIcon,\n\t\t\t\t\t'groupName' => $g['cmt_groupname'],\n\t\t\t\t\t'groupId' => $g['id'],\n\t\t\t\t\t'groupHtml' => $groupHtml,\n\t\t \t\t'groupSelected' => $groupSelected\n\t\t\t \t);\n\t\t\t\t\t\t\n\t\t\t $this->parser->SetMultipleParserVars($this->parserVars);\n\t\t\t $navigation .= $this->parser->parse($this->groupTemplate);\n\t\t\t \n\t\t\t unset($groupHtml);\n\t \t}\n\t }\n\t $this->parser->setParserVar('cmtNavigationGroups', $navigation);\t \n\t return $this->parser->parseTemplate('administration/cmt_navigation.tpl');\n\t}",
"public function topMenuNavigation() {\n\t\t$out = '';\n\t\tif($modules = DataObject::get('WorkflowCategory', '', 'priority ASC')) {\n\t\t\tforeach ($modules as $module) {\n\t\t\t\tif (Permission::check(strtoupper(str_replace(\" \", \"_\", $module->name)))) {\n\t\t\t\t\t$icon = '';\n\t\t\t\t\tif($image = DataObject::get_by_id('Image', $module->imageID)) {\n\t\t\t\t\t\tif($smImage = $image->setSize(16,16)) {\n\t\t\t\t\t\t\t$icon = $smImage->URL;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t$out .= \"\n\t\t\t\t\t{\n\t\t\t\t\t\ttext: '{$module->name}', \n\t\t\t\t\t\ticon: '{$icon}',\n\t\t\t\t\t\tmenu: {$this->moduleItems($module->ID)}\n\t\t\t\t\t},\";\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $out;\n\t}",
"protected function generateMenu() {}",
"protected function generateMenu() {}",
"protected function generateMenu() {}",
"protected function generateMenu() {}",
"protected function generateMenu() {}",
"protected function generateMenu() {}",
"public static function navigation(array $navigation = NULL, $user = NULL, $current_controller = NULL)\n\t{\n\t\t$navigation = $navigation ?: Kohana::$config->load('jam-tart.navigation');\n\t\t$user = $user ?: Auth::instance()->get_user();\n\n\t\tif ( ! $current_controller AND Request::initial())\n\t\t{\n\t\t\t$current_controller = Request::initial()->controller();\n\t\t}\n\n\t\treturn Tart::html(NULL, function($h) use ($navigation, $user, $current_controller) {\n\t\t\t$h('div.navbar.navbar-inverse.navbar-fixed-top', function($h) use ($navigation, $user, $current_controller) {\n\t\t\t\t$h('div.navbar-inner', function($h) use ($navigation, $user, $current_controller) {\n\t\t\t\t\t$h('div.container-fluid', function($h) use ($navigation, $user, $current_controller) {\n\t\t\t\t\t\t$h('button', array('class' => 'btn btn-navbar collapsed', 'data-toggle' => 'collapse', 'data-target' => '.nav-collapse'), function($h){\n\t\t\t\t\t\t\t$h('span.icon-bar', ' ');\n\t\t\t\t\t\t\t$h('span.icon-bar', ' ');\n\t\t\t\t\t\t\t$h('span.icon-bar', ' ');\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\t$h('a', array('class' => 'brand', 'href' => Tart::uri()), 'Admin');\n\t\t\t\t\t\t$h('div.nav-collapse.collapse', function($h) use ($navigation, $user, $current_controller) {\n\t\t\t\t\t\t\t$h('ul.nav', function($h) use ($navigation, $user, $current_controller) {\n\t\t\t\t\t\t\t\tforeach ($navigation as $controller => $name)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tif (is_array($name))\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tif (array_filter(array_map(function($controller) use ($user) { return Tart::user_allowed(Tart::uri($controller), $user);}, array_keys($name))))\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t$h('li', array('class' => 'dropdown '.(array_key_exists($current_controller, $name) ? 'active' : '')), function($h) use ($controller, $current_controller, $user, $name) {\n\t\t\t\t\t\t\t\t\t\t\t\t$h('a', array('href' => '#', 'class' => 'dropdown-toggle', 'data-toggle' => 'dropdown'), $controller.' <b class=\"caret\"></b>');\n\n\t\t\t\t\t\t\t\t\t\t\t\t$h('ul.dropdown-menu', function($h) use ($controller, $name, $user, $current_controller) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tforeach ($name as $controller => $name)\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (Tart::user_allowed(Tart::uri($controller), $user))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$h('li', array('class' => ($current_controller === $controller) ? 'active' : NULL), function($h) use ($controller, $name) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$h('a', array('href' => Tart::uri($controller)), $name);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t});\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\telseif (Tart::user_allowed(Tart::uri($controller), $user))\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t$h('li', array('class' => ($current_controller === $controller) ? 'active' : NULL), function($h) use ($controller, $name) {\n\t\t\t\t\t\t\t\t\t\t\t$h('a', array('href' => Tart::uri($controller)), $name);\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\tif ($user)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$h('div.pull-right', function($h) use ($user) {\n\t\t\t\t\t\t\t\t\t$h('ul.nav.pull-right', function($h) use ($user) {\n\t\t\t\t\t\t\t\t\t\t$h('li.dropdown', function($h) use ($user) {\n\t\t\t\t\t\t\t\t\t\t\t$h('a', array('href' => '#', 'class' => 'dropdown-toggle', 'data-toggle' => 'dropdown'), $user->name().' <b class=\"caret\"></b>');\n\n\t\t\t\t\t\t\t\t\t\t\t$h('ul.dropdown-menu', function($h) use ($user) {\n\t\t\t\t\t\t\t\t\t\t\t\t$h('li', function($h) use ($user) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t$h('a', array('href' => Tart::uri($user)), '<i class=\"icon-cog\"></i> Preferences');\n\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t$h('li.divider');\n\t\t\t\t\t\t\t\t\t\t\t\t$h('li', function($h) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t$h('a', array('href' => Tart::uri('session', 'destroy')), '<i class=\"icon-off\"></i> Logout');\n\t\t\t\t\t\t\t\t\t\t\t\t});\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});\n\t\t\t});\n\t\t})->render();\n\t}",
"private function left_menu()\n\t\t{\n\t\t\t $page_name = functions::get_page_name();\n\t\t\techo '\n\t\t\t\t<ul>\n\t\t\t\t\t';\n\t\t\t\t\t\n\t\t\t\t\t$content_module = array('manage_content.php', 'register_content.php', 'manage_page_content.php', 'register_page_content.php','manage_content_option.php', 'register_content_option.php'\n\t\t\t\t\t,'manage_category.php', 'register_category.php');\n\t\t\t\t\tif(in_array($page_name, $content_module))\n\t\t\t\t\t{\n\t\t\t\t\t\techo '\n\t\t\t\t\t\t<li>\n\t\t\t\t\t\t<img src=\"images/icon-content.png\" alt=\"Manage CMS\" title=\"Manage CMS\" width=\"24\" height=\"24\" />\n\t\t\t\t\t\t<a href=\"manage_content.php\">CMS</a>\n\t\t\t\t\t\t<ul>\n\t\t\t\t\t\t<li><a href=\"manage_page_content.php\">Page Content</a></li>\n\t\t\t\t\t\t<li><a href=\"manage_category.php\">Category</a></li>\n\t\t\t\t\t\t\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t</li>';\n\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\techo '<li><img src=\"images/icon-content.png\" alt=\"Manage CMS\" title=\"Manage CMS\" width=\"24\" height=\"24\" /><a href=\"manage_content.php\" >CMS</a></li>';\n\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \n\t\t\t\t\techo '<li><img src=\"images/icon-member.png\" alt=\"Manage Member\" title=\"Manage Member\" width=\"24\" height=\"24\" /><a href=\"manage_member.php\" >Member</a></li>\n\t\t\t\t\t<!--<li><img src=\"images/icon-property.png\" alt=\"Manage Property Type\" title=\"Manage Property Type\" width=\"24\" height=\"24\" /><a href=\"manage_property_type.php\" >Property Type</a></li>-->\n\t\t\t\t\t\n\t\t\t\t\t<li><img src=\"images/icon-property.png\" alt=\"Manage Hotel\" title=\"Manage Hotel\" width=\"24\" height=\"24\" /><a href=\"manage_hotel.php\" >Hotel</a></li>\n\t\t\t\t\t<li><img src=\"images/icon-restaurant.jpg\" alt=\"Manage Restaurant\" title=\"Manage Restaurant\" width=\"24\" height=\"24\" /><a href=\"manage_restaurant.php\" >Restaurant</a></li>\n\t\t\t\t\t<li><img src=\"images/icon-venue.png\" alt=\"Manage Venue\" title=\"Manage Venue\" width=\"24\" height=\"24\" /><a href=\"manage_venue.php\" >Venue</a></li>\n\t\t\t\t\t';\n\t\t\t\t\t\t\n\t\techo '</ul>';\n\t\t\t\t\t\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\t\n\t\t}",
"function renderNavigation(array $array)\n {\n $html = '';\n\n foreach ( $array as $item=>$attributes){\n\n // Set the title of the navigation point\n $title = (isset($attributes['title']) ? $attributes['title'] : $item );\n\n // if a icon is passed to the array a icon tag will be created\n $icon = (isset($attributes['icon']) ? sprintf('<i class=\"%s\"></i>',$attributes['icon']) : null );\n // pass together the whole anchor tag\n $anchor = sprintf('<a href=\"%s\">%s%s</a>',$attributes['url'],$icon,$title);\n\n // Check if there is a submenu. If Yes, run that itself through this macro\n $submenu = (isset($attributes['sub-menu']) ? sprintf('<ul class=\"sub-menu\">%s</ul>',renderNavigation($attributes['sub-menu'])) : null );\n\n // Check for the current URL if it matches any Anchors\n $class = '';\n if(strstr(Request::fullUrl(),$attributes['url']))\n $class = 'class=\"on\"';\n\n // and wrap it into the listitem\n $html .= sprintf('<li %s>%s%s</li>',$class,$anchor,$submenu);\n\n }\n\n // Pass back the entire navigation list\n return $html;\n }"
] |
[
"0.7305105",
"0.67850035",
"0.6637389",
"0.66160345",
"0.6464492",
"0.6399221",
"0.63659745",
"0.63345915",
"0.63326687",
"0.6292554",
"0.6261929",
"0.62212855",
"0.61710054",
"0.61477906",
"0.61224926",
"0.60922724",
"0.6067675",
"0.60470074",
"0.6036356",
"0.5949508",
"0.5945477",
"0.59321994",
"0.59321994",
"0.59321994",
"0.59321994",
"0.59321994",
"0.59321994",
"0.5911671",
"0.59074086",
"0.5898747"
] |
0.7843991
|
0
|
Add fields to Edit taxonomy term screen.
|
public function edit_taxonomy_fields( $term ) {
$template_file = $this->media->plugin->template_path . 'taxonomy-term-transformation-fields.php';
if ( file_exists( $template_file ) ) {
include $template_file; // phpcs:ignore
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function bdpp_edit_taxonomy_field($term){\n\t\tinclude_once( BDPP_DIR . '/includes/admin/taxonomy/edit-form.php' );\n\t}",
"public function edit_screen_fields( $term, $taxonomy ) {\n\t\t$doc_vicar_forane = get_term_meta( $term->term_id, 'doc_vicar_forane', true );\n\n\t\t// Form fields.\n\t\techo '<tr class=\"form-field term-doc_vicar_forane-wrap\">';\n\t\techo '<th scope=\"row\">';\n\t\techo '\t<label for=\"doc_vicar_forane\">' . __( 'Vicar Forane', 'doc' ) . '</label>';\n\t\techo '</th>';\n\t\techo '<td>';\n\t\techo '\t<input type=\"text\" id=\"doc_vicar_forane\" name=\"doc_vicar_forane\" value=\"' . esc_attr( $doc_vicar_forane ) . '\">';\n\t\techo '</td>';\n\t\techo '</tr>';\n\n\t}",
"public function render_edit_fields( $term, $taxonomy ) {\n\n\t\t\t$format = '<tr class=\"form-field cherry-term-meta-wrap\"><th> </th><td>%s</td></tr>';\n\t\t\techo $this->get_fields( $term, $taxonomy, $format );\n\t\t}",
"function glbs_edit_extra_tax_fields( $term ) { //check for existing featured ID\n\t$id = $term->term_id;\n\t\n\t$title = get_term_meta( $id, 'basic_seo_title', true );\n\t$key = get_term_meta( $id, 'basic_seo_keywords', true );\n\t$desc = get_term_meta( $id, 'basic_seo_description', true );\n\t?>\n\t<?php wp_nonce_field( '_glbs_nonce_tax', 'glbs_nonce_tax' ); ?>\n\t<table class=\"form-table\">\n\t\t<tr class=\"form-field\">\n\t\t\t<th scope=\"row\"><label for=\"basic_seo_title\"><?php _e( 'SEO Title', 'glbs' ); ?></label></th>\n\t\t\t<td>\n\t\t\t\t<input class=\"large-text\" type=\"text\" name=\"basic_seo_title\" id=\"basic_seo_title\" value=\"<?php echo $title ? $title : ''; ?>\"><br/>\n\t\t\t\t<span class=\"description\">Leave empty to use default title</span>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class=\"form-field\">\n\t\t\t<th scope=\"row\"><label for=\"basic_seo_keywords\"><?php _e( 'SEO Keywords', 'glbs' ); ?></label></th>\n\t\t\t<td>\n\t\t\t\t<input class=\"large-text\" type=\"text\" name=\"basic_seo_keywords\" id=\"basic_seo_keywords\" value=\"<?php echo $key ? $key : ''; ?>\"><br/>\n\t\t\t\t<span class=\"description\">Enter the list of keywords separated by comma</span>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class=\"form-field\">\n\t\t\t<th scope=\"row\"><label for=\"basic_seo_description\"><?php _e( 'SEO Description', 'glbs' ); ?></label></th>\n\t\t\t<td>\n\t\t\t\t<textarea class=\"large-text\" name=\"basic_seo_description\" id=\"basic_seo_description\" rows=\"5\"><?php echo $desc ? $desc : ''; ?></textarea><br/>\n\t\t\t\t<span class=\"description\">Enter meta description for this Term</span>\n\t\t\t</td>\n\t\t</tr>\n\t</table>\n\t<?php\n}",
"function gcd_tax_edit_meta_field($term) {\r\n $t_id = $term->term_id;\r\n \r\n // retrieve the existing value(s) for this meta field. This returns an array\r\n $term_meta = get_option( \"taxonomy_$t_id\" ); ?>\r\n <tr class=\"form-field\">\r\n <th scope=\"row\" valign=\"top\"><label for=\"term_meta[featured]\"><?php _e( 'Featured ?', '' ); ?></label></th>\r\n <td>\r\n <input type=\"text\" name=\"term_meta[featured]\" id=\"term_meta[featured]\" value=\"<?php echo esc_attr( $term_meta['featured'] ) ? esc_attr( $term_meta['featured'] ) : ''; ?>\">\r\n <p class=\"description\"><?php _e( 'Type 1 if you want to list category as featured','' ); ?></p>\r\n </td>\r\n </tr>\r\n <tr class=\"form-field\">\r\n <th scope=\"row\" valign=\"top\"><label for=\"term_meta[subtitle]\"><?php _e( 'Subtitle', '' ); ?></label></th>\r\n <td>\r\n <input type=\"text\" name=\"term_meta[subtitle]\" id=\"term_meta[subtitle]\" value=\"<?php echo esc_attr( $term_meta['subtitle'] ) ? esc_attr( $term_meta['subtitle'] ) : ''; ?>\">\r\n <p class=\"description\"><?php _e( 'Subtitle for your project','' ); ?></p>\r\n </td>\r\n </tr>\r\n<?php\r\n}",
"public function edit(Term $term)\n {\n //\n }",
"public function edit(Term $term)\n {\n //\n }",
"function glbs_add_extra_tax_fields( $term ) {\n\t$id = $term->term_id;\n\t\n\t$title = get_term_meta( $id, 'basic_seo_title', true );\n\t$key = get_term_meta( $id, 'basic_seo_keywords', true );\n\t$desc = get_term_meta( $id, 'basic_seo_description', true );\n\t?>\n\t<?php wp_nonce_field( '_glbs_nonce_tax', 'glbs_nonce_tax' ); ?>\n\t<div class=\"form-field\">\n\t\t<label for=\"basic_seo_title\"><?php _e( 'SEO Title', 'glbs' ); ?></label>\n\t\t<input class=\"large-text\" type=\"text\" name=\"basic_seo_title\" id=\"basic_seo_title\" value=\"<?php echo $title ? $title : ''; ?>\"><br>\n\t\t<span class=\"description\">Leave empty to use default title</span>\n\t</div>\n\t<div class=\"form-field\">\n\t\t<label for=\"basic_seo_keywords\"><?php _e( 'SEO Keywords', 'glbs' ); ?></label>\n\t\t<input class=\"large-text\" type=\"text\" name=\"basic_seo_keywords\" id=\"basic_seo_keywords\" value=\"<?php echo $key ? $key : ''; ?>\"><br>\n\t\t<span class=\"description\">Enter the list of keywords separated by comma</span>\n\t</div>\n\t<div class=\"form-field\">\n\t\t<label for=\"basic_seo_description\"><?php _e( 'SEO Description', 'glbs' ); ?></label>\n\t\t<textarea class=\"large-text\" name=\"basic_seo_description\" id=\"basic_seo_description\" rows=\"5\"><?php echo $desc ? $desc : ''; ?></textarea><br>\n\t\t<span class=\"description\">Enter meta description for this Term</span>\n\t</div>\n\t<?php\n}",
"function gcd_tax_add_new_meta_field() {\r\n ?>\r\n <div class=\"form-field\">\r\n <label for=\"term_meta[featured]\"><?php _e( 'Featured ?', '' ); ?></label>\r\n <input type=\"text\" name=\"term_meta[featured]\" id=\"term_meta[featured]\" value=\"\">\r\n <p class=\"description\"><?php _e( 'Type 1 if you want to list category as featured','' ); ?></p>\r\n </div>\r\n\r\n <div class=\"form-field\">\r\n <label for=\"term_meta[subtitle]\"><?php _e( 'Subtitle', '' ); ?></label>\r\n <input type=\"text\" name=\"term_meta[subtitle]\" id=\"term_meta[subtitle]\" value=\"\">\r\n <p class=\"description\"><?php _e( 'Subtitle for your group','' ); ?></p>\r\n <div>\r\n<?php\r\n}",
"function save_extra_taxonomy_fields($term_id)\n\n {\n\n if (isset($_POST['term_meta'])) {\n\n $t_id = $term_id;\n\n $term_meta = get_option(\"taxonomy_$t_id\");\n\n $cat_keys = array_keys($_POST['term_meta']);\n\n foreach ($cat_keys as $key) {\n\n if (isset($_POST['term_meta'][$key])) {\n\n $term_meta[$key] = $_POST['term_meta'][$key];\n\n }\n\n }\n\n update_option(\"taxonomy_$t_id\", $term_meta);\n\n }\n\n }",
"public static function register_term_object_fields()\n {\n }",
"public function renderTaxonomyEdit(\\WP_Term $term, string $fieldId, string $value = null): void\n {\n // wrapper begin\n echo '<tr class=\"form-field term-' . $fieldId . '-wrap\">';\n\n // header area (\"left side\")\n echo '<th scope=\"row\">';\n // label\n $this->renderLabel($fieldId);\n echo '</th>';\n\n // input area (\"right side\")\n echo '<td>';\n // the actual input field\n $this->renderField($term, $fieldId, $value);\n // optional description/usage hint\n $this->renderDescription($fieldId, 'description');\n // other… e.g. Javascript\n $this->renderAnythingAfterField($term, $fieldId, $value);\n echo '</td>';\n\n // wrapper end\n echo '</tr>';\n }",
"function get_edit_term_link($term, $taxonomy = '', $object_type = '')\n {\n }",
"public function render_field_edit( $term, $taxonomy ) {\n\t\t$editor_settings = $this->get_editor_settings();\n\t\tif ( empty( $editor_settings ) || ! is_array( $editor_settings ) ) {\n\t\t\treturn;\n\t\t}\n\t?>\n\t\t<tr>\n\t\t\t<th scope=\"row\" valign=\"top\"><label for=\"description\"><?php _e( 'Description', APP_TD ); ?></label></th>\n\t\t\t<td><?php wp_editor( htmlspecialchars_decode( $term->description ), 'html-description', $editor_settings ); ?>\n\t\t\t<span class=\"description\"><?php _e( 'The description is not prominent by default, however some themes may show it.', APP_TD ); ?></span></td>\n\t\t\t<script type=\"text/javascript\">\n\t\t\t\t// Remove the non-html field\n\t\t\t\tjQuery( 'textarea#description' ).closest( '.form-field' ).remove();\n\t\t\t</script>\n\t\t</tr>\n\t\t<?php\n\t}",
"public function set_term_custom_fields($term_id, $fields)\n {\n }",
"function addExtraCategoryFields_editForm($tag) {\n\t\t$this->addExtraCategoryFields($tag, true);\n\t}",
"public function add_taxonomy_fields() {\n\t\t$template_file = $this->media->plugin->template_path . 'taxonomy-transformation-fields.php';\n\t\tif ( file_exists( $template_file ) ) {\n\t\t\tinclude $template_file; // phpcs:ignore\n\t\t}\n\t}",
"function specialities_taxonomy_custom_fields($tag) {\n // Check for existing taxonomy meta for the term you're editing\n $t_id = $tag->term_id; // Get the ID of the term you're editing\n $term_meta = get_option( \"taxonomy_term_$t_id\" ); // Do the check\n\t?>\n\n\t<tr class=\"form-field\">\n\t\t<th scope=\"row\" valign=\"top\">\n\t\t\t<label for=\"s_keyword\"><?php _e('Search Keyword'); ?></label>\n\t\t</th>\n\t\t<td>\n\t\t\t<input type=\"text\" name=\"term_meta[s_keyword]\" id=\"term_meta[s_keyword]\" size=\"25\" style=\"width:60%;\" value=\"<?php echo $term_meta['s_keyword'] ? $term_meta['s_keyword'] : ''; ?>\" data-role=\"tagsinput\"><br />\n\t\t\t<span class=\"description\"><?php _e('Search Keyword description'); ?></span>\n\t\t</td>\n\t</tr>\n\n\t<?php\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 am2_vanity_add_taxonomy_fields( $term ) { //check for existing featured ID\n $t_id = $term->term_id;\n $vanity_urls = get_option('am2_vanity_urls');\n\t$value = '';\n\tif(!empty($vanity_urls[$_REQUEST['taxonomy'].\"_\".$term->term_id]['url'])){\n\t\t$value = $vanity_urls[$_REQUEST['taxonomy'].\"_\".$term->term_id]['url'];\n\t}\n?>\n<tr class=\"form-field\">\n\t<th scope=\"row\" valign=\"top\"><label for=\"_am2_vanity_url\"><?php _e('Vanity URL'); ?></label></th>\n\t<td>\n \t<?php echo site_url().'/'; ?>\n\t\t<input type=\"hidden\" name=\"_am2_vanity_term_name\" value=\"<?php echo $_REQUEST['taxonomy']; ?>\" />\n <input type=\"text\" name=\"_am2_vanity_url\" id=\"_am2_vanity_url\" placeholder=\"any-url\" size=\"3\" style=\"width:60%;\" value=\"<?php echo $value; ?>\"><br />\n <span class=\"description\"><?php _e('This URL will replace the dafault category URL with new one.'); ?></span>\n </td>\n</tr>\n<?php\n}",
"public function bamobile_edit_taxonomy_field($taxonomy){\r\n echo $this->bamobile_taxonomy_field('mobiconnector-edit-field-category', $taxonomy);\r\n }",
"function external_url_taxonomy_add_new_meta_field() {\n ?>\n <div class=\"form-field\">\n <label for=\"term_meta[custom_term_meta]\"><?php _e( 'External URL:', 'external_url' ); ?></label>\n <input type=\"text\" name=\"term_meta[custom_term_meta]\" id=\"term_meta[custom_term_meta]\" value=\"\">\n <p class=\"description\"><?php _e( 'Enter a value for this field','external_url' ); ?></p>\n </div>\n<?php\n}",
"function acf_upgrade_550_termmeta()\n{\n}",
"public function edit($id)\n {\n $taxonomy = TermTaxonomy::find($id);\n return view('admin.term.edit',\n [\n 'taxonomy' => $taxonomy,\n 'termTaxonomies' => $this->getAllTaxonomies(),\n ]\n );\n }",
"function glbs_save_extra_tax_fileds( $term_id ) {\n\tif ( ! isset( $_POST['glbs_nonce_tax'] ) || ! wp_verify_nonce( $_POST['glbs_nonce_tax'], '_glbs_nonce_tax' ) ) {\n\t\treturn;\n\t}\n\t\n\tif ( isset( $_POST['basic_seo_title'] ) ) {\n\t\tupdate_term_meta( $term_id, 'basic_seo_title', esc_attr( $_POST['basic_seo_title'] ) );\n\t}\n\tif ( isset( $_POST['basic_seo_keywords'] ) ) {\n\t\tupdate_term_meta( $term_id, 'basic_seo_keywords', esc_attr( $_POST['basic_seo_keywords'] ) );\n\t}\n\tif ( isset( $_POST['basic_seo_description'] ) ) {\n\t\tupdate_term_meta( $term_id, 'basic_seo_description', esc_attr( $_POST['basic_seo_description'] ) );\n\t}\n}",
"public function get_term_custom_fields($term_id)\n {\n }",
"function bdpp_add_taxonomy_field( $taxonomy ) {\n\t\tinclude_once( BDPP_DIR . '/includes/admin/taxonomy/add-form.php' );\n\t}",
"function classiera_save_location_fields( $term_id ) { \r\n\t\tif ( isset( $_POST['term_meta'] ) ) { \r\n\t\t\t$t_id = $term_id; \r\n\t\t\t$term_meta = get_option( \"taxonomy_term_$t_id\" ); \r\n\t\t\t$cat_keys = array_keys( $_POST['term_meta'] ); \r\n\t\t\t\tforeach ( $cat_keys as $key ){ \r\n\t\t\t\tif ( isset( $_POST['term_meta'][$key] ) ){ \r\n\t\t\t\t\t$term_meta[$key] = $_POST['term_meta'][$key]; \r\n\t\t\t\t} \r\n\t\t\t} \r\n\t\t\t//save the option array \r\n\t\t\tupdate_option( \"taxonomy_term_$t_id\", $term_meta ); \r\n\t\t} \r\n\t}",
"public function saveFields( $term_id ) \n\t{\n\t\tif ( isset( $_POST[self::CUSTOM_FIELDS_PREFIX] ) ) {\t\t\t\t\n\t\t\t$meta_data = $_POST[self::CUSTOM_FIELDS_PREFIX];\n\t\t\t$term_meta = get_option( sprintf( '%s_%d', $this->taxomomyStr, $term_id ) );\t\t\t\t\n\t\t\t$field_names = array_keys( $meta_data );\n\t\t\t\t\n\t\t\tforeach ( $field_names as $name ) {\n\t\t\t\tif ( isset ( $meta_data[$name] ) ) {\t\t\t\t\t\t\n\t\t\t\t\t$data = $meta_data[$name];\n\t\t\t\t\t\t\n\t\t\t\t\tif( is_string( $var ) ) {\n\t\t\t\t\t\t$data = wp_unslash( $data );\n\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t$term_meta[$name] = $data;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\t\n\t\t\t// save the option array.\n\t\t\tupdate_option( sprintf( '%s_%d', $this->taxomomyStr, $term_id ), $term_meta );\n\t\t}\n\t}",
"function t_add_texonomy_field() {\n echo '<div class=\"form-field\">\n\t\t<label for=\"taxonomy_displayorder\">' . __('Display Order', 'zci') . '</label>\n\t\t<input type=\"text\" name=\"taxonomy_displayorder\" id=\"taxonomy_displayorder\" value=\"1\" />\n\t</div>';\n}"
] |
[
"0.74985325",
"0.72452503",
"0.72088474",
"0.7183759",
"0.70884484",
"0.6951727",
"0.6951727",
"0.6702951",
"0.6641194",
"0.6519398",
"0.6448476",
"0.6406624",
"0.63754696",
"0.6302986",
"0.62290657",
"0.6180432",
"0.6159408",
"0.6135861",
"0.60828745",
"0.6068833",
"0.6058766",
"0.605649",
"0.6034228",
"0.602653",
"0.6008651",
"0.5991197",
"0.59670436",
"0.5922212",
"0.5916473",
"0.5916215"
] |
0.7538446
|
0
|
Get the transformations of a posts taxonomies.
|
public function get_taxonomy_transformations( $type ) {
$return_transformations = '';
if ( in_the_loop() ) {
$post = get_post();
if ( ! empty( $post ) ) {
$transformations = array();
$terms = $this->get_terms( $post->ID );
if ( ! empty( $terms ) ) {
foreach ( $terms as $item ) {
$transformation = $this->get_term_transformations( $item['term']->term_id, $type );
if ( ! empty( $transformation[ $type . '_freeform' ] ) ) {
$transformations[] = trim( $transformation[ $type . '_freeform' ] );
}
}
// Join the freeform.
$return_transformations = implode( '/', (array) $transformations );
}
}
}
return $return_transformations;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function get_post_taxonomies($post = 0)\n {\n }",
"protected function get_taxonomies() {\n\t\treturn apply_filters( 'appthemes_html_term_description_taxonomies', $this->taxonomies );\n\t}",
"public function get_property_taxonomies_translation($taxonomies){\n $terms_package = array(\n 'kind' => 'Property Term',\n 'name' => 'custom-term',\n 'title' => 'Property Term',\n );\n \n foreach( $taxonomies as $key => $tax ){\n $taxonomies[$key]['label'] = apply_filters( 'wpml_translate_string', $key,$key, $terms_package );\n }\n return $taxonomies;\n }",
"function acf_get_taxonomies_for_post_type($post_types = 'post')\n{\n}",
"public function getTransformer();",
"function get_custom_taxonomies( $post_identity ) {\r\n\r\n // Get the post by ID\r\n $post = get_post( $post_identity );\r\n\r\n // Get the post type\r\n $post_type = $post->post_type;\r\n\r\n // Get taxonomies related to the post type\r\n $taxonomies = get_object_taxonomies( $post_type, 'objects' );\r\n\r\n $out = array();\r\n // Loop through taxonomies and put the terms in an array\r\n foreach ( $taxonomies as $taxonomy_slug => $taxonomy ) {\r\n\r\n $terms = get_the_terms( $post_identity, $taxonomy_slug );\r\n //var_dump($terms); die;\r\n\r\n if ( !empty( $terms ) ) {\r\n \r\n foreach ( $terms as $term ) {\r\n $out[] .= $term->name;\r\n }\r\n }\r\n }\r\n\r\n return $out;\r\n }",
"static public function taxonomies( $post_type ) {\n\t\t$taxonomies = get_object_taxonomies( $post_type, 'objects' );\n\t\t$data\t\t= array();\n\n\t\tforeach ( $taxonomies as $tax_slug => $tax ) {\n\n\t\t\tif ( ! $tax->public || ! $tax->show_ui ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$data[ $tax_slug ] = $tax;\n\t\t}\n\n\t\treturn apply_filters( 'fl_builder_loop_taxonomies', $data, $taxonomies, $post_type );\n\t}",
"public function getTransformations()\n {\n return $this->transformations;\n }",
"function _post_format_get_terms($terms, $taxonomies, $args)\n {\n }",
"function get_taxonomy_rewrite_tags( $taxonomies = null, $post_link = '' )\n{\n $post = null;\n\n if ( null === $taxonomies ) {\n $taxonomies = get_taxonomies();\n } elseif ( $taxonomies instanceof WP_Post ) {\n $post = $taxonomies;\n $taxonomies = get_object_taxonomies( $post->post_type );\n } elseif ( ! is_array( $taxonomies ) ) {\n $taxonomies = [];\n }\n\n $tags = [];\n foreach ( $taxonomies as $taxonomy ) {\n $tax = \"%{$taxonomy}%\";\n $term = '';\n\n $taxonomy_object = get_taxonomy( $taxonomy );\n if ( strpos($post_link, $tax) !== false ) {\n $terms = get_the_terms( $post->ID, $taxonomy );\n\n if ( $terms ) {\n usort($terms, '_usort_terms_by_ID');\n $term = $terms[0]->slug;\n if ( $taxonomy_object->hierarchical && $parent = $terms[0]->parent ) {\n $term = get_term_parents($parent, $taxonomy, false, '/', true) . $term;\n }\n }\n\n /** Show default category in permalinks, without having to assign it explicitly */\n if ( empty( $term ) && $taxonomy === 'category' ) {\n $default_category = get_category( get_option( 'default_category' ) );\n $term = ( is_wp_error( $default_category ) ? '' : $default_category->slug );\n }\n }\n\n $tags[$tax] = $term;\n }\n\n /**\n * Filter taxonomy rewrite tags.\n *\n * @param array $tags The rewrite tags.\n * @param string $post_link A post permalink to resolve from.\n */\n $tags = apply_filters( 'rewrite_tags/taxonomy', $tags, $post_link );\n\n if ( $post instanceof WP_Post ) {\n $post_type = $post->post_type;\n\n /**\n * Filter taxonomy rewrite tags for a specific post type.\n *\n * @param array $tags The rewrite tags.\n * @param string $post_link A post permalink to resolve from.\n * @param WP_Post $post The post to resolve from.\n */\n $tags = apply_filters( \"rewrite_tags_for_{$post_type}/taxonomy\", $tags, $post_link, $post );\n }\n\n return $tags;\n}",
"public function getTaxonomyTerms();",
"function acf_get_pretty_taxonomies($taxonomies = array())\n{\n}",
"function acf_get_taxonomy_terms($taxonomies = array())\n{\n}",
"public function getTaxonomy()\n {\n return $this->taxonomy;\n }",
"function get_attachment_taxonomies($attachment, $output = 'names')\n {\n }",
"public function getTaxonomies(): array\n {\n return $this->taxonomies;\n }",
"private function get_taxonomies() : array {\n\t\treturn $this->taxonomies;\n\t}",
"function acf_get_taxonomy_labels($taxonomies = array())\n{\n}",
"public function setTaxonomies() {\n // ## TAXONOMIES ##\n $args = array(\n // ## Fields ##\n array(\n 'taxonomy' => self::TAX_FIELDS,\n 'object_type' => array(self::POST_TYPE_BADGES),\n 'args' => array(\n 'labels' => array(\n 'name' => _x('Fields of education', 'taxonomy general name'),\n 'singular_name' => _x('Field of education', 'taxonomy singular name'),\n 'search_items' => __('Search Fields of education'),\n 'all_items' => __('All Fields of education'),\n 'parent_item' => __('Parent Field'),\n 'parent_item_colon' => __('Parent Field:'),\n 'edit_item' => __('Edit Field'),\n 'update_item' => __('Update Field'),\n 'add_new_item' => __('Add New Field'),\n 'new_item_name' => __('New Field Name'),\n 'menu_name' => __('Field of Education'),\n ),\n 'rewrite' => array('slug' => self::TAX_FIELDS),\n 'hierarchical' => true,\n 'show_ui' => true,\n 'show_admin_column' => true,\n 'query_var' => true\n )\n ),\n // ## Levels ##\n array(\n 'taxonomy' => self::TAX_LEVELS,\n 'object_type' => self::POST_TYPE_BADGES,\n 'args' => array(\n 'labels' => array(\n 'name' => _x('Levels', 'taxonomy general name'),\n 'singular_name' => _x('Levels', 'taxonomy singular name'),\n 'search_items' => __('Search Levels'),\n 'all_items' => __('All Levels'),\n 'parent_item' => __('Parent Level'),\n 'parent_item_colon' => __('Parent Level:'),\n 'edit_item' => __('Edit Level'),\n 'update_item' => __('Update Level'),\n 'add_new_item' => __('Add New Level'),\n 'new_item_name' => __('New Level Name'),\n 'menu_name' => __('Level of Education'),\n ),\n 'rewrite' => array('slug' => self::TAX_LEVELS),\n 'hierarchical' => false,\n 'show_ui' => true,\n 'show_admin_column' => true,\n 'query_var' => true\n )\n ),\n );\n\n $this->settings->loadTaxonomies($args);\n }",
"function acf_get_taxonomies($args = array())\n{\n}",
"public function getTransformer()\n {\n return new CategoryTransformer();\n }",
"public function daam_get_taxonomies()\n {\n\n //check the referer\n if ( ! check_ajax_referer('daam', 'security', false)) {\n echo \"Invalid AJAX Request\";\n die();\n }\n\n //check the capability\n if ( ! current_user_can(get_option($this->shared->get('slug') . \"_capabilities_term_groups_menu\"))) {\n esc_attr('Invalid Capability', 'daam');\n die();\n }\n\n //get the data\n $post_type = addslashes($_POST['post_type']);\n\n $taxonomies = get_object_taxonomies($post_type);\n\n $taxonomy_obj_a = array();\n if (is_array($taxonomies) and count($taxonomies) > 0) {\n foreach ($taxonomies as $key => $taxonomy) {\n $taxonomy_obj_a[] = get_taxonomy($taxonomy);\n }\n }\n\n echo json_encode($taxonomy_obj_a);\n die();\n\n }",
"function get_term_attach_post($post){\n\t$taxonomy = get_post_taxonomies( $post );\n\t$terms = get_the_terms( $post, $taxonomy );\n\treturn $terms;\n}",
"public function get_taxonomies()\n {\n $terms = get_terms(array(\n 'hide_empty' => false\n ));\n\n return $terms;\n }",
"public function taxonomies()\n {\n return $this->hasMany('Darryldecode\\Backend\\Components\\ContentBuilder\\Models\\ContentTypeTaxonomy','content_type_id');\n }",
"public function getTaxonomiesList() {\n return $this->_get(1);\n }",
"public function tags()\n {\n $new = $this->postterms->filter(function($term)\n {\n return $term->termtaxonomy->taxonomy == 'post_tag';\n });\n\n return $new->map(function($term)\n {\n return $term->termtaxonomy->term; \n });\n }",
"public function addTaxonomies() {\n foreach (self::getPostTypes() as $post_type) {\n register_rest_field($post_type, 'taxonomies', [\n 'get_callback' => function ($post) use ($post_type) {\n return self::getTermSchema($post_type, $post);\n },\n ]);\n }\n }",
"function getTransformers()\n {\n return $this->getTransformerContainer()->getTransformers();\n }",
"private function WP_Post_taxonomies($graph, $post) {\r\n $taxonomy_names = get_object_taxonomies( $post->post_type );\r\n foreach ( $taxonomy_names as $taxonomy_name ) {\r\n $terms = wp_get_post_terms($post->ID, $taxonomy_name);\r\n foreach ( $terms as $term ) {\r\n $post_resource = $graph->resource($post->guid);\r\n $post_resource->add('sioc:topic', $graph->resource(get_term_link( $term)));\r\n $taxonomy_resource = $graph->resource(get_term_link( $term));\r\n $taxonomy_resource->set('rdfs:seeAlso', $graph->resource($this->return_seeAlso_resource(get_term_link($term))));\r\n }\r\n }\r\n return $graph;\r\n }"
] |
[
"0.61587244",
"0.601891",
"0.59312177",
"0.58796275",
"0.5698192",
"0.5696998",
"0.5645848",
"0.5624387",
"0.5606456",
"0.54836756",
"0.5482019",
"0.5456188",
"0.5397657",
"0.53388333",
"0.5332151",
"0.530243",
"0.5283578",
"0.5280874",
"0.52555394",
"0.52364314",
"0.5222494",
"0.5203499",
"0.5177962",
"0.51504564",
"0.51487094",
"0.5141238",
"0.51341623",
"0.5124634",
"0.512084",
"0.5118536"
] |
0.6310316
|
0
|
Check if the image has a post taxonomy overwrite.
|
public function is_taxonomy_overwrite() {
$apply_type = false;
if ( in_the_loop() ) {
$post = get_post();
$apply_type = get_post_meta( $post->ID, self::META_APPLY_KEY . '_terms', true );
}
return ! empty( $apply_type );
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function hasTaxonomy() {\n return $this->_has(1);\n }",
"public function hasTaxonomy() {\n return $this->_has(1);\n }",
"function is_movie_taxonomy() {\n return is_tax( get_object_taxonomies( 'movie' ) );\n }",
"public static function add_notice_if_publish_failed_due_to_missing_taxonomies() {\n\t\tglobal $post;\n\n\t\t$meta_key = Posts::META_KEY_MISSING_TAXONOMIES;\n\n\t\tif ( isset( $post->ID ) ) {\n\t\t\t$missing_taxonomies = get_post_meta( $post->ID, $meta_key, true );\n\n\t\t\tif ( $missing_taxonomies ) {\n\t\t\t\techo '<div class=\"notice notice-error is-dismissible notice-missing-taxonomies\"><p>';\n\t\t\t\tprintf(\n\t\t\t\t\t__( '<strong>Error:</strong> Photo was not published because the following taxonomies are missing terms: %s', 'wporg-photos' ),\n\t\t\t\t\t'<strong>' . implode( '</strong>, <strong>', $missing_taxonomies ) . '</strong>'\n\t\t\t\t);\n\n\t\t\t\techo '</p></div>' . \"\\n\";\n\t\t\t\tdelete_post_meta( $post->ID, $meta_key );\n\t\t\t}\n\t\t}\n\t}",
"function hasMeta() {\n return $this->imageMeta->hasMeta();\n }",
"function is_taxonomy($taxonomy)\n {\n }",
"function is_video_taxonomy() {\n return is_tax( get_object_taxonomies( 'video' ) );\n }",
"function is_object_in_taxonomy($object_type, $taxonomy)\n {\n }",
"function has_term($term = '', $taxonomy = '', $post = \\null)\n {\n }",
"function checkImg(){\n global $postpath;\n return getimagesize($postpath) !== false;\n }",
"function taxonomy_exists( $taxonomy ) {\n\t\tif ( function_exists( 'taxonomy_exists' ) ) { // 3.0 or later\n\t\t\treturn taxonomy_exists( $taxonomy );\n\t\t} else {\n\t\t\treturn is_taxonomy( $taxonomy );\n\t\t}\n\t}",
"function acf_isset_termmeta($taxonomy = '')\n{\n}",
"function rfi_should_stop_post_publishing( $post ) {\n $is_watched_post_type = rfi_is_supported_post_type( $post );\n $is_after_enforcement_time = rfi_is_in_enforcement_window( $post );\n $large_enough_image_attached = rfi_post_has_large_enough_image_attached( $post );\n\n if ( $is_after_enforcement_time && $is_watched_post_type ) {\n return !$large_enough_image_attached;\n }\n return false;\n}",
"public function hasTaxonomies() {\n return $this->_has(1);\n }",
"public function register(): bool {\n\t\tif ( ! taxonomy_exists( static::NAME ) ) {\n\t\t\t$taxonomy = register_taxonomy(\n\t\t\t\tstatic::NAME,\n\t\t\t\t$this->get_object_types(),\n\t\t\t\t$this->get_args()\n\t\t\t);\n\t\t\treturn ! is_wp_error( $taxonomy );\n\t\t}\n\n\t\treturn true;\n\t}",
"public function exists()\n {\n if (get_post($this->id)) {\n return true;\n }\n\n return false;\n }",
"function is_taxonomy_viewable($taxonomy)\n {\n }",
"public function hasAugmentedFile() : bool\n {\n $productId = $this->getProduct()->getId();\n return (count($this->augmentedRealityRepo->getArByProduct($productId)) > 0);\n }",
"function wp_is_post_autosave($post)\n {\n }",
"protected function check_is_taxonomy_allowed($taxonomy)\n {\n }",
"public function has_public_taxonomies( $post ) {\n\t\t$taxonomies = get_object_taxonomies( $post, 'objects' );\n\t\t// Only get taxonomies that have a UI.\n\t\t$taxonomies = array_filter(\n\t\t\t$taxonomies,\n\t\t\tfunction ( $tax ) {\n\t\t\t\treturn $tax->show_ui;\n\t\t\t}\n\t\t);\n\n\t\treturn ! empty( $taxonomies );\n\t}",
"function barjeel_post_thumbnail_check() {\n global $post;\n if (get_the_post_thumbnail()) {\n return true; }\n else { return false; }\n}",
"public function has_image() {\r\n return ! empty( $this->image );\r\n }",
"private function does_publication_exist() : bool {\n\t\t$publication = get_term( $this->publication, 'publication' );\n\n\t\tif ( ! $publication || is_wp_error( $publication ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t$this->publication_term = $publication;\n\n\t\treturn true;\n\t}",
"function has_term_meta($term_id)\n {\n }",
"private function _hasPostContents($input)\n {\n return isset($_FILES[$input]) || isset($_POST[$input]);\n }",
"function bootstrapwp_is_post_thumbnail_set()\n{\n global $post;\n if (get_the_post_thumbnail()) {\n return true;\n } else {\n return false;\n }\n}",
"function term_exists( $term, $taxonomy = '', $parent = 0 ) {\n\t\tif ( function_exists( 'term_exists' ) ) { // 3.0 or later\n\t\t\treturn term_exists( $term, $taxonomy, $parent );\n\t\t} else {\n\t\t\treturn is_term( $term, $taxonomy, $parent );\n\t\t}\n\t}",
"public function addTaxonomies() {\n\n echo \"\\nAdding taxonomies to post {$this->wp_post_id}...\\n\";\n\n if( is_array($this->taxonomy_info) ){\n foreach( $this->taxonomy_info as $taxonomy_name => $terms ){\n $term_ids = implode( \" \", $this->getRandomTerms($terms) );\n $set_terms_cmd = \"wp post term set {$this->wp_post_id} {$taxonomy_name} {$term_ids} --by=id\";\n $output = shell_exec( $set_terms_cmd );\n }\n }\n\n return true;\n }",
"function check_if_metal_types_exist()\r\n{\r\n\twrite_log(\"Checking Metal Types Exist\");\r\n\t$term = term_exists('gold', 'metal_type');\r\n\tif ($term === null) {\r\n\t\twrite_log(\"Making GOLD\");\r\n\r\n\t\twp_insert_term(\r\n\t\t 'Gold', // the term \r\n\t\t 'metal_type', // the taxonomy\r\n\t\t array(\r\n\t\t\t'description'=> 'Gold Metal',\r\n\t\t\t'slug' => 'gold',\r\n\t\t\t'parent'=> 0 // get numeric term id\r\n\t\t )\r\n\t\t);\r\n\t}\r\n\t\r\n\t$term = term_exists('silver', 'metal_type');\r\n\tif ($term === null) {\r\n\t\twrite_log(\"Making SILVER\");\r\n\r\n\t\twp_insert_term(\r\n\t\t 'Silver', // the term \r\n\t\t 'metal_type', // the taxonomy\r\n\t\t array(\r\n\t\t\t'description'=> 'Silver Metal',\r\n\t\t\t'slug' => 'silver',\r\n\t\t\t'parent'=> 0 // get numeric term id\r\n\t\t )\r\n\t\t);\r\n\t}\r\n\r\n\t$term = term_exists('platinum', 'metal_type');\r\n\tif ($term === null) {\r\n\t\twrite_log(\"Making Platinum\");\r\n\r\n\t\twp_insert_term(\r\n\t\t 'Platinum', // the term \r\n\t\t 'metal_type', // the taxonomy\r\n\t\t array(\r\n\t\t\t'description'=> 'Platinum Metal',\r\n\t\t\t'slug' => 'platinum',\r\n\t\t\t'parent'=> 0 // get numeric term id\r\n\t\t )\r\n\t\t);\r\n\t}\r\n\r\n\t$term = term_exists('palladium', 'metal_type');\r\n\tif ($term === null) {\r\n\t\twrite_log(\"Making Palladium\");\r\n\r\n\t\twp_insert_term(\r\n\t\t 'Palladium', // the term \r\n\t\t 'metal_type', // the taxonomy\r\n\t\t array(\r\n\t\t\t'description'=> 'Palladium Metal',\r\n\t\t\t'slug' => 'palladium',\r\n\t\t\t'parent'=> 0 // get numeric term id\r\n\t\t )\r\n\t\t);\r\n\t}\r\n\t\r\n\t\r\n\twrite_log(\"End of Metal Types Exist\");\t\t\t\r\n}"
] |
[
"0.6135039",
"0.6135039",
"0.5955681",
"0.5778112",
"0.5769805",
"0.5757012",
"0.5737036",
"0.5729192",
"0.5727491",
"0.5664555",
"0.56128263",
"0.55978876",
"0.55933446",
"0.5587934",
"0.55795115",
"0.5568868",
"0.5542056",
"0.5529233",
"0.5519791",
"0.54816175",
"0.5468513",
"0.53986764",
"0.5394253",
"0.53870475",
"0.5386637",
"0.5363331",
"0.5360411",
"0.5353133",
"0.53498137",
"0.5337574"
] |
0.77912635
|
0
|
Check if the post has any public taxonomies.
|
public function has_public_taxonomies( $post ) {
$taxonomies = get_object_taxonomies( $post, 'objects' );
// Only get taxonomies that have a UI.
$taxonomies = array_filter(
$taxonomies,
function ( $tax ) {
return $tax->show_ui;
}
);
return ! empty( $taxonomies );
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function hasTaxonomies() {\n return $this->_has(1);\n }",
"public function hasTaxonomy() {\n return $this->_has(1);\n }",
"public function hasTaxonomy() {\n return $this->_has(1);\n }",
"public function hasTaxes()\n {\n return !empty($this->taxes);\n }",
"public function hasTerms()\n\t{\n\t\t$terms = $this->retrieveAll();\n\n\t\tif( empty( $terms ) || is_wp_error( $terms ) ) {\n\t\t\treturn false;\n\t\t} else {\n\t\t\treturn true;\n\t\t}\n\t}",
"public static function get_allowed_taxonomies()\n {\n }",
"public static function add_notice_if_publish_failed_due_to_missing_taxonomies() {\n\t\tglobal $post;\n\n\t\t$meta_key = Posts::META_KEY_MISSING_TAXONOMIES;\n\n\t\tif ( isset( $post->ID ) ) {\n\t\t\t$missing_taxonomies = get_post_meta( $post->ID, $meta_key, true );\n\n\t\t\tif ( $missing_taxonomies ) {\n\t\t\t\techo '<div class=\"notice notice-error is-dismissible notice-missing-taxonomies\"><p>';\n\t\t\t\tprintf(\n\t\t\t\t\t__( '<strong>Error:</strong> Photo was not published because the following taxonomies are missing terms: %s', 'wporg-photos' ),\n\t\t\t\t\t'<strong>' . implode( '</strong>, <strong>', $missing_taxonomies ) . '</strong>'\n\t\t\t\t);\n\n\t\t\t\techo '</p></div>' . \"\\n\";\n\t\t\t\tdelete_post_meta( $post->ID, $meta_key );\n\t\t\t}\n\t\t}\n\t}",
"public function hasTax()\r\n {\r\n return $this->item->getParentObject()->getOrder()->getProxy()->hasTax();\r\n }",
"function is_taxable() {\n\t\tif (isset($this->data['tax_status']) && $this->data['tax_status']=='taxable') return true;\n\t\treturn false;\n\t}",
"function utcw_wp_loaded() {\n\tglobal $utcw_allowed_taxonomies, $utcw_allowed_post_types;\n\n\t$utcw_allowed_taxonomies = get_taxonomies();\n\t$utcw_allowed_post_types = get_post_types(array('public' => true));\n}",
"function is_movie_taxonomy() {\n return is_tax( get_object_taxonomies( 'movie' ) );\n }",
"function widgetopts_global_taxonomies() {\n \t$taxonomies = get_option( 'widgetopts_global_taxonomies' );\n\n \tif( empty( $taxonomies ) ) {\n\n $tax_args = array(\n 'public' => true\n );\n $tax_output = 'objects'; // or objects\n $tax_operator = 'and'; // 'and' or 'or'\n $taxonomies = get_taxonomies( $tax_args, $tax_output, $tax_operator );\n unset( $taxonomies['post_format'] );\n\n // Let's let devs alter that value coming in\n $taxonomies = apply_filters( 'widgetopts_update_global_taxonomies', $taxonomies );\n update_option( 'widgetopts_global_taxonomies', $taxonomies );\n\n \t}\n\n \treturn apply_filters( 'widgetopts_get_global_taxonomies', $taxonomies );\n }",
"function voicewp_news_taxonomies() {\n\t$option = get_option( 'voicewp-settings' );\n\n\t$taxonomies = ( empty( $option['latest_taxonomies'] ) ) ? array() : $option['latest_taxonomies'];\n\n\t// Nonexistant taxonomies can shortcircuit get_terms().\n\treturn array_filter( $taxonomies, 'taxonomy_exists' );\n}",
"function has_term($term = '', $taxonomy = '', $post = \\null)\n {\n }",
"function get_post_taxonomies($post = 0)\n {\n }",
"public function addTaxonomies() {\n\n echo \"\\nAdding taxonomies to post {$this->wp_post_id}...\\n\";\n\n if( is_array($this->taxonomy_info) ){\n foreach( $this->taxonomy_info as $taxonomy_name => $terms ){\n $term_ids = implode( \" \", $this->getRandomTerms($terms) );\n $set_terms_cmd = \"wp post term set {$this->wp_post_id} {$taxonomy_name} {$term_ids} --by=id\";\n $output = shell_exec( $set_terms_cmd );\n }\n }\n\n return true;\n }",
"public function hasTerms()\n {\n $terms = $this->getElementData('t');\n return (null !== $terms && '' !== $terms);\n }",
"public function isTaxAdminPage() \n\t{\n\t\treturn ( is_admin() && $this->taxomomyStr === $_GET['taxonomy'] );\n\t}",
"function is_taxonomy_viewable($taxonomy)\n {\n }",
"public function register(): bool {\n\t\tif ( ! taxonomy_exists( static::NAME ) ) {\n\t\t\t$taxonomy = register_taxonomy(\n\t\t\t\tstatic::NAME,\n\t\t\t\t$this->get_object_types(),\n\t\t\t\t$this->get_args()\n\t\t\t);\n\t\t\treturn ! is_wp_error( $taxonomy );\n\t\t}\n\n\t\treturn true;\n\t}",
"public function has_published_pages()\n {\n }",
"function has_children(){\n\t\tglobal $post;\n\t\t$pages = get_pages('child_of='.$post->ID);\n\t\treturn count($pages);\n\t}",
"function has_shidlren() {\n\n\tglobal $post;\n\n\t$pages = get_pages('child_of=' . $post->ID);\n\treturn count($pages);\n\n}",
"function user_has_permission() {\r\n\tglobal $wp_query;\r\n\r\n\tif ( is_posttype( 'itinerary', POSTTYPE_ARCHIVEORSINGLE ) ) {\r\n\t\treturn current_user_can( 'ind_read_itinerary' );\r\n\t}\r\n\r\n\tif ( is_posttype( 'magazine', POSTTYPE_SINGLEONLY ) ) {\r\n\t\t// Check if this is the most recent post somehow\r\n\t}\r\n\r\n\tif ( is_posttype( 'magazine', POSTTYPE_ARCHIVEONLY ) ) {\r\n\t\treturn true;\r\n\t\t$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;\r\n\t\t$current = ( $paged == 1 && $wp_query->current_post == 0 );\r\n\t\treturn ( current_user_can( 'ind_read_magazine_archive' ) ||\r\n\t\t\t( $current /* && current_user_can( 'ind_read_magazine' ) */ ) );\r\n\t}\r\n\t\r\n\tif ( is_posttype( 'restaurant', POSTTYPE_SINGLEONLY )\r\n\t\t|| is_posttype( 'shop', POSTTYPE_SINGLEONLY )\r\n\t\t|| is_posttype( 'activity', POSTTYPE_SINGLEONLY )\r\n\t\t|| is_posttype( 'article', POSTTYPE_SINGLEONLY )\r\n\t\t|| is_posttype( 'insidertrip' ) ) {\r\n\t\tif ( current_user_can( 'ind_read_itinerary' ) ) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\t\r\n\t\t$counter_show = \\indagare\\cookies\\Counters::getPageCountGroup( 'restricted' );\r\n\t\tif ( $counter_show > INDG_PREVIEW_COUNT_MAX ) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\r\n\t\r\n\r\n\treturn true;\r\n}",
"function custom_has_term($slug) {\n global $post;\n $tax = get_the_taxonomies( $post );\n foreach ($tax as $key => $value) {\n $terms = wp_get_post_terms( $post->ID, $key );\n foreach( $terms as $term ) {\n if( $term->slug == $slug ) {\n return true;\n }\n }\n }\n return false;\n}",
"function dd_in_tax($tax, $term, $_post = NULL) {\n // if neither tax nor term are specified, return false\n if ( !$tax || !$term ) { return FALSE; }\n // if post parameter is given, get it, otherwise use $GLOBALS to get post\n if ( $_post ) {\n $_post = get_post( $_post );\n } else {\n $_post =& $GLOBALS['post'];\n }\n // if no post return false\n if ( !$_post ) { return FALSE; }\n // check whether post matches term belongin to tax\n $return = is_object_in_term( $_post->ID, $tax, $term );\n // if error returned, then return false\n if ( is_wp_error( $return ) ) { return FALSE; }\n return $return;\n}",
"public function is_tax($taxonomy = '', $term = '')\n {\n }",
"function is_video_taxonomy() {\n return is_tax( get_object_taxonomies( 'video' ) );\n }",
"public function hasPublishedTag() {\n return $this->_has(1);\n }",
"protected function check_is_taxonomy_allowed($taxonomy)\n {\n }"
] |
[
"0.79673815",
"0.7515551",
"0.7515551",
"0.68217105",
"0.6574634",
"0.6494449",
"0.6356902",
"0.6325235",
"0.6238318",
"0.6216023",
"0.61740726",
"0.61227643",
"0.6086072",
"0.5983104",
"0.59752756",
"0.59658426",
"0.59424704",
"0.5924158",
"0.5920752",
"0.5910281",
"0.5843017",
"0.58307403",
"0.5808518",
"0.5804122",
"0.57985485",
"0.57959837",
"0.57815784",
"0.5768888",
"0.5767648",
"0.57563245"
] |
0.8528321
|
0
|
Init the taxonomy ordering metabox.
|
private function init_taxonomy_manager( $post ) {
$out = array();
$out[] = '<div class="cld-tax-order">';
$out[] = '<ul class="cld-tax-order-list" id="cld-tax-items">';
$out[] = '<li class="cld-tax-order-list-item no-items">' . esc_html__( 'No terms added', 'cloudinary' ) . '</li>';
$terms = $this->get_terms( $post->ID );
// Process Terms.
if ( ! empty( $terms ) ) {
foreach ( (array) $terms as $item ) {
$out[] = $this->make_term_sort_item( $item['value'], $item['term']->name );
}
}
$out[] = '</ul>';
// Get apply Type.
$type = get_post_meta( $post->ID, self::META_APPLY_KEY . '_terms', true );
$out[] = '<label class="cld-tax-order-list-type"><input ' . checked( 'overwrite', $type, false ) . ' type="checkbox" value="overwrite" name="cld_apply_type" />' . __( 'Overwrite', 'cloudinary' ) . '</label>';
$out[] = '</div>';
return implode( $out );
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function admin_init()\n \t{\t\t\t\n \t\t// Add metaboxes\n \t\t//add_action('add_meta_boxes', array(&$this, 'add_meta_boxes'));\n \t}",
"function position_init() {\n\tregister_taxonomy(\n\t\t'position',\n\t\t'wsc_team',\n\t\tarray(\n\t\t\t'hierarchical' => true,\n\t\t\t'show_ui' => true,\n\t\t\t'show_admin_column' => true,\n\t\t\t'query_var' => true,\n\t\t\t'sort' => true,\n\t\t\t'label' => __( 'Position' ),\n\t\t\t'rewrite' => array( 'slug' => 'position' ),\n\t\t\t'capabilities' => array(\n\t\t\t\t'assign_terms',\n\t\t\t\t'edit_terms',\n\t\t\t\t'manage_terms',\n\t\t\t\t'delete_terms'\n\t\t\t)\n\t\t)\n\t);\n}",
"public function admin_init() {\n\n\t\t$taxonomy = get_taxonomy( $this->taxonomy );\n\n\t\tif ( empty( $taxonomy ) || empty( $taxonomy->public ) || ! $this->show_metabox() ) {\n\t\t\treturn;\n\t\t}\n\n\t\t$this->insert_description_field_editor();\n\n\t\tadd_filter( 'category_description', array( $this, 'custom_category_descriptions_add_shortcode_support' ) );\n\n\t\tadd_action( sanitize_text_field( $this->taxonomy ) . '_edit_form', array( $this, 'term_metabox' ), 90, 1 );\n\t\tadd_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );\n\t}",
"public static function init() {\n\t\t\n \t\tadd_action( 'init', array(get_class(), 'init_tax'), 0 );\n\t\t// Template\n\t\tadd_filter('template_include', array( get_class(), 'override_template' ) );\n\t\t// Meta Boxes\n\t\tadd_action( 'add_meta_boxes', array(get_class(), 'add_meta_boxes'));\n\t\tadd_action( 'save_post', array( get_class(), 'save_meta_boxes' ), 10, 2 );\n\t\t\n\t}",
"function initialize() {\n\t\t$this->number = 1;\n\t\t$this->post_types = array();\n\t\t$this->widget_form_fields = array();\n\n\t\tadd_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) );\n\t\tadd_action( 'save_post', array( $this, 'save_widget_post_meta' ), 10, 3 );\n\t}",
"function wp_ajax_meta_box_order()\n {\n }",
"function dhali_sort_meta( $taxonomy ) {\t?>\n\n\t<div class=\"form-field term-sort-order-wrap\">\n\t\t<label for=\"sort_order\"><?php _e( 'Sort Order', 'dhali' ); ?></label>\n\t\t<input type=\"text\" name=\"sort_order\" id=\"sort_order\" value=\"\">\n\t\t<p class=\"description\"><?php _e( 'Enter the category sort order','dhali' ); ?></p>\n\t</div>\n\n<?php }",
"public function initial_taxonomy() {\n $labels = array(\n 'name' => __( 'Taxonomies', Settings::$text_domain ),\n 'singular_name' => __( 'Taxonomy', Settings::$text_domain ),\n 'menu_name' => __( 'Taxonomies', Settings::$text_domain ),\n 'name_admin_bar' => __( 'Taxonomies', Settings::$text_domain ),\n 'add_new' => __( 'Add New', Settings::$text_domain ),\n 'add_new_item' => __( 'Add New Taxonomy', Settings::$text_domain ),\n 'new_item' => __( 'New Taxonomy', Settings::$text_domain ),\n 'edit_item' => __( 'Edit Taxonomy', Settings::$text_domain ),\n 'view_item' => __( 'View Taxonomy', Settings::$text_domain ),\n 'all_items' => __( 'Taxonomies', Settings::$text_domain ),\n 'search_items' => __( 'Search Taxonomies', Settings::$text_domain ),\n 'parent_item_colon' => __( 'Parent Taxonomies:', Settings::$text_domain ),\n 'not_found' => __( 'No taxonomy found.', Settings::$text_domain ),\n 'not_found_in_trash' => __( 'No taxonomies found in Trash.', Settings::$text_domain )\n );\n\n $args = array(\n 'labels' => $labels,\n 'public' => true,\n 'publicly_queryable' => true,\n 'show_ui' => true,\n 'show_in_menu' => 'tools.php',\n 'show_in_nav_menus' => false,\n 'query_var' => true,\n 'capability_type' => 'post',\n 'has_archive' => false,\n 'hierarchical' => false,\n 'menu_position' => null,\n 'taxonomies' => array( '' ),\n 'menu_icon' => 'dashicons-category',\n 'supports' => array('title')\n );\n\n register_post_type( Settings::$main_taxonomy_name, $args );\n\n $taxonomy_factory = new Taxonomy_Factory();\n $taxonomy_factory->register_all_taxonomies();\n\n //Configura o número de posts por página\n add_action('pre_get_posts', array($taxonomy_factory, 'set_posts_per_page'));\n }",
"public function setup_hooks() {\n\t\t$taxonomies = get_taxonomies( array( 'show_ui' => true ) );\n\t\t$global = $this;\n\t\tarray_map(\n\t\t\tfunction ( $taxonomy ) use ( $global ) {\n\t\t\t\tadd_action( $taxonomy . '_add_form_fields', array( $global, 'add_taxonomy_fields' ) );\n\t\t\t\tadd_action( $taxonomy . '_edit_form_fields', array( $global, 'edit_taxonomy_fields' ) );\n\t\t\t\tadd_action( 'create_' . $taxonomy, array( $global, 'save_taxonomy_custom_meta' ) );\n\t\t\t\tadd_action( 'edited_' . $taxonomy, array( $global, 'save_taxonomy_custom_meta' ) );\n\t\t\t},\n\t\t\t$taxonomies\n\t\t);\n\n\t\t// Add ordering metaboxes.\n\t\tadd_action( 'add_meta_boxes', array( $this, 'taxonomy_ordering' ), 10, 2 );\n\t\tadd_action( 'save_post', array( $this, 'save_taxonomy_ordering' ), 10, 4 );\n\t}",
"private function initCustomTaxonomy(){\n //Instantiate our custom taxonomy object\n $this->taxAstrology = new Taxonomy($this->wpdsTaxonomyName, $this->wpdsPostType);\n \n //Set our taxonomy's properties\n $this->taxAstrology->setSingularName($this->wpdsTaxonomyName);\n $this->taxAstrology->setPluralName($this->wpdsTaxonomyName);\n $this->taxAstrology->setMenuName($this->wpdsTaxonomyName);\n $this->taxAstrology->setLabels('Search '.$this->wpdsPostTypeNamePlural, 'Popular '.$this->wpdsPostTypeNamePlural, 'All '.$this->wpdsPostTypeNamePlural, 'Edit '.$this->wpdsPostTypeName, 'Update '.$this->wpdsPostTypeName, 'Add New '.$this->wpdsPostTypeName, 'New '.$this->wpdsPostTypeName.' Name');\n $this->taxAstrology->setDescription($this->wpdsPostTypeNamePlural);\n $this->taxAstrology->setShowInMenu(true);\n $this->taxAstrology->setPublic(true);\n $this->taxAstrology->setHierarchical(false);\n \n //Finally, we register our new taxonomy\n $this->taxAstrology->register();\n }",
"public static function init() {\r\n add_action( 'add_meta_boxes', array( __CLASS__, 'createMetaBox' ) );\r\n add_actioN( 'save_post', array( __CLASS__, 'saveMetaData' ) );\r\n }",
"public function initializeObject()\n {\n $this->setDefaultOrderings(\n [\n 'sorting' => \\TYPO3\\CMS\\Extbase\\Persistence\\QueryInterface::ORDER_ASCENDING,\n ]\n );\n }",
"public function __construct(){\n //Create our custom taxonomy\n $this->initCustomTaxonomy();\n \n //Create our custom post type\n $this->initCustomPostType();\n \n //Manage our columns for our admin page\n $this->initColumns();\n }",
"function atoz_init() {\r\n\t// create a new taxonomy\r\n\tregister_taxonomy(\r\n\t\t'azcategory',\r\n\t\t'atoz',\r\n\t\tarray(\r\n\t\t\t'label' \t\t => __( 'AtoZ Category' ),\r\n\t\t\t'sort' \t\t\t=> true,\r\n\t\t\t'args' \t\t\t=> array( 'orderby' => 'atoz_order' ),\r\n\t\t\t'query_var'\t => true,\r\n\t\t\t//'rewrite'\t\t => true,\r\n\t\t\t'rewrite'\t\t => array( 'slug' => 'azcategory' ),\r\n\t\t\t'hierarchical' \t=> true\r\n\t\t)\r\n\t);\r\n}",
"function specialoffers_init() {\r\n\t// create a new taxonomy\r\n\tregister_taxonomy(\r\n\t\t'specialofferscategory',\r\n\t\t'specialoffers',\r\n\t\tarray(\r\n\t\t\t'label' \t\t => __( 'Special Offers Category' ),\r\n\t\t\t'sort' \t\t\t=> true,\r\n\t\t\t'args' \t\t\t=> array( 'orderby' => 'specialoffers_order' ),\r\n\t\t\t'query_var'\t => true,\r\n\t\t\t'rewrite'\t\t => array( 'slug' => 'specialofferscategory' ),\r\n\t\t\t'hierarchical' \t=> true\r\n\t\t)\r\n\t);\r\n}",
"public function init()\n {\n add_filter('woocommerce_attribute_show_in_nav_menus', array( $this, 'attrForMenus' ), 1, 2);\n //Add chaeccked on checkout page to terms\n add_filter('woocommerce_terms_is_checked_default', array( $this, 'termsChecked' ) );\n\n\n }",
"protected function setupReorderOperation()\n {\n $this->crud->set('reorder.label', 'title');\n // define how deep the admin is allowed to nest the items\n // for infinite levels, set it to 0\n $this->crud->set('reorder.max_level', 2);\n }",
"function wp_nav_menu_taxonomy_meta_boxes()\n {\n }",
"function wp_initial_nav_menu_meta_boxes()\n {\n }",
"public function __construct() {\n\n // Register the post type\n add_action('init', [ $this, 'reg_post_type' ] );\n add_action('init', [ $this, 'add_taxonomy' ] );\n add_action('init', [ $this, 'add_tags' ] );\n\n add_action( 'add_meta_boxes', [ $this, 'add_metabox' ], 1 );\n add_action( 'save_post', [ $this, 'save_metabox' ], 10, 2 );\n\n }",
"function faqs_init() {\r\n\t// create a new taxonomy\r\n\tregister_taxonomy(\r\n\t\t'faqscategory',\r\n\t\t'faqs',\r\n\t\tarray(\r\n\t\t\t'label' \t\t => __( 'FAQs Category' ),\r\n\t\t\t'sort' \t\t\t=> true,\r\n\t\t\t'args' \t\t\t=> array( 'orderby' => 'faqs_order' ),\r\n\t\t\t'query_var'\t => true,\r\n\t\t\t'rewrite'\t\t => array( 'slug' => 'faqscategory' ),\r\n\t\t\t'hierarchical' \t=> true\r\n\t\t)\r\n\t);\r\n}",
"public function _setup()\n {\n foreach($this->get_taxonomies() as $tax)\n {\n add_action(\"{$tax}_edit_form\", array($this, 'render'), 10, 2);\n }\n add_action('edit_term', array($this, 'save'), 10, 3);\n }",
"function carton_set_term_order( $term_id, $index, $taxonomy, $recursive = false ) {\n\tglobal $wpdb;\n\n\t$term_id \t= (int) $term_id;\n\t$index \t\t= (int) $index;\n\n\t// Meta name\n\tif (strstr($taxonomy, 'pa_')) :\n\t\t$meta_name = 'order_' . esc_attr($taxonomy);\n\telse :\n\t\t$meta_name = 'order';\n\tendif;\n\n\tupdate_carton_term_meta( $term_id, $meta_name, $index );\n\n\tif( ! $recursive ) return $index;\n\n\t$children = get_terms($taxonomy, \"parent=$term_id&menu_order=ASC&hide_empty=0\");\n\n\tforeach ( $children as $term ) {\n\t\t$index ++;\n\t\t$index = carton_set_term_order($term->term_id, $index, $taxonomy, true);\n\t}\n\n\tclean_term_cache( $term_id, $taxonomy );\n\n\treturn $index;\n}",
"public function setTerms(){\n\t\t$this->terms = new stdClass();\n\t\tforeach (get_taxonomies() as $taxonomy ) {\n\t\t\t$this->terms->$taxonomy = $this->getTerms( $taxonomy);\n\t\t\t//$this->{'terms_'.$taxonomy} = $this->terms[$taxonomy];\n\t\t}\n\t}",
"function __construct($tg_meta_box) {\n $this->_meta_box = $tg_meta_box;\n add_action('admin_menu', array(&$this, 'add'));\n add_action('save_post', array(&$this, 'save'));\n }",
"function Trigger_SetOrderColumn(&$tNG) {\n $orderFieldObj = new tNG_SetOrderField($tNG);\n $orderFieldObj->setFieldName(\"menubar2orderlist\");\n return $orderFieldObj->Execute();\n}",
"public function __construct()\r\n\t\t{\t\t\t\r\n\t\t\t$this->sorting_markup_list[ORDER_TYPE::ASCENDING] \t= ORDER_MARKUP::ASCENDING;\r\n\t\t\t$this->sorting_markup_list[ORDER_TYPE::DECENDING] \t= ORDER_MARKUP::DECENDING;\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t}",
"function t_edit_texonomy_field($taxonomy) {\n global $wp_query,$wpdb;\n \n //$displayorder = get_option('t_taxonomy_displayorder' . $taxonomy->term_id);\n \n $terms = $wpdb->prefix . \"terms\";\n $sql = \"SELECT term_order FROM $terms WHERE term_id = {$taxonomy->term_id}\";\n $term = $wpdb->get_row($sql);\n if($term){\n $displayorder = $term->term_order;\n }else{\n $displayorder = 0;\n }\n echo '<tr class=\"form-field\">\n\t\t<th scope=\"row\" valign=\"top\"><label for=\"taxonomy_displayorder\">' . __('Display Order', 'zci') . '</label></th>\n\t\t<td>\n <input type=\"text\" name=\"taxonomy_displayorder\" id=\"taxonomy_displayorder\" value=\"' . $displayorder . '\" />\n\t\t</td>\n\t</tr>';\n}",
"public static function init(){\n self::items_needed_for_brands();\n self::brand_for_product_post_type_metabox();\n }",
"function admin_init() {\n\t\tadd_meta_box(\"1-Round\", \"First Round\", array(&$this, \"meta_options\"), \"Tournaments\" );\n\t}"
] |
[
"0.6117411",
"0.6097307",
"0.6012518",
"0.5987337",
"0.5971014",
"0.5964718",
"0.5921568",
"0.5909976",
"0.58931667",
"0.5871262",
"0.5863057",
"0.58582014",
"0.58531153",
"0.58479875",
"0.5818886",
"0.5783493",
"0.5778847",
"0.57557535",
"0.5736358",
"0.5727188",
"0.5713413",
"0.5709657",
"0.57076895",
"0.5681734",
"0.5638467",
"0.5617354",
"0.5617072",
"0.55518",
"0.55470085",
"0.5541149"
] |
0.6229519
|
0
|
Get the year of the oldest movie.
|
public static function getYearOldest()
{
if (Helpers::hasAccess('titles.create'))
$year = Title::min('year');
else
$year = Title::where('type', '=', 'movie')
->whereNotNull('video')
->where('video','<>','')
->whereNotNull('poster')
->where('poster','<>','')
->whereNotNull('background')
->where('background','<>','')
->min('year');
return $year;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public static function getYearNewest()\n {\n if (Helpers::hasAccess('titles.create'))\n $year = Title::max('year');\n else\n $year = Title::where('type', '=', 'movie')\n ->whereNotNull('video')\n ->where('video','<>','')\n ->whereNotNull('poster')\n ->where('poster','<>','')\n ->whereNotNull('background')\n ->where('background','<>','')\n ->max('year'); \n return $year;\n }",
"public function getYear()\n {\n if ($this->isReady) {\n if ($strReturn = $this->matchRegex($this->_strSource, IMDB::IMDB_YEAR, 1)) {\n return intval($strReturn);\n }\n }\n return 0;\n }",
"public function getYear()\n\t{\n\t\treturn $this->year \n\t\t\t?? $this->year = date('Y');\n\t}",
"function get_year()\n {\n $datearray=getdate($this->timestamp);\n return $datearray[\"year\"];\n }",
"public function getYear()\r\n\t{\r\n\t\treturn $this->format('y');\r\n\t}",
"public function getHighestYear() {\n\t\t$query = $this->createQuery();\n\t\t$query->getQuerySettings()->setRespectStoragePage(FALSE);\n\t\t$query->statement(\"SELECT MAX(year) as year FROM `tx_wxlottery_domain_model_partnerlog`\");\n\t\treturn $query->execute()->getFirst()->getYear();\n }",
"function getYear()\n {\n if (!isset($this->iyear) && !$this->bLoaded) {\n $this->DBCarregar();\n }\n return $this->iyear;\n }",
"public function getYear()\n {\n return $this->_getDateValue('Y');\n }",
"public function GetYear() {\n return $this->format('Y');\n }",
"public function getYear()\n\t\t{\n\t\t\t$date = new \\DateTime($this->created_at);\n\t\t\treturn $date->format('Y');\n\t\t}",
"public function getYear() {}",
"public function getYear(): string\n {\n return $this->toLocalizedString('y');\n }",
"public function getYear() : int\n {\n return $this->year;\n }",
"public function latestYear()\n\t{\n\t\t$year = $this->doll->orderBy('release_year', 'DESC')->pluck('release_year');\n\t\treturn $year;\n\t}",
"public function getMinYearBuilt();",
"public function getYear()\n {\n return $this->year;\n }",
"public function getYear()\n {\n return $this->year;\n }",
"public function getYear()\n\t{\n\t\treturn $this->year;\n\t}",
"protected function year(){\n return $this->now->format('Y');\n }",
"public function year()\n\t{\n\t\treturn date('Y');\n\t}",
"function getYear()\r\n {\r\n return $this->ano;\r\n }",
"public function getCurrentYear() {\n return date('Y');\n }",
"public function getYear()\n {\n return $this->calendarMonth->getYear();\n }",
"function getCurrentYear ()\n\t{\n\t\treturn date ('Y');\n\t}",
"public function getYear() {\n return $this->_year;\n }",
"public static function getCurrentYear() {\n return date('Y');\n }",
"public function get_year()\n {\n $round = $this->get_round();\n $roundNumber = $round['numero'];\n /*Se obtiene la fecha final para sacar el año*/\n $r = $round['fecha_final'];\n /*Se concatena el año, siempre son 4 caracteres*/\n $año = $r[0].$r[1].$r[2].$r[3];\n \n return $año;\n }",
"public static function yearOrMostRecent($year) {\n\t if($year > 0 AND CompYear::where('year', $year)->count() > 0) {\n\t return $year;\n\t } else {\n\t return CompYear::orderBy('year', 'desc')->first()->year;\n\t }\n\t}",
"public function getYear(){\n\t\treturn $this->_year;\n\t}",
"public function getYear() : string;"
] |
[
"0.81303746",
"0.7449406",
"0.7371676",
"0.7352392",
"0.7312623",
"0.7278274",
"0.724361",
"0.72215223",
"0.71951646",
"0.71776026",
"0.7151557",
"0.7150249",
"0.71406263",
"0.70873475",
"0.70543605",
"0.7052554",
"0.7052554",
"0.70257914",
"0.6981894",
"0.69788736",
"0.69694334",
"0.6944934",
"0.69096845",
"0.68999535",
"0.6899735",
"0.68808264",
"0.6854106",
"0.68393826",
"0.68079925",
"0.6806976"
] |
0.84857553
|
0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.