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 |
---|---|---|---|---|---|---|
Move jQuery script include to the footer
|
public static function move_jquery_to_footer() {
add_action('wp_enqueue_scripts', function() {
if (is_admin()) {
return;
}
$wp_scripts = wp_scripts();
$wp_scripts->add_data('jquery', 'group', 1);
$wp_scripts->add_data('jquery-core', 'group', 1);
$wp_scripts->add_data('jquery-migrate', 'group', 1);
}, 0);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function move_js_to_footer() {\n\t\t$this->remove_action( 'wp_head', 'wp_print_scripts' );\n\t\t$this->remove_action( 'wp_head', 'wp_print_head_scripts', 9 );\n\t\t$this->remove_action( 'wp_head', 'wp_enqueue_scripts', 1 );\n\t}",
"function wp_footer() {\n SLPlus_Actions::ManageTheScripts();\n\t\t}",
"public static function footer_scripts()\n\t{\n\t\tself::$_configInstance->footer_scripts();\n\t}",
"function _wp_footer_scripts()\n {\n }",
"public function buildFooter() {\n $arrOfJsFiles = $this->getJsFiles();\n \n //alle js bestanden in een script tag steken\n $stringOfJsTags = $this->createJsTags($arrOfJsFiles);\n \n include $this->footerFile;\n \n }",
"function footer_js(){?>\n <script>\n jQuery(document).ready(function(){\n jQuery('.load').addClass('loaded');\n });\n </script>\n <?php\n}",
"protected function add_footer_scripts() {\n\t\t\tdo_action( 'admin_print_footer_scripts' );\n\t\t}",
"function ct_js_to_footer() {\n remove_action( 'wp_head', 'wp_print_scripts' );\n remove_action( 'wp_head', 'wp_print_head_scripts', 9 );\n remove_action( 'wp_head', 'wp_enqueue_scripts', 1 );\n}",
"function add_qoorate_scripts(){\n\t\t// MAYBE TODO: cacheing ... place in DB options?\t\t\n\t\t// unregister our really old jquery bundled with WP\n\t\t// Maybe we can keep it? should it be an option?\n\t\twp_deregister_script( 'jquery' );\n\t\twp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js' );\n\t\twp_enqueue_script( 'jquery' );\n\t}",
"public function print_footer_scripts()\n {\n }",
"public function footer_scripts() {\n\n\t\tif ( ! empty( $this->element_footer_scripts ) ) {\n\t\t\techo \"<script type=\\\"text/javascript\\\">\\r\\n\";\n\t\t\tforeach ( $this->element_footer_scripts as $script ) {\n\t\t\t\techo $script . \"\\r\\n\";\n\t\t\t}\n\t\t\techo \"</script>\\r\\n\";\n\t\t}\n\t}",
"public function print_footer_scripts()\n {\n }",
"public function admin_index_print_footer_scripts() {\n\t\tif (time() < UpdraftPlus_Options::get_updraft_option('dismissed_clone_php_notices_until', 0)) return;\n\t\t?>\n\t\t<script>\n\t\t\tjQuery(function($) {\n\t\t\t\tif ($('#dashboard-widgets #dashboard_php_nag').length < 1) return;\n\t\t\t\t$('#dashboard-widgets #dashboard_php_nag .button-container').before('<div class=\"updraft-ad-container\"><a href=\"<?php echo UpdraftPlus_Options::admin_page_url(); ?>?page=updraftplus&tab=migrate#updraft-navtab-migrate-content\"><?php echo esc_js(__('You can test running your site on a different PHP (or WordPress) version using UpdraftClone credits.', 'updraftplus')); ?></a> (<a href=\"#\" onclick=\"jQuery(\\'.updraft-ad-container\\').slideUp(); jQuery.post(ajaxurl, {action: \\'updraft_ajax\\', subaction: \\'dismiss_clone_php_notice\\', nonce: \\'<?php echo wp_create_nonce('updraftplus-credentialtest-nonce'); ?>\\' });return false;\"><?php echo esc_js(__('Dismiss notice', 'updraftplus')); ?></a>)</div>');\n\t\t\t});\n\t\t</script>\n\t\t<?php\n\t}",
"public static function _wp_footer()\n\t{\n\t\tforeach (static::$footer_scripts as $params) {\n\t\t\tif (!isset($params['url'])) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (isset($params['localize']) && isset($params['localize']['name']) && isset($params['localize']['data'])) {\n\t\t\t\t?>\n\t\t\t\t<script type=\"text/javascript\">\n\t\t\t\tvar <?php $params['localize']['name'] ?> = <?php echo json_encode($params['localize']['data']); ?>;\n\t\t\t\t</script>\n\t\t\t\t<?php\n\t\t\t}\n\n\t\t\tif (isset($params['version']) && $params['version']) {\n\t\t\t\t$join_char = (stripos($params['url'], '?') !== false) ? '&' : '?';\n\t\t\t\t$params['url'] .= $join_char.'ver='.$params['version'];\n\t\t\t}\n\n\t\t\t$attrs_str = 'type=\"text/javascript\" src=\"'.$params['url'].'\"';\n\n\t\t\tif (isset($params['async']) && $params['async']) {\n\t\t\t\t$attrs_str .= ' async';\n\t\t\t}\n\n\t\t\tif (isset($params['defer']) && $params['defer']) {\n\t\t\t\t$attrs_str .= ' defer';\n\t\t\t}\n\n\t\t\techo \"<script {$attrs_str}></script>\\n\";\n\t\t}\n\t}",
"function codepress_footer_js()\n {\n }",
"function mocca_script_files() {\n\n wp_deregister_script('jquery'); // Remove Registeration Old JQuery\n wp_register_script('jquery', includes_url('/js/jquery/jquery.js'), false, '', true); // Register a New JQuery in Footer\n wp_enqueue_script('jquery'); // Enqueue New JQuery\n wp_enqueue_script('popper-js', get_template_directory_uri() . '/js/popper.min.js', array(), false, true);\n wp_enqueue_script('bootstrap-js', get_template_directory_uri() . '/js/bootstrap.min.js', array(), false, true);\n }",
"public function after_footer_scripts_code () {\n // Sets initial JS variables value\n ?>\n <script type=\"text/javascript\">\n ct_current_role = '<?php echo $this->role; ?>';\n ct_current_orderby = '<?php echo $this->orderby; ?>';\n ct_current_order = '<?php echo $this->order; ?>';\n ct_current_page = <?php echo $this->page; ?>;\n ct_total_pages = <?php echo $this->total_pages; ?>;\n </script>\n <?php\n }",
"function print_html_footer() {\n\techo '\n\t\t\t</div> <!-- /content -->\t\t\t \n\t\t</div> <!-- /container -->\t\t\t \n\t\t<script src=\"https://code.jquery.com/jquery-3.1.1.slim.min.js\"></script>\n\t\t<script src=\"https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js\"></script>\n\t\t<script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js\"></script>\n\t\t<script src=\"js/script.js\"></script>\n\t</body>\n</html>\n\t';\n}",
"function add_late_scripts()\n\t{\n\t\t// only procceed if we have finished printing footer scripts\n\t\tif (did_action('bwp_minify_after_footer_scripts'))\n\t\t\t$this->todo_late_scripts = 'footer' . $this->late_script_order;\n\t}",
"function sb_slideshow_footer_javascript() {\n\tglobal $sb_slideshow_used_ids, $sb_slideshow_footer_javascript;\n\n\tif (empty( $sb_slideshow_used_ids )) return; // don't add javascript to footer if there are no slideshows\n?>\n\t<script type=\"text/javascript\">\n\t//<![CDATA[\n\t;(function($) {\n\t\t$(document).ready(function(){\n<?php\n\t\t\techo $sb_slideshow_footer_javascript;\n?>\n\t\t\t// center any existing nivo control navs\n\t\t\t$('.with-controlNav').each(function( index, value ) {\n\t\t\t\tctrlnav = $('.nivo-controlNav', this);\n\t\t\t\tctrlnav.css('left', ($(this).width() - ctrlnav.width()) / 2);\n\t\t\t});\n\t\t});\n\t})(jQuery);\n\t//]]>\n\t</script>\n<?php\n}",
"public function customizer_footer_scripts()\n {\n $this->add_activate_switch();\n $this->change_title_html();\n do_action('mo_optin_customizer_footer_scripts', $this);\n }",
"public function footer_scripts()\n\t{\n\t\tglobal $context, $settings;\n\n\t\tif(!empty($context['theme_scripts'])) {\n\t\t\tforeach($context['theme_scripts'] as $type => $script) {\n\t\t\t\techo '\n\t\t<script type=\"text/javascript\" src=\"',($script['default'] ? $settings['default_theme_url'] : $settings['theme_url']) . '/' . $script['name'] . $context['jsver'], '\"></script>';\n\t\t\t}\n\t\t}\n\t\tif(!empty($context['inline_footer_script']))\n\t\t\techo '\n\t\t<script type=\"text/javascript\">\n\t\t<!-- // --><![CDATA[\n\t\t',$context['inline_footer_script'],'\n\n\t\t';\n\t\techo '\n\t\t// ]]>\n\t\t</script>\n\t\t';\n\t}",
"function bethel_move_jquery() {\n global $wp_scripts;\n foreach ($wp_scripts->registered as $k => $v) {\n if (substr($k, 0, 6) == 'jquery') {\n if (isset($wp_scripts->registered[$k]->ver) && isset($wp_scripts->registered[$k]->src) && $wp_scripts->registered[$k]->deps) {\n $ver = $wp_scripts->registered[$k]->ver;\n $src = $wp_scripts->registered[$k]->src;\n $deps = $wp_scripts->registered[$k]->deps;\n wp_deregister_script ($k);\n wp_register_script($k, $src, $deps, $ver, true);\n }\n }\n }\n}",
"function print_footer_scripts()\n {\n }",
"function ft_hook_add_js_call_footer() {}",
"function wp_print_footer_scripts()\n {\n }",
"public static function displayFooter() {\r\n ?>\r\n <br><br><br>\r\n <div id=\"push\"></div>\r\n </div>\r\n <div id=\"footer\"><br>© 2016 Power House. All Rights Reserved.</div>\r\n <script type=\"text/javascript\" src=\"<?= BASE_URL ?>/www/js/ajax_autosuggestion.js\"></script>\r\n </body>\r\n </html>\r\n <?php\r\n }",
"function modifyThemeFooter() {\n?>\n<!-- W3TC-include-js-head -->\n<?php\n}",
"function opinionstage_settings_load_footer(){\n}",
"function truethemes_hook_footer_scripts(){\n\n\t//get option values\n global $ttso;\n\t$jcycle_timeout = $ttso->ka_jcycle_timeout; // jQuery banner cycle time\n\t$jcycle_pause_hover = $ttso->ka_jcycle_pause_hover; //whether pause on hover.\n\n\tif ($jcycle_pause_hover == \"true\"){\n\t\t$jcycle_pause_hover_results = '1';\n\t}else{\n\t\t$jcycle_pause_hover_results = '';\n\t}\n\n\n//init slider if is Template Homepage :: jQuery 2\nif(is_page_template('template-homepage-jquery-2.php')){\n\necho \"<!-- jQuery Banner Init Script for Template Homepage :: jQuery 2 -->\\n\";\t\necho \"<script type='text/javascript'>\\n\";\necho \"//<![CDATA[\njQuery(window).load(function(){\n\tjQuery('.home-banner-wrap ul').css('background-image','none');\n\tjQuery('.jqslider').css('display','block');\n\tjQuery('.big-banner #main .main-area').css('padding-top','16px');\n \tjQuery('.home-banner-wrap ul').after('<div class=\\\"jquery-pager\\\"> </div>').cycle({\n\t\tfx: 'fade',\n\t\ttimeout: '{$jcycle_timeout}',\n\t\theight: 'auto',\n\t\tpause: '{$jcycle_pause_hover_results}',\n\t\tpager: '.jquery-pager',\n\t\tcleartypeNoBg: true\n\n\t});\n});\n//]]>\\n\";\necho \"</script>\\n\";\n}\n\n//init slider if is Template Homepage :: jQuery\nif(is_page_template('template-homepage-jquery.php')){\n\necho \"<!-- jQuery Banner Init Script for Template Homepage :: jQuery -->\\n\";\t\necho \"<script type='text/javascript'>\\n\";\necho \"//<![CDATA[\njQuery(window).load(function(){\n\tjQuery('.home-bnr-jquery ul').css('background-image','none');\n\tjQuery('.jqslider').css('display','block');\n jQuery('.home-bnr-jquery ul').after('<div class=\\\"jquery-pager\\\"> </div>').cycle({\n\t\tfx: 'fade',\n\t\ttimeout: '{$jcycle_timeout}',\n\t\theight: 'auto',\n\t\tpause: '{$jcycle_pause_hover_results}',\n\t\tpager: '.jquery-pager',\n\t\tcleartypeNoBg: true\n\t\t});\n});\n//]]>\n</script>\\n\";\t\n}\n\n//Testimonial init script\nglobal $ttso;\n$testimonial_enable = $ttso->ka_testimonial_enable;\n\nif($testimonial_enable == \"true\"){\n$testimonial_timeout = $ttso->ka_testimonial_timeout;\n$testimonial_pause_hover = $ttso->ka_testimonial_pause_hover;\n\tif ($testimonial_pause_hover == \"true\"){\n\t\t$testimonial_pause_hover_results = '1';\n\t}else{\n\t$testimonial_pause_hover_results = '0';\n\t}\n\necho \"<!-- Testimonial init script -->\\n\";\necho \"<script type='text/javascript'>\n//<![CDATA[\njQuery(document).ready(function(){\n\tfunction adjust_container_height(){\n\t\t//get the height of the current testimonial slide\n\t\tvar hegt = jQuery(this).height();\n\t\t//set the container's height to that of the current slide\n\t\tjQuery(this).parent().animate({height:hegt});\n\t}\n jQuery('.testimonials').after('<div class=\\\"testimonial-pager\\\"> </div>').cycle({\n\t\tfx: 'fade',\n\t\ttimeout: '{$testimonial_timeout}',\n\t\theight: 'auto',\n\t\tpause: '{$testimonial_pause_hover_results}',\n\t\tpager: '.testimonial-pager',\n\t\tbefore: adjust_container_height,\n\t\tcleartypeNoBg: true\n\n\t});\n});\n\n//]]>\n</script>\\n\";\n}\t\t\t\t\t\n}"
] |
[
"0.7482841",
"0.7109882",
"0.71092767",
"0.70924175",
"0.7026485",
"0.6949759",
"0.69473714",
"0.690166",
"0.6879257",
"0.6825306",
"0.6820708",
"0.6817645",
"0.6796867",
"0.67859644",
"0.67785853",
"0.6738475",
"0.66899544",
"0.6629538",
"0.66239816",
"0.66025186",
"0.65861326",
"0.65512097",
"0.6550064",
"0.654392",
"0.6525617",
"0.650685",
"0.650508",
"0.650265",
"0.64974546",
"0.64872956"
] |
0.8380822
|
0
|
Returns TRUE if the route matches the filter and FALSE if not.
|
protected function routeMatches(string $filter, Route $route): bool
{
if(str_contains($route->getRoute(), $filter))
{
return true;
}
if(str_contains($this->getNormalizedActionName($route), $filter))
{
return true;
}
if(str_contains((string) $route->getName(), $filter))
{
return true;
}
return false;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function hasRoute(): bool;",
"public function match(): bool\n {\n $uri = $_SERVER['REQUEST_URI'];\n $parse = parse_url($uri);\n $url = trim($parse['path'] ?? '', '/');\n foreach ($this->routes as $route => $params) {\n if (preg_match($route, $url, $matches)) {\n $this->params = $params;\n return true;\n }\n }\n return false;\n }",
"protected function checkFilterPasses()\n {\n $filter = $this->getFilter();\n if (! $filter) {\n return true;\n }\n\n if (is_callable($filter)) {\n return call_user_func($filter, $this->request);\n }\n if (! $this->request->is($this->filter)) {\n return false;\n }\n\n return true;\n }",
"public static function isRouteValid() {\r\n global $Routes;\r\n $uri = $_SERVER['REQUEST_URI'];\r\n\r\n if (!in_array(explode('?',$uri)[0], $Routes)) {\r\n return 0;\r\n } else {\r\n return 1;\r\n }\r\n }",
"public static function isRouteValid()\n {\n global $Routes;\n $uri = $_SERVER['REQUEST_URI'];\n if (!in_array(explode('?', $uri)[0], $Routes, true)) {\n return 0;\n } else {\n return 1;\n }\n }",
"public function matchesRequest()\n {\n return $this->event->get('AccountSid') && !(is_null($this->event->get('Latitude')) || is_null($this->event->get('Longitude')));\n }",
"public function hasFilter(): bool;",
"public function matches(Route $route, Request $request);",
"private function hasRouteParameters($route) {\n\n if (preg_match(\"/\\/:/\", $route)) {\n return true;\n }\n\n return false;\n }",
"public function hasRoute(string $name): bool;",
"public function is()\n {\n foreach (\\func_get_args() as $pattern) {\n if (Str::is($pattern, $this->currentRouteName())) {\n return true;\n }\n }\n\n return false;\n }",
"protected function isActiveByRoutes()\r\n {\r\n if (!$this->routes_activate) return false;\r\n\r\n $route_name = request()->route()->getName();\r\n\r\n return in_array($route_name, $this->routes_activate);\r\n }",
"public function matchesRequest()\n {\n return $this->event->has('queryText') && $this->payload->has('originalDetectIntentRequest');\n }",
"function isValidRoute($route) {\n \n return $route == 'campus' ||\n $route == 'extended' ||\n $route == 'nathanBisk' ||\n $route == 'downtown';\n}",
"private function checkRoute()\n\t{\n\t $route = GlobalSystem::routeType();\n\t\tif(key_exists($route, RequestRoute::$routes)){\n\t\t\t$this->trigger = RequestRoute::$routes[$route][GlobalSystem::ExpRouteKeyTrigger];\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}",
"public function matches(Route $route, Request $request)\n {\n global $current_screen;\n return $route->hookSuffix==$current_screen->id;\n }",
"protected function isActiveByRoutesParts()\r\n {\r\n if (!$this->routes_parts) return false;\r\n\r\n $route_name = request()->route()->getName();\r\n\r\n foreach ($this->routes_parts as $group) {\r\n\r\n if (strpos($route_name, $group) !== false) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }",
"public function uses()\n {\n foreach (\\func_get_args() as $pattern) {\n if (Str::is($pattern, $this->currentRouteAction())) {\n return true;\n }\n }\n\n return false;\n }",
"public function isMatch() : bool\n {\n return substr($this->uri, -strlen($this->match)) === $this->match;\n }",
"public function match(ServerRequestInterface $request, Route $route): bool\n {\n $uri = $request->getUri()->getPath();\n $path = $this->generatePath($route);\n\n if (!preg_match(\"#^$path$#i\", $uri, $matches)) {\n return false;\n }\n\n array_shift($matches);\n $route->setParameters($matches);\n\n return true;\n }",
"public function isOnRoute(): bool\n {\n $lang = $this->grav['language']->getActive();\n\n $path = $this->grav['uri']->rootUrl() ?: '/';\n $routes = $this->config->get('plugins.' . $this->name . '.routes');\n\n foreach ($routes as $route) {\n ['blog' => $blog, 'items' => $items] = $route;\n if ($path === $blog || str_starts_with($path, $items)) {\n if ($lang) {\n $route['blog'] = '/' . $lang . $route['blog'];\n $route['items'] = '/' . $lang . $route['items'];\n }\n $this->routes = $route;\n\n return true;\n }\n }\n\n return false;\n }",
"public function isActive (Request $request)\n {\n //debug ($this->method);\n //debug($request->getMethod());\n //debug ($this->getPattern(), $this->path);\n if ($this->method!==null && $this->method!=$request->getMethod())\n {\n return false;\n }\n\n if (\n ($request->getPath()==='/' && $this->path==='/') ||\n preg_match($this->getPattern(), $request->getPath())===1\n )\n {\n //Maybe filter compiration must be before regex match?\n //If it will be cost effective\n if (is_array($this->filters) && count($this->filters))\n {\n foreach ($this->filters as $name => $options)\n {\n $filter = Route::getFilter($name);\n if (!$filter($this, $request, $options))\n {\n return false;\n }\n }\n }\n return true;\n }\n return false;\n }",
"public function shouldShow()\n {\n if (! $this->checkFilterPasses()) {\n return false;\n }\n if (! $this->getPath()) {\n return false;\n }\n\n return true;\n }",
"public function testRouteMatchesResourceWithConditions()\n {\n $resource = '/hello/Josh/and/John';\n $route = new \\Slim\\Route('/hello/:first/and/:second', function () {});\n $route->conditions(array('first' => '[a-zA-Z]{3,}'));\n $result = $route->matches($resource);\n $this->assertTrue($result);\n $this->assertEquals(array('first' => 'Josh', 'second' => 'John'), $route->getParams());\n }",
"public function testRouteConditionQueryVars() {\n\n\t\t$_GET['omg'] = 'true';\n\t\t$_GET['bbq'] = 'yey';\n\n\t\t$router = new Nether\\Avenue\\Router(static::$RequestData['TestQuery']);\n\n\t\t$router->ClearRoutes()->AddRoute('{@}//test??tacobell','herp::derp');\n\t\t$route = $router->GetRoute();\n\t\t(new Verify(\n\t\t\t'this route fails because there is no tacobell in get.',\n\t\t\t($route instanceof Nether\\Avenue\\RouteHandler)\n\t\t))->false();\n\n\t\t$router->ClearRoutes()->AddRoute('{@}//test??omg','herp::derp');\n\t\t$route = $router->GetRoute();\n\t\t(new Verify(\n\t\t\t'this route passes because we had omg',\n\t\t\t($route instanceof Nether\\Avenue\\RouteHandler)\n\t\t))->true();\n\n\t\t$router->ClearRoutes()->AddRoute('{@}//test??omg&bbq','herp::derp');\n\t\t$route = $router->GetRoute();\n\t\t(new Verify(\n\t\t\t'this route passes because we had omg and bbq',\n\t\t\t($route instanceof Nether\\Avenue\\RouteHandler)\n\t\t))->true();\n\n\t\t$router->ClearRoutes()->AddRoute('{@}//test??omg&wtf&bbq','herp::derp');\n\t\t$route = $router->GetRoute();\n\t\t(new Verify(\n\t\t\t'this route fails because we had omg and bbq, but no wtf.',\n\t\t\t($route instanceof Nether\\Avenue\\RouteHandler)\n\t\t))->false();\n\n\t\treturn;\n\t}",
"public function hasRoute(): bool\n {\n return isset($this->route);\n }",
"public function matches(lib_routing_route $route, lib_http_request $request)\n\t{\n\t\tif ($route->httpOnly())\n\t\t{\n\t\t\treturn ! $request->secure();\n\t\t}\n\t\telseif ($route->secure())\n\t\t{\n\t\t\treturn $request->secure();\n\t\t}\n\n\t\treturn true;\n\t}",
"protected function matches(Route $route, string $path): bool\n\t{\n\t\tif(preg_match($route->getRegex(), $path, $parameters) === 1)\n\t\t{\n\t\t\t$filtered = [];\n\n\t\t\tforeach($parameters as $key => $value)\n\t\t\t{\n\t\t\t\tif(is_string($key))\n\t\t\t\t{\n\t\t\t\t\t$filtered[$key] = $value;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$route->setParameters($filtered);\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}",
"public function hasFilter(string $name): bool;",
"public function isActiveRoute();"
] |
[
"0.707657",
"0.6868592",
"0.65790206",
"0.64857113",
"0.63828856",
"0.63648313",
"0.6349395",
"0.6322933",
"0.62939703",
"0.626243",
"0.62082624",
"0.61796606",
"0.6168364",
"0.61516345",
"0.6147093",
"0.6116729",
"0.609138",
"0.6074885",
"0.6057383",
"0.6055772",
"0.6052468",
"0.6043993",
"0.60398185",
"0.6026337",
"0.60194427",
"0.6018939",
"0.6017131",
"0.59577894",
"0.59325206",
"0.5921251"
] |
0.75885576
|
0
|
Create a quizp with questions and walk through a quizp attempt.
|
public function test_quizp_attempt_walkthrough() {
global $SITE;
$this->resetAfterTest(true);
// Make a quizp.
$quizpgenerator = $this->getDataGenerator()->get_plugin_generator('mod_quizp');
$quizp = $quizpgenerator->create_instance(array('course'=>$SITE->id, 'questionsperpage' => 0, 'grade' => 100.0,
'sumgrades' => 2));
// Create a couple of questions.
$questiongenerator = $this->getDataGenerator()->get_plugin_generator('core_question');
$cat = $questiongenerator->create_question_category();
$saq = $questiongenerator->create_question('shortanswer', null, array('category' => $cat->id));
$numq = $questiongenerator->create_question('numerical', null, array('category' => $cat->id));
// Add them to the quizp.
quizp_add_quizp_question($saq->id, $quizp);
quizp_add_quizp_question($numq->id, $quizp);
// Make a user to do the quizp.
$user1 = $this->getDataGenerator()->create_user();
$quizpobj = quizp::create($quizp->id, $user1->id);
// Start the attempt.
$quba = question_engine::make_questions_usage_by_activity('mod_quizp', $quizpobj->get_context());
$quba->set_preferred_behaviour($quizpobj->get_quizp()->preferredbehaviour);
$timenow = time();
$attempt = quizp_create_attempt($quizpobj, 1, false, $timenow, false, $user1->id);
quizp_start_new_attempt($quizpobj, $quba, $attempt, 1, $timenow);
$this->assertEquals('1,2,0', $attempt->layout);
quizp_attempt_save_started($quizpobj, $quba, $attempt);
// Process some responses from the student.
$attemptobj = quizp_attempt::create($attempt->id);
$this->assertFalse($attemptobj->has_response_to_at_least_one_graded_question());
$prefix1 = $quba->get_field_prefix(1);
$prefix2 = $quba->get_field_prefix(2);
$tosubmit = array(1 => array('answer' => 'frog'),
2 => array('answer' => '3.14'));
$attemptobj->process_submitted_actions($timenow, false, $tosubmit);
// Finish the attempt.
$attemptobj = quizp_attempt::create($attempt->id);
$this->assertTrue($attemptobj->has_response_to_at_least_one_graded_question());
$attemptobj->process_finish($timenow, false);
// Re-load quizp attempt data.
$attemptobj = quizp_attempt::create($attempt->id);
// Check that results are stored as expected.
$this->assertEquals(1, $attemptobj->get_attempt_number());
$this->assertEquals(2, $attemptobj->get_sum_marks());
$this->assertEquals(true, $attemptobj->is_finished());
$this->assertEquals($timenow, $attemptobj->get_submitted_date());
$this->assertEquals($user1->id, $attemptobj->get_userid());
$this->assertTrue($attemptobj->has_response_to_at_least_one_graded_question());
// Check quizp grades.
$grades = quizp_get_user_grades($quizp, $user1->id);
$grade = array_shift($grades);
$this->assertEquals(100.0, $grade->rawgrade);
// Check grade book.
$gradebookgrades = grade_get_grades($SITE->id, 'mod', 'quizp', $quizp->id, $user1->id);
$gradebookitem = array_shift($gradebookgrades->items);
$gradebookgrade = array_shift($gradebookitem->grades);
$this->assertEquals(100, $gradebookgrade->grade);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function test_quizp_with_random_question_attempt_walkthrough() {\n global $SITE;\n\n $this->resetAfterTest(true);\n question_bank::get_qtype('random')->clear_caches_before_testing();\n\n $this->setAdminUser();\n\n // Make a quizp.\n $quizpgenerator = $this->getDataGenerator()->get_plugin_generator('mod_quizp');\n\n $quizp = $quizpgenerator->create_instance(array('course' => $SITE->id, 'questionsperpage' => 2, 'grade' => 100.0,\n 'sumgrades' => 4));\n\n $questiongenerator = $this->getDataGenerator()->get_plugin_generator('core_question');\n\n // Add two questions to question category.\n $cat = $questiongenerator->create_question_category();\n $saq = $questiongenerator->create_question('shortanswer', null, array('category' => $cat->id));\n $numq = $questiongenerator->create_question('numerical', null, array('category' => $cat->id));\n\n // Add random question to the quizp.\n quizp_add_random_questions($quizp, 0, $cat->id, 1, false);\n\n // Make another category.\n $cat2 = $questiongenerator->create_question_category();\n $match = $questiongenerator->create_question('match', null, array('category' => $cat->id));\n\n quizp_add_quizp_question($match->id, $quizp, 0);\n\n $multichoicemulti = $questiongenerator->create_question('multichoice', 'two_of_four', array('category' => $cat->id));\n\n quizp_add_quizp_question($multichoicemulti->id, $quizp, 0);\n\n $multichoicesingle = $questiongenerator->create_question('multichoice', 'one_of_four', array('category' => $cat->id));\n\n quizp_add_quizp_question($multichoicesingle->id, $quizp, 0);\n\n foreach (array($saq->id => 'frog', $numq->id => '3.14') as $randomqidtoselect => $randqanswer) {\n // Make a new user to do the quizp each loop.\n $user1 = $this->getDataGenerator()->create_user();\n $this->setUser($user1);\n\n $quizpobj = quizp::create($quizp->id, $user1->id);\n\n // Start the attempt.\n $quba = question_engine::make_questions_usage_by_activity('mod_quizp', $quizpobj->get_context());\n $quba->set_preferred_behaviour($quizpobj->get_quizp()->preferredbehaviour);\n\n $timenow = time();\n $attempt = quizp_create_attempt($quizpobj, 1, false, $timenow);\n\n quizp_start_new_attempt($quizpobj, $quba, $attempt, 1, $timenow, array(1 => $randomqidtoselect));\n $this->assertEquals('1,2,0,3,4,0', $attempt->layout);\n\n quizp_attempt_save_started($quizpobj, $quba, $attempt);\n\n // Process some responses from the student.\n $attemptobj = quizp_attempt::create($attempt->id);\n $this->assertFalse($attemptobj->has_response_to_at_least_one_graded_question());\n\n $tosubmit = array();\n $selectedquestionid = $quba->get_question_attempt(1)->get_question()->id;\n $tosubmit[1] = array('answer' => $randqanswer);\n $tosubmit[2] = array(\n 'frog' => 'amphibian',\n 'cat' => 'mammal',\n 'newt' => 'amphibian');\n $tosubmit[3] = array('One' => '1', 'Two' => '0', 'Three' => '1', 'Four' => '0'); // First and third choice.\n $tosubmit[4] = array('answer' => 'One'); // The first choice.\n\n $attemptobj->process_submitted_actions($timenow, false, $tosubmit);\n\n // Finish the attempt.\n $attemptobj = quizp_attempt::create($attempt->id);\n $this->assertTrue($attemptobj->has_response_to_at_least_one_graded_question());\n $attemptobj->process_finish($timenow, false);\n\n // Re-load quizp attempt data.\n $attemptobj = quizp_attempt::create($attempt->id);\n\n // Check that results are stored as expected.\n $this->assertEquals(1, $attemptobj->get_attempt_number());\n $this->assertEquals(4, $attemptobj->get_sum_marks());\n $this->assertEquals(true, $attemptobj->is_finished());\n $this->assertEquals($timenow, $attemptobj->get_submitted_date());\n $this->assertEquals($user1->id, $attemptobj->get_userid());\n $this->assertTrue($attemptobj->has_response_to_at_least_one_graded_question());\n\n // Check quizp grades.\n $grades = quizp_get_user_grades($quizp, $user1->id);\n $grade = array_shift($grades);\n $this->assertEquals(100.0, $grade->rawgrade);\n\n // Check grade book.\n $gradebookgrades = grade_get_grades($SITE->id, 'mod', 'quizp', $quizp->id, $user1->id);\n $gradebookitem = array_shift($gradebookgrades->items);\n $gradebookgrade = array_shift($gradebookitem->grades);\n $this->assertEquals(100, $gradebookgrade->grade);\n }\n }",
"public function createQuestionAndAnswers () {\n global $tpl, $lng, $ilCtrl, $ilTabs;\n\n // create wizard object\n include_once('class.ilObjMobileQuizWizard.php');\n $wiz = new ilObjMobileQuizWizard();\n\n\n $ilTabs->activateTab(\"editQuiz\");\n\n\n if ($wiz->checkInput()){\n $wiz->createQuestionAndAnswers($this->object);\n ilUtil::sendSuccess($this->txt(\"question_obj_create\"), true);\n $ilCtrl->redirect($this, \"editQuiz\");\n }\n $this->initAddQuestionAndAnswersFormAfterError();\n //$tpl->setContent(\"Test\");\n }",
"private function create_quiz_with_questions($startattempt = false, $finishattempt = false, $behaviour = 'deferredfeedback') {\n\n // Create a new quiz with attempts.\n $quizgenerator = $this->getDataGenerator()->get_plugin_generator('mod_quiz');\n $data = array('course' => $this->course->id,\n 'sumgrades' => 2,\n 'preferredbehaviour' => $behaviour);\n $quiz = $quizgenerator->create_instance($data);\n $context = context_module::instance($quiz->cmid);\n\n // Create a couple of questions.\n $questiongenerator = $this->getDataGenerator()->get_plugin_generator('core_question');\n\n $cat = $questiongenerator->create_question_category();\n $question = $questiongenerator->create_question('numerical', null, array('category' => $cat->id));\n quiz_add_quiz_question($question->id, $quiz);\n $question = $questiongenerator->create_question('numerical', null, array('category' => $cat->id));\n quiz_add_quiz_question($question->id, $quiz);\n\n $quizobj = quiz::create($quiz->id, $this->student->id);\n\n // Set grade to pass.\n $item = grade_item::fetch(array('courseid' => $this->course->id, 'itemtype' => 'mod',\n 'itemmodule' => 'quiz', 'iteminstance' => $quiz->id, 'outcomeid' => null));\n $item->gradepass = 80;\n $item->update();\n\n if ($startattempt or $finishattempt) {\n // Now, do one attempt.\n $quba = question_engine::make_questions_usage_by_activity('mod_quiz', $quizobj->get_context());\n $quba->set_preferred_behaviour($quizobj->get_quiz()->preferredbehaviour);\n\n $timenow = time();\n $attempt = quiz_create_attempt($quizobj, 1, false, $timenow, false, $this->student->id);\n quiz_start_new_attempt($quizobj, $quba, $attempt, 1, $timenow);\n quiz_attempt_save_started($quizobj, $quba, $attempt);\n $attemptobj = quiz_attempt::create($attempt->id);\n\n if ($finishattempt) {\n // Process some responses from the student.\n $tosubmit = array(1 => array('answer' => '3.14'));\n $attemptobj->process_submitted_actions(time(), false, $tosubmit);\n\n // Finish the attempt.\n $attemptobj->process_finish(time(), false);\n }\n return array($quiz, $context, $quizobj, $attempt, $attemptobj, $quba);\n } else {\n return array($quiz, $context, $quizobj);\n }\n\n }",
"public function next()\n\t{\n\t\tif(!S::may())\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\t/*\n\t\t * Try to find a current quiz session ant retrieve the questions\n\t\t */\n\t\tif($quiz = S::get('quiz-questions'))\n\t\t{\n\t\t\t$dia = new XhrDialog();\n\t\t\t$dia->addClass('quiz-questiondialog');\n\t\t\t// get quiz_index it is the current array index of the questions\n\t\t\t$i = S::get('quiz-index');\n\t\t\t\n\t\t\t/*\n\t\t\t * If the quiz index is 0 we have to start a new quiz session \n\t\t\t */\n\t\t\t\n\t\t\t$easymode = 0;\n\t\t\tif(S::get('quiz-easymode'))\n\t\t\t{\n\t\t\t\t$easymode = 1;\n\t\t\t}\n\t\t\t\n\t\t\tif($i == 0)\n\t\t\t{\t\t\t\t\n\t\t\t\t$quuizz = $this->model->getQuiz(S::get('quiz-id'));\n\t\t\t\t// init quiz session in DB\n\t\t\t\tif($id = $this->model->initQuizSession(S::get('quiz-id'), $quiz, $quuizz['maxfp'], $quuizz['questcount'],$easymode))\n\t\t\t\t{\n\t\t\t\t\tS::set('quiz-session', $id);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// this variable we need to output an message that the last question was only a joke \n\t\t\t$was_a_joke = false;\n\t\t\t\n\t\t\t/*\n\t\t\t * check if an answered quiz question is arrived\n\t\t\t */\n\t\t\tif(isset($_GET['answer']))\n\t\t\t{\n\t\t\t\t/*\n\t\t\t\t * parse the anser parameter\n\t\t\t\t */\n\t\t\t\t$answers = urldecode($_GET['answer']);\n\t\t\t\t$params = array();\n\t\t\t\tparse_str($_GET['answer'], $params);\n\t\t\t\t\n\t\t\t\t/*\n\t\t\t\t * store params in the quiz array to save users answers\n\t\t\t\t */\n\t\t\t\tif(isset($params['qanswers']))\n\t\t\t\t{\n\t\t\t\t\t$quiz[($i-1)]['answers'] = $params['qanswers'];\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t/*\n\t\t\t\t * check if there are 0 point for the questions its a joke\n\t\t\t\t */\n\t\t\t\tif($quiz[($i-1)]['fp'] == 0)\n\t\t\t\t{\n\t\t\t\t\t$was_a_joke = true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t/*\n\t\t\t\t * store the time how much time has the user need\n\t\t\t\t */\n\t\t\t\t$quiz[($i-1)]['userduration'] = (time() - (int)S::get('quiz-quest-start'));\n\t\t\t\t\n\t\t\t\t/*\n\t\t\t\t * has store noco ;) its the value when the user marked that no answer is correct\n\t\t\t\t */\n\t\t\t\t$quiz[($i-1)]['noco'] = (int)$_GET['noco'];\n\t\t\t\t\n\t\t\t\t/*\n\t\t\t\t * And store it all back to the session\n\t\t\t\t */\n\t\t\t\tS::set('quiz-questions', $quiz);\n\t\t\t}\n\t\t\t\n\t\t\t/*\n\t\t\t * Have a look has the user entered an comment for this question?\n\t\t\t*/\n\t\t\tif(isset($_GET['comment']) && !empty($_GET['comment']))\n\t\t\t{\n\t\t\t\t$comment = strip_tags($_GET['comment']);\n\t\t\t\t\n\t\t\t\t$comment = $_GET['commentanswers'] . $comment;\n\t\t\t\t\n\t\t\t\t// if yes lets store in the db\n\t\t\t\t$this->model->addUserComment((int)$_GET['qid'], $comment);\n\t\t\t}\n\t\t\t\n\t\t\t/*\n\t\t\t * Check the special param if the next question should not be displayed\n\t\t\t */\n\t\t\tif(isset($_GET['special']))\n\t\t\t{\n\t\t\t\t// make a break\n\t\t\t\tif($_GET['special'] == 'pause')\n\t\t\t\t{\n\t\t\t\t\t$this->model->updateQuizSession(S::get('quiz-session'), $quiz, $i);\n\t\t\t\t\treturn $this->pause();\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t//\n\t\t\t\tif($_GET['special'] == 'result')\n\t\t\t\t{\n\t\t\t\t\t$this->model->updateQuizSession(S::get('quiz-session'), $quiz, $i);\n\t\t\t\t\treturn $this->resultNew($quiz[($i-1)],$dia->getId());\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t/*\n\t\t\t * check if there is a next question in quiz array push it to the user\n\t\t\t * othwise forward to the result of the quiz\n\t\t\t */\n\t\t\tif(isset($quiz[$i]))\n\t\t\t{\n\t\t\t\t// get the question\n\t\t\t\tif($question = $this->model->getQuestion($quiz[$i]['id']))\n\t\t\t\t{\t\t\n\t\t\t\t\t// get possible answers\t\t\n\t\t\t\t\t$comment_aswers = '';\n\t\t\t\t\tif($answers = $this->model->getAnswers($question['id']))\n\t\t\t\t\t{\n\t\t\t\t\t\t// random sorting for the answers\n\t\t\t\t\t\tshuffle($answers);\n\n\t\t\t\t\t\t$x=1;\n\t\t\t\t\t\tforeach ($answers as $a)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$comment_aswers .= $x.'. Frage #'.$a['id'].' => '.preg_replace('/[^a-zA-Z0-9\\ \\.]/','',tt($a['text'],25)).\"\\n\";\n\t\t\t\t\t\t\t$x++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * increase the question index so we are at the next question ;)\n\t\t\t\t\t\t */ \n\t\t\t\t\t\t$i++;\n\t\t\t\t\t\tS::set('quiz-index',$i);\n\t\t\t\t\t\t\n\t\t\t\t\t\t// update quiz session\n\t\t\t\t\t\t$session_id = S::get('quiz-session');\n\t\t\t\t\t\t$this->model->updateQuizSession($session_id, $quiz, $i);\n\t\t\t\t\t\tS::set('quiz-quest-start',time());\n\t\t\t\t\t\t\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * let's prepare the output dialog\n\t\t\t\t\t\t */\n\t\t\t\t\t\t$dia->addOpt('width', 1000);\n\t\t\t\t\t\t$dia->addOpt('height', '($(window).height()-40)',false);\n\t\t\t\t\t\t$dia->addOpt('position', 'center');\n\t\t\t\t\t\t$dia->setTitle('Frage '.($i).' / '.count($quiz));\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t$dia->addContent($this->view->quizQuestion($question,$answers));\n\t\t\t\t\t\t\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * for later function is not ready yet :)\n\t\t\t\t\t\t */\n\t\t\t\t\t\t$dia->addButton('Weiter', 'questcheckresult();return false;');\n\t\t\t\t\t\t$dia->addButton('Pause', 'ajreq(\\'pause\\',{app:\\'quiz\\',sid:\\''.$session_id.'\\'});');\n\n\t\t\t\t\t\t$dia->addButton('nächste Frage','ajreq(\\'next\\',{app:\\'quiz\\',qid:'.(int)$question['id'].',commentanswers:\"'.jsSafe($comment_aswers).'\"});$(\".quiz-questiondialog .ui-dialog-buttonset .ui-button\").button( \"option\", \"disabled\", true );$(\".quiz-questiondialog .ui-dialog-buttonset .ui-button span\").prepend(\\'<i class=\"fa fa-spinner fa-spin\"></i> \\')');\n\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * add next() Button\n\t\t\t\t\t\t */\n\n\t\t\t\t\t\t$dia->addOpt('open','\n\t\t\t\t\t\tfunction(){\n\t\t\t\t\t\t\tsetTimeout(function(){\n\t\t\t\t\t\t\t\t$close = $(\"#'.$dia->getId().'\").prev().children(\".ui-dialog-titlebar-close\");\n\t\t\t\t\t\t\t\t$close.unbind(\"click\");\n\t\t\t\t\t\t\t\t$close.click(function(){\n\t\t\t\t\t\t\t\t\tajreq(\"pause\",{app:\"quiz\",sid:'.(int)$session_id.'});\n\t\t\t\t\t\t\t\t\t//abortOrPause(\"'.$dia->getId().'\");\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t$(\"#quizcomment\").hide();\n\t\t\t\t\t\t\t\t$(\".quiz-questiondialog .ui-dialog-buttonset button:last\").hide();\n\t\t\t\t\t\t\t\t$(\".quiz-questiondialog .ui-dialog-buttonset .ui-button:contains(\\'Pause\\')\").hide();\n\t\t\t\t\t\t\t\t$(\".ui-dialog-titlebar-close\").hide();\n\t\t\t\t\t\t\t},100);\n\t\t\t\t\t\t}',false);\n\t\t\t\t\t\t\n\t\t\t\t\t\t$return = $dia->xhrout();\n\t\t\t\t\t\t\n\t\t\t\t\t\t// additional output if it was a joke question\n\t\t\t\t\t\tif($was_a_joke)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$return['script'] .= 'pulseInfo(\"<h3>Das war eine Scherzfrage</h3>Du kannst beruhigt weitermachen und auch wenn die möglichen Antworten nicht falsch sind, müssen diese Fragen nicht richtig beantwortet werden, sie dienen lediglich des auflockerns für Zwischendurch ;)\",{sticky:true});';\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * strange but it works ;) generate the js code and send is to the client for execute\n\t\t\t\t\t\t */\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t$quizbreath = '\n\t\t\t\t\t\t\t$(\\'#quizwrapper\\').show();\n\t\t\t\t\t\t\t$(\\'#quizbreath\\').hide();\n\t\t\t\t\t\t\tvar count = '.(int)$question['duration'].';\n\t\t\t\t\t\t\tvar counter = null;\n\t\t\t\t\t\t';\n\t\t\t\t\t\t\n\t\t\t\t\t\tif($easymode == 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$quizbreath = '\n\t\t\t\t\t\t\t$(\\'#quizwrapper\\').hide();\n\t\t\t\t\t\t\t$(\\'#quizbreath\\').show();\n\t\t\t\t\t\t\t$(\"#'.$dia->getId().'\").next(\".ui-dialog-buttonpane\").css(\"visibility\",\"hidden\");\n\t\t\t\t\t\t\tvar count = '.(int)$question['duration'].';\n\t\t\t\t\t\t\tvar counter = null;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfunction timer()\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t count--;\n\t\t\t\t\t $(\"#countdown\").progressbar(\"value\",count);\n\t\t\t\t\t\t\t //$(\"#countdown\").text((count)+\"\");\n\t\t\t\t\t\t\t if (count <= 0)\n\t\t\t\t\t\t\t {\n\t\t\t\t\t\t\t questcheckresult(true);\n\t\t\t\t\t\t\t return;\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tsetTimeout(function(){\n\t\t\t\t\t\t\t\t$(\\'#quizbreath span\\').text(\"Auf die Plätze!\");\n\t\t\t\t\t\t\t},3000);\n\t\t\t\t\t\t\tsetTimeout(function(){\n\t\t\t\t\t\t\t\t$(\\'#quizbreath span\\').text(\"Fertig...\");\n\t\t\t\t\t\t\t},4000);\n\t\t\t\t\t\t\tsetTimeout(function(){\n\t\t\t\t\t\t\t\t$(\\'#quizbreath span\\').text(\"Weiter gehts!\");\n\t\t\t\t\t\t\t},5000);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tsetTimeout(function(){\n\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\tcounter = setInterval(timer, 1000); \n\t\t\t\t\t\t\t\t$(\"#countdown\").progressbar({\n\t\t\t\t\t\t value: '.$question['duration'].',\n\t\t\t\t\t\t max:'.$question['duration'].'\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$(\\'#quizwrapper\\').show();\n\t\t\t\t\t\t\t\t$(\\'#quizbreath\\').hide();\n\t\t\t\t\t\t\t\t$(\".ui-dialog-buttonpane\").css(\"visibility\",\"visible\");\n\t\t\t\t\t\t\t},6000);';\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t$return['script'] .= '\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfunction abortOrPause()\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$(\"#abortOrPause\").dialog(\"open\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfunction questcomment(el)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif($(\\'#qanswers input:checked\\').length > 0)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tclearInterval(counter);\n\t\t\t\t\t\t\t\t\t$(\".ui-dialog-buttonpane button:contains(\\'Kommentar\\')\").hide();\n\t\t\t\t\t\t\t\t\t$(\"#quizwrapper input, #countdown\").hide();\n\t\t\t\t\t\t\t\t\t$(\"#quizwrapper\").css({\n\t\t\t\t\t\t\t\t\t\t\"height\":\"50%\",\n\t\t\t\t\t\t\t\t\t\t\"overflow\":\"auto\"\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t$(\"#quizcomment\").show();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tpulseError(\\'Bitte treffe erst eine Auswahl!\\')\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfunction questgonext(special)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif(special == undefined)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tspecial = 0;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tclearInterval(counter);\n\t\t\t\t\t\t\t\tajreq(\\'next\\',{answer:$(\\'.qanswers\\').serialize(),noco:$(\\'.nocheck:checked\\').length,app:\\'quiz\\',commentanswers:\"'.jsSafe($comment_aswers).'\",comment:$(\\'#quizusercomment\\').val(),qid:'.(int)$question['id'].',special:special});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfunction breaknext()\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif($(\\'#qanswers input:checked\\').length > 0)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tquestgonext(\"pause\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tpulseError(\\'Bitte treffe erst eine Auswahl!\\')\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfunction questionnext()\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif($(\\'#qanswers input:checked\\').length > 0)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tquestgonext();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tpulseError(\\'Bitte treffe eine Auswahl!\\')\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfunction questcheckresult(nowait)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif(nowait == undefined)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tnowait = false;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif(nowait || $(\\'#qanswers input:checked\\').length > 0)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tquestgonext(\"result\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tpulseError(\\'Bitte treffe erst eine Auswahl!\\')\n\t\t\t\t\t\t\t\t}\t\n\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$(\"li.noanswer\").click(function(){\n\t\t\t\t\t\t\t\tsetTimeout(function(){\n\t\t\t\t\t\t\t\t\tif($(\"input.nocheck:checked\").length > 0)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t$(\"li.answer input\").each(function(){\n\t\t\t\t\t\t\t\t\t\t\tthis.checked = false;\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},50);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$(\"li.answer input\").click(function(){\n\t\t\t\t\t\t\t\tif(this.checked)\n\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}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$(\"li.answer, li.noanswer\").click(function(ev){\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tvar nName = ev.target.nodeName.toLowerCase();\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif(nName == \"li\" || nName == \"label\")\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tif($(this).children(\"label\").children(\"input:checked\").length >= 1)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t$(this).children(\"label\").children(\"input\")[0].checked = false;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t$(this).children(\"label\").children(\"input\")[0].checked = true;\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\t\n\t\t\t\t\t\t\t$(\"li.answer\").click(function(){\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif($(\"li.answer input:checked\").length > 0)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t$(\"input.nocheck\")[0].checked = false;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\n\t\t\t\t\t\t\tvar width = 1000;\n\t\t\t\t\t\t\tif($(window).width() < 1000)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\twidth = ($(window).width()-40);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t$(\"#'.$dia->getId().'\").dialog(\"option\",{\n\t\t\t\t\t\t\t\twidth:width,\n\t\t\t\t\t\t\t\theight:($(window).height()-40)\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t$(window).resize(function(){\n\t\t\t\t\t\t\t\tvar width = 1000;\n\t\t\t\t\t\t\t\tif($(window).width() < 1000)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\twidth = ($(window).width()-40);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t$(\"#'.$dia->getId().'\").dialog(\"option\",{\n\t\t\t\t\t\t\t\t\twidth:width,\n\t\t\t\t\t\t\t\t\theight:($(window).height()-40)\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\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t' . $quizbreath;\n\t\t\t\t\t\treturn $return;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t$i++;\n\t\t\t\t\t\tS::set('quiz-index',$i);\n\t\t\t\t\t\treturn array(\n\t\t\t\t\t\t\t'status' => 1,\n\t\t\t\t\t\t\t'script' => 'pulseError(\"Diese Frage hat Keine Antworten, überspringe...\");ajreq(\"next\",{app:\"quiz\"});'\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\telse\n\t\t\t{\n\t\t\t\treturn $this->quizResult();\n\t\t\t}\n\t\t}\n\t\t\n\t\t$i++;\n\t\tS::set('quiz-index',$i);\n\t\treturn array(\n\t\t\t\t'status' => 1,\n\t\t\t\t'script' => 'pulseError(\"Es ist ein Fehler aufgetreten, Frage wird übersprungen\");ajreq(\"next\",{app:\"quiz\"});'\n\t\t);\n\t\t\n\t}",
"public function test_for_quiz_question()\n {\n $this->withOutExceptionHandling();\n\n $user = $this->actingAs(User::factory()->make());\n\n $session = QuizSession::factory()->create();\n $schedule = ClassSchedule::factory()->create();\n\n $response = $this->post('api/v1/quiz/question',\n array_merge($this->data(), [\n 'quiz_session_id' => $session->id,\n 'class_schedule_id' => $schedule->id,\n ]\n )\n );\n\n $response->assertStatus(200);\n }",
"private function generate_question() {\n\n require_once(__DIR__ . '/csv_gd.class.php');\n $csv_filename = $this->configuration['base_data_dir'] . '/csv/' . $this->configuration['csv_input'];\n\n $data_quiz_src_obj = new csv_gd($csv_filename);\n $data_quiz_src_orig = $data_quiz_src_obj->csv_to_array();\n\n\n\n // filter unwanted question (tags, diff level, void )\n $data_quiz_src_filtered = $this->quiz_filter($data_quiz_src_orig, $this->configuration['tags'], $this->configuration['min_diffucult_level'], $this->configuration['max_diffucult_level']);\n\n\n // reverse question with_answer\n if ($this->configuration['reverse_question'] == TRUE) {\n $data_quiz_src_filtered = $this->quiz_switch_question_with_answer($data_quiz_src_filtered);\n }\n\n\n // generate question and answer\n $data_quiz_src = $this->quiz_generate($data_quiz_src_filtered);\n\n\n // randomize quiz \n if ($this->configuration['randomize_question'] == TRUE) {\n shuffle($data_quiz_src);\n }\n\n\n // restrict the maxium number of question\n if ($this->configuration['max_question_total'] > 0) {\n $this->configuration['max_question_total'] = min(count($data_quiz_src), $this->configuration['max_question_total']);\n } else {\n $this->configuration['max_question_total'] = count($data_quiz_src);\n }\n $this->question = array_slice($data_quiz_src, 0, $this->configuration['max_question_total']);\n\n $this->configuration['debug']=$this->debug;\n\n // return $this->quiz_questions;\n }",
"public function startquiz()\n\t{\n\t\tif(!S::may())\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\t/*\n\t\t * First we want to check is there an quiz session what the user have lost?\n\t\t */\n\t\tif($session = $this->model->getExsistingSession($_GET['qid']))\n\t\t{\n\t\t\t// if yes reinitiate the running quiz session\n\t\t\tS::set('quiz-id', (int)$_GET['qid']);\n\t\t\tS::set('quiz-questions', $session['quiz_questions']);\n\t\t\tS::set('quiz-index', $session['quiz_index']);\n\t\t\tS::set('quiz-session', $session['id']);\n\t\t\t$easymode = false;\n\t\t\tif ($session['easymode'] == 1 && (int)$_GET['qid'] == 1)\n\t\t\t{\n\t\t\t\t$easymode = true;\n\t\t\t}\n\t\t\tS::set('quiz-easymode', $easymode);\n\t\t\t\n\t\t\t/*\n\t\t\t * Make a little output that the user can continue the quiz\n\t\t\t */\n\t\t\t$dia = new XhrDialog();\n\t\t\t\n\t\t\t$dia->setTitle('Quiz fortführen');\n\t\t\t\n\t\t\t$dia->addContent( '<h1>Du hast Dein Quiz nicht beendet</h1><p>Aber keine Sorge Du kannst einfach jetzt das Quiz zum Ende bringen.</p><p>Also viel Spaß beim weiterquizzen.</p>');\n\t\t\t$dia->addButton('Quiz fortführen', 'ajreq(\\'next\\',{app:\\'quiz\\'});');\n\t\t\t$return = $dia->xhrout();\n\t\t\t\n\t\t\t$return['script'] .= $this->abortOrOpenDialog($session['id']);\n\t\t\t\n\t\t\treturn $return;\n\t\t\t\n\t\t}\n\t\t/*\n\t\t * Otherwiser we start a new quiz session\n\t\t */\n\t\telse if($quiz = $this->model->getQuiz($_GET['qid']))\n\t\t{\n\t\t\t\n\t\t\t/*\n\t\t\t * if foodsaver quiz user can choose between easy and quick mode\n\t\t\t*/\n\t\t\t\n\t\t\tif($_GET['qid'] == 1 && isset($_GET['easymode']) && $_GET['easymode'] == 1)\n\t\t\t{\n\t\t\t\tS::set('quiz-easymode', true);\n\t\t\t\t$quiz['questcount'] = 20;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tS::set('quiz-easymode', false);\n\t\t\t}\n\t\t\t\n\t\t\t/*\n\t\t\t * first get random sorted quiz questions\n\t\t\t */\n\t\t\tif($questions = $this->getRandomQuestions($_GET['qid'],$quiz['questcount']))\n\t\t\t{\n\t\t\t\t//Get the description how the quiz works\n\t\t\t\t$content = $this->model->getContent(17);\n\t\t\t\t\n\t\t\t\t// for safety check if there are not to many questions\n\t\t\t\t$questions = array_slice($questions, 0, (int)$quiz['questcount']);\n\t\t\t\t\n\t\t\t\t// check for double question (bugfix)\n\t\t\t\t$questions = $this->replaceDoubles($questions);\n\t\t\t\t\n\t\t\t\t/*\n\t\t\t\t * Store quiz data in the users session\n\t\t\t\t */\n\t\t\t\tS::set('quiz-id', (int)$_GET['qid']);\n\t\t\t\tS::set('quiz-questions', $questions);\n\t\t\t\tS::set('quiz-index', 0);\n\t\t\t\t\n\t\t\t\t/*\n\t\t\t\t * Make a litte output for the user that he/she cat just start the quiz now\n\t\t\t\t */\n\t\t\t\t$dia = new XhrDialog();\n\t\t\t\t$dia->addOpt('width', 600);\n\t\t\t\t$dia->setTitle($quiz['name'].'-Quiz');\n\t\t\t\t$dia->addContent($this->view->initQuiz($quiz,$content));\n\t\t\t\t$dia->addAbortButton();\n\t\t\t\t$dia->addButton('Quiz Starten', 'ajreq(\\'next\\',{app:\\'quiz\\'});$(\\'#'.$dia->getId().'\\').dialog(\\'close\\');');\n\t\t\t\t\n\t\t\t\t$return = $dia->xhrout();\n\t\t\t\t\n\t\t\t\t$return['script'] .= $this->abortOrOpenDialog($session['id']);\n\t\t\t\t\n\t\t\t\treturn $return;\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\t/*\n\t\t * If we cant get an quiz from the db send an error\n\t\t */\n\t\treturn array(\n\t\t\t'status' => 1,\n\t\t\t'script' => 'pulseError(\"Quiz konnte nicht gestartet werden...\");'\n\t\t);\n\t}",
"public function test_quizp_with_question_with_variants_attempt_walkthrough($variantno, $correctresponse, $done = false) {\n global $SITE;\n\n $this->resetAfterTest($done);\n\n $this->setAdminUser();\n\n if ($this->quizpwithvariants === null) {\n // Make a quizp.\n $quizpgenerator = $this->getDataGenerator()->get_plugin_generator('mod_quizp');\n\n $this->quizpwithvariants = $quizpgenerator->create_instance(array('course'=>$SITE->id,\n 'questionsperpage' => 0,\n 'grade' => 100.0,\n 'sumgrades' => 1));\n\n $questiongenerator = $this->getDataGenerator()->get_plugin_generator('core_question');\n\n $cat = $questiongenerator->create_question_category();\n $calc = $questiongenerator->create_question('calculatedsimple', 'sumwithvariants', array('category' => $cat->id));\n quizp_add_quizp_question($calc->id, $this->quizpwithvariants, 0);\n }\n\n\n // Make a new user to do the quizp.\n $user1 = $this->getDataGenerator()->create_user();\n $this->setUser($user1);\n $quizpobj = quizp::create($this->quizpwithvariants->id, $user1->id);\n\n // Start the attempt.\n $quba = question_engine::make_questions_usage_by_activity('mod_quizp', $quizpobj->get_context());\n $quba->set_preferred_behaviour($quizpobj->get_quizp()->preferredbehaviour);\n\n $timenow = time();\n $attempt = quizp_create_attempt($quizpobj, 1, false, $timenow);\n\n // Select variant.\n quizp_start_new_attempt($quizpobj, $quba, $attempt, 1, $timenow, array(), array(1 => $variantno));\n $this->assertEquals('1,0', $attempt->layout);\n quizp_attempt_save_started($quizpobj, $quba, $attempt);\n\n // Process some responses from the student.\n $attemptobj = quizp_attempt::create($attempt->id);\n $this->assertFalse($attemptobj->has_response_to_at_least_one_graded_question());\n\n $tosubmit = array(1 => array('answer' => $correctresponse));\n $attemptobj->process_submitted_actions($timenow, false, $tosubmit);\n\n // Finish the attempt.\n $attemptobj = quizp_attempt::create($attempt->id);\n $this->assertTrue($attemptobj->has_response_to_at_least_one_graded_question());\n\n $attemptobj->process_finish($timenow, false);\n\n // Re-load quizp attempt data.\n $attemptobj = quizp_attempt::create($attempt->id);\n\n // Check that results are stored as expected.\n $this->assertEquals(1, $attemptobj->get_attempt_number());\n $this->assertEquals(1, $attemptobj->get_sum_marks());\n $this->assertEquals(true, $attemptobj->is_finished());\n $this->assertEquals($timenow, $attemptobj->get_submitted_date());\n $this->assertEquals($user1->id, $attemptobj->get_userid());\n $this->assertTrue($attemptobj->has_response_to_at_least_one_graded_question());\n\n // Check quizp grades.\n $grades = quizp_get_user_grades($this->quizpwithvariants, $user1->id);\n $grade = array_shift($grades);\n $this->assertEquals(100.0, $grade->rawgrade);\n\n // Check grade book.\n $gradebookgrades = grade_get_grades($SITE->id, 'mod', 'quizp', $this->quizpwithvariants->id, $user1->id);\n $gradebookitem = array_shift($gradebookgrades->items);\n $gradebookgrade = array_shift($gradebookitem->grades);\n $this->assertEquals(100, $gradebookgrade->grade);\n }",
"function exam_take_form($form, &$form_state, $pExamID, $pQNO=0){\n \n $vCurrentQuestionNumber = 0; // This should be properly defined later\n \n //Prepare this function for iterative use\n // - ensure the $vExamInstance is only created the first time\n // - pass back into this function a value for the question number\n // - capture student answers\n //print 'exam = ' . $pExamID;\n //\n // $_SESSION['exam']['pExamInitialize'] = 1: Initiate a session for a new exam\n // $_SESSION['exam']['pExamContinuation'] = 2: Initiate a session for an existing exam\n // \n // Capture SESSION variables, if they exist. This is not necessary,\n // but if we wait and try to reference the session variables later,\n // we have to first check if the variable exists (isset), and \n // that's so annoying. It detracts from the code's readability.\n if (isset($_SESSION['exam']['pExamInitialize'])) { \n $pExamInitialize = $_SESSION['exam']['pExamInitialize'];\n // Unset the session variable pExamInitiative so that the exam \n // is not initialized again unless a new exam is launched. \n unset($_SESSION['exam']['pExamInitialize']);\n } else {\n $pExamInitialize = 0;\n }\n \n if ($pExamInitialize == '1') {\n // Initialize the page advance controls\n exam_take_page_advance_init();\n // Initialize the exam - create an exam instance in the database\n // and generate a new exam_instance_id. Capture the exam_instance_id \n // in a variable, we'll need this.\n $vExamInstanceID = ExamInstance::populateInstanceTables($pExamID); \n $_SESSION['exam']['pExamInstanceID'] = $vExamInstanceID;\n } else {\n // Obtain the already-established exam_instance_id\n $vExamInstanceID = $_SESSION['exam']['pExamInstanceID'];\n }\n \n ExamInstance::storeMessage('$vExamInstanceID = ' . $vExamInstanceID, 'exam_take_form');\n \n // SKERE777 add logic for what happens with bogus incoming values for pExamInstanceID\n \n // Get basic exam data\n $vExamInfo = ExamInstance::getInfoForExamInstanceID($vExamInstanceID);\n\n //\n // Confirm that the incoming request is asking for a valid question number\n // pQNO is \"Parameter for a Question Number\". All incoming parameters should\n // start with a \"p\". But that may not be fully enforced yet.\n //\n if (($pQNO > 0) and ($pQNO <= $vExamInfo['totalQuestions'])) { \n $vCurrentQuestionNumber = $pQNO;\n $_SESSION['exam']['pCurrentQuestionNumber'] = $vCurrentQuestionNumber;\n } else {\n // \n // SKERE - WORK ON THIS\n // Display an error message warning that the \n // incoming request is for a non-existent question number\n ExamInstance::storeMessage('ERROR: Invalid question number ' . $pQNO . ' ***', 'exam_take_form');\n $form['pQuestionNumber'] = array(\n '#markup' => t('Invalid question number ' . $pQNO \n . ' of ' \n . $vExamInfo['totalQuestions'] . '</h2></p>')\n ); \n return $form;\n }\n \n // Get the array of answers for the current question\n $vTheQuestion = ExamInstance::getOneQuestion($vExamInstanceID, $vCurrentQuestionNumber);\n ExamInstance::storeMessage('$vTheQuestion - text is \"' . $vTheQuestion['question_text'] . '\"', 'exam_take_form');\n $vTheAnswers = ExamInstance::getOneQuestionsAnswers($vExamInstanceID, $vCurrentQuestionNumber);\n $vNumberOfAnswers = count($vTheAnswers)-1; // Account for the first initialized blank row. Looping starts at 0 and needs to iterate four times, so 0, 1, 2, 3. Three is the end.\n \n ExamInstance::storeMessage('$vNumberOfAnswers = ' . $vNumberOfAnswers, 'exam_take_form');\n \n $form['pQuestionNumber'] = array(\n '#markup' => t('<p><h2>Question #' \n . $vCurrentQuestionNumber . ' of ' \n . $vExamInfo['totalQuestions'] . '</h2></p>')\n );\n \n $form['pMark'] = array(\n '#type' => 'checkbox',\n '#title' => t('Mark'),\n '#default_value' => $vTheQuestion['marked'] // Skere - check this\n );\n \n // Create and initialize a counter \n // to support the creation of \n // an array of answers for the current question\n // to be used in the form['pAnswer'] object \n $vCounter = 1;\n while ($vCounter <= $vNumberOfAnswers) {\n // Extract the answer_instance_id value\n //$vAnswerInstanceID = $vTheAnswers[$vCounter]['answer_instance_id'];\n // Build the answer string to be displayed \n $vAnswerString = '<b>' . $vTheAnswers[$vCounter]['answer_letter'] . '</b>: ' .\n $vTheAnswers[$vCounter]['answer_text'];\n // Combine the answer letter and the string and build the array\n // REPLACE THIS WITH THE NEXT LINE: $vAnswerArray[$vAnswerInstanceID] = $vAnswerString;\n $vAnswerArray[$vCounter] = $vAnswerString;\n $vCounter++;\n }\n\n // Very important - run the question_text through the Drupal filter to ensure\n // that any uses of the \"img\" tag have proper URLS. \n ExamInstance::storeMessage('$vTheQuestion[\\'question_text\\']=' . $vTheQuestion['question_text'], 'exam_take_form');\n ExamInstance::storeMessage('Just before call to filter', 'exam_take_form');\n $vTheQuestion['question_text'] = filter_for_URL($vTheQuestion['question_text']);\n ExamInstance::storeMessage('Just after call to filter', 'exam_take_form'); \n // End of the filtering of the question text\n \n // The set of answers is treated as a single form object. \n // It includes the question - see the \"title\" property.\n // Note that the value stored for answers selected is the answer_instance_id\n \n $vDefaultValue = $vTheQuestion['selected_answer_number']; // SKERE - check this\n ExamInstance::storeMessage('$vDefaultValue = ' . $vDefaultValue . '.', 'exam_take_form');\n \n $form['pAnswer'] = array(\n '#type' => 'radios',\n '#options' => $vAnswerArray,\n '#title' => t($vTheQuestion['question_text']),\n '#default_value' => $vDefaultValue \n );\n \n //print '** The big answer is: ' . $vExamInstance->ei_qa[$vCurrentQuestionNumber]['selected_answer_instance_id'] . ' ** ';\n \n $form['actions'] = array('#type' => 'actions');\n if ($vCurrentQuestionNumber <> 1) {\n $form['actions']['pButtonPrevious'] = array(\n '#type' => 'submit',\n '#value' => t('Previous Question'),\n '#name' => 'Previous',\n '#prefix' => '<div id=\"buttonGroup\" class=\"demo\">',\n '#suffix' => '</div',\n '#submit' => array('exam_capture_data'\n , 'exam_take_form_submit_previous'\n , 'exam_take_form_submit'\n )\n );\n }\n\n if ($vCurrentQuestionNumber <> $vExamInfo['totalQuestions']) {\n $form['actions']['pButtonNext'] = array(\n '#type' => 'submit',\n '#value' => t('Next Question'),\n '#name' => 'Next',\n '#prefix' => '<div id=\"buttonGroup\" class=\"demo\">',\n '#suffix' => '</div',\n '#submit' => array('exam_capture_data'\n , 'exam_take_form_submit_next'\n , 'exam_take_form_submit'\n )\n );\n }\n\n $form['actions']['pButtonSummary'] = array(\n '#type' => 'submit',\n '#value' => t('Show Summary'),\n '#name' => 'Summary',\n '#prefix' => '<div id=\"buttonGroup\" class=\"demo\">',\n '#suffix' => '</div', \n '#submit' => array('exam_take_form_submit_summary')\n );\n \n //Do we need these? Haven't tried them yet\n //$form['#validate'][] = 'exam_take_form_validate';\n //field_attach_form('exam', $exam, $form, $form_state);\n\n // Specify the function to handle form submission\n //$form['#submit'][] = 'exam_take_form_submit';\n \n return $form;\n \n}",
"function AddTesteeQuestions($testEntryID, $examQAs)\n {\n try\n {\n if (count($examQAs) < 1)\n {\n return;\n }\n \n $db = GetDBConnection();\n \n $qCount = 1;\n $questions = array();\n foreach ($examQAs as $qa)\n {\n $questionID = $qa->GetQuestionId();\n $question = GetQuestion($questionID);\n \n if ($question != FALSE)\n {\n $aCount = 1;\n $answers = GetQuestionAnswers($questionID);\n \n for ($i = 0; $i < count($answers); $i++)\n {\n $chosen = '0';\n $answer = $answers[$i];\n $answer['AnswerNo'] = $aCount;\n \n if ($answer[GetAnswerIdIdentifier()] == $qa->GetAnswerId())\n {\n $chosen = '1';\n }\n \n $answer['Chosen'] = $chosen;\n \n $answers[$i] = $answer;\n \n $aCount++;\n }\n \n $question['QuestionNo'] = $qCount;\n $question['Answers'] = $answers;\n \n $questions[] = $question;\n \n $qCount++;\n }\n }\n \n $qQuery = 'INSERT INTO ' . GetTesteeQuestionsIdentifier()\n . ' (' . GetTestIdIdentifier()\n . ', ' . 'QuestionNo'\n . ', ' . 'Level'\n . ', ' . 'Instructions'\n . ', ' . 'Question' . ') VALUES';\n \n $aQuery = 'INSERT INTO ' . GetTesteeAnswersIdentifier()\n . ' (' . GetTestIdIdentifier()\n . ', ' . 'QuestionNo'\n . ', ' . 'AnswerNo'\n . ', ' . 'Answer'\n . ', ' . 'Correct'\n . ', ' . 'Chosen' . ') VALUES';\n \n foreach($questions as $question)\n {\n $answers = $question['Answers'];\n $questionNo = $question['QuestionNo'];\n \n $qQuery .= ' (:' . GetTestIdIdentifier()\n . ', :' . 'QuestionNo' . $questionNo\n . ', :' . 'Level' . $questionNo\n . ', :' . 'Instructions' . $questionNo\n . ', :' . 'Question' . $questionNo . '),';\n \n foreach($answers as $answer)\n {\n $answerNo = $answer['AnswerNo'];\n \n $aQuery .= ' (:' . GetTestIdIdentifier()\n . ', :' . 'QuestionNo' . $questionNo . $answerNo\n . ', :' . 'AnswerNo' . $questionNo . $answerNo\n . ', :' . 'Answer' . $questionNo . $answerNo\n . ', :' . 'Correct' . $questionNo . $answerNo\n . ', :' . 'Chosen' . $questionNo . $answerNo . '),';\n }\n }\n \n $qQuery = rtrim($qQuery, ',') . ';';\n $aQuery = rtrim($aQuery, ',') . ';';\n \n $qStatement = $db->prepare($qQuery);\n $aStatement = $db->prepare($aQuery);\n \n foreach($questions as $question)\n {\n $answers = $question['Answers'];\n $questionNo = $question['QuestionNo'];\n \n foreach($answers as $answer)\n {\n $answerNo = $answer['AnswerNo'];\n \n $aStatement->bindValue(':' . GetTestIdIdentifier(), $testEntryID);\n $aStatement->bindValue(':' . 'QuestionNo' . $questionNo . $answerNo, $questionNo);\n $aStatement->bindValue(':' . 'AnswerNo' . $questionNo . $answerNo, $answerNo);\n $aStatement->bindValue(':' . 'Answer' . $questionNo . $answerNo, $answer[GetNameIdentifier()]);\n $aStatement->bindValue(':' . 'Chosen' . $questionNo . $answerNo, $answer['Chosen']);\n $aStatement->bindValue(':' . 'Correct' . $questionNo . $answerNo, $answer['Correct']);\n }\n \n $qStatement->bindValue(':' . GetTestIdIdentifier(), $testEntryID);\n $qStatement->bindValue(':' . 'QuestionNo' . $questionNo, $questionNo);\n $qStatement->bindValue(':' . 'Level' . $questionNo, $question['Level']);\n $qStatement->bindValue(':' . 'Instructions' . $questionNo, $question['Instructions']);\n $qStatement->bindValue(':' . 'Question' . $questionNo, $question[GetNameIdentifier()]);\n }\n \n $qStatement->execute();\n $qStatement->closeCursor();\n \n $aStatement->execute();\n $aStatement->closeCursor();\n }\n catch (PDOException $ex)\n {\n LogError($ex);\n }\n }",
"public function test_all_questions_and_answers_route_when_questioner_has_sitewide_role() {\n global $DB;\n\n // create a user\n $user = $this->getDataGenerator()->create_user();\n $roleid = $DB->get_field('role', 'id', array('shortname' => 'manager'));\n $this->getDataGenerator()->role_assign($roleid, $user->id);\n\n // create a course\n $course = $this->getDataGenerator()->create_course();\n\n // create a course module\n $videoquanda = $this->getDataGenerator()->create_module('videoquanda', array(\n 'course' => $course->id\n ));\n\n $now = time();\n\n $this->loadDataSet($this->createArrayDataSet(array(\n 'videoquanda_questions' => array(\n array('id', 'instanceid', 'userid', 'timecreated', 'timemodified' ,'seconds', 'text'),\n array(1, $videoquanda->id, $user->id, $now, $now + 1, 2, 'dummy text')\n )\n )));\n\n $this->setUser($user);\n $client = new Client($this->_app);\n $client->request('GET', '/api/v1/' . $videoquanda->id . '/questions');\n $json = $client->getResponse()->getContent();\n $this->assertEquals(200, $client->getResponse()->getStatusCode());\n $array = (array) json_decode($json);\n $this->assertCount(1, $array);\n }",
"public function run()\n {\n $questions = Question::all();\n \n foreach ($questions as $question) {\n for ($i=1; $i <= 1; $i++) { \n factory(QuestionOption::class)->create([\n 'option' => \"opcion correcta\",\n 'correct' => true,\n 'question_id' => $question->id,\n ]);\n }\n for ($i=1; $i <= 3; $i++) { \n factory(QuestionOption::class)->create([\n 'option' => \"opcion\",\n 'correct' => false,\n 'question_id' => $question->id,\n ]);\n }\n }\n }",
"public function test_quizUserScoreFunctions() {\n \t$quiz = TheTrainingMangerLMS\\LessonQuiz::create(\n \t\tarray( 'title' => 'This is my favorite quiz!',\n \t\t\t 'options' => array(\n \t\t\t \t\t'number_of_questions' => 20,\n \t\t\t \t\t'time_limit' => 3600,\n \t\t\t \t\t'allowed_repeats' => 2\n \t\t\t \t)\n \t\t)\n \t);\n \t$this->assertTrue(get_class($quiz) == 'TheTrainingMangerLMS\\LessonQuiz');\n \t// create a whole bunch of questions, say 25 and add them\n \tfor($i = 0; $i < 25; $i++) {\n\t\t\t$question = TheTrainingMangerLMS\\Quiz\\Question::create( array( 'title' => \"This is my favorite question {$i}!\") );\n\t\t\t$question->setAnswer($this->createSimpleChoiceAnswer());\n\t\t\t$quiz->addQuestion($question);\n \t}\n \t$this->assertEquals(25, count($quiz->getQuestions()));\n \t$user = TheTrainingMangerLMS\\User::create( array( 'login' => 'Joe Schmoe', 'password' => 'test123' ) );\n \t$this->assertTrue(get_class($user) == 'TheTrainingMangerLMS\\User');\n $user = TheTrainingMangerLMS\\Student::promote($user);\n $this->assertTrue(get_class($user) == 'TheTrainingMangerLMS\\Student');\n \t$quiz->startQuiz($user);\n \t$questions = explode(',', get_user_meta($user->ID(), ttp_lms_prefix('quiz_' . $quiz->ID() . '_try_' . '1' . '_questions'), true));\n \tfor($i = 0; $i < 10; $i++) {\n\t \t$question = $quiz->getNextQuestion($user);\n \t\t$this->assertEquals($questions[$i], $question->ID());\n \t\t$quiz->saveQuestionResponseAndOutcome($user, $question, array('choice' => 1), array( 'outcome' => 'CORRECT', 'score' => 2.0, 'tpp' => 4.0));\n \t}\n \t$quiz->endQuiz($user);\n \t$totalpoints = get_user_meta($user->ID(), ttp_lms_prefix('quiz_' . $quiz->ID() . '_try_' . '1' . '_ttp'), false);\n \t$this->assertEquals(1, count($totalpoints));\n \t$this->assertEquals(80, $totalpoints[0]);\n \t$totalscore = get_user_meta($user->ID(), ttp_lms_prefix('quiz_' . $quiz->ID() . '_try_' . '1' . '_totalscore'), false);\n \t$this->assertEquals(1, count($totalscore));\n \t$this->assertEquals(20, $totalscore[0]);\n }",
"public function startQuiz(){\n if($this->session->get('userId') == null){\n echo \"sorry unauthorized!...\";\n return;\n }\n $this->answeredQuestions =[];\n $this->minId = 1;\n // jel ok da pretpostavim da je sve od 1 do maxa tu - msm da da\n $q = new Question();\n $this->maxId = $q->getMaxId();\n\n return view('quiz.php');\n }",
"public function run()\n {\n $class = QuizAnswer::create([\n \t'quiz_id' => 1,\n \t'attempts' => 4,\n \t'correct' => 0,\n \t'fail' => 2,\n ]);\n\n }",
"public function run()\n {\n $question = new TemplateQuestion();\n $question->question = 'Conducted by?';\n $question->template_section_id = 1;\n $question->save();\n\n $question = new TemplateQuestion();\n $question->question = 'date?';\n $question->template_section_id = 1;\n $question->save();\n\n $question = new TemplateQuestion();\n $question->question = 'Location';\n $question->template_section_id = 1;\n $question->save();\n\n //seed another section\n\n $question = new TemplateQuestion();\n $question->question = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.';\n $question->template_section_id = 2;\n $question->save();\n\n $question = new TemplateQuestion();\n $question->question = 'trash empty?';\n $question->template_section_id = 2;\n $question->save();\n\n $question = new TemplateQuestion();\n $question->question = 'Water shut off?';\n $question->template_section_id = 2;\n $question->save();\n\n\n }",
"private function createAnswers($f, $p) {\n\n // Simulate each qeustion answering\n foreach ($f->questions as $q) {\n if ($q->isAspect()) {\n // If the question is about each aspect, answer like..\n\n // Each aspects has 3 level: normal, high-risk, very-high-risk\n // random to choose between those\n $c = $this->getRandomChoice($q->choices, null, true);\n if ($c->value == 0) {\n // Choose it and continue to next question\n $this->chooseChoice($f, $q, $c, $p);\n\n // next loop\n } else {\n // Choose the choice\n $this->chooseChoice($f, $q, $c, $p);\n $this->chooseRandomSubchoices($f, $q, $c, $p);\n\n // and random again\n // Since high & very-high can be their simultaneously\n $nc = $this->getRandomChoice($q->choices, null, true);\n\n if ($nc->value > 0 && $nc->value != $c->value) {\n // Not the 'normal' and not the same choice, choose it\n $this->chooseChoice($f, $q, $nc, $p);\n $this->chooseRandomSubchoices($f, $q, $nc, $p);\n } else {\n // next loop\n }\n }\n } else if ($q->isAboutTalent()) {\n // If the question is about talent answer like...\n\n // Talent has only 2 choice, random between the two\n $c = $this->getRandomChoice($q->choices, null);\n $a = $this->chooseChoice($f, $q, $c, $p);\n $ci = $c->inputs()->first();\n if ($ci) {\n $this->createRandomTalent($a, $ci, $p);\n }\n\n // next loop\n\n } else if ($q->isAboutDisability()) {\n // If the question is about disability answer like...\n\n // Non uniform random, low rate of having disability\n $probHaveDis = rand(0, 100);\n\n // Only 30% chance that a participant will have disability\n if ($probHaveDis > 70) {\n\n $numDis = $this->randomNumberOfDisabilities();\n\n $choosenChoices = [];\n $numChoice = count($q->choices);\n for ($i=0; $i < $numDis; $i++) { \n $c = $this->getRandomChoice($q->choices, $numChoice);\n \n if (Choice::choiceExistsInAnswers($c, $choosenChoices)) {\n // Allow no duplicates disabilities\n continue;\n } else {\n $a = $this->chooseChoice($f, $q, $c, $p);\n $ci = $c->inputs()->first();\n if ($ci) {\n $this->createRandomDisability($a, $ci);\n }\n }\n\n $choosenChoices[] = $a;\n }\n }\n }\n }\n }",
"public function test_get_attempt_data_with_blocked_questions() {\n global $DB;\n\n // Create a new quiz with one attempt started and using immediatefeedback.\n list($quiz, $context, $quizobj, $attempt, $attemptobj) = $this->create_quiz_with_questions(\n true, false, 'immediatefeedback');\n\n $quizobj = $attemptobj->get_quizobj();\n\n // Make second question blocked by the first one.\n $structure = $quizobj->get_structure();\n $slots = $structure->get_slots();\n $structure->update_question_dependency(end($slots)->id, true);\n\n $quizobj->preload_questions();\n $quizobj->load_questions();\n $questions = $quizobj->get_questions();\n\n $this->setUser($this->student);\n\n // We receive one question per page.\n $result = mod_quiz_external::get_attempt_data($attempt->id, 0);\n $result = external_api::clean_returnvalue(mod_quiz_external::get_attempt_data_returns(), $result);\n\n $this->assertEquals($attempt, (object) $result['attempt']);\n $this->assertCount(1, $result['questions']);\n $this->assertEquals(1, $result['questions'][0]['slot']);\n $this->assertEquals(1, $result['questions'][0]['number']);\n $this->assertEquals(false, $result['questions'][0]['blockedbyprevious']);\n\n // Now try the last page.\n $result = mod_quiz_external::get_attempt_data($attempt->id, 1);\n $result = external_api::clean_returnvalue(mod_quiz_external::get_attempt_data_returns(), $result);\n\n $this->assertEquals($attempt, (object) $result['attempt']);\n $this->assertCount(1, $result['questions']);\n $this->assertEquals(2, $result['questions'][0]['slot']);\n $this->assertEquals(2, $result['questions'][0]['number']);\n $this->assertEquals(true, $result['questions'][0]['blockedbyprevious']);\n }",
"public function run()\n\t{\n\t\t$this->createQuestions();\n\t}",
"abstract protected function __construct($instantquiz, $record);",
"function ipal_print_pagecontrols($quiz, $pageurl, $page, $hasattempts, $defaultcategoryobj) {\n global $CFG, $OUTPUT;\n static $randombuttoncount = 0;\n $randombuttoncount++;\n echo '<div class=\"pagecontrols\">';\n $hasattempts = 0;// Modified for ipal this is added because attempts don't mean anything with ipal.\n // Get the current context.\n $thiscontext = context_module::instance($quiz->course);\n $contexts = new question_edit_contexts($thiscontext);\n\n // Get the default category.\n list($defaultcategoryid) = explode(',', $pageurl->param('cat'));\n if (empty($defaultcategoryid)) {\n $defaultcategoryid = $defaultcategoryobj->id;\n }\n\n // Create the url the question page will return to.\n $returnurladdtoquiz = new moodle_url($pageurl, array('addonpage' => $page));\n\n // Print a button linking to the choose question type page.\n $returnurladdtoquiz = str_replace($CFG->wwwroot, '', $returnurladdtoquiz->out(false));\n $newquestionparams = array('returnurl' => $returnurladdtoquiz,\n 'cmid' => $quiz->cmid, 'appendqnumstring' => 'addquestion');\n create_new_question_button($defaultcategoryid, $newquestionparams,\n get_string('addaquestion', 'quiz'),\n get_string('createquestionandadd', 'quiz'), $hasattempts);\n\n if ($hasattempts) {\n $disabled = 'disabled=\"disabled\"';\n } else {\n $disabled = '';\n }// IPAL removed lines that added a random button.\n echo \"\\n</div>\";\n}",
"function create_session_and_responses(&$question, &$state, $cmoptions, $attempt) {\n global $CFG, $DB;\n if(!$maxnumber = (int)$DB->get_field_sql(\n \"SELECT MIN(a.itemcount)\n FROM {question_dataset_definitions} a,\n {question_datasets} b\n WHERE b.question = ?\n AND a.id = b.datasetdefinition\", array($question->id))) {\n print_error('cannotgetdsforquestion', 'question', '', $question->id);\n }\n\n // Choose a random dataset\n if (!isset($cmoptions->intro) || strstr($cmoptions->intro, 'synchronize_calculated') === false ) {\n $state->options->datasetitem = rand(1, $maxnumber);\n }else{\n if( !isset($cmoptions->synchronize_calculated)) {\n $state->options->datasetitem = rand(1, $maxnumber);\n $cmoptions->synchronize_calculated = $state->options->datasetitem ;\n }else {\n if ($cmoptions->synchronize_calculated <= $maxnumber){\n $state->options->datasetitem = $cmoptions->synchronize_calculated ;\n }else {\n $state->options->datasetitem = rand(1, $maxnumber);\n }\n }\n };\n $state->options->dataset =\n $this->pick_question_dataset($question,$state->options->datasetitem);\n $state->responses = array('' => '');\n return true;\n }",
"public function test_post_question() {\n global $DB;\n\n // Create user\n $user = $this->getDataGenerator()->create_user();\n\n // create a course\n $course = $this->getDataGenerator()->create_course();\n\n // enrol the user on the course\n $this->getDataGenerator()->enrol_user($user->id, $course->id, $DB->get_field('role', 'id', array(\n 'shortname' => 'student',\n )));\n\n // create a course module\n $videoquanda = $this->getDataGenerator()->create_module('videoquanda', array(\n 'course' => $course->id\n ));\n\n // enrol the user on the course\n $this->getDataGenerator()->enrol_user($user->id, $course->id, $DB->get_field('role', 'id', array(\n 'shortname' => 'student',\n )));\n\n $question = array(\n 'seconds' => '2',\n 'text' => 'dummy text'\n );\n\n $this->setUser($user);\n\n $client = new Client($this->_app);\n $client->request('POST', '/api/v1/' . $videoquanda->id . '/questions', array(), array(), array(), json_encode($question));\n\n $this->assertEquals(201, $client->getResponse()->getStatusCode());\n $this->assertEquals(1, $DB->count_records('videoquanda_questions', array('instanceid' => $videoquanda->id)));\n }",
"public function addQuestionAndAnswers () {\n global $tpl, $ilTabs;\n $ilTabs->activateTab(\"editQuiz\");\n $this->initAddQuestionAndAnswersForm();\n }",
"public function run()\n {\n $i = 1;\n $question = Question::create(\n [\n 'title' => '前端工程师的技术进阶点在哪里?',\n 'description' => <<<'EOT'\n这个问题是一个比较全能的Java工程师提出来的,总结一下大家的回答:\n\n需求变化快,需要良好的复用、可拓展能力,否则动不动重写。\n兼容性问题,需要兼容各种移动设备的各种浏览器。\nCSS非正交,对于绝大多数人来说属于『玄学』。\n\n\n那么问题来了,普通前端工程师的技术进阶突破点在什么地方?\n\n有哪些方向可以突破,以后端为例\n\n全局方向: 做业务整体架构\n深度方向: 做性能调优、高并发、分布式等专业要求很高的领域\n延伸方向: 以Java 为例很多大神转移到大数据、分布式计算这个方面,算是传统Java Web的延伸方向\nEOT\n,\n 'user_id' => $i,\n ]);\n $question->answers()->create([\n 'user_id' => ++$i,\n 'content' => <<<'EOT'\n基于上面这个我个人认为的前提,我觉得前端的技术进阶并不像 Java 那样,对技术本身有很深度的研究,我个人规划更倾向于选择偏业务性的突破点:快速学习技术的能力前端时不时出来很多新东西,然后总是先于当前实现写未来代码,快速学习新事物的能力是最基础的。出来的新东西,能不能快速了解用法、特性、适用场景和底层实现?这是后面的基础。突破方法:对新事物保持好奇而非恐惧和抵触,跳出舒适区掌握学习的方法论,比如先看文档、再跑 Demo、提出问题、源码验证学习一些学习技巧业务抽象能力和技术选型、设计能力一个产品不是一夜建设出来的,但前端可以加速这个过程。使用 Node.js 可以写一个 index.js 文件执行下就跑起来一个各种功能的 Web 服务器,这个时间放在 Java 可能刚用 Spring Boot 创建好项目目录?\nEOT\n ]);\n\n }",
"public function run()\n {\n $class = Quiz::create([\n \t'class_schedule_id' => 1,\n \t'question' => '1 Gives you the chance to learn programming',\n \t'attempts' => 2,\n ]);\n\n $class = Quiz::create([\n \t'class_schedule_id' => 1,\n \t'question' => '2 Gives you the chance to learn programming',\n \t'attempts' => 2,\n ]);\n\n $class = Quiz::create([\n \t'class_schedule_id' => 1,\n \t'question' => '3 Gives you the chance to learn programming',\n \t'attempts' => 2,\n ]);\n\n $class = Quiz::create([\n \t'class_schedule_id' => 1,\n \t'question' => '4 Gives you the chance to learn programming',\n \t'attempts' => 2,\n ]);\n\n $class = Quiz::create([\n \t'class_schedule_id' => 1,\n \t'question' => '5 Gives you the chance to learn programming',\n \t'attempts' => 2,\n ]);\n\n\n\n\n $class = Quiz::create([\n 'class_schedule_id' => 2,\n 'question' => '1 Gives you the chance to learn programming',\n 'attempts' => 2,\n ]);\n\n $class = Quiz::create([\n 'class_schedule_id' => 2,\n 'question' => '2 Gives you the chance to learn programming',\n 'attempts' => 2,\n ]);\n\n $class = Quiz::create([\n 'class_schedule_id' => 2,\n 'question' => '3 Gives you the chance to learn programming',\n 'attempts' => 2,\n ]);\n\n $class = Quiz::create([\n 'class_schedule_id' => 2,\n 'question' => '4 Gives you the chance to learn programming',\n 'attempts' => 2,\n ]);\n\n $class = Quiz::create([\n 'class_schedule_id' => 2,\n 'question' => '5 Gives you the chance to learn programming',\n 'attempts' => 2,\n ]);\n\n\n\n $class = Quiz::create([\n 'class_schedule_id' => 3,\n 'question' => '1 Gives you the chance to learn programming',\n 'attempts' => 2,\n ]);\n\n $class = Quiz::create([\n 'class_schedule_id' => 3,\n 'question' => '2 Gives you the chance to learn programming',\n 'attempts' => 2,\n ]);\n\n $class = Quiz::create([\n 'class_schedule_id' => 3,\n 'question' => '3 Gives you the chance to learn programming',\n 'attempts' => 2,\n ]);\n\n $class = Quiz::create([\n 'class_schedule_id' => 3,\n 'question' => '4 Gives you the chance to learn programming',\n 'attempts' => 2,\n ]);\n\n $class = Quiz::create([\n 'class_schedule_id' => 3,\n 'question' => '5 Gives you the chance to learn programming',\n 'attempts' => 2,\n ]);\n }",
"public function run()\n {\n $numberOfQuestions = 12;\n\n foreach(range(1,$numberOfQuestions) as $i)\n {\n factory(Question::class)->create();\n }\n }",
"public function takeAll(){\n if(isset($_POST['submit'])){\n $post = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);\n // var_dump($post);\n // Messages::setMsg('Answer is submitted', 'success');\n // Check if the answer is correct\n // echo 'session data:';\n\n // Put the submitted chosen answers into an array\n $choices = array();\n // Check the number of questions\n $num_q = count($_SESSION['quiz_data']);\n // Add the choices into an array\n for($i = 0; $i < $num_q; $i++){\n $choices[] = intval($post[\"choice{$i}\"]);\n }\n echo 'CHOICES';\n var_dump($choices);\n echo 'NUMBER OF QUESTIONS IS: ';\n echo $num_q;\n\n // Loop through the answers and count the correct answers\n $score = 0;\n $question = 0;\n foreach($choices as $choice){\n // $indexed_array = array_values($_SESSION['quiz_data']);\n $is_answer = array_values($_SESSION['quiz_data']) [$question][$choice]['is_answer'];\n if($is_answer == 1){\n $score++;\n $question++;\n }\n }\n Messages::setMsg(\"You scored {$score} out of {$num_q}\", 'success');\n return;\n } else {\n // !!! Need to modified, question.user_id does not exist amy more\n $this->query('SELECT questions.content, options.content, options.is_answer FROM questions JOIN users ON questions.user_id = users.id JOIN options ON options.question_id = questions.id WHERE users.id = :user_id');\n // Bind the user_id to the current user id\n $userId = $_SESSION['user_data']['id'];\n $this->bind(':user_id', $userId);\n $rows = $this->resultSetGroup();\n // echo '<pre>';\n // print_r($rows);\n // echo '</pre>';\n // var_dump($rows);\n // print_r($rows);\n // Store $row in session to check the answer once it is submitted\n if($rows){\n $_SESSION['quiz_data'] = $rows;\n } else {\n Messages::setMsg('No quizzes yet', 'error');\n }\n return $rows;\n }\n }",
"public static function drawQuizPage($args)\n\t{\n\t\tekQuiz::registerMyFrontScripts();\t\t\n\t\t\n\t\t\n\t\t\n\t\tglobal $ek_quiz_database;\n\t\t$pageStr = '';\n\t\t\n\t\t// Define the other vars in case missing\n\t\t$correctFeedback = '';\n\t\t$incorrectFeedback = '';\n\t\t$buttonText = '';\n\t\t$quizReportScreen = '';\n\t\tif(isset($args['quizReportScreen']))\n\t\t{\n\t\t\t$quizReportScreen = $args['quizReportScreen'];\n \n\t\t}\n\n\t\tif(!isset($args['quizID']) )\n\t\t{\n\t\t//\treturn;\n\t\t}\n\t\t\t\t\n\t\t$quizID = $args ['quizID'];\n\t\t$currentPage = $args['currentPage'];\n\t\t\n\t\tif(isset($_SESSION['attemptID'] ) )\n\t\t{\n\t\t\t$attemptID = $_SESSION['attemptID'];\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$attemptID = $args['attemptID'];\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\tif(isset($args['attemptID'])){$attemptID=$args['attemptID'];}\n\t\t\t\t\n\t\t$userID = get_current_user_id();\n\t\t// Get the question order details based on the attemptID\n\t\t$attemptInfo = $ek_quiz_database->getAttemptInfo( $attemptID );\n\t\t$quizQuestionsArray = $attemptInfo['questionOrder'];\n\t\t$quizQuestionsArray = unserialize($quizQuestionsArray);\t\n\t\t\n\t\t$userResponses = $attemptInfo['userResponses'];\n\t\t$userResponses = unserialize($userResponses);\n\t\t\n\t\t\n\t\t\n\t//\techo 'called';\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t// If the quiz is finished read only is ON\n\t\tif($currentPage==\"answers\")\n\t\t{\n\t\t\t$readOnly = true;\n\t\t\t\n\t\t\t// Turn the questionsOnPageArray into a single array\n\t\t\t$fullPageArray = array();\n\t\t\tforeach($quizQuestionsArray as $thisPage => $thisPageQuestionArray)\n\t\t\t{\n\t\t\t\tforeach ($thisPageQuestionArray as $KEY => $myQuestionMeta)\n\t\t\t\t{\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t$qType = $myQuestionMeta['qType'];\n\t\t\t\t\t$questionID = $myQuestionMeta['questionID'];\n\t\t\t\t\t$fullPageArray[] = array(\n\t\t\t\t\t\"qType\"\t\t\t=> $qType,\n\t\t\t\t\t\"questionID\"\t=> $questionID,\n\t\t\t\t\t\"responseOptions\"\t=> $myQuestionMeta['responseOptions'],\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t$questionsOnPageArray = $fullPageArray;\n\t\t\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$readOnly = false;\n\t\t\t$questionsOnPageArray = $quizQuestionsArray[$currentPage-1];\n\t\t}\n\t\t\n\t\t\n\t\t$pageCount = count($quizQuestionsArray);\n\t\t$totalCorrect=0;\n\t\t$totalWeighting = 0;\n\t\t$totalAvailableWeighting = 0;\n\t\t\n\t\tforeach ($questionsOnPageArray as $questionInfo)\n\t\t{\n\t\t\t$questionID = $questionInfo['questionID'];\t\n\t\t\t$qType = $questionInfo['qType'];\n\t\t\t\n\t\t\t\n\t\t\t$responseOptions = $questionInfo['responseOptions'];\n\t\t\t\n\n\t\t\t\n\t\t\t$thisUserResponse = \"\";\n\t\t\tif(isset($userResponses[$questionID])){$thisUserResponse = ekQuiz_utils::processDatabaseTextForTextarea($userResponses[$questionID]);}\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t$args = array(\n\t\t\n\t\t\t\t\"questionID\" \t\t\t=> $questionID,\n\t\t\t\t\"readOnly\"\t\t\t\t=> $readOnly,\n\t\t\t\t\"correctFeedback\"\t\t=> $correctFeedback,\n\t\t\t\t\"incorrectFeedback\"\t\t=> $incorrectFeedback,\n\t\t\t\t\"userResponse\"\t\t\t=> $thisUserResponse,\n\t\t\t\t\"showButtons\"\t\t\t=> false, // TO DO Check if flashcards and set true\n\t\t\t\t\"responseOptionOrder\"\t=> $responseOptions,\n\t\t\t\t\"buttonText\"\t\t\t=> $buttonText,\n\t\t\t);\n\t\t\t\n\t\t\t\n\t\t\t// If its the answers page don't show the individual submit buttons\n\t\t\tif($currentPage==\"answers\")\n\t\t\t{\n\t\t\t\t$args[\"showButtons\"]\t= false;\n\t\t\t\t$args[\"showCorrectAnswer\"]\t= \"on\";\n\t\t\t}\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t// Get the qType for this question\t\t\t\n\t\t\t$thisQuestionClass = 'ek_'.$qType;\n\t\t\t\n\t\t\t//die();\n\t\t\t\n\t\t\t$pageStr.='<div class=\"ek-question\" id=\"ek-question_'.$questionID.'_'.$qType.'\">';\n\t\t\t$pageStr.= $thisQuestionClass::drawQuestion($args);\n\t\t\t$pageStr.='</div>';\n\t\t\t\n\t\t\t\n\t\t\t// Mark and calculate score as well if its the answers page\n\t\t\tif($currentPage==\"answers\")\n\t\t\t{\n\t\t\t\t$markArgs = array(\n\t\t\t\n\t\t\t\t\t\"questionID\" \t\t\t=> $questionID,\n\t\t\t\t\t\"userResponse\"\t\t\t=> $thisUserResponse,\n\t\t\t\t\t\n\t\t\t\t);\n\t\t\t\t$isCorrect= $thisQuestionClass::markQuestion($markArgs);\n\t\t\t\t\n\t\t\t\t// TODO ADD WEIGHTING\n\t\t\t\t$questionWeighting = 1;\n\t\t\t\t\n\t\t\t\t$totalAvailableWeighting = $totalAvailableWeighting+$questionWeighting;\n\t\t\t\t\n\t\t\t\tif($isCorrect==1)\n\t\t\t\t{\n\t\t\t\t\t$totalWeighting =$totalWeighting + $questionWeighting;\n\t\t\t\t\t$totalCorrect++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\t/* Don't show any page nav if its the end of the quiz */\n\t\tif($currentPage==\"answers\")\n\t\t{\n\t\t\t\n\t\t\t$completionMessage = ekQuiz_utils::formatMetaboxText(get_post_meta($quizID, \"completionMessage\", true));\n\t\t\tif($completionMessage)\n\t\t\t{\n\t\t\t\t$completionMessage = '<div class=\"completionMessage\">'.$completionMessage.'</div>';\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t// Mark the Quiz as well\n\t\t\t$questionCount = count($questionsOnPageArray);\n\t\t\t\n\t\t\t// Get the percentage based on question weighting\n\t\t\t$percentageScore = round(($totalWeighting / $totalAvailableWeighting) * 100);\n\t\t\t\n\t\t\t$markedFeedback = '<div class=\"markOutOfTotalFeedback\">You got <b>'.$percentageScore.'%</b> ('.$totalCorrect.' / '.$questionCount.' questions correct)</div>';\n\t\t\t\t\t\n\t\t\t// Update this in the DB - but only if not admin screen\n\t\t\t\n\t\t\t\n\t\t\tif($quizReportScreen<>1)\n\t\t\t{\n\t\t\t\t$ek_quiz_database->saveQuizScore($attemptID, $percentageScore);\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t// Check if there is grade boundary to show\n\t\t\t$boundaryFeedback = ekQuiz_queries::getBoundaryFeedback($percentageScore, $quizID);\n\t\t\t//$boundaryFeedback.=do_shortcode($boundaryFeedback);\n\t\t\tif($boundaryFeedback)\n\t\t\t{\n\t\t\t\t$boundaryFeedback = '<div class=\"boundaryFeedback\">'.$boundaryFeedback.'</div>';\n\t\t\t}\t\t\t\n\t\t\t\n\t\t\t$pageStr=$markedFeedback.$boundaryFeedback.$completionMessage.$pageStr;\n\t\t\t\n\t\t\treturn $pageStr;\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\t$pageStr.='Page '.$currentPage.' / '.$pageCount.'<br/><br/>';\n\t\t\n\t\t// Add hidden form for the quiz ID\n\t\t$pageStr.='<input type=\"hidden\" value=\"'.$quizID.'\" id=\"quizID\" name=\"quizID\" />';\n\t\t$pageStr.='<input type=\"hidden\" value=\"'.$currentPage.'\" id=\"currentPage\" name=\"currentPage\" />';\n\t\t\n\t\t\n\t\t// If its the first page don't show back button\n\t\t$pageStr.='<div id=\"ek-quiz-nav\">';\n\t\tif($currentPage<>1)\n\t\t{\n\t\t\t$pageStr.='<span class=\"ek-quiz-nav-button\" id=\"ek-prevpage-button\">Back</span>';\n\t\t\t\n\t\t}\n\t\t\n\t\t// if its the last page don't show next button\n\t\tif($currentPage <> $pageCount)\n\t\t{\n\t\t\t$pageStr.='<button class=\"ek-quiz-nav-button\" id=\"ek-nextpage-button\">Save and Continue</button>';\n\t\t}\n\t\t\n\t\t// If its the last page the show the finish button\n\t\tif($currentPage == $pageCount)\n\t\t{\t\t\t\t\t\n\t\t\t$pageStr.='<button class=\"ek-quiz-nav-button\" id=\"ek-endquiz-button\">Save and Finish</button>';\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\t$pageStr.='</div>';\n\t\t\n\t\t\n\t\t\t\t\n\t\treturn $pageStr;\n\t\t\n\t\t\n\t}",
"function ipal_print_question_list($quiz, $pageurl, $allowdelete, $reordertool,\n $quizqbanktool, $hasattempts, $defaultcategoryobj) {\n global $USER, $CFG, $DB, $OUTPUT;\n $strorder = get_string('order');\n $strquestionname = get_string('questionname', 'quiz');\n $strgrade = get_string('grade');\n $strremove = get_string('remove', 'quiz');\n $stredit = get_string('edit');\n $strview = get_string('view');\n $straction = get_string('action');\n $strmove = get_string('move');\n $strmoveup = get_string('moveup');\n $strmovedown = get_string('movedown');\n $strsave = get_string('save', 'quiz');\n $strreorderquestions = get_string('reorderquestions', 'quiz');\n\n $strselectall = get_string('selectall', 'quiz');\n $strselectnone = get_string('selectnone', 'quiz');\n $strtype = get_string('type', 'quiz');\n $strpreview = get_string('preview', 'quiz');\n $hasattempts = 0;// Modified for ipal this is added because attempts don't mean anything with ipal.\n if ($quiz->questions) {\n list($usql, $params) = $DB->get_in_or_equal(explode(',', $quiz->questions));\n $qcount = 0;\n foreach ($params as $key => $value) {\n if ($value > 0) {\n $questions = $DB->get_records_sql(\"SELECT q.* FROM {question} q WHERE q.id = $value\", $params);\n $ipalquestions[$value] = $questions[$value];\n $ipalname[$qcount] = trim($questions[$value]->name);\n $ipalquestiontext[$qcount] = trim($questions[$value]->questiontext);\n $ipalid[$qcount] = $value;\n $ipalqtype[$qcount] = $questions[$value]->qtype;\n $qcount++;\n } else {\n $ipalid[$qcount] = 0;\n $qcount++;\n }\n }\n\n } else {\n $questions = array();\n }\n\n if (isset($ipalid)) {\n $order = $ipalid;\n } else {\n $order = null;\n }\n $lastindex = count($order) - 1;\n $disabled = '';\n $pagingdisabled = '';\n\n $reordercontrolssetdefaultsubmit = '<div style=\"display:none;\">' .\n '<input type=\"submit\" name=\"savechanges\" value=\"' .\n $strreorderquestions . '\" ' . $pagingdisabled . ' /></div>';\n $reordercontrols1 = '<div class=\"addnewpagesafterselected\">' .\n '<input type=\"submit\" name=\"addnewpagesafterselected\" value=\"' .\n get_string('addnewpagesafterselected', 'quiz') . '\" ' .\n $pagingdisabled . ' /></div>';\n $reordercontrols1 .= '<div class=\"quizdeleteselected\">' .\n '<input type=\"submit\" name=\"quizdeleteselected\" ' .\n 'onclick=\"return confirm(\\'' .\n get_string('areyousureremoveselected', 'quiz') . '\\');\" value=\"' .\n get_string('removeselected', 'quiz') . '\" ' . $disabled . ' /></div>';\n\n $a = '<input name=\"moveselectedonpagetop\" type=\"text\" size=\"2\" ' .\n $pagingdisabled . ' />';\n $b = '<input name=\"moveselectedonpagebottom\" type=\"text\" size=\"2\" ' .\n $pagingdisabled . ' />';\n\n $reordercontrols2top = '<div class=\"moveselectedonpage\">' .\n get_string('moveselectedonpage', 'quiz', $a) .\n '<input type=\"submit\" name=\"savechanges\" value=\"' .\n $strmove . '\" ' . $pagingdisabled . ' />' .\n '<br /><input type=\"submit\" name=\"savechanges\" value=\"' .\n $strreorderquestions . '\" /></div>';\n $reordercontrols2bottom = '<div class=\"moveselectedonpage\">' .\n '<input type=\"submit\" name=\"savechanges\" value=\"' .\n $strreorderquestions . '\" /><br />' .\n get_string('moveselectedonpage', 'quiz', $b) .\n '<input type=\"submit\" name=\"savechanges\" value=\"' .\n $strmove . '\" ' . $pagingdisabled . ' /> ' . '</div>';\n\n $reordercontrols3 = '<a href=\"javascript:select_all_in(\\'FORM\\', null, ' .\n '\\'quizquestions\\');\">' .\n $strselectall . '</a> /';\n $reordercontrols3 .= ' <a href=\"javascript:deselect_all_in(\\'FORM\\', ' .\n 'null, \\'quizquestions\\');\">' .\n $strselectnone . '</a>';\n\n $reordercontrolstop = '<div class=\"reordercontrols\">' .\n $reordercontrolssetdefaultsubmit .\n $reordercontrols1 . $reordercontrols2top . $reordercontrols3 . \"</div>\";\n $reordercontrolsbottom = '<div class=\"reordercontrols\">' .\n $reordercontrolssetdefaultsubmit .\n $reordercontrols2bottom . $reordercontrols1 . $reordercontrols3 . \"</div>\";\n\n // The current question ordinal (no descriptions).\n $qno = 1;\n // The current question (includes questions and descriptions).\n $questioncount = 0;\n // The current page number in iteration.\n $pagecount = 0;\n\n $pageopen = false;\n\n $returnurl = str_replace($CFG->wwwroot, '', $pageurl->out(false));\n $questiontotalcount = count($order);\n\n if (isset($order)) {\n foreach ($order as $count => $qnum) {\n\n $reordercheckbox = '';\n $reordercheckboxlabel = '';\n $reordercheckboxlabelclose = '';\n\n if ($qnum && strlen($ipalname[$count]) == 0 && strlen($ipaltext[$count]) == 0) {\n continue;\n }\n\n if ($qnum != 0 || ($qnum == 0 && !$pageopen)) {\n // This is either a question or a page break after another (no page is currently open).\n if (!$pageopen) {\n // If no page is open, start display of a page.\n $pagecount++;\n echo '<div class=\"quizpage\">';\n echo '<div class=\"pagecontent\">';\n $pageopen = true;\n }\n\n if ($qnum != 0) {\n $question = $ipalquestions[$qnum];\n $questionparams = array(\n 'returnurl' => $returnurl,\n 'cmid' => $quiz->cmid,\n 'id' => $ipalid[$count]);\n $questionurl = new moodle_url('/question/question.php',\n $questionparams);\n $questioncount++;\n // This is an actual question.\n\n /* Display question start */\n ?>\n<div class=\"question\">\n <div class=\"questioncontainer <?php echo $ipalqtype[$count]; ?>\">\n <div class=\"qnum\">\n <?php\n $reordercheckbox = '';\n $reordercheckboxlabel = '';\n $reordercheckboxlabelclose = '';\n\n if ((strlen($ipalname[$count]) + strlen($ipalquestiontext[$count])) == 0) {\n $qnodisplay = get_string('infoshort', 'quiz');\n $qnodisplay = '?';\n } else {\n\n if ($qno > 999) {\n $qnodisplay = html_writer::tag('small', $qno);\n } else {\n $qnodisplay = $qno;\n }\n $qno ++;\n }\n echo $reordercheckboxlabel . $qnodisplay . $reordercheckboxlabelclose .\n $reordercheckbox;\n\n ?>\n </div>\n <div class=\"content\">\n <div class=\"questioncontrols\">\n <?php\n if ($count != 0) {\n if (!$hasattempts) {\n $upbuttonclass = '';\n if ($count >= $lastindex - 1) {\n $upbuttonclass = 'upwithoutdown';\n }\n echo $OUTPUT->action_icon($pageurl->out(true,\n array('up' => $ipalid[$count], 'sesskey' => sesskey())),\n new pix_icon('t/up', $strmoveup),\n new component_action('click',\n 'M.core_scroll_manager.save_scroll_action'),\n array('title' => $strmoveup));\n }\n\n }\n if ($count < $lastindex - 1) {\n if (!$hasattempts) {\n echo $OUTPUT->action_icon($pageurl->out(true,\n array('down' => $ipalid[$count], 'sesskey' => sesskey())),\n new pix_icon('t/down', $strmovedown),\n new component_action('click',\n 'M.core_scroll_manager.save_scroll_action'),\n array('title' => $strmovedown));\n }\n }\n if ($allowdelete) {\n if (!$hasattempts) {\n echo $OUTPUT->action_icon($pageurl->out(true,\n array('remove' => $ipalid[$count], 'sesskey' => sesskey())),\n new pix_icon('t/delete', $strremove),\n new component_action('click',\n 'M.core_scroll_manager.save_scroll_action'),\n array('title' => $strremove));\n }\n }\n ?>\n </div>\n \n <div class=\"questioncontentcontainer\">\n <?php\n quiz_print_singlequestion($question, $returnurl, $quiz);\n ?>\n </div>\n </div>\n </div>\n</div>\n\n <?php\n }\n }\n // A page break: end the existing page.\n if ($qnum == 0) {// This should never happen.\n if ($pageopen) {\n if (!$reordertool && !($quiz->shufflequestions &&\n $count < $questiontotalcount - 1)) {\n ipal_print_pagecontrols($quiz, $pageurl, $pagecount,\n $hasattempts, $defaultcategoryobj);\n } else if ($count < $questiontotalcount - 1) {\n // Do not include the last page break for reordering.\n // To avoid creating a new extra page in the end.\n echo '<input type=\"hidden\" name=\"opg' . $pagecount . '\" size=\"2\" value=\"' .\n (10 * $count + 10) . '\" />';\n }\n echo \"</div></div>\";\n\n $pageopen = false;\n $count++;\n }\n }\n\n }\n }// End of if(isset($order).\n}"
] |
[
"0.76349396",
"0.6763173",
"0.6469097",
"0.64066756",
"0.6017654",
"0.5983769",
"0.5971516",
"0.59537715",
"0.59507346",
"0.5914015",
"0.5832889",
"0.57762975",
"0.5765079",
"0.5750939",
"0.5750079",
"0.5732327",
"0.57071424",
"0.57052",
"0.56721216",
"0.5661432",
"0.56369287",
"0.5635094",
"0.5622056",
"0.56121093",
"0.5610472",
"0.5600644",
"0.55701405",
"0.55639184",
"0.55442196",
"0.5536988"
] |
0.769148
|
0
|
Create a quizp with a random as well as other questions and walk through quizp attempts.
|
public function test_quizp_with_random_question_attempt_walkthrough() {
global $SITE;
$this->resetAfterTest(true);
question_bank::get_qtype('random')->clear_caches_before_testing();
$this->setAdminUser();
// Make a quizp.
$quizpgenerator = $this->getDataGenerator()->get_plugin_generator('mod_quizp');
$quizp = $quizpgenerator->create_instance(array('course' => $SITE->id, 'questionsperpage' => 2, 'grade' => 100.0,
'sumgrades' => 4));
$questiongenerator = $this->getDataGenerator()->get_plugin_generator('core_question');
// Add two questions to question category.
$cat = $questiongenerator->create_question_category();
$saq = $questiongenerator->create_question('shortanswer', null, array('category' => $cat->id));
$numq = $questiongenerator->create_question('numerical', null, array('category' => $cat->id));
// Add random question to the quizp.
quizp_add_random_questions($quizp, 0, $cat->id, 1, false);
// Make another category.
$cat2 = $questiongenerator->create_question_category();
$match = $questiongenerator->create_question('match', null, array('category' => $cat->id));
quizp_add_quizp_question($match->id, $quizp, 0);
$multichoicemulti = $questiongenerator->create_question('multichoice', 'two_of_four', array('category' => $cat->id));
quizp_add_quizp_question($multichoicemulti->id, $quizp, 0);
$multichoicesingle = $questiongenerator->create_question('multichoice', 'one_of_four', array('category' => $cat->id));
quizp_add_quizp_question($multichoicesingle->id, $quizp, 0);
foreach (array($saq->id => 'frog', $numq->id => '3.14') as $randomqidtoselect => $randqanswer) {
// Make a new user to do the quizp each loop.
$user1 = $this->getDataGenerator()->create_user();
$this->setUser($user1);
$quizpobj = quizp::create($quizp->id, $user1->id);
// Start the attempt.
$quba = question_engine::make_questions_usage_by_activity('mod_quizp', $quizpobj->get_context());
$quba->set_preferred_behaviour($quizpobj->get_quizp()->preferredbehaviour);
$timenow = time();
$attempt = quizp_create_attempt($quizpobj, 1, false, $timenow);
quizp_start_new_attempt($quizpobj, $quba, $attempt, 1, $timenow, array(1 => $randomqidtoselect));
$this->assertEquals('1,2,0,3,4,0', $attempt->layout);
quizp_attempt_save_started($quizpobj, $quba, $attempt);
// Process some responses from the student.
$attemptobj = quizp_attempt::create($attempt->id);
$this->assertFalse($attemptobj->has_response_to_at_least_one_graded_question());
$tosubmit = array();
$selectedquestionid = $quba->get_question_attempt(1)->get_question()->id;
$tosubmit[1] = array('answer' => $randqanswer);
$tosubmit[2] = array(
'frog' => 'amphibian',
'cat' => 'mammal',
'newt' => 'amphibian');
$tosubmit[3] = array('One' => '1', 'Two' => '0', 'Three' => '1', 'Four' => '0'); // First and third choice.
$tosubmit[4] = array('answer' => 'One'); // The first choice.
$attemptobj->process_submitted_actions($timenow, false, $tosubmit);
// Finish the attempt.
$attemptobj = quizp_attempt::create($attempt->id);
$this->assertTrue($attemptobj->has_response_to_at_least_one_graded_question());
$attemptobj->process_finish($timenow, false);
// Re-load quizp attempt data.
$attemptobj = quizp_attempt::create($attempt->id);
// Check that results are stored as expected.
$this->assertEquals(1, $attemptobj->get_attempt_number());
$this->assertEquals(4, $attemptobj->get_sum_marks());
$this->assertEquals(true, $attemptobj->is_finished());
$this->assertEquals($timenow, $attemptobj->get_submitted_date());
$this->assertEquals($user1->id, $attemptobj->get_userid());
$this->assertTrue($attemptobj->has_response_to_at_least_one_graded_question());
// Check quizp grades.
$grades = quizp_get_user_grades($quizp, $user1->id);
$grade = array_shift($grades);
$this->assertEquals(100.0, $grade->rawgrade);
// Check grade book.
$gradebookgrades = grade_get_grades($SITE->id, 'mod', 'quizp', $quizp->id, $user1->id);
$gradebookitem = array_shift($gradebookgrades->items);
$gradebookgrade = array_shift($gradebookitem->grades);
$this->assertEquals(100, $gradebookgrade->grade);
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function test_quizp_attempt_walkthrough() {\n global $SITE;\n\n $this->resetAfterTest(true);\n\n // Make a quizp.\n $quizpgenerator = $this->getDataGenerator()->get_plugin_generator('mod_quizp');\n\n $quizp = $quizpgenerator->create_instance(array('course'=>$SITE->id, 'questionsperpage' => 0, 'grade' => 100.0,\n 'sumgrades' => 2));\n\n // Create a couple of questions.\n $questiongenerator = $this->getDataGenerator()->get_plugin_generator('core_question');\n\n $cat = $questiongenerator->create_question_category();\n $saq = $questiongenerator->create_question('shortanswer', null, array('category' => $cat->id));\n $numq = $questiongenerator->create_question('numerical', null, array('category' => $cat->id));\n\n // Add them to the quizp.\n quizp_add_quizp_question($saq->id, $quizp);\n quizp_add_quizp_question($numq->id, $quizp);\n\n // Make a user to do the quizp.\n $user1 = $this->getDataGenerator()->create_user();\n\n $quizpobj = quizp::create($quizp->id, $user1->id);\n\n // Start the attempt.\n $quba = question_engine::make_questions_usage_by_activity('mod_quizp', $quizpobj->get_context());\n $quba->set_preferred_behaviour($quizpobj->get_quizp()->preferredbehaviour);\n\n $timenow = time();\n $attempt = quizp_create_attempt($quizpobj, 1, false, $timenow, false, $user1->id);\n\n quizp_start_new_attempt($quizpobj, $quba, $attempt, 1, $timenow);\n $this->assertEquals('1,2,0', $attempt->layout);\n\n quizp_attempt_save_started($quizpobj, $quba, $attempt);\n\n // Process some responses from the student.\n $attemptobj = quizp_attempt::create($attempt->id);\n $this->assertFalse($attemptobj->has_response_to_at_least_one_graded_question());\n\n $prefix1 = $quba->get_field_prefix(1);\n $prefix2 = $quba->get_field_prefix(2);\n\n $tosubmit = array(1 => array('answer' => 'frog'),\n 2 => array('answer' => '3.14'));\n\n $attemptobj->process_submitted_actions($timenow, false, $tosubmit);\n\n // Finish the attempt.\n $attemptobj = quizp_attempt::create($attempt->id);\n $this->assertTrue($attemptobj->has_response_to_at_least_one_graded_question());\n $attemptobj->process_finish($timenow, false);\n\n // Re-load quizp attempt data.\n $attemptobj = quizp_attempt::create($attempt->id);\n\n // Check that results are stored as expected.\n $this->assertEquals(1, $attemptobj->get_attempt_number());\n $this->assertEquals(2, $attemptobj->get_sum_marks());\n $this->assertEquals(true, $attemptobj->is_finished());\n $this->assertEquals($timenow, $attemptobj->get_submitted_date());\n $this->assertEquals($user1->id, $attemptobj->get_userid());\n $this->assertTrue($attemptobj->has_response_to_at_least_one_graded_question());\n\n // Check quizp grades.\n $grades = quizp_get_user_grades($quizp, $user1->id);\n $grade = array_shift($grades);\n $this->assertEquals(100.0, $grade->rawgrade);\n\n // Check grade book.\n $gradebookgrades = grade_get_grades($SITE->id, 'mod', 'quizp', $quizp->id, $user1->id);\n $gradebookitem = array_shift($gradebookgrades->items);\n $gradebookgrade = array_shift($gradebookitem->grades);\n $this->assertEquals(100, $gradebookgrade->grade);\n }",
"private function createAnswers($f, $p) {\n\n // Simulate each qeustion answering\n foreach ($f->questions as $q) {\n if ($q->isAspect()) {\n // If the question is about each aspect, answer like..\n\n // Each aspects has 3 level: normal, high-risk, very-high-risk\n // random to choose between those\n $c = $this->getRandomChoice($q->choices, null, true);\n if ($c->value == 0) {\n // Choose it and continue to next question\n $this->chooseChoice($f, $q, $c, $p);\n\n // next loop\n } else {\n // Choose the choice\n $this->chooseChoice($f, $q, $c, $p);\n $this->chooseRandomSubchoices($f, $q, $c, $p);\n\n // and random again\n // Since high & very-high can be their simultaneously\n $nc = $this->getRandomChoice($q->choices, null, true);\n\n if ($nc->value > 0 && $nc->value != $c->value) {\n // Not the 'normal' and not the same choice, choose it\n $this->chooseChoice($f, $q, $nc, $p);\n $this->chooseRandomSubchoices($f, $q, $nc, $p);\n } else {\n // next loop\n }\n }\n } else if ($q->isAboutTalent()) {\n // If the question is about talent answer like...\n\n // Talent has only 2 choice, random between the two\n $c = $this->getRandomChoice($q->choices, null);\n $a = $this->chooseChoice($f, $q, $c, $p);\n $ci = $c->inputs()->first();\n if ($ci) {\n $this->createRandomTalent($a, $ci, $p);\n }\n\n // next loop\n\n } else if ($q->isAboutDisability()) {\n // If the question is about disability answer like...\n\n // Non uniform random, low rate of having disability\n $probHaveDis = rand(0, 100);\n\n // Only 30% chance that a participant will have disability\n if ($probHaveDis > 70) {\n\n $numDis = $this->randomNumberOfDisabilities();\n\n $choosenChoices = [];\n $numChoice = count($q->choices);\n for ($i=0; $i < $numDis; $i++) { \n $c = $this->getRandomChoice($q->choices, $numChoice);\n \n if (Choice::choiceExistsInAnswers($c, $choosenChoices)) {\n // Allow no duplicates disabilities\n continue;\n } else {\n $a = $this->chooseChoice($f, $q, $c, $p);\n $ci = $c->inputs()->first();\n if ($ci) {\n $this->createRandomDisability($a, $ci);\n }\n }\n\n $choosenChoices[] = $a;\n }\n }\n }\n }\n }",
"private function generate_question() {\n\n require_once(__DIR__ . '/csv_gd.class.php');\n $csv_filename = $this->configuration['base_data_dir'] . '/csv/' . $this->configuration['csv_input'];\n\n $data_quiz_src_obj = new csv_gd($csv_filename);\n $data_quiz_src_orig = $data_quiz_src_obj->csv_to_array();\n\n\n\n // filter unwanted question (tags, diff level, void )\n $data_quiz_src_filtered = $this->quiz_filter($data_quiz_src_orig, $this->configuration['tags'], $this->configuration['min_diffucult_level'], $this->configuration['max_diffucult_level']);\n\n\n // reverse question with_answer\n if ($this->configuration['reverse_question'] == TRUE) {\n $data_quiz_src_filtered = $this->quiz_switch_question_with_answer($data_quiz_src_filtered);\n }\n\n\n // generate question and answer\n $data_quiz_src = $this->quiz_generate($data_quiz_src_filtered);\n\n\n // randomize quiz \n if ($this->configuration['randomize_question'] == TRUE) {\n shuffle($data_quiz_src);\n }\n\n\n // restrict the maxium number of question\n if ($this->configuration['max_question_total'] > 0) {\n $this->configuration['max_question_total'] = min(count($data_quiz_src), $this->configuration['max_question_total']);\n } else {\n $this->configuration['max_question_total'] = count($data_quiz_src);\n }\n $this->question = array_slice($data_quiz_src, 0, $this->configuration['max_question_total']);\n\n $this->configuration['debug']=$this->debug;\n\n // return $this->quiz_questions;\n }",
"public function test_quizp_with_question_with_variants_attempt_walkthrough($variantno, $correctresponse, $done = false) {\n global $SITE;\n\n $this->resetAfterTest($done);\n\n $this->setAdminUser();\n\n if ($this->quizpwithvariants === null) {\n // Make a quizp.\n $quizpgenerator = $this->getDataGenerator()->get_plugin_generator('mod_quizp');\n\n $this->quizpwithvariants = $quizpgenerator->create_instance(array('course'=>$SITE->id,\n 'questionsperpage' => 0,\n 'grade' => 100.0,\n 'sumgrades' => 1));\n\n $questiongenerator = $this->getDataGenerator()->get_plugin_generator('core_question');\n\n $cat = $questiongenerator->create_question_category();\n $calc = $questiongenerator->create_question('calculatedsimple', 'sumwithvariants', array('category' => $cat->id));\n quizp_add_quizp_question($calc->id, $this->quizpwithvariants, 0);\n }\n\n\n // Make a new user to do the quizp.\n $user1 = $this->getDataGenerator()->create_user();\n $this->setUser($user1);\n $quizpobj = quizp::create($this->quizpwithvariants->id, $user1->id);\n\n // Start the attempt.\n $quba = question_engine::make_questions_usage_by_activity('mod_quizp', $quizpobj->get_context());\n $quba->set_preferred_behaviour($quizpobj->get_quizp()->preferredbehaviour);\n\n $timenow = time();\n $attempt = quizp_create_attempt($quizpobj, 1, false, $timenow);\n\n // Select variant.\n quizp_start_new_attempt($quizpobj, $quba, $attempt, 1, $timenow, array(), array(1 => $variantno));\n $this->assertEquals('1,0', $attempt->layout);\n quizp_attempt_save_started($quizpobj, $quba, $attempt);\n\n // Process some responses from the student.\n $attemptobj = quizp_attempt::create($attempt->id);\n $this->assertFalse($attemptobj->has_response_to_at_least_one_graded_question());\n\n $tosubmit = array(1 => array('answer' => $correctresponse));\n $attemptobj->process_submitted_actions($timenow, false, $tosubmit);\n\n // Finish the attempt.\n $attemptobj = quizp_attempt::create($attempt->id);\n $this->assertTrue($attemptobj->has_response_to_at_least_one_graded_question());\n\n $attemptobj->process_finish($timenow, false);\n\n // Re-load quizp attempt data.\n $attemptobj = quizp_attempt::create($attempt->id);\n\n // Check that results are stored as expected.\n $this->assertEquals(1, $attemptobj->get_attempt_number());\n $this->assertEquals(1, $attemptobj->get_sum_marks());\n $this->assertEquals(true, $attemptobj->is_finished());\n $this->assertEquals($timenow, $attemptobj->get_submitted_date());\n $this->assertEquals($user1->id, $attemptobj->get_userid());\n $this->assertTrue($attemptobj->has_response_to_at_least_one_graded_question());\n\n // Check quizp grades.\n $grades = quizp_get_user_grades($this->quizpwithvariants, $user1->id);\n $grade = array_shift($grades);\n $this->assertEquals(100.0, $grade->rawgrade);\n\n // Check grade book.\n $gradebookgrades = grade_get_grades($SITE->id, 'mod', 'quizp', $this->quizpwithvariants->id, $user1->id);\n $gradebookitem = array_shift($gradebookgrades->items);\n $gradebookgrade = array_shift($gradebookitem->grades);\n $this->assertEquals(100, $gradebookgrade->grade);\n }",
"public function createQuestionAndAnswers () {\n global $tpl, $lng, $ilCtrl, $ilTabs;\n\n // create wizard object\n include_once('class.ilObjMobileQuizWizard.php');\n $wiz = new ilObjMobileQuizWizard();\n\n\n $ilTabs->activateTab(\"editQuiz\");\n\n\n if ($wiz->checkInput()){\n $wiz->createQuestionAndAnswers($this->object);\n ilUtil::sendSuccess($this->txt(\"question_obj_create\"), true);\n $ilCtrl->redirect($this, \"editQuiz\");\n }\n $this->initAddQuestionAndAnswersFormAfterError();\n //$tpl->setContent(\"Test\");\n }",
"private function quiz_generate($data_quiz_src) {\n // extract all possible answer\n $all_possible_answer = array();\n foreach ($data_quiz_src as $single_quiz) {\n $all_correct_answer = explode('|', $single_quiz['correct_answer']);\n $all_possible_answer[] = $all_correct_answer[0];\n }\n\n $out = array();\n $index = 0;\n foreach ($data_quiz_src as $single_quiz) {\n shuffle($all_possible_answer);\n\n $single_quiz['all_correct_answer'] = explode('|', $single_quiz['correct_answer']);\n\n $single_quiz['possible_answer'] = array($single_quiz['all_correct_answer'][0]);\n\n $single_quiz['response_type'] = !empty($single_quiz['response_type']) ? $single_quiz['response_type'] : $this->configuration['default_response_type'];\n\n // add wrong answer to $possible_answer from input data\n if (isset($single_quiz[\"wrong_answer\"])) {\n $possible_wrong_answer = explode('|', $single_quiz[\"wrong_answer\"]);\n\n //remove eventually emtpy element\n $single_quiz['possible_answer'] = array_filter($single_quiz['possible_answer']);\n\n\n $single_quiz['possible_answer'] = array_merge($single_quiz['possible_answer'], $possible_wrong_answer);\n }\n\n // add random wrong answer to $possible_answer\n $single_quiz['possible_answer'] = array_merge($single_quiz['possible_answer'], $all_possible_answer);\n\n // eliminate duplicates\n $single_quiz['possible_answer'] = array_unique($single_quiz['possible_answer']);\n\n //remove eventually emtpy element\n $single_quiz['possible_answer'] = array_filter($single_quiz['possible_answer']);\n\n //get only the correct number of elements:\n $single_quiz['response_type'] = strtolower($single_quiz['response_type']);\n $option_array = explode('_', $single_quiz['response_type']);\n if (isset($option_array[1])) {\n $max_option = $option_array[1];\n $single_quiz['response_type'] = $option_array[0];\n } else {\n $max_option = $this->configuration['num_options'];\n }\n\n $single_quiz['possible_answer'] = array_slice($single_quiz['possible_answer'], 0, $max_option);\n\n // shuffle all data:\n shuffle($single_quiz['possible_answer']);\n\n $single_quiz['all_question'] = explode('|', $single_quiz['question']);\n\n // remove all empty values \n $single_quiz['all_question'] = array_filter($single_quiz['all_question']);\n\n shuffle($single_quiz['all_question']);\n\n $single_quiz['question'] = $single_quiz['all_question'][0];\n\n\n // add id of the correct_answer to correct answer if the answer_type is 'options' \n if ($single_quiz['response_type'] == \"options\") {\n $key = array_search($single_quiz['all_correct_answer'][0], $single_quiz['possible_answer']);\n $single_quiz['all_correct_answer'][] = $key;\n }\n\n\n $output_keys = array(\n 'id',\n 'question',\n 'all_correct_answer',\n 'possible_answer',\n 'response_type',\n 'if_correct',\n 'if_wrong'\n );\n\n\n $out[$index] = array();\n foreach ($output_keys as $single_key) {\n\n $out[$index][$single_key] = isset($single_quiz[$single_key]) ? $single_quiz[$single_key] : \"\";\n }\n\n $index ++;\n }\n return $out;\n }",
"function buildQuiz() {\n for ($i = 0; $i <= 9; $i++) {\n $randomNumbers = getRandomNumbers();\n $correctAnswer = getCorrectAnswer($randomNumbers);\n $answers = getRandomAnswers($correctAnswer);\n $quiz[] = [\n \"leftAdder\" => $randomNumbers[0],\n \"rightAdder\" => $randomNumbers[1],\n \"correctAnswer\" => $correctAnswer,\n \"firstIncorrectAnswer\" => $answers[0],\n \"secondIncorrectAnswer\" => $answers[1],\n ];\n }\n return $quiz;\n}",
"function generateQuestion(){\n $rangeLow = 1;\n $rangeHigh = 100;\n $incorrectNumberHigh = 10;\n\n $leftAdder = random_int($rangeLow, $rangeHigh);\n $rightAdder = random_int($rangeLow, $rangeHigh);\n $correctAnswer = $leftAdder + $rightAdder;\n //generate init values for envaluation\n $incorrectAnswerFirst = random_int($correctAnswer-$incorrectNumberHigh, $correctAnswer+$incorrectNumberHigh);\n $incorrectAnswerSecond = random_int($correctAnswer-$incorrectNumberHigh , $correctAnswer+$incorrectNumberHigh);\n\n //if the condition not met, keep generated\n while(\n ($incorrectAnswerFirst == $correctAnswer) \n || \n ($incorrectAnswerFirst == $incorrectAnswerSecond)\n ||\n ($incorrectAnswerSecond == $correctAnswer)\n ){\n $incorrectAnswerFirst = random_int($correctAnswer-$incorrectNumberHigh, $correctAnswer+$incorrectNumberHigh);\n $incorrectAnswerSecond = random_int($correctAnswer-$incorrectNumberHigh , $correctAnswer+$incorrectNumberHigh);\n }\n $questions =\n [\n \"leftAdder\" => $leftAdder,\n \"rightAdder\" => $rightAdder,\n \"correctAnswer\" => $correctAnswer,\n \"firstIncorrectAnswer\" => $incorrectAnswerFirst,\n \"secondIncorrectAnswer\" => $incorrectAnswerSecond\n ];\n\n\n return $questions;\n}",
"function ipal_print_pagecontrols($quiz, $pageurl, $page, $hasattempts, $defaultcategoryobj) {\n global $CFG, $OUTPUT;\n static $randombuttoncount = 0;\n $randombuttoncount++;\n echo '<div class=\"pagecontrols\">';\n $hasattempts = 0;// Modified for ipal this is added because attempts don't mean anything with ipal.\n // Get the current context.\n $thiscontext = context_module::instance($quiz->course);\n $contexts = new question_edit_contexts($thiscontext);\n\n // Get the default category.\n list($defaultcategoryid) = explode(',', $pageurl->param('cat'));\n if (empty($defaultcategoryid)) {\n $defaultcategoryid = $defaultcategoryobj->id;\n }\n\n // Create the url the question page will return to.\n $returnurladdtoquiz = new moodle_url($pageurl, array('addonpage' => $page));\n\n // Print a button linking to the choose question type page.\n $returnurladdtoquiz = str_replace($CFG->wwwroot, '', $returnurladdtoquiz->out(false));\n $newquestionparams = array('returnurl' => $returnurladdtoquiz,\n 'cmid' => $quiz->cmid, 'appendqnumstring' => 'addquestion');\n create_new_question_button($defaultcategoryid, $newquestionparams,\n get_string('addaquestion', 'quiz'),\n get_string('createquestionandadd', 'quiz'), $hasattempts);\n\n if ($hasattempts) {\n $disabled = 'disabled=\"disabled\"';\n } else {\n $disabled = '';\n }// IPAL removed lines that added a random button.\n echo \"\\n</div>\";\n}",
"function create_session_and_responses(&$question, &$state, $cmoptions, $attempt) {\n global $CFG, $DB;\n if(!$maxnumber = (int)$DB->get_field_sql(\n \"SELECT MIN(a.itemcount)\n FROM {question_dataset_definitions} a,\n {question_datasets} b\n WHERE b.question = ?\n AND a.id = b.datasetdefinition\", array($question->id))) {\n print_error('cannotgetdsforquestion', 'question', '', $question->id);\n }\n\n // Choose a random dataset\n if (!isset($cmoptions->intro) || strstr($cmoptions->intro, 'synchronize_calculated') === false ) {\n $state->options->datasetitem = rand(1, $maxnumber);\n }else{\n if( !isset($cmoptions->synchronize_calculated)) {\n $state->options->datasetitem = rand(1, $maxnumber);\n $cmoptions->synchronize_calculated = $state->options->datasetitem ;\n }else {\n if ($cmoptions->synchronize_calculated <= $maxnumber){\n $state->options->datasetitem = $cmoptions->synchronize_calculated ;\n }else {\n $state->options->datasetitem = rand(1, $maxnumber);\n }\n }\n };\n $state->options->dataset =\n $this->pick_question_dataset($question,$state->options->datasetitem);\n $state->responses = array('' => '');\n return true;\n }",
"public function generateQuestion()\n\t{\n\t\t//get random question type\n\t\t$type = $this->questionTypes[array_rand($this->questionTypes)];\n\n\t\t//get random section\n\t\t$section = $this->getRandomSection();\n\n\t\t//get random function (within the above section)\n\t\t$function = $this->getRandomFunction($section);\n\n\t\t$question = [];\n\t\t$question['type'] = $type;\n\t\t$question['section'] = $section;\n\t\t$question['function'] = $function;\n\t\t$question['text'] = \"{$section} now, {$this->questionTextPerType[$type]}\";\n\t\t$question['choices'] = [];\n\t\t$question['answer_text'] = '';\n\t\t$question['answer_index'] = '';\t//in ['choices'] array\n\n\n\t\treturn $this->fillQuestion($question);\n\t}",
"function getGeneratedQuestions() {\n $generatedQuestions = [];\n\n // for the generated questions, let's make the total 12\n for ($i = 0; $i < 12; $i++) {\n\n // create the queston attributes\n $leftAdder = mt_rand(0 , 100);\n\n $rightAdder;\n do {\n $rightAdder = mt_rand(0 , 100);\n } while ($rightAdder === $leftAdder);\n\n $correctAnswer = $leftAdder + $rightAdder;\n\n $firstIncorrectAnswer;\n do {\n $firstIncorrectAnswer = mt_rand($correctAnswer - 10, $correctAnswer + 10);\n } while ($firstIncorrectAnswer === $correctAnswer);\n\n $secondIncorrectAnswer;\n do {\n $secondIncorrectAnswer = mt_rand($correctAnswer - 10, $correctAnswer + 10);\n } while (\n $secondIncorrectAnswer === $correctAnswer || \n $secondIncorrectAnswer === $firstIncorrectAnswer\n );\n\n // cast to object to mimic json file\n $generatedQuestions[] = (object)[\n \"leftAdder\" => $leftAdder,\n \"rightAdder\" => $rightAdder,\n \"correctAnswer\" => $correctAnswer,\n \"firstIncorrectAnswer\" => $firstIncorrectAnswer,\n \"secondIncorrectAnswer\" => $secondIncorrectAnswer \n ];\n }\n\n return $generatedQuestions;\n}",
"private function create_quiz_with_questions($startattempt = false, $finishattempt = false, $behaviour = 'deferredfeedback') {\n\n // Create a new quiz with attempts.\n $quizgenerator = $this->getDataGenerator()->get_plugin_generator('mod_quiz');\n $data = array('course' => $this->course->id,\n 'sumgrades' => 2,\n 'preferredbehaviour' => $behaviour);\n $quiz = $quizgenerator->create_instance($data);\n $context = context_module::instance($quiz->cmid);\n\n // Create a couple of questions.\n $questiongenerator = $this->getDataGenerator()->get_plugin_generator('core_question');\n\n $cat = $questiongenerator->create_question_category();\n $question = $questiongenerator->create_question('numerical', null, array('category' => $cat->id));\n quiz_add_quiz_question($question->id, $quiz);\n $question = $questiongenerator->create_question('numerical', null, array('category' => $cat->id));\n quiz_add_quiz_question($question->id, $quiz);\n\n $quizobj = quiz::create($quiz->id, $this->student->id);\n\n // Set grade to pass.\n $item = grade_item::fetch(array('courseid' => $this->course->id, 'itemtype' => 'mod',\n 'itemmodule' => 'quiz', 'iteminstance' => $quiz->id, 'outcomeid' => null));\n $item->gradepass = 80;\n $item->update();\n\n if ($startattempt or $finishattempt) {\n // Now, do one attempt.\n $quba = question_engine::make_questions_usage_by_activity('mod_quiz', $quizobj->get_context());\n $quba->set_preferred_behaviour($quizobj->get_quiz()->preferredbehaviour);\n\n $timenow = time();\n $attempt = quiz_create_attempt($quizobj, 1, false, $timenow, false, $this->student->id);\n quiz_start_new_attempt($quizobj, $quba, $attempt, 1, $timenow);\n quiz_attempt_save_started($quizobj, $quba, $attempt);\n $attemptobj = quiz_attempt::create($attempt->id);\n\n if ($finishattempt) {\n // Process some responses from the student.\n $tosubmit = array(1 => array('answer' => '3.14'));\n $attemptobj->process_submitted_actions(time(), false, $tosubmit);\n\n // Finish the attempt.\n $attemptobj->process_finish(time(), false);\n }\n return array($quiz, $context, $quizobj, $attempt, $attemptobj, $quba);\n } else {\n return array($quiz, $context, $quizobj);\n }\n\n }",
"public function next()\n\t{\n\t\tif(!S::may())\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\t/*\n\t\t * Try to find a current quiz session ant retrieve the questions\n\t\t */\n\t\tif($quiz = S::get('quiz-questions'))\n\t\t{\n\t\t\t$dia = new XhrDialog();\n\t\t\t$dia->addClass('quiz-questiondialog');\n\t\t\t// get quiz_index it is the current array index of the questions\n\t\t\t$i = S::get('quiz-index');\n\t\t\t\n\t\t\t/*\n\t\t\t * If the quiz index is 0 we have to start a new quiz session \n\t\t\t */\n\t\t\t\n\t\t\t$easymode = 0;\n\t\t\tif(S::get('quiz-easymode'))\n\t\t\t{\n\t\t\t\t$easymode = 1;\n\t\t\t}\n\t\t\t\n\t\t\tif($i == 0)\n\t\t\t{\t\t\t\t\n\t\t\t\t$quuizz = $this->model->getQuiz(S::get('quiz-id'));\n\t\t\t\t// init quiz session in DB\n\t\t\t\tif($id = $this->model->initQuizSession(S::get('quiz-id'), $quiz, $quuizz['maxfp'], $quuizz['questcount'],$easymode))\n\t\t\t\t{\n\t\t\t\t\tS::set('quiz-session', $id);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// this variable we need to output an message that the last question was only a joke \n\t\t\t$was_a_joke = false;\n\t\t\t\n\t\t\t/*\n\t\t\t * check if an answered quiz question is arrived\n\t\t\t */\n\t\t\tif(isset($_GET['answer']))\n\t\t\t{\n\t\t\t\t/*\n\t\t\t\t * parse the anser parameter\n\t\t\t\t */\n\t\t\t\t$answers = urldecode($_GET['answer']);\n\t\t\t\t$params = array();\n\t\t\t\tparse_str($_GET['answer'], $params);\n\t\t\t\t\n\t\t\t\t/*\n\t\t\t\t * store params in the quiz array to save users answers\n\t\t\t\t */\n\t\t\t\tif(isset($params['qanswers']))\n\t\t\t\t{\n\t\t\t\t\t$quiz[($i-1)]['answers'] = $params['qanswers'];\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t/*\n\t\t\t\t * check if there are 0 point for the questions its a joke\n\t\t\t\t */\n\t\t\t\tif($quiz[($i-1)]['fp'] == 0)\n\t\t\t\t{\n\t\t\t\t\t$was_a_joke = true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t/*\n\t\t\t\t * store the time how much time has the user need\n\t\t\t\t */\n\t\t\t\t$quiz[($i-1)]['userduration'] = (time() - (int)S::get('quiz-quest-start'));\n\t\t\t\t\n\t\t\t\t/*\n\t\t\t\t * has store noco ;) its the value when the user marked that no answer is correct\n\t\t\t\t */\n\t\t\t\t$quiz[($i-1)]['noco'] = (int)$_GET['noco'];\n\t\t\t\t\n\t\t\t\t/*\n\t\t\t\t * And store it all back to the session\n\t\t\t\t */\n\t\t\t\tS::set('quiz-questions', $quiz);\n\t\t\t}\n\t\t\t\n\t\t\t/*\n\t\t\t * Have a look has the user entered an comment for this question?\n\t\t\t*/\n\t\t\tif(isset($_GET['comment']) && !empty($_GET['comment']))\n\t\t\t{\n\t\t\t\t$comment = strip_tags($_GET['comment']);\n\t\t\t\t\n\t\t\t\t$comment = $_GET['commentanswers'] . $comment;\n\t\t\t\t\n\t\t\t\t// if yes lets store in the db\n\t\t\t\t$this->model->addUserComment((int)$_GET['qid'], $comment);\n\t\t\t}\n\t\t\t\n\t\t\t/*\n\t\t\t * Check the special param if the next question should not be displayed\n\t\t\t */\n\t\t\tif(isset($_GET['special']))\n\t\t\t{\n\t\t\t\t// make a break\n\t\t\t\tif($_GET['special'] == 'pause')\n\t\t\t\t{\n\t\t\t\t\t$this->model->updateQuizSession(S::get('quiz-session'), $quiz, $i);\n\t\t\t\t\treturn $this->pause();\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t//\n\t\t\t\tif($_GET['special'] == 'result')\n\t\t\t\t{\n\t\t\t\t\t$this->model->updateQuizSession(S::get('quiz-session'), $quiz, $i);\n\t\t\t\t\treturn $this->resultNew($quiz[($i-1)],$dia->getId());\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t/*\n\t\t\t * check if there is a next question in quiz array push it to the user\n\t\t\t * othwise forward to the result of the quiz\n\t\t\t */\n\t\t\tif(isset($quiz[$i]))\n\t\t\t{\n\t\t\t\t// get the question\n\t\t\t\tif($question = $this->model->getQuestion($quiz[$i]['id']))\n\t\t\t\t{\t\t\n\t\t\t\t\t// get possible answers\t\t\n\t\t\t\t\t$comment_aswers = '';\n\t\t\t\t\tif($answers = $this->model->getAnswers($question['id']))\n\t\t\t\t\t{\n\t\t\t\t\t\t// random sorting for the answers\n\t\t\t\t\t\tshuffle($answers);\n\n\t\t\t\t\t\t$x=1;\n\t\t\t\t\t\tforeach ($answers as $a)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$comment_aswers .= $x.'. Frage #'.$a['id'].' => '.preg_replace('/[^a-zA-Z0-9\\ \\.]/','',tt($a['text'],25)).\"\\n\";\n\t\t\t\t\t\t\t$x++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * increase the question index so we are at the next question ;)\n\t\t\t\t\t\t */ \n\t\t\t\t\t\t$i++;\n\t\t\t\t\t\tS::set('quiz-index',$i);\n\t\t\t\t\t\t\n\t\t\t\t\t\t// update quiz session\n\t\t\t\t\t\t$session_id = S::get('quiz-session');\n\t\t\t\t\t\t$this->model->updateQuizSession($session_id, $quiz, $i);\n\t\t\t\t\t\tS::set('quiz-quest-start',time());\n\t\t\t\t\t\t\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * let's prepare the output dialog\n\t\t\t\t\t\t */\n\t\t\t\t\t\t$dia->addOpt('width', 1000);\n\t\t\t\t\t\t$dia->addOpt('height', '($(window).height()-40)',false);\n\t\t\t\t\t\t$dia->addOpt('position', 'center');\n\t\t\t\t\t\t$dia->setTitle('Frage '.($i).' / '.count($quiz));\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t$dia->addContent($this->view->quizQuestion($question,$answers));\n\t\t\t\t\t\t\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * for later function is not ready yet :)\n\t\t\t\t\t\t */\n\t\t\t\t\t\t$dia->addButton('Weiter', 'questcheckresult();return false;');\n\t\t\t\t\t\t$dia->addButton('Pause', 'ajreq(\\'pause\\',{app:\\'quiz\\',sid:\\''.$session_id.'\\'});');\n\n\t\t\t\t\t\t$dia->addButton('nächste Frage','ajreq(\\'next\\',{app:\\'quiz\\',qid:'.(int)$question['id'].',commentanswers:\"'.jsSafe($comment_aswers).'\"});$(\".quiz-questiondialog .ui-dialog-buttonset .ui-button\").button( \"option\", \"disabled\", true );$(\".quiz-questiondialog .ui-dialog-buttonset .ui-button span\").prepend(\\'<i class=\"fa fa-spinner fa-spin\"></i> \\')');\n\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * add next() Button\n\t\t\t\t\t\t */\n\n\t\t\t\t\t\t$dia->addOpt('open','\n\t\t\t\t\t\tfunction(){\n\t\t\t\t\t\t\tsetTimeout(function(){\n\t\t\t\t\t\t\t\t$close = $(\"#'.$dia->getId().'\").prev().children(\".ui-dialog-titlebar-close\");\n\t\t\t\t\t\t\t\t$close.unbind(\"click\");\n\t\t\t\t\t\t\t\t$close.click(function(){\n\t\t\t\t\t\t\t\t\tajreq(\"pause\",{app:\"quiz\",sid:'.(int)$session_id.'});\n\t\t\t\t\t\t\t\t\t//abortOrPause(\"'.$dia->getId().'\");\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t$(\"#quizcomment\").hide();\n\t\t\t\t\t\t\t\t$(\".quiz-questiondialog .ui-dialog-buttonset button:last\").hide();\n\t\t\t\t\t\t\t\t$(\".quiz-questiondialog .ui-dialog-buttonset .ui-button:contains(\\'Pause\\')\").hide();\n\t\t\t\t\t\t\t\t$(\".ui-dialog-titlebar-close\").hide();\n\t\t\t\t\t\t\t},100);\n\t\t\t\t\t\t}',false);\n\t\t\t\t\t\t\n\t\t\t\t\t\t$return = $dia->xhrout();\n\t\t\t\t\t\t\n\t\t\t\t\t\t// additional output if it was a joke question\n\t\t\t\t\t\tif($was_a_joke)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$return['script'] .= 'pulseInfo(\"<h3>Das war eine Scherzfrage</h3>Du kannst beruhigt weitermachen und auch wenn die möglichen Antworten nicht falsch sind, müssen diese Fragen nicht richtig beantwortet werden, sie dienen lediglich des auflockerns für Zwischendurch ;)\",{sticky:true});';\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * strange but it works ;) generate the js code and send is to the client for execute\n\t\t\t\t\t\t */\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t$quizbreath = '\n\t\t\t\t\t\t\t$(\\'#quizwrapper\\').show();\n\t\t\t\t\t\t\t$(\\'#quizbreath\\').hide();\n\t\t\t\t\t\t\tvar count = '.(int)$question['duration'].';\n\t\t\t\t\t\t\tvar counter = null;\n\t\t\t\t\t\t';\n\t\t\t\t\t\t\n\t\t\t\t\t\tif($easymode == 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$quizbreath = '\n\t\t\t\t\t\t\t$(\\'#quizwrapper\\').hide();\n\t\t\t\t\t\t\t$(\\'#quizbreath\\').show();\n\t\t\t\t\t\t\t$(\"#'.$dia->getId().'\").next(\".ui-dialog-buttonpane\").css(\"visibility\",\"hidden\");\n\t\t\t\t\t\t\tvar count = '.(int)$question['duration'].';\n\t\t\t\t\t\t\tvar counter = null;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfunction timer()\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t count--;\n\t\t\t\t\t $(\"#countdown\").progressbar(\"value\",count);\n\t\t\t\t\t\t\t //$(\"#countdown\").text((count)+\"\");\n\t\t\t\t\t\t\t if (count <= 0)\n\t\t\t\t\t\t\t {\n\t\t\t\t\t\t\t questcheckresult(true);\n\t\t\t\t\t\t\t return;\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tsetTimeout(function(){\n\t\t\t\t\t\t\t\t$(\\'#quizbreath span\\').text(\"Auf die Plätze!\");\n\t\t\t\t\t\t\t},3000);\n\t\t\t\t\t\t\tsetTimeout(function(){\n\t\t\t\t\t\t\t\t$(\\'#quizbreath span\\').text(\"Fertig...\");\n\t\t\t\t\t\t\t},4000);\n\t\t\t\t\t\t\tsetTimeout(function(){\n\t\t\t\t\t\t\t\t$(\\'#quizbreath span\\').text(\"Weiter gehts!\");\n\t\t\t\t\t\t\t},5000);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tsetTimeout(function(){\n\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\tcounter = setInterval(timer, 1000); \n\t\t\t\t\t\t\t\t$(\"#countdown\").progressbar({\n\t\t\t\t\t\t value: '.$question['duration'].',\n\t\t\t\t\t\t max:'.$question['duration'].'\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$(\\'#quizwrapper\\').show();\n\t\t\t\t\t\t\t\t$(\\'#quizbreath\\').hide();\n\t\t\t\t\t\t\t\t$(\".ui-dialog-buttonpane\").css(\"visibility\",\"visible\");\n\t\t\t\t\t\t\t},6000);';\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t$return['script'] .= '\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfunction abortOrPause()\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$(\"#abortOrPause\").dialog(\"open\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfunction questcomment(el)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif($(\\'#qanswers input:checked\\').length > 0)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tclearInterval(counter);\n\t\t\t\t\t\t\t\t\t$(\".ui-dialog-buttonpane button:contains(\\'Kommentar\\')\").hide();\n\t\t\t\t\t\t\t\t\t$(\"#quizwrapper input, #countdown\").hide();\n\t\t\t\t\t\t\t\t\t$(\"#quizwrapper\").css({\n\t\t\t\t\t\t\t\t\t\t\"height\":\"50%\",\n\t\t\t\t\t\t\t\t\t\t\"overflow\":\"auto\"\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t$(\"#quizcomment\").show();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tpulseError(\\'Bitte treffe erst eine Auswahl!\\')\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfunction questgonext(special)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif(special == undefined)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tspecial = 0;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tclearInterval(counter);\n\t\t\t\t\t\t\t\tajreq(\\'next\\',{answer:$(\\'.qanswers\\').serialize(),noco:$(\\'.nocheck:checked\\').length,app:\\'quiz\\',commentanswers:\"'.jsSafe($comment_aswers).'\",comment:$(\\'#quizusercomment\\').val(),qid:'.(int)$question['id'].',special:special});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfunction breaknext()\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif($(\\'#qanswers input:checked\\').length > 0)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tquestgonext(\"pause\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tpulseError(\\'Bitte treffe erst eine Auswahl!\\')\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfunction questionnext()\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif($(\\'#qanswers input:checked\\').length > 0)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tquestgonext();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tpulseError(\\'Bitte treffe eine Auswahl!\\')\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfunction questcheckresult(nowait)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif(nowait == undefined)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tnowait = false;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif(nowait || $(\\'#qanswers input:checked\\').length > 0)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tquestgonext(\"result\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tpulseError(\\'Bitte treffe erst eine Auswahl!\\')\n\t\t\t\t\t\t\t\t}\t\n\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$(\"li.noanswer\").click(function(){\n\t\t\t\t\t\t\t\tsetTimeout(function(){\n\t\t\t\t\t\t\t\t\tif($(\"input.nocheck:checked\").length > 0)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t$(\"li.answer input\").each(function(){\n\t\t\t\t\t\t\t\t\t\t\tthis.checked = false;\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},50);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$(\"li.answer input\").click(function(){\n\t\t\t\t\t\t\t\tif(this.checked)\n\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}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$(\"li.answer, li.noanswer\").click(function(ev){\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tvar nName = ev.target.nodeName.toLowerCase();\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif(nName == \"li\" || nName == \"label\")\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tif($(this).children(\"label\").children(\"input:checked\").length >= 1)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t$(this).children(\"label\").children(\"input\")[0].checked = false;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t$(this).children(\"label\").children(\"input\")[0].checked = true;\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\t\n\t\t\t\t\t\t\t$(\"li.answer\").click(function(){\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif($(\"li.answer input:checked\").length > 0)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t$(\"input.nocheck\")[0].checked = false;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\n\t\t\t\t\t\t\tvar width = 1000;\n\t\t\t\t\t\t\tif($(window).width() < 1000)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\twidth = ($(window).width()-40);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t$(\"#'.$dia->getId().'\").dialog(\"option\",{\n\t\t\t\t\t\t\t\twidth:width,\n\t\t\t\t\t\t\t\theight:($(window).height()-40)\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t$(window).resize(function(){\n\t\t\t\t\t\t\t\tvar width = 1000;\n\t\t\t\t\t\t\t\tif($(window).width() < 1000)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\twidth = ($(window).width()-40);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t$(\"#'.$dia->getId().'\").dialog(\"option\",{\n\t\t\t\t\t\t\t\t\twidth:width,\n\t\t\t\t\t\t\t\t\theight:($(window).height()-40)\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\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t' . $quizbreath;\n\t\t\t\t\t\treturn $return;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t$i++;\n\t\t\t\t\t\tS::set('quiz-index',$i);\n\t\t\t\t\t\treturn array(\n\t\t\t\t\t\t\t'status' => 1,\n\t\t\t\t\t\t\t'script' => 'pulseError(\"Diese Frage hat Keine Antworten, überspringe...\");ajreq(\"next\",{app:\"quiz\"});'\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\telse\n\t\t\t{\n\t\t\t\treturn $this->quizResult();\n\t\t\t}\n\t\t}\n\t\t\n\t\t$i++;\n\t\tS::set('quiz-index',$i);\n\t\treturn array(\n\t\t\t\t'status' => 1,\n\t\t\t\t'script' => 'pulseError(\"Es ist ein Fehler aufgetreten, Frage wird übersprungen\");ajreq(\"next\",{app:\"quiz\"});'\n\t\t);\n\t\t\n\t}",
"function module_specific_controls($totalnumber, $recurse, $category, $cmid, $cmoptions) {\n global $OUTPUT;\n $out = '';\n $catcontext = context::instance_by_id($category->contextid);\n if (has_capability('moodle/question:useall', $catcontext)) {\n $cmoptions->hasattempts = false;\n if ($cmoptions->hasattempts) {// Prior attempts donít matter with IPAL.\n $disabled = ' disabled=\"disabled\"';\n } else {\n $disabled = '';\n }\n $randomusablequestions = question_bank::get_qtype('random')->get_available_questions_from_category(\n $category->id, $recurse);\n $maxrand = count($randomusablequestions);$maxrand = 0;// Adding random questions is not an IPAL option.\n if ($maxrand > 0) {\n for ($i = 1; $i <= min(10, $maxrand); $i++) {\n $randomcount[$i] = $i;\n }\n for ($i = 20; $i <= min(100, $maxrand); $i += 10) {\n $randomcount[$i] = $i;\n }\n } else {\n $randomcount[0] = 0;\n $disabled = ' disabled=\"disabled\"';\n }\n\n $out = '<strong><label for=\"menurandomcount\">'.get_string('addrandomfromcategory', 'quiz').\n '</label></strong><br />';\n $attributes = array();\n $attributes['disabled'] = $disabled ? 'disabled' : null;\n $select = html_writer::select($randomcount, 'randomcount', '1', null, $attributes);\n $out .= get_string('addrandom', 'quiz', $select);\n $out .= '<input type=\"hidden\" name=\"recurse\" value=\"'.$recurse.'\" />';\n $out .= '<input type=\"hidden\" name=\"categoryid\" value=\"' . $category->id . '\" />';\n $out .= ' <input type=\"submit\" name=\"addrandom\" value=\"'.\n get_string('addtoquiz', 'quiz').'\"' . $disabled . ' />';\n $out .= $OUTPUT->help_icon('addarandomquestion', 'quiz');\n }\n return $out;\n}",
"function shuffleAnswers($answer1, $answer2, $answer3, $answer4)\n{\n\n\t$i = rand(0,3);\n\n\t//Puts the correct answer on a random position\n\tswitch($i)\n\t{\n\t\tcase 0:\n\t\t\t$antwort1 = $answer1;\n\t\t\t$antwort2 = $answer2;\n\t\t\t$antwort3 = $answer3;\n\t\t\t$antwort4 = $answer4;\n $position1 = 1;\n $position2 = 2;\n $position3 = 3;\n $position4 = 4;\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\t$antwort1 = $answer2;\n\t\t\t$antwort2 = $answer1;\n\t\t\t$antwort3 = $answer3;\n\t\t\t$antwort4 = $answer4;\n\t\t\t$position1 = 2;\n $position2 = 1;\n $position3 = 3;\n $position4 = 4;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\t$antwort1 = $answer2;\n\t\t\t$antwort2 = $answer3;\n\t\t\t$antwort3 = $answer1;\n\t\t\t$antwort4 = $answer4;\n $position1 = 2;\n $position2 = 3;\n $position3 = 1;\n $position4 = 4;\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\t$antwort1 = $answer2;\n\t\t\t$antwort2 = $answer3;\n\t\t\t$antwort3 = $answer4;\n\t\t\t$antwort4 = $answer1;\n $position1 = 2;\n $position2 = 3;\n $position3 = 4;\n $position4 = 1;\n\t\t\tbreak;\n\t}\n\n $res = [\"casename\"=>$questionData['casename'], \"antwort1\"=>$antwort1, \"antwort2\"=>$antwort2, \"antwort3\"=>$antwort3, \"antwort4\"=>$antwort4, \"positionAnswer1\"=>$position1, \"positionAnswer2\"=>$position2 , \"positionAnswer3\"=>$position3, \"positionAnswer4\"=>$position4];\n return $res;\n}",
"private function generateQuestion(){\n\t\t\t$questions = array(\n\t\t\t\t\tarray('name' => 'chevrolet', 'logo' => 'chevrolet.png'),\n\t\t\t\t\tarray('name' => 'playboy', 'logo' => 'playboy.png'),\n\t\t\t\t\tarray('name' => 'shell', 'logo' => 'shell.png'),\n\t\t\t\t\tarray('name' => 'java', 'logo' => 'java.png'),\n\t\t\t\t\tarray('name' => 'mysql', 'logo' => 'mysql.png'),\n\t\t\t\t\tarray('name' => 'postgresql', 'logo' => 'postgresql.png'),\n\t\t\t\t\tarray('name' => 'chrome', 'logo' => 'chrome.png'),\n\t\t\t\t\tarray('name' => 'firefox', 'logo' => 'firefox.png'),\n\t\t\t\t\tarray('name' => 'bluetooth', 'logo' => 'bluetooth.png'),\n\t\t\t\t\tarray('name' => 'twitter', 'logo' => 'twitter.png')\n\t\t\t\t);\n\t\t\t\t\n\t\t\t$index = rand(0, count($questions) - 1);\n\t\t\t\n\t\t\t$this->session->set('gl_answer', $questions[$index]['name']);\n\t\t\t\n\t\t\treturn array(\n\t\t\t\t\t\t\t'type' => 'image',\n\t\t\t\t\t\t\t'originalContentUrl' => $this->image_url . $questions[$index]['logo'],\n\t\t\t\t\t\t\t'previewImageUrl' => $this->image_url . $questions[$index]['logo']\n\t\t\t\t\t\t);\n\t\t}",
"public function randomQuestion(): void\n {\n $expectedQuestion = QuestionUserHelper::createScheduledQuestionForUser($this->user)->question()->first();\n $randomQuestions = $this->user->randomUserQuestion();\n\n $this->assertTrue($randomQuestions->contains($expectedQuestion));\n }",
"public function newMathQuestion(): void {\n\t\t$this->rndNumber1 = random_int(1, 10);\n\t\t$this->rndNumber2 = random_int(1, 10);\n\t\t$this->rndOperator = random_int(0, 2);\n\t\t$this->calcResult();\n\t}",
"public function test_quizUserScoreFunctions() {\n \t$quiz = TheTrainingMangerLMS\\LessonQuiz::create(\n \t\tarray( 'title' => 'This is my favorite quiz!',\n \t\t\t 'options' => array(\n \t\t\t \t\t'number_of_questions' => 20,\n \t\t\t \t\t'time_limit' => 3600,\n \t\t\t \t\t'allowed_repeats' => 2\n \t\t\t \t)\n \t\t)\n \t);\n \t$this->assertTrue(get_class($quiz) == 'TheTrainingMangerLMS\\LessonQuiz');\n \t// create a whole bunch of questions, say 25 and add them\n \tfor($i = 0; $i < 25; $i++) {\n\t\t\t$question = TheTrainingMangerLMS\\Quiz\\Question::create( array( 'title' => \"This is my favorite question {$i}!\") );\n\t\t\t$question->setAnswer($this->createSimpleChoiceAnswer());\n\t\t\t$quiz->addQuestion($question);\n \t}\n \t$this->assertEquals(25, count($quiz->getQuestions()));\n \t$user = TheTrainingMangerLMS\\User::create( array( 'login' => 'Joe Schmoe', 'password' => 'test123' ) );\n \t$this->assertTrue(get_class($user) == 'TheTrainingMangerLMS\\User');\n $user = TheTrainingMangerLMS\\Student::promote($user);\n $this->assertTrue(get_class($user) == 'TheTrainingMangerLMS\\Student');\n \t$quiz->startQuiz($user);\n \t$questions = explode(',', get_user_meta($user->ID(), ttp_lms_prefix('quiz_' . $quiz->ID() . '_try_' . '1' . '_questions'), true));\n \tfor($i = 0; $i < 10; $i++) {\n\t \t$question = $quiz->getNextQuestion($user);\n \t\t$this->assertEquals($questions[$i], $question->ID());\n \t\t$quiz->saveQuestionResponseAndOutcome($user, $question, array('choice' => 1), array( 'outcome' => 'CORRECT', 'score' => 2.0, 'tpp' => 4.0));\n \t}\n \t$quiz->endQuiz($user);\n \t$totalpoints = get_user_meta($user->ID(), ttp_lms_prefix('quiz_' . $quiz->ID() . '_try_' . '1' . '_ttp'), false);\n \t$this->assertEquals(1, count($totalpoints));\n \t$this->assertEquals(80, $totalpoints[0]);\n \t$totalscore = get_user_meta($user->ID(), ttp_lms_prefix('quiz_' . $quiz->ID() . '_try_' . '1' . '_totalscore'), false);\n \t$this->assertEquals(1, count($totalscore));\n \t$this->assertEquals(20, $totalscore[0]);\n }",
"public function display($quiz, $cm, $course) {\n global $DB, $OUTPUT;\n\n list($currentgroup, $students, $groupstudents, $allowed) =\n $this->init('randomsummary', 'quiz_randomsummary_settings_form', $quiz, $cm, $course);\n $options = new quiz_randomsummary_options('randomsummary', $quiz, $cm, $course);\n\n if ($fromform = $this->form->get_data()) {\n $options->process_settings_from_form($fromform);\n\n } else {\n $options->process_settings_from_params();\n }\n\n $this->form->set_data($options->get_initial_form_data());\n\n if ($options->attempts == self::ALL_WITH) {\n // This option is only available to users who can access all groups in\n // groups mode, so setting allowed to empty (which means all quiz attempts\n // are accessible, is not a security porblem.\n $allowed = array();\n }\n\n // Load the required questions.\n // First get all Random questions within this quiz.\n $idfield = $DB->sql_concat('q2.id', 'slot.slot');\n $questionsraw = $DB->get_records_sql(\"\n SELECT $idfield as id, q2.id as q2id, q.id as qid, slot.slot, q2.length, slot.maxmark, q2.name\n FROM {question} q\n JOIN {quiz_slots} slot ON slot.questionid = q.id\n JOIN {question} q2 on q.category = q2.category\n WHERE slot.quizid = ?\n AND q.length > 0\n AND q.qtype = 'random'\n AND q2.qtype <> 'random'\n ORDER BY slot.slot\", array($quiz->id));\n $number = 1;\n $questions = array();\n foreach ($questionsraw as $question) {\n if (!isset($questions[$question->q2id])) {\n $questions[$question->q2id] = $question;\n $questions[$question->q2id]->slots = array();\n }\n $questions[$question->q2id]->slots[] = $question->slot;\n $questions[$question->q2id]->number = $number;\n $number += $questions[$question->q2id]->length;\n }\n\n // Prepare for downloading, if applicable.\n $courseshortname = format_string($course->shortname, true,\n array('context' => context_course::instance($course->id)));\n $table = new quiz_randomsummary_table($quiz, $this->context, $this->qmsubselect,\n $options, $groupstudents, $students, $questions, $options->get_url());\n $filename = quiz_report_download_filename(get_string('randomsummaryfilename', 'quiz_randomsummary'),\n $courseshortname, $quiz->name);\n $table->is_downloading($options->download, $filename,\n $courseshortname . ' ' . format_string($quiz->name, true));\n if ($table->is_downloading()) {\n raise_memory_limit(MEMORY_EXTRA);\n }\n\n $this->course = $course; // Hack to make this available in process_actions.\n $this->process_actions($quiz, $cm, $currentgroup, $groupstudents, $allowed, $options->get_url());\n\n // Start output.\n if (!$table->is_downloading()) {\n // Only print headers if not asked to download data.\n $this->print_header_and_tabs($cm, $course, $quiz, $this->mode);\n }\n\n if ($groupmode = groups_get_activity_groupmode($cm)) {\n // Groups are being used, so output the group selector if we are not downloading.\n if (!$table->is_downloading()) {\n groups_print_activity_menu($cm, $options->get_url());\n }\n }\n\n // Print information on the number of existing attempts.\n if (!$table->is_downloading()) {\n // Do not print notices when downloading.\n if ($strattemptnum = quiz_num_attempt_summary($quiz, $cm, true, $currentgroup)) {\n echo '<div class=\"quizattemptcounts\">' . $strattemptnum . '</div>';\n }\n }\n\n $hasquestions = quiz_has_questions($quiz->id);\n if (!$table->is_downloading()) {\n if (!$hasquestions) {\n echo quiz_no_questions_message($quiz, $cm, $this->context);\n } else if (!$students) {\n echo $OUTPUT->notification(get_string('nostudentsyet'));\n } else if ($currentgroup && !$groupstudents) {\n echo $OUTPUT->notification(get_string('nostudentsingroup'));\n }\n\n // Print the display options.\n $this->form->display();\n }\n\n $hasstudents = $students && (!$currentgroup || $groupstudents);\n if ($hasquestions && ($hasstudents || $options->attempts == self::ALL_WITH)) {\n // Construct the SQL.\n $fields = $DB->sql_concat('u.id', \"'#'\", 'COALESCE(quiza.attempt, 0)') .\n ' AS uniqueid, ';\n\n list($fields, $from, $where, $params) = $table->base_sql($allowed);\n\n $table->set_count_sql(\"SELECT COUNT(1) FROM $from WHERE $where\", $params);\n\n // Test to see if there are any regraded attempts to be listed.\n $fields .= \", COALESCE((\n SELECT MAX(qqr.regraded)\n FROM {quiz_overview_regrades} qqr\n WHERE qqr.questionusageid = quiza.uniqueid\n ), -1) AS regraded\";\n $table->set_sql($fields, $from, $where, $params);\n\n if (!$table->is_downloading()) {\n // Print information on the grading method.\n if ($strattempthighlight = quiz_report_highlighting_grading_method(\n $quiz, $this->qmsubselect, $options->onlygraded)) {\n echo '<div class=\"quizattemptcounts\">' . $strattempthighlight . '</div>';\n }\n }\n\n // Define table columns.\n $columns = array();\n $headers = array();\n\n if (!$table->is_downloading() && $options->checkboxcolumn) {\n $columns[] = 'checkbox';\n $headers[] = null;\n }\n\n $this->add_user_columns($table, $columns, $headers);\n $this->add_state_column($columns, $headers);\n $this->add_time_columns($columns, $headers);\n\n $this->add_grade_columns($quiz, $options->usercanseegrades, $columns, $headers, false);\n\n foreach ($questions as $slot => $question) {\n // Ignore questions of zero length.\n $columns[] = 'qsgrade' . $slot;\n $header = get_string('qbrief', 'quiz', implode($question->slots, ', '));\n if (!$table->is_downloading()) {\n $header .= '<br />';\n } else {\n $header .= ' ';\n }\n $header .= '/' . $question->name;\n $headers[] = $header;\n }\n\n // Check to see if we need to add columns for the student responses.\n $responsecolumnconfig = get_config('quiz_randomsummary', 'showstudentresponse');\n if (!empty($responsecolumnconfig)) {\n $responsecolumns = array_filter(explode(',', $responsecolumnconfig));\n // Get the question names for these columns to display in the header.\n list($sql, $params) = $DB->get_in_or_equal($responsecolumns, SQL_PARAMS_NAMED);\n $params['quizid'] = $quiz->id;\n\n $responseqs = $DB->get_records_sql(\"\n SELECT slot.slot, q.name\n FROM {question} q\n JOIN {quiz_slots} slot ON slot.questionid = q.id\n WHERE slot.quizid = :quizid AND q.length > 0\n AND slot.slot \".$sql.\" ORDER BY slot.slot\", $params);\n\n foreach ($responseqs as $rq) {\n $columns[] = 'qsresponse'.$rq->slot;\n if (!empty($rq->name)) {\n $headers[] = format_string($rq->name);\n } else {\n $headers[] = '';\n }\n }\n }\n\n $this->set_up_table_columns($table, $columns, $headers, $this->get_base_url(), $options, false);\n $table->set_attribute('class', 'generaltable generalbox grades');\n\n $table->out($options->pagesize, true);\n }\n\n return true;\n }",
"public function run()\n {\n $maxrate = 5;\n \n Question::create([\n 'name' => 'Clarity',\n 'label_left' => 'Low clear', \n 'label_right' => 'Very clear',\n 'max_rate' => $maxrate, \n 'correct_answer' => rand(1,$maxrate),\n ]);\n \n Question::create([\n 'name' => 'Effervenscence',\n 'label_left' => 'Low', \n 'label_right' => 'High',\n 'max_rate' => $maxrate,\n 'correct_answer' => rand(1,$maxrate),\n ]);\n \n Question::create([\n 'name' => 'Fluidity',\n 'label_left' => 'Low', \n 'label_right' => 'High',\n 'max_rate' => $maxrate, \n 'correct_answer' => rand(1,$maxrate),\n ]);\n \n Question::create([\n 'name' => 'Balsamic',\n 'label_left' => 'Low', \n 'label_right' => 'High',\n 'max_rate' => $maxrate, \n 'correct_answer' => rand(1,$maxrate),\n ]);\n \n Question::create([\n 'name' => 'Fruity',\n 'label_left' => 'Low', \n 'label_right' => 'High',\n 'max_rate' => $maxrate, \n 'correct_answer' => rand(1,$maxrate),\n ]);\n \n Question::create([\n 'name' => 'Floral',\n 'label_left' => 'Low', \n 'label_right' => 'High',\n 'max_rate' => $maxrate, \n 'correct_answer' => rand(1,$maxrate),\n ]);\n \n Question::create([\n 'name' => 'Woody',\n 'label_left' => 'Low', \n 'label_right' => 'High',\n 'max_rate' => $maxrate, \n 'correct_answer' => rand(1,$maxrate),\n ]);\n \n Question::create([\n 'name' => 'Spiced',\n 'label_left' => 'Low', \n 'label_right' => 'High',\n 'max_rate' => $maxrate, \n 'correct_answer' => rand(1,$maxrate),\n ]);\n \n Question::create([\n 'name' => 'Sugar content',\n 'label_left' => 'Low', \n 'label_right' => 'High',\n 'max_rate' => $maxrate, \n 'correct_answer' => rand(1,$maxrate),\n ]);\n \n Question::create([\n 'name' => 'Alcohol content',\n 'label_left' => 'Low', \n 'label_right' => 'High',\n 'max_rate' => $maxrate, \n 'correct_answer' => rand(1,$maxrate),\n ]);\n \n Question::create([\n 'name' => 'Texture',\n 'label_left' => 'Low', \n 'label_right' => 'High',\n 'max_rate' => $maxrate, \n 'correct_answer' => rand(1,$maxrate),\n ]);\n \n Question::create([\n 'name' => 'Acidity',\n 'label_left' => 'Low', \n 'label_right' => 'High',\n 'max_rate' => $maxrate, \n 'correct_answer' => rand(1,$maxrate),\n ]);\n \n \n Question::create([\n 'name' => 'Structure',\n 'label_left' => 'Low', \n 'label_right' => 'High',\n 'max_rate' => $maxrate, \n 'correct_answer' => rand(1,$maxrate),\n ]);\n \n \n Question::create([\n 'name' => 'Persistance',\n 'label_left' => 'Low', \n 'label_right' => 'High',\n 'max_rate' => $maxrate, \n 'correct_answer' => rand(1,$maxrate),\n ]);\n \n Question::create([\n 'name' => 'Development',\n 'label_left' => 'Low', \n 'label_right' => 'High',\n 'max_rate' => $maxrate, \n 'correct_answer' => rand(1,$maxrate),\n ]);\n \n Question::create([\n 'name' => 'Yellowness',\n 'label_left' => 'Low', \n 'label_right' => 'High',\n 'max_rate' => $maxrate, \n 'correct_answer' => rand(1,$maxrate),\n ]); \n \n Question::create([\n 'name' => 'Frankness',\n 'label_left' => 'Low', \n 'label_right' => 'High',\n 'max_rate' => $maxrate, \n 'correct_answer' => rand(1,$maxrate),\n ]); \n \n Question::create([\n 'name' => 'Harmony',\n 'label_left' => 'Low', \n 'label_right' => 'High',\n 'max_rate' => $maxrate, \n 'correct_answer' => rand(1,$maxrate),\n ]); \n \n Question::create([\n 'name' => 'Intensity',\n 'label_left' => 'Low', \n 'label_right' => 'High',\n 'max_rate' => $maxrate, \n 'correct_answer' => rand(1,$maxrate),\n ]); \n \n Question::create([\n 'name' => 'Quality',\n 'label_left' => 'Low', \n 'label_right' => 'High',\n 'max_rate' => $maxrate, \n 'correct_answer' => rand(1,$maxrate),\n ]); \n \n Question::create([\n 'name' => 'Intensity of color',\n 'label_left' => 'Low', \n 'label_right' => 'High',\n 'max_rate' => $maxrate, \n 'correct_answer' => rand(1,$maxrate),\n ]); \n \n Question::create([\n 'name' => 'Creemy odour',\n 'label_left' => 'Low', \n 'label_right' => 'High',\n 'max_rate' => $maxrate, \n 'correct_answer' => rand(1,$maxrate),\n ]); \n \n Question::create([\n 'name' => 'Buttery',\n 'label_left' => 'Low', \n 'label_right' => 'High',\n 'max_rate' => $maxrate, \n 'correct_answer' => rand(1,$maxrate),\n ]); \n \n Question::create([\n 'name' => 'Salty',\n 'label_left' => 'Low', \n 'label_right' => 'High',\n 'max_rate' => $maxrate, \n 'correct_answer' => rand(1,$maxrate),\n ]); \n \n Question::create([\n 'name' => 'Acid',\n 'label_left' => 'Low', \n 'label_right' => 'High',\n 'max_rate' => $maxrate, \n 'correct_answer' => rand(1,$maxrate),\n ]); \n \n Question::create([\n 'name' => 'Grainy',\n 'label_left' => 'Low', \n 'label_right' => 'High',\n 'max_rate' => $maxrate, \n 'correct_answer' => rand(1,$maxrate),\n ]); \n \n Question::create([\n 'name' => 'Hardness',\n 'label_left' => 'Low', \n 'label_right' => 'High',\n 'max_rate' => $maxrate, \n 'correct_answer' => rand(1,$maxrate),\n ]); \n \n Question::create([\n 'name' => 'Softness',\n 'label_left' => 'Low', \n 'label_right' => 'High',\n 'max_rate' => $maxrate, \n 'correct_answer' => rand(1,$maxrate),\n ]); \n \n Question::create([\n 'name' => 'Springiness',\n 'label_left' => 'Low', \n 'label_right' => 'High',\n 'max_rate' => $maxrate, \n 'correct_answer' => rand(1,$maxrate),\n ]); \n \n Question::create([\n 'name' => 'Padding',\n 'label_left' => 'Low', \n 'label_right' => 'High',\n 'max_rate' => $maxrate, \n 'correct_answer' => rand(1,$maxrate),\n ]); \n \n Question::create([\n 'name' => 'Lining',\n 'label_left' => 'Low', \n 'label_right' => 'High',\n 'max_rate' => $maxrate, \n 'correct_answer' => rand(1,$maxrate),\n ]); \n \n Question::create([\n 'name' => 'Wear',\n 'label_left' => 'Low', \n 'label_right' => 'High',\n 'max_rate' => $maxrate, \n 'correct_answer' => rand(1,$maxrate),\n ]); \n \n Question::create([\n 'name' => 'Melody',\n 'label_left' => 'Low', \n 'label_right' => 'High',\n 'max_rate' => $maxrate, \n 'correct_answer' => rand(1,$maxrate),\n ]); \n \n Question::create([\n 'name' => 'Harmony',\n 'label_left' => 'Low', \n 'label_right' => 'High',\n 'max_rate' => $maxrate, \n 'correct_answer' => rand(1,$maxrate),\n ]); \n \n Question::create([\n 'name' => 'Rhythm',\n 'label_left' => 'Low', \n 'label_right' => 'High',\n 'max_rate' => $maxrate, \n 'correct_answer' => rand(1,$maxrate),\n ]); \n \n Question::create([\n 'name' => 'Stamp',\n 'label_left' => 'Low', \n 'label_right' => 'High',\n 'max_rate' => $maxrate, \n 'correct_answer' => rand(1,$maxrate),\n ]); \n }",
"public function test_for_quiz_question()\n {\n $this->withOutExceptionHandling();\n\n $user = $this->actingAs(User::factory()->make());\n\n $session = QuizSession::factory()->create();\n $schedule = ClassSchedule::factory()->create();\n\n $response = $this->post('api/v1/quiz/question',\n array_merge($this->data(), [\n 'quiz_session_id' => $session->id,\n 'class_schedule_id' => $schedule->id,\n ]\n )\n );\n\n $response->assertStatus(200);\n }",
"public function takeAll(){\n if(isset($_POST['submit'])){\n $post = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);\n // var_dump($post);\n // Messages::setMsg('Answer is submitted', 'success');\n // Check if the answer is correct\n // echo 'session data:';\n\n // Put the submitted chosen answers into an array\n $choices = array();\n // Check the number of questions\n $num_q = count($_SESSION['quiz_data']);\n // Add the choices into an array\n for($i = 0; $i < $num_q; $i++){\n $choices[] = intval($post[\"choice{$i}\"]);\n }\n echo 'CHOICES';\n var_dump($choices);\n echo 'NUMBER OF QUESTIONS IS: ';\n echo $num_q;\n\n // Loop through the answers and count the correct answers\n $score = 0;\n $question = 0;\n foreach($choices as $choice){\n // $indexed_array = array_values($_SESSION['quiz_data']);\n $is_answer = array_values($_SESSION['quiz_data']) [$question][$choice]['is_answer'];\n if($is_answer == 1){\n $score++;\n $question++;\n }\n }\n Messages::setMsg(\"You scored {$score} out of {$num_q}\", 'success');\n return;\n } else {\n // !!! Need to modified, question.user_id does not exist amy more\n $this->query('SELECT questions.content, options.content, options.is_answer FROM questions JOIN users ON questions.user_id = users.id JOIN options ON options.question_id = questions.id WHERE users.id = :user_id');\n // Bind the user_id to the current user id\n $userId = $_SESSION['user_data']['id'];\n $this->bind(':user_id', $userId);\n $rows = $this->resultSetGroup();\n // echo '<pre>';\n // print_r($rows);\n // echo '</pre>';\n // var_dump($rows);\n // print_r($rows);\n // Store $row in session to check the answer once it is submitted\n if($rows){\n $_SESSION['quiz_data'] = $rows;\n } else {\n Messages::setMsg('No quizzes yet', 'error');\n }\n return $rows;\n }\n }",
"public function generateWrongOptions($quiz_id,$question_id=-1){\n\n //for all questions-wrong options with limit\n// SELECT quiz_id, question_id, question, answer_id,answer FROM (SELECT quiz_question.quiz_id, quiz_question.question_id, question.question, answer_id,answer ,@rn := IF(@prev = quiz_question.question_id, @rn + 1, 1) as rn, @prev := quiz_question.question_id FROM quiz INNER JOIN quiz_question ON quiz.quiz_id = quiz_question.quiz_id AND quiz.deleted = 0 AND quiz.quiz_id = 1 INNER JOIN question ON quiz_question.question_id = question.question_id INNER JOIN (SELECT * FROM answer WHERE answer.answer_id NOT IN (SELECT answer_id FROM correct_question_answer) ORDER BY RAND()) as answers ON answers.question_id = quiz_question.question_id JOIN (SELECT @prev := NULL, @rn := 0) AS vars) as final WHERE rn <= 3\n\n\n\n //it means u have to generate wrong options for all questions with limit of NoOfWrongOptionsWithMostFrequency\n if($question_id==-1){\n $resultSet = $this->getNoOfWrongOptionsWithMostFrequency($quiz_id);\n $noOfWrongOptions = ($resultSet->fetchAll());\n//print_r($ans);\n $this->noOfWrongOption = $noOfWrongOptions[0]->no_of_wrong;\n// return Connection::connectToDB()->query(\"SELECT quiz_id, question_id, question, answer_id,answer FROM (SELECT quiz_question.quiz_id, quiz_question.question_id, question.question, answer_id,answer ,@rn := IF(@prev = quiz_question.question_id, @rn + 1, 1) as rn, @prev := quiz_question.question_id FROM quiz INNER JOIN quiz_question ON quiz.quiz_id = quiz_question.quiz_id AND quiz.deleted = 0 AND quiz.quiz_id = $quiz_id and question_id INNER JOIN question ON quiz_question.question_id = question.question_id INNER JOIN (SELECT * FROM answer WHERE answer.answer_id NOT IN (SELECT answer_id FROM correct_question_answer) ORDER BY RAND()) as answers ON answers.question_id = quiz_question.question_id JOIN (SELECT @prev := NULL, @rn := 0) AS vars) as final WHERE rn <= $this->noOfWrongOption\");\n\n return Connection::connectToDB()->query(\"SELECT quiz_id, question_id, question, answer_id,answer FROM (SELECT quiz_question.quiz_id, quiz_question.question_id, question.question, answer_id,answer ,@rn := IF(@prev = quiz_question.question_id, @rn + 1, 1) as rn, @prev := quiz_question.question_id FROM quiz INNER JOIN quiz_question ON quiz.quiz_id = quiz_question.quiz_id AND quiz.deleted = 0 AND quiz.quiz_id = $quiz_id and question_id not in (SELECT question_id FROM (SELECT a.question_id,a.no_of_options,b.no_of_correct,a.no_of_options-b.no_of_correct as no_of_wrong FROM (SELECT no_of_options,question_id FROM quiz_question WHERE quiz_id=$quiz_id GROUP by question_id) as a LEFT OUTER JOIN (SELECT COUNT(*) as no_of_correct,question_id FROM correct_question_answer GROUP by question_id) as b on a.question_id=b.question_id) as t WHERE no_of_wrong!=$this->noOfWrongOption) INNER JOIN question ON quiz_question.question_id = question.question_id INNER JOIN (SELECT * FROM answer WHERE answer.answer_id NOT IN (SELECT answer_id FROM correct_question_answer) ORDER BY RAND()) as answers ON answers.question_id = quiz_question.question_id JOIN (SELECT @prev := NULL, @rn := 0) AS vars) as final WHERE rn <=$this->noOfWrongOption\");\n }\n\n //else u have to generate wrong option for particular question\n $resultSet = $this->getNoOfWrongOptions($quiz_id,$question_id);\n $noOfWrongOptions = ($resultSet->fetchAll());\n//print_r($ans);\n $noOfWrongOption = $noOfWrongOptions[0]->noOfWrongOption;\n return Connection::connectToDB()->query(\"SELECT\n quiz_question.quiz_id,quiz_question.question_id,question,answer.answer_id,answer\nFROM\n answer\nJOIN quiz_question ON quiz_question.question_id = answer.question_id\nJOIN question ON quiz_question.question_id = question.question_id\nWHERE\n quiz_question.quiz_id =$quiz_id AND quiz_question.question_id=$question_id AND answer.answer_id NOT IN(\n SELECT\n answer_id\n FROM\n correct_question_answer\n JOIN quiz_question ON quiz_question.question_id = correct_question_answer.question_id\n WHERE\n quiz_id = $quiz_id\n GROUP BY\n quiz_question.question_id\n\n) ORDER BY RAND() LIMIT $noOfWrongOption\");\n }",
"function exam_take_form($form, &$form_state, $pExamID, $pQNO=0){\n \n $vCurrentQuestionNumber = 0; // This should be properly defined later\n \n //Prepare this function for iterative use\n // - ensure the $vExamInstance is only created the first time\n // - pass back into this function a value for the question number\n // - capture student answers\n //print 'exam = ' . $pExamID;\n //\n // $_SESSION['exam']['pExamInitialize'] = 1: Initiate a session for a new exam\n // $_SESSION['exam']['pExamContinuation'] = 2: Initiate a session for an existing exam\n // \n // Capture SESSION variables, if they exist. This is not necessary,\n // but if we wait and try to reference the session variables later,\n // we have to first check if the variable exists (isset), and \n // that's so annoying. It detracts from the code's readability.\n if (isset($_SESSION['exam']['pExamInitialize'])) { \n $pExamInitialize = $_SESSION['exam']['pExamInitialize'];\n // Unset the session variable pExamInitiative so that the exam \n // is not initialized again unless a new exam is launched. \n unset($_SESSION['exam']['pExamInitialize']);\n } else {\n $pExamInitialize = 0;\n }\n \n if ($pExamInitialize == '1') {\n // Initialize the page advance controls\n exam_take_page_advance_init();\n // Initialize the exam - create an exam instance in the database\n // and generate a new exam_instance_id. Capture the exam_instance_id \n // in a variable, we'll need this.\n $vExamInstanceID = ExamInstance::populateInstanceTables($pExamID); \n $_SESSION['exam']['pExamInstanceID'] = $vExamInstanceID;\n } else {\n // Obtain the already-established exam_instance_id\n $vExamInstanceID = $_SESSION['exam']['pExamInstanceID'];\n }\n \n ExamInstance::storeMessage('$vExamInstanceID = ' . $vExamInstanceID, 'exam_take_form');\n \n // SKERE777 add logic for what happens with bogus incoming values for pExamInstanceID\n \n // Get basic exam data\n $vExamInfo = ExamInstance::getInfoForExamInstanceID($vExamInstanceID);\n\n //\n // Confirm that the incoming request is asking for a valid question number\n // pQNO is \"Parameter for a Question Number\". All incoming parameters should\n // start with a \"p\". But that may not be fully enforced yet.\n //\n if (($pQNO > 0) and ($pQNO <= $vExamInfo['totalQuestions'])) { \n $vCurrentQuestionNumber = $pQNO;\n $_SESSION['exam']['pCurrentQuestionNumber'] = $vCurrentQuestionNumber;\n } else {\n // \n // SKERE - WORK ON THIS\n // Display an error message warning that the \n // incoming request is for a non-existent question number\n ExamInstance::storeMessage('ERROR: Invalid question number ' . $pQNO . ' ***', 'exam_take_form');\n $form['pQuestionNumber'] = array(\n '#markup' => t('Invalid question number ' . $pQNO \n . ' of ' \n . $vExamInfo['totalQuestions'] . '</h2></p>')\n ); \n return $form;\n }\n \n // Get the array of answers for the current question\n $vTheQuestion = ExamInstance::getOneQuestion($vExamInstanceID, $vCurrentQuestionNumber);\n ExamInstance::storeMessage('$vTheQuestion - text is \"' . $vTheQuestion['question_text'] . '\"', 'exam_take_form');\n $vTheAnswers = ExamInstance::getOneQuestionsAnswers($vExamInstanceID, $vCurrentQuestionNumber);\n $vNumberOfAnswers = count($vTheAnswers)-1; // Account for the first initialized blank row. Looping starts at 0 and needs to iterate four times, so 0, 1, 2, 3. Three is the end.\n \n ExamInstance::storeMessage('$vNumberOfAnswers = ' . $vNumberOfAnswers, 'exam_take_form');\n \n $form['pQuestionNumber'] = array(\n '#markup' => t('<p><h2>Question #' \n . $vCurrentQuestionNumber . ' of ' \n . $vExamInfo['totalQuestions'] . '</h2></p>')\n );\n \n $form['pMark'] = array(\n '#type' => 'checkbox',\n '#title' => t('Mark'),\n '#default_value' => $vTheQuestion['marked'] // Skere - check this\n );\n \n // Create and initialize a counter \n // to support the creation of \n // an array of answers for the current question\n // to be used in the form['pAnswer'] object \n $vCounter = 1;\n while ($vCounter <= $vNumberOfAnswers) {\n // Extract the answer_instance_id value\n //$vAnswerInstanceID = $vTheAnswers[$vCounter]['answer_instance_id'];\n // Build the answer string to be displayed \n $vAnswerString = '<b>' . $vTheAnswers[$vCounter]['answer_letter'] . '</b>: ' .\n $vTheAnswers[$vCounter]['answer_text'];\n // Combine the answer letter and the string and build the array\n // REPLACE THIS WITH THE NEXT LINE: $vAnswerArray[$vAnswerInstanceID] = $vAnswerString;\n $vAnswerArray[$vCounter] = $vAnswerString;\n $vCounter++;\n }\n\n // Very important - run the question_text through the Drupal filter to ensure\n // that any uses of the \"img\" tag have proper URLS. \n ExamInstance::storeMessage('$vTheQuestion[\\'question_text\\']=' . $vTheQuestion['question_text'], 'exam_take_form');\n ExamInstance::storeMessage('Just before call to filter', 'exam_take_form');\n $vTheQuestion['question_text'] = filter_for_URL($vTheQuestion['question_text']);\n ExamInstance::storeMessage('Just after call to filter', 'exam_take_form'); \n // End of the filtering of the question text\n \n // The set of answers is treated as a single form object. \n // It includes the question - see the \"title\" property.\n // Note that the value stored for answers selected is the answer_instance_id\n \n $vDefaultValue = $vTheQuestion['selected_answer_number']; // SKERE - check this\n ExamInstance::storeMessage('$vDefaultValue = ' . $vDefaultValue . '.', 'exam_take_form');\n \n $form['pAnswer'] = array(\n '#type' => 'radios',\n '#options' => $vAnswerArray,\n '#title' => t($vTheQuestion['question_text']),\n '#default_value' => $vDefaultValue \n );\n \n //print '** The big answer is: ' . $vExamInstance->ei_qa[$vCurrentQuestionNumber]['selected_answer_instance_id'] . ' ** ';\n \n $form['actions'] = array('#type' => 'actions');\n if ($vCurrentQuestionNumber <> 1) {\n $form['actions']['pButtonPrevious'] = array(\n '#type' => 'submit',\n '#value' => t('Previous Question'),\n '#name' => 'Previous',\n '#prefix' => '<div id=\"buttonGroup\" class=\"demo\">',\n '#suffix' => '</div',\n '#submit' => array('exam_capture_data'\n , 'exam_take_form_submit_previous'\n , 'exam_take_form_submit'\n )\n );\n }\n\n if ($vCurrentQuestionNumber <> $vExamInfo['totalQuestions']) {\n $form['actions']['pButtonNext'] = array(\n '#type' => 'submit',\n '#value' => t('Next Question'),\n '#name' => 'Next',\n '#prefix' => '<div id=\"buttonGroup\" class=\"demo\">',\n '#suffix' => '</div',\n '#submit' => array('exam_capture_data'\n , 'exam_take_form_submit_next'\n , 'exam_take_form_submit'\n )\n );\n }\n\n $form['actions']['pButtonSummary'] = array(\n '#type' => 'submit',\n '#value' => t('Show Summary'),\n '#name' => 'Summary',\n '#prefix' => '<div id=\"buttonGroup\" class=\"demo\">',\n '#suffix' => '</div', \n '#submit' => array('exam_take_form_submit_summary')\n );\n \n //Do we need these? Haven't tried them yet\n //$form['#validate'][] = 'exam_take_form_validate';\n //field_attach_form('exam', $exam, $form, $form_state);\n\n // Specify the function to handle form submission\n //$form['#submit'][] = 'exam_take_form_submit';\n \n return $form;\n \n}",
"function AddTesteeQuestions($testEntryID, $examQAs)\n {\n try\n {\n if (count($examQAs) < 1)\n {\n return;\n }\n \n $db = GetDBConnection();\n \n $qCount = 1;\n $questions = array();\n foreach ($examQAs as $qa)\n {\n $questionID = $qa->GetQuestionId();\n $question = GetQuestion($questionID);\n \n if ($question != FALSE)\n {\n $aCount = 1;\n $answers = GetQuestionAnswers($questionID);\n \n for ($i = 0; $i < count($answers); $i++)\n {\n $chosen = '0';\n $answer = $answers[$i];\n $answer['AnswerNo'] = $aCount;\n \n if ($answer[GetAnswerIdIdentifier()] == $qa->GetAnswerId())\n {\n $chosen = '1';\n }\n \n $answer['Chosen'] = $chosen;\n \n $answers[$i] = $answer;\n \n $aCount++;\n }\n \n $question['QuestionNo'] = $qCount;\n $question['Answers'] = $answers;\n \n $questions[] = $question;\n \n $qCount++;\n }\n }\n \n $qQuery = 'INSERT INTO ' . GetTesteeQuestionsIdentifier()\n . ' (' . GetTestIdIdentifier()\n . ', ' . 'QuestionNo'\n . ', ' . 'Level'\n . ', ' . 'Instructions'\n . ', ' . 'Question' . ') VALUES';\n \n $aQuery = 'INSERT INTO ' . GetTesteeAnswersIdentifier()\n . ' (' . GetTestIdIdentifier()\n . ', ' . 'QuestionNo'\n . ', ' . 'AnswerNo'\n . ', ' . 'Answer'\n . ', ' . 'Correct'\n . ', ' . 'Chosen' . ') VALUES';\n \n foreach($questions as $question)\n {\n $answers = $question['Answers'];\n $questionNo = $question['QuestionNo'];\n \n $qQuery .= ' (:' . GetTestIdIdentifier()\n . ', :' . 'QuestionNo' . $questionNo\n . ', :' . 'Level' . $questionNo\n . ', :' . 'Instructions' . $questionNo\n . ', :' . 'Question' . $questionNo . '),';\n \n foreach($answers as $answer)\n {\n $answerNo = $answer['AnswerNo'];\n \n $aQuery .= ' (:' . GetTestIdIdentifier()\n . ', :' . 'QuestionNo' . $questionNo . $answerNo\n . ', :' . 'AnswerNo' . $questionNo . $answerNo\n . ', :' . 'Answer' . $questionNo . $answerNo\n . ', :' . 'Correct' . $questionNo . $answerNo\n . ', :' . 'Chosen' . $questionNo . $answerNo . '),';\n }\n }\n \n $qQuery = rtrim($qQuery, ',') . ';';\n $aQuery = rtrim($aQuery, ',') . ';';\n \n $qStatement = $db->prepare($qQuery);\n $aStatement = $db->prepare($aQuery);\n \n foreach($questions as $question)\n {\n $answers = $question['Answers'];\n $questionNo = $question['QuestionNo'];\n \n foreach($answers as $answer)\n {\n $answerNo = $answer['AnswerNo'];\n \n $aStatement->bindValue(':' . GetTestIdIdentifier(), $testEntryID);\n $aStatement->bindValue(':' . 'QuestionNo' . $questionNo . $answerNo, $questionNo);\n $aStatement->bindValue(':' . 'AnswerNo' . $questionNo . $answerNo, $answerNo);\n $aStatement->bindValue(':' . 'Answer' . $questionNo . $answerNo, $answer[GetNameIdentifier()]);\n $aStatement->bindValue(':' . 'Chosen' . $questionNo . $answerNo, $answer['Chosen']);\n $aStatement->bindValue(':' . 'Correct' . $questionNo . $answerNo, $answer['Correct']);\n }\n \n $qStatement->bindValue(':' . GetTestIdIdentifier(), $testEntryID);\n $qStatement->bindValue(':' . 'QuestionNo' . $questionNo, $questionNo);\n $qStatement->bindValue(':' . 'Level' . $questionNo, $question['Level']);\n $qStatement->bindValue(':' . 'Instructions' . $questionNo, $question['Instructions']);\n $qStatement->bindValue(':' . 'Question' . $questionNo, $question[GetNameIdentifier()]);\n }\n \n $qStatement->execute();\n $qStatement->closeCursor();\n \n $aStatement->execute();\n $aStatement->closeCursor();\n }\n catch (PDOException $ex)\n {\n LogError($ex);\n }\n }",
"public function run()\n {\n $class = Quiz::create([\n \t'class_schedule_id' => 1,\n \t'question' => '1 Gives you the chance to learn programming',\n \t'attempts' => 2,\n ]);\n\n $class = Quiz::create([\n \t'class_schedule_id' => 1,\n \t'question' => '2 Gives you the chance to learn programming',\n \t'attempts' => 2,\n ]);\n\n $class = Quiz::create([\n \t'class_schedule_id' => 1,\n \t'question' => '3 Gives you the chance to learn programming',\n \t'attempts' => 2,\n ]);\n\n $class = Quiz::create([\n \t'class_schedule_id' => 1,\n \t'question' => '4 Gives you the chance to learn programming',\n \t'attempts' => 2,\n ]);\n\n $class = Quiz::create([\n \t'class_schedule_id' => 1,\n \t'question' => '5 Gives you the chance to learn programming',\n \t'attempts' => 2,\n ]);\n\n\n\n\n $class = Quiz::create([\n 'class_schedule_id' => 2,\n 'question' => '1 Gives you the chance to learn programming',\n 'attempts' => 2,\n ]);\n\n $class = Quiz::create([\n 'class_schedule_id' => 2,\n 'question' => '2 Gives you the chance to learn programming',\n 'attempts' => 2,\n ]);\n\n $class = Quiz::create([\n 'class_schedule_id' => 2,\n 'question' => '3 Gives you the chance to learn programming',\n 'attempts' => 2,\n ]);\n\n $class = Quiz::create([\n 'class_schedule_id' => 2,\n 'question' => '4 Gives you the chance to learn programming',\n 'attempts' => 2,\n ]);\n\n $class = Quiz::create([\n 'class_schedule_id' => 2,\n 'question' => '5 Gives you the chance to learn programming',\n 'attempts' => 2,\n ]);\n\n\n\n $class = Quiz::create([\n 'class_schedule_id' => 3,\n 'question' => '1 Gives you the chance to learn programming',\n 'attempts' => 2,\n ]);\n\n $class = Quiz::create([\n 'class_schedule_id' => 3,\n 'question' => '2 Gives you the chance to learn programming',\n 'attempts' => 2,\n ]);\n\n $class = Quiz::create([\n 'class_schedule_id' => 3,\n 'question' => '3 Gives you the chance to learn programming',\n 'attempts' => 2,\n ]);\n\n $class = Quiz::create([\n 'class_schedule_id' => 3,\n 'question' => '4 Gives you the chance to learn programming',\n 'attempts' => 2,\n ]);\n\n $class = Quiz::create([\n 'class_schedule_id' => 3,\n 'question' => '5 Gives you the chance to learn programming',\n 'attempts' => 2,\n ]);\n }",
"public function test_get_attempt_data_with_blocked_questions() {\n global $DB;\n\n // Create a new quiz with one attempt started and using immediatefeedback.\n list($quiz, $context, $quizobj, $attempt, $attemptobj) = $this->create_quiz_with_questions(\n true, false, 'immediatefeedback');\n\n $quizobj = $attemptobj->get_quizobj();\n\n // Make second question blocked by the first one.\n $structure = $quizobj->get_structure();\n $slots = $structure->get_slots();\n $structure->update_question_dependency(end($slots)->id, true);\n\n $quizobj->preload_questions();\n $quizobj->load_questions();\n $questions = $quizobj->get_questions();\n\n $this->setUser($this->student);\n\n // We receive one question per page.\n $result = mod_quiz_external::get_attempt_data($attempt->id, 0);\n $result = external_api::clean_returnvalue(mod_quiz_external::get_attempt_data_returns(), $result);\n\n $this->assertEquals($attempt, (object) $result['attempt']);\n $this->assertCount(1, $result['questions']);\n $this->assertEquals(1, $result['questions'][0]['slot']);\n $this->assertEquals(1, $result['questions'][0]['number']);\n $this->assertEquals(false, $result['questions'][0]['blockedbyprevious']);\n\n // Now try the last page.\n $result = mod_quiz_external::get_attempt_data($attempt->id, 1);\n $result = external_api::clean_returnvalue(mod_quiz_external::get_attempt_data_returns(), $result);\n\n $this->assertEquals($attempt, (object) $result['attempt']);\n $this->assertCount(1, $result['questions']);\n $this->assertEquals(2, $result['questions'][0]['slot']);\n $this->assertEquals(2, $result['questions'][0]['number']);\n $this->assertEquals(true, $result['questions'][0]['blockedbyprevious']);\n }",
"function set_up_question($question_ID)\r\n{\r\n\tglobal $mydb, $question, $answers, $correct_answer, $is_question, $is_random_question;\r\n\t\r\n\t// set the is question global variable\r\n\t$is_question = true;\r\n\r\n\tif (($question_ID == \"random\") || !$question_ID)\r\n\t{\r\n\t\t$is_random_question = true;\r\n\t\t$question = get_question_random();\r\n\t}\r\n\telse\r\n\t{\r\n\t\t$is_random_question = false;\r\n\t\t$question = get_question_from_ID($question_ID);\r\n\r\n\t}\r\n\t\r\n\t// get random answers\r\n\t$answers = $question->get_Answers();\r\n\t\r\n\t// get the correct answer and remember it\r\n\tforeach ($answers as $answer)\r\n\t{\r\n\t\tif ($answer->is_correct())\r\n\t\t{\r\n\t\t\t$correct_answer = $answer;\r\n\t\t}\r\n\t}\r\n}"
] |
[
"0.7495671",
"0.63325435",
"0.61733365",
"0.6148252",
"0.61098903",
"0.6068342",
"0.60463625",
"0.59748024",
"0.5973014",
"0.59567016",
"0.5895462",
"0.58555186",
"0.58377725",
"0.5822629",
"0.5807805",
"0.5736343",
"0.57085407",
"0.5646675",
"0.5627417",
"0.56231403",
"0.5605447",
"0.55841017",
"0.55723125",
"0.55719095",
"0.5553493",
"0.5547621",
"0.5547103",
"0.55446327",
"0.5533964",
"0.5532837"
] |
0.83981144
|
0
|
Create a quizp with a single question with variants and walk through quizp attempts.
|
public function test_quizp_with_question_with_variants_attempt_walkthrough($variantno, $correctresponse, $done = false) {
global $SITE;
$this->resetAfterTest($done);
$this->setAdminUser();
if ($this->quizpwithvariants === null) {
// Make a quizp.
$quizpgenerator = $this->getDataGenerator()->get_plugin_generator('mod_quizp');
$this->quizpwithvariants = $quizpgenerator->create_instance(array('course'=>$SITE->id,
'questionsperpage' => 0,
'grade' => 100.0,
'sumgrades' => 1));
$questiongenerator = $this->getDataGenerator()->get_plugin_generator('core_question');
$cat = $questiongenerator->create_question_category();
$calc = $questiongenerator->create_question('calculatedsimple', 'sumwithvariants', array('category' => $cat->id));
quizp_add_quizp_question($calc->id, $this->quizpwithvariants, 0);
}
// Make a new user to do the quizp.
$user1 = $this->getDataGenerator()->create_user();
$this->setUser($user1);
$quizpobj = quizp::create($this->quizpwithvariants->id, $user1->id);
// Start the attempt.
$quba = question_engine::make_questions_usage_by_activity('mod_quizp', $quizpobj->get_context());
$quba->set_preferred_behaviour($quizpobj->get_quizp()->preferredbehaviour);
$timenow = time();
$attempt = quizp_create_attempt($quizpobj, 1, false, $timenow);
// Select variant.
quizp_start_new_attempt($quizpobj, $quba, $attempt, 1, $timenow, array(), array(1 => $variantno));
$this->assertEquals('1,0', $attempt->layout);
quizp_attempt_save_started($quizpobj, $quba, $attempt);
// Process some responses from the student.
$attemptobj = quizp_attempt::create($attempt->id);
$this->assertFalse($attemptobj->has_response_to_at_least_one_graded_question());
$tosubmit = array(1 => array('answer' => $correctresponse));
$attemptobj->process_submitted_actions($timenow, false, $tosubmit);
// Finish the attempt.
$attemptobj = quizp_attempt::create($attempt->id);
$this->assertTrue($attemptobj->has_response_to_at_least_one_graded_question());
$attemptobj->process_finish($timenow, false);
// Re-load quizp attempt data.
$attemptobj = quizp_attempt::create($attempt->id);
// Check that results are stored as expected.
$this->assertEquals(1, $attemptobj->get_attempt_number());
$this->assertEquals(1, $attemptobj->get_sum_marks());
$this->assertEquals(true, $attemptobj->is_finished());
$this->assertEquals($timenow, $attemptobj->get_submitted_date());
$this->assertEquals($user1->id, $attemptobj->get_userid());
$this->assertTrue($attemptobj->has_response_to_at_least_one_graded_question());
// Check quizp grades.
$grades = quizp_get_user_grades($this->quizpwithvariants, $user1->id);
$grade = array_shift($grades);
$this->assertEquals(100.0, $grade->rawgrade);
// Check grade book.
$gradebookgrades = grade_get_grades($SITE->id, 'mod', 'quizp', $this->quizpwithvariants->id, $user1->id);
$gradebookitem = array_shift($gradebookgrades->items);
$gradebookgrade = array_shift($gradebookitem->grades);
$this->assertEquals(100, $gradebookgrade->grade);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function test_quizp_with_random_question_attempt_walkthrough() {\n global $SITE;\n\n $this->resetAfterTest(true);\n question_bank::get_qtype('random')->clear_caches_before_testing();\n\n $this->setAdminUser();\n\n // Make a quizp.\n $quizpgenerator = $this->getDataGenerator()->get_plugin_generator('mod_quizp');\n\n $quizp = $quizpgenerator->create_instance(array('course' => $SITE->id, 'questionsperpage' => 2, 'grade' => 100.0,\n 'sumgrades' => 4));\n\n $questiongenerator = $this->getDataGenerator()->get_plugin_generator('core_question');\n\n // Add two questions to question category.\n $cat = $questiongenerator->create_question_category();\n $saq = $questiongenerator->create_question('shortanswer', null, array('category' => $cat->id));\n $numq = $questiongenerator->create_question('numerical', null, array('category' => $cat->id));\n\n // Add random question to the quizp.\n quizp_add_random_questions($quizp, 0, $cat->id, 1, false);\n\n // Make another category.\n $cat2 = $questiongenerator->create_question_category();\n $match = $questiongenerator->create_question('match', null, array('category' => $cat->id));\n\n quizp_add_quizp_question($match->id, $quizp, 0);\n\n $multichoicemulti = $questiongenerator->create_question('multichoice', 'two_of_four', array('category' => $cat->id));\n\n quizp_add_quizp_question($multichoicemulti->id, $quizp, 0);\n\n $multichoicesingle = $questiongenerator->create_question('multichoice', 'one_of_four', array('category' => $cat->id));\n\n quizp_add_quizp_question($multichoicesingle->id, $quizp, 0);\n\n foreach (array($saq->id => 'frog', $numq->id => '3.14') as $randomqidtoselect => $randqanswer) {\n // Make a new user to do the quizp each loop.\n $user1 = $this->getDataGenerator()->create_user();\n $this->setUser($user1);\n\n $quizpobj = quizp::create($quizp->id, $user1->id);\n\n // Start the attempt.\n $quba = question_engine::make_questions_usage_by_activity('mod_quizp', $quizpobj->get_context());\n $quba->set_preferred_behaviour($quizpobj->get_quizp()->preferredbehaviour);\n\n $timenow = time();\n $attempt = quizp_create_attempt($quizpobj, 1, false, $timenow);\n\n quizp_start_new_attempt($quizpobj, $quba, $attempt, 1, $timenow, array(1 => $randomqidtoselect));\n $this->assertEquals('1,2,0,3,4,0', $attempt->layout);\n\n quizp_attempt_save_started($quizpobj, $quba, $attempt);\n\n // Process some responses from the student.\n $attemptobj = quizp_attempt::create($attempt->id);\n $this->assertFalse($attemptobj->has_response_to_at_least_one_graded_question());\n\n $tosubmit = array();\n $selectedquestionid = $quba->get_question_attempt(1)->get_question()->id;\n $tosubmit[1] = array('answer' => $randqanswer);\n $tosubmit[2] = array(\n 'frog' => 'amphibian',\n 'cat' => 'mammal',\n 'newt' => 'amphibian');\n $tosubmit[3] = array('One' => '1', 'Two' => '0', 'Three' => '1', 'Four' => '0'); // First and third choice.\n $tosubmit[4] = array('answer' => 'One'); // The first choice.\n\n $attemptobj->process_submitted_actions($timenow, false, $tosubmit);\n\n // Finish the attempt.\n $attemptobj = quizp_attempt::create($attempt->id);\n $this->assertTrue($attemptobj->has_response_to_at_least_one_graded_question());\n $attemptobj->process_finish($timenow, false);\n\n // Re-load quizp attempt data.\n $attemptobj = quizp_attempt::create($attempt->id);\n\n // Check that results are stored as expected.\n $this->assertEquals(1, $attemptobj->get_attempt_number());\n $this->assertEquals(4, $attemptobj->get_sum_marks());\n $this->assertEquals(true, $attemptobj->is_finished());\n $this->assertEquals($timenow, $attemptobj->get_submitted_date());\n $this->assertEquals($user1->id, $attemptobj->get_userid());\n $this->assertTrue($attemptobj->has_response_to_at_least_one_graded_question());\n\n // Check quizp grades.\n $grades = quizp_get_user_grades($quizp, $user1->id);\n $grade = array_shift($grades);\n $this->assertEquals(100.0, $grade->rawgrade);\n\n // Check grade book.\n $gradebookgrades = grade_get_grades($SITE->id, 'mod', 'quizp', $quizp->id, $user1->id);\n $gradebookitem = array_shift($gradebookgrades->items);\n $gradebookgrade = array_shift($gradebookitem->grades);\n $this->assertEquals(100, $gradebookgrade->grade);\n }\n }",
"public function test_quizp_attempt_walkthrough() {\n global $SITE;\n\n $this->resetAfterTest(true);\n\n // Make a quizp.\n $quizpgenerator = $this->getDataGenerator()->get_plugin_generator('mod_quizp');\n\n $quizp = $quizpgenerator->create_instance(array('course'=>$SITE->id, 'questionsperpage' => 0, 'grade' => 100.0,\n 'sumgrades' => 2));\n\n // Create a couple of questions.\n $questiongenerator = $this->getDataGenerator()->get_plugin_generator('core_question');\n\n $cat = $questiongenerator->create_question_category();\n $saq = $questiongenerator->create_question('shortanswer', null, array('category' => $cat->id));\n $numq = $questiongenerator->create_question('numerical', null, array('category' => $cat->id));\n\n // Add them to the quizp.\n quizp_add_quizp_question($saq->id, $quizp);\n quizp_add_quizp_question($numq->id, $quizp);\n\n // Make a user to do the quizp.\n $user1 = $this->getDataGenerator()->create_user();\n\n $quizpobj = quizp::create($quizp->id, $user1->id);\n\n // Start the attempt.\n $quba = question_engine::make_questions_usage_by_activity('mod_quizp', $quizpobj->get_context());\n $quba->set_preferred_behaviour($quizpobj->get_quizp()->preferredbehaviour);\n\n $timenow = time();\n $attempt = quizp_create_attempt($quizpobj, 1, false, $timenow, false, $user1->id);\n\n quizp_start_new_attempt($quizpobj, $quba, $attempt, 1, $timenow);\n $this->assertEquals('1,2,0', $attempt->layout);\n\n quizp_attempt_save_started($quizpobj, $quba, $attempt);\n\n // Process some responses from the student.\n $attemptobj = quizp_attempt::create($attempt->id);\n $this->assertFalse($attemptobj->has_response_to_at_least_one_graded_question());\n\n $prefix1 = $quba->get_field_prefix(1);\n $prefix2 = $quba->get_field_prefix(2);\n\n $tosubmit = array(1 => array('answer' => 'frog'),\n 2 => array('answer' => '3.14'));\n\n $attemptobj->process_submitted_actions($timenow, false, $tosubmit);\n\n // Finish the attempt.\n $attemptobj = quizp_attempt::create($attempt->id);\n $this->assertTrue($attemptobj->has_response_to_at_least_one_graded_question());\n $attemptobj->process_finish($timenow, false);\n\n // Re-load quizp attempt data.\n $attemptobj = quizp_attempt::create($attempt->id);\n\n // Check that results are stored as expected.\n $this->assertEquals(1, $attemptobj->get_attempt_number());\n $this->assertEquals(2, $attemptobj->get_sum_marks());\n $this->assertEquals(true, $attemptobj->is_finished());\n $this->assertEquals($timenow, $attemptobj->get_submitted_date());\n $this->assertEquals($user1->id, $attemptobj->get_userid());\n $this->assertTrue($attemptobj->has_response_to_at_least_one_graded_question());\n\n // Check quizp grades.\n $grades = quizp_get_user_grades($quizp, $user1->id);\n $grade = array_shift($grades);\n $this->assertEquals(100.0, $grade->rawgrade);\n\n // Check grade book.\n $gradebookgrades = grade_get_grades($SITE->id, 'mod', 'quizp', $quizp->id, $user1->id);\n $gradebookitem = array_shift($gradebookgrades->items);\n $gradebookgrade = array_shift($gradebookitem->grades);\n $this->assertEquals(100, $gradebookgrade->grade);\n }",
"private function generate_question() {\n\n require_once(__DIR__ . '/csv_gd.class.php');\n $csv_filename = $this->configuration['base_data_dir'] . '/csv/' . $this->configuration['csv_input'];\n\n $data_quiz_src_obj = new csv_gd($csv_filename);\n $data_quiz_src_orig = $data_quiz_src_obj->csv_to_array();\n\n\n\n // filter unwanted question (tags, diff level, void )\n $data_quiz_src_filtered = $this->quiz_filter($data_quiz_src_orig, $this->configuration['tags'], $this->configuration['min_diffucult_level'], $this->configuration['max_diffucult_level']);\n\n\n // reverse question with_answer\n if ($this->configuration['reverse_question'] == TRUE) {\n $data_quiz_src_filtered = $this->quiz_switch_question_with_answer($data_quiz_src_filtered);\n }\n\n\n // generate question and answer\n $data_quiz_src = $this->quiz_generate($data_quiz_src_filtered);\n\n\n // randomize quiz \n if ($this->configuration['randomize_question'] == TRUE) {\n shuffle($data_quiz_src);\n }\n\n\n // restrict the maxium number of question\n if ($this->configuration['max_question_total'] > 0) {\n $this->configuration['max_question_total'] = min(count($data_quiz_src), $this->configuration['max_question_total']);\n } else {\n $this->configuration['max_question_total'] = count($data_quiz_src);\n }\n $this->question = array_slice($data_quiz_src, 0, $this->configuration['max_question_total']);\n\n $this->configuration['debug']=$this->debug;\n\n // return $this->quiz_questions;\n }",
"private function quiz_generate($data_quiz_src) {\n // extract all possible answer\n $all_possible_answer = array();\n foreach ($data_quiz_src as $single_quiz) {\n $all_correct_answer = explode('|', $single_quiz['correct_answer']);\n $all_possible_answer[] = $all_correct_answer[0];\n }\n\n $out = array();\n $index = 0;\n foreach ($data_quiz_src as $single_quiz) {\n shuffle($all_possible_answer);\n\n $single_quiz['all_correct_answer'] = explode('|', $single_quiz['correct_answer']);\n\n $single_quiz['possible_answer'] = array($single_quiz['all_correct_answer'][0]);\n\n $single_quiz['response_type'] = !empty($single_quiz['response_type']) ? $single_quiz['response_type'] : $this->configuration['default_response_type'];\n\n // add wrong answer to $possible_answer from input data\n if (isset($single_quiz[\"wrong_answer\"])) {\n $possible_wrong_answer = explode('|', $single_quiz[\"wrong_answer\"]);\n\n //remove eventually emtpy element\n $single_quiz['possible_answer'] = array_filter($single_quiz['possible_answer']);\n\n\n $single_quiz['possible_answer'] = array_merge($single_quiz['possible_answer'], $possible_wrong_answer);\n }\n\n // add random wrong answer to $possible_answer\n $single_quiz['possible_answer'] = array_merge($single_quiz['possible_answer'], $all_possible_answer);\n\n // eliminate duplicates\n $single_quiz['possible_answer'] = array_unique($single_quiz['possible_answer']);\n\n //remove eventually emtpy element\n $single_quiz['possible_answer'] = array_filter($single_quiz['possible_answer']);\n\n //get only the correct number of elements:\n $single_quiz['response_type'] = strtolower($single_quiz['response_type']);\n $option_array = explode('_', $single_quiz['response_type']);\n if (isset($option_array[1])) {\n $max_option = $option_array[1];\n $single_quiz['response_type'] = $option_array[0];\n } else {\n $max_option = $this->configuration['num_options'];\n }\n\n $single_quiz['possible_answer'] = array_slice($single_quiz['possible_answer'], 0, $max_option);\n\n // shuffle all data:\n shuffle($single_quiz['possible_answer']);\n\n $single_quiz['all_question'] = explode('|', $single_quiz['question']);\n\n // remove all empty values \n $single_quiz['all_question'] = array_filter($single_quiz['all_question']);\n\n shuffle($single_quiz['all_question']);\n\n $single_quiz['question'] = $single_quiz['all_question'][0];\n\n\n // add id of the correct_answer to correct answer if the answer_type is 'options' \n if ($single_quiz['response_type'] == \"options\") {\n $key = array_search($single_quiz['all_correct_answer'][0], $single_quiz['possible_answer']);\n $single_quiz['all_correct_answer'][] = $key;\n }\n\n\n $output_keys = array(\n 'id',\n 'question',\n 'all_correct_answer',\n 'possible_answer',\n 'response_type',\n 'if_correct',\n 'if_wrong'\n );\n\n\n $out[$index] = array();\n foreach ($output_keys as $single_key) {\n\n $out[$index][$single_key] = isset($single_quiz[$single_key]) ? $single_quiz[$single_key] : \"\";\n }\n\n $index ++;\n }\n return $out;\n }",
"private function createAnswers($f, $p) {\n\n // Simulate each qeustion answering\n foreach ($f->questions as $q) {\n if ($q->isAspect()) {\n // If the question is about each aspect, answer like..\n\n // Each aspects has 3 level: normal, high-risk, very-high-risk\n // random to choose between those\n $c = $this->getRandomChoice($q->choices, null, true);\n if ($c->value == 0) {\n // Choose it and continue to next question\n $this->chooseChoice($f, $q, $c, $p);\n\n // next loop\n } else {\n // Choose the choice\n $this->chooseChoice($f, $q, $c, $p);\n $this->chooseRandomSubchoices($f, $q, $c, $p);\n\n // and random again\n // Since high & very-high can be their simultaneously\n $nc = $this->getRandomChoice($q->choices, null, true);\n\n if ($nc->value > 0 && $nc->value != $c->value) {\n // Not the 'normal' and not the same choice, choose it\n $this->chooseChoice($f, $q, $nc, $p);\n $this->chooseRandomSubchoices($f, $q, $nc, $p);\n } else {\n // next loop\n }\n }\n } else if ($q->isAboutTalent()) {\n // If the question is about talent answer like...\n\n // Talent has only 2 choice, random between the two\n $c = $this->getRandomChoice($q->choices, null);\n $a = $this->chooseChoice($f, $q, $c, $p);\n $ci = $c->inputs()->first();\n if ($ci) {\n $this->createRandomTalent($a, $ci, $p);\n }\n\n // next loop\n\n } else if ($q->isAboutDisability()) {\n // If the question is about disability answer like...\n\n // Non uniform random, low rate of having disability\n $probHaveDis = rand(0, 100);\n\n // Only 30% chance that a participant will have disability\n if ($probHaveDis > 70) {\n\n $numDis = $this->randomNumberOfDisabilities();\n\n $choosenChoices = [];\n $numChoice = count($q->choices);\n for ($i=0; $i < $numDis; $i++) { \n $c = $this->getRandomChoice($q->choices, $numChoice);\n \n if (Choice::choiceExistsInAnswers($c, $choosenChoices)) {\n // Allow no duplicates disabilities\n continue;\n } else {\n $a = $this->chooseChoice($f, $q, $c, $p);\n $ci = $c->inputs()->first();\n if ($ci) {\n $this->createRandomDisability($a, $ci);\n }\n }\n\n $choosenChoices[] = $a;\n }\n }\n }\n }\n }",
"public function test_export_multichoice_1() {\n $qdata = new stdClass();\n $qdata->id = 123;\n $qdata->contextid = 0;\n $qdata->qtype = 'multichoice';\n $qdata->name = 'Multiple choice question';\n $qdata->questiontext = 'Questiontext of muliple choice question.';\n $qdata->questiontextformat = FORMAT_HTML;\n $qdata->generalfeedback = 'General feedback';\n $qdata->generalfeedbackformat = FORMAT_HTML;\n $qdata->defaultmark = 23;\n $qdata->length = 1;\n $qdata->penalty = 0.3333333;\n $qdata->hidden = 0;\n \n $qdata->options = new stdClass();\n $qdata->options->single = 0;\n $qdata->options->shuffleanswers = 0;\n $qdata->options->answernumbering = 'abc';\n $qdata->options->correctfeedback = '<p>Your answer is correct.</p>';\n $qdata->options->correctfeedbackformat = FORMAT_HTML;\n $qdata->options->partiallycorrectfeedback = '<p>Your answer is partially correct.</p>';\n $qdata->options->partiallycorrectfeedbackformat = FORMAT_HTML;\n $qdata->options->shownumcorrect = 1;\n $qdata->options->incorrectfeedback = '<p>Your answer is incorrect.</p>';\n $qdata->options->incorrectfeedbackformat = FORMAT_HTML;\n \n $qdata->options->answers = array(\n 13 => new question_answer(13, 'answer 1', 0, '', FORMAT_HTML),\n 14 => new question_answer(14, 'answer 2', 1, '', FORMAT_HTML),\n 15 => new question_answer(15, 'answer 3', 0, '', FORMAT_HTML),\n 16 => new question_answer(16, 'answer 4', 0, '', FORMAT_HTML),\n );\n \n $qdata->hints = array(\n new question_hint_with_parts(0, 'Hint 1.', FORMAT_HTML, false, false),\n new question_hint_with_parts(0, 'Hint 2.', FORMAT_HTML, false, false),\n );\n \n \n // Export the question.\n $exporter = new qformat_smart();\n $questions = array($qdata);\n $zipcontent = $exporter->export_questions($questions);\n \n // Open exported question as import_data.\n $import_data = $this->zip_to_import_data($zipcontent);\n \n /*\n * Test content of imsmanifest.xml\n */\n \n $imsmanifest = $import_data->imsmanifest;\n \n $expected = '<resource identifier=\"group0_pages\" href=\"page0.svg\" type=\"webcontent\" adlcp:scormType=\"asset\"><file href=\"page0.svg\"/></resource>';\n $actual = $imsmanifest->resources->resource[0]->asXML();\n $this->assert_same_xml($expected, $actual);\n \n $expected = '<resource identifier=\"pages\" href=\"page0.svg\" type=\"webcontent\" adlcp:scormType=\"asset\"><file href=\"page0.svg\"/></resource>';\n $actual = $imsmanifest->resources->resource[1]->asXML();\n $this->assert_same_xml($expected, $actual);\n \n /*\n * Test content of page.\n */\n \n // Test number of pages.\n $this->assertCount(1, $import_data->pages);\n \n $page = $import_data->pages[0];\n \n // Test the number of question elements.\n $questions = $page->xpath('//g[@class=\"question\"]');\n $this->assertCount(1, $questions);\n \n // Test the question element.\n $question = $questions[0];\n $expectedvotemetadata = '<votemetadata><questiontext format=\"choice\" labelstyle=\"upper-alpha\" correct=\"2\" points=\"23\" tags=\"\" explanation=\"General feedback\" mathgradingoption=\"\" likert=\"false\"/></votemetadata>';\n $votemetadata = $question->votemetadata->asXML();\n $this->assert_same_xml($expectedvotemetadata, $votemetadata);\n \n // Test the question number.\n $expectedquestionnumber = '1';\n $questionnumber = strip_tags($question->text[0]->asXML());\n $this->assertEquals($expectedquestionnumber, $questionnumber);\n \n // Test the question text without formattings.\n $expectedquestiontext = 'Questiontext of muliple choice question.';\n $questiontext = strip_tags($question->text[1]->asXML());\n $this->assertEquals($expectedquestiontext, $questiontext);\n \n // Test the number of choices.\n $choices = $page->xpath('//g[@class=\"questionchoice\"]');\n $this->assertCount(4, $choices);\n \n // Test the 1. choice element.\n $choice = $choices[0];\n $expectedvotemetadata = '<votemetadata><choicetext label=\"1\" format=\"choice\"/></votemetadata>';\n $votemetadata = $choice->votemetadata->asXML();\n $this->assert_same_xml($expectedvotemetadata, $votemetadata);\n \n // Test the numbering of the choice text without formattings.\n $expectedchoicetext = 'A';\n $choicetext = strip_tags($choice->text[0]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n // Test the choice text without formattings.\n $expectedchoicetext = 'answer 1';\n $choicetext = strip_tags($choice->text[1]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n // Test the 2. choice element.\n $choice = $choices[1];\n $expectedvotemetadata = '<votemetadata><choicetext label=\"2\" format=\"choice\"/></votemetadata>';\n $votemetadata = $choice->votemetadata->asXML();\n $this->assert_same_xml($expectedvotemetadata, $votemetadata);\n \n // Test the numbering of the choice text without formattings.\n $expectedchoicetext = 'B';\n $choicetext = strip_tags($choice->text[0]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n // Test the choice text without formattings.\n $expectedchoicetext = 'answer 2';\n $choicetext = strip_tags($choice->text[1]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n // Test the 3. choice element.\n $choice = $choices[2];\n $expectedvotemetadata = '<votemetadata><choicetext label=\"3\" format=\"choice\"/></votemetadata>';\n $votemetadata = $choice->votemetadata->asXML();\n $this->assert_same_xml($expectedvotemetadata, $votemetadata);\n \n // Test the numbering of the choice text without formattings.\n $expectedchoicetext = 'C';\n $choicetext = strip_tags($choice->text[0]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n // Test the choice text without formattings.\n $expectedchoicetext = 'answer 3';\n $choicetext = strip_tags($choice->text[1]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n // Test the 4. choice element.\n $choice = $choices[3];\n $expectedvotemetadata = '<votemetadata><choicetext label=\"4\" format=\"choice\"/></votemetadata>';\n $votemetadata = $choice->votemetadata->asXML();\n $this->assert_same_xml($expectedvotemetadata, $votemetadata);\n \n // Test the numbering of the choice text without formattings.\n $expectedchoicetext = 'D';\n $choicetext = strip_tags($choice->text[0]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n // Test the choice text without formattings.\n $expectedchoicetext = 'answer 4';\n $choicetext = strip_tags($choice->text[1]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n }",
"public function createQuestionAndAnswers () {\n global $tpl, $lng, $ilCtrl, $ilTabs;\n\n // create wizard object\n include_once('class.ilObjMobileQuizWizard.php');\n $wiz = new ilObjMobileQuizWizard();\n\n\n $ilTabs->activateTab(\"editQuiz\");\n\n\n if ($wiz->checkInput()){\n $wiz->createQuestionAndAnswers($this->object);\n ilUtil::sendSuccess($this->txt(\"question_obj_create\"), true);\n $ilCtrl->redirect($this, \"editQuiz\");\n }\n $this->initAddQuestionAndAnswersFormAfterError();\n //$tpl->setContent(\"Test\");\n }",
"public function testCreateSurveyQuestionChoice0()\n {\n }",
"public function testCreateSurveyQuestionChoice0()\n {\n }",
"public function test_export_multichoice_2() {\n $qdata = new stdClass();\n $qdata->id = 123;\n $qdata->contextid = 0;\n $qdata->qtype = 'multichoice';\n $qdata->name = 'Multiple choice question';\n $qdata->questiontext = 'Questiontext of muliple choice question.';\n $qdata->questiontextformat = FORMAT_HTML;\n $qdata->generalfeedback = 'General feedback';\n $qdata->generalfeedbackformat = FORMAT_HTML;\n $qdata->defaultmark = 23;\n $qdata->length = 1;\n $qdata->penalty = 0.3333333;\n $qdata->hidden = 0;\n \n $qdata->options = new stdClass();\n $qdata->options->single = 0;\n $qdata->options->shuffleanswers = 0;\n $qdata->options->answernumbering = 'abc';\n $qdata->options->correctfeedback = '<p>Your answer is correct.</p>';\n $qdata->options->correctfeedbackformat = FORMAT_HTML;\n $qdata->options->partiallycorrectfeedback = '<p>Your answer is partially correct.</p>';\n $qdata->options->partiallycorrectfeedbackformat = FORMAT_HTML;\n $qdata->options->shownumcorrect = 1;\n $qdata->options->incorrectfeedback = '<p>Your answer is incorrect.</p>';\n $qdata->options->incorrectfeedbackformat = FORMAT_HTML;\n \n $qdata->options->answers = array(\n 13 => new question_answer(13, 'answer 1', 0, '', FORMAT_HTML),\n 14 => new question_answer(14, 'answer 2', 1, '', FORMAT_HTML),\n 15 => new question_answer(15, 'answer 3', 0, '', FORMAT_HTML),\n 16 => new question_answer(16, 'answer 4', 1, '', FORMAT_HTML),\n );\n \n $qdata->hints = array(\n new question_hint_with_parts(0, 'Hint 1.', FORMAT_HTML, false, false),\n new question_hint_with_parts(0, 'Hint 2.', FORMAT_HTML, false, false),\n );\n \n \n // Export the question.\n $exporter = new qformat_smart();\n $questions = array($qdata);\n $zipcontent = $exporter->export_questions($questions);\n \n // Open exported question as import_data.\n $import_data = $this->zip_to_import_data($zipcontent);\n \n /*\n * Test content of imsmanifest.xml\n */\n \n $imsmanifest = $import_data->imsmanifest;\n \n $expected = '<resource identifier=\"group0_pages\" href=\"page0.svg\" type=\"webcontent\" adlcp:scormType=\"asset\"><file href=\"page0.svg\"/></resource>';\n $actual = $imsmanifest->resources->resource[0]->asXML();\n $this->assert_same_xml($expected, $actual);\n \n $expected = '<resource identifier=\"pages\" href=\"page0.svg\" type=\"webcontent\" adlcp:scormType=\"asset\"><file href=\"page0.svg\"/></resource>';\n $actual = $imsmanifest->resources->resource[1]->asXML();\n $this->assert_same_xml($expected, $actual);\n \n /*\n * Test content of page.\n */\n \n // Test number of pages.\n $this->assertCount(1, $import_data->pages);\n \n $page = $import_data->pages[0];\n \n // Test the number of question elements.\n $questions = $page->xpath('//g[@class=\"question\"]');\n $this->assertCount(1, $questions);\n \n // Test the question element.\n $question = $questions[0];\n $expectedvotemetadata = '<votemetadata><questiontext format=\"selection\" labelstyle=\"upper-alpha\" correct=\"2 4\" points=\"23\" tags=\"\" explanation=\"General feedback\" mathgradingoption=\"\" likert=\"\"/></votemetadata>';\n $votemetadata = $question->votemetadata->asXML();\n $this->assert_same_xml($expectedvotemetadata, $votemetadata);\n \n // Test the question number.\n $expectedquestionnumber = '1';\n $questionnumber = strip_tags($question->text[0]->asXML());\n $this->assertEquals($expectedquestionnumber, $questionnumber);\n \n // Test the question text without formattings.\n $expectedquestiontext = 'Questiontext of muliple choice question.';\n $questiontext = strip_tags($question->text[1]->asXML());\n $this->assertEquals($expectedquestiontext, $questiontext);\n \n // Test the number of choices.\n $choices = $page->xpath('//g[@class=\"questionchoice\"]');\n $this->assertCount(4, $choices);\n \n // Test the 1. choice element.\n $choice = $choices[0];\n $expectedvotemetadata = '<votemetadata><choicetext label=\"1\" format=\"selection\"/></votemetadata>';\n $votemetadata = $choice->votemetadata->asXML();\n $this->assert_same_xml($expectedvotemetadata, $votemetadata);\n \n // Test the numbering of the choice text without formattings.\n $expectedchoicetext = 'A';\n $choicetext = strip_tags($choice->text[0]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n // Test the choice text without formattings.\n $expectedchoicetext = 'answer 1';\n $choicetext = strip_tags($choice->text[1]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n // Test the 2. choice element.\n $choice = $choices[1];\n $expectedvotemetadata = '<votemetadata><choicetext label=\"2\" format=\"selection\"/></votemetadata>';\n $votemetadata = $choice->votemetadata->asXML();\n $this->assert_same_xml($expectedvotemetadata, $votemetadata);\n \n // Test the numbering of the choice text without formattings.\n $expectedchoicetext = 'B';\n $choicetext = strip_tags($choice->text[0]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n // Test the choice text without formattings.\n $expectedchoicetext = 'answer 2';\n $choicetext = strip_tags($choice->text[1]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n // Test the 3. choice element.\n $choice = $choices[2];\n $expectedvotemetadata = '<votemetadata><choicetext label=\"3\" format=\"selection\"/></votemetadata>';\n $votemetadata = $choice->votemetadata->asXML();\n $this->assert_same_xml($expectedvotemetadata, $votemetadata);\n \n // Test the numbering of the choice text without formattings.\n $expectedchoicetext = 'C';\n $choicetext = strip_tags($choice->text[0]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n // Test the choice text without formattings.\n $expectedchoicetext = 'answer 3';\n $choicetext = strip_tags($choice->text[1]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n // Test the 4. choice element.\n $choice = $choices[3];\n $expectedvotemetadata = '<votemetadata><choicetext label=\"4\" format=\"selection\"/></votemetadata>';\n $votemetadata = $choice->votemetadata->asXML();\n $this->assert_same_xml($expectedvotemetadata, $votemetadata);\n \n // Test the numbering of the choice text without formattings.\n $expectedchoicetext = 'D';\n $choicetext = strip_tags($choice->text[0]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n // Test the choice text without formattings.\n $expectedchoicetext = 'answer 4';\n $choicetext = strip_tags($choice->text[1]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n }",
"private function question()\n\t{\n\t\t$this->qns['questionnaire']['questionnairecategories_id'] = $this->allinputs['questioncat'];\n\t\t$this->qns['questionnaire']['questionnairesubcategories_id'] = $this->allinputs['questionsubcat'];\n\t\t$this->qns['questionnaire']['label'] = $this->allinputs['question_label'];\n\n\n\t\t$this->qns['questionnaire']['question'] = $this->allinputs['question'];\n\t\t$this->qns['questionnaire']['has_sub_question'] = $this->allinputs['subquestion'];\n\n\t\tif( $this->qns['questionnaire']['has_sub_question'] == 0 )\n\t\t{\n\t\t\t$this->qns['answers']['answer_type'] = $this->allinputs['optiontype'];\n\t\t}\n\n\t\t$this->qns['questionnaire']['active'] = 1;\n\n\t\tif( $this->qns['questionnaire']['has_sub_question'] == 0 ){\n\t\t\t//This code must be skipped if sub_question is 1\n\t\t\t$optionCounter = 0;\n\t\t\tforeach ($this->allinputs as $key => $value) {\n\n\t\t\t\tif( str_is('option_*', $key) ){\n\t\t\t\t\t$optionCounter++;\n\t\t\t\t\t$this->qns['answers'][$optionCounter] = ( $this->qns['answers']['answer_type'] == 'opentext' ) ? 'Offered answer text' : $value;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}",
"abstract protected function create(string $name, string $description, array $variants): Question;",
"public function test_for_quiz_question()\n {\n $this->withOutExceptionHandling();\n\n $user = $this->actingAs(User::factory()->make());\n\n $session = QuizSession::factory()->create();\n $schedule = ClassSchedule::factory()->create();\n\n $response = $this->post('api/v1/quiz/question',\n array_merge($this->data(), [\n 'quiz_session_id' => $session->id,\n 'class_schedule_id' => $schedule->id,\n ]\n )\n );\n\n $response->assertStatus(200);\n }",
"public function testCreateSurveyQuestion0()\n {\n }",
"public function testCreateSurveyQuestion0()\n {\n }",
"private function create_quiz_with_questions($startattempt = false, $finishattempt = false, $behaviour = 'deferredfeedback') {\n\n // Create a new quiz with attempts.\n $quizgenerator = $this->getDataGenerator()->get_plugin_generator('mod_quiz');\n $data = array('course' => $this->course->id,\n 'sumgrades' => 2,\n 'preferredbehaviour' => $behaviour);\n $quiz = $quizgenerator->create_instance($data);\n $context = context_module::instance($quiz->cmid);\n\n // Create a couple of questions.\n $questiongenerator = $this->getDataGenerator()->get_plugin_generator('core_question');\n\n $cat = $questiongenerator->create_question_category();\n $question = $questiongenerator->create_question('numerical', null, array('category' => $cat->id));\n quiz_add_quiz_question($question->id, $quiz);\n $question = $questiongenerator->create_question('numerical', null, array('category' => $cat->id));\n quiz_add_quiz_question($question->id, $quiz);\n\n $quizobj = quiz::create($quiz->id, $this->student->id);\n\n // Set grade to pass.\n $item = grade_item::fetch(array('courseid' => $this->course->id, 'itemtype' => 'mod',\n 'itemmodule' => 'quiz', 'iteminstance' => $quiz->id, 'outcomeid' => null));\n $item->gradepass = 80;\n $item->update();\n\n if ($startattempt or $finishattempt) {\n // Now, do one attempt.\n $quba = question_engine::make_questions_usage_by_activity('mod_quiz', $quizobj->get_context());\n $quba->set_preferred_behaviour($quizobj->get_quiz()->preferredbehaviour);\n\n $timenow = time();\n $attempt = quiz_create_attempt($quizobj, 1, false, $timenow, false, $this->student->id);\n quiz_start_new_attempt($quizobj, $quba, $attempt, 1, $timenow);\n quiz_attempt_save_started($quizobj, $quba, $attempt);\n $attemptobj = quiz_attempt::create($attempt->id);\n\n if ($finishattempt) {\n // Process some responses from the student.\n $tosubmit = array(1 => array('answer' => '3.14'));\n $attemptobj->process_submitted_actions(time(), false, $tosubmit);\n\n // Finish the attempt.\n $attemptobj->process_finish(time(), false);\n }\n return array($quiz, $context, $quizobj, $attempt, $attemptobj, $quba);\n } else {\n return array($quiz, $context, $quizobj);\n }\n\n }",
"public function make_multianswer_question_fourmc() {\n question_bank::load_question_definition_classes('multianswer');\n $q = new qtype_multianswer_question();\n test_question_maker::initialise_a_question($q);\n $q->name = 'Multianswer four multi-choice';\n $q->questiontext = '<p>Match the following cities with the correct state:</p>\n <ul>\n <li>San Francisco: {#1}</li>\n <li>Tucson: {#2}</li>\n <li>Los Angeles: {#3}</li>\n <li>Phoenix: {#4}</li>\n </ul>';\n $q->questiontextformat = FORMAT_HTML;\n $q->generalfeedback = '';\n $q->qtype = question_bank::get_qtype('multianswer');\n\n $q->textfragments = array('<p>Match the following cities with the correct state:</p>\n <ul>\n <li>San Francisco: ', '</li>\n <li>Tucson: ', '</li>\n <li>Los Angeles: ', '</li>\n <li>Phoenix: ', '</li>\n </ul>');\n $q->places = array('1' => '1', '2' => '2', '3' => '3', '4' => '4');\n\n $subqdata = array(\n 1 => array('qt' => '{1:MULTICHOICE:=California#OK~Arizona#Wrong}', 'California' => 'OK', 'Arizona' => 'Wrong'),\n 2 => array('qt' => '{1:MULTICHOICE:%0%California#Wrong~=Arizona#OK}', 'California' => 'Wrong', 'Arizona' => 'OK'),\n 3 => array('qt' => '{1:MULTICHOICE:=California#OK~Arizona#Wrong}', 'California' => 'OK', 'Arizona' => 'Wrong'),\n 4 => array('qt' => '{1:MULTICHOICE:%0%California#Wrong~=Arizona#OK}', 'California' => 'Wrong', 'Arizona' => 'OK'),\n );\n foreach ($subqdata as $i => $data) {\n // Multiple-choice subquestion.\n question_bank::load_question_definition_classes('multichoice');\n $mc = new qtype_multichoice_single_question();\n test_question_maker::initialise_a_question($mc);\n $mc->name = 'Multianswer four multi-choice';\n $mc->questiontext = $data['qt'];\n $mc->questiontextformat = FORMAT_HTML;\n $mc->generalfeedback = '';\n $mc->generalfeedbackformat = FORMAT_HTML;\n\n $mc->shuffleanswers = 0; // TODO this is a cheat to make the unit tests easier to write.\n // In reality, multianswer questions always shuffle.\n $mc->answernumbering = 'none';\n $mc->layout = qtype_multichoice_base::LAYOUT_DROPDOWN;\n\n $mc->answers = array(\n 10 * $i => new question_answer(13, 'California', (float) ($data['California'] == 'OK'),\n $data['California'], FORMAT_HTML),\n 10 * $i + 1 => new question_answer(14, 'Arizona', (float) ($data['Arizona'] == 'OK'),\n $data['Arizona'], FORMAT_HTML),\n );\n $mc->qtype = question_bank::get_qtype('multichoice');\n $mc->maxmark = 1;\n\n $q->subquestions[$i] = $mc;\n }\n\n return $q;\n }",
"public function test_export_matching() {\n $qdata = new stdClass();\n $qdata->id = 123;\n $qdata->contextid = 0;\n $qdata->qtype = 'match';\n $qdata->name = 'Matching question';\n $qdata->questiontext = 'Match the upper and lower case letters.';\n $qdata->questiontextformat = FORMAT_HTML;\n $qdata->generalfeedback = 'The answer is A -> a, B -> b and C -> c.';\n $qdata->generalfeedbackformat = FORMAT_HTML;\n $qdata->defaultmark = 23;\n $qdata->length = 1;\n $qdata->penalty = 0.3333333;\n $qdata->hidden = 0;\n \n $qdata->options = new stdClass();\n $qdata->options->shuffleanswers = 1;\n $qdata->options->correctfeedback = 'Well done.';\n $qdata->options->correctfeedbackformat = FORMAT_HTML;\n $qdata->options->partiallycorrectfeedback = 'Not entirely.';\n $qdata->options->partiallycorrectfeedbackformat = FORMAT_HTML;\n $qdata->options->shownumcorrect = false;\n $qdata->options->incorrectfeedback = 'Completely wrong!';\n $qdata->options->incorrectfeedbackformat = FORMAT_HTML;\n \n $subq1 = new stdClass();\n $subq1->id = -4;\n $subq1->questiontext = 'A';\n $subq1->questiontextformat = FORMAT_HTML;\n $subq1->answertext = 'a';\n \n $subq2 = new stdClass();\n $subq2->id = -3;\n $subq2->questiontext = 'B';\n $subq2->questiontextformat = FORMAT_HTML;\n $subq2->answertext = 'b';\n \n $subq3 = new stdClass();\n $subq3->id = -2;\n $subq3->questiontext = 'C';\n $subq3->questiontextformat = FORMAT_HTML;\n $subq3->answertext = 'c';\n \n $subq4 = new stdClass();\n $subq4->id = -1;\n $subq4->questiontext = '';\n $subq4->questiontextformat = FORMAT_HTML;\n $subq4->answertext = 'd';\n \n $qdata->options->subquestions = array(\n $subq1, $subq2, $subq3, $subq4);\n \n $qdata->hints = array(\n new question_hint_with_parts(0, 'Hint 1', FORMAT_HTML, true, false),\n new question_hint_with_parts(0, '', FORMAT_HTML, true, true),\n );\n \n // Export the question.\n $exporter = new qformat_smart();\n $questions = array($qdata);\n $zipcontent = $exporter->export_questions($questions);\n \n // Open exported question as import_data.\n $import_data = $this->zip_to_import_data($zipcontent);\n \n /*\n * Test content of imsmanifest.xml\n */\n \n $imsmanifest = $import_data->imsmanifest;\n \n $expected = '<resource identifier=\"group0_pages\" href=\"page0.svg\" type=\"webcontent\" adlcp:scormType=\"asset\"><file href=\"page0.svg\"/><file href=\"page1.svg\"/><file href=\"page2.svg\"/></resource>';\n $actual = $imsmanifest->resources->resource[0]->asXML();\n $this->assert_same_xml($expected, $actual);\n \n $expected = '<resource identifier=\"pages\" href=\"page0.svg\" type=\"webcontent\" adlcp:scormType=\"asset\"><file href=\"page0.svg\"/><file href=\"page1.svg\"/><file href=\"page2.svg\"/></resource>';\n $actual = $imsmanifest->resources->resource[1]->asXML();\n $this->assert_same_xml($expected, $actual);\n \n /*\n * Test content of page.\n */\n \n // Test number of pages.\n $this->assertCount(3, $import_data->pages);\n \n // Test first page\n \n $page = $import_data->pages[0];\n \n // Test the number of question elements.\n $questions = $page->xpath('//g[@class=\"question\"]');\n $this->assertCount(1, $questions);\n \n // Test the question element.\n $question = $questions[0];\n $expectedvotemetadata1 = '<votemetadata><questiontext format=\"choice\" labelstyle=\"upper-alpha\"';\n $expectedvotemetadata2 = 'points=\"23\" tags=\"\" explanation=\"The answer is A -$gt; a, B -$gt; b and C -$gt; c.\" mathgradingoption=\"\" likert=\"false\"/></votemetadata>';\n $votemetadata = $question->votemetadata->asXML();\n //$this->assert_same_xml($expectedvotemetadata, $votemetadata);\n //$this->assertStringStartsWith($expectedvotemetadata1, $votemetadata);\n //$this->assertStringEndsWith($expectedvotemetadata2, $votemetadata);\n \n // Test the question number.\n $expectedquestionnumber = '1';\n $questionnumber = strip_tags($question->text[0]->asXML());\n //$this->assertEquals($expectedquestionnumber, $questionnumber);\n \n // Test the question text without formattings.\n $expectedquestiontext = 'Match the upper and lower case letters.';\n $questiontext = strip_tags($question->text[1]->asXML());\n $this->assertStringStartsWith($expectedquestiontext, $questiontext);\n \n // Test the number of choices.\n $choices = $page->xpath('//g[@class=\"questionchoice\"]');\n $this->assertCount(4, $choices);\n \n // Test the 1. choice element.\n $choice = $choices[0];\n $expectedvotemetadata = '<votemetadata><choicetext label=\"1\" format=\"choice\"/></votemetadata>';\n $votemetadata = $choice->votemetadata->asXML();\n $this->assert_same_xml($expectedvotemetadata, $votemetadata);\n \n // Test the numbering of the choice text without formattings.\n $expectedchoicetext = 'A';\n $choicetext = strip_tags($choice->text[0]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n // Test the choice text without formattings.\n $expectedchoicetext = 'a';\n $choicetext = strip_tags($choice->text[1]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n // Test the 2. choice element.\n $choice = $choices[1];\n $expectedvotemetadata = '<votemetadata><choicetext label=\"2\" format=\"choice\"/></votemetadata>';\n $votemetadata = $choice->votemetadata->asXML();\n $this->assert_same_xml($expectedvotemetadata, $votemetadata);\n \n // Test the numbering of the choice text without formattings.\n $expectedchoicetext = 'B';\n $choicetext = strip_tags($choice->text[0]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n // Test the choice text without formattings.\n $expectedchoicetext = 'b';\n $choicetext = strip_tags($choice->text[1]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n // Test the 3. choice element.\n $choice = $choices[2];\n $expectedvotemetadata = '<votemetadata><choicetext label=\"3\" format=\"choice\"/></votemetadata>';\n $votemetadata = $choice->votemetadata->asXML();\n $this->assert_same_xml($expectedvotemetadata, $votemetadata);\n \n // Test the numbering of the choice text without formattings.\n $expectedchoicetext = 'C';\n $choicetext = strip_tags($choice->text[0]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n // Test the choice text without formattings.\n $expectedchoicetext = 'c';\n $choicetext = strip_tags($choice->text[1]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n // Test the 4. choice element.\n $choice = $choices[3];\n $expectedvotemetadata = '<votemetadata><choicetext label=\"4\" format=\"choice\"/></votemetadata>';\n $votemetadata = $choice->votemetadata->asXML();\n $this->assert_same_xml($expectedvotemetadata, $votemetadata);\n \n // Test the numbering of the choice text without formattings.\n $expectedchoicetext = 'D';\n $choicetext = strip_tags($choice->text[0]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n // Test the choice text without formattings.\n $expectedchoicetext = 'd';\n $choicetext = strip_tags($choice->text[1]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n // Test second page\n \n $page = $import_data->pages[1];\n \n // Test the number of question elements.\n $questions = $page->xpath('//g[@class=\"question\"]');\n $this->assertCount(1, $questions);\n \n // Test the question element.\n $question = $questions[0];\n $expectedvotemetadata1 = '<votemetadata><questiontext format=\"choice\" labelstyle=\"upper-alpha\"';\n $expectedvotemetadata2 = 'points=\"23\" tags=\"\" explanation=\"The answer is A -$gt; a, B -$gt; b and C -$gt; c.\" mathgradingoption=\"\" likert=\"false\"/></votemetadata>';\n $votemetadata = $question->votemetadata->asXML();\n //$this->assert_same_xml($expectedvotemetadata, $votemetadata);\n //$this->assertStringStartsWith($expectedvotemetadata1, $votemetadata);\n //$this->assertStringEndsWith($expectedvotemetadata2, $votemetadata);\n \n // Test the question number.\n $expectedquestionnumber = '2';\n $questionnumber = strip_tags($question->text[0]->asXML());\n //$this->assertEquals($expectedquestionnumber, $questionnumber);\n \n // Test the question text without formattings.\n $expectedquestiontext = 'Match the upper and lower case letters.';\n $questiontext = strip_tags($question->text[1]->asXML());\n $this->assertStringStartsWith($expectedquestiontext, $questiontext);\n \n // Test the number of choices.\n $choices = $page->xpath('//g[@class=\"questionchoice\"]');\n $this->assertCount(4, $choices);\n \n // Test the 1. choice element.\n $choice = $choices[0];\n $expectedvotemetadata = '<votemetadata><choicetext label=\"1\" format=\"choice\"/></votemetadata>';\n $votemetadata = $choice->votemetadata->asXML();\n $this->assert_same_xml($expectedvotemetadata, $votemetadata);\n \n // Test the numbering of the choice text without formattings.\n $expectedchoicetext = 'A';\n $choicetext = strip_tags($choice->text[0]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n // Test the choice text without formattings.\n $expectedchoicetext = 'a';\n $choicetext = strip_tags($choice->text[1]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n // Test the 2. choice element.\n $choice = $choices[1];\n $expectedvotemetadata = '<votemetadata><choicetext label=\"2\" format=\"choice\"/></votemetadata>';\n $votemetadata = $choice->votemetadata->asXML();\n $this->assert_same_xml($expectedvotemetadata, $votemetadata);\n \n // Test the numbering of the choice text without formattings.\n $expectedchoicetext = 'B';\n $choicetext = strip_tags($choice->text[0]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n // Test the choice text without formattings.\n $expectedchoicetext = 'b';\n $choicetext = strip_tags($choice->text[1]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n // Test the 3. choice element.\n $choice = $choices[2];\n $expectedvotemetadata = '<votemetadata><choicetext label=\"3\" format=\"choice\"/></votemetadata>';\n $votemetadata = $choice->votemetadata->asXML();\n $this->assert_same_xml($expectedvotemetadata, $votemetadata);\n \n // Test the numbering of the choice text without formattings.\n $expectedchoicetext = 'C';\n $choicetext = strip_tags($choice->text[0]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n // Test the choice text without formattings.\n $expectedchoicetext = 'c';\n $choicetext = strip_tags($choice->text[1]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n // Test the 4. choice element.\n $choice = $choices[3];\n $expectedvotemetadata = '<votemetadata><choicetext label=\"4\" format=\"choice\"/></votemetadata>';\n $votemetadata = $choice->votemetadata->asXML();\n $this->assert_same_xml($expectedvotemetadata, $votemetadata);\n \n // Test the numbering of the choice text without formattings.\n $expectedchoicetext = 'D';\n $choicetext = strip_tags($choice->text[0]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n // Test the choice text without formattings.\n $expectedchoicetext = 'd';\n $choicetext = strip_tags($choice->text[1]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n // Test third page\n \n $page = $import_data->pages[2];\n \n // Test the number of question elements.\n $questions = $page->xpath('//g[@class=\"question\"]');\n $this->assertCount(1, $questions);\n \n // Test the question element.\n $question = $questions[0];\n $expectedvotemetadata1 = '<votemetadata><questiontext format=\"choice\" labelstyle=\"upper-alpha\"';\n $expectedvotemetadata2 = 'points=\"23\" tags=\"\" explanation=\"The answer is A -$gt; a, B -$gt; b and C -$gt; c.\" mathgradingoption=\"\" likert=\"false\"/></votemetadata>';\n $votemetadata = $question->votemetadata->asXML();\n //$this->assert_same_xml($expectedvotemetadata, $votemetadata);\n //$this->assertStringStartsWith($expectedvotemetadata1, $votemetadata);\n //$this->assertStringEndsWith($expectedvotemetadata2, $votemetadata);\n \n // Test the question number.\n $expectedquestionnumber = '3';\n $questionnumber = strip_tags($question->text[0]->asXML());\n //$this->assertEquals($expectedquestionnumber, $questionnumber);\n \n // Test the question text without formattings.\n $expectedquestiontext = 'Match the upper and lower case letters.';\n $questiontext = strip_tags($question->text[1]->asXML());\n $this->assertStringStartsWith($expectedquestiontext, $questiontext);\n \n // Test the number of choices.\n $choices = $page->xpath('//g[@class=\"questionchoice\"]');\n $this->assertCount(4, $choices);\n \n // Test the 1. choice element.\n $choice = $choices[0];\n $expectedvotemetadata = '<votemetadata><choicetext label=\"1\" format=\"choice\"/></votemetadata>';\n $votemetadata = $choice->votemetadata->asXML();\n $this->assert_same_xml($expectedvotemetadata, $votemetadata);\n \n // Test the numbering of the choice text without formattings.\n $expectedchoicetext = 'A';\n $choicetext = strip_tags($choice->text[0]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n // Test the choice text without formattings.\n $expectedchoicetext = 'a';\n $choicetext = strip_tags($choice->text[1]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n // Test the 2. choice element.\n $choice = $choices[1];\n $expectedvotemetadata = '<votemetadata><choicetext label=\"2\" format=\"choice\"/></votemetadata>';\n $votemetadata = $choice->votemetadata->asXML();\n $this->assert_same_xml($expectedvotemetadata, $votemetadata);\n \n // Test the numbering of the choice text without formattings.\n $expectedchoicetext = 'B';\n $choicetext = strip_tags($choice->text[0]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n // Test the choice text without formattings.\n $expectedchoicetext = 'b';\n $choicetext = strip_tags($choice->text[1]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n // Test the 3. choice element.\n $choice = $choices[2];\n $expectedvotemetadata = '<votemetadata><choicetext label=\"3\" format=\"choice\"/></votemetadata>';\n $votemetadata = $choice->votemetadata->asXML();\n $this->assert_same_xml($expectedvotemetadata, $votemetadata);\n \n // Test the numbering of the choice text without formattings.\n $expectedchoicetext = 'C';\n $choicetext = strip_tags($choice->text[0]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n // Test the choice text without formattings.\n $expectedchoicetext = 'c';\n $choicetext = strip_tags($choice->text[1]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n // Test the 4. choice element.\n $choice = $choices[3];\n $expectedvotemetadata = '<votemetadata><choicetext label=\"4\" format=\"choice\"/></votemetadata>';\n $votemetadata = $choice->votemetadata->asXML();\n $this->assert_same_xml($expectedvotemetadata, $votemetadata);\n \n // Test the numbering of the choice text without formattings.\n $expectedchoicetext = 'D';\n $choicetext = strip_tags($choice->text[0]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n // Test the choice text without formattings.\n $expectedchoicetext = 'd';\n $choicetext = strip_tags($choice->text[1]->asXML());\n $this->assertEquals($expectedchoicetext, $choicetext);\n \n \n }",
"function create_session_and_responses(&$question, &$state, $cmoptions, $attempt) {\n global $CFG, $DB;\n if(!$maxnumber = (int)$DB->get_field_sql(\n \"SELECT MIN(a.itemcount)\n FROM {question_dataset_definitions} a,\n {question_datasets} b\n WHERE b.question = ?\n AND a.id = b.datasetdefinition\", array($question->id))) {\n print_error('cannotgetdsforquestion', 'question', '', $question->id);\n }\n\n // Choose a random dataset\n if (!isset($cmoptions->intro) || strstr($cmoptions->intro, 'synchronize_calculated') === false ) {\n $state->options->datasetitem = rand(1, $maxnumber);\n }else{\n if( !isset($cmoptions->synchronize_calculated)) {\n $state->options->datasetitem = rand(1, $maxnumber);\n $cmoptions->synchronize_calculated = $state->options->datasetitem ;\n }else {\n if ($cmoptions->synchronize_calculated <= $maxnumber){\n $state->options->datasetitem = $cmoptions->synchronize_calculated ;\n }else {\n $state->options->datasetitem = rand(1, $maxnumber);\n }\n }\n };\n $state->options->dataset =\n $this->pick_question_dataset($question,$state->options->datasetitem);\n $state->responses = array('' => '');\n return true;\n }",
"function buildQuiz() {\n for ($i = 0; $i <= 9; $i++) {\n $randomNumbers = getRandomNumbers();\n $correctAnswer = getCorrectAnswer($randomNumbers);\n $answers = getRandomAnswers($correctAnswer);\n $quiz[] = [\n \"leftAdder\" => $randomNumbers[0],\n \"rightAdder\" => $randomNumbers[1],\n \"correctAnswer\" => $correctAnswer,\n \"firstIncorrectAnswer\" => $answers[0],\n \"secondIncorrectAnswer\" => $answers[1],\n ];\n }\n return $quiz;\n}",
"public function run()\n {\n $questions = Question::all();\n \n foreach ($questions as $question) {\n for ($i=1; $i <= 1; $i++) { \n factory(QuestionOption::class)->create([\n 'option' => \"opcion correcta\",\n 'correct' => true,\n 'question_id' => $question->id,\n ]);\n }\n for ($i=1; $i <= 3; $i++) { \n factory(QuestionOption::class)->create([\n 'option' => \"opcion\",\n 'correct' => false,\n 'question_id' => $question->id,\n ]);\n }\n }\n }",
"public function takeAll(){\n if(isset($_POST['submit'])){\n $post = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);\n // var_dump($post);\n // Messages::setMsg('Answer is submitted', 'success');\n // Check if the answer is correct\n // echo 'session data:';\n\n // Put the submitted chosen answers into an array\n $choices = array();\n // Check the number of questions\n $num_q = count($_SESSION['quiz_data']);\n // Add the choices into an array\n for($i = 0; $i < $num_q; $i++){\n $choices[] = intval($post[\"choice{$i}\"]);\n }\n echo 'CHOICES';\n var_dump($choices);\n echo 'NUMBER OF QUESTIONS IS: ';\n echo $num_q;\n\n // Loop through the answers and count the correct answers\n $score = 0;\n $question = 0;\n foreach($choices as $choice){\n // $indexed_array = array_values($_SESSION['quiz_data']);\n $is_answer = array_values($_SESSION['quiz_data']) [$question][$choice]['is_answer'];\n if($is_answer == 1){\n $score++;\n $question++;\n }\n }\n Messages::setMsg(\"You scored {$score} out of {$num_q}\", 'success');\n return;\n } else {\n // !!! Need to modified, question.user_id does not exist amy more\n $this->query('SELECT questions.content, options.content, options.is_answer FROM questions JOIN users ON questions.user_id = users.id JOIN options ON options.question_id = questions.id WHERE users.id = :user_id');\n // Bind the user_id to the current user id\n $userId = $_SESSION['user_data']['id'];\n $this->bind(':user_id', $userId);\n $rows = $this->resultSetGroup();\n // echo '<pre>';\n // print_r($rows);\n // echo '</pre>';\n // var_dump($rows);\n // print_r($rows);\n // Store $row in session to check the answer once it is submitted\n if($rows){\n $_SESSION['quiz_data'] = $rows;\n } else {\n Messages::setMsg('No quizzes yet', 'error');\n }\n return $rows;\n }\n }",
"function exam_take_form($form, &$form_state, $pExamID, $pQNO=0){\n \n $vCurrentQuestionNumber = 0; // This should be properly defined later\n \n //Prepare this function for iterative use\n // - ensure the $vExamInstance is only created the first time\n // - pass back into this function a value for the question number\n // - capture student answers\n //print 'exam = ' . $pExamID;\n //\n // $_SESSION['exam']['pExamInitialize'] = 1: Initiate a session for a new exam\n // $_SESSION['exam']['pExamContinuation'] = 2: Initiate a session for an existing exam\n // \n // Capture SESSION variables, if they exist. This is not necessary,\n // but if we wait and try to reference the session variables later,\n // we have to first check if the variable exists (isset), and \n // that's so annoying. It detracts from the code's readability.\n if (isset($_SESSION['exam']['pExamInitialize'])) { \n $pExamInitialize = $_SESSION['exam']['pExamInitialize'];\n // Unset the session variable pExamInitiative so that the exam \n // is not initialized again unless a new exam is launched. \n unset($_SESSION['exam']['pExamInitialize']);\n } else {\n $pExamInitialize = 0;\n }\n \n if ($pExamInitialize == '1') {\n // Initialize the page advance controls\n exam_take_page_advance_init();\n // Initialize the exam - create an exam instance in the database\n // and generate a new exam_instance_id. Capture the exam_instance_id \n // in a variable, we'll need this.\n $vExamInstanceID = ExamInstance::populateInstanceTables($pExamID); \n $_SESSION['exam']['pExamInstanceID'] = $vExamInstanceID;\n } else {\n // Obtain the already-established exam_instance_id\n $vExamInstanceID = $_SESSION['exam']['pExamInstanceID'];\n }\n \n ExamInstance::storeMessage('$vExamInstanceID = ' . $vExamInstanceID, 'exam_take_form');\n \n // SKERE777 add logic for what happens with bogus incoming values for pExamInstanceID\n \n // Get basic exam data\n $vExamInfo = ExamInstance::getInfoForExamInstanceID($vExamInstanceID);\n\n //\n // Confirm that the incoming request is asking for a valid question number\n // pQNO is \"Parameter for a Question Number\". All incoming parameters should\n // start with a \"p\". But that may not be fully enforced yet.\n //\n if (($pQNO > 0) and ($pQNO <= $vExamInfo['totalQuestions'])) { \n $vCurrentQuestionNumber = $pQNO;\n $_SESSION['exam']['pCurrentQuestionNumber'] = $vCurrentQuestionNumber;\n } else {\n // \n // SKERE - WORK ON THIS\n // Display an error message warning that the \n // incoming request is for a non-existent question number\n ExamInstance::storeMessage('ERROR: Invalid question number ' . $pQNO . ' ***', 'exam_take_form');\n $form['pQuestionNumber'] = array(\n '#markup' => t('Invalid question number ' . $pQNO \n . ' of ' \n . $vExamInfo['totalQuestions'] . '</h2></p>')\n ); \n return $form;\n }\n \n // Get the array of answers for the current question\n $vTheQuestion = ExamInstance::getOneQuestion($vExamInstanceID, $vCurrentQuestionNumber);\n ExamInstance::storeMessage('$vTheQuestion - text is \"' . $vTheQuestion['question_text'] . '\"', 'exam_take_form');\n $vTheAnswers = ExamInstance::getOneQuestionsAnswers($vExamInstanceID, $vCurrentQuestionNumber);\n $vNumberOfAnswers = count($vTheAnswers)-1; // Account for the first initialized blank row. Looping starts at 0 and needs to iterate four times, so 0, 1, 2, 3. Three is the end.\n \n ExamInstance::storeMessage('$vNumberOfAnswers = ' . $vNumberOfAnswers, 'exam_take_form');\n \n $form['pQuestionNumber'] = array(\n '#markup' => t('<p><h2>Question #' \n . $vCurrentQuestionNumber . ' of ' \n . $vExamInfo['totalQuestions'] . '</h2></p>')\n );\n \n $form['pMark'] = array(\n '#type' => 'checkbox',\n '#title' => t('Mark'),\n '#default_value' => $vTheQuestion['marked'] // Skere - check this\n );\n \n // Create and initialize a counter \n // to support the creation of \n // an array of answers for the current question\n // to be used in the form['pAnswer'] object \n $vCounter = 1;\n while ($vCounter <= $vNumberOfAnswers) {\n // Extract the answer_instance_id value\n //$vAnswerInstanceID = $vTheAnswers[$vCounter]['answer_instance_id'];\n // Build the answer string to be displayed \n $vAnswerString = '<b>' . $vTheAnswers[$vCounter]['answer_letter'] . '</b>: ' .\n $vTheAnswers[$vCounter]['answer_text'];\n // Combine the answer letter and the string and build the array\n // REPLACE THIS WITH THE NEXT LINE: $vAnswerArray[$vAnswerInstanceID] = $vAnswerString;\n $vAnswerArray[$vCounter] = $vAnswerString;\n $vCounter++;\n }\n\n // Very important - run the question_text through the Drupal filter to ensure\n // that any uses of the \"img\" tag have proper URLS. \n ExamInstance::storeMessage('$vTheQuestion[\\'question_text\\']=' . $vTheQuestion['question_text'], 'exam_take_form');\n ExamInstance::storeMessage('Just before call to filter', 'exam_take_form');\n $vTheQuestion['question_text'] = filter_for_URL($vTheQuestion['question_text']);\n ExamInstance::storeMessage('Just after call to filter', 'exam_take_form'); \n // End of the filtering of the question text\n \n // The set of answers is treated as a single form object. \n // It includes the question - see the \"title\" property.\n // Note that the value stored for answers selected is the answer_instance_id\n \n $vDefaultValue = $vTheQuestion['selected_answer_number']; // SKERE - check this\n ExamInstance::storeMessage('$vDefaultValue = ' . $vDefaultValue . '.', 'exam_take_form');\n \n $form['pAnswer'] = array(\n '#type' => 'radios',\n '#options' => $vAnswerArray,\n '#title' => t($vTheQuestion['question_text']),\n '#default_value' => $vDefaultValue \n );\n \n //print '** The big answer is: ' . $vExamInstance->ei_qa[$vCurrentQuestionNumber]['selected_answer_instance_id'] . ' ** ';\n \n $form['actions'] = array('#type' => 'actions');\n if ($vCurrentQuestionNumber <> 1) {\n $form['actions']['pButtonPrevious'] = array(\n '#type' => 'submit',\n '#value' => t('Previous Question'),\n '#name' => 'Previous',\n '#prefix' => '<div id=\"buttonGroup\" class=\"demo\">',\n '#suffix' => '</div',\n '#submit' => array('exam_capture_data'\n , 'exam_take_form_submit_previous'\n , 'exam_take_form_submit'\n )\n );\n }\n\n if ($vCurrentQuestionNumber <> $vExamInfo['totalQuestions']) {\n $form['actions']['pButtonNext'] = array(\n '#type' => 'submit',\n '#value' => t('Next Question'),\n '#name' => 'Next',\n '#prefix' => '<div id=\"buttonGroup\" class=\"demo\">',\n '#suffix' => '</div',\n '#submit' => array('exam_capture_data'\n , 'exam_take_form_submit_next'\n , 'exam_take_form_submit'\n )\n );\n }\n\n $form['actions']['pButtonSummary'] = array(\n '#type' => 'submit',\n '#value' => t('Show Summary'),\n '#name' => 'Summary',\n '#prefix' => '<div id=\"buttonGroup\" class=\"demo\">',\n '#suffix' => '</div', \n '#submit' => array('exam_take_form_submit_summary')\n );\n \n //Do we need these? Haven't tried them yet\n //$form['#validate'][] = 'exam_take_form_validate';\n //field_attach_form('exam', $exam, $form, $form_state);\n\n // Specify the function to handle form submission\n //$form['#submit'][] = 'exam_take_form_submit';\n \n return $form;\n \n}",
"private function generateQuestion(){\n\t\t\t$questions = array(\n\t\t\t\t\tarray('name' => 'chevrolet', 'logo' => 'chevrolet.png'),\n\t\t\t\t\tarray('name' => 'playboy', 'logo' => 'playboy.png'),\n\t\t\t\t\tarray('name' => 'shell', 'logo' => 'shell.png'),\n\t\t\t\t\tarray('name' => 'java', 'logo' => 'java.png'),\n\t\t\t\t\tarray('name' => 'mysql', 'logo' => 'mysql.png'),\n\t\t\t\t\tarray('name' => 'postgresql', 'logo' => 'postgresql.png'),\n\t\t\t\t\tarray('name' => 'chrome', 'logo' => 'chrome.png'),\n\t\t\t\t\tarray('name' => 'firefox', 'logo' => 'firefox.png'),\n\t\t\t\t\tarray('name' => 'bluetooth', 'logo' => 'bluetooth.png'),\n\t\t\t\t\tarray('name' => 'twitter', 'logo' => 'twitter.png')\n\t\t\t\t);\n\t\t\t\t\n\t\t\t$index = rand(0, count($questions) - 1);\n\t\t\t\n\t\t\t$this->session->set('gl_answer', $questions[$index]['name']);\n\t\t\t\n\t\t\treturn array(\n\t\t\t\t\t\t\t'type' => 'image',\n\t\t\t\t\t\t\t'originalContentUrl' => $this->image_url . $questions[$index]['logo'],\n\t\t\t\t\t\t\t'previewImageUrl' => $this->image_url . $questions[$index]['logo']\n\t\t\t\t\t\t);\n\t\t}",
"public function generateChoices(array $question)\n\t{\n\t\t[$inputMode, $inputExpectation, $notUseful, $from] = explode('_', $question['type']);\n\n\t\tif($this->config['cross_sections_for_possible_answers'])\n\t\t{\n\t\t\t//TODO\n\t\t}\n\n\t\telse\n\t\t{\n\t\t\t//leave space for the correct answer to be slotted in!\n\t\t\t//(not done in this method BTW)\n\t\t\t//UPDATE: actually, no, we'll just clobber one to put the correct answer in\n\t\t\t//$count = $this->config['choices_per_question'] - 1;\n\t\t\t$count = $this->config['choices_per_question'];\n\n\t\t\t$randomKeys = array_rand($this->functionData[$question['section']], $count);\n\n\t\t\t$choices = [];\n\n\t\t\tforeach($randomKeys as $key)\n\t\t\t{\n\t\t\t\t$choices[] = $this->functionData[$question['section']][$key][$inputExpectation];\n\t\t\t}\n\n\t\t\treturn $choices;\n\n\t\t}\n\t}",
"public function next()\n\t{\n\t\tif(!S::may())\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\t/*\n\t\t * Try to find a current quiz session ant retrieve the questions\n\t\t */\n\t\tif($quiz = S::get('quiz-questions'))\n\t\t{\n\t\t\t$dia = new XhrDialog();\n\t\t\t$dia->addClass('quiz-questiondialog');\n\t\t\t// get quiz_index it is the current array index of the questions\n\t\t\t$i = S::get('quiz-index');\n\t\t\t\n\t\t\t/*\n\t\t\t * If the quiz index is 0 we have to start a new quiz session \n\t\t\t */\n\t\t\t\n\t\t\t$easymode = 0;\n\t\t\tif(S::get('quiz-easymode'))\n\t\t\t{\n\t\t\t\t$easymode = 1;\n\t\t\t}\n\t\t\t\n\t\t\tif($i == 0)\n\t\t\t{\t\t\t\t\n\t\t\t\t$quuizz = $this->model->getQuiz(S::get('quiz-id'));\n\t\t\t\t// init quiz session in DB\n\t\t\t\tif($id = $this->model->initQuizSession(S::get('quiz-id'), $quiz, $quuizz['maxfp'], $quuizz['questcount'],$easymode))\n\t\t\t\t{\n\t\t\t\t\tS::set('quiz-session', $id);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// this variable we need to output an message that the last question was only a joke \n\t\t\t$was_a_joke = false;\n\t\t\t\n\t\t\t/*\n\t\t\t * check if an answered quiz question is arrived\n\t\t\t */\n\t\t\tif(isset($_GET['answer']))\n\t\t\t{\n\t\t\t\t/*\n\t\t\t\t * parse the anser parameter\n\t\t\t\t */\n\t\t\t\t$answers = urldecode($_GET['answer']);\n\t\t\t\t$params = array();\n\t\t\t\tparse_str($_GET['answer'], $params);\n\t\t\t\t\n\t\t\t\t/*\n\t\t\t\t * store params in the quiz array to save users answers\n\t\t\t\t */\n\t\t\t\tif(isset($params['qanswers']))\n\t\t\t\t{\n\t\t\t\t\t$quiz[($i-1)]['answers'] = $params['qanswers'];\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t/*\n\t\t\t\t * check if there are 0 point for the questions its a joke\n\t\t\t\t */\n\t\t\t\tif($quiz[($i-1)]['fp'] == 0)\n\t\t\t\t{\n\t\t\t\t\t$was_a_joke = true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t/*\n\t\t\t\t * store the time how much time has the user need\n\t\t\t\t */\n\t\t\t\t$quiz[($i-1)]['userduration'] = (time() - (int)S::get('quiz-quest-start'));\n\t\t\t\t\n\t\t\t\t/*\n\t\t\t\t * has store noco ;) its the value when the user marked that no answer is correct\n\t\t\t\t */\n\t\t\t\t$quiz[($i-1)]['noco'] = (int)$_GET['noco'];\n\t\t\t\t\n\t\t\t\t/*\n\t\t\t\t * And store it all back to the session\n\t\t\t\t */\n\t\t\t\tS::set('quiz-questions', $quiz);\n\t\t\t}\n\t\t\t\n\t\t\t/*\n\t\t\t * Have a look has the user entered an comment for this question?\n\t\t\t*/\n\t\t\tif(isset($_GET['comment']) && !empty($_GET['comment']))\n\t\t\t{\n\t\t\t\t$comment = strip_tags($_GET['comment']);\n\t\t\t\t\n\t\t\t\t$comment = $_GET['commentanswers'] . $comment;\n\t\t\t\t\n\t\t\t\t// if yes lets store in the db\n\t\t\t\t$this->model->addUserComment((int)$_GET['qid'], $comment);\n\t\t\t}\n\t\t\t\n\t\t\t/*\n\t\t\t * Check the special param if the next question should not be displayed\n\t\t\t */\n\t\t\tif(isset($_GET['special']))\n\t\t\t{\n\t\t\t\t// make a break\n\t\t\t\tif($_GET['special'] == 'pause')\n\t\t\t\t{\n\t\t\t\t\t$this->model->updateQuizSession(S::get('quiz-session'), $quiz, $i);\n\t\t\t\t\treturn $this->pause();\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t//\n\t\t\t\tif($_GET['special'] == 'result')\n\t\t\t\t{\n\t\t\t\t\t$this->model->updateQuizSession(S::get('quiz-session'), $quiz, $i);\n\t\t\t\t\treturn $this->resultNew($quiz[($i-1)],$dia->getId());\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t/*\n\t\t\t * check if there is a next question in quiz array push it to the user\n\t\t\t * othwise forward to the result of the quiz\n\t\t\t */\n\t\t\tif(isset($quiz[$i]))\n\t\t\t{\n\t\t\t\t// get the question\n\t\t\t\tif($question = $this->model->getQuestion($quiz[$i]['id']))\n\t\t\t\t{\t\t\n\t\t\t\t\t// get possible answers\t\t\n\t\t\t\t\t$comment_aswers = '';\n\t\t\t\t\tif($answers = $this->model->getAnswers($question['id']))\n\t\t\t\t\t{\n\t\t\t\t\t\t// random sorting for the answers\n\t\t\t\t\t\tshuffle($answers);\n\n\t\t\t\t\t\t$x=1;\n\t\t\t\t\t\tforeach ($answers as $a)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$comment_aswers .= $x.'. Frage #'.$a['id'].' => '.preg_replace('/[^a-zA-Z0-9\\ \\.]/','',tt($a['text'],25)).\"\\n\";\n\t\t\t\t\t\t\t$x++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * increase the question index so we are at the next question ;)\n\t\t\t\t\t\t */ \n\t\t\t\t\t\t$i++;\n\t\t\t\t\t\tS::set('quiz-index',$i);\n\t\t\t\t\t\t\n\t\t\t\t\t\t// update quiz session\n\t\t\t\t\t\t$session_id = S::get('quiz-session');\n\t\t\t\t\t\t$this->model->updateQuizSession($session_id, $quiz, $i);\n\t\t\t\t\t\tS::set('quiz-quest-start',time());\n\t\t\t\t\t\t\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * let's prepare the output dialog\n\t\t\t\t\t\t */\n\t\t\t\t\t\t$dia->addOpt('width', 1000);\n\t\t\t\t\t\t$dia->addOpt('height', '($(window).height()-40)',false);\n\t\t\t\t\t\t$dia->addOpt('position', 'center');\n\t\t\t\t\t\t$dia->setTitle('Frage '.($i).' / '.count($quiz));\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t$dia->addContent($this->view->quizQuestion($question,$answers));\n\t\t\t\t\t\t\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * for later function is not ready yet :)\n\t\t\t\t\t\t */\n\t\t\t\t\t\t$dia->addButton('Weiter', 'questcheckresult();return false;');\n\t\t\t\t\t\t$dia->addButton('Pause', 'ajreq(\\'pause\\',{app:\\'quiz\\',sid:\\''.$session_id.'\\'});');\n\n\t\t\t\t\t\t$dia->addButton('nächste Frage','ajreq(\\'next\\',{app:\\'quiz\\',qid:'.(int)$question['id'].',commentanswers:\"'.jsSafe($comment_aswers).'\"});$(\".quiz-questiondialog .ui-dialog-buttonset .ui-button\").button( \"option\", \"disabled\", true );$(\".quiz-questiondialog .ui-dialog-buttonset .ui-button span\").prepend(\\'<i class=\"fa fa-spinner fa-spin\"></i> \\')');\n\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * add next() Button\n\t\t\t\t\t\t */\n\n\t\t\t\t\t\t$dia->addOpt('open','\n\t\t\t\t\t\tfunction(){\n\t\t\t\t\t\t\tsetTimeout(function(){\n\t\t\t\t\t\t\t\t$close = $(\"#'.$dia->getId().'\").prev().children(\".ui-dialog-titlebar-close\");\n\t\t\t\t\t\t\t\t$close.unbind(\"click\");\n\t\t\t\t\t\t\t\t$close.click(function(){\n\t\t\t\t\t\t\t\t\tajreq(\"pause\",{app:\"quiz\",sid:'.(int)$session_id.'});\n\t\t\t\t\t\t\t\t\t//abortOrPause(\"'.$dia->getId().'\");\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t$(\"#quizcomment\").hide();\n\t\t\t\t\t\t\t\t$(\".quiz-questiondialog .ui-dialog-buttonset button:last\").hide();\n\t\t\t\t\t\t\t\t$(\".quiz-questiondialog .ui-dialog-buttonset .ui-button:contains(\\'Pause\\')\").hide();\n\t\t\t\t\t\t\t\t$(\".ui-dialog-titlebar-close\").hide();\n\t\t\t\t\t\t\t},100);\n\t\t\t\t\t\t}',false);\n\t\t\t\t\t\t\n\t\t\t\t\t\t$return = $dia->xhrout();\n\t\t\t\t\t\t\n\t\t\t\t\t\t// additional output if it was a joke question\n\t\t\t\t\t\tif($was_a_joke)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$return['script'] .= 'pulseInfo(\"<h3>Das war eine Scherzfrage</h3>Du kannst beruhigt weitermachen und auch wenn die möglichen Antworten nicht falsch sind, müssen diese Fragen nicht richtig beantwortet werden, sie dienen lediglich des auflockerns für Zwischendurch ;)\",{sticky:true});';\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * strange but it works ;) generate the js code and send is to the client for execute\n\t\t\t\t\t\t */\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t$quizbreath = '\n\t\t\t\t\t\t\t$(\\'#quizwrapper\\').show();\n\t\t\t\t\t\t\t$(\\'#quizbreath\\').hide();\n\t\t\t\t\t\t\tvar count = '.(int)$question['duration'].';\n\t\t\t\t\t\t\tvar counter = null;\n\t\t\t\t\t\t';\n\t\t\t\t\t\t\n\t\t\t\t\t\tif($easymode == 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$quizbreath = '\n\t\t\t\t\t\t\t$(\\'#quizwrapper\\').hide();\n\t\t\t\t\t\t\t$(\\'#quizbreath\\').show();\n\t\t\t\t\t\t\t$(\"#'.$dia->getId().'\").next(\".ui-dialog-buttonpane\").css(\"visibility\",\"hidden\");\n\t\t\t\t\t\t\tvar count = '.(int)$question['duration'].';\n\t\t\t\t\t\t\tvar counter = null;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfunction timer()\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t count--;\n\t\t\t\t\t $(\"#countdown\").progressbar(\"value\",count);\n\t\t\t\t\t\t\t //$(\"#countdown\").text((count)+\"\");\n\t\t\t\t\t\t\t if (count <= 0)\n\t\t\t\t\t\t\t {\n\t\t\t\t\t\t\t questcheckresult(true);\n\t\t\t\t\t\t\t return;\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tsetTimeout(function(){\n\t\t\t\t\t\t\t\t$(\\'#quizbreath span\\').text(\"Auf die Plätze!\");\n\t\t\t\t\t\t\t},3000);\n\t\t\t\t\t\t\tsetTimeout(function(){\n\t\t\t\t\t\t\t\t$(\\'#quizbreath span\\').text(\"Fertig...\");\n\t\t\t\t\t\t\t},4000);\n\t\t\t\t\t\t\tsetTimeout(function(){\n\t\t\t\t\t\t\t\t$(\\'#quizbreath span\\').text(\"Weiter gehts!\");\n\t\t\t\t\t\t\t},5000);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tsetTimeout(function(){\n\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\tcounter = setInterval(timer, 1000); \n\t\t\t\t\t\t\t\t$(\"#countdown\").progressbar({\n\t\t\t\t\t\t value: '.$question['duration'].',\n\t\t\t\t\t\t max:'.$question['duration'].'\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$(\\'#quizwrapper\\').show();\n\t\t\t\t\t\t\t\t$(\\'#quizbreath\\').hide();\n\t\t\t\t\t\t\t\t$(\".ui-dialog-buttonpane\").css(\"visibility\",\"visible\");\n\t\t\t\t\t\t\t},6000);';\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t$return['script'] .= '\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfunction abortOrPause()\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$(\"#abortOrPause\").dialog(\"open\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfunction questcomment(el)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif($(\\'#qanswers input:checked\\').length > 0)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tclearInterval(counter);\n\t\t\t\t\t\t\t\t\t$(\".ui-dialog-buttonpane button:contains(\\'Kommentar\\')\").hide();\n\t\t\t\t\t\t\t\t\t$(\"#quizwrapper input, #countdown\").hide();\n\t\t\t\t\t\t\t\t\t$(\"#quizwrapper\").css({\n\t\t\t\t\t\t\t\t\t\t\"height\":\"50%\",\n\t\t\t\t\t\t\t\t\t\t\"overflow\":\"auto\"\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t$(\"#quizcomment\").show();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tpulseError(\\'Bitte treffe erst eine Auswahl!\\')\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfunction questgonext(special)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif(special == undefined)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tspecial = 0;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tclearInterval(counter);\n\t\t\t\t\t\t\t\tajreq(\\'next\\',{answer:$(\\'.qanswers\\').serialize(),noco:$(\\'.nocheck:checked\\').length,app:\\'quiz\\',commentanswers:\"'.jsSafe($comment_aswers).'\",comment:$(\\'#quizusercomment\\').val(),qid:'.(int)$question['id'].',special:special});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfunction breaknext()\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif($(\\'#qanswers input:checked\\').length > 0)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tquestgonext(\"pause\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tpulseError(\\'Bitte treffe erst eine Auswahl!\\')\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfunction questionnext()\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif($(\\'#qanswers input:checked\\').length > 0)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tquestgonext();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tpulseError(\\'Bitte treffe eine Auswahl!\\')\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfunction questcheckresult(nowait)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif(nowait == undefined)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tnowait = false;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif(nowait || $(\\'#qanswers input:checked\\').length > 0)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tquestgonext(\"result\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tpulseError(\\'Bitte treffe erst eine Auswahl!\\')\n\t\t\t\t\t\t\t\t}\t\n\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$(\"li.noanswer\").click(function(){\n\t\t\t\t\t\t\t\tsetTimeout(function(){\n\t\t\t\t\t\t\t\t\tif($(\"input.nocheck:checked\").length > 0)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t$(\"li.answer input\").each(function(){\n\t\t\t\t\t\t\t\t\t\t\tthis.checked = false;\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},50);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$(\"li.answer input\").click(function(){\n\t\t\t\t\t\t\t\tif(this.checked)\n\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}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$(\"li.answer, li.noanswer\").click(function(ev){\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tvar nName = ev.target.nodeName.toLowerCase();\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif(nName == \"li\" || nName == \"label\")\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tif($(this).children(\"label\").children(\"input:checked\").length >= 1)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t$(this).children(\"label\").children(\"input\")[0].checked = false;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t$(this).children(\"label\").children(\"input\")[0].checked = true;\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\t\n\t\t\t\t\t\t\t$(\"li.answer\").click(function(){\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif($(\"li.answer input:checked\").length > 0)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t$(\"input.nocheck\")[0].checked = false;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\n\t\t\t\t\t\t\tvar width = 1000;\n\t\t\t\t\t\t\tif($(window).width() < 1000)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\twidth = ($(window).width()-40);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t$(\"#'.$dia->getId().'\").dialog(\"option\",{\n\t\t\t\t\t\t\t\twidth:width,\n\t\t\t\t\t\t\t\theight:($(window).height()-40)\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t$(window).resize(function(){\n\t\t\t\t\t\t\t\tvar width = 1000;\n\t\t\t\t\t\t\t\tif($(window).width() < 1000)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\twidth = ($(window).width()-40);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t$(\"#'.$dia->getId().'\").dialog(\"option\",{\n\t\t\t\t\t\t\t\t\twidth:width,\n\t\t\t\t\t\t\t\t\theight:($(window).height()-40)\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\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t' . $quizbreath;\n\t\t\t\t\t\treturn $return;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t$i++;\n\t\t\t\t\t\tS::set('quiz-index',$i);\n\t\t\t\t\t\treturn array(\n\t\t\t\t\t\t\t'status' => 1,\n\t\t\t\t\t\t\t'script' => 'pulseError(\"Diese Frage hat Keine Antworten, überspringe...\");ajreq(\"next\",{app:\"quiz\"});'\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\telse\n\t\t\t{\n\t\t\t\treturn $this->quizResult();\n\t\t\t}\n\t\t}\n\t\t\n\t\t$i++;\n\t\tS::set('quiz-index',$i);\n\t\treturn array(\n\t\t\t\t'status' => 1,\n\t\t\t\t'script' => 'pulseError(\"Es ist ein Fehler aufgetreten, Frage wird übersprungen\");ajreq(\"next\",{app:\"quiz\"});'\n\t\t);\n\t\t\n\t}",
"function ipal_create_genericq($courseid){\r\n global $DB;\r\n global $USER;\r\n global $COURSE;\r\n $contextid = $DB->get_record('context', array('instanceid'=>\"$courseid\",'contextlevel'=>'50'));\r\n $contextID = $contextid->id;\r\n $categories = $DB->get_records_menu('question_categories',array('contextid'=>\"$contextID\"));\r\n $categoryid = 0;\r\n foreach ($categories as $key => $value){\r\n if(preg_match(\"/Default\\ for/\",$value)){\r\n if(($value == \"Default for \".$COURSE->shortname) or ($categoryid == 0)){$categoryid = $key;}\r\n }\r\n }\r\n if(!($categoryid > 0)){\r\n echo \"\\n<br />Error obtaining categoryid\\n<br />\";\r\n return false;\r\n }\r\n $qmultichoicecheckid = $DB->count_records('question', array('category'=>\"$categoryid\",'name'=>'Generic multichoice question (1-8)'));\r\n $qessaycheckid = $DB->count_records('question', array('category'=>\"$categoryid\",'name'=>'Generic essay question'));\r\n if(($qmultichoicecheckid>0) and ($qessaycheckid > 0)){\r\n return true;\r\n }\r\n $hostname = 'unknownhost';\r\n if (!empty($_SERVER['HTTP_HOST'])) {\r\n $hostname = $_SERVER['HTTP_HOST'];\r\n } else if (!empty($_ENV['HTTP_HOST'])) {\r\n $hostname = $_ENV['HTTP_HOST'];\r\n } else if (!empty($_SERVER['SERVER_NAME'])) {\r\n $hostname = $_SERVER['SERVER_NAME'];\r\n } else if (!empty($_ENV['SERVER_NAME'])) {\r\n $hostname = $_ENV['SERVER_NAME'];\r\n }\r\n $date = gmdate(\"ymdHis\");\r\n $stamp = $hostname .'+'. $date .'+'.ipal_random_string(6);\r\n $version = $hostname .'+'. $date .'+'.ipal_random_string(6);\r\n $questionFieldArray=array('category','parent','name','questiontext','questiontextformat','generalfeedback','generalfeedbackformat','defaultgrade','penalty','qtype','length','stamp','version','hidden','timecreated','timemodified','createdby','modifiedby');\r\n $questionNotNullArray=array('name','questiontext','generalfeedback');\r\n\t$questioninsert = new stdClass();\r\n\t$date = gmdate(\"ymdHis\");\r\n\t$stamp = $hostname .'+'. $date .'+'.ipal_random_string(6);\r\n\t$version = $hostname .'+'. $date .'+'.ipal_random_string(6);\r\n\t$questioninsert -> category = $categoryid;\r\n\t$questioninsert -> parent = 0;\r\n\t$questioninsert ->questiontextformat = 1;\r\n\t$questioninsert ->generalfeedback = ' ';\r\n\t$questioninsert ->generalfeedbackformat = 1;\r\n\t$questioninsert ->defaultgrade = 1;\r\n\t$questioninsert ->penalty = 0;\r\n\t$questioninsert ->length = 1;\r\n\t$questioninsert->stamp = $stamp;\r\n\t$questioninsert->version = $version;\r\n\t$questioninsert ->hidden = 0;\r\n\t$questioninsert->timecreated = time();\r\n\t$questioninsert->timemodified = time();\r\n\t$questioninsert->createdby = $USER -> id;\r\n\t$questioninsert->modifiedby =$USER -> id;\r\n if ($qmultichoicecheckid == 0){\r\n \t$questioninsert ->name = 'Generic multichoice question (1-8)';//$title;\r\n \t$questioninsert ->questiontext = 'Please select an answer.';//.$text;\r\n \t$questioninsert ->qtype = 'multichoice';\r\n \t$lastinsertid = $DB->insert_record('question', $questioninsert);\r\n $answerFieldArray=array('answer','answerformat','fraction','feedback','feedbackformat');\r\n $answerNotNullArray =array('answer','feedback');\r\n if(!($lastinsertid > 0)){\r\n echo \"\\n<br />Error creating Generic multichoice question\\n<br />\";\r\n return false;\r\n }\r\n\t\tfor($n=1;$n<9;$n++){\r\n\t\t\t$answerInsert = new stdClass();\r\n\t\t\t$answerInsert->answer = $n;\r\n\t\t\t$answerInsert->question = $lastinsertid;\r\n\t\t\t$answerInsert ->format = 1;\r\n\t\t\t$answerInsert ->fraction = 1;\r\n\t\t\t$answerInsert ->feedback = ' ';\r\n\t\t\t$answerInsert ->feedbackformat = 1;\r\n\t\t\t$lastAnswerinsertid[$n] = $DB->insert_record('question_answers',$answerInsert);\r\n\t\t\tif(!($lastAnswerinsertid[$n] > 0)){\r\n\t\t\t\techo \"\\n<br />Error inserting answer $n for Generic multichoice question (1-8)\\n<br />\";\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\t\t$multichoiceFieldArray = array('question','layout','answers','single','shuffleanswers','correctfeedback','correctfeedbackformat','partiallycorrectfeedback','partiallycorrectfeedbackformat','incorrectfeedback','incorrectfeedbackformat','answernumbering');\r\n\t\t$multichoiceNotNullArray = array('correctfeedback','partiallycorrectfeedback','incorrectfeedback');\r\n\t\t$qtypeInsert = new stdClass();\r\n\t\t$qtypeInsert->answers = join(',',$lastAnswerinsertid);\r\n\t\t$qtypeInsert->single = 1;\r\n\t\t$qtypeInsert->correctfeedbackformat = 1;\r\n\t\t$qtypeInsert->partiallycorrectfeedbackformat = 1;\r\n\t\t$qtypeInsert->incorrectfeedbackformat = 1;\r\n\t\t$qtypeInsert->correctfeedback = ' ';\r\n\t\t$qtypeInsert->partiallycorrectfeedback = ' ';\r\n\t\t$qtypeInsert->incorrectfeedback = ' ';\r\n\t\t$qtypeInsert->answernumbering = '123';\r\n\t\t$qtypeInsert->question = $lastinsertid;\r\n\t\t$qtypeTable = 'question_'.$questioninsert->qtype;\r\n\t\t$qtypeInsert->shuffleanswers = '0';\r\n\t\t$qtypeinsertid = $DB->insert_record($qtypeTable, $qtypeInsert);\r\n\t}\r\n\tif ($qessaycheckid == 0){\r\n \t$questioninsert ->name = 'Generic essay question';//$title;\r\n \t$questioninsert ->questiontext = 'Please answer the question in the space provided.';//.$text;\r\n \t$questioninsert ->qtype = 'essay';\r\n \t$lastinsertid = $DB->insert_record('question', $questioninsert);\r\n\t\t$essayoptions = new stdClass;\r\n\t\t$essayoptions->questionid = $lastinsertid;\r\n\t\t$essayoptions->responsefieldlines = 3;\r\n\t\t$essayoptionsid = $DB->insert_record('qtype_essay_options',$essayoptions);\r\n }\r\n return true; \r\n}",
"public function generateQuestion()\n\t{\n\t\t//get random question type\n\t\t$type = $this->questionTypes[array_rand($this->questionTypes)];\n\n\t\t//get random section\n\t\t$section = $this->getRandomSection();\n\n\t\t//get random function (within the above section)\n\t\t$function = $this->getRandomFunction($section);\n\n\t\t$question = [];\n\t\t$question['type'] = $type;\n\t\t$question['section'] = $section;\n\t\t$question['function'] = $function;\n\t\t$question['text'] = \"{$section} now, {$this->questionTextPerType[$type]}\";\n\t\t$question['choices'] = [];\n\t\t$question['answer_text'] = '';\n\t\t$question['answer_index'] = '';\t//in ['choices'] array\n\n\n\t\treturn $this->fillQuestion($question);\n\t}",
"function run()\n\t{\n\t\trequire_code('quiz');\n\n\t\t$questions=array();\n\n\t\t$text=post_param('text');\n\t\t$type=post_param('type');\n\n\t\t$_qs=explode(chr(10).chr(10),$text);\n\t\t$qs=array();\n\t\tforeach ($_qs as $q)\n\t\t{\n\t\t\t$q=trim($q);\n\t\t\tif ($q!='') $qs[]=$q;\n\t\t}\n\t\t$num_q=0;\n\n\t\t$qs2=array();\n\t\tforeach ($qs as $i=>$q)\n\t\t{\n\t\t\t$_as=explode(chr(10),$q);\n\t\t\t$as=array();\n\t\t\tforeach ($_as as $a)\n\t\t\t{\n\t\t\t\tif ($a!='') $as[]=$a;\n\t\t\t}\n\t\t\t$q=array_shift($as);\n\t\t\t$matches=array();\n\t\t\t//if (preg_match('#^(\\d+)\\)?(.*)#',$q,$matches)===false) continue;\n\t\t\tif (preg_match('#^(.*)#',$q,$matches)===false) continue;\n\t\t\tif (count($matches)==0) continue;\n\n\t\t\t$implicit_question_number=$i;//$matches[1];\n\n\t\t\t$qs2[$implicit_question_number]=$q.chr(10).implode(chr(10),$as);\n\t\t}\n\t\tksort($qs2);\n\n\t\tforeach (array_values($qs2) as $i=>$q)\n\t\t{\n\t\t\t$_as=explode(chr(10),$q);\n\t\t\t$as=array();\n\t\t\tforeach ($_as as $a)\n\t\t\t{\n\t\t\t\tif ($a!='') $as[]=$a;\n\t\t\t}\n\t\t\t$q=array_shift($as);\n\t\t\t$matches=array();\n\t\t\t//if (preg_match('#^(\\d+)\\)?(.*)#',$q,$matches)===false) continue;\n\t\t\tif (preg_match('#^(.*)#',$q,$matches)===false) continue;\n\t\t\tif (count($matches)==0) continue;\n\t\t\t$question=trim($matches[count($matches)-1]);\n\t\t\t$long_input_field=(strpos($question,' [LONG]')!==false)?1:0;\n\t\t\t$question=str_replace(' [LONG]','',$question);\n\t\t\t$num_choosable_answers=(strpos($question,' [*]')!==false)?count($as):((count($as)>0)?1:0);\n\t\t\t$question=str_replace(' [*]','',$question);\n\t\t\t$required=(strpos($question,' [REQUIRED]')!==false)?1:0;\n\t\t\t$question=str_replace(' [REQUIRED]','',$question);\n\n\t\t\t// Now we add the answers\n\t\t\t$answers=array();\n\t\t\tforeach ($as as $x=>$a)\n\t\t\t{\n\t\t\t\t$is_correct=((($x==0) && (strpos($qs2[$i],' [*]')===false) && ($type!='SURVEY')) || (strpos($a,' [*]')!==false))?1:0;\n\t\t\t\t$a=str_replace(' [*]','',$a);\n\n\t\t\t\tif (substr($a,0,1)==':') continue;\n\n\t\t\t\t$answers[]=array(\n\t\t\t\t\t'id'=>$x,\n\t\t\t\t\t'q_answer_text'=>$a,\n\t\t\t\t\t'q_is_correct'=>$is_correct,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t$questions[]=array(\n\t\t\t\t'id'=>$i,\n\t\t\t\t'q_long_input_field'=>$long_input_field,\n\t\t\t\t'q_num_choosable_answers'=>$num_choosable_answers,\n\t\t\t\t'q_question_text'=>$question,\n\t\t\t\t'answers'=>$answers,\n\t\t\t\t'q_required'=>$required,\n\t\t\t);\n\n\t\t\t$num_q++;\n\t\t}\n\n\t\t$preview=render_quiz($questions);\n\n\t\treturn array(do_template('FORM',array('SUBMIT_NAME'=>'','TEXT'=>'','URL'=>'','HIDDEN'=>'','FIELDS'=>$preview)),NULL);\n\t}",
"function AddTesteeQuestions($testEntryID, $examQAs)\n {\n try\n {\n if (count($examQAs) < 1)\n {\n return;\n }\n \n $db = GetDBConnection();\n \n $qCount = 1;\n $questions = array();\n foreach ($examQAs as $qa)\n {\n $questionID = $qa->GetQuestionId();\n $question = GetQuestion($questionID);\n \n if ($question != FALSE)\n {\n $aCount = 1;\n $answers = GetQuestionAnswers($questionID);\n \n for ($i = 0; $i < count($answers); $i++)\n {\n $chosen = '0';\n $answer = $answers[$i];\n $answer['AnswerNo'] = $aCount;\n \n if ($answer[GetAnswerIdIdentifier()] == $qa->GetAnswerId())\n {\n $chosen = '1';\n }\n \n $answer['Chosen'] = $chosen;\n \n $answers[$i] = $answer;\n \n $aCount++;\n }\n \n $question['QuestionNo'] = $qCount;\n $question['Answers'] = $answers;\n \n $questions[] = $question;\n \n $qCount++;\n }\n }\n \n $qQuery = 'INSERT INTO ' . GetTesteeQuestionsIdentifier()\n . ' (' . GetTestIdIdentifier()\n . ', ' . 'QuestionNo'\n . ', ' . 'Level'\n . ', ' . 'Instructions'\n . ', ' . 'Question' . ') VALUES';\n \n $aQuery = 'INSERT INTO ' . GetTesteeAnswersIdentifier()\n . ' (' . GetTestIdIdentifier()\n . ', ' . 'QuestionNo'\n . ', ' . 'AnswerNo'\n . ', ' . 'Answer'\n . ', ' . 'Correct'\n . ', ' . 'Chosen' . ') VALUES';\n \n foreach($questions as $question)\n {\n $answers = $question['Answers'];\n $questionNo = $question['QuestionNo'];\n \n $qQuery .= ' (:' . GetTestIdIdentifier()\n . ', :' . 'QuestionNo' . $questionNo\n . ', :' . 'Level' . $questionNo\n . ', :' . 'Instructions' . $questionNo\n . ', :' . 'Question' . $questionNo . '),';\n \n foreach($answers as $answer)\n {\n $answerNo = $answer['AnswerNo'];\n \n $aQuery .= ' (:' . GetTestIdIdentifier()\n . ', :' . 'QuestionNo' . $questionNo . $answerNo\n . ', :' . 'AnswerNo' . $questionNo . $answerNo\n . ', :' . 'Answer' . $questionNo . $answerNo\n . ', :' . 'Correct' . $questionNo . $answerNo\n . ', :' . 'Chosen' . $questionNo . $answerNo . '),';\n }\n }\n \n $qQuery = rtrim($qQuery, ',') . ';';\n $aQuery = rtrim($aQuery, ',') . ';';\n \n $qStatement = $db->prepare($qQuery);\n $aStatement = $db->prepare($aQuery);\n \n foreach($questions as $question)\n {\n $answers = $question['Answers'];\n $questionNo = $question['QuestionNo'];\n \n foreach($answers as $answer)\n {\n $answerNo = $answer['AnswerNo'];\n \n $aStatement->bindValue(':' . GetTestIdIdentifier(), $testEntryID);\n $aStatement->bindValue(':' . 'QuestionNo' . $questionNo . $answerNo, $questionNo);\n $aStatement->bindValue(':' . 'AnswerNo' . $questionNo . $answerNo, $answerNo);\n $aStatement->bindValue(':' . 'Answer' . $questionNo . $answerNo, $answer[GetNameIdentifier()]);\n $aStatement->bindValue(':' . 'Chosen' . $questionNo . $answerNo, $answer['Chosen']);\n $aStatement->bindValue(':' . 'Correct' . $questionNo . $answerNo, $answer['Correct']);\n }\n \n $qStatement->bindValue(':' . GetTestIdIdentifier(), $testEntryID);\n $qStatement->bindValue(':' . 'QuestionNo' . $questionNo, $questionNo);\n $qStatement->bindValue(':' . 'Level' . $questionNo, $question['Level']);\n $qStatement->bindValue(':' . 'Instructions' . $questionNo, $question['Instructions']);\n $qStatement->bindValue(':' . 'Question' . $questionNo, $question[GetNameIdentifier()]);\n }\n \n $qStatement->execute();\n $qStatement->closeCursor();\n \n $aStatement->execute();\n $aStatement->closeCursor();\n }\n catch (PDOException $ex)\n {\n LogError($ex);\n }\n }"
] |
[
"0.7419718",
"0.69667053",
"0.6091967",
"0.59769595",
"0.59140337",
"0.59006685",
"0.58695",
"0.5824834",
"0.5824834",
"0.5812037",
"0.5787143",
"0.5611998",
"0.5593689",
"0.55851674",
"0.55851674",
"0.55576384",
"0.55356145",
"0.55082655",
"0.54741",
"0.54672533",
"0.546011",
"0.5459856",
"0.54529685",
"0.5437471",
"0.54250735",
"0.5421473",
"0.54054976",
"0.5381747",
"0.53723204",
"0.53482777"
] |
0.70966285
|
1
|
Initialise Gateway Settings Store all settings in a single database entry and make sure the $settings array is either the default or the settings stored in the database.
|
public function init_settings() {
// Load form_field settings
$this->settings = get_option($this->plugin_id . $this->id . '_settings', null);
if (!$this->settings || !is_array($this->settings)) {
$this->settings = array();
// If there are no settings defined, load defaults
if ($form_fields = $this->get_form_fields())
foreach ($form_fields as $k => $v)
$this->settings[$k] = isset($v['default']) ? $v['default'] : '';
}
if ($this->settings && is_array($this->settings)) {
$this->settings = array_map(array($this, 'format_settings'), $this->settings);
$this->enabled = isset($this->settings['enabled']) && $this->settings['enabled'] == 'yes' ? 'yes' : 'no';
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function ensureSettings() {\n $settings = $this->getSettings();\n if (!$settings) {\n $defaults = $this->getDefaultSettings();\n add_option($this->getSettingsKey(), $defaults, '', 'yes');\n }\n }",
"public function initialize_settings() {\n\n\t\t$default_settings = array();\n\n\t\tforeach ($this->settings as $id => $setting) {\n\t\t\tif ($setting['type'] != 'heading')\n\t\t\t\t$default_settings['$id'] = $setting['std'];\n\t\t}\n\n\t\tupdate_option('eaboot_options', $default_settings);\n\t}",
"private function getSettings(){\n $settings = Auth::user()->settings;\n if(!$settings){\n $settings = new \\App\\Setting;\n $settings->user_id = Auth::id();\n foreach(Cons::$default_settings as $key => $value){\n $settings->{$key} = $value;\n }\n $settings->save();\n return Cons::$default_settings;\n }\n return $settings; // return created settings\n }",
"public function initSettings()\n {\n register_setting('flickr_group_gallery_settings', 'flickr_group_gallery_api_key');\n register_setting('flickr_group_gallery_settings', 'flickr_group_gallery_api_secret');\n register_setting('flickr_group_gallery_settings', 'flickr_group_gallery_cache_path');\n register_setting('flickr_group_gallery_settings', 'flickr_group_gallery_cache_expires');\n }",
"private function syncronize() {\n\t\t$existingsOptions = get_option( $this->getGatewayKey() );\n\n\t\t// Get the saved options in the object\n\t\t$options = $this->getSettings();\n\n\t\t// If options exists we need to merge them with the default ones\n\t\tif ( $existingsOptions ) {\n\t\t\tforeach ( $existingsOptions as $option ) {\n\t\t\t\tif ( isset( $options[ $option->getName() ] ) )\n\t\t\t\t\t$options[ $option->getName() ]->setValue( $option->getValue() );\n\t\t\t}\n\t\t}\n\n\t\t//$this->addSettings( $options );\n\t}",
"public function initSettingsData()\n {\n $this->maximum_users_per_group = 5;\n $this->maximum_user_group_memberships = 3;\n $this->maximum_groups_own_per_user = 3;\n $this->maximum_points_group = 200;\n //$this->mail_group_invite_template = 'dma.friends::mail.invite'; \n $this->reset_groups_every_day = $this->days;\n $this->reset_groups_time = '00:00';\n }",
"public function init_settings()\n {\n /** @noinspection PhpUndefinedClassInspection */\n parent::init_settings();\n\n $sharedOptions = get_option(SharedPersistor::OPTION_NAME, []) ?: [];\n $this->settings = array_merge($this->settings, $sharedOptions);\n }",
"function myprefix_init_settings() {\t\n\t\n\t// Settings section:\n\t// Multiple settings can go into this section after we set it up.\n\t// We are going to add three settings into this one section.\n\t\tadd_settings_section(settingsSectionOneSlug, settingsSectionOneTitle, \n\t\t\tsettingsSectionOneCallbackFunction, settingsPageID);\n\t\n\t// Settings field:\n\t// We add settings fields to our settings section:\n\t\tadd_settings_field(settingOneSlug, settingOneTitle, settingOneCallbackFunction, \n\t\t\tsettingsPageID, settingsSectionOneSlug, array( 'label_for' => settingOneSlug ));\n\t\tadd_settings_field(settingTwoSlug, settingTwoTitle, settingTwoCallbackFunction, \n\t\t\tsettingsPageID, settingsSectionOneSlug, array( 'label_for' => settingTwoSlug ));\n\t\tadd_settings_field(settingThreeSlug, settingThreeTitle, settingThreeCallbackFunction, \n\t\t\tsettingsPageID, settingsSectionOneSlug, array( 'label_for' => settingThreeSlug ));\n\t\n\t// Setting:\n\t// Now we register our settings:\n\t\tregister_setting(settingsPageID, settingOneSlug, settingOneValidationFunction);\n\t\tregister_setting(settingsPageID, settingTwoSlug, settingTwoValidationFunction);\n\t\tregister_setting(settingsPageID, settingThreeSlug, settingThreeValidationFunction);\n}",
"function wshop_settings_init(){\n register_setting('wshop_settings', 'wshop_api_key');\n register_setting('wshop_settings', 'wshop_domain', 'remove_protocol');\n // register_setting('wshop_settings', 'wshop_app_id');\n register_setting('wshop_settings', 'wshop_rewrite_slug');\n register_setting('wshop_settings', 'wshop_collections_slug');\n }",
"function settings_init()\n\t{\n\t\t//-----------------------------------------\n\t\t// Load the settings lib\n\t\t//-----------------------------------------\n\t\t\n\t\t$settings = $this->ipsclass->load_class( ROOT_PATH.'sources/action_admin/settings.php', 'ad_settings' );\n\t\t\n\t\t//-----------------------------------------\n\t\t// Have we created this setting group yet?\n\t\t//-----------------------------------------\n\t\t\n\t\t$group = $this->ipsclass->DB->build_and_exec_query( array( 'select' => 'conf_title_id', 'from' => 'conf_settings_titles', 'where' => \"conf_title_keyword='umi'\" ) );\n\t\t\n\t\tif ( !$group['conf_title_id'] )\n\t\t{\n\t\t\t$this->ipsclass->DB->do_insert( 'conf_settings_titles', array( 'conf_title_title' => 'Universal Mod Installer',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t 'conf_title_desc' => 'Install and manage all compatible mods',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t 'conf_title_count' => 0,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t 'conf_title_noshow' => 1,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t 'conf_title_keyword' => 'umi',\n\t\t\t\t\t\t\t\t\t\t )\t\t\t\t\t\t\t\t );\n\t\t\t\n\t\t\t$group['conf_title_id'] = $this->ipsclass->DB->get_insert_id();\n\t\t}\n\t\t\n\t\t//-----------------------------------------\n\t\t// Define our settings\n\t\t//-----------------------------------------\n\t\t\n\t\t$umi_settings = array( 'umi_mods_perpage' => array( 'conf_title' => 'Number of mods to display per page',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'conf_description' => 'How many mods do you want to display per page on the mods list?',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'conf_type' => 'input',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'conf_default' => 10,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'conf_extra' => '',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'conf_evalphp' => '',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'conf_position' => 1,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'conf_start_group' => 'Universal Mod Installer settings',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'conf_end_group' => 0,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'conf_help_key' => '',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t ),\n\t\t\t\t\t\t\t 'umi_do_callbacks' => array( 'conf_title' => 'Use the \\'callback\\' functions?',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'conf_description' => 'These functions can help ensure your mods are up to date, but not all hosts allow them to work.',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'conf_type' => 'yes_no',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'conf_default' => 1,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'conf_extra' => '',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'conf_evalphp' => '',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'conf_position' => 2,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'conf_start_group' => '',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'conf_end_group' => 0,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'conf_help_key' => '',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t ),\n\t\t\t\t\t\t\t 'umi_skin_recache' => array( 'conf_title' => 'Recache skins automatically?',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'conf_description' => 'If any templates are added, should the skin be automatically recached? Turn this off if installing a mod exhausts your memory at this point.',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'conf_type' => 'yes_no',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'conf_default' => 1,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'conf_extra' => '',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'conf_evalphp' => '',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'conf_position' => 3,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'conf_start_group' => '',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'conf_end_group' => 1,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'conf_help_key' => '',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t ),\n\t\t\t\t\t\t\t );\n\t\t\n\t\t//-----------------------------------------\n\t\t// Ensure the settings have been created\n\t\t//-----------------------------------------\n\t\t\n\t\t$cnt = 0;\n\t\t\n\t\tforeach ( $umi_settings as $key => $value )\n\t\t{\n\t\t\tif ( !isset( $this->ipsclass->vars[ $key ] ) )\n\t\t\t{\n\t\t\t\t$cnt++;\n\t\t\t\t\n\t\t\t\t$insert = array( 'conf_title' => $value['conf_title'],\n\t\t\t\t\t\t\t\t 'conf_description' => $value['conf_description'],\n\t\t\t\t\t\t\t\t 'conf_group' => $group['conf_title_id'],\n\t\t\t\t\t\t\t\t 'conf_type' => $value['conf_type'],\n\t\t\t\t\t\t\t\t 'conf_key' => $key,\n\t\t\t\t\t\t\t\t 'conf_default' => $value['conf_default'],\n\t\t\t\t\t\t\t\t 'conf_extra' => $value['conf_extra'],\n\t\t\t\t\t\t\t\t 'conf_evalphp' => $value['conf_evalphp'],\n\t\t\t\t\t\t\t\t 'conf_protected' => 1,\n\t\t\t\t\t\t\t\t 'conf_position' => $value['conf_position'],\n\t\t\t\t\t\t\t\t 'conf_start_group' => $value['conf_start_group'],\n\t\t\t\t\t\t\t\t 'conf_end_group' => $value['conf_end_group'],\n\t\t\t\t\t\t\t\t 'conf_help_key' => $value['conf_help_key'],\n\t\t\t\t\t\t\t\t 'conf_add_cache' => 1,\n\t\t\t\t\t\t\t );\n\t\t\t\t\n\t\t\t\tif ( !$this->ipsclass->DB->field_exists( 'conf_help_key', 'conf_settings' ) )\n\t\t\t\t{\n\t\t\t\t\tunset( $insert['conf_help_key'] );\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t$this->ipsclass->DB->do_insert( 'conf_settings', $insert );\n\t\t\t}\n\t\t}\n\t\t\n\t\t//-----------------------------------------\n\t\t// Recache, if needed\n\t\t//-----------------------------------------\n\t\t\n\t\tif ( $cnt )\n\t\t{\n\t\t\t$settings->setting_rebuildcache();\n\t\t}\n\t\t\n\t\treturn TRUE;\n\t}",
"public function setup_settings() {\n\t\t$this->init_sections();\n\t\t$this->init_fields();\n\t\t$this->settings_fields();\n\t}",
"public static function init(array $settings = NULL)\n {\n parent::init($settings);\n\n if (isset($settings['ssdb_host']))\n\t {\n\t Kohana::$ssdb_host = (string) $settings['ssdb_host'];\n\t }\n\n if (isset($settings['ssdb_port']))\n\t {\n\t Kohana::$ssdb_port = (integer) $settings['ssdb_port'];\n\t }\n\n if (isset($settings['ssdb_timeout']))\n\t {\n\t Kohana::$ssdb_timeout = (integer) $settings['ssdb_timeout'];\n\t }\n }",
"function achilles_settings_init() {\n\t\n\t//create one option to store all of our values. \n register_setting( 'achilles-settings-group', 'achilles-settings' );\n add_settings_section( 'achilles-general-settings', 'General Settings', 'achilles_general_settings_callback', 'achilles' );\n add_settings_field('resident-portal', 'Resident Portal URL', 'resident_portal_url_callback', 'achilles', 'achilles-general-settings');\n add_settings_field('facebook-url', 'Facebook URL', 'facebook_url_callback', 'achilles', 'achilles-general-settings' );\n add_settings_field('google-analytics-id', 'Google Analytics ID', 'google_analytics_id_callback', 'achilles', 'achilles-general-settings');\n\t\n}",
"function setSettings($settings)\n {\n //You can use any method to keep track of settings during this session,\n //below is an example of re-using the member variable \"$settings\" to store\n //the settings, but you can just as easily store them in a var named config or\n //whatever.\n if (!is_array($settings)) {\n return false; //oops, settings are no good\n }\n foreach ($settings as $key => $value) {\n //set each setting, checking to make sure its all good first..\n if (isset($this->settings[$key])) {\n //valid setting, so set that setting.\n $this->settings[$key] = $value;\n }\n }\n }",
"public function admin_init() {\n\t\tregister_setting( $this->options_key, $this->options_key, array( $this, 'save_settings' ) );\n\t}",
"public static function save_settings($settings = array())\n\t{\n\t\t//be sure to save all settings possible\n\t\t$_tmp_settings = array_merge(self::_get_default_settings(), $settings);\n\t\t//No way to do INSERT IF NOT EXISTS so...\n\t\tforeach ($_tmp_settings as $setting_name => $setting_value)\n\t\t{\n\t\t\t$query = ee()->db->get_where(self::$_settings_table_name, array('setting_name'=>$setting_name), 1, 0);\n\t\t\tif ($query->num_rows() == 0) {\n\t\t\t // A record does not exist, insert one.\n\t\t\t $query = ee()->db->insert(self::$_settings_table_name, array('setting_name' => $setting_name, 'setting_value' => $setting_value));\n\t\t\t} else {\n\t\t\t // A record does exist, update it.\n\t\t\t $query = ee()->db->update(self::$_settings_table_name, array('setting_value' => $setting_value), array('setting_name'=>$setting_name));\n\t\t\t}\n\t\t}\n\t\tself::$_settings = $_tmp_settings;\n\t}",
"protected function updateSettings()\n {\n $this->settings = array();\n $raw_settings = $this->db->fetchAll('SELECT name, value FROM settings');\n\n foreach ($raw_settings as $raw_setting) {\n $this->settings[$raw_setting['name']] = $raw_setting['value'];\n }\n }",
"public function run()\n {\n\n Model::unguard();\n\n DB::statement('SET FOREIGN_KEY_CHECKS=0');\n DB::table('settings')->truncate();\n\n\n\n $setting = $this->findSetting('site.title');\n if (!$setting->exists) {\n $setting->fill([\n 'display_name' => __('voyager::seeders.settings.site.title'),\n 'value' => __('voyager::seeders.settings.site.title'),\n 'details' => '',\n 'type' => 'text',\n 'order' => 1,\n 'group' => 'Site',\n ])->save();\n }\n\n $setting = $this->findSetting('site.description');\n if (!$setting->exists) {\n $setting->fill([\n 'display_name' => __('voyager::seeders.settings.site.description'),\n 'value' => __('voyager::seeders.settings.site.description'),\n 'details' => '',\n 'type' => 'text',\n 'order' => 2,\n 'group' => 'Site',\n ])->save();\n }\n\n $setting = $this->findSetting('site.logo');\n if (!$setting->exists) {\n $setting->fill([\n 'display_name' => __('voyager::seeders.settings.site.logo'),\n 'value' => '',\n 'details' => '',\n 'type' => 'image',\n 'order' => 3,\n 'group' => 'Site',\n ])->save();\n }\n\n $setting = $this->findSetting('site.google_analytics_tracking_id');\n if (!$setting->exists) {\n $setting->fill([\n 'display_name' => __('voyager::seeders.settings.site.google_analytics_tracking_id'),\n 'value' => '',\n 'details' => '',\n 'type' => 'text',\n 'order' => 4,\n 'group' => 'Site',\n ])->save();\n }\n\n\n\n\n\n\n $setting = $this->findSetting('admin.bg_image');\n if (!$setting->exists) {\n $setting->fill([\n 'display_name' => __('voyager::seeders.settings.admin.background_image'),\n 'value' => 'settings\\admin\\bg.png',\n 'details' => '',\n 'type' => 'image',\n 'order' => 5,\n 'group' => 'Admin',\n ])->save();\n }\n\n $setting = $this->findSetting('admin.title');\n if (!$setting->exists) {\n $setting->fill([\n 'display_name' => __('voyager::seeders.settings.admin.title'),\n 'value' => 'Тестовое задание',\n 'details' => '',\n 'type' => 'text',\n 'order' => 1,\n 'group' => 'Admin',\n ])->save();\n }\n\n $setting = $this->findSetting('admin.description');\n if (!$setting->exists) {\n $setting->fill([\n 'display_name' => __('voyager::seeders.settings.admin.description'),\n 'value' => \"Тестовое задание доступ к панели управления\",\n 'details' => '',\n 'type' => 'text',\n 'order' => 2,\n 'group' => 'Admin',\n ])->save();\n }\n\n $setting = $this->findSetting('admin.loader');\n if (!$setting->exists) {\n $setting->fill([\n 'display_name' => __('voyager::seeders.settings.admin.loader'),\n 'value' => 'settings\\admin\\loader.png',\n 'details' => '',\n 'type' => 'image',\n 'order' => 3,\n 'group' => 'Admin',\n ])->save();\n }\n\n $setting = $this->findSetting('admin.icon_image');\n if (!$setting->exists) {\n $setting->fill([\n 'display_name' => __('voyager::seeders.settings.admin.icon_image'),\n 'value' => 'settings\\admin\\logo.png',\n 'details' => '',\n 'type' => 'image',\n 'order' => 4,\n 'group' => 'Admin',\n ])->save();\n }\n\n $setting = $this->findSetting('admin.google_analytics_client_id');\n if (!$setting->exists) {\n $setting->fill([\n 'display_name' => __('voyager::seeders.settings.admin.google_analytics_client_id'),\n 'value' => '',\n 'details' => '',\n 'type' => 'text',\n 'order' => 1,\n 'group' => 'Admin',\n ])->save();\n }\n }",
"private function initializeSettings() {\r\n global $config;\r\n $this->settings = $config;\r\n $this->fileUploadPath = $this->settings[\"uploadFolder\"];\r\n $this->fileSavePath = $this->settings[\"downloadFolder\"];\r\n $this->currentLang = $this->settings[\"lang\"];\r\n $this->currentpage = 1;\r\n }",
"public function admin_init() {\n\n\t\t// set the settings\n\n\t\t$this->setting_api->set_sections( $this->get_settings_sections());\n\t\t$this->setting_api->set_fields( $this->get_settings_fields() );\n\n\t\t// initialize settings\n\t\t$this->setting_api->admin_init();\n\t}",
"function __initSettings(&$Model, $settings) {\n\t\t$this->model = $Model;\n\t\tif (!isset($this->settings[$this->model->alias])) {\n\t\t\t$this->settings[$this->model->alias] = array(\n\t\t\t\t'host' => 'localhost',\n\t\t\t\t'port' => 8080,\n\t\t\t\t'path' => '/solr/',\n\t\t\t\t'include' => array(),\n\t\t\t\t'fields' => array(),\n\t\t\t\t'boost' => false\n\t\t\t);\n\t\t}\n\t\t$this->settings[$this->model->alias] = am($this->settings[$this->model->alias], (array)$settings);\n\t}",
"private static function setup() {\n if(!isset(self::$settings)) {\n require 'regain/global_settings.php';\n self::$settings = $settings;\n }\n }",
"public function setTemporarySettingValues(array $settings)\n\t{\n\t\t$this->settings = array_merge($this->settings, $settings);\n\t}",
"public function setSettings($settings){\r\n\t\t$this->initSettings = $settings;\r\n\t}",
"protected function load_settings() {\n\t\t$this->settings = WP_United_Settings::Create();\n\t\t$this->init_style_keys();\n\t}",
"public function init_settings() {\n\t\tparent::init_settings();\n\t\t$this->enabled = ! empty( $this->settings['enabled'] ) && 'yes' === $this->settings['enabled'] ? 'yes' : 'no';\n\t}",
"public function settings_setup($settings)\n\t{\n\t\tif(!isset($settings['S' . $this->product_prefix . '_key']))\n\t\t{\n\t\t\t//Add our 'default' paths_key option\n\t\t\t$settings['S' . $this->product_prefix . '_key'] = '';\n\t\t}\n\t\tif(!isset($settings['J' . $this->product_prefix . '_key_status']))\n\t\t{\n\t\t\t//Add our 'default' paths_key_status option\n\t\t\t$settings['J' . $this->product_prefix . '_key_status'] = 'inactive';\n\t\t}\n\t\tif(!isset($settings['J' . $this->product_prefix . '_key_site_active']))\n\t\t{\n\t\t\t//Add our 'default' Jmenu_magic_key_site_active option\n\t\t\t$settings['J' . $this->product_prefix . '_key_site_active'] = '';\n\t\t}\n\t\treturn $settings;\n\t}",
"public function plugin_settings_init() {\n\t\tregister_setting( 'plugin-boilerplate', 'plugin_settings' );\n\n\t\t//create a settings section - there can be multiple settings sections, just make sure you attribute\n\t\t//the settings fields to the sections you want\n\t\tadd_settings_section( \n\t\t\t'settings-section-id', \n\t\t\t__( 'Plugin Settings Section Title', 'plugin-text-domain' ), \n\t\t\tarray( $this, 'settings_section_callback' ), \n\t\t\t'plugin-boilerplate' );\n\n\t\t//create the settings fields, associate them with the required settings sections\n\t\tadd_settings_field( \n\t\t\t'settings-fields-id', \n\t\t\t__('Settings Fields Title', 'plugin-text-domain' ), \n\t\t\tarray( $this, 'settings_field_callback' ), \n\t\t\t'plugin-boilerplate', \n\t\t\t'settings-section-id' );\n\t\t\n\t}",
"public function prepSettings($settings)\n\t{\n\t\tif (!isset($settings['defaults']))\n\t\t{\n\t\t\t$settings['defaults'] = array();\n\t\t}\n\n\t\treturn $settings;\n\t}",
"public function init_settings()\n\t{\n\t\tregister_setting('jststm_testimonials_group', 'jststm_testimonials', function($input)\n\t\t{\n\t\t\tforeach($input as $i => $data)\n\t\t\t{\n\t\t\t\t$input[$i]['message'] = sanitize_text_field($data['message']);\n\t\t\t\t$input[$i]['author'] = sanitize_text_field($data['author']);\n\t\t\t}\n\n\t\t\treturn $input;\n\t\t});\n\t}"
] |
[
"0.6397223",
"0.63902307",
"0.63051826",
"0.62767166",
"0.62757075",
"0.623652",
"0.62250507",
"0.62164",
"0.61997765",
"0.6094793",
"0.60886085",
"0.6001734",
"0.5941662",
"0.5940215",
"0.5935266",
"0.5923227",
"0.5888221",
"0.58669966",
"0.58562356",
"0.5843336",
"0.5839005",
"0.58353883",
"0.5825873",
"0.5822726",
"0.5813808",
"0.5813742",
"0.58047503",
"0.5793671",
"0.578564",
"0.5774305"
] |
0.6487295
|
0
|
Returns a new dict ( keyedarray ) sorted by the values of the given iterable. If the optional comparator function isn't provided, the values will be sorted in ascending order.
|
function sort(iterable $iterable, ?Closure $comparator = null): array
{
$array = [];
foreach ($iterable as $k => $v) {
$array[$k] = $v;
}
if (null !== $comparator) {
uasort(
$array,
/**
* @param Tv $a
* @param Tv $b
*/
static fn(mixed $a, mixed $b): int => $comparator($a, $b)
);
} else {
asort($array);
}
return $array;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public abstract function sort(\n\t\tbool $ascending = true,\n\t\tint $flags = SORT_REGULAR,\n\t\tbool $sortByKeys = false,\n\t\tbool $preserveKeys = true\n\t): ArrayMap;",
"public function usort($comparator) {\n uasort($this->_hash, array($comparator, 'compare'));\n }",
"public function sortByKey(ComparerInterface $comparer = null)\n {\n if ($comparer === null) {\n $comparer = $this->getDefaultComparer();\n }\n ukort($this->array, array($comparer, 'compare'));\n }",
"public function sort(callable $comparator = null);",
"public function intersectByKeysUsingCallback(array $arr, callable $key_comparator): CollectionInterface;",
"public function sorted(callable $comparator = null): Sequence;",
"public static function sortByKeysAndHandler(&$array, $handler)\n {\n if (!Arr::isArray($array)) {\n throw new \\InvalidArgumentException('Param $array is not array type.');\n }\n if (!Vrbl::isCallable($handler)) {\n throw new \\InvalidArgumentException('Param $handler is not callable type.');\n }\n return uksort($array, $handler);\n }",
"public function comparator();",
"function sorted(array $array, callable|int $func = null, int $flags = 0, bool $assoc = null, bool $key = false): array\n{\n if ($key) {\n return Arrays::sortKey($array, $func, $flags);\n }\n return Arrays::sort($array, $func, $flags, $assoc);\n}",
"public static function arrSortObjsByKey($key, $order = 'DESC') {\n\treturn function($a, $b) use ($key, $order) {\n\t\t// Swap order if necessary\n\t\tif ($order == 'DESC') {\n \t \t\tlist($a, $b) = array($b, $a);\n \t\t} \n \t\t// Check data type\n \t\tif (is_numeric($a->$key)) {\n \t\t\treturn $a->$key - $b->$key; // compare numeric\n \t\t} else {\n \t\t\treturn strnatcasecmp($a->$key, $b->$key); // compare string\n \t\t}\n\t};\n}",
"public function testIterationKeySort()\r\n\t{\r\n \t\t$expected = array(\r\n\t\t\t-3 => 'eerht',\r\n\t\t\t-2 => 'owt',\r\n\t\t\t-1 => 'eno',\r\n\t\t\t0 => 'zero',\r\n\t\t\t1 => 'one',\r\n\t\t\t2 => 'two',\r\n\t\t\t3 => 'three',\r\n\t\t);\r\n\r\n\t\t// add and remove items in totally random order\r\n\t\t$this->list->set( 1, 'one' );\r\n\t\t$this->list->prepend( 'zero' );\r\n\t\t$this->list->add( 2, 'two' );\r\n\t\t$this->list->prepend( 'eno' );\r\n\t\t$this->list->remove( 0 );\r\n\t\t$this->list->append( 'three' );\r\n\t\t$this->list->set( -2, 'owt' );\r\n\t\t$this->list->prepend( 'eerht' );\r\n\t\t$this->list->set( 0, 'zero' );\r\n\r\n\t\t// make sure keys are a mess\r\n\t\t$this->assertEquals(\r\n\t\t\tarray( 1, 2, -1, 3, -2, -3, 0 ),\r\n\t\t\t$this->list->keys()\r\n\t\t);\r\n\r\n\t\t// results array\r\n\t\t$actual = array();\r\n\r\n\t\t// loop the list\r\n\t\tforeach( $this->list as $key => $value ) {\r\n\t\t\t// assign to result\r\n\t\t\t$actual[ $key ] = $value;\r\n\t\t}\r\n\r\n\t\t// should be identical\r\n\t\t$this->assertEquals( $expected, $actual );\r\n\r\n\t\t// check count\r\n\t\t$this->assertEquals( 7, $this->list->count() );\r\n\t}",
"function array_key_multi_sort(&$arr, $l , $f='strnatcasecmp') {\n\treturn usort($arr, create_function('$a, $b', \"return $f(\\$a['$l'], \\$b['$l']);\"));\n}",
"function make_comparer() {\n $criteria = func_get_args();\n foreach ($criteria as $index => $criterion) {\n $criteria[$index] = is_array($criterion) ? array_pad($criterion, 3, null) : array($criterion, SORT_ASC, null);\n }\n\n return function($first, $second) use (&$criteria) {\n foreach ($criteria as $criterion) {\n // How will we compare this round?\n list($column, $sortOrder, $projection) = $criterion;\n $sortOrder = $sortOrder === SORT_DESC ? -1 : 1;\n\n // If a projection was defined project the values now\n if ($projection) {\n $lhs = call_user_func($projection, $first[$column]);\n $rhs = call_user_func($projection, $second[$column]);\n } else {\n $lhs = $first[$column];\n $rhs = $second[$column];\n }\n\n // Do the actual comparison; do not return if equal\n if ($lhs < $rhs) {\n return -1 * $sortOrder;\n } else if ($lhs > $rhs) {\n return 1 * $sortOrder;\n }\n }\n\n return 0; // tiebreakers exhausted, so $first == $second\n };\n }",
"public function diffAssocUsing(array $items, callable $key_comparator): CollectionInterface;",
"function unique_by(iterable $iterable, callable $scalar_func): array\n{\n return Dict\\unique_by($iterable, $scalar_func);\n}",
"function sortBy(callable $function, iterable $items) : array\n{\n return Fpl\\sort(Fpl\\useWith([$function, $function], Fpl\\spaceship), $items);\n}",
"function sort_array_by_other_array($arr, $keys_arr, $num_field) {\n\t$new_arr = array();\n\t$left_arr = $arr;\n\t\n\tforeach($keys_arr as $key=>$value) {\n\t\tforeach($arr as $key2=>$value2) {\n\t\t\tif($value2[$num_field] == $value) {\n\t\t\t\t$new_arr[] = $value2;\n\t\t\t\tunset($left_arr[$key2]);\n\t\t\t}\t\n\t\t}\n\t}\t\n\t$new_arr = array_merge($new_arr, $left_arr);\n\treturn $new_arr;\n}",
"function arrayKeySort(&$array, $keys) {\n $res = array();\n foreach($keys as $key) {\n if(isset($array[$key])) {\n $res[$key] = $array[$key];\n }\n }\n return $res;\n}",
"function array_sort($array, $sortby) {\n\n $size = sizeof($array);\n\n for($i=0;$i<$size;$i++) {\n for($j=$i+1;$j<$size;$j++) {\n $temp = array();\n if($array[$i]['priority']<$array[$j]['priority']) {\n $temp = $array[$i];\n $array[$i] = $array[$j];\n $array[$j] = $temp;\n }\n }\n }\n return $array;\n}",
"public function diffKeysUsing(array $items, callable $key_comparator): CollectionInterface;",
"function build_sorter($key) {\n return function ($a, $b) use ($key) {\n return strnatcmp($b[$key], $a[$key]);\n };\n}",
"function usort(/*. array[int] .*/ $a, /*. mixed .*/ $cmp_func)\n{}",
"function orderBy(?iterable $collection, array $iteratee, array $orders): array\n{\n if (null === $collection) {\n return [];\n }\n\n return baseOrderBy($collection, $iteratee, $orders);\n}",
"public static function sortInnerValues(&$arr, $sortFn = 'sort') {\n foreach ($arr as $key => $item) {\n $sortFn($arr[$key]);\n }\n }",
"function iterable_map_keys(iterable $iterable, callable $callback): \\Generator\n{\n foreach ($iterable as $key => $value) {\n yield call_user_func($callback, $value, $key) => $value;\n }\n}",
"function make_comparer() {\n // Normalize criteria up front so that the comparer finds everything tidy\n $criteria = func_get_args();\n foreach ($criteria as $index => $criterion) {\n $criteria[$index] = is_array($criterion)\n ? array_pad($criterion, 3, null)\n : array($criterion, SORT_ASC, null);\n }\n\n return function($first, $second) use (&$criteria) {\n foreach ($criteria as $criterion) {\n // How will we compare this round?\n list($column, $sortOrder, $projection) = $criterion;\n $sortOrder = $sortOrder === SORT_DESC ? -1 : 1;\n\n // If a projection was defined project the values now\n if ($projection) {\n $lhs = call_user_func($projection, $first[$column]);\n $rhs = call_user_func($projection, $second[$column]);\n }\n else {\n $lhs = $first[$column];\n $rhs = $second[$column];\n }\n\n // Do the actual comparison; do not return if equal\n if ($lhs < $rhs) {\n return -1 * $sortOrder;\n }\n else if ($lhs > $rhs) {\n return 1 * $sortOrder;\n }\n }\n\n return 0; // tiebreakers exhausted, so $first == $second\n };\n}",
"function sortByFrequency($array = array(), $is_ascending=true){\n\t\t$key = array_keys($array);\t\t//mengambil key dari array\n\t\t$val = array_values($array);\t// mengambil value dari array\n\n\t\tfor ($i=0; $i<sizeof($key)-1; $i++) // melakukan perulangan sebanyak jumlah key\n\t for ($j=0; $j<sizeof($key)-$i-1; $j++) { //melakukan perulangan sebanyak jumlah key - i\n\t $k = $j+1;\t\t// inisialisasi k\n\t if (!$is_ascending) {\t\t// apabila asc\n\t \tif ($val[$k] > $val[$j]){ // apabila nilai ke-k > nilai ke-j\n\t \t\tlist($val[$j], $val[$k]) = array($val[$k], $val[$j]); //swap nilai\n\t \tlist($key[$j], $key[$k]) = array($key[$k], $key[$j]); //swap key\n\t \t}\n\t } elseif($val[$k] < $val[$j]){ // apabila nilai ke-k < nilai ke-j\n\t \tlist($val[$j], $val[$k]) = array($val[$k], $val[$j]);\t//swap nilai\n\t list($key[$j], $key[$k]) = array($key[$k], $key[$j]);\t//swap key\n\t }\n\t }\n\t \n\t $res = array(); // membuat array baru untuk dikembalikan\n\t for ($i=0; $i < sizeof($key); $i++) // melakukan perulangan sebanyak jumlah key\n\t \t$res[$key[$i]] = $val[$i];\t\t// menambahkan key => value ke dalam array\n\t \n\t\treturn $res; // mengembalikan nilai array yang sudah di urutkan\n\t}",
"public abstract function sortManual(\n\t\tcallable $callback,\n\t\tbool $sortByKeys = false,\n\t\tbool $preserveKeys = true\n\t): ArrayMap;",
"public function mySort(array $array);",
"function sort_array_by_array($array, $keyname_array)\n\t{\n\t$result = array();\n\tforeach($keyname_array as $key)\n\t\t{\n\t\t$result[$key] = $array[$key];\n\t\t}\n\treturn $result;\n\t}"
] |
[
"0.56830055",
"0.55051553",
"0.5455086",
"0.54309356",
"0.534282",
"0.53048",
"0.527365",
"0.52029616",
"0.5133146",
"0.51328266",
"0.51051307",
"0.5087128",
"0.50821316",
"0.5066106",
"0.5064406",
"0.5020478",
"0.49981987",
"0.49789152",
"0.49775127",
"0.49701512",
"0.4960296",
"0.49341476",
"0.49321797",
"0.49228948",
"0.48817393",
"0.4872925",
"0.4870555",
"0.48092642",
"0.47743675",
"0.47519365"
] |
0.67392766
|
0
|
Scope the query to only include non started events.
|
public function scopeNotStarted($query)
{
return $query->where('date_begin', ">", Carbon::now());
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function scopeStarted($query) {\n $query->where('start_date', '<=', Carbon::now());\n }",
"public function scopePastEventsOnly($query)\n {\n return $query->where('date_start', '<=', Carbon::now());\n }",
"public function scopeFutureEventsOnly($query)\n {\n return $query->where('date_start', '>', Carbon::now());\n }",
"public function scopeStarted($query)\n {\n return $query->where('date_begin', \"<=\", Carbon::now())->where('date_end', \">=\", Carbon::now());\n }",
"public function scopeNotActivated($query)\n {\n return $query->where($this->starts_at_field, '>', date('Y-m-d H:i:s'));\n }",
"public function ongoingEvents()\n {\n $now = Carbon::now();\n\n return Event::where('date_start', '<', $now)\n ->where('date_end', '>', $now);\n }",
"public function scopeFilterByStartDate( $query )\n { \n $date = request() -> get( 'start_date' );\n if( $date )\n {\n try \n {\n $date = Carbon :: parse( $date );\n $query -> whereDate( 'created_at', '>=', $date );\n }\n catch( \\Exception $e )\n {\n // Do nothing, it's ok.\n }\n }\n }",
"public function scopeInFuture($query){\n return $query->where('end','>=', date('Y-m-d H:i:s'));\n }",
"public function scopeUpcoming($query) {\n return $query->where('end_time', '>=', 'NOW()');\n }",
"public function scopeAvailableByEvent($query, $eventId){\n\n return $query->where('status', '=', 0)->where('event_id', '=', $eventId);\n\n }",
"public function scopeincomplete($query) \n {\n // we say 'static' as we are already within the task model\n return $query->where('completed', 0);\n }",
"public function newQueryWithoutScopes();",
"public function scopeUncompleted($query)\n {\n return $query->whereNull('completed_at');\n }",
"public function getUncommittedEvents();",
"public function scopeNotDeactivated($query)\n {\n return $query->where($this->ends_at_field, '>=', date('Y-m-d H:i:s'));\n }",
"public function scopeInventoried($query)\n {\n return $query->where('inventoried', '=', true);\n }",
"public function scopeNotWorking($query)\n {\n return $query->where('working',0)->where('active',1);\n }",
"public function scopeEnabled($query)\n {\n $query->where('enabled', 1)->whereHas('terms', function ($q) {\n $now = Carbon::now();\n $q\n ->where('start_date', '<=', $now->toDateString())\n ->where('end_date', '>=', $now->toDateString());\n });\n }",
"public function scopeNotComplete($query)\n {\n return $query->where('status', '<>', 'complete');\n }",
"public function scopeNoRead($query){\n return $query->where('read',false)->where('active',false);\n\n }",
"public function scopeDisponible($query)\n {\n $fieldEnabled = $this->getField('ENABLED');\n if ($this->existsAttribute($fieldEnabled))\n return $query->where($fieldEnabled,1);\n return $query;\n }",
"public function scopePublished($query){ \n \t$query->where('published_at','<=',Carbon::now());\n }",
"public function scopePublished($query){\n $query->where('RDate','<=',Carbon::now()->format('Y-m-d'))->where('EXDate','>=',Carbon::now()->format('Y-m-d'));\n }",
"public function scopePublished($query)\n {\n return $query->where('published_at', '!=', null);\n }",
"public function scopeUrgent($query)\n {\n $query->where('urgent', true);\n }",
"public function scopeIsTimed($query)\n\t{\n\n\t\t$date = date(\"Y-m-d\");\n\t\treturn $query\n\t\t\t->where('is_timed', '=', 1)\n\t\t\t->where('publish_start', '<=', $date . \" 00:00:00\")\n\t\t\t->where('publish_end', '>=', $date . \" 23:59:59\");\n\n\t}",
"public function scopeNotInactive($query)\n {\n return $query->where('inactive', 0);\n }",
"public function scopeUnseen($query)\n {\n return $query->where('seen', '=', false);\n }",
"public function scopePending($query)\n {\n return $query->where('status', 0);\n }",
"public function scopePublished($query)\n\t{\n\t\t$query->where('published_at', '<=', Carbon::now());\n\t}"
] |
[
"0.68658894",
"0.6809262",
"0.68086535",
"0.6640144",
"0.6439891",
"0.6246338",
"0.6222054",
"0.6114988",
"0.6107479",
"0.60865635",
"0.60248405",
"0.6005466",
"0.5921819",
"0.58918643",
"0.58851606",
"0.58804977",
"0.5867252",
"0.58590406",
"0.5846704",
"0.58239627",
"0.58222425",
"0.58161706",
"0.5804764",
"0.58040786",
"0.5789065",
"0.578702",
"0.5765908",
"0.57645595",
"0.5763001",
"0.5754627"
] |
0.7088914
|
0
|
Scope the query to only include started events.
|
public function scopeStarted($query)
{
return $query->where('date_begin', "<=", Carbon::now())->where('date_end', ">=", Carbon::now());
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function scopeStarted($query) {\n $query->where('start_date', '<=', Carbon::now());\n }",
"public function scopeFilterByStartDate( $query )\n { \n $date = request() -> get( 'start_date' );\n if( $date )\n {\n try \n {\n $date = Carbon :: parse( $date );\n $query -> whereDate( 'created_at', '>=', $date );\n }\n catch( \\Exception $e )\n {\n // Do nothing, it's ok.\n }\n }\n }",
"public function scopeNotStarted($query)\n {\n return $query->where('date_begin', \">\", Carbon::now());\n }",
"public function scopeFutureEventsOnly($query)\n {\n return $query->where('date_start', '>', Carbon::now());\n }",
"public function scopeActivated($query)\n {\n return $query->where($this->starts_at_field, '<=', date('Y-m-d H:i:s'));\n }",
"public function scopePastEventsOnly($query)\n {\n return $query->where('date_start', '<=', Carbon::now());\n }",
"public function scopeFrom($query, $from) {\n return $query->where('events.start_date_hour', '>=', $from);\n }",
"public function ongoingEvents()\n {\n $now = Carbon::now();\n\n return Event::where('date_start', '<', $now)\n ->where('date_end', '>', $now);\n }",
"public function scopeInFuture($query){\n return $query->where('end','>=', date('Y-m-d H:i:s'));\n }",
"public function scopeUpcoming($query) {\n return $query->where('end_time', '>=', 'NOW()');\n }",
"public function scopeTo($query, $to) {\n return $query->where('events.start_date_hour', '<=', $to);\n }",
"public function scopeActive($query)\n {\n $query->where('status', static::PUBLISHED);\n }",
"public function scopeEnabled($query)\n {\n $query->where('enabled', 1)->whereHas('terms', function ($q) {\n $now = Carbon::now();\n $q\n ->where('start_date', '<=', $now->toDateString())\n ->where('end_date', '>=', $now->toDateString());\n });\n }",
"public function scopeActive($query) {\n return $query->where('status', '<>', self::STATUS_COMPLETED);\n }",
"public function scopeGetActive($query) {\n\t\t\n\t\treturn $query->where('status', '<>', 9);\n\t}",
"public function scopeIsTimed($query)\n\t{\n\n\t\t$date = date(\"Y-m-d\");\n\t\treturn $query\n\t\t\t->where('is_timed', '=', 1)\n\t\t\t->where('publish_start', '<=', $date . \" 00:00:00\")\n\t\t\t->where('publish_end', '>=', $date . \" 23:59:59\");\n\n\t}",
"public function scopeInventoried($query)\n {\n return $query->where('inventoried', '=', true);\n }",
"public function scopeWithinRange($query, $start, $end)\n {\n return $query->whereDate('metadata_order.value', '>=', $start)\n ->whereDate('metadata_order.value', '<=', $end);\n }",
"public function scopeAvailableByEvent($query, $eventId){\n\n return $query->where('status', '=', 0)->where('event_id', '=', $eventId);\n\n }",
"public function scopeActive(Builder $query)\n {\n return $query->whereHas('source', function($query) {\n return $query->active();\n })->whereNotNull('date');\n }",
"public function All() {\n return $this->get_all_events( 'start_date', 'DESC', false );\n }",
"public function scopeNotActivated($query)\n {\n return $query->where($this->starts_at_field, '>', date('Y-m-d H:i:s'));\n }",
"public function scopeUpcoming($query)\n {\n return $query->whereDate('metadata_order.value', '>=', Carbon::today());\n }",
"function getCurrentEvents()\n {\n //1. Define the query\n $sql = \"SELECT * FROM events WHERE starttime < CURRENT_DATE && event_complete != 1 ORDER BY starttime\";\n\n //2. Prepare the statement\n $statement = $this->_dbh->prepare($sql);\n\n //4. Execute the query\n $statement->execute();\n\n //5. Process the results (get OrderID)\n return $statement->fetchAll(PDO::FETCH_ASSOC);\n }",
"public function scopePublished($query){\n $query->where('RDate','<=',Carbon::now()->format('Y-m-d'))->where('EXDate','>=',Carbon::now()->format('Y-m-d'));\n }",
"public function scopePublished($query){ \n \t$query->where('published_at','<=',Carbon::now());\n }",
"public function scopeincomplete($query) \n {\n // we say 'static' as we are already within the task model\n return $query->where('completed', 0);\n }",
"public function scopeWorking($query)\n {\n return $query->where('working',1)->where('active',1);\n }",
"public function event()\n {\n return $this->belongsTo(Event::class, 'event_id', 'id')->whereActive(1)\n ->where('start_at', '<', date('Y-m-d H:i:s'))\n ->where('end_at', '>', date('Y-m-d H:i:s'));\n }",
"public function scopePublished($query)\n\t{\n\t\t$query->where('published_at', '<=', Carbon::now());\n\t}"
] |
[
"0.7775167",
"0.6716673",
"0.66064984",
"0.6585067",
"0.62775064",
"0.6270628",
"0.6111483",
"0.60758907",
"0.6070289",
"0.5981551",
"0.5897425",
"0.58730745",
"0.57950944",
"0.5706399",
"0.57001233",
"0.56765765",
"0.56661993",
"0.565529",
"0.5626473",
"0.56015617",
"0.5591434",
"0.55771637",
"0.5569986",
"0.556191",
"0.55282885",
"0.5517377",
"0.5478339",
"0.54537",
"0.54242814",
"0.539226"
] |
0.75189656
|
1
|
Method for preparing a new object to be created. To be overridden in the actual controller.
|
abstract public function prepare_new_object(array $args);
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function prepareAsCreate()\n {\n $context = sfContext::hasInstance() ? sfContext::getInstance() : NULL;\n if ($context)\n {\n $context->getConfiguration()->getActive()->loadHelpers('Partial', 'I18N');\n $objStack = $this->form->getObject();\n $resource = new sfRessource($objStack->getTable()->getClassnameToReturn());\n $vars = array(\n \"ressource_id\" => $resource->getId(),\n \"entity_id\" => $objStack->getId());\n return get_component(\"eav\", \"form\", $vars);\n }\n }",
"protected function _precreate() {\n }",
"protected function create() {\n\t}",
"protected function createObjects() {\n\t\t$this->lblId = $this->mctHut->lblId_Create();\n\t\t$this->lstPosition = $this->mctHut->lstPosition_Create();\n\t\t$this->txtName = $this->mctHut->txtName_Create();\n\t}",
"public abstract function create($object);",
"function create()\n\t{\n\t\tif ($_GET[\"obj_id\"] != \"\")\n\t\t{\n\t\t\t$this->setTabs();\n\t\t}\n\t\tparent::create();\n\t}",
"public function create($obj)\n {\n }",
"public function createobject($data, Form $form, $request)\n {\n if ($this->data()->AllowUserSelection) {\n $pid = $request->postVar('CreateLocationID');\n if ($this->isParentIdValid($pid)) {\n $this->pid = $pid;\n }\n } else {\n $this->pid = $this->data()->CreateLocationID;\n }\n\n if ($this->data()->AllowUserWhenObjectExists) {\n $this->woe = $request->postVar('WhenObjectExists');\n } else {\n $this->woe = $this->data()->WhenObjectExists;\n }\n\n // create a new object or update / replace one...\n $obj = null;\n if ($this->data()->useObjectExistsHandling()) {\n $existingObject = $this->objectExists();\n if ($existingObject && $this->woe == 'Replace') {\n if ($existingObject->hasExtension('VersionedFileExtension') || $existingObject->hasExtension(Versioned::class)) {\n $obj = $existingObject;\n } else {\n $existingObject->delete();\n }\n } elseif ($existingObject && $this->woe == 'Error') {\n $form->sessionMessage(\"Error: $this->CreateType already exists\", 'bad');\n return $this->redirect($this->Link()); // redirect back with error message\n }\n }\n if (!$obj) {\n // Set $obj to $this->editObject so it's modifying the same entity provided to the form.\n // (Ensures UnsavedRelationList stuff works properly)\n $obj = $this->editObject;\n }\n\n if ($this->pid) {\n $obj->ParentID = $this->pid;\n }\n\n $obj->ObjectCreatorPageID = $this->ID;\n\n // if (!$form->validate()) {\n // \t$form->sessionMessage(\"Could not validate form\", 'bad');\n // \treturn $this->redirect($this->data()->Link());\n // }\n\n // allow extensions to change the object state just before creating.\n $this->extend('updateObjectBeforeCreate', $obj);\n\n if ($obj->hasMethod('onBeforeFrontendCreate')) {\n $obj->onBeforeFrontendCreate($this);\n }\n\n $origMode = Versioned::get_reading_mode();\n Versioned::set_stage('Stage');\n\n try {\n $form->saveInto($obj);\n } catch (ValidationException $ve) {\n Versioned::set_reading_mode($origMode);\n $form->sessionMessage(\"Could not upload file: \" . $ve->getMessage(), 'bad');\n $this->redirect($this->data()->Link());\n return;\n }\n\n // get workflow\n $workflowID = $this->data()->WorkflowDefinitionID;\n $workflow = false;\n if ($workflowID && $obj->hasExtension(WorkflowApplicable::class)) {\n if ($workflow = WorkflowDefinition::get()->byID($workflowID)) {\n $obj->WorkflowDefinitionID = $workflowID;\n }\n }\n\n $additional = $this->data()->AdditionalProperties->getValues();\n if ($additional) {\n foreach ($additional as $field => $value) {\n $obj->$field = $value;\n }\n }\n\n if (Extensible::has_extension($this->CreateType, Versioned::class)) {\n // switching to make sure everything we do from now on is versioned, until the\n // point that we redirect\n $obj->write();\n if ($this->PublishOnCreate) {\n $obj->doPublish();\n }\n } else {\n $obj->write();\n }\n\n // start workflow\n if ($workflow) {\n $svc = singleton(WorkflowService::class);\n $svc->startWorkflow($obj);\n }\n\n $this->extend('objectCreated', $obj);\n // let the object be updated directly\n // if this is a versionable object, it'll be edited on stage\n $obj->invokeWithExtensions('frontendCreated');\n\n Versioned::set_reading_mode($origMode);\n $link = $this->data()->Link();\n $link = $link . (strpos($link, \"?\") !== false ? \"&\" : \"?\") . \"new=\" . $obj->ID;\n $this->redirect($link);\n }",
"public function create(){}",
"abstract protected function createObject();",
"public function create(){\n\t\t//\n\t}",
"public function create(){\n\t\t//\n\t}",
"public function create(){\n\t\t//\n\t}",
"public function create(){\n\t\t//\n\t}",
"public function create() {\n\t\t$model = new $this->model_class;\n\t\t$model->status = 3;\n\t\t$model->author_id = Session::get('wildfire_user_cookie');\n\t\t$model->url = time();\n\t\tif(Request::get(\"title\")) $model->title = Request::get(\"title\");\n\t\telse $model->title = \"Enter Your Title Here\";\n\t\t$this->redirect_to(\"/admin/content/edit/\".$model->save()->id.\"/\");\n\t}",
"protected function CreateObjects() {\n\t\t$this->lblId = $this->mctAddress->lblId_Create();\n\t\t$this->lstPerson = $this->mctAddress->lstPerson_Create();\n\t\t$this->txtStreet = $this->mctAddress->txtStreet_Create();\n\t\t$this->txtCity = $this->mctAddress->txtCity_Create();\n\t}",
"public function create()\n\t{\n\n\n\t\t//\n\t}",
"public function create() {\n\t\t\t//\n\t\t}",
"public function create()\n {\n // Not needed cause this is coming from the item listing\n }",
"public function create()\n\t{\n\t\t\n\t\t//\n\t}",
"public function create() {\n //\n }",
"public function creating()\n {\n # code...\n }",
"public function create(){\n // enter your stuff here if you want...\n\treturn(parent::create());\n }",
"public function setCurModelObject() {\n //'cause when the Controller is called by another Controller\n //and thus the Model in the local Controller is also called remotely\n //by that remote Controller\n //$curModel = CURMODEL;\n //$this->model = new $curModel();\n\n $model = $this->CMO->model_prefix.get_class($this);\n $this->model = new $model();\n //Models' pseudo constructor cannot pass Parameters\n if(method_exists($this->model,'_construct')) {\n call_user_func_array(array($this->model,'_construct'),array());//this invokes the pseudo constructor of Model class\n }\n if(method_exists($this->model,'_'.$model)) {\n call_user_func_array(array($this->model,'_'.$model),array());//this invokes the pseudo constructor of Model class\n }\n }",
"public function create() {\r\n //\r\n }",
"public function create() {\n\t\t//\n\t}",
"public function create() {\n\t\t//\n\t}",
"public function create() {\n\t\t//\n\t}",
"public function create() {\n\t\t//\n\t}",
"public function create() {\n\t\t//\n\t}"
] |
[
"0.64539057",
"0.6325703",
"0.63123745",
"0.62933123",
"0.62919134",
"0.619301",
"0.61800444",
"0.6084957",
"0.60814303",
"0.6045303",
"0.6035242",
"0.6035242",
"0.6035242",
"0.6035242",
"0.6014944",
"0.6013776",
"0.60044175",
"0.6001884",
"0.5998275",
"0.59890157",
"0.5983081",
"0.5979291",
"0.59771144",
"0.59702754",
"0.5969515",
"0.5950572",
"0.5950572",
"0.5950572",
"0.5950572",
"0.5950572"
] |
0.6943712
|
0
|
/ arg: $query_params call by reference arg: $db_question contain current FedQuestion + FedAnswer records arg: $question contain fulcrum api question with choosen precodes (answer ids)
|
function get_query_params(&$query_params, $db_question, $question) {
$mapping_function = $db_question['FedQuestion']['queryable'];
if ($mapping_function == 'age') {
$query_params['age_from'] = min($question['PreCodes']);
$query_params['age_to'] = max($question['PreCodes']);
}
elseif ($mapping_function == 'gender') {
// two genders is same as all, so this can be excluded
if (count($question['PreCodes']) > 1) {
return;
}
$query_params['gender'] = FedMappings::$mapping_function(current($question['PreCodes']));
}
elseif (in_array($mapping_function, array('hhi'))) {
foreach ($question['PreCodes'] as $precode) {
$result = FedMappings::$mapping_function($precode);
if ($result !== false) {
$query_params[$mapping_function][] = $result;
}
}
}
elseif ($mapping_function == 'postal_code') {
foreach ($question['PreCodes'] as $precode) {
$query_params['postal_code'][] = $precode;
}
}
elseif ($mapping_function == 'dma') {
$dmas = $this->GeoZip->getDmas();
foreach ($question['PreCodes'] as $precode) {
if (array_key_exists($precode, $dmas)) {
$query_params['dma_code'][] = $precode;
}
}
}
elseif ($mapping_function == 'ethnicity') {
foreach ($question['PreCodes'] as $precode) {
$result = FedMappings::$mapping_function($precode);
if ($result !== false) {
$query_params[$mapping_function][] = $result;
}
}
}
elseif ($mapping_function == 'hispanic') {
foreach ($question['PreCodes'] as $precode) {
$result = FedMappings::$mapping_function($precode);
if ($result !== false) {
$query_params[$mapping_function][] = $result;
}
}
}
elseif ($mapping_function == 'children') {
foreach ($question['PreCodes'] as $precode) {
$result = FedMappings::$mapping_function($precode);
if ($result !== false) {
$query_params[$mapping_function][] = $result;
}
}
}
elseif ($mapping_function == 'employment') {
foreach ($question['PreCodes'] as $precode) {
$result = FedMappings::$mapping_function($precode);
if ($result !== false) {
$query_params[$mapping_function][] = $result;
}
}
}
elseif ($mapping_function == 'job') {
foreach ($question['PreCodes'] as $precode) {
$result = FedMappings::$mapping_function($precode);
if ($result !== false) {
$query_params[$mapping_function][] = $result;
}
}
}
elseif ($mapping_function == 'industry') {
foreach ($question['PreCodes'] as $precode) {
$result = FedMappings::$mapping_function($precode);
if ($result !== false) {
$query_params[$mapping_function][] = $result;
}
}
}
elseif ($mapping_function == 'organization_size') {
foreach ($question['PreCodes'] as $precode) {
$result = FedMappings::$mapping_function($precode, $question['QuestionID']);
if ($result !== false) {
if (is_array($result)) {
$query_params[$mapping_function] = isset($query_params[$mapping_function]) ? array_merge($query_params[$mapping_function], $result) : $result;
}
else {
$query_params[$mapping_function][] = $result;
}
}
}
}
elseif ($mapping_function == 'organization_revenue') {
foreach ($question['PreCodes'] as $precode) {
$result = FedMappings::$mapping_function($precode);
if ($result !== false) {
$query_params[$mapping_function][] = $result;
}
}
}
elseif ($mapping_function == 'department') {
foreach ($question['PreCodes'] as $precode) {
$result = FedMappings::$mapping_function($precode);
if ($result !== false) {
$query_params[$mapping_function][] = $result;
}
}
}
elseif ($mapping_function == 'education') {
foreach ($question['PreCodes'] as $precode) {
$result = FedMappings::$mapping_function($precode);
if ($result !== false) {
$query_params[$mapping_function][] = $result;
}
}
}
elseif ($mapping_function == 'state') { // Question_id = 96 is matched.
App::import('Model', 'GeoState');
$State = new GeoState();
foreach ($question['PreCodes'] as $precode) {
foreach ($db_question['FedAnswer'] as $answer) {
if ($precode == $answer['precode']) {
$geo_state = $State->find('first', array(
'conditions' => array(
'GeoState.state' => $answer['answer']
)
));
if ($geo_state) {
$query_params[$mapping_function][] = $geo_state['GeoState']['state_abbr'];
}
break;
}
}
}
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function buildRelatedSqlQuery($arr, $form) {\r\n\t$formId = getFormId($form);\r\n\t$sql = \"SELECT forms.description AS formName, fq1.description AS question1, fq1.id AS question_id1, fqc1.description AS choice1, fqc1.id AS choice_id1 \";\r\n\tforeach ($arr as $key => $value) {\r\n\t\tif($key == 0) continue;\r\n\t\t$sql .= \", question\".($key+1).\" \";\r\n\t\t$sql .= \", question_id\".($key+1).\" \";\r\n\t\t$sql .= \", choice\".($key+1).\" \";\r\n\t\t$sql .= \", choice_id\".($key+1).\" \";\r\n\t}\t\r\n\t$sql .= \", COUNT(fqc1.description) AS votes FROM \";\r\n\tforeach ($arr as $key => $value) {\r\n\t\tif($key == 0) continue;\r\n\t\t$sql .= \"(SELECT DISTINCT sd\".($key+1).\".sms_number AS sender, fqc\".($key+1).\".description AS choice\".($key+1).\", fqc\".($key+1).\".id AS choice_id\".($key+1).\", fq\".($key+1).\".description AS question\".($key+1).\", fq\".($key+1).\".id AS question_id\".($key+1).\", f\".($key+1).\".description AS formName, f\".($key+1).\".id AS form_id FROM survey_data AS sd\".($key+1).\" LEFT JOIN choices AS fqc\".($key+1).\" ON sd\".($key+1).\".choice_id = fqc\".($key+1).\".id LEFT JOIN questions AS fq\".($key+1).\" ON fqc\".($key+1).\".question_id = fq\".($key+1).\".id LEFT JOIN forms AS f\".($key+1).\" ON fq\".($key+1).\".form_id = f\".($key+1).\".id WHERE f\".($key+1).\".id =\".$formId.\" AND fq\".($key+1).\".question =\".$value.\") AS x\".($key+1).\", \";\r\n\t}\r\n\t$sql .= \"survey_data AS sd1 LEFT JOIN choices AS fqc1 ON sd1.choice_id = fqc1.id LEFT JOIN questions AS fq1 ON fq1.id = fqc1.question_id LEFT JOIN forms ON fq1.form_id = forms.id WHERE \";\r\n\tforeach ($arr as $key => $value) {\r\n\t\tif($key == 0) continue;\r\n\t\t$sql .= \"sd1.sms_number = x\".($key+1).\".sender AND \";\r\n\t\t$sql .= \"forms.id = x\".($key+1).\".form_id\".($key<(sizeof($arr)-1)?\" AND \":\" \");\r\n\t}\r\n\t$sql .= \"AND fq1.question =\".$arr[0].\" GROUP BY choice1, \";\t\r\n\tforeach ($arr as $key => $value) {\r\n\t\tif($key == 0) continue;\r\n\t\t$sql .= \"choice\".($key+1).($key<(sizeof($arr)-1)?\", \":\" \");\r\n\t}\r\n\t//echo $sql;\r\n\treturn $sql;\r\n}",
"function processQuiz() {\n $response = array();\n $accountId = $_GET['accountId'];\n $quizId = $_GET['quizId'];\n // for now just return the questions from the quiz if quiz is not a part of the history.\n $sql = \"SELECT count(*) as count FROM results where quizId=:quizId and accountId=:accountId\";\n try {\n $db = getConnection();\n $stmt = $db->prepare($sql);\n $stmt->bindParam(\"quizId\", $quizId);\n $stmt->bindParam(\"accountId\", $accountId);\n $stmt->execute();\n $count = $stmt->fetchObject();\n $db = null;\n } catch (PDOException $e) {\n $response[\"status\"] = ERROR;\n $response[\"data\"] = EXCEPTION_MSG;\n phpLog($e->getMessage());\n }\n if ($count->count == 0) {\n // this quiz hasn't been taken.\n // logic for package redemption at this point its null.\n $sql = \"SELECT questionIds FROM quizzes where id=:id\";\n try {\n $db = getConnection();\n $stmt = $db->prepare($sql);\n $stmt->bindParam(\"id\", $quizId);\n $stmt->execute();\n $questionIds = $stmt->fetchObject();\n $db = null;\n if ($questionIds->questionIds != null) {\n $questions = getQuestions($questionIds->questionIds);\n $response[\"status\"] = \"success\";\n $response[\"data\"] = $questions;\n } else {\n $response[\"status\"] = \"fail\";\n $response[\"data\"] = \"Something went wrong! Please drop in an email to [email protected]\";\n }\n } catch (PDOException $e) {\n $response[\"status\"] = ERROR;\n $response[\"data\"] = EXCEPTION_MSG;\n phpLog($e->getMessage());\n }\n } else {\n // you have already taken this quiz, fetch the questions and show it in results\n $response[\"status\"] = FAIL;\n $response[\"data\"] = \"You have already taken this quiz\";\n //echo '{\"error\":{\"text\":' . $msg . '}}';\n }\n sendResponse($response);\n}",
"public function getQuestions()\n {\n if (isset($_GET[\"user_id\"]) && isset($_GET[\"action_id\"]) && isset($_GET[\"attempted\"]) && isset($_GET[\"oq\"] ) ) {\n\n $user_id = $this->input->get('user_id');\n $action_id = $this->input->get('action_id');\n $attempted = $this->input->get('attempted');\n $oq = $this->input->get('oq');\n\n $questions = $this->Question_model->getQuestions($user_id, $action_id, $attempted, $oq);\n\n //var_dump($questions);\n\n foreach ($questions as $key => $question) {\n\n $questions[$key]['answer_id'] = null;\n \n if($answer_question = $this->Answer_model->getAnswer($question['question_id'])){\n if ($answer_question['isRecorded'] == 1) {\n $questions[$key]['answer_id'] = $answer_question['answer_id'];\n }\n }\n\n if ($user_id == \"142566\") $questions[$key]['answer_id'] = 18;\n\n $questions[$key]['listen_before'] = false;\n if($this->Question_model->checkUserQuestion($user_id, $question['question_id']))\n $questions[$key]['listen_before'] = true;\n \n $questions[$key]['like'] = false;\n $questions[$key]['dislike'] = false;\n $questions[$key]['report'] = false;\n $questions[$key]['pref'] = false;\n \n if($response = $this->Question_model->checkUserResponse($user_id, $question['question_id'])) {\n $questions[$key]['pref'] = true;\n $questions[$key][$response['response']] = false;\n }\n }\n echo json_encode(array('result' => array('error' => false, 'length' => sizeof($questions), 'questions' => $questions)));\n return;\n }\n else echo json_encode(array('result' => array('error' => true, 'message' => 'wrong params')));\n }",
"public function changeQuestionAndAnswers () {\n global $ilUser, $tpl, $ilTabs, $ilCtrl;\n $ilTabs->activateTab(\"editQuiz\");\n\n // update database\n // create wizard object\n include_once('class.ilObjMobileQuizWizard.php');\n $wiz = new ilObjMobileQuizWizard();\n $wiz->changeQuestionAndAnswers($this->object);\n\n $_GET['question_id'] = $_POST['question_id'];\n $this->initQuestionAndAnswersEditForm();\n\n // load changed data and display them\n }",
"function getresultquestion($qid, $clientid, $sid) \n {\n try {\n $query = \"select value as label,count(value) as value from Tbl_Analytic_EmployeeHappiness where clientId=:cli and surveyId = :sid and questionId = :qid group by value;\n\";\n $stmt = $this->DB->prepare($query);\n $stmt->bindParam(':qid', $qid, PDO::PARAM_STR);\n $stmt->bindParam(':cli', $clientid, PDO::PARAM_STR);\n $stmt->bindParam(':sid', $sid, PDO::PARAM_STR);\n $stmt->execute();\n $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);\n \n \n $query1 = \"select question from Tbl_C_HappinessQuestion where clientId=:cli and surveyId = :sid and questionId = :qid\";\n\n $stmt1 = $this->DB->prepare($query1);\n $stmt1->bindParam(':qid', $qid, PDO::PARAM_STR);\n $stmt1->bindParam(':cli', $clientid, PDO::PARAM_STR);\n $stmt1->bindParam(':sid', $sid, PDO::PARAM_STR); \n $stmt1->execute();\n $value = $stmt1->fetchAll(PDO::FETCH_ASSOC);\n \n $response[\"data\"] = $rows;\n // $response[\"question\"] = $value;\n } \n catch (PDOException $e) {\n echo $e;\n }\n return json_encode($response);\n }",
"public function updateclaimquestion(){\n try{\n\t if(isset($this->getData['operators'])){\n\t $opertaors = commonfunction::implod_array($this->getData['operators']);\n\t $update = $this->UpdateInToTable(CLAIM_QUESTIONS, array(array('operators'=>$opertaors, 'question'=>$this->getData['claimquename'], 'status'=>$this->getData['claim_status'])), \"question_id='\".$this->getData['question_id'].\"'\");\n\t }\n\t else{\n\t $update = $this->UpdateInToTable(CLAIM_QUESTIONS, array(array('question'=>$this->getData['claimquename'], 'status'=>$this->getData['claim_status'])), \"question_id='\".$this->getData['question_id'].\"'\");\n\t }\n\t}\n\tcatch (Exception $e) {\n $this->_logger->info('Class-'.__CLASS__.',Function-'.__FUNCTION__.',Line-'.__LINE__.',Error-'.$e->getMessage());\n } \n\t return $update;\n }",
"public function getQuestionsAndAnswers()\r\n{\r\n $query_string = \"SELECT questionid, ans \";\r\n $query_string .= \"FROM questions \";\r\n $query_string .= \"WHERE quizid = :quizid\";\r\n\r\n return $query_string;\r\n}",
"public function updateQuestion()\r\n{\r\n $query_string = \"UPDATE questions \";\r\n $query_string .= \"SET \";\r\n $query_string .= \"quizid = :quizid, \";\r\n $query_string .= \"question = :question, \";\r\n $query_string .= \"choice1 = :choice1, \";\r\n $query_string .= \"choice2 = :choice2, \";\r\n $query_string .= \"choice3 = :choice3, \";\r\n $query_string .= \"choice4 = :choice4, \";\r\n $query_string .= \"ans = :ans \";\r\n $query_string .= \"WHERE questionid = :questionid \";\r\n\r\n return $query_string;\r\n}",
"public function checkAnswer()\r\n{\r\n $query_string = \"SELECT ans FROM questions \";\r\n $query_string .= \"WHERE questionid = :questionid AND quizid = :quizid\";\r\n\r\n return $query_string;\r\n}",
"function tep_is_set_faq_question($current_category_id,$qid,$site_id,$search='',$page=1){\n if(isset($search) && $search) {\n $query_raw = \"select \n fqd.is_show,\n fq2c.faq_category_id,\n fqd.faq_question_id,\n fqd.romaji,\n fqd.ask,\n fqd.keywords,\n fqd.answer,\n fq.sort_order,\n fq.created_at,\n fq.updated_at,\n fqd.site_id \n from \".TABLE_FAQ_QUESTION.\" fq, \n \".TABLE_FAQ_QUESTION_DESCRIPTION.\" fqd ,\n \".TABLE_FAQ_QUESTION_TO_CATEGORIES.\" fq2c \n where fq.id = fqd.faq_question_id \n and fq.id = fq2c.faq_question_id \n and fqd.ask like '%\".$search.\"%' \n and fqd.site_id ='0' \n order by fq.sort_order,fqd.ask,fq.id \n \";\n }else if(isset($site_id)&&$site_id){\n $query_raw = \"select * from (\n select \n fqd.is_show,\n fq2c.faq_category_id,\n fqd.faq_question_id,\n fqd.romaji,\n fqd.ask,\n fqd.keywords,\n fqd.answer,\n fq.sort_order,\n fq.created_at,\n fq.updated_at,\n fqd.site_id \n from \".TABLE_FAQ_QUESTION.\" fq, \n \".TABLE_FAQ_QUESTION_DESCRIPTION.\" fqd ,\n \".TABLE_FAQ_QUESTION_TO_CATEGORIES.\" fq2c \n where fq.id = fqd.faq_question_id \n and fq.id = fq2c.faq_question_id \n and fq2c.faq_category_id = '\". $current_category_id . \"' \n order by fqd.site_id DESC\n ) c \n where site_id = \".((isset($site_id) &&\n $site_id)?$site_id:0).\" \n or site_id = 0 \n group by c.faq_question_id \n order by c.sort_order,c.ask,c.faq_question_id \n \";\n }else{\n $query_raw = \"select * from (\n select \n fqd.is_show,\n fq2c.faq_category_id,\n fqd.faq_question_id,\n fqd.romaji,\n fqd.ask,\n fqd.keywords,\n fqd.answer,\n fq.sort_order,\n fq.created_at,\n fq.updated_at,\n fqd.site_id \n from \".TABLE_FAQ_QUESTION.\" fq, \n \".TABLE_FAQ_QUESTION_DESCRIPTION.\" fqd ,\n \".TABLE_FAQ_QUESTION_TO_CATEGORIES.\" fq2c \n where fq.id = fqd.faq_question_id \n and fq.id = fq2c.faq_question_id \n and fq2c.faq_category_id = '\". $current_category_id . \"' \n order by fqd.site_id DESC\n ) c \n group by c.faq_question_id \n order by c.sort_order,c.ask,c.faq_question_id \n \";\n }\n $split = new splitPageResults($page,MAX_DISPLAY_FAQ_ADMIN,\n $query_raw,$query_number);\n $query = tep_db_query($query_raw);\n while($res = tep_db_fetch_array($query)){\n if($res['faq_question_id']==$qid){\n return true;\n }\n }\n return false;\n }",
"function loadQuestionsFromDb() \n\t{\n\t\tglobal $ilDB;\n\t\t$this->questions = array();\n\t\t$result = $ilDB->queryF(\"SELECT * FROM svy_svy_qst WHERE survey_fi = %s ORDER BY sequence\",\n\t\t\tarray('integer'),\n\t\t\tarray($this->getSurveyId())\n\t\t);\n\t\twhile ($data = $ilDB->fetchAssoc($result)) \n\t\t{\n\t\t\t$this->questions[$data[\"sequence\"]] = $data[\"question_fi\"];\n\t\t}\n\t}",
"public function getQuestionId()\r\n{\r\n $query_string = \"SELECT questionid FROM questions \";\r\n $query_string .= \"WHERE question = :question\";\r\n\r\n return $query_string;\r\n}",
"public function getQuestion()\r\n{\r\n $query_string = \"SELECT questionid, question, choice1, choice2, choice3, choice4, ans \";\r\n $query_string .= \"FROM questions \";\r\n $query_string .= \"WHERE questionid = :questionid\";\r\n\r\n return $query_string;\r\n}",
"function process_Answers_FamilyQuestion($iCurrentTemporarySurveyId) {\n\n\n\t\t$iAnswerProcessingStatus = 1;\n\t\t$sError = '';\n\n\t\t$this->load->config('question_config');\n\n\t\t$this->load->model('question_model');\n\n\t\t$questions_master_data = $this->question_model->getQuestionMasterData();\n\n\t\t//$questions_master_data \t= $this->config->item('questions_master_data');\n\t\t$answer_types_details\t= $this->config->item('answer_types_details');\n\n\n $iEnumeratorAccountNo = s('ACCOUNT_NO');\n\n $this->db->where('enumerator_account_no', s('ACCOUNT_NO'));\n $this->db->where('id', $iCurrentTemporarySurveyId);\n\t\t$oTemporarySurvey = $oRow = $this->db->get('temporary_survey')->row();\n\n\t\tif($oTemporarySurvey) {\n\n\t\t\t$aData = unserialize($oTemporarySurvey->raw_data);\n\n\t\t\tlog_message('error', print_r($_POST, true));\n\t\t\t//exit;\n\n\t\t\t//log_message('error', 'surveyee_users_new : ' . print_r($aData['surveyee_users_new'], true));\n\n\t\t\t$aNewDataSet = [];\n\n\t\t\tforeach($_POST AS $iKey => $aItem) {\n\n\t\t\t\t$aInput = array();\n\n // field name of form has been modified. there is a row number attached to field names.\n // it(++$iKey) is added in the next \"for loop\" for convinience.\n\n $aTableFieldName_to_FormFieldName_map = array(\n 'name' => 'name',\n 'gender' => 'gender',\n 'election_id' => 'election_id',\n 'aadhar_id' => 'aadhar_id',\n\n 'reservation' => 'reservation',\n 'mobile_number' => 'mobile_number',\n 'email_id' => 'email_id',\n 'whatsapp_number' => 'whatsapp_number',\n\n 'is_head_of_house' => 'is_head_of_house',\n 'relationship_to_head_of_house' => 'relationship_to_head_of_house',\n 'educational_qualification' => 'educational_qualification',\n 'employment_category' => 'employment_category',\n\n 'date_of_birth' => 'date_of_birth',\n 'marital_status' => 'marital_status',\n 'has_passport' => 'has_passport',\n 'has_driving_license' => 'has_driving_license',\n\n 'has_bank_account' => 'has_bank_account',\n 'blood_group' => 'blood_group',\n 'pension_type_id' => 'pension_type_id',\n 'insurance_type_id' => 'insurance_type_id'\n );\n\n\t\t\t\t// populate user data\n\t\t\t\t$iRowNumber = ++$iKey;\n\t\t\t\tforeach($aTableFieldName_to_FormFieldName_map AS $sTableFieldName => $sFormFieldName) {\n $value = safeText($aItem[$sFormFieldName . $iRowNumber], false, '', TRUE);\n\n // if it is empty string, then we assign NULL as the value. - because otherwise, it will affect foreign key constrains.\n // 0 cannot be considered like this, as it can be a valid response.\n $value = $value == '' ? NULL : $value;\n\n $aInput[$sTableFieldName] = $value;\n }\n\n\n\n\t\t\t\t$aNormalizedInput = array(\n\t\t\t\t\t'name' => '',\n\t\t\t\t\t'gender' => NULL,\n 'election_id' => '',\n 'aadhar_id' => '',\n\n 'reservation' => NULL,\n 'mobile_number' => '',\n\t\t\t\t\t'email_id' => '',\n\t\t\t\t\t'whatsapp_number' => '',\n\n 'is_head_of_house' => NULL,\n 'relationship_to_head_of_house' => NULL,\n\t\t\t\t\t'employment_category' => NULL,\n\t\t\t\t\t'educational_qualification' => NULL,\n\n 'date_of_birth' => NULL,\n 'marital_status' => NULL,\n 'has_passport' => NULL,\n 'has_driving_license' => NULL,\n\n 'has_bank_account' => NULL,\n 'blood_group' => NULL,\n 'pension_type_id' => NULL,\n 'insurance_type_id' => NULL\n\n\t\t\t\t);\n\n\t\t\t\t$aInput = array_merge($aNormalizedInput, $aInput);\n\n\t\t\t\t$aNewDataSet[] = $aInput;\n\t\t\t}\n\n\n\t\t\t//log_message('error', 'aNewDataSet : ' . print_r($aNewDataSet, true));\n\n\t\t\t// overwirite any existing data and store the new set of informations.\n\t\t\t$aData['surveyee_users_new'] = $aNewDataSet;\n\n\t\t\t// verify, that there is a head of family, and that there is only one head of family\n // to do\n\n\n //save data to temporary table\n\t\t\t$this->updateTemporaryTable($iEnumeratorAccountNo, $aData, 'raw_data', $iCurrentTemporarySurveyId );\n\n\t\t}\n\n\t\treturn array($iAnswerProcessingStatus, $sError);\n\t}",
"public function getQuestions()\r\n{\r\n $query_string = \"SELECT questionid, question, choice1, choice2, choice3, choice4, ans \";\r\n $query_string .= \"FROM questions \";\r\n $query_string .= \"WHERE quizid = :quizid\";\r\n\r\n return $query_string;\r\n}",
"private function question()\n\t{\n\t\t$this->qns['questionnaire']['questionnairecategories_id'] = $this->allinputs['questioncat'];\n\t\t$this->qns['questionnaire']['questionnairesubcategories_id'] = $this->allinputs['questionsubcat'];\n\t\t$this->qns['questionnaire']['label'] = $this->allinputs['question_label'];\n\n\n\t\t$this->qns['questionnaire']['question'] = $this->allinputs['question'];\n\t\t$this->qns['questionnaire']['has_sub_question'] = $this->allinputs['subquestion'];\n\n\t\tif( $this->qns['questionnaire']['has_sub_question'] == 0 )\n\t\t{\n\t\t\t$this->qns['answers']['answer_type'] = $this->allinputs['optiontype'];\n\t\t}\n\n\t\t$this->qns['questionnaire']['active'] = 1;\n\n\t\tif( $this->qns['questionnaire']['has_sub_question'] == 0 ){\n\t\t\t//This code must be skipped if sub_question is 1\n\t\t\t$optionCounter = 0;\n\t\t\tforeach ($this->allinputs as $key => $value) {\n\n\t\t\t\tif( str_is('option_*', $key) ){\n\t\t\t\t\t$optionCounter++;\n\t\t\t\t\t$this->qns['answers'][$optionCounter] = ( $this->qns['answers']['answer_type'] == 'opentext' ) ? 'Offered answer text' : $value;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}",
"public function Read($user_id, $is_admin, $questionGroupId)\n {\n\n if($is_admin)\n {\n if($questionGroupId == \"sve\"){\n $query = $this->db->prepare(\"SELECT questions.id, description, questions.theme, questiongroup.name as groupName, difficulty.name as difficultyName FROM questions \n JOIN difficulty ON difficultyId = difficulty.id \n JOIN questiongroup ON questionGroupId = questiongroup.id\n \");\n }else{\n $query = $this->db->prepare(\"SELECT questions.id, description, questions.theme, questiongroup.name as groupName, difficulty.name as difficultyName FROM questions \n JOIN difficulty ON difficultyId = difficulty.id \n JOIN questiongroup ON questionGroupId = questiongroup.id\n WHERE questiongroup.id = :questionGroupId\n \");\n\n $query->bindParam(\"questionGroupId\", $questionGroupId, PDO::PARAM_INT);\n }\n\n \n }\n else\n {\n if($questionGroupId == \"sve\"){\n $query = $this->db->prepare(\"SELECT questions.id, description, questions.theme, questiongroup.name as groupName, difficulty.name as difficultyName FROM questions \n JOIN difficulty ON difficultyId = difficulty.id \n JOIN questiongroup ON questionGroupId = questiongroup.id\n JOIN customquestionhistory ON customquestionhistory.questionId = questions.id\n WHERE customquestionhistory.userId = :userId\n \");\n\n \n }else{\n $query = $this->db->prepare(\"SELECT questions.id, description, questions.theme, questiongroup.name as groupName, difficulty.name as difficultyName FROM questions \n JOIN difficulty ON difficultyId = difficulty.id \n JOIN questiongroup ON questionGroupId = questiongroup.id\n JOIN customquestionhistory ON customquestionhistory.questionId = questions.id\n WHERE customquestionhistory.userId = :userId\n AND questiongroup.id = :questionGroupId\n \");\n\n $query->bindParam(\"questionGroupId\", $questionGroupId, PDO::PARAM_INT);\n }\n\n $query->bindParam(\"userId\", $user_id, PDO::PARAM_INT);\n \n }\n $query->execute();\n $data = array();\n while ($row = $query->fetch(PDO::FETCH_ASSOC)) {\n $data[] = $row;\n }\n return $data;\n }",
"public function getquestions(Request $request,$id='')\n { \n $postdata = file_get_contents(\"php://input\");\n $data=json_decode($postdata,true);\n $were = array('status'=>'1');\n if(isset($data['country']) && $data['country']!='')\n {\n $were1= array('country'=>$data['country']);\n $were = array_merge($were,$were1);\n }\n \n if(isset($data['state']) && $data['state']!='')\n {\n $were2= array('state'=>$data['state']);\n $were = array_merge($were,$were2);\n }\n \n if(isset($data['course']) && $data['course']!='')\n {\n $were3= array('course'=>$data['course']);\n $were = array_merge($were,$were3);\n }\n \n if(isset($data['grade']) && $data['grade']!='')\n {\n $were4= array('grade'=>$data['grade']);\n $were = array_merge($were,$were4);\n }\n \n if(isset($data['year']) && $data['year']!='')\n {\n $were5= array('year'=>$data['year']);\n $were = array_merge($were,$were5);\n }\n \n \n if(isset($data['subject']) && $data['subject']!='')\n {\n $were6= array('subject'=>$data['subject']);\n $were = array_merge($were,$were6);\n }\n \n if(isset($data['chapter']) && $data['chapter']!='')\n {\n $were7= array('chapter'=>$data['chapter']);\n $were = array_merge($were,$were7);\n }\n $weres = array();\n if(count($were) > 0 )\n {\n $weres = $were;\n unset($weres['status']); \n }\n \n $ids='';\n $result2 = array();\n $result2 = DB::table('question_answers');\n $result2->leftJoin('users', function ($result2) {\n $result2->on('users.id', '=', 'question_answers.user_id')\n ->where('users.status', '!=', 2);\n });\n $result2->leftJoin('admins', 'admins.id', '=', 'question_answers.is_admin');\n if(isset($data['country']) && $data['country']!='')\n {\n $result2 = $result2->where('question_answers.country', $data['country']);\n }\n if(isset($data['state']) && $data['state']!='')\n {\n $result2 = $result2->where('question_answers.state', $data['state']);\n }\n if(isset($data['course']) && $data['course']!='')\n {\n $result2 = $result2->where('question_answers.course', $data['course']);\n }\n if(isset($data['grade']) && $data['grade']!='')\n {\n $result2 = $result2->where('question_answers.grade', $data['grade']);\n }\n if(isset($data['year']) && $data['year']!='')\n {\n $result2 = $result2->where('question_answers.year', $data['year']);\n }\n if(isset($data['subject']) && $data['subject']!='')\n {\n $result2 = $result2->where('question_answers.subject', $data['subject']);\n }\n if(isset($data['chapter']) && $data['chapter']!='')\n {\n $result2 = $result2->where('question_answers.chapter', $data['chapter']);\n }\n $result2 = $result2->where('question_answers.qstatus','=','1');\n $result2 = $result2->select('question_answers.*');\n $result2 = $result2->orderBy(DB::raw('RAND()'))->distinct('question_answers.id')->limit(10)->get();\n \n if((count($result2) > 0 && !empty($result2)))\n { \n if($ids=='')\n {\n $ids = $result2[0]->id; \n }\n $answers = $result2;\n if(count($answers) > 0)\n {\n $totals = array();\n $all = array();\n foreach($answers as $resultk)\n {\n $totals[] = $resultk->question;\n $all[] = $resultk->id;\n } \n $input = [\n 'user_id'=>$id,\n 'test_id'=>'0',\n 'total_questions' => count($totals),\n 'attempt_answer' => '0',\n 'correct_answers' => '0',\n 'all_questions'=>implode(',',$all)\n ];\n $pre_que_id = User_test::insertoption2($input);\n User_test::updateoption($weres,$pre_que_id);\n $data['test_id']=$pre_que_id;\n \n }else\n {\n $answers=array(); \n $pre_que_id='';\n $data['test_id']=$pre_que_id;\n $data['message'] = \"no data found.\";\n $data['status'] = 0;\n $data['data'] = array();\n \n }\n $data['message'] = \"data found.\";\n $data['status'] = 1;\n $data['data'] = $answers;\n }else\n { \n $data['message'] = \"no data found.\";\n\t\t\t $data['status'] = 0;\n\t\t\t $data['data'] = array();\n }\n return json_encode($data);\n die;\n }",
"public function update_question() {\r\n $questions = stripcslashes($this->input->get('questions'));\r\n \r\n // Decode the JSON array\r\n $questions = json_decode($questions,TRUE);\r\n \r\n foreach ($questions as $question) {\r\n $data['status'] = $this->question_model->update_correct_answer($question['question_id'],$question['correct_answer']);\r\n //mysqli_next_result( $this->db->conn_id );//Free BDD\r\n }\r\n \r\n $data['status'] = $this->message->warning('U');\r\n echo json_encode($data);\r\n }",
"private function getAlcoholQuestions()\n {\n// SELECT alcohol_questions.GUID, alcohol_questions.Question, \n// alcohol_options.response0, alcohol_options.response1, \n// alcohol_options.response2, alcohol_options.response3, \n// alcohol_options.response4\n// FROM alcohol_questions\n// JOIN alcohol_options ON alcohol_options.GUID = alcohol_questions.optionsid\n \n // selecting all variables needed for the alcohol_questions part of the questionnaire to populate if record exists\n // we dont select * as any updates to the table would cause unneccessary data to be loaded such as the GUID\n $this->db->select(\"alcohol_questions.GUID, alcohol_questions.Question, \n alcohol_options.response0, alcohol_options.response1, \n alcohol_options.response2, alcohol_options.response3, \n alcohol_options.response4\"); \n $this->db->from('alcohol_questions');\n // we join the questions and options tables on the foreign key options id in alcohol_questions\n // into the GUID of alcohol_options\n $this->db->join('alcohol_options', 'alcohol_options.GUID = alcohol_questions.optionsid');\n\n $query = $this->db->get();\n return $query;\n }",
"function ipal_send_question(){\r\n\tglobal $ipal;\r\n\tglobal $DB;\r\n\tglobal $CFG;\r\n\t\r\n\t$ipal_course=$DB->get_record('ipal',array('id'=>$ipal->id));\r\n\t$record = new stdClass();\r\n\t$record->id = '';\r\n\t$record->course = $ipal_course->course;\r\n\t$record->ipal_id = $ipal->id;\r\n\t$record->quiz_id = $ipal->id;\r\n\t$record->question_id = $_POST['question'];\r\n\t$record->timemodified = time();\r\n\t if($DB->record_exists('ipal_active_questions', array('ipal_id'=>$ipal->id))){\r\n\t $mybool=$DB->delete_records('ipal_active_questions', array('ipal_id'=>$ipal->id));\r\n\t }\r\n\t$lastinsertid = $DB->insert_record('ipal_active_questions', $record);\r\n\r\n}",
"public function action_nextquestion()\r\n\t{\r\n\tORM::factory('questionbank');\r\n\t$jsonret = Model_Questionbank::to_questionanswer_json( $this->request->query('quest_id'));\r\n\t\r\n\tprint $jsonret;\r\n\t return true;\r\n\t}",
"public function getQuestionIds()\r\n{\r\n $query_string = \"SELECT questionid FROM questions \";\r\n $query_string .= \"WHERE question = :question AND questionid != :questionid\";\r\n\r\n return $query_string;\r\n}",
"public function addnewclaimquestion(){\n\tif(isset($this->getData['opertaors']) && !empty($this->getData['opertaors'])){\n\t $operators = commonfunction::implod_array($this->getData['opertaors']);\n\t}\n\telse{\n\t $operators = '';\n \t}\n\tif($this->getData['question_type']=='file'){\n\t $file_upload = 1;\n\t}else{\n\t $file_upload = 0;\n\t}\n\t$question_options ='';\n\tif($this->getData['question_type']=='select' || $this->getData['question_type']=='radio'){\n\t foreach($this->getData['questionoption'] as $key=>$que_option){\n\t\t$que_value = $this->getData['questionvalue'][$key];\n\t\t$question_options .= $que_option.'|'.$que_value.';';\n\t }\n\t}\n\tif(isset($this->getData['subquestion_a']) && $this->getData['subquestion_a']!=''){\n\t $sub_question = isset($this->getData['subquestion_a'])?$this->getData['subquestion_a']:'';\n\t $sub_que_option = isset($this->getData['subquestion_option_a'])?$this->getData['subquestion_option_a']:'';\n\t}else{\n\t $sub_question = isset($this->getData['subquestion'])?$this->getData['subquestion']:'';\n\t $sub_que_option = isset($this->getData['subquestion_option'])?$this->getData['subquestion_option']:'';\n\t}\n\t$lastinserted_id = $this->insertInToTable(CLAIM_QUESTIONS, array(array('sub_question'=>$sub_question,'sub_question_option'=>$sub_que_option,'question_type'=>$this->getData['question_type'],'question'=>$this->getData['question'],'question_options'=>$question_options,'operators'=>$operators,'file_upload'=>$file_upload,'status'=>$this->getData['claim_status'],'created_by'=>$this->Useconfig['user_id'],'created_ip'=>commonfunction::loggedinIP())));\n\treturn $lastinserted_id;\n }",
"private function json_retrieveQuestions()\n {\n // Gets the input data from the Front-End\n $input = json_decode(file_get_contents(\"php://input\"));\n// $surveyID = $_POST['surveyID'];\n $surveyID= $input->surveyID;\n\n // Gets Survey Details\n $surveyQuery = \"SELECT surveyTitle, surveyDescription FROM Surveys WHERE surveyID = :surveyID;\";\n $surveyParams = [\n \":surveyID\" => $surveyID,\n ];\n // This decodes the JSON encoded by getJSONRecordSet() from an associative array\n $resSurveyDetails = json_decode($this->recordset->getJSONRecordSet($surveyQuery, $surveyParams), true);\n $surveyTitle = $resSurveyDetails['data']['0']['surveyTitle'];\n $surveyDescription = $resSurveyDetails['data']['0']['surveyDescription'];\n\n // Gets Questions Details\n $questionsQuery = \"SELECT questionID, question, mediaPath FROM Questions WHERE surveyID = :surveyID;\";\n $questionsParams = [\n \":surveyID\" => $surveyID,\n ];\n\n // This decodes the JSON encoded by getJSONRecordSet() from an associative array\n $resQuestions = json_decode($this->recordset->getJSONRecordSet($questionsQuery, $questionsParams), true);\n $questionID = $resQuestions['data']['0']['questionID'];\n $question = $resQuestions['data']['0']['question'];\n $mediaPath = $resQuestions['data']['0']['mediaPath'];\n\n $nextpage = null;\n\n $res['status'] = 200;\n $res['message'] = \"ok\";\n $res['next_page'] = $nextpage;\n $res['surveyTitle'] = $surveyTitle;\n $res['surveyDescription'] = $surveyDescription;\n $res['questionID'] = $questionID;\n $res['question'] = $question;\n $res['mediaPath'] = $mediaPath;\n\n return json_encode($res);\n }",
"function unity_query_quiz()\r\n{\r\n $quiz_id = func_arg(0);\r\n $lilo_mongo = new LiloMongo();\r\n $lilo_mongo->selectDB('Game');\r\n $lilo_mongo->selectCollection('Quiz');\r\n $data = $lilo_mongo->findOne(array('ID' => $quiz_id));\r\n $output=array();\r\n $datebegintemp=\"\";\r\n $dateendtemp=\"\";\r\n if($data)\r\n {\r\n $output['ID'] = $data['ID'];\r\n $output['Title'] = $data['Title'];\r\n $output['Description'] = $data['Description'];\r\n $output['BrandId'] = $data['BrandId'];\r\n $output['State'] = $data['State'];\r\n $output['StartTime'] = $data['StartTime'];\r\n $output['EndTime'] = $data['EndTime'];\r\n $output['IsRandom'] = (bool)$data['IsRandom'];\r\n $output['Number'] = (int)$data['Number'];\r\n $output['Count'] = (int)$data['Count'];\r\n $output['RequiredQuiz'] = (int)$data['RequiredQuiz'];\r\n $output['RequiredQuest'] = (int)$data['RequiredQuest']; \r\n $output['RequiredItem'] = $data['RequiredItem'];\r\n $output['Reward'] = $data['Reward'];\r\n $temp_dt_question=array();\r\n foreach( $data['Questions'] as $dtquestion)\r\n {\r\n $options=array();\r\n foreach( $dtquestion['Options'] as $dtpilihan)\r\n {\r\n $options[]=array(\r\n 'Answer'=>$dtpilihan['Answer'],\r\n 'IsCorrect'=>(bool)$dtpilihan['IsCorrect'],\r\n );\r\n }\r\n $temp_dt_question[]=array(\r\n 'QuestionId'=>$dtquestion['QuestionId'],\r\n 'Question'=>$dtquestion['Question'],\r\n 'Difficulty'=>$dtquestion['Difficulty'],\r\n 'QuestionTime'=>$dtquestion['QuestionTime'],\r\n 'Tipe'=>$dtquestion['Tipe'],\r\n 'Image'=>(($dtquestion['Image']==\"\")?\"\":$dtquestion['Image']),\r\n 'Options'=>$options,\r\n );\r\n } \r\n $output['Questions'] = $temp_dt_question;\r\n if($data['EndDate']!='')\r\n {\r\n $dateendtemp=date('Y-m-d', $data['EndDate']->sec);\r\n }\r\n if($data['StartDate']!='')\r\n {\r\n $datebegintemp=date('Y-m-d', $data['StartDate']->sec);\r\n }\r\n $output['EndDate'] = $dateendtemp;\r\n $output['StartDate'] = $datebegintemp;\r\n }\r\n return json_encode($output);\r\n}",
"function buldSqlQuery($arr, $form) {\r\n\t$formId = getFormId($form);\r\n\r\n\t$sql = \"SELECT count(b.id) AS vote, b.description AS choice, b.id AS choice_id, c.description AS question, c.id AS questionId, d.description AS formName FROM survey_data AS a LEFT JOIN choices AS b ON a.choice_id = b.id LEFT JOIN questions AS c ON c.id = b.question_id LEFT JOIN forms AS d ON c.form_id = d.id WHERE c.form_id=$formId AND (\";\r\n\r\n\tforeach ($arr as $key => $value) {\r\n\t\t$sql .= \"(c.question=\" . $value . \" AND c.form_id=\" . $formId . ($key<(sizeof($arr)-1)?\") OR \":\")\");\r\n\t}\r\n\r\n\t$sql .= \") GROUP BY b.id\";\r\n\treturn $sql;\r\n}",
"function qa_q_request($questionid, $title)\n{\n\tif (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }\n\n\trequire_once QA_INCLUDE_DIR . 'app/options.php';\n\trequire_once QA_INCLUDE_DIR . 'util/string.php';\n\n\t$title = qa_block_words_replace($title, qa_get_block_words_preg());\n\t$slug = qa_slugify($title, qa_opt('q_urls_remove_accents'), qa_opt('q_urls_title_length'));\n\n\treturn (int)$questionid . '/' . $slug;\n}",
"function add_form($params, $q, $a, $qId, $qType, $answersScore, $questionsScore)\n {\n// var_dump($scores);\n// die();\n $this->db->insert('forms',$params);\n $formId = $this->db->insert_id();\n\n $questionsCount = count($qId);\n //Insert data in tables\n foreach ($q as $qkey => $qItem){\n $this->db->insert('questions', array(\n 'question_label' => $qItem,\n 'question_form' => $formId,\n 'question_type' => $qType[$qkey],\n 'question_score' => $questionsScore[$qkey]\n ));\n\n $questId = $this->db->insert_id();\n\n for($i=0; $i<$questionsCount; $i++){\n if ($qId[$i]==$qkey){\n $this->db->insert('answers', array(\n 'ans_question' => $questId,\n 'ans_value' => $a[$i],\n 'ans_score' => $answersScore[$i]+1\n ));\n }\n }\n }\n\n return $formId;\n }",
"function AddTesteeQuestions($testEntryID, $examQAs)\n {\n try\n {\n if (count($examQAs) < 1)\n {\n return;\n }\n \n $db = GetDBConnection();\n \n $qCount = 1;\n $questions = array();\n foreach ($examQAs as $qa)\n {\n $questionID = $qa->GetQuestionId();\n $question = GetQuestion($questionID);\n \n if ($question != FALSE)\n {\n $aCount = 1;\n $answers = GetQuestionAnswers($questionID);\n \n for ($i = 0; $i < count($answers); $i++)\n {\n $chosen = '0';\n $answer = $answers[$i];\n $answer['AnswerNo'] = $aCount;\n \n if ($answer[GetAnswerIdIdentifier()] == $qa->GetAnswerId())\n {\n $chosen = '1';\n }\n \n $answer['Chosen'] = $chosen;\n \n $answers[$i] = $answer;\n \n $aCount++;\n }\n \n $question['QuestionNo'] = $qCount;\n $question['Answers'] = $answers;\n \n $questions[] = $question;\n \n $qCount++;\n }\n }\n \n $qQuery = 'INSERT INTO ' . GetTesteeQuestionsIdentifier()\n . ' (' . GetTestIdIdentifier()\n . ', ' . 'QuestionNo'\n . ', ' . 'Level'\n . ', ' . 'Instructions'\n . ', ' . 'Question' . ') VALUES';\n \n $aQuery = 'INSERT INTO ' . GetTesteeAnswersIdentifier()\n . ' (' . GetTestIdIdentifier()\n . ', ' . 'QuestionNo'\n . ', ' . 'AnswerNo'\n . ', ' . 'Answer'\n . ', ' . 'Correct'\n . ', ' . 'Chosen' . ') VALUES';\n \n foreach($questions as $question)\n {\n $answers = $question['Answers'];\n $questionNo = $question['QuestionNo'];\n \n $qQuery .= ' (:' . GetTestIdIdentifier()\n . ', :' . 'QuestionNo' . $questionNo\n . ', :' . 'Level' . $questionNo\n . ', :' . 'Instructions' . $questionNo\n . ', :' . 'Question' . $questionNo . '),';\n \n foreach($answers as $answer)\n {\n $answerNo = $answer['AnswerNo'];\n \n $aQuery .= ' (:' . GetTestIdIdentifier()\n . ', :' . 'QuestionNo' . $questionNo . $answerNo\n . ', :' . 'AnswerNo' . $questionNo . $answerNo\n . ', :' . 'Answer' . $questionNo . $answerNo\n . ', :' . 'Correct' . $questionNo . $answerNo\n . ', :' . 'Chosen' . $questionNo . $answerNo . '),';\n }\n }\n \n $qQuery = rtrim($qQuery, ',') . ';';\n $aQuery = rtrim($aQuery, ',') . ';';\n \n $qStatement = $db->prepare($qQuery);\n $aStatement = $db->prepare($aQuery);\n \n foreach($questions as $question)\n {\n $answers = $question['Answers'];\n $questionNo = $question['QuestionNo'];\n \n foreach($answers as $answer)\n {\n $answerNo = $answer['AnswerNo'];\n \n $aStatement->bindValue(':' . GetTestIdIdentifier(), $testEntryID);\n $aStatement->bindValue(':' . 'QuestionNo' . $questionNo . $answerNo, $questionNo);\n $aStatement->bindValue(':' . 'AnswerNo' . $questionNo . $answerNo, $answerNo);\n $aStatement->bindValue(':' . 'Answer' . $questionNo . $answerNo, $answer[GetNameIdentifier()]);\n $aStatement->bindValue(':' . 'Chosen' . $questionNo . $answerNo, $answer['Chosen']);\n $aStatement->bindValue(':' . 'Correct' . $questionNo . $answerNo, $answer['Correct']);\n }\n \n $qStatement->bindValue(':' . GetTestIdIdentifier(), $testEntryID);\n $qStatement->bindValue(':' . 'QuestionNo' . $questionNo, $questionNo);\n $qStatement->bindValue(':' . 'Level' . $questionNo, $question['Level']);\n $qStatement->bindValue(':' . 'Instructions' . $questionNo, $question['Instructions']);\n $qStatement->bindValue(':' . 'Question' . $questionNo, $question[GetNameIdentifier()]);\n }\n \n $qStatement->execute();\n $qStatement->closeCursor();\n \n $aStatement->execute();\n $aStatement->closeCursor();\n }\n catch (PDOException $ex)\n {\n LogError($ex);\n }\n }"
] |
[
"0.56023747",
"0.55133784",
"0.54875916",
"0.5476981",
"0.5442274",
"0.54051304",
"0.53983665",
"0.5389919",
"0.53634864",
"0.5352979",
"0.5339082",
"0.5314202",
"0.5303351",
"0.5301565",
"0.5240693",
"0.5231116",
"0.5231056",
"0.52276266",
"0.5216364",
"0.5204766",
"0.5194195",
"0.5180657",
"0.5176827",
"0.515077",
"0.5123521",
"0.5118544",
"0.5117023",
"0.51104057",
"0.5104494",
"0.509004"
] |
0.66555727
|
0
|
Return index of the questions array, for a speicific question
|
function searchQuestion($question, &$questions) {
foreach ($questions as $key => $val) {
if ($val['FedQuestion']['question'] === $question) {
return $key;
}
}
return null;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"private function a($question) {\n\t\treturn $this->answers[$question - 1];\n\t}",
"function getIndex() ;",
"function getAnswer($index = 0)\n\t{\n\t\tif ($index < 0) return NULL;\n\t\tif (count($this->answers) < 1) return NULL;\n\t\tif ($index >= count($this->answers)) return NULL;\n\n\t\treturn $this->answers[$index];\n\t}",
"public static function answer_question(array $question);",
"public function get_id_question()\n\t{\n\t\treturn $this->id_question;\n\t}",
"public function getQuestionIds(){\n\t\treturn array('todo'); // This will be moved to QuestionTemplate\n\t}",
"function deduce_question_id($question) {\n if(is_array($question))\n if(is_array($question['pytanie']))\n $question = isSet($question['pytanie']['id_pytania'])? \n $question['pytanie']['id_pytania'] : null;\n else\n $question = isSet($question['id_pytania']) ? $question['id_pytania'] : null;\n \n return $question;\n}",
"abstract protected function getIndex();",
"public function PullNextQuestionID()\n {\n $questionID = 0;\n \n $foundNextQues = FALSE;\n $lvlQAs = $this->GetLvlQAs();\n \n for($index = 0; $index < count($lvlQAs) && !$foundNextQues; $index++)\n {\n $lvlQA = $lvlQAs[$index];\n \n if(!$lvlQA->IsAnswerIdSet())\n {\n $foundNextQues = TRUE;\n $questionID = $lvlQA->GetQuestionId();\n }\n }\n \n return $questionID;\n }",
"private function question()\n\t{\n\t\t$this->qns['questionnaire']['questionnairecategories_id'] = $this->allinputs['questioncat'];\n\t\t$this->qns['questionnaire']['questionnairesubcategories_id'] = $this->allinputs['questionsubcat'];\n\t\t$this->qns['questionnaire']['label'] = $this->allinputs['question_label'];\n\n\n\t\t$this->qns['questionnaire']['question'] = $this->allinputs['question'];\n\t\t$this->qns['questionnaire']['has_sub_question'] = $this->allinputs['subquestion'];\n\n\t\tif( $this->qns['questionnaire']['has_sub_question'] == 0 )\n\t\t{\n\t\t\t$this->qns['answers']['answer_type'] = $this->allinputs['optiontype'];\n\t\t}\n\n\t\t$this->qns['questionnaire']['active'] = 1;\n\n\t\tif( $this->qns['questionnaire']['has_sub_question'] == 0 ){\n\t\t\t//This code must be skipped if sub_question is 1\n\t\t\t$optionCounter = 0;\n\t\t\tforeach ($this->allinputs as $key => $value) {\n\n\t\t\t\tif( str_is('option_*', $key) ){\n\t\t\t\t\t$optionCounter++;\n\t\t\t\t\t$this->qns['answers'][$optionCounter] = ( $this->qns['answers']['answer_type'] == 'opentext' ) ? 'Offered answer text' : $value;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}",
"public function getQuestionId() {\n\t\treturn $this->questionId;\n\t}",
"function questionID()\r\n {\r\n $ret = 0;\r\n\r\n if ( is_a( $this->Question, \"eZQuizQuestion\" ) )\r\n {\r\n $ret = $this->Question->id();\r\n }\r\n\r\n return $ret;\r\n }",
"public function testIndexOf() {\n\t\t$array = array(1, 2, 3, 4, 5);\n\t\t$result = _::indexOf($array, 4);\n\t\t$this->assertEquals(3, $result);\n\n\t\t// test not finding an element's index\n\t\t$result = _::indexOf($array, 6);\n\t\t$this->assertEquals(-1, $result);\n\t}",
"function insertParticularQuestionToQuiz($question,$conn)\n {\n if($question['type']==\"radio\")\n {\n return insertRadioQuestion($question,$conn);\n }\n if($question['type']==\"checkbox\")\n {\n return insertCheckboxQuestion($question,$conn);\n }\n else if($question[\"type\"]==\"loose_text\" || $question[\"type\"]==\"strict_text\")\n {\n return insertTextQuestion($question,$conn);\n }\n return -1;\n }",
"private function getAnswers($question){\n $answerModel = new Answer();\n $answers = $answerModel->where('id_qst',$question->id_qst)->findAll();\n $retMess = \"\";\n $this->answersId = [];\n foreach($answers as $answer){\n array_push($this->answersId,$answer->id_ans);\n $retMess .= \",\".$answer->text;\n }\n\n return $retMess;\n }",
"public static function check_question(array $question);",
"function lookUpAnswer($question) {\n\t\tif(is_array($this->_answers)) {\n\t\t\tforeach((array) $this->_answers as $answer) {\n\t\t\t\tif($answer->getQuestionUID() == $question->getUID()) {\n\t\t\t\t\treturn $answer;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn false;\n\t}",
"function getQuestions() { \n\ttry {\n\t\t$questions = ORM::for_table('questions')->find_many();\n\t\tif (!count($questions)) { \n\t\t\treturn 0;\n\t\t}\n\t\t$theQuestions = array();\n\t\tforeach ($questions as $question) { \n\t\t\t$theQuestion = array();\n\t\t\t$theQuestion['id'] = $question->id;\n\t\t\t$theQuestion['text'] = $question->text;\n\t\t\t$theQuestion['answer1'] = $question->answer1;\n\t\t\t$theQuestion['answer2'] = $question->answer2;\n\t\t\t$theQuestions[] = $theQuestion;\n\t\t}\n\t\treturn $theQuestions;\n\t} catch (Exception $e) { \n\t\treturn 0;\n\t}\n}",
"function getQuestions()\n\t{\n\t\treturn $this->aQuestion;\n\t}",
"function ipal_get_questions_student($qid){\r\n\r\n global $ipal;\r\n global $DB;\r\n global $CFG;\r\n\t\t$q='';\r\n\t\t$pagearray2=array();\r\n\t\t\r\n $aquestions=$DB->get_record('question',array('id'=>$qid));\r\n\t\t\tif($aquestions->questiontext != \"\"){ \r\n\r\n\t$pagearray2[]=array('id'=>$qid, 'question'=>$aquestions->questiontext, 'answers'=>ipal_get_answers_student($qid));\r\n\t\t\t\t\t\t\t}\r\n return($pagearray2);\r\n}",
"function introTutorial($V, $arr) {\n $p = 0;\n\n for ($i = 0; $i < count($arr); $i++) {\n if ($arr[$i] == $V) {\n $p = $i;\n break;\n }\n }\n\n return $p;\n}",
"public function getQuestionData()\n {\n return $this->_coreRegistry->registry('current_question');\n }",
"function sa_array_index($ary,$idx){\n if( isset($ary) and isset($idx) and isset($ary[$idx]) ) return $ary[$idx];\n}",
"protected function question_where(){\n return $array = array('exam_id'=>trim($this->input->post('exam_id')), \n 'category_id'=>trim($this->input->post('category_id')),\n 'body_id'=>trim($this->input->post('body_id')),\n 'subject_id'=>trim($this->input->post('subject_id')),\n 'period_id'=>trim($this->input->post('period_id')),\n 'question_number'=>trim($this->input->post('question_number')),\n );\n }",
"function get_index($array, $index, $required=false){\r\n if ((array_key_exists($index, $array)) &&\r\n (($required === false) || ($required && (!empty($array[$index])))) )\r\n {\r\n return $array[$index];\r\n }\r\n else{\r\n $this->msg .= \"$index is required \" . (($required)?\" and must not be empty \":\" \") . \"\\n\";\r\n }\r\n }",
"private function generateQuestion(){\n\t\t\t$questions = array(\n\t\t\t\t\tarray('name' => 'chevrolet', 'logo' => 'chevrolet.png'),\n\t\t\t\t\tarray('name' => 'playboy', 'logo' => 'playboy.png'),\n\t\t\t\t\tarray('name' => 'shell', 'logo' => 'shell.png'),\n\t\t\t\t\tarray('name' => 'java', 'logo' => 'java.png'),\n\t\t\t\t\tarray('name' => 'mysql', 'logo' => 'mysql.png'),\n\t\t\t\t\tarray('name' => 'postgresql', 'logo' => 'postgresql.png'),\n\t\t\t\t\tarray('name' => 'chrome', 'logo' => 'chrome.png'),\n\t\t\t\t\tarray('name' => 'firefox', 'logo' => 'firefox.png'),\n\t\t\t\t\tarray('name' => 'bluetooth', 'logo' => 'bluetooth.png'),\n\t\t\t\t\tarray('name' => 'twitter', 'logo' => 'twitter.png')\n\t\t\t\t);\n\t\t\t\t\n\t\t\t$index = rand(0, count($questions) - 1);\n\t\t\t\n\t\t\t$this->session->set('gl_answer', $questions[$index]['name']);\n\t\t\t\n\t\t\treturn array(\n\t\t\t\t\t\t\t'type' => 'image',\n\t\t\t\t\t\t\t'originalContentUrl' => $this->image_url . $questions[$index]['logo'],\n\t\t\t\t\t\t\t'previewImageUrl' => $this->image_url . $questions[$index]['logo']\n\t\t\t\t\t\t);\n\t\t}",
"public function getQuestions() {\r\n\t\t\treturn $this->_arrQuestions;\r\n\t\t}",
"private function getAnyQuestion()\n {\n $count = Question::count();\n $offset = mt_rand(0, $count-1);\n\n $questions = Question::find(\n [\n \"limit\" => [\"offset\" => $offset, \"number\" => 1] \n ]\n );\n \n //find() will only return 1 record because of the limit, but it returns it in a ResultSet so we need to extract the result\n return $questions->getFirst();\n }",
"public function get_question() {\n\t\t\treturn $this->question;\n\t\t}",
"public function ask_get_nb_questions()\n\t{\n\t\t$sql = \"SELECT COUNT(*) AS nb_quest\n\t\t\t\tFROM \".$this->table_ask.\"\n\t\t\t\tWHERE id_quest = -1\";\n\t\t$query = $this->db->query($sql);\n\t\tif( $query->row() != NULL )\n\t\t\treturn $query->row()->nb_quest;\n\t\telse\n\t\t\treturn 0;\n\t}"
] |
[
"0.6266214",
"0.58499724",
"0.58141816",
"0.5764732",
"0.5735292",
"0.5658158",
"0.5655185",
"0.55458844",
"0.5536691",
"0.5479546",
"0.5451633",
"0.54152364",
"0.53806555",
"0.5377644",
"0.53027576",
"0.5275363",
"0.5248899",
"0.52484316",
"0.52406067",
"0.52209103",
"0.52183986",
"0.5217434",
"0.5206359",
"0.5193914",
"0.5181922",
"0.51600665",
"0.51514107",
"0.514508",
"0.51430446",
"0.51401633"
] |
0.6453069
|
0
|
Return index of the questions array, for a speicific queryable
|
function searchQueryable($queryable, &$questions) {
foreach ($questions as $key => $val) {
if ($val['FedQuestion']['queryable']) {
if ($val['FedQuestion']['queryable'] == $queryable) {
return $key;
}
}
}
return false;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function searchQuestion($question, &$questions) {\n\t\tforeach ($questions as $key => $val) {\n\t\t\tif ($val['FedQuestion']['question'] === $question) {\n\t\t\t\treturn $key;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn null;\n\t}",
"function getIndex() ;",
"abstract protected function getIndex();",
"private function myQid(){\r\n\t\t$this->db->where('uid', $this->uid);\r\n\t\t$this->db->select('id');\r\n\t\t$this->db->from('wen_answer');\r\n\t\t$tmp = $this->db->get()->result_array();\r\n\t\t$return = array();\r\n\t\tforeach($tmp as $r){\r\n\t\t\t$return[$r['id']] = 1;\r\n\t\t}\r\n\t\treturn $return;\r\n\t}",
"public function getIndex();",
"public function getIndex();",
"public function getIndex();",
"public function getQuestionIds(){\n\t\treturn array('todo'); // This will be moved to QuestionTemplate\n\t}",
"private function a($question) {\n\t\treturn $this->answers[$question - 1];\n\t}",
"public function get_id_question()\n\t{\n\t\treturn $this->id_question;\n\t}",
"function getQuestions() { \n\ttry {\n\t\t$questions = ORM::for_table('questions')->find_many();\n\t\tif (!count($questions)) { \n\t\t\treturn 0;\n\t\t}\n\t\t$theQuestions = array();\n\t\tforeach ($questions as $question) { \n\t\t\t$theQuestion = array();\n\t\t\t$theQuestion['id'] = $question->id;\n\t\t\t$theQuestion['text'] = $question->text;\n\t\t\t$theQuestion['answer1'] = $question->answer1;\n\t\t\t$theQuestion['answer2'] = $question->answer2;\n\t\t\t$theQuestions[] = $theQuestion;\n\t\t}\n\t\treturn $theQuestions;\n\t} catch (Exception $e) { \n\t\treturn 0;\n\t}\n}",
"private function getAnyQuestion()\n {\n $count = Question::count();\n $offset = mt_rand(0, $count-1);\n\n $questions = Question::find(\n [\n \"limit\" => [\"offset\" => $offset, \"number\" => 1] \n ]\n );\n \n //find() will only return 1 record because of the limit, but it returns it in a ResultSet so we need to extract the result\n return $questions->getFirst();\n }",
"function deduce_question_id($question) {\n if(is_array($question))\n if(is_array($question['pytanie']))\n $question = isSet($question['pytanie']['id_pytania'])? \n $question['pytanie']['id_pytania'] : null;\n else\n $question = isSet($question['id_pytania']) ? $question['id_pytania'] : null;\n \n return $question;\n}",
"public function PullNextQuestionID()\n {\n $questionID = 0;\n \n $foundNextQues = FALSE;\n $lvlQAs = $this->GetLvlQAs();\n \n for($index = 0; $index < count($lvlQAs) && !$foundNextQues; $index++)\n {\n $lvlQA = $lvlQAs[$index];\n \n if(!$lvlQA->IsAnswerIdSet())\n {\n $foundNextQues = TRUE;\n $questionID = $lvlQA->GetQuestionId();\n }\n }\n \n return $questionID;\n }",
"public function getIndex() {}",
"public function getIndex() {}",
"public function getIndex() {}",
"public function getIndex() {}",
"public function getIndex() {}",
"public function getIndex() {}",
"public function getIndex() {}",
"public function getIndex() {}",
"public function getIndex() {}",
"function questionID()\r\n {\r\n $ret = 0;\r\n\r\n if ( is_a( $this->Question, \"eZQuizQuestion\" ) )\r\n {\r\n $ret = $this->Question->id();\r\n }\r\n\r\n return $ret;\r\n }",
"public function ask_get_nb_questions()\n\t{\n\t\t$sql = \"SELECT COUNT(*) AS nb_quest\n\t\t\t\tFROM \".$this->table_ask.\"\n\t\t\t\tWHERE id_quest = -1\";\n\t\t$query = $this->db->query($sql);\n\t\tif( $query->row() != NULL )\n\t\t\treturn $query->row()->nb_quest;\n\t\telse\n\t\t\treturn 0;\n\t}",
"function getAnswer($index = 0)\n\t{\n\t\tif ($index < 0) return NULL;\n\t\tif (count($this->answers) < 1) return NULL;\n\t\tif ($index >= count($this->answers)) return NULL;\n\n\t\treturn $this->answers[$index];\n\t}",
"public function batchIndex(): ?int;",
"protected function question_where(){\n return $array = array('exam_id'=>trim($this->input->post('exam_id')), \n 'category_id'=>trim($this->input->post('category_id')),\n 'body_id'=>trim($this->input->post('body_id')),\n 'subject_id'=>trim($this->input->post('subject_id')),\n 'period_id'=>trim($this->input->post('period_id')),\n 'question_number'=>trim($this->input->post('question_number')),\n );\n }",
"public function getQuestionIds()\r\n{\r\n $query_string = \"SELECT questionid FROM questions \";\r\n $query_string .= \"WHERE question = :question AND questionid != :questionid\";\r\n\r\n return $query_string;\r\n}",
"public function getIdx()\n {\n return $this->get(self::_IDX);\n }"
] |
[
"0.61148477",
"0.59463614",
"0.5834089",
"0.5653804",
"0.5583022",
"0.5583022",
"0.5583022",
"0.5527927",
"0.55273694",
"0.55122256",
"0.5442615",
"0.5431654",
"0.5410717",
"0.5388203",
"0.5332536",
"0.5332447",
"0.5332447",
"0.5332447",
"0.5331524",
"0.5331524",
"0.5331524",
"0.5330277",
"0.5330277",
"0.5281173",
"0.52755713",
"0.52749383",
"0.52332187",
"0.5219444",
"0.51961017",
"0.51824695"
] |
0.6371429
|
0
|
// Implementacion de FabricarVista //
|
public function fabricarVista($param) {
return new VistaUsuarioRCJA($this, $param, null);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function vista($vista,$datos=[])\n {\n if(file_exists('../app/vistas/'.$vista.'.php'))\n {\n require_once'../app/vistas/'.$vista.'.php';\n }\n else\n {\n die(\"La vista no existe\");\n }\n \n }",
"public function vista($vista,$datos=[]){\n //revisar si el archivo vista existe\n if(file_exists('../app/views/'. $vista .'.php')){\n require_once '../app/views/'. $vista .'.php';\n }else {\n //si el archivo no existe en la vista;\n die('La vista no existe;');\n }\n\n \n }",
"public function RicercaAvanzata(){\n $view = new VRicerca();\n $view->mostraFiltri();\n }",
"private function setRutasVista() {\n /* variable relacionadas a un controlador especifico */\n $this->_rutas = [\n 'vista' => RUTA_MODULOS . 'vista' . DS . $this->_controlador . DS,\n 'img' => URL_MODULOS . \"vista/\" . $this->_controlador . \"/img/\",\n 'js' => URL_MODULOS . \"vista/\" . $this->_controlador . \"/js/\",\n 'css' => URL_MODULOS . \"vista/\" . $this->_controlador . \"/css/\",\n ];\n }",
"function venta($mysqli,$fecha,$ref,$monto16,$monto0,$iva,$tipo,$factu,$cte){\n\t\t//en todos los casos\n\t\t$table='diario';\n\t\t$tmonto=$monto16+$monto0;\n\t\t$montof=$tmonto+$iva;\n\t\t//inicializa variable resultados\n\t\t\t//calculo del costo de ventas\n\t\t $costoc=$mysqli->query(\"SELECT SUM(haber)FROM inventario WHERE tipomov = 2 AND idoc= $ref\");\n\t\t\t$row=mysqli_fetch_row($costoc);\n\t\t\t$costo=$row[0];\n\t\t\t$costoc->close();\t\n\t\t\t//si existe el costo de ventas?\n\t\t\tif($costo!=''){\n\t\t\t\ttry {\n\t\t\t\t\t$mysqli->autocommit(false);\n\t\t\t\t\t//abono a inventario 115.01\n\t\t\t\t\t$abono=\"115.01\";\n\t\t\t\t\toperdiario($mysqli,$abono,1,1,$ref,$costo,$fecha,$factu);\n\t\t\t\t\t//cargo a costo de ventas 501.01\n\t\t\t\t\t$cargo=\"501.01\";\n\t\t\t\t\toperdiario($mysqli,$cargo,1,0,$ref,$costo,$fecha,$factu);\n\t\t\t\t\t//abono a ventas segun tasa\n\t\t\t\t\t//ventas tasa general \n\t\t\t\t\t\t$abono=\"401.01\";\n\t\t\t\t\t\toperdiario($mysqli,$abono,1,1,$ref,$monto16,$fecha,$factu,$cte);\n\t\t\t\t\t//ventas tasa 0 \n\t\t\t\t\t\t$abono=\"401.04\";\n\t\t\t\t\t\toperdiario($mysqli,$abono,1,1,$ref,$monto0,$fecha,$factu,$cte);\n\t\t\t\t\t//movimientos por tipo de venta\n\t\t\t\t\t\tswitch($tipo){\n\t\t\t\t\t\t\tcase 0:\n\t\t\t\t\t\t\t\t//mostrador- cargo a caja y efectivo 101.01\n\t\t\t\t\t\t\t\t$cargo=\"101.01\";\n\t\t\t\t\t\t\t\toperdiario($mysqli,$cargo,1,0,$ref,$montof,$fecha,$factu);\n\t\t\t\t\t\t\t\t//iva trasladado cobrado 208.01\n\t\t\t\t\t\t\t\t$abono=\"208.01\";\n\t\t\t\t\t\t\t\toperdiario($mysqli,$abono,1,1,$ref,$iva,$fecha,$factu);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase 1:\n\t\t\t\t\t\t\t\t//contado x ahora igual a anterior, luego se manda al cobro\n\t\t\t\t\t\t\t\t//mostrador- cargo a caja y efectivo 101.01\n\t\t\t\t\t\t\t\t$cargo=\"101.01\";\n\t\t\t\t\t\t\t\toperdiario($mysqli,$cargo,1,0,$ref,$montof,$fecha,$factu);\n\t\t\t\t\t\t\t\t//iva trasladado cobrado 208.01\n\t\t\t\t\t\t\t\t$abono=\"208.01\";\n\t\t\t\t\t\t\t\toperdiario($mysqli,$abono,1,1,$ref,$iva,$fecha,$factu);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase 2:\n\t\t\t\t\t\t\t\t//credito cargo a clientes\n\t\t\t\t\t\t\t\t$cargo=\"105.01\";\n\t\t\t\t\t\t\t\toperdiario($mysqli,$cargo,1,0,$ref,$montof,$fecha,$factu,$cte);\n\t\t\t\t\t\t\t\t//iva trasladado no cobrado 209.01\n\t\t\t\t\t\t\t\t$abono=\"209.01\";\n\t\t\t\t\t\t\t\toperdiario($mysqli,$abono,1,1,$ref,$iva,$fecha,$factu);\t\n\t\t\t\t\t\t\t\tbreak;\n\t\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\t//efectuar la operacion\n\t\t\t\t\t$mysqli->commit();\n\t\t\t\t $resul=0;\n\t\t\t\t} catch (Exception $e) {\n\t\t\t\t\t//error en las operaciones de bd\n\t\t\t\t $mysqli->rollback();\n\t\t\t\t \t$resul=-2;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}else{\n\t\t\t\t//no hay costo de ventas\n\t\t\t\t$resul=-1;\n\t\t\t}\n\t\t\n\t\t return $resul;\n}",
"protected function entidades(){\n\t\tfor($i=1; $i < 6;$i++) $niveis[$i] = \"nivel de busca {$i}\";\n\t\t$this->visualizacao->nivel = VComponente::montar(VComponente::caixaCombinacao, 'nivel', isset($_POST['nivel']) ? $_POST['nivel'] : 1 ,null,$niveis);\n\t\t$this->visualizacao->filtro = isset($_POST['filtro']) ? $_POST['filtro'] : null;\n\t\t$this->visualizacao->listagens = false;\n\t\tif(!$this->visualizacao->filtro) return;\n\t\t$d = dir(\".\");\n\t\t$negocios = new colecao();\n\t\t$controles = new colecao();\n\t\twhile (false !== ($arquivo = $d->read())) {\n\t\t\tif( is_dir($arquivo) && ($arquivo{0} !== '.') ){\n\t\t\t\tif(is_file($arquivo.'/classes/N'.ucfirst($arquivo).'.php')){\n\t\t\t\t\t$negocio = 'N'.ucfirst($arquivo);\n\t\t\t\t\t$obNegocio = new $negocio();\n\t\t\t\t\tif( $obNegocio instanceof negocioPadrao ) {\n\t\t\t\t\t\t$ordem[$arquivo] = array(\n\t\t\t\t\t\t\t'nome'=>$obNegocio->pegarInter()->pegarNome(),\n\t\t\t\t\t\t\t'caminho'=>$arquivo.'/classes/N'.ucfirst($arquivo).'.php'\n\t\t\t\t\t\t);\n\t\t\t\t\t\t$negocios->$arquivo = $obNegocio;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t$d->close();\n\t\tasort($ordem);\n\t\t$this->visualizacao->ordem = $ordem;\n\t\t$listagens = array();\n\t\tforeach($ordem as $idx => $arquivo){\n\t\t\t$obNegocio = $negocios->pegar($idx);\n\t\t\t$nome['controle'] = definicaoEntidade::controle($obNegocio, 'verPesquisa');\n\t\t\tif($this->exibirListagem($arquivo)){\n\t\t\t\t$colecao = $obNegocio->pesquisaGeral($this->pegarFiltro(),$this->pegarPagina(),isset($_POST['nivel']) ? $_POST['nivel'] : 1);\n\t\t\t\tcall_user_func_array(\"{$nome['controle']}::montarListagem\", array($this->visualizacao,$colecao,$this->pegarPagina(),$nome['controle']));\n\t\t\t\t$this->visualizacao->listagem->passarControle($nome['controle']);\n\t\t\t\tif($colecao->contarItens()){\n\t\t\t\t\t$listagens[$idx]['listagem'] = $this->visualizacao->listagem;\n\t\t\t\t\t$listagens[$idx]['ocorrencias'] = $colecao->contarItens();\n\t\t\t\t\t$listagens[$idx]['nome'] = $arquivo['nome'];\n\t\t\t\t\t$listagens[$idx]['controlePesquisa'] = $nome['controle'];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tunset($this->visualizacao->listagem);\n\t\t$this->visualizacao->listagens = $listagens;\n\t}",
"public function getFabricante()\n\t{\n\t\treturn $this->fabricante;\n\t}",
"public function vista($vista, $data=[])\n {\n //verificar si existe\n if (file_exists(\"../App/View/\" . $vista . \".php\")) \n {\n require_once \"../App/View/\" . $vista . \".php\" ;\n }\n else \n {\n die(\"No existe la vista\");\n }\n }",
"function addVivienda($calle, $numero_exterior, $codigo_postal = false, $numero_interior = \"\", $referencia = \"\", $telefono_fijo = \"0\", $telefono_movil = \"0\",\n\t\t\t$es_principal = false, $regimen = FALLBACK_PERSONAS_REGIMEN_VIV, $tipo = FALLBACK_PERSONAS_TIPO_VIV, $tiempo_de_residir = DEFAULT_TIEMPO, \n\t\t\t$colonia = \"\", $TipoDeAcceso = \"\", $gps = \"\",\n\t\t\t$clave_de_localidad = false, $clave_de_pais = EACP_CLAVE_DE_PAIS, \n\t\t\t$nombre_pais = \"\", $nombre_estado = \"\", $nombre_municipo = \"\", $nombre_localidad = \"\"){\n\t\t\n\t\t//$xViv\t\t\t\t= new cPersonasVivienda($this->getCodigo(), $tipo);\n\t\t\n\t\t$fechaalta \t\t\t= fechasys();\n\t\t$eacp\t\t\t\t= EACP_CLAVE;\n\t\t$socio\t\t\t\t= $this->mCodigo;\n\t\t$xT\t\t\t\t\t= new cTipos();\n\t\t$xLc\t\t\t\t= new cLocal();\n\t\t$xQL\t\t\t\t= new MQL();\n\t\t//depurar calle y numero 18Jul2013\n\t\t$calle\t\t\t\t= str_replace(\"CALLE\", \"\", strtoupper($calle));\n\t\t//Inicia al Socio 20120620\n\t\t$this->init();\n\t\t$DSocio\t\t\t\t= $this->getDatosInArray();\n\t\t$TipoDeIngreso\t\t= $DSocio[\"tipoingreso\"];\n\t\t$codigo_postal\t\t= setNoMenorQueCero($codigo_postal);\n\t\t$sucursal\t\t\t= getSucursal();\n\t\t$sucess\t\t\t\t= true;\n\t\t$usuario\t\t\t= getUsuarioActual();\n\t\t//Fixed\n\n\t\t\n\t\t\n\t\t$msg\t\t\t\t= \"\";\n\t\t$TipoDeAcceso\t\t= ($TipoDeAcceso == \"\") ? \"calle\" : $TipoDeAcceso;\n\t\t$clave_de_municipio\t= $xLc->DomicilioMunicipioClave();\n\t\t$clave_de_estado\t= $xLc->DomicilioEstadoClaveNum();\n\t\t$clave_de_localidad\t= setNoMenorQueCero($clave_de_localidad);\n\t\t$clave_de_pais\t\t= (trim($clave_de_pais) == \"\") ? EACP_CLAVE_DE_PAIS : $clave_de_pais;\n\t\t/* 1 part 2 fiscal 3 laboral*/\n\t\t//verifica los codigos postales\n\t\t$xCol\t\t\t\t= new cDomiciliosColonias();\n\t\tif($clave_de_pais == EACP_CLAVE_DE_PAIS){\n\t\t\tif( $xCol->existe($codigo_postal) == true){\n\t\t\t\t$estado\t\t\t\t\t= $xCol->getNombreEstado();\n\t\t\t\t$nombre_localidad\t\t\t\t= $xCol->getNombreLocalidad();\n\t\t\t\t$municipio\t\t\t\t= $xCol->getNombreMunicipio();\n\t\t\t\t$colonia\t\t\t\t= ( trim($colonia) == \"\" ) ? $xCol->getNombre() : $xT->cChar( $colonia );\t\n\t\t\t\t$clave_de_estado\t\t= $xCol->getClaveDeEstado();\n\t\t\t\t$clave_de_municipio\t\t= $xCol->getClaveDeMunicipio();\n\t\t\t\t$msg\t\t\t\t\t.= \"WARN\\t$socio\\tEl CP queda en $codigo_postal, Localidad en $nombre_localidad, municipio en $municipio, Colonia $colonia\\r\\n\";\n\t\t\t} else {\n\t\t\t\t$msg\t\t\t.= \"WARN\\tEL C.P.($codigo_postal) No existe, se carga el de la Caja Local\\r\\n\";\n\t\t\t\t\n\t\t\t\t\tif( SISTEMA_CAJASLOCALES_ACTIVA == true){\n\t\t\t\t\t\t$this->init();\n\t\t\t\t\t\t$xCL\t\t\t= new cCajaLocal($this->mCajaLocal);\n\t\t\t\t\t\t$DCols\t\t\t= $xCL->getDatosInArray();\n\t\t\t\t\t\t$codigo_postal\t\t= ( isset($DCols[\"codigo_postal\"]) ) ? setNoMenorQueCero(($DCols[\"codigo_postal\"])) : $xLc->DomicilioCodigoPostal();\n\t\t\t\t\t\t$msg\t\t\t.= \"WARN\\tSe obtiene el C.P. por caja Local ($codigo_postal) \\r\\n\";\n\t\t\t\t\t\tif( $xCol->existe($codigo_postal) == true){\n\t\t\t\t\t\t\t$estado\t\t\t\t\t= $xCol->getNombreEstado();\n\t\t\t\t\t\t\t$nombre_localidad\t\t\t\t= $xCol->getNombreLocalidad();\n\t\t\t\t\t\t\t$municipio\t\t\t\t= $xCol->getNombreMunicipio();\n\t\t\t\t\t\t\t$colonia\t\t\t\t= ( trim($colonia) == \"\" ) ? $xCol->getNombre() : $xT->cChar( $colonia );\n\t\t\t\t\t\t\t$clave_de_estado\t\t= $xCol->getClaveDeEstado();\n\t\t\t\t\t\t\t$clave_de_municipio\t\t= $xCol->getClaveDeMunicipio();\n\t\t\t\t\t\t}\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\tif($codigo_postal <= 0){\n\t\t\t\t\t\t$msg\t\t\t.= \"ERROR\\tEL C.P.($codigo_postal) No existe, se carga el de la Sucursal\\r\\n\";\n\t\t\t\t\t\t$codigo_postal\t= $xLc->DomicilioCodigoPostal();\n\t\t\t\t\t}\n\t\n\t\t\t}\n\t\t} else {\n\t\t\t$clave_de_estado\t\t\t\t= FALLBACK_PERSONAS_DOMICILIO_ID_ESTADO;\n\t\t\t$clave_de_municipio\t\t\t\t= FALLBACK_PERSONAS_DOMICILIO_ID_MUNICIPIO;\n\t\t\tif($codigo_postal <= 0){\t$codigo_postal = 1; } \n\t\t}\n\n\t\t$xLoc\t\t\t\t\t= new cDomicilioLocalidad($clave_de_localidad);\n\t\tif( $clave_de_localidad <= 0 ){\n\t\t\t$clave_de_localidad\t= $xLoc->setBuscar($nombre_localidad, $clave_de_estado, $clave_de_municipio);\n\t\t\tif( setNoMenorQueCero($clave_de_localidad) <= 0 ){\n\t\t\t\t$clave_de_localidad\t\t\t= $xLc->DomicilioLocalidadClave();\n\t\t\t}\n\t\t\t$xLoc->set($clave_de_localidad);\n\t\t} else {\n\t\t\t$xLoc->init();\n\t\t}\n\t\t$nombre_localidad\t\t\t\t= ($nombre_localidad == \"\") ? $xLoc->getNombre() : $nombre_localidad;\n\t\t//Tipos de Acceso calle, avenida, callejon privada, andador\n\t\tif($nombre_pais == \"\"){\n\t\t\t$xPais\t= new cDomiciliosPaises($clave_de_pais);\n\t\t\t//$xPais->getPaisPorMoneda($moneda)\n\t\t\t$xTP\t= new cPersonas_domicilios_paises();\n\t\t\t$xTP->setData( $xTP->query()->initByID($clave_de_pais) );\n\t\t\t$nombre_pais\t= $xTP->nombre_oficial()->v();\n\t\t\t$municipio\t\t= ($nombre_municipo == \"\") ? $nombre_localidad : strtoupper($nombre_municipo);\n\t\t\t$estado\t\t\t= ($nombre_estado == \"\") ? $nombre_localidad : strtoupper($nombre_estado);\n\t\t}\n\t\t\n\t\t$estado\t\t\t\t= ($nombre_estado == \"\") ? $xLc->DomicilioEstado() : strtoupper($nombre_estado);\n\t\t$nombre_localidad\t= ($nombre_localidad == \"\") ? $xLc->DomicilioLocalidad() : strtoupper($nombre_localidad);\n\t\t$municipio\t\t\t= ($nombre_municipo == \"\") ? $xLc->DomicilioMunicipio() : strtoupper($nombre_municipo);\n\t\t\n\t\t$calle\t\t\t\t= setCadenaVal($calle);\n\t\t$colonia\t\t\t= setCadenaVal($colonia);\n\t\t$estado\t\t\t\t= setCadenaVal($estado);\n\t\t$nombre_localidad\t= setCadenaVal($nombre_localidad);\n\t\t$municipio\t\t\t= setCadenaVal($municipio);\n\t\t$sql\t\t= \"INSERT INTO socios_vivienda(socio_numero, tipo_regimen, calle, numero_exterior, numero_interior, colonia,\n\t\t\t\tlocalidad, estado, municipio, telefono_residencial, telefono_movil,\n\t\t\t\ttiempo_residencia, referencia, idusuario, principal, tipo_domicilio, codigo_postal,\n\t\t\t\tfecha_alta, codigo , sucursal,\n\t\t\t\teacp, coordenadas_gps, tipo_de_acceso, fecha_de_verificacion, oficial_de_verificacion, estado_actual, clave_de_localidad,\n\t\t\t\tclave_de_pais, nombre_de_pais)\n\t\t\t\tVALUES\n\t\t\t\t($socio, $regimen, '$calle', '$numero_exterior', '$numero_interior', '$colonia',\n\t\t\t\t'$nombre_localidad', '$estado', '$municipio', '$telefono_fijo','$telefono_movil',\n\t\t\t\t$tiempo_de_residir, '$referencia', $usuario, '$es_principal', $tipo, '$codigo_postal',\n\t\t\t\t'$fechaalta', $socio, '$sucursal',\n\t\t\t\t'$eacp', '$gps', '$TipoDeAcceso', '$fechaalta', $usuario, 99, $clave_de_localidad,\n\t\t\t\t'$clave_de_pais', '$nombre_pais')\";\n\t\t$sucess\t\t= $xQL->setRawQuery($sql);\n\t\tif ( $sucess != false ){\n\t\t\t$id\t\t\t\t\t= $xQL->getLastInsertID();\n\t\t\t$this->mIDVivienda\t= $id;\n\t\t\t$msg\t\t\t.= \"OK\\tSe agrega la Vivienda con ID $id CP $codigo_postal y Localidad $clave_de_localidad del pais $nombre_pais\\r\\n\";\n\t\t\t//Actualiza el Dato de Domicilio del Grupo Solidario\n\t\t\tif( ($TipoDeIngreso == TIPO_INGRESO_GRUPO) AND (intval($es_principal) == SYS_UNO) ){\n\t\t\t\t$xGrp\t= new cGrupo($this->mCodigo);\n\t\t\t\t$DDom\t= $this->getDatosDomicilio();\n\t\t\t\t$arrUp\t= array(\n\t\t\t\t\t\t\"direccion_gruposolidario\" => $this->getDomicilio(),\n\t\t\t\t\t\t\"colonia_gruposolidario\" => $DDom[\"colonia\"]\n\t\t\t\t);\n\t\t\t\t$xGrp->setUpdate($arrUp);\n\t\t\t\t$msg\t.= $xGrp->getMessages();\n\t\t\t}\n\t\t\t$this->setCuandoSeActualiza();\n\t\t}\n\t\t$this->mMessages\t.= $msg;\n\t\treturn $sucess;\n\t}",
"public function planoVigente($contato_id=null){\n\n\t\t# Parametros\n\t\t$options = array(\n\t\t\t'conditions'=>array(\n\t\t\t\t'Etiqueta.status' => true,\n\t\t\t\t'Etiqueta.inicio <= CURDATE()',\n\t\t\t\t'Etiqueta.fim >= CURDATE()',\n\t\t\t\t'Etiqueta.contato_id'=>$contato_id\n\t\t\t),\n\t\t\t'order'=>array('Etiqueta.modified DESC'),\n\t\t);\n\n\t\t# Consulta\n\t\treturn $this->find('first', $options);\n\t}",
"function cambiarClaveServSoc()\n {\n }",
"function getVista()\n {\n try {\n $list = $this->mCategory->get_All();\n include_once('./vistes/categoria.php');\n }catch(Exception $e){\n $this->error->throwException('304', 'No s`ha pogut carregar les dades i la vista', $e);\n }\n }",
"function setCobrar($tarjeta1,$tarjeta2,$tarjeta3,$tarjeta4,$tarjeta5,$partida){\n\t$tarjetas=array(0=>$tarjeta1,1=>$tarjeta2,2=>$tarjeta3,3=>$tarjeta4,4=>$tarjeta5);\n\t$tarjeta_cambio;\n\t$veces_entre_foreach=0;\n\t$cantidad=0;\n\t\t\t//pregunta si el usuario saco tarjeta en la ronda, si no saco no puede cambiar ninguna de las que ya tiene(por esto ese if)\n\tif($partida->turno_usuario->getSaqueTarjeta() == 1){\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\tforeach($tarjetas as $tarjeta){\n\t\t\t\tif($tarjeta == 1){\n\t\t\t\t\tif($partida->turno_usuario->getTarjeta($veces_entre_foreach)!=NULL ){\n\t\t\t\t\t\t\t//solamente puede tomar una tarjeta, porque es cobrar, si hay mas de una seleccionadada cantidad de hace mas de 1 y el cambio no se realiza\n\t\t\t\t\t\tif($cantidad < 1){\n\t\t\t\t\t\t\t\t//digo que la tarjeta que esta en la posicion $avanzar_arreglo del usuario fue seleccionada\n\t\t\t\t\t\t\t$tarjeta_cambio=$partida->turno_usuario->getTarjeta($veces_entre_foreach);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$cantidad++;\n\t\t\t\t\t}\n\t\t\t\t}\t\t\t\t\n\t\t\t\t$veces_entre_foreach++;\n\t\t\t}//foreach($tarjetas as $tarjeta){\n\t\t\t\n\t\t\t\t//si se selecciono una y solo una tarjeta\n\t\t\tif($cantidad == 1){\n\t\t\t\t\t//compruebo si la tarjeta esta en estado de ser cambiada\n\t\t\t\tif($tarjeta_cambio->getEstado() == 0 ){\n\t\t\t\t\t\t\n\t\t\t\t\t$id_pais=$tarjeta_cambio->getIdPais();\n\t\t\t\t\t\t//recorro todos los paises \n\t\t\t\t\tforeach($partida->paises as $pais){\t\n\t\t\t\t\t\t\t//compruebo si id del usuario en turno es igual al del propietario del pais que selecciona el foreach Y aparte compruebo que \n\t\t\t\t\t\t\t//el pais al que hace referencia la tarjeta sea el seleccionado por el foreach\n\t\t\t\t\t\tif($id_pais == $pais->getId() && $partida->turno_usuario->getId() == $pais->getPropietario()->getId() )\t{\n\t\t\t\t\t\t\t\t//cambio el estado de la tarjeta\n\t\t\t\t\t\t\t$tarjeta_cambio->setEstado(1);\n\t\t\t\t\t\t\t\t//le entrego al pais al que hace referencia 2 fichas\n\t\t\t\t\t\t\t$pais->setFichas(2);\n\t\t\t\t\t\t\t\t//reseteo el saco tarjeta, para que en la misma ronda no pueda cobrar dos tarjetas\n\t\t\t\t\t\t\t$partida->turno_usuario->setSaqueTarjetaReset();\n\t\t\t\t\t\t\treturn 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}//if($cantidad == 1){\n\t\t\t\n\t}//if($partida->turno_usuario->getSaqueTarjeta() == 1){\t\n}",
"function cl_evolucaodividaativa() {\n //classes dos rotulos dos campos\n $this->rotulo = new rotulo(\"evolucaodividaativa\");\n $this->pagina_retorno = basename($GLOBALS[\"HTTP_SERVER_VARS\"][\"PHP_SELF\"]);\n }",
"public function mostrarVista($vista) {\n //$this->vistaData[TEMPLATE_BREADCUMBS] = $this->breadcumbs;\n $this->vistaData[TEMPLATE_VALORES_DEFECTO] = $this->valoresDefecto;\n //$this->vistaData[TEMPLATE_NOTIFICACION] = $this->notificacion;\n //$this->vistaData[TEMPLATE_MEMBRESIA] = $this->obtenerMembresiaSesion();\n\n // Transformacion de la vista al contenido del template\n $templateData[TEMPLATE_CONTENIDO] = $this->load->view($vista, $this->vistaData, true);\n\n $this->load->view('templates/backend', $templateData);\n return true;\n }",
"public static function modificaProfiloAzienda()\n {\n $vd = new ViewDescriptor();\n $vd->setTitolo(\"SardiniaInFood: Profilo\");\n $vd->setLogoFile(\"../view/in/logo.php\");\n $vd->setMenuFile(\"../view/in/menu_modifica_profilo.php\");\n $vd->setContentFile(\"../view/in/azienda/modifica_profilo_azienda.php\");\n $vd->setErrorFile(\"../view/in/error_in.php\");\n $vd->setFooterFile(\"../view/in/footer_empty.php\");\n \n require_once \"../view/Master.php\";\n }",
"public function changeToOrdine()\n {\n\n //crea la tabella degli ordini verso i fornitori\n //Rielabora\n $preventivatore = $this->getPreventivatore();\n $result = $preventivatore->elabora();\n $imponibile = $result['prezzo_cliente_senza_iva'];\n $iva = $result['prezzo_cliente_con_iva'] - $result['prezzo_cliente_senza_iva'];\n $importo_trasportatore = $result['costo_trazione'];\n $importo_depositario = $result['deposito'];\n $importo_traslocatore_partenza = $result['costo_scarico_totale'] ;\n $importo_traslocatore_destinazione = $result['costo_salita_piano_totale'] + $result['costo_montaggio_totale'] + $result['costo_scarico_ricarico_hub_totale'];\n\n $totali = array();\n $totali[$this->id_trasportatore] = 0;\n $totali[$this->id_depositario] = 0;\n $totali[$this->id_traslocatore_destinazione] = 0;\n $totali[$this->id_traslocatore_partenza] = 0;\n\n $totaliMC = array();\n $totaliMC[$this->id_trasportatore] = 0;\n $totaliMC[$this->id_depositario] = 0;\n $totaliMC[$this->id_traslocatore_destinazione] = 0;\n $totaliMC[$this->id_traslocatore_partenza] = 0;\n\n\n $totali[$this->id_trasportatore] = $totali[$this->id_trasportatore] + $importo_trasportatore;\n $totali[$this->id_depositario] = $totali[$this->id_depositario] + $importo_depositario;\n $totali[$this->id_traslocatore_partenza] = $totali[$this->id_traslocatore_partenza] + $importo_traslocatore_partenza;\n $totali[$this->id_traslocatore_destinazione] = $totali[$this->id_traslocatore_destinazione] + $importo_traslocatore_destinazione;\n\n\n $mc = $preventivatore->getMC();\n\n $totaliMC[$this->id_trasportatore] = $totaliMC[$this->id_trasportatore] + $mc;\n $totaliMC[$this->id_depositario] = $totaliMC[$this->id_depositario] + $mc;\n $totaliMC[$this->id_traslocatore_destinazione] = $totaliMC[$this->id_traslocatore_destinazione] + $mc;\n $totaliMC[$this->id_traslocatore_partenza] = $totaliMC[$this->id_traslocatore_partenza] + $mc;\n\n $imponibile = round($totali[$this->id_trasportatore]/(1+ Parametri::getIVA()),2);\n $iva = round($totali[$this->id_trasportatore] - $imponibile,2);\n\n $ordine_trasportatore = new OrdineFornitore($this->id_preventivo, $this->id_trasportatore, $totali[$this->id_trasportatore], $imponibile, $iva, $totaliMC[$this->id_trasportatore], date('Y-m-d'), OrdineFornitore::TIPO_SERVIZIO_TRASPORTO);\n $ordine_trasportatore->save();\n\n $imponibile = round($totali[$this->id_traslocatore_partenza]/(1+ Parametri::getIVA()),2);\n $iva = round($totali[$this->id_traslocatore_partenza] - $imponibile,2);\n\n $ordine_traslocatore_partenza = new OrdineFornitore($this->id_preventivo, $this->id_traslocatore_partenza, $totali[$this->id_traslocatore_partenza], $imponibile, $iva, $totaliMC[$this->id_traslocatore_destinazione], date('Y-m-d'), OrdineFornitore::TIPO_SERVIZIO_TRASLOCO_PARTENZA);\n $ordine_traslocatore_partenza->save();\n\n $imponibile = round($totali[$this->id_traslocatore_destinazione]/(1+ Parametri::getIVA()),2);\n $iva = round($totali[$this->id_traslocatore_destinazione] - $imponibile,2);\n $ordine_traslocatore_destinazione = new OrdineFornitore($this->id_preventivo, $this->id_traslocatore_destinazione, $totali[$this->id_traslocatore_destinazione], $imponibile, $iva, $totaliMC[$this->id_traslocatore_partenza], date('Y-m-d'), OrdineFornitore::TIPO_SERVIZIO_TRASLOCO_DESTINAZIONE);\n $ordine_traslocatore_destinazione->save();\n\n if ($this->giorni_deposito>10) {\n $imponibile = round($totali[$this->id_depositario]/(1+ Parametri::getIVA()),2);\n $iva = round($totali[$this->id_depositario] - $imponibile,2);\n\n $ordine_depositario = new OrdineFornitore($this->id_preventivo, $this->id_depositario, $totali[$this->id_depositario], $imponibile, $iva, $totaliMC[$this->id_depositario], date('Y-m-d'), OrdineFornitore::TIPO_SERVIZIO_DEPOSITO);\n $ordine_depositario->save();\n }\n\n\n\n $data_ordine = date('Y-m-d');\n $con = DBUtils::getConnection();\n $sql =\"UPDATE preventivi SET tipo=\".OrdineBusiness::TIPO_ORDINE.\" , data='\".$data_ordine.\"' ,\n importo_commessa_trasportatore ='\".$totali[$this->id_trasportatore].\"',\n importo_commessa_traslocatore_partenza ='\".$totali[$this->id_traslocatore_partenza].\"',\n importo_commessa_traslocatore_destinazione ='\".$totali[$this->id_traslocatore_destinazione].\"',\n importo_commessa_depositario ='\".$totali[$this->id_depositario].\"',\n imponibile ='\".$imponibile.\"',\n iva ='\".$iva.\"'\n WHERE id_preventivo=\".$this->id_preventivo;\n\n $res = mysql_query($sql);\n //echo \"\\nSQL: \".$sql;\n DBUtils::closeConnection($con);\n\n return new OrdineCliente($this->id_preventivo);\n }",
"function evt__cuadro_fechas__seleccionar ($fecha_cuadro){\n }",
"static function crear( toba_modelo_instancia $instancia, $nombre, $usuarios_a_vincular , $dir_inst_proyecto=null)\n\t{\n\t\t//- 1 - Controles\n\t\t$dir_template = toba_dir() . self::template_proyecto;\n\t\tif ( $nombre == 'toba' ) {\n\t\t\tthrow new toba_error(\"INSTALACIÓN: No es posible crear un proyecto con el nombre 'toba'\");\n\t\t}\n\t\tif ( self::existe( $nombre ) ) {\n\t\t\ttoba_logger::instancia()->error(\"INSTALACIÓN: Ya existe una carpeta con el nombre '$nombre' en la carpeta 'proyectos'\");\n\t\t\tthrow new toba_error(\"INSTALACIÓN: Ya existe una carpeta con el nombre especificado en la carpeta 'proyectos'\");\n\t\t}\n\t\ttry {\n\n\t\t\t//- 2 - Modificaciones en el sistema de archivos\n\t\t\t$dir_proyecto = (is_null($dir_inst_proyecto)) ? $instancia->get_path_proyecto($nombre): $dir_inst_proyecto;\n\t\t\t$url_proyecto = $instancia->get_url_proyecto($nombre);\n\n\t\t\t// Creo la CARPETA del PROYECTO\n\t\t\t$excepciones = array();\n\t\t\t$excepciones[] = $dir_template.'/www/aplicacion.produccion.php';\n\t\t\ttoba_manejador_archivos::copiar_directorio( $dir_template, $dir_proyecto, $excepciones);\n\n\t\t\t// Modifico los archivos\n\t\t\t$editor = new toba_editor_archivos();\n\t\t\t$editor->agregar_sustitucion( '|__proyecto__|', $nombre );\n\t\t\t$editor->agregar_sustitucion( '|__instancia__|', $instancia->get_id() );\n\t\t\t$editor->agregar_sustitucion( '|__toba_dir__|', toba_manejador_archivos::path_a_unix( toba_dir() ) );\n\t\t\t$editor->agregar_sustitucion( '|__version__|', '1.0.0');\n\t\t\t$editor->procesar_archivo( $dir_proyecto . '/www/aplicacion.php' );\n\n\t\t\t$modelo = $dir_proyecto . '/php/extension_toba/modelo.php';\n\t\t\t$comando = $dir_proyecto . '/php/extension_toba/comando.php';\n\t\t\t$editor->procesar_archivo($comando);\n\t\t\t$editor->procesar_archivo($modelo);\n\t\t\t$editor->procesar_archivo($dir_proyecto.'/www/rest.php');\n\t\t\t$editor->procesar_archivo($dir_proyecto.'/www/servicios.php');\n\n\t\t\trename($modelo, str_replace('modelo.php', $nombre.'_modelo.php', $modelo));\n\t\t\trename($comando, str_replace('comando.php', $nombre.'_comando.php', $comando));\n\t\t\t$ini = $dir_proyecto.'/proyecto.ini';\n\t\t\t$editor->procesar_archivo($ini);\n\n\t\t\t// Asocio el proyecto a la instancia\n\t\t\t$instancia->vincular_proyecto( $nombre, $dir_inst_proyecto, $url_proyecto);\n\n\t\t\t//- 3 - Modificaciones en la BASE de datos\n\t\t\t$db = $instancia->get_db();\n\t\t\ttry {\n\t\t\t\t$db->abrir_transaccion();\n\t\t\t\t$db->retrasar_constraints();\n\t\t\t\t$db->ejecutar( self::get_sql_metadatos_basicos( $nombre ) );\n\t\t\t\t$sql_version = self::get_sql_actualizar_version( toba_modelo_instalacion::get_version_actual(),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$nombre);\n\t\t\t\t$db->ejecutar($sql_version);\n\t\t\t\tforeach( $usuarios_a_vincular as $usuario ) {\n\t\t\t\t\tself::do_vincular_usuario($db, $nombre, $usuario, array('admin'));\n\t\t\t\t}\n\t\t\t\t$db->cerrar_transaccion();\n\t\t\t} catch ( toba_error $e ) {\n\t\t\t\t$db->abortar_transaccion();\n\t\t\t\t$txt = 'PROYECTO : Ha ocurrido un error durante la carga de METADATOS del PROYECTO. DETALLE: ';\n\t\t\t\ttoba_logger::instancia()->error($txt . $e->getMessage());\n\t\t\t\tthrow new toba_error( $txt );\n\t\t\t}\n\t\t} catch ( toba_error $e ) {\n\t\t\t// Borro la carpeta creada\n\t\t\tif ( is_dir( $dir_proyecto ) ) {\n\t\t\t\t$instancia->desvincular_proyecto( $nombre );\n\t\t\t\ttoba_manejador_archivos::eliminar_directorio( $dir_proyecto );\n\t\t\t}\n\t\t\tthrow $e;\n\t\t}\n\t}",
"public function versionarObjetosNaoVersionados()\n\t{\n\t\t//salvando log de inicio da operação\n\t Basico_OPController_LogOPController::getInstance()->salvaLogFS(LOG_MSG_CREATE_CVC_INICIO);\n\n\t // setando as diretrizes administraticas para execucao de metodos administrativos e recuperando as configuracoes atuais do servidor\n\t $arrayConfigAtualPHP = Basico_OPController_UtilOPController::setaDiretivasAdministrativasPHP();\n\t \n\t\t// desabilitado o pool de ids de objetos manipulados (p/log)\n\t\tself::desabilitaPoolIdsObjetosManipulados();\n\n\t\t// recuperando todos os modelos dos sistema\n\t\t$arrayNomesModelosSistema = Basico_OPController_UtilOPController::retornaArrayNomeTodosModelosSistema(true);\n\n\t\t// recuperando array de objetos que nao devem ser versionados\n\t\t$arrayNomesObjetosNaoVersionais = self::retornaArrayNomesObjetosNaoVerionaveis();\n\n\t\t// loop para remover os objetos nao verionaveis do array de modelos do sistema\n\t\tforeach ($arrayNomesObjetosNaoVersionais as $nomeObjetoNaoVersionavel) {\n\t\t\t// localizando o objeto nao versionavel no array de modelos do sistema\n\t\t\tif (($chaveObjetoNaoVersionavel = array_search($nomeObjetoNaoVersionavel, $arrayNomesModelosSistema)) !== false) {\n\t\t\t\t// removendo elemento\n\t\t\t\tunset($arrayNomesModelosSistema[$chaveObjetoNaoVersionavel]);\n\t\t\t}\n\n\t\t\t// limpando memória\n\t\t\tunset($nomeObjetoNaoVersionavel);\n\t\t}\n\n\t\t// limpando variáveis\n\t\tunset($arrayNomesObjetosNaoVersionais);\n\n\t\t// iniciando transacao\n\t\tBasico_OPController_PersistenceOPController::bdControlaTransacao();\n\n\t\t// loop para recuperar todos os objetos dos modelos\n\t\tforeach ($arrayNomesModelosSistema as $nomeModelo) {\n\t\t\ttry {\t\t\t\n\t\t\t\t// instanciando o modelo\n\t\t\t\t$modelo = new $nomeModelo();\n\n\t\t\t\t// verificando se o modelo possui mapper\n\t\t\t\tif ((property_exists($modelo, '_mapper')) and (method_exists($modelo, 'getMapper'))) {\n\t\t\t\t\t// recuperando os objetos\n\t\t\t\t\t$objetos = $modelo->getMapper()->fetchAll();\n\n\t\t\t\t\t// verificando se houve recuperacao de objetos\n\t\t\t\t\tif (count($objetos)) {\n\t\t\t\t\t\t// loop para verificar se o objeto foi versionado\n\t\t\t\t\t\tforeach ($objetos as $objeto) {\n\t\t\t\t\t\t\t// versionando objetos nao versionados\n\t\t\t\t\t\t\t$versaoObjeto = self::retornaUltimaVersao($objeto, true);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// limpando memória\n\t\t\t\t\t\tunset($objeto);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// limpando modelo e objetos\n\t\t\t\tunset($modelo);\n\t\t\t\tunset($objetos);\n\t\t\t\tunset($versaoObjeto);\n\t\t\t} catch (Exception $e) {\n\t\t\t\t// voltando a transacao\n\t\t\t\tBasico_OPController_PersistenceOPController::bdControlaTransacao(DB_ROLLBACK_TRANSACTION);\n\n\t\t\t\t// estourando excessao\n\t\t\t\tthrow new Exception(MSG_ERRO_CVC_FALHOU . $nomeModelo . \" \" . $e->getMessage());\n\t\t\t}\n\t\t}\n\n\t\t// salvando a transacao\n\t\tBasico_OPController_PersistenceOPController::bdControlaTransacao(DB_COMMIT_TRANSACTION);\n\n\t\t// voltando as diretrizes administrativas\n\t\tBasico_OPController_UtilOPController::setaDiretivasAdministrativasPHP($arrayConfigAtualPHP);\n\n\t\t// inicializando atributo $this->_arrayObjetosManipulados\n\t\t$this->limpaArrayIdsObjetosManipulados();\n\n\t\t// salvando log de sucesso na operação\n\t Basico_OPController_LogOPController::getInstance()->salvaLogFS(LOG_MSG_CREATE_CVC_SUCESSO);\n\n\t\t// retornando sucesso\n\t\treturn true;\n\t}",
"function modificarServicio(){\r\n\t\t$this->procedimiento='gev.f_tgv_servicio_ime';\r\n\t\t$this->tipo_procedimiento='IME';\r\n\t\t\t\t\r\n\t\t\r\n\t\t$parametros = $this->aParam->getArregloParametros('asignacion');\r\n\t\t//si esdel tipo matriz verifica en la primera posicion el tipo de vista\r\n\t\tif($this->esMatriz){\r\n\t\t $tipo_operacion =$parametros[0]['tipo_operacion'];\t\r\n\t\t\t\r\n\t\t}else{\r\n\t\t\t$tipo_operacion =$parametros['tipo_operacion'];\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\tif($tipo_operacion=='asignacion'){\r\n\t\t $this->transaccion='tgv_SERVIC_MOD';\r\n } \r\n elseif($tipo_operacion=='cambiar_estado'){ \r\n\t\t $this->transaccion='tgv_SERCAMEST_MOD';\r\n\t\t $this->setParametro('operacion','operacion','varchar');// cuando finaliza los requerimientos, su valor es fin_requerimiento\r\n\t\t //$this->setParametro('id_abogado','id_abogado','int4');\r\n\t\t}\r\n\t\telseif ($tipo_operacion=='def_fechas'){ \r\n\t\t $this->transaccion='tgv_DEFFECHA_MOD';\r\n\t\t // $this->setParametro('operacion','operacion','varchar');// cuando finaliza los requerimientos, su valor es fin_requerimiento\r\n\t\t //$this->setParametro('id_abogado','id_abogado','int4');\r\n\t\t}\r\n\t\t\r\n\t\t//Define los parametros para la funcion\r\n\t\t$this->setParametro('id_servicio','id_servicio','int4');\r\n\t\t$this->setParametro('estado','estado','varchar');\r\n\t\t$this->setParametro('estado_reg','estado_reg','varchar');\r\n\t\t$this->setParametro('id_lugar_destino','id_lugar_destino','int4');\r\n\t\t$this->setParametro('id_ep','id_ep','int4');\r\n\t\t$this->setParametro('fecha_asig_fin','fecha_asig_fin','date');\r\n\t\t$this->setParametro('fecha_sol_ini','fecha_sol_ini','date');\r\n\t\t$this->setParametro('descripcion','descripcion','varchar');\r\n\t\t$this->setParametro('id_lugar_origen','id_lugar_origen','int4');\r\n\t\t$this->setParametro('cant_personas','cant_personas','int4');\r\n\t\t$this->setParametro('fecha_sol_fin','fecha_sol_fin','date');\r\n\t\t$this->setParametro('id_funcionario','id_funcionario','int4');\r\n\t\t$this->setParametro('fecha_asig_ini','fecha_asig_ini','date');\r\n\t\t$this->setParametro('id_funcionario_autoriz','id_funcionario_autoriz','int4');\r\n\t\t$this->setParametro('observaciones','observaciones','varchar');\r\n\r\n\t\t//Ejecuta la instruccion\r\n\t\t$this->armarConsulta();\r\n\t\t$this->ejecutarConsulta();\r\n\r\n\t\t//Devuelve la respuesta\r\n\t\treturn $this->respuesta;\r\n\t}",
"function AsignarVacacion(){\n\t $this->procedimiento='asis.ft_vacacion_sel';\n\t\t$this->transaccion='ASIS_ASIGVAC_SEL';\n\t\t$this->tipo_procedimiento='SEL';//tipo de transaccion\n\n\t\t$this->setCount(false); \n\t\t\n\t\t$this->tipo_conexion='seguridad';\n\t\t\n\t\t$this->arreglo=array(\"id_usuario\" =>1,\n\t\t\t\t\t\t\t \"tipo\"=>'TODOS'\n\t\t\t\t\t\t\t );\n\t\t\n\t\t$this->setParametro('id_usuario','id_usuario','int4');\t\t\t\t\t\t \n $this->captura('dias_asignados','int4');\n\n\t //Ejecuta la instruccion\n\t\t$this->armarConsulta();\n\t\t\n\t\t$this->ejecutarConsulta();\n\t\t\n\t\t//echo (\"entro al cron modelo vacacion juan \".$this->consulta.' fin juan');\n\t\t//exit;\n\t\t\n\t\t//Devuelve la respuesta\n\t\treturn $this->respuesta;\n\t}",
"public function vincularConta($iCodigoConta) {\n\n $this->excluirConta($iCodigoConta);\n\n /**\n * Pega o ultimo ano do plano de contas, para criar o vinculo com a conta de todos os anos\n */\n $oDaoPlano = new cl_conplanoorcamento();\n $sCampo = \"max(c60_anousu) as c60_anousu\";\n $sSqlMaximoAno = $oDaoPlano->sql_query_file(null, null, $sCampo);\n $rsMaximoAno = $oDaoPlano->sql_record($sSqlMaximoAno);\n\n $iAnoAtual = db_getsession('DB_anousu');\n $iUltimoAno = db_utils::fieldsMemory($rsMaximoAno, 0)->c60_anousu;\n\n $oDaoContaGrupo = new cl_conplanoorcamentogrupo();\n\n for ($iAno = $iAnoAtual; $iAno <= $iUltimoAno; $iAno++) {\n\n $oDaoContaGrupo->c21_sequencial = null;\n $oDaoContaGrupo->c21_anousu = $iAno;\n $oDaoContaGrupo->c21_codcon = $iCodigoConta;\n $oDaoContaGrupo->c21_congrupo = $this->getCodigo();\n $oDaoContaGrupo->c21_instit = db_getsession('DB_instit');\n $oDaoContaGrupo->incluir(null);\n if ($oDaoContaGrupo->erro_status == \"0\") {\n throw new BusinessException(\"Não foi possível vincular a conta {$iCodigoConta} ao grupo {$this->getDescricao()}\");\n }\n }\n\n return true;\n }",
"public function cargarVista()\n {\n session_start();\n // load views\n if ($_SESSION['tipeUser'] != 1) {\n\n header('location:'.URL.'Cuentas/access');\n exit();\n\n }else{\n $user = $this->model->cargarPaciente($_SESSION[\"idUser\"],$_SESSION['tipeUser']);\n foreach ($user as $value) {\n $this->model->setId_Paciente($value->id_paciente);\n $this->model->setNombre($value->primer_nombre.' '.$value->segundo_nombre);\n $this->model->setApellido($value->primer_apellido.' '.$value->segundo_apellido);\n $_SESSION['historia'] = $value->id_historia_clinica;\n }\n $_SESSION['userName'] = (\"Paciente : \".$this->model->getNombre(). ' ' .$this->model->getApellido());\n $_SESSION['idPaciente'] = $this->model->getId_Paciente();\n $_SESSION['userName'] = ($this->model->getNombre(). ' ' .$this->model->getApellido());\n $_SESSION['userHome'] = ($this->model->getUrl());\n \n }\n $paciente = $this->model->consultarPaciente($_SESSION['idPaciente']);\n foreach ($paciente as $item) \n {\n $this->model->setId_Paciente($item->id_paciente);\n $this->model->setNombre($item->primer_nombre.' '.$item->segundo_nombre);\n $this->model->setApellido($item->primer_apellido.' '.$item->segundo_apellido);\n $this->model->setTipo_Documento($item->tdocumento);\n $this->model->setDocumento($item->documento);\n $this->model->setGenero($item->genero);\n $this->model->setTelefono($item->telefono);\n $this->model->setEscolaridad($item->escolaridad);\n $this->model->setHistoria($item->historia);\n }\n $_SESSION['historia'] = $this->model->getHistoria();\n $_SESSION['documento'] = $this->model->getDocumento();\n\n }",
"public function recalcula() {\n\n //Si el cliente no está sujeto a iva\n //pongo el iva a cero en las líneas para evitar que por cambio\n //de cliente se aplique indebidamente\n $cliente = new Clientes($this->IDCliente);\n if ($cliente->getIva()->getIDTipo() == '0') {\n $lineas = new FemitidasLineas();\n $lineas->queryUpdate(array(\"Iva\" => 0, \"Recargo\" => 0), \"`IDFactura`= '{$this->IDFactura}'\");\n unset($lineas);\n }\n //Si el cliente no está sujeto a recargo de equivalencia\n //lo pongo a cero en las líneas para evitar que por cambio\n //de cliente se aplique indebidamente\n elseif ($cliente->getRecargoEqu()->getIDTipo() == '0') {\n $lineas = new FemitidasLineas();\n $lineas->queryUpdate(array(\"Recargo\" => 0), \"`IDFactura`= '{$this->IDFactura}'\");\n unset($lineas);\n }\n unset($cliente);\n\n //SI TIENE DESCUENTO, CALCULO EL PORCENTAJE QUE SUPONE RESPECTO AL IMPORTE BRUTO\n //PARA REPERCUTUIRLO PORCENTUALMENTE A CADA BASE\n $pordcto = 0;\n if ($this->getDescuento() != 0)\n $pordcto = round(100 * ($this->getDescuento() / $this->getImporte()), 2);\n\n //Calcular los totales, desglosados por tipo de iva.\n $this->conecta();\n if (is_resource($this->_dbLink)) {\n $lineas = new FemitidasLineas();\n $tableLineas = \"{$lineas->getDataBaseName()}.{$lineas->getTableName()}\";\n $articulos = new Articulos();\n $tableArticulos = \"{$articulos->getDataBaseName()}.{$articulos->getTableName()}\";\n unset($lineas);\n unset($articulos);\n\n $query = \"select sum(Importe) as Bruto,sum(ImporteCosto) as Costo from {$tableLineas} where (IDFactura='\" . $this->getIDFactura() . \"')\";\n $this->_em->query($query);\n $rows = $this->_em->fetchResult();\n $bruto = $rows[0]['Bruto'];\n\n $query = \"select Iva,Recargo, sum(Importe) as Importe from {$tableLineas} where (IDFactura='\" . $this->getIDFactura() . \"') group by Iva,Recargo order by Iva\";\n $this->_em->query($query);\n $rows = $this->_em->fetchResult();\n $totbases = 0;\n $totiva = 0;\n $totrec = 0;\n $bases = array();\n\n foreach ($rows as $key => $row) {\n $importe = $row['Importe'] * (1 - $pordcto / 100);\n $cuotaiva = round($importe * $row['Iva'] / 100, 2);\n $cuotarecargo = round($importe * $row['Recargo'] / 100, 2);\n $totbases += $importe;\n $totiva += $cuotaiva;\n $totrec += $cuotarecargo;\n\n $bases[$key] = array(\n 'b' => $importe,\n 'i' => $row['Iva'],\n 'ci' => $cuotaiva,\n 'r' => $row['Recargo'],\n 'cr' => $cuotarecargo\n );\n }\n\n $subtotal = $totbases + $totiva + $totrec;\n\n // Calcular el recargo financiero según la forma de pago\n $formaPago = new FormasPago($this->IDFP);\n $recFinanciero = $formaPago->getRecargoFinanciero();\n $cuotaRecFinanciero = $subtotal * $recFinanciero / 100;\n unset($formaPago);\n\n $total = $subtotal + $cuotaRecFinanciero;\n\n //Calcular el peso, volumen y n. de bultos de los productos inventariables\n switch ($_SESSION['ver']) {\n case '0': //Estandar\n $columna = \"Unidades\";\n break;\n case '1': //Cristal\n $columna = \"MtsAl\";\n break;\n }\n $em = new EntityManager($this->getConectionName());\n $query = \"select sum(a.Peso*l.{$columna}) as Peso,\n sum(aVolumen*l.{$columna}) as Volumen,\n sum(Unidades) as Bultos \n from {$tableArticulos} as a,{$tableLineas} as l\n where (l.IDArticulo=a.IDArticulo)\n and (a.Inventario='1')\n and (l.IDFactura='{$this->IDFactura}')\";\n $em->query($query);\n $rows = $em->fetchResult();\n $em->desConecta();\n\n $this->setImporte($bruto);\n $this->setBaseImponible1($bases[0]['b']);\n $this->setIva1($bases[0]['i']);\n $this->setCuotaIva1($bases[0]['ci']);\n $this->setRecargo1($bases[0]['r']);\n $this->setCuotaRecargo1($bases[0]['cr']);\n $this->setBaseImponible2($bases[1]['b']);\n $this->setIva2($bases[1]['i']);\n $this->setCuotaIva2($bases[1]['ci']);\n $this->setRecargo2($bases[1]['r']);\n $this->setCuotaRecargo2($bases[1]['cr']);\n $this->setBaseImponible3($bases[2]['b']);\n $this->setIva3($bases[2]['i']);\n $this->setCuotaIva3($bases[2]['ci']);\n $this->setRecargo3($bases[2]['r']);\n $this->setCuotaRecargo3($bases[2]['cr']);\n $this->setTotalBases($totbases);\n $this->setTotalIva($totiva);\n $this->setTotalRecargo($totrec);\n $this->setRecargoFinanciero($recFinanciero);\n $this->setCuotaRecargoFinanciero($cuotaRecFinanciero);\n $this->setTotal($total);\n $this->setPeso($rows[0]['Peso']);\n $this->setVolumen($rows[0]['Volumen']);\n $this->setBultos($rows[0]['Bultos']);\n\n $this->save();\n }\n }",
"public function verlinealista(){\n\t$resultado=$this->producto->verlinealista();\n return $resultado;\n\t\t\t\n\t\t}",
"public function fabricarEntidad($fila=null,$nombreModelo=null) {\n //Si se solicita una entidad de otro modelo, pedir al mismo\n if($nombreModelo) return $this->fabricarModelo($nombreModelo)->fabricarEntidad($fila);\n\n $obj=new $this->tipoEntidad;\n \n if($fila) {\n foreach($this->campos as $nombre=>$campo) {\n $aliasCampo='__'.$this->alias.'_'.$nombre;\n\n if($campo->tipo=='relacional') {\n //Mantener null por defecto\n //if($campo->relacion=='1:n') $obj->$nombre=null;\n } elseif($campo->contrasena) {\n //Omitir\n } else {\n $obj->$nombre=$fila->$aliasCampo;\n }\n }\n\n //Asignar valores existentes en la consulta\n foreach($this->consultaRelaciones as $relacion) {\n if($relacion->campo&&$relacion->tipo!='1:n'&&($relacion->siempre||$this->consultaProcesarRelaciones)) {\n $campo=$relacion->campo;\n $obj->$campo=$relacion->modelo->fabricarEntidad($fila);\n //Si no hubo coincidencias, mantener el campo nulo\n if(!$obj->$campo->id) $obj->$campo=null;\n }\n }\n\n //Procesar valores adicionales (recursividad, 1:n)\n $this->procesarRelaciones($obj,false,$this->consultaProcesarRelaciones&&$this->consultaProcesarRelaciones1n);\n\n $obj->procesarValores();\n }\n\n return $obj;\n }",
"public static function modificaServizi()\n {\n $vd = new ViewDescriptor();\n $vd->setTitolo(\"SardiniaInFood: Profilo\");\n $vd->setLogoFile(\"../view/in/logo.php\");\n $vd->setMenuFile(\"../view/in/menu_modifica_profilo.php\");\n $vd->setContentFile(\"../view/in/azienda/modifica_servizi.php\");\n $vd->setErrorFile(\"../view/in/error_in.php\");\n $vd->setFooterFile(\"../view/in/footer_empty.php\");\n \n require_once \"../view/Master.php\";\n }",
"public function RegistreVenta($idVentaActiva,$TipoVenta,$CuentaDestino,$Comision,$Comisionista)\r\n {\r\n \r\n $fecha=date(\"Y-m-d\");\r\n $Hora=date(\"H:i:s\");\r\n \r\n //////// Averiguamos el ultimo numero de venta/////////////////////////////////////////////////////////////////////////////////\r\n\r\n$this->NombresColumnas(\"ventas\");\r\n$maxID=$this->VerUltimoID();\r\n$campos=$this->DevuelveValores($maxID);\r\n$NumVenta=$campos[\"NumVenta\"];\r\n$NumVenta=$NumVenta+1;\r\n\r\n//////// Averiguamos el ultimo numero de factura/////////////////////////////////////////////////////////////////////////////////\r\n\r\n$this->NombresColumnas(\"facturas\");\r\n$maxID=$this->VerUltimoID();\r\n$campos=$this->DevuelveValores($maxID);\r\n$NumFact=$campos[\"idFacturas\"];\r\n$NumFact=$NumFact+1;\r\n\r\n//////// Averiguamos el ultimo numero de cotizacion/////////////////////////////////////////////////////////////////////////////////\r\n\r\n$this->NombresColumnas(\"cotizaciones\");\r\n$maxID=$this->VerUltimoID();\r\n$idCoti=$maxID+1;\r\n$campos=$this->DevuelveValores($maxID);\r\n$NumCot=$campos[\"NumCotizacion\"];\r\n$NumCot=$NumCot+1;\r\n\r\n//print(\"max id de ventas: $maxID, Numero de Venta: $NumVenta\");\r\n\r\n$DatosVentaActiva=mysql_query(\"SELECT * FROM vestasactivas WHERE idVestasActivas='$idVentaActiva';\", $this->con) or die('problemas para consultas vestasactivas: ' . mysql_error());\r\n$DatosVentaActiva=mysql_fetch_array($DatosVentaActiva);\r\n$idCliente=$DatosVentaActiva[\"Clientes_idClientes\"];\r\n\r\n$registros=mysql_query(\"SELECT * FROM preventa WHERE VestasActivas_idVestasActivas='$idVentaActiva';\", $this->con) or die('no se pudo conectar: ' . mysql_error());\r\n\r\n//$registros1=mysql_fetch_array($registros);\t\r\n\t\t\t//$this->NombresColumnas(\"productosventa\");\r\n\t\t\tif(mysql_num_rows($registros)){\r\n\t\t\t\t$i=0;\r\n\t\t\t\t//print($i);\r\n\t\t\t\t\r\n\t\t\t\twhile($registros2=mysql_fetch_array($registros)){\r\n\t\t\t\t\t$i++;\t\t\t\r\n\t\t\t\t\t//print(\"fila $i:///////////////////////////////////////////////////////////////<br>\");\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t//print_r($registros2);\r\n\t\t\t\t\t$this->NombresColumnas(\"productosventa\");\r\n\t\t\t\t\t$idProducto=$registros2[\"ProductosVenta_idProductosVenta\"];\r\n\t\t\t\t\t$campos=$this->DevuelveValores($idProducto);\r\n\t\t\t\t\t$TotalVenta=$registros2[\"TotalVenta\"]+$registros2[\"Descuento\"];\r\n\t\t\t\t\t$IVA=$registros2[\"Impuestos\"];\r\n\t\t\t\t\t$TotalCostoP=$registros2[\"Cantidad\"]*$campos[\"CostoUnitario\"]; \r\n\t\t\t\t\t////////empezamos a formar el registro que se hará en ventas empezamos desde porque el id es autoincrement y el numcuentapuc es conocido\r\n\t\t\t\t\t\r\n\t\t\t\t\t$CamposVenta[2]=$NumVenta;\r\n\t\t\t\t\t$CamposVenta[3]=$fecha;\r\n\t\t\t\t\t$CamposVenta[4]=$idProducto;\r\n\t\t\t\t\t$CamposVenta[5]=$campos[\"Nombre\"];\r\n\t\t\t\t\t$CamposVenta[6]=$campos[\"Referencia\"];\r\n\t\t\t\t\t$CamposVenta[7]=$registros2[\"Cantidad\"];\r\n\t\t\t\t\t$CamposVenta[8]=$campos[\"CostoUnitario\"];\r\n\t\t\t\t\t$CamposVenta[9]=$registros2[\"ValorAcordado\"];\r\n\t\t\t\t\t$CamposVenta[10]=$registros2[\"Impuestos\"];\r\n\t\t\t\t\t$CamposVenta[11]=$registros2[\"Descuento\"];\r\n\t\t\t\t\t$CamposVenta[12]=$registros2[\"Cantidad\"]*$campos[\"CostoUnitario\"]; //Total costo\r\n\t\t\t\t\t$CamposVenta[13]=$TotalVenta;\r\n\t\t\t\t\t$CamposVenta[14]=$TipoVenta;\r\n\t\t\t\t\t$CamposVenta[15]=\"NO\"; //cerrado en periodo\r\n\t\t\t\t\t$CamposVenta[16]=$campos[\"Especial\"];\r\n\t\t\t\t\t$CamposVenta[17]=$idCliente;\r\n\t\t\t\t\t$CamposVenta[18]=$Hora;\r\n\t\t\t\t\t$CamposVenta[19]=$registros2[\"Usuarios_idUsuarios\"];\r\n\t\t\t\t\t$CamposVenta[20]=$NumFact;\r\n\t\t\t\t\t//print_r($CamposVenta);\r\n\t\t\t\t\t\r\n\t\t\t\t\t///////////////////////////Inserto el registro en la tabla ventas\r\n\t\t\t\t\tif($TipoVenta==\"Credito\" and $idCliente==0)\r\n\t\t\t\t\t\texit(\"Usted está intentando Registrar una venta a credito sin seleccionar un cliente, por favor asignelo a esta venta antes de continuar\");\r\n\t\t\t\t\telse\t\r\n\t\t\t\t\t\t$this->GuardaRegistroVentas(\"ventas\", $CamposVenta);\r\n\t\t\t\t\t///////////////////////////Registro el movimiento de SALIDA DE LA VENTA de los productos al Kardex\r\n\t\t\t\t\t\r\n\t\t\t\t\t$Movimiento=\"SALIDA\";\r\n\t\t\t\t\t$Detalle=\"VENTA\";\r\n\t\t\t\t\t$idDocumento=$NumVenta;\r\n\t\t\t\t\t$Cantidad=$registros2[\"Cantidad\"];\r\n\t\t\t\t\t$ValorUnitario=$campos[\"CostoUnitario\"];\r\n\t\t\t\t\t$ValorTotalSalidas=round($Cantidad*$ValorUnitario);\r\n\t\t\t\t\t\r\n\t\t\t\t\t$this->RegistrarKardex(\"kardexmercancias\",\"ProductosVenta_idProductosVenta\",$fecha, $Movimiento, $Detalle, $idDocumento, $Cantidad, $ValorUnitario, $ValorTotalSalidas, $idProducto);\r\n\t\t\t\t\t\r\n\t\t\t\t\t///////////////////////////Registro el movimiento de SALDOS DESPUES DE LA VENTA de los productos al Kardex\r\n\t\t\t\t\t\r\n\t\t\t\t\t$Movimiento=\"SALDOS\";\r\n\t\t\t\t\t$CantidadSaldo=$campos[\"Existencias\"];\r\n\t\t\t\t\t$NuevoSaldo=$CantidadSaldo-$Cantidad;\r\n\t\t\t\t\t$ValorTotal=$NuevoSaldo*$ValorUnitario;\r\n\t\t\t\t\t$this->RegistrarKardex(\"kardexmercancias\",\"ProductosVenta_idProductosVenta\",$fecha, $Movimiento, $Detalle, $idDocumento, $NuevoSaldo, $ValorUnitario, $ValorTotal, $idProducto);\r\n\t\t\t\t\t\r\n\t\t\t\t\t///////////////////////////Actualiza tabla de productos venta\r\n\t\t\t\t\t\r\n\t\t\t\t\t$tabla=\"productosventa\";\r\n\t\t\t\t\t$NumRegistros=1;\r\n\t\t\t\t\t$Columnas[0]=\"Existencias\";\r\n\t\t\t\t\t//$Columnas[1]=\"CostoUnitario\";\r\n\t\t\t\t\t//$Columnas[2]=\"CostoTotal\";\r\n\t\t\t\t\t$Valores[0]=$NuevoSaldo;\r\n\t\t\t\t\t//$Valores[1]=$ValorUnitario;\r\n\t\t\t\t\t//$Valores[2]=$ValorTotal;\r\n\t\t\t\t\t$Filtro=\"idProductosVenta\";\r\n\t\t\t\t\t\r\n\t\t\t\t\t$this->EditeValoresTabla($tabla,$NumRegistros,$Columnas,$Valores,$Filtro,$idProducto);\r\n\t\t\t\t\t\r\n\t\t\t\t\t///////////////////////////Ingresar a Cotizaciones \r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t$tabla=\"cotizaciones\";\r\n\t\t\t\t\t$NumRegistros=16; \r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t$Columnas[0]=\"Fecha\";\t\t\t\t\t$Valores[0]=$fecha;\r\n\t\t\t\t\t$Columnas[1]=\"NumCotizacion\";\t\t\t$Valores[1]=$NumCot;\r\n\t\t\t\t\t$Columnas[2]=\"Descripcion\";\t\t\t\t$Valores[2]=$campos[\"Nombre\"];\r\n\t\t\t\t\t$Columnas[3]=\"Referencia\";\t\t\t\t$Valores[3]=$campos[\"Referencia\"];\r\n\t\t\t\t\t$Columnas[4]=\"ValorUnitario\";\t\t\t$Valores[4]=$registros2[\"ValorAcordado\"];\r\n\t\t\t\t\t$Columnas[5]=\"Cantidad\";\t\t\t\t$Valores[5]=$registros2[\"Cantidad\"];\r\n\t\t\t\t\t$Columnas[6]=\"Subtotal\";\t\t\t\t$Valores[6]=$registros2[\"Subtotal\"];\r\n\t\t\t\t\t$Columnas[7]=\"IVA\";\t\t\t\t\t\t$Valores[7]=$IVA;\r\n\t\t\t\t\t$Columnas[8]=\"Total\";\t\t\t\t\t$Valores[8]=round($registros2[\"Subtotal\"]+$IVA);\r\n\t\t\t\t\t$Columnas[9]=\"Descuento\";\t\t\t\t$Valores[9]=0;\r\n\t\t\t\t\t$Columnas[10]=\"ValorDescuento\";\t\t\t$Valores[10]=$registros2[\"Descuento\"];\r\n\t\t\t\t\t$Columnas[11]=\"Clientes_idClientes\";\t$Valores[11]=$idCliente;\r\n\t\t\t\t\t$Columnas[12]=\"Usuarios_idUsuarios\";\t$Valores[12]=$registros2[\"Usuarios_idUsuarios\"];\r\n\t\t\t\t\t$Columnas[13]=\"TipoItem\";\t\t\t\t$Valores[13]=\"PR\";\r\n\t\t\t\t\t$Columnas[14]=\"PrecioCosto\";\t\t\t$Valores[14]=round($campos[\"CostoUnitario\"]);\r\n\t\t\t\t\t$Columnas[15]=\"SubtotalCosto\";\t\t\t$Valores[15]=round($campos[\"CostoUnitario\"]*$registros2[\"Cantidad\"]);\r\n\t\t\t\t\t\r\n\t\t\t\t\t$this->InsertarRegistro($tabla,$NumRegistros,$Columnas,$Valores);\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t}\r\nreturn($NumVenta);\t\r\n//echo \"Venta Registrada\";\r\n\r\n}",
"function cl_contacorrenteregravinculo() { \n //classes dos rotulos dos campos\n $this->rotulo = new rotulo(\"contacorrenteregravinculo\"); \n $this->pagina_retorno = basename($GLOBALS[\"HTTP_SERVER_VARS\"][\"PHP_SELF\"]);\n }"
] |
[
"0.6169682",
"0.60450226",
"0.60238135",
"0.58766603",
"0.58105135",
"0.57797974",
"0.5748047",
"0.57355905",
"0.57233053",
"0.5698818",
"0.5660733",
"0.5659091",
"0.5649198",
"0.5640625",
"0.56251717",
"0.56095475",
"0.5566064",
"0.5543903",
"0.5509294",
"0.54937166",
"0.5470083",
"0.5456108",
"0.5438333",
"0.5433317",
"0.5424933",
"0.5417354",
"0.5415802",
"0.541447",
"0.5413824",
"0.5409368"
] |
0.648428
|
0
|
Get forums list grouped by category name
|
public function get_categories($data)
{
$table = $this->di['table']('Forum');
$list = $this->di['db']->find('Forum', 'ORDER BY priority ASC, category ASC');
$result = array();
foreach ($list as $f) {
$result[$f->category][] = $table->toApiArray($f);
}
return $result;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function get_categories($category = '')\n {\n /** @var \\tacitus89\\homepage\\entity\\category[] $entities */\n $entities = array();\n\n\t\t//it show all categories\n if($category == ''){\n $sql = 'SELECT f1.forum_id, f1.parent_id, f1.forum_name, f1.forum_desc, f1.forum_image, f1.hp_url, f1.hp_desc, f1.hp_special\n\t\t\tFROM ' . FORUMS_TABLE . ' f1, '. FORUMS_TABLE .' f2\n\t\t\tWHERE (f2.hp_show = 1 AND f2.parent_id = 0\n\t\t\t AND (f1.hp_special = 0 AND f1.hp_show = 1 AND (f1.parent_id = 0 OR f1.parent_id = f2.forum_id)) )\n\t\t\t\tOR (f1.forum_id = 543 AND f2.forum_id = 543)\n\t\t\t\tOR (f2.hp_show = 1 AND f1.hp_special = 1 AND (f1.parent_id = 0 OR f1.parent_id = f2.forum_id))\n\t\t\tORDER BY f1.hp_special, f1.left_id ASC';\n }\n\t\t//Special url\n\t\t//display all modding forums\n elseif ($category == 'modding') {\n $sql = 'SELECT f1.forum_id, f1.parent_id, f1.forum_name, f1.forum_desc, f1.forum_image, f1.hp_url, f1.hp_desc, f1.hp_special\n\t\t\tFROM ' . FORUMS_TABLE . ' f1\n\t\t\tWHERE f1.hp_show = 1 AND f1.hp_special = 1\n\t\t\tORDER BY f1.left_id ASC';\n }\n\t\t//display all forums of category\n\t\telse {\n\t\t\t$sql = 'SELECT f1.forum_id, f1.parent_id, f1.forum_name, f1.forum_desc, f1.forum_image, f1.hp_url, f1.hp_desc, f1.hp_special\n\t\t\tFROM ' . FORUMS_TABLE . ' f1\n\t\t\tRIGHT JOIN '. FORUMS_TABLE .' f2 ON (f2.left_id < f1.left_id AND f2.right_id > f1.right_id)\n\t\t\tWHERE f1.hp_show = 1 AND f2.hp_show = 1 \n\t\t\t\tAND f1.hp_special = 0 AND f2.hp_special = 0\n\t\t\t AND f2.hp_url = \"'. $category .'\"\n\t\t\tORDER BY f1.left_id ASC';\n\t\t}\n // Load all page data from the database\n $result = $this->db->sql_query($sql);\n\n while ($row = $this->db->sql_fetchrow($result))\n {\n\t\t\t//adding to pseudo-Category\n\t\t\tif($row['hp_special'] == 1)\n\t\t\t{\n\t\t\t\t$row['parent_id'] = 543;\n\t\t\t}\n\t\t\t//pseudo-Category\n\t\t\tif($row['forum_id'] == 543)\n\t\t\t{\n\t\t\t\t$row['forum_name'] = 'Modding';\n\t\t\t\t$row['hp_url'] = 'modding';\n\t\t\t}\n\t\t\t\n $category = $this->container->get('tacitus89.homepage.category')->import($row);\n if(isset($entities[$row['parent_id']]) && $row['parent_id'] > 0)\n {\n\t\t\t\t$entities[$row['parent_id']]->add_forum($category);\n }\n else\n {\n // Import each page row into an entity\n $entities[$row['forum_id']] = $category;\n }\n }\n $this->db->sql_freeresult($result);\n\n // Return all page entities\n return $entities;\n }",
"function DisplayForumCategories()\n {\n global $DB, $categoryid, $mainsettings, $sdlanguage, $sdurl, $userinfo, $usersystem;\n\n //SD343: display optional tag cloud\n $forum_tags = false;\n if(!empty($this->conf->plugin_settings_arr['display_tagcloud']))\n {\n require_once(SD_INCLUDE_PATH.'class_sd_tags.php');\n SD_Tags::$maxentries = 30;\n SD_Tags::$plugins = $this->conf->plugin_id;\n SD_Tags::$tags_title = $sdlanguage['tags_title'];\n SD_Tags::$targetpageid = $categoryid;\n SD_Tags::$tag_as_param = 'tag';\n if($forum_tags = SD_Tags::DisplayCloud(false))\n {\n if(in_array($this->conf->plugin_settings_arr['display_tagcloud'],array(1,3)))\n {\n echo $forum_tags;\n }\n }\n }\n\n echo '\n <table border=\"0\" class=\"forums\" cellpadding=\"0\" cellspacing=\"0\" summary=\"layout\" width=\"100%\"><thead><tr>';\n if(!empty($this->conf->plugin_settings_arr['display_forum_image']))\n {\n echo '<th class=\"col-forum-icon\"> </th>';\n }\n echo '<th class=\"col-forum-title\">'.$this->conf->plugin_phrases_arr['column_forum'].'</th>';\n if(!empty($mainsettings['enable_rss_forum']))\n {\n echo '<th class=\"col-rss\"><a title=\"RSS\" class=\"rss-icon\" href=\"forumrss.php\">RSS</a></th>';\n }\n echo '<th class=\"col-topic-count\">'.$this->conf->plugin_phrases_arr['column_topics'].'</th>\n <th class=\"col-post-count\">'.$this->conf->plugin_phrases_arr['column_posts'].'</th>\n <th class=\"col-last-updated\">'.$this->conf->plugin_phrases_arr['column_last_updated'].'</th>\n </tr></thead>';\n\n if(isset($this->conf) && isset($this->conf->forums_cache['categories'])) //SD343\n foreach($this->conf->forums_cache['categories'] as $fid)\n {\n if(!isset($this->conf->forums_cache['forums'][$fid])) continue; //SD343\n $entry = $this->conf->forums_cache['forums'][$fid];\n\n if(!$this->conf->IsSiteAdmin)\n {\n if(empty($entry['online'])) continue;\n $entry_groups = sd_ConvertStrToArray($entry['access_view'],'|');\n if(!empty($entry_groups) && !count(@array_intersect($userinfo['usergroupids'], $entry_groups)))\n continue;\n }\n\n if(empty($entry['parent_forum_id']) && empty($entry['is_category']))\n {\n if($res = $this->DisplayForums(0,$fid,$entry['title']))\n {\n echo $res;\n }\n continue;\n }\n\n $output = '\n <tbody>\n <tr>\n <td colspan=\"6\" class=\"category-cell\">\n <div class=\"category-title-container\">';\n\n if(strlen($entry['title']))\n {\n $image = '';\n if(!empty($entry['image']) && !empty($entry['image_h']) && !empty($entry['image_w']))\n {\n $image = '<img src=\"'.SDUserCache::$img_path.$entry['image'].'\" alt=\"\" width=\"'.(int)$entry['image_w'].'\" height=\"'.(int)$entry['image_h'].'\" />';\n }\n $output .= '<span class=\"category-image\">'.($image?$image:' ').'</span> <span class=\"category-title\">'.$entry['title'].'</span>';\n if(strlen($entry['description']))\n {\n $output .= '\n <span class=\"category-description\">' . $entry['description']. '</span>';\n }\n }\n $output .= '\n </div>\n </td>\n </tr>\n </tbody>';\n\n if($res = $this->DisplayForums($fid,0,$entry['title']))\n {\n echo $output . $res;\n }\n\n } //foreach\n\n echo '\n </table>\n ';\n\n //SD343: display optional tag cloud\n if(!empty($forum_tags) && !empty($this->conf->plugin_settings_arr['display_tagcloud']) &&\n in_array($this->conf->plugin_settings_arr['display_tagcloud'],array(2,3)))\n {\n echo $forum_tags;\n }\n\n }",
"function categories( $as_object = true )\r\n {\r\n $db =& eZDB::globalDatabase();\r\n\r\n $db->array_query( $forum_array, \"SELECT CategoryID FROM\r\n eZForum_ForumCategoryLink\r\n WHERE ForumID='$this->ID'\" );\r\n\r\n $ret = array();\r\n\r\n foreach ( $forum_array as $forum )\r\n {\r\n if ( $as_object )\r\n $ret[] = new eZForumCategory( $forum[$db->fieldName( \"CategoryID\" )] );\r\n else\r\n $ret[] = $forum[$db->fieldName( \"CategoryID\" )];\r\n }\r\n\r\n return $ret;\r\n }",
"private function categories()\n\t{\n\t\t$categories = ORM::factory('forum_cat')->find_all();\n\t\tif(0 == $categories->count())\n\t\t\treturn FALSE;\n\t\t\t\n\t\treturn $categories;\n\t}",
"function get_auth_cat()\n{\n\tglobal $db, $userdata;\n\n\t// get the cat id of all auth forums\n\t$catlist = array();\n\t$sql = \"select * from \" . FORUMS_TABLE;\n\tif ( !($result = $db->sql_query($sql)) ) message_die(GENERAL_ERROR, \"Couldn't obtain forum list.\", \"\", __LINE__, __FILE__, $sql);\n\twhile ( $row = $db->sql_fetchrow($result) )\n\t{\n\t\t$is_auth = array();\n\t\t$is_auth = auth(AUTH_ALL, $row['forum_id'], $userdata);\n\t\tif ( $is_auth['auth_view'] ) $catlist[] = $row['cat_id'];\n\t}\n\n\t// get the mother cat\n\t$t_cat = $catlist;\n\twhile ( count($t_cat) > 0 )\n\t{\n\t\t$s_cat = implode( ', ', $t_cat );\n\t\t$t_cat = array();\n\t\t$sql = \"select * from \" . CATEGORIES_TABLE . \" where cat_id in ($s_cat)\";\n\t\tif ( !($result = $db->sql_query($sql)) ) message_die(GENERAL_ERROR, \"Couldn't obtain category list.\", \"\", __LINE__, __FILE__, $sql);\n\t\twhile ( $row = $db->sql_fetchrow($result) )\n\t\t{\n\t\t\tif ( !in_array($row['cat_main'], $catlist) )\n\t\t\t{\n\t\t\t\t$catlist[] = $row['cat_main'];\n\t\t\t\t$t_cat[] = $row['cat_main'];\n\t\t\t}\n\t\t}\n\t}\n\n\t// read cat sorted\n\t$catrows = array();\n\tget_auth_cat_order( $catrows, $catlist );\n\n\treturn $catrows;\n}",
"function get_forum_list() {\n return $this->call('get_forum_list');\n }",
"function recycle_forum_categories()\n\t{\n\t\t$table_forum = Database :: get_course_table(TABLE_FORUM);\n\t\t$table_forumcat = Database :: get_course_table(TABLE_FORUM_CATEGORY);\n\t\t$sql = \"SELECT fc.cat_id FROM \".$table_forumcat.\" fc LEFT JOIN \".$table_forum.\" f ON fc.cat_id=f.forum_category WHERE f.forum_id IS NULL\";\n\t\t$res = api_sql_query($sql,__FILE__,__LINE__);\n\t\twhile ($obj = mysql_fetch_object($res))\n\t\t{\n\t\t\t$sql = \"DELETE FROM \".$table_forumcat.\" WHERE cat_id = \".$obj->cat_id;\n\t\t\tapi_sql_query($sql,__FILE__,__LINE__);\n\t\t}\n\t}",
"public function getCategorys()\r\n {\r\n $groupData = $this->getGroupById();\r\n $html = null;\r\n if ($groupData) {\r\n foreach (explode(',', $groupData['categorys']) as $categoryId) {\r\n if ($categoryId) {\r\n $itemCategorys = $this->itemCollectionFactory->create()\r\n ->addFieldToFilter('category_id', array('eq' => $categoryId))\r\n ->addFieldToFilter('status', array('eq' => 1))\r\n ->addFieldToFilter('menu_type', array('eq' => 1));\r\n if ($itemCategorys->getData()) {\r\n foreach ($itemCategorys as $item) {\r\n $html .= $this->getMegamenuHtml($item);\r\n continue;\r\n }\r\n } else {\r\n $category = $this->getCategoryById($categoryId);\r\n if ($category) {\r\n $parentClass = ($this->hasSubcategory($category->getId())) ? 'parent' : null;\r\n $html .= '<li class=\"' . $this->checkCurrentCategory($category->getId()) . ' ui-menu-item level0 ' . $this->getMenuTypeGroup($groupData['menu_type']) . ' ' . $parentClass . ' \">';\r\n $html .= '<a href=\"' . $category->getUrl() . '\" class=\"level-top\"><span>' . $category->getName() . '</span></a>';\r\n if ($this->hasSubcategory($category->getId())) {\r\n $html .= '<div class=\"open-children-toggle\"></div>';\r\n }\r\n //get html of category\r\n $html .= $this->getHtmlCategory($category,\r\n $this->getMenuTypeGroup($groupData['menu_type']));\r\n $html .= '</li>';\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return $html;\r\n }",
"public function getSubForumTitles($cat_id)\n\t\t\t{\n\t\t\t\t$sql = 'SELECT c.cat_id, c.cat_name, c.seo_title, c.has_child, c.description, c.total_discussions, c.total_boards, c.total_solutions, c.last_post_user_id'.\n\t\t\t\t\t\t', DATE_FORMAT(last_post_date, \\''.$this->CFG['mysql_format']['date_time_meridian'].'\\') AS last_post_date'.\n\t\t\t\t\t\t', DATE_FORMAT(last_post_date, \\''.$this->CFG['mysql_format']['new_date'].'\\') AS last_post_date_only'.\n\t\t\t\t\t\t', DATE_FORMAT(last_post_date, \\'%h:%m %p\\') AS last_post_time_only, lp.'.$this->getUserTableField('name').' as last_post_user'.\n\t\t\t\t\t\t', lp.'.$this->getUserTableField('display_name').' as last_post_name'.\n\t\t\t\t\t\t' FROM '.$this->CFG['db']['tbl']['category'].' As c LEFT JOIN '.$this->CFG['db']['tbl']['users'].' As lp ON c.last_post_user_id=lp.'.$this->getUserTableField('user_id').\n\t\t\t\t\t\t' WHERE status = \\'Active\\' AND parent_id = '.$this->dbObj->Param($cat_id);\n\n\t\t\t\t$field_values = array();\n\t\t\t\t$field_values[] = $cat_id;\n\t\t\t\t$sql .= ' ORDER BY disporder';\n\t\t\t\t$stmt = $this->dbObj->Prepare($sql);\n\t\t\t\t$rs = $this->dbObj->Execute($stmt, $field_values);\n\t\t\t\tif (!$rs)\n\t\t\t\t trigger_db_error($this->dbObj);\n\n\t\t\t\t$showDiscussionTitles_arr = array();\n\t\t\t\twhile($row = $rs->FetchRow()) {\n\t\t\t\t\t$row['subforum']['url'] = 'discussions.php?cat='.$row['cat_id'];\n\t\t\t\t\t$row['category_description_manual'] = nl2br(wordWrapManual($row['description'], 15, 100));\n\t\t\t\t\t$row['lastPost']['url'] = $this->CFG['site']['url'].'admin/viewMembers.php?uid='.$row['last_post_user_id'];\n\t\t\t\t\t$row['last_post_name1'] = stripString($row['last_post_name'], 20);\n\t\t\t\t\t$showDiscussionTitles_arr[] = $row;\n\t\t\t\t}\n\t\t\t\treturn $showDiscussionTitles_arr;\n\t\t\t}",
"protected function fetchForums()\n\t{\n\t\t$forums = array();\n\n\t\tforeach( $this->db->select( '*', 'node', array( \"node.nodeid<>2 AND closure.parent=? AND node.contenttypeid=?\", $this->fetchType( 'Thread' ), $this->fetchType( 'Channel' ) ) )->join( 'closure', \"closure.child = node.nodeid\" ) AS $node )\n\t\t{\n\t\t\t$forums[$node['nodeid']] = $node;\n\t\t}\n\n\t\treturn $forums;\n\t}",
"public function getCategories();",
"public function getCategories();",
"function getForumCategoryFields() {\n return array(\n 'nom',\n 'image',\n 'niveau',\n 'ordre'\n );\n}",
"private function get_posts_list()\n\t{\n\t\t$category = $this->filter;\n\n\t\t# filter posts by?\n\t\t$where = array();\n\t\tif('all' != $category)\n\t\t\t$where['forum_cats.url'] = $category;\n\t\t\t\n\t\t# order posts by?\n\t\t$order_by = ('newest' == $this->sort)\n\t\t\t? 'forum_cat_post_comment:created'\n\t\t\t: (('votes' == $this->sort)\n\t\t\t\t? 'forum_cat_post_comment:vote_count'\n\t\t\t\t: 'forum_cat_posts.last_active');\n\n\t\t$posts = ORM::factory('forum_cat_post')\n\t\t\t->select('forum_cat_posts.*, forum_cats.name, forum_cats.url')\n\t\t\t->with('forum_cat_post_comment')\n\t\t\t->join('forum_cats', 'forum_cats.id', 'forum_cat_posts.forum_cat_id')\n\t\t\t->where($where)\n\t\t\t->orderby(\"$order_by\", 'desc')\n\t\t\t->find_all();\n\t\tif(0 == $posts->count())\n\t\t\treturn 'No posts in this category';\n\t\t\n\t\t$view = new View('public_forum/posts_list');\t\t\n\t\t$view->posts = $posts;\n\t\treturn $view;\n\t}",
"public function getAllCategories();",
"function getForumCategoryListCfg() {\n return array(\n 'sqlQuery' => 'SELECT id, nom, ordre FROM '. FORUM_CAT_TABLE,\n 'defaultSortables' => array(\n 'order' => array('ordre', 'nom')\n ),\n 'fields' => array(\n 'nom' => array('label' => __('CATEGORY')),\n 'ordre' => array('label' => __('ORDER'))\n ),\n 'edit' => array(),\n 'delete' => array()\n );\n}",
"public function findCategories();",
"public static function categories() {\n $db = Db::getInstance();\n $req = $db->query('SELECT * FROM category');\n return $req->fetchAll(PDO::FETCH_ASSOC);\n }",
"public function showDiscussionTitles()\n\t\t\t{\n\t\t\t\t$sql = 'SELECT cat_id, cat_name, seo_title, has_child, total_discussions'.\n\t\t\t\t\t\t' FROM '.$this->CFG['db']['tbl']['category'].\n\t\t\t\t\t\t' WHERE status = \\'Active\\'';\n\n\t\t\t\t$field_values = array();\n\t\t\t\tif ($this->fields_arr['cat'])\n\t\t\t\t\t{\n\t\t\t\t\t\t$sql .= ' AND cat_id ='.$this->dbObj->Param($this->fields_arr['cat']);\n\t\t\t\t\t\t$field_values[] = $this->fields_arr['cat'];\n\t\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t$sql .=' AND parent_id = 0';\n\t\t\t\t\t}\n\t\t\t\t$sql .= ' ORDER BY disporder';\n\t\t\t\t$stmt = $this->dbObj->Prepare($sql);\n\t\t\t\t$rs = $this->dbObj->Execute($stmt, $field_values);\n\t\t\t\tif (!$rs)\n\t\t\t\t\t trigger_db_error($this->dbObj);\n\n\t\t\t\t$showDiscussionTitles_arr = array();\n\t\t\t\twhile($row = $rs->FetchRow()) {\n\t\t\t\t\t//$row['subforum_titles'] = array();\n\t\t\t\t\t$row['discussion_titles'] = $this->getDiscussionTitles($row['cat_id']);\n\t\t\t\t\t//if(!$row['discussion_titles'])\n\t\t\t\t\t$row['subforum_titles'] = $this->getSubForumTitles($row['cat_id']);\n\t\t\t\t\t$showDiscussionTitles_arr[] = $row;\n\t\t\t\t}\n\t\t\t\treturn $showDiscussionTitles_arr;\n\t\t\t}",
"public function getCategories()\n {\n $categories = array();\n $collection = Mage::getModel('faq/category')->getCollection();\n $collection->getSelect()->order('position ASC');\n foreach ($collection as $category) {\n if ($category->getIsActive() && $category->isVisible()) {\n $categories[$category->getId()] = $category;\n }\n }\n return $categories;\n }",
"public function getForumList() : array\r\n {\r\n $postdata = http_build_query(\r\n array(\r\n 'token' => $this->config['app-token'],\r\n 'getForumName' => $this->getForumName\r\n )\r\n );\r\n $opts = array('http' =>\r\n array(\r\n 'method' => 'POST',\r\n 'header' => 'Content-Type: application/x-www-form-urlencoded',\r\n 'content' => $postdata\r\n )\r\n );\r\n $context = stream_context_create($opts);\r\n $result = file_get_contents($this->config['endPoint'] .'GetForumList', true, $context);\r\n\r\n $data = json_decode($result, true);\r\n if($data['statusCode'] == 'SUCCESS'){\r\n //TODO create message or change page locations\r\n return $data;\r\n }\r\n else if($data['statusCode'] == 'INVALID_TOKEN'){\r\n return [\"message\" => \"there was a problem with your request please contact system administrator.\"];\r\n }\r\n else{\r\n //TODO throw error with end user message\r\n return [\"message\" => \"there was a error processing your request please contact system administrator.\"];\r\n }\r\n }",
"private function getCategories($groupID = null)\n {\n $this->db->select('*', '`bf_categories`')\n ->where('`visible` = 1' . \n ($groupID ? ' AND `category_group_id` = \\'' . intval($groupID) . '\\'' : ''))\n ->order('name', 'asc')\n ->execute();\n \n // Collect categories\n $categoryCollection = array();\n while($category = $this->db->next())\n {\n // Get image\n $image = $this->parent->db->getRow('bf_images', $category->image_id);\n \n // No image?\n if(!$image)\n {\n // Default image\n $imageURL = \n $this->parent->config->get('com.b2bfront.site.default-image', true);\n }\n else\n {\n $imageURL = Tools::getImageThumbnail($image->url);\n }\n \n $categoryCollection[] = array(\n 'name' => $category->name,\n 'id' => $category->id,\n 'url' => $imageURL\n );\n }\n \n return $categoryCollection;\n }",
"function faq_build_get_categories() { //retrieve all categories\n\tglobal $wpdb;\n\t$res = $wpdb->get_results(\"SELECT * FROM \".FAQBUILDDBCATEGORY.\" ORDER BY name ASC;\",ARRAY_A);\n\t$categories = array();\n\tif(is_array($res)) {\n\t\tforeach($res as $row) {\n\t\t\t$c = new FAQ_Build_Category();\n\t\t\tif($c->fromArray($row))\n\t\t\t\t$categories[] = $c;\n\t\t\telse\n\t\t\t\tunset($c);\n\t\t}\n\t}\n\treturn $categories;\n}",
"private function groupByCategory(){\n \n $searchResults = null;\n $items = $this->items; \n \n foreach($items as $item){\n foreach($item->categories as $category_tmp){ \n $searchResults[$category_tmp][] = $item;\n } \n }\n \n return $searchResults;\n }",
"public function getCategories()\n\t{\n\t\treturn BlogCategory::all();\t\n\t}",
"public function getAllWithCategory();",
"public function getAllCategoryNames();",
"public function listFaqs()\n {\n $category = DB::table(\"faq_categories\")->get()->each(function ($value) {\n $faqs =DB::table('pages')->where([self::FAQ_CAT_ID => $value->id, \"type\" => \"faqs\"])->orderBy(self::ORDER_ID, 'asc')->get();\n foreach ($faqs as $val) {\n $val->descriptions = $val->description;\n }\n\n $value->faqs =$faqs ;\n });\n return [self::STATUS => true, \"data\" => $category];\n }",
"function get_categories_by_group()\n\t{\n\t\t// get variables\n\t\t$vars = $this->_get_vars('get', array('group_id'));\n\n\t\t// start hook\n\t\t$vars = $this->_hook('get_categories_by_group_start', $vars);\n\n\t\t// load channel data library\n\t\t$this->_load_library('channel_data');\n\n\t\t$data = $this->EE->channel_data_lib->get_category_by_group($vars['group_id'])->result();\n\n\t\t// end hook\n\t\t$data = $this->_hook('get_categories_by_group_end', $data);\n\n\t\t$this->response($data);\n\t}",
"public function getCategoryList()\n\t{\n\t\tif (cookie('staffAccount') != '') {\n\t\t\t// sql\n\t\t\t$category = D('Category');\n\t\t\t$sql = \"SELECT * FROM lib_category;\";\n\t\t\t$return = $category->query($sql);\n\t\t\t$result = array();\n\t\t\tfor ($k = 0; $k < count($return); $k++) {\n\t\t\t\tarray_push($result, $return[$k]['category']);\n\t\t\t}\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\t'cat' => json_encode($result)\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' => 'SQL Error!'\n\t\t\t\t));\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\t}"
] |
[
"0.6917915",
"0.6669657",
"0.66655284",
"0.64551497",
"0.64397806",
"0.6352046",
"0.6319351",
"0.63084525",
"0.6255787",
"0.624772",
"0.62321514",
"0.62321514",
"0.6209879",
"0.6196391",
"0.61936826",
"0.6161975",
"0.6121115",
"0.60677123",
"0.6043509",
"0.60170734",
"0.60083973",
"0.5976735",
"0.59702575",
"0.5963446",
"0.5962386",
"0.59521204",
"0.59496224",
"0.5932677",
"0.5887721",
"0.58656"
] |
0.6677569
|
1
|
Get topic messages list
|
public function get_topic_message_list($data)
{
if (!isset($data['forum_topic_id'])) {
throw new \Box_Exception('Forum Topic ID not passed');
}
$table = $this->di['table']('ForumTopicMessage');
list($sql, $params) = $table->getSearchQuery($data);
$per_page = $this->di['array_get']($data, 'per_page', $this->di['pager']->getPer_page());
$pager = $this->di['pager']->getSimpleResultSet($sql, $params, $per_page);
foreach($pager['list'] as $key => $item){
$forum = $this->di['db']->getExistingModelById('ForumTopicMessage', $item['id'], 'Forum topic message not found');
$pager['list'][$key] = $table->toApiArray($forum);
}
return $pager;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getTopics()\n {\n return [\n 'topicName' => 1\n ];\n }",
"public function getAllTopic()\n {\n return $this->dal->getTopic(null,false);\n }",
"public function getMessages();",
"public function getMessages();",
"public function getMessages();",
"public function getMessages();",
"public function getMessages();",
"public function getMessages();",
"public function getMessages();",
"public function topicLists()\n {\n $this->adapter = $this->serviceLocator->get('Zend\\Db\\Adapter\\Adapter');\n $sql = \"select * from topics\";\n $statement = $this->adapter->query($sql);\n $result = $statement->execute();\n\n return $result;\n }",
"public function getTopics()\n {\n $headers = $this->getDefaultHeaders();\n\n // Accecpt header is needed to fetch the topics\n $headers[\"Accept\"] = \"application/vnd.github.mercy-preview+json\";\n\n $response = $this->client->request(\n 'GET',\n $this->api . $this->repo . \"/topics\",\n array(\n \"headers\" => $headers\n )\n );\n\n if ($response->getStatusCode() == 200) {\n $body = $response->getBody();\n $body = json_decode($body, true);\n return $body[\"names\"];\n }\n\n return array();\n }",
"public function getMessages() {}",
"public function getMessages() {}",
"public function get_messages() {\n\t\t$messages = $this->_read_messages();\n\t\t$this->clear_messages();\n\t\treturn apply_filters( 'tn_get_messages', $messages );\t\n\t}",
"public function get_topic_messages($topic_id) {\n $messages = Message::select(\n 'message.message_id',\n 'message.content',\n 'message.reply_to',\n 'message.created_at',\n 'message.created_by',\n 'user.user_id AS author_id',\n 'user.display_name AS author_name',\n 'topic.topic_id'\n )\n ->leftJoin('topic', 'topic.topic_id', '=', 'message.topic_id')\n ->leftJoin('user', 'user.user_id', '=', 'message.created_by')\n ->where('topic.topic_id', $topic_id)\n ->orderBy('message.created_at', 'DESC')\n ->get();\n $topic = Topic::select(\n 'topic.title',\n 'topic.content',\n 'topic.created_at',\n 'topic.created_by',\n 'user.display_name AS author_name'\n )\n ->leftJoin('user', 'user.user_id', '=', 'topic.created_by')\n ->where('topic.franchise_id', $this->franchise_id)\n ->where('topic.club_id', $this->club_id)\n ->where('topic.topic_id', $topic_id)\n ->first();\n\n $results = array(\n 'topic_id' => $topic_id,\n 'author_name' => $topic->author_name,\n 'title' => $topic->title,\n 'content' => $topic->content,\n 'created_at' => $topic->created_at->toDateTimeString(),\n 'created_by' => $topic->created_by,\n 'messages' => $messages\n );\n\n return response()->json($results, 200);\n }",
"public function get_cahnrs_topics() {\n\n\t\t$topics = array();\n\n\t\t$response = wp_remote_get( 'http://api.wpdev.cahnrs.wsu.edu/?service=topics' );\n\t\tif ( ! is_wp_error( $response ) ) {\n\t\t\t$body = wp_remote_retrieve_body( $response );\n\t\t\tif ( ! is_wp_error( $body ) ) {\n\t\t\t\t$topics = json_decode( $body, true );\n\t\t\t}\n\t\t}\n\n\t\treturn $topics;\n\n\t}",
"function GetMessages()\n\t{\n\t\t$trns = LiveChat::GetSessionsHeaders(array('sid' => $this->sid));\n\t\t$trns = $trns[0];\n\t\t\n\t\t$r = $this->db->q(\"\n\t\t\tSELECT *\n\t\t\tFROM #_PREF_lc_messages messages\n\t\t\t LEFT JOIN #_PREF_lc_users users ON messages.user_id = users.user_id\n\t\t\tWHERE messages.sid = \". $this->sid .\"\n\t\t\");\n\t\t\n\t\t$chat = array();\n\t\twhile ($item = $this->db->fetchAssoc()) {\n\t\t\t$chat[] = $item;\n\t\t}\n\t\t\n\t\t$trns['messages'] = $chat;\n\t\treturn $trns;\n\t}",
"public function getMessages(): array;",
"public function getMessages(): array;",
"public function getMessages(): array;",
"public function getMessages(): Collection;",
"public function getMessages(): Collection;",
"function getTopics()\n {\n\n $topics = \"SELECT * from topics\";\n $topicsresult = $this->ds->select($topics); \n //print_r($topicsresult);\n return $topicsresult;\n }",
"public function index()\n {\n return Topic::all();\n }",
"public function index()\n {\n return Topic::all();\n }",
"public function index()\n {\n return Topic::all();\n }",
"public function get_topics()\n {\n return $this->connection->query_select_value('threads', 'COUNT(*)');\n }",
"public function list_($topic = null)\n {\n //getAuthentication()->requireAuthentication();\n $webhooks = $this->webhook->getAll($topic);\n if($webhooks)\n return $this->success(\"Successfully retrieved webhooks\", $webhooks);\n else\n return $this->error(\"Error getting webhooks\", false);\n }",
"public function fetchMessages(){\n\t\t$sql = $this->dbh->query(\"SELECT * FROM `wsMessages`\");\n\t\t$msgs = $sql->fetchAll();\n\t\treturn $msgs;\n\t}",
"public function getMessages()\n\t{\n\t\t$messages = Message::orderBy( 'created_at', 'asc' )->get();\n\t\treturn $messages;\n\t}"
] |
[
"0.7135517",
"0.71164143",
"0.7090743",
"0.7090743",
"0.7090743",
"0.7090743",
"0.7090743",
"0.7090743",
"0.7090743",
"0.707463",
"0.6953233",
"0.6943801",
"0.6943801",
"0.68840235",
"0.6883212",
"0.6717567",
"0.67139053",
"0.66860235",
"0.66860235",
"0.66860235",
"0.66675764",
"0.66675764",
"0.66619956",
"0.6647634",
"0.6647634",
"0.6647634",
"0.6633928",
"0.6629691",
"0.65878737",
"0.6584154"
] |
0.71788394
|
0
|
/ Devuelve el nombre de un campo de una consulta
|
function nombrecampo($numcampo){return mysqli_field_name($this->Consulta_ID, $numcampo);}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function nombrecampo($numcampo) {\r\n\r\n return mysql_field_name($this->Consulta_ID, $numcampo);\r\n\r\n}",
"function nombreCampo($result, $indice){\n\t return mysql_field_name($result, $indice);\t\n\t}",
"public function nombreCampo($numcampo) {\n\t\t$meta = $this->query->getColumnMeta($numcampo);\n\t\t$resultado = false;\n\t\tif ($meta !==false){\n\t\t\t$resultado = $meta['name'];\n\t\t}\n\t\treturn $resultado;\n\t}",
"public function get_field_name();",
"function field_name($sth,$index){\n try{\n switch(dbconection::$conntype){\n case \"pdo\" : return $sth->getColumnMeta($index)[\"name\"]; break;\n case \"mysql\" : return mysqli_fetch_field_direct($sth,$index)->name; break;\n case \"postgresql\" : return pg_field_name($sth,$index); break;\n default : throw new Exception(\"Nenhum tipo de conexão definida.\");\n }\n }catch(Exception $e){\n printr(\"NAME FIELDS ERROR : \".$e->getMessage());\n }\n }",
"public function field_name($result, $index){\r\n\t\t$obj_field = new ADOFieldObject();\r\n\t\t$obj_field = $result->FetchField($index);\r\n\t\treturn isset($obj_field->name) ? $obj_field->name : \"\";\r\n\t}",
"public function getFieldName() {}",
"function sql_field_name($res, $offset = 0)\n {\n $column = $res->getColumnMeta($offset);\n if ($column) {\n return $column['name'];\n }\n return false;\n }",
"public function campo($nombre) {}",
"function db_field_name($qid, $fieldno) {\n\n\treturn mysqli_fetch_field_direct($qid, $fieldno);\n}",
"function getFieldName($n){\n\t\t$field = $this->fields[$n]['Field'];\n\t\treturn $field;\n\t}",
"public function fieldName($result = false, $field_offset = 0){\n $this->resCalc($result);\n return mysql_field_name($result, $field_offset);\n }",
"public function obtener_nombre()\n {\n echo \" el nombre es del alumno es: \" .$this -> nombre; \n }",
"public function getDbFieldName($field_name);",
"public function getName(){ return $this->getField('name'); }",
"function field_name($number, $resultQuery=''){\n\t\tif(!$this->Id_Connection){\n\t\t\treturn false;\n\t\t}\n\t\tif(!$resultQuery){\n\t\t\t$resultQuery = $this->lastResultQuery;\n\t\t\tif(!$resultQuery){\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\tif(($fieldName = pg_field_name($resultQuery, $number))!==false){\n\t\t\treturn $fieldName;\n\t\t} else {\n\t\t\t$this->lastError = pg_last_error($this->Id_Connection);\n\t\t\t$this->log($this->error(), Logger::ERROR);\n\t\t\treturn false;\n\t\t}\n\t\treturn false;\n\t}",
"function fieldname($fieldnum) {\r\n\t\treturn @mysql_field_name( $this->result, $fieldnum );\r\n\t}",
"function wrapper_field_name($columnnum) {\n\t\treturn $this->functions['field_name']($this->query_id, $columnnum);\n\t}",
"function getField($campo)\n{\n\treturn $this->res2[$campo];\n}",
"function get_fields_name()\n\t{\n\t\treturn $this->db->list_fields( $this->table );\n\t}",
"public function fetchField();",
"public function field_name( $qHanle, $offset )\r\n\t{\r\n\t\treturn $qHanle->Fields( $offset )->Name;\r\n\t}",
"function field_name($number, $resultQuery=''){\n\t\tif(!$this->id_connection){\n\t\t\treturn false;\n\t\t}\n\t\tif(!$resultQuery){\n\t\t\t$resultQuery = $this->last_result_query;\n\t\t\tif(!$resultQuery){\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\tif(($fieldName = pg_field_name($resultQuery, $number))!==false){\n\t\t\treturn $fieldName;\n\t\t} else {\n\t\t\tthrow new DbException($this->error(), $this->no_error());\n\t\t\treturn false;\n\t\t}\n\t\treturn false;\n\t}",
"public function field_name($number, $result_query=''){\n\t\tif(!$this->id_connection){\n\t\t\treturn false;\n\t\t}\n\t\tif(!$result_query){\n\t\t\t$result_query = $this->last_result_query;\n\t\t\tif(!$result_query){\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\tif(($fieldName = ibase_field_name($result_query, $number))!==false){\n\t\t\treturn $fieldName;\n\t\t} else {\n\t\t\tthrow new DbException($this->error(), $this->no_error());\n\t\t\treturn false;\n\t\t}\n\t\treturn false;\n\t}",
"public function getNombreCompleto() {\n\t\treturn $this->txt_username . ' ' . $this->txt_apellido_paterno . ' ' . $this->txt_apellido_materno;\n\t}",
"public function getBuscaNombre(){\n $sql = \"SELECT count(id) AS PlanesName\n FROM \". $this->db_table .\"\n WHERE PlanesName = ? AND id <> ? \";\n\n $stmt = $this->conn->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL));\n\n $stmt->bindParam(1, $this->PlanesName, PDO::PARAM_STR);\n\t\t\t$stmt->bindParam(2, $this->id, PDO::PARAM_INT);\n\n $stmt->execute();\n\n $dataRow = $stmt->fetch(PDO::FETCH_ASSOC);\n \n $this->PlanesName = $dataRow['PlanesName'];\n }",
"function getDatosNombre_dl()\n {\n $nom_tabla = $this->getNomTabla();\n $oDatosCampo = new core\\DatosCampo(array('nom_tabla' => $nom_tabla, 'nom_camp' => 'nombre_dl'));\n $oDatosCampo->setEtiqueta(_(\"nombre de la delegación\"));\n $oDatosCampo->setTipo('texto');\n $oDatosCampo->setArgument(30);\n return $oDatosCampo;\n }",
"public function getFieldName() {\n return $this->fieldName;\n }",
"public function getFieldName()\r\n\t{\r\n\t\treturn $this->name;\r\n\t}",
"function getName($id, $query) {\n\n\t\tglobal $db, $f;\n\n\t\t$strSQL\t\t= \"SELECT\n\t\t\t\t\tnama \n\t\t\t\t FROM\n\t\t\t\t \ttbl_\".$query.\" \n\t\t\t\t WHERE\n\t\t\t\t \tid = $id\";\n\n\t\t$result = $db->Execute($strSQL);\n\t\tif (!$result) print $db->ErrorMsg();\n\t\t$row \t= $result->FetchRow();\n\n\t\t$nama\t= $row[$f->fmtCase('nama')];\n\n\t\treturn $nama;\n\t}"
] |
[
"0.7922134",
"0.7377288",
"0.71420497",
"0.7060528",
"0.70041186",
"0.7001186",
"0.6884735",
"0.68751854",
"0.6776885",
"0.65124124",
"0.64981425",
"0.6433757",
"0.6430387",
"0.6429114",
"0.64281505",
"0.63923633",
"0.6350692",
"0.6342653",
"0.6298511",
"0.6282917",
"0.62797976",
"0.62596875",
"0.62311023",
"0.6226056",
"0.6210624",
"0.62066215",
"0.62008584",
"0.61841273",
"0.6163536",
"0.61558855"
] |
0.8191316
|
0
|
Adds costs associated with a vehicle
|
public function createCosts(Request $request, $vehicleId)
{
$cost = Cost::create([
'vehicle_id' => $vehicleId,
'car_valet' => $request->input('car_valet'),
'mot' => $request->input('mot'),
'windscreen' => $request->input('windscreen'),
'dents_scratches' => $request->input('dents_scratches'),
'oil_filter' => $request->input('oil_filter'),
'fuel_topup' => $request->input('fuel_topup'),
'tyres' => $request->input('tyres'),
'timing_chain' => $request->input('timing_chain'),
'vat' => $request->input('vat'),
'advertisement' => $request->input('advertisement'),
'other_costs' => $request->input('other_costs')
]);
return response()->json([
'status' => 200,
'message' => 'Costs have been added successfully',
'data' => $cost
]);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getCost() {\n return 15 + $this->carService->getCost();\n }",
"public function show(VehicleRequest $request)\n {\n \n $input = $request->input();\n $cost = $request->input('purchase_cost');\n\n\n \n // depreciation\n $depreciation = new depreciationCost($cost);\n $depreciation_amount = $depreciation->depreciateCalc();\n\n\n // interest \n $carInterest = new interestCost($cost);\n $interest_amount = $carInterest->interestCalc();\n $hire_amount = $carInterest->hirePurchase();\n\n // interest total\n $interest_total = $interest_amount + $hire_amount;\n\n\n $carInsurance = new insuranceCost($cost);\n $insurance_amount = $carInsurance->insuranceCalc();\n\n \n $cat = $request->input('category');\n\n //subscription\n $subscription_cost =$request->input('subs');\n\n\n //parking default\n $parking_cost = 93500;\n\n //liscence default\n $liscence_cost = 0;\n //dd($liscence_cost);\n\n $fixed_cost = $liscence_cost + $parking_cost + $subscription_cost + $insurance_amount + $interest_total + $depreciation_amount;\n \n\n\n //fixed cost per km\n $fixed_costs_km = round ($fixed_cost / 30000, 2);\n \n \n\n \n \n //Operating Cost\n\n $oil_cost = $request->input('oils');\n $drive = $request->input('oils');\n $services_cost = $request->input('services');\n $repairs_cost = $request->input('repairs');\n $tyres_cost = $request->input('tyres');\n \n\n //get distance and fuel price\n $capacity_id = $request->input('capacity');\n $fuel_worth = $this->getFuels($capacity_id);\n $distance = $this->getDistance($capacity_id);\n \n\n $fuel_cost = new runningCost($fuel_worth, $distance,);\n $fuel = $fuel_cost->fuelCalc();\n\n\n \n $operating_costs = $oil_cost + $services_cost + $repairs_cost + $tyres_cost + $fuel;\n\n \n //Total Running Cost per KM\n\n \n $running_cost = $fixed_costs_km + $operating_costs;\n\n \n \n \n return view('frontend.costs')->with(compact('fixed_cost','operating_costs','parking_cost','liscence_cost','depreciation_amount','interest_total','subscription_cost','insurance_amount','parking_cost','oil_cost','services_cost','repairs_cost','tyres_cost','drive', 'fuel', 'fixed_costs_km', 'running_cost'));\n }",
"public function getCost();",
"function actualizarCostos($id_vehiculo)\n {\n $sql = \"\n SELECT \n *\n FROM\n gastos\n WHERE \n id_vehiculo = '$id_vehiculo' AND\n eliminado = '0' \n \";\n \n $gastos = $this->getQuery($sql);\n $vehiculos = $this->getRegistros($id_vehiculo);\n \n foreach ($vehiculos as $row) \n {\n $_registro = array(\n 'precio_costo' => $row->precio_toma,\n 'id_calculo' => $row->id_calculo, \n 'calculo' => $row->calculo,\n );\n }\n \n // Suma Costo del Vehiculo\n if($gastos)\n {\n foreach ($gastos as $gasto) \n {\n if($gasto->aumenta_costo == 1)\n {\n $_registro['precio_costo'] = $_registro['precio_costo'] + $gasto->monto;\n }\n } \n }\n \n // Cambio de costos del vehiculo\n if($_registro['id_calculo'] == 1)\n {\n $porcentaje = $_registro['calculo'] * $_registro['precio_costo'] / 100;\n $_registro['precio_venta'] = $_registro['precio_costo'] + $porcentaje; \n }else if($_registro['id_calculo'] == 2)\n {\n $_registro['precio_venta'] = $_registro['precio_costo'] + $_registro['calculo'];\n }\n \n $where = array(\n 'id_vehiculo' => $id_vehiculo,\n ); \n \n $this->update($_registro, $where);\n }",
"public function getBaseTotalInvoicedCost();",
"public function addVehicles(Vehicle $vehicle)\n {\n $vehicles = $this->getCurrentVehicles();\n if (!in_array($vehicle, $vehicles) && ($vehicle instanceof Bicycle || $vehicle instanceof Skateboard)) {\n array_push($vehicles, $vehicle);\n $this->setCurrentVehicles($vehicles);\n }\n }",
"public function routeCost(){\n return $this->hasMany(RouteCost::class, 'rute_id', 'id');\n }",
"public function addCarTechnical()\n {\n /** @var TechnicalOption[] $technicalOptions */\n $technicalOptions = TechnicalOption::find()->all();\n\n foreach ($technicalOptions as $option)\n {\n $carTechnical = new CarTechnical();\n $carTechnical->car_id = $this->id;\n $carTechnical->tech_option_id = $option->id;\n $carTechnical->save();\n }\n }",
"private function calculateCost() : void\n {\n $graph = [];\n $data = $this->data->whereNotIn('container_id', $this->containers);\n\n $countAccumulateProductTypes = count($this->accumulateProductTypes);\n foreach ($data as $key => $value) {\n $graph[$key] = $this->getCost($this->accumulateProductTypes, $value, $countAccumulateProductTypes);\n }\n $this->graph = collect($graph);\n }",
"public function getTotalCostAttribute(){\n return $this->routeCost()->select(['cost_id', DB::raw('round(AVG(`cost_per_ton`), 0) AS cost_per_ton')])->groupBy('cost_id')->get()->sum('cost_per_ton');\n }",
"public function getCosts()\n {\n return $this->_costs;\n }",
"function AddProduct() {\n\t$customer_id=$_GET['customer_id'];\n\n\t$invoice_id=$_GET['invoice_id'];\n\n\t$invoice_item_id = $_POST['invoice_item_id'];\n\n\t$service_type = $_POST['service_type'];\n\n\t$service_range = $_POST['service_range'];\n\n\t$price = $_POST['price'];\n\n\t$value = ($_POST['price'] * $_POST['service_range'])-(($_POST['price'] * $_POST['service_range'])*($_POST['vat']/(100+$_POST['vat'])));\n\t$vat_percent = $_POST['vat'];\n\n\t$vat= ($_POST['price'] * $_POST['service_range'])*($_POST['vat']/(100+$_POST['vat']));\n\n\t$vat_value =(($_POST['price'] * $_POST['service_range'])-(($_POST['price'] * $_POST['service_range'])*($_POST['vat']/(100+$_POST['vat']))))+\n\t(($_POST['price'] * $_POST['service_range'])*($_POST['vat']/(100+$_POST['vat'])));\n\tif ($_POST['rebate']>0) {\n\t\t$rabat = (($_POST['price'] * $_POST['service_range']/100)*$_POST['rebate']);\n\t}else{\n\t\t$rebate = $_POST['rebate'];}\n\n\t\tif ($_POST['rebate']>0) {\n\t\t\t$total_value = ((($_POST['price'] * $_POST['service_range'])-(($_POST['price'] * $_POST['service_range'])*($_POST['vat']\n\t\t\t\t/(100+$_POST['vat']))))+(($_POST['price'] * $_POST['service_range'])*($_POST['vat']/(100+$_POST['vat']))))\n\t\t\t-(($_POST['price']*$_POST['service_range'])/100*$_POST['rebate']);\n\t\t}else{\n\t\t\t$total_value = (($_POST['price'] * $_POST['service_range'])-(($_POST['price'] * $_POST['service_range'])\n\t\t\t\t*($_POST['vat']/(100+$_POST['vat'])))+(($_POST['price'] * $_POST['service_range'])*($_POST['vat']/(100+$_POST['vat']))));}\n\n\t\t\t$query = \"INSERT INTO invoice_item (invoice_item_id,invoice_id,customer_id, service_range, service_type, price, value,\n\t\t\t vat ,vat_percent,vat_value,rebate,total_value)\n\t\t\tVALUES (NULL,'$invoice_id','$customer_id','$service_range','$service_type','$price','$value',\n\t\t\t\t'$vat','$vat_percent','$vat_value','$rebate','$total_value')\";\n\t\t\t$result = mysql_query($query);\n\n\t\t\tif(!$result) \n\t\t\t{\n\t\t\t\tdie(mysql_error());\n\t\t\t}\n\n\t\t}",
"public function has_additional_costs() {\n\t\treturn true;\n\t}",
"public function setAdditionalCostAttribute($value)\n {\n $this->attributes['additional_cost'] = Utils::numbersOnly($value);\n }",
"public function get_services_cost(){\n //find all the requested services on a deadbody\n $sql = \"SELECT * FROM requested_service WHERE dead_no={$this->id}\";\n $this->requested_services = RequestedService::find_by_sql($sql);\n $total_debit = 0;\n //for each requested service find price and add to total debit\n foreach ($this->requested_services as $requested_service) {\n $service = Service::find_by_id($requested_service->service_no);\n $total_debit += $service->price;\n }\n return $total_debit;\n }",
"public function cost()\n {\n return $this->beverage->cost() + $this->cost;\n }",
"function get_cost() {\n\t\t$this->_event->log(\"get_costs\", $_SERVER['REQUEST_TIME'], 5, \"cloudprofile.class.php\", \"Calulating bill for cr $this->id\", \"\", \"\", 0, 0, 0);\n\t\t$cr_appliance_id = $this->appliance_id;\n\t\t$app_id_arr = explode(\",\", $cr_appliance_id);\n\t\t$cr_costs_final = 0;\n\t\tforeach ($app_id_arr as $app_id) {\n\t\t\t$cloud_app = new cloudappliance();\n\t\t\t$cloud_app->get_instance_by_appliance_id($app_id);\n\t\t\t// check state, only bill if active\n\t\t\tif ($cloud_app->state == 1) {\n\t\t\t\t// basic cost\n\t\t\t\t$cr_costs = 0;\n\t\t\t\t// + per cpu\n\t\t\t\t$cr_costs = $cr_costs + $this->cpu_req;\n\t\t\t\t// + per nic\n\t\t\t\t$cr_costs = $cr_costs + $this->network_req;\n\t\t\t\t// ha cost double\n\t\t\t\tif (!strcmp($this->ha_req, '1')) {\n\t\t\t\t\t$cr_costs = $cr_costs * 2;\n\t\t\t\t}\n\t\t\t\t// TODO : disk costs\n\t\t\t\t// TODO : network-traffic costs\n\n\t\t\t\t// sum\n\t\t\t\t$cr_costs_final = $cr_costs_final + $cr_costs;\n\t\t\t\t$this->_event->log(\"get_costs\", $_SERVER['REQUEST_TIME'], 5, \"cloudprofile.class.php\", \"-> Billing active appliance $app_id (cr $this->id) = $cr_costs CC-units\", \"\", \"\", 0, 0, 0);\n\t\t\t} else {\n\t\t\t\t$this->_event->log(\"get_costs\", $_SERVER['REQUEST_TIME'], 5, \"cloudprofile.class.php\", \"-> Not billing paused appliance $app_id (cr $this->id)\", \"\", \"\", 0, 0, 0);\n\t\t\t}\n\t\t}\n\t\t$this->_event->log(\"get_costs\", $_SERVER['REQUEST_TIME'], 5, \"cloudprofile.class.php\", \"-> Final bill for cr $this->id = $cr_costs_final CC-units\", \"\", \"\", 0, 0, 0);\n\t\treturn $cr_costs_final;\n\t}",
"public function addVehicle(Vehicle $vehicle)\n {\n if($vehicle instanceof Bicycle)\n {\n echo \"You'r note allowed here\";\n }else{\n $this->currentVehicles[] = $vehicle;\n }\n }",
"public function postCost()\n {\n if(!Request::ajax()) return;\n \n // validate \n $rules = array('cottage_id' => 'required|integer',\n 'first_night' => 'required|date_format:Y-m-d',\n 'depart' => 'required|date_format:Y-m-d',\n );\n\n $validator = Validator::make(Input::all(), $rules);\n\n if ($validator->fails()) \n return Response::json(array('status' => 'error', 'messages' => $validator->messages()));\n \n $cost = $this->price->calculateByNight(Input::get('cottage_id'), Input::get('first_night'), Input::get('depart'));\n \n return Response::json(array('status' => 'success', 'cost' => $cost[0]->cost));\n }",
"public function agregar(Vehiculo $vehiculo)\n {\n }",
"public function addVehicle(Request $request){\n // sanitize input (function in Controller parent)\n $this->formatInput($request);\n\n // validation of user input in the form\n $this->validateVehicle($request);\n\n // if VALIDATION went ok proceed to below\n $vehi = new Vehicle();\n\n // get someValue from the name=\"someValue\" key/value pair\n $vehi->fldRegoNo = strtoupper($request->fldRegoNo); // convert to uppercase\n $vehi->fldBrand = $request->fldBrand;\n $vehi->fldSeating = $request->fldSeating;\n $vehi->fldHirePriceCurrent = $request->fldHirePriceCurrent;\n\n // assuming every new vehicle added is not damaged nor retired, so hardcode these values\n $vehi->fldDamaged = 0;\n $vehi->fldRetired = 0;\n\n // set created_at to current date and time\n $vehi->created_at = Carbon::now();\n\n // set fldLocationId to null since we don't implement location/suburb in this assignment\n $vehi->fldLocationId = null;\n\n $vehi->save();\n\n return redirect('vehicles');\n }",
"public function createCostEstimate($request)\n {\n\n $user_id = $request->get('user_id');\n\n $vehicle_id = $request->get('vehicle_id',null);\n\n $location = $request->get('location',null);\n\n $city = $request->get('city',null);\n\n /** get array of object services & supplies */\n $item = $request->input('joborder_service_supplies');\n\n /** get array of user id techinician */\n $technician_id = $request->input('technician_id');\n\n\n DB::beginTransaction();\n\n /**\n * Get users\n */\n $user = $this->user\n ->addWith(['information.enterprise.vehicles','vehicles'])\n ->firstOrfail($user_id);\n\n try{\n /**\n * Create Bookings\n */\n $data = [\n 'vehicle_id' => $vehicle_id,\n 'address' => $request->get('address',''),\n 'concern' => $request->get('concern',''),\n 'concern_type' => $request->get('concern_type',null),\n 'date' => $request->get('date',null),\n 'time' => $request->get('time',null),\n 'status' => $request->get('status','pending'),\n 'booked_by' => $this->authUser->user_type\n ];\n\n /**\n * Consumer type Request\n */\n if($user->user_type === 'consumer')\n {\n $data['user_id'] = $user->id;\n $data['location'] = $location;\n $data['city'] = $city;\n }\n\n /**\n * Enterprise Type Request\n */\n if($user->user_type === 'enterprise')\n {\n $data['user_id'] = $user->id;\n $data['enterprise_id'] = $user->information->enterprise_id;\n }\n\n /** booking created */\n $booking = $this->booking->create($data);\n\n /**\n * Create Joborders\n */\n $data = [\n 'requested_at' => $request->get('requested_at',null),\n 'concern' => $request->get('concern',null),\n 'assessment' => $request->get('assessment',null),\n 'solution' => $request->get('solution',null),\n 'vehicle_id' => $vehicle_id,\n 'status' => $request->get('status','pending'),\n 'user_id' => $user->id,\n 'concern_type' => $request->get('concern_type',null),\n 'schedule' => $request->get('schedule',null),\n 'location' => $request->get('location',null),\n 'city' => $city,\n 'booking_id' => $booking->id,\n 'total' => $request->get('total',null)\n ];\n\n /**\n * Enterprise Type Request\n */\n if($user->user_type === 'enterprise')\n {\n $data['enterprise_id'] = $user->information->enterprise_id;\n }\n\n $joborder = $this->joborder->create($data);\n\n $joborder->load(['user.information.enterprise']);\n\n /**\n * Create Joborder Code\n */\n $this->joborder->update(['id' => $joborder->id],[\n 'code' => sprintf('%04d',$joborder->id),\n ]);\n\n\n /**\n * Send Message\n */\n $threadId = md5($joborder->user_id);\n if($joborder->user->information->enterprise_id !== null){\n $threadId = md5('enterprise-'.$joborder->user->information->enterprise->id);\n }\n\n $data = [\n 'thread_id' => $threadId,\n 'user_id' => $this->authUser->id,\n 'chat' => 'Joborder Created #' . $joborder->joborder_id . $joborder->code,\n 'is_read' => 'sent',\n 'joborder_id' => $joborder->id,\n ];\n\n $chatCreated = $this->message->create($data);\n\n $chatCreated->load(['joborder']);\n\n /**\n * Broadcast Messages\n */\n broadcast(new ChatMessages($chatCreated))->toOthers();\n\n /**\n * Update Booking status\n */\n if($request->has('booking_id') === TRUE)\n {\n $this->booking->update(['id' => $booking->id],[\n 'status' => $request->get('status','pending')\n ]);\n }\n\n /**\n * Save Service And Supplies\n */\n foreach ($item as $key => $value)\n {\n $value['joborder_id'] = $joborder->id;\n $this->joborderItem->create((array)$value);\n }\n\n /**\n * Save Data in Pivot\n */\n $joborder->users()->attach($technician_id);\n\n }catch(Exception $e){\n DB::rollback();\n\n return $this->response('error',[ $e->getMessage() ],Code::HTTP_BAD_REQUEST);\n }\n DB::commit();\n\n /**\n * Send SNS Notification\n */\n if($user->user_type === 'admin'){\n\n /**\n * Get All Users of Thread Id\n */\n $participant = $this->message->addWhere(['thread_id' => $chatCreated->thread_id])->addGroupBy('user_id')->fetch(FALSE,TRUE,FALSE);\n\n\n foreach ($participant as $key => $value){\n\n /**\n * Get All Devices of Users\n */\n $device = clone $this->device;\n $usersDevice = $device->addWhere(['user_id' => $value['user_id']])->fetch(FALSE,TRUE,FALSE);\n\n /**\n * Send Notif To ALl Mobile\n */\n if(count($usersDevice) !== 0){\n\n foreach ($usersDevice as $key => $value){\n\n Notification::sendToArn($chatCreated->chat,$value,['data' => $chatCreated],'mycasa_message');\n }\n }\n }\n }\n\n $joborder = $this->joborder->firstOrFail($joborder->id);\n\n return $this->response('success',$joborder,Code::HTTP_CREATED);\n\n }",
"public function setTotalcost($v)\n {\n if ($v !== null) {\n $v = (string) $v;\n }\n\n if ($this->totalcost !== $v) {\n $this->totalcost = $v;\n $this->modifiedColumns[OrdrhedTableMap::COL_TOTALCOST] = true;\n }\n\n return $this;\n }",
"function getCost(){\n return $this->cost;\n }",
"public function planCosts()\n {\n return $this->hasManyThrough('Modules\\Plan\\Entities\\PlanCost',\n 'Modules\\Plan\\Entities\\Deducible',\n \t\t\t\t\t\t\t\t'plan_id',\n 'plan_deducible_id');\n }",
"public function cost()\n {\n return $this->hasOne(CostService::class,\n SchemaConstant::PRIMARY_KEY,\n SchemaConstant::COST_FOREIGN_KEY);\n }",
"public function totalCost(): float;",
"protected function createVehicles($vehicle)\n {\n $vehicleCount = 0;\n if (isset($vehicle['attributes']['validate'])) {\n foreach ($vehicle['attributes']['validate'] as &$validator) {\n if ($validator['type'] === 'php') {\n if (strpos($validator['source'], ':/') === false && strpos($validator['source'], '/') !== 0) {\n $validator['source'] = $this->tplBase . '/' . $validator['source'];\n }\n }\n }\n }\n if (isset($vehicle['attributes']['resolve'])) {\n foreach ($vehicle['attributes']['resolve'] as &$resolver) {\n if ($resolver['type'] === 'php') {\n if (strpos($resolver['source'], ':/') === false && strpos($resolver['source'], '/') !== 0) {\n $resolver['source'] = $this->tplBase . '/' . $resolver['source'];\n }\n }\n }\n }\n switch ($vehicle['vehicle_class']) {\n case '\\\\Teleport\\\\Transport\\\\xPDOObjectVehicle':\n case 'xPDOObjectVehicle':\n $realClass = $this->modx->loadClass($vehicle['object']['class']);\n if ($realClass === false) {\n $this->request->log(\"Invalid class {$vehicle['object']['class']} specified; skipping vehicle\");\n break;\n }\n $graph = isset($vehicle['object']['graph']) && is_array($vehicle['object']['graph'])\n ? $vehicle['object']['graph'] : array();\n $graphCriteria = isset($vehicle['object']['graphCriteria']) && is_array($vehicle['object']['graphCriteria'])\n ? $vehicle['object']['graphCriteria'] : null;\n if (isset($vehicle['object']['script'])) {\n include $this->tplBase . '/scripts/' . $vehicle['object']['script'];\n } elseif (isset($vehicle['object']['criteria'])) {\n $iterator = $this->modx->getIterator($vehicle['object']['class'], (array)$vehicle['object']['criteria'], false);\n foreach ($iterator as $object) {\n /** @var \\xPDOObject $object */\n if (!empty($graph)) {\n $object->getGraph($graph, $graphCriteria, false);\n }\n if ($this->package->put($object, $vehicle['attributes'])) {\n $vehicleCount++;\n }\n }\n } elseif (isset($vehicle['object']['data'])) {\n /** @var \\xPDOObject $object */\n $object = $this->modx->newObject($vehicle['object']['class']);\n if ($object instanceof $realClass) {\n $object->fromArray($vehicle['object']['data'], '', true, true);\n if ($this->package->put($object, $vehicle['attributes'])) {\n $vehicleCount++;\n }\n }\n }\n $this->request->log(\"Packaged {$vehicleCount} xPDOObjectVehicles for class {$vehicle['object']['class']}\");\n break;\n case '\\\\Teleport\\\\Transport\\\\xPDOCollectionVehicle':\n $objCnt = 0;\n $realClass = $this->modx->loadClass($vehicle['object']['class']);\n $graph = isset($vehicle['object']['graph']) && is_array($vehicle['object']['graph'])\n ? $vehicle['object']['graph'] : array();\n $graphCriteria = isset($vehicle['object']['graphCriteria']) && is_array($vehicle['object']['graphCriteria'])\n ? $vehicle['object']['graphCriteria'] : null;\n if (isset($vehicle['object']['script'])) {\n include $this->tplBase . '/scripts/' . $vehicle['object']['script'];\n } elseif (isset($vehicle['object']['criteria'])) {\n $limit = isset($vehicle['object']['limit']) ? (integer)$vehicle['object']['limit'] : 0;\n if ($limit < 1) {\n $limit = 500;\n }\n $offset = 0;\n $criteria = $this->modx->newQuery($vehicle['object']['class'], (array)$vehicle['object']['criteria'], false);\n if (!isset($vehicle['object']['orderBy']) || !is_array($vehicle['object']['orderBy'])) {\n $pk = (array)$this->modx->getPK($realClass);\n foreach ($pk as &$primaryKey) {\n $primaryKey = $this->modx->escape($primaryKey);\n }\n $orderBy = array_fill_keys($pk, 'ASC');\n } else {\n $orderBy = $vehicle['object']['orderBy'];\n }\n foreach ($orderBy as $by => $direction) {\n $criteria->sortby($by, $direction);\n }\n $set = $this->modx->getCollection($vehicle['object']['class'], $criteria->limit($limit, $offset), false);\n while (!empty($set)) {\n foreach ($set as &$object) {\n /** @var \\xPDOObject $object */\n if (!empty($graph)) {\n $object->getGraph($graph, $graphCriteria, false);\n }\n }\n if (!empty($set) && $this->package->put($set, $vehicle['attributes'])) {\n $vehicleCount++;\n $objCnt = $objCnt + count($set);\n }\n $offset += $limit;\n $set = $this->modx->getCollection($vehicle['object']['class'], $criteria->limit($limit, $offset), false);\n }\n }\n $this->request->log(\"Packaged {$vehicleCount} xPDOCollectionVehicles with {$objCnt} total objects for class {$vehicle['object']['class']}\");\n break;\n case '\\\\Teleport\\\\Transport\\\\MySQLVehicle':\n /* collect table names from classes and grab any additional tables/data not listed */\n $modxDatabase = $this->modx->getOption('dbname', null, $this->modx->getOption('database'));\n $modxTablePrefix = $this->modx->getOption('table_prefix', null, '');\n\n $coreTables = array();\n foreach ($vehicle['object']['classes'] as $class) {\n $coreTables[$class] = $this->modx->quote($this->modx->literal($this->modx->getTableName($class)));\n }\n\n $stmt = $this->modx->query(\"SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = '{$modxDatabase}' AND TABLE_NAME NOT IN (\" . implode(',', $coreTables) . \")\");\n $extraTables = $stmt->fetchAll(\\PDO::FETCH_COLUMN);\n\n if (is_array($extraTables) && !empty($extraTables)) {\n $excludeExtraTablePrefix = isset($vehicle['object']['excludeExtraTablePrefix']) && is_array($vehicle['object']['excludeExtraTablePrefix'])\n ? $vehicle['object']['excludeExtraTablePrefix'] : array();\n $excludeExtraTables = isset($vehicle['object']['excludeExtraTables']) && is_array($vehicle['object']['excludeExtraTables'])\n ? $vehicle['object']['excludeExtraTables'] : array();\n foreach ($extraTables as $extraTable) {\n if (in_array($extraTable, $excludeExtraTables)) continue;\n\n $instances = 0;\n $object = array(\n 'vehicle_package' => '',\n 'vehicle_class' => '\\\\Teleport\\\\Transport\\\\MySQLVehicle'\n );\n $attributes = array(\n 'vehicle_package' => '',\n 'vehicle_class' => '\\\\Teleport\\\\Transport\\\\MySQLVehicle'\n );\n\n /* remove modx table_prefix if table starts with it */\n $extraTableName = $extraTable;\n if (!empty($modxTablePrefix) && strpos($extraTableName, $modxTablePrefix) === 0) {\n $extraTableName = substr($extraTableName, strlen($modxTablePrefix));\n $addTablePrefix = true;\n } elseif (!empty($modxTablePrefix) || in_array($extraTableName, $excludeExtraTablePrefix)) {\n $addTablePrefix = false;\n } else {\n $addTablePrefix = true;\n }\n $object['tableName'] = $extraTableName;\n $this->request->log(\"Extracting non-core table {$extraTableName}\");\n\n /* generate the CREATE TABLE statement */\n $stmt = $this->modx->query(\"SHOW CREATE TABLE {$this->modx->escape($extraTable)}\");\n $resultSet = $stmt->fetch(\\PDO::FETCH_NUM);\n $stmt->closeCursor();\n if (isset($resultSet[1])) {\n if ($addTablePrefix) {\n $object['drop'] = \"DROP TABLE IF EXISTS {$this->modx->escape('[[++table_prefix]]' . $extraTableName)}\";\n $object['table'] = str_replace(\"CREATE TABLE {$this->modx->escape($extraTable)}\", \"CREATE TABLE {$this->modx->escape('[[++table_prefix]]' . $extraTableName)}\", $resultSet[1]);\n } else {\n $object['drop'] = \"DROP TABLE IF EXISTS {$this->modx->escape($extraTableName)}\";\n $object['table'] = $resultSet[1];\n }\n\n /* collect the rows and generate INSERT statements */\n $object['data'] = array();\n $stmt = $this->modx->query(\"SELECT * FROM {$this->modx->escape($extraTable)}\");\n if (!$stmt) {\n $this->request->log(\"Skipping table {$extraTable} as SELECT query failed\");\n break;\n }\n while ($row = $stmt->fetch(\\PDO::FETCH_ASSOC)) {\n if ($instances === 0) {\n $fields = implode(', ', array_map(array($this->modx, 'escape'), array_keys($row)));\n }\n $values = array();\n foreach ($row as $key => $value) {\n switch (gettype($value)) {\n case 'string':\n $values[] = $this->modx->quote($value);\n break;\n case 'NULL':\n case 'array':\n case 'object':\n case 'resource':\n case 'unknown type':\n $values[] = 'NULL';\n break;\n default:\n $values[] = (string)$value;\n break;\n }\n }\n $values = implode(', ', $values);\n if ($addTablePrefix) {\n $object['data'][] = \"INSERT INTO {$this->modx->escape('[[++table_prefix]]' . $extraTableName)} ({$fields}) VALUES ({$values})\";\n } else {\n $object['data'][] = \"INSERT INTO {$this->modx->escape($extraTable)} ({$fields}) VALUES ({$values})\";\n }\n $instances++;\n }\n }\n\n if (!$this->package->put($object, $attributes)) {\n $this->request->log(\"Could not package rows for table {$extraTable}\");\n } else {\n $this->request->log(\"Packaged {$instances} rows for non-core table {$extraTable}\");\n $vehicleCount++;\n }\n }\n $this->request->log(\"Packaged {$vehicleCount} {$vehicle['vehicle_class']} vehicles for non-core tables\");\n } else {\n $this->request->log(\"No non-core tables found for packaging\");\n }\n break;\n case 'xPDOScriptVehicle':\n if (isset($vehicle['object']['source'])) {\n if (strpos($vehicle['object']['source'], ':/') === false && strpos($vehicle['object']['source'], '/') !== 0) {\n $vehicle['object']['source'] = $this->tplBase . '/' . $vehicle['object']['source'];\n }\n }\n case 'xPDOFileVehicle':\n case 'xPDOTransportVehicle':\n default:\n if (isset($vehicle['object']['script'])) {\n include $this->tplBase . '/scripts/' . $vehicle['object']['script'];\n } else {\n if ($this->package->put($vehicle['object'], $vehicle['attributes'])) {\n $this->request->log(\"Packaged 1 {$vehicle['vehicle_class']}\" . (isset($vehicle['object']['source'])\n ? \" from {$vehicle['object']['source']}\" : \"\"));\n $vehicleCount++;\n }\n }\n break;\n }\n return $vehicleCount;\n }",
"public function setCost($cost)\n {\n $this->cost = $cost;\n }",
"public function getCosts (VirtueMartCart $cart, $method, $cart_prices) {\r\n\r\n\t\t$cartTotalAmountOrig=!empty($cart_prices['withTax'])? $cart_prices['withTax']:$cart_prices['salesPrice'];\r\n\t\t\r\n\t\t$this->_vivinstalments = vRequest::getInt('vivinstalments', 0);\r\n\t\t$this->addprice = '';\r\n\t\t$this->addpricecurrency = '';\r\n\t\t\r\n\t\tif(isset($this->_vivinstalments) && $this->_vivinstalments > 1){\r\n\t\t$this->_setHellaspayIntoSession();\r\n\t\t}\r\n\t\t\r\n\t\t$this->_getHellaspayIntoSession();\r\n\t\tif(isset($this->_vivinstalments) && $this->_vivinstalments > 1){\r\n\t\t\r\n\t\t$instalmentcharge = $this->_getInstalmentCharge($this->_currentMethod);\r\n\t\t$this->_currentMethod->hellaspay_instalments_charge = '';\r\n\t\t\r\n\t\tif(isset($instalmentcharge) && $instalmentcharge!=''){\r\n\t\t\r\n\t\t$split_charge_hellaspay = explode(',', $instalmentcharge);\r\n\t\t$c = count ($split_charge_hellaspay);\r\n\t\tfor($i=0; $i<$c; $i++)\r\n\t\t{\r\n\t\tlist($instal_amount, $instal_percentage) = explode(\":\", $split_charge_hellaspay[$i]);\r\n\t\t\r\n\t\tif($this->_vivinstalments == $instal_amount){\r\n\t\t$this->addprice = $cartTotalAmountOrig * $instal_percentage * 0.01;\r\n\t\t$this->addpricecurrency = (string)$cart->pricesCurrency;\r\n\t\t} \r\n\t\t}//end for\r\n\t\t\r\n\t\t}//end if charge is set\r\n\t\t}//end if instalments are selected\r\n\t\t\r\n\t\t$instalmentoptions = $this->_getInstalmentOptions($this->_currentMethod);\r\n\t\t$split_instal_hellaspay = explode(',', $instalmentoptions);\r\n\t\t$c = count ($split_instal_hellaspay);\r\n\t\t$term_array = array();\r\n\t\t\r\n\t\tif($c > 1){\r\n\t\tfor($i=0; $i<$c; $i++)\r\n\t\t{\r\n\t\tlist($instal_amount, $instal_term) = explode(\":\", $split_instal_hellaspay[$i]);\r\n\t\tif($cartTotalAmountOrig > $instal_amount){\r\n\t\t$term_array[]=$instal_term;\r\n\t\t}\r\n\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tif(!in_array($this->_vivinstalments ,$term_array)){\r\n\t\t$this->addprice = '';\r\n\t\t$this->addpricecurrency = '';\r\n\t\t$this->_clearHellaspaySession();\r\n\t\t}\r\n\t\t\r\n\t\t$this->_currentMethod->cost_per_transaction += $this->addprice;\r\n\t\t\r\n\t\tif(!empty($cart_prices['withTax'])){\r\n\t\t$cart_prices['withTax'] = $cart_prices['withTax'] + $this->_currentMethod->cost_per_transaction;\r\n\t\t} else {\r\n\t\t$cart_prices['salesPrice'] = $cart_prices['salesPrice'] + $this->_currentMethod->cost_per_transaction;\r\n\t\t}\r\n\t\t\r\n\t\tif (preg_match ('/%$/', $this->_currentMethod->cost_percent_total)) {\r\n\t\t\t$this->_currentMethod->cost_percent_total = substr ($this->_currentMethod->cost_percent_total, 0, -1);\r\n\t\t} else {\r\n\t\t\t$this->_currentMethod->cost_percent_total = $this->_currentMethod->cost_percent_total;\r\n\t\t}\r\n\t\t$cartPrice = !empty($cart_prices['withTax'])? $cart_prices['withTax']:$cart_prices['salesPrice'];\r\n\t\t\r\n\t\treturn ($this->_currentMethod->cost_per_transaction + ($cartPrice * $method->cost_percent_total * 0.01));\r\n\t}"
] |
[
"0.5889306",
"0.58638257",
"0.5545648",
"0.55259603",
"0.54718703",
"0.53469163",
"0.52663314",
"0.5263282",
"0.5260133",
"0.52451503",
"0.52340394",
"0.523153",
"0.5223022",
"0.52106977",
"0.5200253",
"0.5174442",
"0.51644814",
"0.510732",
"0.50984615",
"0.50879616",
"0.50837374",
"0.5047552",
"0.5024894",
"0.50107753",
"0.5003712",
"0.49938816",
"0.4965219",
"0.49217668",
"0.49199525",
"0.4907482"
] |
0.65340537
|
0
|
The results of running a [Replay][google.cloud.policysimulator.v1.Replay]. Generated from protobuf field repeated .google.cloud.policysimulator.v1.ReplayResult replay_results = 1;
|
public function getReplayResults()
{
return $this->replay_results;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function setReplayResults($var)\n {\n $arr = GPBUtil::checkRepeatedField($var, \\Google\\Protobuf\\Internal\\GPBType::MESSAGE, \\Google\\Cloud\\PolicySimulator\\V1\\ReplayResult::class);\n $this->replay_results = $arr;\n\n return $this;\n }",
"public function getQueryReplay()\n {\n return $this->get(self::_QUERY_REPLAY);\n }",
"public function getQueryReplay()\n {\n return $this->get(self::_QUERY_REPLAY);\n }",
"public function getReplay()\n {\n return $this->get(self::_REPLAY);\n }",
"function send_replay_REPLAY() {\n $skipback = read_raceinfo('replay-skipback', '4');\n $num_showings = read_raceinfo('replay-num-showings', '2');\n $rate = read_raceinfo('replay-rate', '0.5');\n send_replay_message(\"REPLAY \".$skipback.\" \".$num_showings.\" \".$rate);\n}",
"public function getReplays()\n {\n $sql = \"\n SELECT *\n FROM games \n ORDER BY id DESC LIMIT 20\n \";\n\n $data = $this->db->exec($sql);\n\n //remove all previous replays\n if ($data && count($data) == 20)\n {\n $last = end($data);\n $sql = \"\n DELETE \n FROM games \n WHERE id < {$last['id']}\n \";\n $this->db->exec($sql);\n }\n\n return $data;\n }",
"public function setQueryReplay(Down_QueryReplay $value)\n {\n return $this->set(self::_QUERY_REPLAY, $value);\n }",
"public function setQueryReplay(Down_QueryReplay $value)\n {\n return $this->set(self::_QUERY_REPLAY, $value);\n }",
"public function getResults()\n {\n return $this->Results;\n }",
"public function getReplayedSession()\n {\n return $this->replayedSession;\n }",
"function send_replay_RACE_STARTS() {\n $skipback = read_raceinfo('replay-skipback', '4');\n $num_showings = read_raceinfo('replay-num-showings', '2');\n $rate = read_raceinfo('replay-rate', '0.5');\n send_replay_message(\"RACE_STARTS $skipback $num_showings $rate\");\n}",
"public function Results()\n {\n return $this->mResults;\n }",
"public function getResultsReturned()\n {\n return $this->ResultsReturned;\n }",
"public function getReplayId()\n {\n return $this->get(self::_REPLAY_ID);\n }",
"public function setReplay(Down_PvpRecord $value)\n {\n return $this->set(self::_REPLAY, $value);\n }",
"public function get_results()\n {\n return [\n 'skipped' => $this->m_skipped,\n 'migrated' => $this->m_migrated,\n 'missing_classes' => $this->m_missing_classes,\n ];\n }",
"public function getRuns()\n {\n return $this->runs;\n }",
"public function getResponses()\n {\n return $this->data['responses'];\n }",
"public function getResults() {\n\t\t$this->$results_ = $this->resultSource_->getResults();\n\t\treturn $this->$results_;\n }",
"public function getResults()\n {\n return $this->results;\n }",
"public function Results(){\r\n\t\treturn self::get_results();\r\n\t}",
"public function results() {\n return $this->results;\n }",
"public function isReplaying() {\r\n return!$this->isRecording();\r\n }",
"public function getResults()\n {\n return $this->results;\n }",
"public function getResults()\n {\n return $this->results;\n }",
"public function getResults()\n {\n return $this->results;\n }",
"public function getResults()\n {\n return $this->results;\n }",
"public function getResults()\n {\n return $this->results;\n }",
"public function getNumberPlayedMatches()\n {\n return $this->played;\n }",
"public function results()\n {\n return $this->_results;\n }"
] |
[
"0.77779174",
"0.6110347",
"0.6110347",
"0.6099787",
"0.578775",
"0.54053783",
"0.52967185",
"0.5293707",
"0.5192404",
"0.517329",
"0.5050758",
"0.5037287",
"0.50216436",
"0.49210176",
"0.49081644",
"0.48471704",
"0.48276582",
"0.48268548",
"0.4780751",
"0.4775717",
"0.47599483",
"0.47557437",
"0.4754008",
"0.47457045",
"0.47457045",
"0.47457045",
"0.47457045",
"0.47457045",
"0.4729504",
"0.4710698"
] |
0.78970385
|
0
|
The results of running a [Replay][google.cloud.policysimulator.v1.Replay]. Generated from protobuf field repeated .google.cloud.policysimulator.v1.ReplayResult replay_results = 1;
|
public function setReplayResults($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\PolicySimulator\V1\ReplayResult::class);
$this->replay_results = $arr;
return $this;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getReplayResults()\n {\n return $this->replay_results;\n }",
"public function getQueryReplay()\n {\n return $this->get(self::_QUERY_REPLAY);\n }",
"public function getQueryReplay()\n {\n return $this->get(self::_QUERY_REPLAY);\n }",
"public function getReplay()\n {\n return $this->get(self::_REPLAY);\n }",
"function send_replay_REPLAY() {\n $skipback = read_raceinfo('replay-skipback', '4');\n $num_showings = read_raceinfo('replay-num-showings', '2');\n $rate = read_raceinfo('replay-rate', '0.5');\n send_replay_message(\"REPLAY \".$skipback.\" \".$num_showings.\" \".$rate);\n}",
"public function getReplays()\n {\n $sql = \"\n SELECT *\n FROM games \n ORDER BY id DESC LIMIT 20\n \";\n\n $data = $this->db->exec($sql);\n\n //remove all previous replays\n if ($data && count($data) == 20)\n {\n $last = end($data);\n $sql = \"\n DELETE \n FROM games \n WHERE id < {$last['id']}\n \";\n $this->db->exec($sql);\n }\n\n return $data;\n }",
"public function setQueryReplay(Down_QueryReplay $value)\n {\n return $this->set(self::_QUERY_REPLAY, $value);\n }",
"public function setQueryReplay(Down_QueryReplay $value)\n {\n return $this->set(self::_QUERY_REPLAY, $value);\n }",
"public function getResults()\n {\n return $this->Results;\n }",
"public function getReplayedSession()\n {\n return $this->replayedSession;\n }",
"function send_replay_RACE_STARTS() {\n $skipback = read_raceinfo('replay-skipback', '4');\n $num_showings = read_raceinfo('replay-num-showings', '2');\n $rate = read_raceinfo('replay-rate', '0.5');\n send_replay_message(\"RACE_STARTS $skipback $num_showings $rate\");\n}",
"public function Results()\n {\n return $this->mResults;\n }",
"public function getResultsReturned()\n {\n return $this->ResultsReturned;\n }",
"public function getReplayId()\n {\n return $this->get(self::_REPLAY_ID);\n }",
"public function setReplay(Down_PvpRecord $value)\n {\n return $this->set(self::_REPLAY, $value);\n }",
"public function get_results()\n {\n return [\n 'skipped' => $this->m_skipped,\n 'migrated' => $this->m_migrated,\n 'missing_classes' => $this->m_missing_classes,\n ];\n }",
"public function getRuns()\n {\n return $this->runs;\n }",
"public function getResponses()\n {\n return $this->data['responses'];\n }",
"public function getResults() {\n\t\t$this->$results_ = $this->resultSource_->getResults();\n\t\treturn $this->$results_;\n }",
"public function getResults()\n {\n return $this->results;\n }",
"public function Results(){\r\n\t\treturn self::get_results();\r\n\t}",
"public function isReplaying() {\r\n return!$this->isRecording();\r\n }",
"public function results() {\n return $this->results;\n }",
"public function getResults()\n {\n return $this->results;\n }",
"public function getResults()\n {\n return $this->results;\n }",
"public function getResults()\n {\n return $this->results;\n }",
"public function getResults()\n {\n return $this->results;\n }",
"public function getResults()\n {\n return $this->results;\n }",
"public function getNumberPlayedMatches()\n {\n return $this->played;\n }",
"public function results()\n {\n return $this->_results;\n }"
] |
[
"0.7895785",
"0.610941",
"0.610941",
"0.6099436",
"0.57897633",
"0.5404606",
"0.5297664",
"0.52946496",
"0.51897067",
"0.51730776",
"0.50527394",
"0.5034621",
"0.5019206",
"0.49218386",
"0.4909336",
"0.48454005",
"0.4826863",
"0.48244554",
"0.477813",
"0.47729188",
"0.47576424",
"0.47543296",
"0.47528997",
"0.47427073",
"0.47427073",
"0.47427073",
"0.47427073",
"0.47427073",
"0.47283518",
"0.47078237"
] |
0.77768373
|
1
|
Looks for the most relevant content excerpt of the page. For extracting the most relevant excerpt follows the next steps: 1. Check if the page layout is OpenGraph compliant and get the description if so. 2. If the page is not OG compliant, tries to get the meta description. 3. If the page has not meta description tag but has html5 layout, look for the first inside the first 4. If the page does not have any tag, returns the first paragraph 5. Return the bare text inside the body tag.
|
public function extractContent()
{
$metas = $this->parsedDOM->getElementsByTagName('meta');
// If exists meta-description, uses it
foreach ($metas as $meta)
{
// Loops the list of attributes
foreach ($meta->attributes as $attribute)
{
// Checks if the page is OG Compliant
if ($attribute->name == 'name'
&& $attribute->value == 'og:description'
&& $meta->attributes->getNamedItem('content')->value !== ''
) {
// Returns the og:description
return trim($meta->attributes->getNamedItem('content')->value);
}
// looks for the description meta tag
if ($attribute->name == 'name'
&& $attribute->value == 'description'
&& $meta->attributes->getNamedItem('content')->value !== ''
) {
return trim($meta->attributes->getNamedItem('content')->value);
}
}
}
$article = $this->parsedDOM->getElementsByTagName('article')->item(0);
if ($article !== null ) {
// Search the first paragraph inside the article
$paragraph = $article->firstChild->nodeValue;
return trim($paragraph);
}
$paragraph = $this
->parsedDOM
->getElementsByTagName('p')
->item(0);
if ($paragraph !== null) {
return trim($paragraph);
}
return trim($this
->parsedDOM
->getElementsByTagName('body')
->item(0)
->nodeValue);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"protected function getExcerpt($content)\n {\n // Check for excerpt tags\n $pattern = '#(\\<\\!\\-\\-\\s?excerpt\\s?\\-\\-\\>)(.*)(\\<\\!\\-\\-\\s?endexcerpt\\s?\\-\\-\\>)#si';\n if (preg_match($pattern, $content, $matches)) {\n return $matches[2];\n }\n\n // If all else get the content from the first paragraph\n return $this->description;\n }",
"public function excerpt()\n {\n if (!$this->desc()->empty()) {\n $excerpt = $this->desc();\n } else {\n $excerpt = excerpt($this->text(), $length = 40, $mode = 'words');\n };\n\n return $excerpt;\n }",
"private function getPostExcerpt()\n {\n global $post;\n\n // If this is not a page or a single post, it cannot have an excerpt and\n // so the method should return an empty string.\n if (!is_page() && !is_singular()) {\n return '';\n }\n\n // Attempt to get a manaul excerpt\n $excerpt = apply_filters('the_excerpt', $post->post_excerpt);\n\n // If there is no manual excerpt, use the main content instead\n if (!$excerpt) {\n $excerpt = apply_filters('the_content', $post->post_content);\n }\n\n // Return the excerpt, stripped of any HTML code\n return strip_tags($excerpt);\n }",
"public function getPageDescription()\n {\n $element = $this->query('meta[name=\"description\"]')->first();\n if ($element) {\n return $element->getAttribute('content');\n }\n\n return '';\n }",
"function getTheExcerpt($post){\n\t$postfile = file_get_contents($post);\n\t$fullpost = getBetween('<div class=\"content\">',\" </div>\",$postfile);\n\t$postExcerpt = trimText($fullpost,750);\n\t$postExcerpt = stripslashes($postExcerpt);\n\treturn $postExcerpt;\n}",
"function ep_get_teaser_or_body() {\n\n\t$content = ep_get_the_content(\"teaser\");\n\tif (empty($content)) {\n\t\t$content = ep_get_the_content(\"body\");\n\t}\n\treturn $content;\n}",
"public function excerpt()\n\t{\n\t\treturn ( ! empty($this->excerpt))? $this->excerpt : truncate_word($this->content, 200);\n\t}",
"public function excerpt() { return $this->post->post_excerpt; }",
"public function get_description () {\r\n\t\t$content = file_get_contents($this->url);\r\n\t\t$regex = preg_match('/<p id=\"eow-description\" class=\"\" >(.*)<\\/p>/i', $content, $matches);\r\n\t\treturn $matches[1];\r\n\t}",
"private function retrieve_excerpt() {\n\t\t$replacement = null;\n\n\t\t// The check `post_password_required` is because excerpt must be hidden for a post with a password.\n\t\tif ( ! empty( $this->args->ID ) && ! post_password_required( $this->args->ID ) ) {\n\t\t\tif ( $this->args->post_excerpt !== '' ) {\n\t\t\t\t$replacement = wp_strip_all_tags( $this->args->post_excerpt );\n\t\t\t}\n\t\t\telseif ( $this->args->post_content !== '' ) {\n\t\t\t\t$replacement = wp_html_excerpt( strip_shortcodes( $this->args->post_content ), 156 );\n\t\t\t\t// Trim the auto-generated string to a word boundary.\n\t\t\t\t$replacement = substr( $replacement, 0, strrpos( $replacement, ' ' ) );\n\t\t\t}\n\t\t}\n\n\t\treturn $replacement;\n\t}",
"function arras_document_description() {\n\tif ( class_exists('All_in_One_SEO_Pack') || class_exists('Platinum_SEO_Pack') ) return false;\n\t\n\tif ( is_single() || is_page() ) {\n\t\tif ( have_posts() ) {\n\t\t\twhile( have_posts() ) {\n\t\t\t\tthe_post();\n\t\t\t\techo '<meta name=\"description\" content=\"' . get_the_excerpt() . '\" />';\n\t\t\t}\n\t\t}\n\t} else {\n\t\techo '<meta name=\"description\" content=\"' . get_bloginfo('description') . '\" />';\n\t}\n}",
"function ridizain_ephemera_excerpt () {\r\n\t$theContent = trim(strip_tags(get_the_content()));\r\n\t\t$output = str_replace( '\"', '', $theContent);\r\n\t\t$output = str_replace( '\\r\\n', ' ', $output);\r\n\t\t$output = str_replace( '\\n', ' ', $output);\r\n\t\t\t$limit = '15';\r\n\t\t\t$content = explode(' ', $output, $limit);\r\n\t\t\tarray_pop($content);\r\n\t\t$content = implode(\" \",$content).\" \";\r\n\treturn strip_tags($content, ' ');\r\n}",
"public function getExcerptAttribute()\n {\n $body = $this->description;\n $words = explode(\" \", $body);\n $words30 = array_slice($words,0,30);\n\n $excerpt = implode(' ', $words30);\n\n return strip_tags($excerpt);\n }",
"function getPageDescription() {\n global $wp_query,\n $post;\n\n $description = get_bloginfo( 'description' );\n\n // single / page\n if( ( is_single() || is_page() ) && !is_front_page() ) {\n $_description = $post->post_content;\n\n // try fetching first text blocks\n if( function_exists( 'get_field' ) ) {\n if( $blocks = get_field( 'blocks', $post->ID ) ) {\n for( $i = 0; $i < count( $blocks ); $i++ ) {\n if( $blocks[$i]['acf_fc_layout'] === 'text' ) {\n $_description = $blocks[$i]['text'];\n break;\n }\n }\n }\n }\n\n if( function_exists( 'get_field' ) ) {\n if( get_field( 'linkpreview--description', $post->ID ) ) {\n $_description = get_field( 'linkpreview--description', $post->ID );\n }\n }\n\n $description = ( !empty( $_description ) ) ? $_description : $description;\n }\n\n // custom taxonomy terms\n if( !empty( $wp_query->query_vars['term'] ) ) {\n $term = get_term_by( 'slug', $wp_query->query_vars['term'], $wp_query->query_vars['taxonomy'] );\n if( $term ) {\n $description = ( !empty( $term->description ) ) ? $term->description : $description;\n }\n }\n\n // tags\n if( is_tag() ) {\n $tag = get_term_by( 'slug', $wp_query->query['tag'], 'post_tag' );\n if( $tag ) {\n $description = ( !empty( $tag->description ) ) ? $tag->description : $description;\n }\n }\n\n // category\n if( is_category() ) {\n $category = get_term_by( 'slug', $wp_query->query['category_name'], 'category' );\n if( $category ) {\n $description = ( !empty( $category->description ) ) ? $category->description : $description;\n }\n }\n\n // author\n if( !empty( $wp_query->query['author_name'] ) ) {\n $author = get_user_by( 'slug', $wp_query->query['author_name'] );\n if( $author ) {\n $biography = get_the_author_meta( 'description', $author->ID );\n $description = ( !empty( $biography ) ) ? $biography : $description;\n }\n }\n\n return wp_trim_words( $description, 115, null );\n}",
"function postExcerpt($content) {\n\t\t$clean = strip_tags($content);\n\t\tif (strlen($clean) > 120){\n\t\t\t$excerpt = substr($clean, 0, strpos($clean, ' ', 120));\n\t\t\tprint $excerpt . ' ...';\n\t\t}\n\t}",
"function cc_post_excerpt() {\n\tglobal $post;\n\n\t$excerpt = htmlentities(strip_tags($post->post_content));\n\t$excerpt_a = array_slice (explode(\" \", $excerpt), 0, 55);\n\techo implode(\" \", $excerpt_a) . \"...\";\n}",
"public function getExcerptAttribute()\n {\n $value = $this->getAttribute('content');\n $format = $this->attributes['format'];\n\n list($excerpt, ) = explode('<!--more-->', $value, 2);\n\n return StoryFormat::driver($format)->parse($excerpt);\n }",
"private function retrieve_excerpt_only() {\n\t\t$replacement = null;\n\n\t\t// The check `post_password_required` is because excerpt must be hidden for a post with a password.\n\t\tif ( ! empty( $this->args->ID ) && $this->args->post_excerpt !== '' && ! post_password_required( $this->args->ID ) ) {\n\t\t\t$replacement = wp_strip_all_tags( $this->args->post_excerpt );\n\t\t}\n\n\t\treturn $replacement;\n\t}",
"function quasar_get_post_loop_description(){\n\tglobal $post;\n\tif(!$post) return;\n\t\n\t$summary_choice = xr_get_option('post_summary','content');//or excerpt;\n\t\n\t$return = '';\n\t\n\tif($summary_choice === 'content'){\n\t\t$return = quasar_get_the_content();\n\t}elseif($summary_choice === 'excerpt'){\n\t\t$return = rock_check_p(get_the_excerpt());\n\t\t$return .= quasar_get_read_more_link();\n\t}\n\t\n\treturn $return;\n}",
"public function get_excerpt();",
"function emc_the_cpt_description(){\r\n\r\n\t$desc = get_page_by_path( 'description', OBJECT, 'emc_content_focus' );\r\n\t$html = apply_filters( 'the_content', $desc->post_content );\r\n\techo $html;\r\n\r\n}",
"public function filter_post_content_excerpt($text)\n\t{\n\t\tif(strlen($text) > 280) {\n\t\t\t// cut off everything after the word at position 280. Don't use \\W so we don't cut HTML tags\n\t\t\t$rest = preg_replace('/[ .\\-]+.*/', '', substr($text, 280));\n\t\t\treturn substr($text, 0, 280) . $rest;\n\t\t}\n\t\treturn $text;\n\t\t\n\t\t// Alternative method: Return match[0] from /(\\w+\\W+){50}/ for the first 50 words\n\t}",
"public function getExcerpt(Block $post)\n {\n // TODO: replace by ability to set custom excerpt\n $excerpt = $postBody = $post->getBodyForInsertion();\n if (preg_match('/^.{1,260}\\b/s', $postBody, $match))\n {\n $excerpt = $match[0];\n }\n\n return $excerpt;\n }",
"public function get_excerpt() {\n\t\tif ( $excerpt = $this->get_field( 'post_excerpt' ) ) {\n\t\t\treturn $excerpt;\n\t\t}\n\t}",
"function ridizain_recentpost_excerpt () {\r\n\t$theContent = trim(strip_tags(get_the_content()));\r\n\t\t$output = str_replace( '\"', '', $theContent);\r\n\t\t$output = str_replace( '\\r\\n', ' ', $output);\r\n\t\t$output = str_replace( '\\n', ' ', $output);\r\n\t\t\tif (get_theme_mod( 'ridizain_recentpost_excerpt_length' )) :\r\n\t\t\t$limit = get_theme_mod( 'ridizain_recentpost_excerpt_length' );\r\n\t\t\telse : \r\n\t\t\t$limit = '15';\r\n\t\t\tendif;\r\n\t\t\t$content = explode(' ', $output, $limit);\r\n\t\t\tarray_pop($content);\r\n\t\t$content = implode(\" \",$content).\" \";\r\n\treturn strip_tags($content, ' ');\r\n}",
"function block_core_latest_posts_get_excerpt_length()\n {\n }",
"function monaco_child_get_the_excerpt($content) {\n global $post;\n $link = '<a class=\"moretag\" href=\"'. get_permalink($post->ID) . '\"> ' . __('[Read the full article...]', 'patrick') . '</a>';\n return preg_replace('/\\[.*\\]$/', '', $content) . $link;\n}",
"function improved_trim_excerpt($text) { // Fakes an excerpt if needed\n global $post;\n if ( '' == $text ) {\n $text = get_the_content('');\n $text = apply_filters('the_content', $text);\n \n\t$text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text);\n\t$text = preg_replace('@<style[^>]*?>.*?</style>@si', '', $text);\n\t$text = preg_replace('@<p class=\"wp-caption-text\"[^>]*?>.*?</p>@si', '', $text);\t\n $text = str_replace('\\]\\]\\>', ']]>', $text);\n $text = strip_tags($text, '<p><i><em><b><a><strong>');\n $excerpt_length = 140;\n $words = explode(' ', $text, $excerpt_length + 1);\n if (count($words)> $excerpt_length) {\n array_pop($words);\n array_push($words, '... <a href=\"'.get_permalink($post->ID).'\">'.'Read More »'.'</a>');\n $text = implode(' ', $words);\n }\n }\nreturn $text;\n}",
"function ridizain_featured_excerpt () {\r\n\t$theContent = trim(strip_tags(get_the_content()));\r\n\t\t$output = str_replace( '\"', '', $theContent);\r\n\t\t$output = str_replace( '\\r\\n', ' ', $output);\r\n\t\t$output = str_replace( '\\n', ' ', $output);\r\n\t\t\t$limit = '15';\r\n\t\t\t$content = explode(' ', $output, $limit);\r\n\t\t\tarray_pop($content);\r\n\t\t$content = implode(\" \",$content).\" \";\r\n\treturn strip_tags($content, ' ');\r\n}",
"public function get_description() {\n\t\treturn $this->_post->post_excerpt;\n\t}"
] |
[
"0.66581935",
"0.66392016",
"0.6221437",
"0.61910444",
"0.6178585",
"0.61264884",
"0.61191046",
"0.6092527",
"0.60415566",
"0.6011203",
"0.598786",
"0.594341",
"0.58690476",
"0.58599055",
"0.58398885",
"0.57887125",
"0.5775605",
"0.57638454",
"0.57549316",
"0.5712347",
"0.5689261",
"0.56645685",
"0.5653107",
"0.5648695",
"0.5639003",
"0.56321794",
"0.55878484",
"0.55800587",
"0.5573066",
"0.5571934"
] |
0.7406819
|
0
|
Get semantic code block for the specified function/file/line
|
private static function getCode($file, $line, $function = null)
{
$filer = new WalrusFileManager($_ENV['W']['ROOT_PATH']);
$filer->setCurrentElem($file);
$fail = false;
if (isset($function) && class_exists(substr($file, 0, -4))) {
$class = substr($file, 0, -4);
try {
$method = new ReflectionMethod($class, $function);
$return['comment'] = $method->getDocComment();
$start = $method->getStartLine() - 2;
$end = $method->getEndLine() + 1;
$return['highlight'] = $line - $start - 1;
$return['code'] = $filer->getFileContent(null, $start, $end);
} catch (Exception $exception) {
$fail = true;
}
} elseif (class_exists(substr($file, 0, -4))) {
$code = $filer->getFileContent('array');
$i = $line;
for ($i; $i > 0; $i--) {
if (isset($code[$i])) {
preg_match('/function\s+([a-z_]\w+)\s?\(/', $code[$i], $matches);
if (!empty($matches) && isset($matches[1])) {
$function = $matches[1];
break;
}
}
}
$method = new ReflectionMethod(substr($file, 0, -4), $function);
$return['comment'] = $method->getDocComment();
$start = $method->getStartLine() - 2;
$end = $method->getEndLine() + 1;
$return['highlight'] = $line - $i;
$return['code'] = $filer->getFileContent(null, $start, $end);
} else {
$start = $line - 5;
$end = $line;
$return['highlight'] = $line - $start - 1;
$return['code'] = $filer->getFileContent(null, $start, $end);
}
$return['file'] = $file;
if ($fail) {
$return = array(
'code' => 'No data available',
'hightlight' => false,
'comment' => false
);
}
return $return;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getDocblock()\n {\n $currentLineNumber = $this->tokenStream[$this->id][2];\n $prevLineNumber = $currentLineNumber - 1;\n\n for ($i = $this->id - 1; $i > 0; $i--) {\n\n if ('T_FUNCTION' == $this->tokenStream[$i][0]\n || 'T_CLASS' == $this->tokenStream[$i][0]\n ) {\n // Some other class or function,\n // no docblock can be used for the current token\n break;\n }\n\n $line = $this->tokenStream[$i][2];\n\n if ($line == $currentLineNumber\n || (($line == $prevLineNumber)\n && ('T_WHITESPACE' == $this->tokenStream[$i][0]))\n ) {\n continue;\n }\n\n if ($line == $prevLineNumber\n && ('T_COMMENT' == $this->tokenStream[$i][0])\n ) {\n return $this->tokenStream[$i][1];\n }\n\n if (($line < $currentLineNumber)\n && ('T_DOC_COMMENT' !== $this->tokenStream[$i][0])\n ) {\n break;\n }\n\n return $this->tokenStream[$i][1];\n }\n }",
"public function getCode()\n {\n if ( $this->isInternal() ) {\n $code = '/* ' . $this->getName() . ' is an internal function.'\n . ' Therefore the source code is not available. */';\n } else {\n $filename = $this->getFileName();\n\n $start = $this->getStartLine();\n $end = $this->getEndLine();\n\n $offset = $start - 1;\n $length = $end - $start + 1;\n \n $lines = array_slice( file( $filename ), $offset, $length );\n\n if ( strpos( trim( $lines[0] ), 'function' ) !== 0 ) {\n $lines[0] = substr( $lines[0], strpos( $lines[0], 'function' ) );\n }\n\n $code = implode( '', $lines );\n }\n return $code;\n }",
"abstract public function getLinesOfCode();",
"public function getDocblock()\n {\n $tokens = $this->tokenStream->tokens();\n $currentLineNumber = $tokens[$this->id]->getLine();\n $prevLineNumber = $currentLineNumber - 1;\n\n for ($i = $this->id - 1; $i; $i--) {\n if (!isset($tokens[$i])) {\n return;\n }\n\n if ($tokens[$i] instanceof PHP_Token_FUNCTION ||\n $tokens[$i] instanceof PHP_Token_CLASS ||\n $tokens[$i] instanceof PHP_Token_TRAIT) {\n // Some other trait, class or function, no docblock can be\n // used for the current token\n break;\n }\n\n $line = $tokens[$i]->getLine();\n\n if ($line == $currentLineNumber ||\n ($line == $prevLineNumber &&\n $tokens[$i] instanceof PHP_Token_WHITESPACE)) {\n continue;\n }\n\n if ($line < $currentLineNumber &&\n !$tokens[$i] instanceof PHP_Token_DOC_COMMENT) {\n break;\n }\n\n return (string) $tokens[$i];\n }\n }",
"public function getBlock($tag)\n {\n preg_match('#<!-- START ' . $tag . ' -->(.+?)<!-- END ' . $tag . ' -->#si', $this->content, $tor);\n if (!empty($tor)) {\n $tor = str_replace('<!-- START ' . $tag . ' -->', \"\", $tor[0]);\n $tor = str_replace('<!-- END ' . $tag . ' -->', \"\", $tor);\n } else {\n $tor = '';\n }\n return $tor;\n }",
"static function getLine($file,$line){\n\t\tif($file){\n\t\t\t$f = file($file);\n\t\t\t$code = substr($f[$line-1],0,-1);\n\t\t\treturn preg_replace('@^\\s*@','',$code);\n\t\t}\n\t}",
"final function getCode();",
"function getLineOfCode($tokens,$stackPtr)\n {\n try {\n // Get the line Start position.//\n $startPos = $stackPtr;\n while (\n $tokens[$startPos]['line'] == $tokens[$stackPtr]['line'] \n && $startPos > 0\n ) {\n $startPos--;\n }\n if ($startPos == 0) {\n $startPos--;\n }\n \n //Get the line ending position.//\n $endPos = $stackPtr;\n while (\n $tokens[$endPos]['line'] == $tokens[$stackPtr]['line'] \n && $endPos < sizeof($tokens)-1\n ) {\n $endPos++;\n }\n $lineCode='';\n //Get the line content from startPosition to EndPosition.//\n for ($i = $startPos + 1; $i < $endPos; $i++) {\n if ($tokens[$i]['code'] == T_COMMENT ) {\n continue;\n }\n $lineCode .= ($tokens[$i]['content']);\n // Remove the WhiteSpace for first content only.//\n if ($i == $startPos) {\n $lineCode = trim($lineCode);\n }\n }\n $lineCode = trim(str_replace(\"%\", \"%%\", $lineCode));\n \n return $lineCode;\n } catch (Exception $e){\n echo \"Exception found for Function - \".$tokens[$stackPtr]['code'];\n exit;\n }\n }",
"static function ParseCode($source) {\n\t\tglobal $phpTokens;\n\t\t\n\t\t$alltokens = token_get_all($source);\n\t\t$tokens = array();\n\t\t$interesting = array( \n\t\t\tT_DOC_COMMENT, T_FUNCTION, T_STRING, T_VARIABLE, T_CLASS, T_INCLUDE, T_INCLUDE_ONCE, T_REQUIRE, \n\t\t\tT_REQUIRE_ONCE, T_CONSTANT_ENCAPSED_STRING, T_DNUMBER,T_LNUMBER, T_SPECIAL_BRACKET, T_INTERFACE);\n\t\t$opentagfound = false;\n\t\tforeach($alltokens as $token) {\n\t\t\tif ($token[0] == T_OPEN_TAG) $opentagfound = true;\n\t\t\t\n\t\t\tif (!is_array($token) && $token != \")\") continue;\n\t\t\tif ($token == \")\") $token = array(T_SPECIAL_BRACKET, \")\", 0);\n\t\t\tif (!in_array($token[0], $interesting)) continue;\n\t\t\t$token[3] = @token_name($token[0]);\n\t\t\t$tokens[] = $token;\n\t\t}\n\t\t\n\t\t// NO open tag? there is no PHP code at all?\n\t\tif (!$opentagfound) return null;\n\t\t\n\t\t// Find Php Comment blocks\n\t\t$blocks = array();\n\t\t\n\t\t// Now, we have all interesting & consecutive tokens\n\t\t$pageDocBlock = null;\n\t\t$lines = preg_split(\"/((\\r?\\n)|(\\n?\\r))/\", $source);\n\t\t\n\t\t// Check all tokens\n\t\tfor($i=0; $i<count($tokens); $i++) {\n\t\t\t$token = $tokens[$i];\n\t\t\t$nextToken = $tokens[$i+1];\n\t\t\t$previousToken = $tokens[$i-1];\n\t\t\t\n\t\t\t\n\t\t\t// Trying to detect if there is a Page Docblock\n\t\t\t// First doc bloc should be a T_DOC_COMMENT. \n\t\t\t// It should contain @package\n\t\t\tif ($i == 0 && $token[0] == T_DOC_COMMENT) {\n\t\t\t\tif (stripos($token[1], \"@package\") !== FALSE) {\n\t\t\t\t\t// We found the page docblock!\n\t\t\t\t\t$block = new DocBlock($token[1], \"(Page DocBlock)\", BLOCK_PAGE);\n\t\t\t\t\t$block->line = $token[2];\n\t\t\t\t\t$block->docline = $token[2];\n\t\t\t\t\t$blocks[] = $block;\n\t\t\t\t\t$pageDocBlock = $block;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// So, what's this comment block for?\n\t\t\tif (!in_array($token[0],array(T_FUNCTION,T_CLASS,T_INTERFACE,T_STRING,T_INCLUDE,T_INCLUDE_ONCE,T_REQUIRE,T_REQUIRE_ONCE))) continue; // nothing of interest (bad syntax?) => continue...\n\t\t\tif ($token[0] == T_STRING && strtolower($token[1]) != \"define\") continue; // a string, but not \"define\"... not useful to us\n\t\t\t\n\t\t\t// Filter out elements we don't want to see\n\t\t\tif ($token[0] == T_FUNCTION && !$_POST['Dfunc']) continue;\n\t\t\telseif ($token[0] == T_CLASS && !$_POST['Dclas']) continue;\n\t\t\telseif ($token[0] == T_INTERFACE && !$_POST['Dinte']) continue;\n\t\t\telseif ($token[0] == T_STRING && !$_POST['Dcons']) continue;\n\t\t\telseif (in_array($token[0], array(T_INCLUDE,T_INCLUDE_ONCE,T_REQUIRE,T_REQUIRE_ONCE)) && !$_POST['Dincl']) continue;\n\t\t\t\n\t\t\t// Filter out anonymous functions (non anonymous functions have their name/T_STRING right after the keyword 'function')\n\t\t\tif ($token[0] == T_FUNCTION && $nextToken[0] != T_STRING) continue;\n\t\t\t\n\t\t\t// Do we have a docblock for this token?\n\t\t\t$relevantDocBlock = null;\n\t\t\tif ($previousToken[0] == T_DOC_COMMENT) {\n\t\t\t\t// Is it the page token?\n\t\t\t\tif ($i == 1 && $pageDocBlock) { // yup, it's the page token, no action\n\t\t\t\t\t//$relevantDocBlock = null;\n\t\t\t\t} else {\n\t\t\t\t\t// This is a doc block likely meant for the following object\n\t\t\t\t\t$relevantDocBlock = $previousToken;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Create empty docblock\n\t\t\tif (!$relevantDocBlock) {\n\t\t\t\t$relevantDocBlock = array(T_DOC_COMMENT,\"/**\\r\\n*\\r\\n*/\",0);\n\t\t\t}\n\t\t\t\n\t\t\t// Find out associated tokens, depending on the current token type\n\t\t\t$associatedCode = $lines[ $token[2]-1 ];\n\t\t\t$type = $token[3];\n\t\t\t\n\t\t\t$block = new DocBlock($relevantDocBlock[1],$associatedCode, $type);\n\t\t\t$block->line = $token[2];\n\t\t\t$block->docline = $relevantDocBlock[2];\n\t\t\t//echo \"<pre>\"; print_r(htmlentities($lines));die();\t\t\t\n\t\t\t$blocks[] = $block;\n\t\t}\n\t\t\n\t\treturn $blocks;\n\t}",
"public function findCodeContent($codeBlock) {\n\t\t$codeBlock = ltrim(rtrim($codeBlock, \" \"),\" \");\n\t\t$arr = explode(\" \", $codeBlock);\n\t\t$content = \"\";\n\t\t$i = 0;\n\t\tforeach ($arr as $cnt) {\n\t\t\tif ($i!=0) {\n\t\t\t\t$content .= \" \" .$cnt;\n\t\t\t}\n\t\t\t$i += 1;\n\t\t}\n\t\treturn ltrim($content, \" \");\n\t}",
"public function getCode() {\n return $this->parse()['code'];\n }",
"public function getStartLine() {\n if ( $this->reflectionSource instanceof ReflectionFunction ) {\n return $this->reflectionSource->getStartLine();\n } else {\n return parent::getStartLine();\n }\n }",
"private static function showCodeLines($file, $line){\n $text=\"\";\n $fileContent = file_get_contents($file);\n $lines = explode(\"\\n\",$fileContent);\n $nLines = Pokelio_Global::getConfig(\"EXCEPTION_SHOW_CODE_LINES\", 'Pokelio');\n $startLine=$line-$nLines;\n if($startLine<1){\n $startLine=1;\n }\n $endLine=$line+$nLines;\n if($endLine>sizeof($lines)){\n $endLine=sizeof($lines);\n }\n $text.= \" Code:\".\"\\n\";\n for($iLine=$startLine;$iLine<=$endLine;$iLine++){\n if($iLine==$line){\n $text.= \" !!!----> \";\n }else{\n $text.= \" \";\n }\n $text.= substr(\" \".$iLine,-4);\n $text.= \" \";\n $text.= str_replace(\"\\n\",\"\",$lines[$iLine-1]).\"\\n\";\n }\n return $text;\n }",
"private function getDocBlock(string $fullyQualifiedNameSpace, string $methodName) : DocBlock\n {\n $emptyDocBlock = DocBlockFactory::createInstance()->create('/** */');\n\n if (!class_exists($fullyQualifiedNameSpace)) {\n return $emptyDocBlock;\n }\n\n try {\n return DocBlockUtility::getMethodDocBlock(new $fullyQualifiedNameSpace, $methodName) ?? $emptyDocBlock;\n } catch (Exception $e) {\n return $emptyDocBlock;\n }\n }",
"public function getStmt();",
"public function getLine()\n\t{\n\t\treturn $this->token->line;\n\t}",
"public function parseFunctionName()\n {\n $type = $this->tokenizer->peek();\n switch ($type) {\n\n case PHP_Depend_TokenizerI::T_CLONE:\n case PHP_Depend_TokenizerI::T_STRING:\n case PHP_Depend_TokenizerI::T_USE:\n case PHP_Depend_TokenizerI::T_GOTO:\n case PHP_Depend_TokenizerI::T_NULL:\n case PHP_Depend_TokenizerI::T_SELF:\n case PHP_Depend_TokenizerI::T_TRUE:\n case PHP_Depend_TokenizerI::T_FALSE:\n case PHP_Depend_TokenizerI::T_NAMESPACE:\n case PHP_Depend_TokenizerI::T_DIR:\n case PHP_Depend_TokenizerI::T_NS_C:\n case PHP_Depend_TokenizerI::T_PARENT:\n return $this->consumeToken($type)->image;\n\n case PHP_Depend_TokenizerI::T_EOF:\n throw new PHP_Depend_Parser_TokenStreamEndException($this->tokenizer);\n }\n throw new PHP_Depend_Parser_UnexpectedTokenException(\n $this->tokenizer->next(),\n $this->tokenizer->getSourceFile()\n );\n }",
"function parse_blocks($content)\n {\n }",
"public function miniStatement() {\n ... function body ...\n }",
"function single_inline_codeblock($content) {\n $content = preg_replace(\"/(`[^`]*`)/\", \"<span class='code-inline'>$0</span>\", $content);\n $content = str_replace('`', '', $content);\n return $content;\n}",
"public function getLineNumber();",
"public function getLineNumber();",
"public function getCode(string $hook): string;",
"public function getLine(): int\n {\n return $this->node->start_lineno;\n }",
"function getSourceFile() ;",
"function InsertDocBlock($file, $doc, $type, $code=\"\", $line=0) {\n\t\t// Read file...\n\t\t$source = @file_get_contents($file);\n\t\tif (!$source) die(\"ERR3\"); // error 3 => can't read file\n\t\t\n\t\t// Split the code in an array\n\t\t$lines = preg_split(\"/((\\r?\\n)|(\\n?\\r))/\", $source);\n\t\t\n\t\t// Figure out line number\n\t\t// Make sure the retained line contains the same code as previously, otherwise we may have a problem\n\t\tif ($type != BLOCK_PAGE) {\n\t\t\t$linenumber = intval($line);\t\t\n\t\t\tif (trim($lines[$linenumber-1]) != trim($code) ) die(\"ERR1\");\t\t\t\n\t\t\t// Figure out indent\n\t\t\tif ( preg_match('@^([\\t\\040]*).*$@', $lines[$linenumber-1], $matches) ) {\n\t\t\t\t$doc->indent = $matches[1];\n\t\t\t}\n\t\t\t\n\t\t} else {\n\t\t\t// For the page block, we have to find the first open tag and insert after\n\t\t\t$tokens = token_get_all($source);\n\t\t\t$found = false;\n\t\t\tforeach($tokens as $token) {\n\t\t\t\tif ($token[0] == T_OPEN_TAG) {\n\t\t\t\t\t$found = true;\n\t\t\t\t\t$linenumber = intval($token[2])+1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!$found) die(\"ERR4\");\n\t\t}\n\t\t\n\t\t// Which line breaks does the source use?\n\t\t$lbtype = \"\\n\";\n\t\tif (substr_count($source,\"\\r\\n\") > 0) $lbtype = \"\\r\\n\";\n\n\t\t// Insert docblock\n\t\tarray_splice($lines, $linenumber-1, 0, $lbtype.@implode($lbtype,$doc->Output( isUtf8($source) )) );\n\t\t\t\t\n\t\t// final source\n\t\t$source = implode($lbtype, $lines);\n\t\t//rename($file,$file.\".bak\");\n\t\tfile_put_contents($file, $source);\n\t}",
"public static function getCode()\n\t{\n\t\tthrow new NotImplementedException;\n\t}",
"public function getNextBlock();",
"public function getLine() {\r\n return $this->node->getLine();\r\n }",
"public function getCodePosition() {\n return $this->codeAtEnd ? self::END : self::START;\n }"
] |
[
"0.6253031",
"0.62182677",
"0.5855573",
"0.5788603",
"0.5748935",
"0.5615003",
"0.54348975",
"0.5347467",
"0.5332671",
"0.53263307",
"0.5310516",
"0.52821976",
"0.5279118",
"0.5244513",
"0.5233449",
"0.520388",
"0.51691425",
"0.5167681",
"0.51287574",
"0.5122568",
"0.51186913",
"0.51186913",
"0.5116586",
"0.51125133",
"0.5111959",
"0.50962543",
"0.50791556",
"0.50664115",
"0.5045663",
"0.5044218"
] |
0.63970923
|
0
|
This generates a new FTPObject. The FTPconnection is not established. $inOptions is an associative array of the options you wish to set at creation time. You should use the class OPTION_ constants to set these values. Alternatively you can use the setX methods.
|
function __construct(array $inOptions = array()) {
$this->_handle = null;
$this->getOptionsSet()->setOptions($inOptions);
$this->_file_extensions = array(
'php' => FTP_ASCII,
'css' => FTP_ASCII,
'js' => FTP_ASCII,
'html' => FTP_ASCII,
'htm' => FTP_ASCII,
'phtml' => FTP_ASCII,
'xml' => FTP_ASCII,
'json' => FTP_ASCII,
'gif' => FTP_BINARY,
'jpg' => FTP_BINARY,
'jpeg' => FTP_BINARY,
'png' => FTP_BINARY,
'ico' => FTP_BINARY,
'zip' => FTP_BINARY,
'gz' => FTP_BINARY,
'iso' => FTP_BINARY,
);
$this->_ls_match = array(
'unix' => array(
'pattern' => '/(?:(d)|.)([rwxts-]{9})\s+(\w+)\s+([\w\d-()?.]+)\s+([\w\d-()?.]+)\s+(\w+)\s+(\S+\s+\S+\s+\S+)\s+(.+)/',
'map' => array(
'is_dir' => 1,
'rights' => 2,
'files_inside' => 3,
'user' => 4,
'group' => 5,
'size' => 6,
'date' => 7,
'name' => 8,
)
),
'windows' => array(
'pattern' => '/([0-9\-]+)\s+([0-9:APM]+)\s+((<DIR>)|\d+)\s+(.+)/',
'map' => array(
'date' => 1,
'time' => 2,
'size' => 3,
'is_dir' => 4,
'name' => 5,
)
)
);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"static function &creer_ftp(&$liste_option, $user, $passwd, $port = '21', $timeout = 10, $sort_en_erreur = false, $entete = __CLASS__) {\n\t\t$objet = new ftp ( $user, $passwd, $sort_en_erreur, $port, $timeout, $entete );\n\t\t$objet->_initialise ( array (\n\t\t\t\t\"options\" => $liste_option \n\t\t) );\n\t\t\n\t\treturn $objet;\n\t}",
"protected function ftpAdapter(array $config)\n {\n return new Ftp([\n 'host' => $config['host'],\n 'username' => $config['user'],\n 'password' => $config['pass'],\n\n /** optional config settings */\n 'passive' => true,\n ]);\n }",
"function ftplib()\r\n {\r\n\t $this->_debug = false;\r\n $this->_umask = 0022;\r\n $this->_timeout = 30;\r\n $this->_BINARY = 1;\r\n $this->_ASCII = 0;\r\n /*if (function_exists(\"ftp_connect\")) {\r\n \t\t$this->_use_mod_ftp = true;\r\n \t} else {*/\r\n \r\n\t\t\t$this->_use_mod_ftp = false;\r\n \t//}\r\n }",
"public function __construct($options = [])\n {\n $this->_createObject($options);\n }",
"function initFtp($connection) {\n $wrapper = new FTPWrapper($connection);\n\n /**\n * This factory creates Permissions models from a given permission string (rw-)\n */\n $permFactory = new PermissionsFactory;\n\n /**\n * This factory creates Filesystem models from a given string, ex:\n * drwxr-x--- 3 vincent vincent 4096 Jul 12 12:16 public_ftp\n *\n * It needs the PermissionsFactory so as to instanciate the given permissions in\n * its model\n */\n $fsFactory = new FilesystemFactory($permFactory);\n\n /**\n * If your server runs on WINDOWS, you can use a Windows filesystem factory instead\n */\n // $fsFactory = new WindowsFilesystemFactory;\n\n /**\n * This manager focuses on operations on remote files and directories\n * It needs the FTPWrapper so as to do operations on the serveri\n * It needs the FilesystemFfactory so as to create models\n */\n $manager = new FTPFilesystemManager($wrapper, $fsFactory);\n\n\n /**\n * This is the downloader voter. It loads multiple DownloaderVotable class and\n * checks which one is needed on given options\n */\n $dlVoter = new DownloaderVoter;\n\n /**\n * Loads up default FTP Downloaders\n * It needs the FTPWrapper to be able to share them with the downloaders\n */\n $dlVoter->addDefaultFTPDownloaders($wrapper);\n\n /**\n * This is the uploader voter. It loads multiple UploaderVotable class and\n * checks which one is needed on given options\n */\n $ulVoter = new UploaderVoter;\n\n /**\n * Loads up default FTP Uploaders\n * It needs the FTPWrapper to be able to share them with the uploaders\n */\n $ulVoter->addDefaultFTPUploaders($wrapper);\n\n /**\n * This is the creator voter. It loads multiple CreatorVotable class and\n * checks which one is needed on the given options\n */\n $crVoter = new CreatorVoter;\n\n /**\n * Loads up the default FTP creators.\n * It needs the FTPWrapper and the FTPFilesystemManager to be able to share\n * them whith the creators\n */\n $crVoter->addDefaultFTPCreators($wrapper, $manager);\n\n /**\n * This is the deleter voter. It loads multiple DeleterVotable classes and\n * checks which one is needed on the given options\n */\n $deVoter = new DeleterVoter;\n\n /**\n * Loads up the default FTP deleters.\n * It needs the FTPWrapper and the FTPFilesystemManager to be able to share\n * them with the deleters\n */\n $deVoter->addDefaultFTPDeleters($wrapper, $manager);\n\n /**\n * Finally creates the main FTP\n * It needs the manager to do operations on files\n * It needs the download voter to pick-up the right downloader on ->download\n * It needs the upload voter to pick-up the right uploader on ->upload\n * It needs the creator voter to pick-up the right creator on ->create\n * It needs the deleter voter to pick-up the right deleter on ->delete\n */\n return new FTP($manager, $dlVoter, $ulVoter, $crVoter, $deVoter);\n\n}",
"function createFTPConnection()\n{\n $settings = getSettings();\n if (empty($settings['seedbox']) || empty($settings['seedbox']['host']) || empty($settings['seedbox']['username'])\n || empty($settings['seedbox']['password'])\n ) {\n addLog('ERROR', 'No setting file found.', 'ftp');\n return false;\n } else {\n // Connect to seedbox with SSL\n $ftp = ftp_ssl_connect($settings['seedbox']['host'], intval($settings['seedbox']['port']));\n if (!$ftp) {\n addLog('ERROR', 'Wrong FTP host.', 'ftp');\n return false;\n }\n // Log with information set on settings screen\n if (!ftp_login($ftp, $settings['seedbox']['username'], $settings['seedbox']['password'])) {\n addLog('ERROR', 'Wrong FTP login or password.', 'ftp');\n return false;\n };\n\n // Enter on passive mode\n if (ftp_pasv($ftp, true)) {\n return $ftp;\n } else {\n addLog('ERROR', 'Unable to switch to passive mode.', 'ftp');\n return false;\n }\n }\n}",
"function Pico_GetFTPObject()\n{\n\t// get ftp object if we need one\n\tif (!isset($GLOBALS['pico_ftp_obj']))\n\t{\n\t\t$ftp = @Pico_ConnectFTP();\n\t\t$GLOBALS['pico_ftp_obj'] = $ftp;\n\t}\n\n\t$ftp = $GLOBALS['pico_ftp_obj'];\n\tif (is_object($ftp)) { return $ftp; }\n\n\treturn false;\n}",
"public static function factory($options)\n {\n return new self();\n }",
"public function connect($options = array())\n {\n //todo can this be a stream?\n $this->temp = '/Users/amystephen/Sites/Filesystem/.dev/Tests/Hold/amy.txt';\n\n parent::connect($options);\n\n if ($this->is_connected === true) {\n return;\n }\n\n try {\n if ($this->getConnectType() == 'ftps') {\n\n if (function_exists('ftp_ssl_connect')) {\n throw new InvalidArgumentException\n ('ftp_ssl_connect must be enabled in PHP to use SSL over Ftp');\n }\n\n $id = \\ftp_ssl_connect($this->host, $this->port, $this->timeout);\n\n } else {\n $id = \\ftp_connect($this->host, $this->port, $this->timeout);\n }\n\n $this->setConnection($id);\n\n } catch (\\Exception $e) {\n throw new \\InvalidArgumentException\n ('Filesystem Adapter Ftp: Unable to connect to the Ftp Server '\n . ' Host: ' . $this->host . ' Port: ' . $this->port);\n }\n\n if ($this->is_connected === false) {\n throw new \\InvalidArgumentException\n ('Filesystem Adapter Ftp: Not connected '\n . ' Host: ' . $this->host . ' Port: ' . $this->port);\n }\n\n try {\n \\ftp_pasv($this->connection, $this->getPassiveMode());\n\n } catch (\\Exception $e) {\n\n throw new \\InvalidArgumentException\n ('Filesystem Adapter Ftp: Unable to set passive mode for Ftp Server '\n . ' Host: ' . $this->host . ' Port: ' . $this->port);\n }\n\n try {\n $this->login();\n\n } catch (\\Exception $e) {\n\n throw new \\InvalidArgumentException\n ('Filesystem Adapter Ftp: Login failed for ' . ' User: ' . $this->username\n . ' Host: ' . $this->host . ' Port: ' . $this->port);\n }\n\n try {\n $this->is_windows = false;\n\n $ftpSystemType = \\ftp_systype($this->getConnection());\n\n if (stripos($ftpSystemType, 'win') == false) {\n $this->is_windows = false;\n } else {\n $this->is_windows = true;\n }\n\n } catch (\\Exception $e) {\n\n throw new \\InvalidArgumentException\n ('Filesystem Adapter Ftp: Login failed for ' . ' User: ' . $this->username\n . ' Host: ' . $this->host . ' Port: ' . $this->port);\n }\n\n try {\n if ($this->initial_directory === null) {\n $results = true;\n } else {\n $results = \\ftp_chdir($this->connection, $this->initial_directory);\n }\n\n } catch (\\Exception $e) {\n\n throw new \\InvalidArgumentException\n ('Filesystem Adapter Ftp: Changing Ftp Directory failed. Directory: '\n . $this->initial_directory);\n }\n\n if ($results === false) {\n\n throw new \\InvalidArgumentException\n ('Filesystem Adapter Ftp: Unable to change directory: '\n . $this->root . ' for Ftp Server '\n . ' Host: ' . $this->host . ' Port: ' . $this->port);\n }\n\n return;\n }",
"public function __construct($files, $options = [])\n { \n parent::__construct();\n $this->signal_this();\n $this->_sig_complete = new SIG_Complete();\n $this->_sig_failure = new SIG_Failure();\n $this->_sig_finished = new SIG_Finished();\n $defaults = [\n 'hostname' => null,\n 'port' => 21,\n 'timeout' => 90,\n 'username' => null,\n 'password' => null\n ];\n $this->_files = $files;\n $options += $defaults;\n $this->_options = $options;\n\n /**\n * Upload Idle process\n */\n $this->_routine->set_idle(new Process(function(){\n $this->_init_transfers();\n foreach ($this->_uploading as $_key => $_file) {\n $status = ftp_nb_continue($_file[0]);\n if ($status === FTP_MOREDATA) {\n continue;\n }\n if ($status === FTP_FINISHED) {\n emit(\n $this->_sig_complete,\n new EV_Complete($_file[1])\n );\n // Close the FTP connection to that file\n ftp_close($_file[0]);\n $this->_uploaded[] = $_file[1];\n } else {\n emit(\n $this->_sig_failure,\n new EV_Failure($_file[1])\n );\n // Close the FTP connection to that file\n ftp_close($_file[0]);\n }\n unset($this->_uploading[$_key]);\n }\n // Cleanup once finished\n if (count($this->_uploading) == 0) {\n emit(\n $this->_sig_finished, \n new EV_Finished($this)\n );\n delete_signal($this);\n delete_signal($this->_sig_complete);\n delete_signal($this->_sig_failure);\n }\n\n }));\n }",
"public function __construct($options)\n {\n foreach($options as $key => $value) {\n if ($value) $this->method = str_replace('-', '_', $key);\n }\n\n $this->filePath = storage_path('app/csv_files/');\n }",
"public function __construct($options = array())\n {\n foreach ($this->_fields as $field) {\n if (isset($options[$field])) {\n $this->$field = $options[$field];\n }\n }\n }",
"function setMode($mode) {\r\n\t\tif ( ($mode == FTP_ASCII) || ($mode == FTP_BINARY) ) {\r\n\t\t\t$this->getOptionsSet()->setOptions(array(self::OPTION_TRANSFER_MODE => $mode));\r\n\t\t\treturn $this;\r\n\t\t} else {\r\n\t\t\tthrow new ftpException('FTP-Mode has either to be FTP_ASCII or FTP_BINARY');\r\n\t\t}\r\n\t}",
"function setup($isPassive=TRUE) {\n\t\t// set up basic connection\n\t\t$this->conn_id = ftp_connect($this->ftp_server, $this->ftp_port); \n\n\t\t// login with username and password\n\t\t$this->login_result = ftp_login($this->conn_id, $this->ftp_user_name, $this->ftp_user_pass); \n\n\t\t// check connection\n\t\tif ((!$this->conn_id) || (!$this->login_result)) { \n\t\t\t\techo \"FTP connection has failed!\\n\";\n\t\t\t\techo \"Attempted to connect to $this->ftp_server for user $this->ftp_user_name\\n\"; \n\t\t\t\texit; \n\t\t} else {\n\t\t\t\techo \"Connected to $this->ftp_server,\\n\\t$this->ftp_user_name\\n\";\n\t\t}\n\n\t\tif($isPassive){\n\t\t\tftp_pasv($this->getConn_id(), TRUE);\n\t\t}\n\t}",
"private function __construct($options = false)\n {\n $this->options = $options;\n }",
"public function __construct($file, $options = null) {\r\n $this->file = $file;\r\n // Set options\r\n if (isset($options)) {\r\n if (isset($options['perms'])) {\r\n $this->option_perms = $options['perms'];\r\n }\r\n if (isset($options['create'])) {\r\n $this->option_create = $options['create'];\r\n }\r\n if (isset($options['remove'])) {\r\n $this->option_remove = $options['remove'];\r\n }\r\n }\r\n if (is_null($this->option_perms)) {\r\n $this->option_perms = 0666 & ~umask();\r\n }\r\n }",
"private function __open($options) {\n\n \t$this->zip_archive->open($this->zip_file, $options);\n\n \treturn $this;\n\n }",
"public function construct_old($options) {\n\n $this->logger = new PsApiLogger;\n\n $this->url_mode = false;\n $this->url_mode_prefix = 'psapi_';\n\n foreach ($options as $option=>$value) {\n switch ($option) {\n case 'logging':\n\tif ($options['logging']) $this->logger->enable();\n\tbreak;\n case 'url-mode':\n\tif ($value) $this->url_mode = true;\n\tbreak;\n case 'url-mode-prefix':\n\tif (strlen($value) > 0) {\n\t $this->url_mode_prefix = $value;\n\t} else {\n\t $this->logger->error('Invalid url mode prefix. Must be at least one character.');\n\t}\n\tbreak;\n case 'account':\n\t$this->options['account'] = $value;\n\tbreak;\n case 'catalog':\n\t$this->options['catalog'] = $value;\n\tbreak;\n }\n }\n\n $this->called = false;\n\n $resources = array('merchants', 'products', 'deals', 'offers', 'categories', 'brands', 'deal_types', 'countries', 'merchant_types');\n foreach ($resources as $resource) {\n $this->{$resource} = array();\n }\n }",
"public function __construct() {\n\n\t\tparent::__construct();\n\n\t\t// Handle errors from ftp_* functions that throw warnings for things like invalid username / password, failed directory changes, and failed data connections\n\t\tset_error_handler( array( $this, 'handle_errors' ) );\n\n\t\t// setup connection\n\t\t$this->link = null;\n\n\t\tif ( 'ftps' == $this->security && function_exists( 'ftp_ssl_connect' ) ) {\n\n\t\t\t$this->link = ftp_ssl_connect( $this->server, $this->port, $this->timeout );\n\n\t\t} elseif ( 'ftps' !== $this->security ) {\n\n\t\t\t$this->link = ftp_connect( $this->server, $this->port, $this->timeout );\n\t\t}\n\n\t\t// check for successful connection\n\t\tif ( ! $this->link ) {\n\n\t\t\tthrow new Exception( __( \"Could not connect via FTP to {$this->server} on port {$this->port}, check server address and port.\", 'woocommerce-customer-order-csv-export' ) );\n\t\t}\n\n\t\t// attempt to login, note that incorrect credentials throws an E_WARNING PHP error\n\t\tif ( ! ftp_login( $this->link, $this->username, $this->password ) ) {\n\n\t\t\tthrow new Exception( __( \"Could not authenticate via FTP with username {$this->username} and password <hidden>. Check username and password.\", 'woocommerce-customer-order-csv-export' ) );\n\t\t}\n\n\t\t// set passive mode if enabled\n\t\tif ( $this->passive_mode ) {\n\n\t\t\t// check for success\n\t\t\tif ( ! ftp_pasv( $this->link, true ) ) {\n\n\t\t\t\tthrow new Exception( __( 'Could not set passive mode', 'woocommerce-customer-order-csv-export' ) );\n\t\t\t}\n\t\t}\n\n\t\t// change directories if initial path is populated, note that failing to change directory throws an E_WARNING PHP error\n\t\tif ( $this->path ) {\n\n\t\t\t// check for success\n\t\t\tif ( ! ftp_chdir( $this->link, '/' . $this->path ) ) {\n\n\t\t\t\tthrow new Exception( __( \"Could not change directory to {$this->path} - check path exists.\", 'woocommerce-customer-order-csv-export' ) );\n\t\t\t}\n\t\t}\n\t}",
"private function create() {\n $connection = mysqli_connect(\"localhost\", \"php\", \"password\");\n if (!$connection) {\n //error connecting\n } else { //connection was good\n $this->enforceSQLProtection($connection);\n $db = mysqli_select_db($connection, \"DB_PHP\");\n $queryString = \"INSERT INTO OPTIONS(QuestionID\n ,Text\n ,IsAnswer)\n VALUES (\n '$this->QuestionID'\n ,'$this->Text'\n ,$this->IsAnswer\n );\n \";\n $qCreateUser = mysqli_query($connection, $queryString);\n $this->OptionID = $connection->insert_id;\n\n\n mysqli_close($connection); // Closing Connection\n return $this;\n }\n }",
"public function __construct($options)\n {\n $this->item = $options['item'];\n $this->name = (string) $this->item->name;\n $this->object = $options['object'];\n $this->values = isset($options['values']) ? $options['values'] : [];\n $this->errors = isset($options['errors']) ? $options['errors'] : [];\n $this->options = [];\n $nameMultiple = (isset($options['nameMultiple']) && isset($options['idMultiple']) && $options['nameMultiple'] != '' && $options['idMultiple']);\n $this->options['nameSimple'] = $this->name;\n $this->options['name'] = ($nameMultiple) ? $options['nameMultiple'] . '-' . $options['idMultiple'] . '-' . $this->name : $this->name;\n $this->options['value'] = $this->values[$this->name];\n $this->options['error'] = $this->errors[$this->name];\n $this->options['label'] = (string) $this->item->label;\n $this->options['placeholder'] = (string) $this->item->placeholder;\n $this->options['lang'] = (string) $this->item->language;\n $this->options['mode'] = (string) $this->item->mode;\n $this->options['layout'] = (string) $this->item->layout;\n $this->options['className'] = $this->object->className;\n $this->options['idObject'] = $this->object->id();\n $this->options['required'] = ((string) $this->item->required != '') ? true : false;\n $this->options['multiple'] = ((string) $this->item->multiple != '') ? true : false;\n $this->options['typeField'] = (isset($options['typeField'])) ? $options['typeField'] : 'file';\n }",
"public function createFromFTP ($path) {\n\n // Attempt to open this using URL wrappers and the createFromFile\n // function.\n return $this->createFromFile($path);\n\n }",
"public static function createFromOptions($options)\n {\n $operation = new self();\n $operation->fromArray($options);\n\n return $operation;\n }",
"public static function createFromOptions($options)\n {\n $operation = new self();\n $operation->fromArray($options);\n\n return $operation;\n }",
"public static function factory($options = [])\n {\n return new static();\n }",
"public function __construct($options = [], $adapter = 'Http')\n {\n $direction = false;\n $rename = isset($options['rename']) ? $options['rename'] : '%random%';\n $destination = !empty($options['destination'])\n ? $options['destination']\n : 'upload/' . Pi::service('module')->current();\n $this->setAdapter($adapter, $direction, $options);\n $this->setDestination($destination);\n $this->setRename($rename);\n }",
"public static function createFromUpload( array $file_upload, $options=array() )\r\n {\r\n if (!isset($file_upload['error']) || is_array($file_upload['error'])) \r\n {\r\n throw new \\Exception('Invalid Upload');\r\n }\r\n \r\n switch ($file_upload['error']) \r\n {\r\n \tcase UPLOAD_ERR_OK:\r\n \t break;\r\n \tcase UPLOAD_ERR_NO_FILE:\r\n \t throw new \\Exception('No file sent.');\r\n \tcase UPLOAD_ERR_INI_SIZE:\r\n \tcase UPLOAD_ERR_FORM_SIZE:\r\n \t throw new \\Exception('Exceeded filesize limit.');\r\n \tdefault:\r\n \t throw new \\Exception('Unknown errors.');\r\n }\r\n \r\n if (empty($file_upload['tmp_name']) || empty($file_upload['name']))\r\n {\r\n throw new \\Exception('Invalid Upload Properties');\r\n }\r\n\r\n if (empty($file_upload['size']))\r\n {\r\n throw new \\Exception('Invalid Upload Size');\r\n }\r\n \r\n $app = \\Base::instance();\r\n $options = $options + array('width'=>460, 'height'=>308);\r\n \r\n // Do the upload \r\n $model = new static;\r\n $grid = $model->getDb()->getGridFS( $model->collectionNameGridFS() );\r\n $file_path = $model->inputFilter()->clean($file_upload['tmp_name']);\r\n $name = $model->inputFilter()->clean($file_upload['name']);\r\n\t\t$buffer = file_get_contents($file_upload['tmp_name']);\r\n \r\n\t\t$thumb = null;\r\n\t\tif ( $thumb_binary_data = $model->getThumb( $buffer, null, $options )) {\r\n\t\t\t$thumb = new \\MongoBinData( $thumb_binary_data, 2 );\r\n\t\t}\r\n\t\t\r\n $values = array(\r\n 'type' => !empty($options['type']) ? $options['type'] : null,\r\n 'storage' => 'gridfs',\r\n 'md5' => md5_file( $file_path ),\r\n 'url' => null,\r\n \t'thumb' => $thumb,\r\n \t'filename' => $name,\r\n \t'contentType' => $model->getMimeType($buffer),\r\n 'title' => \\Dsc\\String::toSpaceSeparated( $name ),\r\n );\r\n \r\n if ($storedfile = $grid->storeFile( $file_path, $values ))\r\n {\r\n $model->load(array('_id'=>$storedfile));\r\n $model->bind( $values );\r\n $model->slug = $model->generateSlug();\r\n if(!empty($options['tags'])){\r\n \t$model->set('tags', $options['tags']);\r\n }\r\n $model->save();\r\n }\r\n \r\n return $model;\r\n }",
"public function __construct($options = array())\n {\n $this->required_options('login, password', $options);\n\n if (isset($options['currency'])) {\n self::$default_currency = $options['currency'];\n }\n\n $this->options = $options;\n }",
"protected function createFtpDriver()\n {\n return new Ftp($this->app, $this->app['orchestra.publisher.ftp']);\n }",
"function __construct($conn)\n {\n $this->connect = ftp_connect($conn);\n\n if (!$this->connect) {\n echo \"Ftp don't connect\\n\";\n }\n\n return $this->connect;\n }"
] |
[
"0.5817841",
"0.5251337",
"0.5163629",
"0.5153623",
"0.51196057",
"0.50996274",
"0.5059596",
"0.50089073",
"0.5008019",
"0.49293974",
"0.48901674",
"0.48864746",
"0.48430973",
"0.48141062",
"0.4782511",
"0.47701994",
"0.47690064",
"0.4750853",
"0.47476667",
"0.47047424",
"0.47032145",
"0.46722212",
"0.46678475",
"0.46678475",
"0.46658063",
"0.46638727",
"0.4643615",
"0.46291214",
"0.46261856",
"0.46014157"
] |
0.591341
|
0
|
This logs you into the ftpserver. You are free to specify username and password in this method. If you specify it, the values will be taken into the corresponding attributes, if do not specify, the attributes are taken. If connect() has not been called yet, a connection will be setup
|
function login($username = null, $password = null) {
if ( $this->_handle === null ) {
$res = $this->connect();
}
if ( $username !== null ) {
$this->setUsername($username);
}
if ( $password !== null ) {
$this->setPassword($password);
}
$res = @ftp_login($this->_handle, $this->getUsername(), $this->getPassword());
if ( !$res ) {
throw new ftpLoginException($this->getUsername(), $this->getPassword());
} else {
return true;
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function setup($isPassive=TRUE) {\n\t\t// set up basic connection\n\t\t$this->conn_id = ftp_connect($this->ftp_server, $this->ftp_port); \n\n\t\t// login with username and password\n\t\t$this->login_result = ftp_login($this->conn_id, $this->ftp_user_name, $this->ftp_user_pass); \n\n\t\t// check connection\n\t\tif ((!$this->conn_id) || (!$this->login_result)) { \n\t\t\t\techo \"FTP connection has failed!\\n\";\n\t\t\t\techo \"Attempted to connect to $this->ftp_server for user $this->ftp_user_name\\n\"; \n\t\t\t\texit; \n\t\t} else {\n\t\t\t\techo \"Connected to $this->ftp_server,\\n\\t$this->ftp_user_name\\n\";\n\t\t}\n\n\t\tif($isPassive){\n\t\t\tftp_pasv($this->getConn_id(), TRUE);\n\t\t}\n\t}",
"public function connect()\n {\n $server = $this->server;\n\n // Make sure the path has a trailing slash.\n $server['path'] = rtrim($server['path'], '/').'/';\n\n // Make the connection.\n $connection = @ftp_connect($server['host'], $server['port']);\n\n if (! $connection)\n {\n throw new Exception(\"Couldn't connect to '{$server['host']}'.\");\n }\n\n // Try logging in.\n if (! @ftp_login($connection, $server['username'], $server['password']))\n {\n throw new Exception(\"Couldn't login to '{$server['host']}' with user '{$server['username']}'\");\n }\n\n // Set passive mode from connection config.\n ftp_pasv($connection, (bool) $server['passive']);\n\n // Try changing the directory to the one set\n // in the connection config.\n if (! ftp_chdir($connection, $server['path']))\n {\n throw new Exception(\"Couldn't change the FTP directory to '{$server['path']}'.\");\n }\n\n $this->connection = $connection;\n }",
"protected function initConnection()\n {\n\n $host = $this->connParam['host'] ?? null;\n $userName = $this->connParam['user'] ?? null;\n $password = $this->connParam['password'] ?? null;\n\n $this->FTPHandle = $this->connectFTP($host);\n\n return $this->loginFTP($this->FTPHandle, $userName, $password);\n }",
"function connect() {\n $fedora_user = new stdClass();\n $fedora_user->name = $this->config->fedora->username;\n $fedora_user->pass = $this->config->fedora->password;\n $this->fedora_connect = new FedoraConnection($fedora_user, $this->config->fedora->protocol . '://' . $this->config->fedora->host . ':' . $this->config->fedora->port . '/fedora');\n }",
"public function useFauxtonLogin($username = null, $password = null)\n {\n self::$username = !is_null($username) ? $username : null;\n self::$password = !is_null($password) ? $password : null;\n if (!isset($username, $password) || !is_null($username) || !is_null($password)) {\n $this->setCurlOptions(CURLOPT_USERPWD, \"{$username}:{$password}\"); \n } \n }",
"protected function login( )\r\n {\r\n $this->sendData( 'USER', $this->_nick, $this->_nick . ' ' . $this->_user . ' : ' . $this->_realName );\r\n \r\n $this->sendData( 'NICK', $this->_nick );\r\n \r\n $this->_loggedOn = true;\r\n }",
"public function connect() {\n if ($this->_connection === null) {\n // Connect - SSL?\n $this->_connection = $this->ssl ? ftp_ssl_connect($this->host, $this->port, $this->timeout) : ftp_connect($this->host, $this->port, $this->timeout);\n// $this->_connection = $this->ssl ? ftp_connect($this->host, $this->port, $this->timeout) : ftp_ssl_connect($this->host, $this->port, $this->timeout);\n // Connection anonymous?\n if (!empty($this->username) AND !empty($this->password)) {\n $login_result = ftp_login($this->_connection, $this->username, $this->password);\n } else {\n $login_result = true;\n }\n\n // Check connection\n if (!$this->_connection)\n throw new CHttpException(403, 'FTP Library Error: Connection failed!');\n\n // Check login\n if ((empty($this->username) AND empty($this->password)) AND !$login_result)\n throw new CHttpException(403, 'FTP Library Error: Login failed!');\n\n $this->_active = true;\n }\n }",
"public function Login ($username = '', $password = '') {\n if ($this->connected == false) {\n $this->error = 'Not connected to POP3 server';\n\n if ($this->do_debug >= 1) {\n $this->displayErrors();\n }\n }\n\n if (empty($username)) {\n $username = $this->username;\n }\n\n if (empty($password)) {\n $password = $this->password;\n }\n\n $pop_username = \"USER $username\" . $this->CRLF;\n $pop_password = \"PASS $password\" . $this->CRLF;\n\n // Send the Username\n $this->sendString($pop_username);\n $pop3_response = $this->getResponse();\n\n if ($this->checkResponse($pop3_response)) {\n // Send the Password\n $this->sendString($pop_password);\n $pop3_response = $this->getResponse();\n\n if ($this->checkResponse($pop3_response)) {\n return true;\n } else {\n return false;\n }\n } else {\n return false;\n }\n }",
"public function connect($host=NULL,$username='',$password='',$passive=NULL,$port=NULL)\n\t{\n\t\t//Initlize Params\n\t\tif (is_array($host) and $host) {\n\t\t\t$this->initialize($host);\n\t\t} elseif ($host) {\n\t\t\t$config = array(\n\t\t\t\t'host' => $host,\n\t\t\t\t'username' => $username,\n\t\t\t\t'password' => $password\n\t\t\t);\n\t\t\tis_null($passive) || $config['passive'] = $passive;\n\t\t\tis_null($port) || $config['port'] = $port;\n\t\t\t$this->initialize($config);\n\t\t} elseif (!$this->host) {\n\t\t\tshowError('FTP connect has no config, Connect been stopped.',FALSE);\n\t\t\treturn FALSE;\n\t\t}\n\n\t\t//Connect\n\t\t$this->conn = @ftp_connect($this->host,$this->port);\n\n\t\tif (!$this->conn) {\n\t\t\tshowError(\"Unable to connect to FTP server '{$this->host}'\",FALSE);\n\t\t\treturn FALSE;\n\t\t}\n\n\t\t//Login\n\t\t$login = @ftp_login($this->conn,$this->username,$this->password);\n\t\tif (!$login) {\n\t\t\tshowError(\"Unable to login to FTP server\");\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tif ($this->passive) {\n\t\t\tftp_pasv($this->conn,TRUE);\n\t\t}\n\n\t\treturn TRUE;\n\t}",
"protected function login()\n {\n $this->send(Response::nick($this->config['nick']));\n $this->send(Response::user(\n $this->config['nick'],\n $this->config['hostname'],\n $this->config['servername'],\n $this->config['realname']\n ));\n }",
"public function login ( $username, $password ) { return $this->server->login( $username, $password ); }",
"public static function login(string $username, string $password, string $server, ?string $cwd = null)\n {\n self::runCommand(sprintf('login --username %s --password %s %s', $username, $password, $server), $cwd);\n }",
"public function setLogin($username, $password) {\n\t\t$this->_username = $username;\n\t\t$this->_password = $password;\n\t}",
"public function ftpConnect() {\n\t\t\t$this->ftpConnection = ftp_connect($this->ftp['server']);\n\t\t\t\n\t\t\tif(ftp_login($this->ftpConnection, $this->ftp['user'], $this->ftp['password'])) {\n\t\t\t\t\n\t\t\t\tif(!empty($this->ftp['defaultDirectory'])) {\n\t\t\t\t\tftp_chdir($this->ftpConnection, $this->ftp['defaultDirectory']);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t$this->system->addSyslog($this->name, \"FTP successfully connected.\");\n\t\t\t\treturn $this->ftpConnection;\n\t\t\t}\n\t\t\telse $this->system->addSyslog($this->name, \"Can't connect to FTP.\");\n\t\t\t\n\t\t\treturn null;\n\t\t}",
"function login($username, $password = null)\n {\n $f3->get('user')->copyfrom('POST');\n k($f3);\n $user = self::load(\"name = $username\");\n k($user);\n }",
"public function connect() {\n if(!isset($this->_ip) || !isset($this->_ftpUsername) || !isset($this->_ftpPassword)) {\n trigger_error(\"IP, username, or password is not set\");\n return FALSE;\n }\n \n $this->_ftpConnection = ftp_connect($this->_ip);\n \n if(!$this->_ftpConnection) {\n trigger_error(\"Couldn't open FTP connection to \" . $this->_ip);\n return FALSE;\n }\n \n if(!ftp_login($this->_ftpConnection, $this->_ftpUsername, $this->_ftpPassword)) {\n trigger_error(\"Couldn't login to FTP\");\n return FALSE;\n }\n \n $this->_connected = TRUE;\n \n return TRUE;\n }",
"function ftp($host, $username, $password, $root_path, $port = 21, $timeout = 10)\n\t{\n\t\t$this->host\t\t\t= $host;\n\t\t$this->port\t\t\t= $port;\n\t\t$this->username\t\t= $username;\n\t\t$this->password\t\t= $password;\n\t\t$this->timeout\t\t= $timeout;\n\n\t\t// Make sure $this->root_path is layed out the same way as the $user->page['root_script_path'] value (/ at the end)\n\t\t$this->root_path\t= str_replace('\\\\', '/', $this->root_path);\n\n\t\tif (!empty($root_path))\n\t\t{\n\t\t\t$this->root_path = (($root_path[0] != '/' ) ? '/' : '') . $root_path . ((substr($root_path, -1, 1) == '/') ? '' : '/');\n\t\t}\n\n\t\t// Init some needed values\n\t\ttransfer::transfer();\n\n\t\treturn;\n\t}",
"public function login()\n {\n //$this->username = $username; // we are gonnna use the above property: $username here\n //$this->password = $password;\n // we want to call authuser from within login so\n $this->auth_user(); // we don't need to pass any arguments here because we know the class properties above this line\n\n }",
"function _connectFTP()\n\t{\n\t\tJoomlapackLogger::WriteLog(_JP_LOG_DEBUG, 'Connecting to remote FTP');\n\t\t// Connect to the FTP server\n\t\tif($this->_usessl)\n\t\t{\n\t\t\tif(function_exists('ftp_ssl_connect'))\n\t\t\t{\n\t\t\t\t$this->_ftphandle = @ftp_ssl_connect($this->_host, $this->_port);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->_ftphandle = false;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->_ftphandle = @ftp_connect($this->_host, $this->_port);\n\t\t}\n\n\t\tif(!is_resource($this->_ftphandle))\n\t\t{\n\t\t\t$this->setError('Could not connect to remote FTP server');\n\t\t\treturn false;\n\t\t}\n\n\t\t// Login\n\t\tif(!@ftp_login($this->_ftphandle, $this->_user, $this->_pass))\n\t\t{\n\t\t\t$this->setError('Invalid username/password for the remote FTP server');\n\t\t\treturn false;\n\t\t}\n\n\t\t// Change to initial directory\n\t\tif(!@ftp_chdir($this->_ftphandle, $this->_initdir))\n\t\t{\n\t\t\t$this->setError('Invalid initial directory for the remote FTP server');\n\t\t\treturn false;\n\t\t}\n\n\t\t$this->_currentdir = $this->_initdir;\n\n\t\t@ftp_pasv($this->_ftphandle, $this->_passive);\n\t\treturn true;\n\t}",
"public function login($_username, $_password)\n {\n $this->m_username = $_username;\n $this->m_password = $_password;\n }",
"public function login()\n {\n $logged_in = ftp_login($this->getConnection(), $this->getUsername(), $this->getPassword());\n\n if ($logged_in === true) {\n } else {\n throw new \\RuntimeException\n ('Filesystem Adapter Ftp: Unable to login with Password: ' . $this->getPassword()\n . ' Password: ' . $this->getPassword());\n }\n\n return true;\n }",
"public function connect($server, $username, $secret);",
"public function login($login = 'anonymous', $pass = null){\n\t\t$passiveMode = true;\n\t\tif (!@ftp_login($this->connection, $login, $pass))\n\t\t{\n\t\t\t$this->error = 'access denied';\n\t\t\treturn false;\n\t\t}\n\n\t\tif($passiveMode && !ftp_pasv($this->connection, true)){\n\t\t\t$this->error = \"ftp passive mode not available\";\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\treturn true;\n\t}",
"protected function connect ($username = '', $password = '')\n {\n if ( $username !== '' )\n $this->username = $username;\n \n if ( $password !== '' )\n $this->password = $password;\n \n $this->writeFrame(new StompFrame('CONNECT', array('login' => $this->username, 'passcode' => $this->password)));\n return $this->readFrame();\n }",
"public function login($username, $password);",
"public function connect($options = array())\n {\n //todo can this be a stream?\n $this->temp = '/Users/amystephen/Sites/Filesystem/.dev/Tests/Hold/amy.txt';\n\n parent::connect($options);\n\n if ($this->is_connected === true) {\n return;\n }\n\n try {\n if ($this->getConnectType() == 'ftps') {\n\n if (function_exists('ftp_ssl_connect')) {\n throw new InvalidArgumentException\n ('ftp_ssl_connect must be enabled in PHP to use SSL over Ftp');\n }\n\n $id = \\ftp_ssl_connect($this->host, $this->port, $this->timeout);\n\n } else {\n $id = \\ftp_connect($this->host, $this->port, $this->timeout);\n }\n\n $this->setConnection($id);\n\n } catch (\\Exception $e) {\n throw new \\InvalidArgumentException\n ('Filesystem Adapter Ftp: Unable to connect to the Ftp Server '\n . ' Host: ' . $this->host . ' Port: ' . $this->port);\n }\n\n if ($this->is_connected === false) {\n throw new \\InvalidArgumentException\n ('Filesystem Adapter Ftp: Not connected '\n . ' Host: ' . $this->host . ' Port: ' . $this->port);\n }\n\n try {\n \\ftp_pasv($this->connection, $this->getPassiveMode());\n\n } catch (\\Exception $e) {\n\n throw new \\InvalidArgumentException\n ('Filesystem Adapter Ftp: Unable to set passive mode for Ftp Server '\n . ' Host: ' . $this->host . ' Port: ' . $this->port);\n }\n\n try {\n $this->login();\n\n } catch (\\Exception $e) {\n\n throw new \\InvalidArgumentException\n ('Filesystem Adapter Ftp: Login failed for ' . ' User: ' . $this->username\n . ' Host: ' . $this->host . ' Port: ' . $this->port);\n }\n\n try {\n $this->is_windows = false;\n\n $ftpSystemType = \\ftp_systype($this->getConnection());\n\n if (stripos($ftpSystemType, 'win') == false) {\n $this->is_windows = false;\n } else {\n $this->is_windows = true;\n }\n\n } catch (\\Exception $e) {\n\n throw new \\InvalidArgumentException\n ('Filesystem Adapter Ftp: Login failed for ' . ' User: ' . $this->username\n . ' Host: ' . $this->host . ' Port: ' . $this->port);\n }\n\n try {\n if ($this->initial_directory === null) {\n $results = true;\n } else {\n $results = \\ftp_chdir($this->connection, $this->initial_directory);\n }\n\n } catch (\\Exception $e) {\n\n throw new \\InvalidArgumentException\n ('Filesystem Adapter Ftp: Changing Ftp Directory failed. Directory: '\n . $this->initial_directory);\n }\n\n if ($results === false) {\n\n throw new \\InvalidArgumentException\n ('Filesystem Adapter Ftp: Unable to change directory: '\n . $this->root . ' for Ftp Server '\n . ' Host: ' . $this->host . ' Port: ' . $this->port);\n }\n\n return;\n }",
"private function _login() {\n if( !$this->_connection->getCookieJar()->getCookie( $this->_baseUrl,\n 'auth_tkt', Zend_Http_CookieJar::COOKIE_OBJECT ) ) {\n $this->_connection->setUri( $this->_baseUrl . self::URL_LOGIN );\n $this->_connection->setParameterPost( array(\n 'login_username' => $this->_username,\n 'login_password' => $this->_password,\n 'back' => $this->_baseUrl,\n 'login' => 'Log In' ) );\n $this->_doRequest( Zend_Http_Client::POST );\n if( !$this->_connection->getCookieJar()->getCookie( $this->_baseUrl,\n 'auth_tkt', Zend_Http_CookieJar::COOKIE_OBJECT ) ) {\n throw new Opsview_Remote_Exception( 'Login failed for unknown reason' );\n }\n }\n }",
"function setCredentials($username, $password)\n {\n $this->username = $username;\n $this->password = $password;\n }",
"protected static function login() {\n $wsdl = FS_APP_ROOT.'/lib/third_party/salesforce/soapclient/partner.wsdl.xml';\n\n if (self::getSessionData('salesforce_sessionId') == NULL) {\n self::getConn()->createConnection($wsdl);\n self::getConn()->login(self::$_username, self::$_password . self::$_token);\n\n // Now we can save the connection info for the next page\n self::setSessionData('salesforce_location', self::getConn()->getLocation());\n self::setSessionData('salesforce_sessionId', self::getConn()->getSessionId());\n self::setSessionData('salesforce_wsdl', $wsdl);\n } else {\n // Use the saved info\n self::getConn()->createConnection(self::getSessionData('salesforce_wsdl'));\n self::getConn()->setEndpoint(self::getSessionData('salesforce_location'));\n self::getConn()->setSessionHeader(self::getSessionData('salesforce_sessionId'));\n }\n }",
"function TpDbgConnect()\n{\n global $TpDbg;\n if (!isset($TpDbg))\n {\n $TpDbg = ftp_connect(\"localhost\", 999, 20);\n if ($TpDbg)\n ftp_login($TpDbg, \"PHP\", \"TURBO\");\n else\n echo \"TurboPhp: Could not connect to debug server.<br>\";\n }\n return $TpDbg;\n}"
] |
[
"0.65001386",
"0.64200884",
"0.6330892",
"0.6271324",
"0.6223954",
"0.6175788",
"0.6145142",
"0.60273546",
"0.601544",
"0.5963218",
"0.59508634",
"0.5942888",
"0.5934921",
"0.5931462",
"0.59142077",
"0.58818674",
"0.5866705",
"0.58344656",
"0.5802064",
"0.57855093",
"0.57732373",
"0.5725869",
"0.572476",
"0.5707778",
"0.56955516",
"0.56923205",
"0.56808674",
"0.56801444",
"0.563507",
"0.56093824"
] |
0.6854084
|
0
|
This method tries executing a command on the ftp, using SITE EXEC.
|
function execute($command) {
$res = @ftp_exec($this->_handle, $command);
if ( !$res ) {
throw new ftpExecCommandException($command);
} else {
return $res;
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function exec($command) {\n\t\t$CODE_RETOUR = false;\n\t\tif ($this->verifie_connexion ())\n\t\t\t$CODE_RETOUR = ftp_exec ( $this->conn_id, $command );\n\t\treturn $CODE_RETOUR;\n\t}",
"function site($command)\r\n {\r\n if ($this->_use_mod_ftp) {\r\n \t\tftp_site($this->_socket, $command);\r\n \t} else {\r\n \t $this->putcmd(\"SITE\", $command);\r\n \t}\r\n \treturn $this->ok();\r\n }",
"function site($command) {\r\n\t\t$res = @ftp_site($this->_handle, $command);\r\n\t\tif ( !$res ) {\r\n\t\t\tthrow new ftpSiteCommandException($command);\r\n\t\t} else {\r\n\t\t\treturn $res;\r\n\t\t}\r\n\t}",
"public function exec_ftp_commande($command) {\n\t\t$CODE_RETOUR = false;\n\t\tif ($this->verifie_connexion ())\n\t\t\t$CODE_RETOUR = ftp_raw ( $this->conn_id, $command );\n\t\treturn $CODE_RETOUR;\n\t}",
"function _site($command)\n\t{\n\t\treturn @ftp_site($this->connection, $command);\n\t}",
"public abstract function exec();",
"abstract protected function executeCommand();",
"function commandExec($param)\n{\n echo gethostname() . \"@\" . get_current_user() . \" $ \" . $param . \"<br>\";\n if (! checkFunctions(\"system\")) {\n system($param);\n } else if (! checkFunctions(\"passthru\")) {\n echo passthru($param);\n } else if (! checkFunctions(\"exec\")) {\n echo exec($param);\n } else if (! checkFunctions(\"shell_exec\")) {\n echo shell_exec($param);\n } else if (! checkFunctions(\"popen\")) {\n $handle = popen($param . ' 2>&1', \"r\");\n $read = fread($handle, 2096);\n echo $read;\n fclose($handle);\n }else{\n echo \"Sorry we can't run any system command in this server\";\n }\n}",
"public function execute($command) {\n if ($this->getActive()) {\n // Execute command\n if (ftp_exec($this->_connection, $command)) {\n return true;\n } else {\n return false;\n }\n } else {\n throw new CHttpException(403, 'EFtpComponent is inactive and cannot perform any FTP operations.');\n }\n }",
"protected function _exec()\n {\n }",
"public function execute() {\n\t\t$success = false;\n\t\t// preload error_code\n\t\t$this->init();\n\t\t// execute the command on all pages selected\n\t\t$pids = $this->extGetTreeList($this->getPage(), $this->getDepth(), 0, \"(fe_group=0 OR fe_group='') and hidden < 1\") . '-1';\n\t\t$pages = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*','pages', 'uid in('.$pids.')');\n\t\tif(count($pages) > 0){\n\t\t\tforeach($pages as $page){\n\t\t\t\t$this->executeTidy($page);\n\t\t\t}\n\t\t\t$success = true;\n\t\t}\n\t\t\n\t\t/*mail('[email protected]', 'Server Error', 'Fehler: '.$errstr.CHR(10).\n\t\t\t\t'Fehlernummer: '.$errno.CHR(10).\n\t\t\t\t'Server: '.$this->ip.CHR(10).\n\t\t\t\t'Port: '.$this->port);\n\t\t*/\n\t\treturn $success;\n\t}",
"public function exec () {\r\n\t\t$a = isset($_GET['action']) ? $_GET['action'] : 'capa';\r\n\t\tswitch ($a) {\r\n\t\t\tcase 'capa':\r\n\t\t\t\t$this->capa();\r\n\t\t\tbreak;\r\n\t\t\tcase 'adicionar':\r\n\t\t\t\t$this->adicionar();\r\n\t\t\tbreak;\r\n\t\t\tcase 'alterar':\r\n\t\t\t\t$this->alterar();\r\n\t\t\tbreak;\r\n\t\t\tcase 'detalhar':\r\n\t\t\t\t$this->detalhar();\r\n\t\t\tbreak;\r\n\t\t\tcase 'excluir':\r\n\t\t\t\t$this->excluir();\r\n\t\t\tbreak;\r\n\t\t\tcase 'sair':\r\n\t\t\t\t$this->sair();\r\n\t\t\tbreak;\r\n\t\t} \r\n\t}",
"public function execute();",
"public function execute();",
"public function execute();",
"public function execute();",
"public function execute();",
"public function execute();",
"public function execute();",
"public function execute();",
"public function execute();",
"public function execute();",
"public function execute();",
"public function execute();",
"public function execute();",
"public function execute();",
"public function execute();",
"abstract public function Execute();",
"function execute();",
"abstract function execute ();"
] |
[
"0.663193",
"0.64547426",
"0.63901365",
"0.62406564",
"0.6240563",
"0.61226964",
"0.59822744",
"0.5962912",
"0.5935318",
"0.57824224",
"0.5779387",
"0.5598238",
"0.55200696",
"0.55200696",
"0.55200696",
"0.55200696",
"0.55200696",
"0.55200696",
"0.55200696",
"0.55200696",
"0.55200696",
"0.55200696",
"0.55200696",
"0.55200696",
"0.55200696",
"0.55200696",
"0.55200696",
"0.5505429",
"0.54083186",
"0.54061615"
] |
0.6597113
|
1
|
Execute a SITE command on the server This method tries to execute a SITE command on the ftp server.
|
function site($command) {
$res = @ftp_site($this->_handle, $command);
if ( !$res ) {
throw new ftpSiteCommandException($command);
} else {
return $res;
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function site($command)\r\n {\r\n if ($this->_use_mod_ftp) {\r\n \t\tftp_site($this->_socket, $command);\r\n \t} else {\r\n \t $this->putcmd(\"SITE\", $command);\r\n \t}\r\n \treturn $this->ok();\r\n }",
"function _site($command)\n\t{\n\t\treturn @ftp_site($this->connection, $command);\n\t}",
"public function execute()\n {\n if (is_null($this->site)) {\n throw new \\Exception('No site is selected for this task! Check task settings!', 1489588837);\n }\n\n $this->initializeExtbase();\n $this->initializeObject();\n\n if ($this->solrSitemap->run()) {\n return true;\n }\n return false;\n }",
"function install_site() {\n \n}",
"private function uploadScript($cmstype, $real_name, $site_full, $site_ftp_server) {\n\t\t$cms = Cms::findOrFail($cmstype);\n\t\t$script_name = SiteController::$SCRIPT_NAME;\n\t\t$script_path = SiteController::$SCRIPT_PATH;\n\t\t$server_cms_file = $script_path.$script_name;\n\t\t$local_cms_file = $cms->url;\n\t\t$server_upzip_file = $script_path.'unzip.php';\n\t\t$local_unzip_file = 'https://nfcmsservice.blob.core.windows.net/cms-scripts/unzip.php';\n\t\t$server_file_default = $script_path.'hostingstart.html';\n\t\t$conn_id = ftp_connect($site_ftp_server);\n\t\t$ftp_user = $real_name.'\\\\';\n\t\t$ftp_user .= SiteController::$FTP_USER;\n\t\t$login_result = ftp_login($conn_id,$ftp_user,SiteController::$FTP_PW);\n\t\t// turn passive mode on\n\t\tftp_pasv($conn_id, true);\n\n\t\t//Upload CMS\n\t\tif(!ftp_put($conn_id, $server_cms_file, $local_cms_file, FTP_BINARY)) {\n\t\t\treturn false;\n\t\t}\n\n\t\t//Upload unzip.php\n\t\tif(!ftp_put($conn_id, $server_upzip_file, $local_unzip_file, FTP_BINARY)) {\n\t\t\treturn false;\n\t\t}\n\n\t\t//Delete azure default\n\t\tftp_delete($conn_id, $server_file_default);\t\n\n\t\t//Close FTP connection\n\t\tftp_close($conn_id);\n\n\t\t//Unzip script\t\t\n\t\t$result = SiteController::url_get_contents('http://'.$site_full.'/unzip.php?filename='.$script_name);\n\t\t\t\n\t\treturn true;\n\t}",
"public function doAutoRemoteSiteAdd() {\n\t\t$sAutoAddFilePath = $this->getController()->getRootDir().'auto_add.php';\n\t\tif ( $this->getIsSiteLinked() || !$this->loadFS()->isFile( $sAutoAddFilePath ) ) {\n\t\t\treturn;\n\t\t}\n\t\t$sContent = $this->loadDP()\n\t\t\t\t\t\t ->readFileContentsUsingInclude( $sAutoAddFilePath );\n\t\t$this->loadFS()->deleteFile( $sAutoAddFilePath );\n\t\tif ( !empty( $sContent ) ) {\n\t\t\t$aParsed = json_decode( $sContent, true );\n\t\t\t$sApiKey = isset( $aParsed[ 'api-key' ] ) ? $aParsed[ 'api-key' ] : '';\n\t\t\t$sEmail = isset( $aParsed[ 'email' ] ) ? $aParsed[ 'email' ] : '';\n\t\t\t$this->doRemoteAddSiteLink( $sApiKey, $sEmail );\n\t\t}\n\t}",
"public function execute()\n\t{\n\t\t// Make sure we're using a secure connection\n\t\tif (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'off')\n\t\t{\n\t\t\tApp::redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], '', 'message', true);\n\t\t\tdie('insecure connection and redirection failed');\n\t\t}\n\n\t\t$this->baseURL = rtrim(Request::base(), '/');\n\n\t\t$this->registerTask('__default', 'create');\n\n\t\tparent::execute();\n\t}",
"function execute(){\n\t\tsession_write_close();\n\t\t$sRssUri = we_base_request::_(we_base_request::URL, 'we_cmd', '', 0);\n\t\t$sCfgBinary = we_base_request::_(we_base_request::STRING, 'we_cmd', '', 1); //note binary content\n\t\t$bCfgTitle = (bool) $sCfgBinary{0};\n\t\t$bCfgLink = (bool) $sCfgBinary{1};\n\t\t$bCfgDesc = (bool) $sCfgBinary{2};\n\t\t$bCfgContEnc = (bool) $sCfgBinary{3};\n\t\t$bCfgPubDate = (bool) $sCfgBinary{4};\n\t\t$bCfgCategory = (bool) $sCfgBinary{5};\n\t\t$iNumItems = we_base_request::_(we_base_request::INT, 'we_cmd', '', 2);\n\t\tswitch($iNumItems){\n\t\t\tcase 11:\n\t\t\t\t$iNumItems = 15;\n\t\t\t\tbreak;\n\t\t\tcase 12:\n\t\t\t\t$iNumItems = 20;\n\t\t\t\tbreak;\n\t\t\tcase 13:\n\t\t\t\t$iNumItems = 25;\n\t\t\t\tbreak;\n\t\t\tcase 14:\n\t\t\t\t$iNumItems = 50;\n\t\t\t\tbreak;\n\t\t}\n\t\t$sTbBinary = we_base_request::_(we_base_request::STRING, 'we_cmd', '', 3); //binary\n\t\t$bTbLabel = (bool) $sTbBinary{0};\n\t\t$bTbTitel = (bool) $sTbBinary{1};\n\t\t$bTbDesc = (bool) $sTbBinary{2};\n\t\t$bTbLink = (bool) $sTbBinary{3};\n\t\t$bTbPubDate = (bool) $sTbBinary{4};\n\t\t$bTbCopyright = (bool) $sTbBinary{5};\n\n\t\t//Bug 6119: Keine Unterstützung für curl in der XML_RSS Klasse\n\t\t//daher Umstellung den Inhalt des Feeds selbst zu holen\n\t\t$parsedurl = parse_url($sRssUri);\n\t\t$http_request = new we_http_request($parsedurl['path'], $parsedurl['host'], 'GET');\n\t\t$http_request->executeHttpRequest();\n\t\t$http_response = new we_http_response($http_request->getHttpResponseStr());\n\t\twhile(isset($http_response->http_headers['Location'])){//eine Weiterleitung ist aktiv\n\t\t\t$parsedurl = parse_url($http_response->http_headers['Location']);\n\t\t\t$http_request = new we_http_request($parsedurl['path'], $parsedurl['host'], 'GET');\n\t\t\t$http_request->executeHttpRequest();\n\t\t\t$http_response = new we_http_response($http_request->getHttpResponseStr());\n\t\t}\n\t\t$feeddata = $http_response->http_body;\n\n\t\t$oRssParser = new we_xml_rss($feeddata, null, $GLOBALS['WE_BACKENDCHARSET']); // Umstellung in der XML_RSS-Klasse: den string, und nicht die url weiterzugeben\n\t\t$tmp = $oRssParser->parse();\n\t\t$sRssOut = \"\";\n\n\t\t$iCurrItem = 0;\n\t\tforeach($oRssParser->getItems() as $item){\n\t\t\t$bShowTitle = ($bCfgTitle && isset($item['title']));\n\t\t\t$bShowLink = ($bCfgLink && isset($item['link']));\n\t\t\t$bShowDesc = ($bCfgDesc && isset($item['description']));\n\t\t\t$bShowContEnc = ($bCfgContEnc && isset($item['content:encoded']));\n\t\t\t$bShowPubdate = ($bCfgPubDate && isset($item['pubdate']));\n\t\t\t$bShowCategory = ($bCfgCategory && isset($item['category']));\n\n\t\t\t$sLink = (($bCfgLink && isset($item['link'])) && !$bShowTitle) ? \" \" .\n\t\t\t\twe_html_element::htmlA(array(\"href\" => $item['link'], \"target\" => \"_blank\", \"style\" => \"text-decoration:underline;\"), g_l('cockpit', '[more]')) : \"\";\n\t\t\tif($bShowContEnc){\n\t\t\t\t$contEnc = new we_html_table(array(\"class\" => 'default'), 1, 1);\n\t\t\t\t$contEnc->setCol(0, 0, null, $item['content:encoded'] . ((!$bCfgDesc) ? $sLink : \"\"));\n\t\t\t}\n\n\t\t\t$sRssOut .= ($bShowTitle ?\n\t\t\t\t\t($bShowLink ? we_html_element::htmlA(array(\"href\" => $item['link'], \"target\" => \"_blank\"), we_html_element::htmlB($item['title'])) :\n\t\t\t\t\t\twe_html_element::htmlB($item['title'])) .\n\t\t\t\t\t($bShowPubdate ? ' ' : we_html_element::htmlBr()) :\n\t\t\t\t\t'') .\n\t\t\t\t($bShowPubdate ?\n\t\t\t\t\tg_l('cockpit', '[published]') . ': ' . date(g_l('date', '[format][default]'), strtotime($item['pubdate'])) :\n\t\t\t\t\t'') .\n\t\t\t\t($bShowCategory ?\n\t\t\t\t\t($bShowPubdate ? we_html_element::htmlBr() : \"\") .\n\t\t\t\t\tg_l('cockpit', '[category]') . \": \" . $item['category'] :\n\t\t\t\t\t'') .\n\t\t\t\t($bShowPubdate || $bShowCategory ?\n\t\t\t\t\twe_html_element::htmlBr() :\n\t\t\t\t\t'') .\n\t\t\t\t($bShowDesc ?\n\t\t\t\t\t$item['description'] . $sLink . we_html_element::htmlBr() :\n\t\t\t\t\t\"\") .\n\t\t\t\t($bShowContEnc ?\n\t\t\t\t\t$contEnc->getHTML() :\n\t\t\t\t\t(!$bShowDesc ?\n\t\t\t\t\t\t$sLink . we_html_element::htmlBr() :\n\t\t\t\t\t\t'')\n\t\t\t\t) .\n\t\t\t\t($bShowDesc || $bShowContEnc ?\n\t\t\t\t\twe_html_element::htmlBr() :\n\t\t\t\t\t\"\");\n\t\t\tif($iNumItems){\n\t\t\t\t$iCurrItem++;\n\t\t\t\tif($iCurrItem == $iNumItems){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t$aTb = array();\n\t\tif($bTbLabel){\n\t\t\t$aTb[] = g_l('cockpit', '[rss_feed]');\n\t\t}\n\t\tif($bTbTitel){\n\t\t\t$aTb[] = we_base_request::_(we_base_request::STRING, 'we_cmd', '', 4) ? :\n\t\t\t\t((isset($oRssParser->channel[\"title\"])) ? $oRssParser->channel[\"title\"] : \"\");\n\t\t}\n\t\tif($bTbDesc){\n\t\t\t$aTb[] = (isset($oRssParser->channel[\"description\"])) ? str_replace(array(\"\\n\", \"\\r\"), '', $oRssParser->channel[\"description\"]) : '';\n\t\t}\n\t\tif($bTbLink){\n\t\t\t$aTb[] = (isset($oRssParser->channel[\"link\"])) ? $oRssParser->channel[\"link\"] : '';\n\t\t}\n\t\tif($bTbPubDate){\n\t\t\t$aTb[] = (isset($oRssParser->channel[\"pubdate\"])) ? (date(g_l('date', '[format][default]'), strtotime($oRssParser->channel[\"pubdate\"]))) : \"\";\n\t\t}\n\t\tif($bTbCopyright){\n\t\t\t$aTb[] = (isset($oRssParser->channel[\"copyright\"])) ? $oRssParser->channel[\"copyright\"] : \"\";\n\t\t}\n\t\t$resp = new we_rpc_response();\n\t\t$resp->setData('data', $sRssOut);\n\n\t\t// title\n\t\t$title = implode(' - ', $aTb);\n\t\tif(strlen($title) > 50){\n\t\t\t$title = substr($title, 0, 50) . '…';\n\t\t}\n\t\t$resp->setData('titel', $title);\n\t\t$resp->setData('widgetType', \"rss\");\n\t\t$resp->setData('widgetId', we_base_request::_(we_base_request::STRING, 'we_cmd', 0, 5));\n\n\t\treturn $resp;\n\t}",
"public function execute() {\n\t\t$success = false;\n\t\t// preload error_code\n\t\t$this->init();\n\t\t// execute the command on all pages selected\n\t\t$pids = $this->extGetTreeList($this->getPage(), $this->getDepth(), 0, \"(fe_group=0 OR fe_group='') and hidden < 1\") . '-1';\n\t\t$pages = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*','pages', 'uid in('.$pids.')');\n\t\tif(count($pages) > 0){\n\t\t\tforeach($pages as $page){\n\t\t\t\t$this->executeTidy($page);\n\t\t\t}\n\t\t\t$success = true;\n\t\t}\n\t\t\n\t\t/*mail('[email protected]', 'Server Error', 'Fehler: '.$errstr.CHR(10).\n\t\t\t\t'Fehlernummer: '.$errno.CHR(10).\n\t\t\t\t'Server: '.$this->ip.CHR(10).\n\t\t\t\t'Port: '.$this->port);\n\t\t*/\n\t\treturn $success;\n\t}",
"public function execute ()\n\t{\n\t\tparent::execute();\n\t\t\n\t\t// set our template\n\t\t$this->setTemplate(\"ServerExplorerSuccess.php\");\n\n\t\t// set the title\n\t\t$this->setTitle(\"Server Explorer\");\n\t}",
"public function testUpdateSite()\n {\n }",
"public function executeCommands()\n {\n $isVhostCreated = $this->createVirtualHostFile();\n if (!$isVhostCreated) {\n showInfo('Something went wrong' . printNextLine());\n showInfo('Exiting the wizard.' . printNextLine());\n printNextLine();\n exit();\n }\n $this->addNewHostToHostsFile();\n showInfo(' [ ' . $this->name . $this->extension . ' ] >>> Virtual host file is created successfully' . printNextLine());\n showInfo(' [ ' . $this->name . ' ] >>> Added to the HOSTS file successfully' . printNextLine());\n $this->enableNewVirtualHost();\n printNextLine();\n showInfo(' New host ready to rock Goto >>>> http://' . $this->name);\n printNextLine();\n printNextLine();\n }",
"public function execute($command) {\n if ($this->getActive()) {\n // Execute command\n if (ftp_exec($this->_connection, $command)) {\n return true;\n } else {\n return false;\n }\n } else {\n throw new CHttpException(403, 'EFtpComponent is inactive and cannot perform any FTP operations.');\n }\n }",
"public function crawl_site() : void {\n // just be in SiteCrawler?\n\n $ch = curl_init();\n $site_url = SiteInfo::getUrl( 'site' );\n\n // add filter to allow user to specify extra downloadable extensions\n $crawlable_filetypes = [];\n $crawlable_filetypes['img'] = 1;\n $crawlable_filetypes['jpeg'] = 1;\n $crawlable_filetypes['jpg'] = 1;\n $crawlable_filetypes['png'] = 1;\n $crawlable_filetypes['webp'] = 1;\n $crawlable_filetypes['gif'] = 1;\n $crawlable_filetypes['svg'] = 1;\n\n $asset_downloader = new AssetDownloader(\n $ch,\n $site_url,\n $crawlable_filetypes,\n $this->settings\n );\n\n $site_crawler = new SiteCrawler(\n (bool) $this->settings['allowOfflineUsage'],\n (bool) $this->remove_wp_meta,\n (bool) $this->remove_conditional_head_comments,\n (bool) $this->remove_wp_links,\n (bool) $this->remove_canonical_links,\n (bool) $this->create_empty_favicon,\n (bool) $this->remove_html_comments,\n $this->site_url,\n $this->site_url_host,\n $this->destination_url,\n $this->rewrite_rules,\n $this->settings,\n $asset_downloader\n );\n\n $site_crawler->crawl();\n }",
"public function execute()\n\t{\t\n\t\t$this->controller = new Controller($this->path);\n\t\t$this->static_server = new StaticServer($this->path);\n\t\t\n\t\tCurrent::$plugins->hook('prePathParse', $this->controller, $this->static_server);\n\t\t\n\t\tif ( $this->static_server->isFile() )\n\t\t{\n\t\t\tCurrent::$plugins->hook('preStaticServe', $this->static_server);\n\t\t\t\n\t\t\t// Output the file\n\t\t\t$this->static_server->render();\n\t\t\t\n\t\t\tCurrent::$plugins->hook('postStaticServe', $this->static_server);\n\t\t\t\n\t\t\texit;\n\t\t}\n\t\t\n\t\t// Parse arguments from path and call appropriate command\n\t\tCowl::timer('cowl parse');\n\t\t$request = $this->controller->parse();\n\t\tCowl::timerEnd('cowl parse');\n\t\n\t\tif ( COWL_CLI )\n\t\t{\n\t\t\t$this->fixRequestForCLI($request);\n\t\t}\n\t\t\n\t\t$command = new $request->argv[0];\n\t\t\n\t\t// Set template directory, which is the command directory mirrored\n\t\t$command->setTemplateDir(Current::$config->get('paths.view') . $request->app_directory);\n\t\t\n\t\tCurrent::$plugins->hook('postPathParse', $request);\n\t\t\n\t\tCowl::timer('cowl command run');\n\t\t$ret = $command->run($request);\n\t\tCowl::timerEnd('cowl command run');\n\t\t\n\t\tCurrent::$plugins->hook('postRun');\n\t\t\n\t\tif ( is_string($ret) )\n\t\t{\n\t\t\tCowl::redirect($ret);\n\t\t}\n\t}",
"function execute_site_actions( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {\n\t\t // switch_to_blog($blog_id);\n\n\t\t // Find and delete the WP default 'Sample Page'\n\t\t $defaultPage = get_page_by_title( 'Sample Page' );\n\t\t wp_delete_post( $defaultPage->ID, $bypass_trash = true );\n\n\t\t // Find and delete the WP default 'Hello world!' post\n\t\t $defaultPost = get_posts( array( 'title' => 'Hello World!' ) );\n\t\t wp_delete_post( $defaultPost[0]->ID, $bypass_trash = true );\n\n\t\t // restore_current_blog();\n\t\t}",
"public function execute()\n {\n $this->sinch->startCronFullImport();\n }",
"public function upload() {\n // FYI. We are on master now.\n $m_ftp = new \\Model_Ftp();\n $m_ftp->user_id = $this->user_id;\n $branch = $this->branch;\n // Get ftp data for the respective branch\n $ftp_data = $m_ftp->get($branch['ftp_id']);\n\n if (count($ftp_data) !== 1) {\n $this->log('Failed: Enviornment does not have a Linked FTP account.');\n throw new Exception(\"No Linked FTP for enviornment.\");\n } else {\n $ftp_data = $ftp_data[0];\n }\n\n // Testing if the FTP server works.\n try {\n $ftp_data['user'] = $ftp_data['username'];\n $ftp_url = http_build_url($ftp_data);\n// $ftp_test = utils::test_ftp($ftp_url);\n $ftp_test = new \\Banago\\Bridge\\Bridge($ftp_url);\n if ($ftp_test) {\n $this->log('ftp_connect', 'connected');\n }\n } catch (Exception $e) {\n $this->log('ftp_connect', 'connection failed: ' . $e->getMessage());\n throw new Exception('We are sending msg here.' . $e->getMessage());\n }\n\n // LOG --------------------------------\n $this->log('deploy_branch', $branch['branch_name']);\n $this->log('deploy_branch_env', $branch['name']);\n $this->output('Deploy to branch name: ' . $branch['branch_name']);\n // LOG END ----------------------------\n\n /*\n * Data is ready, need to get ready with repository state.\n * Has to be checked out to the branch specified\n * and has to be checked out to the commit specified.\n */\n\n /*\n * pull and clone done,\n * checkout to branch now.\n */\n\n $this->output('Checkout to ' . $branch['branch_name']);\n \\Utils::gitCommand(\"checkout \" . $this->branch['branch_name']);\n $this->log('revision_on_server_before', $branch['revision']);\n $this->output('Revision on FTP: ' . $branch['revision']);\n\n // Setting options for gitcore\n $options = array(\n 'record_id' => $this->record_id,\n 'repo' => $this->repo_dir,\n 'debug' => $this->debug,\n 'deploy_id' => $this->deploy_id,\n 'server' => 'default',\n 'ftp' => array(\n 'default' => array(\n 'scheme' => $ftp_data['scheme'],\n 'host' => $ftp_data['host'],\n 'user' => $ftp_data['username'],\n 'pass' => $ftp_data['pass'],\n 'port' => $ftp_data['port'],\n 'path' => $ftp_data['path'],\n 'passive' => TRUE,\n 'skip' => unserialize($this->branch['skip_path']),\n 'purge' => unserialize($this->branch['purge_path']),\n )\n ),\n 'remoteRevision' => $branch['revision'],\n );\n\n // if type_rollback.\n if ($this->record['record_type'] == $this->m_record->type_rollback && !empty($this->record['hash'])) {\n // checkout the the specific hash.\n \\Utils::gitCommand('checkout ' . $this->record['hash']);\n }\n\n // if type_sync\n if ($this->record['record_type'] == $this->m_record->type_sync) {\n // upload all files please.\n $options['remoteRevision'] = '';\n }\n\n if ($this->record['record_type'] == $this->m_record->type_service_push) {\n // push from github/bitbucket.\n if (!empty($this->record['hash']))\n \\Utils::gitCommand('checkout ' . $this->record['hash']);\n }\n\n // else its update\n\n $localRevision = \\Utils::gitCommand('rev-parse HEAD');\n if (isset($localRevision[0])) {\n $localRevision = trim($localRevision[0]);\n $options['localRevision'] = $localRevision;\n }\n\n if ($options['localRevision'] == $options['remoteRevision']) {\n $this->output('FTP server has the latest changes!');\n $this->log('FTP server has the latest changes!');\n }\n\n $this->output($localRevision);\n\n $gitcore = new \\Gitcore($options);\n try {\n // todo: we're inside.\n $gitcore->startDeploy();\n } catch (Exception $e) {\n // Store logs from GITCORE.\n $this->log('deploy_log', $gitcore->log);\n $this->output($this->log);\n throw new \\Exception($e->getMessage());\n }\n\n // Store Logs from GITCORE.\n $this->log['deploy_log'] = $gitcore->log;\n $this->output($this->log);\n\n $before_revision = $this->log['deploy_log']['remoteRevision_before'];\n $current_revision = $this->log['deploy_log']['remoteRevision_after'];\n\n // Storing output from GITCORE.\n $this->m_record->set($this->record_id, array(\n 'raw' => serialize($this->log),\n 'amount_deployed' => $this->log['deploy_log']['deployed']['human'],\n 'amount_deployed_raw' => $this->log['deploy_log']['deployed']['data'],\n 'file_add' => $this->log['deploy_log']['files']['upload'],\n 'file_remove' => $this->log['deploy_log']['files']['delete'],\n 'file_skip' => $this->log['deploy_log']['files']['skip'],\n 'hash' => $current_revision,\n 'hash_before' => $before_revision,\n ));\n\n // OK,\n // Update branch to ready,\n // Update branch revision.\n $this->m_branches->set($branch['id'], array(\n 'ready' => 1,\n 'revision' => $current_revision\n ));\n\n // OK, checkout to master.\n \\Utils::gitCommand('checkout master');\n }",
"function adminUpdateSite()\n{\n\t$siteId=null;\n\t$_clusterId=null;\n\t$onAir='Yes';\t# default value\n\t$updated=null;\n\t\n\t# retrieve the other sites in the same cluster and then link\n\tif(isset($_POST['siteId']))\n\t{\n\t\t$siteId=filter_input(INPUT_POST,'siteId',FILTER_SANITIZE_NUMBER_INT);\n\t} \t\n\t\n\tif(isset($_POST['_clusterId']))\n\t{\n\t\t$_clusterId=filter_input(INPUT_POST,'_clusterId',FILTER_SANITIZE_NUMBER_INT);\n\t}\n\n\tif(isset($_POST['onAir']))\n\t{\n\t\t$onAir=filter_input(INPUT_POST,'onAir',FILTER_SANITIZE_STRING);\n\t}\n\t\n\t# send siteId and clisterId to first find site Id's of sites on the same link as this site that are\n\t# coming off this site. They all have their status updated\n\t$updated=updateSiteCluster($siteId,$_clusterId,$onAir);\n\t\n\tif($updated)\n\t{\n\t\t# if invalid username/password display that they were invalid\n\t\theader('Location: ./messageAlert?messageId=8&forwardTo=adminSites');\n\t\texit;\n\t}\n\telse\n\t{\n\t\t# if invalid username/password display that they were invalid\n\t\theader('Location: ./messageAlert?messageId=9&forwardTo=adminSites');\n\t\texit;\t\t\n\t}\n}",
"public function exec () {\r\n\t\t$a = isset($_GET['action']) ? $_GET['action'] : 'capa';\r\n\t\tswitch ($a) {\r\n\t\t\tcase 'capa':\r\n\t\t\t\t$this->capa();\r\n\t\t\tbreak;\r\n\t\t\tcase 'adicionar':\r\n\t\t\t\t$this->adicionar();\r\n\t\t\tbreak;\r\n\t\t\tcase 'alterar':\r\n\t\t\t\t$this->alterar();\r\n\t\t\tbreak;\r\n\t\t\tcase 'detalhar':\r\n\t\t\t\t$this->detalhar();\r\n\t\t\tbreak;\r\n\t\t\tcase 'excluir':\r\n\t\t\t\t$this->excluir();\r\n\t\t\tbreak;\r\n\t\t\tcase 'sair':\r\n\t\t\t\t$this->sair();\r\n\t\t\tbreak;\r\n\t\t} \r\n\t}",
"function liens_implicite_site_dist($texte,$id,$type,$args,$ancre,$connect=''){\n\tif (!$id = intval($id))\n\t\treturn false;\n\t$url = sql_getfetsel('url_site', 'spip_syndic', \"id_syndic=\".intval($id),'','','','',$connect);\n\treturn $url;\n}",
"public function execute()\n\t{\n\t\tif (!User::authorise('core.admin', $this->_option))\n\t\t{\n\t\t\tNotify::warning(Lang::txt('Not authorized'));\n\n\t\t\tApp::redirect(\n\t\t\t\tRoute::url('index.php?option=com_members', false)\n\t\t\t);\n\t\t}\n\n\t\tLang::load($this->_option . '.import', dirname(__DIR__));\n\n\t\tparent::execute();\n\t}",
"function ejecutar()\n\t{\n\t\t$this->enviar();\n\t}",
"function execute($command) {\r\n\t\t$res = @ftp_exec($this->_handle, $command);\r\n\t\tif ( !$res ) {\r\n\t\t\tthrow new ftpExecCommandException($command);\r\n\t\t} else {\r\n\t\t\treturn $res;\r\n\t\t}\r\n\t}",
"public function exec($command) {\n\t\t$CODE_RETOUR = false;\n\t\tif ($this->verifie_connexion ())\n\t\t\t$CODE_RETOUR = ftp_exec ( $this->conn_id, $command );\n\t\treturn $CODE_RETOUR;\n\t}",
"public function connect_to_site() {\n\t\treturn false;\n\t}",
"function execute() {\r\n\t\t\r\n\t\tswitch( $this->mAction ) {\r\n\t\t\tcase 'help':\r\n\t\t\t\t$this->Help();\r\n\t\t\t\tbreak;\r\n\t\t\t\r\n\t\t\tcase 'compute':\r\n\t\t\t\t$this->Compute();\r\n\t\t\t\tbreak;\r\n\t\t\t\r\n\t\t\tcase 'liste':\r\n\t\t\t\t$this->Liste();\r\n\t\t\t\t$this->mOutput->display();\r\n\t\t\t\tbreak;\r\n\t\t\t\r\n\t\t\tcase 'open':\r\n\t\t\t\t$this->Open();\r\n\t\t\t\tbreak;\r\n\t\t\t\r\n\t\t\tcase 'save':\r\n\t\t\t\t$this->Save();\r\n\t\t\t\tbreak;\r\n\t\t\t\r\n\t\t\tcase 'delete':\r\n\t\t\t\t$this->Delete();\r\n\t\t\t\t$this->mOutput->display();\r\n\t\t\t\tbreak;\r\n\t\t\t\r\n\t\t\tcase 'install':\r\n\t\t\t\t$this->Install();\r\n\t\t\t\t$this->mOutput->display();\r\n\t\t\t\tbreak;\r\n\t\t\t\r\n\t\t\tdefault:\r\n\t\t\t\t$this->mOutput->start( $this->mDB->isOK(), $this->mLang, $this->mText, array(), '', $this->mCountRegexes, $this->mRegexes );\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}",
"function getPage(){\r\n\t$pageData=getPages();\r\n\tfor($i=0;$i<sizeof($pageData);$i++){\r\n\t\tif($pageData[$i]['key']==$_GET['key']){\r\n\t\t\t$page=$pageData[$i];\r\n\t\t}\r\n\t}\r\n\t// Return on empty/not found page\r\n\tif(!isset($page)){\r\n\t\treturn;\r\n\t}\r\n\t// Access Site Info\r\n\t$siteData=getSites();\r\n\tfor($i=0;$i<sizeof($siteData);$i++){\r\n\t\tif($siteData[$i]['id']==$page['id']){\r\n\t\t\t$site=$siteData[$i];\r\n\t\t}\r\n\t}\r\n\t// Return on empty/not found page\r\n\tif(!isset($site)){\r\n\t\treturn;\r\n\t}\r\n\t// Real Work Done Here\r\n\t// FTP Connection Setup\r\n\t$ftp_server=$site['site'];\r\n\t$ftp_user_name=$site['user'];\r\n\t$ftp_user_pass=$site['password'];\r\n\t$local_file = tempnam(\"/tmp\", \"tmp\");\r\n\t$server_file=$site['path'].$page['path'];\r\n\t// set up basic connection\r\n\t$conn_id = ftp_connect($ftp_server); \r\n\t// login with username and password\r\n\t$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); \r\n\t// check connection\r\n\tif ((!$conn_id) || (!$login_result)) { \r\n echo \"FTP connection has failed!\";\r\n echo \"Attempted to connect to $ftp_server for user $ftp_user_name\"; \r\n exit; \r\n } \r\n\tif (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) {\r\n//\t echo \"Successfully written to $local_file\\n\";\r\n\t} else {\r\n\t echo \"There was a problem\\n\";\r\n\t}\r\n\t// close the FTP stream \r\n\tftp_close($conn_id); \r\n\t$html = file_get_html($local_file);\r\n\tunlink($local_file);\r\n\treturn $html;\r\n}",
"private function updateServers($mode,$servers=Array()){\n \n switch ($mode){\n case \"typo3conf\":{\n $dest=PATH_site.\"typo3temp/__\".time().\"typo3conf.tar.gz\";\n $src=\"typo3conf/\";\n break;\n }\n \n case \"localconf\":{\n $dest=PATH_site.\"typo3temp/__\".time().\"localconf.tar.gz\"; \n $src=\"typo3conf/localconf.php\";\n break;\n }\n \n case \"fileadmin\":{\n $dest=PATH_site.\"typo3temp/__\".time().\"fileadmin.tar.gz\"; \n $src=\"fileadmin/\";\n break;\n }\n \n \n \n }\n \n $cmd=\"tar -C\".PATH_site.\" -zcvf $dest $src\";\t \n exec($cmd,$out,$retVal); \n \n if (isset($retVal)&&$retVal==0){\n $params[\"action\"]=\"uploadBackup\";\n $params[\"file\"]=\"@$dest\";\n $params[\"destination\"]=PATH_site.\"typo3temp/localconf.tar.gz\";\n\t\t $params['typo3_cluster_execute']=1;\n $results=$this->sendRequestToNodes($params,$this->distributedServiceUrl,$servers);\n if ($results){\n foreach($results as $srv=>$res){\n $this->content.=\"Error in $srv: \".$res;\n }\n }else{\n $this->content.=\"All files updated successfully on all servers\";\n $this->content.=$this->getUpdateform();\n }\n unlink($dest);\n }else{\n echo \"Error in zip process\";\n }\n \n }",
"public function execute();"
] |
[
"0.76268655",
"0.7015597",
"0.5551464",
"0.5530256",
"0.53217196",
"0.5276184",
"0.51790607",
"0.5121527",
"0.5119085",
"0.50983864",
"0.507158",
"0.50473267",
"0.49920434",
"0.49905616",
"0.49340725",
"0.49266765",
"0.492612",
"0.49225768",
"0.49119577",
"0.48639384",
"0.48504966",
"0.48439223",
"0.47563398",
"0.47458062",
"0.47321963",
"0.47093433",
"0.47008997",
"0.4699967",
"0.4695907",
"0.4689855"
] |
0.72332525
|
1
|
This method will try to chmod a folder and all of its contents on the server. The target argument must be a folder or an array of folders and the permissions argument have to be an integer (i.e. 777). The file can be either a relative or absolute path. NOTE: Some servers do not support this feature. In that case, you will get an exception thrown. If successful, the method returns true
|
function chmodRecursive($target, $permissions) {
if ( !self::$_dir_permissions ) {
self::$_dir_permissions = $this->_makeDirPermissions($permissions);
}
if ( is_array($target) ) {
for ( $i = 0; $i < count($target); $i++ ) {
$res = $this->chmodRecursive($target[$i], $permissions);
}
} else {
$remote_path = $this->_constructPath($target);
// Chmod the directory itself
$result = $this->chmod($remote_path, self::$_dir_permissions);
// If $remote_path last character is not a slash, add one
if ( substr($remote_path, strlen($remote_path) - 1) != "/" ) {
$remote_path .= "/";
}
$dir_list = array();
$mode = self::LS_MODE_DIR_ONLY;
$dir_list = $this->ls($remote_path, $mode);
foreach ( $dir_list as $dir_entry ) {
if ( $dir_entry['name'] == '.' || $dir_entry['name'] == '..' ) {
continue;
}
$remote_path_new = $remote_path . $dir_entry["name"] . "/";
// Chmod the directory we're about to enter
$result = $this->chmod($remote_path_new, self::$_dir_permissions);
$result = $this->chmodRecursive($remote_path_new, $permissions);
}
$file_list = array();
$mode = self::LS_MODE_FILES_ONLY;
$file_list = $this->ls($remote_path, $mode);
foreach ( $file_list as $file_entry ) {
$remote_file = $remote_path . $file_entry["name"];
$result = $this->chmod($remote_file, $permissions);
}
}
return true;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function chmod($target, $permissions) {\r\n\t\tif ( is_array($target) ) {\r\n\t\t\tfor ( $i = 0; $i < count($target); $i++ ) {\r\n\t\t\t\t$res = $this->chmod($target[$i], $permissions);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t$res = $this->site(\"CHMOD \" . $permissions . \" \" . $target);\r\n\t\t\tif ( !$res ) {\r\n\t\t\t\tthrow new ftpChmodException($target, $permissions);\r\n\t\t\t} else {\r\n\t\t\t\treturn $res;\r\n\t\t\t}\r\n\t\t}\r\n\t}",
"function fn_te_chmod($source, $perms = DEFAULT_DIR_PERMISSIONS, $recursive = false)\n{\n // Simple copy for a file\n if (is_file($source) || $recursive == false) {\n $res = @chmod($source, $perms);\n\n return $res;\n }\n\n // Loop through the folder\n if (is_dir($source)) {\n $dir = dir($source);\n while (false !== $entry = $dir->read()) {\n // Skip pointers\n if ($entry == '.' || $entry == '..') {\n continue;\n }\n if (fn_te_chmod($source . '/' . $entry, $perms, true) == false) {\n return false;\n }\n }\n // Clean up\n $dir->close();\n\n return @chmod($source, $perms);\n } else {\n return false;\n }\n}",
"function cli_chmod($path, $mode = 0755, $recursive = true, $exceptions = array()) {\n global $_messages, $_errors;\n\n if ($recursive === false && is_dir($path)) {\n if (@chmod($path, intval($mode, 8))) {\n $_messages[] = sprintf('<success>%s changed to %s<success>', $path, $mode);\n return true;\n }\n\n $_errors[] = sprintf('<error>%s NOT changed to %s', $path, $mode);\n return false;\n }\n\n if (is_dir($path)) {\n $paths = cli_tree($path);\n\n foreach ($paths as $type) {\n foreach ($type as $key => $fullpath) {\n $check = explode(DS, $fullpath);\n $count = count($check);\n\n if (in_array($check[$count - 1], $exceptions)) {\n continue;\n }\n\n if (@chmod($fullpath, intval($mode, 8))) {\n $_messages[] = sprintf('<success>%s changed to %s</success>', $fullpath, $mode);\n } else {\n $_errors[] = sprintf('<error>%s NOT changed to %s</error>', $fullpath, $mode);\n }\n }\n }\n\n if (empty($_errors)) {\n return true;\n }\n }\n return false;\n}",
"public function upload($chmod = 0644)\n {\n if ($this->uploadDir == '') {\n $this->setErrors(\\XoopsLocale::E_UPLOAD_DIRECTORY_NOT_SET);\n return false;\n }\n if (!is_dir($this->uploadDir)) {\n $this->setErrors(sprintf(\\XoopsLocale::EF_DIRECTORY_NOT_OPENED, $this->uploadDir));\n return false;\n }\n if (!is_writeable($this->uploadDir)) {\n $this->setErrors(sprintf(\\XoopsLocale::EF_DIRECTORY_WITH_WRITE_PERMISSION_NOT_OPENED, $this->uploadDir));\n return false;\n }\n $this->sanitizeMultipleExtensions();\n\n if (!$this->checkMaxFileSize()) {\n return false;\n }\n if (!$this->checkMaxWidth()) {\n return false;\n }\n if (!$this->checkMaxHeight()) {\n return false;\n }\n if (!$this->checkMimeType()) {\n return false;\n }\n if (!$this->checkImageType()) {\n return false;\n }\n if (count($this->errors) > 0) {\n return false;\n }\n return $this->copyFile($chmod);\n }",
"function ftp_chmod_son($filename,$chmod = 0777){\r\n\t\t//$chmod = (int) $chmod;\r\n\t\t\r\n\t\t$filename = dzz_ftp::clear($filename);\r\n\t\t//检查子目录\r\n\t\tif($list=self::ftp_list($filename,0)){\r\n\t\t\tforeach($list as $value){\r\n\t\t\t\tif($value['type']=='folder'){\r\n\t\t\t\t\tself::ftp_chmod_son($value['path'],$chmod);\r\n\t\t\t\t}else{\r\n\t\t\t\t\tself::ftp_chmod($value['path'],$chmod);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn self::ftp_chmod($filename,$chmod);\r\n\t}",
"function chmod($file,$permission) \n {\n \t $cmd = \"CHMOD \" . decoct($permission) . \" \" . $file;\n return $this->sendCommand($cmd); \n }",
"function Pico_IsWritable($file, $update_perms = false)\n{\n\tif ( (!file_exists($file)) or (is_file($file)) )\n\t{\n\t\t// check to see if parent folder is writable\n\t\t$parent_dir = dirname($file);\n\t\t\n\t\tif (is_writable($parent_dir))\n\t\t{\n\t\t\treturn TRUE;\n\t\t}\n\t\telseif ($update_perms == TRUE)\n\t\t{\n\t\t\t// atempt to make writable\n\t\t\tif (is_dir($parent_dir))\n\t\t\t{\n\t\t\t\t$folder_is_writable = Pico_IsWritable($parent_dir, TRUE);\n\t\t\t\treturn $folder_is_writable;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn FALSE;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\t}\n\t$is_writable = is_writable($file);\n\t\n\tif (!$is_writable)\n\t{\n\t\tif ($update_perms == TRUE)\n\t\t{\n\t\t\t// try to connect via FTP and make this file writable\n\t\t\t$ftp = @Pico_ConnectFTP();\n\t\t\tif (!is_object($ftp))\n\t\t\t{\n\t\t\t\treturn FALSE;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (is_file($file))\n\t\t\t\t{\n\t\t\t\t\t@$ftp->chmod($file, 0666);\n\t\t\t\t}\n\t\t\t\telseif (is_dir($file))\n\t\t\t\t{\n\t\t\t\t\t@$ftp->chmod($file, 0777);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (is_writable($file))\n\t\t\t\t{\n\t\t\t\t\treturn TRUE;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\t}\n\telse\n\t{\n\t\treturn TRUE;\n\t}\n}",
"public function setChmod($mode = self::DEFAULT_MODE, bool $recursive = true, array $exceptions = [])\n {\n if (!self::exists($this->path)){\n\t\t\t$this->errors[] = \"[{$this->path}] - Não existe.\";\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\tif (!self::isValidChmod($mode)){\n\t\t\t$this->messages[] = sprintf('O valor %s, é inválido para chmod. O valor padrão %s, foi aplicado para o diretório %s.', $mode, self::DEFAULT_MODE, $this->path);\n\t\t}\n\n if ($recursive === false && is_dir($this->path)) {\n //@codingStandardsIgnoreStart\n if (@chmod($this->path, intval($mode, 8))) {\n //@codingStandardsIgnoreEnd\n $this->messages[] = sprintf('%s alterado para %s', $this->path, $mode);\n\n return true;\n }\n $this->errors[] = sprintf('%s não alterado para %s', $this->path, $mode);\n return false;\n }\n\n if (is_dir($this->path)) {\n $paths = self::tree($this->path);\n\n foreach ($paths as $type) {\n foreach ($type as $fullpath) {\n $check = explode(DIRECTORY_SEPARATOR, $fullpath);\n $count = count($check);\n\n if (in_array($check[$count - 1], $exceptions)) \n continue;\n //@codingStandardsIgnoreStart\n if (@chmod($fullpath, intval($mode, 8))) \n //@codingStandardsIgnoreEnd\n $this->messages[] = sprintf('%s alterado para %s', $fullpath, $mode);\n else \n $this->errors[] = sprintf('%s não alterado para %s', $fullpath, $mode);\n }\n }\n\n if (empty(self::$errors)) \n return true; \n }\n\n return false;\n }",
"public function chmod($file, $mode) {\n if ($this->getActive()) {\n // Change the desired file's permissions\n if (ftp_chmod($this->_connection, $mode, $file)) {\n return true;\n } else {\n return false;\n }\n } else {\n throw new CHttpException(403, 'EFtpComponent is inactive and cannot perform any FTP operations.');\n }\n }",
"public static function isWritable($path, $chmod)\n {\n if (!is_writable($path)) {\n @chmod($path, $chmod);\n }\n return is_writable($path);\n }",
"function phpbb_chmod($filename, $perms = CHMOD_READ)\n{\n\tstatic $_chmod_info;\n\n\t// Return if the file no longer exists.\n\tif (!file_exists($filename))\n\t{\n\t\treturn false;\n\t}\n\n\t// Determine some common vars\n\tif (empty($_chmod_info))\n\t{\n\t\tif (!function_exists('fileowner') || !function_exists('filegroup'))\n\t\t{\n\t\t\t// No need to further determine owner/group - it is unknown\n\t\t\t$_chmod_info['process'] = false;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tglobal $phpbb_root_path, $phpEx;\n\n\t\t\t// Determine owner/group of common.php file and the filename we want to change here\n\t\t\t$common_php_owner = @fileowner($phpbb_root_path . 'common.' . $phpEx);\n\t\t\t$common_php_group = @filegroup($phpbb_root_path . 'common.' . $phpEx);\n\n\t\t\t// And the owner and the groups PHP is running under.\n\t\t\t$php_uid = (function_exists('posix_getuid')) ? @posix_getuid() : false;\n\t\t\t$php_gids = (function_exists('posix_getgroups')) ? @posix_getgroups() : false;\n\n\t\t\t// If we are unable to get owner/group, then do not try to set them by guessing\n\t\t\tif (!$php_uid || empty($php_gids) || !$common_php_owner || !$common_php_group)\n\t\t\t{\n\t\t\t\t$_chmod_info['process'] = false;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$_chmod_info = array(\n\t\t\t\t\t'process'\t\t=> true,\n\t\t\t\t\t'common_owner'\t=> $common_php_owner,\n\t\t\t\t\t'common_group'\t=> $common_php_group,\n\t\t\t\t\t'php_uid'\t\t=> $php_uid,\n\t\t\t\t\t'php_gids'\t\t=> $php_gids,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tif ($_chmod_info['process'])\n\t{\n\t\t$file_uid = @fileowner($filename);\n\t\t$file_gid = @filegroup($filename);\n\n\t\t// Change owner\n\t\tif (@chown($filename, $_chmod_info['common_owner']))\n\t\t{\n\t\t\tclearstatcache();\n\t\t\t$file_uid = @fileowner($filename);\n\t\t}\n\n\t\t// Change group\n\t\tif (@chgrp($filename, $_chmod_info['common_group']))\n\t\t{\n\t\t\tclearstatcache();\n\t\t\t$file_gid = @filegroup($filename);\n\t\t}\n\n\t\t// If the file_uid/gid now match the one from common.php we can process further, else we are not able to change something\n\t\tif ($file_uid != $_chmod_info['common_owner'] || $file_gid != $_chmod_info['common_group'])\n\t\t{\n\t\t\t$_chmod_info['process'] = false;\n\t\t}\n\t}\n\n\t// Still able to process?\n\tif ($_chmod_info['process'])\n\t{\n\t\tif ($file_uid == $_chmod_info['php_uid'])\n\t\t{\n\t\t\t$php = 'owner';\n\t\t}\n\t\telse if (in_array($file_gid, $_chmod_info['php_gids']))\n\t\t{\n\t\t\t$php = 'group';\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// Since we are setting the everyone bit anyway, no need to do expensive operations\n\t\t\t$_chmod_info['process'] = false;\n\t\t}\n\t}\n\n\t// We are not able to determine or change something\n\tif (!$_chmod_info['process'])\n\t{\n\t\t$php = 'other';\n\t}\n\n\t// Owner always has read/write permission\n\t$owner = CHMOD_READ | CHMOD_WRITE;\n\tif (is_dir($filename))\n\t{\n\t\t$owner |= CHMOD_EXECUTE;\n\n\t\t// Only add execute bit to the permission if the dir needs to be readable\n\t\tif ($perms & CHMOD_READ)\n\t\t{\n\t\t\t$perms |= CHMOD_EXECUTE;\n\t\t}\n\t}\n\n\tswitch ($php)\n\t{\n\t\tcase 'owner':\n\t\t\t$result = @chmod($filename, ($owner << 6) + (0 << 3) + (0 << 0));\n\n\t\t\tclearstatcache();\n\n\t\t\tif (is_readable($filename) && is_writable($filename))\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\tcase 'group':\n\t\t\t$result = @chmod($filename, ($owner << 6) + ($perms << 3) + (0 << 0));\n\n\t\t\tclearstatcache();\n\n\t\t\tif ((!($perms & CHMOD_READ) || is_readable($filename)) && (!($perms & CHMOD_WRITE) || is_writable($filename)))\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\tcase 'other':\n\t\t\t$result = @chmod($filename, ($owner << 6) + ($perms << 3) + ($perms << 0));\n\n\t\t\tclearstatcache();\n\n\t\t\tif ((!($perms & CHMOD_READ) || is_readable($filename)) && (!($perms & CHMOD_WRITE) || is_writable($filename)))\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\tdefault:\n\t\t\treturn false;\n\t\tbreak;\n\t}\n\n\treturn $result;\n}",
"function phpbb_chmod($filename, $perms = CHMOD_READ)\n{\n\tstatic $_chmod_info;\n\n\t// Return if the file no longer exists.\n\tif (!file_exists($filename))\n\t{\n\t\treturn false;\n\t}\n\n\t// Determine some common vars\n\tif (empty($_chmod_info))\n\t{\n\t\tif (!function_exists('fileowner') || !function_exists('filegroup'))\n\t\t{\n\t\t\t// No need to further determine owner/group - it is unknown\n\t\t\t$_chmod_info['process'] = false;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tglobal $root_path, $phpEx;\n\n\t\t\t// Determine owner/group of common.php file and the filename we want to change here\n\t\t\t$common_php_owner = @fileowner($phpbb_root_path . 'index.' . $phpEx);\n\t\t\t$common_php_group = @filegroup($phpbb_root_path . 'index.' . $phpEx);\n\n\t\t\t// And the owner and the groups PHP is running under.\n\t\t\t$php_uid = (function_exists('posix_getuid')) ? @posix_getuid() : false;\n\t\t\t$php_gids = (function_exists('posix_getgroups')) ? @posix_getgroups() : false;\n\n\t\t\t// If we are unable to get owner/group, then do not try to set them by guessing\n\t\t\tif (!$php_uid || empty($php_gids) || !$common_php_owner || !$common_php_group)\n\t\t\t{\n\t\t\t\t$_chmod_info['process'] = false;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$_chmod_info = array(\n\t\t\t\t\t'process'\t\t=> true,\n\t\t\t\t\t'common_owner'\t=> $common_php_owner,\n\t\t\t\t\t'common_group'\t=> $common_php_group,\n\t\t\t\t\t'php_uid'\t\t=> $php_uid,\n\t\t\t\t\t'php_gids'\t\t=> $php_gids,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tif ($_chmod_info['process'])\n\t{\n\t\t$file_uid = @fileowner($filename);\n\t\t$file_gid = @filegroup($filename);\n\n\t\t// Change owner\n\t\tif (@chown($filename, $_chmod_info['common_owner']))\n\t\t{\n\t\t\tclearstatcache();\n\t\t\t$file_uid = @fileowner($filename);\n\t\t}\n\n\t\t// Change group\n\t\tif (@chgrp($filename, $_chmod_info['common_group']))\n\t\t{\n\t\t\tclearstatcache();\n\t\t\t$file_gid = @filegroup($filename);\n\t\t}\n\n\t\t// If the file_uid/gid now match the one from common.php we can process further, else we are not able to change something\n\t\tif ($file_uid != $_chmod_info['common_owner'] || $file_gid != $_chmod_info['common_group'])\n\t\t{\n\t\t\t$_chmod_info['process'] = false;\n\t\t}\n\t}\n\n\t// Still able to process?\n\tif ($_chmod_info['process'])\n\t{\n\t\tif ($file_uid == $_chmod_info['php_uid'])\n\t\t{\n\t\t\t$php = 'owner';\n\t\t}\n\t\telse if (in_array($file_gid, $_chmod_info['php_gids']))\n\t\t{\n\t\t\t$php = 'group';\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// Since we are setting the everyone bit anyway, no need to do expensive operations\n\t\t\t$_chmod_info['process'] = false;\n\t\t}\n\t}\n\n\t// We are not able to determine or change something\n\tif (!$_chmod_info['process'])\n\t{\n\t\t$php = 'other';\n\t}\n\n\t// Owner always has read/write permission\n\t$owner = CHMOD_READ | CHMOD_WRITE;\n\tif (is_dir($filename))\n\t{\n\t\t$owner |= CHMOD_EXECUTE;\n\n\t\t// Only add execute bit to the permission if the dir needs to be readable\n\t\tif ($perms & CHMOD_READ)\n\t\t{\n\t\t\t$perms |= CHMOD_EXECUTE;\n\t\t}\n\t}\n\n\tswitch ($php)\n\t{\n\t\tcase 'owner':\n\t\t\t$result = @chmod($filename, ($owner << 6) + (0 << 3) + (0 << 0));\n\n\t\t\tclearstatcache();\n\n\t\t\tif (is_readable($filename) && is_writable($filename))\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\tcase 'group':\n\t\t\t$result = @chmod($filename, ($owner << 6) + ($perms << 3) + (0 << 0));\n\n\t\t\tclearstatcache();\n\n\t\t\tif ((!($perms & CHMOD_READ) || is_readable($filename)) && (!($perms & CHMOD_WRITE) || is_writable($filename)))\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\tcase 'other':\n\t\t\t$result = @chmod($filename, ($owner << 6) + ($perms << 3) + ($perms << 0));\n\n\t\t\tclearstatcache();\n\n\t\t\tif ((!($perms & CHMOD_READ) || is_readable($filename)) && (!($perms & CHMOD_WRITE) || is_writable($filename)))\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\tdefault:\n\t\t\treturn false;\n\t\tbreak;\n\t}\n\n\treturn $result;\n}",
"function _chmod($file, $perms)\n\t{\n\t\t// Unfortunatly CHMOD is not expecting an octal value...\n\t\t// We need to transform the integer (which was an octal) to an octal representation (to get the int) and then pass as is. ;)\n\t\treturn $this->_send_command('SITE CHMOD', base_convert($perms, 10, 8) . ' ' . $file);\n\t}",
"function _chmod($file, $perms)\n\t{\n\t\tif (function_exists('ftp_chmod'))\n\t\t{\n\t\t\t$err = @ftp_chmod($this->connection, $perms, $file);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// Unfortunatly CHMOD is not expecting an octal value...\n\t\t\t// We need to transform the integer (which was an octal) to an octal representation (to get the int) and then pass as is. ;)\n\t\t\t$chmod_cmd = 'CHMOD ' . base_convert($perms, 10, 8) . ' ' . $file;\n\t\t\t$err = $this->_site($chmod_cmd);\n\t\t}\n\n\t\treturn $err;\n\t}",
"public function testSetChmod()\n {\n file_put_contents(self::$temp.DS.'file.txt', 'Hello World');\n\n Storage::chmod(self::$temp.DS.'file.txt', 0755);\n\n $actual = substr(sprintf('%o', fileperms(self::$temp.DS.'file.txt')), -4);\n $expected = ('\\\\' === DS) ? '0666' : '0755';\n\n $this->assertTrue($expected === $actual);\n }",
"public function chmod($path, $umask);",
"public function testGetChmod()\n {\n file_put_contents(self::$temp.DS.'file.txt', 'Hello World');\n chmod(self::$temp.DS.'file.txt', 0755);\n\n $actual = Storage::chmod(self::$temp.DS.'file.txt');\n $expected = ('\\\\' === DS) ? '0666' : '0755';\n\n $this->assertTrue($expected === $actual);\n }",
"function chmodr($path, $mode = 0755) {\n\t\tif (!is_dir($path)) {\n\t\t\treturn chmod($path, $mode);\n\t\t}\n\t\t$dir = opendir($path);\n\n\t\twhile($file = readdir($dir)) {\n\t\t\tif ($file != '.' && $file != '..') {\n\t\t\t\t$fullpath = $path . '/' . $file;\n\n\t\t\t\tif (!is_dir($fullpath)) {\n\t\t\t\t\tif (!chmod($fullpath, $mode)) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (!chmodr($fullpath, $mode)) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tclosedir($dir);\n\n\t\tif (chmod($path, $mode)) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}",
"public static function chmodR($path, $permission) {\n \n if (!static::is($path))\n return static::chmod($path, $permission);\n\n $dirh = @opendir($path);\n while ($file = readdir($dh)) {\n if ($file != '.' && $file != '..') {\n $fullpath = $path . '/' . $file;\n if (!static::is($fullpath)) {\n if (!static::chmod($fullpath, $filemode))\n return FALSE;\n }\n else {\n if (!static::chmodR($fullpath, $filemode))\n return FALSE;\n }\n }\n }\n\n closedir($dirh);\n\n if (static::chmod($path, $filemode))\n return TRUE;\n else\n return FALSE;\n }",
"function FileChmod()\n{\t\n\t$sFileUrl = '';\n\t\n\tif(isset($_REQUEST['file-path']) === false)\n\t{\n\t\techo '<fail>no file path</fail>';\n\t\treturn;\n\t}\n\t$sFileUrl = trim($_REQUEST['file-path']);\n\t\n\t\n\t$nChmodParam = 0755;\n\t\n\tif(isset($_REQUEST['chmod']) === false)\n\t{\n\t\techo '<fail>no chmodparametr</fail>';\n\t\treturn;\n\t}\n\t$nChmodParam = trim($_REQUEST['chmod']);\n\t\n\tif($nChmodParam[0] === '0')\n\t{\n\t\t$nChmodParam[0] = ' ';\n\t\t$nChmodParam = trim($nChmodParam);\n\t}\n\t\n\t$nChmodParam = (int) $nChmodParam;\n\t$nChmodParam = octdec($nChmodParam);\n\n\t\n\t\n\t\n\t$bIsChmodCreate = true;\n\t$bIsChmodCreate = chmod($sFileUrl, $nChmodParam);\n\t\n\tif($bIsChmodCreate === true)\n\t{\n\t\techo '<correct>update chmod correct</correct>';\n\t} else\n\t{\n\t\techo '<fail>cant create chmod</fail>';\n\t}\n}",
"public function chmod(string $path, int $mode = null): string|bool\n {\n if ($mode) {\n return chmod($path, $mode);\n }\n\n return Str::substring(sprintf('%o', fileperms($path)), -4);\n }",
"public function setPermissions($folder)\n\t{\n\t\t$commands = array();\n\n\t\t// Get path to folder\n\t\t$folder = $this->releasesManager->getCurrentReleasePath($folder);\n\t\t$this->command->comment('Setting permissions for '.$folder);\n\n\t\t// Get permissions options\n\t\t$callback = $this->rocketeer->getOption('remote.permissions.callback');\n\t\t$commands = (array) $callback($this, $folder);\n\n\t\t// Cancel if setting of permissions is not configured\n\t\tif (empty($commands)) {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn $this->runForCurrentRelease($commands);\n\t}",
"function CheckFilePermission($filename) {\n\t//can we write?\n\tif(!is_writable($filename)) {\n\t\t//no we can't.\n\t\tif(!@chmod($filename, 0666)) {\n\t\t\t$pathtofilename = dirname($filename);\n\t\t\t//Lets check if parent directory is writable.\n\t\t\tif(!is_writable($pathtofilename)) {\n\t\t\t\t//it's not writeable too.\n\t\t\t\tif(!@chmod($pathtoffilename, 0666)) {\n\t\t\t\t\t//darn couldn't fix up parrent directory this hosting is foobar.\n\t\t\t\t\t//Lets error because of the permissions problems.\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t//we can write, return 1/true/happy dance.\n\treturn true;\n}",
"function ftp_chmod($filename, $chmod = 0777) {\r\n\t\t//$chmod = (int) $chmod;\r\n\t\t\r\n\t\t$filename = dzz_ftp::clear($filename);\r\n\t\tif(function_exists('ftp_chmod')) {\r\n\t\t\treturn @ftp_chmod($this->connectid, $chmod, $filename);\r\n\t\t} else {\r\n\t\t\treturn @ftp_site($this->connectid, 'CHMOD '.$chmod.' '.$filename);\r\n\t\t}\r\n\t}",
"public function checkFolderPermissionsFilesystemPermissionsDataProvider() {}",
"public function chmod($fileName, $permissions)\n\t{\n\t\t$targetFile = $this->translatePath($fileName);\n\n\t\t// Prefer the SFTP way, if available\n\t\tif (function_exists('ssh2_sftp_chmod'))\n\t\t{\n\t\t\treturn @ssh2_sftp_chmod($this->sftpHandle, $targetFile, $permissions);\n\t\t}\n\t\t// Otherwise fall back to the (likely to fail) raw command mode\n\t\telse\n\t\t{\n\t\t\t$cmd = 'chmod ' . decoct($permissions) . ' ' . escapeshellarg($targetFile);\n\t\t\treturn @ssh2_exec($this->connection, $cmd);\n\t\t}\n\t}",
"public function chmod(string $path, int $mode): Promise;",
"function fn_check_writable_path_permissions($path)\n{\n if (is_writable($path)) {\n $result = true;\n\n } elseif (is_dir($path)) {\n $result = $path;\n\n } else {\n $result = call_user_func(__FUNCTION__, dirname($path));\n }\n\n return $result;\n}",
"public static function test_permission($path) {\n if (!is_dir($path))\n $path = dirname($path);\n if (!is_writable($path)) {\n throw new PermissionDeniedException('You do not have permission to write to this directory: ' . $path);\n }\n if (!is_readable($path)) {\n throw new PermissionDeniedException('You do not have permission to read from this directory: ' . $path);\n }\n return true;\n }",
"public static function makePath($path, $chmod = 0777) {\n\t\t// directory already exists, abort\n\t\tif (file_exists($path)) {\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t// check if parent directory exists\n\t\t$parent = dirname($path);\n\t\tif ($parent != $path) {\n\t\t\t// parent directory does not exist either\n\t\t\t// we have to create the parent directory first\n\t\t\t$parent = self::addTrailingSlash($parent);\n\t\t\tif (!@file_exists($parent)) {\n\t\t\t\t// could not create parent directory either => abort\n\t\t\t\tif (!self::makePath($parent, $chmod)) {\n\t\t\t\t\treturn false;\t\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// well, the parent directory exists or has been created\n\t\t\t// lets create this path\n\t\t\t$oldumask = @umask(0);\n\t\t\tif (!@mkdir($path, $chmod)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t@umask($oldumask);\n\t\t\t/*if (!@chmod($path, $chmod)) {\n\t\t\t\treturn false;\n\t\t\t}*/\n\t\t\tif (IS_APACHE_MODULE || !@is_writable($path)) {\n\t\t\t\t@chmod($path, 0777);\n\t\t\t}\n\t\t\t\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\treturn false;\n\t}"
] |
[
"0.7088286",
"0.65019256",
"0.63009363",
"0.61689377",
"0.6148387",
"0.6035399",
"0.595986",
"0.5959056",
"0.58962417",
"0.58626235",
"0.5858042",
"0.5847576",
"0.58444333",
"0.5833462",
"0.5818773",
"0.5795754",
"0.5744853",
"0.57395583",
"0.57394207",
"0.57214576",
"0.5661669",
"0.5648663",
"0.5608365",
"0.56072545",
"0.560672",
"0.55906236",
"0.5499514",
"0.5490616",
"0.5481832",
"0.5468922"
] |
0.7174637
|
0
|
This method returns a directorylist of the current directory or given one. To display the current selected directory, simply set the first parameter to null or leave it blank, if you do not want to use any other parameters. There are 4 different modes of listing directories. Either to list only the files (using ftpClient::LS_MODE_FILES_ONLY), to list only directories (using ftpClient::LS_MODE_DIRS_ONLY) or to show both (using ftpClient::LS_MODE_DIRS_FILES, which is default). The 4th one is the ftpClient::LS_MODE_RAW_LIST, which returns just the array created by the ftp_rawlist() function built into PHP. The other functionmodes will return an array containing the requested data. The files and dirs are listed in humansorted order, but if you select ftpClient::LS_MODE_DIRS_FILES the directories will be added above the files, although both sorted. All elements in the arrays are associative arrays themselves. They have the following structure: Dirs: ["name"] => string The name of the directory ["rights"] => string The rights of the directory (in style "rwxrxrx") ["user"] => string The owner of the directory ["group"] => string The groupowner of the directory ["files_inside"]=> string The number of files/dirs inside the directory excluding "." and ".." ["date"] => int The creationdate as Unix timestamp ["is_dir"] => bool true, cause this is a dir Files: ["name"] => string The name of the file ["size"] => int Size in bytes ["rights"] => string The rights of the file (in style "rwxrxrx") ["user"] => string The owner of the file ["group"] => string The groupowner of the file ["date"] => int The creationdate as Unix timestamp ["is_dir"] => bool false, cause this is a file
|
function ls($dir = null, $mode = self::LS_MODE_DIRS_FILES) {
if ( $dir === null ) {
$dir = $this->pwd();
}
if ( ($mode != self::LS_MODE_FILES_ONLY) && ($mode != self::LS_MODE_DIR_ONLY) && ($mode != self::LS_MODE_RAWLIST) ) {
$mode = self::LS_MODE_DIRS_FILES;
}
switch ( $mode ) {
case self::LS_MODE_DIRS_FILES :
$res = $this->_lsBoth($dir);
break;
case self::LS_MODE_DIR_ONLY :
$res = $this->_lsDirs($dir);
break;
case self::LS_MODE_FILES_ONLY :
$res = $this->_lsFiles($dir);
break;
case self::LS_MODE_RAWLIST :
$res = @ftp_rawlist($this->_handle, $dir);
break;
}
return $res;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"static function getDirectoryListing();",
"function GetDirectoryList($bIsShowResult = true, $sInFilePath = '')\n{\t\n\t$sDirectoryPath = '';\n\t\n\tif(strlen($sInFilePath) === 0)\n\t{\n\t\tif(isset($_REQUEST['file-path']) === false)\n\t\t{\n\t\t\techo '<fail>no file path</fail>';\n\t\t\treturn;\n\t\t}\n\t\t$sDirectoryPath = trim($_REQUEST['file-path']);\n\t} else\n\t{\n\t\t$sDirectoryPath = $sInFilePath;\n\t}\n\n\t\n\t\n\t$lsNamesArrayList = array();\n\t\n\t$stDirectoryHandle = opendir($sDirectoryPath);\n\t\n\tif (!($stDirectoryHandle === false)) \n\t{\n\t\t$sFileName = '';\n\t\t\n\t\twhile (false !== ($sFileName = readdir($stDirectoryHandle))) \n\t\t{ \n\t\t\tif(strcmp($sFileName, '.') != 0 && strcmp($sFileName, '..'))\n\t\t\t{\n\t\t\t\tif(is_dir($sDirectoryPath.$sFileName) === true)\n\t\t\t\t{\n\t\t\t\t\tif($bIsShowResult === true)\n\t\t\t\t\t{\n\t\t\t\t\t\t$lsNamesArrayList[] = $sFileName.'<$%sep%$>d';\n\t\t\t\t\t} else\n\t\t\t\t\t{\n\t\t\t\t\t\t$lsNamesArrayList[] = array('type' => 'd', 'name' => $sFileName);\n\t\t\t\t\t}\n\t\t\t\t} else\n\t\t\t\t{\n\t\t\t\t\tif($bIsShowResult === true)\n\t\t\t\t\t{\n\t\t\t\t\t\t$lsNamesArrayList[] = $sFileName.'<$%sep%$>f';\n\t\t\t\t\t} else\n\t\t\t\t\t{\n\t\t\t\t\t\t$lsNamesArrayList[] = array('type' => 'f', 'name' => $sFileName);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else\n\t{\n\t\techo '<fail>cant open direcotry</fail>';\n\t}\n\t\n\t\n\tif($bIsShowResult === true)\n\t{\n\t\techo '<correct>directory list</correct>';\n\t\techo implode(\"\\n\", $lsNamesArrayList);\n\t} else\n\t{\n\t\treturn $lsNamesArrayList;\n\t}\n}",
"public function getDirectoryTreeList();",
"function dirListing($directory, $flags = '-a')\n\t{\n\t\tif (!empty($flags))\n\t\t$list = ftp_nlist($this->connection, $flags.' '.$directory);\n\t\telse\n\t\t$list = ftp_nlist($this->connection, $directory);\n\n\t\tif ($list===false)\n\t\treturn false;\n\t\telseif (empty($list))\n\t\treturn array();\n\t\telse\n\t\treturn $list;\n\t}",
"function _ls($dir = './')\n\t{\n\t\t$list = @ftp_nlist($this->connection, $dir);\n\n\t\t// See bug #46295 - Some FTP daemons don't like './'\n\t\tif ($dir === './')\n\t\t{\n\t\t\t// Let's try some alternatives\n\t\t\t$list = (empty($list)) ? @ftp_nlist($this->connection, '.') : $list;\n\t\t\t$list = (empty($list)) ? @ftp_nlist($this->connection, '') : $list;\n\t\t}\n\n\t\t// Return on error\n\t\tif ($list === false)\n\t\t{\n\t\t\treturn false;\n\t\t}\n\n\t\t// Remove path if prepended\n\t\tforeach ($list as $key => $item)\n\t\t{\n\t\t\t// Use same separator for item and dir\n\t\t\t$item = str_replace('\\\\', '/', $item);\n\t\t\t$dir = str_replace('\\\\', '/', $dir);\n\n\t\t\tif (!empty($dir) && strpos($item, $dir) === 0)\n\t\t\t{\n\t\t\t\t$item = substr($item, strlen($dir));\n\t\t\t}\n\n\t\t\t$list[$key] = $item;\n\t\t}\n\n\t\treturn $list;\n\t}",
"public function get_directory_list() {\n\t\treturn $this->directory_list;\n\t}",
"function list_dir($chdir,$id_item_parent1,$mon_dir=\"\")\r\n{\r\n\t global $id_item,$mon_path,$rep;\r\n\r\n\t $var_retour = \"\"; \r\n\t unset($sdirs);\r\n\t unset($sfiles);\r\n\t chdir($chdir);\r\n \r\n\t $self = basename($_SERVER['PHP_SELF']);\r\n\t $handle = opendir('.');\r\n\t while ($file = readdir($handle))\r\n\t {\r\n //echo($file.\"<br>\");\r\n\t \tif(is_dir($file) && $file != \".\" && $file != \"..\")\r\n\t \t{ $sdirs[] = $file; }\r\n\t\telseif (is_file($file))\r\n\t\t{ $sfiles[] = $file; }\r\n\t }\r\n\t \r\n\t $dir = getcwd();\r\n\t $dir1 = str_replace($root, \"\", $dir);\r\n\t $count = substr_count($dir1, \"/\") + substr_count($dir1, \"\\\\\");\r\n \r\n\t if(is_array($sdirs))\r\n\t {\r\n\t\t sort($sdirs);\r\n\t \t reset($sdirs);\r\n\t\t \r\n\t \t for($y=0; $y<sizeof($sdirs); $y++)\r\n\t \t {\r\n\t\t\t $id_item++;\r\n\t\t\t // on n'affiche pas les répertoires\r\n\t\t\t //echo htmlentities($sdirs[$y]);\r\n \r\n\t\t\t $cwd1[0] = $dir;\r\n\t \t\t $cwd1[1] = $sdirs[$y];\r\n\t\t\t $chdir = join(\"/\", $cwd1);\r\n\t\t\t \r\n\t\t\t $var_retour = $var_retour.list_dir($chdir,$id_item,$chdir);\r\n\t\t }\r\n\t }\r\n\t \t\t \r\n\t chdir($chdir);\r\n\t \r\n\t if(is_array($sfiles))\r\n\t {\r\n\t \t sort($sfiles);\r\n\t \t reset($sfiles);\r\n\t\t \r\n\t\t $sizeof = sizeof($sfiles);\r\n\t\t \r\n\t\t for($y=0; $y<$sizeof; $y++)\r\n\t\t {\r\n\t\t\t $id_item++;\r\n\t\t\t if ($mon_dir) {\r\n\t\t\t\t $nom_path = str_replace($mon_path,\"\",$mon_dir).\"/\";\r\n\t\t\t }\r\n\t\t\t else {\r\n\t\t\t\t $nom_path = $rep;\r\n\t\t\t }\r\n\r\n\t\t\t$var_retour = $var_retour.\"<option value=\\\"\".$sfiles[$y].\"\\\">\".$sfiles[$y].\"</option>\"; \r\n\t\t }\r\n\t }\r\n\r\n\t return $var_retour;\r\n}",
"function ftp_list_detailed($rmt_dir = '.') {\n\t\t$rmt_dir = rtrim($rmt_dir, '/');\n\t\t\n\t\tif (is_array($ls_details = @ftp_rawlist($this->conn_id, $rmt_dir))) {\n\t\t\t\t$items = array();\n\n\t\t\t\tforeach ($ls_details as $i=>$ls_detail) {\n\t\t\t\t\t\t$chunks = preg_split(\"/\\s+/\", $ls_detail);\n\t\t\t\t\t\tlist(\n\t\t\t\t\t\t\t\t$item['rights'], \n\t\t\t\t\t\t\t\t$item['number'],\n\t\t\t\t\t\t\t\t$item['user'], \n\t\t\t\t\t\t\t\t$item['group'], \n\t\t\t\t\t\t\t\t$item['size'], \n\t\t\t\t\t\t\t\t$item['month'], \n\t\t\t\t\t\t\t\t$item['day'], \n\t\t\t\t\t\t\t\t$item['time']\n\t\t\t\t\t\t\t\t\t\t) = $chunks;\n\t\t\t\t\t\t$item['type'] = $chunks[0]{0} === 'd' ? 'directory' : 'file';\n\t\t\t\t\t\tpreg_match(\"/\\S*$/\", $ls_detail, $name);\n\t\t\t\t\t\t$item['name'] = $name[0];\n\t\t\t\t\t\t$items[$i] = $item;\n\t\t\t\t}\n\n\t\t\t\treturn $items;\n\t\t} else {\n\t\t\treturn FALSE;\n\t\t}\n\t}",
"function _ls($dir = './')\n\t{\n\t\tif (!$this->_open_data_connection())\n\t\t{\n\t\t\treturn false;\n\t\t}\n\n\t\t$this->_send_command('NLST', $dir);\n\n\t\t$list = array();\n\t\twhile (!@feof($this->data_connection))\n\t\t{\n\t\t\t$filename = preg_replace('#[\\r\\n]#', '', @fgets($this->data_connection, 512));\n\n\t\t\tif ($filename !== '')\n\t\t\t{\n\t\t\t\t$list[] = $filename;\n\t\t\t}\n\t\t}\n\t\t$this->_close_data_connection();\n\n\t\t// Clear buffer\n\t\t$this->_check_command();\n\n\t\t// See bug #46295 - Some FTP daemons don't like './'\n\t\tif ($dir === './' && empty($list))\n\t\t{\n\t\t\t// Let's try some alternatives\n\t\t\t$list = $this->_ls('.');\n\n\t\t\tif (empty($list))\n\t\t\t{\n\t\t\t\t$list = $this->_ls('');\n\t\t\t}\n\n\t\t\treturn $list;\n\t\t}\n\n\t\t// Remove path if prepended\n\t\tforeach ($list as $key => $item)\n\t\t{\n\t\t\t// Use same separator for item and dir\n\t\t\t$item = str_replace('\\\\', '/', $item);\n\t\t\t$dir = str_replace('\\\\', '/', $dir);\n\n\t\t\tif (!empty($dir) && strpos($item, $dir) === 0)\n\t\t\t{\n\t\t\t\t$item = substr($item, strlen($dir));\n\t\t\t}\n\n\t\t\t$list[$key] = $item;\n\t\t}\n\n\t\treturn $list;\n\t}",
"private static function getDirListing($path){\n\t\t\tlist($url,$cred,$trgt,$pth)=self::usrpwd($path);\n\t\t\t$ch=self::setup($url,$cred);\n\t\t\tif(!function_exists('k2f_ftp_getDirListingHeaders')){\n\t\t\t\tfunction k2f_ftp_getDirListingHeaders($ch,$hdr){\n\t\t\t\t\tif(CFG::get('DEBUG_VERBOSE'))xlog('FTPWRP: Read header: ',$hdr);\n\t\t\t\t\treturn strlen($hdr);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcurl_setopt($ch,CURLOPT_HEADERFUNCTION,'k2f_ftp_getDirListingHeaders');\n\t\t\tif(self::isWinFtp($path))curl_setopt($ch,CURLOPT_QUOTE,array('SITE DIRSTYLE'));\n\t\t\t$dirlist=curl_exec($ch);\n\t\t\tself::error($ch);\n\t\t\tcurl_close($ch);\n\t\t\t$dirlist=FtpDirListingParser::parse($dirlist);\n\t\t\txlog('FTPWRP: Getting listing of \"'.$path.'\":',$dirlist);\n\t\t\treturn $dirlist;\n\t\t}",
"function dir_list($path=\"\")\n\t{\n\t\t$s=\"\";\n\t\tif($this->pasv())\n\t\t{\n\t\t\tif($path == '')\n\t\t\t{\n\t\t\t\t$this->sock_write(\"LIST\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->sock_write(\"LIST $path\");\n\t\t\t}\n\t\t\tif($this->is_ok())\n\t\t\t{\n\t\t\t\twhile(true)\n\t\t\t\t{\n\t\t\t\t\t$line = fgets($this->data_sock);\n\t\t\t\t\t$s .= $line;\n\t\t\t\t\tif($line =='')\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $s;\n\t}",
"function ft_hook_dirlist() {}",
"function ls($directory);",
"public function listFiles() {\r\n $list = ftp_nlist($this->connessione, '.');\r\n return $list;\r\n }",
"function sd_sc_list_dir($atts) {\n\tglobal $sd_error_msg;\n\n\t$dir = sd_sc_get_path($atts);\n\tif (!$dir) { return 'Fehler: Ungültiges Verzeichnis.'; }\n\n\t// ensure that $dir starts and ends with a slash.\n\t$dir = trailingslashit( $dir );\n\tif ('/' != $dir{0}) { $dir = '/' . $dir; }\n\n\t$absdir = untrailingslashit(SD_DL_ROOT) . $dir;\n\tif (!is_dir($absdir)) { return 'Fehler: Kein Verzeichnis.'.$absdir; };\n\tif (!is_readable($absdir)) { return 'Fehler: Unlesbares Verzeichnis.'; };\n\n\t$access = sd_check_permissions($absdir);\n\tif (!$access) { return $sd_error_msg; }\n\t\n\t$list = '';\n\t$urlpath = untrailingslashit(SD_DL_BASEURL) . $dir;\n\t$baseurl = home_url() . (('/' == $urlpath{0}) ? '' : '/') . $urlpath;\n\t$d = dir($absdir);\n\twhile (false !== ($entry = $d->read())) {\n\t\tif ('.' == $entry{0}) { continue; }\n\t\t$link = $baseurl . $entry;\n\t\t$list .= '<a href=\"' . $link . '\">' . $entry . '</a> ('.$link.')<br />';\n\t}\n\t$d->close();\n\n\treturn $list;\n}",
"public function getFileList(){\n return ftp_nlist($this->ftp_conn, $this->directory); \n }",
"function get_folders_list_ajax() {\n\t\t$path = str_replace( '\\\\\\\\', DIRECTORY_SEPARATOR, $_POST['path'] );\n\t\t$path = $path . DIRECTORY_SEPARATOR;\n\t\t$list = $this->get_folders_list( $path );\n\t\t$output = [];\n\t\t$output['path'] = $path;\n\t\t$output['folders'] = '';\n\t\t$output['files'] = '';\n\t\tob_start();\n\t\tif ( $list ) {\n\t\t\t$output['folders'] .= '<option>' . NONE_ELEMENT . '</option>';\n\t\t\tforeach ( $list as $item ) {\n\t\t\t\t$output['folders'] .= '<option>' . substr( $item, strripos( $item, DIRECTORY_SEPARATOR ) + 1 ) . '</option>';\n\t\t\t}\n\t\t}\n\t\t$available_files = get_all_available_files( $path );\n\t\tif ( $available_files ) {\n\t\t\t$output['files'] = edde_dispay_available_files( $available_files );\n\t\t}\n\t\tob_end_clean();\n\t\techo json_encode( $output );\n\t\twp_die();\n\t}",
"public function dir($extend = true, $checkFormat = true) {\n if (false === $this->connection) {\n return false;\n }\n\n $listing = [];\n if (false === $extend) {\n $listing = ftp_nlist($this->connection, $this->pwd());\n } else {\n foreach(ftp_rawlist($this->connection, $this->pwd()) as $rawFileInfo) {\n if (true === $checkFormat) {\n try {\n FtpClientFileHelper::checkRawFormat($rawFileInfo);\n } catch(\\InvalidArgumentException $e) {\n throw new FtpClientException('Could not list directory contents with format check', 0, $e);\n }\n }\n\n $file = new FtpClientRemoteFile();\n $seg = preg_split('([\\s]+)', $rawFileInfo, 9);\n\n $file->setIsDir((bool) $seg[0]{0} == 'd');\n $file->setChmodRaw($seg[0]);\n $file->setChmod(FtpClientFileHelper::getChmod($seg[0]));\n $file->setOwner($seg[2]);\n $file->setGroup($seg[3]);\n $file->setSizeRaw($seg[4]);\n $file->setDateRaw($seg[6] . ' ' . $seg[5] . ' ' . $seg[7]);\n $file->setTimestamp(FtpClientFileHelper::getTimestamp($seg[7], $seg[5], $seg[6]));\n $file->setName($seg[8]);\n $file->setMime(FtpClientFileHelper::guessMimeType($seg[8]));\n $file->setRaw($rawFileInfo);\n\n if (!$file->isDir()) {\n $file->setSize(FtpClientFileHelper::getSize($seg[4]));\n }\n $listing[] = $file;\n }\n }\n return $listing;\n }",
"public function listDir($directory, $recursive = FALSE) {\n\n if ($this->connectId) {\n $array = @ftp_rawlist($this->connectId, $directory, $recursive);\n\n if (!is_array($array)) {\n $this->errores[] = \"FTP: Ha fallado el listado de la carpeta '{$directory}'\";\n }\n }\n\n return $array;\n }",
"function ftp_rawlist($ftp_stream, $directory, $recursive = false)\n{\n}",
"public function getFileList()\r\n {\r\n $gid = $this->input->get_post('gid');\r\n if ($gid === FALSE)\r\n {\r\n // list all groups (by permission)\r\n $permission = $this->input->get_post('permission');\r\n $file_list = $this->_get_group_list($permission);\r\n $access_full_path = '';\r\n }\r\n else\r\n {\r\n // check permission\r\n $this->_check_group_permission();\r\n $access_full_path = $this->_get_access_full_path();\r\n $sortby = $this->input->get_post('sortby') ?: '+name';\r\n $file_list = $this->files_model->get_file_list($access_full_path, $sortby);\r\n }\r\n\r\n $format = $this->input->get_post('format');\r\n if ($format === 'jstree')\r\n {\r\n //$path = '/' . trim($this->input->get_post('path') ?: '', '/');\r\n $path = $this->input->get_post('path');\r\n $path = $path ? $path : '';\r\n $dironly = $this->input->get_post('dironly');\r\n $tree = array();\r\n foreach ($file_list as $file)\r\n {\r\n if ($dironly && $file['type'] === Files_model::FILE_TYPE_FILE)\r\n {\r\n continue;\r\n }\r\n // Give different directory icons based directories.\r\n $is_my_workspace = 0;\r\n if ($gid)\r\n {\r\n $is_my_workspace = $this->_is_my_workspace($gid);\r\n }\r\n else\r\n {\r\n $is_my_workspace = $this->_is_my_workspace($file['gid']);\r\n }\r\n $access_full_subpath = $access_full_path .'/'. $file['name'];\r\n\r\n $data_path = $file['type'] === Files_model::FILE_TYPE_FOLDER ? $path . '/' . $file['name'] : $path;\r\n if ($gid !== FALSE && $path === '' && $file['type'] === Files_model::FILE_TYPE_FOLDER)\r\n {\r\n $file['show_name'] = $this->files_model->get_system_folder_name($file['name']);\r\n }\r\n $tree[] = array(\r\n 'data' => array(\r\n 'title' => isset($file['show_name']) ? $file['show_name'] : $file['name'],\r\n 'attr' => array(\r\n 'href' => '#',\r\n ),\r\n ),\r\n 'attr' => array(\r\n 'data-name' => $file['name'],\r\n 'data-gid' => $gid === FALSE ? $file['gid'] : $gid,\r\n 'data-path' => $gid === FALSE ? '' : $data_path,\r\n 'data-size' => $file['size'],\r\n 'data-crumb'=> $file['type'] == Files_model::FILE_TYPE_FOLDER ? $this->login->get_crumb($access_full_subpath) : '',\r\n 'class' => $file['type'] == Files_model::FILE_TYPE_FOLDER ? 'folder' : 'file',\r\n 'rel' => $is_my_workspace ? 'user-folder' : 'folder',\r\n ),\r\n 'state' => $file['type'] == Files_model::FILE_TYPE_FOLDER ? 'closed' : '',\r\n );\r\n }\r\n $this->_outputJSON($tree);\r\n }\r\n\r\n $resp['status'] = 'ok';\r\n $resp['errno'] = $resp['errmsg'] = '';\r\n $resp['list'] = $file_list;\r\n $this->_outputJSON($resp);\r\n }",
"function list_directory($dir, &$list)\r\n\t{\r\n\t\tif ($dh = @opendir($dir)) \r\n\t\t{\r\n\t\t\twhile(($file = readdir($dh)) !== false)\r\n\t\t\t{\r\n\t\t\t\tif( $file != \".\" and $file != \"..\") \r\n\t\t\t\t{\r\n\t\t\t\t\tif(!is_dir($dir.$file))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$list[] = str_replace(\"\\\\\", \"/\", $dir.$file);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(is_dir($dir.$file)) \r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$newdir = $dir.$file.\"/\";\r\n\t\t\t\t\t\tchdir($newdir);\r\n\t\t\t\t\t\tlist_directory($newdir, $list);\r\n\t\t\t\t\t} \r\n\t\t\t\t} \r\n\t\t\t}\r\n\t\t\tchdir(\"..\");\r\n\t\t}\r\n\t\treturn $list;\r\n\t}",
"function list_dir($chdir) {\r\n\t/* some globals, some cleaning */\r\n\tglobal $root, $prefix, $PHP_SELF, $SERVER_NAME, $showsize, $display, $excludedir, $excludefile;\r\n\tunset($sdirs);\r\n\tunset($sfiles);\r\n\tchdir($chdir);\r\n\t$self = basename($PHP_SELF);\r\n\r\n\t/* open current directory */\r\n\t$handle = opendir('.');\r\n\t/* read directory. If the item is a directory, place it in $sdirs, if it's a filetype we want\r\n\t * and not this file, put it in $sfiles */\r\n\twhile ($file = readdir($handle))\r\n\t{\r\n\t\tif(is_dir($file) && $file != \".\" && $file != \"..\" && !in_array($file, $excludedir))\r\n\t\t{ $sdirs[] = $file; }\r\n\t\telseif(is_file($file) && $file != \"$self\" && array_key_exists(get_extension($file), $display)\r\n\t\t\t&& !in_array($file, $excludefile))\r\n\t\t{ $sfiles[] = $file; }\r\n\t}\r\n\r\n\t/* count the slashes to determine how deep we're in the directory tree and how many\r\n\t * nice bars we need to add */\r\n\t$dir = getcwd();\r\n\t$dir1 = str_replace($root, \"\", $dir.\"/\");\r\n\t$count = substr_count($dir1, \"/\") + substr_count($dir1, \"\\\\\") - (substr_count($root, \"/\")-1);\r\n\r\n\t/* display directory names and recursively list all of them */\r\n\tif(isset($sdirs) && is_array($sdirs)) {\r\n\t\tsort($sdirs);\r\n\t\treset($sdirs);\r\n\r\n\t\tfor($y=0; $y<sizeof($sdirs); $y++) {\r\n\t\t\techo \"<tr><td>\";\r\n\t\t\tfor($z=1; $z<=$count; $z++)\r\n\t\t \t{ echo \"<img align=absmiddle src=comu/sitemap/vertical.gif> \"; }\r\n\t\t\tif((isset($sfiles) && is_array($sfiles)) || $y<sizeof($sdirs)-1)\r\n\t\t\t{ echo \"<img align=absmiddle src=comu/sitemap/verhor.gif>\"; }\r\n\t\t\telse\r\n\t\t\t{ echo \"<img align=absmiddle src=comu/sitemap/verhor1.gif>\"; }\r\n\t\t\techo \"<img align=absmiddle src=comu/sitemap/folder.gif> <a href=\\\"http://$SERVER_NAME$prefix/$dir1$sdirs[$y]\\\" target=\\\"_blank\\\" class=\\\"blau10b\\\">$sdirs[$y]</a>\";\r\n\t\t\tlist_dir($dir.\"/\".$sdirs[$y]);\r\n\t\t}\r\n\t}\r\n\r\n\tchdir($chdir);\r\n\r\n\t/* iterate through the array of files and display them */\r\n\tif(isset($sfiles) && is_array($sfiles)) {\r\n\t\tsort($sfiles);\r\n\t\treset($sfiles);\r\n\r\n\t\t$sizeof = sizeof($sfiles);\r\n\r\n\t\t/* what file types shall be displayed? */\r\n\t\tfor($y=0; $y<$sizeof; $y++) {\r\n\t\t\techo \"<tr><td>\";\r\n\t\t\tfor($z=1; $z<=$count; $z++)\r\n\t\t\t{ echo \"<img align=absmiddle src=comu/sitemap/vertical.gif> \"; }\r\n\t\t\tif($y == ($sizeof -1))\r\n\t\t\t{ echo \"<img align=absmiddle src=comu/sitemap/verhor1.gif>\"; }\r\n\t\t\telse\r\n\t\t\t{ echo \"<img align=absmiddle src=comu/sitemap/verhor.gif>\"; }\r\n\t\t\techo \"<img align=absmiddle src=comu/sitemap/\";\r\n\t\t\techo $display[get_extension($sfiles[$y])];\r\n\t\t\techo \"> \";\r\n\r\n\r\n\t\t\t\t$valorlink=\"$prefix/$dir1$sfiles[$y]\";\r\n\t\t\t\t//echo \"<a href=\\\"$valorlink\\\" class=\\\"blau10\\\" target=\\\"_blank\\\">$sfiles[$y]</a>\";\r\n\t\t\t\techo '<a href=\"#\" class=\"blau10\" onclick=\"OpenFile(\\''.$valorlink.'\\');return false;\">'.$sfiles[$y].'</a>';\r\n\r\n\t\t\t/*if (!isset($_GET['nocopy'])) {\r\n\t\t\t\t//per copiar link\r\n\t\t\t\techo \"<input type=hidden name=\\\"$dir1$sfiles[$y]\\\" id=\\\"$dir1$sfiles[$y]\\\" value=\\\"$valorlink\\\">\";\r\n\t\t\t\techo \" <a href=\\\"javascript:CopyClipboard('$dir1$sfiles[$y]')\\\" title=\\\"copiar el vincle al portapapers\\\">copiar vincle</a>\";\r\n\t\t\t\t//fi\r\n\t\t\t}*/\r\n\r\n\t\t\tif($showsize) {\r\n\t\t\t\t$fsize = @filesize($sfiles[$y])/1024;\r\n\t\t\t\tprintf(\" (%.2f kB)\", $fsize);\r\n\t\t\t}\r\n\t\t\techo \"</td></tr>\";\r\n\r\n\r\n\r\n\t\t}\r\n\t\techo \"<tr><td>\";\r\n\t\tfor($z=1; $z<=$count; $z++)\r\n\t\t{ echo \"<img align=absmiddle src=comu/sitemap/vertical.gif> \"; }\r\n\t\techo \"</td></tr>\\n\";\r\n\t}\r\n}",
"public static function getSelectULList($table, $selected_id = -1){\n\t\n\t$htmlList = '';\n\t$htmlListFirstEntry = \"<li data-value='-1' class='disabled'><a href='#'>Select folder </a></li><li class='divider'></li>\";\t\n\t\n\tswitch ($table){\n\t\tcase 'folder':\n\t\tcase 'parentfolder':\n\t\t{\n\t\t\tif($table=='folder'){\n\t\t\t\t$list = Folder::getAll() ; //'SELECT id_folder, folderName, id_user from folder';\n\t\t\t}elseif($table=='parentfolder'){\n\t\t\t\t$list = Folder::getAllParents() ; //'SELECT id_folder, folderName, id_user from folder';\n\t\t\t}\t\t\n\t\t\tif(false !== $list){\n\t\t\t\t$htmlItem = '';\n\t\t\t\tforeach($list as $item){\n\t\t\t\tif($item['id_folder'] == $selected_id){$is_selected=' selected ';}else{$is_selected='';}\n\t\t\t\t$htmlItem = \"<li data-value='{$item['id_folder']}'><a href='#'>{$item['folderName']}</a></li>\";\n\t\t\t\t\t$htmlList = $htmlList.$htmlItem.PHP_EOL;\n\t\t\t\t}\n\t\t\tif($selected_id == -1) $htmlList = $htmlListFirstEntry.PHP_EOL.$htmlList;\t\t\t\n\t\t\t}\n\t\t\telse $htmlList = \"<li data-value='-1' class='disabled'><a href='#'>No folders</a></li>\";\n\t\t}\n\t\t$htmlList = \"<ul class='dropdown-menu' role='menu'>\".$htmlList.\"</ul>\";\n\t\tbreak;\n\t\tcase 'folderGroupped':{\n\t\t\t$list = Folder::getFoldersArray() ; //groupped array\n\t\t\tif(false !== $list AND count($list) > 0){\n\t\t\t\t$htmlItem = '';\n\t\t\t\tforeach($list as $folderSet){\n\t\t\t\t\t$fldNameParent = $folderSet['parentName'];\n\t\t\t\t\t$fldCountParent = $folderSet['folderCount'];\n\t\t\t\t\t$fldIDParent = $folderSet['parentID'];\n\t\t\t\t\t\n\t\t\t\t\tif( count($folderSet['subfolders']) > 0 ){\n\t\t\t\t\t\t//group header//\n\t\t\t$htmlItem = \"<li data-value='{$fldIDParent}' class='ulheader'><a href='#'>{$fldNameParent}</a></li>\";\n\t\t\t$htmlList = $htmlList.$htmlItem.PHP_EOL;\n\t\t\t\n\t\t\tforeach($folderSet['subfolders'] as $subfolder){\n\t\t\t\n\t\t\t\t$folderName = $subfolder['folderName'];\n\t\t\t\t$folderCount = $subfolder['folderCount'];\n\t\t\t\t$folderID = $subfolder['id_folder'];\n\t\t\t\t$HTMLfldID = 'subfolder'.$folderID;\n\t$htmlItem = \"<li data-value='{$folderID}'><a href='#'>{$folderName}</a></li>\";\n\t$htmlList = $htmlList.$htmlItem.PHP_EOL;\n\t\t\t\t}\n\t\t\t\t$htmlList = $htmlList.\"<li class='divider'></li>\";\n\t\t}else{\n\t\t\t$htmlItem = \"<li data-value='{$fldIDParent}' class='ulheader'><a href='#'>{$fldNameParent}</a></li>\";\n\t\t\t$htmlList = $htmlList.$htmlItem.PHP_EOL;\n\t\t\t$htmlList = $htmlList.\"<li class='divider'></li>\";\n\t\t}\n\t\t\t\t}\n\t\t\tif($selected_id == -1) $htmlList = $htmlListFirstEntry.PHP_EOL.$htmlList;\t\t\t\n\t\t\t}\n\t\t\telse $htmlList = \"<li data-value='-1' class='disabled'><a href='#'>No folders</a></li>\";\n\t\t}\n\t\t$htmlList = \"<ul class='dropdown-menu' role='menu'>\".$htmlList.\"</ul>\";\t\t\n\t\tbreak;\n\n\t\tcase 'tag':{\n\t\t\t$list = Tag::getAll() ;\n\t\t\tif(false !== $list){\n\t\t\t\t$htmlItem = '';\n\t\t\t\tforeach($list as $item){\t\t\t\n\t\t\t\t\tif($item['id_tag'] === $selected_id){\n\t\t$htmlItem = \"<li data-value='{$item['id_tag']}' selected><a href='#'>{$item['tagName']}</a></li>\";\t\t\n\t\t\t\t\t}else{\n\t\t$htmlItem = \"<li data-value='{$item['id_tag']}'><a href='#'>{$item['tagName']}</a></li>\";\n\t\t\t\t\t}\t\n\t\t\t\t\t$htmlList = $htmlList.$htmlItem.PHP_EOL;\n\t\t\t\t}\n\t\t\t\tif($selected_id == -1) $htmlList = $htmlListFirstEntry.PHP_EOL.$htmlList;\t\t\t\n\t\t\t}\n\t\t\telse $htmlList = \"<li data-value='-1' class='disabled'><a href='#'>No tags</a></li>\";\n\t\t}\n\t\t$htmlList = \"<ul class='dropdown-menu' role='menu'>\".$htmlList.\"</ul>\";\n\t\tbreak;\n\t\t\n\t\tbreak;\n\t\tdefault:\n\t\t\t$htmlList = \"<option disabled value='-1'>No data</option>\";\t\n\t\t}\n\treturn $htmlList;\t\n\n\t}",
"function get_directory_list ($directory, $file=true) {\n $d = dir ($directory);\n $list = array();\n while ($entry = $d->read() ) {\n if ($file == true) { // We want a list of files, not directories\n $parts_array = explode ('.', $entry);\n $extension = $parts_array[1];\n // Don't add files or directories that we don't want\n if ($entry != '.' && $entry != '..' && $entry != '.htaccess' && $extension != 'php') {\n if (!is_dir ($directory . \"/\" . $entry) ) {\n $list[] = $entry;\n }\n }\n } else { // We want the directories and not the files\n if (is_dir ($directory . \"/\" . $entry) && $entry != '.' && $entry != '..') {\n $list[] = array ('id' => $entry,\n 'text' => $entry\n );\n }\n }\n }\n $d->close();\n return $list;\n}",
"function DisplayDirListing()\n{\n\tglobal $gBitSmarty, $env;\n\n\t// Create our CVS connection object and set the required properties.\n\t$CVSServer = new CVS_PServer($env['CVSSettings']['cvsroot'], $env['CVSSettings']['server'], $env['CVSSettings']['username'], $env['CVSSettings']['passwd']);\n\n\t// Connect to the CVS server.\n\tif ($CVSServer->Connect() === true) {\n\n\t\t// Authenticate against the server.\n\t\t$Response = $CVSServer->Authenticate();\n\t\tif ($Response !== true) {\n\t\t\t$gBitSmarty->assign('error', \"ERROR: \".$Response);\n\t\t\treturn;\n\t\t}\n\n\t\t// Get a RLOG of the module path specified in $env['mod_path'].\n\t\t$CVSServer->RLog($env['mod_path']);\n\t\t\n\t\t// If we are in the Root of the CVS Repository then lets get the Module list.\n\t\tif (strlen($env['mod_path']) < 2) {\n\t\t\t$Modules = $CVSServer->getModuleList();\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$Modules = false;\n\t\t}\n\n\t\t// Do we need the \"Back\" operation.\n\t\tif (strlen($env['mod_path']) > 2) {\n\t\t\t$hrefup = str_replace(\"//\", \"/\", $env['script_name'].\"?mp=\".substr($env['mod_path'], 0, strrpos(substr($env['mod_path'], 0, -1), \"/\")).\"/\");\n\t\t\t$gBitSmarty->assign('hrefup', $hrefup );\n\t\t\t$gBitSmarty->assign('ParentIcon', $env['script_path'].'/icons/parent.png' );\n\t\t}\n\n\t\t$HREF = str_replace(\"//\", \"/\", $env['script_name'].\"?mp=\".$env['mod_path'].\"/\");\n\t\t$gBitSmarty->assign('HREF', $HREF );\n\t\t$gBitSmarty->assign('DownloadIcon', $env['script_path'].'/icons/download.png' );\n\t\t$gBitSmarty->assign('FolderIcon', $env['script_path'].'/icons/folder.png' );\n\t\t$gBitSmarty->assign('ModuleIcon', $env['script_path'].'/icons/module.png' );\n\t\t$gBitSmarty->assign('FileIcon', $env['script_path'].'/icons/file.png' );\n\t\t$gBitSmarty->assign_by_ref('folders', $CVSServer->FOLDERS);\n\t\tif ($Modules !== false) {\n\t\t\t$gBitSmarty->assign_by_ref('modules', $Modules);\n\t\t}\n\t\t$lfiles = array();\n\t\t$i = 0;\n\t\tforeach ($CVSServer->FILES as $File) {\n\t\t\t$lfiles[$i]['Name'] = $File['Name'];\n\t\t\t$lfiles[$i]['Head'] = $File['Head'];\n\t\t\t$lfiles[$i]['HREF'] = str_replace(\"//\", \"/\", $env['script_name'].\"?mp=\".$env['mod_path'].\"/\".$File[\"Name\"]);\n\t\t\t$lfiles[$i]['DateTime'] = strtotime($File[\"Revisions\"][$File[\"Head\"]][\"date\"]);\n\t\t\t$lfiles[$i]['AGE'] = CalculateDateDiff($lfiles[$i]['DateTime'], strtotime(gmdate(\"M d Y H:i:s\")));\n\t\t\t$lfiles[$i]['Author'] = $File[\"Revisions\"][$File[\"Head\"]][\"author\"];\n\t\t\t$lfiles[$i]['Log'] = $File[\"Revisions\"][$File[\"Head\"]][\"LogMessage\"];\n\t\t\t$i++;\n\t\t}\n\t\t$gBitSmarty->assign_by_ref('files', $lfiles);\n\n\t\t$CVSServer->Disconnect();\n\t} else {\n\t\t$gBitSmarty->assign('error', \"ERROR: Could not connect to the PServer\" );\n\t}\n}",
"function getDirectories($dir)\r\n{\r\n\tglobal $debug;\r\n\t$directories = getFolderList($dir);\r\n\t// Only bother with it if there are any subdirectories here\r\n\tif (count($directories)>0)\r\n\t{\r\n\t\t$getDirectories = '<div class=\"list-group\">';\r\n\t\tforeach($directories as $directory)\r\n\t\t{\r\n\t\t\t// Only bother with it if there are playable tracks or subdirectories\r\n\t\t\tif ( getTracksCount($directory)>0 || getFoldersCount($directory)>0 )\r\n\t\t\t{\r\n\t\t\t\t$getDirectories .= '<a href=\"?dir='.rawurlencode($directory);\r\n\t\t\t\tif ( !empty($debug) )\r\n\t\t\t\t{\r\n\t\t\t\t\t$getDirectories .= '&debug=log';\r\n\t\t\t\t}\r\n\t\t\t\t$getDirectories .= '\" class=\"list-group-item\" title=\"Open this directory\">'.substr($directory,strrpos($directory,\"/\")+1).'</a>';\r\n\t\t\t}\r\n\t\t}\r\n\t\tunset($directories);\r\n\t\t$getDirectories .= '</div>';\r\n\t}\r\n\telse\r\n\t{\r\n\t\t$getDirectories = '';\r\n\t}\r\n\tif ( !empty($debug) )\r\n\t{\r\n\t\t$log = \"getDirectories(\".$dir.\")\\n----------\\n\";\r\n\t\t$log .= \"getDirectories = \".$getDirectories.\"\\n\\n\";\r\n\t\tdebugLog($log);\r\n\t}\r\n\treturn $getDirectories;\r\n}",
"public function filelist ($args)\n {\n if (!isset($args['startdir'])) {\n $args['startdir'] = './';\n }\n if (!isset($args['searchSubdirs']) || !is_numeric($args['searchSubdirs'])) {\n $args['searchSubdirs'] = 1;\n }\n if (!isset($args['directoriesonly']) || !is_numeric($args['directoriesonly'])) {\n $args['directoriesonly'] = 0;\n }\n if (!isset($args['maxlevel'])) {\n $args['maxlevel'] = 'all';\n }\n if (!isset($args['level']) || !is_numeric($args['level'])) {\n $args['level'] = 1;\n }\n if (!isset($args['ztemp']) || !is_numeric($args['ztemp'])) {\n $args['ztemp'] = 0;\n }\n\n if (!SecurityUtil::checkPermission('SysInfo::', '::', ACCESS_ADMIN)) {\n return LogUtil::registerPermissionError();\n }\n\n $startdir = $args['startdir'];\n $searchSubdirs = $args['searchSubdirs'];\n $directoriesonly = $args['directoriesonly'];\n $maxlevel = $args['maxlevel'];\n $level = $args['level'];\n $ztemp = $args['ztemp'];\n\n // this process could take a while....\n @set_time_limit(0);\n @ini_set('memory_limit', '128M');\n\n $ignoredDirectory[] = '.';\n $ignoredDirectory[] = '..';\n $ignoredDirectory[] = '.svn';\n $ztemp = DataUtil::formatForOS(CacheUtil::getLocalDir(),true);\n if ($ztemp == 0) {\n $ignoredDirectory[] = $ztemp;\n }\n\n global $directorylist;\n if (is_dir($startdir)) {\n if ($dh = @opendir($startdir)) {\n while (($file = readdir($dh)) !== false) {\n if (!(array_search($file,$ignoredDirectory) > -1)) {\n if (filetype($startdir . $file) == 'dir') {\n $directorylist[$startdir . $file]['dir'] = $this->__('Folder');\n $directorylist[$startdir . $file]['path'] = $startdir;\n $directorylist[$startdir . $file]['name'] = $file;\n $directorylist[$startdir . $file]['writable'] = (bool)is_writable($startdir . $file);\n if ($searchSubdirs) {\n if ((($maxlevel) == 'all') or ($maxlevel > $level)) {\n ModUtil::apiFunc('SysInfo', 'admin', 'filelist',\n array ('startdir' => $startdir . $file . '/',\n 'searchSubdirs' => $searchSubdirs,\n 'directoriesonly' => $directoriesonly,\n 'maxlevel' => $maxlevel,\n 'level' => $level + 1));\n }\n }\n } else {\n if (!$directoriesonly) {\n $directorylist[$startdir . $file]['dir'] = $this->__('File');\n $directorylist[$startdir . $file]['path'] = $startdir;\n $directorylist[$startdir . $file]['name'] = $file;\n $directorylist[$startdir . $file]['writable'] = (bool)is_writable($startdir . $file);\n }\n }\n }\n }\n closedir($dh);\n }\n }\n return($directorylist);\n }",
"public function listDirectory(string $id, int $page = null, int $limit = null, string $sort = null, string $dir = null, &$responseCode, array &$responseHeaders);",
"protected function getFileList()\n\t\t{\n\t\t\t$dirname=opendir($this->ruta);\n\t\t\t$files=scandir($this->ruta);\n\t\t\tclosedir ($dirname);\t\n\t\t\t\n\t\t\treturn $files;\t\t\n\t\t}"
] |
[
"0.7070453",
"0.6928776",
"0.69244236",
"0.68159485",
"0.67324615",
"0.6686486",
"0.6603457",
"0.6514352",
"0.65143013",
"0.65051925",
"0.6398932",
"0.63027406",
"0.6298545",
"0.62482154",
"0.6223807",
"0.62214774",
"0.6115675",
"0.6090025",
"0.6064449",
"0.6048543",
"0.6031594",
"0.59801775",
"0.5953525",
"0.594813",
"0.5913908",
"0.59112805",
"0.58970094",
"0.5895747",
"0.58916205",
"0.5875356"
] |
0.76958275
|
0
|
This method will delete the given file or directory ($path) from the server (maybe recursive). Whether the given string is a file or directory is only determined by the last sign inside the string ("/" or not). If you specify a directory, you can optionally specify $recursive as true, to let the directory be deleted recursive (with all subdirectories and files inherited). You can either give a absolute or relative path for the file / dir. If you choose to use the relative path, it will be automatically completed with the actual selected directory.
|
function rm($path, $recursive = false, $filesonly = false) {
$path = $this->_constructPath($path);
if ( $this->_checkRemoteDir($path) === true ) {
if ( $recursive ) {
return $this->_rmDirRecursive($path, $filesonly);
} else {
return $this->_rmDir($path);
}
} else {
return $this->_rmFile($path);
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function delete($path, $recursive);",
"public function delete( $file, $recursive = false, $type = false ) {\n\t\tif ( empty( $file ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif ( 'f' === $type || $this->is_file( $file ) ) {\n\t\t\treturn ftp_delete( $this->link, $file );\n\t\t}\n\n\t\tif ( ! $recursive ) {\n\t\t\treturn ftp_rmdir( $this->link, $file );\n\t\t}\n\n\t\t$filelist = $this->dirlist( trailingslashit( $file ) );\n\n\t\tif ( ! empty( $filelist ) ) {\n\t\t\tforeach ( $filelist as $delete_file ) {\n\t\t\t\t$this->delete( trailingslashit( $file ) . $delete_file['name'], $recursive, $delete_file['type'] );\n\t\t\t}\n\t\t}\n\n\t\treturn ftp_rmdir( $this->link, $file );\n\t}",
"public function delete($path);",
"public function delete($path);",
"function recursiveDelete($str) {\r\n\tif (is_file($str)) {\r\n\t\treturn @unlink($str);\r\n\t}\r\n\telseif (is_dir($str)) {\r\n\t\t$scan = glob(rtrim($str,'/').'/*');\r\n\t\tforeach($scan as $index=>$path) {\r\n\t\t\trecursiveDelete($path);\r\n\t\t}\r\n\t\treturn @rmdir($str);\r\n\t}\r\n}",
"public function delete($file, $recursive = \\false, $type = \\false)\n {\n }",
"public function delete($file, $recursive = \\false, $type = \\false)\n {\n }",
"public function delete($file, $recursive = \\false, $type = \\false)\n {\n }",
"public function delete($file, $recursive = \\false, $type = \\false)\n {\n }",
"public function delete($file, $recursive = \\false, $type = \\false)\n {\n }",
"function delete($path);",
"public static function rmdirRecursive(string $path) : File\n {\n return (new File($path))->rmdirRecursive();\n }",
"public function delete($path, $root = NULL) {\n\n if (is_null($root)) $root = $this->root;\n $response = $this->http_oauthed($this->api_url . 'fileops/delete', array('path' => $path, 'root' => $root));\n return json_decode($response);\n\n }",
"function delete($path)\n{\n if (is_dir($path) === true) {\n $files = array_diff(scandir($path), array('.', '..'));\n\n foreach ($files as $file) {\n delete(realpath($path) . '/' . $file);\n }\n\n return rmdir($path);\n } else if (is_file($path) === true) {\n return unlink($path);\n }\n\n return false;\n}",
"function delete($path)\n{\n if (is_dir($path) === true) {\n $files = array_diff(scandir($path), array('.', '..'));\n\n foreach ($files as $file) {\n delete(realpath($path) . '/' . $file);\n }\n\n return rmdir($path);\n } else if (is_file($path) === true) {\n return unlink($path);\n }\n\n return false;\n}",
"public static function delete($path){\r\n $currentDir = getcwd();\r\n $storageSubPath = \"/../../\".STORAGE_PATH;\r\n $file = $currentDir . $storageSubPath . '/' . $path;\r\n\r\n unlink($file);\r\n }",
"public function doDelete($path);",
"public function silo_delete($path)\n\t{\n\t}",
"public function silo_delete($path)\r\n\t{\r\n\t}",
"public static function deleteFolder(string $path, bool $recursive = false): bool\n\t{\n\t\tif (!is_dir($path) || !self::isAuthorizedPath($path))\n\t\t\treturn false;\n\n\t\tif (!$recursive)\n\t\t\treturn rmdir($path);\n\n\t\t$items = self::getFolder($path);\n\n\t\tforeach ($items as $name) {\n\t\t\t$pathname = \"$path/$name\";\n\n\t\t\tif (is_dir($pathname))\n\t\t\t\tself::deleteFolder($pathname);\n\t\t\telse\n\t\t\t\tunlink($pathname);\n\t\t}\n\n\t\treturn rmdir($path);\n\t}",
"public function remove($path);",
"public function removeDirectory($clientPath, $recursive, $handlerObj = NULL, $handlerMethod = NULL) {\n $this->_handlersRemoveDirectory[$clientPath] = ($handlerObj&&$handlerMethod ? array( $handlerObj, $handlerMethod ) : NULL);\n $this->callMethod( 'removeDirectory', array( $clientPath, (bool) $recursive ) );\n }",
"public static function delete($path)\r\n {\r\n foreach (new \\DirectoryIterator($path) as $filesInfo) {\r\n if ($filesInfo->isDot()) {\r\n continue;\r\n }\r\n \r\n if (is_dir($filesInfo->getPathname())) {\r\n self::delete($filesInfo->getPathname());\r\n rmdir($filesInfo->getPathname());\r\n }\r\n unlink($filesInfo->getPathname());\r\n }\r\n }",
"public static function remove($path)\n {\n // (array) Convert Traversable object to array\n if ($path instanceof Traversable) {\n $path = iterator_to_array($path, FALSE);\n }\n\n // Loop through each path to delete (convert string to array if needed)\n foreach ((array) $path as $p) {\n // Failed to delete file\n if (is_file($p) && ! @unlink($p)) {\n throw new RuntimeException('Cannot remove file: ' . $p);\n // Delete a directory\n } elseif (is_dir($p)) {\n // Try loosening file permissions before deleting\n @chmod($p, 0777);\n\n // (string) Normalize path\n $p = rtrim($p, '/\\\\');\n\n // [recursion] Must first delete all files in directory\n foreach (glob($p . '/{,.}[!.,!..]*', GLOB_MARK|GLOB_BRACE) as $sp) {\n static::remove($sp);\n }\n\n // Failed to delete directory\n if ( ! @rmdir($p)) {\n throw new RuntimeException('Cannot remove directory: ' . $p);\n }\n }\n }\n\n // Successful if no exceptions thrown\n return TRUE;\n }",
"public static function clear($s_path,$is_recursive = true,$is_file = true,$is_dir = true)\n {\n if(empty($s_path))\n return true;\n if($s_path[strlen($s_path)-1]=='/')\n $s_path = substr($s_path,0,strlen($s_path)-1);\n $has_file = false;\n if($r_dir = opendir($s_path))\n {\n while(($s_file = readdir($r_dir))!==false)\n {\n if($s_file=='.'||$s_file=='..')\n continue;\n if(is_dir($s_path.'/'.$s_file))\n {\n if($is_recursive)\n {\n if(static::clear($s_path.'/'.$s_file,true,$is_file))\n {\n if($is_dir)\n rmdir($s_path.'/'.$s_file);\n else\n $has_file = true;\n }\n else\n $has_file = true;\n }\n else\n $has_file = true;\n continue;\n }\n if($is_file)\n {\n if(!unlink($s_path.'/'.$s_file))\n $has_file = true;\n }\n else\n $has_file = true;\n }\n closedir($r_dir);\n }\n return !$has_file;\n }",
"function delete($image, $path) {\n\t\tif($path) {\n\t\t\t$path = $path.DS;\n\t\t}\n @unlink(Configure::read('__Site.upload_path').DS.$path.$image);\n\t}",
"public function delete($path)\n {\n $endpoint = 'https://api.dropboxapi.com/2/files/delete';\n $headers = [\n 'Content-Type: application/json'\n ];\n $postdata = json_encode(['path' => $path]);\n return Dropbox::postRequest($endpoint, $headers, $postdata);\n }",
"public function delete($path)\n {\n }",
"private function deleteFolderRecursively($path) {\n\t\t\t$path = self::folderPath($path);\n\t\t\t$handle = opendir($path);\n\t\t\t\n\t\t\tif (!$handle)\n\t\t\t\tthrow new ServiceException(\"REQUEST_FAILED\", \"Could not open directory for traversal (recurse): \".$path);\n\t\t \n\t\t while (false !== ($item = readdir($handle))) {\n\t\t\t\tif ($item != \".\" and $item != \"..\" ) {\n\t\t\t\t\t$fullpath = $path.$item;\n\t\n\t\t\t\t\tif (is_dir($fullpath)) {\n\t\t\t\t\t\t$this->deleteFolderRecursively($fullpath);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (!unlink($fullpath)) {\n\t\t\t\t\t\t\tclosedir($handle);\n\t\t\t\t\t\t\tthrow new ServiceException(\"REQUEST_FAILED\", \"Failed to remove file (recurse): \".$fullpath);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tclosedir($handle);\n\t\t\t\n\t\t\tif (!rmdir($path))\n\t\t\t\tthrow new ServiceException(\"REQUEST_FAILED\", \"Failed to remove directory (delete_directory_recurse): \".$path);\n\t\t}",
"public static function deleteFile ($path) {\n\t\t\\unlink($path);\n\t}"
] |
[
"0.77975637",
"0.6731399",
"0.66654307",
"0.66654307",
"0.66474277",
"0.6620933",
"0.6620933",
"0.6620933",
"0.66208696",
"0.66184694",
"0.6570786",
"0.639026",
"0.6366436",
"0.6351251",
"0.6351251",
"0.63443154",
"0.63084537",
"0.6296331",
"0.62851125",
"0.62797",
"0.62589467",
"0.6250027",
"0.623444",
"0.62268084",
"0.6223597",
"0.6204945",
"0.6196685",
"0.61897296",
"0.6178142",
"0.6166657"
] |
0.70951134
|
1
|
This functionality allows you to transfer a whole directorystructure from the remoteftp to your local host. You have to give a remotedirectory (ending with '/') and the local directory (ending with '/') where to put the files you download. The remote path is automatically completed with the currentremotedir, if you give a relative path to this function. You can give a relative path for the $local_path, too. Then the scriptbasedir will be used for comletion of the path. The parameter $overwrite will determine, whether to overwrite existing files or not. Standard for this is false. Fourth you can explicitly set a mode for all transfer actions done. If you do not set this, the method tries to determine the transfer mode by checking your modedirectory for the file extension. If the extension is not inside the modedirectory, it will get your default mode. Since 1.4 no error will be returned when a file exists while $overwrite is set to false.
|
function getRecursive($remote_path, $local_path, $overwrite = false, $mode = null) {
$remote_path = $this->_constructPath($remote_path);
if ( $this->_checkRemoteDir($remote_path) !== true ) {
throw new ftpGetRecursiveException("Given remote-path '$remote_path' seems not to be a directory.");
}
if ( !@file_exists($local_path) ) {
$res = @mkdir($local_path);
if ( !$res ) {
throw new ftpGetRecursiveException("Could not create dir '$local_path'");
}
} elseif ( !@is_dir($local_path) ) {
throw new ftpGetRecursiveException("Given local-path '$local_path' seems not to be a directory.");
}
$dir_list = array();
$dir_list = $this->ls($remote_path, self::LS_MODE_DIR_ONLY);
foreach ( $dir_list as $dir_entry ) {
if ( $dir_entry['name'] != '.' && $dir_entry['name'] != '..' ) {
$remote_path_new = $remote_path . $dir_entry["name"] . "/";
$local_path_new = $local_path . $dir_entry["name"] . "/";
$result = $this->getRecursive($remote_path_new, $local_path_new, $overwrite, $mode);
}
}
$file_list = array();
$file_list = $this->ls($remote_path, self::LS_MODE_FILES_ONLY);
foreach ( $file_list as $file_entry ) {
$remote_file = $remote_path . $file_entry["name"];
$local_file = $local_path . $file_entry["name"];
$result = $this->get($remote_file, $local_file, $overwrite, $mode);
}
return true;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function putRecursive($local_path, $remote_path, $overwrite = false, $mode = null) {\r\n\t\t$remote_path = $this->_constructPath($remote_path);\r\n\t\tif ( !file_exists($local_path) || !is_dir($local_path) ) {\r\n\t\t\tthrow new ftpPutRecursiveException(\"Given local-path '$local_path' seems not to be a directory.\");\r\n\t\t}\r\n\t\t// try to create directory if it doesn't exist\r\n\t\t$old_path = $this->pwd();\r\n\t\ttry {\r\n\t\t\t$this->cd($remote_path);\r\n\t\t} catch ( ftpException $e ) {\r\n\t\t\t$res = $this->mkdir($remote_path);\r\n\t\t}\r\n\t\t\r\n\t\t$this->cd($old_path);\r\n\t\tif ( $this->_checkRemoteDir($remote_path) !== true ) {\r\n\t\t\tthrow new ftpPutRecursiveException(\"Given remote-path '$remote_path' seems not to be a directory.\");\r\n\t\t}\r\n\t\t$dir_list = $this->_lsLocal($local_path);\r\n\t\tforeach ( $dir_list[\"dirs\"] as $dir_entry ) {\r\n\t\t\t// local directories do not have arrays as entry\r\n\t\t\t$remote_path_new = $remote_path . $dir_entry . \"/\";\r\n\t\t\t$local_path_new = $local_path . $dir_entry . \"/\";\r\n\t\t\t$result = $this->putRecursive($local_path_new, $remote_path_new, $overwrite, $mode);\r\n\t\t}\r\n\t\t\r\n\t\tforeach ( $dir_list[\"files\"] as $file_entry ) {\r\n\t\t\t$remote_file = $remote_path . $file_entry;\r\n\t\t\t$local_file = $local_path . $file_entry;\r\n\t\t\t$result = $this->put($local_file, $remote_file, $overwrite, $mode);\r\n\t\t}\r\n\t\treturn true;\r\n\t}",
"private function prv_ftp_put_dir($loc_dir, $rmt_dir, $isRecursive=TRUE, $useWhiteList=FALSE) {\n\t\t$dir = dir($loc_dir);\n\t\t\n\t\t// does $rmt_dir exist\n\t\tif ($this->isRmtDir($rmt_dir) === FALSE) {\n\t\t\techo \"\\nUnknown remote path specified...\\n\";\n\t\t\t$this->close();\n\t\t\texit(1);\n\t\t}\n\t\t\n\t\t // do this for each file in the directory\n\t\twhile ($file = $dir->read()) {\n\t\t\t\n\t\t\tif ($file != \".\" && $file != \"..\") { // to prevent an infinite loop\n\n\t\t\t\t// ignore chosen dirs\n\t\t\t\tif ($this->isIgnore($this->ignore, $rmt_dir.\"/\".$file) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (is_dir($loc_dir.\"/\".$file)) { // do the following if it is a directory\n\t\t\t\t\t\n\t\t\t\t\tif (!@ftp_chdir($this->conn_id, $rmt_dir.\"/\".$file)) {\n\t\t\t\t\t\t// create directories that do not yet exist\n\t\t\t\t\t\techo \"+:/ \".$rmt_dir.\"/\".$file.\"\\n\";\n\t\t\t\t\t\t$rtn_mkdir = ftp_mkdir($this->conn_id, $rmt_dir.\"/\".$file);\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ($rtn_mkdir === FALSE) {\n\t\t\t\t\t\t\techo \"\\nThere was an error uploading the directory...\\n\";\n\t\t\t\t\t\t\t$this->close();\n\t\t\t\t\t\t\texit(1);\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// recursive into next directory\n\t\t\t\t\t$this->prv_ftp_put_dir($loc_dir.\"/\".$file, $rmt_dir.\"/\".$file);\n\t\t\t\t\n\t\t\t\t} else {\n\t\t\t\t\techo '+>> '.$rmt_dir.\"/\".$file;\n\t\t\t\t\t$rtn_put = ftp_nb_put(\n\t\t\t\t\t\t\t$this->conn_id, \n\t\t\t\t\t\t\t$rmt_dir.\"/\".$file, \n\t\t\t\t\t\t\t$loc_dir.\"/\".$file, \n\t\t\t\t\t\t\t$this->ftp_trans_mode($file));\n\t\t\t\t\t\n\t\t\t\twhile ($rtn_put == FTP_MOREDATA) {\n\t\t\t\t\t// do whatever you want\n\t\t\t\t\techo '.';\n\t\t\t\t\t\n\t\t\t\t\t// continue downloading\n\t\t\t\t\t$rtn_put = ftp_nb_continue($this->conn_id);\n\t\t\t\t}\n\t\t\t\tif ($rtn_put != FTP_FINISHED) {\n\t\t\t\t\techo \"\\nThere was an error uploading the file...\\n\";\n\t\t\t\t\t$this->close();\n\t\t\t\t\texit(1);\n\t\t\t\t}\n\t\t\t\t\techo \"\\n\";\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t}",
"function ftpFiles($id, $archivo, $destino){\r\n\t//die(\"ftpFiles: $id - $archivo - $destino<br />\");\r\n\textract($GLOBALS);\r\n\t$aux = split(\"@\", $destino);\r\n\t$dir_crops = $aux[0] . \"/\";\r\n\t$server = $aux[1];\r\n\t$dir_id = calcularCarpeta($id) . \"/\";\r\n\t$auxFile = pathinfo($archivo);\r\n\t$localFile = $auxFile[\"basename\"];\r\n\t\r\n\tswitch($server){\r\n\t\tcase \"USA\": $dir_final = DIR_WP_USA;break;\t\t\r\n\t\tcase \"241\": $dir_final = DIR_WP_241;\tbreak;\r\n\t}\r\n\t\r\n\t$remoteFilePath = \"$dir_final$dir_crops$dir_id$localFile\";\r\n\tprint \"$dir_crops - $localFile creado!<br />\";\r\n\t//------------------ftp login---------------------------------------------------------------------------------\r\n\t$ftp = new Ftp($servers[$server][0], $servers[$server][1], $servers[$server][2]);\r\n\tif( !$ftp->login() ){\r\n\t\terror(\"No se pudo conectar al FTP: $server\", false);\r\n\t\tlimpiarCagadas($newId);\r\n\t};\r\n\t\r\n\tif( !$ftp->cambiarAcarpeta($dir_final . $dir_crops ) ){\r\n\t\tif( !$ftp->crearCarpeta( $dir_final . $dir_crops ) ){\r\n\t\t\terror(\"No se pudo crear la carpeta: $dir_final . $dir_crops\", false);\r\n\t\t\tlimpiarCagadas($newId);\r\n\t\t\tdie();\r\n\t\t}\r\n\t\t$ftp->cambiarAcarpeta($dir_final . $dir_crops);\r\n\t}\r\n\t\t\r\n\tif( !$ftp->cambiarAcarpeta( $dir_id ) ){\r\n\t\tif( !$ftp->crearCarpeta( $dir_id ) ){\r\n\t\t\tlimpiarCagadas($newId);\r\n\t\t\tdie(\"No se pudo crear la carpeta: \" . $dir_final . $dir_crops . $dir_id);\r\n\t\t}\r\n\t\t$ftp->cambiarAcarpeta( $dir_id );\r\n\t}\r\n\t\r\n\tif( !$ftp->subir( $archivo, $localFile) ){\r\n\t\tprint \"no se pudo subir ($archivo a $remoteFilePath en $server)\\n\";\r\n\t\terror(\"No se pudo subir $archivo a $remoteFilePath en $server\", false);\r\n\t\tlimpiarCagadas($newId);\r\n\t\tdie();\r\n\t}else{\r\n\t\t@unlink($archivo);\r\n\t\tprint $localFile . \" subido a: $server!!<br />\";\r\n\t}\r\n\r\n\t//$ftp->logout();\r\n\t//print \"$remoteFilePath@$server@$destino <br />\";\r\n\t$_SESSION['subidos'][] = \"$remoteFilePath@$server@$destino\";\r\n}",
"function put($remotefile, $localfile, $mode = 1)\r\n {\r\n if ($this->_use_mod_ftp) {\r\n \t\tftp_put($this->_socket, $remotefile, $localfile, $mode);\r\n \t} else {\r\n \tif ($mode) {\r\n \t\t$type = \"I\";\r\n \t} else {\r\n \t\t$type = \"A\";\r\n \t}\r\n \t\r\n \tif (!file_exists($localfile)) {\r\n \t\t$this->debug(\"Error : No such file or directory \\\"\".$localfile.\"\\\"\\n\");\r\n \t\t$this->debug(\"Error : PUT failed\\n\");\r\n \t\treturn FALSE;\r\n \t}\r\n \t\r\n \t$fp = @fopen($localfile, \"r\");\r\n \tif (!$fp) {\r\n \t\t$this->debug(\"Cannot read file \\\"\".$localfile.\"\\\"\\n\");\r\n \t\t$this->debug(\"Error : PUT failed\\n\");\r\n \t\treturn FALSE;\r\n \t}\r\n \t\r\n \t$this->putcmd(\"PASV\");\r\n \t$string = $this->getresp();\r\n \t\r\n \t$this->putcmd(\"TYPE\", $type);\r\n \t$this->getresp();\r\n \t\r\n \tif ($this->file_exists($remotefile)) {\r\n \t\t$this->debug(\"Warning : Remote file will be overwritten\\n\");\r\n \t}\r\n \t\r\n \t$this->putcmd(\"STOR\", $remotefile);\r\n \t\r\n \t$sock_data = $this->open_data_connection($string);\r\n \tif (!$sock_data) {\r\n \t\treturn FALSE;\r\n \t}\r\n \tif ($this->ok()) {\r\n \t\t$this->debug(\"Connected to remote host\\n\");\r\n \t} else {\r\n \t\t$this->debug(\"Cannot connect to remote host\\n\");\r\n \t\t$this->debug(\"Error : PUT failed\\n\");\r\n \t\treturn FALSE;\r\n \t}\r\n \t\r\n \t$this->debug(\"Storing local file \\\"\".$localfile.\"\\\" to remote file \\\"\".$remotefile.\"\\\"\\n\");\r\n \twhile (!feof($fp)) {\r\n \t\tfputs($sock_data, fread($fp, 4096));\r\n \t}\r\n \tfclose($fp);\r\n \t\r\n \t$this->close_data_connection($sock_data);\r\n \t}\r\n \treturn $this->ok();\r\n }",
"function stor($localPath,$remotePath)\n\t{\n\t\tlog(\"<h3>uploading $localPath</h3>\");\n\t\t\n\t\t\n\t\tif($this->pasv())\n\t\t{\n\t\t\t$this->sock_write(\"STOR $remotePath\");\n\t\t\tif($this->is_ok())\n\t\t\t{\n\t\t\t\t$fp = fopen($localPath,\"rb\");\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tif($fp)\n\t\t\t\t{\n\t\t\t\t\t\n\t\t\t\t\twhile(!feof($fp))\n\t\t\t\t\t{\n\t\t\t\t\t\t$s = fread($fp,4096);\n\t\t\t\t\t\tfwrite($this->data_sock,$s);\n\t\t\t\t\t}\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}",
"public function ftpDownload($localDir, $remoteDir) {\n\t\t\t$i = 0;\n\t\t\t//change the directory if not current\n\t\t\tif($remoteDir !== \".\") {\n\t\t\t\t$chdir = TRUE;\n\t\t\t\t\n\t\t\t\tif(!ftp_chdir($this->ftpConnection, $remoteDir)) {\n\t\t\t\t\t$this->system->addSyslog($this->name, \"Can't change ftp directory to '$remoteDir'.\");\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$chdir = FALSE;\n\t\t\t}\n\t\t\t\n\t\t\t$fileList = ftp_nlist($this->ftpConnection, \".\");\n\t\t\tsort($fileList);\n\t\t\t\n\t\t\tforeach($fileList as $file) {\n\t\t\t\tif($file === \".\" || $file === \"..\") {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(@ftp_chdir($this->ftpConnection, $file)) {\n\t\t\t\t\tftp_cdup($this->ftpConnection);\n\t\t\t\t\t\n\t\t\t\t\tmkdir($localDir . \"/$file\");\n\t\t\t\t\t\n\t\t\t\t\t//logovat vytvoreni adresare\n\t\t\t\t\t$this->system->addSyslog($this->name, \"Local directory '$file' created.\");\n\t\t\t\t\t\n\t\t\t\t\t$dir = $localDir . \"/\" . $file;\n\t\t\t\t\t\n\t\t\t\t\t$i += $this->ftpDownload($dir, $file);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif(ftp_get($this->ftpConnection, $localDir . \"/$file\", $file, FTP_BINARY)) {\n\t\t\t\t\t\t$i++;\n\t\t\t\t\t\t\n\t\t\t\t\t\t$this->system->addSyslog($this->name, \"File '$file' downloaded successfully.\");\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t$this->system->addSyslog($this->name, \"File '$file' download failed.\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t//return to previous directory before exit\n\t\t\tif($chdir) {\n\t\t\t\tftp_cdup($this->ftpConnection);\n\t\t\t}\n\t\t\t\n\t\t\treturn $i;\n\t\t}",
"function downloadFileThroughFtp(\n $username,\n $password,\n $host,\n $absolutePath,\n $localDirectoryPath )\n{\n $baseName = extractBaseNameFromPath( $absolutePath );\n\n $ftpStream = ftp_connect( $host );\n\n ftp_login( $ftpStream, $username, $password );\n ftp_pasv( $ftpStream, TRUE );\n\n $isFileDownloaded = writeLocalFileFromFtpStream(\n $baseName, $localDirectoryPath, $ftpStream, $absolutePath );\n\n ftp_close( $ftpStream );\n\n return $isFileDownloaded;\n}",
"function ftp_put_dir($loc_dir, $rmt_dir, $isRecursive=TRUE, $useWhiteList=FALSE) {\n\t\t$loc_dir = rtrim($loc_dir, '/');\n\t\t$rmt_dir = rtrim($rmt_dir, '/');\n\t\t\n\t\t$this->prv_ftp_put_dir($loc_dir, $rmt_dir, $isRecursive, $useWhiteList);\n\t}",
"function get($localfile, $remotefile, $mode = 1)\r\n {\r\n if ($this->_use_mod_ftp) {\r\n \t\tftp_get($this->_socket, $localfile, $remotefile, $mode);\r\n \t} else {\r\n \tif ($mode) {\r\n \t\t$type = \"I\";\r\n \t} else {\r\n \t\t$type = \"A\";\r\n \t}\r\n \t\r\n \tif (!$this->file_exists($remotefile)) {\r\n \t\t$this->debug(\"Error : No such file or directory \\\"\".$remotefile.\"\\\"\\n\");\r\n \t\t$this->debug(\"Error : GET failed\\n\");\r\n \t\treturn FALSE;\r\n \t}\r\n \t\r\n \tif (@file_exists($localfile)) {\r\n \t\t$this->debug(\"Warning : local file will be overwritten\\n\");\r\n \t} else {\r\n \t\tumask($this->_umask);\r\n \t}\r\n \t\r\n \t$fp = @fopen($localfile, \"w\");\r\n \tif (!$fp) {\r\n \t\t$this->debug(\"Error : Cannot create \\\"\".$localfile.\"\\\"\");\r\n \t\t$this->debug(\"Error : GET failed\\n\");\r\n \t\treturn FALSE;\r\n \t}\r\n \t\r\n \t$this->putcmd(\"PASV\");\r\n \t$string = $this->getresp();\r\n \t\r\n \t$this->putcmd(\"TYPE\", $type);\r\n \t$this->getresp();\r\n \t\r\n \t$this->putcmd(\"RETR\", $remotefile);\r\n \t\r\n \t$sock_data = $this->open_data_connection($string);\r\n \tif (!$sock_data) {\r\n \t\treturn FALSE;\r\n \t}\r\n \tif ($this->ok()) {\r\n \t\t$this->debug(\"Connected to remote host\\n\");\r\n \t} else {\r\n \t\t$this->debug(\"Cannot connect to remote host\\n\");\r\n \t\t$this->debug(\"Error : GET failed\\n\");\r\n \t\treturn FALSE;\r\n \t}\r\n \t\r\n \t$this->debug(\"Retrieving remote file \\\"\".$remotefile.\"\\\" to local file \\\"\".$localfile.\"\\\"\\n\");\r\n \twhile (!feof($sock_data)) {\r\n \t\tfputs($fp, fread($sock_data, 4096));\r\n \t}\r\n \tfclose($fp);\r\n \t\r\n \t$this->close_data_connection($sock_data);\r\n \t}\r\n \treturn $this->ok();\r\n }",
"public function download($url, $local_path = \"\", $local_name = \"\", $overwrite = false) {\r\n\t\tif (!preg_match(\"/^(https?|ftp):\\/\\//ims\", $url)) { trigger_error(\"download() expects parameter 1 to be http / ftp url\", E_USER_WARNING); }\r\n\t\telse {\r\n\t\t\t# initialize variables for current request\r\n\t\t\t$new_file = null;\r\n\t\t\t$tmp_file = tempnam(\"temp\", \"lc_\");\r\n\t\t\t$tmp_fp = fopen($tmp_file, \"w\");\r\n\t\t\t# temporary curl options for downloading file\r\n\t\t\t$old_options = array_merge(array(\"CURLOPT_FILE\" => fopen(\"php://stdout\", \"w\")), $this->options);\r\n\t\t\t$tmp_options = array(\"CURLOPT_CONNECTTIMEOUT\" => 30, \"CURLOPT_TIMEOUT\" => 600, \"CURLOPT_FILE\" => $tmp_fp);\r\n\t\t\t$this->set_opt($tmp_options);\r\n\t\t\t$this->exec($url);\r\n\t\t\t$http_code = curl_getinfo($this->ch, CURLINFO_HTTP_CODE);\r\n\t\t\t$tmp_type = curl_getinfo($this->ch, CURLINFO_CONTENT_TYPE);\r\n\t\t\tfclose($tmp_fp);\r\n\t\t\t$this->set_opt($old_options);\r\n\t\t\tif ($http_code >= 400) { trigger_error(\"server response {$http_code} when trying to access '\".$this->hide_credential($url).\"'\", E_USER_WARNING); }\r\n\t\t\telse {\r\n\t\t\t\t# find the best matching local path for downloaded file\r\n\t\t\t\tif (empty($local_path)) { $local_path = rtrim(getcwd(), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.\"temp\"; }\r\n\t\t\t\telse {\r\n\t\t\t\t\t$local_path = rtrim($local_path, DIRECTORY_SEPARATOR);\r\n\t\t\t\t\tif (substr($local_path, 0, 2) == \".\".DIRECTORY_SEPARATOR) { $local_path = rtrim(getcwd(), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.substr($local_path, 2); }\t\t\t# fix relative path\r\n\t\t\t\t}\r\n\t\t\t\t# find the best matching file name for downloaded file\r\n\t\t\t\tif (empty($local_name)) {\r\n\t\t\t\t\tif (!empty($this->header_vars[$this->location_idx][\"content-disposition\"])) {\r\n\t\t\t\t\t\tpreg_match(\"/filename\\s*=\\s*([^;]+)[;\\s]/imsU\", $this->header_vars[$this->location_idx][\"content-disposition\"], $matches);\r\n\t\t\t\t\t\tif (!empty($matches[1])) { $local_name = trim($matches[1], \" '\\\"\"); }\t\t\t\t\t\t\t\t\t# (name + ext) first priority in http header\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (empty($local_name)) {\r\n\t\t\t\t\t\t$pathinfo = pathinfo(parse_url($url, PHP_URL_PATH));\r\n\t\t\t\t\t\tif (!empty($pathinfo[\"filename\"])) { $local_name = $pathinfo[\"filename\"]; }\t\t\t\t\t\t\t\t# (name) failover to file name in target url\r\n\t\t\t\t\t\telse { $local_name = pathinfo($tmp_file, PATHINFO_FILENAME); }\t\t\t\t\t\t\t\t\t\t\t# (name) lastly use temp file name\r\n\t\t\t\t\t\tif (!empty($pathinfo[\"extension\"])) { $local_name .= \".\".$pathinfo[\"extension\"]; }\t\t\t\t\t\t# (ext) find file extension in target url\r\n\t\t\t\t\t\telseif (!empty($tmp_type)) { $local_name .= \".\".str_replace(\"/\", \".\", $tmp_type); }\t\t\t\t\t\t# (ext) failover to content type in http header as descriptive extension\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t# move file only if file has content\r\n\t\t\t\tif (filesize($tmp_file) > 0) {\r\n\t\t\t\t\t$new_file = $local_path.DIRECTORY_SEPARATOR.$local_name;\r\n\t\t\t\t\tif (file_exists($new_file) && !$overwrite) {\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# add unix timestamp to the end of file name\r\n\t\t\t\t\t\t$pathinfo = pathinfo($new_file);\r\n\t\t\t\t\t\t$local_name = $pathinfo[\"filename\"].\"_\".time().((!empty($pathinfo[\"extension\"])) ? \".\".$pathinfo[\"extension\"] : \"\");\r\n\t\t\t\t\t\t$new_file = $local_path.DIRECTORY_SEPARATOR.$local_name;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (!$this->is_writable($new_file)) { trigger_error(\"no write permission to access '{$new_file}'\", E_USER_WARNING); }\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\tif (is_resource($tmp_fp)) { fclose($tmp_fp); }\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# workaround for php 5.3.0 on windows\r\n\t\t\t\t\t\trename($tmp_file, $new_file);\r\n\t\t\t\t\t\tchmod($new_file, 0644);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (file_exists($tmp_file) && ($tmp_file != $new_file)) { unlink($tmp_file); }\r\n\t\t\tif (file_exists($new_file) && $this->is_writable($new_file)) {\r\n\t\t\t\t$this->data = \"\";\r\n\t\t\t\treturn $new_file;\r\n\t\t\t}\r\n\t\t}\r\n\t\t$this->data = \"\";\r\n\t\treturn false;\r\n\t}",
"private function copyServerFile($src, $des){\n /* \n if(ftp_chdir($this->conn, $src)){\n $rawList = ftp_nlist($conn, \".\"); \n if (!in_array($destDir, $rawList)) \n { \n ftp_mkdir($conn, $destDir); \n //@ftp_chmod($conn, 0777, $image_dir); \n }\n }\n \n $files = ftp_nlist($this->ftp_conn, $path);\n foreach ($files as $file)\n {\n $this->delete($path.'/'.$file);\n }\n return $this->delete($path);\n\n $srcDir = $this->fieldarray['sourceItemId']; \n $destDir = $this->fieldarray['itemId']; \n $localDir = PUBLIC_PATH . 'photos/' . $this->fieldarray['imageType'] . '/original/' . $this->fieldarray['itemId']; \n \n if ($conn = ftp_connect(PHOTO_SERVER)) \n { \n if (ftp_login($conn, PHOTO_SERVER_USER, PHOTO_SERVER_PW)) \n { \n ftp_pasv($conn, true); \n if (ftp_chdir($conn, PHOTO_SERVER_UPLOAD_DIR)) \n { \n $rawList = ftp_nlist($conn, \".\"); \n if (!in_array($destDir, $rawList)) \n { \n ftp_mkdir($conn, $destDir); \n //@ftp_chmod($conn, 0777, $image_dir); \n } \n \n $files = ftp_nlist($conn, $srcDir); \n foreach ($files as $file) \n { \n if ($file != \".\" && $file != \"..\") \n { \n $srcFile = PHOTO_SERVER_FTP_GET_SRC_DIR . '/' . $srcDir . '/' . $file; \n $localFile = $localDir . '/' . $file; \n \n if (ftp_get($conn, $localFile, $srcFile, FTP_BINARY)) \n { \n $upload = ftp_put($conn, $destDir . \"/\" . $file, $localFile, FTP_BINARY); \n } \n } \n } \n } \n }\n }*/\n }",
"function Pico_FTPWritable($directory)\n{\n\t$path = explode('/', trim($directory, '/'));\n\t$start_path = getcwd();\n\n\t// get it at the beginning\n\t$ftp = Pico_GetFTPObject();\n\n\twhile ($folder = array_shift($path))\n\t{\n\t\tif (!is_dir($folder))\n\t\t{\n\t\t\t// make the folder\n\n\t\t\t// just make if parent happens to already be writable\n\t\t\t// this will help sites with no ftp\n\t\t\tif (is_writable(getcwd())) \n\t\t\t{\n\t\t\t\tmkdir($folder); \n\t\t\t\tchmod($folder, 0777);\n\t\t\t} \n\t\t\telse\n\t\t\t{\n\t\t\t\t// make it with ftp\n\t\t\t\tif ($ftp == false) { return false; }\n\n\t\t\t\ttry \n\t\t\t\t{\n\t\t\t\t\t$ftp->mkdir($folder);\n\t\t\t\t} \n\t\t\t\tcatch (Exception $e) \n\t\t\t\t{\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!is_dir($folder)) { return false; }\n\t\t}\n\n\t\t// only 777 the LAST folder\n\t\tif ( (sizeof($path) == 0) and (!is_writable($folder)) )\n\t\t{\n\t\t\tif (is_writable(getcwd()))\n\t\t\t{\n\t\t\t\tchmod($folder, 0777);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif ($ftp == false) { return false; }\n\n\t\t\t\ttry \n\t\t\t\t{\n\t\t\t\t\t$ftp->chmod($folder, 0777);\t\n\t\t\t\t} \n\t\t\t\tcatch (Exception $e) \n\t\t\t\t{\n\t\t\t\t\treturn false;\n\t\t\t\t}\t\n\t\t\t}\n\t\t}\n\n\t\t// change into the folder so we can do the next folder up\n\t\ttry\n\t\t{\n\t\t\tif (is_object($ftp)) { $ftp->chdir($folder); }\n\t\t}\n\t\tcatch (Exception $e)\n\t\t{\n\t\t\t$error_msg = $e->getMessage();\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\tchdir($folder);\n\t}\n\n\t// go back to start, if we got this far all is well\n\tchdir($start_path);\n\treturn true;\n}",
"function put($local_file, $remote_file, $overwrite = false, $mode = null, $options = 0) {\r\n\t\tif ( $options & (self::PUT_BLOCKING | self::PUT_NONBLOCKING) === (self::PUT_BLOCKING | self::PUT_NONBLOCKING) ) {\r\n\t\t\tthrow new ftpPutOptionsException();\r\n\t\t}\r\n\t\t\r\n\t\t$usenb = !($options & (self::PUT_BLOCKING == self::PUT_BLOCKING));\r\n\t\t\r\n\t\tif ( !isset($mode) ) {\r\n\t\t\t$mode = $this->checkFileExtension($local_file);\r\n\t\t}\r\n\t\t$remote_file = $this->_constructPath($remote_file);\r\n\t\t\r\n\t\tif ( !@file_exists($local_file) ) {\r\n\t\t\tthrow new ftpPutLocalFileDoesNotExistException($local_file);\r\n\t\t}\r\n\t\tif ( (@ftp_size($this->_handle, $remote_file) != -1) && !$overwrite ) {\r\n\t\t\tthrow new ftpPutRemoteFileExistsNoOverwriteException($remote_file);\r\n\t\t}\r\n\t\t\r\n\t\tif ( function_exists('ftp_alloc') ) {\r\n\t\t\tftp_alloc($this->_handle, filesize($local_file));\r\n\t\t}\r\n\t\tif ( $usenb && function_exists('ftp_nb_put') ) {\r\n\t\t\t$res = @ftp_nb_put($this->_handle, $remote_file, $local_file, $mode);\r\n\t\t\twhile ( $res == FTP_MOREDATA ) {\r\n\t\t\t\t$this->notify('nb_put');\r\n\t\t\t\t$res = @ftp_nb_continue($this->_handle);\r\n\t\t\t}\r\n\t\t\r\n\t\t} else {\r\n\t\t\t$res = @ftp_put($this->_handle, $remote_file, $local_file, $mode);\r\n\t\t}\r\n\t\tif ( !$res ) {\r\n\t\t\tthrow new ftpPutException(\"File '$local_file' could not be uploaded to '\" . $remote_file . \"'.\");\r\n\t\t} else {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}",
"function _ftp_chdir($dir)\n\t{\n\t\t// Calculate \"real\" (absolute) FTP path\n\t\t$realdir = substr($this->_initdir, -1) == '/' ? substr($this->_initdir, 0, strlen($this->_initdir) - 1) : $this->_initdir;\n\t\t$realdir .= '/'.$dir;\n\t\t$realdir = substr($realdir, 0, 1) == '/' ? $realdir : '/'.$realdir;\n\n\t\tif($this->_currentdir == $realdir)\n\t\t{\n\t\t\t// Already there, do nothing\n\t\t\treturn true;\n\t\t}\n\n\t\t$result = @ftp_chdir($this->_ftphandle, $realdir);\n\t\tif($result === false)\n\t\t{\n\t\t\t// The directory doesn't exist, let's try to create it...\n\t\t\tif(!$this->_makeDirectory($dir)) return false;\n\t\t\t// After creating it, change into it\n\t\t\t@ftp_chdir($this->_ftphandle, $realdir);\n\t\t}\n\n\t\t// Update the private \"current remote directory\" variable\n\t\t$this->_currentdir = $realdir;\n\t\treturn true;\n\t}",
"function get($remote_file, $local_file, $overwrite = false, $mode = null) {\r\n\t\tif ( $mode === null ) {\r\n\t\t\t$mode = $this->checkFileExtension($remote_file);\r\n\t\t}\r\n\t\t\r\n\t\t$remote_file = $this->_constructPath($remote_file);\r\n\t\t\r\n\t\tif ( @file_exists($local_file) && !$overwrite ) {\r\n\t\t\tthrow new ftpGetLocalFileExistsException($local_file);\r\n\t\t}\r\n\t\tif ( @file_exists($local_file) && !@is_writeable($local_file) && $overwrite ) {\r\n\t\t\tthrow new ftpGetLocalFileNotWritableException($local_file);\r\n\t\t}\r\n\t\t\r\n\t\tif ( @function_exists('ftp_nb_get') ) {\r\n\t\t\t$res = @ftp_nb_get($this->_handle, $local_file, $remote_file, $mode);\r\n\t\t\twhile ( $res == FTP_MOREDATA ) {\r\n\t\t\t\t$this->notify('nb_get');\r\n\t\t\t\t$res = @ftp_nb_continue($this->_handle);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t$res = @ftp_get($this->_handle, $local_file, $remote_file, $mode);\r\n\t\t}\r\n\t\tif ( !$res ) {\r\n\t\t\tthrow new ftpGetException(\"File '\" . $remote_file . \"' could not be downloaded to '$local_file'.\");\r\n\t\t} else {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}",
"abstract public function copyLocalDir($from, $to);",
"private function _iocUnzipAndFtpSend($source, $destination) {\n if (($dir = @opendir($source))) {\n $ret = TRUE;\n while ($file = readdir($dir)) {\n if ($file!==\".\" && $file!==\"..\") {\n if (is_dir(\"$source$file\")) {\n $ret = $ret && $this->_iocUnzipAndFtpSend(\"$source$file/\", \"$destination$file/\");\n }else{\n $ret = $ret && $this->uploadFile($file, $source, $file, $destination);\n }\n }\n }\n }\n return $ret;\n }",
"public function cd($path)\n {\n // Go to root folder\n if (!ftp_chdir($this->handle, $path)) {\n return $this->log('Remote folder[##] not found', $path);\n }\n\n // Check if we can write there\n if (!$this->isWritable()) {\n return $this->log('Remote path [##] is not writable', $path);\n }\n\n $this->log('Switching to [##] folder', $path);\n\n // Store current folder\n $this->currentFolder = ftp_pwd($this->handle);\n\n return true;\n }",
"function ftp_get_dir($loc_dir, $rmt_dir, $isRecursive=TRUE, $useWhiteList=FALSE, $debug=FALSE) {\n\t\t$loc_dir = rtrim($loc_dir, '/');\n\t\t$rmt_dir = rtrim($rmt_dir, '/');\n\t\t\n\t\t$this->prv_ftp_get_dir($loc_dir, $rmt_dir, $isRecursive, $useWhiteList, $debug);\n\t}",
"private function uploadFile($local_file, $source, $remote_file, $remote_dir) {\n if (($fh = fopen(\"$source$local_file\", \"rb\"))) {\n $buffer = fread($fh, 4096);\n fclose($fh);\n }\n if (empty($buffer))\n throw new Exception(\"Could not open local file: $source$local_file.\");\n\n $fh = fopen(\"$source$local_file\", \"rb\");\n if ($fh) {\n $maxBytes = WikiGlobalConfig::getConf('maxVarLengthFTP', 'wikiiocmodel');\n $remote_dir = \"/\".trim($remote_dir,\"/\").\"/\";\n ssh2_sftp_mkdir($this->sftp, $remote_dir, 0777, TRUE);\n\n $stream = @fopen(\"ssh2.sftp://{$this->sftp}$remote_dir$remote_file\", 'w');\n if (! $stream)\n throw new Exception(\"Could not open remote file: $remote_dir$remote_file\");\n\n while (! feof($fh)) {\n $data_to_send = @fread($fh, $maxBytes); //Llegir 1 MB\n if (@fwrite($stream, $data_to_send) === false)\n throw new Exception(\"Could not send data from file: $source$local_file.\");\n }\n $ret = fclose($stream);\n fclose($fh);\n }\n //Logger::debug(\"FtpSender::uploadFile-end: \\$ret=$ret\", 0, __LINE__, basename(__FILE__), 1);\n return $ret;\n }",
"public function upload($localFile, $remoteFile)\n\t{\n\t\t$this->initScp();\n\n\t\tif (is_dir($localFile)) {\n\t\t\t$localDir = rtrim($localFile, '/') . '/';\n\t\t\t$remoteDir = rtrim($remoteFile, '/') . '/';\n\n\t\t\t$this->exec('mkdir -p ' . $remoteDir);\n\n\t\t\t$files = array_diff(scandir($localDir), array('.', '..'));\n\t\t\tforeach ($files as $file) {\n\t\t\t\t$this->upload($localDir . $file, $remoteDir . $file);\n\t\t\t}\n\t\t} else {\n\t\t\treturn $this->scp->put($remoteFile, $localFile, NET_SCP_LOCAL_FILE);\n\t\t}\n\t}",
"function setFileContent($db, $file, $localFilePath)\n{\n $storageType = 'local';\n $storageLocation = LOCAL_STORAGE_DEFAULT_PATH;\n $uploadServerDetails = loadServer($db, $file);\n if ($uploadServerDetails != false)\n {\n $storageLocation = $uploadServerDetails['storagePath'];\n $storageType = $uploadServerDetails['serverType'];\n\n // if no storage path set & local, use system default\n if ((strlen($storageLocation) == 0) && ($storageType == 'local'))\n {\n $storageLocation = LOCAL_STORAGE_DEFAULT_PATH;\n }\n\n if ($storageType == 'direct')\n {\n $storageLocation = LOCAL_STORAGE_DEFAULT_PATH;\n }\n }\n\n // get subfolder\n $subFolder = current(explode(\"/\", $file['localFilePath']));\n $originalFilename = end(explode(\"/\", $file['localFilePath']));\n\n // use ssh to get contents of 'local' files\n if (($storageType == 'local') || ($storageType == 'direct'))\n {\n // get remote file path\n $remoteFilePath = $storageLocation . $file['localFilePath'];\n // first try setting the file locally\n $done = false;\n if ((ON_SCRIPT_INSTALL == true) && file_exists($remoteFilePath))\n {\n $done = copy($localFilePath, $remoteFilePath);\n if ($done)\n {\n return true;\n }\n }\n\n // try over ssh\n if ($done == false)\n {\n\t\t\t$sshHost = LOCAL_STORAGE_SSH_HOST;\n\t\t\t$sshUser = LOCAL_STORAGE_SSH_USER;\n\t\t\t$sshPass = LOCAL_STORAGE_SSH_PASS;\n\n\t\t\t// if 'direct' file server, get SSH details\n\t\t\t$serverDetails = getDirectFileServerSSHDetails($file['serverId']);\n\t\t\tif($serverDetails)\n\t\t\t{\n\t\t\t\t$sshHost = $serverDetails['ssh_host'];\n $sshPort = $serverDetails['ssh_port'];\n\t\t\t\t$sshUser = $serverDetails['ssh_username'];\n\t\t\t\t$sshPass = $serverDetails['ssh_password'];\n\t\t\t\t$basePath = $serverDetails['file_storage_path'];\n\t\t\t\tif(substr($basePath, strlen($basePath)-1, 1) == '/')\n\t\t\t\t{\n\t\t\t\t\t$basePath = substr($basePath, 0, strlen($basePath)-1);\n\t\t\t\t}\n\t\t\t\t$remoteFilePath = $basePath . '/' . $file['localFilePath'];\n\t\t\t}\n \n if(strlen($sshPort) == 0)\n {\n $sshPort = 22;\n }\n\t\t\t\n // connect to 'local' storage via SSH\n $sftp = new Net_SFTP($sshHost, $sshPort);\n if (!$sftp->login($sshUser, $sshPass))\n {\n output(\"Error: Failed logging into \" . $sshHost . \" (Port: \".$sshPort.\") via SSH..\\n\");\n\n return false;\n }\n\n // overwrite file\n $rs = $sftp->put($remoteFilePath, $localFilePath, NET_SFTP_LOCAL_FILE);\n if ($rs)\n {\n return true;\n }\n\n output(\"Error: Failed uploading converted file to \" . LOCAL_STORAGE_SSH_HOST . \" (\" . $remoteFilePath . \") via SSH..\\n\");\n }\n\n return false;\n }\n\n // ftp\n if ($storageType == 'ftp')\n {\n // setup full path\n $prePath = $uploadServerDetails['storagePath'];\n if (substr($prePath, strlen($prePath) - 1, 1) == '/')\n {\n $prePath = substr($prePath, 0, strlen($prePath) - 1);\n }\n $remoteFilePath = $prePath . '/' . $file['localFilePath'];\n\n // connect via ftp\n $conn_id = ftp_connect($uploadServerDetails['ipAddress'], $uploadServerDetails['ftpPort'], 30);\n if ($conn_id === false)\n {\n output('Could not connect to ' . $uploadServerDetails['ipAddress'] . ' to upload file.');\n return false;\n }\n\n // authenticate\n $login_result = ftp_login($conn_id, $uploadServerDetails['ftpUsername'], $uploadServerDetails['ftpPassword']);\n if ($login_result === false)\n {\n output('Could not login to ' . $uploadServerDetails['ipAddress'] . ' with supplied credentials.');\n return false;\n }\n\n // get content\n $rs = ftp_put($conn_id, $remoteFilePath, $localFilePath, FTP_BINARY);\n if ($rs == true)\n {\n return true;\n }\n }\n\n output(\"Error: Failed uploading converted file to \" . $uploadServerDetails['ipAddress'] . \" via FTP..\\n\");\n\n return false;\n}",
"function ftp_file($source_file, $dest_file, $mimetype, $disable_error_mode = false)\n{\n\tglobal $config, $lang, $error, $error_msg;\n\n\t$conn_id = attach_init_ftp();\n\n\t// Binary or Ascii ?\n\t$mode = FTP_BINARY;\n\tif (preg_match(\"/text/i\", $mimetype) || preg_match(\"/html/i\", $mimetype))\n\t{\n\t\t$mode = FTP_ASCII;\n\t}\n\n\t$res = @ftp_put($conn_id, $dest_file, $source_file, $mode);\n\n\tif (!$res && !$disable_error_mode)\n\t{\n\t\t$error = true;\n\t\tif (!empty($error_msg))\n\t\t{\n\t\t\t$error_msg .= '<br />';\n\t\t}\n\t\t$error_msg = sprintf($lang['Ftp_error_upload'], $config['ftp_path']) . '<br />';\n\t\t@ftp_quit($conn_id);\n\t\treturn false;\n\t}\n\n\tif (!$res)\n\t{\n\t\treturn false;\n\t}\n\n\t@ftp_site($conn_id, 'CHMOD 0644 ' . $dest_file);\n\t@ftp_quit($conn_id);\n\treturn true;\n}",
"function FTPupload($origen,$destino='',$borrar=true){\n\t#origen: donde esta la imagen. destino: donde ira la imagen.\n\t#borrar: falso si no se quiere eliminar la imagen original\n\t#las rutas deben ser relativas a img. si destino es vacio o false, se colocara en la misma ruta del origen\n\t//validaciones previas\n\tglobal $config;\n\tif(!is_file(\"$config->relpath/img/$origen\")) return \"404 file $config->relpath/img/$origen not found\";\n\tglobal $config;\n\t$error=0;\n\tif($destino=='') $destino=$origen;\n\t$file=end(explode('/',$destino));\n\tif(!$file) $error=400;\n\t$path=isset($config->ftp->folder)?$config->ftp->folder.'/':'';\n\t$path.=dirname($destino);\n\t$data=\" P:$path F:$file O:$origen D:$destino\";\n\tif(!$error)\n\tif(isset($config->ftp)){\n\t\tif(!isset($img_ftp_con)){\n\t\t\t$img_ftp_con=ftp_connect($config->ftp->host,isset($config->ftp->port)?$config->ftp->port:21);\n\t\t\t$login=@ftp_login($img_ftp_con,$config->ftp->user,$config->ftp->pass);\n\t\t\tif(!$login){\n\t\t\t\t$img_ftp_con=0;\n\t\t\t\treturn 403;\n\t\t\t}\n\t\t\tftp_pasv($img_ftp_con,true);\n\t\t}\n\t\t#vamos a la carpeta raiz\n\t\t// ftp_cdup($img_ftp_con);\n\t\t#Nos vamos a la carpeta destino. Se crean las carpetas que no existan.\n\t\t$foldercount=0;\n\t\t$folders=explode('/',$path);\n\t\tforeach($folders as $folder){\n\t\t\tif($folder!=''){\n\t\t\t\tif(@ftp_chdir($img_ftp_con,$folder)){#abrir carpeta\n\t\t\t\t\t$foldercount++;\n\t\t\t\t}elseif(@ftp_mkdir($img_ftp_con,$folder)){#crear y abrir carpeta\n\t\t\t\t\tftp_chdir($img_ftp_con,$folder);\n\t\t\t\t\t$foldercount++;\n\t\t\t\t\t@ftp_put($img_ftp_con,'index.html',RELPATH.'img/index.html',FTP_BINARY);\n\t\t\t\t}else{\n\t\t\t\t\t$error=412;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(!$error){\n\t\t\t$data=' PWD:'.ftp_pwd($img_ftp_con).$data;\n\t\t\t#Copiamos el archivo\n\t\t\t$error=(@ftp_put($img_ftp_con,$file,RELPATH.'img/'.$origen,FTP_BINARY)) ? 200 : 401;\n\t\t\t#Borramos la imagen de origen si es requerido\n\t\t\tif($borrar&&$error==200&&!@unlink(RELPATH.'img/'.$origen)) $error=206;\n\t\t}\n\t\tftp_quit($img_ftp_con);\n\t// }elseif(!$config->local){\n\t\t#Si no es local movemos al servidor de imagenes\n\t}else{\n\t\t#movemos al servidor de imagenes\n\t\t$_origen=RELPATH.'img/'.$origen;\n\t\t$_destino=$config->img_server_path.'img/'.$destino;\n\t\t$data.=\"<br>FO: $_origen FD: $_destino\";\n\t\tif(!is_dir($config->img_server_path.'img/'.$path))\n\t\t\tif(!@mkdir($config->img_server_path.'img/'.$path,0775,true)) $error=412;\n\t\tif(!$error)\n\t\tif($borrar)\n\t\t\t$error=(!@rename($_origen,$_destino))?408:200;\n\t\telse\n\t\t\t$error=(!@copy($_origen,$_destino))?409:200;\n/*\t}elseif($destino!=$origen){\n\t\t#Cuando no es ftp, y el origen es distinto al destino, se mueve/copia el archivo\n\t\tif(!is_dir(RELPATH.'img/'.$path))\n\t\t\tif(!@mkdir(RELPATH.'img/'.$path,0777,true)) $error=412;\n\t\tif(!$error)\n\t\tif($borrar)\n\t\t\t$error=(!@rename(RELPATH.'img/'.$origen,RELPATH.'img/'.$destino))?408:200;\n\t\telse\n\t\t\t$error=(!@copy(RELPATH.'img/'.$origen,RELPATH.'img/'.$destino))?409:200;\n*/\t}\n\treturn $error.$data;#descomentar data si decea ver los mensajes de error\n}",
"public function move_backup_in($working_dir, $dest_dir, $preserve_existing = 1, $do_not_overwrite = array('plugins', 'themes', 'uploads', 'upgrade'), $type = 'not-others', $send_actions = false, $force_local = false) {\n\n\t\tglobal $wp_filesystem, $updraftplus;\n\t\t$updraft_dir = $updraftplus->backups_dir_location();\n\n\t\tif (true == $force_local) {\n\t\t\t$wpfs = new UpdraftPlus_WP_Filesystem_Direct(true);\n\t\t} else {\n\t\t\t$wpfs = $wp_filesystem;\n\t\t}\n\n\t\t// Get the content to be moved in. Include hidden files = true. Recursion is only required if we're likely to copy-in\n\t\t$recursive = (self::MOVEIN_COPY_IN_CONTENTS == $preserve_existing) ? true : false;\n\t\t$upgrade_files = $wpfs->dirlist($working_dir, true, $recursive);\n\n\t\tif (empty($upgrade_files)) return true;\n\n\t\t// check if our path is a file by looking to see if it's in the list of files we want to restore, if it is then remove the file from the path\n\t\tif (isset($upgrade_files[basename($dest_dir)]) && 'f' == $upgrade_files[basename($dest_dir)]['type']) $dest_dir = trailingslashit(dirname($dest_dir));\n\t\t\n\t\tif (!$wpfs->is_dir($dest_dir)) {\n\t\t\tif ($wpfs->is_dir(dirname($dest_dir))) {\n\t\t\t\tif (!$wpfs->mkdir($dest_dir, FS_CHMOD_DIR)) return new WP_Error('mkdir_failed', __('The directory does not exist, and the attempt to create it failed', 'updraftplus') . ' (' . $dest_dir . ')');\n\t\t\t\t$updraftplus->log(\"Destination directory did not exist, but was successfully created ($dest_dir)\");\n\t\t\t} else {\n\t\t\t\treturn new WP_Error('no_such_dir', __('The directory does not exist', 'updraftplus') . \" ($dest_dir)\");\n\t\t\t}\n\t\t}\n\n\t\t$wpcore_config_moved = false;\n\n\t\tif ('plugins' == $type || 'themes' == $type) $updraftplus->log(\"Top-level entities being moved: \".implode(', ', array_keys($upgrade_files)));\n\n\t\tforeach ($upgrade_files as $file => $filestruc) {\n\n\t\t\tif (empty($file)) continue;\n\n\t\t\tif ($dest_dir.$file == $updraft_dir) {\n\t\t\t\t$updraftplus->log('Skipping attempt to replace updraft_dir whilst processing '.$type);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Correctly restore files in 'others' in no directory that were wrongly backed up in versions 1.4.0 - 1.4.48\n\t\t\tif (('others' == $type || 'wpcore' == $type) && preg_match('/^([\\-_A-Za-z0-9]+\\.php)$/i', $file, $matches) && $wpfs->exists($working_dir . \"/$file/$file\")) {\n\t\t\t\tif ('others' == $type) {\n\t\t\t\t\t$updraftplus->log(\"Found file: $file/$file: presuming this is a backup with a known fault (backup made with versions 1.4.0 - 1.4.48, and sometimes up to 1.6.55 on some Windows servers); will rename to simply $file\", 'notice-restore');\n\t\t\t\t} else {\n\t\t\t\t\t$updraftplus->log(\"Found file: $file/$file: presuming this is a backup with a known fault (backup made with versions before 1.6.55 in certain situations on Windows servers); will rename to simply $file\", 'notice-restore');\n\t\t\t\t}\n\t\t\t\t$updraftplus->log(\"$file/$file: rename to $file\");\n\t\t\t\t$file = $matches[1];\n\t\t\t\t$tmp_file = rand(0, 999999999).'.php';\n\t\t\t\t// Rename directory\n\t\t\t\tif (!$wpfs->move($working_dir . \"/$file\", $working_dir . \"/\".$tmp_file, true)) {\n\t\t\t\t\t$this->restore_log_permission_failure_message($working_dir, 'Move '. $working_dir . \"/$file -> \".$working_dir . \"/\".$tmp_file, 'Destination');\n\t\t\t\t}\n\t\t\t\tif (!$wpfs->move($working_dir . \"/$tmp_file/$file\", $working_dir .\"/\".$file, true)) {\n\t\t\t\t\t$this->restore_log_permission_failure_message($working_dir, 'Move '.$working_dir . \"/$tmp_file/$file -> \".$working_dir .\"/\".$file, 'Destination');\n\t\t\t\t}\n\t\t\t\tif (!$wpfs->rmdir($working_dir . \"/$tmp_file\", false)) {\n\t\t\t\t\t$this->restore_log_permission_failure_message($working_dir, 'Delete '.$working_dir . \"/$tmp_file\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ('wp-config.php' == $file && 'wpcore' == $type) {\n\t\t\t\tif (empty($this->restore_options['updraft_restorer_wpcore_includewpconfig'])) {\n\t\t\t\t\t$updraftplus->log_e('wp-config.php from backup: will restore as wp-config-backup.php', 'updraftplus');\n\t\t\t\t\tif (!$wpfs->move($working_dir . \"/$file\", $working_dir . \"/wp-config-backup.php\", true)) {\n\t\t\t\t\t\t$this->restore_log_permission_failure_message($working_dir, 'Move '.$working_dir . \"/$file -> \".$working_dir . \"/wp-config-backup.php\", 'Destination');\n\t\t\t\t\t}\n\t\t\t\t\t$file = \"wp-config-backup.php\";\n\t\t\t\t\t$wpcore_config_moved = true;\n\t\t\t\t} else {\n\t\t\t\t\t$updraftplus->log_e(\"wp-config.php from backup: restoring (as per user's request)\", 'updraftplus');\n\t\t\t\t}\n\t\t\t} elseif ('wpcore' == $type && 'wp-config-backup.php' == $file && $wpcore_config_moved) {\n\t\t\t\t// The file is already gone; nothing to do\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Sanity check (should not be possible as these were excluded at backup time)\n\t\t\tif (in_array($file, $do_not_overwrite)) continue;\n\n\t\t\tif (('object-cache.php' == $file || 'advanced-cache.php' == $file) && 'others' == $type) {\n\t\t\t\tif (false == apply_filters('updraftplus_restorecachefiles', true, $file)) {\n\t\t\t\t\t$nfile = preg_replace('/\\.php$/', '-backup.php', $file);\n\t\t\t\t\tif (!$wpfs->move($working_dir . \"/$file\", $working_dir . \"/\" .$nfile, true)) {\n\t\t\t\t\t\t$this->restore_log_permission_failure_message($working_dir, 'Move '. $working_dir . '/' . $file .' -> '.$working_dir . '/' . $nfile, 'Destination');\n\t\t\t\t\t}\n\t\t\t\t\t$file = $nfile;\n\t\t\t\t}\n\t\t\t} elseif (('object-cache-backup.php' == $file || 'advanced-cache-backup.php' == $file) && 'others' == $type) {\n\t\t\t\tif (!$wpfs->delete($working_dir.\"/\".$file)) {\n\t\t\t\t\t$this->restore_log_permission_failure_message($working_dir, 'Delete '.$working_dir.\"/\".$file);\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// First, move the existing one, if necessary (may not be present)\n\t\t\tif ($wpfs->exists($dest_dir.$file)) {\n\t\t\t\tif (self::MOVEIN_MAKE_BACKUP_OF_EXISTING == $preserve_existing) {\n\t\t\t\t\tif (!$wpfs->move($dest_dir.$file, $dest_dir.$file.'-old', true)) {\n\t\t\t\t\t\t$this->restore_log_permission_failure_message($dest_dir, 'Move '. $dest_dir.$file.' -> '.$dest_dir.$file.'-old', 'Destination');\n\t\t\t\t\t\treturn new WP_Error('old_move_failed', $this->strings['old_move_failed'].\" ($dest_dir$file)\");\n\t\t\t\t\t}\n\t\t\t\t} elseif (self::MOVEIN_OVERWRITE_NO_BACKUP == $preserve_existing) {\n\t\t\t\t\tif (!$wpfs->delete($dest_dir.$file, true)) {\n\t\t\t\t\t\t$this->restore_log_permission_failure_message($dest_dir, 'Delete '.$dest_dir.$file);\n\t\t\t\t\t\treturn new WP_Error('old_delete_failed', $this->strings['old_delete_failed'].\" ($file)\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\t// Secondly, move in the new one\n\t\t\t$is_dir = $wpfs->is_dir($working_dir.\"/\".$file);\n\n\t\t\tif (self::MOVEIN_DO_NOTHING_IF_EXISTING == $preserve_existing && $wpfs->exists($dest_dir.$file)) {\n\t\t\t\t// Something exists - no move. Remove it from the temporary directory - so that it will be clean later\n\t\t\t\t@$wpfs->delete($working_dir.'/'.$file, true);// phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged\n\t\t\t// The $is_dir check was added in version 1.11.18; without this, files in the top-level that weren't in the first archive didn't get over-written\n\t\t\t} elseif (self::MOVEIN_COPY_IN_CONTENTS != $preserve_existing || !$wpfs->exists($dest_dir.$file) || !$is_dir) {\n\n\t\t\t\tif ($wpfs->move($working_dir.\"/\".$file, $dest_dir.$file, true)) {\n\t\t\t\t\tif ($send_actions) do_action('updraftplus_restored_'.$type.'_one', $file);\n\t\t\t\t\t// Make sure permissions are at least as great as those of the parent\n\t\t\t\t\tif ($is_dir) {\n\t\t\t\t\t\t// This method is broken due to https://core.trac.wordpress.org/ticket/26598\n\t\t\t\t\t\tif (empty($chmod)) $chmod = octdec(sprintf(\"%04d\", $this->get_current_chmod($dest_dir, $wpfs)));// phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable\n\t\t\t\t\t\tif (!empty($chmod)) $this->chmod_if_needed($dest_dir.$file, $chmod, false, $wpfs);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t$this->restore_log_permission_failure_message($dest_dir, 'Move '. $working_dir.\"/\".$file.\" -> \".$dest_dir.$file, 'Destination');\n\t\t\t\t\treturn new WP_Error('move_failed', $this->strings['move_failed'], $working_dir.\"/\".$file.\" -> \".$dest_dir.$file);\n\t\t\t\t}\n\t\t\t} elseif (self::MOVEIN_COPY_IN_CONTENTS == $preserve_existing && !empty($filestruc['files'])) {\n\t\t\t\t// The directory ($dest_dir) already exists, and we've been requested to copy-in. We need to perform the recursive copy-in\n\t\t\t\t// $filestruc['files'] is then a new structure like $upgrade_files\n\t\t\t\t// First pass: create directory structure\n\t\t\t\t// Get chmod value for the parent directory, and re-use it (instead of passing false)\n\n\t\t\t\t// This method is broken due to https://core.trac.wordpress.org/ticket/26598\n\t\t\t\tif (empty($chmod)) $chmod = octdec(sprintf(\"%04d\", $this->get_current_chmod($dest_dir, $wpfs)));\n\t\t\t\t// Copy in the files. This also needs to make sure the directories exist, in case the zip file lacks entries\n\t\t\t\t$delete_root = ('others' == $type || 'wpcore' == $type) ? false : true;\n\n\t\t\t\t$copy_in = $this->copy_files_in($working_dir.'/'.$file, $dest_dir.$file, $filestruc['files'], $chmod, $delete_root);\n\t\t\t\tif (!empty($chmod)) $this->chmod_if_needed($dest_dir.$file, $chmod, false, $wpfs);\n\n\t\t\t\tif (is_wp_error($copy_in) || !$copy_in) {\n\t\t\t\t\t$this->restore_log_permission_failure_message($dest_dir, 'Move '. $working_dir.\"/\".$file.\" -> \".$dest_dir.$file, 'Destination');\n\t\t\t\t}\n\t\t\t\tif (is_wp_error($copy_in)) return $copy_in;\n\t\t\t\tif (!$copy_in) return new WP_Error('move_failed', $this->strings['move_failed'], \"(2) \".$working_dir.'/'.$file.\" -> \".$dest_dir.$file);\n\n\t\t\t\tif (!$wpfs->rmdir($working_dir.'/'.$file)) {\n\t\t\t\t\t$this->restore_log_permission_failure_message($working_dir, 'Delete '.$working_dir.'/'.$file);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (!$wpfs->rmdir($working_dir.'/'.$file)) {\n\t\t\t\t\t$this->restore_log_permission_failure_message($working_dir, 'Delete '.$working_dir.'/'.$file);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\n\t}",
"public function repo($dir, $remote);",
"function FTPupload($origen,$destino='',$borrar=true,&$id_ftp=false){\n\t//colocar ruta relativa de origen y destino, incluyendo carpetas.\n\t//si se omite destino se copia con la misma ruta del origen.\n\t//por defecto se elimina la imagen original\n\tif($destino=='') $destino=$origen;\n\t$count=preg_match('/(.+\\/)*/',$destino,$path);\n\tif(!NOFPT){\n\t\tif(!$id_ftp){\n\t\t\t$id_ftp=ftp_connect(FTPSERVER,21);\n\t\t\tftp_login($id_ftp,FTPACCOUNT,FTPPASS);\n\t\t\tftp_pasv($id_ftp,false);\n\t\t}\n\t\t//Movilizacion a subcarpetas. Si no existen las crea.\n\t\t//$count=preg_match('/(.+\\/)(.+\\/)*/',$path[1],$path);\n\t\t$path=$path[1];\n\t\twhile(($pos=strpos($path,'/'))!==false){\n\t\t\t$folder=substr($path,0,$pos);\n\t\t\t@ftp_mkdir($id_ftp,$folder);\n\t\t\tif(ftp_chdir($id_ftp,$folder)){\n\t\t\t\t@ftp_put($id_ftp,'index.html',RELPATH.'img/index.html',FTP_BINARY);\n\t\t\t}else{\n\t\t\t\tftp_quit($id_ftp);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t$path=substr($path,$pos+1);\n\t\t}\n\t\t$file=end(explode('/',$destino));\n\t\tif($file!=''){\n\t\t\tftp_put($id_ftp,$file,RELPATH.'img/'.$origen,FTP_BINARY);\n\t\t\tftp_quit($id_ftp);\n\t\t}\n\t\tif($borrar){\n\t\t\t@unlink(RELPATH.$origen);\n\t\t}\n\t}elseif($destino!=$origen){\n\t\tmkdir(substr($path[1],0,-1),0777,true);\n\t\tif($borrar)\n\t\t\trename(RELPATH.'img/'.$origen,RELPATH.'img/'.$destino);\n\t\telse\n\t\t\tcopy(RELPATH.'img/'.$origen,RELPATH.'img/'.$destino);\n\t}\n}",
"function transfer()\n\t{\n\t\tglobal $phpbb_root_path;\n\n\t\t$this->file_perms\t= 0644;\n\t\t$this->dir_perms\t= 0777;\n\n\t\t// We use the store directory as temporary path to circumvent open basedir restrictions\n\t\t$this->tmp_path = $phpbb_root_path . 'store/';\n\t}",
"abstract function upload($locpath, $rempath, $mode = 'auto', $permissions = NULL);",
"function fput($remotefile, $fp, $mode = 1)\r\n {\r\n if ($this->_use_mod_ftp) {\r\n \t\tftp_fput($this->_socket, $remotefile, $fp, $mode);\r\n \t} else {\r\n \tif ($mode) {\r\n \t\t$type = \"I\";\r\n \t} else {\r\n \t\t$type = \"A\";\r\n \t}\r\n \t\r\n \t$this->putcmd(\"PASV\");\r\n \t$string = $this->getresp();\r\n \t\r\n \t$this->putcmd(\"TYPE\", $type);\r\n \t$this->getresp();\r\n \t\r\n \tif ($this->file_exists($remotefile)) {\r\n \t\t$this->debug(\"Warning : Remote file will be overwritten\\n\");\r\n \t}\r\n \t\r\n \t$this->putcmd(\"STOR\", $remotefile);\r\n \t\r\n \t$sock_data = $this->open_data_connection($string);\r\n \tif (!$sock_data) {\r\n \t\treturn FALSE;\r\n \t}\r\n \tif ($this->ok()) {\r\n \t\t$this->debug(\"Connected to remote host\\n\");\r\n \t} else {\r\n \t\t$this->debug(\"Cannot connect to remote host\\n\");\r\n \t\t$this->debug(\"Error : PUT failed\\n\");\r\n \t\treturn FALSE;\r\n \t}\r\n \t\r\n \t$this->debug(\"Storing local file to remote file \\\"\".$remotefile.\"\\\"\\n\");\r\n \twhile (!feof($fp)) {\r\n \t\tfputs($sock_data, fread($fp, 4096));\r\n \t}\r\n \t\r\n \t$this->close_data_connection($sock_data);\r\n \t}\r\n \treturn $this->ok();\r\n }"
] |
[
"0.704996",
"0.6385157",
"0.6246431",
"0.60614157",
"0.59130377",
"0.5825603",
"0.57816327",
"0.56919616",
"0.5660841",
"0.56599873",
"0.5652505",
"0.5612076",
"0.5551456",
"0.5546748",
"0.5536973",
"0.5508493",
"0.5396458",
"0.537932",
"0.53686416",
"0.5363926",
"0.53615993",
"0.5297933",
"0.5284042",
"0.5277264",
"0.5267269",
"0.5236632",
"0.5216502",
"0.5209419",
"0.5193629",
"0.5193303"
] |
0.6890301
|
1
|
This functionality allows you to transfer a whole directorystructure from your local host to the remoteftp. You have to give a remotedirectory (ending with '/') and the local directory (ending with '/') where to put the files you download. The remote path is automatically completed with the currentremotedir, if you give a relative path to this function. You can give a relative path for the $local_path, too. Then the scriptbasedir will be used for comletion of the path. The parameter $overwrite will determine, whether to overwrite existing files or not. Standard for this is false. Fourth you can explicitly set a mode for all transfer actions done. If you do not set this, the method tries to determine the transfer mode by checking your modedirectory for the fileextension. If the extension is not inside the modedirectory, it will get your default mode.
|
function putRecursive($local_path, $remote_path, $overwrite = false, $mode = null) {
$remote_path = $this->_constructPath($remote_path);
if ( !file_exists($local_path) || !is_dir($local_path) ) {
throw new ftpPutRecursiveException("Given local-path '$local_path' seems not to be a directory.");
}
// try to create directory if it doesn't exist
$old_path = $this->pwd();
try {
$this->cd($remote_path);
} catch ( ftpException $e ) {
$res = $this->mkdir($remote_path);
}
$this->cd($old_path);
if ( $this->_checkRemoteDir($remote_path) !== true ) {
throw new ftpPutRecursiveException("Given remote-path '$remote_path' seems not to be a directory.");
}
$dir_list = $this->_lsLocal($local_path);
foreach ( $dir_list["dirs"] as $dir_entry ) {
// local directories do not have arrays as entry
$remote_path_new = $remote_path . $dir_entry . "/";
$local_path_new = $local_path . $dir_entry . "/";
$result = $this->putRecursive($local_path_new, $remote_path_new, $overwrite, $mode);
}
foreach ( $dir_list["files"] as $file_entry ) {
$remote_file = $remote_path . $file_entry;
$local_file = $local_path . $file_entry;
$result = $this->put($local_file, $remote_file, $overwrite, $mode);
}
return true;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function getRecursive($remote_path, $local_path, $overwrite = false, $mode = null) {\r\n\t\t$remote_path = $this->_constructPath($remote_path);\r\n\t\tif ( $this->_checkRemoteDir($remote_path) !== true ) {\r\n\t\t\tthrow new ftpGetRecursiveException(\"Given remote-path '$remote_path' seems not to be a directory.\");\r\n\t\t}\r\n\t\t\r\n\t\tif ( !@file_exists($local_path) ) {\r\n\t\t\t$res = @mkdir($local_path);\r\n\t\t\tif ( !$res ) {\r\n\t\t\t\tthrow new ftpGetRecursiveException(\"Could not create dir '$local_path'\");\r\n\t\t\t}\r\n\t\t} elseif ( !@is_dir($local_path) ) {\r\n\t\t\tthrow new ftpGetRecursiveException(\"Given local-path '$local_path' seems not to be a directory.\");\r\n\t\t}\r\n\t\t\r\n\t\t$dir_list = array();\r\n\t\t$dir_list = $this->ls($remote_path, self::LS_MODE_DIR_ONLY);\r\n\t\t\r\n\t\tforeach ( $dir_list as $dir_entry ) {\r\n\t\t\tif ( $dir_entry['name'] != '.' && $dir_entry['name'] != '..' ) {\r\n\t\t\t\t$remote_path_new = $remote_path . $dir_entry[\"name\"] . \"/\";\r\n\t\t\t\t$local_path_new = $local_path . $dir_entry[\"name\"] . \"/\";\r\n\t\t\t\t$result = $this->getRecursive($remote_path_new, $local_path_new, $overwrite, $mode);\r\n\t\t\t}\r\n\t\t}\r\n\t\t$file_list = array();\r\n\t\t$file_list = $this->ls($remote_path, self::LS_MODE_FILES_ONLY);\r\n\t\t\r\n\t\tforeach ( $file_list as $file_entry ) {\r\n\t\t\t$remote_file = $remote_path . $file_entry[\"name\"];\r\n\t\t\t$local_file = $local_path . $file_entry[\"name\"];\r\n\t\t\t$result = $this->get($remote_file, $local_file, $overwrite, $mode);\r\n\t\t}\r\n\t\treturn true;\r\n\t}",
"private function prv_ftp_put_dir($loc_dir, $rmt_dir, $isRecursive=TRUE, $useWhiteList=FALSE) {\n\t\t$dir = dir($loc_dir);\n\t\t\n\t\t// does $rmt_dir exist\n\t\tif ($this->isRmtDir($rmt_dir) === FALSE) {\n\t\t\techo \"\\nUnknown remote path specified...\\n\";\n\t\t\t$this->close();\n\t\t\texit(1);\n\t\t}\n\t\t\n\t\t // do this for each file in the directory\n\t\twhile ($file = $dir->read()) {\n\t\t\t\n\t\t\tif ($file != \".\" && $file != \"..\") { // to prevent an infinite loop\n\n\t\t\t\t// ignore chosen dirs\n\t\t\t\tif ($this->isIgnore($this->ignore, $rmt_dir.\"/\".$file) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (is_dir($loc_dir.\"/\".$file)) { // do the following if it is a directory\n\t\t\t\t\t\n\t\t\t\t\tif (!@ftp_chdir($this->conn_id, $rmt_dir.\"/\".$file)) {\n\t\t\t\t\t\t// create directories that do not yet exist\n\t\t\t\t\t\techo \"+:/ \".$rmt_dir.\"/\".$file.\"\\n\";\n\t\t\t\t\t\t$rtn_mkdir = ftp_mkdir($this->conn_id, $rmt_dir.\"/\".$file);\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ($rtn_mkdir === FALSE) {\n\t\t\t\t\t\t\techo \"\\nThere was an error uploading the directory...\\n\";\n\t\t\t\t\t\t\t$this->close();\n\t\t\t\t\t\t\texit(1);\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// recursive into next directory\n\t\t\t\t\t$this->prv_ftp_put_dir($loc_dir.\"/\".$file, $rmt_dir.\"/\".$file);\n\t\t\t\t\n\t\t\t\t} else {\n\t\t\t\t\techo '+>> '.$rmt_dir.\"/\".$file;\n\t\t\t\t\t$rtn_put = ftp_nb_put(\n\t\t\t\t\t\t\t$this->conn_id, \n\t\t\t\t\t\t\t$rmt_dir.\"/\".$file, \n\t\t\t\t\t\t\t$loc_dir.\"/\".$file, \n\t\t\t\t\t\t\t$this->ftp_trans_mode($file));\n\t\t\t\t\t\n\t\t\t\twhile ($rtn_put == FTP_MOREDATA) {\n\t\t\t\t\t// do whatever you want\n\t\t\t\t\techo '.';\n\t\t\t\t\t\n\t\t\t\t\t// continue downloading\n\t\t\t\t\t$rtn_put = ftp_nb_continue($this->conn_id);\n\t\t\t\t}\n\t\t\t\tif ($rtn_put != FTP_FINISHED) {\n\t\t\t\t\techo \"\\nThere was an error uploading the file...\\n\";\n\t\t\t\t\t$this->close();\n\t\t\t\t\texit(1);\n\t\t\t\t}\n\t\t\t\t\techo \"\\n\";\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t}",
"function ftpFiles($id, $archivo, $destino){\r\n\t//die(\"ftpFiles: $id - $archivo - $destino<br />\");\r\n\textract($GLOBALS);\r\n\t$aux = split(\"@\", $destino);\r\n\t$dir_crops = $aux[0] . \"/\";\r\n\t$server = $aux[1];\r\n\t$dir_id = calcularCarpeta($id) . \"/\";\r\n\t$auxFile = pathinfo($archivo);\r\n\t$localFile = $auxFile[\"basename\"];\r\n\t\r\n\tswitch($server){\r\n\t\tcase \"USA\": $dir_final = DIR_WP_USA;break;\t\t\r\n\t\tcase \"241\": $dir_final = DIR_WP_241;\tbreak;\r\n\t}\r\n\t\r\n\t$remoteFilePath = \"$dir_final$dir_crops$dir_id$localFile\";\r\n\tprint \"$dir_crops - $localFile creado!<br />\";\r\n\t//------------------ftp login---------------------------------------------------------------------------------\r\n\t$ftp = new Ftp($servers[$server][0], $servers[$server][1], $servers[$server][2]);\r\n\tif( !$ftp->login() ){\r\n\t\terror(\"No se pudo conectar al FTP: $server\", false);\r\n\t\tlimpiarCagadas($newId);\r\n\t};\r\n\t\r\n\tif( !$ftp->cambiarAcarpeta($dir_final . $dir_crops ) ){\r\n\t\tif( !$ftp->crearCarpeta( $dir_final . $dir_crops ) ){\r\n\t\t\terror(\"No se pudo crear la carpeta: $dir_final . $dir_crops\", false);\r\n\t\t\tlimpiarCagadas($newId);\r\n\t\t\tdie();\r\n\t\t}\r\n\t\t$ftp->cambiarAcarpeta($dir_final . $dir_crops);\r\n\t}\r\n\t\t\r\n\tif( !$ftp->cambiarAcarpeta( $dir_id ) ){\r\n\t\tif( !$ftp->crearCarpeta( $dir_id ) ){\r\n\t\t\tlimpiarCagadas($newId);\r\n\t\t\tdie(\"No se pudo crear la carpeta: \" . $dir_final . $dir_crops . $dir_id);\r\n\t\t}\r\n\t\t$ftp->cambiarAcarpeta( $dir_id );\r\n\t}\r\n\t\r\n\tif( !$ftp->subir( $archivo, $localFile) ){\r\n\t\tprint \"no se pudo subir ($archivo a $remoteFilePath en $server)\\n\";\r\n\t\terror(\"No se pudo subir $archivo a $remoteFilePath en $server\", false);\r\n\t\tlimpiarCagadas($newId);\r\n\t\tdie();\r\n\t}else{\r\n\t\t@unlink($archivo);\r\n\t\tprint $localFile . \" subido a: $server!!<br />\";\r\n\t}\r\n\r\n\t//$ftp->logout();\r\n\t//print \"$remoteFilePath@$server@$destino <br />\";\r\n\t$_SESSION['subidos'][] = \"$remoteFilePath@$server@$destino\";\r\n}",
"function put($remotefile, $localfile, $mode = 1)\r\n {\r\n if ($this->_use_mod_ftp) {\r\n \t\tftp_put($this->_socket, $remotefile, $localfile, $mode);\r\n \t} else {\r\n \tif ($mode) {\r\n \t\t$type = \"I\";\r\n \t} else {\r\n \t\t$type = \"A\";\r\n \t}\r\n \t\r\n \tif (!file_exists($localfile)) {\r\n \t\t$this->debug(\"Error : No such file or directory \\\"\".$localfile.\"\\\"\\n\");\r\n \t\t$this->debug(\"Error : PUT failed\\n\");\r\n \t\treturn FALSE;\r\n \t}\r\n \t\r\n \t$fp = @fopen($localfile, \"r\");\r\n \tif (!$fp) {\r\n \t\t$this->debug(\"Cannot read file \\\"\".$localfile.\"\\\"\\n\");\r\n \t\t$this->debug(\"Error : PUT failed\\n\");\r\n \t\treturn FALSE;\r\n \t}\r\n \t\r\n \t$this->putcmd(\"PASV\");\r\n \t$string = $this->getresp();\r\n \t\r\n \t$this->putcmd(\"TYPE\", $type);\r\n \t$this->getresp();\r\n \t\r\n \tif ($this->file_exists($remotefile)) {\r\n \t\t$this->debug(\"Warning : Remote file will be overwritten\\n\");\r\n \t}\r\n \t\r\n \t$this->putcmd(\"STOR\", $remotefile);\r\n \t\r\n \t$sock_data = $this->open_data_connection($string);\r\n \tif (!$sock_data) {\r\n \t\treturn FALSE;\r\n \t}\r\n \tif ($this->ok()) {\r\n \t\t$this->debug(\"Connected to remote host\\n\");\r\n \t} else {\r\n \t\t$this->debug(\"Cannot connect to remote host\\n\");\r\n \t\t$this->debug(\"Error : PUT failed\\n\");\r\n \t\treturn FALSE;\r\n \t}\r\n \t\r\n \t$this->debug(\"Storing local file \\\"\".$localfile.\"\\\" to remote file \\\"\".$remotefile.\"\\\"\\n\");\r\n \twhile (!feof($fp)) {\r\n \t\tfputs($sock_data, fread($fp, 4096));\r\n \t}\r\n \tfclose($fp);\r\n \t\r\n \t$this->close_data_connection($sock_data);\r\n \t}\r\n \treturn $this->ok();\r\n }",
"public function ftpDownload($localDir, $remoteDir) {\n\t\t\t$i = 0;\n\t\t\t//change the directory if not current\n\t\t\tif($remoteDir !== \".\") {\n\t\t\t\t$chdir = TRUE;\n\t\t\t\t\n\t\t\t\tif(!ftp_chdir($this->ftpConnection, $remoteDir)) {\n\t\t\t\t\t$this->system->addSyslog($this->name, \"Can't change ftp directory to '$remoteDir'.\");\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$chdir = FALSE;\n\t\t\t}\n\t\t\t\n\t\t\t$fileList = ftp_nlist($this->ftpConnection, \".\");\n\t\t\tsort($fileList);\n\t\t\t\n\t\t\tforeach($fileList as $file) {\n\t\t\t\tif($file === \".\" || $file === \"..\") {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(@ftp_chdir($this->ftpConnection, $file)) {\n\t\t\t\t\tftp_cdup($this->ftpConnection);\n\t\t\t\t\t\n\t\t\t\t\tmkdir($localDir . \"/$file\");\n\t\t\t\t\t\n\t\t\t\t\t//logovat vytvoreni adresare\n\t\t\t\t\t$this->system->addSyslog($this->name, \"Local directory '$file' created.\");\n\t\t\t\t\t\n\t\t\t\t\t$dir = $localDir . \"/\" . $file;\n\t\t\t\t\t\n\t\t\t\t\t$i += $this->ftpDownload($dir, $file);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif(ftp_get($this->ftpConnection, $localDir . \"/$file\", $file, FTP_BINARY)) {\n\t\t\t\t\t\t$i++;\n\t\t\t\t\t\t\n\t\t\t\t\t\t$this->system->addSyslog($this->name, \"File '$file' downloaded successfully.\");\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t$this->system->addSyslog($this->name, \"File '$file' download failed.\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t//return to previous directory before exit\n\t\t\tif($chdir) {\n\t\t\t\tftp_cdup($this->ftpConnection);\n\t\t\t}\n\t\t\t\n\t\t\treturn $i;\n\t\t}",
"function ftp_put_dir($loc_dir, $rmt_dir, $isRecursive=TRUE, $useWhiteList=FALSE) {\n\t\t$loc_dir = rtrim($loc_dir, '/');\n\t\t$rmt_dir = rtrim($rmt_dir, '/');\n\t\t\n\t\t$this->prv_ftp_put_dir($loc_dir, $rmt_dir, $isRecursive, $useWhiteList);\n\t}",
"function stor($localPath,$remotePath)\n\t{\n\t\tlog(\"<h3>uploading $localPath</h3>\");\n\t\t\n\t\t\n\t\tif($this->pasv())\n\t\t{\n\t\t\t$this->sock_write(\"STOR $remotePath\");\n\t\t\tif($this->is_ok())\n\t\t\t{\n\t\t\t\t$fp = fopen($localPath,\"rb\");\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tif($fp)\n\t\t\t\t{\n\t\t\t\t\t\n\t\t\t\t\twhile(!feof($fp))\n\t\t\t\t\t{\n\t\t\t\t\t\t$s = fread($fp,4096);\n\t\t\t\t\t\tfwrite($this->data_sock,$s);\n\t\t\t\t\t}\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}",
"function Pico_FTPWritable($directory)\n{\n\t$path = explode('/', trim($directory, '/'));\n\t$start_path = getcwd();\n\n\t// get it at the beginning\n\t$ftp = Pico_GetFTPObject();\n\n\twhile ($folder = array_shift($path))\n\t{\n\t\tif (!is_dir($folder))\n\t\t{\n\t\t\t// make the folder\n\n\t\t\t// just make if parent happens to already be writable\n\t\t\t// this will help sites with no ftp\n\t\t\tif (is_writable(getcwd())) \n\t\t\t{\n\t\t\t\tmkdir($folder); \n\t\t\t\tchmod($folder, 0777);\n\t\t\t} \n\t\t\telse\n\t\t\t{\n\t\t\t\t// make it with ftp\n\t\t\t\tif ($ftp == false) { return false; }\n\n\t\t\t\ttry \n\t\t\t\t{\n\t\t\t\t\t$ftp->mkdir($folder);\n\t\t\t\t} \n\t\t\t\tcatch (Exception $e) \n\t\t\t\t{\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!is_dir($folder)) { return false; }\n\t\t}\n\n\t\t// only 777 the LAST folder\n\t\tif ( (sizeof($path) == 0) and (!is_writable($folder)) )\n\t\t{\n\t\t\tif (is_writable(getcwd()))\n\t\t\t{\n\t\t\t\tchmod($folder, 0777);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif ($ftp == false) { return false; }\n\n\t\t\t\ttry \n\t\t\t\t{\n\t\t\t\t\t$ftp->chmod($folder, 0777);\t\n\t\t\t\t} \n\t\t\t\tcatch (Exception $e) \n\t\t\t\t{\n\t\t\t\t\treturn false;\n\t\t\t\t}\t\n\t\t\t}\n\t\t}\n\n\t\t// change into the folder so we can do the next folder up\n\t\ttry\n\t\t{\n\t\t\tif (is_object($ftp)) { $ftp->chdir($folder); }\n\t\t}\n\t\tcatch (Exception $e)\n\t\t{\n\t\t\t$error_msg = $e->getMessage();\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\tchdir($folder);\n\t}\n\n\t// go back to start, if we got this far all is well\n\tchdir($start_path);\n\treturn true;\n}",
"public function download($url, $local_path = \"\", $local_name = \"\", $overwrite = false) {\r\n\t\tif (!preg_match(\"/^(https?|ftp):\\/\\//ims\", $url)) { trigger_error(\"download() expects parameter 1 to be http / ftp url\", E_USER_WARNING); }\r\n\t\telse {\r\n\t\t\t# initialize variables for current request\r\n\t\t\t$new_file = null;\r\n\t\t\t$tmp_file = tempnam(\"temp\", \"lc_\");\r\n\t\t\t$tmp_fp = fopen($tmp_file, \"w\");\r\n\t\t\t# temporary curl options for downloading file\r\n\t\t\t$old_options = array_merge(array(\"CURLOPT_FILE\" => fopen(\"php://stdout\", \"w\")), $this->options);\r\n\t\t\t$tmp_options = array(\"CURLOPT_CONNECTTIMEOUT\" => 30, \"CURLOPT_TIMEOUT\" => 600, \"CURLOPT_FILE\" => $tmp_fp);\r\n\t\t\t$this->set_opt($tmp_options);\r\n\t\t\t$this->exec($url);\r\n\t\t\t$http_code = curl_getinfo($this->ch, CURLINFO_HTTP_CODE);\r\n\t\t\t$tmp_type = curl_getinfo($this->ch, CURLINFO_CONTENT_TYPE);\r\n\t\t\tfclose($tmp_fp);\r\n\t\t\t$this->set_opt($old_options);\r\n\t\t\tif ($http_code >= 400) { trigger_error(\"server response {$http_code} when trying to access '\".$this->hide_credential($url).\"'\", E_USER_WARNING); }\r\n\t\t\telse {\r\n\t\t\t\t# find the best matching local path for downloaded file\r\n\t\t\t\tif (empty($local_path)) { $local_path = rtrim(getcwd(), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.\"temp\"; }\r\n\t\t\t\telse {\r\n\t\t\t\t\t$local_path = rtrim($local_path, DIRECTORY_SEPARATOR);\r\n\t\t\t\t\tif (substr($local_path, 0, 2) == \".\".DIRECTORY_SEPARATOR) { $local_path = rtrim(getcwd(), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.substr($local_path, 2); }\t\t\t# fix relative path\r\n\t\t\t\t}\r\n\t\t\t\t# find the best matching file name for downloaded file\r\n\t\t\t\tif (empty($local_name)) {\r\n\t\t\t\t\tif (!empty($this->header_vars[$this->location_idx][\"content-disposition\"])) {\r\n\t\t\t\t\t\tpreg_match(\"/filename\\s*=\\s*([^;]+)[;\\s]/imsU\", $this->header_vars[$this->location_idx][\"content-disposition\"], $matches);\r\n\t\t\t\t\t\tif (!empty($matches[1])) { $local_name = trim($matches[1], \" '\\\"\"); }\t\t\t\t\t\t\t\t\t# (name + ext) first priority in http header\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (empty($local_name)) {\r\n\t\t\t\t\t\t$pathinfo = pathinfo(parse_url($url, PHP_URL_PATH));\r\n\t\t\t\t\t\tif (!empty($pathinfo[\"filename\"])) { $local_name = $pathinfo[\"filename\"]; }\t\t\t\t\t\t\t\t# (name) failover to file name in target url\r\n\t\t\t\t\t\telse { $local_name = pathinfo($tmp_file, PATHINFO_FILENAME); }\t\t\t\t\t\t\t\t\t\t\t# (name) lastly use temp file name\r\n\t\t\t\t\t\tif (!empty($pathinfo[\"extension\"])) { $local_name .= \".\".$pathinfo[\"extension\"]; }\t\t\t\t\t\t# (ext) find file extension in target url\r\n\t\t\t\t\t\telseif (!empty($tmp_type)) { $local_name .= \".\".str_replace(\"/\", \".\", $tmp_type); }\t\t\t\t\t\t# (ext) failover to content type in http header as descriptive extension\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t# move file only if file has content\r\n\t\t\t\tif (filesize($tmp_file) > 0) {\r\n\t\t\t\t\t$new_file = $local_path.DIRECTORY_SEPARATOR.$local_name;\r\n\t\t\t\t\tif (file_exists($new_file) && !$overwrite) {\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# add unix timestamp to the end of file name\r\n\t\t\t\t\t\t$pathinfo = pathinfo($new_file);\r\n\t\t\t\t\t\t$local_name = $pathinfo[\"filename\"].\"_\".time().((!empty($pathinfo[\"extension\"])) ? \".\".$pathinfo[\"extension\"] : \"\");\r\n\t\t\t\t\t\t$new_file = $local_path.DIRECTORY_SEPARATOR.$local_name;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (!$this->is_writable($new_file)) { trigger_error(\"no write permission to access '{$new_file}'\", E_USER_WARNING); }\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\tif (is_resource($tmp_fp)) { fclose($tmp_fp); }\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# workaround for php 5.3.0 on windows\r\n\t\t\t\t\t\trename($tmp_file, $new_file);\r\n\t\t\t\t\t\tchmod($new_file, 0644);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (file_exists($tmp_file) && ($tmp_file != $new_file)) { unlink($tmp_file); }\r\n\t\t\tif (file_exists($new_file) && $this->is_writable($new_file)) {\r\n\t\t\t\t$this->data = \"\";\r\n\t\t\t\treturn $new_file;\r\n\t\t\t}\r\n\t\t}\r\n\t\t$this->data = \"\";\r\n\t\treturn false;\r\n\t}",
"private function copyServerFile($src, $des){\n /* \n if(ftp_chdir($this->conn, $src)){\n $rawList = ftp_nlist($conn, \".\"); \n if (!in_array($destDir, $rawList)) \n { \n ftp_mkdir($conn, $destDir); \n //@ftp_chmod($conn, 0777, $image_dir); \n }\n }\n \n $files = ftp_nlist($this->ftp_conn, $path);\n foreach ($files as $file)\n {\n $this->delete($path.'/'.$file);\n }\n return $this->delete($path);\n\n $srcDir = $this->fieldarray['sourceItemId']; \n $destDir = $this->fieldarray['itemId']; \n $localDir = PUBLIC_PATH . 'photos/' . $this->fieldarray['imageType'] . '/original/' . $this->fieldarray['itemId']; \n \n if ($conn = ftp_connect(PHOTO_SERVER)) \n { \n if (ftp_login($conn, PHOTO_SERVER_USER, PHOTO_SERVER_PW)) \n { \n ftp_pasv($conn, true); \n if (ftp_chdir($conn, PHOTO_SERVER_UPLOAD_DIR)) \n { \n $rawList = ftp_nlist($conn, \".\"); \n if (!in_array($destDir, $rawList)) \n { \n ftp_mkdir($conn, $destDir); \n //@ftp_chmod($conn, 0777, $image_dir); \n } \n \n $files = ftp_nlist($conn, $srcDir); \n foreach ($files as $file) \n { \n if ($file != \".\" && $file != \"..\") \n { \n $srcFile = PHOTO_SERVER_FTP_GET_SRC_DIR . '/' . $srcDir . '/' . $file; \n $localFile = $localDir . '/' . $file; \n \n if (ftp_get($conn, $localFile, $srcFile, FTP_BINARY)) \n { \n $upload = ftp_put($conn, $destDir . \"/\" . $file, $localFile, FTP_BINARY); \n } \n } \n } \n } \n }\n }*/\n }",
"function downloadFileThroughFtp(\n $username,\n $password,\n $host,\n $absolutePath,\n $localDirectoryPath )\n{\n $baseName = extractBaseNameFromPath( $absolutePath );\n\n $ftpStream = ftp_connect( $host );\n\n ftp_login( $ftpStream, $username, $password );\n ftp_pasv( $ftpStream, TRUE );\n\n $isFileDownloaded = writeLocalFileFromFtpStream(\n $baseName, $localDirectoryPath, $ftpStream, $absolutePath );\n\n ftp_close( $ftpStream );\n\n return $isFileDownloaded;\n}",
"function _ftp_chdir($dir)\n\t{\n\t\t// Calculate \"real\" (absolute) FTP path\n\t\t$realdir = substr($this->_initdir, -1) == '/' ? substr($this->_initdir, 0, strlen($this->_initdir) - 1) : $this->_initdir;\n\t\t$realdir .= '/'.$dir;\n\t\t$realdir = substr($realdir, 0, 1) == '/' ? $realdir : '/'.$realdir;\n\n\t\tif($this->_currentdir == $realdir)\n\t\t{\n\t\t\t// Already there, do nothing\n\t\t\treturn true;\n\t\t}\n\n\t\t$result = @ftp_chdir($this->_ftphandle, $realdir);\n\t\tif($result === false)\n\t\t{\n\t\t\t// The directory doesn't exist, let's try to create it...\n\t\t\tif(!$this->_makeDirectory($dir)) return false;\n\t\t\t// After creating it, change into it\n\t\t\t@ftp_chdir($this->_ftphandle, $realdir);\n\t\t}\n\n\t\t// Update the private \"current remote directory\" variable\n\t\t$this->_currentdir = $realdir;\n\t\treturn true;\n\t}",
"abstract public function copyLocalDir($from, $to);",
"function put($local_file, $remote_file, $overwrite = false, $mode = null, $options = 0) {\r\n\t\tif ( $options & (self::PUT_BLOCKING | self::PUT_NONBLOCKING) === (self::PUT_BLOCKING | self::PUT_NONBLOCKING) ) {\r\n\t\t\tthrow new ftpPutOptionsException();\r\n\t\t}\r\n\t\t\r\n\t\t$usenb = !($options & (self::PUT_BLOCKING == self::PUT_BLOCKING));\r\n\t\t\r\n\t\tif ( !isset($mode) ) {\r\n\t\t\t$mode = $this->checkFileExtension($local_file);\r\n\t\t}\r\n\t\t$remote_file = $this->_constructPath($remote_file);\r\n\t\t\r\n\t\tif ( !@file_exists($local_file) ) {\r\n\t\t\tthrow new ftpPutLocalFileDoesNotExistException($local_file);\r\n\t\t}\r\n\t\tif ( (@ftp_size($this->_handle, $remote_file) != -1) && !$overwrite ) {\r\n\t\t\tthrow new ftpPutRemoteFileExistsNoOverwriteException($remote_file);\r\n\t\t}\r\n\t\t\r\n\t\tif ( function_exists('ftp_alloc') ) {\r\n\t\t\tftp_alloc($this->_handle, filesize($local_file));\r\n\t\t}\r\n\t\tif ( $usenb && function_exists('ftp_nb_put') ) {\r\n\t\t\t$res = @ftp_nb_put($this->_handle, $remote_file, $local_file, $mode);\r\n\t\t\twhile ( $res == FTP_MOREDATA ) {\r\n\t\t\t\t$this->notify('nb_put');\r\n\t\t\t\t$res = @ftp_nb_continue($this->_handle);\r\n\t\t\t}\r\n\t\t\r\n\t\t} else {\r\n\t\t\t$res = @ftp_put($this->_handle, $remote_file, $local_file, $mode);\r\n\t\t}\r\n\t\tif ( !$res ) {\r\n\t\t\tthrow new ftpPutException(\"File '$local_file' could not be uploaded to '\" . $remote_file . \"'.\");\r\n\t\t} else {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}",
"function get($remote_file, $local_file, $overwrite = false, $mode = null) {\r\n\t\tif ( $mode === null ) {\r\n\t\t\t$mode = $this->checkFileExtension($remote_file);\r\n\t\t}\r\n\t\t\r\n\t\t$remote_file = $this->_constructPath($remote_file);\r\n\t\t\r\n\t\tif ( @file_exists($local_file) && !$overwrite ) {\r\n\t\t\tthrow new ftpGetLocalFileExistsException($local_file);\r\n\t\t}\r\n\t\tif ( @file_exists($local_file) && !@is_writeable($local_file) && $overwrite ) {\r\n\t\t\tthrow new ftpGetLocalFileNotWritableException($local_file);\r\n\t\t}\r\n\t\t\r\n\t\tif ( @function_exists('ftp_nb_get') ) {\r\n\t\t\t$res = @ftp_nb_get($this->_handle, $local_file, $remote_file, $mode);\r\n\t\t\twhile ( $res == FTP_MOREDATA ) {\r\n\t\t\t\t$this->notify('nb_get');\r\n\t\t\t\t$res = @ftp_nb_continue($this->_handle);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t$res = @ftp_get($this->_handle, $local_file, $remote_file, $mode);\r\n\t\t}\r\n\t\tif ( !$res ) {\r\n\t\t\tthrow new ftpGetException(\"File '\" . $remote_file . \"' could not be downloaded to '$local_file'.\");\r\n\t\t} else {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}",
"function get($localfile, $remotefile, $mode = 1)\r\n {\r\n if ($this->_use_mod_ftp) {\r\n \t\tftp_get($this->_socket, $localfile, $remotefile, $mode);\r\n \t} else {\r\n \tif ($mode) {\r\n \t\t$type = \"I\";\r\n \t} else {\r\n \t\t$type = \"A\";\r\n \t}\r\n \t\r\n \tif (!$this->file_exists($remotefile)) {\r\n \t\t$this->debug(\"Error : No such file or directory \\\"\".$remotefile.\"\\\"\\n\");\r\n \t\t$this->debug(\"Error : GET failed\\n\");\r\n \t\treturn FALSE;\r\n \t}\r\n \t\r\n \tif (@file_exists($localfile)) {\r\n \t\t$this->debug(\"Warning : local file will be overwritten\\n\");\r\n \t} else {\r\n \t\tumask($this->_umask);\r\n \t}\r\n \t\r\n \t$fp = @fopen($localfile, \"w\");\r\n \tif (!$fp) {\r\n \t\t$this->debug(\"Error : Cannot create \\\"\".$localfile.\"\\\"\");\r\n \t\t$this->debug(\"Error : GET failed\\n\");\r\n \t\treturn FALSE;\r\n \t}\r\n \t\r\n \t$this->putcmd(\"PASV\");\r\n \t$string = $this->getresp();\r\n \t\r\n \t$this->putcmd(\"TYPE\", $type);\r\n \t$this->getresp();\r\n \t\r\n \t$this->putcmd(\"RETR\", $remotefile);\r\n \t\r\n \t$sock_data = $this->open_data_connection($string);\r\n \tif (!$sock_data) {\r\n \t\treturn FALSE;\r\n \t}\r\n \tif ($this->ok()) {\r\n \t\t$this->debug(\"Connected to remote host\\n\");\r\n \t} else {\r\n \t\t$this->debug(\"Cannot connect to remote host\\n\");\r\n \t\t$this->debug(\"Error : GET failed\\n\");\r\n \t\treturn FALSE;\r\n \t}\r\n \t\r\n \t$this->debug(\"Retrieving remote file \\\"\".$remotefile.\"\\\" to local file \\\"\".$localfile.\"\\\"\\n\");\r\n \twhile (!feof($sock_data)) {\r\n \t\tfputs($fp, fread($sock_data, 4096));\r\n \t}\r\n \tfclose($fp);\r\n \t\r\n \t$this->close_data_connection($sock_data);\r\n \t}\r\n \treturn $this->ok();\r\n }",
"public function move_backup_in($working_dir, $dest_dir, $preserve_existing = 1, $do_not_overwrite = array('plugins', 'themes', 'uploads', 'upgrade'), $type = 'not-others', $send_actions = false, $force_local = false) {\n\n\t\tglobal $wp_filesystem, $updraftplus;\n\t\t$updraft_dir = $updraftplus->backups_dir_location();\n\n\t\tif (true == $force_local) {\n\t\t\t$wpfs = new UpdraftPlus_WP_Filesystem_Direct(true);\n\t\t} else {\n\t\t\t$wpfs = $wp_filesystem;\n\t\t}\n\n\t\t// Get the content to be moved in. Include hidden files = true. Recursion is only required if we're likely to copy-in\n\t\t$recursive = (self::MOVEIN_COPY_IN_CONTENTS == $preserve_existing) ? true : false;\n\t\t$upgrade_files = $wpfs->dirlist($working_dir, true, $recursive);\n\n\t\tif (empty($upgrade_files)) return true;\n\n\t\t// check if our path is a file by looking to see if it's in the list of files we want to restore, if it is then remove the file from the path\n\t\tif (isset($upgrade_files[basename($dest_dir)]) && 'f' == $upgrade_files[basename($dest_dir)]['type']) $dest_dir = trailingslashit(dirname($dest_dir));\n\t\t\n\t\tif (!$wpfs->is_dir($dest_dir)) {\n\t\t\tif ($wpfs->is_dir(dirname($dest_dir))) {\n\t\t\t\tif (!$wpfs->mkdir($dest_dir, FS_CHMOD_DIR)) return new WP_Error('mkdir_failed', __('The directory does not exist, and the attempt to create it failed', 'updraftplus') . ' (' . $dest_dir . ')');\n\t\t\t\t$updraftplus->log(\"Destination directory did not exist, but was successfully created ($dest_dir)\");\n\t\t\t} else {\n\t\t\t\treturn new WP_Error('no_such_dir', __('The directory does not exist', 'updraftplus') . \" ($dest_dir)\");\n\t\t\t}\n\t\t}\n\n\t\t$wpcore_config_moved = false;\n\n\t\tif ('plugins' == $type || 'themes' == $type) $updraftplus->log(\"Top-level entities being moved: \".implode(', ', array_keys($upgrade_files)));\n\n\t\tforeach ($upgrade_files as $file => $filestruc) {\n\n\t\t\tif (empty($file)) continue;\n\n\t\t\tif ($dest_dir.$file == $updraft_dir) {\n\t\t\t\t$updraftplus->log('Skipping attempt to replace updraft_dir whilst processing '.$type);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Correctly restore files in 'others' in no directory that were wrongly backed up in versions 1.4.0 - 1.4.48\n\t\t\tif (('others' == $type || 'wpcore' == $type) && preg_match('/^([\\-_A-Za-z0-9]+\\.php)$/i', $file, $matches) && $wpfs->exists($working_dir . \"/$file/$file\")) {\n\t\t\t\tif ('others' == $type) {\n\t\t\t\t\t$updraftplus->log(\"Found file: $file/$file: presuming this is a backup with a known fault (backup made with versions 1.4.0 - 1.4.48, and sometimes up to 1.6.55 on some Windows servers); will rename to simply $file\", 'notice-restore');\n\t\t\t\t} else {\n\t\t\t\t\t$updraftplus->log(\"Found file: $file/$file: presuming this is a backup with a known fault (backup made with versions before 1.6.55 in certain situations on Windows servers); will rename to simply $file\", 'notice-restore');\n\t\t\t\t}\n\t\t\t\t$updraftplus->log(\"$file/$file: rename to $file\");\n\t\t\t\t$file = $matches[1];\n\t\t\t\t$tmp_file = rand(0, 999999999).'.php';\n\t\t\t\t// Rename directory\n\t\t\t\tif (!$wpfs->move($working_dir . \"/$file\", $working_dir . \"/\".$tmp_file, true)) {\n\t\t\t\t\t$this->restore_log_permission_failure_message($working_dir, 'Move '. $working_dir . \"/$file -> \".$working_dir . \"/\".$tmp_file, 'Destination');\n\t\t\t\t}\n\t\t\t\tif (!$wpfs->move($working_dir . \"/$tmp_file/$file\", $working_dir .\"/\".$file, true)) {\n\t\t\t\t\t$this->restore_log_permission_failure_message($working_dir, 'Move '.$working_dir . \"/$tmp_file/$file -> \".$working_dir .\"/\".$file, 'Destination');\n\t\t\t\t}\n\t\t\t\tif (!$wpfs->rmdir($working_dir . \"/$tmp_file\", false)) {\n\t\t\t\t\t$this->restore_log_permission_failure_message($working_dir, 'Delete '.$working_dir . \"/$tmp_file\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ('wp-config.php' == $file && 'wpcore' == $type) {\n\t\t\t\tif (empty($this->restore_options['updraft_restorer_wpcore_includewpconfig'])) {\n\t\t\t\t\t$updraftplus->log_e('wp-config.php from backup: will restore as wp-config-backup.php', 'updraftplus');\n\t\t\t\t\tif (!$wpfs->move($working_dir . \"/$file\", $working_dir . \"/wp-config-backup.php\", true)) {\n\t\t\t\t\t\t$this->restore_log_permission_failure_message($working_dir, 'Move '.$working_dir . \"/$file -> \".$working_dir . \"/wp-config-backup.php\", 'Destination');\n\t\t\t\t\t}\n\t\t\t\t\t$file = \"wp-config-backup.php\";\n\t\t\t\t\t$wpcore_config_moved = true;\n\t\t\t\t} else {\n\t\t\t\t\t$updraftplus->log_e(\"wp-config.php from backup: restoring (as per user's request)\", 'updraftplus');\n\t\t\t\t}\n\t\t\t} elseif ('wpcore' == $type && 'wp-config-backup.php' == $file && $wpcore_config_moved) {\n\t\t\t\t// The file is already gone; nothing to do\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Sanity check (should not be possible as these were excluded at backup time)\n\t\t\tif (in_array($file, $do_not_overwrite)) continue;\n\n\t\t\tif (('object-cache.php' == $file || 'advanced-cache.php' == $file) && 'others' == $type) {\n\t\t\t\tif (false == apply_filters('updraftplus_restorecachefiles', true, $file)) {\n\t\t\t\t\t$nfile = preg_replace('/\\.php$/', '-backup.php', $file);\n\t\t\t\t\tif (!$wpfs->move($working_dir . \"/$file\", $working_dir . \"/\" .$nfile, true)) {\n\t\t\t\t\t\t$this->restore_log_permission_failure_message($working_dir, 'Move '. $working_dir . '/' . $file .' -> '.$working_dir . '/' . $nfile, 'Destination');\n\t\t\t\t\t}\n\t\t\t\t\t$file = $nfile;\n\t\t\t\t}\n\t\t\t} elseif (('object-cache-backup.php' == $file || 'advanced-cache-backup.php' == $file) && 'others' == $type) {\n\t\t\t\tif (!$wpfs->delete($working_dir.\"/\".$file)) {\n\t\t\t\t\t$this->restore_log_permission_failure_message($working_dir, 'Delete '.$working_dir.\"/\".$file);\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// First, move the existing one, if necessary (may not be present)\n\t\t\tif ($wpfs->exists($dest_dir.$file)) {\n\t\t\t\tif (self::MOVEIN_MAKE_BACKUP_OF_EXISTING == $preserve_existing) {\n\t\t\t\t\tif (!$wpfs->move($dest_dir.$file, $dest_dir.$file.'-old', true)) {\n\t\t\t\t\t\t$this->restore_log_permission_failure_message($dest_dir, 'Move '. $dest_dir.$file.' -> '.$dest_dir.$file.'-old', 'Destination');\n\t\t\t\t\t\treturn new WP_Error('old_move_failed', $this->strings['old_move_failed'].\" ($dest_dir$file)\");\n\t\t\t\t\t}\n\t\t\t\t} elseif (self::MOVEIN_OVERWRITE_NO_BACKUP == $preserve_existing) {\n\t\t\t\t\tif (!$wpfs->delete($dest_dir.$file, true)) {\n\t\t\t\t\t\t$this->restore_log_permission_failure_message($dest_dir, 'Delete '.$dest_dir.$file);\n\t\t\t\t\t\treturn new WP_Error('old_delete_failed', $this->strings['old_delete_failed'].\" ($file)\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\t// Secondly, move in the new one\n\t\t\t$is_dir = $wpfs->is_dir($working_dir.\"/\".$file);\n\n\t\t\tif (self::MOVEIN_DO_NOTHING_IF_EXISTING == $preserve_existing && $wpfs->exists($dest_dir.$file)) {\n\t\t\t\t// Something exists - no move. Remove it from the temporary directory - so that it will be clean later\n\t\t\t\t@$wpfs->delete($working_dir.'/'.$file, true);// phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged\n\t\t\t// The $is_dir check was added in version 1.11.18; without this, files in the top-level that weren't in the first archive didn't get over-written\n\t\t\t} elseif (self::MOVEIN_COPY_IN_CONTENTS != $preserve_existing || !$wpfs->exists($dest_dir.$file) || !$is_dir) {\n\n\t\t\t\tif ($wpfs->move($working_dir.\"/\".$file, $dest_dir.$file, true)) {\n\t\t\t\t\tif ($send_actions) do_action('updraftplus_restored_'.$type.'_one', $file);\n\t\t\t\t\t// Make sure permissions are at least as great as those of the parent\n\t\t\t\t\tif ($is_dir) {\n\t\t\t\t\t\t// This method is broken due to https://core.trac.wordpress.org/ticket/26598\n\t\t\t\t\t\tif (empty($chmod)) $chmod = octdec(sprintf(\"%04d\", $this->get_current_chmod($dest_dir, $wpfs)));// phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable\n\t\t\t\t\t\tif (!empty($chmod)) $this->chmod_if_needed($dest_dir.$file, $chmod, false, $wpfs);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t$this->restore_log_permission_failure_message($dest_dir, 'Move '. $working_dir.\"/\".$file.\" -> \".$dest_dir.$file, 'Destination');\n\t\t\t\t\treturn new WP_Error('move_failed', $this->strings['move_failed'], $working_dir.\"/\".$file.\" -> \".$dest_dir.$file);\n\t\t\t\t}\n\t\t\t} elseif (self::MOVEIN_COPY_IN_CONTENTS == $preserve_existing && !empty($filestruc['files'])) {\n\t\t\t\t// The directory ($dest_dir) already exists, and we've been requested to copy-in. We need to perform the recursive copy-in\n\t\t\t\t// $filestruc['files'] is then a new structure like $upgrade_files\n\t\t\t\t// First pass: create directory structure\n\t\t\t\t// Get chmod value for the parent directory, and re-use it (instead of passing false)\n\n\t\t\t\t// This method is broken due to https://core.trac.wordpress.org/ticket/26598\n\t\t\t\tif (empty($chmod)) $chmod = octdec(sprintf(\"%04d\", $this->get_current_chmod($dest_dir, $wpfs)));\n\t\t\t\t// Copy in the files. This also needs to make sure the directories exist, in case the zip file lacks entries\n\t\t\t\t$delete_root = ('others' == $type || 'wpcore' == $type) ? false : true;\n\n\t\t\t\t$copy_in = $this->copy_files_in($working_dir.'/'.$file, $dest_dir.$file, $filestruc['files'], $chmod, $delete_root);\n\t\t\t\tif (!empty($chmod)) $this->chmod_if_needed($dest_dir.$file, $chmod, false, $wpfs);\n\n\t\t\t\tif (is_wp_error($copy_in) || !$copy_in) {\n\t\t\t\t\t$this->restore_log_permission_failure_message($dest_dir, 'Move '. $working_dir.\"/\".$file.\" -> \".$dest_dir.$file, 'Destination');\n\t\t\t\t}\n\t\t\t\tif (is_wp_error($copy_in)) return $copy_in;\n\t\t\t\tif (!$copy_in) return new WP_Error('move_failed', $this->strings['move_failed'], \"(2) \".$working_dir.'/'.$file.\" -> \".$dest_dir.$file);\n\n\t\t\t\tif (!$wpfs->rmdir($working_dir.'/'.$file)) {\n\t\t\t\t\t$this->restore_log_permission_failure_message($working_dir, 'Delete '.$working_dir.'/'.$file);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (!$wpfs->rmdir($working_dir.'/'.$file)) {\n\t\t\t\t\t$this->restore_log_permission_failure_message($working_dir, 'Delete '.$working_dir.'/'.$file);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\n\t}",
"function ftp_get_dir($loc_dir, $rmt_dir, $isRecursive=TRUE, $useWhiteList=FALSE, $debug=FALSE) {\n\t\t$loc_dir = rtrim($loc_dir, '/');\n\t\t$rmt_dir = rtrim($rmt_dir, '/');\n\t\t\n\t\t$this->prv_ftp_get_dir($loc_dir, $rmt_dir, $isRecursive, $useWhiteList, $debug);\n\t}",
"function chmodRecursive($target, $permissions) {\r\n\t\tif ( !self::$_dir_permissions ) {\r\n\t\t\tself::$_dir_permissions = $this->_makeDirPermissions($permissions);\r\n\t\t}\r\n\t\t\r\n\t\tif ( is_array($target) ) {\r\n\t\t\tfor ( $i = 0; $i < count($target); $i++ ) {\r\n\t\t\t\t$res = $this->chmodRecursive($target[$i], $permissions);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t$remote_path = $this->_constructPath($target);\r\n\t\t\t\r\n\t\t\t// Chmod the directory itself\r\n\t\t\t$result = $this->chmod($remote_path, self::$_dir_permissions);\r\n\t\t\t\r\n\t\t\t// If $remote_path last character is not a slash, add one\r\n\t\t\tif ( substr($remote_path, strlen($remote_path) - 1) != \"/\" ) {\r\n\t\t\t\t$remote_path .= \"/\";\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t$dir_list = array();\r\n\t\t\t$mode = self::LS_MODE_DIR_ONLY;\r\n\t\t\t$dir_list = $this->ls($remote_path, $mode);\r\n\t\t\tforeach ( $dir_list as $dir_entry ) {\r\n\t\t\t\tif ( $dir_entry['name'] == '.' || $dir_entry['name'] == '..' ) {\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t$remote_path_new = $remote_path . $dir_entry[\"name\"] . \"/\";\r\n\t\t\t\t\r\n\t\t\t\t// Chmod the directory we're about to enter\r\n\t\t\t\t$result = $this->chmod($remote_path_new, self::$_dir_permissions);\r\n\t\t\t\t$result = $this->chmodRecursive($remote_path_new, $permissions);\r\n\t\t\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t$file_list = array();\r\n\t\t\t$mode = self::LS_MODE_FILES_ONLY;\r\n\t\t\t$file_list = $this->ls($remote_path, $mode);\r\n\t\t\t\r\n\t\t\tforeach ( $file_list as $file_entry ) {\r\n\t\t\t\t$remote_file = $remote_path . $file_entry[\"name\"];\r\n\t\t\t\t$result = $this->chmod($remote_file, $permissions);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn true;\r\n\t}",
"private function _iocUnzipAndFtpSend($source, $destination) {\n if (($dir = @opendir($source))) {\n $ret = TRUE;\n while ($file = readdir($dir)) {\n if ($file!==\".\" && $file!==\"..\") {\n if (is_dir(\"$source$file\")) {\n $ret = $ret && $this->_iocUnzipAndFtpSend(\"$source$file/\", \"$destination$file/\");\n }else{\n $ret = $ret && $this->uploadFile($file, $source, $file, $destination);\n }\n }\n }\n }\n return $ret;\n }",
"public function cd($path)\n {\n // Go to root folder\n if (!ftp_chdir($this->handle, $path)) {\n return $this->log('Remote folder[##] not found', $path);\n }\n\n // Check if we can write there\n if (!$this->isWritable()) {\n return $this->log('Remote path [##] is not writable', $path);\n }\n\n $this->log('Switching to [##] folder', $path);\n\n // Store current folder\n $this->currentFolder = ftp_pwd($this->handle);\n\n return true;\n }",
"public function repo($dir, $remote);",
"function FTPupload($origen,$destino='',$borrar=true){\n\t#origen: donde esta la imagen. destino: donde ira la imagen.\n\t#borrar: falso si no se quiere eliminar la imagen original\n\t#las rutas deben ser relativas a img. si destino es vacio o false, se colocara en la misma ruta del origen\n\t//validaciones previas\n\tglobal $config;\n\tif(!is_file(\"$config->relpath/img/$origen\")) return \"404 file $config->relpath/img/$origen not found\";\n\tglobal $config;\n\t$error=0;\n\tif($destino=='') $destino=$origen;\n\t$file=end(explode('/',$destino));\n\tif(!$file) $error=400;\n\t$path=isset($config->ftp->folder)?$config->ftp->folder.'/':'';\n\t$path.=dirname($destino);\n\t$data=\" P:$path F:$file O:$origen D:$destino\";\n\tif(!$error)\n\tif(isset($config->ftp)){\n\t\tif(!isset($img_ftp_con)){\n\t\t\t$img_ftp_con=ftp_connect($config->ftp->host,isset($config->ftp->port)?$config->ftp->port:21);\n\t\t\t$login=@ftp_login($img_ftp_con,$config->ftp->user,$config->ftp->pass);\n\t\t\tif(!$login){\n\t\t\t\t$img_ftp_con=0;\n\t\t\t\treturn 403;\n\t\t\t}\n\t\t\tftp_pasv($img_ftp_con,true);\n\t\t}\n\t\t#vamos a la carpeta raiz\n\t\t// ftp_cdup($img_ftp_con);\n\t\t#Nos vamos a la carpeta destino. Se crean las carpetas que no existan.\n\t\t$foldercount=0;\n\t\t$folders=explode('/',$path);\n\t\tforeach($folders as $folder){\n\t\t\tif($folder!=''){\n\t\t\t\tif(@ftp_chdir($img_ftp_con,$folder)){#abrir carpeta\n\t\t\t\t\t$foldercount++;\n\t\t\t\t}elseif(@ftp_mkdir($img_ftp_con,$folder)){#crear y abrir carpeta\n\t\t\t\t\tftp_chdir($img_ftp_con,$folder);\n\t\t\t\t\t$foldercount++;\n\t\t\t\t\t@ftp_put($img_ftp_con,'index.html',RELPATH.'img/index.html',FTP_BINARY);\n\t\t\t\t}else{\n\t\t\t\t\t$error=412;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(!$error){\n\t\t\t$data=' PWD:'.ftp_pwd($img_ftp_con).$data;\n\t\t\t#Copiamos el archivo\n\t\t\t$error=(@ftp_put($img_ftp_con,$file,RELPATH.'img/'.$origen,FTP_BINARY)) ? 200 : 401;\n\t\t\t#Borramos la imagen de origen si es requerido\n\t\t\tif($borrar&&$error==200&&!@unlink(RELPATH.'img/'.$origen)) $error=206;\n\t\t}\n\t\tftp_quit($img_ftp_con);\n\t// }elseif(!$config->local){\n\t\t#Si no es local movemos al servidor de imagenes\n\t}else{\n\t\t#movemos al servidor de imagenes\n\t\t$_origen=RELPATH.'img/'.$origen;\n\t\t$_destino=$config->img_server_path.'img/'.$destino;\n\t\t$data.=\"<br>FO: $_origen FD: $_destino\";\n\t\tif(!is_dir($config->img_server_path.'img/'.$path))\n\t\t\tif(!@mkdir($config->img_server_path.'img/'.$path,0775,true)) $error=412;\n\t\tif(!$error)\n\t\tif($borrar)\n\t\t\t$error=(!@rename($_origen,$_destino))?408:200;\n\t\telse\n\t\t\t$error=(!@copy($_origen,$_destino))?409:200;\n/*\t}elseif($destino!=$origen){\n\t\t#Cuando no es ftp, y el origen es distinto al destino, se mueve/copia el archivo\n\t\tif(!is_dir(RELPATH.'img/'.$path))\n\t\t\tif(!@mkdir(RELPATH.'img/'.$path,0777,true)) $error=412;\n\t\tif(!$error)\n\t\tif($borrar)\n\t\t\t$error=(!@rename(RELPATH.'img/'.$origen,RELPATH.'img/'.$destino))?408:200;\n\t\telse\n\t\t\t$error=(!@copy(RELPATH.'img/'.$origen,RELPATH.'img/'.$destino))?409:200;\n*/\t}\n\treturn $error.$data;#descomentar data si decea ver los mensajes de error\n}",
"abstract function upload($locpath, $rempath, $mode = 'auto', $permissions = NULL);",
"function download($rempath, $locpath, $mode = 'auto')\n\t{\n\t\tif ( ! $this->_is_conn())\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\n\t\t// Set the mode if not specified\n\t\tif ($mode == 'auto')\n\t\t{\n\t\t\t// Get the file extension so we can set the upload type\n\t\t\t$ext = $this->_getext($rempath);\n\t\t\t$mode = $this->_settype($ext);\n\t\t}\n\n\t\t$mode = ($mode == 'ascii') ? FTP_ASCII : FTP_BINARY;\n\n\t\t$result = @ftp_get($this->conn_id, $locpath, $rempath, $mode);\n\n\t\tif ($result === FALSE)\n\t\t{\n\t\t\tif ($this->debug == TRUE)\n\t\t\t{\n\t\t\t\t$this->_error('ftp_unable_to_download');\n\t\t\t} \n\t\t\treturn FALSE;\n\t\t}\n\n\t\treturn TRUE;\n\t}",
"public function upload($localFile, $remoteFile)\n\t{\n\t\t$this->initScp();\n\n\t\tif (is_dir($localFile)) {\n\t\t\t$localDir = rtrim($localFile, '/') . '/';\n\t\t\t$remoteDir = rtrim($remoteFile, '/') . '/';\n\n\t\t\t$this->exec('mkdir -p ' . $remoteDir);\n\n\t\t\t$files = array_diff(scandir($localDir), array('.', '..'));\n\t\t\tforeach ($files as $file) {\n\t\t\t\t$this->upload($localDir . $file, $remoteDir . $file);\n\t\t\t}\n\t\t} else {\n\t\t\treturn $this->scp->put($remoteFile, $localFile, NET_SCP_LOCAL_FILE);\n\t\t}\n\t}",
"function transfer()\n\t{\n\t\tglobal $phpbb_root_path;\n\n\t\t$this->file_perms\t= 0644;\n\t\t$this->dir_perms\t= 0777;\n\n\t\t// We use the store directory as temporary path to circumvent open basedir restrictions\n\t\t$this->tmp_path = $phpbb_root_path . 'store/';\n\t}",
"function setFileContent($db, $file, $localFilePath)\n{\n $storageType = 'local';\n $storageLocation = LOCAL_STORAGE_DEFAULT_PATH;\n $uploadServerDetails = loadServer($db, $file);\n if ($uploadServerDetails != false)\n {\n $storageLocation = $uploadServerDetails['storagePath'];\n $storageType = $uploadServerDetails['serverType'];\n\n // if no storage path set & local, use system default\n if ((strlen($storageLocation) == 0) && ($storageType == 'local'))\n {\n $storageLocation = LOCAL_STORAGE_DEFAULT_PATH;\n }\n\n if ($storageType == 'direct')\n {\n $storageLocation = LOCAL_STORAGE_DEFAULT_PATH;\n }\n }\n\n // get subfolder\n $subFolder = current(explode(\"/\", $file['localFilePath']));\n $originalFilename = end(explode(\"/\", $file['localFilePath']));\n\n // use ssh to get contents of 'local' files\n if (($storageType == 'local') || ($storageType == 'direct'))\n {\n // get remote file path\n $remoteFilePath = $storageLocation . $file['localFilePath'];\n // first try setting the file locally\n $done = false;\n if ((ON_SCRIPT_INSTALL == true) && file_exists($remoteFilePath))\n {\n $done = copy($localFilePath, $remoteFilePath);\n if ($done)\n {\n return true;\n }\n }\n\n // try over ssh\n if ($done == false)\n {\n\t\t\t$sshHost = LOCAL_STORAGE_SSH_HOST;\n\t\t\t$sshUser = LOCAL_STORAGE_SSH_USER;\n\t\t\t$sshPass = LOCAL_STORAGE_SSH_PASS;\n\n\t\t\t// if 'direct' file server, get SSH details\n\t\t\t$serverDetails = getDirectFileServerSSHDetails($file['serverId']);\n\t\t\tif($serverDetails)\n\t\t\t{\n\t\t\t\t$sshHost = $serverDetails['ssh_host'];\n $sshPort = $serverDetails['ssh_port'];\n\t\t\t\t$sshUser = $serverDetails['ssh_username'];\n\t\t\t\t$sshPass = $serverDetails['ssh_password'];\n\t\t\t\t$basePath = $serverDetails['file_storage_path'];\n\t\t\t\tif(substr($basePath, strlen($basePath)-1, 1) == '/')\n\t\t\t\t{\n\t\t\t\t\t$basePath = substr($basePath, 0, strlen($basePath)-1);\n\t\t\t\t}\n\t\t\t\t$remoteFilePath = $basePath . '/' . $file['localFilePath'];\n\t\t\t}\n \n if(strlen($sshPort) == 0)\n {\n $sshPort = 22;\n }\n\t\t\t\n // connect to 'local' storage via SSH\n $sftp = new Net_SFTP($sshHost, $sshPort);\n if (!$sftp->login($sshUser, $sshPass))\n {\n output(\"Error: Failed logging into \" . $sshHost . \" (Port: \".$sshPort.\") via SSH..\\n\");\n\n return false;\n }\n\n // overwrite file\n $rs = $sftp->put($remoteFilePath, $localFilePath, NET_SFTP_LOCAL_FILE);\n if ($rs)\n {\n return true;\n }\n\n output(\"Error: Failed uploading converted file to \" . LOCAL_STORAGE_SSH_HOST . \" (\" . $remoteFilePath . \") via SSH..\\n\");\n }\n\n return false;\n }\n\n // ftp\n if ($storageType == 'ftp')\n {\n // setup full path\n $prePath = $uploadServerDetails['storagePath'];\n if (substr($prePath, strlen($prePath) - 1, 1) == '/')\n {\n $prePath = substr($prePath, 0, strlen($prePath) - 1);\n }\n $remoteFilePath = $prePath . '/' . $file['localFilePath'];\n\n // connect via ftp\n $conn_id = ftp_connect($uploadServerDetails['ipAddress'], $uploadServerDetails['ftpPort'], 30);\n if ($conn_id === false)\n {\n output('Could not connect to ' . $uploadServerDetails['ipAddress'] . ' to upload file.');\n return false;\n }\n\n // authenticate\n $login_result = ftp_login($conn_id, $uploadServerDetails['ftpUsername'], $uploadServerDetails['ftpPassword']);\n if ($login_result === false)\n {\n output('Could not login to ' . $uploadServerDetails['ipAddress'] . ' with supplied credentials.');\n return false;\n }\n\n // get content\n $rs = ftp_put($conn_id, $remoteFilePath, $localFilePath, FTP_BINARY);\n if ($rs == true)\n {\n return true;\n }\n }\n\n output(\"Error: Failed uploading converted file to \" . $uploadServerDetails['ipAddress'] . \" via FTP..\\n\");\n\n return false;\n}",
"function FTPupload($origen,$destino='',$borrar=true,&$id_ftp=false){\n\t//colocar ruta relativa de origen y destino, incluyendo carpetas.\n\t//si se omite destino se copia con la misma ruta del origen.\n\t//por defecto se elimina la imagen original\n\tif($destino=='') $destino=$origen;\n\t$count=preg_match('/(.+\\/)*/',$destino,$path);\n\tif(!NOFPT){\n\t\tif(!$id_ftp){\n\t\t\t$id_ftp=ftp_connect(FTPSERVER,21);\n\t\t\tftp_login($id_ftp,FTPACCOUNT,FTPPASS);\n\t\t\tftp_pasv($id_ftp,false);\n\t\t}\n\t\t//Movilizacion a subcarpetas. Si no existen las crea.\n\t\t//$count=preg_match('/(.+\\/)(.+\\/)*/',$path[1],$path);\n\t\t$path=$path[1];\n\t\twhile(($pos=strpos($path,'/'))!==false){\n\t\t\t$folder=substr($path,0,$pos);\n\t\t\t@ftp_mkdir($id_ftp,$folder);\n\t\t\tif(ftp_chdir($id_ftp,$folder)){\n\t\t\t\t@ftp_put($id_ftp,'index.html',RELPATH.'img/index.html',FTP_BINARY);\n\t\t\t}else{\n\t\t\t\tftp_quit($id_ftp);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t$path=substr($path,$pos+1);\n\t\t}\n\t\t$file=end(explode('/',$destino));\n\t\tif($file!=''){\n\t\t\tftp_put($id_ftp,$file,RELPATH.'img/'.$origen,FTP_BINARY);\n\t\t\tftp_quit($id_ftp);\n\t\t}\n\t\tif($borrar){\n\t\t\t@unlink(RELPATH.$origen);\n\t\t}\n\t}elseif($destino!=$origen){\n\t\tmkdir(substr($path[1],0,-1),0777,true);\n\t\tif($borrar)\n\t\t\trename(RELPATH.'img/'.$origen,RELPATH.'img/'.$destino);\n\t\telse\n\t\t\tcopy(RELPATH.'img/'.$origen,RELPATH.'img/'.$destino);\n\t}\n}",
"function drush_file_sync($source, $destination) {\n\n $only_public = drush_get_option('only-public', FALSE);\n $only_private = drush_get_option('only-private', FALSE);\n\n if ($only_public && $only_private) {\n drush_log(dt('Only one of --only-public or --only-private can be set'), 'error');\n return false;\n }\n\n // drush_unset_option() is needed to prevent the options for file-sync getting\n // passed through to core-rsync.\n // core-rync loads the original command line options to pass to rsync, so some\n // additional context-hacking is needed.\n // see drush_core_rsync() and drush_get_original_cli_args_and_options().\n $args = &drush_get_context('DRUSH_COMMAND_ARGS', array());\n $original_args = $args;\n\n $command = drush_get_command();\n foreach (array_keys($command['options']) as $option) {\n drush_unset_option($option, 'cli');\n\n $arg_index = array_search('--' . $option, $args);\n if ($arg_index !== FALSE) {\n unset($args[$arg_index]);\n }\n }\n $args = array_values($args);\n\n $public_result = FALSE;\n if (!$only_private) {\n drush_log(dt('Syncing public files'), 'status');\n $public_result = _drush_file_sync_path_alias($source, $destination, '%files');\n }\n\n $private_result = FALSE;\n if (!$only_public) {\n drush_log(dt('Syncing private files'), 'status');\n $private_result = _drush_file_sync_path_alias($source, $destination, '%private', $only_private? 'error': 'warning');\n }\n\n // Restore the original arguments just to be safe.\n $args = $original_args;\n\n if (\n (!$only_private && !$public_result)\n ||\n ($only_private && !$private_result)\n ) {\n // If public transfer is attempted but fails, it's always an error.\n // If private transfer is attempted but fails, it's an error if only\n // transferring private files was attempted.\n drush_log(dt('Sync could not complete successfully'), 'error');\n }\n else if (!$only_public && !$only_private && !$private_result) {\n // A private file path may not be defined, so it's only a warning if the\n // private transfer could not be completed while attempting to transfer all\n // files.\n drush_log(dt('Sync partially completed'), 'warning');\n }\n else {\n drush_log(dt('Sync completed successfully'), 'success');\n }\n}"
] |
[
"0.6840044",
"0.63063794",
"0.6051163",
"0.5718282",
"0.56136626",
"0.56073457",
"0.55651313",
"0.55123526",
"0.5510334",
"0.5448246",
"0.5443058",
"0.5361282",
"0.5351838",
"0.5342508",
"0.531576",
"0.5276888",
"0.52697504",
"0.52126557",
"0.5172134",
"0.51385975",
"0.5137837",
"0.5119501",
"0.5100132",
"0.50961983",
"0.5056391",
"0.50478554",
"0.50422204",
"0.5034906",
"0.50035",
"0.5002502"
] |
0.70397973
|
0
|
This checks, whether a file should be transfered in ascii or binarymode by it's fileextension. If the fileextension is not set or the extension is not inside one of the extensiondirs, the actual set transfermode is returned.
|
function checkFileExtension($filename) {
if ( ($pos = strrpos($filename, '.')) === false ) {
return $this->getMode();
} else {
$ext = substr($filename, $pos + 1);
}
if ( isset($this->_file_extensions[$ext]) ) {
return $this->_file_extensions[$ext];
}
return $this->getMode();
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function isAllowedExtension()\n {\n if (!empty($this->allowed_upload_file_ext)) {\n if (!is_array($this->allowed_upload_file_ext)) {\n NUCLEUS_Exceptions::catcher(FILE_TYPE_LIST_ERROR);\n return false;\n }\n else {\n if (!in_array($this->_file_info['ext'], $this->allowed_upload_file_ext)) {\n NUCLEUS_Exceptions::catcher(UPLOAD_FILE_TYPE_DENIED);\n return false;\n }\n }\n }\n\n return true;\n }",
"function getExtensionMode($ext) {\r\n\t\tif ( array_key_exists($ext, $this->_file_extensions) ) {\r\n\t\t\treturn $this->_file_extensions[$ext];\r\n\t\t}\r\n\t\treturn null;\r\n\t}",
"function ftp_trans_mode($file){ \n $path_parts = pathinfo($file);\n\t\t\n\t\tif (!isset($path_parts['extension']))\n\t\t\treturn FTP_BINARY;\n\t\tswitch (strtolower($path_parts['extension'])) {\n\t\t\tcase 'am':case 'asp':case 'bat':case 'c':case 'cfm':case 'cgi':case 'conf':\n\t\t\tcase 'cpp':case 'css':case 'dhtml':case 'diz':case 'h':case 'hpp':case 'htm':\n\t\t\tcase 'html':case 'in':case 'inc':case 'js':case 'm4':case 'mak':case 'nfs':\n\t\t\tcase 'nsi':case 'pas':case 'patch':case 'php':case 'php3':case 'php4':case 'php5':\n\t\t\tcase 'phtml':case 'pl':case 'po':case 'py':case 'qmail':case 'sh':case 'shtml':\n\t\t\tcase 'sql':case 'tcl':case 'tpl':case 'txt':case 'vbs':case 'xml':case 'xrc':\n\t\t\t\treturn FTP_ASCII;\n\t\t}\n\t\tif ($file === '.htaccess') {\n\t\t\treturn FTP_ASCII;\n\t\t}\n\t\treturn FTP_BINARY;\n\t}",
"public function checkFileType($fileType){\n \t\tif ($fileType == \"application/octet-stream\"){\n \t\t\treturn true;\n \t\t}else{\n \t\t\treturn false;\n \t\t}\n \t}",
"public function extens(){\n $this->typefl = pathinfo($this->filename, PATHINFO_EXTENSION);\n\n if(!in_array($this->typefl, $this->type)){\n echo \"Wrong extension!!!\";\n return false;\n }\n else{\n return true;\n }\n }",
"function getMode() {\r\n\t\treturn $this->getOptionsSet()->getOptions(self::OPTION_TRANSFER_MODE, FTP_ASCII);\r\n\t}",
"function check_file_extension($ext, $allowed) {\nif (in_array($ext, $allowed)) {\nreturn true;\n}else {\necho \"Only .txt file allow to be uploaded\";\n}\n}",
"abstract protected function getFileExtension();",
"private function extension_is_allowed( $extension = null )\n\t{\n\t\tif( $this->config['content_types'] === false || is_null($this->config['content_types']) ) {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn ( is_null($extension) || ! in_array($extension, $this->config['content_types']) ) ? false : true;\n\t}",
"public static function guess_fileextension( $filename = null, $filecontent = null ) {\r\n\t\t\tif ( $filename ) {\r\n\t\t\t\t$filecontent = $this->getFileContents( $filename );\r\n\t\t\t\tif ( !$filecontent ) {\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t} else if ( !$filecontent ) {\r\n\t\t\t\tthrow new Exception( 'This function needs atleast one argument!' );\r\n\t\t\t}\r\n\t\t\t$signature = self::getFileSignature( $filecontent );\r\n\t\t\tswitch( $signature[0] ) {\r\n\t\t\t\tcase 'FF': { return ( self::is_jpg( null, $signature ) ) ? 'jpg' : (( self::is_mp3( null, $signature ) ) ? 'mp3' : false ); } break;\r\n\t\t\t\tcase '47': { return ( self::is_gif( null, $signature ) ) ? 'gif' : false; } break;\r\n\t\t\t\tcase '89': { return ( self::is_png( null, $signature ) ) ? 'png' : false; } break;\r\n\t\t\t\tcase '42': { return ( self::is_bmp( null, $signature ) ) ? 'bmp' : false; } break;\r\n\t\t\t\tcase '52': { return ( self::is_webp( null, $signature ) ) ? 'webp' : (( self::is_rar( null, $signature ) ) ? 'rar' : false ); } break;\r\n\t\t\t\tcase '1F': { return ( self::is_gzip( null, $signature ) ) ? 'gz' : false; } break;\r\n\t\t\t\tcase '37': { return ( self::is_7zip( null, $signature ) ) ? '7z' : false; } break;\r\n\t\t\t\tcase '4D': { return ( self::is_exe( null, $signature ) ) ? 'exe' : (( self::is_tiff( null, $signature ) ) ? 'tiff' : false ); } break;\r\n\t\t\t\tcase '49': { return ( self::is_tif( null, $signature ) ) ? 'tif' : (( self::is_mp3( null, $signature ) ) ? 'mp3' : false ); } break;\r\n\t\t\t\tcase '25': { return ( self::is_pdf( null, $signature ) ) ? 'pdf' : false; } break;\r\n\t\t\t\tcase '30': { return ( self::is_wmv( null, $signature ) ) ? 'wmv' : false; } break;\r\n\t\t\t\tcase '75': { return ( self::is_tar( null, $signature ) ) ? 'tar' : false; } break;\r\n\t\t\t\tcase '3C': { return ( self::is_xml( null, $signature ) ) ? 'xml' : false; } break;\r\n\t\t\t\tdefault: {\r\n\t\t\t\t\t$signature = self::getFileSignature( $filecontent, 4 );\r\n\t\t\t\t\tswitch( $signature[0] ) {\r\n\t\t\t\t\t\tcase '66': { return ( self::is_mp4( null, $signature ) ) ? 'mp4' : false; } break;\r\n\t\t\t\t\t\tcase '1A': { return ( self::is_webm( null, $signature ) ) ? 'webm' : false; } break;\r\n\t\t\t\t\t\tdefault: {\r\n\t\t\t\t\t\t\t$signature = self::getFileSignature( $filecontent, 8 );\r\n\t\t\t\t\t\t\tswitch( $signature[0] ) {\r\n\t\t\t\t\t\t\t\tcase '57': { return ( self::is_wav( null, $signature ) ) ? 'wav' : false; } break;\r\n\t\t\t\t\t\t\t\tcase '41': { return ( self::is_avi( null, $signature ) ) ? 'avi' : false; } break;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn false;\r\n\t\t}",
"function getMimeMode($ext,$viewMode=false) {\n\t\t// if viewMode, will use inline for formats that most browsers can handle\n\t\t$knownExts = array(\n\t\t'gif' => false,\n\t\t'jpg' => false,\n\t\t'jpeg' => false,\n\t\t'png' => false,\n\t\t'psd' => true,\n\t\t'zip' => true,\n\t\t'rar' => true,\n\t\t'7z' => true,\n\t\t'doc' => true,\n\t\t'docx' => true,\n\t\t'odt' => true,\n\t\t'rtf' => true,\n\t\t'swf' => false,\n\t\t'tif' => !$viewMode,\n\t\t'au' => !$viewMode,\n\t\t'pdf' => !$viewMode,\n\t\t'mp3' => !$viewMode,\n\t\t'ogg' => !$viewMode,\n\t\t'ico' => false,\n\t\t'mpg' => !$viewMode,\n\t\t'mpeg' => !$viewMode,\n\t\t'qt' => !$viewMode,\n\t\t'mov' => !$viewMode,\n\t\t'mp4' => !$viewMode,\n\t\t'avi' => !$viewMode,\n\t\t'mkv' => !$viewMode, // do browsers really support this?\n\t\t'txt' => false,\n\t\t'html' => false,\n\t\t'htm' => false,\n\t\t'xml' => true,\n\t\t'xls' => true,\n\t\t'wmv' => !$viewMode,\n\t\t'pps' => true,\n\t\t'ppt' => true,\n\t\t'exe' => true,\n\t\t'msi' => true,\n\t\t'bat' => true,\n\t\t'ps' => true,\n\t\t'qif' => !$viewMode,\n\t\t'ai' => true,\n\t\t'wma' => !$viewMode,\n\t\t'css' => false,\n\t\t'js' => false,\n\t\t'rss' => false,\n\t\t'json' => false\n\t\t);\n\t\treturn isset($knownExts[$ext])?$knownExts[$ext]:true;\n\t}",
"function getFileType ( $ext ) {\n\t\t\tforeach ( self::$TYPES_TO_EXTENSIONS as $type => $extensions ) {\n\t\t\t\tif ( in_array( $ext, $extensions ) ) {\n\t\t\t\t\treturn $type;\n\t\t\t\t}\n\t\t\t}\t\t\t\n\t\t\t\n\t\t\treturn false;\n\t\t\t\n\t\t}",
"function extension2fileType( $extension )\n{\n $file_types = '' ; # initialize\n switch ( strtolower( $extension ) )\n {\n case '.jpg':\n case '.jpeg':\n $file_types = 'image/pjpeg,image/jpeg' ;\n break ;\n case '.gif':\n $file_types = 'image/gif' ;\n break ;\n case '.png':\n $file_types = 'image/x-png' ;\n break ;\n case '.doc':\n $file_types = 'application/msword' ;\n break ;\n case '.zip':\n $file_types = 'application/x-zip-compressed' ;\n break ;\n case '.pdf':\n $file_types = 'application/pdf' ;\n break ;\n case '.xls':\n $file_types = 'application/vnd.ms-excel' ;\n break ;\n case '.mp3':\n $file_types = 'audio/mpeg' ;\n break ;\n case '.txt':\n $file_types = 'text/plain' ;\n break ;\n case '.htm':\n case '.html':\n $file_types = 'text/html' ;\n break ;\n case '.wma':\n $file_types = 'audio/x-ms-wma' ;\n break ;\n default:\n $file_types = 'image/pjpeg,image/jpeg' ; # default to .jpg\n }\n return $file_types ; # return matching file type!\n}",
"public function getFileExtension();",
"public function getFileMode()\n {\n if (isset($this->raw->chmod)) {\n return intval($this->raw->chmod, 8);\n }\n\n return null;\n }",
"protected function determineTargetFileExtension() {}",
"public function validExtension() {\t\n\t\tif(in_array($this->extension, $this->extensions)) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}",
"function getTargetFileExtension() ;",
"function extension($ext){\r\n\t\tif ($ext == \"jpg\" || $ext == \"jpeg\" || $ext == \"png\") {\r\n\t\t\t$ret = 1;\r\n\t\t} else{\r\n\t\t\t$ret = 0;\r\n\t\t}\r\n\r\n\t\treturn $ret;\r\n\t}",
"public function checkExtensions()\r\n\t{\r\n\t\treturn (strcasecmp(pathinfo($this->targetFile, PATHINFO_EXTENSION), pathinfo($this->referenceFile, PATHINFO_EXTENSION)) === 0);\r\n\t}",
"public function getFileExtension(){\n\n if($this->isPhoto()){\n return \"jpg\";\n }\n\n if($this->isVideo()){\n return \"mp4\";\n }\n\n return \"bin\";\n\n }",
"public function isValidType( $ext=null ){\n global $VALID_FILES;\n if (!$ext)\n $ext = $this->ext; \n return (in_array( $ext, $VALID_FILES )); \n }",
"function getExtensionsFile($filename) {\r\n\t\tif ( !file_exists($filename) ) {\r\n\t\t\tthrow new ftpException(\"Extensions-file '$filename' does not exist\");\r\n\t\t}\r\n\t\tif ( !is_readable($filename) ) {\r\n\t\t\tthrow new ftpException(\"Extensions-file '$filename' is not readable\");\r\n\t\t}\r\n\t\t\r\n\t\t$exts = @parse_ini_file($filename, true);\r\n\t\tif ( !is_array($exts) ) {\r\n\t\t\tthrow new ftpException(\"Extensions-file '$filename' could not be loaded\");\r\n\t\t}\r\n\t\t\r\n\t\t$this->_file_extensions = array();\r\n\t\t\r\n\t\tif ( isset($exts['ASCII']) ) {\r\n\t\t\tforeach ( $exts['ASCII'] as $ext => $bogus ) {\r\n\t\t\t\t$this->_file_extensions[$ext] = FTP_ASCII;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif ( isset($exts['BINARY']) ) {\r\n\t\t\tforeach ( $exts['BINARY'] as $ext => $bogus ) {\r\n\t\t\t\t$this->_file_extensions[$ext] = FTP_BINARY;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn true;\r\n\t}",
"public function getTargetFileExtension() {}",
"public function getTargetFileExtension() {}",
"public function extIsAllowed( $ext )\n {\n if ( !mb_strlen($ext) )\n {\n return false;\n }\n\n return in_array($ext, self::$ext);\n }",
"function availableFileTypes($ext) {\n //checking file type extension\n switch ($ext) {\n //checking txt extention\n case \"txt\":\n $type[0] = \"text/plain\";\n break;\n\n //checking xml extention\n case \"xml\":\n $type[0] = \"text/xml\";\n $type[1] = \"application/xml\";\n break;\n\n //checking csv extention\n case \"csv\":\n $type[0] = \"text/x-comma-separated-values\";\n $type[1] = \"application/octet-stream\";\n $type[2] = \"text/plain\";\n break;\n\n //checking zip extention\n case \"zip\":\n $type[0] = \"application/zip\";\n break;\n\n //checking tar extention\n case \"tar\":\n $type[0] = \"application/x-gzip\";\n break;\n\n //checking ctar extention\n case \"ctar\":\n $type[0] = \"application/x-compressed-tar\";\n break;\n\n //checking pdf extention\n case \"pdf\":\n $type[0] = \"application/pdf\";\n break;\n\n //checking doc extention\n case \"doc\":\n $type[0] = \"application/msword\";\n $type[1] = \"application/octet-stream\";\n break;\n\n //checking xls extention\n case \"xls\":\n $type[0] = \"application/vnd.ms-excel\";\n $type[1] = \"application/vnd.oasis.opendocument.spreadsheet\";\n break;\n\n //checking ppt extention\n case \"ppt\":\n $type[0] = \"application/vnd.ms-powerpoint\";\n break;\n\n //checking jpg extention\n case \"jpg\":\n $type[0] = \"image/jpg\";\n $type[1] = \"image/jpeg\";\n $type[2] = \"image/pjpeg\";\n break;\n\n //checking gif extention\n case \"gif\":\n $type[0] = \"image/gif\";\n break;\n\n //checking png extention\n case \"png\":\n $type[0] = \"image/png\";\n break;\n\n //checking bmp extention\n case \"bmp\":\n $type[0] = \"image/bmp\";\n break;\n\n //checking icon extention\n case \"icon\":\n $type[0] = \"image/x-ico\";\n break;\n\n //checking tfontt extention\n case \"font\":\n $type[0] = \"application/x-font-ttf\";\n break;\n }\n\n return $type;\n }",
"public static function isNeedConvertExtension($extension)\n\t{\n\t\tstatic $convertFormat = array(\n\t\t\t'doc' => 'docx',\n\t\t\t'.doc' => '.docx',\n\t\t\t'xls' => 'xlsx',\n\t\t\t'.xls' => '.xlsx',\n\t\t\t'ppt' => 'pptx',\n\t\t\t'.ppt' => '.pptx',\n\t\t);\n\n\t\treturn isset($convertFormat[$extension]) || isset($convertFormat[mb_strtolower($extension)]);\n\t}",
"protected function checkExtension() {\n\t\t\n\t\t//If no extensions set, all are valid\n\t\tif(empty($this->valid_extensions)) {\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\t$extension = $this->getExtension();\n\t\t\n\t\treturn in_array($extension, $this->valid_extensions) ? true : false;\n\t\t\n\t}",
"function fromExt($ext) \n {\n $mtl = $GLOBALS['File_MimeType'];\n $ext = strtolower($ext);\n foreach($mtl as $mtd) {\n if (in_array($ext, $mtd[1])) {\n return $mtd[0];\n }\n }\n return 'application/octet-stream';\n }"
] |
[
"0.6222746",
"0.59937483",
"0.5992325",
"0.5862044",
"0.5817195",
"0.5796146",
"0.57901603",
"0.57067025",
"0.5697592",
"0.567932",
"0.5632301",
"0.55994314",
"0.5553778",
"0.5549837",
"0.5525384",
"0.55070263",
"0.54663616",
"0.54640836",
"0.5455433",
"0.5452496",
"0.54275656",
"0.53847635",
"0.53842497",
"0.5383634",
"0.5381155",
"0.53706455",
"0.53451234",
"0.53248817",
"0.52952963",
"0.5290869"
] |
0.672113
|
0
|
Returns the baseOptionsSet object
|
function getOptionsSet() {
if ( !$this->_OptionsSet instanceof baseOptionsSet ) {
$this->_OptionsSet = new baseOptionsSet();
}
return $this->_OptionsSet;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function getOptionsSet() {\n\t\tif ( !$this->_OptionsSet instanceof baseOptionsSet ) {\n\t\t\t$this->_OptionsSet = new baseOptionsSet();\n\t\t}\n\t\treturn $this->_OptionsSet;\n\t}",
"public function getBaseOptions()\n {\n return array();\n }",
"protected function getOptionSets() {\n return $this->getOptionSetsManager()->getOptions();\n }",
"function setOptionsSet(baseOptionsSet $inOptionsSet) {\n\t\tif ( $inOptionsSet !== $this->_OptionsSet ) {\n\t\t\t$this->_OptionsSet = $inOptionsSet;\n\t\t\t$this->setModified();\n\t\t}\n\t\treturn $this;\n\t}",
"public function getOptions()\n {\n return ArrayHelper::merge(\n parent::getOptions(),\n ['children' => []]\n );\n }",
"abstract public function getOptions();",
"protected function getOptionSetsManager() {\n return \\Drupal::service('option_sets.manager');\n }",
"public function getOptions()\n {\n return array_merge(parent::getOptions(), []);\n }",
"public function getOptions()\n {\n return array_merge(parent::getOptions(), []);\n }",
"public function getOptions()\n { return $this->get('options'); }",
"protected function getOptions()\n {\n return $this->options;\n }",
"public function getOptions() {\n\n return $this->options;\n }",
"public function getOptions()\n {\n return $this->_options;\n }",
"public function getOptions()\n {\n return $this->options;\n }",
"public function getOptions()\n {\n return $this->options;\n }",
"public function getOptions()\n {\n return $this->_options;\n }",
"public function getOptions() \n {\n return $this->options;\n }",
"public function getOptions()\n {\n return $this->_options;\n }",
"public function getOptions()\n {\n return $this->_options;\n }",
"public function getOptions()\n {\n return $this->_options;\n }",
"public function getOptions()\n {\n return $this->_options;\n }",
"public function getOptions() {\n return $this->options;\n }",
"public function getOptions() {\n return $this->options;\n }",
"public function getOptions()\n {\n return $this->options ?: [];\n }",
"public function getOptions()\n {\n return $this->options;\n }",
"public function getOptions()\n {\n return $this->options;\n }",
"public function getOptions()\n {\n return $this->options;\n }",
"public function getOptions()\n {\n return $this->options;\n }",
"public function getOptions()\n {\n return $this->options;\n }",
"public function getOptions()\n {\n return $this->options;\n }"
] |
[
"0.836398",
"0.6810016",
"0.631381",
"0.60119367",
"0.5970159",
"0.59405893",
"0.5907657",
"0.5883584",
"0.5883584",
"0.5828509",
"0.5827756",
"0.5814671",
"0.58013594",
"0.5790813",
"0.5790813",
"0.57905287",
"0.5789148",
"0.5783503",
"0.5783503",
"0.5783503",
"0.5783503",
"0.5781485",
"0.5781485",
"0.5775702",
"0.57705283",
"0.57705283",
"0.57705283",
"0.57705283",
"0.57705283",
"0.57705283"
] |
0.8351127
|
1
|
Set the transfermode. You can use the predefined constants FTP_ASCII or FTP_BINARY. The mode will be stored for any further transfers.
|
function setMode($mode) {
if ( ($mode == FTP_ASCII) || ($mode == FTP_BINARY) ) {
$this->getOptionsSet()->setOptions(array(self::OPTION_TRANSFER_MODE => $mode));
return $this;
} else {
throw new ftpException('FTP-Mode has either to be FTP_ASCII or FTP_BINARY');
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function getMode() {\r\n\t\treturn $this->getOptionsSet()->getOptions(self::OPTION_TRANSFER_MODE, FTP_ASCII);\r\n\t}",
"function setMode($mode) {\n\t\t$this->_mode = $mode;\n\t}",
"function setMode($mode) {\n\t\t$this->_mode = $mode;\n\t}",
"public function SetMode($mode)\n\t{\n\t\t$this->mode = $mode;\n\t}",
"public function setMode($mode) {\n $this->mode = $mode;\n }",
"public function setMode($mode)\n {\n $this->mode = $mode;\n }",
"private function setMode($mode)\n {\n $this->mode = $mode;\n }",
"function setMode($mode)\n {\n $this->_mcryptMode = $mode;\n }",
"function setMode($mode)\n {\n $this->mode = $mode;\n $this->determineRequiredPermission();\n }",
"private function setMode() {\r\n\t\t$this->mode = substr($this->mode, -1);\r\n\t}",
"public function setMode($mode = 'create')\n {\n $this->mode = $mode;\n }",
"public function setMode($mode)\n {\n if (Router::isMode($mode)) {\n $this->_mode = $mode;\n }\n\n return $this->_mode;\n }",
"function setEncryptionMode($mode)\n {\n $this->encryptionMode = $mode;\n }",
"function setMode($value) {\r\n\t\t$this->mode = $value;\r\n\t}",
"public function setMode($mode)\n {\n $this->_isLiveMode = ($mode == self::LIVE);\n }",
"public static function mode($mode) {\n static::$mode = $mode;\n }",
"public function setMode($mode)\n {\n $this->options['mode'] = $mode ?? $this->options['mode'];\n return $this;\n }",
"public function Set_Mode($Mode=UniCAT::UNICAT_OPTION_WRITE)\n\t{\n\t\ttry\n\t\t{\n\t\t\tif(!in_array($Mode, UniCAT::ShowOptions_FileWriter()))\n\t\t\t{\n\t\t\t\tthrow new UniCAT_Exception(UniCAT::UNICAT_XCPT_MAIN_CLS, UniCAT::UNICAT_XCPT_MAIN_FNC, UniCAT::UNICAT_XCPT_MAIN_PRM, UniCAT::UNICAT_XCPT_SEC_PRM_DMDOPTION);\n\t\t\t}\n\t\t}\n\t\tcatch(UniCAT_Exception $Exception)\n\t\t{\n\t\t\t$Exception -> ExceptionWarning(__CLASS__, __FUNCTION__, MethodScope::Get_ParameterName(__CLASS__, __FUNCTION__), UniCAT::ShowOptions_FileWriter());\n\t\t}\n\t\t\n\t\t$this -> Mode = $Mode;\n\t}",
"function ftp_trans_mode($file){ \n $path_parts = pathinfo($file);\n\t\t\n\t\tif (!isset($path_parts['extension']))\n\t\t\treturn FTP_BINARY;\n\t\tswitch (strtolower($path_parts['extension'])) {\n\t\t\tcase 'am':case 'asp':case 'bat':case 'c':case 'cfm':case 'cgi':case 'conf':\n\t\t\tcase 'cpp':case 'css':case 'dhtml':case 'diz':case 'h':case 'hpp':case 'htm':\n\t\t\tcase 'html':case 'in':case 'inc':case 'js':case 'm4':case 'mak':case 'nfs':\n\t\t\tcase 'nsi':case 'pas':case 'patch':case 'php':case 'php3':case 'php4':case 'php5':\n\t\t\tcase 'phtml':case 'pl':case 'po':case 'py':case 'qmail':case 'sh':case 'shtml':\n\t\t\tcase 'sql':case 'tcl':case 'tpl':case 'txt':case 'vbs':case 'xml':case 'xrc':\n\t\t\t\treturn FTP_ASCII;\n\t\t}\n\t\tif ($file === '.htaccess') {\n\t\t\treturn FTP_ASCII;\n\t\t}\n\t\treturn FTP_BINARY;\n\t}",
"public function changeMode($path, $mode);",
"public function setMode(string $mode)\n {\n $this->mode = $mode;\n return $this;\n }",
"function setPassive() {\r\n\t\t$this->getOptionsSet()->setOptions(array(self::OPTION_TRANSFER_METHOD => self::TRANSFER_METHOD_PASSIVE));\r\n\t\t@ftp_pasv($this->_handle, true);\r\n\t\treturn $this;\r\n\t}",
"public function setMode(string $mode): self\n {\n //dd($mode);\n if ($this->isValidMode($mode)) {\n $this->mode = $mode;\n } else {\n throw new \\Exception('Can\\'t set \"' . $mode . '\" as current mode, due to \"' . $mode . '\" is not a ' . static::class . ' valid mode. You must implement \"'.Str::camel($mode).static::MODES_METHODS_NAME_SUFFIX.'()\" at ' . static::class .' in order to use that mode');\n }\n return $this;\n }",
"function set_mode($mode){\r\n\r\n\t\tswitch($mode){\r\n\t\t\tcase self::OUTPUT_MODE_NORMAL:\r\n\t\t\tcase self::OUTPUT_MODE_TEMPLATE:\r\n\t\t\t$this->_mode = $mode;\r\n\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\tthrow new Exception(get_instance()->lang->line(\"Unknown output mode.\"));\r\n\t\t}\r\n\r\n\t\treturn;\r\n\t}",
"public function setCompression($mode) { \n switch($mode) {\n case \"gzip\":\n $this->compression = \"gz\";\n break;\n case \"bzip2\":\n $this->compression = \"bz2\";\n break;\n case \"none\":\n $this->compression = null;\n break;\n default:\n $this->log(\"Ignoring unknown compression mode: \".$mode, Project::MSG_WARN);\n $this->compression = null;\n }\n }",
"function setActive() {\r\n\t\t$this->getOptionsSet()->setOptions(array(self::OPTION_TRANSFER_METHOD => self::TRANSFER_METHOD_ACTIVE));\r\n\t\t@ftp_pasv($this->_handle, false);\r\n\t\treturn $this;\r\n\t}",
"public function setMode($val)\n {\n $this->_propDict[\"mode\"] = $val;\n return $this;\n }",
"function ftp_chmod($filename, $chmod = 0777) {\r\n\t\t//$chmod = (int) $chmod;\r\n\t\t\r\n\t\t$filename = dzz_ftp::clear($filename);\r\n\t\tif(function_exists('ftp_chmod')) {\r\n\t\t\treturn @ftp_chmod($this->connectid, $chmod, $filename);\r\n\t\t} else {\r\n\t\t\treturn @ftp_site($this->connectid, 'CHMOD '.$chmod.' '.$filename);\r\n\t\t}\r\n\t}",
"public function setMode($mode)\n {\n if (in_array($mode, $this->modeList)) {\n $this->mode = $mode;\n }\n\n return $this;\n }",
"function setTokenMode($value)\n {\n $this->_props['TokenMode'] = $value;\n }"
] |
[
"0.6850781",
"0.65944886",
"0.65944886",
"0.6564583",
"0.65627694",
"0.65428835",
"0.6451531",
"0.63967395",
"0.6360661",
"0.6278658",
"0.6198315",
"0.5991085",
"0.59650475",
"0.59004724",
"0.5823119",
"0.5705238",
"0.56567866",
"0.56388",
"0.56295097",
"0.5612661",
"0.56083703",
"0.5525855",
"0.5503029",
"0.55017483",
"0.5501381",
"0.54496866",
"0.5423576",
"0.54207975",
"0.5411374",
"0.5360786"
] |
0.82249117
|
0
|
Set the transfermethod to passive mode
|
function setPassive() {
$this->getOptionsSet()->setOptions(array(self::OPTION_TRANSFER_METHOD => self::TRANSFER_METHOD_PASSIVE));
@ftp_pasv($this->_handle, true);
return $this;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function setPassive($passive = true)\n {\n $this->passive = $passive;\n }",
"protected function passiveMode()\n {\n if(!filter_var($this->ip,FILTER_VALIDATE_IP,FILTER_FLAG_NO_PRIV_RANGE))\n {\n ftp_pasv($this->resource,true);\n }\n\n }",
"function isPassive() {\r\n\t\treturn $this->getOptionsSet()->getOptions(self::OPTION_TRANSFER_METHOD, self::TRANSFER_METHOD_PASSIVE);\r\n\t}",
"function setActive() {\r\n\t\t$this->getOptionsSet()->setOptions(array(self::OPTION_TRANSFER_METHOD => self::TRANSFER_METHOD_ACTIVE));\r\n\t\t@ftp_pasv($this->_handle, false);\r\n\t\treturn $this;\r\n\t}",
"public function isPassive();",
"public function getPassive()\n {\n return $this->passive;\n }",
"public function passive(bool $passive)\n {\n $this->passive = $passive;\n\n return $this;\n }",
"function setup($isPassive=TRUE) {\n\t\t// set up basic connection\n\t\t$this->conn_id = ftp_connect($this->ftp_server, $this->ftp_port); \n\n\t\t// login with username and password\n\t\t$this->login_result = ftp_login($this->conn_id, $this->ftp_user_name, $this->ftp_user_pass); \n\n\t\t// check connection\n\t\tif ((!$this->conn_id) || (!$this->login_result)) { \n\t\t\t\techo \"FTP connection has failed!\\n\";\n\t\t\t\techo \"Attempted to connect to $this->ftp_server for user $this->ftp_user_name\\n\"; \n\t\t\t\texit; \n\t\t} else {\n\t\t\t\techo \"Connected to $this->ftp_server,\\n\\t$this->ftp_user_name\\n\";\n\t\t}\n\n\t\tif($isPassive){\n\t\t\tftp_pasv($this->getConn_id(), TRUE);\n\t\t}\n\t}",
"function setMode($mode) {\r\n\t\tif ( ($mode == FTP_ASCII) || ($mode == FTP_BINARY) ) {\r\n\t\t\t$this->getOptionsSet()->setOptions(array(self::OPTION_TRANSFER_MODE => $mode));\r\n\t\t\treturn $this;\r\n\t\t} else {\r\n\t\t\tthrow new ftpException('FTP-Mode has either to be FTP_ASCII or FTP_BINARY');\r\n\t\t}\r\n\t}",
"public function setTransferMethod($transfer_method) {\n $this->transfer_method = $transfer_method;\n }",
"public function passiv_mode() {\n\t\t$CODE_RETOUR = false;\n\t\tif ($this->verifie_connexion ()) {\n\t\t\t$CODE_RETOUR = ftp_pasv ( $this->conn_id, $this->getPassive () );\n\t\t}\n\t\t\n\t\treturn $CODE_RETOUR;\n\t}",
"public function setPassive($id)\n {\n }",
"public function setPassive($id)\n {\n }",
"function getMode() {\r\n\t\treturn $this->getOptionsSet()->getOptions(self::OPTION_TRANSFER_MODE, FTP_ASCII);\r\n\t}",
"public function isPassiveRequest() {\n if (empty($this->prompt)) {\n return false;\n }\n $values = explode(' ', $this->prompt);\n return in_array(\"none\", $values);\n }",
"function setFtp_port($ftp_port) {\n\t\tif( !isset($this->conn_id) ) {\n\t\t\t$this->ftp_port = $ftp_port;\n\t\t\treturn TRUE;\n\t\t} else {\n\t\t\treturn FALSE;\n\t\t}\n\t}",
"function createFTPConnection()\n{\n $settings = getSettings();\n if (empty($settings['seedbox']) || empty($settings['seedbox']['host']) || empty($settings['seedbox']['username'])\n || empty($settings['seedbox']['password'])\n ) {\n addLog('ERROR', 'No setting file found.', 'ftp');\n return false;\n } else {\n // Connect to seedbox with SSL\n $ftp = ftp_ssl_connect($settings['seedbox']['host'], intval($settings['seedbox']['port']));\n if (!$ftp) {\n addLog('ERROR', 'Wrong FTP host.', 'ftp');\n return false;\n }\n // Log with information set on settings screen\n if (!ftp_login($ftp, $settings['seedbox']['username'], $settings['seedbox']['password'])) {\n addLog('ERROR', 'Wrong FTP login or password.', 'ftp');\n return false;\n };\n\n // Enter on passive mode\n if (ftp_pasv($ftp, true)) {\n return $ftp;\n } else {\n addLog('ERROR', 'Unable to switch to passive mode.', 'ftp');\n return false;\n }\n }\n}",
"public function connect($host=NULL,$username='',$password='',$passive=NULL,$port=NULL)\n\t{\n\t\t//Initlize Params\n\t\tif (is_array($host) and $host) {\n\t\t\t$this->initialize($host);\n\t\t} elseif ($host) {\n\t\t\t$config = array(\n\t\t\t\t'host' => $host,\n\t\t\t\t'username' => $username,\n\t\t\t\t'password' => $password\n\t\t\t);\n\t\t\tis_null($passive) || $config['passive'] = $passive;\n\t\t\tis_null($port) || $config['port'] = $port;\n\t\t\t$this->initialize($config);\n\t\t} elseif (!$this->host) {\n\t\t\tshowError('FTP connect has no config, Connect been stopped.',FALSE);\n\t\t\treturn FALSE;\n\t\t}\n\n\t\t//Connect\n\t\t$this->conn = @ftp_connect($this->host,$this->port);\n\n\t\tif (!$this->conn) {\n\t\t\tshowError(\"Unable to connect to FTP server '{$this->host}'\",FALSE);\n\t\t\treturn FALSE;\n\t\t}\n\n\t\t//Login\n\t\t$login = @ftp_login($this->conn,$this->username,$this->password);\n\t\tif (!$login) {\n\t\t\tshowError(\"Unable to login to FTP server\");\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tif ($this->passive) {\n\t\t\tftp_pasv($this->conn,TRUE);\n\t\t}\n\n\t\treturn TRUE;\n\t}",
"function ftp_trans_mode($file){ \n $path_parts = pathinfo($file);\n\t\t\n\t\tif (!isset($path_parts['extension']))\n\t\t\treturn FTP_BINARY;\n\t\tswitch (strtolower($path_parts['extension'])) {\n\t\t\tcase 'am':case 'asp':case 'bat':case 'c':case 'cfm':case 'cgi':case 'conf':\n\t\t\tcase 'cpp':case 'css':case 'dhtml':case 'diz':case 'h':case 'hpp':case 'htm':\n\t\t\tcase 'html':case 'in':case 'inc':case 'js':case 'm4':case 'mak':case 'nfs':\n\t\t\tcase 'nsi':case 'pas':case 'patch':case 'php':case 'php3':case 'php4':case 'php5':\n\t\t\tcase 'phtml':case 'pl':case 'po':case 'py':case 'qmail':case 'sh':case 'shtml':\n\t\t\tcase 'sql':case 'tcl':case 'tpl':case 'txt':case 'vbs':case 'xml':case 'xrc':\n\t\t\t\treturn FTP_ASCII;\n\t\t}\n\t\tif ($file === '.htaccess') {\n\t\t\treturn FTP_ASCII;\n\t\t}\n\t\treturn FTP_BINARY;\n\t}",
"function ftplib()\r\n {\r\n\t $this->_debug = false;\r\n $this->_umask = 0022;\r\n $this->_timeout = 30;\r\n $this->_BINARY = 1;\r\n $this->_ASCII = 0;\r\n /*if (function_exists(\"ftp_connect\")) {\r\n \t\t$this->_use_mod_ftp = true;\r\n \t} else {*/\r\n \r\n\t\t\t$this->_use_mod_ftp = false;\r\n \t//}\r\n }",
"public function GetFTPPassive(GetFTPPassive $parameters)\n {\n return $this->__soapCall('GetFTPPassive', array($parameters));\n }",
"public function applyConnection()\n\t{\n\t\t$result = (object) [\n\t\t\t'status' => true,\n\t\t\t'message' => '',\n\t\t\t'ignorable' => false,\n\t\t];\n\n\t\t// Get the parameters from the request\n\t\t$transferOption = $this->input->getCmd('method', 'ftp');\n\t\t$force = $this->input->getInt('force', 0);\n\t\t$ftpHost = $this->input->get('host', '', 'raw', 2);\n\t\t$ftpPort = $this->input->getInt('port', null);\n\t\t$ftpUsername = $this->input->get('username', '', 'raw', 2);\n\t\t$ftpPassword = $this->input->get('password', '', 'raw', 2);\n\t\t$ftpPubKey = $this->input->get('public', '', 'raw', 2);\n\t\t$ftpPrivateKey = $this->input->get('private', '', 'raw', 2);\n\t\t$ftpPassive = $this->input->getInt('passive', 1);\n\t\t$ftpPassiveFix = $this->input->getInt('passive_fix', 1);\n\t\t$ftpDirectory = $this->input->get('directory', '', 'raw', 2);\n\t\t$chunkMode = $this->input->getCmd('chunkMode', 'chunked');\n\t\t$chunkSize = $this->input->getInt('chunkSize', '5242880');\n\n\t\t// Fix the port if it's missing\n\t\tif (empty($ftpPort))\n\t\t{\n\t\t\tswitch ($transferOption)\n\t\t\t{\n\t\t\t\tcase 'ftp':\n\t\t\t\tcase 'ftpcurl':\n\t\t\t\t\t$ftpPort = 21;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'ftps':\n\t\t\t\tcase 'ftpscurl':\n\t\t\t\t\t$ftpPort = 990;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'sftp':\n\t\t\t\tcase 'sftpcurl':\n\t\t\t\t\t$ftpPort = 22;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// Store everything in the session\n\t\t$this->container->platform->setSessionVar('transfer.transferOption', $transferOption, 'akeeba');\n\t\t$this->container->platform->setSessionVar('transfer.force', $force, 'akeeba');\n\t\t$this->container->platform->setSessionVar('transfer.ftpHost', $ftpHost, 'akeeba');\n\t\t$this->container->platform->setSessionVar('transfer.ftpPort', $ftpPort, 'akeeba');\n\t\t$this->container->platform->setSessionVar('transfer.ftpUsername', $ftpUsername, 'akeeba');\n\t\t$this->container->platform->setSessionVar('transfer.ftpPassword', $ftpPassword, 'akeeba');\n\t\t$this->container->platform->setSessionVar('transfer.ftpPubKey', $ftpPubKey, 'akeeba');\n\t\t$this->container->platform->setSessionVar('transfer.ftpPrivateKey', $ftpPrivateKey, 'akeeba');\n\t\t$this->container->platform->setSessionVar('transfer.ftpDirectory', $ftpDirectory, 'akeeba');\n\t\t$this->container->platform->setSessionVar('transfer.ftpPassive', $ftpPassive ? 1 : 0, 'akeeba');\n\t\t$this->container->platform->setSessionVar('transfer.ftpPassiveFix', $ftpPassiveFix ? 1 : 0, 'akeeba');\n\t\t$this->container->platform->setSessionVar('transfer.chunkMode', $chunkMode, 'akeeba');\n\t\t$this->container->platform->setSessionVar('transfer.chunkSize', $chunkSize, 'akeeba');\n\n\t\t/** @var \\Akeeba\\Backup\\Admin\\Model\\Transfer $model */\n\t\t$model = $this->getModel();\n\n\t\ttry\n\t\t{\n\t\t\t$config = $model->getFtpConfig();\n\t\t\t$model->testConnection($config);\n\t\t}\n\t\tcatch (TransferIgnorableError $e)\n\t\t{\n\t\t\t$result = (object) [\n\t\t\t\t'status' => false,\n\t\t\t\t'ignorable' => true,\n\t\t\t\t'message' => $e->getMessage(),\n\t\t\t];\n\t\t}\n\t\tcatch (Exception $e)\n\t\t{\n\t\t\t$result = (object) [\n\t\t\t\t'status' => false,\n\t\t\t\t'message' => $e->getMessage(),\n\t\t\t\t'ignorable' => false,\n\t\t\t];\n\t\t}\n\n\t\t@ob_end_clean();\n\t\techo '###' . json_encode($result) . '###';\n\t\t$this->container->platform->closeApplication();\n\t}",
"public function setMode($mode)\n {\n $this->_isLiveMode = ($mode == self::LIVE);\n }",
"public function pasv($enable = true) {\n if (false !== $this->connection) {\n ftp_pasv($this->connection, $enable);\n }\n return $this;\n }",
"function _open_data_connection()\n\t{\n\t\t// Try to find out whether we have a IPv4 or IPv6 (control) connection\n\t\tif (function_exists('stream_socket_get_name'))\n\t\t{\n\t\t\t$socket_name = stream_socket_get_name($this->connection, true);\n\t\t\t$server_ip = substr($socket_name, 0, strrpos($socket_name, ':'));\n\t\t}\n\n\t\tif (!isset($server_ip) || preg_match(get_preg_expression('ipv4'), $server_ip))\n\t\t{\n\t\t\t// Passive mode\n\t\t\t$this->_send_command('PASV', '', false);\n\n\t\t\tif (!$ip_port = $this->_check_command(true))\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// open the connection to start sending the file\n\t\t\tif (!preg_match('#[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+#', $ip_port, $temp))\n\t\t\t{\n\t\t\t\t// bad ip and port\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t$temp = explode(',', $temp[0]);\n\t\t\t$server_ip = $temp[0] . '.' . $temp[1] . '.' . $temp[2] . '.' . $temp[3];\n\t\t\t$server_port = $temp[4] * 256 + $temp[5];\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// Extended Passive Mode - RFC2428\n\t\t\t$this->_send_command('EPSV', '', false);\n\n\t\t\tif (!$epsv_response = $this->_check_command(true))\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// Response looks like \"229 Entering Extended Passive Mode (|||12345|)\"\n\t\t\t// where 12345 is the tcp port for the data connection\n\t\t\tif (!preg_match('#\\(\\|\\|\\|([0-9]+)\\|\\)#', $epsv_response, $match))\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t$server_port = (int) $match[1];\n\n\t\t\t// fsockopen expects IPv6 address in square brackets\n\t\t\t$server_ip = \"[$server_ip]\";\n\t\t}\n\n\t\t$errno = 0;\n\t\t$errstr = '';\n\n\t\tif (!$this->data_connection = @fsockopen($server_ip, $server_port, $errno, $errstr, $this->timeout))\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\t@stream_set_timeout($this->data_connection, $this->timeout);\n\n\t\treturn true;\n\t}",
"public function turn()\n {\n $this->setError('The SMTP TURN command is not implemented');\n $this->edebug('SMTP NOTICE: ' . $this->error['error'], self::DEBUG_CLIENT);\n return false;\n }",
"function setReverseMode(){\n\t\t$this->mode = SUSHEE_DEP_REVERSE_MODE;\n\t}",
"public function wp_ftp_migration($opts, $type_ftp = 'ftp'){\n\n\t\t$file \t\t\t= $this->_file_destination;\n\t\t$remote_file \t= $this->_file_destination;\n\n\t\tif($type_ftp === 'sftp'){\n\t\t\t$connection = ssh2_connect($opts['ftp_url'], 22);\n\t\t\tssh2_auth_password($connection, $opts['user_ftp'], $opts['ftp_pass']);\n\n\t\t\tssh2_scp_send($connection, 'migration.php', rtrim($opts['ftp_folder'], '/').'/migration.php', 0644);\n\t\t\tssh2_scp_send($connection, $this->_file_sql, rtrim($opts['ftp_folder'], '/').'/'.$this->_file_sql, 0644);\n\t\t\tssh2_scp_send($connection, $file, rtrim($opts['ftp_folder'], '/').'/'.$remote_file, 0644);\n\n\t\t\treturn TRUE;\n\t\t}\n\n\t\tif($type_ftp === 'ftp'){\n\t\t\t$conn_id = ftp_connect($opts['ftp_url']);\n\t\t}elseif ($type_ftp === 'ftps') {\n\t\t\t$conn_id = ftp_ssl_connect($opts['ftp_url']);\n\t\t}\n\n\t\tif($conn_id == FALSE){\n\n\t\t\treturn FALSE;\n\t\t}\n\n\t\t$login_result = ftp_login($conn_id, $opts['user_ftp'], $opts['ftp_pass']);\n\t\tif($login_result == FALSE){\n\n\t\t\treturn FALSE;\n\t\t}\n\n\t\t// Envoie de tous les fichiers en FTP\n\t\t$this->ftp_putAll($conn_id, '.', rtrim($opts['ftp_folder'], '/'));\n\t\t\n\t\tftp_close($conn_id);\n\n\t\treturn TRUE;\n\t}",
"public function connect($options = array())\n {\n //todo can this be a stream?\n $this->temp = '/Users/amystephen/Sites/Filesystem/.dev/Tests/Hold/amy.txt';\n\n parent::connect($options);\n\n if ($this->is_connected === true) {\n return;\n }\n\n try {\n if ($this->getConnectType() == 'ftps') {\n\n if (function_exists('ftp_ssl_connect')) {\n throw new InvalidArgumentException\n ('ftp_ssl_connect must be enabled in PHP to use SSL over Ftp');\n }\n\n $id = \\ftp_ssl_connect($this->host, $this->port, $this->timeout);\n\n } else {\n $id = \\ftp_connect($this->host, $this->port, $this->timeout);\n }\n\n $this->setConnection($id);\n\n } catch (\\Exception $e) {\n throw new \\InvalidArgumentException\n ('Filesystem Adapter Ftp: Unable to connect to the Ftp Server '\n . ' Host: ' . $this->host . ' Port: ' . $this->port);\n }\n\n if ($this->is_connected === false) {\n throw new \\InvalidArgumentException\n ('Filesystem Adapter Ftp: Not connected '\n . ' Host: ' . $this->host . ' Port: ' . $this->port);\n }\n\n try {\n \\ftp_pasv($this->connection, $this->getPassiveMode());\n\n } catch (\\Exception $e) {\n\n throw new \\InvalidArgumentException\n ('Filesystem Adapter Ftp: Unable to set passive mode for Ftp Server '\n . ' Host: ' . $this->host . ' Port: ' . $this->port);\n }\n\n try {\n $this->login();\n\n } catch (\\Exception $e) {\n\n throw new \\InvalidArgumentException\n ('Filesystem Adapter Ftp: Login failed for ' . ' User: ' . $this->username\n . ' Host: ' . $this->host . ' Port: ' . $this->port);\n }\n\n try {\n $this->is_windows = false;\n\n $ftpSystemType = \\ftp_systype($this->getConnection());\n\n if (stripos($ftpSystemType, 'win') == false) {\n $this->is_windows = false;\n } else {\n $this->is_windows = true;\n }\n\n } catch (\\Exception $e) {\n\n throw new \\InvalidArgumentException\n ('Filesystem Adapter Ftp: Login failed for ' . ' User: ' . $this->username\n . ' Host: ' . $this->host . ' Port: ' . $this->port);\n }\n\n try {\n if ($this->initial_directory === null) {\n $results = true;\n } else {\n $results = \\ftp_chdir($this->connection, $this->initial_directory);\n }\n\n } catch (\\Exception $e) {\n\n throw new \\InvalidArgumentException\n ('Filesystem Adapter Ftp: Changing Ftp Directory failed. Directory: '\n . $this->initial_directory);\n }\n\n if ($results === false) {\n\n throw new \\InvalidArgumentException\n ('Filesystem Adapter Ftp: Unable to change directory: '\n . $this->root . ' for Ftp Server '\n . ' Host: ' . $this->host . ' Port: ' . $this->port);\n }\n\n return;\n }",
"function setMode($mode)\n {\n $this->_mcryptMode = $mode;\n }"
] |
[
"0.7559317",
"0.75359666",
"0.71501225",
"0.70234513",
"0.6735268",
"0.6558415",
"0.6455848",
"0.61674577",
"0.6076515",
"0.5956675",
"0.5813254",
"0.5641019",
"0.5641019",
"0.54413456",
"0.5257897",
"0.5136559",
"0.5117393",
"0.51021487",
"0.5034456",
"0.5033596",
"0.49786726",
"0.49557954",
"0.49163714",
"0.48917013",
"0.48354524",
"0.4782541",
"0.47556266",
"0.47306964",
"0.4725684",
"0.46888897"
] |
0.7793043
|
0
|
Set the transfermethod to active mode
|
function setActive() {
$this->getOptionsSet()->setOptions(array(self::OPTION_TRANSFER_METHOD => self::TRANSFER_METHOD_ACTIVE));
@ftp_pasv($this->_handle, false);
return $this;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function setActive()\n\t\t{\n\t\t\t$this->_state = 1;\n\t\t}",
"public function setActive()\r\n {\r\n $this->active = true;\r\n }",
"public function setActive() {}",
"public function setTransferMethod($transfer_method) {\n $this->transfer_method = $transfer_method;\n }",
"private function setMode() {\r\n\t\t$this->mode = substr($this->mode, -1);\r\n\t}",
"public function SetActive ($active = TRUE);",
"public function setActive()\n {\n $this->update(['status' => static::STATUS_ACTIVE]);\n }",
"function setActive() ;",
"public function setActive($value) {\n if ($value != $this->_active) {\n if ($value)\n $this->connect();\n else\n $this->close();\n }\n }",
"public function setActivation(): void;",
"function setMode($mode) {\n\t\t$this->_mode = $mode;\n\t}",
"function setMode($mode) {\n\t\t$this->_mode = $mode;\n\t}",
"public function setActive($active = true)\n {\n $this->active = $active;\n }",
"public function setActive($active)\n {\n $this->active = $active;\n }",
"public function setActive($active)\n {\n $this->active = $active;\n }",
"public function setModeCurrent() {\n\t\t$this->mode = 'current';\n\t}",
"public function setActive($value) {\n\t\t$this->_active = $value;\n\t}",
"function setMode($mode)\n {\n $this->_mcryptMode = $mode;\n }",
"public function setActive(bool $active){\n // enables \"active\" change for this model\n $this->allowActiveChange = true;\n $this->active = $active;\n }",
"public function setActive($value) {\n if ($value != $this->_active) {\n if ($value)\n $this->open();\n else\n $this->close();\n }\n }",
"public function setMode($mode) {\n $this->mode = $mode;\n }",
"function setActive($a_active)\n\t{\n\t\t$this->active = $a_active;\n\t}",
"function setMode($value) {\r\n\t\t$this->mode = $value;\r\n\t}",
"public function switchMode($mode) {\r\n if (!$this->statusIsAvailable($mode))\r\n\t{\r\n\t\tCertissimLogger::insertLogKwixo(__FILE__, \"Le mode '$mode' n'est pas reconnu. 'test' défini à la place.\");\r\n\t\t$mode = 'test';\r\n\t}\r\n\r\n\t//switch the status to $mode\r\n\t$this->setStatus($mode);\r\n\r\n\t//reload URLs\r\n\t$this->loadURLs();\r\n }",
"function setMode($mode) {\r\n\t\tif ( ($mode == FTP_ASCII) || ($mode == FTP_BINARY) ) {\r\n\t\t\t$this->getOptionsSet()->setOptions(array(self::OPTION_TRANSFER_MODE => $mode));\r\n\t\t\treturn $this;\r\n\t\t} else {\r\n\t\t\tthrow new ftpException('FTP-Mode has either to be FTP_ASCII or FTP_BINARY');\r\n\t\t}\r\n\t}",
"public function setActive($value);",
"public function setMode($mode)\n {\n $this->_isLiveMode = ($mode == self::LIVE);\n }",
"function enableTestMode()\n {\n $this->testMode = TRUE;\n $this->gatewayUrl = 'https://sandbox/url/yet/to/define';\n }",
"public function SetMode($mode)\n\t{\n\t\t$this->mode = $mode;\n\t}",
"public function setMode($mode)\n {\n $this->mode = $mode;\n }"
] |
[
"0.6446733",
"0.64192504",
"0.63525045",
"0.6117903",
"0.6024459",
"0.5942182",
"0.5850992",
"0.5840481",
"0.5839646",
"0.58149135",
"0.5809298",
"0.5809298",
"0.5803175",
"0.572635",
"0.572635",
"0.5717569",
"0.57032007",
"0.5702752",
"0.5659796",
"0.56547743",
"0.55781746",
"0.55399525",
"0.5534791",
"0.55270684",
"0.55108815",
"0.54998106",
"0.546741",
"0.54289633",
"0.5427278",
"0.54195285"
] |
0.7487946
|
0
|
Set the timeout for FTP operations Use this method to set a timeout for FTP operation. Timeout has to be an integer.
|
function setTimeout($timeout = 0) {
if ( !is_int($timeout) || ($timeout < 0) ) {
throw new ftpException('Timeout '.$timeout.' is invalid, has to be an integer >= 0');
}
$this->getOptionsSet()->setOptions(array(self::OPTION_TIMEOUT => $timeout));
if ( isset($this->_handle) && is_resource($this->_handle) ) {
$res = @ftp_set_option($this->_handle, FTP_TIMEOUT_SEC, $timeout);
} else {
$res = true;
}
if ( !$res ) {
throw new ftpException("Set timeout failed.");
}
return $this;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function set_timeout($timeout)\n {\n // Sanitize the timeout, and save to instance.\n \n $this->timeout = (int)$timeout;\n }",
"public function setConnectionTimeout($timeout);",
"public function set_timeout($timeout = 10)\n {\n }",
"public function setTimeout($timeout){\n curl_setopt($this->ch, CURLOPT_TIMEOUT_MS, $timeout);\n curl_setopt($this->ch, CURLOPT_CONNECTTIMEOUT_MS, $timeout);\n }",
"public function setTimeout($timeout) {\n\t\t\tcurl_setopt($this->_curl, CURLOPT_TIMEOUT, $timeout);\n\t\t}",
"public function setTimeout($timeout)\n {\n $this->timeout = $timeout;\n }",
"public function setRpcTimeout(float $timeout): void\n {\n }",
"public function setConnectTimeoutMs(int $timeout): void;",
"public function setTimeout($timeout)\n {\n static::$timeout = $timeout;\n }",
"function set_timeout($timeout) {\n if (!is_integer($timeout)) {\n if (is_numeric($timeout)) {\n $this->timeout = (integer($timeout));\n return true;\n }\n return false;\n }\n $this->timeout = $timeout;\n return true;\n }",
"public function setConnectionTimeout($timeout)\n {\n // do nothing\n }",
"public function setTimeOut($timeout){\n\t\t$this->_timeout = $timeout;\n\t\t$this->setMessage(\"Setting time out: \".$this->_timeout);\n\t}",
"public function timeout($timeout);",
"public function setTimeout( $timeout )\n\t{\n\t\t$this->config['timeout'] = $timeout;\n\t}",
"public function setTimeout(int $timeout): self\n {\n $this->options['timeout'] = $timeout;\n return $this;\n }",
"public function setTimeout(int $timeout): self\n {\n $this->options['timeout'] = $timeout;\n return $this;\n }",
"function getTimeout() {\r\n\t\treturn ftp_get_option($this->_handle, FTP_TIMEOUT_SEC);\r\n\t}",
"public function setTimeout($timeout = null)\r\n {\r\n if ($timeout === null) {\r\n $timeout = 30000;\r\n }\r\n if (!is_int($timeout)) {\r\n throw new \\InvalidArgumentException('Parameter is not an integer');\r\n }\r\n if ($timeout < 0) {\r\n throw new \\InvalidArgumentException('Parameter is negative. Only positive timeouts accepted.');\r\n }\r\n\r\n $this->timeout = $timeout;\r\n return $this;\r\n }",
"public function setTimeout($nTimeout){\n\t\t\tself::$timeout = $nTimeout;\n\t\t}",
"public function setTimeout($timeout)\n {\n $this->provider->timeout = $timeout;\n }",
"public function setTimeout($timeout)\n {\n $this->_param['timeout'] = (int)$timeout;\n return $this;\n }",
"public function setWriteTimeout(float $timeout): void\n {\n }",
"public function setTimeout($timeout)\n {\n $this->requestTimeout = intval($timeout);\n return $this;\n }",
"public function setTimeout($timeout)\n\t{\n\t\t$this->timeout = (int)$timeout;\n\t\treturn $this;\n\t}",
"public function setTimeout( $timeout ) {\n $this->_timeout = $timeout;\n return $this;\n }",
"public function setTimeout($timeout);",
"public function setSessionTimeout($timeout)\n {\n $this->sessionTimeout = abs($timeout);\n }",
"public function setTimeout($timeout)\n {\n $timeout = (float) $timeout;\n if ($timeout) {\n $this->timeout = $timeout;\n }\n return $this;\n }",
"public function setTimeout($timeout)\n {\n $this->timeout = (int) $timeout;\n\n return $this;\n }",
"public function setReadTimeout(float $timeout): void\n {\n }"
] |
[
"0.6976904",
"0.6955168",
"0.6949712",
"0.68502665",
"0.66588414",
"0.66486305",
"0.66191757",
"0.6510758",
"0.6496033",
"0.6495994",
"0.6435909",
"0.64264894",
"0.63783514",
"0.6364912",
"0.63516015",
"0.63516015",
"0.6348588",
"0.6340599",
"0.63151735",
"0.62643373",
"0.62338257",
"0.6153681",
"0.6121069",
"0.61021066",
"0.6065763",
"0.60615426",
"0.6055838",
"0.6054053",
"0.60531986",
"0.6046039"
] |
0.803322
|
0
|
Adds an extension to a modedirectory The modedirectory saves fileextensions coresponding to filetypes (ascii e.g.: 'php', 'txt', 'htm',...; binary e.g.: 'jpg', 'gif', 'exe',...). The extensions have to be saved without the '.'. And can be predefined in an external file (see: getExtensionsFile()). The array is build like this: 'php' => FTP_ASCII, 'png' => FTP_BINARY To change the mode of an extension, just add it again with the new mode!
|
function addExtension($mode, $ext) {
$this->_file_extensions[$ext] = $mode;
return $this;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function addExtension(string $extension);",
"private function addExtension($extension) {\n $extension = trim(strtolower($extension));\n $extension = preg_quote($extension, \"#\");\n\n if ($extension === \"jpg\" || $extension === \"jpeg\")\n $extension = \"jpe?g\";\n\n // don't add duplicates!\n if (!in_array($extension, $this->extensions)) {\n $this->extensions[] = $extension;\n }\n }",
"function _addInstalledExtension($result) {\r\n\t\t\t$this->_installedExtensions[] = $result;\r\n\t\t}",
"public function setExtension($ext);",
"public function extension($filePath);",
"public function update_extension(){}",
"function add_extension() {\n\n require_once( dirname( __FILE__ ) . '/LFAPPS_Comments_Extension.php' );\n $this->ext = new LFAPPS_Comments_Extension();\n }",
"public function activate_extension()\n\t{\n\n\t $data = array(\n\t 'class' => __CLASS__,\n\t 'method' => 'template_types',\n\t 'hook' => 'template_types',\n\t 'settings' => serialize($this->settings),\n\t 'priority' => 10,\n\t 'version' => $this->version,\n\t 'enabled' => 'y'\n\t );\t\n\t ee()->db->insert('extensions', $data);\n\t \n\t}",
"public function addDirectory($dir, $ext = '.php')\n {\n $finder = sfFinder::type('file')->follow_link()->name('*'.$ext);\n\n if ($dirs = glob($dir))\n {\n foreach ($dirs as $dir)\n {\n if (false !== $key = array_search($dir, $this->dirs))\n {\n unset($this->dirs[$key]);\n $this->dirs[] = $dir;\n\n if ($this->cacheLoaded)\n {\n continue;\n }\n }\n else\n {\n $this->dirs[] = $dir;\n }\n\n $this->cacheChanged = true;\n $this->addFiles($finder->in($dir), false);\n }\n }\n }",
"public function add_modes($newmodes)\r\n\t{\r\n\t\t// not yet implemented\r\n\t}",
"public function activate_extension()\n\t{\n\t\t// fetch default settings\n\t\t$settings = $this->settings();\n\t\t\n\t\t// $value is the settings array ($type, $options, $defaults)\n\t\tforeach($settings as $key => $value)\n\t\t{\n\t\t\t$this->settings[$key] = $value[2];\n\t\t}\n\t\t\n\t\t$hooks = array(\n\t\t\t'sessions_end' => 'sessions_end',\n\t\t);\n\n\t\tforeach ($hooks as $hook => $method)\n\t\t{\n\t\t\t$data = array(\n\t\t\t\t'class'\t\t=> __CLASS__,\n\t\t\t\t'method'\t=> $method,\n\t\t\t\t'hook'\t\t=> $hook,\n\t\t\t\t'settings'\t=> serialize($this->settings),\n\t\t\t\t'version'\t=> $this->version,\n\t\t\t\t'enabled'\t=> 'y'\n\t\t\t);\n\n\t\t\t$this->EE->db->insert('extensions', $data);\t\t\t\n\t\t}\n\t}",
"public function extensions(array $extensions) {\n $this->extensions = [];\n foreach ($extensions as $key => $value) {\n $this->addExtension($value);\n }\n }",
"public function setDirectoryExtensionsEnabled($val)\n {\n $this->_propDict[\"directoryExtensionsEnabled\"] = $val;\n return $this;\n }",
"public function add($f, $ext_path, $ext_name = 'plugins')\n {\n if (in_array($ext_name, self::$extensions)) {\n return true;\n }\n $extension = array('name' => $f, 'base' => $ext_path);\n self::$extensions[$ext_name] = $extension;\n }",
"function changeExtension() {\n if (isset($this->params['file_id']) && $this->params['file_id'] != '' &&\n isset($this->params['extension']) && $this->params['extension'] != '' &&\n isset($this->currentFile) && is_array($this->currentFile) &&\n isset($this->currentFile['file_name'])) {\n $extensions = $this->mimeObj->getMimeTypesExtensions($this->currentFile['mimetype_id']);\n if (isset($extensions[$this->params['extension']])) {\n if ($pos = papaya_strings::strrpos($this->currentFile['file_name'], '.')) {\n $newFileName = substr($this->currentFile['file_name'], 0, $pos + 1);\n $newFileName .= $this->params['extension'];\n } else {\n $newFileName = $this->currentFile['file_name'].'.'.$this->params['extension'];\n }\n $data = array(\n 'file_name' => $newFileName,\n );\n $condition = array(\n 'file_id' => $this->params['file_id'],\n );\n if ($this->databaseUpdateRecord($this->tableFiles, $data, $condition)) {\n $this->addMsg(\n MSG_INFO, $this->_gt('File extension corrected.')\n );\n $this->loadFileData();\n }\n } else {\n $this->addMsg(\n MSG_ERROR,\n sprintf(\n $this->_gt('Invalid extension \"%s\" for filetype \"%s\".'),\n $this->params['extension'],\n $this->currentFile['mimetype']\n )\n );\n }\n }\n }",
"public function setExtension($name, $list=array());",
"public function setExtensions(array $extensions)\n {\n foreach ($extensions as $extension) {\n $this->addExtension($extension);\n }\n }",
"public function addMimeType(string $mimeType, string $extension): void\n {\n self::$supportedMimeTypes[$mimeType] = $extension;\n }",
"private function writeExtension() {\n tx_clitools::info('Creating extension');\n if (is_dir($this->ext->getExtensionDir())) {\n fwrite(STDOUT, \"Directory {$this->ext->getExtensionDir()} not empty. Overwrite? [y/N] \\n\"); // Output - prompt user\n $overwrite = chop(fgets(STDIN));\n if(!preg_match('/y/i', $overwrite)) {\n return false;\n }\n }\n $this->codeGenerator->build($this->ext);\n }",
"function setFilenameExtension()\n\t{\n\t\t$sOldFilenameExtension = substr($this->filename, strlen($this->filename) - 4, 4);\n\t\tif (($sOldFilenameExtension != '.gif') &&\n\t\t\t\t($sOldFilenameExtension != '.jpg') &&\n\t\t\t\t($sOldFilenameExtension != '.png')) {\n\t\t\t$this->printError('invalid filename extension');\n\t\t}\n\n\t\tswitch ($this->type) {\n\t\t\tcase 1:\n\t\t\t\t$this->filename = substr($this->filename, 0, strlen($this->filename) - 4) . '.gif';\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\t$this->filename = substr($this->filename, 0, strlen($this->filename) - 4) . '.jpg';\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\t$this->filename = substr($this->filename, 0, strlen($this->filename) - 4) . '.png';\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t$this->printError('invalid imagetype');\n\t\t}\n\t}",
"function addFileExtension($param)\n {\n\n $ext = strtoupper($param);\n if ($ext{0} !== '.') {\n $ext = '.' . $ext;\n }\n\n if (isset($this->fileExtensions[$ext])) {\n return PEAR::raiseError(\"file extension '$ext' ($param) already defined\"); \n }\n\n $this->fileExtensions[$ext] = $ext;\n }",
"public function setExtension($extension, $attributes = array()) {\n\t\t$this->connections [$this->active]->setExtension ( $extension, $attributes );\n\t}",
"private function addExtension($extension = \".txt\")\n\t{\n\t\t$fileName = $this->fileName;\n\t\tif(substr($fileName, -4) !== $extension) {\n\t\t\t$fileName .= $extension;\n\t\t\t$this->fileName = $fileName;\n\t\t}\n\t\treturn $fileName;\n\t}",
"public function fileExtensions($mimeType);",
"function activate_extension()\n\t{\n\t\t$data = array(\n\t\t\t'class'\t\t\t=>\t__CLASS__,\n\t\t\t'method'\t\t=>\t'cp_js_end',\n\t\t\t'hook'\t\t\t=>\t'cp_js_end',\n\t\t\t'settings'\t\t=>\t'',\n\t\t\t'priority'\t\t=>\t10,\n\t\t\t'version'\t\t=> \t$this->version,\n\t\t\t'enabled'\t\t=>\t'y'\n\t);\n\n\t$this->EE->db->insert('extensions', $data);\n\n\t}",
"function activate_extension()\n\t{\n\t\t$data = array(\n\t\t\t'class'\t\t\t=>\t__CLASS__,\n\t\t\t'method'\t\t=>\t'cp_js_end',\n\t\t\t'hook'\t\t\t=>\t'cp_js_end',\n\t\t\t'settings'\t\t=>\t'',\n\t\t\t'priority'\t\t=>\t10,\n\t\t\t'version'\t\t=> \t$this->version,\n\t\t\t'enabled'\t\t=>\t'y'\n\t);\n\n\t$this->EE->db->insert('extensions', $data);\n\n\t}",
"protected function registerExtensions()\n {\n $apiResult = Event::fire('editor.extension.register');\n\n if (!is_array($apiResult)) {\n return;\n }\n\n foreach ($apiResult as $extensionClassName) {\n if (!is_string($extensionClassName)) {\n continue;\n }\n\n $this->extensionClassNames[] = $extensionClassName;\n }\n }",
"public function setExtension($name, $baseVersion, $extensionLevel) {}",
"protected function addModesFromFile($dir,$file)\n {\n $dir = $this->parseDir($dir);\n\n $jsContent = $file->getContents();\n preg_match_all('#defineMIME\\(\\s*(\\'|\")([^\\'\"]+)(\\'|\")#', $jsContent, $modes);\n if (count($modes[2])) {\n foreach ($modes[2] as $mode) {\n $this->addMode($mode, $dir.\"/\".$file->getRelativePathname());\n }\n }\n $this->addMode($file->getRelativePath(), $dir.\"/\".$file->getRelativePathname());\n\n #save to cache if env prod\n if ($this->env == 'prod') {\n $this->cacheDriver->save(static::CACHE_MODES_NAME, $this->getThemes());\n }\n }",
"public function setExtensions(array $extensions)\n {\n $this->extensions = array();\n\n foreach ($extensions as $extension) {\n $this->addExtension($extension);\n }\n }"
] |
[
"0.63675094",
"0.58321375",
"0.5629835",
"0.55891204",
"0.5438619",
"0.54373145",
"0.5402144",
"0.5400976",
"0.5369483",
"0.5367307",
"0.536299",
"0.5359017",
"0.5352645",
"0.53465056",
"0.5340563",
"0.53397155",
"0.5319969",
"0.52761304",
"0.5249996",
"0.52448475",
"0.52263004",
"0.52132916",
"0.51884276",
"0.5183692",
"0.51801276",
"0.51801276",
"0.516687",
"0.5154872",
"0.51396435",
"0.5130182"
] |
0.6890582
|
0
|
Returns the transfermode, default FTP_ASCII
|
function getMode() {
return $this->getOptionsSet()->getOptions(self::OPTION_TRANSFER_MODE, FTP_ASCII);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function setMode($mode) {\r\n\t\tif ( ($mode == FTP_ASCII) || ($mode == FTP_BINARY) ) {\r\n\t\t\t$this->getOptionsSet()->setOptions(array(self::OPTION_TRANSFER_MODE => $mode));\r\n\t\t\treturn $this;\r\n\t\t} else {\r\n\t\t\tthrow new ftpException('FTP-Mode has either to be FTP_ASCII or FTP_BINARY');\r\n\t\t}\r\n\t}",
"function ftp_trans_mode($file){ \n $path_parts = pathinfo($file);\n\t\t\n\t\tif (!isset($path_parts['extension']))\n\t\t\treturn FTP_BINARY;\n\t\tswitch (strtolower($path_parts['extension'])) {\n\t\t\tcase 'am':case 'asp':case 'bat':case 'c':case 'cfm':case 'cgi':case 'conf':\n\t\t\tcase 'cpp':case 'css':case 'dhtml':case 'diz':case 'h':case 'hpp':case 'htm':\n\t\t\tcase 'html':case 'in':case 'inc':case 'js':case 'm4':case 'mak':case 'nfs':\n\t\t\tcase 'nsi':case 'pas':case 'patch':case 'php':case 'php3':case 'php4':case 'php5':\n\t\t\tcase 'phtml':case 'pl':case 'po':case 'py':case 'qmail':case 'sh':case 'shtml':\n\t\t\tcase 'sql':case 'tcl':case 'tpl':case 'txt':case 'vbs':case 'xml':case 'xrc':\n\t\t\t\treturn FTP_ASCII;\n\t\t}\n\t\tif ($file === '.htaccess') {\n\t\t\treturn FTP_ASCII;\n\t\t}\n\t\treturn FTP_BINARY;\n\t}",
"public function passiv_mode() {\n\t\t$CODE_RETOUR = false;\n\t\tif ($this->verifie_connexion ()) {\n\t\t\t$CODE_RETOUR = ftp_pasv ( $this->conn_id, $this->getPassive () );\n\t\t}\n\t\t\n\t\treturn $CODE_RETOUR;\n\t}",
"public function getTransferType()\n {\n return $this->transfer_type;\n }",
"public function getFileMode()\n {\n if (isset($this->raw->chmod)) {\n return intval($this->raw->chmod, 8);\n }\n\n return null;\n }",
"public function getName() {\n\t\treturn \"FTP\";\n\t}",
"public function getMode()\n {\n if (isset($this->data[\"mode\"])) {\n return $this->data[\"mode\"];\n }\n if (isset($this->data['external'])) {\n return \"prefer_local\";\n }\n return \"only_local\";\n }",
"public function getDeliveryMode() {\n return $this->delivery_mode;\n }",
"public function getTMode()\n {\n return $this->transport_fk;\n }",
"public function getTransferEncoding() {\n\t\tif ($this->getHeader()->has(\"Content-Transfer-Encoding\")) {\n\t\t\treturn strtolower($this->getHeader()->get(\"Content-Transfer-Encoding\")->getValue());\n\t\t}\n\t\treturn \"7bit\";\n\t}",
"function ftplib()\r\n {\r\n\t $this->_debug = false;\r\n $this->_umask = 0022;\r\n $this->_timeout = 30;\r\n $this->_BINARY = 1;\r\n $this->_ASCII = 0;\r\n /*if (function_exists(\"ftp_connect\")) {\r\n \t\t$this->_use_mod_ftp = true;\r\n \t} else {*/\r\n \r\n\t\t\t$this->_use_mod_ftp = false;\r\n \t//}\r\n }",
"private function _getMode()\n {\n if ($this->_mcryptMode == '') {\n $this->_mcryptMode = MCRYPT_MODE_CBC;\n }\n return $this->_mcryptMode;\n }",
"function searchFTPMethod()\t{\n\t\treturn $this->getRandomFTPMethod();\n\t}",
"public function getTftpLang() {\n return $this->tftpLang;\n }",
"final public function mode():string\n {\n return $this->mode;\n }",
"public function getContentTransferEncoding(): string\n {\n if ($this->transferEncoding) {\n return $this->transferEncoding;\n }\n\n $charset = strtoupper($this->charset);\n if (in_array($charset, $this->charset8bit, true)) {\n return '8bit';\n }\n\n return '7bit';\n }",
"public function getDeliveryMode();",
"public function pwd() {\n if (false !== $this->connection) {\n return ftp_pwd($this->connection);\n }\n return false;\n }",
"public function getMode(): string\n {\n return $this->mode;\n }",
"private function getTransactionMode()\n {\n $gatewayUrl = $this->requestParser->getGatewayUrl(['apiOperation' => 'PAYMENT_OPTIONS_INQUIRY']);\n $jsonResponse = $this->transactionHandler->getTransactionResponse($gatewayUrl);\n $responseArray = json_decode($jsonResponse, true);\n $transactionMode = $responseArray['transactionMode'];\n if ($transactionMode === 'PURCHASE')\n return 'PAY';\n else\n return 'AUTHORIZE';\n\n }",
"function isPassive() {\r\n\t\treturn $this->getOptionsSet()->getOptions(self::OPTION_TRANSFER_METHOD, self::TRANSFER_METHOD_PASSIVE);\r\n\t}",
"public function getDeliveryMode()\n {\n }",
"public function getDeliveryMode(): int\n {\n }",
"function getMode() {\n\t\treturn $this->get('mode');\n\t}",
"function Pico_GetFTPObject()\n{\n\t// get ftp object if we need one\n\tif (!isset($GLOBALS['pico_ftp_obj']))\n\t{\n\t\t$ftp = @Pico_ConnectFTP();\n\t\t$GLOBALS['pico_ftp_obj'] = $ftp;\n\t}\n\n\t$ftp = $GLOBALS['pico_ftp_obj'];\n\tif (is_object($ftp)) { return $ftp; }\n\n\treturn false;\n}",
"function getTimeout() {\r\n\t\treturn ftp_get_option($this->_handle, FTP_TIMEOUT_SEC);\r\n\t}",
"public function getTransportMethod()\n {\n \t $transportMethod = Mage::getStoreConfig('actions/settings/transport_method');\n \t if (empty($transportMethod)) {\n \t \t $transportMethod = CartDefender_Actions_Model_System_Config_Source_Transport::CURL_PROCESS;\n \t \t Mage::getConfig()->saveConfig('actions/settings/transport_method', $transportMethod, 'default', 0);\n \t }\n return $transportMethod;\n }",
"protected function getDefaultMode() : int {\n return 0644;\n }",
"public function getPassword() {\n if(isset($this->_ftpPassword)) {\n return $this->_ftpPassword;\n }\n \n trigger_error(\"FTP password is not set\");\n return FALSE;\n }",
"public function getTravelMode()\n {\n return $this->travel_mode;\n }"
] |
[
"0.7063605",
"0.7009786",
"0.61256963",
"0.5786866",
"0.57228506",
"0.5716351",
"0.571261",
"0.566911",
"0.5609958",
"0.560734",
"0.5556411",
"0.5522493",
"0.5507663",
"0.5490671",
"0.532803",
"0.5322894",
"0.5318709",
"0.52736455",
"0.5236705",
"0.52286404",
"0.52075624",
"0.520714",
"0.519102",
"0.51588094",
"0.5148139",
"0.5142582",
"0.5142165",
"0.5138642",
"0.5138505",
"0.5120016"
] |
0.87295794
|
0
|
Returns, whether the connection is set to passive mode or not
|
function isPassive() {
return $this->getOptionsSet()->getOptions(self::OPTION_TRANSFER_METHOD, self::TRANSFER_METHOD_PASSIVE);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function isPassive();",
"public function getPassive()\n {\n return $this->passive;\n }",
"protected function passiveMode()\n {\n if(!filter_var($this->ip,FILTER_VALIDATE_IP,FILTER_FLAG_NO_PRIV_RANGE))\n {\n ftp_pasv($this->resource,true);\n }\n\n }",
"public function isPassiveRequest() {\n if (empty($this->prompt)) {\n return false;\n }\n $values = explode(' ', $this->prompt);\n return in_array(\"none\", $values);\n }",
"public function setPassive($passive = true)\n {\n $this->passive = $passive;\n }",
"public function passive(bool $passive)\n {\n $this->passive = $passive;\n\n return $this;\n }",
"function setPassive() {\r\n\t\t$this->getOptionsSet()->setOptions(array(self::OPTION_TRANSFER_METHOD => self::TRANSFER_METHOD_PASSIVE));\r\n\t\t@ftp_pasv($this->_handle, true);\r\n\t\treturn $this;\r\n\t}",
"public function passiv_mode() {\n\t\t$CODE_RETOUR = false;\n\t\tif ($this->verifie_connexion ()) {\n\t\t\t$CODE_RETOUR = ftp_pasv ( $this->conn_id, $this->getPassive () );\n\t\t}\n\t\t\n\t\treturn $CODE_RETOUR;\n\t}",
"function isListening() {\n\t\treturn !empty($this->data['INFO_REMOTE_METHOD']) && !empty($this->data['INFO_REMOTE_URI']);\n\t}",
"protected function _isActive() {\n\t\treturn connection_status() === CONNECTION_NORMAL && !connection_aborted();\n\t}",
"public function isLiveMode()\n {\n return $this->_isLiveMode;\n }",
"public function isConnect()\n {\n return $this->bbb->isConnectionWorking();\n }",
"public function isOpen() {\n return $this->transport_->isOpen();\n }",
"public function isConnection()\n {\n return ($this->_connection) ? true : false;\n }",
"public function isSwooleMode(): bool;",
"public function is_enabled() {\n return $this->proxy_host && $this->proxy_port;\n }",
"public function isConnected()\n {\n return (bool) $this->socket;\n }",
"public static function isLiveMode()\n {\n return static::getInstance()->blnLiveMode ? true : false;\n }",
"function setup($isPassive=TRUE) {\n\t\t// set up basic connection\n\t\t$this->conn_id = ftp_connect($this->ftp_server, $this->ftp_port); \n\n\t\t// login with username and password\n\t\t$this->login_result = ftp_login($this->conn_id, $this->ftp_user_name, $this->ftp_user_pass); \n\n\t\t// check connection\n\t\tif ((!$this->conn_id) || (!$this->login_result)) { \n\t\t\t\techo \"FTP connection has failed!\\n\";\n\t\t\t\techo \"Attempted to connect to $this->ftp_server for user $this->ftp_user_name\\n\"; \n\t\t\t\texit; \n\t\t} else {\n\t\t\t\techo \"Connected to $this->ftp_server,\\n\\t$this->ftp_user_name\\n\";\n\t\t}\n\n\t\tif($isPassive){\n\t\t\tftp_pasv($this->getConn_id(), TRUE);\n\t\t}\n\t}",
"public function isConnected() {\n\t\treturn isset($this->conn);\n\t}",
"public function isConnected() {\n\t\treturn isset($this->conn);\n\t}",
"public function isConnected()\n {\n return isset($this->conn);\n }",
"public function isConnected() {\n\n\t\tif (!$this->connection_opened) {\n\t\t\treturn false;\n\t\t}\n\n\t\ttry {\n\t\t\t$this->query('DO 1');\n\t\t} catch (Exception $e) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\n\t}",
"public function is_available() {\n if ($this->enabled == \"yes\") {\n if (!is_ssl() && !$this->testmode) {\n return false;\n }\n // Required fields check\n if (!$this->secret_key || !$this->publishable_key) {\n return false;\n }\n return true;\n }\n return false;\n }",
"public function isOpen(): bool\n\t{\n\t\treturn !is_null($this->socket);\n\t}",
"public static function isSecureConnection() {\n\n\t\tif (self::_hasAdapter(get_class(), __FUNCTION__))\n\t\t\treturn self::_callAdapter(get_class(), __FUNCTION__);\n\n\t\tif ($_SERVER['HTTPS'] != 'on')\n\t\t\treturn false;\n\n\t\treturn true;\n\t}",
"public function isAlive() {\n\t\treturn (($this->active !== null) && $this->connections [$this->active]->isAlive ());\n\t}",
"public function isConnected()\n {\n return isset($this->connection);\n }",
"public function isConnected()\n\t{\n\t\treturn isset( $this->pdo );\n\t}",
"function isOpen() \r\n{ \r\nreturn ($this->Socket ? true : false); \r\n}"
] |
[
"0.7929185",
"0.76152426",
"0.7356573",
"0.67842066",
"0.66578174",
"0.63898975",
"0.6260651",
"0.6238535",
"0.6108577",
"0.6060114",
"0.60431004",
"0.6024618",
"0.6018507",
"0.5974547",
"0.5953263",
"0.594491",
"0.59225506",
"0.5892725",
"0.5870056",
"0.58573437",
"0.58573437",
"0.58411264",
"0.58245623",
"0.5809609",
"0.5806573",
"0.5802779",
"0.5793115",
"0.57901955",
"0.5782117",
"0.57482255"
] |
0.8220496
|
0
|
Returns the mode set for a fileextension
|
function getExtensionMode($ext) {
if ( array_key_exists($ext, $this->_file_extensions) ) {
return $this->_file_extensions[$ext];
}
return null;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getFileMode()\n {\n if (isset($this->raw->chmod)) {\n return intval($this->raw->chmod, 8);\n }\n\n return null;\n }",
"function checkFileExtension($filename) {\r\n\t\tif ( ($pos = strrpos($filename, '.')) === false ) {\r\n\t\t\treturn $this->getMode();\r\n\t\t} else {\r\n\t\t\t$ext = substr($filename, $pos + 1);\r\n\t\t}\r\n\t\t\r\n\t\tif ( isset($this->_file_extensions[$ext]) ) {\r\n\t\t\treturn $this->_file_extensions[$ext];\r\n\t\t}\r\n\t\t\r\n\t\treturn $this->getMode();\r\n\t}",
"public function extension()\n {\n return pathinfo($this->path_filename, PATHINFO_EXTENSION);\n }",
"public function getFileExtension();",
"public function getExtensionAttribute()\n {\n return pathinfo($this->file_path, PATHINFO_EXTENSION);\n }",
"public function getPermissions()\n {\n return $this->fileStructure->mode;\n }",
"public function get_file_extension () {\r\n\t\treturn $this->_file_extension;\r\n\t}",
"public function getFileExtension() {\n\t\t$pathInfo = pathinfo($this->filename);\n\t\tif (!isset($pathInfo['extension'])) {\n\t\t\treturn '???';\n\t\t} else {\n\t\t\treturn $pathInfo['extension'];\n\t\t}\n\t}",
"public function getExtension()\r\n {\r\n return pathinfo($this->filename, PATHINFO_EXTENSION);\r\n }",
"public function getExt()\n {\n $filename = $this->getPath(); \n return pathinfo($filename, PATHINFO_EXTENSION);\n }",
"function getMimeMode($ext,$viewMode=false) {\n\t\t// if viewMode, will use inline for formats that most browsers can handle\n\t\t$knownExts = array(\n\t\t'gif' => false,\n\t\t'jpg' => false,\n\t\t'jpeg' => false,\n\t\t'png' => false,\n\t\t'psd' => true,\n\t\t'zip' => true,\n\t\t'rar' => true,\n\t\t'7z' => true,\n\t\t'doc' => true,\n\t\t'docx' => true,\n\t\t'odt' => true,\n\t\t'rtf' => true,\n\t\t'swf' => false,\n\t\t'tif' => !$viewMode,\n\t\t'au' => !$viewMode,\n\t\t'pdf' => !$viewMode,\n\t\t'mp3' => !$viewMode,\n\t\t'ogg' => !$viewMode,\n\t\t'ico' => false,\n\t\t'mpg' => !$viewMode,\n\t\t'mpeg' => !$viewMode,\n\t\t'qt' => !$viewMode,\n\t\t'mov' => !$viewMode,\n\t\t'mp4' => !$viewMode,\n\t\t'avi' => !$viewMode,\n\t\t'mkv' => !$viewMode, // do browsers really support this?\n\t\t'txt' => false,\n\t\t'html' => false,\n\t\t'htm' => false,\n\t\t'xml' => true,\n\t\t'xls' => true,\n\t\t'wmv' => !$viewMode,\n\t\t'pps' => true,\n\t\t'ppt' => true,\n\t\t'exe' => true,\n\t\t'msi' => true,\n\t\t'bat' => true,\n\t\t'ps' => true,\n\t\t'qif' => !$viewMode,\n\t\t'ai' => true,\n\t\t'wma' => !$viewMode,\n\t\t'css' => false,\n\t\t'js' => false,\n\t\t'rss' => false,\n\t\t'json' => false\n\t\t);\n\t\treturn isset($knownExts[$ext])?$knownExts[$ext]:true;\n\t}",
"protected function determineMode($filepath, $mode) {\r\n\t\tif(($mode & Curly_Stream_File::OPEN)===Curly_Stream_File::OPEN) {\r\n\t\t\t// File does not exist\r\n\t\t\tif(($mode & Curly_Stream_File::CREATE)!==Curly_Stream_File::CREATE and !file_exists($filepath)) {\r\n\t\t\t\tthrow new Curly_Stream_Exception('The file '.$filepath.' does not exist and can not been opened');\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(($mode & Curly_Stream_File::TRUNCATE)===Curly_Stream_File::TRUNCATE) {\r\n\t\t\t\treturn 'w';\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\treturn 'a';\r\n\t\t\t}\r\n\t\t}\r\n\t\telse if(($mode & Curly_Stream_File::CREATE)===Curly_Stream_File::CREATE) {\r\n\t\t\treturn 'x';\r\n\t\t}\r\n\t\telse {\r\n\t\t\tthrow new Curly_Stream_Exception('Invalid open mode given. At least the open or create mode has to be specified');\r\n\t\t}\r\n\t}",
"function getFileType ( $ext ) {\n\t\t\tforeach ( self::$TYPES_TO_EXTENSIONS as $type => $extensions ) {\n\t\t\t\tif ( in_array( $ext, $extensions ) ) {\n\t\t\t\t\treturn $type;\n\t\t\t\t}\n\t\t\t}\t\t\t\n\t\t\t\n\t\t\treturn false;\n\t\t\t\n\t\t}",
"public function getFileExtension()\n\t{\n\t\treturn $this->fileExtension;\n\t}",
"function fileTypes($extension){\r\n $fileTypes['pdf'] = 'application/pdf';\r\n \r\n $fileTypes['zip'] = 'application/zip';\r\n $fileTypes['doc'] = 'application/msword';\r\n $fileTypes['rar'] = 'application/rar';\r\n\r\n \r\n return $fileTypes[$extention];\r\n }",
"public function extension($filePath);",
"public function getFileExtension(){\n\n if($this->isPhoto()){\n return \"jpg\";\n }\n\n if($this->isVideo()){\n return \"mp4\";\n }\n\n return \"bin\";\n\n }",
"final public static function fext($file){\n\t\treturn pathinfo($file, PATHINFO_EXTENSION);\n\t}",
"public function getFileExtension()\n {\n return $this->_fileExtension;\n }",
"public function getFileExtension()\n {\n return $this->fileExtension;\n }",
"public function getFileExtension()\n {\n return $this->fileExtension;\n }",
"public function getExtension() {\n\t\t\n\t\t$filename = $this->file['name'];\n\t\t\n\t\t$parts = explode('.', $filename);\n\t\t$extension = end($parts);\n\t\t\n\t\treturn strtolower($extension);\n\t\t\n\t}",
"public function getExtension()\n {\n return $this->fileExtension;\n }",
"public function extension() : string {\n return $this->file->extension;\n }",
"public function getExtension()\n\t{\n\t\treturn pathinfo($this->path, PATHINFO_EXTENSION);\n\t}",
"public function getSupportedFileExtensions() {}",
"function getfileextension($filename){\n return pathinfo($filename, PATHINFO_EXTENSION);\n }",
"public function getExtension()\n {\n return $this->file['extension'];\n }",
"abstract protected function getFileExtension();",
"public static function file_extension($filename)\r\r\n\t{\r\r\n\t $path_info = pathinfo($filename);\r\r\n\t return $path_info['extension'];\r\r\n\t}"
] |
[
"0.70943767",
"0.7017578",
"0.63967186",
"0.63099325",
"0.6278676",
"0.62502825",
"0.6250247",
"0.61829853",
"0.61474675",
"0.6141805",
"0.6138898",
"0.6129679",
"0.6115365",
"0.6113114",
"0.6085588",
"0.6066616",
"0.6054769",
"0.60324866",
"0.6029519",
"0.60203546",
"0.60203546",
"0.6007987",
"0.5969806",
"0.5963773",
"0.5954614",
"0.59544665",
"0.59534883",
"0.5948461",
"0.592836",
"0.5898538"
] |
0.7742663
|
0
|
Adds a ftpClientObserver instance to the list of observers that are listening for messages emitted by this Net_FTP instance.
|
function attach(ftpClientObserver $observer) {
$this->_listeners[$observer->getId()] = $observer;
return true;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function add($observer){\n $this->observers[] = $observer;\n }",
"function addObserver(Observer $observer_in) {\n $this->observers[] = $observer_in;\n }",
"function notify($event) {\r\n\t\tif ( count($this->_listeners) > 0 ) {\r\n\t\t\tif ( false ) $listener = new ftpClientObserver();\r\n\t\t\tforeach ( $this->_listeners as $id => $listener ) {\r\n\t\t\t\t$listener->notify($event);\r\n\t\t\t}\r\n\t\t}\r\n\t}",
"public function registerObserver($observer)\n {\n $this->observers[] = $observer;\n }",
"public function attach( $observer )\r\n {\r\n $this->observers []= $observer;\r\n }",
"public function addObserver(WorkflowObserverInterface $observer)\n {\n $this->observers[] = $observer;\n }",
"function attach(Observer $observer_in) {\n $this->observers[] = $observer_in;\n }",
"public function attach(Observer $observer) {\n $this->observers[] = $observer;\n }",
"public function observers();",
"public function attach(Observer $observer)\n {\n $this->observers[] = $observer;\n }",
"function attach(AbstractObserver $observer)\n {\n $this->observers[] = $observer;\n\n }",
"function attach( &$observer)\r\n\t{\r\n\t\tif (is_object($observer))\r\n\t\t{\r\n\t\t\t$class = get_class($observer);\r\n\t\t\tforeach ($this->_observers as $check) {\r\n\t\t\t\tif (is_a($check, $class)) {\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t$this->_observers[] =& $observer;\r\n\t\t} else {\r\n\t\t\t$this->_observers[] =& $observer;\r\n\t\t}\r\n\t}",
"public function AddObserver(object $objObserver) {\n if(method_exists($objObserver,\"On\")) {\n $this->_arrObservers[] = $objObserver;\n }\n }",
"function isAttached(ftpClientObserver $observer) {\r\n\t\tif ( isset($this->_listeners[$observer->getId()]) ) {\r\n\t\t\treturn true;\r\n\t\t} else {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}",
"private function add_observers( $observers, $subject ) {\n \n if ( is_array( $observers ) ) {\n \n foreach ( $observers as $observer) {\n \n if ( class_exists( $observer ) ) {\n \n $subject->attach( new $observer() );\n \n }\n }\n \n }\n \n }",
"public function bindObserver($observer)\n\t{\n\t\t$file = dirname(__FILE__) . '/Observer/' . $observer . '.php';\n\t\tif(file_exists($file)){\n\t\t\trequire_once($file);\n\t\t\t$obj = new $observer($this->CI, $this->config);\n\t\t\tif($obj instanceof ObserverInterface){\n\t\t\t\t$this->observers[] = $obj;\n\t\t\t}\n\t\t}\n\t}",
"public function attach(ObserverInterface $observer)\n {\n $observers = $this->getObservers();\n\n foreach ($observer->getEvents() as $event) {\n $observers[$event][] = $observer;\n }\n\n $this->setObservers($observers);\n }",
"public function attach($observer)\n {\n $observerKey = spl_object_hash($observer);\n $this->observers[$observerKey] = $observer;\n }",
"public function attach(SplObserver $observer) {\n\t\tarray_push($this->_observers, $observer);\n\t\t$this->notify();\n\t}",
"public function attach(SplObserver $observer){\n $id = spl_object_hash($observer);\n $this->observers[$id] = $observer;\n }",
"public function attachObserver(ISimulatorObserver $observer) {\r\n \t$this->_observers[] = $observer;\r\n }",
"public function attach(\\SplObserver $observer) {}",
"public function attach(\\SplObserver $observer) {}",
"public function attach(\\SplObserver $observer) {}",
"public function attach(\\SplObserver $observer) {}",
"public function attach(\\SplObserver $observer) {}",
"public function attach(\\SplObserver $observer) {}",
"public static function attachStaticObserver(TA_Model_Observer_Interface $o)\n\t{\n\t\tarray_push(self::$_observers, $o);\n\t}",
"function Net_FTP_Observer()\n {\n $this->_id = md5(microtime());\n }",
"function extend(ObservableClient $client) {\n $this->unextend();\n $this->observation = $client->addObservation([\n ObservableClient::REQUEST => function($dataArr) { $this->onRequest($dataArr); },\n ObservableClient::RESPONSE => function($dataArr) { $this->onResponse($dataArr); }\n ]);\n }"
] |
[
"0.6249877",
"0.60950863",
"0.59716177",
"0.5705185",
"0.561706",
"0.55773526",
"0.5526165",
"0.55224204",
"0.54940724",
"0.5479578",
"0.5478748",
"0.5443663",
"0.54420626",
"0.54005563",
"0.53310895",
"0.5220643",
"0.51744914",
"0.51441795",
"0.51218146",
"0.50910205",
"0.5050927",
"0.5023547",
"0.5023547",
"0.5023547",
"0.50229377",
"0.50229377",
"0.50229377",
"0.49708307",
"0.4940927",
"0.49326116"
] |
0.7357347
|
0
|
Returns true if $observer is a currently attached listener
|
function isAttached(ftpClientObserver $observer) {
if ( isset($this->_listeners[$observer->getId()]) ) {
return true;
} else {
return false;
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function attached(&$observer)\n {\n return isset($this->observers[$observer->getHashCode()]);\n }",
"public function hasObservers() : bool\n {\n\n return 0 < $this->countObservers();\n\n }",
"public function isListening ()\r\n\t\t{\r\n\t\t\t\treturn $this -> currentState == self :: STATE_LISTENING;\r\n\t\t}",
"public function attached()\n {\n return ( ! is_null($this->memory));\n }",
"public function hasListeners($eventName): bool;",
"public function hasListeners($event): bool;",
"public function hasListeners($eventName);",
"public function isListener($listener)\n {\n return true;\n }",
"public function isEvent()\n {\n return isset($this->status_changed) && ! is_null($this->status_changed);\n }",
"public function hasEvents()\n {\n return count($this->events) > 0 ? true : false;\n }",
"public function isListened()\n {\n return !empty($this->socket);\n }",
"public static function hasAttachedEvents($handler)\n {\n return (\n isset(static::$events[$handler]) &&\n is_array(static::$events[$handler])\n );\n }",
"public function hasListeners($name);",
"public function hasEventListeners($event);",
"public function isListening(): bool\n {\n return $this->listening;\n }",
"public function isActivated() {}",
"protected function observed($event)\n {\n return $this->hasListeners($this->buildEventName($event));\n }",
"public function isObserverExists( $observer )\n {\n return $this->_storage->contains( $observer );\n }",
"public function detach(EventObserver $observer):bool{\r\n $name=$observer->eventName();\r\n if (is_string($name))$name=[$name];\r\n $deatch=0;\r\n foreach ($name as $v){\r\n foreach ($this->storage[$v]??[] as $k=>$ob){\r\n if($ob[0]===$observer){\r\n unset($this->storage[$v][$k]);\r\n $deatch++;\r\n }\r\n }\r\n }\r\n return $deatch;\r\n }",
"function attach(ftpClientObserver $observer) {\r\n\t\t$this->_listeners[$observer->getId()] = $observer;\r\n\t\treturn true;\r\n\t}",
"function detach(ftpClientObserver $observer) {\r\n\t\tif ( !isset($this->_listeners[$observer->getId()]) ) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tunset($this->_listeners[$observer->getId()]);\r\n\t\treturn true;\r\n\t}",
"public function hasListener($event, $listener);",
"public function attach($eventName, $observerName)\n {\n if (empty($eventName) || empty($observerName)) {\n return false;\n }\n if (Model::factory('Observer')->attach($eventName, $observerName)) {\n return true;\n }\n\n return false;\n }",
"static public function hasListeners($eventName) {\n return !empty(self::$listeners[$eventName]);\n }",
"function isListening() {\n\t\treturn !empty($this->data['INFO_REMOTE_METHOD']) && !empty($this->data['INFO_REMOTE_URI']);\n\t}",
"protected function isListenerFired($event)\n {\n // Do not apply to the same or newer versions\n if (version_compare(static::VERSION, $event->old, '<=')) {\n return true;\n }\n\n return false;\n }",
"public function connected() {\n\t\treturn !is_null($this->oAdapterAbstract);\n\t}",
"public function hasCurrent()\n {\n return $this->current !== null;\n }",
"public function hasListeners($event)\n {\n return isset($this->listeners[$event]);\n }",
"public function hasEvent($name)\n\t{\n\t\tif((strncasecmp($name,'on',2)===0&&method_exists($this,$name))||strncasecmp($name,'fx',2)===0||strncasecmp($name,'dy',2)===0)\n\t\t\treturn true;\n\n\t\telse if($this->_m!==null&&$this->_behaviorsenabled)\n\t\t{\n\t\t\tforeach($this->_m->toArray() as $behavior)\n\t\t\t{\n\t\t\t\tif((!($behavior instanceof IBehavior)||$behavior->getEnabled())&&$behavior->hasEvent($name))\n\t\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}"
] |
[
"0.79412216",
"0.68658304",
"0.66018933",
"0.65932125",
"0.64843065",
"0.6340191",
"0.62870955",
"0.6272731",
"0.6262706",
"0.61173975",
"0.6112861",
"0.61037534",
"0.60954267",
"0.60746217",
"0.60729647",
"0.60577047",
"0.60215765",
"0.6006896",
"0.6003025",
"0.59668964",
"0.59508747",
"0.5865732",
"0.5821361",
"0.5817061",
"0.57993996",
"0.5798519",
"0.5783918",
"0.5770255",
"0.57196724",
"0.56923974"
] |
0.7775298
|
1
|
Sets the directory listing matcher Use this method to set the directory listing matcher to a specific pattern. Indicate the pattern as a perl regular expression and give an array containing as keys the fields selected in the regular expression and as values the offset of the subpattern in the pattern. Example: $pattern = '/(?:(d)|.)([rwxt]+)\s+(\w+)\s+([\w\d]+)\s+([\w\d]+)\s+(\w+) \s+(\S+\s+\S+\s+\S+)\s+(.+)/', $matchmap = array( 'is_dir' => 1, 'rights' => 2, 'files_inside' => 3, 'user' => 4, 'group' => 5, 'size' => 6, 'date' => 7, 'name' => 8, ) Make sure at least the is_dir and name keys are set. The is_dir key should point to a subpattern that is empty for nondirectories and nonempty for directories.
|
function setDirMatcher($pattern, $matchmap) {
if ( !is_string($pattern) ) {
throw new ftpException('The supplied pattern is not a string');
}
if ( !is_array($matchmap) ) {
throw new ftpException('The supplied matchmap pattern is not an array');
} else {
foreach ( $matchmap as $val ) {
if ( !is_numeric($val) ) {
throw new ftpException('The supplied pattern contains invalid value ' . $val);
}
}
}
$this->_matcher = array('pattern' => $pattern, 'map' => $matchmap);
return $this;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function map($pattern, $defaults=false, $requirements=false) {\n\t\t# parse pattern into regex\n\t\t$this->maps[] = new UsherMap($pattern, $defaults, $requirements);\n\t}",
"function setDirNameRegex($dirNameRegex) {\n $this->dirNameRegex = $dirNameRegex;\n }",
"public function setMatcher(Matcher $matcher)\n {\n $this->matcher = $matcher;\n }",
"protected function initialisePatternMap()\n {\n // Define the XML-based scanner output patterns\n $xmlScannerPatterns = new Collection([\n self::XML_NMAP_REGEX => ScannerApp::SCANNER_NMAP,\n self::XML_BURP_REGEX => ScannerApp::SCANNER_BURP,\n self::XML_NEXPOSE_REGEX => ScannerApp::SCANNER_NEXPOSE,\n self::XML_NETSPARKER_REGEX => ScannerApp::SCANNER_NETSPARKER,\n self::XML_NESSUS_REGEX => ScannerApp::SCANNER_NESSUS,\n ]);\n\n // Define the CSV-based scanner output patterns\n $csvScannerPatterns = new Collection();\n\n // Define the JSON-based scanner output patterns\n $jsonScannerPatterns = new Collection();\n\n // Set the pattern Collection for each group of file types on the main Collection\n $this->scannerPatternMap->put(File::FILE_TYPE_XML, $xmlScannerPatterns);\n $this->scannerPatternMap->put(File::FILE_TYPE_CSV, $csvScannerPatterns);\n $this->scannerPatternMap->put(File::FILE_TYPE_JSON, $jsonScannerPatterns);\n\n return true;\n }",
"public function setMatches(array $matches, mixed $patternKey): void\n {\n $this->setModName($matches[3]);\n $this->addSolution((new FileDeleteSolution())->setAbsolutePath($matches[4]));\n }",
"public function setRegexDirectory ($dir)\r\n {\r\n $dir = rtrim($dir, '/');\r\n if (!is_dir($dir)) {\r\n throw new Exception(\"'$dir' is not a directory\");\r\n }\r\n \r\n $this->_regexDirectory = (string) $dir;\r\n return $this;\r\n }",
"public function setMatchList($var)\n {\n $arr = GPBUtil::checkRepeatedField($var, \\Google\\Protobuf\\Internal\\GPBType::MESSAGE, \\MatchInfo::class);\n $this->match_list = $arr;\n\n return $this;\n }",
"protected function loadGroupsByPattern()\n {\n foreach ($this->configuredGroups as $group => $pattern) {\n if (strpos($group, '*') === false) {\n continue;\n }\n $files = Finder::create()->files()\n ->name(basename($pattern))\n ->sortByName()\n ->in(Configuration::projectDir().dirname($pattern));\n\n $i = 1;\n foreach ($files as $file) {\n /** @var SplFileInfo $file * */\n $this->configuredGroups[str_replace('*', $i, $group)] = dirname($pattern).DIRECTORY_SEPARATOR.$file->getRelativePathname();\n $i++;\n }\n unset($this->configuredGroups[$group]);\n }\n }",
"function map_named($name, $pattern, $defaults=false, $requirements=false) {\n\t\t# parse pattern into regex\n\t\t$this->maps[$name] = new UsherMap($pattern, $defaults, $requirements);\n\t}",
"public function setPattern($pattern) {}",
"public function Load($sDir, $sPattern = null, $bUseRegexPattern = true)\n {\n $this->Destroy();\n $sDir = realpath($sDir);\n if ($bUseRegexPattern) {\n $d = dir($sDir);\n while (false !== ($entry = $d->read())) {\n if (is_file($sDir.'/'.$entry) && (is_null($sPattern) || $this->StringMatchesPattern($entry, $sPattern))) {\n $oItem = TCMSFile::GetInstance($sDir.'/'.$entry);\n $this->AddItem($oItem);\n }\n }\n $d->close();\n } else {\n $aFiles = glob($sDir.'/'.$sPattern, GLOB_ERR);\n if (!is_array($aFiles)) {\n TTools::WriteLogEntry('TCMSFileList: '.print_r($aFiles, true).' called Directory:'.$sDir, '1', __FILE__, __LINE__);\n } else {\n if (count($aFiles) > 0) {\n foreach ($aFiles as $filename) {\n $oItem = TCMSFile::GetInstance($filename);\n $this->AddItem($oItem);\n }\n }\n }\n }\n }",
"public function SetMatch ($match);",
"public function setPattern($pattern)\n {\n $this->_pattern = $pattern;\n }",
"function __construct(array $inOptions = array()) {\r\n\t\t$this->_handle = null;\r\n\t\t$this->getOptionsSet()->setOptions($inOptions);\r\n\t\t$this->_file_extensions = array(\r\n\t\t\t'php' => FTP_ASCII,\r\n\t\t\t'css' => FTP_ASCII,\r\n\t\t\t'js' => FTP_ASCII,\r\n\t\t\t'html' => FTP_ASCII,\r\n\t\t\t'htm' => FTP_ASCII,\r\n\t\t\t'phtml' => FTP_ASCII,\r\n\t\t\t'xml' => FTP_ASCII,\r\n\t\t\t'json' => FTP_ASCII,\r\n\t\t\t\r\n\t\t\t'gif' => FTP_BINARY,\r\n\t\t\t'jpg' => FTP_BINARY,\r\n\t\t\t'jpeg' => FTP_BINARY,\r\n\t\t\t'png' => FTP_BINARY,\r\n\t\t\t'ico' => FTP_BINARY,\r\n\t\t\t'zip' => FTP_BINARY,\r\n\t\t\t'gz' => FTP_BINARY,\r\n\t\t\t'iso' => FTP_BINARY,\r\n\t\t);\r\n\t $this->_ls_match = array(\r\n\t\t\t'unix' => array(\r\n\t\t\t\t'pattern' => '/(?:(d)|.)([rwxts-]{9})\\s+(\\w+)\\s+([\\w\\d-()?.]+)\\s+([\\w\\d-()?.]+)\\s+(\\w+)\\s+(\\S+\\s+\\S+\\s+\\S+)\\s+(.+)/',\r\n\t\t\t\t'map' => array(\r\n\t\t\t\t\t'is_dir' => 1,\r\n\t\t\t\t\t'rights' => 2,\r\n\t\t\t\t\t'files_inside' => 3,\r\n\t\t\t\t\t'user' => 4,\r\n\t\t\t\t\t'group' => 5,\r\n\t\t\t\t\t'size' => 6,\r\n\t\t\t\t\t'date' => 7,\r\n\t\t\t\t\t'name' => 8,\r\n\t\t\t\t)\r\n\t\t\t),\r\n\t\t\t'windows' => array(\r\n\t\t\t\t'pattern' => '/([0-9\\-]+)\\s+([0-9:APM]+)\\s+((<DIR>)|\\d+)\\s+(.+)/',\r\n\t\t\t\t'map' => array(\r\n\t\t\t\t\t'date' => 1,\r\n\t\t\t\t\t'time' => 2,\r\n\t\t\t\t\t'size' => 3,\r\n\t\t\t\t\t'is_dir' => 4,\r\n\t\t\t\t\t'name' => 5,\r\n\t\t\t\t)\r\n\t\t\t)\r\n\t\t);\r\n\t}",
"public function setMatches(array $matches, mixed $patternKey): void\n {\n $this->worldName = $matches[1];\n\n $this->addSolution((new WorldRepairSolution())->setWorldName($this->getWorldName()));\n $this->addSolution((new FileDeleteSolution())->setRelativePath($this->getWorldName()));\n }",
"public function setMatches(array $matches, mixed $patternKey): void\n {\n $this->modName = $matches[1];\n $this->addSolution((new ModRemoveSolution())->setModName($this->modName));\n\n $this->secondModName = $matches[2];\n $this->addSolution((new ModRemoveSolution())->setModName($this->secondModName));\n }",
"protected function _setMatch($match)\n {\n if ($match === null) {\n $this->_match = array(null, null);\n return $this;\n }\n\n $this->_match = $match;\n return $this;\n }",
"public function setRoute($match, $isRegex, $controller, $class,\n $function)\n {\n $this->routes[$match] = array(\n 'match' => $match,\n 'is_regex' => $isRegex,\n 'controller' => $controller,\n 'class' => $class,\n 'function' => $function\n );\n }",
"public static function matchPath($pattern, $str, $isCaseSensitive = true) {\n \n // When str starts with a DIRECTORY_SEPARATOR, pattern has to start with a\n // DIRECTORY_SEPARATOR.\n // When pattern starts with a DIRECTORY_SEPARATOR, str has to start with a\n // DIRECTORY_SEPARATOR.\n if (StringHelper::startsWith(DIRECTORY_SEPARATOR, $str) !==\n StringHelper::startsWith(DIRECTORY_SEPARATOR, $pattern)) {\n return false;\n }\n\n $patDirs = explode(DIRECTORY_SEPARATOR, $pattern);\n $strDirs = explode(DIRECTORY_SEPARATOR, $str);\n\n $patIdxStart = 0;\n $patIdxEnd = count($patDirs)-1;\n $strIdxStart = 0;\n $strIdxEnd = count($strDirs)-1;\n \n // up to first '**'\n while ($patIdxStart <= $patIdxEnd && $strIdxStart <= $strIdxEnd) {\n $patDir = $patDirs[$patIdxStart];\n if ($patDir == \"**\") {\n break;\n }\n if (!self::match($patDir, $strDirs[$strIdxStart], $isCaseSensitive)) {\n return false;\n }\n $patIdxStart++;\n $strIdxStart++;\n }\n if ($strIdxStart > $strIdxEnd) {\n // String is exhausted\n for ($i=$patIdxStart; $i <= $patIdxEnd; $i++) {\n if ($patDirs[$i] != \"**\") {\n return false;\n }\n }\n return true;\n } elseif ($patIdxStart > $patIdxEnd) {\n // String not exhausted, but pattern is. Failure.\n return false;\n }\n\n // up to last '**'\n while ($patIdxStart <= $patIdxEnd && $strIdxStart <= $strIdxEnd) {\n $patDir = $patDirs[$patIdxEnd];\n if ($patDir == \"**\") {\n break;\n }\n if (!self::match($patDir, $strDirs[$strIdxEnd], $isCaseSensitive)) {\n return false;\n }\n $patIdxEnd--;\n $strIdxEnd--;\n }\n \n if ($strIdxStart > $strIdxEnd) {\n // String is exhausted\n for ($i = $patIdxStart; $i <= $patIdxEnd; $i++) {\n if ($patDirs[$i] != \"**\") {\n return false;\n }\n }\n return true;\n }\n\n while ($patIdxStart != $patIdxEnd && $strIdxStart <= $strIdxEnd) {\n $patIdxTmp = -1;\n for ($i = $patIdxStart+1; $i <= $patIdxEnd; $i++) {\n if ($patDirs[$i] == \"**\") {\n $patIdxTmp = $i;\n break;\n }\n }\n if ($patIdxTmp == $patIdxStart+1) {\n // '**/**' situation, so skip one\n $patIdxStart++;\n continue;\n }\n // Find the pattern between padIdxStart & padIdxTmp in str between\n // strIdxStart & strIdxEnd\n $patLength = ($patIdxTmp-$patIdxStart-1);\n $strLength = ($strIdxEnd-$strIdxStart+1);\n $foundIdx = -1;\n\n //strLoop: (start of outer loop)\n for ($i=0; $i <= $strLength - $patLength; $i++) { \n for ($j = 0; $j < $patLength; $j++) {\n $subPat = $patDirs[$patIdxStart+$j+1];\n $subStr = $strDirs[$strIdxStart+$i+$j];\n if (!self::match($subPat, $subStr, $isCaseSensitive)) {\n continue 2; // continue up two levels (to strLoop:)\n }\n } \n $foundIdx = $strIdxStart+$i; // only reached if all sub patterns matched\n break;\n }\n\n if ($foundIdx == -1) {\n return false;\n }\n\n $patIdxStart = $patIdxTmp;\n $strIdxStart = $foundIdx + $patLength;\n }\n\n for ($i = $patIdxStart; $i <= $patIdxEnd; $i++) {\n if ($patDirs[$i] != \"**\") {\n return false;\n }\n }\n\n return true;\n }",
"function ft_hook_dirlist() {}",
"public function setMatcher(MatcherInterface $matcher)\n {\n $this->manager->setMatcher($matcher);\n }",
"public function buildFromDirectory($dir, $regex = null)\n {\n $iterator = new RecursiveIteratorIterator(\n new RecursiveDirectoryIterator(\n $dir,\n FilesystemIterator::KEY_AS_PATHNAME\n | FilesystemIterator::CURRENT_AS_FILEINFO\n | FilesystemIterator::SKIP_DOTS\n )\n );\n\n if ($regex) {\n $iterator = new RegexIterator($iterator, $regex);\n }\n\n $this->buildFromIterator($iterator, $dir);\n }",
"public function setMatch(array $offset){\n $this->match = $offset;\n }",
"public function setMatch(Match $match);",
"public function set_test_directory_list() {\n\t\tforeach ($this->directory_list as $dir_name) {\n\t\t\t$dir=dir($dir_name);\n\t\t\twhile(( $file=$dir->read()) !==false) {\n\t\t\t\tif (preg_match(\"/\\w+\\.phpt$/\", $file)) {\n\t\t\t\t\tarray_push($this->test_directory_list, $dir_name);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}",
"private function addRegex(\n $inputDir,\n $regexPattern,\n $localPath = \"/\",\n $recursive = true,\n $compressionMethod = null\n ) {\n $regexPattern = (string)$regexPattern;\n if (empty($regexPattern)) {\n throw new InvalidArgumentException('The regex pattern is not specified');\n }\n $inputDir = (string)$inputDir;\n if (strlen($inputDir) === 0) {\n throw new InvalidArgumentException('The input directory is not specified');\n }\n if (!is_dir($inputDir)) {\n throw new InvalidArgumentException(sprintf('The \"%s\" directory does not exist.', $inputDir));\n }\n $inputDir = rtrim($inputDir, '/\\\\') . DIRECTORY_SEPARATOR;\n\n $files = FilesUtil::regexFileSearch($inputDir, $regexPattern, $recursive);\n if (empty($files)) {\n return $this;\n }\n if (!empty($localPath) && is_string($localPath)) {\n $localPath = trim($localPath, '\\\\/') . '/';\n } else {\n $localPath = \"/\";\n }\n $inputDir = rtrim($inputDir, '/\\\\') . DIRECTORY_SEPARATOR;\n\n /**\n * @var string $file\n */\n foreach ($files as $file) {\n $filename = str_replace($inputDir, $localPath, $file);\n $filename = ltrim($filename, '\\\\/');\n if (is_dir($file) && FilesUtil::isEmptyDir($file)) {\n $this->addEmptyDir($filename);\n } elseif (is_file($file)) {\n $this->addFile($file, $filename, $compressionMethod);\n }\n }\n return $this;\n }",
"public function __construct( $pattern, $default = null )\n {\n $this->pattern = $pattern;\n $this->default = $default;\n }",
"public static function preg_ls ($path=\".\", $recursive=false, $pattern=\"/.*/\") {\n $rec = $recursive;\n $pat = $pattern;\n // it's going to be used repeatedly, ensure we compile it for speed.\n $pat=preg_replace(\"|(/.*/[^S]*)|s\", \"\\\\1S\", $pat);\n //Remove trailing slashes from path\n while (substr($path,-1,1)==\"/\") $path=substr($path,0,-1);\n //also, make sure that $path is a directory and repair any screwups\n if (!is_dir($path)) $path=dirname($path);\n //assert either truth or falsehoold of $rec, allow no scalars to mean truth\n if ($rec!==true) $rec=false;\n //get a directory handle\n $d=dir($path);\n //initialise the output array\n $ret=Array();\n //loop, reading until there's no more to read\n while (false!==($e=$d->read())) {\n //Ignore parent- and self-links\n if (($e==\".\")||($e==\"..\")) continue;\n //If we're working recursively and it's a directory, grab and merge\n if ($rec && is_dir($path.\"/\".$e)) {\n $ret=array_merge($ret,preg_ls($path.\"/\".$e,$rec,$pat));\n continue;\n }\n //If it don't match, exclude it\n if (!preg_match($pat,$e)) continue;\n //In all other cases, add it to the output array\n $ret[]=$path.\"/\".$e;\n }\n //finally, return the array\n return $ret;\n }",
"public function setPattern($pattern) {\n $this->pattern = $pattern;\n return $this;\n }",
"public function match($pattern, $path, $isCaseSensitive = false);"
] |
[
"0.5060598",
"0.49435905",
"0.48913258",
"0.4856138",
"0.48100463",
"0.4758084",
"0.471023",
"0.4632601",
"0.4630211",
"0.46175572",
"0.4611517",
"0.4597019",
"0.4581685",
"0.45802873",
"0.44857332",
"0.43892467",
"0.43859693",
"0.4378849",
"0.4374053",
"0.43589106",
"0.4307968",
"0.4285801",
"0.42778212",
"0.42760384",
"0.4249332",
"0.42426652",
"0.4230113",
"0.4229107",
"0.42286626",
"0.422698"
] |
0.7971091
|
0
|
/get el datatables Invoices
|
public function getInvoicesDataTable($codigoInvoices='')
{//var_dump($_POST);exit;
echo ($this->invm->ShowInvoicesTable($codigoInvoices));
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getInvoices()\n {\n $users = User::where('role_id', '=', 2)->lists('id')->toArray();\n $invoices = Invoice::whereIn('user_id', $users);\n\n return Datatables::of($invoices)\n ->editColumn('id', function ($invoice) {\n return '<a href=\"' . url('admin/invoices/' . $invoice->id) . '\">' . $invoice->id . '</a>';\n })\n ->addColumn('member_id', function ($invoice) {\n return $invoice->user->id;\n })\n ->editColumn('created_at', function ($invoice) {\n return Carbon::parse($invoice->created_at)->format('d-M-Y');\n })\n ->addColumn('due_date', function ($invoice) {\n if ($invoice->status == 'paid') {\n return 'Paid';\n }\n\n $formattedDueDate = Carbon::parse(explode(' ', $invoice->due_date)[0]);\n $formattedNowDate = Carbon::parse(explode(' ', Carbon::now())[0]);\n\n if ($formattedDueDate->eq($formattedNowDate))\n return 'Today';\n else if ($formattedDueDate->lt($formattedNowDate))\n return Carbon::parse($invoice->due_date)->diffForHumans();\n\n return Carbon::parse($invoice->due_date)->format('d-M-Y');\n })\n ->editColumn('total', function ($invoice) {\n return '$' . number_format($invoice->total, 2);\n })->addColumn('store_code', function ($invoice) {\n return isset($invoice->store_payment->code) ? $invoice->store_payment->code : '-';\n })\n ->editColumn('status', function ($invoice) {\n if ($invoice->status == 'paid') {\n return '<div class=\"invoice-stat-col\" style=\"color:#c12036;\">' .\n '<i class=\"check-icon\" aria-hidden=\"true\"></i>' .\n '<span>Paid</span>' .\n '</div>';\n } else if ($invoice->status == 'pending') {\n return '<div class=\"invoice-stat-col\" style=\"color:#d98800;\">' .\n '<i class=\"fa fa-clock-o\" aria-hidden=\"true\"></i>' .\n '<span>Pending approval</span>' .\n '</div>';\n } else if ($invoice->status == 'draft') {\n return '<div class=\"invoice-stat-col\" style=\"color:#0081d9;\">' .\n '<i class=\"fa fa-clipboard\" aria-hidden=\"true\"></i>' .\n '<span>Draft</span>' .\n '</div>';\n }\n\n return '<div class=\"invoice-stat-col\">' .\n '<i class=\"x-icon\" aria-hidden=\"true\"></i>' .\n '<span>Unpaid</span>' .\n '</div>';\n })\n ->addColumn('action', function ($invoice) {\n if ($invoice->status == 'draft')\n return '<a class=\"btn btn-primary\" href=\"' .\n url('admin/invoices/' . $invoice->id . '/send-invoice') .\n '\">Send Invoice</a>';\n\n if ($invoice->status == 'pending') {\n $btns = '<a class=\"btn btn-outline\" href=\"' .\n url('admin/invoices/' . $invoice->id . '/mark-as-payed') .\n '\">Mark as paid</a>';\n return $btns;\n }\n\n\n return '';\n })\n ->make(true);\n }",
"public function get_invoice_list()\n {\n return $this->db->select('sr_no, invoice_no, round_off_total, invoice_date, bakery_name,bakery_address, bakery_area, bakery_city')->order_by('sr_no','desc')\n ->from('insider_bill')->join('customers', 'customers.id = insider_bill.customer_id')->get();\n }",
"public function get_invoices( ) {\n\n $invoiceArray = $this->mockinvoice_model->get_invoices( $this->input->post( 'jobId' ) );\n\n if ( !empty( $invoiceArray ) ) {\n $invoiceHTML = create_invoice_html( $invoiceArray );\n // Push the HTML for the invoice tables onto the array being returned\n $invoiceArray[] = array( 'mockInvoiceId' => '', 'readyToInvoice' => '', 'archived' => '', 'invoiceHTML' => $invoiceHTML );\n }\n\n // Send back the timesheet settings as JSON.\n $this->json_library->print_array_json( $invoiceArray );\n }",
"public function getData()\n {\n return Datatables::of(App\\Models\\Courier::where('company_id', Auth::user()->company_id))->make(true);\n }",
"public function index(SaleInvoiceDataTable $dataTable)\n {\n $data = [];\n $data['menu'] = 'sales';\n $data['sub_menu'] = 'sales/direct-invoice';\n $data['page_title'] = __('Invoices');\n $data['location'] = isset($_GET['location']) ? $_GET['location'] : NULL;\n $data['customer'] = isset($_GET['customer']) ? $_GET['customer'] : NULL;\n $data['currency'] = isset($_GET['currency']) ? $_GET['currency'] : NULL;\n $data['project'] = isset($_GET['project']) ? $_GET['project'] : NULL;\n $data['status'] = isset($_GET['status']) ? $_GET['status'] : NULL;\n $data['from'] = isset($_GET['from']) ? $_GET['from'] : NULL;\n $data['to'] = isset($_GET['to']) ? $_GET['to'] : NULL;\n $data['transactionType'] = isset($_GET['transactionType']) ? $_GET['transactionType'] : NULL;\n $data['customerList'] = Customer::where('is_active', 1)->get(['id', 'name']);\n $data['locationList'] = Location::getAll();\n $data['currencyList'] = Currency::getAll();\n $data['projectList'] = Project::getAll(['id', 'name']);\n $data['amounts'] = $amounts = $invoiceSummery = $this->saleOrder->getMoneyStatus(['customer_id' => $data['customer'], 'location' => $data['location'], 'currency' => $data['currency'], 'from' => $data['from'], 'to' => $data['to'], 'transaction_type' => $data['transactionType'], 'status' => $data['status']]);\n $allCurrency = [];\n $overdueCurrency = [];\n foreach ($amounts['amounts'] as $amount) {\n if (isset($amount->currency->symbol) && !empty($amount->currency->symbol)) {\n $allCurrency[] = $amount->currency->symbol;\n }\n }\n foreach ($amounts['overDue'] as $amount) {\n if (isset($amount->currency->symbol) && !empty($amount->currency->symbol)) {\n $overdueCurrency[] = $amount->currency->symbol;\n }\n }\n $data['allCurrency'] = array_diff($allCurrency, $overdueCurrency);\n\n $row_per_page = Preference::getAll()->where('field', 'row_per_page')->first()->value;\n return $dataTable->with('row_per_page', $row_per_page)->render('admin.invoice.list', $data);\n }",
"public function dataForInvoice() {\n\t\t\t\n\t\t\t$data = [\n\t\t\t 'booking_reference' => $this->reference,\n\t\t\t 'booking_date' => Utility::dateTimeLocale($this->updated_at, false),\n\t\t\t 'user_booking_fullname' => $this->user_booking_fullname,\n\t\t\t 'user_booking_address' => $this->user_booking_address,\n\t\t\t 'user_booking_locality' => $this->user_booking_full_locality,\n\t\t\t 'user_booking_email' => $this->user_booking_email,\n\t\t\t 'user_booking_tax_code' => $this->user->customer->taxCode,\n\t\t\t 'apartment_owner_fullname' => $this->apartment_owner_fullname,\n\t\t\t 'apartment_owner_tax_code' => $this->apartmentOwner->customer->taxCode,\n\t\t\t 'apartment_owner_address' => $this->apartment_owner_address,\n\t\t\t 'apartment_owner_locality' => $this->apartment_owner_full_locality,\n\t\t\t 'apartment_owner_email' => $this->apartment_owner_email,\n\t\t\t 'apartment_title' => $this->apartment_title,\n\t\t\t 'apartment_price_per_night' => $this->apartment_price_per_night,\n\t\t\t 'check_in' => Utility::dateTimeLocale($this->check_in, false),\n\t\t\t 'check_out' => Utility::dateTimeLocale($this->check_out, false),\n\t\t\t 'nights_count' => Utility::diffInDays($this->check_in, $this->check_out),\n\t\t\t 'total_amount' => $this->bookingAmount(),\n\t\t\t 'has_upgrades' => $this->bookedServices()->exists(),\n\t\t\t];\n\t\t\tif ($data['has_upgrades']) {\n\t\t\t\t$data['upgrades'] = [];\n\t\t\t\tforeach ($this->bookedServices()->get() as $bookedService) {\n\t\t\t\t\t$data['upgrades'][] =\n\t\t\t\t\t [\n\t\t\t\t\t\t'name' => $bookedService->name,\n\t\t\t\t\t\t'price_per_night' => $bookedService->price_per_night,\n\t\t\t\t\t ];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn $data;\n\t\t}",
"public function list(InvoiceDataTable $datatable)\n {\n return $datatable->ajax();\n }",
"public function getData()\n {\n return DataTables::of(App\\Models\\Deposit::where('company_id', Auth::user()->company_id))->make(true);\n }",
"public function invoices()\n {\n //\n $invoices = Invoice::orderBy('updated_at','DESC')->get();\n return view('reports.invoice',['invoices'=>$invoices]);\n }",
"function invoices ($user_id) {\n global $sql;\n return $sql->sql_select_array_query(\"SELECT * FROM `invoice` WHERE user_id = '{$user_id}' ORDER BY invoice_date DESC\");\n }",
"public function postdata4()\n {\n $worker = Worker::where(\"email\",Auth::user()->email)->first();\n return Datatables::of(Invoice::where(\"worker_key\",$worker->key)->get())->make(true);\n }",
"public function postdata5()\n {\n $dealer = Dealer::where(\"company_email\",Auth::user()->email)->first();\n return Datatables::of(Invoice::where(\"dealer_key\",$dealer->key)->get())->make(true);\n }",
"public function getData()\n {\n return Datatables::of(App\\Models\\Volume::where('company_id', Auth::user()->company_id))->make(true);\n }",
"function get_datatables_invoice()\n {\n $this->company_db = $this->load->database('company_db', TRUE);\n $offset = ($_REQUEST['datatable']['pagination']['page'] - 1)*$_REQUEST['datatable']['pagination']['perpage'];\n $this->_get_datatables_query_invoice();\n if($_REQUEST['datatable']['pagination']['perpage'] != -1)\n $this->company_db->limit($_REQUEST['datatable']['pagination']['perpage'], $offset);\n $query = $this->company_db->get();\n /*$this->_get_datatables_query();\n $query2 = $this->company_db->get();*/\n /* echo \"<pre>\";\n var_dump($query);exit;\n echo \"</pre>\";*/\n\n $this->session->set_userdata('last_pickup_report_query',$this->company_db->last_query());\n\n\n if($query->num_rows() > 0)\n {\n foreach ($query->result() as $row)\n {\n //var_dump($row);exit;\n //$balance = $row->balance;\n\n //var_dump($balance);exit;\n\n\n\n // $now = strtotime(str_replace('/', '-', $_REQUEST['datatable']['pickup_date'])); // or your date as well\n\n $row->invoice_number = \"<span class='invoice'>$row->invoice_number</span>\n <span></span>\";\n $row->name = \"<div style='display:none' class='customer'>$row->customer_id</div><span>$row->name</span>\";\n\n $row->nameShipto = \"<div style='display:none' class='nameShipto'>$row->ShiptoId</div><span>$row->nameShipto</span>\";\n\n $row->total_packages = \"<span class='total_packages'>$row->total_packages</span><span></span>\";\n\n $row->balance = \"<span class='balance'>$row->balance</span><span></span>\";\n\n $row->invoice_date = \"<span class='invoice_date'>$row->invoice_date</span><span></span>\n \";\n // var_dump($row);exit;\n\n /*$your_date = strtotime($row->pickup_date);\n $datediff = $now - $your_date;\n\n $days = round($datediff / (60 * 60 * 24));\n if($days > 2)\n $row->pickup_date = \"<label class='text-danger'>\".date(\"m/d/Y\", strtotime($row->pickup_date)).\"</label>\";\n else if($days > 1)\n $row->pickup_date = \"<label class='text-warning'>\".date(\"m/d/Y\", strtotime($row->pickup_date)).\"</label>\";\n else\n $row->pickup_date = date(\"m/d/Y\", strtotime($row->pickup_date));*/\n\n $row->chk_status = \"<label class='m-checkbox m-checkbox--solid m-checkbox--brand'><input type='checkbox' id='chk_status_$row->id' value = '$row->id' class = 'chk_status' name='chk_status[]' data-id ='$row->id'>\n <span></span></label>\n \";\n /*if($row->status != \"Done\"){\n } else {\n $row->chk_status = \"<label class='m-checkbox m-checkbox--solid m-checkbox--brand'><input type='checkbox' id='chk_status_$row->id' value = '$row->id' class = 'chk_status' name='chk_status[]' data-id ='$row->id' checked>\n <span></span></label>\";\n }*/\n\n $row->chk_print = \"<label class='m-checkbox m-checkbox--solid m-checkbox--brand'>\n <input type='checkbox' class = 'chk_print' name='chk_print[]' data-id ='$row->id' checked>\n <span></span>\n </label>\";\n\n /* if($row->driver_id != '0'){\n\n $row->chk_driver = \"<label class='m-checkbox m-checkbox--solid m-checkbox--brand'><input type='checkbox' class = 'chk_driver' name='chk_driver[]' data-id ='$row->id' checked>\n <span></span></label>\";\n\n }else{\n\n $row->chk_driver = \"<label class='m-checkbox m-checkbox--solid m-checkbox--brand'><input type='checkbox' class = 'chk_driver' name='chk_driver[]' data-id ='$row->id'>\n <span></span></label>\n \";\n }*/\n\n\n }\n\n return $query->result();\n }\n else\n {\n return false;\n }\n }",
"public function getInvoices(User $user);",
"public function datatable()\n {\n $reportes=Reporte::join('ilustraciones','reportes.id_ilustracion','=','ilustraciones.id_ilustracion')\n ->join('users','reportes.id_user','=','users.id')\n ->select(array('users.name','ilustraciones.name_draw','ilustraciones.estado','reportes.id_reporte'));\n return DataTables::of($reportes)\n ->addColumn('view','IntAdmin.intReportes.botones.revisar')\n ->rawColumns(['view'])\n ->toJson(); \n }",
"public function getInvoiceModel(){}",
"function InfGetInvoices($inf_contact_id, $pay_status = 0) {\n\t$object_type = \"Invoice\";\n\t$class_name = \"Infusionsoft_\" . $object_type;\n\t$object = new $class_name();\n\t$objects = Infusionsoft_DataService::query(new $class_name(), array('ContactId' => $inf_contact_id, 'PayStatus' => $pay_status));\n\n $invoices_array = array();\n foreach ($objects as $i => $object) {\n\t\t// Give it a userful index, ie, inf_invoice_id\n\t\t$array = $object->toArray();\n $invoices_array[$array['Id']] = $array;\n }\n\treturn $invoices_array; \n}",
"public function data()\n {\n $orders=libro::all();\n foreach ($orders as $key => $value) {\n \n if(count(autor::find($value->id_autor)))\n $value->id_autor=autor::find($value->id_autor)->nombre;\n else $value->id_autor='No asignado';\n \n }\n return \\Datatables::of($orders)->addColumn('action', 'libro.partials.vista')->make(true) ; \n }",
"public function getAllInvoicesFromWebSerice() {\n $response = $this->_XeroOAuth->request('GET', $this->_XeroOAuth->url('Invoices', 'core'), array());\n if ($this->_XeroOAuth->response['code'] == 200) {\n $invoices = $this->_XeroOAuth->parseResponse($this->_XeroOAuth->response['response'], $this->_XeroOAuth->response['format']);\n return $invoices;\n } else {\n \\De\\Log::logApplicationInfo ( \"Caught Exception: \" . urldecode($response['response']) . ' -- File: ' . __FILE__ . ' Line: ' . __LINE__ );\n }\n }",
"function displayInvoices($custId) {\n $sql = \"SELECT * FROM invoices \n WHERE customer_id = $custId\n \";\n \n $result = mysqli_query($GLOBALS[\"con\"], $sql);\n if ($result) {\n $rows = array();\n while ($row = mysqli_fetch_assoc($result)) {\n $rows[] = $row;\n }\n echo json_encode($rows);\n } \n \n }",
"public function getDatatable() {\n \treturn datatables()->of(\\App\\Models\\Class_::all())->make(true);\n }",
"public function invoices(Request $request)\n {\n $user = $request->user();\n $currentCompany = $user->currentCompany();\n \n $invoices = Invoice::findByCompany($currentCompany->id)\n ->findByCustomer($request->customer_id)\n ->unpaid()\n ->where('due_amount', '>', 0)\n ->select('id', 'invoice_number AS text', 'due_amount')\n ->get();\n\n return response()->json($invoices);\n }",
"public function dataTable();",
"public function getInvoices($options = array())\n {\n return $this->getListe(\"invoices\", $options);\n }",
"public function index()\n {\n $data = array();\n $invoices = Invoice::select('*')->get();\n $data = $invoices;\n $counter = 0;\n\n foreach($invoices as $k => $v){\n $custId = json_encode($v->cust_id);\n\n $customer = Customer::select('*')->where('cust_id', '=', $v->cust_id)->first();\n $data[$counter]->cust_id = $customer;\n\n $pid = explode(',', $v->product_id);\n $discount = explode(',', $v->discount_percentage);\n $quantity = explode(',', $v->quantity);\n\n $prods = array();\n $grandTotal = 0;\n $unitPrice = array();\n foreach($pid as $k => $pv){\n $products = Product::select('*')->where('product_id', '=',$pv)->first();\n array_push($prods, $products);\n array_push($unitPrice, $products->sellprice);\n $discountAmount = $products->sellprice * $discount[$k];\n $totalPrice = $quantity[$k] * $products->sellprice;\n $total = $totalPrice - $discountAmount;\n $grandTotal = $grandTotal + $total;\n }\n $data[$counter]->product_id = $prods;\n $data[$counter]->total = $grandTotal;\n\n $iPdf = isset($custId) ? \"https://eyeplus.xtechsoftsolution.com/invoice_pdf_api.php?cust_id=\".$custId.\"&last_id=\".$v->invoice_id : '';\n $data[$counter]->invoiceUrl = $iPdf;\n\n $counter++;\n }\n return json_encode($data);\n }",
"public function invoices()\n {\n $user = auth()->user();\n $facturas = DB::table('quotes')\n ->select('quotes.account_id', 'quotes.created_by_id', 'quotes.id as quoteId', 'quotes.quote_date',\n DB::raw(\"upper(quotes.quote_number) AS quote_number\"),\n 'quotes.invoice_date','quotes.stage_id',\n 'accounts.name as accountName','users.name as userName','stages.name as stageName',\n 'accounts.document_number','document_types.name as documenttype')\n ->join('accounts', 'accounts.id', '=', 'quotes.account_id')\n ->join('document_types', 'document_types.id', '=', 'accounts.document_type_id')\n ->join('stages', 'stages.id', '=', 'quotes.stage_id')\n ->join('users', 'users.id', '=', 'quotes.created_by_id')\n ->whereIn('quotes.stage_id', array(3,4))\n ->where('users.organization_id', $user->organization_id)\n ->orderByRaw('quotes.updated_at DESC')\n ->paginate(10);\n return view('quote.invoices',compact('facturas'));\n }",
"public function invoices() {\n\t\treturn $this->hasMany('Invoice');\n\t}",
"function datatable()\n {\n return $this->table($this->table);\n }",
"public function anyData()\n\t{\n\t return Datatables::collection(goods::all())->make(true);\n\t}"
] |
[
"0.7523435",
"0.6980783",
"0.6794872",
"0.67808783",
"0.67311484",
"0.66760546",
"0.66644865",
"0.6654955",
"0.6619565",
"0.66085905",
"0.6585801",
"0.6575053",
"0.65600234",
"0.65282506",
"0.6496797",
"0.64775985",
"0.64752084",
"0.64749837",
"0.64601135",
"0.6440379",
"0.6405476",
"0.6403143",
"0.63989234",
"0.63976675",
"0.63893396",
"0.63844126",
"0.63810945",
"0.6369295",
"0.63527036",
"0.63515264"
] |
0.7548225
|
0
|
/ get shipto data by ajax
|
function get_shipto_data($shipto_id="")
{
//var_dump($_POST);exit;
$output = array('result'=>'');
if(!empty($shipto_id)){
$output['result'] = $this->invm->get_shipto_data($shipto_id);
//var_dump($output['result']);exit;
}
echo json_encode($output);
die;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function ajaxGetAction()\n {\n $this->view->disable();\n $response = new \\Phalcon\\Http\\Response();\n if (!$this->request->isAjax()) {\n echo \"is not Ajax ! \";\n }\n if (!$this->request->isPost()) {\n echo \"is not Post ! \";\n }\n $tokuisaki_bunrui4 = TokuisakiBunrui4Kbns::find(array(\n 'order' => 'cd',\n 'conditions' => ' cd LIKE ?1 ',\n 'bind' => array(1 => $this->request->getPost('cd').'%')\n ));\n $res_flds = [\"id\",\"cd\",\"name\",];\n $resData = array();\n foreach ($tokuisaki_bunrui4 as $bunrui4) {\n $resAdata = array();\n foreach ($res_flds as $res_fld) {\n $resAdata[$res_fld] = $bunrui4->$res_fld;\n }\n $resData[] = $resAdata;\n }\n $response->setContent(json_encode($resData));\n return $response;\n }",
"public function ajaxTraerPrestamo(){\n\n\t\t$item = \"idPrestamo\";\n\t\t$valor = $this->idPrestamo;\n\n\t\t$respuesta = ControladorArticulos::ctrBuscarPrestamo($item, $valor);\n\n\t\techo json_encode($respuesta);\n\n\t}",
"public function get_data_berita_on_slider_page(){\r\r\n\t\tif( $this->input->is_ajax_request() ){\r\r\n\t\t\t$this->get_data_ajax_berita_on_slider_page();\r\r\n\t\t}else{\r\r\n\t\t\tredirect(base_url());\r\r\n\t\t}\r\r\n\t}",
"public function ajax_content()\n\t{\n\t\t$return_struct = array(\n\t\t\t'status' => 0,\n\t\t\t'code'\t => 501,\n\t\t\t'msg'\t => 'Not Implemented'\n\t\t);\n\t\tif(request::is_ajax())\n\t\t{\n\t\t\t$id = intval($this->input->get('id')); \n $value = $this->single($id);\n \n\t\t\t$return_template = $this->template = new View('template_blank');\n\t\t\t$this->template->content = $value;\n\t\t\t$return_str = $return_template->render();\n\t\t\t$return_struct['status'] = 1;\n\t\t\t$return_struct['code'] = 200;\n\t\t\t$return_struct['msg'] = 'Success';\n\t\t\t$return_struct['content'] = $return_str;\n\t\t\texit(json_encode($return_struct));\n\t\t}\n\t}",
"public function hapusDataajax()\n {\n $data = $this->model_system->hapusData();\n echo json_encode($data);\n\t }",
"public function ajaxCodsPrestamo(){\n\n\t\t$item = \"idPrestamo\";\n\t\t$valor = $this->idPrestamo;\n\n\t\t$respuesta = ControladorArticulos::ctrMostrarArticulosCodPrestados($item, $valor);\n\t\techo json_encode($respuesta);\n\n\t}",
"function getdata(){\n\t\t$grid = $this->jqdatagrid;\n\n\t\t// CREA EL WHERE PARA LA BUSQUEDA EN EL ENCABEZADO\n\t\t$mWHERE = $grid->geneTopWhere('spre');\n\n\t\t$response = $grid->getData('spre', array(array()), array(), false, $mWHERE, 'id', 'desc' );\n\t\t$rs = $grid->jsonresult( $response);\n\t\techo $rs;\n\t}",
"public function ajaxmethod()\n {\n $result = [\n \"csrfTokenName\" => $this->security->get_csrf_token_name(),\n \"csrfHash\" => $this->security->get_csrf_hash(),\n ];\n $this->output->set_content_type('application/json')->set_output(json_encode($result));\n }",
"public function ajax_response()\n {\n $this->ajax_data_return['data'] = (object) $this->ajax_data_return['data'];\n echo json_encode($this->ajax_data_return);\n }",
"function ajax()\n {\n $json = \"\";\n $registros = $this->model->getRegistros();\n \n if($registros){\n $url_modificar = \"'\".base_url().\"index.php/\".$this->_subject.\"/abm/\";\n $btn_class = \"'btn btn-default'\";\n $icon_class = \"'fa fa-pencil-square-o'\";\n foreach ($registros as $row) {\n $url_final = $row->id_log.\"'\";\n \n $buttons = '<a class='.$btn_class.' href='.$url_modificar.$url_final.'><i class='.$icon_class.'></i></a> ';\n \n $registro = array(\n $row->date_add,\n $row->accion,\n $row->user_add,\n $row->programa,\n $buttons,\n );\n \n $json .= setJsonContent($registro);\n }\n } \n \n $json = substr($json, 0, -2);\n \n echo '{ \"data\": ['.$json.' ] }';\n }",
"function ajaxPhotographyDetails(){\n\t\n\t\t$this->loadModel('Photographer');\n\t\t$photographer = $this->Photographer->find('first',array('conditions'=>array('Photographer.id'=>$_POST['id'])));\n\t\t$photographerArr[\"name\"]= $photographer['Photographer']['name'];\n\t\t$photographerArr[\"mobile\"]= $photographer['Photographer']['mobile'];\n\t\t$photographerArr[\"website\"]= $photographer['Photographer']['website'];\n\t\t$photographerArr[\"email\"]= $photographer['User']['email'];\n\t\techo json_encode($photographerArr);\n\t\texit;\n\t\n\t}",
"public function ajaxMostrarProductos(){\n\n $item = null;\n $valor = null;\n\n $respuesta = ProductosControlador::ctrMostrarProductos($item, $valor);\n\n echo json_encode($respuesta);\n\n }",
"public function sendData()\n \t{\n \t\t$data = $this->m_admin->getData(\"siswa\")->result();\n \t\techo json_encode($data) ;\n \t}",
"public function get_resultado_final(){\n if($this->input->is_ajax_request() && $this->input->post()){\n $post = $this->input->post();\n $rf_id = $this->security->xss_clean($post['rf_id']);\n\n $dato_rfinal = $this->model_mestrategico->get_resultado_final($rf_id);\n \n $result = array(\n 'resultado' => $dato_rfinal\n );\n\n echo json_encode($result);\n }else{\n show_404();\n }\n }",
"public function sendAjax($data){\n header(\"Content-Type:application/json\"); // Cabecera que indica el tipo de datos que recibe.\n echo json_encode($data); // Imprime los datos dentro de objetos JSON.\n }",
"public function ajaxTraerEspecialidad(){\n\n\t\t$item = \"idEspecialidad\";\n\t\t$valor = $this->idEspecialidad;\n\t\t$respuesta = ControladorAdmision::ctrMostrarEspecialidad($item, $valor);\n\n\t\techo json_encode($respuesta);\n\n\t}",
"function ajax_listsiswa_by_To($idTO) {\n\t\t$list = $this->load->Mtoback->siswa_by_totID($idTO);\n\t\t$data = array();\n\n\t\t$baseurl = base_url();\n\t\t$no=1;\n\t\tforeach ( $list as $list_siswa ) {\n\t\t\t// $no++;\n\t\t\t$row = array();\n\t\t\t$row[] = $no;\n\t\t\t$row[] = $list_siswa ['namaPengguna'];\n\t\t\t$row[] = $list_siswa ['namaDepan'].' '.$list_siswa ['namaBelakang'];\n\t\t\t$row[] = $list_siswa['aliasTingkat'];\n\t\t\t$row[] = '<a class=\"btn btn-sm btn-danger\" title=\"Hapus\" onclick=\"dropSiswa('.\"'\".$list_siswa['idKey'].\"'\".')\"><i class=\"ico-remove\"></i></a>';\n\n\t\t\t$data[] = $row;\n\t\t\t$no++;\n\t\t}\n\n\t\t$output = array(\n\t\t\t\"data\"=>$data,\n\t\t\t);\n\n\t\techo json_encode( $output );\n\t}",
"public function handleAjaxRequest();",
"function get_siswa_json() {\n header('Content-Type: application/json');\n echo $this->bagikelas_model->get_all_siswa();\n }",
"public function ajaxAction(){\n $request = $this->getRequest();\n $cat = $request->request->get('cat');\n $pg = $request->request->get('pg');\n $q = $request->request->get('q');\n $sort = $request->request->get('sort');\n if(!$request->isXmlHttpRequest() || !$pg || !$cat){\n throw new AccessDeniedHttpException('Você não tem permissão para acessar esta página.');\n }\n $ret['search'] = (empty ($q)) ? null : $q;\n $ret['cat'] = ($cat == 'all') ? null : $cat;\n if($pg != 1){\n list($field, $pg) = explode('_', $pg);\n }\n $ret['pg'] = $pg;\n $ret['sort'] = $sort;\n return $ret;\n }",
"public function mp_hook_smsabo_ajax(){\n\t\treturn $this->mp_hook_payment_ajax('smsabo');\n\t\t}",
"public function getSettingsAjax()\n {\n $formId = absint($_REQUEST['form_id']);\n wp_send_json_success(array(\n 'custom_css' => $this->getData($formId, '_custom_form_css'),\n 'custom_js' => $this->getData($formId, '_custom_form_js'),\n ), 200);\n }",
"public function postAmplificador()\n {\n //si la peticion es ajax\n if ( Request::ajax() ) {\n $troba = Input::get('troba');\n $nodo = Input::get('nodo');\n $amp = DigTroba::getAmp($troba , $nodo);\n return Response::json(array('rst'=>1,'datos'=>$amp));\n }\n }",
"public function echoAjaxContent() {\n\t\t\n\t\t$sSection = trim( $_GET[ 'section' ] );\n\t\t$sMethod = '';\n\t\t\n\t\tif ( $sSection ) {\n\t\t\t$sMethod = sprintf( 'get%sAjax', Geko_Inflector::camelize( $sSection ) );\n\t\t\tif ( !method_exists( $this, $sMethod ) ) $sMethod = '';\n\t\t}\n\t\t\n\t\tif ( $sMethod ) {\n\t\t\t$aAjaxResponse = $this->$sMethod();\n\t\t\techo Zend_Json::encode( $aAjaxResponse );\n\t\t}\n\t}",
"function getData() {\r\n // get srId from URL\r\n $srID = URL::getParameter('sr_id');\r\n if (!$srID) {\r\n // get srID from incident\r\n if (!$incidentID = intval(URL::getParameter('i_id'))) {\r\n echo $this->reportError('Invalid ID');\r\n return;\r\n }\r\n $incident = RNCPHP\\Incident::fetch(intval($incidentID));\r\n if (!is_null($incident)) {\r\n $srID = $incident->CustomFields->Accelerator->siebel_sr_id;\r\n }\r\n }\r\n\r\n // render data to javascript\r\n $this->data['js']['sr_id'] = $srID;\r\n $this->data['js']['ext_server_type'] = $this->extServerType;\r\n $this->data['js']['development_mode'] = IS_DEVELOPMENT;\r\n }",
"public function get_objetivos_estrategicos(){\n if($this->input->is_ajax_request() && $this->input->post()){\n $post = $this->input->post();\n $obj_id = $post['obj_id'];\n $obj_id = $this->security->xss_clean($obj_id);\n\n $dato_obj = $this->model_mestrategico->get_objetivos_estrategicos($obj_id);\n //caso para modificar el codigo de proyecto y actividades\n foreach($dato_obj as $row){\n $result = array(\n 'codigo' => $row['obj_codigo'],\n \"descripcion\" =>$row['obj_descripcion']\n );\n }\n echo json_encode($result);\n }else{\n show_404();\n }\n }",
"public function mostrar_ajax()\n\t{\n\t\t$sentencia = \"select t1.id_materia, t1.nom_materia,t1.puntaje,t1.descripcion from materia t1\";\n\t\t//var_dump($this->pdo);\n\t\t//exit;\n\t\t$resultado = $this->pdo->prepare($sentencia);\n\t\t$html=\"\";\n\t\t$resultado->execute();\n\t\t/*while ($fila = $resultado->fetch(PDO::FETCH_NUM, PDO::FETCH_ORI_NEXT)) {\n\t\t\t$html.=\"<tr>\";\n\t\t\t$html .= \"<th>\".$fila[0].\"</th>\".\"<th>\".$fila[1].\"</th>\".\"<th>\".$fila[2].\"</th>\".\"<th>\".$fila[3].\"</th>\".\"<th>\".$fila[4].\"</th>\";\n\t\t\t$html .=\"</tr>\";\n\t\t}\n\t\t$this->pdo=null;\n\t\techo $html; exit;*/\n\t\t$num = $resultado->fetchAll();\n\n\t\t$valor = array();\n\t\t$valor = array(\n\t\t\"data\"=> $num\n\t\t); \n\t\theader('Content-type: application/json');\n\t\techo json_encode($valor);\n\t\t//return $datos;\n\t}",
"public function ajax_response()\n {\n }",
"public function xhrGetListings()\n {\n $result = $this->db->select(\"SELECT * FROM data\");\n echo json_encode($result);\n }",
"public function postTroba()\n {\n //si la peticion es ajax\n if ( Request::ajax() ) {\n $trobas = DigTroba::getTroba(Input::all());\n return Response::json(array('rst'=>1,'datos'=>$trobas));\n }\n }"
] |
[
"0.6572706",
"0.635614",
"0.6232196",
"0.62082094",
"0.6185981",
"0.6147785",
"0.6115331",
"0.60822755",
"0.60677",
"0.6010254",
"0.60079944",
"0.59974813",
"0.59423375",
"0.5935562",
"0.5921799",
"0.5903236",
"0.58796006",
"0.58713067",
"0.5868673",
"0.5868634",
"0.5861177",
"0.5848895",
"0.5843133",
"0.5826004",
"0.58174473",
"0.58172077",
"0.5815042",
"0.58133847",
"0.5812316",
"0.5805009"
] |
0.6930998
|
0
|
/ Validation Form Invoices
|
public function Invoices_validate()
{ //return print_r($_POST);
// $versionMax = 0;
if (!$this->input->is_ajax_request())
{
redirect('404');
}else
{
$this->form_validation->set_rules('date',$this->lang->line('field_date'),'required|trim');
$this->form_validation->set_rules('due_date',$this->lang->line('field_due_date'),'trim');
$this->form_validation->set_rules('user',$this->lang->line('field_user'),'trim');
$this->form_validation->set_rules('misc',$this->lang->line('field_misc'),'trim');
$this->form_validation->set_rules('invoice_hash',$this->lang->line('field_invoice_number'),'required|trim');
$this->form_validation->set_rules('agent_invoice',$this->lang->line('field_agent_invoice'),'trim');
$this->form_validation->set_rules('container',$this->lang->line('field_container'),'required|trim');
$this->form_validation->set_rules('agent',$this->lang->line('field_agent'),'trim');
$this->form_validation->set_rules('driver_id',$this->lang->line('field_driver_id'),'required|trim');
$this->form_validation->set_rules('pay_term',$this->lang->line('field_pay_term'),'required|trim');
$this->form_validation->set_rules('status',$this->lang->line('field_status'),'required|trim');
$this->form_validation->set_rules('tot_box',$this->lang->line('field_tot_box'),'required|trim|numeric');
$this->form_validation->set_rules('sub_total',$this->lang->line('field_sub_total'),'required|trim|numeric');
$this->form_validation->set_rules('final_tax',$this->lang->line('field_final_tax'),'required|trim|numeric');
$this->form_validation->set_rules('final_discount',$this->lang->line('field_final_discount'),'required|trim|numeric');
$this->form_validation->set_rules('final_insurance',$this->lang->line('field_final_insurance'),'required|trim');
$this->form_validation->set_rules('final_payment',$this->lang->line('field_final_payment'),'required|trim|numeric');
$this->form_validation->set_rules('final_balance',$this->lang->line('field_final_balance'),'required|trim|numeric');
$this->form_validation->set_rules('shipto_id',$this->lang->line('label_shipto_details'),'required|trim|numeric');
$this->form_validation->set_rules('text_customer_id',$this->lang->line('label_customer_details'),'required|trim|numeric');
$this->form_validation->set_message('required', 'El Campo %s es Requerido');
// $this->form_validation->set_message('version_check','Esta Asignatura para esta version ya existe, favor crear una nueva version para esta asignatura');
/*$this->form_validation->set_message('version_check_max','la version para esta asignatura no esta disponible');*/
if ($this->form_validation->run()== false)
{
echo json_encode(array('st'=>0, 'msg' => validation_errors()));
}
else
{
$customer_id = $shipto_id = 0;
$customer_id = $this->input->post('text_customer_id');
$shipto_id = $this->input->post('shipto_id');
$has_insrance = (!empty($this->input->post('final_insurance')))? "Yes" : "No";
$datos = array(
'customer_id' => $customer_id,
'shipto_id' => $shipto_id,
'void' => 'No',
'user_id' => $this->session->userdata('admin_id'),
'invoice_date' => date("Y-m-d",strtotime(str_replace('/', '-',$this->input->post('date')))),
'invoice_number' => $this->input->post('invoice_hash'),
'agent_number' => $this->input->post('agent_invoice'),
'container' => $this->input->post('container'),
'driver_id' => $this->input->post('driver_id'),
'pay_term' => $this->input->post('pay_term'),
'status' => $this->input->post('status'),
'sub_total' => $this->input->post('sub_total'),
'total_packages' => $this->input->post('tot_box'),
'final_tax' => $this->input->post('final_tax'),
'final_discount' => $this->input->post('final_discount'),
'final_insurance' => $this->input->post('final_insurance'),
'final_payment' => $this->input->post('final_payment'),
'final_balance' => $this->input->post('final_balance'),
'balance' => $this->input->post('final_balance'),
);
/*echo "<PRE>";
print_r($datos);exit;
echo "</PRE>";*/
if(!empty($this->input->post('user'))){
$datos['user_name'] = $this->input->post('user');
}
if(!empty($this->input->post('misc'))){
$datos['misc'] = $this->input->post('misc');
}
if(!empty($this->input->post('agent_invoice'))){
$datos['agent_number'] = $this->input->post('agent_invoice');
}
if(!empty($this->input->post('agent'))){
$datos['agent'] = $this->input->post('agent');
}
if(!empty($this->input->post('due_date'))){
$datos['duedate'] = date("Y-m-d",strtotime(str_replace('/', '-',$this->input->post('due_date'))));
}
$header_last_id = $this->invm->add_invoices($datos);
// echo json_encode(array('st'=>1, 'msg' => $this->lang->line('text_inventory_add_success')));
/* now add items */
$item_params = array();
for ($i=0; $i < count($this->input->post('item')); $i++) {
$i_param = array(
'header_id' => $header_last_id,
'description_1' => $this->input->post('item')[$i],
'line_number' => ($i+1),
'qty' => $this->input->post('qty')[$i],
'rate' => $this->input->post('price')[$i],
'discount' => $this->input->post('discount')[$i],
'insurance' => $this->input->post('insurance')[$i],
'tax' => $this->input->post('tax')[$i],
'total_price' => $this->input->post('total')[$i],
);
$item_params[] = $i_param;
}
if(!empty($item_params)){
$header_id = $this->invm->add_invoice_items($item_params);
echo json_encode(array('st'=>1, 'msg' => $this->lang->line('text_inventory_add_success')));
}
// return print_r($datos);
/*echo "<PRE>";
print_r($datos);
echo "</PRE>";*/
/*if($this->input->post("idInventory") !='')
{
$this->invm->createInventory($datos,'update');
echo json_encode(array('st'=>2, 'msg' => $this->lang->line('text_inventory_update_success')));
}
else
{
$this->invm->createInventory($datos,'create');
echo json_encode(array('st'=>1, 'msg' => $this->lang->line('text_inventory_add_success')));
}*/
}
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function validateDataInvoice(): void\n {\n $this->validarDatos($this->datos, $this->getRules('fe'));\n\n $this->validarDatosArray($this->datos->arrayOtrosTributos, 'tributos');\n\n /** @phpstan-ignore-next-line */\n if (property_exists($this->datos, 'arraySubtotalesIVA')) {\n $this->validarDatosArray((array) $this->datos->arraySubtotalesIVA, 'iva');\n }\n\n $this->validarDatosArray($this->datos->comprobantesAsociados, 'comprobantesAsociados');\n\n if ($this->ws === 'wsfe') {\n if (property_exists($this->datos, 'arrayOpcionales')) {\n $this->validarDatosArray((array) $this->datos->arrayOpcionales, 'opcionales');\n }\n } elseif ($this->ws === 'wsmtxca') {\n $this->validarDatosArray($this->datos->items, 'items');\n }\n }",
"private function validatePaymentFields(){\n }",
"public function createInvoice()\r\n {\r\n }",
"function VerifyEDIInvoices($EDIInvoices, $i, $Errors) {\n\t\tif ($EDIInvoices!=0 and $EDIInvoices!=1) {\n\t\t\t$Errors[$i] = InvalidEDIInvoices;\n\t\t}\n\t\treturn $Errors;\n\t}",
"function invoice_number_validation( $flaq, $product_id, $quantity ) {\n\t\tif ( get_the_title( $product_id ) == \"Invoice\" ) {\n\t\t\tif ( empty( $_REQUEST['invoice_number'] ) ) {\n\t\t\t\twc_add_notice( __( 'Please enter an Invoice Number…', 'woocommerce' ), 'error' );\n\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}",
"public function create_new_invoice()\n\t{\n\t\tif(isset($this->session->isactive)){\n\n\t\t\t$grnumber = $this->input->post('grnumber');\n\t\t\t$class = $this->input->post('class');\n\t\t\t$division = $this->input->post('division');\n\t\t\t// Storing termwise total amount got from input values\n\t\t\t$term_one_total = 0;\n\t\t\t$term_two_total = 0;\n\n\t\t\t// Storing term one fees values into fees table as well for invoice table\n\t\t\t// (particulars) and updating term one total value\n\t\t\tif($this->input->post('june')){\n\t\t\t\t$term_one_values['june'] = trim($this->input->post('june'),' ');\n\t\t\t\t$particulars['june'] = trim($this->input->post('june'),' ');\n\t\t\t\t$term_one_total = $term_one_total + trim($this->input->post('june'),' ');\n\t\t\t}\n\t\t\tif($this->input->post('july')){\n\t\t\t\t$term_one_values['july'] = trim($this->input->post('july'),' ');\n\t\t\t\t$particulars['july'] = trim($this->input->post('july'),' ');\n\t\t\t\t$term_one_total = $term_one_total + trim($this->input->post('july'),' ');\n\t\t\t}\n\t\t\tif($this->input->post('august')){\n\t\t\t\t$term_one_values['august'] = trim($this->input->post('august'),' ');\n\t\t\t\t$particulars['august'] = trim($this->input->post('august'),' ');\n\t\t\t\t$term_one_total = $term_one_total + trim($this->input->post('august'),' ');\n\t\t\t}\n\t\t\tif($this->input->post('september')){\n\t\t\t\t$term_one_values['september'] = trim($this->input->post('september'),' ');\n\t\t\t\t$particulars['september'] = trim($this->input->post('september'),' ');\n\t\t\t\t$term_one_total = $term_one_total + trim($this->input->post('september'),' ');\n\t\t\t}\n\t\t\tif($this->input->post('october')){\n\t\t\t\t$term_one_values['october'] = trim($this->input->post('october'),' ');\n\t\t\t\t$particulars['october'] = trim($this->input->post('october'),' ');\n\t\t\t\t$term_one_total = $term_one_total + trim($this->input->post('october'),' ');\n\t\t\t}\n\t\t\tif($this->input->post('november')){\n\t\t\t\t$term_one_values['november'] = trim($this->input->post('november'),' ');\n\t\t\t\t$particulars['november'] = trim($this->input->post('november'),' ');\n\t\t\t\t$term_one_total = $term_one_total + trim($this->input->post('november'),' ');\n\t\t\t}\n\t\t\tif($this->input->post('term_one')){\n\t\t\t\t$term_one_values['term'] = trim($this->input->post('term_one'),' ');\n\t\t\t\t$particulars['term_one'] = trim($this->input->post('term_one'),' ');\n\t\t\t\t$term_one_total = $term_one_total + trim($this->input->post('term_one'),' ');\n\t\t\t}\n\t\t\tif($this->input->post('activity_one')){\n\t\t\t\t$term_one_values['activity'] = trim($this->input->post('activity_one'),' ');\n\t\t\t\t$particulars['activity_one'] = trim($this->input->post('activity_one'),' ');\n\t\t\t\t$term_one_total = $term_one_total + trim($this->input->post('activity_one'),' ');\n\t\t\t}\n\t\t\tif($this->input->post('computer_one')){\n\t\t\t\t$term_one_values['computer'] = trim($this->input->post('computer_one'),' ');\n\t\t\t\t$particulars['computer_one'] = trim($this->input->post('computer_one'),' ');\n\t\t\t\t$term_one_total = $term_one_total + trim($this->input->post('computer_one'),' ');\n\t\t\t}\n\t\t\tif($this->input->post('elearning_one')){\n\t\t\t\t$term_one_values['elearning'] = trim($this->input->post('elearning_one'),' ');\n\t\t\t\t$particulars['elearning_one'] = trim($this->input->post('elearning_one'),' ');\n\t\t\t\t$term_one_total = $term_one_total + trim($this->input->post('elearning_one'),' ');\n\t\t\t}\n\t\t\tif($this->input->post('sport_one')){\n\t\t\t\t$term_one_values['sport'] = trim($this->input->post('sport_one'),' ');\n\t\t\t\t$particulars['sport_one'] = trim($this->input->post('sport_one'),' ');\n\t\t\t\t$term_one_total = $term_one_total + trim($this->input->post('sport_one'),' ');\n\t\t\t}\n\t\t\t// updated term one total = current input total + old total from db\n\t\t\t$term_one_values['total'] = $term_one_total + trim($this->input->post('total_one'),' ');\n\n\t\t\t// Storing term two fees values into fees table as well for invoice table\n\t\t\t// (particulars) and updating term two total value\n\t\t\tif($this->input->post('december')){\n\t\t\t\t$term_two_values['december'] = trim($this->input->post('december'),' ');\n\t\t\t\t$particulars['december'] = trim($this->input->post('december'),' ');\n\t\t\t\t$term_two_total = $term_two_total + trim($this->input->post('december'),' ');\n\t\t\t}\n\t\t\tif($this->input->post('january')){\n\t\t\t\t$term_two_values['january'] = trim($this->input->post('january'),' ');\n\t\t\t\t$particulars['january'] = trim($this->input->post('january'),' ');\n\t\t\t\t$term_two_total = $term_two_total + trim($this->input->post('january'),' ');\n\t\t\t}\n\t\t\tif($this->input->post('february')){\n\t\t\t\t$term_two_values['february'] = trim($this->input->post('february'),' ');\n\t\t\t\t$particulars['february'] = trim($this->input->post('february'),' ');\n\t\t\t\t$term_two_total = $term_two_total + trim($this->input->post('february'),' ');\n\t\t\t}\n\t\t\tif($this->input->post('march')){\n\t\t\t\t$term_two_values['march'] = trim($this->input->post('march'),' ');\n\t\t\t\t$particulars['march'] = trim($this->input->post('march'),' ');\n\t\t\t\t$term_two_total = $term_two_total + trim($this->input->post('march'),' ');\n\t\t\t}\n\t\t\tif($this->input->post('april')){\n\t\t\t\t$term_two_values['april'] = trim($this->input->post('april'),' ');\n\t\t\t\t$particulars['april'] = trim($this->input->post('april'),' ');\n\t\t\t\t$term_two_total = $term_two_total + trim($this->input->post('april'),' ');\n\t\t\t}\n\t\t\tif($this->input->post('may')){\n\t\t\t\t$term_two_values['may'] = trim($this->input->post('may'),' ');\n\t\t\t\t$particulars['may'] = trim($this->input->post('may'),' ');\n\t\t\t\t$term_two_total = $term_two_total + trim($this->input->post('may'),' ');\n\t\t\t}\n\t\t\tif($this->input->post('term_two')){\n\t\t\t\t$term_two_values['term'] = trim($this->input->post('term_two'),' ');\n\t\t\t\t$particulars['term_two'] = trim($this->input->post('term_two'),' ');\n\t\t\t\t$term_two_total = $term_two_total + trim($this->input->post('term_two'),' ');\n\t\t\t}\n\t\t\tif($this->input->post('activity_two')){\n\t\t\t\t$term_two_values['activity'] = trim($this->input->post('activity_two'),' ');\n\t\t\t\t$particulars['activity_two'] = trim($this->input->post('activity_two'),' ');\n\t\t\t\t$term_two_total = $term_two_total + trim($this->input->post('activity_two'),' ');\n\t\t\t}\n\t\t\tif($this->input->post('computer_two')){\n\t\t\t\t$term_two_values['computer'] = trim($this->input->post('computer_two'),' ');\n\t\t\t\t$particulars['computer_two'] = trim($this->input->post('computer_two'),' ');\n\t\t\t\t$term_two_total = $term_two_total + trim($this->input->post('computer_two'),' ');\n\t\t\t}\n\t\t\tif($this->input->post('elearning_two')){\n\t\t\t\t$term_two_values['elearning'] = trim($this->input->post('elearning_two'),' ');\n\t\t\t\t$particulars['elearning_two'] = trim($this->input->post('elearning_two'),' ');\n\t\t\t\t$term_two_total = $term_two_total + trim($this->input->post('elearning_two'),' ');\n\t\t\t}\n\t\t\tif($this->input->post('sport_two')){\n\t\t\t\t$term_two_values['sport'] = trim($this->input->post('sport_two'),' ');\n\t\t\t\t$particulars['sport_two'] = trim($this->input->post('sport_two'),' ');\n\t\t\t\t$term_two_total = $term_two_total + trim($this->input->post('sport_two'),' ');\n\t\t\t}\n\t\t\t// updated term two total = current input total + old total from db\n\t\t\t$term_two_values['total'] = $term_two_total + trim($this->input->post('total_two'),' ');\n\n\t\t\t// Checking if any fees amount is entered or not\n\t\t\tif($term_one_total || $term_two_total){\n\t\t\t\t// Updating student fees data\n\t\t\t\t$this->load->model('fees_model');\n\t\t\t\t$this->fees_model->update_fees_term_one($grnumber,$class,$division,$term_one_values);\n\t\t\t\t$this->fees_model->update_fees_term_two($grnumber,$class,$division,$term_two_values);\n\n\t\t\t\t// creating invoice\n\t\t\t\t$invoice_values = array(\n\t\t\t\t\t'id' => '0',\n\t\t\t\t\t'gr_number' => $grnumber,\n\t\t\t\t\t'class' => $class,\n\t\t\t\t\t'division' => $division,\n\t\t\t\t\t'date' => date('Y-m-d'),\n\t\t\t\t\t'particulars' => implode(' ',array_keys($particulars)),\n\t\t\t\t\t'amount' => implode(' ',$particulars),\n\t\t\t\t\t'grand_total' => $term_one_total + $term_two_total,\n\t\t\t\t\t'fees_help' => trim($this->input->post('fees_help'),' '),\n\t\t\t\t\t'comment' => trim($this->input->post('comment'),' ')\n\t\t\t\t);\n\n\t\t\t\t$this->load->model('invoice_model');\n\t\t\t\tif($this->invoice_model->add_invoice($invoice_values)){\n\t\t\t\t\t// Creating transaction\n\t\t\t\t\t$transaction_values = array(\n\t\t\t\t\t\t'id' => '0',\n\t\t\t\t\t\t'type' => 'Income',\n\t\t\t\t\t\t'is_of' => 'Fees Payment',\n\t\t\t\t\t\t'date' => date('Y-m-d'),\n\t\t\t\t\t\t'amount' => $term_one_total + $term_two_total,\n\t\t\t\t\t\t'payment_mode' => 'Cash'\n\t\t\t\t\t);\n\n\t\t\t\t\t$this->load->model('transaction_model');\n\t\t\t\t\t$this->transaction_model->add_transaction($transaction_values);\n\n\t\t\t\t\t$this->input->set_cookie('message_code','1',1);\n\t\t\t\t\t$id = $this->invoice_model->get_invoice_id();\n\t\t\t\t\tredirect('invoice/print_invoice/'.$id[0]['id']);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$this->input->set_cookie('message_code','4',1);\n\t\t\t\t\tredirect('invoice/show_fees/'.$grnumber.'/'.$class.'/'.$division);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$this->input->set_cookie('message_code','3',1);\n\t\t\t\tredirect('invoice/show_fees/'.$grnumber.'/'.$class.'/'.$division);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tredirect('login');\n\t\t}\n\t}",
"public function validateSalesOrderInvoiceViewAction()\n {\n $id = $this->_request->getParam('invoice_id');\n if (!$id) {\n $id = $this->_request->getParam('id');\n }\n if ($id) {\n $object = $this->_objectManager->create(\\Magento\\Sales\\Model\\Order\\Invoice::class)->load($id);\n if ($object && $object->getId()) {\n $store = $object->getStoreId();\n if (!$this->_role->hasStoreAccess($store)) {\n $this->_forward();\n return false;\n }\n }\n }\n return true;\n }",
"public function invoice(){\n \n $page_name = 'invoice';\n \n $this->load->helper('num2word');\n \n // Check for valid request method\n if($this->input->server('REQUEST_METHOD') == 'POST') {\n \n // Get Student details\n $data['student_details'] = $this->pay_mdl->gets('student_details', $this->main->item('user_id'));\n \n // Get all form field values.\n $form_fields = $this->input->post(NULL);\n \n \n \n \n $pay_param = array(\n 'percent' => $form_fields['percentage'],\n 'schoolid' => $form_fields['schoolid'],\n 'exceptionid' => $form_fields['exceptionid'],\n 'can_name' => $data['student_details']['fname'] .' '. $data['student_details']['lname']. ' '.$data['student_details']['mname'],\n 'scheduleid' => $form_fields['scheduleid'],\n 'scheduletype' => $form_fields['scheduletype'],\n 'sessionname' => $form_fields['sessionname'],\n 'sessionid' => $form_fields['sessionid'],\n 'penalty_status' => $form_fields['penalty_status'],\n 'penalty' => $form_fields['penalty'],\n 'userid' => $this->main->item('user_id'),\n \"revenuehead\" => $form_fields['revenue_head'],\n );\n \n if($form_fields['penalty_status'] == \"active\"){\n \n //get the Calculated percentage of the amount to me paid if Penalty is active\n $pay_param['amount'] = $form_fields['amount'];\n $pay_param['amount2word'] = convert_number_to_words((double)$form_fields['amount']);\n \n }else{\n \n //get the Calculated percentage of the amount to me paid if Penalty is Inactive \n $paying_amount = (($form_fields['amount'] * $form_fields['percentage']) / 100);\n $pay_param['amount2word'] = convert_number_to_words((double)$paying_amount);\n $pay_param['amount'] = $paying_amount;\n }\n \n \n \n $data['form_fields'] = $pay_param;\n \n //build view page for Payment Invoice \n $page_content = $this->load->view($this->folder_name.'/'.$page_name, $data, true);\n $this->page->build($page_content, $this->folder_name, $page_name, $this->page_title ); \n }\n else{\n\n // Set error message for any request other than POST\n $error_msg = $this->lang->line('invalid_req_method'); \n $this->main->set_notification_message(MSG_TYPE_ERROR, $error_msg, TRUE); \n \n $this->index();\n }\n \n \n }",
"function validate()\n {\n if (!$this->getItems())\n return array(___('No items selected for purchase'));\n // @todo check compatible items\n if (empty($this->user_id))\n throw new Am_Exception_InternalError(\"User is not assigned to invoice in \" . __METHOD__);\n if (null == $this->getUser())\n throw new Am_Exception_InternalError(\"Could not load invoice user in \" . __METHOD__);\n if ($error = $this->validateCoupon())\n return array($error);\n if ($this->_validateProductRequirements) {\n if ($error = $this->checkProductRequirements())\n return $error;\n }\n\n $event = new Am_Event(Am_Event::INVOICE_VALIDATE, array('invoice' => $this));\n $this->getDi()->hook->call($event);\n $error = $event->getReturn();\n\n if(!empty($error))\n return is_array($error) ? $error: array($error);\n\n }",
"public function validateSalesOrderInvoiceCreateAction()\n {\n if ($id = $this->_request->getParam('order_id')) {\n $className = \\Magento\\Sales\\Model\\Order::class;\n } elseif ($id = $this->_request->getParam('invoice_id')) {\n $className = \\Magento\\Sales\\Model\\Order\\Invoice::class;\n } else {\n return true;\n }\n\n if ($id) {\n $object = $this->_objectManager->create($className)->load($id);\n if ($object && $object->getId()) {\n $store = $object->getStoreId();\n if (!$this->_role->hasStoreAccess($store)) {\n $this->_forward();\n return false;\n }\n }\n }\n return true;\n }",
"function validateOnAdd( $entity ){\t\t\t\n\t\t//TODO unicidad (cliente )\n\t\t\n\t}",
"public function store(Request $request)\n {\n if(!in_array(Auth::user()->role,['Admin']))\n return view('home')->with('message','You are not authorized for the page you tried to visit');\n // dd($request);\n DB::beginTransaction();\n $invoice = Validator::make($request->only(['customer_id','taxtype','invoice_no','pono','taxrate','remarks','user_id']),[\n 'invoice_no' => 'required',\n 'customer_id' => 'required',\n 'taxtype' => 'required',\n 'pono' => 'required',\n 'taxrate' => '',\n 'remarks' => '',\n 'user_id' => 'required'\n ]);\n\n if ($invoice->fails()) \n {\n DB::rollBack();\n return redirect('invoice/create')\n ->withErrors($invoice)\n ->withInput();\n }\n\n $invoicearray = $invoice->validate();\n $invno = Invoice::create($invoicearray);\n\n $invoicedetail = Validator::make($request->except(['customer_id','taxtype','invoice_no','pono','taxrate','remarks','user_id']), [\n 'product_id.*' => 'required',\n 'quantity.*' => 'required',\n 'unit_price.*' => 'required',\n 'remarks2.*' => ''\n ]);\n\n if ($invoicedetail->fails()) \n {\n DB::rollBack();\n return redirect('invoice/create')\n ->withErrors($invoicedetail)\n ->withInput();\n }\n $i = 0;\n while($v = array_column($invoicedetail->validate(), $i++))\n {\n // dd($v);\n $invd = [\n 'invoice_id'=>$invno->id,\n 'product_id'=>$v[0],\n 'quantity'=>$v[1],\n 'unit_price'=>$v[2],\n 'remarks' =>$v[3]\n ];\n \n InvoiceDetail::create($invd);\n }\n DB::commit();\n return redirect('invoice');\n //\n }",
"function _validatePurchase() {\n\n // Return results in an array\n $ret = array();\n\n // Retain edit metadata, if found\n if ($this->input->post('edit_id') !== FALSE) {\n $repop['edit_id'] = $this->input->post('edit_id');\n }\n\n // Validate: \"description\"\n $repop['description'] = htmlspecialchars(trim($this->input->post('description')));\n if (!$repop['description']) {\n $error['description'] = 'Description cannot be blank.';\n } elseif (count($repop['description']) > 50) {\n $error['description'] = 'Description cannot exceed 50 characters.';\n } else {\n $purchase_details['description'] = $repop['description'];\n }\n\n // Validate: \"payer\"\n $repop['payer'] = $this->input->post('payer');\n if (!$repop['payer']) {\n $error['payer'] = 'No user was selected as the \"Payer\" of this purchase.';\n } else {\n $valid = false;\n foreach ($this->housemates as $housemate) {\n if ($housemate['user_id'] == $repop['payer']) {\n $valid = true; break;\n }\n }\n if ($valid) {\n $purchase_details['payer'] = $repop['payer'];\n } else {\n $error['payer'] = 'The user selected as purchase \"Payer\" is not your housemate.';\n }\n }\n\n // Validate: \"purchase_date\"\n $repop['purchase_date'] = htmlspecialchars(trim($this->input->post('purchase_date_submit')));\n if (!$repop['purchase_date']) {\n $error['purchase_date'] = 'You must specify a purchase date.';\n } elseif (FALSE) {\n // TODO - verify specified date is a valid format, and exists!\n } else {\n $purchase_details['purchase_date'] = $repop['purchase_date'];\n }\n\n // Validate: \"split_type\"\n $repop['split_type'] = $this->input->post('split_type');\n $repop['total_price'] = trim($this->input->post('total_price'));\n $repop['payees'] = $this->input->post('payees');\n $repop['price_custom'] = $this->input->post('price_custom');\n if ($repop['split_type'] == 'even') {\n $purchase_details['split_type'] = 'even';\n\n // Validate: \"total_price\"\n if (!$repop['total_price']) {\n $error['total_price'] = 'Total Price must be specified if choosing an \"even\" split.';\n } elseif (!is_numeric($repop['total_price'])) {\n $error['total_price'] = 'Total Price must be numeric.';\n } else {\n $purchase_details['total_price'] = $repop['total_price'];\n\n // Validate: \"payees\"\n if (!is_array($repop['payees']) || count($repop['payees']) == 0) {\n $error['payees'] = 'One or more users must be selected to share the total price.';\n } else {\n $tick_count = 0; // count 'ticked' housemates\n $tmp = array_values($repop['payees']);\n foreach ($this->housemates as $housemate) {\n if (in_array($housemate['user_id'], $tmp)) {\n $tick_count++;\n }\n }\n if ($tick_count == 0) {\n $error['payees'] = 'One or more selected users are not housemates.';\n } else {\n // divide the total price between ticked housemates\n foreach ($this->housemates as $housemate) {\n if (in_array($housemate['user_id'], $tmp)) {\n $purchase_details['payees'][] = array(\n 'user_id' => $housemate['user_id'],\n 'price' => ($purchase_details['total_price']/$tick_count)\n );\n }\n }\n }\n }\n }\n } elseif ($repop['split_type'] == 'custom') {\n $purchase_details['split_type'] = 'custom';\n\n // Validate: \"price_custom\"\n if (!$repop['price_custom'] || !is_array($repop['price_custom']) || (count($repop['price_custom']) == 0)) {\n $error['price_custom'] = 'One or more housemates must have prices specified when using a \"custom\" split.';\n } else {\n $user_prices_count = 0; // count number of defined housemate prices\n foreach ($this->housemates as $housemate) {\n if (isset($repop['price_custom'][$housemate['user_id']]) && ($repop['price_custom'][$housemate['user_id']] != '')) {\n if (!is_numeric($repop['price_custom'][$housemate['user_id']])) {\n $error['price_custom'] = 'One or more custom prices were not numeric.';\n $user_prices_count = -1;\n break;\n }\n // Include this user's price in the purchase details\n $purchase_details['payees'][] = array(\n 'user_id' => $housemate['user_id'],\n 'price' => $repop['price_custom'][$housemate['user_id']]\n );\n $user_prices_count++;\n }\n }\n if ($user_prices_count == 0) {\n $error['price_custom'] = 'One or more housemates must have prices specified when using a \"custom\" split.';\n //$error['price_custom'] = 'One or more specified users are not housemates.';\n }\n }\n } else {\n $error['split_type'] = 'Purchase splitting is not defined. Select either \"even\" or \"custom\" splitting.';\n }\n\n // Validate: comment\n $repop['comment'] = htmlspecialchars(trim($this->input->post('comment')));\n if (count($repop['comment']) > 250) {\n $error['comment'] = 'Comment cannot exceed 250 characters';\n } else {\n $purchase_details['comment'] = $repop['comment'];\n }\n\n $ret['repop'] = $repop;\n if (isset($error)) {\n $ret['error'] = $error;\n }\n $ret['purchase_details'] = $purchase_details;\n\n return $ret;\n\n }",
"public function salesInvoice_edit($invoiceId = null)\n {\n if (is_numeric($invoiceId)) {\n //is invoice id is valid\n $validInvoiecId = $this->Sales_Model->checkInvoiceIdAndDistributor($this->dist_id, $invoiceId);\n if ($validInvoiecId === FALSE) {\n exception(\"Sorry invoice id is invalid!!\");\n redirect(site_url('salesInvoice'));\n }\n } else {\n exception(\"Sorry invoice id is invalid!!\");\n redirect(site_url('salesInvoice_edit/' . $invoiceId));\n }\n /* check Invoice id valid ? or not */\n if (isPostBack()) {\n\n\n\n\n\n // dumpVar($_POST);\n $this->form_validation->set_rules('netTotal', 'Net Total', 'required');\n $this->form_validation->set_rules('customer_id', 'Customer ID', 'required');\n $this->form_validation->set_rules('voucherid', 'Voucehr ID', 'required');\n $this->form_validation->set_rules('saleDate', 'Sales Date', 'required');\n $this->form_validation->set_rules('paymentType', 'Payment Type', 'required');\n $this->form_validation->set_rules('category_id[]', 'Category ID', 'required');\n echo \"<pre>\";\n print_r($_POST);\n\n //$this->form_validation->set_rules('product_id[]', 'Product', 'required');\n //$this->form_validation->set_rules('quantity[]', 'Product Quantity', 'required');\n //$this->form_validation->set_rules('rate[]', 'Product Rate', 'required');\n //$this->form_validation->set_rules('price[]', 'Product Price', 'required');\n $allData = $this->input->post();\n if ($this->form_validation->run() == FALSE) {\n\n exception(\"Required field can't be empty.\");\n redirect(site_url('salesInvoice_add'));\n\n\n } else {\n echo 'Ok';\n exit;\n $payType = $this->input->post('paymentType');\n $sales_inv['invoice_no'] = $this->input->post('voucherid');\n $sales_inv['sales_invoice_id'] = $this->input->post('sales_invoice_id');\n $sales_inv['customer_invoice_no'] = $this->input->post('userInvoiceId');\n $sales_inv['customer_id'] = $this->input->post('customer_id');\n $sales_inv['payment_type'] = $payType;\n $sales_inv['invoice_amount'] = array_sum($this->input->post('price'));\n $sales_inv['vat_amount'] = $this->input->post('vat');\n $sales_inv['discount_amount'] = $this->input->post('discount') != '' ? $this->input->post('discount') : 0;\n $sales_inv['paid_amount'] = $this->input->post('partialPayment') != '' ? $this->input->post('partialPayment') : 0;\n $sales_inv['tran_vehicle_id'] = $this->input->post('transportation') != '' ? $this->input->post('transportation') : 0;\n $sales_inv['transport_charge'] = $this->input->post('transportationAmount') != '' ? $this->input->post('transportationAmount') : 0;\n $sales_inv['loader_charge'] = $this->input->post('loaderAmount') != '' ? $this->input->post('loaderAmount') : 0;\n $sales_inv['loader_emp_id'] = $this->input->post('loader') != '' ? $this->input->post('loader') : 0;\n $sales_inv['refference_person_id'] = $this->input->post('reference');\n $sales_inv['company_id'] = $this->dist_id;\n $sales_inv['dist_id'] = $this->dist_id;\n $sales_inv['branch_id'] = 0;\n $sales_inv['due_date'] = date('Y-m-d', strtotime($this->input->post('dueDate')));\n $sales_inv['invoice_date'] = date('Y-m-d', strtotime($this->input->post('saleDate')));\n $sales_inv['insert_date'] = $this->timestamp;\n $sales_inv['insert_by'] = $this->admin_id;\n $sales_inv['is_active'] = 'Y';\n $sales_inv['is_delete'] = 'N';\n\n\n $this->invoice_id = $this->input->post('sales_invoice_id');\n $this->Common_model->update_data('sales_invoice_info', $sales_inv, 'sales_invoice_id', $this->invoice_id);\n $allStock = array();\n $stockUpdate = array();\n\n foreach ($_POST['sales_details_id'] as $key => $value) {\n $returnable_quantity = $_POST['returnAbleQuantity_' . $value] != '' ? $_POST['returnAbleQuantity_' . $value] : 0;\n $return_quentity = empty($_POST['returnedQuantity_' . $value]) ? 0 : array_sum($_POST['returnedQuantity_' . $value]);\n $supplier_advance = 0;\n $supplier_due = 0;\n unset($stock);\n $stock['sales_invoice_id'] = $this->invoice_id;\n $stock['sales_details_id'] = $value;\n $stock['product_id'] = $_POST['product_id_' . $value];\n $stock['is_package '] = $_POST['is_package_' . $value];\n $stock['returnable_quantity '] = $returnable_quantity;\n $stock['return_quentity '] = $return_quentity;\n if ($return_quentity < $returnable_quantity) {\n $supplier_advance = $returnable_quantity - $return_quentity;\n } else {\n $supplier_due = $return_quentity - $returnable_quantity;\n }\n $stock['customer_due'] = $supplier_due;\n $stock['customer_advance'] = $supplier_advance;\n $stock['quantity'] = $_POST['quantity_' . $value];\n $stock['unit_price'] = $_POST['unit_price_' . $value];\n $stock['update_by'] = $this->admin_id;\n $stock['update_date'] = $this->timestamp;\n $stock['is_active'] = 'Y';\n $stock['is_delete'] = 'N';\n $stockUpdate[] = $stock;\n\n if (isset($_POST['returnproductEdit_' . $value])) {\n foreach ($_POST['returnproductEdit_' . $value] as $key1 => $value1) {\n unset($stock2);\n $stock2['sales_details_id'] = $value1;\n //$stock2['product_id'] = $value1;\n $stock2['returnable_quantity'] = $_POST['returnQuentityEdit_' . $value][$key1];\n $stock2['return_quantity'] = $_POST['returnQuentityEdit_' . $value][$key1];\n $stock2['update_by'] = $this->admin_id;\n $stock2['update_date'] = $this->timestamp;\n $allEditStock[] = $stock2;\n }\n }\n if (isset($_POST['returnproductAdd_' . $value])) {\n foreach ($_POST['returnproductAdd_' . $value] as $key1 => $value1) {\n unset($stock2);\n $stock2['sales_details_id'] = $value;\n $stock2['product_id'] = $value1;\n $stock2['returnable_quantity'] = $_POST['returnQuentityAdd_' . $value][$key1];\n $stock2['return_quantity'] = $_POST['returnQuentityAdd_' . $value][$key1];\n $stock2['update_by'] = $this->admin_id;\n $stock2['update_date'] = $this->timestamp;\n $alladdStock[] = $stock2;\n }\n }\n }\n\n\n //echo '<pre>';\n //print_r($_POST);\n //print_r($stockUpdate);\n //print_r($allEditStock);\n //print_r($alladdStock);\n //exit;\n\n\n $productId = $this->input->post('product_id');\n $pmtype = $this->input->post('paymentType');\n $ppAmount = $this->input->post('partialPayment');\n $this->db->trans_start();\n\n // echo $payType;die;\n $data['customer_id'] = $this->input->post('customer_id');\n $data['voucher_no'] = $this->input->post('voucherid');\n $data['reference'] = $this->input->post('reference');\n $data['payType'] = $this->input->post('paymentType');\n $data['date'] = date('Y-m-d', strtotime($this->input->post('saleDate')));\n $data['discount'] = $this->input->post('discount');\n $data['vat'] = $this->input->post('vat');\n $data['narration'] = $this->input->post('narration');\n $data['shipAddress'] = $this->input->post('shippingAddress');\n $data['loader'] = $this->input->post('loader');\n $data['loaderAmount'] = $this->input->post('loaderAmount');\n $data['transportation'] = $this->input->post('transportation');\n $data['transportationAmount'] = $this->input->post('transportationAmount');\n $data['form_id'] = 5;\n $data['debit'] = $this->input->post('netTotal');\n $data['dist_id'] = $this->dist_id;\n $data['updated_at'] = $this->timestamp;\n $data['updated_by'] = $this->admin_id;\n $data['mainInvoiceId'] = $this->input->post('userInvoiceId');\n $grandtotal = $this->input->post('grandtotal');\n $data['vatAmount'] = ($grandtotal / 100) * $data['vat'];\n $returnQty = array_sum($this->input->post('returnQuantity'));\n $this->Common_model->update_data('generals', $data, 'invoice_id', $this->invoice_id);\n $generals_id = $invoiceId;\n /* Delete query fro this invoice id */\n //delete stock table\n $this->Common_model->delete_data('stock', 'generals_id', $invoiceId);\n $this->Common_model->delete_data('generalledger', 'generals_id', $invoiceId);\n $this->Common_model->delete_data('client_vendor_ledger', 'history_id', $invoiceId);\n $this->Common_model->delete_data('moneyreceit', 'mainInvoiceId', $invoiceId);\n $invoiceList = $this->Sales_Model->getInvoiceIdList($this->dist_id, $invoiceId);\n //delete general table\n if (!empty($invoiceList)) {\n foreach ($invoiceList as $eachId):\n $this->Common_model->delete_data('generals', 'generals_id', $eachId->generals_id);\n $this->Common_model->delete_data('stock', 'generals_id', $eachId->generals_id);\n $this->Common_model->delete_data('generalledger', 'generals_id', $eachId->generals_id);\n $this->Common_model->delete_data('client_vendor_ledger', 'history_id', $eachId->generals_id);\n $this->Common_model->delete_data('moneyreceit', 'mainInvoiceId', $eachId->generals_id);\n endforeach;\n }\n if (!empty($returnQty)) {\n /*\n * Edit By Nahid\n * or Stop Inserting data to general table\n *\n *\n * $cylinder['customer_id'] = $this->input->post('customer_id');\n $cylinder['voucher_no'] = $this->input->post('voucherid');\n $cylinder['reference'] = $this->input->post('reference');\n $cylinder['payType'] = $this->input->post('paymentType');\n $cylinder['date'] = date('Y-m-d', strtotime($this->input->post('saleDate')));\n $cylinder['discount'] = $this->input->post('discount');\n $cylinder['vat'] = $this->input->post('vat');\n $cylinder['narration'] = $this->input->post('narration');\n $cylinder['shipAddress'] = $this->input->post('shippingAddress');\n $cylinder['form_id'] = 23;\n $cylinder['debit'] = $this->input->post('netTotal');\n $cylinder['dist_id'] = $this->dist_id;\n $cylinder['mainInvoiceId'] = $generals_id;\n $cylinder['updated_by'] = $this->admin_id;\n $cylinder['vatAmount'] = ($grandtotal / 100) * $data['vat'];\n $cylinderId = $this->Common_model->insert_data('generals', $cylinder); */\n }\n $customerName = $this->Common_model->tableRow('customer', 'customer_id', $data['customer_id'])->customerName;\n $mobile = $this->Common_model->tableRow('customer', 'customer_id', $data['customer_id'])->customerPhone;\n $category_cat = $this->input->post('category_id');\n $allStock = array();\n $allStock1 = array();\n $totalProductCost = 0;\n $newCylinderProductCost = 0;\n $otherProductCost = 0;\n foreach ($category_cat as $key => $value):\n unset($stock);\n $productCost = $this->Sales_Model->productCost($this->input->post('product_id')[$key], $this->dist_id);\n $totalProductCost += $this->input->post('quantity')[$key] * $productCost;\n if ($value == 1) {\n //get cylinder product cost\n $newCylinderProductCost += $this->input->post('quantity')[$key] * $productCost;\n } else {\n //get without cylinder product cost\n $otherProductCost += $this->input->post('quantity')[$key] * $productCost;\n }\n $stock['generals_id'] = $generals_id;\n $stock['category_id'] = $value;\n $stock['product_id'] = $this->input->post('product_id')[$key];\n $stock['unit'] = getProductUnit($this->input->post('product_id')[$key]);\n $stock['quantity'] = $this->input->post('quantity')[$key];\n $stock['rate'] = $this->input->post('rate')[$key];\n $stock['price'] = $this->input->post('price')[$key];\n $stock['date'] = date('Y-m-d', strtotime($this->input->post('saleDate')));\n $stock['form_id'] = 5;\n $stock['type'] = 'Out';\n $stock['dist_id'] = $this->dist_id;\n $stock['updated_by'] = $this->admin_id;\n $stock['created_at'] = $this->timestamp;\n $allStock[] = $stock;\n $returnQty = $this->input->post('returnQuantity')[$key];\n //If cylinder stock out than transaction store here.\n if (!empty($returnQty)) {\n // $productCost = $this->Sales_Model->productCost($this->input->post('product_id')[$key], $this->dist_id);\n //$stock1['generals_id'] = $cylinderId;\n $stock1['generals_id'] = $generals_id;\n $stock1['category_id'] = $value;\n $stock1['product_id'] = $this->input->post('product_id')[$key];\n $stock1['unit'] = getProductUnit($this->input->post('product_id')[$key]);\n $stock1['quantity'] = $this->input->post('returnQuantity')[$key];\n $stock1['rate'] = $this->input->post('rate')[$key];\n $stock1['price'] = $this->input->post('price')[$key];\n $stock1['date'] = date('Y-m-d', strtotime($this->input->post('saleDate')));\n $stock1['form_id'] = 23;\n $stock1['type'] = 'Cout';\n $stock1['dist_id'] = $this->dist_id;\n $stock1['customerId'] = $this->input->post('customer_id');\n $stock1['updated_by'] = $this->admin_id;\n $stock1['created_at'] = $this->timestamp;\n $allStock1[] = $stock1;\n }\n endforeach;\n $cylinderRecive = $this->input->post('category_id2');\n $cylinderAllStock = array();\n if (!empty($cylinderRecive)):\n /*\n * Edit By Nahid\n * or Stop Inserting data to general table\n *\n *\n * $cylinderData['customer_id'] = $this->input->post('customer_id');\n $cylinderData['voucher_no'] = $this->input->post('voucherid');\n $cylinderData['date'] = date('Y-m-d', strtotime($this->input->post('saleDate')));\n $cylinderData['narration'] = $this->input->post('narration');\n $cylinderData['form_id'] = 24;\n $cylinderData['dist_id'] = $this->dist_id;\n $cylinderData['mainInvoiceId'] = $generals_id;\n $cylinderData['updated_by'] = $this->admin_id;\n $CylinderReceive = $this->Common_model->insert_data('generals', $cylinderData); */\n foreach ($cylinderRecive as $key => $value) :\n //$stock1['generals_id'] = $cylinderId;\n $stockReceive['generals_id'] = $generals_id;\n //$stockReceive['generals_id'] = $CylinderReceive;\n $stockReceive['category_id'] = $value;\n $stockReceive['product_id'] = $this->input->post('product_id2')[$key];\n $stockReceive['unit'] = getProductUnit($this->input->post('product_id2')[$key]);\n $stockReceive['quantity'] = $this->input->post('quantity2')[$key];\n $stockReceive['date'] = date('Y-m-d', strtotime($this->input->post('saleDate')));\n $stockReceive['form_id'] = 24;\n $stockReceive['type'] = 'Cin';\n $stockReceive['dist_id'] = $this->dist_id;\n $stockReceive['customerId'] = $this->input->post('customer_id');\n $stockReceive['updated_by'] = $this->admin_id;\n $stockReceive['created_at'] = $this->timestamp;\n $cylinderAllStock[] = $stockReceive;\n endforeach;\n //insert for culinder receive\n $this->db->insert_batch('stock', $cylinderAllStock);\n $this->db->insert_batch('stock', $cylinderAllStock);\n endif;\n //insert for quantity out stock\n $this->db->insert_batch('stock', $allStock);\n //insert for cylinder stock out\n $this->db->insert_batch('stock', $allStock1);\n //insert in stock table\n $customerLedger = array(\n 'ledger_type' => 1,\n 'trans_type' => 'Sales',\n 'history_id' => $generals_id,\n 'trans_type' => $this->input->post('voucherid'),\n 'client_vendor_id' => $this->input->post('customer_id'),\n 'updated_by' => $this->admin_id,\n 'dist_id' => $this->dist_id,\n 'amount' => $this->input->post('netTotal'),\n 'dr' => $this->input->post('netTotal'),\n 'date' => date('Y-m-d', strtotime($this->input->post('saleDate'))),\n );\n $this->db->insert('client_vendor_ledger', $customerLedger);\n $mrCondition = array(\n 'dist_id' => $this->dist_id,\n 'receiveType' => 1,\n );\n $totalMoneyReceite = $this->Common_model->get_data_list_by_many_columns('moneyreceit', $mrCondition);\n $mrid = \"CMR\" . date(\"y\") . date(\"m\") . str_pad(count($totalMoneyReceite) + 1, 4, \"0\", STR_PAD_LEFT);\n if ($payType == 1) {\n //when payment type cash\n $this->cashTransactionInsert($generals_id, $data, $totalProductCost, $otherProductCost, $newCylinderProductCost, $mrid);\n } elseif ($payType == 2) {\n //when paymnet type credit\n $this->creditTransactionInsert($generals_id, $data, $totalProductCost, $otherProductCost, $newCylinderProductCost, $mrid);\n } elseif ($payType == 3) {\n //when payment type cheque\n $this->chequeTransactionInsert($generals_id, $data, $totalProductCost, $otherProductCost, $newCylinderProductCost, $mrid);\n } else {\n //when payment transaction is partial.but now it use as cash.\n $this->partialTransactionInsert($generals_id, $data, $totalProductCost, $otherProductCost, $newCylinderProductCost, $mrid);\n }\n $this->db->trans_complete();\n if ($this->db->trans_status() === FALSE) {\n notification(\"Your sales can't be inserted.Something is wrong.\");\n redirect('salesInvoice_edit/' . $generals_id, 'refresh');\n } else {\n message(\"Your data successfully inserted into database.\");\n redirect('salesInvoice_view/' . $generals_id, 'refresh');\n }\n /* Delete query fro this invoice id */\n }\n }\n\n /*page navbar details*/\n $data['title'] = 'Sale Invoice Edit';\n $data['page_type']=$this->page_type;\n $data['link_page_name']='Sale Invoice Add';\n $data['link_page_url']='salesInvoice_add';\n $data['link_icon']=\"<i class='fa fa-plus'></i>\";\n\n /*page navbar details*/\n $data['editInvoice'] = $this->Common_model->get_single_data_by_single_column('sales_invoice_info', 'sales_invoice_id', $invoiceId);\n//echo \"<pre>\";\n//print_r($data['editInvoice']);exit;\n $data['bank_check_details'] = array();\n if ($data['editInvoice']->payment_type == 3) {\n $data['bank_check_details'] = $this->Common_model->get_single_data_by_single_column('moneyreceit', 'mainInvoiceId', $data['editInvoice']->sales_invoice_id);\n }\n\n\n //$data['editStock'] = $this->Common_model->get_data_list_by_single_column('stock', 'generals_id', $invoiceId);\n\n $stockList = $this->Common_model->get_sales_product_detaild2($invoiceId);\n\n\n\n\n foreach ($stockList as $ind => $element) {\n\n $result[$element->sales_invoice_id][$element->sales_details_id]['sales_invoice_id'] = $element->sales_invoice_id;\n $result[$element->sales_invoice_id][$element->sales_details_id]['sales_details_id'] = $element->sales_details_id;\n $result[$element->sales_invoice_id][$element->sales_details_id]['is_package'] = $element->is_package;\n $result[$element->sales_invoice_id][$element->sales_details_id]['category_id'] = $element->category_id;\n $result[$element->sales_invoice_id][$element->sales_details_id]['product_id'] = $element->product_id;\n $result[$element->sales_invoice_id][$element->sales_details_id]['productName'] = $element->productName;\n $result[$element->sales_invoice_id][$element->sales_details_id]['product_code'] = $element->product_code;\n $result[$element->sales_invoice_id][$element->sales_details_id]['title'] = $element->title;\n $result[$element->sales_invoice_id][$element->sales_details_id]['unitTtile'] = $element->unitTtile;\n $result[$element->sales_invoice_id][$element->sales_details_id]['brandName'] = $element->brandName;\n $result[$element->sales_invoice_id][$element->sales_details_id]['quantity'] = $element->quantity;\n $result[$element->sales_invoice_id][$element->sales_details_id]['unit_price'] = $element->unit_price;\n $result[$element->sales_invoice_id][$element->sales_details_id]['tt_returnable_quantity'] = $element->tt_returnable_quantity;\n //$result[$element->sales_invoice_id][$element->sales_details_id]['unit_price'] = $element->unit_price;\n if ($element->returnable_quantity > 0) {\n $result[$element->sales_invoice_id][$element->sales_details_id]['return'][$element->sales_details_id][] = array('return_product_name' => $element->return_product_name,\n 'return_product_id' => $element->return_product_id,\n 'sales_return_id' => $element->sales_return_id,\n 'return_product_cat' => $element->return_product_cat,\n 'return_product_name' => $element->return_product_name,\n 'return_product_unit' => $element->return_product_unit,\n 'return_product_brand' => $element->return_product_brand,\n 'returnable_quantity' => $element->returnable_quantity,\n );\n } else {\n $result[$element->sales_invoice_id][$element->sales_details_id]['return'][$element->sales_details_id] = '';\n }\n\n }\n\n $data['editStock'] = $result;\n\n\n\n\n\n $data['configInfo'] = $this->Common_model->get_single_data_by_single_column('system_config', 'dist_id', $this->dist_id);\n $data['accountHeadList'] = $this->Common_model->getAccountHead();\n //get only cylinder product\n $data['productList'] = $this->Common_model->getPublicProductList($this->dist_id);\n // dumpVar($data['accountHeadList']);\n $data['cylinderProduct'] = $this->Common_model->getPublicProduct($this->dist_id, 1);\n //echo '<pre>';\n //print_r($data['cylinderProduct']);exit;\n $data['productCat'] = $this->Common_model->getPublicProductCat($this->dist_id);\n $data['unitList'] = $this->Common_model->getPublicUnit($this->dist_id);\n $data['referenceList'] = $this->Sales_Model->getReferenceList($this->dist_id);\n $data['customerList'] = $this->Sales_Model->getCustomerList($this->dist_id);\n $data['cylinserOut'] = $this->Sales_Model->getCylinderInOutResult($this->dist_id, $invoiceId, 23);\n $data['cylinderReceive'] = $this->Sales_Model->getCylinderInOutResult2($this->dist_id, $invoiceId, 24);\n //echo $this->db->last_query();exit;\n $data['creditAmount'] = $paymentInfo = $this->Sales_Model->getCreditAmount($invoiceId);\n $condition = array(\n 'dist_id' => $this->dist_id,\n 'isActive' => 'Y',\n 'isDelete' => 'N',\n );\n $data['employeeList'] = $this->Common_model->get_data_list_by_many_columns('employee', $condition);\n $data['vehicleList'] = $this->Common_model->get_data_list_by_many_columns('vehicle', $condition);\n $data['accountId'] = $this->Sales_Model->getAccountId($paymentInfo->generals_id);\n //echo '<pre>';\n //print_r($data);exit;\n // echo $this->db->last_query();die;\n $data['mainContent'] = $this->load->view('distributor/sales/saleInvoice/editInvoice', $data, true);\n $this->load->view('distributor/masterTemplate', $data);\n }",
"public function rules()\n {\n // Check Create or Update\n $this->method() == 'PATCH' ? $invoice_no_rules = 'required' : $invoice_no_rules = 'required|unique:invoices' ;\n list($keys, $invoice_types) = Arr::divide(config('constants.invoice_type'));\n $rules = [\n 'invoice_date' => 'required',\n 'invoice_no' => $invoice_no_rules,\n //'invoice_type' => 'required|in:\"1\",\"2\"',\n 'invoice_type' => 'required|in:'.implode(',',$invoice_types),\n 'total' => 'required',\n ];\n \n foreach($this->request->get('item_id') as $key => $val)\n {\n $rules['item_qty.'.$key] = 'required|min:1|not_in:\"0\"|lte:invoicable_qty.'.$key;\n }\n \n return $rules;\n }",
"private function validateSingleIn($account_invoice, $registration_date) {\n $data = [\n \"registration_date\" => $registration_date\n ];\n\n $result = $this->_client->write(\"account.invoice\", $account_invoice[\"id\"], $data);\n\n if (isset($result[\"faultCode\"])) {\n Util::printError(\"AccountInvoice.validateSingleIn\", $result[\"faultString\"]);\n }\n\n // Validazione della fattura\n $result = $this->_client->execute(\"pointec.pointec\", \"validate_invoice\",\n [\n [$account_invoice[\"id\"]],\n ]);\n\n if (isset($result[\"faultCode\"])) {\n Util::printError(\"AccountInvoice.validateSingleIn [{$account_invoice[\"id\"]}]\", $result[\"faultString\"]);\n }\n\n // Recupero allegato\n $attachment_id = $this->_client->search(\"ir.attachment\",\n [\n [\"res_id\", \"=\", $account_invoice[\"id\"]],\n [\"res_model\", \"=\", \"account.invoice\"],\n ]\n );\n\n $name = $account_invoice[\"id\"][\"period_id\"][1].\"--\".str_replace(\"/\", \"-\", $account_invoice[\"id\"][\"number\"]).\".pdf\";\n\n $data = [\n \"name\" => $name\n ];\n\n $out = $this->_client->write(\"ir.attachment\", $attachment_id[0], $data);\n\n }",
"public function print_invoice_details_form() {\n\n // Variables to be used in heredoc syntax\n $descriptionPlaceHolder = lang( 'report_minv_fm_description_ph' );\n $amountPlaceHolder = lang( 'report_minv_fm_amount_ph' );\n // Get any invoice row details\n $invoiceRows = $this->mockinvoice_row_model->get_by( 'mockInvoiceId = ' . @$_POST['mockInvoiceId'] );\n // Get the invoice categories. Data converted for use by the CI dropdown form helper function\n $categoryArray = create_key_value_array( $this->mockinvoice_categories_model->get( null, null, 'result_array' ), 'category', 'category', true ); // True = Add blank option at beginning\n\n $rowHTML = '';\n\n foreach ( $invoiceRows as $row ) {\n\n $rowHTML .= <<< HTML\n <div class=\"form-group\" id=\"invoice-form-row-$row->mockInvoiceRowId\">\n <div class=\"col-md-3 mb-xs\">\n\nHTML;\n\n // Category dropdown list\n $rowHTML .= form_dropdown( 'category-' . $row->mockInvoiceRowId, $categoryArray, $row->category, 'class=\"form-control invoice-category\" data-invoice-row-id=\"' . $row->mockInvoiceRowId . '\"' );\n\n $rowHTML .= <<< HTML\n </div>\n <div class=\"col-md-6 mb-xs\">\n <textarea name=\"invoice-description-{$row->mockInvoiceRowId}\" id=\"invoice-description-{$row->mockInvoiceRowId}\" rows=\"1\" placeholder=\"{$descriptionPlaceHolder}\" class=\"invoice-description form-control\" data-invoice-row-id=\"{$row->mockInvoiceRowId}\">{$row->description}</textarea>\n </div>\n <div class=\"col-md-2 mb-xs\">\n <div class=\"input-group btn-group\">\n <span class=\"input-group-addon\">\n $\n </span>\n <input type=\"text\" name=\"invoice-amount-{$row->mockInvoiceRowId}\" id=\"invoice-amount-{$row->mockInvoiceRowId}\" value=\"{$row->amount}\" placeholder=\"{$amountPlaceHolder}\" class=\"form-control numeric invoice-amount\" data-invoice-row-id=\"{$row->mockInvoiceRowId}\" />\n </div>\n </div>\n <div class=\"col-md-1 mb-xs\">\n <a href=\"#\" class=\"btn btn-default\" data-invoice-row-id=\"{$row->mockInvoiceRowId}\" data-toggle=\"delete-invoice-row\">\n <i class=\"fa fa-trash\"></i>\n </a>\n </div>\n </div>\n\nHTML;\n }\n\n // Output the HTML if we have some\n if ( $rowHTML != '' ) {\n echo $rowHTML;\n }\n }",
"function validate(SGL_Request $req, SGL_Registry $input)\n {\n SGL::logMessage(null, PEAR_LOG_DEBUG);\n $this->validated = true;\n $input->error = array();\n $input->pageTitle = $this->pageTitle;\n $input->masterTemplate = $this->masterTemplate;\n $input->template = $this->template;\n $input->action = ($req->get('action')) ? $req->get('action') : 'list';\n $input->aDelete = $req->get('frmDelete');\n $input->submitted = $req->get('submitted');\n $input->documents = $req->get('frmDocuments');\n \n // module-specific variables coming from the form\n $input->documentId = $req->get('frmDocumentId');\n $input->invoiceId = $req->get('frmInvoiceId');\n $input->vendorId = $req->get('frmVendorId');\n $input->pageId = ($req->get('pageID')) ? $req->get('pageID') : 1;\n\n /**\n * validation\n * @todo use validator\n */\n if($input->submitted) {\n $empty = 0;\n foreach($input->documents AS $d => $invoice) {\n if(empty($invoice['invoiceId']) && empty($invoice['vendorId'])) {\n // empty order, count it\n $empty++;\n } elseif(!ereg(InvoiceXMLParsingStrategy::$invoiceNumRegEx, $invoice['invoiceId'] . '+')) {\n $aErrors['invoiceFormat'] = 'You must enter a 10 digit alphanumeric invoice number.';\n } elseif(!ereg(InvoiceXMLParsingStrategy::$vendorNumRegEx, $invoice['vendorId'] . '.')) {\n $aErrors['vendorFormat'] = 'You must enter the vendor number as AAA99.';\n }\n\n }\n if($empty == count($input->documents)) {\n $aErrors['empty'] = 'You must enter at least 1 invoice to link.';\n }\n }\n // if errors have occurred, output a notice\n if (isset($aErrors) && count($aErrors)) {\n SGL::raiseMsg('An error has occurred that must be corrected before continuing.');\n $input->error = $aErrors;\n $this->validated = false;\n\n }\n }",
"public function pos_invoice(){\n\t\t\n\t\tredirect('dashboard_pharmacist/invoice/Cinvoice');\n\t\t\n\t\t$CI =& get_instance();\n\t\t$CI->load->library('linvoice');\n\t\t$content = $CI->linvoice->pos_invoice_add_form();\n\t\t$this->template->full_admin_html_view($content);\n\t}",
"function edit() {\n $this->wireframe->hidePrintButton();\n \n if($this->active_invoice->isNew()) {\n $this->response->notFound();\n } // if\n\n if(!$this->active_invoice->canEdit($this->logged_user)) {\n $this->response->forbidden();\n } // if\n\n $invoice_data = $this->request->post('invoice');\n if(!is_array($invoice_data)) {\n $invoice_data = array(\n 'number' => $this->active_invoice->getNumber(),\n 'due_on' => $this->active_invoice->getDueOn(),\n 'issued_on' => $this->active_invoice->getIssuedOn(),\n 'currency_id' => $this->active_invoice->getCurrencyId(),\n 'purchase_order_number' => $this->active_invoice->getPurchaseOrderNumber(),\n 'private_note' => $this->active_invoice->getPrivateNote(),\n 'company_id' => $this->active_invoice->getCompanyId(),\n 'company_address' => $this->active_invoice->getCompanyAddress(),\n 'project_id' => $this->active_invoice->getProjectId(),\n 'note' => $this->active_invoice->getNote(),\n 'language_id' => $this->active_invoice->getLanguageId(),\n 'payment_type' => $this->active_invoice->getAllowPayments(),\n 'second_tax_is_compound' => $this->active_invoice->getSecondTaxIsCompound()\n );\n if(is_foreachable($this->active_invoice->getItems())) {\n $invoice_data['items'] = array();\n foreach($this->active_invoice->getItems() as $item) {\n $invoice_data['items'][] = array(\n 'id'\t\t\t\t\t => $item->getId(),\n 'description' => $item->getDescription(),\n 'unit_cost' => $item->getUnitCost(),\n 'quantity' => $item->getQuantity(),\n 'first_tax_rate_id' => $item->getFirstTaxRateId(),\n 'second_tax_rate_id' => $item->getSecondTaxRateId(),\n 'total' => $item->getTotal(),\n 'subtotal' => $item->getSubtotal(),\n 'time_record_ids' => $item->getTimeRecordIds(),\n );\n } // foreach\n } // if\n } // if\n \n $this->response->assign('invoice_data', $invoice_data);\n $this->response->assign(Invoices::getSettingsForInvoiceForm($this->active_invoice));\n \n if ($this->request->isSubmitted()) {\n \tif (!$this->request->isAsyncCall()) {\n \t\t$this->response->badRequest();\n \t} // if\n \t\n \ttry {\n if (!is_foreachable($invoice_data['items'])) {\n throw new ValidationErrors(lang('At least one invoice item is required'));\n } // if\n\n \t\tDB::beginWork('Editing Invoice');\n\n \t\t$this->active_invoice->setAttributes($invoice_data);\n\n if ($this->active_invoice->getSecondTaxIsEnabled()) {\n $this->active_invoice->setSecondTaxIsCompound(array_var($invoice_data, 'second_tax_is_compound', false));\n } // if\n\n $this->active_invoice->setItems($invoice_data['items']);\n \t\t\n \t\tif ($this->active_invoice->isIssued()) {\n \t\t $issued_on = isset($invoice_data['issued_on']) ? new DateValue($invoice_data['issued_on']) : new DateValue();\n \t\t $this->active_invoice->setIssuedOn($issued_on);\n \t\t} //if\n\n \t\t\n \t\t$this->active_invoice->save();\n \n// TODO: resolve the issue when dialog has to be redirected to the notification page\n// $this->flash->success('\":number\" has been updated', array('number' => $this->active_invoice->getName()));\n// if ($this->active_invoice->isIssued()) {\n// $this->response->redirectTo('invoice_notify', array('invoice_id' => $this->active_invoice->getId()));\n// } else {\n// $this->response->redirectToUrl($this->active_invoice->getViewUrl()); \n// } // if\n\n \t\tDB::commit('Invoice Edited');\n\n\t\t\t\t\t$this->response->respondWithData($this->active_invoice, array(\n \t'as' => 'invoice', \n 'detailed' => true,\n ));\n \n \t} catch (Exception $e) {\n \t\tDB::rollback('Invoice Editing Failed');\n \t\t$this->response->exception($e);\n \t} // try\n \t\n } // if\n }",
"public function validation();",
"public function runCheckoutValidation() {\n global $wpdb, $wpsc_cart;\n \n $fields = array('gender', 'socialNumber', 'firstName', 'lastName', 'street', 'homenumber', 'zipcode',\n 'city', 'phoneNumber', 'mobilePhone', 'emailAddress', 'year_salary', 'invoiceType', 'invoice_type', 'companyName',\n 'house_extension', 'shipmentAddressInput_invoice', 'reference', 'paymentplan', 'birth_day',\n 'birth_month', 'birth_year', 'consent', 'paymentPlan');\n $klarnaCustomerInfo = array();\n foreach($fields AS $field) {\n $klarnaCustomerInfo[$field] =\n (isset($_POST['klarna_' . $this->moduleType . '_' . $field]) ?\n (trim((string)$_POST['klarna_' . $this->moduleType . '_' . $field])) : '');\n }\n\n wpsc_update_customer_meta( 'klarna_customer_info', $klarnaCustomerInfo );\n \n $valid = true;\n $errors = array();\n\n $checkout_details = wpsc_get_customer_meta( 'checkout_details' );\n \n $emailAddressID = $wpdb->get_var(\"SELECT `\" . WPSC_TABLE_CHECKOUT_FORMS . \"`.`id` FROM `\" . WPSC_TABLE_CHECKOUT_FORMS . \"` WHERE `unique_name` = 'billingemail' AND active = '1' \");\n if(isset($_POST['collected_data'][$emailAddressID]) && $_POST['collected_data'][$emailAddressID])\n $klarnaCustomerInfo['emailAddress'] = $_POST['collected_data'][$emailAddressID];\n else\n $klarnaCustomerInfo['emailAddress'] = $checkout_details[$emailAddressID];\n\n $klarnaCustomerInfo['phone'] = ($klarnaCustomerInfo['phoneNumber'] ? $klarnaCustomerInfo['phoneNumber'] : $klarnaCustomerInfo['mobilePhone']);\n\n if($klarnaCustomerInfo['invoiceType'] == '') {\n $klarnaCustomerInfo['invoiceType'] = $klarnaCustomerInfo['invoice_type'];\n }\n\n if(strlen($klarnaCustomerInfo['phone']) == 0)\n $errors[] = $this->fetchFromLanguagePack('phone_number');\n\n if($this->askForYearlySalary()) {\n $klarnaCustomerInfo['year_salary'] = preg_replace('/[\\D]/', '', $klarnaCustomerInfo['year_salary']);\n if(!ctype_digit($klarnaCustomerInfo['year_salary']))\n $errors[] = $this->fetchFromLanguagePack('year_salary');\n }\n\n if($this->getCountryCode() == 'se') {\n $pno_enc = $this->getPNOEncoding();\n if ( ! KlarnaEncoding::checkPNO( $klarnaCustomerInfo['socialNumber'], $pno_enc ) )\n $errors[] = $this->fetchFromLanguagePack( 'klarna_personalOrOrganisatio_number' );\n if ( strlen( $klarnaCustomerInfo['emailAddress'] ) == 0 )\n $errors[] = $this->fetchFromLanguagePack('email_address');\n\n $addrs = array();\n\n if(empty($errors)) {\n try {\n $addrs = $this->getAddresses($klarnaCustomerInfo['socialNumber'], null, KlarnaFlags::GA_GIVEN);\n\n if(count($addrs) == 0)\n $errors[] = $this->fetchFromLanguagePack('error_no_address');\n elseif(count($addrs) == 1)\n $this->addrs = $addrs[0];\n else {\n //This example only works for GA_GIVEN.\n foreach($addrs as $index => $addr) {\n $addr_string = \"\";\n\n if($addr->isCompany) {\n $addr_string = $addr->getCompanyName();\n $addr_string .= \"|\" . $addr->getStreet();\n $addr_string .= \"|\" . $addr->getZipCode();\n $addr_string .= \"|\" . $addr->getCity();\n $addr_string .= \"|\" . $addr->getCountryCode();\n } else {\n $addr_string = $addr->getFirstName() . \" \" . $addr->getLastName();\n $addr_string .= \"|\" . $addr->getStreet();\n $addr_string .= \"|\" . $addr->getZipCode();\n $addr_string .= \"|\" . $addr->getCity();\n $addr_string .= \"|\" . $addr->getCountryCode();\n }\n if(utf8_encode($addr_string) == $klarnaCustomerInfo['shipmentAddressInput_invoice'] ||\n $addr_string == $klarnaCustomerInfo['shipmentAddressInput_invoice']) {\n $this->addrs = $addr;\n }\n }\n }\n if($klarnaCustomerInfo['invoiceType'] == 'company') {\n if(!$addr->isCompany)\n throw new KlarnaException('Invoice type mismatch.', 59999);\n }\n } catch(Exception $e) {\n $this->klarnaErrors[] = utf8_encode($e->getMessage()) . ' (#' . utf8_encode($e->getCode()) . ')';\n $valid = false;\n }\n\n if($this->addrs == null)\n $errors[] = $this->fetchFromLanguagePack('error_no_address', $country);\n }\n\n if(!empty($errors)) {\n $this->validationErrors = $errors;\n $valid = false;\n } else {\n try {\n $this->addrs->setTelno($klarnaCustomerInfo['phone']);\n $this->addrs->setEmail($klarnaCustomerInfo['emailAddress']);\n } catch( Exception $e ) {\n // Do nothing, ignore it.\n }\n }\n } else {\n if ($klarnaCustomerInfo['invoiceType'] != 'company') {\n if (strlen($klarnaCustomerInfo['firstName']) == 0)\n $errors[] = $this->fetchFromLanguagePack('first_name');\n if (strlen($klarnaCustomerInfo['lastName']) == 0)\n $errors[] = $this->fetchFromLanguagePack('last_name');\n }\n \n if ($this->getCountryCode() == \"de\" || $this->getCountryCode() == \"nl\") {\n $klarnaCustomerInfo['socialNumber'] = $klarnaCustomerInfo['birth_day'] .\n $klarnaCustomerInfo['birth_month'] .\n $klarnaCustomerInfo['birth_year'];\n \n if ($klarnaCustomerInfo['gender'] != '0' && $klarnaCustomerInfo['gender'] != '1')\n $errors[] = $this->fetchFromLanguagePack('sex');\n if (strlen($klarnaCustomerInfo['socialNumber']) == 0)\n $errors[] = $this->fetchFromLanguagePack('klarna_personalOrOrganisatio_number');\n if (strlen($klarnaCustomerInfo['street']) == 0)\n $errors[] = $this->fetchFromLanguagePack('street_adress');\n if ($this->getCountryCode() == 'de' && $klarnaCustomerInfo['consent'] != 'on')\n $errors[] = $this->fetchFromLanguagePack('no_consent');\n } elseif($this->getCountryCode() == 'dk' ||\n $this->getCountryCode() == 'fi' ||\n $this->getCountryCode() == \"no\") {\n\n if ($klarnaCustomerInfo['invoiceType'] == 'company') {\n if (strlen($klarnaCustomerInfo['companyName']) == 0)\n $errors[] = $this->fetchFromLanguagePack('invoice_type_company');\n\n if (strlen($klarnaCustomerInfo['reference']) == 0)\n $errors[] = $this->fetchFromLanguagePack('reference');\n\n $klarnaCustomerInfo['firstName'] = $klarnaCustomerInfo['companyName'];\n $klarnaCustomerInfo['lastName'] = '(Ref. ' . $klarnaCustomerInfo['reference'] . ')';\n } else {\n $pno_enc = $this->getPNOEncoding();\n if(!KlarnaEncoding::checkPNO($klarnaCustomerInfo['socialNumber'], $pno_enc))\n $errors[] = $this->fetchFromLanguagePack('klarna_personalOrOrganisatio_number');\n }\n\n if (strlen($klarnaCustomerInfo['street']) == 0)\n $errors[] = $this->fetchFromLanguagePack('street_adress');\n }\n\n if (strlen($klarnaCustomerInfo['zipcode']) == 0) {\n $errors[] = $this->fetchFromLanguagePack('address_zip');\n }\n \n if (strlen($klarnaCustomerInfo['city']) == 0) {\n $errors[] = $this->fetchFromLanguagePack('address_city');\n }\n \n if (!preg_match(\n KlarnaEncoding::getRegexp(KlarnaEncoding::EMAIL),\n $klarnaCustomerInfo['emailAddress'])) {\n $errors[] = $this->fetchFromLanguagePack('klarna_email');\n }\n\n if (!empty($errors)) {\n $this->validationErrors = $errors;\n $valid = false;\n } else {\n try {\n $this->addrs = new KlarnaAddr(\n utf8_decode($klarnaCustomerInfo['emailAddress']),\n utf8_decode($klarnaCustomerInfo['phoneNumber']),\n utf8_decode($klarnaCustomerInfo['mobilePhone']), \n utf8_decode($klarnaCustomerInfo['firstName']),\n utf8_decode($klarnaCustomerInfo['lastName']),\n '',\n utf8_decode($klarnaCustomerInfo['street']),\n utf8_decode($klarnaCustomerInfo['zipcode']),\n utf8_decode($klarnaCustomerInfo['city']),\n $this->getCountryCode(),\n utf8_decode($klarnaCustomerInfo['homenumber']),\n utf8_decode($klarnaCustomerInfo['house_extension'])\n );\n \n if ($klarnaCustomerInfo['invoiceType'] == 'company') {\n $this->addrs->setCompanyName(utf8_decode($klarnaCustomerInfo['companyName']));\n }\n } catch(Exception $e) {\n $this->klarnaErrors[] = utf8_encode($e->getMessage()) . ' (#' . utf8_encode($e->getCode()) . ')';\n $valid = false;\n }\n }\n }\n\n $checkoutFormFields = array();\n $wpsc_checkout = new wpsc_checkout();\n foreach($wpsc_checkout->checkout_items AS $formData) {\n if ( isset( $_POST['collected_data'][$formData->id] ) && is_array( $_POST['collected_data'][$formData->id] ) )\n $value = $_POST['collected_data'][$formData->id][0];\n else\n $value = isset( $_POST['collected_data'][$formData->id] ) ? $_POST['collected_data'][$formData->id] : '';\n \n if ( is_string( $value ) )\n $value = utf8_decode($value);\n\n $checkoutFormFields[$formData->unique_name] = $value;\n }\n\n if(\n $valid == true &&\n ($this->addrs->getCountry() == KlarnaCountry::NL || $this->addrs->getCountry() == KlarnaCountry::DE))\n {\n if(\n $this->addrs->getFirstName() != $checkoutFormFields['billingfirstname'] ||\n $this->addrs->getLastName() != $checkoutFormFields['billinglastname'] ||\n trim($this->addrs->getStreet() . ' ' . $this->addrs->getHouseNumber() . ' ' . $this->addrs->getHouseExt()) != $checkoutFormFields['billingaddress'] ||\n $this->addrs->getCity() != $checkoutFormFields['billingcity'] ||\n $this->addrs->getZipCode() != $checkoutFormFields['billingpostcode'] ||\n $this->addrs->getCountryCode() != strtolower($checkoutFormFields['billingcountry']))\n {\n \n $this->validationErrors[] = $this->fetchFromLanguagePack('error_shipping_must_match_billing');\n $valid = false;\n }\n }\n\n\n $this->iltQuestions = array();\n $klarnaCustomerInfo['ilt'] = array();\n if($valid == true && self::ENABLE_KLARNA_ILT == 1) {\n $this->setAddress(KlarnaFlags::IS_SHIPPING, $this->addrs);\n try {\n $iltQuestions = array();\n $iltQuestions = $this->checkILT(\n (int)$this->totalCartValueIncludingTax,\n $klarnaCustomerInfo['socialNumber'],\n ($this->getCountry() == KlarnaCountry::DE || $this->getCountry() == KlarnaCountry::NL) ? $klarnaCustomerInfo['gender'] : null);\n \n if(is_array($iltQuestions) && count($iltQuestions) >= 1) {\n foreach($iltQuestions AS $questionID => $question) {\n $klarnaField = 'klarna_' . $questionID . '_' . $this->moduleType;\n if(!isset($_POST[$klarnaField]) || !$_POST[$klarnaField]) {\n $valid = false;\n } else {\n $klarnaCustomerInfo['ilt'][$questionID] = $_POST[$klarnaField];\n }\n $this->iltQuestions[$klarnaField] = $question;\n }\n }\n if($valid == false) {\n $this->validationErrors = array($this->fetchFromLanguagePack('ilt_title'));\n }\n } catch(Exception $e) {\n $valid = false;\n $this->validationErrors = array( 'Fatal error encountered when try to fetch ILT questions.' );\n }\n }\n \n if ( $valid ) {\n $address = $this->addrs->toArray();\n $new_address_object = array();\n\n foreach ( $address as $key => $value ) {\n $new_address_object[$key] = ! seems_utf8( $value ) ? utf8_encode( $value ) : utf8_decode( $value );\n }\n\n wpsc_update_customer_meta( 'klarna_address_object', $new_address_object );\n wpsc_update_customer_meta( 'klarna_customer_info', $klarnaCustomerInfo );\n }\n\n return $valid;\n }",
"public function validateOrder();",
"protected static function invalidInvoice($data) {\n\t\t$html = '';\n\t\t$html .= self::pw('config')->twig->render('util/alert.twig', ['type' => 'danger', 'title' => 'Invoice Not Found', 'iconclass' => 'fa fa-warning fa-2x', 'message' => \"Invoice # $data->invnbr can not be found\"]);\n\t\t$html .= '<div class=\"mb-3\"></div>';\n\t\t$html .= self::lookupForm();\n\t\treturn $html;\n\t}",
"protected function validation(){\t\t\n\t\t$this->validate(\"InclusionIn\", array(\n\t\t\t\"field\" => \"mandoc\",\n\t\t\t\"domain\" => array('S', 'N'),\n\t\t\t\"required\" => true\n\t\t));\n\t\tif($this->validationHasFailed()==true){\n\t\t\treturn false;\n\t\t}\n\t}",
"public function store(Request $request)\n {\n $input = $request->all();\n\n $validator = Validator::make($input, [\n 'invoices_no' => 'required',\n /*'dot' => 'required|before_or_equal:'.date('Y-m-d')],[\n 'dot.before_or_equal' => 'Please set the date to today or before'*/\n ]);\n\n if ($validator->fails())\n { \n ($validator->errors()->has('nominals')) ? Session::flash('flash_message',$validator->errors()->first('nominals')) : Session::flash('flash_message',$validator->errors()->first('invoices_no'));\n //dd($validator->errors()->first('invoices_no'));\n return redirect('bpenb/create')->withInput()->withErrors($validator); \n //return response()->json(['errors'=>$validator->errors()->all()]);\n //return redirect('testbpb')->withInput()->withErrors($validator); \n }\n else\n { \n $inv = new Bpenb();\n $inv->invoices_no = $input['invoices_no'];\n $inv->bank = $input['bank'];\n $inv->pay_from = $input['pay_from'];\n $inv->given_by = $input['given_by'];\n $inv->dot = $input['dot'];\n $inv->nominal = $input['nominals'];\n $inv->user_id = $input['user_id'];\n $inv->aiw = $input['aiw'];\n $inv->memo = $input['memo'];\n $inv->save();\n \n\n $iddet = explode(\"|\", $input['iddet'], -1);\n foreach ($iddet as $i) {\n BpenbDetail::where('id',$i)->update(['id_bpenb' => $inv->id]);\n }\n\n //DB::table('inv_no_temp')->where('invoices_no',$input['invoices_no'])->update(['status' => 's']);\n //DB::table('invnolist')->where('invoices_no',$input['invoices_no'])->update(['invoices_no' => $input['invoices_no']+1]);\n\n if($request->submitbutton == 'saveprint') {\n //DB::table('invoices')->where('invoices_no',$input['invoices_no'])->update(['status' => 'p']);\n $invid = Bpenb::where('id',$inv->id)->value('id');\n return view('bpenb.print',compact('invid'));\n }\n\n Session::flash('flash_message','Bank In Transaction Saved');\n return redirect('bpenb');\n }\n }",
"private function validateForm($_POST) {\n\n $hash = self::getHash();\n /* @var Entity\\NeoCart $cart */\n $cart = $this->NeoCartModel->getCart($hash);\n\n $cartItems = $cart->getCartItems();\n\n if (!$cartItems) {\n exit(\"Error(1:20) Va rugam contactati administratorul: [email protected]\");\n }\n\n foreach ($cartItems as $cartItem) {\n /* @var $cartItem Entity\\CartItem */\n /* @var $item Entity\\Item */\n $item = $cartItem->getItem();\n\n if ($item->getItem_type() == \"offer\") {\n for ($i = 0; $i < $cartItem->getQuantity(); $i++) {\n if ($cartItem->getIs_gift()) {\n if (strlen($_POST['name_' . $cartItem->getId()][$i]) < 2 || !filter_var($_POST['email_' . $cartItem->getId()][$i], FILTER_VALIDATE_EMAIL)) {\n $errors.= \"Introduceti corect datele prietenului !<br/>\";\n break 2;\n }\n } else\n if (strlen($_POST['name_' . $cartItem->getId()][$i]) < 2) {\n $errors.= \"Introduceti datele beneficiarului !<br/>\";\n break 2;\n }\n }\n }\n }\n //exit();\n if (!isset($_POST['payment_method']))\n $errors.='Alegeti metoda de plata';\n\n return $errors;\n }",
"public abstract function validation();",
"public function onInvoicePreValidate(ViewEvent $event): void\n {\n $result = $event->getControllerResult();\n $method = $event->getRequest()->getMethod();\n\n if ($result instanceof Invoice === false || $method !== 'POST') {\n return;\n }\n\n $invoice = $result;\n\n $invoice->setChrono(null);\n $invoice->setSentAt(new DateTime());\n }",
"function inscription_jesa_manage_validate($form, &$form_state) {\n \n}"
] |
[
"0.70282775",
"0.6632479",
"0.6456811",
"0.63849866",
"0.62426424",
"0.61502457",
"0.61307806",
"0.6094997",
"0.6093306",
"0.6088881",
"0.60710746",
"0.60404027",
"0.5959779",
"0.5951677",
"0.59440386",
"0.5907626",
"0.59003145",
"0.589629",
"0.5881013",
"0.58791965",
"0.5876884",
"0.58626515",
"0.58408415",
"0.5839188",
"0.5836886",
"0.5804971",
"0.5800443",
"0.5795943",
"0.5762515",
"0.5746009"
] |
0.66370696
|
1
|
protected $guarded = ['is_read','box_type','created_at','updated_at','deleted_at_sender','deleted_at_receiver']; get relationship with sender user
|
public function sender(){
return $this->belongsTo('App\Models\User','sender_id_fk');
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function sender() {\n \treturn $this->belongsTo('User', 'sender_id');\n }",
"public function receiving_user(){\n return $this->belongsTo('App\\User', 'received_by');\n }",
"public function user()\r\n {\r\n // belongsTo(RelatedModel, foreignKey = user_id, keyOnRelatedModel = id)\r\n return $this->belongsTo(User::class,'sender_id');\r\n }",
"public function sender()\n {\n return $this->belongsTo('App\\User');\n }",
"public function senderPerson()\r\n {\r\n // belongsTo(RelatedModel, foreignKey = user_id, keyOnRelatedModel = id)\r\n return $this->belongsTo(User::class,'sender_id');\r\n }",
"public function receiver(){\n return $this->belongsTo('App\\Models\\User','receiver_id_fk');\n }",
"public function sender() {\n return $this->belongsTo(User::class, 'sender_id');\n }",
"public function sender()\n {\n return $this->belongsTo(User::class, 'sender_id');\n }",
"public function sender()\n {\n return $this->belongsTo(User::class);\n }",
"public function sender()\n {\n return $this->belongsTo('User', 'sender_id', 'id');\n }",
"public function receiver()\n {\n return $this->belongsTo('App\\User');\n }",
"public function userObject()\n {\n return $this->belongsTo('App\\User', 'senderUserID');\n }",
"public function receiver() {\n return $this->belongsTo(User::class, 'receiver_id');\n }",
"public function receiverPerson()\r\n {\r\n // belongsTo(RelatedModel, foreignKey = user_id, keyOnRelatedModel = id)\r\n return $this->belongsTo(User::class,'receiver_id');\r\n }",
"public function sender() //Remetente\n\t{\n\t\treturn $this->belongsTo(Entity::class, 'sender_id');\n\t}",
"public function receiver()\n {\n return $this->belongsTo(User::class, 'receiver_id');\n }",
"public function sender()\n\t{\n\t\treturn $this->belongsTo('\\User');\n\t}",
"public function receiver()\n\t{\n\t\treturn $this->belongsTo('\\User');\n\t}",
"public function messageFrom(){\n \treturn $this->belongsTo('App\\User', 'from');\n }",
"public function sender()\n {\n \t// TODO: dodaj u User modelu funkciju koja ce da ti vrati sve thread-ove gde si ili sender ili receiver\n\n\n \t// tu treba da se radi query nad Thread modelom ...\n \t// izvadi sve thread-ove gde je sender_id ili receiver_id ulogovani korisnik\n return $threads = \\Auth::user()->treads();\n \t// priveri samo na laravel dokumentaciji kako se ovo pise\n \t\n \treturn $this->belongsTo(User::class, 'sender_id');\n }",
"public function message_receiver(){\n return $this->belongsToMany(\n 'App\\Message',\n 'receivers',\n 'receiver_id',\n 'message_id')\n ->orderBy('receivers.id','DESC')\n ->whereNull('receivers.deleted_at')\n ->withPivot(['id','read_at']);\n }",
"public function fromUser()\n {\n return $this->belongsTo('App\\User','from_user_id','id');\n }",
"public function sender()\n {\n return $this->hasMany(\n Message::class,\n 'sender_id');\n\n }",
"public function sender() \n {\n if($this->sender_type == 'User') return $this->belongsTo('App\\Models\\User\\User', 'sender_id');\n return $this->belongsTo('App\\Models\\Character\\Character', 'sender_id');\n }",
"public function recipient()\n {\n return $this->belongsTo('App\\User');\n }",
"public function from_user()\n {\n return $this->hasMany(\\App\\User::class, 'id', 'from_user');\n }",
"public function fromUser()\n {\n return $this->belongsTo('App\\User',\"from_user\", \"id\");\n }",
"public function sender()\n {\n return $this->belongsTo('App\\Employee', 'sender');\n }",
"public function messageTo(){\n \treturn $this->belongsTo('App\\User', 'to');\n }",
"function userDetails() {\n return $this->hasOne('App\\Models\\User', 'id', 'receiver_user_id')->withTrashed();\n }"
] |
[
"0.7413782",
"0.73865575",
"0.73354816",
"0.73210055",
"0.7281364",
"0.7252628",
"0.7237966",
"0.7229828",
"0.7204945",
"0.71500844",
"0.70627403",
"0.70428604",
"0.7012635",
"0.7007487",
"0.6989609",
"0.6984055",
"0.6980592",
"0.683865",
"0.6821914",
"0.6816286",
"0.67870045",
"0.6748966",
"0.6693903",
"0.66580343",
"0.6637564",
"0.6633967",
"0.6623616",
"0.6516287",
"0.64451706",
"0.64084065"
] |
0.766727
|
0
|
Render a wavefront model.
|
public function render_wavefront_model(\mod_wavefront\output\wavefront_model $wavefront): string {
$context = $wavefront->export_for_template($this);
if (count($context) == 0) {
// An error has occured.
return $this->output->heading(get_string("errornowavefrontfiles", "wavefront"));
}
return $this->render_from_template('mod_wavefront/wavefront_model', $context);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function render();",
"public function render();",
"public function render();",
"public function render();",
"public function render();",
"public function render();",
"public function render();",
"public function render();",
"public function render();",
"public function render();",
"public function render();",
"public function render();",
"public function render();",
"public function render();",
"public function render();",
"public function render();",
"public function render();",
"public function render();",
"public abstract function render();",
"public abstract function render();",
"public function display_model($context, $model, $stagename, $editing = false) {\n\n $output = $this->output->box_start('wavefront');\n\n // Display model.\n if ($model->type === 'obj') {\n $wavefrontmodel = new \\mod_wavefront\\output\\wavefront_model($context, $model, $stagename);\n $output .= $this->render($wavefrontmodel);\n } else if ($model->type === 'dae') {\n $colladamodel = new \\mod_wavefront\\output\\collada_model($context, $model, $stagename);\n $output .= $this->render($colladamodel);\n }\n\n // Display controls.\n $wavefrontcontrols = new \\mod_wavefront\\output\\model_controls($context, $model, $editing, $this->page->cm->id);\n $output .= $this->render($wavefrontcontrols);\n\n $output .= $this->output->box_end();\n\n return $output;\n }",
"public function render() {\r\n\t\t\r\n\t}",
"public function render() {}",
"public function render() {}",
"public function render() {}",
"public function render() {}",
"public function render() {}",
"public function render() {}",
"public function render() {}",
"public function render() {}"
] |
[
"0.5729931",
"0.5729931",
"0.5729931",
"0.5729931",
"0.5729931",
"0.5729931",
"0.5729931",
"0.5729931",
"0.5729931",
"0.5729931",
"0.5729931",
"0.5729931",
"0.5729931",
"0.5729931",
"0.5729931",
"0.5729931",
"0.5729931",
"0.5729931",
"0.56806767",
"0.56806767",
"0.55882424",
"0.5566605",
"0.5562839",
"0.5562839",
"0.5562839",
"0.5562839",
"0.5562839",
"0.5562839",
"0.5562839",
"0.5562839"
] |
0.7161968
|
0
|
Render a collada model.
|
public function render_collada_model(\mod_wavefront\output\collada_model $collada): string {
$context = $collada->export_for_template($this);
if (count($context) == 0) {
// An error has occured.
return $this->output->heading(get_string("errornocolladafiles", "wavefront"));
}
return $this->render_from_template('mod_wavefront/collada_model', $context);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function display_model_in_ar($context, $model, $stagename) {\n $output = '';\n\n // Display model.\n if ($model->type === 'obj') {\n $wavefrontmodel = new \\mod_wavefront\\output\\wavefront_ar($context, $model, $stagename);\n $output .= $this->render($wavefrontmodel);\n } else if ($model->type === 'dae') {\n $colladamodel = new \\mod_wavefront\\output\\collada_ar($context, $model, $stagename);\n $output .= $this->render($colladamodel);\n }\n\n return $output;\n }",
"public abstract function render();",
"public abstract function render();",
"public function render();",
"public function render();",
"public function render();",
"public function render();",
"public function render();",
"public function render();",
"public function render();",
"public function render();",
"public function render();",
"public function render();",
"public function render();",
"public function render();",
"public function render();",
"public function render();",
"public function render();",
"public function render();",
"public function render();",
"public function render();",
"function render() ;",
"public function render(): void;",
"public function display_model($context, $model, $stagename, $editing = false) {\n\n $output = $this->output->box_start('wavefront');\n\n // Display model.\n if ($model->type === 'obj') {\n $wavefrontmodel = new \\mod_wavefront\\output\\wavefront_model($context, $model, $stagename);\n $output .= $this->render($wavefrontmodel);\n } else if ($model->type === 'dae') {\n $colladamodel = new \\mod_wavefront\\output\\collada_model($context, $model, $stagename);\n $output .= $this->render($colladamodel);\n }\n\n // Display controls.\n $wavefrontcontrols = new \\mod_wavefront\\output\\model_controls($context, $model, $editing, $this->page->cm->id);\n $output .= $this->render($wavefrontcontrols);\n\n $output .= $this->output->box_end();\n\n return $output;\n }",
"abstract public function render();",
"abstract public function render();",
"abstract public function render();",
"abstract public function render();",
"abstract public function render();",
"abstract public function render();"
] |
[
"0.56103164",
"0.52640855",
"0.52640855",
"0.52343816",
"0.52343816",
"0.52343816",
"0.52343816",
"0.52343816",
"0.52343816",
"0.52343816",
"0.52343816",
"0.52343816",
"0.52343816",
"0.52343816",
"0.52343816",
"0.52343816",
"0.52343816",
"0.52343816",
"0.52343816",
"0.52343816",
"0.52343816",
"0.51644295",
"0.5139826",
"0.51345795",
"0.50926834",
"0.50926834",
"0.50926834",
"0.50926834",
"0.50926834",
"0.50926834"
] |
0.7178113
|
0
|
Output the HTML for a comment in the given context.
|
private function print_comment($comment, $context) {
global $DB, $CFG, $COURSE;
$output = '';
$user = $DB->get_record('user', array('id' => $comment->userid));
$deleteurl = new moodle_url('/mod/wavefront/comment.php', array('id' => $comment->wavefrontid, 'delete' => $comment->id));
$output .= '<table cellspacing="0" width="50%" class="boxaligncenter datacomment forumpost">'.
'<tr class="header"><td class="picture left">'.
$this->output->user_picture($user, array('courseid' => $COURSE->id)).'</td>'.
'<td class="topic starter" align="left"><a name="c'.$comment->id.'"></a><div class="author">'.
'<a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&course='.$COURSE->id.'">'.
fullname($user, has_capability('moodle/site:viewfullnames', $context)).'</a> - '.userdate($comment->timemodified).
'</div></td></tr>'.
'<tr><td class="left side">'.
// TODO: user_group picture?
'</td><td class="content" align="left">'.
format_text($comment->commenttext, FORMAT_MOODLE).
'<div class="commands">'.
(has_capability('mod/wavefront:edit', $context) ? html_writer::link($deleteurl, get_string('delete')) : '').
'</div>'.
'</td></tr></table>';
return $output;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function process($context)\n {\n $context->setContents($this->setCDataPlaceholder($context->getContents(), $context->getPlaceholderContainer()));\n\n return $context->setContents($this->setConditionalCommentsPlaceholder($context->getContents(), $context->getPlaceholderContainer()));\n }",
"public function getCommentHTML() {\n return str_replace(\"\\n\", \"<br />\", trim(str_replace(array(\"/*\", \"*\"), array(\"\", \"\"), $this->getComment())));\n }",
"function lightboxgallery_print_comment($comment, $context) {\n global $DB, $CFG, $COURSE, $OUTPUT;\n\n //TODO: Move to renderer!\n\n $user = $DB->get_record('user', array('id' => $comment->userid));\n\n $deleteurl = new moodle_url('/mod/lightboxgallery/comment.php', array('id' => $comment->gallery, 'delete' => $comment->id));\n\n echo '<table cellspacing=\"0\" width=\"50%\" class=\"boxaligncenter datacomment forumpost\">'.\n '<tr class=\"header\"><td class=\"picture left\">'.$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->comment, FORMAT_MOODLE).\n '<div class=\"commands\">'.\n (has_capability('mod/lightboxgallery:edit', $context) ? html_writer::link($deleteurl, get_string('delete')) : '').\n '</div>'.\n '</td></tr></table>';\n}",
"public function comment()\n {\n $commentManager = new CommentManager();\n \n $comment = $commentManager->getComment($_GET['id']);\n \n require (__DIR__ . '/../view/frontend/commentView.php');\n }",
"function OutputComment() {\n\t\t$pagecomment = trim($this->shortDescription) ? PrepString($this->shortDescription).\"<br />\" : \"\";\n\t\t$pagecomment .= trim($this->longDescription) ? PrepString($this->longDescription).\"<br />\" : \"\";\n\t\t$pagecomment .= trim($this->tags) ? \"<i>\".PrepString($this->tags).\"</i>\" : \"\";\n\t\t$pagecomment = $pagecomment ? $pagecomment : \"<i>(Undocumented)</i>\";\n\t\t$pagecomment = \"<div class='pagecomment'>$pagecomment</div>\";\n\t\treturn $pagecomment;\n\t}",
"function doCommentDiv($p_commentTarget){\n\t\techo '<div class=\"fb-comments\" data-href=\"'. $p_commentTarget .'\" data-width=\"350\" data-numposts=\"3\" data-colorscheme=\"light\"></div>';\n\t}",
"function block_core_comment_template_render_comments($comments, $block)\n {\n }",
"function theme_render_comment($comment, $args, $depth) {\n\t$GLOBALS['comment'] = $comment;\n\t?>\n\t<li <?php comment_class(); ?> id=\"li-comment-<?php comment_ID() ?>\">\n\t\t<div id=\"comment-<?php comment_ID(); ?>\">\n\t\t <div class=\"comment-author vcard\">\n\t\t <?php echo get_avatar($comment, 48); ?>\n\t\t <?php comment_author_link() ?>\n\t\t <span class=\"says\">says:</span>\n\t\t </div>\n\t\t <?php if ($comment->comment_approved == '0') : ?>\n\t\t <em class=\"moderation-notice\"><?php _e('Your comment is awaiting moderation.') ?></em><br />\n\t\t <?php endif; ?>\n\t\t\n\t\t <div class=\"comment-meta\">\n\t\t \t<a href=\"<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>\">\n\t\t \t\t<?php comment_date() ?> at <?php comment_time() ?>\n\t\t \t</a>\n\t\t \t<?php edit_comment_link(__('(Edit)'),' ','') ?>\n\t \t</div>\n\t\t\t\n\t\t\t<div class=\"comment-text\">\n\t\t \t<?php comment_text() ?>\n\t\t </div>\n\t\n\t\t <div class=\"comment-reply\">\n\t\t <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>\n\t\t </div>\n\t\t</div>\n\t<?php\n}",
"public function comments()\n {\n $task = $this->getTask();\n $commentSortingDirection = $this->userMetadataCacheDecorator->get(UserMetadataModel::KEY_COMMENT_SORTING_DIRECTION, 'ASC');\n\n $this->response->html($this->template->render('CommentTooltip:board/tooltip_comments', array(\n 'task' => $task,\n 'comments' => $this->commentModel->getAll($task['id'], $commentSortingDirection)\n )));\n }",
"function test_rendering_comment_template() {\n\t\t$parsed_blocks = parse_blocks(\n\t\t\t'<!-- wp:comment-template --><!-- wp:comment-author-name /--><!-- wp:comment-content /--><!-- /wp:comment-template -->'\n\t\t);\n\n\t\t$block = new WP_Block(\n\t\t\t$parsed_blocks[0],\n\t\t\tarray(\n\t\t\t\t'postId' => self::$custom_post->ID,\n\t\t\t)\n\t\t);\n\n\t\t$this->assertSame(\n\t\t\tstr_replace( array( \"\\n\", \"\\t\" ), '', '<ol class=\"wp-block-comment-template\"><li id=\"comment-' . self::$comment_ids[0] . '\" class=\"comment even thread-even depth-1\"><div class=\"wp-block-comment-author-name\"><a rel=\"external nofollow ugc\" href=\"http://example.com/author-url/\" target=\"_self\" >Test</a></div><div class=\"wp-block-comment-content\"><p>Hello world</p></div></li></ol>' ),\n\t\t\tstr_replace( array( \"\\n\", \"\\t\" ), '', $block->render() )\n\t\t);\n\t}",
"function comment_notification_text($notify_message, $comment_id) {\n extract($this->get_comment_data($comment_id));\n if ($comment->comment_type == 'facebook') {\n ob_start();\n $content = strip_tags($comment->comment_content);\n ?>\nNew Facebook Comment on your post \"<?php echo $post->post_title ?>\"\n\nAuthor : <?php echo $comment->comment_author ?> \nURL : <?php echo $comment->comment_author_url ?> \n\nComment:\n\n<?php echo $content ?> \n\nParticipate in the conversation here:\n<?php echo $this->get_permalink($post->ID) ?> \n\n <?php\n return ob_get_clean();\n } else {\n return $notify_message;\n }\n }",
"public function renderCommentView($ucid) {\n global $lexicon;\n global $roles;\n\n $members = new Members();\n\n $comment_data = $this->comments['ucid-'.$ucid];\n $this->html_output .= ('<div class=\"commentia-comment\"'.' data-ucid=\"'.$comment_data['ucid'].'\">'.\"\\n\");\n $this->html_output .= ('<div class=\"commentia-comment-info\">'.\"\\n\");\n $this->html_output .= ('<img src='.$members->getMemberData($comment_data['creator_username'], 'avatar_file').' class=\"commentia-comment-info__member-avatar\">'.\"\\n\");\n $this->html_output .= ('<p class=\"commentia-comment-info__by\">'.COMMENT_INFO_COMMENT_BY.' '.($comment_data['creator_username']).', </p>'.\"\\n\");\n date_default_timezone_set(COMMENTIA_TIMEZONE);\n $this->html_output .= ('<p class=\"commentia-comment-info__timestamp\">'.COMMENT_INFO_POSTED_AT.' '.date(DATETIME_LOCALIZED,strtotime($comment_data['timestamp'])).'</p>'.\"\\n\");\n date_default_timezone_set('UTC');\n $this->html_output .= ('</div>'.\"\\n\");\n $this->html_output .= ('<div class=\"commentia-comment__content\">'.$comment_data['content'].'</div>'.\"\\n\");\n $this->html_output .= ('<div class=\"commentia-comment__edit-area\"></div>'.\"\\n\");\n\n if (!$comment_data['is_deleted']) {\n if ($_SESSION['__COMMENTIA__']['member_is_logged_in']) {\n $this->html_output .= ('<p class=\"commentia-comment-controls\">');\n $this->html_output .= ('<a href=\"javascript:void(0)\" onclick=\"showReplyArea(this)\">'.COMMENT_CONTROLS_REPLY.'</a>');\n if ($roles->memberHasUsername($comment_data['creator_username']) || $roles->memberIsAdmin()) {\n $this->html_output .= ('<a href=\"javascript:void(0)\" onclick=\"showEditArea(this)\">'.COMMENT_CONTROLS_EDIT.'</a>');\n $this->html_output .= ('<a href=\"javascript:void(0)\" onclick=\"deleteComment(this)\">'.COMMENT_CONTROLS_DELETE.'</a>');\n }\n $this->html_output .= ('</p>'.\"\\n\");\n }\n $this->html_output .= ('<div class=\"commentia-rating-controls\">');\n $this->html_output .= ('<a href=\"javascript:void(0)\" onclick=\"updateRating(this, \\'up\\')\" class=\"commentia-rating-controls__arrow commentia-rating-controls__arrow--up\"></a>');\n $this->html_output .= ('<a href=\"javascript:void(0)\" onclick=\"updateRating(this, \\'down\\')\" class=\"commentia-rating-controls__arrow commentia-rating-controls__arrow--down\"></a>');\n $this->html_output .= ('</div>');\n $this->html_output .= ('<span class=\"commentia-rating-indicator\">'.(int) $comment_data['rating'].'</span>');\n }\n\n $this->html_output .= ('<div class=\"commentia-comment__reply-area\"></div>'.\"\\n\");\n\n if ($comment_data['children']) {\n foreach($comment_data['children'] as $child) {\n if (isset($this->comments['ucid-'.$child])) {\n $this->renderCommentView($child);\n unset($this->comments['ucid-'.$child]);\n }\n }\n }\n\n $this->html_output .= ('</div>'.\"\\n\");\n\n }",
"public function render() {\n\n\t\tif(!$this->commentsField) return \"Unable to determine comments field\";\n\t\t$options = $this->options; \t\n\t\t$labels = $options['labels'];\n\t\t$attrs = $options['attrs'];\n\t\t$id = $attrs['id'];\n\t\t$submitKey = $id . \"_submit\";\n\t\t$honeypot = $options['requireHoneypotField'];\n\t\t$inputValues = array('cite' => '', 'email' => '', 'website' => '', 'stars' => '', 'text' => '', 'notify' => '');\n\t\tif($honeypot) $inputValues[$honeypot] = '';\n\t\t\n\t\t$user = $this->wire('user'); \n\n\t\tif($user->isLoggedin()) {\n\t\t\t$inputValues['cite'] = $user->name; \n\t\t\t$inputValues['email'] = $user->email;\n\t\t}\n\t\t\n\t\t$input = $this->wire('input'); \n\t\t$divClass = 'new';\n\t\t$class = trim(\"CommentForm \" . $attrs['class']); \n\t\t$note = '';\n\n\t\t/*\n\t\t * Removed because this is not cache safe! Converted to JS cookie. \n\t\t * \n\t\tif(is_array($this->session->CommentForm)) {\n\t\t\t// submission data available in the session\n\t\t\t$sessionValues = $this->session->CommentForm;\n\t\t\tforeach($inputValues as $key => $value) {\n\t\t\t\tif($key == 'text') continue; \n\t\t\t\tif(!isset($sessionValues[$key])) $sessionValues[$key] = '';\n\t\t\t\t$inputValues[$key] = htmlentities($sessionValues[$key], ENT_QUOTES, $this->options['encoding']); \n\t\t\t}\n\t\t\tunset($sessionValues);\n\t\t}\n\t\t*/\n\n\t\tforeach($options['presets'] as $key => $value) {\n\t\t\tif(!is_null($value)) $inputValues[$key] = $value; \n\t\t}\n\n\t\t$out = '';\n\t\t$showForm = true; \n\t\t\n\t\tif($options['processInput'] && $input->post->$submitKey == 1) {\n\t\t\t$comment = $this->processInput(); \n\t\t\tif($comment) { \n\t\t\t\t$out .= $this->renderSuccess($comment); // success, return\n\t\t\t} else {\n\t\t\t\t$inputValues = array_merge($inputValues, $this->inputValues);\n\t\t\t\tforeach($inputValues as $key => $value) {\n\t\t\t\t\t$inputValues[$key] = htmlentities($value, ENT_QUOTES, $this->options['encoding']);\n\t\t\t\t}\n\t\t\t\t$note = \"\\n\\t$options[errorMessage]\";\n\t\t\t\t$divClass = 'error';\n\t\t\t}\n\n\t\t} else if($this->options['redirectAfterPost'] && $input->get('comment_success') === \"1\") {\n\t\t\t$note = $this->renderSuccess();\n\t\t}\n\n\t\t$form = '';\n\t\tif($showForm) {\n\t\t\tif($this->options['depth'] > 0) {\n\t\t\t\t$form = $this->renderFormThread($id, $class, $attrs, $labels, $inputValues);\n\t\t\t} else {\n\t\t\t\t$form = $this->renderFormNormal($id, $class, $attrs, $labels, $inputValues); \n\t\t\t}\n\t\t\tif(!$options['presetsEditable']) {\n\t\t\t\tforeach($options['presets'] as $key => $value) {\n\t\t\t\t\tif(!is_null($value)) $form = str_replace(\" name='$key'\", \" name='$key' disabled='disabled'\", $form); \n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t$out .= \n\t\t\t\"\\n<div id='{$id}' class='{$id}_$divClass'>\" . \t\n\t\t\t\"\\n\" . $this->options['headline'] . $note . $form . \n\t\t\t\"\\n</div><!--/$id-->\";\n\n\n\t\treturn $out; \n\t}",
"public function toHtml($context = NULL): string {\n return $this->saveHTML($context);\n }",
"public function displayComments()\n {\n global $lexicon;\n $lexicon = new Lexicon(COMMENTIA_LEX_LOCALE);\n\n global $roles;\n $roles = new Roles();\n\n /**\n * Iterates through each comment recursively, and appends it to the var holding the HTML markup.\n *\n * @param array $comment An array containing all the comment data\n */\n\n foreach ($this->comments as $comment) {\n if (isset($this->comments['ucid-'.$comment['ucid']])) {\n $this->renderCommentView($comment['ucid']);\n unset($this->comments['ucid-'.$comment['ucid']]);\n }\n }\n\n if ($_SESSION['__COMMENTIA__']['member_is_logged_in']) {\n $this->html_output .= ('<div class=\"commentia-new_comment_area\">'.\"\\n\".'<h4>'.TITLES_NEW_COMMENT.'</h4>'.\"\\n\".'<textarea id=\"comment-box\" oninput=\"autoGrow(this);\"></textarea>'.\"\\n\".'<button id=\"post-comment-button\" onclick=\"postNewComment(this);\">'.COMMENT_CONTROLS_PUBLISH.'</button>'.\"\\n\".'</div>'.\"\\n\");\n }\n\n return $this->html_output;\n }",
"public function format_comment($comment, $args, $depth) {\n\n $this -> comment_counter ++;\n\n $tag = 'div';\n $add_below = 'div-comment';\n\n echo '<' . $tag;\n echo ($this -> comment_counter > 1) ? ' class=\"rd-comment rd-hidden\"' : ' class=\"rd-comment\"'; \n echo ' id=\"comment-';\n comment_ID();\n echo '\">';\n\n if ( 'div' != $args['style'] ) { ?>\n <div id=\"div-comment-<?php comment_ID() ?>\" class=\"comment-body\"><?php\n } ?>\n <div class=\"comment-author vcard\"><?php \n if ( $args['avatar_size'] != 0 ) {\n echo get_avatar( $comment, $args['avatar_size'] ); \n } \n printf( __( '<cite class=\"fn\">%s</cite> <span class=\"says\">says:</span>' ), get_comment_author_link() ); ?>\n </div><?php \n if ( $comment->comment_approved == '0' ) { ?>\n <em class=\"comment-awaiting-moderation\"><?php _e( 'Your comment is awaiting moderation.' ); ?></em><br/><?php \n } \n comment_text();\n echo '</div></div>';\n }",
"protected function _emitComment($ast) {\n echo \"/{$ast['value']}/\\n\";\n }",
"protected function _emitComment($ast) {\n echo \"/{$ast['value']}/\\n\";\n }",
"public function render()\n\t{\n\t\t$this->prefix = 'comment';\n\n\t\t$comments = $this->model->getComments();\n\n\t\t$this->items = $comments;\n\n\t\t$user = JFactory::getUser();\n\t\t$this->canDeleteComments = $user->authorise('comment.delete', 'com_monitor');\n\t\t$this->canEditComments = $user->authorise('comment.edit', 'com_monitor');\n\t\t$this->canEditOwnComments = $user->authorise('comment.edit.own', 'com_monitor');\n\t\t$this->canEditIssues = $user->authorise('issue.edit', 'com_monitor');\n\t\t$this->canEditOwnIssues = $user->authorise('issue.edit.own', 'com_monitor');\n\t\t$this->canEditProjects = $user->authorise('project.edit', 'com_monitor');\n\n\t\t$this->setLayout('default');\n\n\t\t$this->addToolbar();\n\n\t\treturn parent::render();\n\t}",
"function cosmetics_comments( $cosmetics_comment, $cosmetics_comment_args, $cosmetics_comment_depth ) {\n\n if ( 'div' === $cosmetics_comment_args['style'] ) :\n\n $cosmetics_comment_tag = 'div';\n $cosmetics_comment_add_below = 'comment';\n\n else :\n\n $cosmetics_comment_tag = 'li';\n $cosmetics_comment_add_below = 'div-comment';\n\n endif;\n\n?>\n <<?php echo $cosmetics_comment_tag ?> <?php comment_class( empty( $cosmetics_comment_args['has_children'] ) ? '' : 'parent' ) ?> id=\"comment-<?php comment_ID() ?>\">\n\n <?php if ( 'div' != $cosmetics_comment_args['style'] ) : ?>\n\n <div id=\"div-comment-<?php comment_ID() ?>\" class=\"comment-body\">\n\n <?php endif; ?>\n\n <div class=\"comment-author vcard\">\n <?php if ( $cosmetics_comment_args['avatar_size'] != 0 ) echo get_avatar( $cosmetics_comment, $cosmetics_comment_args['avatar_size'] ); ?>\n\n </div>\n\n <?php if ( $cosmetics_comment->comment_approved == '0' ) : ?>\n <em class=\"comment-awaiting-moderation\">\n <?php esc_html_e( 'Your comment is awaiting moderation.', 'cosmetics' ); ?>\n </em>\n <?php endif; ?>\n\n <div class=\"comment-meta commentmetadata\">\n <div class=\"comment-meta-box\">\n <span class=\"name\">\n <?php comment_author_link(); ?>\n </span>\n <span class=\"comment-metadata\">\n <?php comment_date(); ?>\n </span>\n\n <?php edit_comment_link( esc_html__( 'Edit ', 'cosmetics' ) ); ?>\n\n <?php comment_reply_link( array_merge( $cosmetics_comment_args, array( 'add_below' => $cosmetics_comment_add_below, 'depth' => $cosmetics_comment_depth, 'max_depth' => $cosmetics_comment_args['max_depth'] ) ) ); ?>\n\n </div>\n <div class=\"comment-text-box\">\n <?php comment_text(); ?>\n </div>\n </div>\n\n <?php if ( 'div' != $cosmetics_comment_args['style'] ) : ?>\n </div>\n <?php endif; ?>\n\n<?php\n}",
"abstract public function comment();",
"function get_comment($comment = \\null, $output = \\OBJECT)\n {\n }",
"function phptemplate_comment_wrapper($content, $node) {\n if (!$content || $node->type == 'forum') {\n return '<div id=\"comments\">'. $content .'</div><a name=\"comments\"></a>';\n }\n else {\n return '<div id=\"comments\"><h2 class=\"comments\">'. t('Comments') .'</h2>'. $content .'</div><a name=\"comments\"></a>';\n }\n}",
"public function templateComment()\n {\n // just showing how powerful can commenting be with extension\n }",
"public function render() {\n\t\t$appId = $this->arguments['appId'];\n\t\t$locale = $this->arguments['locale'];\n\t\t$code = '<div id=\"fb-root\"></div>';\n\t\t$scriptFile = 'http://connect.facebook.net/' . $locale . '/all.js#appId=' . htmlspecialchars($appId) . '&xfbml=1';\n\t\t$scriptTag = $this->documentHead->wrap(NULL, $scriptFile, 'js');\n\t\t$this->documentHead->includeHeader($scriptTag, NULL, 'fed-facebook-comment');\n\t\t$code .= $this->tag->render();\n\t\treturn $code;\n\t}",
"function view_comment()\n\t{\n\t\tif ( ! $this->cp->allowed_group('can_access_content'))\n\t\t{\n\t\t\tshow_error($this->lang->line('unauthorized_access'));\n\t\t}\n\n\t\t$comment_id = $this->input->get('comment_id');\n\t\t$this->view_comments('', '', '', array($comment_id));\n\t}",
"public function toHTML(){\n\t\t$login\t\t=\tstripslashes(htmlentities( $this->login , ENT_QUOTES ,'UTF-8'));\n\t\t$content\t=\tstripslashes(htmlentities( $this->content , ENT_QUOTES ,'UTF-8'));\n\t\t$date\t\t=\t$this->date;\n\n\t\techo \"<div class='comment'>\\n\";\n\t\t// Not implemented yet.\n\t\tif(false && (CurrentUser::$admin || $login == CurrentUser::$account->login)){\n\t\t\techo \"<div class='delete'>\n\t\t\t\t\t\t\t<form action='?t=Adm&a=CDe' method='post'>\n\t\t\t\t\t\t\t\t<input type='hidden' name='image' value='\".htmlentities(File::a2r($this->file), ENT_QUOTES ,'UTF-8').\"'>\n\t\t\t\t\t\t\t\t<input type='hidden' name='date' value='$date'>\n\t\t\t\t\t\t\t\t<input type='submit' value='x'>\n\t\t\t\t\t\t\t</form>\n\t\t\t\t\t\t</div>\";\n\t\t}\n\t\techo \"<div class='login name'>$login</div>\\n\";\n\t\techo \"<div class='content'>$content</div>\\n\";\n\t\techo \"</div>\\n\";\n\t}",
"function printComment($commentId){\n ?>\n <div class=\"commentContainer\"> \n <?php\n\n $postId = getPostIdofComment($commentId);\n $user = getUserIdPost($postId);\n\n\n echo \"<br>\";\n ?>\n <div class=\"username\">\n <?php\n \n # Username\n $userId = getUserIdComment($commentId);\n echo getUsername($userId) . \"<br>\";\n\n ?> \n </div> \n \n <div class=\"time\">\n <?php\n\n # Time\n $time = getCreationTimeComment($commentId);\n echo getTimeDif($time) . \"<br>\";\n\n ?> \n </div> \n \n <div class=\"contentComment\">\n <?php\n # Content\n echo getContentComment($commentId) . \"<br>\";\n ?>\n </div>\n \n <div class=\"likeBarComment\">\n <?php\n\n # Button with Html Link displayed like a Button: Delete Post\n if (getUserIdComment($commentId) == $_SESSION['userId']) {\n\n ?>\n <div>\n <div class=\"dropdownComment\">\n <button class=\"dropbtnComment\"><img src='../View/Pictures/Icons/icons Options.PNG' alt='Options' width=\"45\" height=\"45\"></button>\n <div class=\"dropdownComment-content\">\n\n <a href='../Controller/functions.php?deleteComment=<?php echo $commentId; ?>&url=<?php echo parse_url($_SERVER[\"REQUEST_URI\"], PHP_URL_PATH); ?>&id=<?php echo $user; ?>'>Delete Comment</a>\n\n </div>\n </div> \n </div>\n <?php\n }\n echo \"<br>\";\n ?>\n </div>\n\n </div> \n <?php\n \n}",
"function tpl_comment( $comment, $args, $depth ) {\n\n\ttpl('item', 'comment', array(\n\t\t'comment' => $comment,\n\t\t'args' => $args,\n\t\t'depth' => $depth\n\t));\n\n}",
"public function comment($comment)\n\t{\n\t\treturn $comment ? \"/* {$comment} */\" : null;\n\t}"
] |
[
"0.64807594",
"0.6228488",
"0.60839254",
"0.59880054",
"0.5922078",
"0.5841764",
"0.5798406",
"0.5753126",
"0.57374626",
"0.5680428",
"0.56754065",
"0.56631947",
"0.5662908",
"0.56453747",
"0.5634299",
"0.5623954",
"0.5623763",
"0.5623763",
"0.56021094",
"0.5588728",
"0.55853724",
"0.5577122",
"0.5574338",
"0.5565841",
"0.55548406",
"0.551972",
"0.54897255",
"0.54770327",
"0.5470947",
"0.5457485"
] |
0.71384794
|
0
|
Returns the boolean state of microdataAdress
|
public function isMicrodataAdress()
{
return $this->microdataAdress;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function readBoolean();",
"public function getBool(): bool;",
"function getIsOn(){\n\t\tglobal $db;\n\t\t$statement = $db->prepare('SELECT isOn FROM bot_on_off LIMIT 1');\n\t\t$statement->execute();\n\t\treturn $statement->fetch()['isOn'] == true;\n\t}",
"public function getDressingFlag()\n {\n $value = $this->get(self::DRESSINGFLAG_);\n return $value === null ? (boolean)$value : $value;\n }",
"public function getIsAddressMatched(): int {\n return $this->is_address_matched;\n }",
"public function getBoolean( Inx_Api_Recipient_Attribute $oAttribute );",
"public static function boolean()\n {\n return self::builtinType('bool');\n }",
"public function hasAddress() {\n return $this->_has(3);\n }",
"function getIsActive() ;",
"public static function boolean() {}",
"function tinc_enabled()\n{\n $mdl = new \\OPNsense\\Tinc\\Tinc();\n\n foreach ($mdl->networks->network->iterateItems() as $network) {\n if ($network->enabled == '1') {\n return true;\n }\n }\n\n return false;\n}",
"public static function boolean()\n {\n return Type::boolean();\n }",
"public function getIsOnNetworkAttribute()\n {\n return $this->networkDataAtcCurrent->exists;\n }",
"function read_boolean(&$payload) {\n return (bool) read_byte($payload);\n}",
"public function toBoolean()\n {\n $key = $this->toLowerCase()->str;\n $map = array(\n 'true' => true,\n '1' => true,\n 'on' => true,\n 'yes' => true,\n 'false' => false,\n '0' => false,\n 'off' => false,\n 'no' => false,\n );\n\n if (array_key_exists($key, $map)) {\n return $map[$key];\n } elseif (is_numeric($this->str)) {\n return ((int) $this->str > 0);\n } else {\n return (bool) $this->regexReplace('[[:space:]]', '')->str;\n }\n }",
"function toBoolean(){\n\t\tif(in_array($this->lower(),array('','false','off','no','n','f'))){\n\t\t\treturn false;\n\t\t}\n\t\treturn (bool)$this->toString();\n\t}",
"function serendipity_ini_bool($var) {\n return ($var === 'on' || $var == '1');\n}",
"public function getOn()\n {\n if (isset($this->a_State['on']))\n {\n return($this->a_State['on']);\n } /* if */\n else\n {\n return(null);\n } /* else */\n }",
"public function is_active(): bool;",
"public function areLedsOn()\n {\n $payload = '';\n\n $data = $this->sendRequest(self::FUNCTION_ARE_LEDS_ON, $payload);\n\n $payload = unpack('C1leds', $data);\n\n return (bool)$payload['leds'];\n }",
"public function booleanLiteral(){\n try {\n // Sparql11query.g:578:3: ( TRUE | FALSE ) \n // Sparql11query.g: \n {\n if ( ($this->input->LA(1)>=$this->getToken('TRUE') && $this->input->LA(1)<=$this->getToken('FALSE')) ) {\n $this->input->consume();\n $this->state->errorRecovery=false;\n }\n else {\n $mse = new MismatchedSetException(null,$this->input);\n throw $mse;\n }\n\n\n }\n\n }\n catch (RecognitionException $re) {\n $this->reportError($re);\n $this->recover($this->input,$re);\n }\n catch(Exception $e) {\n throw $e;\n }\n \n return ;\n }",
"public function getCompound(): bool;",
"public function hasAddress()\n {\n return $this->address !== null;\n }",
"public function isAlive()\n {\n return $this->personState['alive'];\n }",
"public function getIsActive();",
"private function generateBooleanData()\n {\n return $this->faker->boolean() ? \"1\" : \"0\";\n }",
"public function getIsActive(): bool;",
"public function getIsActive(): bool;",
"public function getIsActive(): bool;",
"function bool_from_yn($yn)\n {\n }"
] |
[
"0.62073547",
"0.59223014",
"0.5874524",
"0.5840616",
"0.5772342",
"0.5735298",
"0.5712108",
"0.56853974",
"0.5670812",
"0.56657386",
"0.5650252",
"0.5627116",
"0.5579414",
"0.55777955",
"0.5569634",
"0.55137557",
"0.5486736",
"0.5481068",
"0.5473054",
"0.54687756",
"0.54413813",
"0.54374",
"0.5420198",
"0.53794956",
"0.537302",
"0.53619885",
"0.5356305",
"0.5356305",
"0.5356305",
"0.53473693"
] |
0.70702624
|
0
|
sets the middleName attribute
|
public function setMiddleName($middleName)
{
$this->middleName = $middleName;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getMiddleName()\n {\n return $this->middle_name;\n }",
"function setStudentMiddleName($studentMiddleName) {\n\t\treturn $this->setData('studentMiddleName', $studentMiddleName);\n\t}",
"public function getMiddleName()\n {\n return $this->middleName;\n }",
"public function getMiddleName()\n {\n return $this->middleName;\n }",
"public function getMiddleName()\n {\n return $this->middleName;\n }",
"public function setMiddleName($middleName)\n {\n $this->middleName = $middleName;\n return $this;\n }",
"public function setMiddleName($middle_name)\n {\n $this->middle_name = $middle_name;\n\n return $this;\n }",
"public function getMiddleName() {}",
"function setSupervisorMiddleName($supervisorMiddleName) {\n\t\treturn $this->setData('supervisorMiddleName', $supervisorMiddleName);\n\t}",
"public function setMiddleName(\\horstoeko\\ubl\\entities\\cbc\\MiddleName $middleName)\n {\n $this->middleName = $middleName;\n return $this;\n }",
"function getStudentMiddleName() {\n\t\treturn $this->getData('studentMiddleName');\n\t}",
"public function getMiddleNames ();",
"public function getMiddleName()\n {\n //Parse the name and set it\n $namePieces = preg_split(\"/\\s/\", $this->name);\n if (count($namePieces) == 3) {\n return $namePieces[1];\n }\n return null;\n }",
"function setLastName($newVal)\r\n\t{\r\n\t\t$this->LastName = $newVal;\r\n\t}",
"public function getMiddleName()\n {\n return $this->getProfile() ? $this->getProfile()->getMiddleName() : null;\n }",
"function getSupervisorMiddleName() {\n\t\treturn $this->getData('supervisorMiddleName');\n\t}",
"function getFieldMiddleName($value = null){\n\t\t$form_ret = '';\n\t\t$dataField = get_option('axceleratelink_srms_opt_middleName');\n\t\t$dataTitle = get_option('axceleratelink_srms_opt_tit_middleName');\n\t\t$tooltip = setToolTipNotification('middlename');\n\t\tif ($dataField == 'true'){\n\t\t\t$form_ret .= \"</br><label>\".$dataTitle.(get_axl_req_fields('middle_name') === 'middle_name' ? '<span class=\"red\">*</span>' : '').$tooltip.\"</label></br><input type='text' name='middleName' value='\".$value.\"' id='middleName' class='srms-field \".(get_axl_req_fields('middle_name') === 'middle_name' ? 'input-text-required' : '').\"'></br>\";\t\t\n\t\t}\n\t\treturn $form_ret;\n\t}",
"public function setLastName($newLastName) {\n //sanitize the string\n $newLastName = filter_var($newLastName, FILTER_SANITIZE_STRING);\n \n //if the string got here, it's passed all our tests - assign it!\n $this->lastName = $newLastName;\n }",
"public function setFullNameAttribute($name)\n {\n $parts = explode(' ', $name);\n $this->first_name = $parts[0];\n $this->last_name = $parts[count($parts) - 1];\n }",
"function setLastName($lastName);",
"private function setLastName()\n {\n \tif ( empty($_POST['last_name'] ) ) {\n \t\t$this->data['error']['last_name'] = \"Please provide your last name.\";\n $this->error = true;\n return;\n }\n \n $ln = trim( $_POST['last_name'] );\n \n \tif (preg_match('/^[A-Z \\'.-]{1,40}$/i', $ln)) {\n\t\t\t$this->data['last_name'] = $ln;\n\t\t} else {\n\t\t\t$this->data['error']['last_name'] = \"Your last name can include letters, apostrophes, periods and hyphens.\";\n $this->error = true;\n\t\t}\n }",
"public function setHonoreeFirstName($lastName);",
"public function setLastName(string $last_name);",
"function setName( $family='', $first='', $additional='', $prefix='', $suffix='' )\n {\n $this->properties[\"N\"] = \"$family;$first;$additional;$prefix;$suffix\";\n $this->setFormattedName( trim( \"$prefix $first $additional $family $suffix\" ) );\n }",
"function set_last_name($last_name='*')\r\n{\r\n\t$this->last_name = '';\t\t// return\r\n\t\r\n\t// get random name\r\n\tif ( $last_name == '*' )\r\n\t{\r\n\t\t$this->last_name = $this->_get_random_last_name();\r\n\t}\r\n\telse\r\n\t{\r\n\t\t$this->last_name = $last_name;\r\n\t}\r\n\t\r\n\t// capitalize\r\n\t$this->last_name = ucwords($this->last_name);\r\n\t\r\n\t// tweaks\r\n\tif ( substr($this->last_name, 0, 2) == 'Mc' ) $this->last_name = 'Mc' . ucwords( substr($this->last_name, 2) );\r\n\t\r\n\treturn $this->last_name;\r\n}",
"public function setHonoreeLastName($lastName);",
"public function setLastnameAttribute($value)\n {\n $this->attributes['lastname'] = title_case(trim($value));\n }",
"function setMidTableName($midTableName) {\n $this->midTableName = $midTableName;\n }",
"public function set_full_name($full_name=\"\"){\n $this->full_name = $full_name;\n }",
"private function setNameLocation($newName)\n\t {\n\t $this->nameLocation = $newName;\n\t }"
] |
[
"0.7139385",
"0.71204305",
"0.7039969",
"0.7039969",
"0.7039969",
"0.70280975",
"0.7011664",
"0.6992115",
"0.6699688",
"0.6694389",
"0.6648134",
"0.64145184",
"0.6414481",
"0.6165374",
"0.61342394",
"0.61179656",
"0.61039025",
"0.6060405",
"0.6035471",
"0.6019809",
"0.5996572",
"0.5993193",
"0.5977051",
"0.59341574",
"0.58540535",
"0.58286256",
"0.5811703",
"0.58081657",
"0.579984",
"0.5799324"
] |
0.78728807
|
0
|
sets the longitude attribute
|
public function setLongitude($longitude)
{
$this->longitude = $longitude;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function setLongitude(?float $longitude): void\n {\n $this->longitude['value'] = $longitude;\n }",
"public function setLongitude($longitude) {\n\n $this->longitude = $longitude;\n\n }",
"abstract public function longitude();",
"public function setLon($value)\n {\n return $this->set(self::LON, $value);\n }",
"public function setLon($value)\n {\n return $this->set(self::LON, $value);\n }",
"public function setLongitude($value)\n {\n return $this->set('Longitude', $value);\n }",
"public function setLongitude($value)\n {\n return $this->set('Longitude', $value);\n }",
"public function setLongitude($value)\n {\n return $this->set('Longitude', $value);\n }",
"public function setLongitude($value)\n {\n return $this->set('Longitude', $value);\n }",
"public function get_longitude()\n {\n }",
"public function get_longitude()\n {\n }",
"public function setLongitude($lng)\n {\n $this->longitude = $lng;\n }",
"public function setLongitude($nLongitude) {\n $this->nLongitude = $nLongitude;\n }",
"public function setLongitude($value)\n {\n $this->longitude = $value;\n\n return $this;\n }",
"public function setLongitude($longitude)\n {\n $this->longitude = $longitude;\n\n return $this;\n }",
"public function setLongitude(number $longitude)\n {\n $this->vkarg_longitude = $longitude;\n\n return $this;\n }",
"public function getLongitude_atual(){\n\t\t \treturn $this->longitude_atual;\n\t\t}",
"public function getLongitude(){\r\n\t\treturn $this->longitude;\r\n\t}",
"public function setLng($value)\n {\n $this->lng = $value;\n }",
"public function setLongitude($longitude)\n {\n $this->longitude = $longitude;\n return $this;\n }",
"public function getlongitude()\r\n {\r\n return $this->_longitude;\r\n }",
"public function unsetLongitude(): void\n {\n $this->longitude = [];\n }",
"public function setLongitude($var)\n {\n GPBUtil::checkInt32($var);\n $this->longitude = $var;\n\n return $this;\n }",
"public function getLongitude() {\n return $this->nLongitude;\n }",
"public function getLongitude()\n {\n return $this->longitude;\n }",
"public function setLongitude($var)\n {\n GPBUtil::checkDouble($var);\n $this->longitude = $var;\n\n return $this;\n }",
"public function setLongitude($var)\n {\n GPBUtil::checkDouble($var);\n $this->longitude = $var;\n\n return $this;\n }",
"public function setLon($var)\n {\n GPBUtil::checkDouble($var);\n $this->lon = $var;\n $this->has_lon = true;\n\n return $this;\n }",
"public function setLongitude($v)\n\t{\n\t\tif ($v !== null) {\n\t\t\t$v = (string) $v;\n\t\t}\n\n\t\tif ($this->longitude !== $v) {\n\t\t\t$this->longitude = $v;\n\t\t\t$this->modifiedColumns[] = CidadePeer::LONGITUDE;\n\t\t}\n\n\t\treturn $this;\n\t}",
"public function setLongitude($longitude)\n\t\t\t{\n\t\t\t\t$this->longitude = $longitude;\n\n\t\t\t\treturn $this;\n\t\t\t}"
] |
[
"0.7615567",
"0.7376114",
"0.72872937",
"0.71950495",
"0.71950495",
"0.71677023",
"0.71677023",
"0.71677023",
"0.71677023",
"0.71138495",
"0.7112261",
"0.70749676",
"0.7006854",
"0.69517934",
"0.68020046",
"0.680126",
"0.67163086",
"0.66951776",
"0.6689237",
"0.6674679",
"0.6673888",
"0.667208",
"0.6664101",
"0.66509044",
"0.66436183",
"0.66393954",
"0.66393954",
"0.6533346",
"0.65274096",
"0.6505796"
] |
0.7400527
|
1
|
sets the building attribute
|
public function setBuilding($building)
{
$this->building = $building;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function setBuilding($v)\n {\n if ($v !== null) {\n $v = (string) $v;\n }\n\n if ($this->building !== $v) {\n $this->building = $v;\n $this->modifiedColumns[AliMemberTableMap::COL_BUILDING] = true;\n }\n\n return $this;\n }",
"function setAutobuild($value) {\n $this->autobuild = (bool) $value;\n }",
"public function setBuild(bool $build): self\n {\n return $this->setOption('build', $build);\n }",
"public function setBuildingtype($v)\n {\n if ($v !== null) {\n $v = (string) $v;\n }\n\n if ($this->buildingtype !== $v) {\n $this->buildingtype = $v;\n $this->modifiedColumns[KluBillTableMap::COL_BUILDINGTYPE] = true;\n }\n\n return $this;\n }",
"public function setCbuilding($v)\n {\n if ($v !== null) {\n $v = (string) $v;\n }\n\n if ($this->cbuilding !== $v) {\n $this->cbuilding = $v;\n $this->modifiedColumns[AliMemberTableMap::COL_CBUILDING] = true;\n }\n\n return $this;\n }",
"public function getBuilding()\n {\n return $this->building;\n }",
"public function getBuilding()\n {\n return $this->building;\n }",
"public function set()\n {\n if ( ! $this->value ) {\n $this->generate();\n }\n }",
"public function setBuildingname(string $buildingName)\n {\n $this->Buildingname = $buildingName;\n return $this;\n }",
"public function set()\n {\n\t\tif ($this->model->state())\n $this->model->set();\n }",
"public function getIdBuilding(){\n return $this->idBuilding;\n }",
"function set_attr($attr=array()) {\n $this->other_attr = $attr;\n }",
"protected function build()\n\t{\n\t}",
"public function __SET($attr, $value){ //Establece valor y atributo\n\n\t\t\t$this->$attr=$value;\n\t\t}",
"public function setAttributes();",
"public function setAsBuilder() {\r\n\t\t$this->setFrontEnd(false);\r\n\t\t$this->RenderWhole = true;\r\n\t\t$this->setMenuTemplate(__DIR__ . '/myNavigationBuilder.latte');\r\n\t}",
"public function building()\n {\n return $this->belongsToOne('App\\Building');\n }",
"public function setBuildingName(string $buildingName)\n {\n $this->buildingName = $buildingName;\n\n return $this;\n }",
"public function __set($attribute, $value){\n\t\t$this->$attribute = $value;\n\t}",
"public function building()\n {\n return $this->belongsTo('App\\Building', 'building_id');\n }",
"public function __set($name, $value)\n { \n //set the attribute with the value\n $this->$name = $value;\n }",
"public function getBuildingtype()\n {\n return $this->buildingtype;\n }",
"function __set($attributeToChange, $newValueToAssign) {\n //check that name is valid class attribute\n switch($attributeToChange) {\n case \"name\":\n $this->name = $newValueToAssign;\n break;\n case \"favoriteFood\":\n $this->favoriteFood = $newValueToAssign;\n break;\n case \"sound\":\n $this->sound = $newValueToAssign;\n break;\n default:\n echo $attributeToChange . \" was not found <br>\";\n }\n echo \"Set \" . $attributeToChange . \" to \" . $newValueToAssign . \"<br>\";\n }",
"public function setMinistryAttribute($value)\n {\n $this->attributes['ministry'] = $value ? $value : null;\n }",
"private function doBuildingCommand()\r\n {\r\n $buildingId = $this->getBuildingIdUri();\r\n if ( !$buildingId )\r\n throw new BadrequestException( \"Building id is not given\" );\r\n\r\n $this->getBuildingContainer()->setBuilding( $this->getDaoContainer()->getBuildingDao()->get( $buildingId ) );\r\n if ( !$this->getBuildingContainer()->getBuilding() )\r\n throw new BadrequestException( sprintf( \"Building \\\"%d\\\" does not exist\", $buildingId ) );\r\n\r\n $floorIds = $this->getFloorIdsUri();\r\n $this->getBuildingContainer()->setFloors(\r\n $floorIds ? $this->getDaoContainer()->getFloorBuildingDao()->getList( $floorIds ) : $this->getDaoContainer()->getFloorBuildingDao()->getMainFloors(\r\n array ( $this->getBuildingContainer()->getBuilding()->getId() ) ) );\r\n\r\n foreach ( $this->getTypesUri() as $type )\r\n {\r\n switch ( $type )\r\n {\r\n case self::TYPE_ELEMENTS :\r\n $this->getBuildingContainer()->setElements(\r\n $this->getDaoContainer()->getElementBuildingDao()->getForeign(\r\n $this->getBuildingContainer()->getFloors()->getIds() ) );\r\n break;\r\n case self::TYPE_NAVIGATIONS :\r\n $this->getBuildingContainer()->setNavigations(\r\n $this->getDaoContainer()->getNodeNavigationBuildingDao()->getForeign(\r\n $this->getBuildingContainer()->getFloors()->getIds() ) );\r\n break;\r\n }\r\n }\r\n }",
"public function build ()\n {\n }",
"public function set_attributes()\n {\n $this->id = 0;\n $this->set_process();\n $this->set_decomposition();\n $this->set_technique();\n $this->set_applicability();\n $this->set_input();\n $this->set_output();\n $this->set_validation();\n $this->set_quality();\n $this->score = 0;\n $this->matchScore = 0;\n $this->misMatch = \"\";\n }",
"protected function setArgument()\n {\n $this->set('primary_key', false);\n $this->set('length', $this->argument);\n $this->set('autoincrement', false);\n $this->set('unsigned', false);\n $this->set('not_null', false);\n }",
"function set($attr, $value)\r\n\t{\r\n\t\t$this->$attr = $value;\r\n\t}",
"function definition() {\n\t\tglobal $CFG, $DB;\n\n\t\t$mform =& $this->_form; // Don't forget the underscore!\n\t\t$instance = $this->_customdata;\n\t\t$buildingid = $instance['idbuilding'];\n\t\t$prevaction=$instance['prevaction'];\n\t\t$name = $instance['buildingname'];\n\t\t$modules=$instance['modules'];\n\t\t$places=$instance['place'];\n\t\t$idres = optional_param('building', NULL, PARAM_RAW);\n\t\t$moduleforline = implode('', $modules);\n\t\t$buildingplace = $DB->get_record('bookingrooms_buildings', array('id'=>$buildingid));\n\t\t$placename = $DB->get_record('bookingrooms_campus', array('id'=>$buildingplace->campus_id));\n\t\t\n\t\t\n\t\t$mform->addElement('select', 'campus', get_string('campus', 'local_bookingrooms').': ', $places); //add the select to the campus\n\t\t$mform->setDefault('campus',$placename->id);\n\t\t$mform->setType('campus', PARAM_INT);\n\t\t$mform->addElement('text', 'building',get_string('newbuildingname', 'local_bookingrooms').': ', array('value'=>$name));// Add new edificos\n\t\t$mform->setType('building', PARAM_TEXT);\n\t\t$mform->addElement('hidden', 'testbuilding', $name);\n\t\t$mform->setType('testbuilding', PARAM_TEXT);\n\t\t$mform->addRule('building',get_string('indicatenametobuilding', 'local_bookingrooms').': ','required');\n\t\t$mform->addElement('textarea', 'modules', get_string('modules', 'local_bookingrooms').': ');\n\t\t$mform->setDefault('modules',$moduleforline);\n\t\t$mform->setType('modules', PARAM_TEXT);\n\t\t$mform->addRule('modules', get_string('indicatemodules', 'local_bookingrooms'), 'required');\n\t\t$mform->addElement('static', 'rule', get_string('modulerule', 'local_bookingrooms').': ');\n\t\t$mform->addElement('static', 'condition', get_string('modulecondition', 'local_bookingrooms'));\n\t\t$mform->addElement('hidden','action','edit');\n\t\t$mform->setType('action', PARAM_TEXT);\n\t\t$mform->addElement('hidden','buildingid',$buildingid);\n\t\t$mform->setType('buildingid', PARAM_INT);\n\t\t$mform->addElement('hidden','prevaction',$prevaction);\n\t\t$mform->setType('prevaction', PARAM_INT);\n\t\t$this->add_action_buttons(true,get_string('changebuilding', 'local_bookingrooms'));\n\t}"
] |
[
"0.6386264",
"0.60069185",
"0.57122755",
"0.5684287",
"0.5518838",
"0.54967844",
"0.54967844",
"0.5492813",
"0.54824615",
"0.5359356",
"0.5359114",
"0.5347055",
"0.5303737",
"0.52960134",
"0.5274026",
"0.52713233",
"0.52189547",
"0.5156233",
"0.5146339",
"0.5140044",
"0.5136437",
"0.51198626",
"0.5118401",
"0.51166546",
"0.50818765",
"0.50754446",
"0.5051388",
"0.5043207",
"0.50275594",
"0.5014491"
] |
0.6802345
|
0
|
returns the building attribute
|
public function getBuilding()
{
return $this->building;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getBuildingtype()\n {\n return $this->buildingtype;\n }",
"public function getIdBuilding(){\n return $this->idBuilding;\n }",
"public function getCbuilding()\n {\n return $this->cbuilding;\n }",
"public function getBuildingName() :string\n {\n return $this->buildingName;\n }",
"public function currentBuilding()\n {\n if (! $this->building_id) {\n return null;\n }\n\n return $this->building->applyModifiers([\n 'level' => $this->level,\n 'defense_bonus' => $this->planet->defense_bonus,\n 'construction_time_bonus' => $this->planet->construction_time_bonus,\n 'construction_cost_penalty' => $this->planet->user->penalty_rate,\n ]);\n }",
"public function getAttr(): string\r\n {\r\n return $this->attr;\r\n }",
"public function getBuildingNumber() :string\n {\n return $this->buildingNumber;\n }",
"public function building()\n {\n return $this->belongsToOne('App\\Building');\n }",
"public function getAttrib() {\n return $this->attrib;\n }",
"public function getCustomAttributesAttribute()\n {\n return $this->custom_attributes()->get();\n }",
"public function getAttribute()\n {\n return $this->attribute;\n }",
"public function getAttribute()\n {\n return $this->attribute;\n }",
"public static function get_build()\n {\n }",
"public function getIdentifyingAttribute();",
"public function building()\n {\n return $this->belongsTo('App\\Building', 'building_id');\n }",
"public function get_builder_id()\n {\n return $this->builder_id;\n }",
"public function build()\n\t{\n\t\t$result = '';\n\t\t$attrs = $this->getAll();\n\t\tforeach ($attrs as $attr => $value) {\n\t\t\tif (null === $value) {\n\t\t\t\t$result .= \"$attr \";\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$result .= \"$attr=\\\"$value\\\" \";\n\t\t\t}\n\t\t}\n\n\t\treturn trim($result);\n\t}",
"public function getAttribute(): string\n {\n return $this->attribute;\n }",
"public function building()\n\t{ \n\t\treturn $this->belongsTo(HafizBuilding::class);\n\t}",
"function get_attribute( $key ) {\n\t\treturn isset( $this->attributes[$key] ) ? $this->attributes[$key] : null;\n\t}",
"public function get_attribute($key, $defaut = NULL);",
"public function getAttribute()\r\n {\r\n return $this->getElement()->getEntityAttribute();\r\n }",
"public static function buildingNumber() {\n\t\treturn static::toUpper(static::bothify(static::randomElement(static::$buildingNumber)));\n\t}",
"public function __get($name) {\n if (!isset($this->attributes[$name]) && isset($this->builders[$name])) {\n $this->attributes[$name] = $this->builders[$name]($this);\n }\n\n return $this->attributes[$name];\n }",
"public function getBuildingname(): ?string\n {\n return $this->Buildingname ?? null;\n }",
"public function property(string $name): IAttributeBuilder;",
"function getBuildingInfo() {\n return getOne(\"SELECT * FROM building WHERE id = ?\",[getLogin()['bid']]);\n}",
"public function getCRRALibrary()\n {\n return $this->fields['building'][0];\n }",
"public function getAttributesProperty()\n {\n return Attribute::whereAttributeType(Customer::class)->get();\n }",
"public function getRoomWithTypeAttribute()\n {\n return \"{$this->room->room_with_type}\";\n }"
] |
[
"0.6928334",
"0.6820047",
"0.6756153",
"0.66879165",
"0.65576094",
"0.63487226",
"0.6320311",
"0.62454426",
"0.6223838",
"0.62041456",
"0.6160483",
"0.6160483",
"0.61378056",
"0.61351764",
"0.6115606",
"0.61023",
"0.6070773",
"0.6010017",
"0.59708655",
"0.59581614",
"0.5904272",
"0.58740264",
"0.5857397",
"0.582786",
"0.5821647",
"0.58193344",
"0.58045936",
"0.58041865",
"0.58019054",
"0.5772145"
] |
0.75128424
|
1
|
sets the room attribute
|
public function setRoom($room)
{
$this->room = $room;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function setRoom($room)\n {\n $this->room = (string)$room;\n return $this;\n }",
"function it_gets_and_sets_the_room_id()\n {\n $this->getRoom()->shouldReturn(123456);\n\n // Set the room id\n $this->setRoom(654321);\n\n // Get the current room id\n $this->getRoom()->shouldReturn(654321);\n }",
"public function setId_room($id_room)\n {\n $this->id_room = $id_room;\n\n return $this;\n }",
"public function setRoom(string $roomSidOrName): self {\n $this->room = $roomSidOrName;\n return $this;\n }",
"protected function put() {\n \t// Update room options\n \n }",
"public function edit(Room $room)\n {\n //\n }",
"public function edit(Room $room)\n {\n //\n }",
"public function edit(Room $room)\n {\n //\n }",
"public function setRoomPassword($room, $password = '')\n\t{\n\t\treturn $this->execute('setroompassword', $room . ':setroompassword', array('room' => $room, 'password' => $password));\n\t}",
"public function setIdRoom($idRoom)\n {\n $this->idRoom = $idRoom;\n\n return $this;\n }",
"public function setRoomData(array $roomData)\n {\n $this->roomData = $roomData;\n }",
"public function getRoom()\n {\n return $this->room;\n }",
"function addRoom(\\pl\\dagguh\\buildings\\Room $room);",
"public function edit($room){\r\n $sql=\"UPDATE salas SET nombre_sala=:name,is3d=:is3D,capacidad=:capacity WHERE id_sala=:roomId\";\r\n $parameters[\"name\"]=$room->getName();\r\n $parameters[\"capacity\"]=$room->getCapacity();\r\n $parameters[\"is3D\"]=$room->getIs3D();\r\n $parameters[\"roomId\"]=$room->getId(); \r\n try\r\n {\r\n $this->connection = Connection::getInstance();\r\n return $this->connection->ExecuteNonQuery($sql, $parameters);\r\n }\r\n catch(PDOException $ex)\r\n {\r\n throw $ex;\r\n }\r\n }",
"public function room()\n {\n return $this->belongsTo('App\\Room', 'ROOM_ID' ,'ROOM_ID');\n }",
"public function getId_room()\n {\n return $this->id_room;\n }",
"public function getIdRoom()\n {\n return $this->idRoom;\n }",
"public function room()\n {\n return $this->belongsTo(Room::class, \"room_id\", \"id\");\n }",
"public function setRoom_name($room_name)\n {\n $this->room_name = $room_name;\n\n return $this;\n }",
"public function __SET($attr, $value){ //Establece valor y atributo\n\n\t\t\t$this->$attr=$value;\n\t\t}",
"public function setRoomEntity($roomEntity): self\n {\n $this->roomEntity = $roomEntity;\n\n return $this;\n }",
"public function update(RoomRequest $request, Room $room)\n {\n $data = $request->only(array_keys($request->rules()));\n $room->fill($data);\n $room->save();\n return redirect()->route('rooms.index')\n ->with('message','Sala alterada com sucesso!');\n }",
"public function update(Request $request, Room $room)\n {\n //\n }",
"public function update(Request $request, Room $room)\n {\n //\n }",
"public function update(Request $request, Room $room)\n {\n //\n }",
"public function setRole(?OnlineMeetingRole $value): void {\n $this->getBackingStore()->set('role', $value);\n }",
"public function getRoom_name()\n {\n return $this->room_name;\n }",
"function roommate(){\n \treturn $this->belongsTo('App\\Roommate');\n }",
"public function getRoom()\n {\n return $this->hasOne(Room::className(), ['id' => 'room_id']);\n }",
"public function getRoom()\n {\n return $this->hasOne(Room::className(), ['id' => 'room_id']);\n }"
] |
[
"0.71970046",
"0.63591516",
"0.6323128",
"0.6299412",
"0.6132031",
"0.6004412",
"0.6004412",
"0.6004412",
"0.5941713",
"0.5873045",
"0.5806969",
"0.5780026",
"0.56965244",
"0.56106573",
"0.5586913",
"0.55191183",
"0.55040455",
"0.5467623",
"0.54494834",
"0.5409776",
"0.5370723",
"0.52816474",
"0.5277187",
"0.5277187",
"0.5277187",
"0.5254828",
"0.52482027",
"0.51743984",
"0.51657087",
"0.51657087"
] |
0.789396
|
0
|
returns the room attribute
|
public function getRoom()
{
return $this->room;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getRoom_name()\n {\n return $this->room_name;\n }",
"public function getId_room()\n {\n return $this->id_room;\n }",
"public function getRoomWithTypeAttribute()\n {\n return \"{$this->room->room_with_type}\";\n }",
"public function getIdRoom()\n {\n return $this->idRoom;\n }",
"public function getRoom()\n {\n return $this->hasOne(Room::className(), ['id' => 'room_id']);\n }",
"public function getRoom()\n {\n return $this->hasOne(Room::className(), ['id' => 'room_id']);\n }",
"public function getRoom($r) {\n return $this->rooms[$r];\n }",
"public function getRoomId()\n {\n return $this->baseEvent->getRoomId();\n }",
"public function getRoomEntity()\n {\n return $this->roomEntity;\n }",
"public function room()\n {\n return $this->hasOne('App\\Entities\\Room', 'id_categoria_habitacion', 'room_category_id');\n }",
"public function room()\n {\n return $this->belongsTo(Room::class, \"room_id\", \"id\");\n }",
"public function room_ac()\n {\n return $this->hasOne(RoomAc::class);\n }",
"public function room()\n {\n return $this->belongsTo('App\\Room', 'ROOM_ID' ,'ROOM_ID');\n }",
"public function getCurrentRoom()\n {\n return $this->dungeon_map[$this->user_position[self::ROW_KEY]][$this->user_position[self::COLUMN_KEY]];\n }",
"public function get_room_at($resource_index){\n return $this->open_rooms[$resource_index];\n }",
"public function getAttr(): string\r\n {\r\n return $this->attr;\r\n }",
"function getClassroomId() {\n\t\treturn $this->classroom_id;\n\t}",
"final function getClassroom_id() {\n\t\treturn $this->getClassroomId();\n\t}",
"public function getRooms()\n {\n return $this->_rooms;\n }",
"public function getAttrib() {\n return $this->attrib;\n }",
"protected function _getRoomId()\n {\n $roomId = $this->_getParam('id');\n if ( ! $roomId) {\n $this->badRequestAction();\n }\n \n return $roomId;\n }",
"public function getAttribute(): string\n {\n return $this->attribute;\n }",
"function get_room_id($name) {\n global $DB;\n\n return $DB->get_record('roomscheduler_rooms', array('name' => $name));\n}",
"public function getAttribute()\n {\n return $this->attribute;\n }",
"public function getAttribute()\n {\n return $this->attribute;\n }",
"public function get_attribute($field){\n\t\treturn $this->{$field};\n\t}",
"function getClassroom() {\n\t\treturn $this->getClassroomRelatedByClassroomId();\n\t}",
"public function model()\n {\n return Room::class;\n }",
"public function getRoomTypeCode()\n {\n return $this->roomTypeCode;\n }",
"public function getPropertyDetails(){\n $objectManager = \\Magento\\Framework\\App\\ObjectManager::getInstance ();\n return $objectManager->get ( 'Apptha\\Airhotels\\Model\\Attributes' );\n }"
] |
[
"0.7381183",
"0.736099",
"0.7209089",
"0.71283317",
"0.6980943",
"0.6980943",
"0.6817425",
"0.66326666",
"0.66019595",
"0.644304",
"0.63499427",
"0.62407887",
"0.62368745",
"0.6234638",
"0.6179508",
"0.6148479",
"0.6056378",
"0.6002739",
"0.5920239",
"0.58789104",
"0.5850902",
"0.5810133",
"0.57772726",
"0.5764123",
"0.5764123",
"0.57540435",
"0.57216805",
"0.57023",
"0.5693238",
"0.5686289"
] |
0.7834874
|
0
|
sets the www attribute
|
public function setWww($www)
{
$this->www = $www;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function setSiteUrl()\n {\n }",
"public function getWww()\n {\n return $this->www;\n }",
"public function setWebsite($val)\n {\n $this->_propDict[\"website\"] = $val;\n return $this;\n }",
"public function setWebsite($uri);",
"function setWebsiteS(string $websiteS): void{\n\t\t$this->websiteS = $websiteS;\n\t}",
"public function hasWWW() : bool {\n $host = $this->getHost();\n $www = substr($host, 0, 3);\n\n return $www == 'www';\n }",
"private function setWebsiteValue()\n {\n $value = $this->getData(self::$websiteAttributeCode);\n $list = $this->storeManager->getWebsites();\n $this->setCustomAttribute(self::$websiteAttributeCode, $list[$value]->getName());\n $this->setCustomAttribute(self::$websiteIdAttributeCode, $value);\n }",
"public function forceWwwUrl() {\n\t\t// read the host from the server environment\n\t\t$host = env('HTTP_HOST');\n\t\tif ($host == 'localhost') {\n\t\t\treturn true;\n\t\t}\n\n\t\t// clean up the host\n\t\t$host = strtolower($host);\n\t\t$host = trim($host);\n\n\t\t// some apps request with the port\n\t\t$host = str_replace(':80', '', $host);\n\t\t$host = str_replace(':8080', '', $host);\n\t\t$host = trim($host);\n\n\t\t// if the host is not starting with www. redirect the\n\t\t// user to the same URL but with www :-)\n\t\tif (!strpos($host, 'www')) {\n\t\t\t$this->redirect('www' . $host);\n\t\t}\n\t}",
"protected function setUrl() {\r\n\t\t$this->url = htmlspecialchars(t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'), ENT_QUOTES);\r\n\t}",
"function site($url) {\n\t\t$this->url = $url;\n\t}",
"public function setWebsite($website)\n {\n $this->website = $website;\n }",
"public function getWww() {}",
"private function setHost()\n {\n $urlE = $this->explodedUrl;\n\n $this->host = $urlE[2];\n }",
"public function setUrl($str){\n\t\t$this->url = $str;\n\t\t$tmp=parse_url($this->url); // heroku refuses to make direct dereference\n\t\t$host = $tmp['host'];\n\t\tforeach ($this->supportedHosts as $supportedHost) {\n\t\t\tif($host === $supportedHost){\n\t\t\t\t$this->host = $supportedHost;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}",
"public function getWwwPath()\n\t{\n\t\treturn $this->www_path;\n\t}",
"function set_market_url($website)\n{\n\n if ($website) {\n\n if (strpos($website, 'http') !== false) {\n\n $pre_url = '';\n\n } else {\n\n $pre_url = 'http://';\n }\n\n $website = '<a href=\"' . $pre_url . $website . '\" target=\"_blank\">Website</a>';\n\n } else {\n\n $website = '';\n\n }\n\n return $website;\n}",
"public static function setWebsiteURL($paramURL){\n getDatabase()->update(\"settings\",array(\n \"value\" => $paramURL\n ), \"setting = 'website_url'\");\n Cache::store('website_url', $paramURL);\n }",
"function webworth() \r\n{\r\n$url = 'www.webworth.info/'.$host;\r\n$host = $_SERVER['HTTP_HOST'];\r\n\r\necho '<a href=\"http://www.webworth.info/'.$host.'\" target=\"_blank\" rel=\"follow\"><img src=\"http://www.webworth.info/'.$host.'/sitewidget.gif\" alt=\"Website Value\" /></a>';\r\n}",
"public function getWebsite(){\r\n\t\t\treturn $this->website;\r\n\t\t}",
"public function __https()\n{\n\tif(strpos($_SERVER['HTTP_HOST'],'www') === false or !isset($_SERVER['HTTPS']))\n\t{\n\t\theader('Location: '._https);\n\t\texit(0);\n\t}\n}",
"function htaccess(){\r\n\t}",
"protected function setSiteName() {\r\n\t\t$this->siteName = trim($this->settings['site']['siteName']);\r\n\t}",
"public function isWww(): bool {\n\t\treturn Opton::get('0', ($subdomains = explode('.', $this->getHost()))) === 'www' && count($subdomains) === 3;\n\t}",
"public function setWebsite($v)\n {\n if ($v !== null) {\n $v = (string) $v;\n }\n\n if ($this->website !== $v) {\n $this->website = $v;\n $this->modifiedColumns[] = EventPeer::WEBSITE;\n }\n\n\n return $this;\n }",
"public function __construct(bool $www = false)\n {\n $this->www = $www;\n }",
"private function setHttpHosts() {\n\n\t\t$this->httpHosts = array(\n\t\t\t'frontend'=>'http://'.t3lib_div::getIndpEnv('HTTP_HOST').'/',\n\t\t\t'backend'=>'http://'.t3lib_div::getIndpEnv('HTTP_HOST').'/',\n\t\t);\n\t}",
"public function setWwwPath($www_path)\n\t{\n\t\t$this->www_path = $www_path;\n\n\t\treturn $this;\n\t}",
"public function setUrlAttribute($value)\n\t{\n\t\t$this->attributes['url'] = strtolower($value);\n\t\tif ($value != '' && substr($value, 0, 4) != 'http') {\n\t\t\t$this->attributes['url'] = 'http://'.$value;\n\t\t}\n\t}",
"public function setUrl($value)\n\t\t{\n\t\t\t$url = parse_url((strpos($value, \"://\") === false ? \"http://{$value}\" : $value));\n\t\t\t\n\t\t\t// Set url defaults if they have been left out\n\t\t\tif(!isset($url['scheme'])) $url['scheme'] = 'http';\n\t\t\tif(!isset($url['path'])) $url['path'] = '/';\n\t\t\t\n\t\t\t// Correct parsed url further\n\t\t\tif(!isset($url['host']))\n\t\t\t{\n\t\t\t\t// If host couldent be parsed, this must mean that there is no\n\t\t\t\t// seperation between host and path. ex www.test.com(path left out).\n\t\t\t\t$url['host'] = str_replace(\"/\", \"\", $url['path']);\n\t\t\t\t$url['path'] = '/';\n\t\t\t}\n\t\t\t\n\t\t\t// Set host header\n\t\t\t$this->_headers->set(new HttpHeaderItem(\"Host\",\n\t\t\t\t$url['host'] . (string)(@$url[\"port\"] == null ? \"\" : \":\" . $url['port'])));\n\t\t\t\n\t\t\t// Store parsed url\n\t\t\t$this->_url = $url;\n\t\t}",
"public function render($www = '') {\n\n // remove http or https\n $www = preg_replace('#^https?://#', '', $www);\n\n // return clean www\n if(substr_count($www,'/') > 0) {\n return substr($www, 0, stripos($www,'/'));\n } else {\n return $www;\n }\n\t}"
] |
[
"0.6796747",
"0.6563193",
"0.6443645",
"0.6322359",
"0.6233604",
"0.6206018",
"0.62003464",
"0.6023501",
"0.599406",
"0.5929153",
"0.58990055",
"0.5888745",
"0.5888548",
"0.57971174",
"0.5782571",
"0.5757156",
"0.5747267",
"0.57394004",
"0.5731308",
"0.56471175",
"0.5641395",
"0.5635532",
"0.56299096",
"0.5620577",
"0.55993074",
"0.559214",
"0.55771",
"0.5569524",
"0.5559164",
"0.5554673"
] |
0.7761134
|
0
|
returns the www attribute
|
public function getWww()
{
return $this->www;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getWebsiteAttribute()\n {\n return $this->sanitizeWebsite($this->attributes['website']);\n }",
"public function getWebsite(){\r\n\t\t\treturn $this->website;\r\n\t\t}",
"public function getWebsite()\n {\n if (array_key_exists(\"website\", $this->_propDict)) {\n return $this->_propDict[\"website\"];\n } else {\n return null;\n }\n }",
"public function getWebsite()\n\t{\n\t\treturn $this->website;\n\t}",
"public function getWww() {}",
"public function getWebsite()\n {\n return $this->website;\n }",
"public function getWebsite()\n {\n return $this->website;\n }",
"public function getWebsite()\n {\n return $this->website;\n }",
"public function getWebsiteURL() {\n return $this->getChaveValor('WEBSITE_URL');\n }",
"public function getWebsite();",
"public function getWebsite()\n {\n return isset($this->website) ? $this->website : null;\n }",
"public function getWebsiteUrl() {\n\n return $this->website_url;\n\n }",
"public function getUserWebsite(){\n return($this->userWebsite);\n }",
"public function getWwwPath()\n\t{\n\t\treturn $this->www_path;\n\t}",
"public function website() {\n\t\treturn $this->webpage;\n\t}",
"public function getSiteURL()\r\n {\r\n return $this->siteURL;\r\n }",
"public static function getWebsiteURL(){\n if(Cache::isStored('website_url'))return Cache::get('website_url'); \n $row = getDatabase()->queryFirstRow(\"SELECT `value` FROM `settings` WHERE `setting` = 'website_url'\");\n $url = $row['value'];\n #http:// prefix\n if(!is_numeric(strpos($url, \"http://\"))){\n $url = 'http://' . $url;\n }\n #/ suffix\n if(substr($url, -1) != '/'){\n $url .= '/';\n }\n Cache::store('website_url', $url);\n return $url;\n }",
"public function getWebUrl()\n {\n return $this->getProperty(\"WebUrl\");\n }",
"public function getHostname() {\n return @$this->attributes['hostname'];\n }",
"public function getServerUrl()\n { \n return $this->_shoptimallyDomain;\n }",
"public function getUrl() {\n\t\treturn $this->siteURL;\n\t}",
"public function site(){\n return $this->site;\n }",
"function trueSiteUrl() {\n\t\treturn $GLOBALS[\"trueSiteUrl\"];\n\t}",
"public function getSiteHost();",
"public function getWebsite(): ?string;",
"public function hasWWW() : bool {\n $host = $this->getHost();\n $www = substr($host, 0, 3);\n\n return $www == 'www';\n }",
"public static function getWebsiteName(){\n if(Cache::isStored('website_name'))return Cache::get('website_name'); \n $row = getDatabase()->queryFirstRow(\"SELECT `value` FROM `settings` WHERE `setting` = 'website_name'\");\n $name = $row['value'];\n Cache::store('website_name', $name);\n return $name;\n }",
"public function siteUrl() {}",
"public function website_name(){\r\n\r\n echo ISSET($this->globalSettings->website_name)?$this->globalSettings->website_name:'';\r\n\r\n }",
"public function site() {\n return $this->site;\n }"
] |
[
"0.7269561",
"0.7160661",
"0.70780647",
"0.70525694",
"0.7027831",
"0.69992083",
"0.69992083",
"0.69992083",
"0.69855565",
"0.6806791",
"0.676768",
"0.6707591",
"0.6690853",
"0.6573932",
"0.64944804",
"0.64118606",
"0.6382563",
"0.6363721",
"0.6356134",
"0.6329755",
"0.62106854",
"0.61821425",
"0.61699075",
"0.6148986",
"0.61468023",
"0.6145737",
"0.6138057",
"0.6132311",
"0.6125519",
"0.609647"
] |
0.7696881
|
0
|
sets the Skype attribute
|
public function setSkype($skype)
{
$this->skype = $skype;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getSkype()\n {\n return $this->skype;\n }",
"public function setSoundType ($typ) {\n\t\tif (ctype_digit ($typ))\n\t\t\t$this->soundType = $typ;\n\t\telse if (!is_null($this->soundTypeMap[$typ]))\n\t\t\t$this->soundType = $this->soundTypeMap[$typ];\n\t}",
"function setSwimMeet($swimmeet)\r\n {\r\n $this->_swimmeet = $swimmeet ;\r\n }",
"public function setSoundSubtype ($typ) {\n\t\t$GLOBALS[\"logger\"]->debug(\"setSoundSubtype: $typ\");\n\t\tif (ctype_digit ($typ))\n\t\t\t$this->soundSubtype = $typ;\n\t\telse if (!is_null($this->soundSubtypeMap[$typ]))\n\t\t\t$this->soundSubtype = $this->soundSubtypeMap[$typ];\n\t}",
"public function setFont($font) {}",
"#[@fromDia(xpath= 'dia:attribute[@name=\"font\"]/dia:font', value= 'font')]\n public function setTextFont($font) {\n $this->setFont('font', $font);\n }",
"function __set ($name, $value)\n\t{\n\t\tswitch ($name) {\n\t\t\tcase \"background\":\n\t\t\t\t$this->_setProperty($name, $value);\n\t\t\tbreak;\n\t\t\tcase \"bgColor\":\n\t\t\tcase \"link\":\n\t\t\tcase \"vLink\":\n\t\t\tcase \"aLink\":\n\t\t\tcase \"text\":\n\t\t\t\t$this->_setProperty($name, $value, \"bool\");\n\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tparent::__set($name, $value);\n\t\t\tbreak;\n\t\t}\n\t}",
"public function setWindowsSkus(?array $value): void {\n $this->getBackingStore()->set('windowsSkus', $value);\n }",
"public function setFontWoffData($data);",
"public function setAttributes();",
"function setShape($a_shape)\n\t{\n\t\t$this->shape = $a_shape;\n\t}",
"public function setPhoneAttribute($value)\n {\n if (!empty($value)) {\n $this->attributes['phone'] = $this->mayaEncrypt($value);\n }\n }",
"public function setAttribute($name, $value)\n\t\t{\n\t\t\tswitch(strtolower($name))\n\t\t\t{\n\t\t\t\tcase 'mode':\n\t\t\t\t\t$this->setDisplayMode($value);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tparent::setAttribute($name, $value);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"public function setFont($font, $size) {\n\t\t$this->_font=$font;\n\t\t$this->_fontSize=$size;\n\t}",
"public function setSpeakerUid($value)\n {\n return $this->set(self::_SPEAKER_UID, $value);\n }",
"public function setName()\n {\n $this->_role->name = '伊泽瑞尔';\n }",
"public function setFont($size, $name) {\n\t\t$this->fontSize = $size;\n\t\t$this->fontName = $name;\n\t}",
"private function set_device(){\n\t\n\t}",
"public function setAttribute($type, $value)\n {\n $this->attributes[$type] = $value;\n }",
"public function setSkus($s)\n {\n if (is_string($s)) {\n $s = [$s];\n }\n if (is_array($s)) {\n $this->resetASINs();\n $this->resetSKUs();\n $i = 1;\n foreach ($s as $x) {\n $this->options['SellerSKUList.Id.'.$i] = $x;\n $i++;\n }\n } else {\n return false;\n }\n }",
"function wp_kses_hair($attr, $allowed_protocols)\n {\n }",
"public function setName()\n {\n $this->_role->name = '奥巴马';\n }",
"protected function set_type() {\n\t\t$this->type = 'kirki-color';\n\t}",
"public function set($name, $value){\n\t\t$_SESSION['tmobi'][$name] = $value;\n\t}",
"public function __set($attr_playlist_name, $attr_val) {\r\n if (property_exists(__CLASS__, $attr_playlist_name)) {\r\n $this->$attr_playlist_name = $attr_val;\r\n }\r\n }",
"function set_attr($attr=array()) {\n $this->other_attr = $attr;\n }",
"function set_screen_options()\n {\n }",
"public function setType($type)\n {\n parent::setAttr(\"type\", $type);\n }",
"public function setHypeUserId($hypeUserId) {\n\t\t$this->hypeUserId = $hypeUserId;\n\t}",
"public function setCallSignature(string $call_sig):void{\n\t\t$this->call_sig = $call_sig;\n\t }"
] |
[
"0.64360106",
"0.5360839",
"0.51810896",
"0.51673484",
"0.5047819",
"0.4973028",
"0.4957092",
"0.49377328",
"0.49316448",
"0.4913234",
"0.4908118",
"0.48766753",
"0.48595825",
"0.48453915",
"0.4820496",
"0.4806761",
"0.47650525",
"0.47495142",
"0.4738293",
"0.47273207",
"0.469121",
"0.46882868",
"0.4665974",
"0.46598682",
"0.46598",
"0.4653524",
"0.46524355",
"0.46523014",
"0.46467286",
"0.464411"
] |
0.70952123
|
0
|
returns the Skype attribute
|
public function getSkype()
{
return $this->skype;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getAttributeName(): string\n {\n return 'Sender';\n }",
"function GetAttributes();",
"public function getWinger()\n {\n if ($this->isSkillsAvailable()) {\n return $this->getXml()->getElementsByTagName('WingerSkill')->item(0)->nodeValue;\n }\n return null;\n }",
"public function getAttributes()\n {\n return $this->getValueJSONDecoded('nb_icontact_prospect_attributes');\n }",
"public function getSpeakerUid()\n {\n return $this->get(self::_SPEAKER_UID);\n }",
"public function getIdentifyingAttribute();",
"public function getPlaymaker()\n {\n if ($this->isSkillsAvailable()) {\n return $this->getXml()->getElementsByTagName('PlaymakerSkill')->item(0)->nodeValue;\n }\n return null;\n }",
"public function getAttrib() {\n return $this->attrib;\n }",
"public function getDeviceAttributes() {}",
"public static function supportedAttributes();",
"public function getAttribute($name)\n {\n //if (isset($this->attributes[$name])) return $this->attributes[$name];\n //else return null;\n if(isset($_SESSION[$name]))\n return $_SESSION[$name];\n else\n return null;\n }",
"protected function xpathAttrib()\n { if ($this->namespace == '*') {\n return '@'.$this->attrib;\n }\n\n return sprintf('@%s:%s', $this->namespace, $this->attrib);\n }",
"public function getAttribute($name);",
"public function getAttribute($type)\n {\n return $this->attributes[$type];\n }",
"public function getAttr(): string\r\n {\r\n return $this->attr;\r\n }",
"public function getExtensionAttributes();",
"public function getExtensionAttributes();",
"public function getExtensionAttributes();",
"public function getExtensionAttributes();",
"public function getExtensionAttributes();",
"public function getExtensionAttributes();",
"public function getExtensionAttributes();",
"public function getExtensionAttributes();",
"public function getExtensionAttributes();",
"public function getExtensionAttributes();",
"public function getExtensionAttributes();",
"public function getExtensionAttributes();",
"public function getExtensionAttributes();",
"public function getExtensionAttributes();",
"public function getSsl() {\n return @$this->attributes['ssl'];\n }"
] |
[
"0.5383808",
"0.5356875",
"0.5239471",
"0.52353203",
"0.5228781",
"0.5224491",
"0.5205744",
"0.51868135",
"0.51776636",
"0.5172952",
"0.515826",
"0.5153727",
"0.51339024",
"0.5119111",
"0.50583917",
"0.50332314",
"0.50332314",
"0.50332314",
"0.50332314",
"0.50332314",
"0.50332314",
"0.50332314",
"0.50332314",
"0.50332314",
"0.50332314",
"0.50332314",
"0.50332314",
"0.50332314",
"0.50332314",
"0.5017719"
] |
0.73733634
|
0
|
sets the twitter attribute
|
public function setTwitter($twitter)
{
if (substr($twitter, 0, 1) !== '@') {
throw new \InvalidArgumentException('twitter name must start with @', 1357530444);
}
$this->twitter = $twitter;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function setTwitterUsername($twitterUsername)\n {\n $this->twitterUsername = $twitterUsername;\n }",
"public function setTwitter($v)\n\t{\n\t\tif ($v !== null) {\n\t\t\t$v = (string) $v;\n\t\t}\n\n\t\tif ($this->twitter !== $v) {\n\t\t\t$this->twitter = $v;\n\t\t\t$this->modifiedColumns[] = VenuePeer::TWITTER;\n\t\t}\n\n\t\treturn $this;\n\t}",
"public function get_twitter() {\r\n return $this->twitter;\r\n }",
"public function twitterAction()\r\n {\r\n if(!($userInfo = Mage::getSingleton('customer/session')\r\n ->getSocialLogonTwitterUserinfo()) || !$userInfo->hasData()) {\r\n \r\n $userInfo = Mage::getSingleton('SocialLogon/twitter_info_user')\r\n ->load();\r\n\r\n Mage::getSingleton('customer/session')\r\n ->setSocialLogonTwitterUserinfo($userInfo);\r\n }\r\n\r\n Mage::register('SocialLogon_twitter_userinfo', $userInfo);\r\n\r\n $this->loadLayout();\r\n $this->renderLayout();\r\n }",
"public function twitterAction()\n {\n if(!($userInfo = Mage::getSingleton('customer/session')\n ->getInchooSocialconnectTwitterUserinfo())) {\n $userInfo = Mage::getSingleton('rootinfo_socialconnect/twitter_userinfo')\n ->getUserInfo();\n \n Mage::getSingleton('customer/session')->setInchooSocialconnectTwitterUserinfo($userInfo);\n }\n \n Mage::register('rootinfo_socialconnect_twitter_userinfo', $userInfo);\n \n $this->loadLayout();\n $this->renderLayout();\n }",
"public function getTwitter()\n {\n return $this->twitter;\n }",
"public function getTwitter()\n\t{\n\t\treturn $this->twitter;\n\t}",
"public function tweet($tweet) {\n $this->_tweet = htmlspecialchars($tweet, ENT_QUOTES, 'UTF-8');\n }",
"public function setTwitterId($twitterId)\n {\n $this->twitterId = $twitterId;\n }",
"public static function twitter()\n {\n return 'twitter';\n }",
"public function tweet() {\r\n\t\tif ($this->feed->tweet != 1 || $this->tweeted == 1) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t$this->save();\r\n\t\t$url = 'http://'.$_SERVER['HTTP_HOST'].$this->get_url();\t\r\n\t\t$tweet = text::limit_chars($this->feed->tweet_desc.' '.$this->title,118,'...',TRUE).' '.$url;\r\n\t\tzest::update_status($tweet);\r\n\t\t$this->tweeted = 1;\r\n\t\t$this->save();\r\n\t}",
"public function setTwitterAccount($account)\n {\n $this->_twitterAccount = $account;\n return $this;\n }",
"public function twitter(string $name, ?string $value)\n\t\t{\n\t\t\t$this->add($name, $value, 'twitter');\n\t\t\treturn $this;\n\t\t}",
"public function getTwitterId()\n {\n return $this->twitterId;\n }",
"public function unlinkTwitter() {\n $this->setOauthToken(NULL);\n $this->setOauthTokenSecret(NULL);\n $this->setScreenName(NULL);\n $this->setTwitterId(NULL);\n }",
"public function getTwitterUrl()\n {\n return $this->twitter_url;\n }",
"public function getTwitterIdentifier()\n {\n return $this->_getIdentifier('twitter');\n }",
"public function getTwitterUsername()\n {\n return $this->twitterUsername;\n }",
"public function setTwitterAccessToken($twitterAccessToken)\n {\n $this->twitterAccessToken = $twitterAccessToken;\n }",
"public function setTwitterUrl($var)\n {\n GPBUtil::checkString($var, True);\n $this->twitter_url = $var;\n }",
"public function saving(Tweet $tweet){\n $tweet->user_id = request()->user()->id;\n }",
"public function twitter() {\n $user_id = $this->Session->read('Auth.User.id');\n //twitter object\n $twitter = new TwitterOAuth($this->Twitter->CONSUMER_KEY, $this->Twitter->CONSUMER_SECRET);\n //if a request for process\n if (isset($_GET['type_request']) && $_GET['type_request'] === 'twitter') {\n //new user profile request\n $user_access_data = $twitter->oauth('oauth/access_token', array('oauth_token' => $_GET['oauth_token'], 'oauth_verifier' => $_GET['oauth_verifier']));\n //create user's oauth object\n $post = new TwitterOAuth($this->Twitter->CONSUMER_KEY, $this->Twitter->CONSUMER_SECRET, $user_access_data['oauth_token'], $user_access_data['oauth_token_secret']);\n //get user's profile\t\t\n $profile = $post->get(\"users/lookup\", array('user_id' => $user_access_data['user_id']));\n //Save profile\n $save['uid'] = $user_id;\n $save['tw_id'] = $profile[0]->id;\n $save['access_token'] = $user_access_data['oauth_token'];\n $save['access_token_secret'] = $user_access_data['oauth_token_secret'];\n $save['name'] = $profile[0]->name;\n $save['screeen_name'] = $profile[0]->screen_name;\n $save['followers_count'] = $profile[0]->friends_count;\n $save['followedby_count'] = $profile[0]->followers_count;\n $save['p_picture'] = $profile[0]->profile_image_url;\n $save['link'] = $profile[0]->url;\n $save['timezone'] = $profile[0]->time_zone;\n //if exists\n if ($this->Twitter->newProfile($user_id, $profile[0]->id)) {\n //Save and redirect\n if ($this->Twitter->save($save)) {\n //Redirect user added\n $this->Session->setFlash(__(\"Profile saved.\"), 'cake-success');\n $this->redirect(array('action' => 'index'));\n }\n //WTF happened...\n else {\n $this->Session->setFlash(__(\"Something went wrong saving Twitter profile! Please try again later.\"), 'cake-error');\n $this->redirect(array('action' => 'index'));\n }\n } else {\n //User exists.\n // When validation fails or other local issues\n $this->Session->setFlash(__(\"User already linked! Logout from Twitter and login with a diffrent account.\"), 'cake-error');\n $this->redirect(array('action' => 'index'));\n }\n } else {\n //Request for approval\n // create a link\n $tokens = $twitter->oauth('oauth/request_token', array('oauth_callback' => $this->Twitter->OAUTH_CALLBACK));\n //get token's\n $app_oauth_token = $tokens['oauth_token'];\n $app_oauth_token_secret = $tokens['oauth_token_secret'];\n //if successful\n //build url \t\t\n $url = $twitter->url('oauth/authorize', array('oauth_token' => $app_oauth_token, 'oauth_callback' => $this->Twitter->OAUTH_CALLBACK));\n //redirect\n $this->redirect($url);\n }\n }",
"public function twitter()\n\t{\n\t\t$this->load->library('twitter/twitter');\n\n\t\t// Try to authenticate\n\t\t$auth = $this->twitter->oauth($this->settings->item('twitter_consumer_key'), $this->settings->item('twitter_consumer_key_secret'), $this->user->twitter_access_token, $this->user->twitter_access_token_secret);\n\n\t\tif ($auth!=1 && $this->settings->item('twitter_consumer_key') && $this->settings->item('twitter_consumer_key_secret'))\n\t\t{\n\t\t\tif (isset($auth['access_token']) && !empty($auth['access_token']) && isset($auth['access_token_secret']) && !empty($auth['access_token_secret']))\n\t\t\t{\n\t\t\t\t// Save the access tokens to the users profile\n\t\t\t\t$this->ion_auth->update_user($this->user->id, array(\n\t\t\t\t\t'twitter_access_token' \t\t => $auth['access_token'],\n\t\t\t\t\t'twitter_access_token_secret' => $auth['access_token_secret'],\n\t\t\t\t));\n\n\t\t\t\tif (isset($_GET['oauth_token']) )\n\t\t\t\t{\n\t\t\t\t\t$parts = explode('?', $_SERVER['REQUEST_URI']);\n\n\t\t\t\t\t// redirect the user since we've saved their info\n\t\t\t\t\tredirect($parts[0]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telseif ($auth == 1) {\n\t\t\tredirect('edit-settings', 'refresh');\n\t\t}\n\t}",
"public function twitter_connect() {\n $profile = $this->params['profile'];\n $merchant_id = $this->params['merchant_id'];\n $account_dbobj = $this->params['account_dbobj'];\n\n $twitter_user = new TwitterUser($account_dbobj);\n $twitter_user->findOne('id='.$merchant_id);\n $twitter_user->setProfileImageUrl($profile['profile_image_url']);\n $twitter_user->setUrl($profile['url']);\n $twitter_user->setLocation($profile['location']);\n $twitter_user->setName($profile['name']);\n $twitter_user->setScreenName($profile['screen_name']);\n $twitter_user->setId($profile['id']);\n $twitter_user->save();\n\n $merchant = new Merchant($account_dbobj);\n BaseMapper::saveAssociation($merchant, $twitter_user, $account_dbobj);\n\n $this->status = 0;\n }",
"public function run()\n {\n \\Setting::Lang('ar')->set('twitter','shari__sa');\n }",
"protected function setup_tweet_data() {\n\t\t$this->text = str_replace( ''', '\\'', $this->raw_data->text );\n\t\t$this->text = $this->remove_emoji( $this->text );\n\t\t$this->add_links_to_text();\n\n\t\t$this->link = \"https://twitter.com/{$this->raw_data->user->name}/status/{$this->raw_data->id_str}\";\n\t\t$this->timestamp = strtotime( $this->raw_data->created_at );\n\n\t\tif ( isset( $this->raw_data->retweeted_status ) ) {\n\t\t\t$this->image = $this->raw_data->retweeted_status->user->profile_image_url;\n\t\t} else {\n\t\t\t$this->image = $this->raw_data->user->profile_image_url;\n\t\t}\n\n\t\t// clear from the retweeted status text\n\t\tif ( ! empty( $this->raw_data->retweeted_status->text ) ) {\n\t\t\t$this->raw_data->retweeted_status->text = $this->remove_emoji( $this->raw_data->retweeted_status->text );\n\t\t}\n\t}",
"private function instanceTwitter() \n\t{\n\t\treturn $this->twitter = new Twitter;\n\t}",
"function add_twitter_field_value($comment_data){\r\n //debugbreak();\r\n global $wpdb;\r\n if(isset($_POST['atf_twitter_id'])){\r\n // clean value\r\n $twitter = esc_attr(trim($_POST['atf_twitter_id']));\r\n $twitter = str_replace('@','',$twitter);\r\n // if user used url (which they do even if you tell them not to), remove it\r\n if(stripos($twitter,'twitter.com')){\r\n $arr = explode('/',$twitter);\r\n $arr = array_filter($arr); // removes empty elements (if url had trailing slash)\r\n $twitter = $arr[sizeof($arr)]; // gets last element in array\r\n }\r\n // update database\r\n if($twitter && is_email($comment_data['comment_author_email'])){\r\n $query = $wpdb->prepare(\"INSERT INTO {$wpdb->prefix}wptwitipid (email,twitid) VALUES (%s,%s) ON DUPLICATE KEY UPDATE twitid = %s\",$comment_data['comment_author_email'],$twitter,$twitter);\r\n $wpdb->query($query);\r\n // set cookie - dont use this any more due to cache plugins causing shenanigans!\r\n //$comment_cookie_lifetime = apply_filters('comment_cookie_lifetime', 30000000);\r\n //setcookie('comment_author_twitter_' . COOKIEHASH, $twitter, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN);\r\n }\r\n }\r\n return $comment_data;\r\n }",
"public function redirectToTwitter()\n\t{\n\t return Socialize::with('twitter')->redirect();\n\t}",
"public function getName()\n {\n return 'Twitter';\n }"
] |
[
"0.7108215",
"0.7088176",
"0.70248353",
"0.68421406",
"0.68282783",
"0.6761694",
"0.66884774",
"0.6673835",
"0.66068304",
"0.66024053",
"0.65370077",
"0.651318",
"0.6512455",
"0.64424044",
"0.6405062",
"0.63825417",
"0.62867504",
"0.62108415",
"0.6209298",
"0.6194429",
"0.6182871",
"0.6150657",
"0.61426044",
"0.6031358",
"0.6007331",
"0.5948068",
"0.59361553",
"0.59215754",
"0.5876717",
"0.586734"
] |
0.70949453
|
1
|
returns the twitter attribute
|
public function getTwitter()
{
return $this->twitter;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function get_twitter() {\r\n return $this->twitter;\r\n }",
"public function getTwitter()\n\t{\n\t\treturn $this->twitter;\n\t}",
"public function getTwitterIdentifier()\n {\n return $this->_getIdentifier('twitter');\n }",
"public function getTwitterUrl()\n {\n return $this->twitter_url;\n }",
"public function getTwitterId()\n {\n return $this->twitterId;\n }",
"public function getTwitterUsername()\n {\n return $this->twitterUsername;\n }",
"public static function twitter()\n {\n return 'twitter';\n }",
"public function getTwitter(): ?string;",
"public function getTweet() {\n return $this->_tweet;\n }",
"public function get() {\n\t\treturn $this->presentation->twitter_creator;\n\t}",
"public function getTwitterName()\n\t{\n\t\tif ($fb_uid = $this->getFBUID()) {\n\t\t\treturn $this->db->queryScalar(\"SELECT twitterid from selective_status_users where fbuid = \" . $this->db->quote($fb_uid) . \" limit 1\");\n\t\t}\n\t}",
"public function getTwist()\n {\n return $this->twist;\n }",
"function get_user_twitter_info()\n{\n\t$name = ( get_option('bb_opts_twitter_name') != '' ) ?\n\t\tget_option('bb_opts_twitter_name') :\n\t\tfalse;\n\t$count = ( get_option('bb_opts_twitter_count') != '' ) ?\n\t\t(int) get_option('bb_opts_twitter_count') :\n\t\tfalse;\t\n\t$output = ( $name && $count ) ?\n\t\t'{name:\"' . $name . '\",count:\"' . $count . '\"}' :\n\t\t'false';\n\t\n\treturn $output;\n}",
"public function getName()\n {\n return 'Twitter';\n }",
"private function twitter() {\n\t\t$url = 'https://twitter.com/intent/tweet?';\n\n\t\t$query = array(\n\t\t\t'*url' \t=> $this->_get_param( 'permalink' ),\n\t\t\t'text'\t=> $this->_get_param( 'title' ),\n\t\t\t'via'\t\t=> $this->_get_param( 'via' ),\n\t\t);\n\n\t\treturn $this->_create_query_string( $url, $query );\n\t}",
"public function twitter() : string\n {\n $parameters = [];\n\n if (empty($this->title) === false) {\n $parameters['text'] = $this->title;\n }\n\n if (empty($this->url) === false) {\n $parameters['url'] = $this->url;\n }\n\n return $this->createHtmlElement('a', [\n 'target' => '_blank',\n 'rel' => 'noopener',\n 'href' => 'https://twitter.com/intent/tweet?'.http_build_query($parameters),\n ], 'Twitter');\n }",
"public function getTwitterAccessToken()\n {\n return $this->twitterAccessToken;\n }",
"public function twitter()\n {\n return $this->hasOne('App\\TwitterAccount');\n }",
"function get_twitter_screen_name($user_id){\n\tglobal $gianism;\n\treturn get_user_meta($user_id, $gianism->twitter->umeta_screen_name, true);\n}",
"public function twitter_user_profile() {\n $current_uid = isset($_GET['team']) ? $_GET['muid'] : \\Drupal::currentUser()->id();\n $TwitterHelper = new TwitterHelperFunction();\n $properties = ['token_access'];\n $response_token = \\Drupal::service('social_media.social_media_controller')->getKabbodeNetworkStatusProperty(174, $current_uid, $properties);\n $connection = new TwitterOAuth($TwitterHelper->getTwitterApiKey(), $TwitterHelper->getTwitterSecretKey(), $response_token['token_access']->oauth_token, $response_token['token_access']->oauth_token_secret);\n $verify_account = $connection->get('account/verify_credentials');\n return $verify_account;\n }",
"public function getTwitterEmpresa()\n {\n return $this->twitterEmpresa;\n }",
"public function hasTwitter(): bool;",
"function ts_get_twitter_username() {\r\n\t\r\n\t$url = ot_get_option('twitter_account_recent_tweets');\r\n\tif (empty($url) || !strstr($url,'twitter.com/'))\r\n\t{\r\n\t\treturn '';\r\n\t}\r\n\t\r\n\t$url = trim($url);\r\n\tif (substr($url,-1) == '/')\r\n\t{\r\n\t\t$url = substr($url,0,-1);\r\n\t}\r\n\t$username = substr($url,strrpos($url,'/')+1);\r\n\t\r\n\treturn $username;\r\n}",
"protected function getTwitterData()\n\t{\n\t\t$http = HttpFactory::getHttp();\n\n\t\t$fields = array('profile' \t=> 'someval_twitter_tweets',\n\t\t\t\t\t\t'following' => 'someval_twitter_following',\n\t\t\t\t\t\t'followers' => 'someval_twitter_followers');\n\n\t\tforeach ($this->aData AS &$elm)\n\t\t{\n\n\t\t\tif (trim($elm->w20_twitter) == '')\n\t\t\t{\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$response = $http->get('http://twitter.com/'.$elm->w20_twitter);\n\n\t\t\tif ($response->code == 200)\n\t\t\t{\n\t\t\t\t// before we parse the DOM check if we have a 'data-nav=\"profile\"' within the response\n\t\t\t\t$html = (string) $response->body;\n\t\t\t\tif (strpos($html, 'data-nav=\"profile\"') === false)\n\t\t\t\t{\n\t\t\t\t\t$elm->someval_twitter_valid = 0;\n\t\t\t\t\tLog::add('Twitter Invalid (redirect):' . $elm->w20_twitter);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t$crawler = new Crawler($html);\n\t\t\t\t$ul \t = $crawler->filter('ul.stats');\n\t\t\t\t$li \t = $ul->children();\n\n\t\t\t\tforeach ($li as $key => $value)\n\t\t\t\t{\n\t\t\t\t\t$a \t\t= $value->firstChild;\n\t\t\t\t\t$type \t= $a->getAttribute('data-nav');\n\t\t\t\t\tif (in_array($type, array_keys($fields)))\n\t\t\t\t\t{\n\t\t\t\t\t\t$val = $a->nodeValue;\n\t\t\t\t\t\tlist($t) = explode(' ', trim($val));\n\t\t\t\t\t\t$num = (int) str_replace('.','',$t);\n\n\t\t\t\t\t\tif ($type == 'profile')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif ($num != 0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$elm->someval_twitter_valid = 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ($num != 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$elm->$fields[$type] = $num;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tLog::add('Twitter Valid:' . $elm->w20_twitter\n\t\t\t\t\t\t. ' | Tweets=' . $elm->someval_twitter_tweets\n\t\t\t\t\t\t. ' | Following=' . $elm->someval_twitter_following\n\t\t\t\t\t\t. ' | Followers=' . $elm->someval_twitter_followers);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$elm->someval_twitter_valid = 0;\n\t\t\t\tLog::add('Twitter Invalid:' . $elm->w20_twitter);\n\t\t\t}\n\t\t}\n\t}",
"public function getTwitterTweets() {\n $current_uid = isset($_GET['team']) ? $_GET['muid'] : \\Drupal::currentUser()->id();\n $properties = ['token_access'];\n $response = $this->getKabbodeNetworkStatusProperty(174, $current_uid, $properties);\n $TwitterHelper = new TwitterHelperFunction();\n $connection = new TwitterOAuth($TwitterHelper->getTwitterApiKey(), $TwitterHelper->getTwitterSecretKey(), $response['token_access']->oauth_token, $response['token_access']->oauth_token_secret);\n $parameters = ['count' => 10, 'include_rts' => 1, 'tweet_mode' => 'extended', 'exclude_replies' => 1];\n $get_tweet = $connection->get('statuses/user_timeline', $parameters);\n //modified twitter text\n foreach ($get_tweet as $key => $tweet) {\n $tweet->full_text = $this->json_tweet_text_to_HTML($tweet, $links = true, $users = true, $hashtags = true);\n if ($tweet->retweeted) {\n if (isset($tweet->retweeted_status) && is_object($tweet->retweeted_status)) {\n $tweet->retweeted_status->full_text = $this->json_tweet_text_to_HTML($tweet->retweeted_status, $links = true, $users = true, $hashtags = true);\n }\n }\n }\n $last_trace_tweet = end($get_tweet)->id - 1;\n \n $get_tweet['last_trace_tweet'] = strval($last_trace_tweet);\n return $get_tweet;\n }",
"public static function twitter($username)\n\t{\n\t\t$twitter = self::title('https://twitter.com/'.$username.'');\n\n\t\t$explode = explode('|', $twitter);\n\n\t\t$sub_explode = explode('(', $explode[0]);\n\n\t\treturn $sub_explode[0];\n\t}",
"public function getTwitter(): Twitter\n\t{\n\t\t$wittertwitterAuth = $this->configs['twitterAuth'];\n\t\treturn new Twitter(\n\t\t\t$wittertwitterAuth['consumerKey'], \n\t\t\t$wittertwitterAuth['consumerSecret'], \n\t\t\t$wittertwitterAuth['accessToken'], \n\t\t\t$wittertwitterAuth['accessTokenSecret']\n\t\t);\t\n\t}",
"public function getTwitterShareUrl() {\n return 'https://twitter.com/share?url='.$this->socialData['url']\n .'&text='.$this->socialData['title']\n .(($this->socialData['via'])?'&via='.$this->socialData['via']:'')\n .(($this->socialData['hashtags'])?'&hashtags='.$this->socialData['hashtags']:'');\n }",
"function ecsp_get_twitter_api() {\n\tstatic $tw = null;\n\n\t// Create a new twitter object if it doesn't already exist, or if the oAuth Token or secret is provided.\n\tif ( $tw === null ) {\n\t\t$creds = get_field( 'ecsp_twitter', 'options' );\n\n\t\tif ( empty($creds) || empty($creds[0]['app_id']) || empty($creds[0]['secret']) ) {\n\t\t\t$tw = false;\n\t\t\treturn $tw;\n\t\t}\n\n\t\tif ( !class_exists( 'Twitter/Twitter' ) ) {\n\t\t\trequire_once ECSP_PATH . '/assets/twitter/autoload.php';\n\t\t}\n\n\n\t\t$tw = new TwitterOAuth(\n\t\t\tapply_filters( 'ecsp_twitter_app_id', $creds[0]['app_id'] ),\n\t\t\tapply_filters( 'ecsp_twitter_app_secret', $creds[0]['secret'] )\n\t\t);\n\t}\n\n\treturn $tw;\n}",
"public function twitterAction()\r\n {\r\n if(!($userInfo = Mage::getSingleton('customer/session')\r\n ->getSocialLogonTwitterUserinfo()) || !$userInfo->hasData()) {\r\n \r\n $userInfo = Mage::getSingleton('SocialLogon/twitter_info_user')\r\n ->load();\r\n\r\n Mage::getSingleton('customer/session')\r\n ->setSocialLogonTwitterUserinfo($userInfo);\r\n }\r\n\r\n Mage::register('SocialLogon_twitter_userinfo', $userInfo);\r\n\r\n $this->loadLayout();\r\n $this->renderLayout();\r\n }"
] |
[
"0.834715",
"0.8154191",
"0.7602827",
"0.74698853",
"0.7467845",
"0.7444171",
"0.73824924",
"0.736928",
"0.7140309",
"0.7075989",
"0.7002053",
"0.6703779",
"0.6683201",
"0.66725594",
"0.6661891",
"0.66387475",
"0.66113746",
"0.65867096",
"0.65150684",
"0.64412993",
"0.6438304",
"0.6408074",
"0.63822335",
"0.6291634",
"0.6181528",
"0.61383545",
"0.6080052",
"0.60792476",
"0.6052569",
"0.6038846"
] |
0.8194156
|
1
|
sets the LinkedIn attribute
|
public function setLinkedIn($linkedIn)
{
$this->linkedIn = $linkedIn;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function get_linkedin() {\r\n return $this->linkedin;\r\n }",
"function setLinkID( $linkID ) \n {\n $this->setValueByFieldName('navbarlink_id', $linkID );\n }",
"public static function linkedin()\n {\n return 'linkedin';\n }",
"public function getLinkedinUrl()\n {\n return $this->linkedin_url;\n }",
"public function updateUserLinked\t(){\n\t\t\n\t\t}",
"public function woo_slg_initialize_linkedin() {\n\t\t\t\n\t\t\tglobal $woo_slg_options;\n\t\t\t\n\t\t\t//check enable linkedin & linkedin application id & linkedin application secret are not empty\n\t\t\tif( !empty( $woo_slg_options['woo_slg_enable_linkedin'] ) && !empty( $woo_slg_options['woo_slg_li_app_id'] )\n\t\t\t\t && !empty( $woo_slg_options['woo_slg_li_app_secret'] ) ) {\n\t\t\t\t\n\t\t\t \t//check $_GET['wooslg'] equals to linkedin\n\t\t\t\tif( isset( $_GET['wooslg'] ) && $_GET['wooslg'] == 'linkedin' \n\t\t\t\t\t&& !empty( $_GET['code'] ) && !empty( $_GET['state'] ) ) {\n\t\t\t\t\t\n\t\t\t\t\t//load linkedin class\n\t\t\t\t\t$linkedin\t= $this->woo_slg_load_linkedin();\n\t\t\t\t\t$config\t\t= $this->linkedinconfig;\n\t\t\t\t\t\n\t\t\t\t\t//check linkedin loaded or not\n\t\t\t\t\tif( !$linkedin ) return false;\n\t\t\t\t\t\n\t\t\t\t\t//Get Access token\n\t\t\t\t\t$arr_access_token\t= $this->linkedin->getAccessToken( $config['appKey'], $config['appSecret'], $config['callbackUrl']);\n\n\t\t\t\t\t// code will excute when user does connect with linked in\n\t\t\t\t\tif( !empty( $arr_access_token['access_token'] ) ) { // if user allows access to linkedin\n\t\t\t\t\t\t\n\t\t\t\t\t\t//Get User Profiles\n\t\t\t\t\t\t$resultdata\t\t\t= $this->linkedin->getProfile();\n\n\t\t\t\t\t\t$resultdata \t\t= $this->woo_slg_get_li_processed_profile_data($resultdata);\n\n\t\t\t\t\t\t$emailData = $this->linkedin->getProfileEmail( $arr_access_token['access_token']);\n\t\t\t\t\t\t\n\t\t\t\t\t\tif( !empty( $emailData ) && isset( $emailData['elements'] ) && !empty( $emailData['elements'] ) ){\n\t\t\t\t\t\t\t$resultdata['emailAddress'] = $emailData['elements'][0]['handle~']['emailAddress'];\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$imageData = $this->linkedin->getProfileImage( $arr_access_token['access_token']);\n\n\t\t\t\t\t\tif( !empty( $imageData ) && isset( $imageData['profilePicture'] ) ){\n\t\t\t\t\t\t\t$resultdata['pictureUrl'] = $imageData['profilePicture']['displayImage~']['elements'][0]['identifiers'][0]['identifier'];\n\t\t\t\t\t\t}\n\n\n\t\t\t\t\t\t//set user data to sesssion for further use\n\n\t\t\t\t\t\t\\WSL\\Persistent\\WOOSLGPersistent::set('woo_slg_linkedin_user_cache', $resultdata);\n\n\t\t\t\t\t\t\n\t\t\t\t\t} else {\n\t\t\t\t\t\t\n\t\t\t\t\t\t// bad token access\n\t\t\t\t\t\techo esc_html__( 'Access token retrieval failed', 'wooslg' );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"public function getLinkedinIdentifier()\n {\n return $this->_getIdentifier('linkedin');\n }",
"public function getLinkedIn()\n {\n return $this->linkedIn;\n }",
"private function setWebsiteValue()\n {\n $value = $this->getData(self::$websiteAttributeCode);\n $list = $this->storeManager->getWebsites();\n $this->setCustomAttribute(self::$websiteAttributeCode, $list[$value]->getName());\n $this->setCustomAttribute(self::$websiteIdAttributeCode, $value);\n }",
"public function unlinkLinkedIn() {\n $this->setLinkedinOauthToken(NULL);\n $this->setLinkedinOauthTokenSecret(NULL);\n $this->setLinkedInId(NULL);\n }",
"function setLink($link) {\r\n $this->_link = $link;\r\n }",
"function setLink($link) {\r\n $this->_link = $link;\r\n }",
"public function setLink($link);",
"public function setLink($link){\n\t\t$this->link = $link;\n\t}",
"function setHeadLink($var)\n\t{\n\t\t$this -> head_link = $var;\n\t}",
"protected function setOrganization() {}",
"function setLink($url)\n\t{\n\t\t$this->link = $url;\n\t}",
"function setLink(&$link)\n {\n $this->_link = $link;\n }",
"public function setLName($lname)\n{\n$this->lname = $lname;\n}",
"public function &setExternalLoginUrl($value);",
"public function setBulletinAttribute($value)\n {\n $this->attributes['bulletin'] = $value ? $value : null;\n }",
"function setURL( $url ) \n {\n $this->setValueByFieldName( 'navbarlink_url', $url );\n }",
"function set_region_id($link, $data, $value) // Colorize: green\n { // Colorize: green\n return set_property_value($link, $data, \"region_id\", $value); // Colorize: green\n }",
"function setUrlLink(){\n if( $this->id == 0 ) return;\n $url = $this->aFields[\"url\"]->toString();\n if( $url == \"\" ) return;\n $url = strip_tags( preg_replace( \"/[\\\"']/\", \"\", $url ) );\n if( !$this->aFields[\"url\"]->editable ) $this->aFields[\"url\"]->display = false;\n $this->aFields[\"url_link\"]->display = true;\n $this->aFields[\"url_link\"]->value = \"<a href=\\\"\".$url.\"\\\">\".$url.\"</a>\";\n }",
"public function linkedin()\n {\n return Socialite::driver('linkedin')->redirect();\n }",
"public function setMarkIdentification($value) {\n\t\tself::$_markIdentification = $value;\n\t}",
"function initiate(){\n $linkedin_config = array(\n 'appKey' => '81pkixf5dxjfaw',\n 'appSecret' => 'VXmzSddDzlEjNNg6',\n 'callbackUrl' => 'http://localhost/Portfolio/linkedin_signup/data/'\n );\n \n $this->load->library('linkedin', $linkedin_config);\n $this->linkedin->setResponseFormat(LINKEDIN::_RESPONSE_JSON);\n $token = $this->linkedin->retrieveTokenRequest();\n \n $this->session->set_flashdata('oauth_request_token_secret',$token['linkedin']['oauth_token_secret']);\n $this->session->set_flashdata('oauth_request_token',$token['linkedin']['oauth_token']);\n \n $link = \"https://api.linkedin.com/uas/oauth/authorize?oauth_token=\". $token['linkedin']['oauth_token']; \n redirect($link);\n}",
"public function setLoginId(): void\n {\n }",
"function setLname($name){\n $this->lname = $name;\n }",
"public function set_link($link){\n\t\t$this->set_channel_element('link', $link);\n\t}"
] |
[
"0.629257",
"0.6147344",
"0.59390426",
"0.5867475",
"0.5864722",
"0.58639896",
"0.5855575",
"0.57803375",
"0.57290864",
"0.5722472",
"0.56263614",
"0.56263614",
"0.5603889",
"0.5535347",
"0.55186194",
"0.5460699",
"0.5440165",
"0.5402634",
"0.53714097",
"0.53541476",
"0.53360516",
"0.5311208",
"0.5301859",
"0.5297076",
"0.5288812",
"0.52804786",
"0.52603555",
"0.52336663",
"0.51944363",
"0.5148364"
] |
0.66637915
|
0
|
sets the company attribute
|
public function setCompany($company)
{
$this->company = $company;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function setCompany(string $company): void\n {\n $this->_company = $company;\n }",
"public function setCompany($company_nid);",
"public function setCompanyNameAttribute($value) {\n\t\t$this->company_name = $value;\n\t}",
"public function __construct($company) {\n $this->company = $company;\n }",
"public function setYomiCompany($value)\n {\n $this->setProperty(\"YomiCompany\", $value, true);\n }",
"public function setCompany($quote, $company)\n {\n $quote->getBillingAddress()->setCompany($company)->save();\n $quote->getShippingAddress()->setCompany($company)->save();\n $customerAddressId = $quote->getBillingAddress()->getCustomerAddressId();\n if ($customerAddressId) {\n $customerAddress = Mage::getModel('customer/address')->load($customerAddressId);\n $customerAddress->setCompany($company)->save();\n }\n }",
"public function setCompany($quote, $company)\n {\n $quote->getBillingAddress()->setCompany($company)->save();\n $quote->getShippingAddress()->setCompany($company)->save();\n $customerAddressId = $quote->getBillingAddress()->getCustomerAddressId();\n if ($customerAddressId) {\n $customerAddress = Mage::getModel('customer/address')->load($customerAddressId);\n $customerAddress->setCompany($company)->save();\n }\n }",
"public function __construct($company)\n {\n $this->company = $company;\n }",
"public function setCustomerCompany($company)\n\t {\n\t \t $this->json['params'][$this->customer]['name']['company'] = $company;\n\t \t \n\t \t return $this;\n\t }",
"public function setCustomerCompany($companyName = '') {\n $company = array(\n 'x_company'=>$this->truncateChars($companyName, 50),\n );\n $this->NVP = array_merge($this->NVP, $company); \n }",
"public function setCompanyShort($company)\n\t\t{\n\t\t\t$this->company = $company;\n\t\t}",
"public function company(string $company): self\n {\n $this->company = $company;\n\n return $this;\n }",
"public function setCompanyIdAttribute($input)\n {\n $this->attributes['company_id'] = $input ? $input : null;\n }",
"private function _setCompanyConfig(){\n\t\t/* Loading the company configuration file */\n\t\t$this->config->load('company'.DIRECTORY_SEPARATOR.$this->getCompanyCode().DIRECTORY_SEPARATOR.'config');\n\t}",
"public function setCompanyName($companyName)\r\n {\r\n $this->companyName = strip_tags($companyName);\r\n }",
"public function setCompany($company = null)\n {\n // validation for constraint: float\n if (!is_null($company) && !(is_float($company) || is_numeric($company))) {\n throw new \\InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($company, true), gettype($company)), __LINE__);\n }\n if (is_null($company) || (is_array($company) && empty($company))) {\n unset($this->company);\n } else {\n $this->company = $company;\n }\n return $this;\n }",
"public function __construct(Company $company)\n {\n $this->companies= $company;\n\n }",
"public function setCompanyId($company_id)\n\t\t{\n\t\t\t$this->company_id = $company_id;\n\t\t}",
"public function __construct(Company $company)\n {\n $this->company = $company;\n }",
"public function setCompanyCity(string $company_city) {\n\n $this->company_city = $company_city;\n\n }",
"protected function setOrganization() {}",
"public function setCompany(\\App\\Domain\\Model\\Company $object) : void\n {\n $this->setRef('from__company_id__to__table__companies__columns__id', $object, 'products');\n }",
"public function setCompany_name($company_name)\n {\n $this->company_name = $company_name;\n }",
"protected function _setCompanyCode($storeId=null) {\n\t\t$config = Mage::getSingleton('avatax/config');\n\t\t$this->_request->setCompanyCode($config->getCompanyCode($storeId));\n\t}",
"public function assignCompany($company)\n {\n return $this->companies()->sync([$company]);\n }",
"public function get_company() \n {\n return $this->company;\n }",
"public function setShippingCompany($companyName = '') {\n $company = array(\n 'x_ship_to_company'=>$this->truncateChars($companyName, 50),\n );\n $this->NVP = array_merge($this->NVP, $company); \n }",
"public function getCompany()\n {\n return $this->company;\n }",
"public function validateCompany()\n\t{\n\t\tif ($this->employed) {\n\t\t\t$validator = CValidator::createValidator('required', $this, 'company', array(\n\t\t\t\t'message' => 'This field depends on \"' .\n\t\t\t\t\t\t\t $this->getAttributeLabel('employed') .\n\t\t\t\t\t\t\t '\" and must not be empty.'\n\t\t\t));\n\t\t\t$validator->validate($this);\n\t\t\t$validator = CValidator::createValidator('length', $this, 'company', array('max'=>'25'));\n\t\t\t$validator->validate($this);\n\t\t} else {\n\t\t\t$this->company = null;\n\t\t}\n\t}",
"public function setCompany($value)\n {\n $this->setParameter('billingCompany', $value);\n $this->setParameter('shippingCompany', $value);\n\n return $this;\n }"
] |
[
"0.8082997",
"0.76697564",
"0.7195021",
"0.6972501",
"0.6943425",
"0.6910738",
"0.6910738",
"0.69060874",
"0.68849957",
"0.68541604",
"0.67947054",
"0.6790856",
"0.67523456",
"0.66812164",
"0.66740984",
"0.66601485",
"0.65668243",
"0.6556261",
"0.6549529",
"0.6535149",
"0.64931923",
"0.63981766",
"0.63891715",
"0.6353366",
"0.6348736",
"0.62970626",
"0.6209284",
"0.6194184",
"0.6193763",
"0.61501926"
] |
0.80843353
|
0
|
returns the company attribute
|
public function getCompany()
{
return $this->company;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function get_company() \n {\n return $this->company;\n }",
"public function getCompany();",
"public function getCompany() {}",
"public function company(): string\n {\n return $this->getData('CompanyName');\n }",
"public function getCompany()\n {\n return isset($this->company) ? $this->company : null;\n }",
"function getCompanyId() {\n return $this->getAdditionalProperty('company_id');\n }",
"public function getCompanyNameAttribute() {\n\t\treturn $this->company_name;\n\t}",
"public function getCompanyValue()\n {\n return $this->CompanyValue;\n }",
"public function getProdCompany()\n {\n return $this->prod_company;\n }",
"public function company()\n {\n return $this->author()->company();\n }",
"public function getCompany()\n {\n if (array_key_exists('company', $this->data)) {\n return $this->data['company'];\n }\n\n if ($this->getType() == Reader\\Reader::TYPE_YML) {\n $company = $this->xpath->evaluate('string(/yml_catalog/shop/company)');\n }\n\n if (! $company) {\n $company = null;\n }\n\n $this->data['company'] = $company;\n\n return $this->data['company'];\n }",
"public function getCompany() {\n return Companies::findById($this->company_id);\n }",
"public function getYomiCompany()\n {\n return $this->getProperty(\"YomiCompany\");\n }",
"public function getCompany_name()\n {\n return $company_name;\n }",
"public function company()\n {\n return ($this->entity_type == 'c') ? $this->belongsTo('App\\Models\\Company\\Company', 'entity_id') : null;\n }",
"public function getCompanyId()\n {\n return $this->company_id;\n }",
"public function getCompanyId()\n {\n return $this->company_id;\n }",
"public function getCompanyName()\n {\n return $this->company_name;\n }",
"public function getReadableCompanyNameAttribute()\n {\n if ($this->company_id){\n $company = Company::find($this->company_id);\n $companyName = $company->name;\n return $companyName;\n }else{\n return null;\n }\n\n }",
"public function company()\n {\n return $this->business();\n }",
"public function getCompanyName()\n {\n return $this->getProperty(\"CompanyName\");\n }",
"public function getCompanyName() {\n\t\treturn $this->company_name; \n\t}",
"public function getOwnedByAttribute()\n {\n return $this->site->company;\n }",
"public function getCompany()\n {\n return $this->getParameter('billingCompany');\n }",
"public function getCompanyName()\r\n {\r\n return $this->companyName;\r\n }",
"public function getAuthorcompany() {}",
"public function getCompanyName() {\n\n return $this->company_name;\n\n }",
"public function getCompanyName()\n {\n return $this->companyName;\n }",
"public function getCompanyName()\n {\n return $this->companyName;\n }",
"public function getCompany(): ?string\n {\n return $this->_company;\n }"
] |
[
"0.8378989",
"0.78750986",
"0.784876",
"0.78114724",
"0.77708524",
"0.7703485",
"0.7699838",
"0.762855",
"0.7607188",
"0.76038194",
"0.7578189",
"0.75520056",
"0.7550505",
"0.74769485",
"0.74613637",
"0.74413955",
"0.74413955",
"0.743876",
"0.74333066",
"0.7407259",
"0.7402892",
"0.73841035",
"0.73431534",
"0.7332226",
"0.7327221",
"0.7324255",
"0.73198473",
"0.7289826",
"0.7289826",
"0.7217136"
] |
0.8223311
|
1
|
Gets array of suboptions.
|
public function getSubOptions();
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getOptions() : array;",
"public function getOptions(): array;",
"public function getOptions(): array;",
"public function getOptions(): array;",
"public function getOptions(): array;",
"public function getOptions(): array;",
"public function getOptions(): array;",
"public function getOptions(): array;",
"public function getAll()\n {\n return $this->options;\n }",
"public function getOptions()\n {\n return ArrayHelper::merge(\n parent::getOptions(),\n ['children' => []]\n );\n }",
"public function getOptions()\n { return $this->get('options'); }",
"protected function getOptions()\n {\n return array(\n );\n }",
"protected function getOptions()\n {\n return array(\n );\n }",
"protected function getOptions()\n {\n return array(\n );\n }",
"protected function getOptions()\n {\n return array(\n\n );\n }",
"public function getOptions();",
"public function getOptions();",
"public function getOptions();",
"public function getOptions();",
"public function getOptions();",
"public function getOptions();",
"public function getOptions();",
"public function getOptions();",
"public function getOptions();",
"public function getOptions();",
"public function getOptions();",
"public function getOptions();",
"public function getOptions();",
"public function getOptions();",
"public function getOptions();"
] |
[
"0.7106345",
"0.7055212",
"0.7055212",
"0.7055212",
"0.7055212",
"0.7055212",
"0.7055212",
"0.7055212",
"0.690142",
"0.6891016",
"0.68470705",
"0.6823954",
"0.6823954",
"0.6823954",
"0.6812171",
"0.67960024",
"0.67960024",
"0.67960024",
"0.67960024",
"0.67960024",
"0.67960024",
"0.67960024",
"0.67960024",
"0.67960024",
"0.67960024",
"0.67960024",
"0.67960024",
"0.67960024",
"0.67960024",
"0.67960024"
] |
0.7902651
|
0
|
No carer selected, all statuses of the missions are APPLIED
|
public function actionMissionsNoCarerSelected() {
$missions = Mission::getMissionsNoCarerSelected();
$this->render('missionsNoCarerSelected', array(
'missions' => $missions,
));
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function actionMissionsNoCarerApplied() {\n\n $missions = Mission::getMissionsNoCarerApplied();\n\n $this->render('missionsNoCarerApplied', array(\n 'missions' => $missions,\n ));\n }",
"public function actionMissionsCarerNotConfirmed() {\n\n $missions = Mission::getMissionsCarerNotConfirmed();\n\n $this->render('missionsCarerNotConfirmed', array(\n 'missions' => $missions,\n ));\n }",
"public function setDefaultStatus() {\n if (!$this->hasField('field_room')) {\n return;\n }\n if (!$this->get('field_room')->isEmpty()) {\n $room = $this->get('field_room')->entity;\n $approval_required = $room->field_approval_required->getString();\n\n $current_user = \\Drupal::currentUser();\n if ($current_user->hasPermission('bypass room reservation agreement')) {\n $approval_required = FALSE;\n }\n\n $current_status = $this->get('field_status')->getString();\n\n if (!$approval_required && $current_status == 'requested') {\n $this->approve();\n }\n }\n }",
"public function massStatusAction()\n {\n $aircraftIds = $this->getRequest()->getParam('aircraft');\n if (!is_array($aircraftIds)) {\n Mage::getSingleton('adminhtml/session')->addError(\n Mage::helper('bs_misc')->__('Please select aircraft.')\n );\n } else {\n try {\n foreach ($aircraftIds as $aircraftId) {\n $aircraft = Mage::getSingleton('bs_misc/aircraft')->load($aircraftId)\n ->setStatus($this->getRequest()->getParam('status'))\n ->setIsMassupdate(true)\n ->save();\n }\n $this->_getSession()->addSuccess(\n $this->__('Total of %d aircraft were successfully updated.', count($aircraftIds))\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_misc')->__('There was an error updating aircraft.')\n );\n Mage::logException($e);\n }\n }\n $this->_redirect('*/*/index');\n }",
"function getStatus(){\n $this->status = 'Unknown';\n if($this->finAid == 1 && $this->totalOwed != 0){\n if($this->finaidQuestion[1] == ''){\n $this->status = 'Waiting for finaid application';\n return;\n }else{\n $this->status = 'Waiting for finaid decision';\n return;\n }\n }\n if($this->schoolFeeOwed != 0){\n $this->status = 'Waiting for school fee payment';\n return;\n }\n if($this->countryId[1] == 0){\n $this->status = 'Waiting for country preferences';\n return;\n }\n if($this->countryId[1] != 0 && $this->countryConfirm != 1){\n $this->status = 'Waiting for country assignments';\n return;\n }\n if($this->delegateFeeOwed != 0){\n $this->status = 'Waiting for delegate fee payment';\n return;\n }\n if(sizeof($this->attendees) == 0){\n $this->status = 'Waiting for attendee info';\n return;\n }\n if($this->totalOwed < 0){\n $this->status = 'Need Refund';\n return;\n }\n if(sizeof($this->attendees) == $this->totalAttendees && $this->totalOwed == 0){\n $this->status = 'Ready';\n return;\n }\n }",
"private function status()\n {\n echo \"<br /><br />Status (number of soldiers alive): <br />\";\n echo $this->_army1->getName() . \": \" . $this->_army1->_numOfSoldiers . \"<br />\";\n echo $this->_army2->getName() . \": \" . $this->_army2->_numOfSoldiers;\n }",
"private function gameStatus($game){\n\t\t$count = array_diff($game['words'],$game['words_found']);\n\t\tif(count($count)==0){\n\t\t\t$game['status'] = 'completed';\n\t\t}\n\t\treturn $game;\n\t}",
"public function hasCombatStatus(){\r\n return $this->_has(2);\r\n }",
"private function processStatus(){\n\t\t$this->facilityData = $this->getFacilityStatus();\n\n\t\t/** Set the date if it's not set for the proved facility */\n\t\t$this->setFacilityStatus();\n\t}",
"public function mudarStatus(){\n //CO_STATUS = 5 se refere ao caso clinico Disponivel na base publica\n\n //busca e atualiza todos os casos clinicos que tenham CO_STATUS = 4 para o CO_STATUS = 5\n CasoClinico::where('CO_STATUS', '=', 4)->update(['CO_STATUS' => '5']);\n }",
"public function insertStatAndRoyalitiesAction(){\n \n }",
"public function projectContractAccepted()\n\t{\n\n\t}",
"public function selectQuoteMissionAction()\n\t{\n\t\t$quote_missions=array();\n\n\t\tif(!is_array($this->quote_creation->select_missions['missions_selected']))\n\t\t\t$this->quote_creation->select_missions['missions_selected']=array();\n\n\t\t//echo \"<pre>\";print_r($this->quote_creation->select_missions['missions_selected']);\n\n\t\tif(is_array($this->quote_creation->create_mission['product']) && count($this->quote_creation->create_mission['product'])>0)\n\t\t{\n\t\t\t$i=0;\n\t\t\tforeach($this->quote_creation->create_mission['product'] as $mission)\n\t\t\t{\n\t\t\t\t/*Added w.r.t Autre mission*/\n\t\t\t\tif($this->quote_creation->create_mission['product'][$i]=='autre')\n\t\t\t\t{\n\t\t\t\t\t$this->quote_creation->create_mission['language'][$i]='fr';\n\t\t\t\t\t$this->quote_creation->create_mission['volume'][$i]=1;\n\t\t\t\t\t$this->quote_creation->create_mission['nb_words'][$i]=1;\n\t\t\t\t\t$this->quote_creation->create_mission['producttype'][$i]='autre';\n\t\t\t\t}\n\n\n\t\t\t\t$quote_missions[$i]['product']=$this->quote_creation->create_mission['product'][$i];\n\t\t\t\t$quote_missions[$i]['product_name']=$this->product_array[$this->quote_creation->create_mission['product'][$i]];\n\t\t\t\t$quote_missions[$i]['language']=$this->quote_creation->create_mission['language'][$i];\n\t\t\t\t$quote_missions[$i]['language_name']=$this->getLanguageName($this->quote_creation->create_mission['language'][$i]);\n\t\t\t\t$quote_missions[$i]['languagedest']=$this->quote_creation->create_mission['languagedest'][$i];\n\t\t\t\t$quote_missions[$i]['languagedest_name']=$this->getLanguageName($this->quote_creation->create_mission['languagedest'][$i]);\n\n\t\t\t\t$quote_missions[$i]['producttype']=$this->quote_creation->create_mission['producttype'][$i];\n\t\t\t\t$quote_missions[$i]['producttypeother']=$this->quote_creation->create_mission['producttypeother'][$i];\n\t\t\t\t$quote_missions[$i]['producttype_name']=$this->producttype_array[$this->quote_creation->create_mission['producttype'][$i]];\n\t\t\t\t$quote_missions[$i]['nb_words']=$this->quote_creation->create_mission['nb_words'][$i];\n\t\t\t\t$quote_missions[$i]['volume']=$this->quote_creation->create_mission['volume'][$i];\n\t\t\t\t/*added w.r.t Tempo*/\n\t\t\t\t$quote_missions[$i]['volume_max']=$this->quote_creation->create_mission['volume_max'][$i];\n\t\t\t\t$quote_missions[$i]['mission_length']=$this->quote_creation->create_mission['mission_length'][$i];\n\t\t\t\t$quote_missions[$i]['mission_length_option']=$this->quote_creation->create_mission['mission_length_option'][$i];\n\t\t\t\t$quote_missions[$i]['delivery_volume_option']=$this->quote_creation->create_mission['delivery_volume_option'][$i];\n\t\t\t\t$quote_missions[$i]['tempo']=$this->quote_creation->create_mission['tempo'][$i];\n\t\t\t\t$quote_missions[$i]['tempo_length']=$this->quote_creation->create_mission['tempo_length'][$i];\n\t\t\t\t$quote_missions[$i]['tempo_length_option']=$this->quote_creation->create_mission['tempo_length_option'][$i];\n\t\t\t\t$quote_missions[$i]['oneshot']=$this->quote_creation->create_mission['oneshot'][$i];\n\t\t\t\t$quote_missions[$i]['demande_client']=$this->quote_creation->create_mission['demande_client'][$i];\n\t\t\t\t$quote_missions[$i]['duration_dont_know']=$this->quote_creation->create_mission['duration_dont_know'][$i];\n\t\t\t\t//flag retrive\n\t\t\t\t$quote_missions[$i]['producttypeautre']=$this->quote_creation->create_mission['producttypeautre'][$i];\n\t\t\t\t$quote_missions[$i]['comments']=$this->quote_creation->create_mission['comments'][$i];\n\n\t\t\t\t$quote_missions[$i]['identifier']=$this->quote_creation->create_mission['identifier'][$i];\t\t\t\t\n\n\t\t\t\t//mission object\n\t\t\t\t$mission_obj=new Ep_Quote_Mission();\n\t\t\t\t\n\t\t\t\t\n\n\t\t\t\t/*dont change the order of this array*/\n\t\t\t\t$searchParameters['product']=$this->quote_creation->create_mission['product'][$i];\n\t\t\t\t$searchParameters['language']=$this->quote_creation->create_mission['language'][$i];\n\t\t\t\t$searchParameters['languagedest']=$this->quote_creation->create_mission['languagedest'][$i];\n\t\t\t\t$searchParameters['producttype']=$this->quote_creation->create_mission['producttype'][$i];\n\t\t\t\t$searchParameters['volume']=$this->quote_creation->create_mission['volume'][$i];\n\t\t\t\t$searchParameters['nb_words']=$this->quote_creation->create_mission['nb_words'][$i];\n\t\t\t\t\n\n\t\t\t\t$missionDetails=$mission_obj->getMissionDetails($searchParameters,3);\n\t\t\t\tif($missionDetails)\n\t\t\t\t{\n\t\t\t\t\t$m=0;\n\t\t\t\t\tforeach($missionDetails as $misson)\n\t\t\t\t\t{\n\t\t\t\t\t\t$missionDetails[$m]['category_name']=$this->getCategoryName($misson['category']);\n\t\t\t\t\t\t$missionDetails[$m]['product']=$this->product_array[$misson['type']];\n\t\t\t\t\t\t$missionDetails[$m]['language1_name']=$this->getLanguageName($misson['language1']);\n\t\t\t\t\t\t$missionDetails[$m]['producttype']=$this->producttype_array[$misson['type_of_article']];\n\n\t\t\t\t\t\t//Added w.r.t conversion\t\t\t\t\t\t\n\t\t\t\t\t\tif($misson['writing_cost_before_signature_currency']!=$this->quote_creation->create_step1['currency'])\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$missionDetails[$m]['writing_cost_before_signature']=($misson['writing_cost_before_signature']*$this->quote_creation->create_step1['conversion']);\n\t\t\t\t\t\t\t$missionDetails[$m]['correction_cost_before_signature']=($misson['correction_cost_before_signature']*$this->quote_creation->create_step1['conversion']);\n\t\t\t\t\t\t\t$missionDetails[$m]['other_cost_before_signature']=($misson['other_cost_before_signature']*$this->quote_creation->create_step1['conversion']);\n\t\t\t\t\t\t\t$missionDetails[$m]['unit_price']=($misson['selling_price']*$this->quote_creation->create_step1['conversion']);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t$missionDetails[$m]['unit_price']=$misson['selling_price'];\n\t\t\t\t\t\t\n\n\t\t\t\t\t\t$missionDetails[$m]['mission_turnover']=($misson['num_of_articles']*$missionDetails[$m]['unit_price'])/1000;\n\t\t\t\t\t\t\n\n\t\t\t\t\t\t$m++;\n\t\t\t\t\t}\n\n\t\t\t\t\t$quote_missions[$i]['missionDetails']=$missionDetails;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t$i++;\n\t\t\t}\t\t\t\n\n \t\t\t//echo \"<pre>\";print_r($quote_missions);exit;\n \t\t\t$this->quote_creation->create_mission['quote_missions']=$quote_missions;\n\n\t\t\t$this->_view->quote_missions=$quote_missions;\n\t\t\t$this->_view->create_mission=$this->quote_creation->create_mission;\n\t $this->_view->create_step1=$this->quote_creation->create_step1;\n\t $this->_view->select_missions=$this->quote_creation->select_missions;\n\n\t\t\t$this->render('select-quote-mission');\n\n\t\t}\n\t\telse\n\t\t\t$this->_redirect(\"/quote/create-quote-step1?submenuId=ML13-SL2\");\t\t\n\n\n\n\t}",
"public function massStatusAction()\n {\n $equipmentIds = $this->getRequest()->getParam('equipment');\n if (!is_array($equipmentIds)) {\n Mage::getSingleton('adminhtml/session')->addError(\n Mage::helper('bs_logistics')->__('Please select equipments.')\n );\n } else {\n try {\n foreach ($equipmentIds as $equipmentId) {\n $equipment = Mage::getSingleton('bs_logistics/equipment')->load($equipmentId)\n ->setStatus($this->getRequest()->getParam('status'))\n ->setIsMassupdate(true)\n ->save();\n }\n $this->_getSession()->addSuccess(\n $this->__('Total of %d equipments were successfully updated.', count($equipmentIds))\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_logistics')->__('There was an error updating equipments.')\n );\n Mage::logException($e);\n }\n }\n $this->_redirect('*/*/index');\n }",
"function updatestatus() {\n global $_lib;\n\n $dataH = array();\n $dataH['ID'] = $this->transaction->ID;\n $dataH['RemittanceSequence'] = $this->transaction->RemittanceSequence;\n $dataH['RemittanceDaySequence'] = $this->transaction->RemittanceDaySequence;\n $dataH['RemittanceSendtDateTime'] = $_lib['sess']->get_session('Datetime');\n $dataH['RemittanceSendtPersonID'] = $_lib['sess']->get_person('PersonID');\n $dataH['RemittanceStatus'] = 'sent';\n \n #Disse m fjernes nr vi har en godkjenningsprosess\n $dataH['RemittanceApprovedDateTime'] = $_lib['sess']->get_session('Datetime');\n $dataH['RemittanceApprovedPersonID'] = $_lib['sess']->get_person('PersonID');\n\n $_lib['storage']->store_record(array('data' => $dataH, 'table' => 'invoicein', 'debug' => false));\n }",
"public function cloture()\n {\n // On prépare la modification pour enregistrer la fermeture de la mission\n $sql = 'UPDATE `mission`\n SET `mission_statut` = 0\n WHERE `mission_id` = :mission';\n $query = $this->_link->prepare($sql);\n $query->bindParam(':mission', $this->_data['mission_id'], PDO::PARAM_INT);\n\n // On effectue la modification\n $query->execute();\n }",
"public function massBergenStatusAction()\r\n {\r\n $orderIds = $this->getRequest()->getPost('order_ids', array());\r\n $countUnbergenStatus = 0;\r\n\r\n foreach ($orderIds as $orderId) {\r\n $order = Mage::getModel('sales/order')->load($orderId);\r\n if ($order && $order->getData('sync_bergen_status')!=1) {\r\n $order->setData('sync_bergen_status',1)->save();\r\n }\r\n $countUnbergenStatus++;\r\n }\r\n if ($countUnbergenStatus) {\r\n $this->_getSession()->addSuccess($this->__('%s order(s) have been ready for bergen.', $countUnbergenStatus));\r\n }\r\n $this->_redirect('*/*/');\r\n }",
"public function automatchMissionPopupAction()\n\t{\n\t\t$mission_params=$this->_request->getParams();\n\t\t$mission_obj=new Ep_Quote_Mission();\n\t\t$quoteMissionObj=new Ep_Quote_QuoteMissions();\n\n\t\t$quote_id=$mission_params['quote_id'];\n\t\t$mission_id=$mission_params['mission_id'];\n\t\t$suggested_mission=$mission_params['suggested_mission'];\n\t\t$suggested_status=$mission_params['suggested'];\n\n\t\t$archieve_mission=$suggested_mission;\n\t\t//get quotemission details\n\t\t$qmission_params['mission_id']=$mission_id;\n\t\t$QuotemissionDetails=$quoteMissionObj->getMissionDetails($qmission_params);\t\t\n\n\t\t//getting auto matched quotes\n\t\tif($QuotemissionDetails)\n\t\t{\n\t\t\t$i=0;//\n\t\t\tforeach ($QuotemissionDetails as $qmission) \n\t\t\t{\n\t\t\t\n\t\t\t\t$QuotemissionDetails[$i]['product']=$qmission['product'];\n\t\t\t\t$QuotemissionDetails[$i]['product_name']=$this->product_array[$qmission['product']];\n\t\t\t\t$QuotemissionDetails[$i]['language']=$qmission['language_source'];\n\t\t\t\t$QuotemissionDetails[$i]['language_name']=$this->getLanguageName($qmission['language_source']);\n\t\t\t\t$QuotemissionDetails[$i]['languagedest']=$qmission['language_dest'];\n\t\t\t\t$QuotemissionDetails[$i]['languagedest_name']=$this->getLanguageName($qmission['language_dest']);\n\t\t\t\t$QuotemissionDetails[$i]['producttype']=$qmission['product_type'];\n\t\t\t\t$QuotemissionDetails[$i]['producttype_name']=$this->producttype_array[$qmission['product_type']];\n\t\t\t\t$QuotemissionDetails[$i]['nb_words']=$qmission['nb_words'];\n\t\t\t\t$QuotemissionDetails[$i]['comments']=$qmission['comments'];\n\t\t\t\t\n\t\t\t\tif($qmission['related_to'])\n\t\t\t\t{\n\t\t\t\t\t$qmission_params['mission_id']=$qmission['related_to'];\t\t\t\t\t\n\t\t\t\t\t$relatedMissionDetails=$quoteMissionObj->getMissionDetails($qmission_params);\t\n\t\t\t\t\t//echo \"<pre>\";print_r($relatedMissionDetails);\n\t\t\t\t\t$qmission['volume']=$relatedMissionDetails[0]['volume'];\n\t\t\t\t\tif(!$qmission['sales_suggested_missions'])\n\t\t\t\t\t$qmission['sales_suggested_missions']=$relatedMissionDetails[0]['sales_suggested_missions'];\n\n\t\t\t\t}\n\n\t\t\t\t$QuotemissionDetails[$i]['volume']=$qmission['volume'];\n\n\n\t\t\t\t$quote_by=$qmission['quote_by'];\n\t\t\t\t$client_obj=new Ep_Quote_Client();\n\t\t\t\t$bo_user_details=$client_obj->getQuoteUserDetails($quote_by);\n\t\t\t\tif($bo_user_details!='NO')\n\t\t\t\t{\n\t\t\t\t\t$QuotemissionDetails[$i]['sales_user_name']=$bo_user_details[0]['first_name'].' '.$bo_user_details[0]['last_name'];\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\n\t\t\t\t\n\t\t\t\t$suggested_mission=$qmission['sales_suggested_missions'];\n\n\t\t\t\t$suggested_currency=$qmission['sales_suggested_currency'];\n\n\t\t\t\t$i++;\n\t\t\t}\n\n\t\t\t/*dont change the order of this array*/\n\t\t\t$searchParameters['product']=$QuotemissionDetails[0]['product'];\n\t\t\t$searchParameters['language']=$QuotemissionDetails[0]['language_source'];\n\t\t\t$searchParameters['languagedest']=$QuotemissionDetails[0]['language_dest'];\t\t\t\n\t\t\t$searchParameters['producttype']=$QuotemissionDetails[0]['product_type'];\n\t\t\t$searchParameters['volume']=$QuotemissionDetails[0]['volume'];\n\t\t\t$searchParameters['nb_words']=$QuotemissionDetails[0]['nb_words'];\n\t\t\t\n\t\t}\t\n\n\t\t$missionDetails=$mission_obj->getMissionDetails($searchParameters,3);\n\t\tif($missionDetails)\n\t\t{\n\t\t\t$m=0;\n\t\t\tforeach($missionDetails as $misson)\n\t\t\t{\n\t\t\t\t$missionDetails[$m]['category_name']=$this->getCategoryName($misson['category']);\n\t\t\t\t$missionDetails[$m]['product']=$this->product_array[$misson['type']];\n\t\t\t\t$missionDetails[$m]['language1_name']=$this->getLanguageName($misson['language1']);\n\t\t\t\t$missionDetails[$m]['producttype']=$this->producttype_array[$misson['type_of_article']];\n\t\t\t\t\n\t\t\t\tif($misson['writing_cost_before_signature_currency']!=$QuotemissionDetails[0]['sales_suggested_currency'])\n\t\t\t\t{\n\t\t\t\t\t$conversion=$QuotemissionDetails[0]['conversion'];\n\t\t\t\t\t$missionDetails[$m]['writing_cost_before_signature']=($misson['writing_cost_before_signature']*$conversion);\n\t\t\t\t\t$missionDetails[$m]['correction_cost_before_signature']=($misson['correction_cost_before_signature']*$conversion);\n\t\t\t\t\t$missionDetails[$m]['other_cost_before_signature']=($misson['other_cost_before_signature']*$conversion);\n\t\t\t\t\t$missionDetails[$m]['unit_price']=($misson['selling_price']*$conversion);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\t$missionDetails[$m]['unit_price']=$misson['selling_price'];\n\n\t\t\t\t$missionDetails[$m]['mission_turnover']=($misson['num_of_articles']*$missionDetails[$m]['unit_price'])/1000;\n\t\t\t\t\n\n\t\t\t\t$m++;\n\t\t\t}\t\t\t\n\t\t}\t\t\n\t\t$QuotemissionDetails[0]['missionDetails']=$missionDetails;\n\n\n\t\t$this->_view->quote_missions=$QuotemissionDetails;\n\t\t$this->_view->suggested_mission=$suggested_mission;\n\t\t$this->_view->suggested_currency=$suggested_currency;\n\t\t//echo \"<pre>\";print_r($QuotemissionDetails);\n\n\t\t$this->render('popup_automatch_missions');\n\t}",
"public function run()\n {\n \n $statuses = [\n 'afwezig' => [\n 'student_selectable' => 1, \n 'coach_selectable' => 1, \n 'text' => 'Afmelden', \n 'color' => '#bb3d49',\n 'reason_requierd'=> 0,\n ],\n 'aanwezig' => [\n 'student_selectable' => 0, \n 'coach_selectable' => 1, \n 'text' => 'Aanmelden',\n 'color' => '#61e786',\n 'reason_requierd'=> 0,\n ],\n 'tussendoor uit' => [\n 'student_selectable' => 1,\n 'coach_selectable' => 0, \n 'text' => 'Tussendoor uit',\n 'color' =>'#db4547',\n 'reason_requierd'=> 1,\n ],\n 'activiteit' => [\n 'student_selectable' => 0,\n 'coach_selectable' => 1, \n 'text' => 'Activiteit, buiten school',\n 'color' => '#982395',\n 'reason_requierd'=> 0,\n ],\n 'bso' => [\n 'student_selectable' => 1, \n 'coach_selectable' => 0, \n 'text' => 'BSO',\n 'color' => '#61c0bf',\n 'reason_requierd'=> 0,\n ],\n 'ziek' => [\n 'student_selectable' => 0,\n 'coach_selectable' => 1, \n 'text' => 'Ziek',\n 'color' => '#9B539C',\n 'reason_requierd'=> 0,\n ],\n 'ziek naar huis' => [\n 'student_selectable' => 1,\n 'coach_selectable' => 1, \n 'text' => 'Ziek naar huis',\n 'color' => '#da507a',\n 'reason_requierd'=> 1,\n ],\n 'bijzonder verlof' => [\n 'student_selectable' => 0, \n 'coach_selectable' => 0, \n 'text' => 'Bijzonder verlof',\n 'color' => '#354458',\n 'reason_requierd'=> 0,\n ],\n ];\n\n foreach ($statuses as $key => $value) {\n DB::Table('statuses')->insert([\n 'status' => $key,\n 'text' => $value['text'],\n 'color' => $value['color'],\n 'student_selectable' => $value['student_selectable'],\n 'coach_selectable' => $value['coach_selectable'],\n 'reason_requierd'=> $value['reason_requierd'],\n 'created_at' => Carbon::now(),\n 'updated_at' => Carbon::now(),\n ]);\n }\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 statusAction()\n {\n \t//set journey id\n \t$this->setJourneyId();\n\n \t$id = $this->params()->fromRoute(\"id\", \"\");\n\n \tif ($id == \"\")\n \t{\n \t\t//set the error message\n \t\t$this->flashMessenger()->addErrorMessage(\"Communication could not be activated. ID is not set\");\n\n \t\t//return to index page\n \t\treturn $this->redirect()->toRoute(\"front-comms-admin/comms\", array(\"journey_id\" => $this->journey_id));\n \t}//end if\n\n \ttry {\n\t\t\t$this->getCommsAdminModel()->updateCommStatus($id);\n\n \t\t//set the success message\n \t\t$this->flashMessenger()->addSuccessMessage(\"Communication Status updated\");\n \t} catch (\\Exception $e) {\n \t\t//extract error\n \t\t$arr_t = explode(\"||\", $e->getMessage());\n \t\t$json = array_pop($arr_t);\n \t\t$objResult = json_decode($json);\n \t\tif (is_object($objResult))\n \t\t{\n \t\t\t$arr_t = explode(\":\", $objResult->HTTP_RESPONSE_MESSAGE);\n \t\t\t$m = array_pop($arr_t);\n \t\t\t$this->flashMessenger()->addErrorMessage($m);\n \t\t} else {\n \t\t\t//set message\n \t\t\t$this->flashMessenger()->addErrorMessage($e->getMessage());\n \t\t}//end if\n \t}//end catch\n\n \t//redirect to indexpage\n \treturn $this->redirect()->toRoute(\"front-comms-admin/comms\", array(\"journey_id\" => $this->journey_id));\n }",
"public function statusAction()\n\t{\n\t\t$id = $this->params()->fromRoute(\"id\", \"\");\n\n\t\tif ($id == \"\")\n\t\t{\n\t\t\t//set the error message\n\t\t\t$this->flashMessenger()->addErrorMessage(\"Journey active status could not be set. Id not set.\");\n\n\t\t\t//return to index page\n\t\t\treturn $this->redirect()->toRoute(\"front-comms-admin/journeys\");\n\t\t}//end if\n\n\t\ttry {\n\t\t\t//load the Jouney details\n\t\t\t$objJourney = $this->getJourneysModel()->fetchJourney($id);\n\t\t\t$objJourney->set(\"active\", (1 - $objJourney->get(\"active\")));\n\n\t\t\t//update the Journey\n\t\t\t$objJourney = $this->getJourneysModel()->updateJourney($objJourney);\n\n\t\t\t//set the success message\n\t\t\t$this->flashMessenger()->addSuccessMessage(\"Journey active status updated\");\n\t\t} catch (\\Exception $e) {\n\t\t\t//set Message\n\t\t\t$this->flashMessenger()->addErrorMessage($e->getMessage());\n\t\t}//end if\n\n\t\t//redirect to the index page\n\t\treturn $this->redirect()->toRoute(\"front-comms-admin/journeys\");\n\t}",
"public function checkAllSystems() {\n\t\techo \"All system are ready<br>\";\n\t\t$this->missionControl->setState($this->missionControl->getStartPowerUnits());\n\t}",
"public function massStatusAction()\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.')\n );\n } else {\n try {\n foreach ($coursedocIds as $coursedocId) {\n $coursedoc = Mage::getSingleton('bs_coursedoc/coursedoc')->load($coursedocId)\n ->setStatus($this->getRequest()->getParam('status'))\n ->setIsMassupdate(true)\n ->save();\n }\n $this->_getSession()->addSuccess(\n $this->__('Total of %d course docs were successfully updated.', 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 updating course docs.')\n );\n Mage::logException($e);\n }\n }\n $this->_redirect('*/*/index');\n }",
"public function getEnumStatusSupply(){\n return ['WAITING','IN PROGRESS','CANCELED','COMPLETED'];\n }",
"public static function commissions_now( $vendor_id, $status = 'due', $inc_shipping = false, $inc_tax = false ){ \n\n\t\tglobal $wpdb;\n\n\t\t$table_name = $wpdb->prefix . \"pv_commission\";\n\n\t\t$sql = \"SELECT sum( `total_due` ) as total_due\"; \n\n\t\tif ( $inc_shipping ) $sql .= \", sum( `total_shipping` ) as total_shipping\"; \n\t\tif ( $inc_tax )\t$sql .= \", sum( `tax` ) as total_tax \"; \n\t\t\n\t\t$sql .= \" \n\t\t\t\tFROM `{$table_name}`\n\t\t\t\tWHERE vendor_id = {$vendor_id} \n\t\t\t\tAND status = '{$status}' \n\t\t\t\"; \n\n\t\t$results = $wpdb->get_row( $sql ); \n\n\t\t$commissions_now = array_filter( get_object_vars( $results ) );\n\n\t\tif ( empty( $commissions_now ) ) $results = false; \n\n\t\treturn $results; \n\n\t}",
"private function setFacilityStatus(){\n\t\t$this->UpdateVisitors();\n\n\t\t/** Update Available Rooms */\n\t\t$this->UpdateAvailableRooms();\n\n\t}",
"public function get_and_present(){\r\n\r\n\t\t$form_no = $this->input->post('form_no');\r\n\t\t$where = array(\r\n\t\t\t'id' => $form_no\r\n\t\t);\r\n\t\t$select = '';\r\n\t\t$this->load->model('admission/admission_batch_model','abm');\r\n\t\t$admission_form = $this->abm->get_by_all('atif_gs_admission.admission_form',$select,$where);\r\n\t\t$old_status = $admission_form[0]->form_status_id;\r\n\t\t$form_status_old_stage_id = $admission_form[0]->form_status_stage_id;\r\n\r\n\t\t// Update New Status of Assessment\r\n\t\t$update_assessment_status = array(\r\n\t\t\t'form_status_id' => 3,\r\n\t\t\t'form_status_stage_id' => 4,\r\n\r\n\t\t);\r\n\r\n\t\t$affected_assessment_status = $this->abm->update_data('atif_gs_admission.admission_form',$where,$update_assessment_status);\r\n\r\n\t\t//// Update New Status of Discussion\r\n\r\n\t\t$update_discussion_result = array(\r\n\t\t\t'form_status_id' => 4,\r\n\t\t\t'form_status_stage_id' => 4,\r\n\t\t);\r\n\r\n\t\t$affected_discussion_status = $this->abm->update_data('atif_gs_admission.admission_form',$where,$update_discussion_result);\r\n\r\n\t\tif($affected_discussion_status != 0){\r\n\t\t\t// Updated Old Status\r\n\t\t\t$update_old_status = array(\r\n\t\t\t\t'form_status_id' => $old_status,\r\n\t\t\t\t'form_status_stage_id' => $form_status_old_stage_id\r\n\r\n\t\t\t);\r\n\r\n\t\t\t$old_status_update = $this->abm->update_data('atif_gs_admission.admission_form',$where,$update_old_status);\r\n\t\t\techo \"1\";\r\n\t\t\t\r\n\r\n\t\t}\r\n\t\telse{\r\n\t\t\techo \"No Stauts Updated\";\r\n\t\t}\r\n\r\n\r\n\t}",
"function _Check_Should_Complete_Schedule ($application_id, $status, $schedule)\n{\n\t/**\n\t * Check the status and whether or not there are any fatal failures to\n\t * determine whether or not this code should be run.\n\t */\n\t$app = ECash::getApplicationById($application_id);\n\t$app_status = $app->getStatus();\n\t\n\t/*\n\t$flags = $app->getFlags();\n\tif(\n\t\t$flags->get('cust_no_ach')\n\t\t&& (!isCardSchedule($application_id))\n\t)\n\t{\n\t\treturn false;\n\t}\n\t*/\n\n\t$status_chain = array();\n\tif ($app_status->level0) $status_chain[] = $app_status->level0;\n\tif ($app_status->level1) $status_chain[] = $app_status->level1;\n\tif ($app_status->level2) $status_chain[] = $app_status->level2;\n\tif ($app_status->level3) $status_chain[] = $app_status->level3;\n\tif ($app_status->level4) $status_chain[] = $app_status->level4;\n\tif ($app_status->level5) $status_chain[] = $app_status->level5;\n\t$status_chain = implode('::', $status_chain);\n\n\t// GF #13514: Removed 3 collections statuses from acceptable statuses. [benb]\n\t$acceptable_status = array(\n\t'active::servicing::customer::*root',\n\t//'past_due::servicing::customer::*root',\n\t'new::collections::customer::*root',\n\t'indef_dequeue::collections::customer::*root',\n\t//'dequeued::contact::collections::customer::*root',\n\t//'queued::contact::collections::customer::*root',\n\t//'follow_up::contact::collections::customer::*root',\n\t'approved::servicing::customer::*root',\n\t);\n\n\t$log = get_log(\"scheduling\");\n\n\t// No accounts with fatal failures or that aren't an acceptable status\n\tif ($status_chain != 'active::servicing::customer::*root' &&\n\t(($status->num_fatal_failures > 0) || !in_array($status_chain, $acceptable_status))) {\n\t\t$log->Write(\"[Agent:{$_SESSION['agent_id']}][AppID:{$application_id}] Is in an invalid status ($status_chain) or has fatal errors ({$status->num_fatal_failures}), not completing schedule.\");\n\t\treturn false;\n\t}\n\n\t// mantis:7875 If no balance, and account has been funded...\n\tif($status->posted_and_pending_total <= 0\n\t&& $status_chain != 'approved::servicing::customer::*root')\n\t{\n\t\t$log->Write(\"[Agent:{$_SESSION['agent_id']}][AppID:{$application_id}] Is in an invalid status, not completing schedule.\");\n\t\treturn false;\n\t}\n\n\t// Do not run if the account has arrangments and a balance\n\tif ($status->has_arrangements && $status->posted_and_pending_total > 0)\n\t{\n\t\t$log->Write(\"[Agent:{$_SESSION['agent_id']}][AppID:{$application_id}] Is in an arrangement status and has a balance, not completing schedule.\");\n\t\treturn false;\n\t}\n\treturn true;\n\n}",
"public function massStatusAction(){\r\n $siegeIds = $this->getRequest()->getParam('siege');\r\n if(!is_array($siegeIds)) {\r\n Mage::getSingleton('adminhtml/session')->addError(Mage::helper('reseauchx_reservationreseau')->__('Please select sieges.'));\r\n }\r\n else {\r\n try {\r\n foreach ($siegeIds as $siegeId) {\r\n $siege = Mage::getSingleton('reseauchx_reservationreseau/siege')->load($siegeId)\r\n ->setStatus($this->getRequest()->getParam('status'))\r\n ->setIsMassupdate(true)\r\n ->save();\r\n }\r\n $this->_getSession()->addSuccess($this->__('Total of %d sieges were successfully updated.', count($siegeIds)));\r\n }\r\n catch (Mage_Core_Exception $e){\r\n Mage::getSingleton('adminhtml/session')->addError($e->getMessage());\r\n }\r\n catch (Exception $e) {\r\n Mage::getSingleton('adminhtml/session')->addError(Mage::helper('reseauchx_reservationreseau')->__('There was an error updating sieges.'));\r\n Mage::logException($e);\r\n }\r\n }\r\n $this->_redirect('*/*/index');\r\n }"
] |
[
"0.62725306",
"0.56865627",
"0.5590174",
"0.54050386",
"0.5391481",
"0.52981645",
"0.52394027",
"0.5221513",
"0.5212329",
"0.516479",
"0.5126701",
"0.50936174",
"0.50896525",
"0.5065493",
"0.50534594",
"0.5049461",
"0.50459325",
"0.5026544",
"0.5017689",
"0.5017262",
"0.49918658",
"0.49566975",
"0.49481335",
"0.4944876",
"0.49439782",
"0.49303442",
"0.49291098",
"0.49070102",
"0.49055",
"0.48911554"
] |
0.5896258
|
1
|
No carer applied, no entries in LiveInMissionCarers
|
public function actionMissionsNoCarerApplied() {
$missions = Mission::getMissionsNoCarerApplied();
$this->render('missionsNoCarerApplied', array(
'missions' => $missions,
));
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function actionMissionsNoCarerSelected() {\n\n $missions = Mission::getMissionsNoCarerSelected();\n\n $this->render('missionsNoCarerSelected', array(\n 'missions' => $missions,\n ));\n }",
"public function actionMissionsCarerNotConfirmed() {\n\n $missions = Mission::getMissionsCarerNotConfirmed();\n\n $this->render('missionsCarerNotConfirmed', array(\n 'missions' => $missions,\n ));\n }",
"public function initGearInfos()\n\t{\n\t\t$this->collGearInfos = array();\n\t}",
"function cicleinscription_get_vacancies_remaning(){\n\t\n}",
"function mis_capacitaciones() {\n\t$my_courses = get_posts( array(\n\t\t'post_type' => 'sfwd-courses',\n\t\t'post_author' => 1,\n\t\t'meta_key' => 'fachada_servicio',\n\t\t'meta_value' => 'fachada_CAPACITACION'\t\n\t));\n\n\n\t/**\n\t * ATENCION CON EL HARDCODE = 1\n\t */\n\treturn add_course_meta($my_courses);\n}",
"public function initGearCompanyInfos()\n\t{\n\t\t$this->collGearCompanyInfos = array();\n\t}",
"public function extra_voor_verp()\n\t{\n\t}",
"public function getAvailableCarList()\n {\n $query = $this->createQueryBuilder('c')\n ->join('CarBundle:Model', 'm', 'WITH', 'c.model = m.id')\n ->where('c.available = 1')\n ->getQuery();\n\n return $query->getResult();\n }",
"public function no_items() {\r\n\t\t_e( 'No customers avaliable.', 'ac' );\r\n\t}",
"public function aircrafts() {\n // return $this->hasMany(Aircraft::class);\n // return $this->hasMany(Aircraft::class);\n if($this->is_an_aircraft_crew()) {\n $classname = $this->statusable_type;\n return $this->hasMany($classname);\n }\n else {\n return false;\n }\n }",
"function emptyMasterservers() {\n\t\t$this->masterservers = array();\n\t}",
"function get_oers_list_clean(){\n $oer_category_id=$GLOBALS['glbstg_crs_category'];\n $DB=$GLOBALS['GLBMDL_DB'];\n\n $oers=get_oers_list($DB, $oer_category_id);\n $oersclean=new stdClass();\n foreach ($oers as $key => $value) {\n $oersclean->$key = cleanresponse_course_infos( $value );\n }\n if( count( (array)$oersclean) == 0 ){\n $oersclean->response_notice=\"No permitted informations to be rendered. Check with admin.\";\n }\n return $oersclean;\n\n }",
"protected function initCityAvailable()\n {\n $citisFromAPI = $this->apiWrapperRegistry->getAllCityWrapped();\n\n $availableCities = array_map(function ($element) {\n return $element->getFormattedCity();\n }, $citisFromAPI);\n\n $availableCities = array_merge(\n $availableCities,\n $this->arrayConverter->stdArrayToArray($this->jcDecauxWrapper->getContracts())\n );\n\n $availableCompleteCities = [];\n\n foreach ($availableCities as $city) {\n $availableCompleteCities[$city['name']] =\n [\n 'commercial_name' => $city['commercial_name'],\n 'country_code' => $city['country_code'],\n ];\n }\n\n $this->availableCities = $availableCompleteCities;\n }",
"public function __construct() {\n $this->reservations = new ArrayCollection();\n }",
"function __construct () {\n parent::__construct();\n\n $temp = json_decode ($this -> planes -> all (), true);\n \n $ap = -1;\n \n // Iterate through each record in associate array and check if type matches plane in fleet\n // assigns a plane to the fleet if it's name matches the selected planes\n foreach ($temp as $key => $record) {\n $check = false;\n if (!empty ($record[\"id\"])) {\n $check = true;\n switch ($record[\"id\"]) {\n case \"avanti\" :\n break;\n case \"caravan\" :\n break;\n default :\n $check = false;\n }\n if ($check) {\n ++$ap;\n $this -> data[\"a$ap\"] = $record;\n }\n }\n }\n \n\n }",
"public function clearGearInfos()\n\t{\n\t\t$this->collGearInfos = null; // important to set this to NULL since that means it is uninitialized\n\t}",
"public function vehicle();",
"public function __construct()\n {\n $this->lanes = Airport::firstOrFail()->lanes;\n $this->take_off_time = Airport::firstOrFail()->take_off_time;\n }",
"function mis_consultorias() {\n\t$my_courses = get_posts( array(\n\t\t'post_type' => 'sfwd-courses',\n\t\t'post_author' => 1,\n\t\t'meta_key' => 'fachada_servicio',\n\t\t'meta_value' => 'fachada_CONSULTORIA'\t\n\t));\n\n\t/**\n\t * ATENCION CON EL HARDCODE = 1\n\t */\n\treturn add_course_meta($my_courses);\n}",
"public function __construct() { $this->_competitions = [new Competition(0, 'unknow', 0)]; }",
"public function getCars()\n {\n $automoviles = Automovil::get();\n \n return $this->sendResponse($automoviles, 'Completado Correctamente.');\n }",
"public function getnoaffectedFleetAction()\n {\n $fleets = $this->get('doctrine_mongodb')->getRepository('ApiGpsAdministrationBundle:fleet')->findAll();\n //var_dump($fleets);die();\n if ($fleets === null) {\n return new View(\"there are no fleet exist\", Response::HTTP_NOT_FOUND);\n }\n\n foreach ($fleets as $fleet) {\n\n if (!empty($fleet->getComapny()) ){\n $formatted[] = [\n 'name' => $fleet->getName(),\n 'companyname' => $fleet->getComapny()->getName(),\n 'vehicles' => count($fleet->getVehicles()),\n\n ];\n }\n\n\n\n }\n return $formatted;\n }",
"public function airlines(){}",
"public function reservation()\n\t{\n\n\t}",
"public function cars(){\n \n $cars = array(\n 'ABARTH',\n 'ABT',\n 'AC',\n 'ACURA',\n 'AIXAM',\n 'ALFA ROMEO',\n 'ALPINA',\n 'ALPINE',\n 'ALVIS',\n 'AMG',\n 'ARASH',\n 'ARIEL',\n 'ARRINERA',\n 'ARTEGA',\n 'ASIA MOTORS',\n 'ASTON MARTIN',\n 'AUDI',\n 'AUSTIN',\n 'AUSTIN HEALEY',\n 'AXON',\n 'BAC',\n 'BAIC',\n 'BAOJUN',\n 'BEDFORD',\n 'BENTLEY',\n 'BERTONE',\n 'BHARATBENZ',\n 'BITTER',\n 'BMW',\n 'BORGWARD',\n 'BOWLER',\n 'BRABUS',\n 'BRAMMO',\n 'BRILLIANCE',\n 'BRISTOL',\n 'BROOKE',\n 'BUFORI',\n 'BUGATTI',\n 'BUICK',\n 'BYD',\n 'CADILLAC',\n 'CAPARO',\n 'CARLSSON',\n 'CATERHAM',\n 'CHANGAN',\n 'CHANGFEN',\n 'CHERY',\n 'CHEVROLET',\n 'CHRYSLER',\n 'CITROEN',\n 'CIZETA',\n 'CORVETTE',\n 'DACIA',\n 'DAEWOO',\n 'DAF',\n 'DAIHATSU',\n 'DAIMLER',\n 'DARTZ',\n 'DATSUN',\n 'DAVID BROWN',\n 'DE TOMASO',\n 'DELOREAN',\n 'DEVEL SIXTEEN',\n 'DINA',\n 'DMC',\n 'DODGE',\n 'DONGFENG',\n 'DONKERVOORT',\n 'DS AUTOMOBILES',\n 'ELFIN',\n 'EUNOS',\n 'EXCALIBUR',\n 'FERRARI',\n 'FIAT',\n 'FORD',\n 'FPV',\n 'GEELY',\n 'GMC',\n 'GOGGOMOBIL',\n 'GREAT WALL',\n 'HDT',\n 'HILLMAN',\n 'HINO',\n 'HOLDEN',\n 'HONDA',\n 'HSV',\n 'HUMMER',\n 'HYUNDAI',\n 'INFINITI',\n 'INTERNATIONAL',\n 'ISUZU',\n 'IVECO',\n 'JAGUAR',\n 'JBA',\n 'JEEP',\n 'JENSEN',\n 'KIA',\n 'LAMBORGHINI',\n 'LANCIA',\n 'LAND ROVER',\n 'LEXUS',\n 'LEYLAND',\n 'LINCOLN',\n 'LOTUS',\n 'MG',\n 'MACK',\n 'MAHINDRA',\n 'MASERATI',\n 'MAZDA',\n 'MERCEDES',\n 'MERCURY',\n 'MINI',\n 'MITSUBISHI',\n 'MORGAN',\n 'MORRIS',\n 'NISSAN',\n 'NISMO',\n 'OLDSMOBILE',\n 'PEUGEOT',\n 'PLYMOUTH',\n 'PONTIAC',\n 'PORSCHE',\n 'PROTON',\n 'RAMBLER',\n 'RENAULT',\n 'ROLLS ROYCE',\n 'ROVER',\n 'SAAB',\n 'SEAT',\n 'SKODA',\n 'SMART',\n 'SSANGYONG',\n 'STUDEBAKER',\n 'SUBARU',\n 'SUZUKI',\n 'TESLA',\n 'TOYOTA',\n 'TRD',\n 'TRIUMPH',\n 'TVR',\n 'UD',\n 'ULTIMA',\n 'VAUXHALL',\n 'VOLKSWAGEN',\n 'VOLVO',\n 'WESTFIELD',\n 'WILLYS',\n 'WOLSELEY'\n );\n\n return $cars;\n }",
"public function initGearReviews()\n\t{\n\t\t$this->collGearReviews = array();\n\t}",
"function guardarReclamo()\n\t\t{\n\t\t}",
"public function testIfPredictorIdentifiesRestrictedLicensePlate()\n {\n $predictor = new Predictor('PDB2503', '2020-04-21', '18:15');\n\n $this->assertFalse($predictor->canDrive());\n }",
"public function attaquerAdversaire() {\n\n }",
"public function getAirings(): LazyCollection\n {\n return $this->airings;\n }"
] |
[
"0.6321016",
"0.6134486",
"0.5349717",
"0.5306109",
"0.51288044",
"0.509439",
"0.50771874",
"0.5059752",
"0.5008533",
"0.49985075",
"0.49725813",
"0.49685416",
"0.49584252",
"0.49474868",
"0.49402985",
"0.49043256",
"0.48895147",
"0.48808253",
"0.48802465",
"0.48540756",
"0.48509938",
"0.48495382",
"0.48185632",
"0.48151547",
"0.4807844",
"0.4794611",
"0.47903407",
"0.47580358",
"0.4741677",
"0.47302034"
] |
0.6777165
|
0
|
Missions where carer has not confirmed
|
public function actionMissionsCarerNotConfirmed() {
$missions = Mission::getMissionsCarerNotConfirmed();
$this->render('missionsCarerNotConfirmed', array(
'missions' => $missions,
));
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function actionMissionsNoCarerApplied() {\n\n $missions = Mission::getMissionsNoCarerApplied();\n\n $this->render('missionsNoCarerApplied', array(\n 'missions' => $missions,\n ));\n }",
"public function actionMissionsNoCarerSelected() {\n\n $missions = Mission::getMissionsNoCarerSelected();\n\n $this->render('missionsNoCarerSelected', array(\n 'missions' => $missions,\n ));\n }",
"public function notConfirmedJourneys(){\n\n if(Auth::user()->canConfirmJourney()){\n\n $drivers = Driver::all()->pluck('fullName','id');\n $vehicles = Vehical::all()->pluck('fullName','id');\n $vehicless = Vehical::all();\n $vehiclesForColor = Vehical::all(); // for vehicle color button {delete}\n $journeys = Journey::notConfirmed();\n return view('journey.confirms',compact('journeys','drivers','vehicles','vehicless','vehiclesForColor'));\n }\n return redirect('home');\n }",
"function unattended() {\n\t\tself::$_db->saveQry(\"SELECT `ID` FROM `#_reservations` \".\n\t\t\t\t\"WHERE (`status` = 'queued') \".\n\t\t\t\t\"AND `startTime` <= ?\",\n\t\t\t\tCalendar::unattended());\n\t\t\n\t\twhile($res = self::$_db->fetch_assoc())\n\t\t\tReservation::load($res['ID'])->unattended();\n\t}",
"function deleteNotConfirmed() {\r\n\t\t$this->connection = new Connection();\r\n\t\t$conn = $this->connection->openConnection();\r\n\t\ttry {\r\n\t\t\tif($conn){\r\n\t\t\t\t$deleteUser = $conn->prepare(\"DELETE `panier`.* FROM `panier` INNER JOIN `nourriture` ON `panier`.`id_nourriture`=`nourriture`.`id_nourriture` INNER JOIN `restaurant`ON `nourriture`.`id_restaurant`=`restaurant`.`id_restaurant`WHERE `panier`.`id_internaute`=:id_internaute AND `panier`.id_nourriture=:id_nourriture AND `panier`.`datep`=:datep AND `panier`.`etat`=0 \" );\r\n\t\t\t\t$deleteUser->execute(\r\n\t\t\t\t\tarray('id_nourriture' => $this->getId_nourriture(),'id_internaute' => $this->getId_internaute(),'datep' => $this->getDate()));\r\n\t\t\t}\r\n\t\t} catch (PDOExecption $e) {\r\n\t\t\tprint \"Error!: \" . $e->getMessage() . \"</br>\";\r\n\t\t}\r\n\r\n\t\t$this->connection->closeConnection();\r\n\t}",
"function cancelPending() {\n\t\tself::$_db->saveQry(\"SELECT `ID` FROM `#_reservations` \".\n\t\t\t\t\"WHERE (`status` = 'pending' OR `status` = 'prefered') \".\n\t\t\t\t\"AND ? >= `startTime` \",\n\t\t\t\tCalendar::startCancel());\n\t\t\n\n\t\twhile($res = self::$_db->fetch_assoc())\n\t\t\tReservation::load($res['ID'])->failed();\n\t\t\n\t\t\n\t\t// TagesEnde - BuchungsCancelZeit ist kleiner als Aktueller Zeitblock\n\t\tif(Calendar::calculateTomorrow()) {\n\t\t\t$opening = Calendar::opening(date('Y-m-d', strtotime(\"tomorrow\")));\n\t\t\tself::$_db->saveQry(\"SELECT * FROM `#_reservations` \".\n\t\t\t\t\t\"WHERE (`status` = 'pending' OR `status` = 'prefered') \".\n\t\t\t\t\t\"AND ? <= `startTime` AND `startTime` <= ? \",\n\t\t\t\t\t$opening->format(\"Y-m-d H:i\"), \n\t\t\t\t\tCalendar::startCancel($opening));\n\t\t\t\n\t\t\twhile($res = self::$_db->fetch_assoc())\n\t\t\t\tReservation::load($res['ID'])->failed();\n\t\t}\n\t\t\n\t}",
"public function noReservationsAvailableCase1()\n\t{\t\n\t\t$reservation = new Reservation();\n\t\t$reservation->setAttributes(array(\n\t\t\t\t'roomid' => 1,\n\t\t\t\t'datefrom' => $this->_dateOverlapFrom,\n\t\t\t\t'numberofnights'=> $this->_numberofnights,\n\t\t\t\t));\n\t\t$this->assertFalse($reservation->save()); \n\t}",
"public function busyStudents(){\n return Talleresdet::find()->where(['talleres_id'=>$this->id])->\n andWhere(['not', ['codtra' => null]]) \n ->all();\n \n }",
"public function findPagoDetalleMontoNegativo()\r\n\t\t{\r\n\t\t\t$registers = self::findPagoDetalleMontoNegativoModel();\r\n\t\t\tif ( !self::guardarConsultaRecaudacion($registers) ) {\r\n\t\t\t\tself::errorCargarData(Yii::t('backend', 'Montos Negativos'));\r\n\t\t\t}\r\n\t\t}",
"function confirm_reservations($id) {\n global $DB;\n\n $reservation = $DB->get_record('roomscheduler_reservations', array('id' => $id));\n\n $reservations = $DB->get_records('roomscheduler_reservations', array('recurrence_id'=>$reservation->recurrence_id,'location'=>$reservation->location));\n \n foreach($reservations as $res){\n $res->confirm = 1;\n $DB->update_record('roomscheduler_reservations', $res);\n }\n}",
"private static function filterCancelledOrNeedsUpdate() {\n\t\treturn Fns::reject( Logic::anyPass( [\n\t\t\tpipe(\n\t\t\t\tObj::prop( 'status' ),\n\t\t\t\tFns::unary( 'intval' ),\n\t\t\t\tLst::includes( Fns::__, [ ICL_TM_NOT_TRANSLATED, ICL_TM_ATE_CANCELLED ] )\n\t\t\t),\n\t\t\tObj::prop( 'needs_update' )\n\t\t] ) );\n\t}",
"function getIncompleteReviewAssignmentsWhereString() {\n\t\treturn ' (r.cancelled IS NULL OR r.cancelled = 0) AND\n\t\tr.date_notified IS NOT NULL AND\n\t\tr.date_completed IS NULL AND\n\t\tr.declined <> 1';\n\t}",
"function confirmReception() {\r\n\r\n\t\t$this->connection = new Connection();\r\n\t\t$conn = $this->connection->openConnection();\r\n\r\n\t\t$insert = $conn->prepare(\"UPDATE `panier` SET `recu`=1 WHERE `id_internaute`=:id_internaute AND `id_nourriture`=:id_nourriture AND `datep`=:datep\");\r\n\t\ttry {\r\n\t\t\t$result = $insert->execute(array('id_internaute' => $this->getId_internaute(),'id_nourriture' => $this->getId_nourriture(),'datep' => $this->getDate()));\r\n\t\t} catch (PDOExecption $e) {\r\n\t\t\tprint \"Error!: \" . $e->getMessage() . \"</br>\";\r\n\t\t}\r\n\t\t$this->connection->closeConnection();\r\n\t}",
"public function declined()\n\t{\n\t\treturn !$this->approved();\n\t}",
"function no_acta_inicio(){\n $sql = \n \"SELECT\n c.Numero,\n c.Objeto,\n t.Nombre AS Contratista,\n c.Fecha_Inicial,\n c.Fecha_Vencimiento,\n c.Valor_Inicial,\n e.Estado \n FROM\n contratos AS c\n INNER JOIN tbl_terceros AS t ON c.Fk_Id_Terceros = t.Pk_Id_Terceros\n INNER JOIN tbl_estados AS e ON c.Fk_Id_Estado = e.Pk_Id_Estado \n WHERE\n c.Acta_Inicio IS FALSE \n AND e.Pk_Id_Estado <> 2 \n AND c.Fk_Id_Proyecto = {$this->session->userdata('Fk_Id_Proyecto')}\n ORDER BY\n Numero ASC\";\n \n //Se retorna la consulta\n return $this->db->query($sql)->result();\n }",
"public function unpaid(): bool\n {\n return in_array($this->status, [self::PENDING]);\n }",
"public function noReservationsAvailableCase2($reservation)\n\t{\t\n\t\t$newDateFrom = new DateTime();\n\t\t$newDateFrom = DateTime::createFromFormat('Y-m-d',$this->_dateOverlapFromObj->format('Y-m-d'));\n\t\t\n\t\t$newDateFrom->add(new DateInterval('P1D'));\n\t\n\t\t\n\t\t$reservation = new Reservation();\n\t\t$reservation->setAttributes(array(\n\t\t\t\t'roomid' => 1,\n\t\t\t\t'datefrom' => $newDateFrom->format('Y-m-d'),\n\t\t\t\t'numberofnights'=> $this->_numberofnights + 1,\n\t\t\t\t));\n\t\t\t\t\t\n\t\t$this->assertFalse($reservation->save()); \n\t}",
"public function noReservationsAvailableCase4($reservation)\n\t{\n\t\t$newDateFrom = new DateTime();\n\t\t$newDateFrom = DateTime::createFromFormat('Y-m-d',$this->_dateOverlapFromObj->format('Y-m-d'));\n\t\t$newDateFrom->sub(new DateInterval('P1D'));\n\n\t\t\n\t\t$reservation = new Reservation();\n\t\t$reservation->setAttributes(array(\n\t\t\t\t'roomid' => 1,\n\t\t\t\t'datefrom' => $newDateFrom->format('Y-m-d'),\n\t\t\t\t'numberofnights'=> $this->_numberofnights - 1,\n\t\t\t\t));\n\t\t\n\n\t\t\n\t\t$this->assertFalse($reservation->save()); \n\t}",
"public function givenNoPriorActivity();",
"private function negarDetalleSolicitud()\r\n {\r\n $result = false;\r\n $modelInscripcion = self::findInscripcionSucursal();\r\n if ( $modelInscripcion !== null ) {\r\n if ( $modelInscripcion['id_contribuyente'] == $this->_model->id_contribuyente ) {\r\n $result = self::updateSolicitudInscripcion($modelInscripcion);\r\n } else {\r\n self::setErrors(Yii::t('backend', 'Error in the ID of taxpayer'));\r\n }\r\n }\r\n\r\n return $result;\r\n }",
"private function confirm()\n {\n // if 1, direct approve\n\n $load = $this->load;\n\n $fleetCount = $load->fleet_count;\n\n if($fleetCount > 1) {\n $loadTrips = $load->confirmed_trips()\n ->count()\n ;\n } else {\n $loadTrips = 1;\n }\n\n if($loadTrips == $fleetCount) {\n\n //@todo: send confirm notifications\n\n $load->status = Load::STATUS_CONFIRMED;\n $load->save();\n }\n\n }",
"public function noReservationsAvailableCase3($reservation)\n\t{\n\t\t$newDateFrom = new DateTime();\n\t\t$newDateFrom = DateTime::createFromFormat('Y-m-d',$this->_dateOverlapFromObj->format('Y-m-d'));\n\t\t$newDateFrom->add(new DateInterval('P1D'));\n\n\n\t\t$reservation = new Reservation();\n\t\t$reservation->setAttributes(array(\n\t\t\t\t'roomid' => 1,\n\t\t\t\t'datefrom' => $newDateFrom->format('Y-m-d'),\n\t\t\t\t'numberofnights'=> $this->_numberofnights - 1,\n\t\t\t\t));\n\t\t\n\t\t$this->assertFalse($reservation->save()); \n\t}",
"public function vacation_expired() {\n\t\t$vacaciones = $this->solicitudes_model->getVacacionesExpired();\n\t\tforeach ($vacaciones as $registro) :\n\t\t\t$datos = array(\n\t\t\t\t//'dias_acumulados'=>((int)$registro->dias_acumulados - (int)$registro->dias_uno) + (int)$registro->dias_dos,\n\t\t\t\t'dias_acumulados' => (int)$registro->dias_acumulados - (int)$registro->dias_uno,\n\t\t\t\t'dias_uno' => $registro->dias_dos,\n\t\t\t\t'vencimiento_uno' => $registro->vencimiento_dos,\n\t\t\t\t'dias_dos' => null,\n\t\t\t\t'vencimiento_dos' => null,\n\t\t\t);\n\t\t\t$this->solicitudes_model->actualiza_dias_vacaciones($registro->colaborador,$datos);\n\t\tendforeach;\n\t}",
"function ctr_validateConfirmation(&$ctx)\n{\n $reservation = $ctx['reservation'];\n\n if ($reservation->persons AND $reservation->destination)\n return true;\n\n $ctx['warning'] .= \"Please, do not play with the URL.\\n\";\n\n return false;\n}",
"function run_leaving_activity_pre()\n\t\t{\n\t\t\t//actually we never send emails when cancelling\n\t\t\treturn true;\n\t\t}",
"public function waiting_requested(){\n\n // $waiting = Friendship::find($id);\n $user_auth = Auth::user()->id;\n $friendship = Friendship::with(['requester', 'user_requested'])\n ->where('user_requested', $user_auth);\n\n }",
"#[@test]\n public function reasonOnly() {\n $action= $this->parseCommandSetFrom('\n if true { \n vacation \"Out of office\";\n }\n ')->commandAt(0)->commands[0];\n $this->assertClass($action, 'peer.sieve.action.VacationAction');\n $this->assertEquals('Out of office', $action->reason);\n }",
"public function isAwaitingConfirmation() {\n if(isset($this->data['charge']))\n return $this->data['charge']['status'] === 'successful' ? false : true;\n else\n return true;\n }",
"public function misCotizacionesP(){\n $userID = Auth::user()->id;\n $cotizaciones = Cotizacion::where([\n ['id_user','=',$userID],\n ['status','<>','Finalizado'],\n ['status','<>','Vendido']\n ])->orderBy('id', 'desc')->get();\n return view('cotizaciones.misCotizacionesP', ['cotizaciones'=>$cotizaciones]);\n }",
"function getRecruitmentContractMission($id)\n\t\t{\n\t\t\t$query = \"SELECT * from Recruitment WHERE contract_mission_id='\".$id.\"'\";\n\t\t\tif(($result = $this->getQuery($query,true))!=NULL)\n\t\t\t\treturn $result;\n\t\t\telse\n\t\t\t\treturn NULL;\n\t\t}"
] |
[
"0.6195166",
"0.6165933",
"0.5717856",
"0.55818486",
"0.53385353",
"0.53327495",
"0.5230382",
"0.5190355",
"0.51818615",
"0.5169733",
"0.51614577",
"0.5030777",
"0.5018356",
"0.5012753",
"0.49802107",
"0.49677613",
"0.49666324",
"0.49653575",
"0.49399075",
"0.4934891",
"0.49300584",
"0.4929871",
"0.48552424",
"0.48424974",
"0.48329923",
"0.4823383",
"0.48159775",
"0.4803143",
"0.48027903",
"0.47978655"
] |
0.7245031
|
0
|
Supprimer le dossier de l'item
|
public function deleteThisItem(){
$this->deleteFiles(self::DATA_DIRECTORY.$this->_page."/items/".$this->_id);
// Supprimer l'item de $this->_collectionAdministrator->_data
$this->_collectionAdministrator->removeItem($this->_id);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function deleteItem()\r\n\t{\r\n\t\t$this->content_obj->deleteItem();\r\n\t\t$_SESSION[\"il_pg_error\"] = $this->pg_obj->update();\r\n\t\t$this->ctrl->returnToParent($this, \"jump\".$this->hier_id);\r\n\t}",
"function delete() {\n global $USER;\n if($this->Dir !== 0 && $this->mayI(DELETE)) {\n $this->loadStructure();\n foreach($this->files as $file) {\n $file->delete();\n }\n foreach($this->folders as $folder) {\n $folder->delete();\n }\n rmdir($this->path);\n parent::delete();\n }\n }",
"abstract function del ($item);",
"public function delete(): void\n {\n unlink($this->getPath());\n }",
"public function delete() {\n $this->remove_content();\n\n parent::delete();\n }",
"public function deleteItem($item);",
"public function delete()\n {\n if($this->exists())\n unlink($this->getPath());\n }",
"public function deleteItem(Item $item) {\n\t\t$id = $item->getId();\n unset($this->items[$id]);\n }",
"public function Delete($item)\n {\n $item->Delete();\n }",
"public static function removePathItem($item)\n\t{\n\t\t$sql = \"DELETE FROM \" . self::$PathTable . \" WHERE id={$item} OR parent={$item};\";\n\t\t$stmt = self::$modx->prepare($sql);\n\t\t$stmt->execute();\n\t\t$stmt->closeCursor();\n\t}",
"public function delete()\n\t{\n\t\t@unlink($this->get_filepath());\n\t\t@unlink($this->get_filepath(true));\n\t\tparent::delete();\n\t}",
"public function supprimerAction($id){\r\n $this->modele->getManager()->supprimer(\"enseignant\", $id);\r\n $this->listerAction();\r\n }",
"public function societeSupprimerUn($id)\n\t{\n\t\tGestion::supprimer(\"Societe\",\"idSociete\",$id);// votre code ici\n\t}",
"public function possederSupprimerUn($id)\n\t{\n\t\tGestion::supprimer(\"Posseder\",\"idPosseder\",$id);// votre code ici\n\t}",
"abstract public function delete($item);",
"public function remove($item);",
"public function remove()\n {\n $fs = new Filesystem();\n $fs->remove($this->dir());\n }",
"public function delete(): void\n {\n unlink($this->path);\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 destroy($id) {\n $item = Item::where('id',$id)->first();\n foreach($item->images as $img) {\n if(\\File::exists(public_path($img->img))){\n \\File::delete(public_path($img->img));\n }\n }\n $path = 'images/items/'.$item->id.'/';\n \\File::deleteDirectory($path); \n $item->delete();\n return redirect('/admin/items')->with('message','تم حذف المنتج بنجاح');\n }",
"public function on_delete() {\n $this->remove_dir();\n }",
"public function galeriaExcluir_action()\n\t{\n\t\t$bd = new GaleriasImagens_Model();\n\t\t$id = abs((int) $this->getParam(3));\n\t\t$resultado = $bd->read(\"galeria={$id} AND usuario={$this->_usuario}\");\n\t\tforeach($resultado as $dados){\n\t\t\tunlink('uploads/img_'.$dados['imagem']);\n\t\t\tunlink('uploads/tb_'.$dados['imagem']);\n\t\t\tunlink('uploads/destaque_'.$dados['imagem']);\n\t\t}\n\t\t$bd->delete(\"galeria={$id} AND usuario={$this->_usuario}\");\n\t\t\n\t\t$bd = new Galerias_Model();\n\t\t$bd->delete(\"id={$id} AND usuario={$this->_usuario}\");\n\t\t\n\t\tHTML::certo('Galeria excluída.');\n\t\t//POG Temporário\n\t\tHTML::Imprime('<script>Abrir(\"#abreGaleriasListar\",\"#galerias\");</script>');\n\t}",
"public function equipementSupprimerUn($id)\n\t{\n\t\tGestion::supprimer(\"Equipement\",\"idEquipement\",$id);// votre code ici\n\t}",
"public function removeItem()\n\t{\n\t\t$this->autoRender = false;\n\t\t$this->layout = false;\n\t\t$id = \"\";\n\t\tif($this->request->is(array('POST')))\n\t\t{\n\t\t\t$data = $this->request->data;\n\t\t\t$cateId = $data['cate_id'];\n\t\t\t$row = $data['row'];\n\t\t\t$id= '';\n\t\t\tif($this->Session->check('item_'.$cateId))\n\t\t\t{\n\t\t\t\t$itemId = $this->Session->read('item_'.$cateId);\n\t\t\t\tif(!empty($itemId))\n\t\t\t\t{\n\t\t\t\t\t$i = $row*2 -2;\n\t\t\t\t\tif(isset($itemId[$i+1]))\n\t\t\t\t\t{\n\t\t\t\t\t\tunset($itemId[$i+1]);\n\t\t\t\t\t}\n\t\t\t\t\tif(isset($itemId[$i]))\n\t\t\t\t\t{\n\t\t\t\t\t\tunset($itemId[$i]);\n\t\t\t\t\t}\n\t\t\t\t\t$this->Session->write('item_'.$cateId,$itemId);\n\t\t\t\t\t$id = implode(',',$itemId);\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t\techo $id;\n\t\t\texit;\n\t}",
"public function destroy(Dossier $dossier)\n {\n //\n }",
"function delete_item($id,$id_documento){\n $db = new MySQL();\n $sql = \"DELETE FROM facturas_detalle WHERE id='$id'\";\n $db->consulta($sql);\n \n /*\n * actualizar nuevos saldos\n */\n $this->actualizar_totales($id_documento);\n }",
"public function remove($item) {\n unset($this->items[$item->id()]);\n }",
"public function destroy($id)\n {\n $item = Item::findOrFail($id); // tukaj najprej najdemo produkt\n\n// unlink(public_path() . $item->photo->file); //potem zbrišemo sliko, ki je vezana nanj\n\n $item->delete(); //potem še zbrišemo produkt\n\n //Session::flash('deleted_user', 'The User was deleted');\n\n return redirect('/admin/items');\n }",
"public function demandeSupprimerUn($id)\n\t{\n\t\tGestion::supprimer(\"Demande\",\"idDemande\",$id);// votre code ici\n\t}",
"public function purchase_item_delete(){\r\n\t\t\r\n\t\t$this->Purchase_model->purchase_item_delete();\r\n\t}"
] |
[
"0.69789827",
"0.6627578",
"0.65693873",
"0.6531691",
"0.65255696",
"0.65250987",
"0.6487496",
"0.6487232",
"0.648498",
"0.64619374",
"0.6450932",
"0.6405849",
"0.6392673",
"0.6345123",
"0.63352144",
"0.63315547",
"0.6293979",
"0.62774855",
"0.626781",
"0.6259536",
"0.62580776",
"0.62473905",
"0.6245009",
"0.62370414",
"0.6223604",
"0.6223524",
"0.6218966",
"0.620923",
"0.6197174",
"0.61846215"
] |
0.7637732
|
0
|
Renderer the table separate block.
|
protected function renderTableSeparateBlock(): string
{
return
'<tbody class="skipped">' .
'<tr>' .
'<td></td>' .
'</tr>' .
'</tbody>';
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function Row_Rendering() {\n\n\t\t// Enter your code here\t\n\t}",
"function Row_Rendering() {\n\n\t\t// Enter your code here\t\n\t}",
"public function renderTableBody() {\n //$models = array_values($this->dataProvider->getModels());\n //$keys = $this->dataProvider->getKeys();\n $rows = [];\n \n foreach ($this->dataProvider as $model) {\n if (is_callable($this->beforeRow)) {\n $row = call_user_func($this->beforeRow, $model, $this);\n if (!empty($row)) {\n $rows[] = $row;\n }\n }\n\n $rows[] = $this->renderTableRow($model);\n\n if ($this->afterRow !== null) {\n $row = call_user_func($this->afterRow, $model, $this);\n if (!empty($row)) {\n $rows[] = $row;\n }\n }\n }\n\n if (empty($rows)) {\n $colspan = count($this->columns);\n\n return \"<tbody>\\n<tr><td colspan=\\\"$colspan\\\">\" . $this->renderEmpty() . \"</td></tr>\\n</tbody>\";\n } else {\n return \"<tbody>\\n\" . implode(\"\\n\", $rows) . \"\\n</tbody>\";\n }\n }",
"public function render()\n {\n return view('components.table-div-theader');\n }",
"public function render()\n {\n return view('avored::system.components.table.cell');\n }",
"public function render()\n\t{\n\n\t\t$table = \"<table\";\n\n\t\t// Add all attributes\n\t\tforeach ($this->attributes as $key => $value) {\n\t\t\t$table .= ' ' . $key . '=\"' . $value .'\"';\n\t\t}\n\n\t\t$table .= \">\"; // Close table\n\n\t\t// Add the head\n\t\tif ($this->showHeadRow) {\n\t\t\t$table .= \"<thead><tr>\";\n\n\t\t\t// Show the number header.\n\t\t\tif ($this->showNumberColumn) {\n\t\t\t\t$table .= \"<th>#</th>\";\n\t\t\t}\n\n\t\t\tforeach ($this->columns as $column) {\n\t\t\t\t$columnHeadTitle = isset($column['headTitle']) ? $column['headTitle'] : $column[0];\n\t\t\t\t$table .= \"<th>\" . $columnHeadTitle . \"</th>\";\n\t\t\t}\n\n\t\t\t$table .= \"</tr></thead>\"; // finish head\n\t\t}\n\n\t\t// Body\n\t\t$table .= \"<tbody>\";\n\n\t\t$row = $this->numberColumnOffset;\n\n\t\tif (count($this->data) == 0) {\n\t\t\t// Show a no data entry\n\t\t\t$colspan = count($this->columns) + ($this->showNumberColumn ? 1 : 0);\n\t\t\t$table .= '<tr><td colspan=\"'.$colspan.'\"><p align=\"center\" style=\"font-weight:bold;\">Keine Einträge</p></td></tr>';\n\t\t}\n\t\telse {\n\t\t\tforeach ($this->data as $dataObject) {\n\n\t\t\t\t// Row attributes\n\t\t\t\t$attributes = $this->rowAttributes;\n\t\t\t\tif (!is_array($attributes)) {\n\t\t\t\t\tif (is_callable($this->rowAttributes)) {\n\t\t\t\t\t\t$callable = $this->rowAttributes;\n\t\t\t\t\t\t$attributes = $callable($dataObject);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t$attributeString = '';\n\t\t\t\tif ($attributes) {\t\t// Add attributes if we have some\n\t\t\t\t\tforeach ($attributes as $attributeName => $attributeValue) {\n\t\t\t\t\t\t$attributeString .= $attributeName . '=\"' . $attributeValue . '\" ' ;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ($this->rowIdDataMethod) {\n\t\t\t\t\t// method name or closure?\n\t\t\t\t\t$id = '';\n\t\t\t\t\tif (is_string($this->rowIdDataMethod)) {\n\t\t\t\t\t\t$id = $dataObject->{$this->rowIdDataMethod}(); // Call the row data method\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t$rf = new \\ReflectionFunction($this->rowIdDataMethod);\n\t\t\t\t\t\tif ($rf->isClosure()) {\n\t\t\t\t\t\t\t// we got a closure\n\t\t\t\t\t\t\t$closure = $this->rowIdDataMethod;\n\t\t\t\t\t\t\t$id = $closure($dataObject);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\n\n\t\t\t\t\t$table .= '<tr id=\"'. $id .'\" ' . $attributeString . '>'; // Start row with id\n\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$table .= \"<tr \". $attributeString .\">\";\t// Start row without id\n\t\t\t\t}\n\n\t\t\t\t// Number?\n\t\t\t\tif ($this->showNumberColumn) {\n\t\t\t\t\t$table .= \"<td>\" . $row . \"</td>\";\n\t\t\t\t}\n\n\t\t\t\tforeach ($this->columns as $column) {\n\t\t\t\t\t$dataMethod = isset($column['dataMethod']) ? $column['dataMethod'] : $column[1];\n\t\t\t\t\tif (is_string($dataMethod)) {\n\t\t\t\t\t\t// Just call the method an insert the return value into the table cell\n\t\t\t\t\t\t$table .= \"<td>\". $dataObject->$dataMethod() .\"</td>\";\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t$rf = new \\ReflectionFunction($dataMethod);\n\t\t\t\t\t\tif ($rf->isClosure()) {\n\n\t\t\t\t\t\t\t// Call the closure and get the result\n\t\t\t\t\t\t\t$value = $dataMethod($dataObject, $this);\n\n\t\t\t\t\t\t\t$table .= \"<td>\". $value .\"</td>\";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t$table .= \"</tr>\";\t// End the table row\n\t\t\t\t$row++;\n\t\t\t}\n\n\t\t\t// Render the footer row\n\t\t\t$table = $this->renderFooter($table);\n\n\t\t}\n\n\t\t$table .= \"</tbody>\";\n\n\t\t$table .= \"</table>\";\n\t\treturn $table;\n\t}",
"public function renderItems()\n {\n $content = array_filter([\n $this->renderCaption(),\n $this->renderColumnGroup(),\n $this->showHeader ? $this->renderTableHeader() : false,\n $this->showFooter ? $this->renderTableFooter() : false,\n $this->renderTableBody(),\n ]);\n\n $table = Html::tag('table', implode(\"\\n\", $content), $this->tableOptions);\n if ($this->responsive)\n {\n $table = Html::tag('div', $table, ['class' => 'table-responsive']);\n }\n else\n {\n $table = Html::tag('div', $table, ['class' => 'table-scrollable']);\n }\n\n return $table;\n }",
"public function renderItems() {\n\n \t $caption = $this->renderCaption();\n \t $columnGroup = $this->renderColumnGroup();\n \t $tableHeader = $this->showHeader ? $this->renderTableHeader() : false;\n \t $tableBody = $this->renderTableBody();\n \t $tableFooter = $this->showFooter ? $this->renderTableFooter() : false;\n \t $content = array_filter([\n \t$caption,\n \t$columnGroup,\n \t$tableHeader,\n \t$tableFooter,\n \t$tableBody,\n \t ]);\n\n\t return self::html()->tag('table', array('options' => $this->tableOptions, 'content' => implode(\"\\n\", $content)), $this->tableOptions);\n }",
"public function render()\n {\n return view('components.table', [\n 'format' => $this->format,\n 'data' => $this->data,\n ]);\n }",
"public function renderItems()\n {\n $caption = $this->renderCaption();\n $columnGroup = $this->renderColumnGroup();\n $tableHeader = $this->showHeader ? $this->renderTableHeader() : false;\n $tableBody = $this->renderTableBody();\n\n $tableFooter = false;\n $tableFooterAfterBody = false;\n\n if ($this->showFooter) {\n if ($this->placeFooterAfterBody) {\n $tableFooterAfterBody = $this->renderTableFooter();\n } else {\n $tableFooter = $this->renderTableFooter();\n }\n }\n\n $content = array_filter([\n $caption,\n $columnGroup,\n $tableHeader,\n $tableFooter,\n $tableBody,\n $tableFooterAfterBody,\n ]);\n\n return Html::tag('table', implode(\"\\n\", $content), $this->tableOptions);\n }",
"public function render()\n {\n return view('components.table.row');\n }",
"public function render()\n {\n return view('components.table-row');\n }",
"public function renderTableBody()\n {\n $models = array_values($this->dataProvider->getModels());\n $keys = $this->dataProvider->getKeys();\n $rows = [];\n foreach ($models as $index => $model) {\n $key = $keys[$index];\n if ($this->beforeRow !== null) {\n $row = call_user_func($this->beforeRow, $model, $key, $index, $this);\n if (!empty($row)) {\n $rows[] = $row;\n }\n }\n\n $rows[] = $this->renderTableRow($model, $key, $index);\n\n if ($this->afterRow !== null) {\n $row = call_user_func($this->afterRow, $model, $key, $index, $this);\n if (!empty($row)) {\n $rows[] = $row;\n }\n }\n }\n\n if (empty($rows) && $this->emptyText !== false) {\n $colspan = count($this->columns);\n\n return \"<tbody>\\n<tr><td colspan=\\\"$colspan\\\">\" . $this->renderEmpty() . \"</td></tr>\\n</tbody>\";\n }\n\n return \"<tbody>\\n\" . implode(\"\\n\", $rows) . \"\\n</tbody>\";\n }",
"public function render()\n {\n $chromosome = explode(\",\", $this->timetable->chromosome);\n $scheme = explode(\",\", $this->timetable->scheme);\n $data = $this->generateData($chromosome, $scheme);\n\n $days = $this->timetable->days()->orderBy('id', 'ASC')->get();\n $timeslots = TimeslotModel::orderBy('rank', 'ASC')->get();\n $classes = CollegeClassModel::all();\n\n $tableTemplate = '<h3 class=\"text-center\">{TITLE}</h3>\n <div style=\"page-break-after: always\">\n <table class=\"table table-bordered\">\n <thead>\n {HEADING}\n </thead>\n <tbody>\n {BODY}\n </tbody>\n </table>\n </div>';\n\n $content = \"\";\n\n foreach ($classes as $class) {\n $header = \"<tr class='table-head'>\";\n $header .= \"<td>Days</td>\";\n\n foreach ($timeslots as $timeslot) {\n $header .= \"\\t<td>\" . $timeslot->time . \"</td>\";\n }\n\n $header .= \"</tr>\";\n\n $body = \"\";\n\n foreach ($days as $day) {\n $body .= \"<tr><td>\" . strtoupper($day->short_name) . \"</td>\";\n foreach ($timeslots as $timeslot) {\n if (isset($data[$class->id][$day->name][$timeslot->time])) {\n $body .= \"<td class='text-center'>\";\n $slotData = $data[$class->id][$day->name][$timeslot->time];\n $courseCode = $slotData['course_code'];\n $courseName = $slotData['course_name'];\n $professor = $slotData['professor'];\n $room = $slotData['room'];\n\n $body .= \"<span class='course_code'>{$courseCode}</span><br />\";\n $body .= \"<span class='room pull-left'>{$room}</span>\";\n $body .= \"<span class='professor pull-right'>{$professor}</span>\";\n\n $body .= \"</td>\";\n } else {\n $body .= \"<td></td>\";\n }\n }\n $body .= \"</tr>\";\n }\n\n $title = $class->name;\n $content .= str_replace(['{TITLE}', '{HEADING}', '{BODY}'], [$title, $header, $body], $tableTemplate);\n }\n\n $path = 'public/timetables/timetable_' . $this->timetable->id . '.html';\n Storage::put($path, $content);\n\n $this->timetable->update([\n 'file_url' => $path\n ]);\n }",
"public function render()\n\t{\n\t\t// convert json to PHP arrays\n\t\tif(!is_array($this->headers))\n\t\t\t$this->headers = $this->extract_json($this->headers);\n\t\tif(!is_array($this->data))\n\t\t\t$this->data = $this->extract_json($this->data);\n\n\t\t// generate a table of the appropriate type with sub-render method\n\t\t$table_html = $this->{\"render_$this->type\"}();\n\t\t\n\t\t// get the snippets directory if set\n\t\tif($this->snippets_dir && file_exists(\"$this->snippets_dir/table.php\"))\n\t\t\t$snippet = \"$this->snippets_dir/table.php\";\n\t\telse\n\t\t\t$snippet = __DIR__ . \"/snippets/table.php\";\n\t\t\n\t\t// build up the replacements array\n\t\t$replacements = array(\n\t\t\t'body' => $table_html,\n\t\t\t'class' => strlen($this->class)?\"class=\\\"$this->class\\\"\":'',\n\t\t\t'id' => strlen($this->id)?\"id=\\\"$this->id\\\"\":'',\n\t\t\t'caption' => strlen($this->caption)?\"<caption>$this->caption</caption>\":'',\n\t\t);\n\t\t\n\t\t$html = \\helpers\\html\\html::load_snippet($snippet, $replacements);\n\n\t\treturn $html;\n\t}",
"public function render()\r\n {\r\n $widths = $this->calculateWidths();\r\n\r\n $table = $this->renderHeaders($widths);\r\n $table .= $this->renderRows($widths);\r\n\r\n return $table;\r\n }",
"protected function _render()\n {\n $resultTRs = array();\n $resultTDs = array();\n $options = array();\n\n if (is_null($this->_paginator)) {\n FaZend_Exception::raise(\n 'FaZend_View_Helper_HtmlTable_MissedPaginatorParameter',\n \"Paginator must be set first\"\n );\n }\n\n foreach ($this->_paginator as $key=>$rowOriginal) {\n // convert ROW, if necessary. skip the ROW if false returned\n if (!$this->_convertColumnValue(false, true, $rowOriginal)) {\n continue;\n }\n\n // prepare one row for rendering, converting it to the ARRAY\n // type, no matter what was the original type.\n if (is_array($rowOriginal)) {\n $row = $rowOriginal;\n } elseif (is_object($rowOriginal)) {\n if (method_exists($rowOriginal, 'toArray')) {\n $row = $rowOriginal->toArray();\n } else {\n $row = array();\n }\n } else {\n $row = array('column'=>$rowOriginal);\n }\n\n // inject columns\n foreach ($this->_injectedColumns as $injectedColumn=>$predecessor) {\n // sanity check\n if (!is_object($rowOriginal)) {\n break;\n }\n\n // if it's a method - call it\n if ($injectedColumn == '__key') {\n $injectedValue = $key;\n } elseif (method_exists($rowOriginal, $injectedColumn)) {\n $injectedValue = $rowOriginal->$injectedColumn();\n } else {\n try {\n $injectedValue = $rowOriginal->$injectedColumn;\n } catch (Exception $e) {\n $injectedValue = $e->getMessage();\n }\n }\n\n $this->_inject($row, $injectedColumn, $predecessor, $injectedValue);\n }\n\n $resultTRs[] = sprintf(\n \"\\t<tr class='%s' onmouseover='this.className=\\\"highlight\\\"' \" .\n \"onmouseout='this.className=\\\"%s\\\"'%s>\\n\",\n (fmod(count($resultTRs), 2) ? 'even' : 'odd'),\n (fmod(count($resultTRs), 2) ? 'even' : 'odd'),\n $this->_formatColumnStyle(false, null, $rowOriginal)\n );\n\n if (!empty($this->_columnOrder)) {\n $row = $this->_orderColumns($row);\n }\n\n $tds = array();\n foreach ($row as $title=>$value) {\n $column = $this->_column($title);\n\n // maybe we should show only some particular columns\n if (!$this->_isVisible($title)) {\n continue;\n }\n\n // convert value, if necessary\n $value = $this->_convertColumnValue($title, $value, $rowOriginal);\n\n // attach link to the TD\n if ($column->link) {\n $value = $this->_resolveLink($column->link, $value, $rowOriginal, $key);\n }\n\n // append CSS style\n $tds[$title] = sprintf(\n \"\\t\\t<td%s>%s\",\n $this->_formatColumnStyle($title, $value, $rowOriginal),\n $value\n );\n }\n\n if (count($this->_options)) {\n $optString = \"\\t\\t<td>\";\n foreach ($this->_options as $option) {\n // skip the option\n if ($option->skip) {\n if ($option->skip->call($rowOriginal, $key)) {\n continue;\n }\n }\n\n // build the <A HREF> link for this option\n $optLink = $this->_optionsSeparator .\n $this->_resolveLink($option->link, $option->title, $rowOriginal, $key);\n\n // attach this option to the particular column\n if ($option->toColumn) {\n $tds[$option->toColumn] .= ' ' . $optLink;\n } else {\n $optString .= $optLink;\n }\n }\n $options[] = $optString;\n }\n $resultTDs[] = $tds;\n }\n\n // if no data in the paginator\n if (!count($resultTDs)) {\n return $this->_noDataMessage;\n }\n\n // build the header using the last ROW information\n $header = \"\\t<tr><!-- header -->\\n\";\n foreach ($row as $title=>$value) {\n if (!$this->_isVisible($title)) {\n continue;\n }\n\n // rename the column\n if ($this->_column($title)->title) {\n $title = $this->_column($title)->title;\n }\n\n $header .= \"\\t\\t<th>{$title}</th>\\n\";\n }\n\n // add header column for OPTIONS\n if (count($this->_options)) {\n $header .= \"\\t\\t<th>\" . _t('Options') . \"</th>\\n\";\n }\n $header .= \"\\t</tr>\\n\";\n\n $html = \"\\n<table>\\n\" . $header;\n foreach ($resultTRs as $tr=>$line) {\n $html .=\n $line .\n implode(\n \"</td>\\n\",\n array_merge(\n $resultTDs[$tr],\n isset($options[$tr]) ? array($options[$tr]) : array()\n )\n ) .\n \"</td>\\n\\t</tr>\\n\";\n }\n\n return $html . \"</table>\\n\";\n }",
"public function renderComponentsToTable(): void\n {\n $language = $this->getDefaultLanguage();\n $this->table->setHeaders(['Name', 'Language', 'File']);\n foreach ($this->components as $component) {\n $this->table->addRow([$component->name, $language, $component->filename]);\n }\n\n $this->table->render();\n }",
"function display() {\r\n echo '<table cols=\"3\" style=\"font-size:large; font-weight:bold\">';\r\n echo '<tr>'; \r\n for ($pos = 0; $pos < 9; $pos++) { \r\n echo $this->show_cell($pos); \r\n if ($pos % 3 == 2) {\r\n echo '</tr><tr>';\r\n } \r\n }\r\n echo '</tr>';\r\n echo '</table>';\r\n }",
"public function table($element) {\n return render($element);\n }",
"private function render_data()\n\t{\n\t\t// create if the headers exists\n\t\t// 2 header style table\n\t\tif(count($this->headers) == 2 && isset($this->headers[0][0]) && isset($this->headers[1][0]) )\n\t\t{\n\t\t\t// generate the column headers\n\t\t\t$html = '<tr><th></th>';\n\t\t\tforeach($this->headers[0] as $header)\n\t\t\t\t$html .= \"<th>$header</th>\";\n\t\t\t$html .= '</tr>';\n\t\t\t\n\t\t\t// generate the row headers and the data\n\t\t\tfor($i=0; $i<count($this->headers[1]); $i++)\n\t\t\t{\n\t\t\t\t// the header\n\t\t\t\t$html .= \"<tr><th>{$this->headers[1][$i]}</th>\";\n\t\t\t\t\n\t\t\t\t// and now the data\n\t\t\t\tforeach($this->data[$i] as $datum)\n\t\t\t\t\t$html .= \"<td>$datum</td>\";\n\t\t\t\t\n\t\t\t\t$html .= '</tr>';\n\t\t\t}\n\t\t\treturn $html;\n\t\t}//end if\n\t\t\n\t\t// 1 header style table\n\t\tif(count($this->headers) > 0 && isset($this->headers[0]) && !is_array($this->headers[0]) )\n\t\t{\n\t\t\t// generate the column headers\n\t\t\t$html = '<tr>';\n\t\t\tforeach($this->headers as $header)\n\t\t\t\t$html .= \"<th>$header</th>\";\n\t\t\t$html .= '</tr>';\n\t\t\t\n\t\t\t// generate the data\n\t\t\tfor($i=0; $i<count($this->data); $i++)\n\t\t\t{\n\t\t\t\tforeach($this->data[$i] as $datum)\n\t\t\t\t\t$html .= \"<td>$datum</td>\";\n\t\t\t\t\n\t\t\t\t$html .= '</tr>';\n\t\t\t}\n\t\t\t\n\t\t\treturn $html;\n\t\t}//end if\n\t\t\n\t\treturn '';\n\t}",
"public function renderTable()\n {\n $get = new GetBag();\n\n $type = $get->fetchEscape('type', $this->db);\n\n /**\n * Column order.\n */\n $order = $get->fetch('order');\n $order = $order[0]['column'];\n switch ($order) {\n case 0:\n $order = 'id';\n break;\n case 1:\n $order = 'date';\n break;\n default:\n $order = 'id';\n }\n\n $direction = $get->fetch('order');\n $direction = $direction[0]['dir'];\n\n /**\n * Total.\n */\n $total = 0;\n $queryTotal = \"SELECT COUNT(*) as `count` FROM `film_review` WHERE `status` = '{$type}'\";\n $result = $this->db->query($queryTotal);\n if ($row = $result->fetch_assoc()) {\n $total = $row['count'];\n }\n\n /**\n * Page offset.\n */\n $length = $get->fetchInt('length');\n $offset = $get->fetchInt('start');\n\n $order = $this->db->real_escape_string($order);\n $direction = $this->db->real_escape_string($direction);\n\n $query = \"SELECT t1.`id`, t1.`status`, t1.`filmId`, t1.`userId`, t1.`name`, t1.`text`, t1.`date`, t2.`login` \n FROM `film_review` as `t1` LEFT JOIN `user` as `t2` ON t1.`userId` = t2.`id` WHERE t1.`status` = '{$type}'\";\n $query .= \" ORDER BY t1.`{$order}` {$direction} LIMIT {$offset}, {$length}\";\n\n $data = [];\n $result = $this->db->query($query);\n while ($row = $result->fetch_assoc()) {\n $login = $row['login'];\n if (empty($login)) {\n $login = $row['name'];\n }\n \n $item[0] = $row['id'];\n $item[1] = $this->formatDate($row['date'], true);\n $item[2] = $row['userId'];\n $item[3] = $row['text'];\n $item[4] = $row['filmId'];\n $item[5] = $login;\n\n $data[] = $item;\n }\n\n $data = [\n 'draw' => $get->fetchInt('draw'),\n 'recordsTotal' => $total,\n 'recordsFiltered' => $total,\n 'data' => $data\n ];\n\n return json_encode($data);\n }",
"public function render($data){\n $html = \"<html><body><table border = 1>\";\n\t $html .= \"<tr>\";\n\t foreach($data[0] as $header){\n\t $html .=\"<th>\" .$header. \"</th>\";\n\t }\n\t $html .= \"</tr>\";\n\t for ($i=1;$i<count($data);$i++){\n\t $html .= \"<tr>\";\n\t foreach ($data[$i] as $row) {\n\t $html .= \"<td>\" .$row. \"</td>\";\n\t }\n\t $html .=\"</tr>\";\n\t }\n\t $html .=\"</table>\";\n\t return $html; \n }",
"protected function RenderFormattedTable()\n {\n if ($this->m_QueryONRender)\n if (!$this->_run_search($resultRecords, $this->m_ClearSearchRule))\n return $this->ProcessDataObjError($ok);\n\n $dispmode = $this->GetDisplayMode();\n $hasSub = $this->m_SubForms ? 1 : 0;\n //$this->SetDisplayMode($dispmode->GetMode());\n $cls_tbl = strlen($dispmode->m_FormatStyle[0])>0 ? \"class='\".$dispmode->m_FormatStyle[0].\"'\" : \"\";\n $sHTML_tbl = \"<table width=100% border=0 cellspacing=0 cellpadding=3 $cls_tbl>\\n\";\n //$sHTML_tby = \"<tbody id='\".$this->m_Name.\"_tbody' Highlighted='\".$this->m_Name.\"_data_\".($this->m_CursorIndex+1).\"' SelectedRow='\".($this->m_CursorIndex+1).\"'>\\n\";\n\n // print column header\n $columns = $this->m_RecordRow->RenderColumn();\n $sHTML = \"\";\n foreach($columns as $colname)\n $sHTML .= \"<th class=head>$colname</th>\\n\";\n\n // print column data table\n $name = $this->m_Name;\n $counter = 0;\n $sHTML_rows = \"\";\n $selectedRecId = null;\n $selectedIndex = 0;\n while (true) {\n if ($this->m_Range != null && $this->m_Range > 0 && $counter >= $this->m_Range)\n break;\n if ($this->CanShowData())\n $arr = $resultRecords[$counter];\n else\n $arr = null;\n if (!$arr && $this->m_FullPage == \"N\")\n break;\n if (!$arr)\n $sHTML_rows .= \"<tr><td colspan=99> </td></tr>\\n\";\n else {\n $recId = $arr[\"Id\"];\n\n $this->m_RecordRow->SetRecordArr($arr);\n $tblRow = $this->m_RecordRow->Render();\n $rowHTML = \"\";\n foreach($tblRow as $cell) {\n $cell_html = $cell==\"\" ? \" \" : $cell;\n $rowHTML .= \"<td valign=top class=cell>$cell_html</td>\\n\";\n }\n $rownum = $counter+1;\n $rowid = $name.\"_data_\".$rownum;\n $attr = $rownum % 2 == 0 ? \"normal=roweven select=rowsel\" : \"normal=rowodd select=rowsel\";\n\n if ($this->m_HistRecordId != null)\n $this->m_RecordId = $this->m_HistRecordId;\n if ($this->m_RecordId == null)\n $this->m_RecordId = $recId;\n \n if ($this->m_RecordId == $recId) {\n $style_class = \"class=rowsel\";\n $selectedRecId = $recId;\n $selectedIndex = $counter;\n }\n else if ($rownum % 2 == 0)\n $style_class = \"class=roweven\";\n else\n $style_class = \"class=rowodd\";\n\n $onclick = \"ondblclick=\\\"CallFunction('$name.EditRecord($recId)');\\\"\" . \n \" onclick=\\\"CallFunction('$name.SelectRecord($recId,$hasSub)');\\\"\";\n if ($rownum == 1) {\n $sHTML_row1 = \"<tr id='$recId' $style_class $attr $onclick>\\n$rowHTML</tr>\\n\";\n $row1_id = $recId;\n }\n else\n $sHTML_rows .= \"<tr id='$recId' $style_class $attr $onclick>\\n$rowHTML</tr>\\n\";\n }\n $counter++;\n } // while\n if ($selectedRecId == null) {\n $selectedRecId = $row1_id;\n $this->m_RecordId = $selectedRecId;\n $sHTML_row1 = str_replace(\"class=rowodd\", \"class=rowsel\", $sHTML_row1);\n }\n $sHTML .= $sHTML_row1 . $sHTML_rows;\n $this->GetDataObj()->SetActiveRecord($resultRecords[$selectedIndex]);\n\n $sHTML_pre = \"\\n<input type='hidden' id='\".$this->m_Name.\"_selectedId' name='_selectedId' value='$selectedRecId'/>\\n\";\n $sHTML_tby = \"<tbody id='\".$this->m_Name.\"_tbody'>\\n\";\n $sHTML = $sHTML_pre . $sHTML_tbl . $sHTML_tby . $sHTML . \"</tbody></table>\";\n\n return $sHTML;\n }",
"protected function RenderTable()\n {\n if ($this->m_QueryONRender)\n if (!$this->_run_search($resultRecords, $this->m_ClearSearchRule))\n return $this->ProcessDataObjError($ok);\n\n $records = array();\n $records[] = $this->m_RecordRow->RenderColumn();\n $counter = 0;\n while (true) {\n if ($this->m_Range != null && $this->m_Range > 0 && $counter > $this->m_Range)\n break;\n if ($this->CanShowData())\n $arr = $resultRecords[$counter];\n if (!$arr)\n break;\n $this->m_RecordRow->SetRecordArr($arr);\n $tblRow = $this->m_RecordRow->Render();\n $records[] = $tblRow;\n $counter++;\n }\n return $records;\n }",
"public function render()\n {\n return view('components.transaction-table');\n }",
"function Render()\n\t{\n\t\t$strTableName = $this->_strName;\n\t\t$strVixenTable = \"Vixen.table.{$strTableName}\";\n\n\t\techo \"\n<script type='text/javascript'>\n\t{$strVixenTable} = Object();\n\t{$strVixenTable}.collapseAll = TRUE;\n\t{$strVixenTable}.linked = TRUE;\n\t{$strVixenTable}.totalRows = 0;\n\t{$strVixenTable}.row = Array();\n</script>\";\n\t\t\t\n\t\t\n\t\t$strPageSize = $this->_intPageSize > 0 ? \" page_size='{$this->_intPageSize}' \" : \"\";\n\n\t\techo \"<table border='0' cellpadding='3' cellspacing='0' class='Listing' width='100%' id='$strTableName'$strPageSize>\\n\";\n\t\t\n\t\t// Build headers\n\t\techo \"<tr class='First'>\\n\";\n\t\t$intHeaderCount = 0;\n\t\t$intSortLimit = ($this->_bolSortable && is_array($this->_arrSortFields)) ? count ($this->_arrSortFields) : -1;\n\t\tforeach ($this->_arrHeader AS $objField)\n\t\t{\n\t\t\t$strAlign = $this->_arrAlignments[$intHeaderCount];\n\t\t\t$strSortLabel = \"\";\n\t\t\tif ($intHeaderCount <= $intSortLimit)\n\t\t\t{\n\t\t\t\tif ($this->_arrSortFields[$intHeaderCount] !== NULL)\n\t\t\t\t{\n\t\t\t\t\t$strSortLabel = \" TABLE_SORT='\" . $this->_arrSortFields[$intHeaderCount] . \"' \";\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$strSortLabel = \" NO_TABLE_SORT='1' \";\n\t\t\t\t}\n\t\t\t}\n\t\t\techo \" <th width='{$this->_arrWidths[$intHeaderCount]}' align='$strAlign'$strSortLabel>\". $objField .\"</th>\\n\";\n\t\t\t$intHeaderCount++;\n\t\t}\n\t\techo \"</tr>\\n\";\n\t\t\n\t\t// Build rows\n\t\t$intRow = -1;\n\t\tforeach ($this->_arrRows AS $objRow)\n\t\t{\n\t\t\t$intRow++;\n\t\t\t$strClass = ($intRow % 2) ? 'Odd' : 'Even';\n\t\t\t$strStyle = \"\";\n\t\t\t\n\t\t\tif (isset($objRow['OnClick']))\n\t\t\t{\n\t\t\t\t// Escape special chars\n\t\t\t\t$strOnClick = \"onclick='\". htmlspecialchars($objRow['OnClick'], ENT_QUOTES) .\"'\";\n\t\t\t\t$strStyle .= \"cursor:pointer;\";\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$strOnClick = \"\";\n\t\t\t}\n\t\t\t\n\t\t\techo \"<tr id='\" . $strTableName . \"_\" . $intRow . \"' class='$strClass' $strOnClick style='$strStyle'>\\n\";\n\t\t\t\n\t\t\t$intColCount = 0;\n\t\t\t// Build fields\n\t\t\tforeach ($objRow['Columns'] as $objField)\n\t\t\t{\n\t\t\t\t$strWidth = '';\n\t\t\t\t// Work out which width to use\n\t\t\t\t//TODO! After setting the widths once in the header, you shouldn't have to set them again, but we are anyway.\n\t\t\t\t//This could cut down the size of the html file generated\n\t\t\t\t/*if (isset($objRow['Widths']))\n\t\t\t\t{\n\t\t\t\t\t// Use the width specific to this row and column\n\t\t\t\t\t$strWidth = \"width='\". $objRow['Widths'][$intColCount] .\"'\";\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t// Use the general width of this column\n\t\t\t\t\t$strWidth = \"width='\". $this->_arrWidths[$intColCount] .\"'\";\n\t\t\t\t}\n\t\t\t\t*/\n\n\t\t\t\t// Work out which alignment to use\n\t\t\t\tif (isset($objRow['Alignments']))\n\t\t\t\t{\n\t\t\t\t\t// Use the alignment specific to this row and column\n\t\t\t\t\t$strAlignment = \"align='\". $objRow['Alignments'][$intColCount] .\"'\";\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t// Use the general alignment of this column\n\t\t\t\t\t$strAlignment = \"align='\". $this->_arrAlignments[$intColCount] .\"'\";\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// Work out how many columns, this column spans\n\t\t\t\t$strColSpan = \"\";\n\t\t\t\tif (isset($objRow['ColSpans']))\n\t\t\t\t{\n\t\t\t\t\t// colspan values have been declared for this row\n\t\t\t\t\t$strColSpan = \"colspan='\". $objRow['ColSpans'][$intColCount] .\"'\";\n\t\t\t\t\t\n\t\t\t\t\t// If using ColSpans do not use row widths\n\t\t\t\t\t$strWidth = \"\";\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\techo \"<td $strWidth $strAlignment $strColSpan>\";\n\t\t\t\techo \"$objField\";\n\t\t\t\techo \"</td>\\n\";\n\t\t\t\t$intColCount++;\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t// Build detail\n\t\t\tif ($this->_bolDetails)\n\t\t\t{\n\t\t\t\techo \"</tr>\";\n\t\t\t\techo \"<tr>\";\n\t\t\t\techo \"<td colspan=\". count($this->_arrHeader) .\" style='padding: 0px 1px 1px 1px;'>\";\n\t\t\t\techo \"<div id='\" . $strTableName . \"_\" . $intRow . \"DIV-DETAIL' style='display: block; overflow:hidden;'>\";\n\t\t\t\techo $objRow['Detail'];\n\t\t\t\techo \"</div>\";\n\t\t\t\techo \"</td>\\n\";\n\t\t\t}\n\t\t\t\n\t\t\t// Build tooltip\n\t\t\tif ($this->_bolToolTips)\n\t\t\t{\n\t\t\t\techo \"</tr>\";\n\t\t\t\techo \"<tr>\";\n\t\t\t\techo \"<td colspan=4 style='padding-top: 0px; padding-bottom: 0px'>\";\n\t\t\t\techo \"<div id='\" . $strTableName . \"_\" . $intRow . \"DIV-TOOLTIP' style='display: none;'>\";\n\t\t\t\techo $objRow['ToolTip'];\n\t\t\t\techo \"</div>\\n\";\n\t\t\t\techo \"</td>\";\n\t\t\t}\n\t\t\n\t\t\techo \"\\n<script type='text/javascript'>\";\n\t\t\techo \"objRow = Object();\\n\";\n\t\t\t\n\t\t\techo \"objRow.selected = false;\\n\";\n\t\t\techo \"objRow.up = true;\\n\";\n\n\t\t\tif ($this->_bolLinked)\n\t\t\t{\n\t\t\t\tif (is_array($objRow['Index']))\n\t\t\t\t{\n\t\t\t\t\t// add Indexes to objRow\n\t\t\t\t\techo \"objIndex = Object();\";\n\t\t\t\t\t\n\t\t\t\t\tforeach ($objRow['Index'] as $strIndexName=>$arrValues)\n\t\t\t\t\t{\n\t\t\t\t\t\techo \"objIndex.{$strIndexName} = Array();\";\n\t\t\t\t\t\tforeach ($arrValues as $strValue)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\techo \"objIndex.{$strIndexName}.push('$strValue');\";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\techo \"objRow.index = objIndex;\";\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\techo \"{$strVixenTable}.row.push(objRow);\\n\";\n\t\t\techo \"</script>\\n\";\n\t\t\techo \"</tr>\\n\";\n\t\t}\n\t\t$intRowCount = $intRow + 1;\n\t\techo \"</table>\\n\";\n\t\t\n\t\techo \"<script type='text/javascript'>{$strVixenTable}.totalRows = $intRowCount;</script>\\n\";\t\n\t\t\n\t\tif ($this->_bolRowHighlighting)\n\t\t{\n\t\t\t// The following \"Vixen.AddCommand\" method breaks down when you try dynamicly inserting a VixenTable into\n\t\t\t// the DOM, because AddCommand only triggers the command when the body.onload event is triggered\n\t\t\t//echo \"<script type='text/javascript'>Vixen.AddCommand('Vixen.Highlight.Attach','\\'$strTableName\\'', $intRowCount);</script>\";\n\t\t\techo \"<script type='text/javascript'>Vixen.Highlight.Attach('$strTableName');</script>\";\n\t\t}\n\t\t\n\t\tif ($this->_bolToolTips)\n\t\t{\n\t\t\techo \"<script type='text/javascript'>Vixen.Tooltip.Attach('$strTableName');</script>\";\n\t\t}\n\t\t\n\t\tif ($this->_bolDetails)\n\t\t{\n\t\t\techo \"<script type='text/javascript'>Vixen.Slide.Attach('$strTableName', TRUE);</script>\\n\";\n\t\t}\n\t\t\n\t\tif ($this->_bolLinked)\n\t\t{\n\t\t\techo \"<script type='text/javascript'>\";\n\t\t\techo \"{$strVixenTable}.linked = TRUE;\";\n\t\t\t\n\t\t\techo \"objLink = Object();\\n\";\n\t\t\t\n\t\t\tforeach ($this->_arrLinkedTables AS $strTableName=>$arrIndexes)\n\t\t\t{\n\t\t\t\techo \"objLink.{$strTableName} = Array();\\n\";\n\t\t\t\tforeach ($arrIndexes AS $strIndex)\n\t\t\t\t{\n\t\t\t\t\techo \"objLink.{$strTableName}.push('$strIndex');\\n\";\n\t\t\t\t}\n\t\t\t}\n\t\t\techo \"{$strVixenTable}.link = objLink;\\n\";\n\t\t\t\n\t\t\techo \"</script>\\n\";\n\t\t\t\t/*'link':\n\t\t\t{\n\t\t\t\t'AccountInvoices' :\n\t\t\t\t[\n\t\t\t\t\t'Invoice'\n\t\t\t\t]\n\t\t\t},*/\n\t\t}\n\t\t\n\t\tif ($this->_bolSortable)\n\t\t{\n\t\t\techo \"<script type='text/javascript'>Vixen.TableSort.prepare('$strTableName');</script>\\n\";\n\t\t}\n\t}",
"public function render()\n\t{\n\t\t$changes = parent::render();\n\t\t$html = '';\n\t\tif(empty($changes)) {\n\t\t\treturn $html;\n\t\t}\n\n\t\t$html .= '<table class=\"Differences DifferencesInline\">';\n\t\t$html .= '<thead>';\n\t\t$html .= '</thead>';\n\t\tforeach($changes as $i => $blocks) {\n\t\t\t// If this is a separate block, we're condensing code so output ...,\n\t\t\t// indicating a significant portion of the code has been collapsed as\n\t\t\t// it is the same\n\t\t\tif($i > 0) {\n\t\t\t\t$html .= '<tbody class=\"Skipped\">';\n\t\t\t\t$html .= '<th>…</th>';\n\t\t\t\t$html .= '<th>…</th>';\n\t\t\t\t$html .= '<td> </td>';\n\t\t\t\t$html .= '</tbody>';\n\t\t\t}\n\n\t\t\tforeach($blocks as $change) {\n\t\t\t\t$html .= '<tbody class=\"Change'.ucfirst($change['tag']).'\">';\n\t\t\t\t// Added lines only on the right side\n\t\t\t\tif($change['tag'] == 'insert') {\n\t\t\t\t\tforeach($change['changed']['lines'] as $no => $line) {\n\t\t\t\t\t\t$html .= '<tr>';\n\t\t\t\t\t\t$html .= '<td class=\"Right\"><ins>'.$line.'</ins> </td>';\n\t\t\t\t\t\t$html .= '</tr>';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Show deleted lines only on the left side\n\t\t\t\telse if($change['tag'] == 'delete') {\n\t\t\t\t\tforeach($change['base']['lines'] as $no => $line) {\n\t\t\t\t\t\t$html .= '<tr>';\n\t\t\t\t\t\t$html .= '<td class=\"Left\"><del>'.$line.'</del> </td>';\n\t\t\t\t\t\t$html .= '</tr>';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Show modified lines on both sides\n\t\t\t\telse if($change['tag'] == 'replace') {\n\t\t\t\t\tforeach($change['base']['lines'] as $no => $line) {\n\t\t\t\t\t\t$html .= '<tr>';\n\t\t\t\t\t\t$html .= '<td class=\"Left\"><span>'.$line.'</span></td>';\n\t\t\t\t\t\t$html .= '</tr>';\n\t\t\t\t\t}\n\n\t\t\t\t\tforeach($change['changed']['lines'] as $no => $line) {\n\t\t\t\t\t\t$html .= '<tr>';\n\t\t\t\t\t\t$html .= '<td class=\"Right\"><span>'.$line.'</span></td>';\n\t\t\t\t\t\t$html .= '</tr>';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$html .= '</tbody>';\n\t\t\t}\n\t\t}\n\t\t$html .= '</table>';\n\t\treturn $html;\n\t}",
"function FancyTable($data, $type, $sortby) {\r\n $this->SetFillColor(255, 0, 0);\r\n $this->SetTextColor(255);\r\n // $this->SetDrawColor(128, 0, 0);\r\n $this->SetLineWidth(.3);\r\n $this->SetFont('Arial', 'B', 14);\r\n\r\n // Color and font restoration\r\n $this->SetFillColor(220, 220, 220);\r\n $this->SetTextColor(0);\r\n $this->SetFont('');\r\n\r\n $w = $GLOBALS[\"width\"];\r\n $fill = false;\r\n\r\n $eId = $_GET[\"eId\"];\r\n if (isset($_GET[\"printall\"]))\r\n $printall = $_GET[\"printall\"];\r\n else\r\n $printall = 0;\r\n\r\n\r\n if ($eId == 999999 && $printall != 0) {\r\n for ($counter = 0; $counter < sizeof($data[1]); $counter++) {\r\n $row = $data[1][$counter];\r\n $this->SetFont('Arial', '', 14);\r\n $this->Cell($w[0], 9, number_format($row[\"school_id\"]), 'LR', 0, 'L', $fill);\r\n $this->Cell($w[1], 9, $row[\"school_name\"], 'LR', 0, 'L', $fill);\r\n $this->Cell($w[2], 9, number_format($row[\"marks_sum\"]), 'LR', 0, 'L', $fill);\r\n $this->Ln();\r\n $fill = !$fill;\r\n }\r\n } else {\r\n for ($counter = 0; $counter < sizeof($data[0]); $counter++) {\r\n $row = $data[0][$counter];\r\n $this->SetFont('Arial', '', 14);\r\n $this->Cell($w[0], 9, number_format($row[\"regn_number\"]), 'LR', 0, 'L', $fill);\r\n $this->Cell($w[1], 9, $row[\"name\"], 'LR', 0, 'L', $fill);\r\n $this->Cell($w[2], 9, $row[\"school_name\"], 'LR', 0, 'L', $fill);\r\n $this->Cell($w[3], 9, $row[\"event_name\"], 'LR', 0, 'L', $fill);\r\n $this->Cell($w[4], 9, number_format($row[\"position\"]), 'LR', 0, 'L', $fill);\r\n $this->Ln();\r\n $fill = !$fill;\r\n }\r\n }\r\n }",
"public function render()\n {\n return view('components.table-view');\n }"
] |
[
"0.6601555",
"0.6601555",
"0.65993",
"0.6592703",
"0.65726787",
"0.65578127",
"0.6525187",
"0.64807254",
"0.6419051",
"0.6417795",
"0.637154",
"0.6371025",
"0.6322328",
"0.627491",
"0.62220323",
"0.6213446",
"0.62116385",
"0.59986055",
"0.5983164",
"0.59502876",
"0.5947072",
"0.59426636",
"0.59295154",
"0.5929192",
"0.59274596",
"0.58794355",
"0.5873778",
"0.58525395",
"0.58098674",
"0.5800251"
] |
0.7448807
|
0
|
Renderer the table block: equal.
|
protected function renderTableBlockEqual(array $block): string
{
$block['new']['lines'] = $this->customFormatLines(
$block['new']['lines'],
SequenceMatcher::OP_EQ,
);
$ret = '';
// note that although we are in a OP_EQ situation,
// the old and the new may not be exactly the same
// because of ignoreCase, ignoreWhitespace, etc
foreach ($block['new']['lines'] as $newLine) {
// we could only pick either the old or the new to show
// here we pick the new one to let the user know what it is now
$ret .= $this->renderTableRow('new', SequenceMatcher::OP_EQ, $newLine);
}
return $ret;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"protected function renderTableSeparateBlock(): string\n {\n return\n '<tbody class=\"skipped\">' .\n '<tr>' .\n '<td></td>' .\n '</tr>' .\n '</tbody>';\n }",
"public function render()\n\t{\n\t\t$changes = parent::render();\n\t\t$html = '';\n\t\tif(empty($changes)) {\n\t\t\treturn $html;\n\t\t}\n\n\t\t$html .= '<table class=\"Differences DifferencesInline\">';\n\t\t$html .= '<thead>';\n\t\t$html .= '</thead>';\n\t\tforeach($changes as $i => $blocks) {\n\t\t\t// If this is a separate block, we're condensing code so output ...,\n\t\t\t// indicating a significant portion of the code has been collapsed as\n\t\t\t// it is the same\n\t\t\tif($i > 0) {\n\t\t\t\t$html .= '<tbody class=\"Skipped\">';\n\t\t\t\t$html .= '<th>…</th>';\n\t\t\t\t$html .= '<th>…</th>';\n\t\t\t\t$html .= '<td> </td>';\n\t\t\t\t$html .= '</tbody>';\n\t\t\t}\n\n\t\t\tforeach($blocks as $change) {\n\t\t\t\t$html .= '<tbody class=\"Change'.ucfirst($change['tag']).'\">';\n\t\t\t\t// Added lines only on the right side\n\t\t\t\tif($change['tag'] == 'insert') {\n\t\t\t\t\tforeach($change['changed']['lines'] as $no => $line) {\n\t\t\t\t\t\t$html .= '<tr>';\n\t\t\t\t\t\t$html .= '<td class=\"Right\"><ins>'.$line.'</ins> </td>';\n\t\t\t\t\t\t$html .= '</tr>';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Show deleted lines only on the left side\n\t\t\t\telse if($change['tag'] == 'delete') {\n\t\t\t\t\tforeach($change['base']['lines'] as $no => $line) {\n\t\t\t\t\t\t$html .= '<tr>';\n\t\t\t\t\t\t$html .= '<td class=\"Left\"><del>'.$line.'</del> </td>';\n\t\t\t\t\t\t$html .= '</tr>';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Show modified lines on both sides\n\t\t\t\telse if($change['tag'] == 'replace') {\n\t\t\t\t\tforeach($change['base']['lines'] as $no => $line) {\n\t\t\t\t\t\t$html .= '<tr>';\n\t\t\t\t\t\t$html .= '<td class=\"Left\"><span>'.$line.'</span></td>';\n\t\t\t\t\t\t$html .= '</tr>';\n\t\t\t\t\t}\n\n\t\t\t\t\tforeach($change['changed']['lines'] as $no => $line) {\n\t\t\t\t\t\t$html .= '<tr>';\n\t\t\t\t\t\t$html .= '<td class=\"Right\"><span>'.$line.'</span></td>';\n\t\t\t\t\t\t$html .= '</tr>';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$html .= '</tbody>';\n\t\t\t}\n\t\t}\n\t\t$html .= '</table>';\n\t\treturn $html;\n\t}",
"protected function renderTableBlock(array $block): string\n {\n switch ($block['tag']) {\n case SequenceMatcher::OP_EQ:\n $content = $this->renderTableBlockEqual($block);\n break;\n case SequenceMatcher::OP_INS:\n $content = $this->renderTableBlockInsert($block);\n break;\n case SequenceMatcher::OP_DEL:\n $content = $this->renderTableBlockDelete($block);\n break;\n case SequenceMatcher::OP_REP:\n $content = $this->renderTableBlockReplace($block);\n break;\n default:\n $content = '';\n }\n\n return '<tbody class=\"change change-' . self::TAG_CLASS_MAP[$block['tag']] . '\">' . $content . '</tbody>';\n }",
"public function drawTable()\n {\n echo \"<table border='1'>\";\n for ($i = 0; $i < $this->m; $i++) {\n echo \"<tr>\";\n for ($j = 0; $j < $this->n; $j++) {\n if ($this->isInSolution($i, $j, $this->matrix)) {\n echo \"<td bgcolor='#9acd32'>\";\n } else {\n echo \"<td>\";\n }\n echo $this->matrix[$i][$j];\n echo \"</td>\";\n }\n echo \"</tr>\";\n }\n echo \"</table>\";\n }",
"public function print(): void\n {\n $values = $this->table->getValues();\n $size = $this->table->getSize();\n echo \"<table>\";\n foreach ($values as $index => $row) {\n if ($index === 1) {\n echo \"<tr><th>*</th>\";\n foreach ($row as $cell) {\n echo \"<th style='width:\" . (100 / ($size + 1)) . \"%'>\" . $cell . \"</th>\";\n }\n echo \"</tr>\";\n }\n echo \"<tr>\";\n echo \"<th style='width:\" . (100 / ($size + 1)) . \"%'>{$index}</th>\";\n foreach ($row as $cell) {\n echo \"<td style='width:\" . (100 / ($size + 1)) . \"%'>\" . $cell . \"</td>\";\n }\n echo \"</tr>\";\n }\n echo \"</table>\";\n }",
"public function renderTableBody() {\n //$models = array_values($this->dataProvider->getModels());\n //$keys = $this->dataProvider->getKeys();\n $rows = [];\n \n foreach ($this->dataProvider as $model) {\n if (is_callable($this->beforeRow)) {\n $row = call_user_func($this->beforeRow, $model, $this);\n if (!empty($row)) {\n $rows[] = $row;\n }\n }\n\n $rows[] = $this->renderTableRow($model);\n\n if ($this->afterRow !== null) {\n $row = call_user_func($this->afterRow, $model, $this);\n if (!empty($row)) {\n $rows[] = $row;\n }\n }\n }\n\n if (empty($rows)) {\n $colspan = count($this->columns);\n\n return \"<tbody>\\n<tr><td colspan=\\\"$colspan\\\">\" . $this->renderEmpty() . \"</td></tr>\\n</tbody>\";\n } else {\n return \"<tbody>\\n\" . implode(\"\\n\", $rows) . \"\\n</tbody>\";\n }\n }",
"public function render()\n {\n return view('avored::system.components.table.cell');\n }",
"function basel_get_compared_products_table() {\n\t\t$products = basel_get_compared_products_data();\n\t\t$fields = basel_get_compare_fields();\n\t\t$empty_compare_text = basel_get_opt( 'empty_compare_text' );\n\n\t\t?>\n\t\t<div class=\"basel-compare-table\">\n\t\t\t<?php\n\t\t\tif ( ! empty( $products ) ) {\n\t\t\t\tarray_unshift( $products, array() );\n\t\t\t\tforeach ( $fields as $field_id => $field ) {\n\t\t\t\t\tif ( ! basel_is_products_have_field( $field_id, $products ) ) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t?>\n\t\t\t\t\t\t<div class=\"basel-compare-row compare-<?php echo esc_attr( $field_id ); ?>\">\n\t\t\t\t\t\t\t<?php foreach ( $products as $product_id => $product ) : ?>\n\t\t\t\t\t\t\t\t<?php if ( ! empty( $product ) ) : ?>\n\t\t\t\t\t\t\t\t\t<div class=\"basel-compare-col compare-value\" data-title=\"<?php echo esc_attr( $field ); ?>\">\n\t\t\t\t\t\t\t\t\t\t<?php basel_compare_display_field( $field_id, $product ); ?>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<?php else : ?>\n\t\t\t\t\t\t\t\t\t<div class=\"basel-compare-col compare-field\">\n\t\t\t\t\t\t\t\t\t\t<?php\n\t\t\t\t\t\t\t\t\t\t\t$field_name = basel_compare_get_field_name_by_id( $field_id );\n\t\t\t\t\t\t\t\t\t\t\techo true == $field_name ? esc_html( $field_name ) : esc_html( $field );\n\t\t\t\t\t\t\t\t\t\t?>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<?php endif; ?>\n\n\t\t\t\t\t\t\t<?php endforeach ?>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t<?php\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t?>\n\t\t\t\t\t<p class=\"basel-empty-compare\">\n\t\t\t\t\t\t<?php esc_html_e( 'Compare list is empty.', 'basel' ); ?>\n\t\t\t\t\t</p>\n\t\t\t\t\t<?php if ( $empty_compare_text ) : ?>\n\t\t\t\t\t\t<div class=\"basel-empty-page-text\">\n\t\t\t\t\t\t<?php\n\t\t\t\t\t\techo wp_kses(\n\t\t\t\t\t\t\t$empty_compare_text,\n\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t'p' => array(),\n\t\t\t\t\t\t\t\t'h1' => array(),\n\t\t\t\t\t\t\t\t'h2' => array(),\n\t\t\t\t\t\t\t\t'h3' => array(),\n\t\t\t\t\t\t\t\t'strong' => array(),\n\t\t\t\t\t\t\t\t'em' => array(),\n\t\t\t\t\t\t\t\t'span' => array(),\n\t\t\t\t\t\t\t\t'div' => array(),\n\t\t\t\t\t\t\t\t'br' => array(),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t\t?>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t<?php endif; ?>\n\t\t\t\t\t<p class=\"return-to-shop\">\n <a class=\"button\" href=\"<?php echo esc_url( apply_filters( 'basel_compare_return_to_shop_url', wc_get_page_permalink( 'shop' ) ) ); ?>\">\n\t\t\t\t\t\t\t<?php esc_html_e( 'Return to shop', 'basel' ); ?>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</p>\n\t\t\t\t<?php\n\t\t\t}\n\n\t\t\t?>\n\t\t</div>\n\t\t<?php\n\t}",
"public function testRenderWithNullRow($expected, $row): void\n {\n $this->assertEquals($expected, $this->renderer->render($row));\n }",
"public function renderTableBody()\n {\n $models = array_values($this->dataProvider->getModels());\n $keys = $this->dataProvider->getKeys();\n $rows = [];\n foreach ($models as $index => $model) {\n $key = $keys[$index];\n if ($this->beforeRow !== null) {\n $row = call_user_func($this->beforeRow, $model, $key, $index, $this);\n if (!empty($row)) {\n $rows[] = $row;\n }\n }\n\n $rows[] = $this->renderTableRow($model, $key, $index);\n\n if ($this->afterRow !== null) {\n $row = call_user_func($this->afterRow, $model, $key, $index, $this);\n if (!empty($row)) {\n $rows[] = $row;\n }\n }\n }\n\n if (empty($rows) && $this->emptyText !== false) {\n $colspan = count($this->columns);\n\n return \"<tbody>\\n<tr><td colspan=\\\"$colspan\\\">\" . $this->renderEmpty() . \"</td></tr>\\n</tbody>\";\n }\n\n return \"<tbody>\\n\" . implode(\"\\n\", $rows) . \"\\n</tbody>\";\n }",
"function TableShow($align,$LineFeedHeight)\r\n{\r\n\t// Le calcul ne l'est pas, lui ;-)\r\n\t$oldFontSizePt=$this->FontSizePt;\r\n\t$oldFontFamily=$this->FontFamily;\r\n\r\n\t$tableFontFamily='helvetica';\r\n\t$cellmargin=3.0;\t\t// pifomètre : un peu de marge sur la largeur de cellule\r\n\t$wrwi=$this->w - $this->lMargin - $this->rMargin;\r\n\t//-----------\r\n\t$tableFontSize=10;\r\n\t$TableWidth = 1.01*$wrwi;\r\n\t$max_width=0;\r\n\t$min_font_size=6.0; // mis à 6, 5 était vraiment petit\r\n\t$maxiter = 10;\r\n\tdo {\r\n\t\t$tableFontSize = $tableFontSize *min(1.0,$wrwi/$TableWidth)*0.99; // 0.99 pour converger plus vite\r\n\r\n\t\t$fixed_width= ($tableFontSize<$min_font_size) || ($maxiter==1) || ($TableWidth<=$wrwi);\r\n\t\tif ($fixed_width)\r\n\t\t\t$coeff=min(1.0,$wrwi/$TableWidth);\r\n\r\n\t\t$tableFontSize = max($min_font_size,$tableFontSize);\r\n\t\t// on boucle sur la taille de police tant que la largeur du tableau ne rentre pas dans la page\r\n\r\n\t\t// remise à zéro des largeurs de colonnes\r\n\t\tforeach ($this->columnProp as $i=>$cprop)\r\n\t\t\tif ($fixed_width)\t$this->columnProp[$i]['w']=$this->columnProp[$i]['w']*$coeff;// redimenssioner la largeur de la colonne\r\n\t\t\telse\t$this->columnProp[$i]['w']=0.0;\r\n\t\tforeach($this->tableContent as $j=>$row)\r\n\t\t\t$this->lineProp[$j]['h']=0.0;\r\n\r\n\t\t// on passe toutes les cellules du tableau en revue\r\n\t\t// de façon à calculer la largeur max de chaque colonne pour la taille de police courante\r\n\t\tforeach($this->tableContent as $j=>$row) {\r\n\t\t\tforeach($row as $i=>$cell) {\r\n\t\t\t\t$htmlContent = $cell['content'].\"<br />\";\r\n\t\t\t\tif ($this->tableContent[$j][$i]['TH']) {\r\n\t\t\t\t\t$htmlContent=\"<B>$htmlContent</B>\";\r\n\t\t\t\t}\r\n\t\t\t\tlist($width,$height)=$this->CellSize($htmlContent,$tableFontFamily,$tableFontSize,$LineFeedHeight,$cellmargin,$fixed_width?$this->columnProp[$i]['w']:0);\r\n\r\n\t\t\t\tif (!$fixed_width)\r\n\t\t\t\t\t$this->columnProp[$i]['w'] = max($this->columnProp[$i]['w'],$width);\r\n\t\t\t\t$this->lineProp[$j]['h'] = max($this->lineProp[$j]['h'],$height)+0.3;\r\n\t\t\t}\r\n\t\t}\r\n\t\t// Repris de CalcWidth : calcul de la largeur de la table\r\n\t\t$TableWidth=0.0;\r\n\t\tforeach($this->columnProp as $col) {\r\n\t\t\t$TableWidth += $col['w'];\r\n\t\t}\r\n\t} while (!$fixed_width && $maxiter--);\r\n\r\n\t//-----------\r\n\t//\tEnvoi du tableau dans le flux PDF\r\n\t//-----------\r\n\r\n\t$this->SetFont($tableFontFamily, '', $tableFontSize);\r\n\t//Calcule l'abscisse du tableau\r\n\tif($align=='C')\r\n\t\t$this->TableX=max(($this->w-$TableWidth)/2, 0);\r\n\telseif($align=='R')\r\n\t\t$this->TableX=max($this->w-$this->rMargin-$TableWidth, 0);\r\n\telse\r\n\t\t$this->TableX=$this->lMargin;\r\n\r\n\t$ci=0;\t# flip-flop pour couleur de fond de ligne\r\n\tforeach($this->tableContent as $j=>$row) {\r\n\t\t$this->SetX($this->TableX);\r\n\t\t$fill = !empty($this->RowColors[$ci]);\r\n\t\tif ($fill) {\r\n\t\t\t$this->SetFillColor($this->RowColors[$ci][0],\r\n\t\t\t\t\t\t\t\t$this->RowColors[$ci][1],\r\n\t\t\t\t\t\t\t\t$this->RowColors[$ci][2]);\r\n\t\t}\r\n\r\n\t\tforeach($this->tableContent[$j] as $i=>$cell) {\r\n\t\t\tif ($this->tableContent[$j][$i]['TH'] == true) {\r\n\t\t\t\t$this->SetFont($tableFontFamily, 'B', $tableFontSize);\r\n\t\t\t\t$this->SetFillColor(255, 255, 0);\t// jaune\r\n\t\t\t\t$fill=1;\r\n\t\t\t}\r\n\t\t\t$this->OutputCell(\r\n\t\t\t\t$this->columnProp[$i]['w'],\r\n\t\t\t\t$this->lineProp[$j]['h'],\r\n\t\t\t\t$cell['content'],\r\n\t\t\t\t1,\r\n\t\t\t\t$LineFeedHeight,\r\n\t\t\t\t$this->columnProp[$i]['a'],\r\n\t\t\t\t$fill,0);\r\n\r\n\t\t\tif ($this->tableContent[$j][$i]['TH']) {\r\n\t\t\t\t$this->SetFont('', '', $tableFontSize);\r\n\t\t\t\t$this->SetFillColor(255);\t// blanc\r\n\t\t\t}\r\n\t\t}\r\n\t\t$ci=1-$ci;\r\n\t\t$this->maxLineWidth = max($this->maxLineWidth,$this->x);\r\n\t\t$this->Ln($this->lineProp[$j]['h']);\r\n\t}\r\n\r\n\t$this->SetFont($oldFontFamily, '', $oldFontSizePt);\r\n\t$this->Ln($LineFeedHeight);\r\n}",
"public function renderChangesTable($revision_one, $revision_two)\n {\n $this->setMetadataVariables($revision_one, $revision_two);\n $details = $this->getDetails();\n $headers = array_keys(current($this->latest_metadata));\n ?>\n <div class=\"row\">\n <div class=\"col-sm-12 col-md-3\" style=\"margin-bottom:20px\">\n <u><b>Details regarding changes between versions</b></u>\n <?php\n if (!empty($details))\n {\n print \"<ul>\";\n print \"<li style='color: green'>Fields added: \" . $details[\"num_fields_added\"] . \"</li>\";\n print \"<li style='color: red'>Fields deleted: \" . $details[\"num_fields_deleted\"] . \"</li>\";\n print \"<li>Fields modified: \" . $details[\"num_fields_modified\"] . \"</li>\";\n print \"<li>Total fields <b>BEFORE</b> changes: \" . $details[\"total_fields_before\"] . \"</li>\";\n print \"<li>Total fields <b>AFTER</b> changes: \" . $details[\"total_fields_after\"] . \"</li>\";\n print \"</ul>\";\n }\n ?>\n </div>\n <div class=\"col-sm-12 col-md-3\" style=\"margin-bottom:20px\">\n <table cellspacing=\"0\" cellpadding=\"0\" border=\"1\">\n <tbody>\n <tr>\n <td style=\"padding: 5px; text-align: left; background-color: black !important; color: white !important; font-weight: bold;\">\n KEY for Comparison Table below\n </td>\n </tr>\n <tr>\n <td style=\"padding: 5px; text-align: left;\">\n White cell = no change\n </td>\n </tr>\n <tr>\n <td style=\"padding: 5px; text-align: left; background-color: #FFFF80 !important;\">\n Yellow cell = field changed (Black text = current value, <font color=\"#909090\">Gray text = old value</font>)\n </td>\n </tr>\n <tr>\n <td style=\"padding: 5px; text-align: left; background-color: #7BED7B !important;\">\n Green cell = new project field\n </td>\n </tr>\n <tr>\n <td style=\"padding: 5px; text-align: left; background-color: #FE5A5A !important;\">\n Red cell = deleted project field\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n </div>\n <div>\n <?php if (empty($this->metadata_changes)) :?>\n <h4>Table of Changes</h4>\n <p>The data dictionaries are identical</p>\n <?php else: ?>\n <form action=\"<?php print $this->getUrl(\"DownloadTable.php\"); ?>\" method=\"post\">\n <h4>Table of Changes <button class=\"btn btn-link\" type=\"submit\" data-toggle=\"tooltip\" title=\"There are two new columns in the CSV: changed_fields (which contains a short list of all changes made in a field), and change_details (which stores the old values for the field, while new values are contained in the associated column). These columns may be hard to see when using Excel. If so, please wrap your text.\">Download</button></h4>\n <input name=\"revision_one\" type=\"hidden\" value=\"<?php print $revision_one;?>\"></input><input name=\"revision_two\" type=\"hidden\" value=\"<?php print $revision_two;?>\"></input>\n </form>\n <table>\n <thead>\n <tr>\n <?php foreach($headers as $header) { print \"<th><b>$header</b></th>\"; } ?>\n </tr>\n </thead>\n <?php \n foreach($this->metadata_changes as $field => $metadata) {\n $html = \"\";\n\n if (is_null($this->furthest_metadata[$field])) // New field\n {\n $html .= \"<tr style='background-color:#7BED7B'>\";\n }\n else if (is_null($this->latest_metadata[$field])) // Deleted field\n {\n $html .= \"<tr style='background-color:#FE5A5A'>\";\n }\n else\n {\n $html =\"<tr>\";\n }\n\n foreach($metadata as $key => $attr)\n {\n $attr = strip_tags($attr);\n if (is_null($this->furthest_metadata[$field]) || is_null($this->latest_metadata[$field]))\n { \n $html .= \"<td>\" . ($attr ? $attr : \"n/a\") . \"</td>\";\n }\n else // Modified field\n {\n $old_value = strip_tags($this->furthest_metadata[$field][$key]);\n if ($attr != $old_value)\n {\n $html .= \"<td style='background-color:#FFFF80'><p>\" . ($attr ? $attr : \"(no value)\") . \"</p><p style='color:#aaa'>\" . ($old_value ? $old_value : \"(no value)\"). \"<p></td>\";\n }\n else\n {\n $html .= \"<td name='row[]'>\" . ($attr ? $attr : \"n/a\") . \"</td>\";\n }\n }\n }\n\n $html .= \"</tr>\";\n print $html;\n }\n ?>\n </table>\n <?php endif?>\n </div>\n <?php\n }",
"public function table($element) {\n return render($element);\n }",
"public static function isEqual(Piwik_DataTable $table1, Piwik_DataTable $table2)\n {\n $rows1 = $table1->getRows();\n $rows2 = $table2->getRows();\n\n $table1->rebuildIndex();\n $table2->rebuildIndex();\n\n if ($table1->getRowsCount() != $table2->getRowsCount()) {\n return false;\n }\n\n foreach ($rows1 as $row1) {\n $row2 = $table2->getRowFromLabel($row1->getColumn('label'));\n if ($row2 === false\n || !Piwik_DataTable_Row::isEqual($row1, $row2)\n ) {\n return false;\n }\n }\n\n return true;\n }",
"function Row_Rendering() {\n\n\t\t// Enter your code here\t\n\t}",
"function Row_Rendering() {\n\n\t\t// Enter your code here\t\n\t}",
"public function html() : string\n {\n $table = \"<table class=\\\"multiplicationTable\\\">\";\n\n for ($row = 1; $row <= $this->rows + 1; $row++) {\n $table .= \"<tr>\";\n\n for ($column = 1; $column <= $this->columns + 1; $column++) {\n if ($row == 1 && $column == 1) {\n $table .= \"<td class=\\\"bold highlighted\\\">X</td>\";\n } elseif ($row == 1) {\n $table .= \"<td class=\\\"bold highlighted\\\">\" . ($column - 1) . \"</td>\";\n } elseif ($column == 1) {\n $table .= \"<td class=\\\"bold highlighted\\\">\" . ($row - 1) . \"</td>\";\n } else {\n $table .= \"<td>\" . ($row - 1) * ($column - 1) . \"</td>\";\n }\n }\n\n $table .= \"</tr>\";\n }\n\n $table .= \"</table>\";\n\n return $table;\n }",
"public function isAllTableSameWidth()\n {\n return $this->sameWide;\n }",
"public function TableItem($text, $align, $width, $height, $left, $line) {\n\n\t// include text translations\n\tinclude('fixed.php');\n\tinclude('data.php'); // Load Testing Data\n \n\t$this->SetX($left);\n $this->SetLineWidth(0.1);\n\n\t\n\t$this->SetFont($formatting[$lang]['font'], '', 6.5, false);\n//\t$this->setTextShadow(array('enabled'=>false, 'depth_w'=>0, 'depth_h'=>0, 'color'=>false, 'opacity'=>1, 'blend_mode'=>'Normal'));\n\t//$this->SetTextColor(255, 0, 0); \n\n\n\tforeach ($text as $i => $value) {\n\t\n\t if ($line % 2 == 0) {\n\t \t$this->SetFillColor(235, 235, 235);\n\t \t//$this->SetTextColor(255, 0, 0); \n\t } else {\n\t \t$this->SetFillColor(255, 255, 255);\n\t \t//$this->SetTextColor(0, 0, 255); \n\t }\n $this->SetLineWidth(0.05); \n\t$this->MultiCell($width[$i], $height, $value, 'LR', $align[$i], 1, 0, '', '', true);\n\n\t\n\t}\n\t\n\t$this->Ln();\n \n return;\n \n}",
"public function render($a, $b) {\n return $a === $b;\n }",
"public function render()\n {\n return view('components.table.row');\n }",
"function FancyTable($data, $type, $sortby) {\r\n $this->SetFillColor(255, 0, 0);\r\n $this->SetTextColor(255);\r\n // $this->SetDrawColor(128, 0, 0);\r\n $this->SetLineWidth(.3);\r\n $this->SetFont('Arial', 'B', 14);\r\n\r\n // Color and font restoration\r\n $this->SetFillColor(220, 220, 220);\r\n $this->SetTextColor(0);\r\n $this->SetFont('');\r\n\r\n $w = $GLOBALS[\"width\"];\r\n $fill = false;\r\n\r\n $eId = $_GET[\"eId\"];\r\n if (isset($_GET[\"printall\"]))\r\n $printall = $_GET[\"printall\"];\r\n else\r\n $printall = 0;\r\n\r\n\r\n if ($eId == 999999 && $printall != 0) {\r\n for ($counter = 0; $counter < sizeof($data[1]); $counter++) {\r\n $row = $data[1][$counter];\r\n $this->SetFont('Arial', '', 14);\r\n $this->Cell($w[0], 9, number_format($row[\"school_id\"]), 'LR', 0, 'L', $fill);\r\n $this->Cell($w[1], 9, $row[\"school_name\"], 'LR', 0, 'L', $fill);\r\n $this->Cell($w[2], 9, number_format($row[\"marks_sum\"]), 'LR', 0, 'L', $fill);\r\n $this->Ln();\r\n $fill = !$fill;\r\n }\r\n } else {\r\n for ($counter = 0; $counter < sizeof($data[0]); $counter++) {\r\n $row = $data[0][$counter];\r\n $this->SetFont('Arial', '', 14);\r\n $this->Cell($w[0], 9, number_format($row[\"regn_number\"]), 'LR', 0, 'L', $fill);\r\n $this->Cell($w[1], 9, $row[\"name\"], 'LR', 0, 'L', $fill);\r\n $this->Cell($w[2], 9, $row[\"school_name\"], 'LR', 0, 'L', $fill);\r\n $this->Cell($w[3], 9, $row[\"event_name\"], 'LR', 0, 'L', $fill);\r\n $this->Cell($w[4], 9, number_format($row[\"position\"]), 'LR', 0, 'L', $fill);\r\n $this->Ln();\r\n $fill = !$fill;\r\n }\r\n }\r\n }",
"function drawSimpleRow($color, $text) {\r\n\t\t\t\techo(\"<tr align = 'center' bgcolor = '$color'>\");\r\n\t\t\t\t\techo(\"<td colspan = '8'>$text</td>\");\r\n\t\t\t\techo(\"</tr>\");\r\n\t\t\t}",
"public function render()\n {\n return view('components.table-div-theader');\n }",
"public function render()\n {\n return view('components.table-row');\n }",
"protected function renderTableBlockReplace(array $block): string\n {\n if ($this->options['detailLevel'] === 'none') {\n return\n $this->renderTableBlockDelete($block) .\n $this->renderTableBlockInsert($block);\n }\n\n $ret = '';\n\n $oldLines = $block['old']['lines'];\n $newLines = $block['new']['lines'];\n\n $oldLinesCount = \\count($oldLines);\n $newLinesCount = \\count($newLines);\n\n // if the line counts changes, we treat the old and the new as\n // \"a line with \\n in it\" and then do one-line-to-one-line diff\n if ($oldLinesCount !== $newLinesCount) {\n [$oldLines, $newLines] = $this->markReplaceBlockDiff($oldLines, $newLines);\n $oldLinesCount = $newLinesCount = 1;\n }\n\n $oldLines = $this->customFormatLines($oldLines, SequenceMatcher::OP_DEL);\n $newLines = $this->customFormatLines($newLines, SequenceMatcher::OP_INS);\n\n // now $oldLines must has the same line counts with $newlines\n for ($no = 0; $no < $newLinesCount; ++$no) {\n $mergedLine = $this->mergeReplaceLines($oldLines[$no], $newLines[$no]);\n\n // not merge-able, we fall back to separated form\n if (!isset($mergedLine)) {\n $ret .=\n $this->renderTableBlockDelete($block) .\n $this->renderTableBlockInsert($block);\n\n break;\n }\n\n $ret .= $this->renderTableRow('rep', SequenceMatcher::OP_REP, $mergedLine);\n }\n\n return $ret;\n }",
"function display() {\n echo'<table cols=\"3\" style=\"font-size:large; font-weight:bold\">';\n echo'<tr>'; //first row\n for ($pos = 0; $pos < 9; $pos++) {\n echo $this->show_cell($pos);\n if ($pos % 3 == 2)\n echo '</tr><tr>'; //next square is in a new row\n }\n echo'</tr>';\n echo'</table>';\n }",
"public function renderFilterCell() {\r\n echo CHtml::openTag('td', $this->filterHtmlOptions);\r\n echo '<div class=\"filter-container\">';\r\n $this->renderFilterCellContent();\r\n echo '</div>';\r\n echo CHtml::closeTag('td');\r\n }",
"public function render()\n\t{\n\n\t\t$table = \"<table\";\n\n\t\t// Add all attributes\n\t\tforeach ($this->attributes as $key => $value) {\n\t\t\t$table .= ' ' . $key . '=\"' . $value .'\"';\n\t\t}\n\n\t\t$table .= \">\"; // Close table\n\n\t\t// Add the head\n\t\tif ($this->showHeadRow) {\n\t\t\t$table .= \"<thead><tr>\";\n\n\t\t\t// Show the number header.\n\t\t\tif ($this->showNumberColumn) {\n\t\t\t\t$table .= \"<th>#</th>\";\n\t\t\t}\n\n\t\t\tforeach ($this->columns as $column) {\n\t\t\t\t$columnHeadTitle = isset($column['headTitle']) ? $column['headTitle'] : $column[0];\n\t\t\t\t$table .= \"<th>\" . $columnHeadTitle . \"</th>\";\n\t\t\t}\n\n\t\t\t$table .= \"</tr></thead>\"; // finish head\n\t\t}\n\n\t\t// Body\n\t\t$table .= \"<tbody>\";\n\n\t\t$row = $this->numberColumnOffset;\n\n\t\tif (count($this->data) == 0) {\n\t\t\t// Show a no data entry\n\t\t\t$colspan = count($this->columns) + ($this->showNumberColumn ? 1 : 0);\n\t\t\t$table .= '<tr><td colspan=\"'.$colspan.'\"><p align=\"center\" style=\"font-weight:bold;\">Keine Einträge</p></td></tr>';\n\t\t}\n\t\telse {\n\t\t\tforeach ($this->data as $dataObject) {\n\n\t\t\t\t// Row attributes\n\t\t\t\t$attributes = $this->rowAttributes;\n\t\t\t\tif (!is_array($attributes)) {\n\t\t\t\t\tif (is_callable($this->rowAttributes)) {\n\t\t\t\t\t\t$callable = $this->rowAttributes;\n\t\t\t\t\t\t$attributes = $callable($dataObject);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t$attributeString = '';\n\t\t\t\tif ($attributes) {\t\t// Add attributes if we have some\n\t\t\t\t\tforeach ($attributes as $attributeName => $attributeValue) {\n\t\t\t\t\t\t$attributeString .= $attributeName . '=\"' . $attributeValue . '\" ' ;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ($this->rowIdDataMethod) {\n\t\t\t\t\t// method name or closure?\n\t\t\t\t\t$id = '';\n\t\t\t\t\tif (is_string($this->rowIdDataMethod)) {\n\t\t\t\t\t\t$id = $dataObject->{$this->rowIdDataMethod}(); // Call the row data method\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t$rf = new \\ReflectionFunction($this->rowIdDataMethod);\n\t\t\t\t\t\tif ($rf->isClosure()) {\n\t\t\t\t\t\t\t// we got a closure\n\t\t\t\t\t\t\t$closure = $this->rowIdDataMethod;\n\t\t\t\t\t\t\t$id = $closure($dataObject);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\n\n\t\t\t\t\t$table .= '<tr id=\"'. $id .'\" ' . $attributeString . '>'; // Start row with id\n\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$table .= \"<tr \". $attributeString .\">\";\t// Start row without id\n\t\t\t\t}\n\n\t\t\t\t// Number?\n\t\t\t\tif ($this->showNumberColumn) {\n\t\t\t\t\t$table .= \"<td>\" . $row . \"</td>\";\n\t\t\t\t}\n\n\t\t\t\tforeach ($this->columns as $column) {\n\t\t\t\t\t$dataMethod = isset($column['dataMethod']) ? $column['dataMethod'] : $column[1];\n\t\t\t\t\tif (is_string($dataMethod)) {\n\t\t\t\t\t\t// Just call the method an insert the return value into the table cell\n\t\t\t\t\t\t$table .= \"<td>\". $dataObject->$dataMethod() .\"</td>\";\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t$rf = new \\ReflectionFunction($dataMethod);\n\t\t\t\t\t\tif ($rf->isClosure()) {\n\n\t\t\t\t\t\t\t// Call the closure and get the result\n\t\t\t\t\t\t\t$value = $dataMethod($dataObject, $this);\n\n\t\t\t\t\t\t\t$table .= \"<td>\". $value .\"</td>\";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t$table .= \"</tr>\";\t// End the table row\n\t\t\t\t$row++;\n\t\t\t}\n\n\t\t\t// Render the footer row\n\t\t\t$table = $this->renderFooter($table);\n\n\t\t}\n\n\t\t$table .= \"</tbody>\";\n\n\t\t$table .= \"</table>\";\n\t\treturn $table;\n\t}",
"public function testCellRender(): void\n {\n $cell = $this->View->cell('Articles::teaserList');\n $render = \"{$cell}\";\n\n $this->assertSame('teaser_list', $cell->viewBuilder()->getTemplate());\n $this->assertStringContainsString('<h2>Lorem ipsum</h2>', $render);\n $this->assertStringContainsString('<h2>Usectetur adipiscing eli</h2>', $render);\n $this->assertStringContainsString('<h2>Topis semper blandit eu non</h2>', $render);\n $this->assertStringContainsString('<h2>Suspendisse gravida neque</h2>', $render);\n\n $cell = $this->View->cell('Cello');\n $this->assertInstanceOf('TestApp\\View\\Cell\\CelloCell', $cell);\n $this->assertSame(\"Cellos\\n\", $cell->render());\n }"
] |
[
"0.6002137",
"0.58134294",
"0.5521011",
"0.5475902",
"0.54481405",
"0.53713137",
"0.5325261",
"0.52899355",
"0.5217159",
"0.52142495",
"0.51913327",
"0.5176212",
"0.5167724",
"0.5084435",
"0.5081667",
"0.5081667",
"0.5074342",
"0.5046094",
"0.50021935",
"0.49961752",
"0.49466744",
"0.49321747",
"0.4920192",
"0.49148896",
"0.4893753",
"0.4893046",
"0.48912102",
"0.48878217",
"0.48860076",
"0.48822665"
] |
0.7297379
|
0
|
Renderer the table block: insert.
|
protected function renderTableBlockInsert(array $block): string
{
$block['new']['lines'] = $this->customFormatLines(
$block['new']['lines'],
SequenceMatcher::OP_INS,
);
$ret = '';
foreach ($block['new']['lines'] as $newLine) {
$ret .= $this->renderTableRow('new', SequenceMatcher::OP_INS, $newLine);
}
return $ret;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function insert() {\n \n }",
"function insert()\n\t{\n\t\t$this->edit(true);\n\t}",
"function insert() {\n\t\tglobal $tpl;\n\n\t\t$form = $this->initForm(TRUE);\n\t\t$tpl->setContent($form->getHTML());\n\t}",
"public function insert()\n {\n \n }",
"function Row_Rendering() {\n\n\t\t// Enter your code here\t\n\t}",
"function Row_Rendering() {\n\n\t\t// Enter your code here\t\n\t}",
"protected function insert()\n\t{\n\t\t$this->autofill();\n\n\t\tparent::insert();\n\n\t}",
"protected function renderTableSeparateBlock(): string\n {\n return\n '<tbody class=\"skipped\">' .\n '<tr>' .\n '<td></td>' .\n '</tr>' .\n '</tbody>';\n }",
"function renderInsert(){\n\t\t$new =[];\n\t\t$pengguna = new ModelPengguna($this->db);\n\t\t$produk = new ModelProduk($this->db);\n\n\t\t$allProduk = $produk->all();\n\t\t$newId = $produk->getMaxIdProduk()[0]['maximum']+1;\n\t\tarray_push($new,$newId);\n\t\t$this->f3->set('sp',$allProduk);\t\n\t\t$ID= $this->f3->get('SESSION.user');\t\n\t\t$pgn = $pengguna->getByID($ID);\n\t\t$role = $this->f3->get('SESSION.role');\n\n\t\t$this->f3->set('pgn',$pengguna);\n\t\t$this->f3->set('newId',$new);\n\t\tif($role==1){\n\t\t\t$template = new Template;\n\t\t\techo $template->render('InsertPage.htm');\n\t\t}\n\t\telse{\n\t\t\t$this->f3->reroute('/pengguna');\n\t\t}\n\t}",
"public function insert()\n {\n }",
"public function insert()\n {\n }",
"public function insertRow($row);",
"public static function insert()\n {\n }",
"function insert($table, $data, $format = null){\n\t\treturn $this->_insert_replace_helper($table, $data, $format, 'INSERT');\n\t}",
"protected function _insert()\n {\n \n }",
"protected function _insert()\n {\n \n }",
"function view_new(){\n echo \"<tr onclick='record.select(this)' id='{$this->entity->name}'>\";\n //\n //loop through the column and out puts its td element.\n foreach ($this->entity->columns as $col){\n //\n //Get the tds for every column\n echo $col->view();\n }\n //\n echo \"</tr>\";\n }",
"protected function doInsert() {\n return '';\n }",
"public function insert(Table $table, $row);",
"public function insert()\n {\n # code...\n }",
"function insert(){\r\n $this->model->randomInsert();\r\n $this->index();\r\n }",
"protected function _insert()\n\t{\n\t}",
"function insert_template()\n {\n $parameter_array = $this->get_parameter_array();\n \n parent::insert('sssis', $parameter_array);\n }",
"protected function write_pre_td(&$cur)\r\n\t{\r\n\t\t?>\r\n\t\t<td style=\"text-align:center;\" id=\"ccms_<?php echo $this->objectname;?>_pic_<?php echo $cur[0];?>\">\r\n\t\t\t<a href=\"javascript:open_showwindow_<?php echo $this->objectname;?>('<?php echo $cur[0];?>');\">\r\n\t\t\t\t<img src=\"<?php echo $this->webpath.$cur[1]; ?>\" alt=\"<?php echo htmlspecialchars($cur[2]);?>\" title=\"<?php echo htmlspecialchars($cur[2]);?>\"<?php\r\n\t\t\t\tif(!empty($this->picstyle))\r\n\t\t\t\t\techo \" class=\\\"\".$this->picstyle.\"\\\"\";\r\n\t\t\t\t?> />\r\n\t\t</a>\r\n\t\t<?php if($this->editmode == 1){ ?>\r\n\t\t\t<br />\r\n\t\t\t<a target=\"ccms_iframe_<?php echo $this->objectname;?>\" class=\"ccms_headeditlink\" href=\"<?php echo CCMS_IFRAMEPATH;?>pictureshow.php?id=<?php echo $this->myid;?>&picname=<?php echo $cur[0];?>&picprename=<?php echo $cur[1];?>\" >Delete</a>\r\n\t\t<?php } ?>\r\n\t\t</td>\r\n\t\t<?php\t\r\n\r\n\t}",
"public function insert() {\r\n return View::make('bus.insert');\r\n }",
"function formatRow(){\n $this->hook('formatRow');\n }",
"public abstract function Insert();",
"public function insertView() {\n $uiObjectName = $this->type.'_Ui';\n $uiObject = new $uiObjectName($this->object);\n return $uiObject->renderForm(array('values'=>$this->values,\n 'action'=>url($this->type.'/insert', true),\n 'class'=>'formAdmin formAdminInsert'));\n }",
"public function addRow() {\n if ($this->linesCount >= 0)\n $this->addContent('</div>');\n $this->linesCount ++;\n $this->colunsCount = 0;\n $this->addContent('<div class=\"row\" >');\n }",
"public abstract function insert();"
] |
[
"0.62343556",
"0.6142746",
"0.6015803",
"0.6014161",
"0.60111696",
"0.60111696",
"0.5970586",
"0.59260947",
"0.58540404",
"0.5833225",
"0.5833225",
"0.5812938",
"0.57923853",
"0.5781786",
"0.57694745",
"0.57694745",
"0.57594526",
"0.5754859",
"0.57356036",
"0.5732808",
"0.5694176",
"0.5671185",
"0.5663482",
"0.56380653",
"0.56120807",
"0.5609602",
"0.55903286",
"0.55819494",
"0.5554457",
"0.5551924"
] |
0.6971927
|
0
|
Renderer the table block: delete.
|
protected function renderTableBlockDelete(array $block): string
{
$block['old']['lines'] = $this->customFormatLines(
$block['old']['lines'],
SequenceMatcher::OP_DEL,
);
$ret = '';
foreach ($block['old']['lines'] as $oldLine) {
$ret .= $this->renderTableRow('old', SequenceMatcher::OP_DEL, $oldLine);
}
return $ret;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function callbackRowDelete() {\n $this->deleted = true;\n foreach(array_keys($this->widgets) as $w) {\n $this->widgets[$w]->hide();\n $this->table->table->remove($this->widgets[$w]);\n $this->widgets[$w]->destroy();\n }\n $this->deleteMenuItem->hide();\n \n $this->table->deleteMenu->remove($this->deleteMenuItem);\n $this->deleteMenuItem->destroy();\n $this->table->frame->hide();\n $this->table->frame->show();\n }",
"public function renderDelete()\n {\n // Is valid record\n $result = $this->prepareRecord();\n if ($result instanceof \\Illuminate\\Http\\RedirectResponse) {\n $this->redirect($result);\n }\n // Render View\n $parameters = array(\n \"Scaffolding\" => $this,\n );\n $content = view($this->template . \".delete\", $parameters)->render();\n return $content;\n }",
"public function render()\n {\n return \\view('lwcrud::components.delete-button');\n }",
"function delete()\n {\n if ($this->GET('sure')) {\n $function = basename($this->table->tablename()) . \"_onRowDelete\";\n if (function_exists($function)) {\n $function($this->table->data($this->GET('id')), &$this->table);\n }\n\n $this->table->delete($this->GET('id'));\n $this->table->write();\n $this->browse();\n return;\n }\n $this->displayHead();\n echo 'Do you really want to<br>delete row \\'' . $this->GET('id') . '\\'?<p>';\n echo '<a class=\"danger\" href=\"' . $this->SELF . '?method=delete&table=' . $this->table->tablename() . '&id=' . $this->GET('id') . '&sure=1\">Yes</a> | ';\n echo '<a href=\"' . $this->SELF . '?method=browse&table=' . $this->table->tablename() . '\">No</a>';\n }",
"function showDelete($path)\n\t{\n\t\t$this->table->deleteColumn = true;\n\t\t$this->table->deletelink = $path;\n\t}",
"function delete()\r\n\t{\r\n\t\t// Check for request forgeries\r\n\t\tJRequest::checkToken() or die( 'Invalid Token' );\r\n\t\tglobal $mainframe;\r\n\t\t$model\t= &$this->getModel( 'table' );\r\n\t\t$ids = JRequest::getVar('ids', array(), 'request', 'array');\r\n\t\t$model->deleteRows( $ids );\r\n\t\tif ( JRequest::getVar('format') == 'raw') {\r\n\t\t\tJRequest::setVar( 'view', 'table' );\r\n\t\t\t$this->display();\r\n\t\t} else {\r\n\t\t\t//@TODO: test this\r\n\t\t\t$ref = JRequest::getVar( 'fabrik_referrer', \"index.php\", 'post' );\r\n\t\t\t$mainframe->redirect( $ref, count($ids) . \" \" . JText::_( 'RECORDS DELETED' ) );\r\n\t\t}\r\n\t}",
"public function delete(){\n if (isset($this->content[$this->idField])) {\n\n $sql = \"DELETE FROM {$this->table} WHERE {$this->idField} = {$this->content[$this->idField]};\";\n $delet = new \\AR\\BD\\Delete();\n $delet->ExeDelete($this->table, \"WHERE {$this->idField} = {$this->content[$this->idField]}\", \"\");\n \n }\n }",
"public function render()\n {\n return view('components.element.delete');\n }",
"function doRealDelete()\n {\n /* Query data of this section */\n $this->dbQuerySingle();\n /* Check the presence of GET or POST parameter 'returntoparent'. */\n $this->processReturnToParent();\n /* The function above sets $this->rs to values that shall be\n displayed. By assigning $this->rs to Smarty variable 'section'\n we can fill the values of $this->rs into a template. */\n $this->_smarty->assign('section', $this->rs);\n\n /* Delete the record */\n $this->dbDeleteById();\n /* Delete the corresponding counter */\n $this->dbDeleteCounterById();\n\n /* Left column contains administrative menu */\n $this->_smarty->assign('leftcolumn', \"leftadmin.tpl\");\n }",
"public function delete (){\n\n $table = new simple_table_ops();\n $table->set_id_column('timetable_id');\n $table->set_table_name('timetables');\n $table->delete();\n\n header(\"Location: http://\".WEBSITE_URL.\"/index.php?controller=timetable&action=show&submit=yes&timetable_period_id={$_GET['timetable_period_id']}\");\n }",
"public function index_delete(){\n\t\t\n\t\t}",
"public function deleting()\n {\n # code...\n }",
"public function action_delete()\n {\n\t $this->template = View::forge('template-admin');\n\n $post = Input::post();\n $entry = Model_Event::find_by_pk($post[\"id\"]);\n\t\tif ($entry){\n\t\t\tif(!$entry->delete()){\n\t\t\t\t$data[\"events\"] = Model_Event::find_all();\n\t\t\t\t$this->template->title = \"イベント一覧\";\n\t\t\t\t$this->template->content = View::forge('event/index', $data);\n\t\t\t}\n\t\t}\n\t\t$data[\"events\"] = Model_Event::find_all();\n\t\t$this->template->title = \"イベント一覧\";\n\t\t$this->template->content = View::forge('event/index', $data);\n }",
"function delete()\n {\n }",
"public function delete() {\n $this->remove_content();\n\n parent::delete();\n }",
"function delete()\n\t{\n\t\tSQL::query(\"delete from {$this->_table} where id = {$this->_data['id']}\");\n\t}",
"public function deleteAction()\n {\n $itemGroupRowId = $this->getRequest()->getParam('containerRowId');\n \n //get eventId of the event to be deleted\n $itemGroupId = $this->getRequest()->getParam('containerId');\n\n // get form\n $form = $this->_model->getForm('delete');\n \n //set form action\n //define form action\n $form->setAction($this->view->url(\n array(\n 'controller' => 'itemgrouprow',\n 'action' => 'delete',\n 'containerId' => $itemGroupId,\n 'containerRowId' => $itemGroupRowId,\n ),\n \n 'event'\n ));\n \n $this->processDelete(\n $form, \n 'msg_itemgrouprow_deleted',\n $this->view->url(\n array(\n 'controller' => 'itemgrouprow',\n 'action' => 'index',\n 'containerId' => $itemGroupId),\n 'event'\n ),\n $itemGroupRowId\n );\n }",
"public function deleteAction() {\n parent::deleteAction();\n }",
"public function actionDelete() {}",
"public function actionDelete() {}",
"function renderFileDeletion($record) {\n\n\t\t$single_Code = tslib_CObj::getSubpart($this->fileContent, '###FILE_DELETION###');\n\t\t// Formating Timefields and filesize\n\t\t$record['tstamp'] = date('d.m.Y', $record['tstamp']);\n\t\t$record['crdate'] = date('d.m.Y', $record['crdate']);\n\t\t#$record['file_size'] = t3lib_div::formatSize($record['file_size'],' bytes | kb| mb| gb');\n\n\t\t// converting all fields in the record to marker (recordfields and markername must match)\n\t\t$markerArray = $this->recordToMarkerArray($record);\n\t\t$markerArray = $markerArray + $this->substituteLangMarkers($single_Code);\n\t\t$markerArray['###FORM_URL###'] = $this->cObj->typolink('', $this->conf['filelist.']['fileDeleteMessage.']['form_url.']);\n\t\t$hiddenFields = '<input type=\"hidden\" name=\"deleteUID\" value=\"' . $record['uid'] . '\" />';\n\t\t$markerArray['###HIDDENFIELDS###'] = $hiddenFields;\n\t\t$this->pi_loadLL();\n\t\t$content = tslib_cObj::substituteMarkerArray($single_Code, $markerArray);\n\t\t$content = tslib_cObj::substituteMarker($content, '###CATEGORY###', $this->cObj->cObjGetSingle($this->conf['singleView.']['category.']['cObject'], $this->conf['singleView.']['category.']['cObject.']));\n\t\t$content = tslib_cObj::substituteMarker($content, '###TITLE_SINGLEVIEW###', $record['title']);\n\t\t$content = tslib_cObj::substituteMarker($content, '###CR_DATE_HEADER###', $this->pi_getLL('CR_DATE_HEADER'));\n\t\t$content = tslib_cObj::substituteMarker($content, '###FILE_SIZE_HEADER###', $this->pi_getLL('FILE_SIZE_HEADER'));\n\t\t$content = tslib_cObj::substituteMarker($content, '###CR_DESCRIPTION_HEADER###', $this->pi_getLL('CR_DESCRIPTION_HEADER'));\n\t\t$content = tslib_cObj::substituteMarker($content, '###COPYRIGHT_HEADER###', $this->pi_getLL('COPYRIGHT_HEADER'));\n\t\t$content = tslib_cObj::substituteMarker($content, '###FILETYPE_HEADER###', $this->pi_getLL('FILETYPE_HEADER'));\n\t\t$content = tslib_cObj::substituteMarker($content, '###LINK_HEADER###', $this->pi_getLL('LINK_HEADER'));\n\t\t$content = tslib_cObj::substituteMarker($content, '###TITLE_SINGLEVIEW_HEADER###', $this->pi_getLL('TITLE_SINGLEVIEW_HEADER'));\n\t\t$content = tslib_cObj::substituteMarker($content, '###LABEL_WARNING###', $this->pi_getLL('LABEL_WARNING'));\n\t\t$content = tslib_cObj::substituteMarker($content, '###MESSAGE_DELETION_WARNING###', $this->pi_getLL('MESSAGE_DELETION_WARNING'));\n\t\t$content = tslib_cObj::substituteMarker($content, '###CONFIRM_DELETION_UID###', $this->cObj->stdWrap('<input name=\"CONFIRM_DELETION\" type=\"submit\" value=\"' . $this->pi_getLL('BUTTON_CONFIRM') . '\">', $this->conf['filelist.']['fileDeleteMessage.']['buttonConfirm.']));\n\t\t$content = tslib_cObj::substituteMarker($content, '###CANCEL_DELETION_UID###', $this->cObj->stdWrap('<input name=\"CANCEL_DELETION\" type=\"submit\" value=\"' . $this->pi_getLL('BUTTON_BACK') . '\">', $this->conf['filelist.']['fileDeleteMessage.']['buttonCancel.']));\n\t\treturn $content;\n\t}",
"public function delete($id = 0) {\n $data[BlockTO::TABLE_NAME] = $this->database->findById($id);\n try {\n $this->database->delete($id);\n } catch (DatabaseException $e) {\n $data[Front::ERRORS] = $e->getMessage();\n Logger::log(LoggerEnum::WARNING, $e->getTraceAsString());\n $this->renderEditForm($data);\n return;\n } catch (Exception $e) {\n $data[Front::ERRORS] = $e->getMessage();\n Logger::log(LoggerEnum::ERROR, $e->getTraceAsString());\n Front::errorsCheck($data);\n $this->renderEditForm($data);\n return;\n }\n redirect('block');\n }",
"public function Admin_Action_DeleteBlock() {\n $blockId = $this->_getPOSTRequest ( 'blockid', 0 );\n if ($blockId) {\n $blockIds = implode ( \"','\", $blockId );\n $query = \"DELETE\" . \" FROM [|PREFIX|]dynamic_content_block \" . \" WHERE blockid in ('\" . $blockIds . \"')\";\n\n if ($result = $this->db->Query ( $query )) {\n // Error message\n FlashMessage ( GetLang ( 'Addon_dynamiccontenttags_DeleteBlock_Success' ), SS_FLASH_MSG_SUCCESS );\n echo GetJSON ( array ('message' => GetFlashMessages (), 'result' => '1' ) );\n return;\n }\n }\n FlashMessage ( GetLang ( 'Addon_dynamiccontenttags_DeleteBlock_Failure' ), SS_FLASH_MSG_ERROR );\n echo GetJSON ( array ('message' => GetFlashMessages (), 'result' => '0' ) );\n return;\n }",
"public function deleteAction() {\n \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 delete() {\n $fetchPrimary = $this->mysqlConnection->query(\"SHOW INDEX FROM \".$this->table);\n $arrayIndex = $fetchPrimary->fetch(PDO::FETCH_ASSOC);\n $kolomIndex = $arrayIndex['Column_name'];\n\n\t\t\t// Delete het huidige record.\n\n\t\t\t$deleteQuery = \"DELETE FROM \".$this->table.\" WHERE \".$kolomIndex.\" = \".$this->originalValues[$kolomIndex];\n\t\t\t$this->lastQuery = $deleteQuery;\n\n $deleteTable = $this->mysqlConnection->prepare($this->lastQuery);\n $deleteTable->execute();\n\n\t\t}",
"public function DELETE() {\n #\n }",
"public function delete()\n {\n try {\n parent::delete(null, $this->data['id']);\n } catch (Exception $e) {\n die('ERROR');\n }\n }",
"function regional_content_form_block_custom_block_delete_alter(&$form, &$form_state) {\n $form['#submit'][] = 'regional_content_form_block_custom_block_delete_submit';\n}",
"function delete_row($table_name, $redirect_filename, $id_column_name, $row_id)\n{\n ?>\n <td>\n <form class=\"form-horizontal\" action=\"<?= $_SERVER['SCRIPT_NAME'] ?>?p=delete\" method=\"post\">\n <input type=\"hidden\" name=\"table\" value=\"<?= $table_name ?>\">\n <input type=\"hidden\" name=\"return\" value=\"<?= $redirect_filename ?>\">\n <input type=\"hidden\" name=\"id_column\" value=\"<?= $id_column_name ?>\">\n <input type=\"hidden\" name=\"id\" value=\"<?= $row_id ?>\">\n <button type=\"submit\" class=\"btn btn-danger btn-xs\"><span class=\"glyphicon glyphicon-trash\"></span> Delete\n </button>\n </form>\n </td>\n <?php\n}"
] |
[
"0.6875197",
"0.6530267",
"0.6465694",
"0.63230854",
"0.6289555",
"0.6286913",
"0.6247387",
"0.6193367",
"0.6185457",
"0.6132531",
"0.6041286",
"0.60357696",
"0.5999281",
"0.5975246",
"0.59517616",
"0.5938059",
"0.58755434",
"0.5868963",
"0.58682895",
"0.58682895",
"0.5864885",
"0.5864859",
"0.58414155",
"0.5825404",
"0.5816627",
"0.5799869",
"0.57894146",
"0.5782381",
"0.57603586",
"0.5749974"
] |
0.72259766
|
0
|
Renderer the table block: replace.
|
protected function renderTableBlockReplace(array $block): string
{
if ($this->options['detailLevel'] === 'none') {
return
$this->renderTableBlockDelete($block) .
$this->renderTableBlockInsert($block);
}
$ret = '';
$oldLines = $block['old']['lines'];
$newLines = $block['new']['lines'];
$oldLinesCount = \count($oldLines);
$newLinesCount = \count($newLines);
// if the line counts changes, we treat the old and the new as
// "a line with \n in it" and then do one-line-to-one-line diff
if ($oldLinesCount !== $newLinesCount) {
[$oldLines, $newLines] = $this->markReplaceBlockDiff($oldLines, $newLines);
$oldLinesCount = $newLinesCount = 1;
}
$oldLines = $this->customFormatLines($oldLines, SequenceMatcher::OP_DEL);
$newLines = $this->customFormatLines($newLines, SequenceMatcher::OP_INS);
// now $oldLines must has the same line counts with $newlines
for ($no = 0; $no < $newLinesCount; ++$no) {
$mergedLine = $this->mergeReplaceLines($oldLines[$no], $newLines[$no]);
// not merge-able, we fall back to separated form
if (!isset($mergedLine)) {
$ret .=
$this->renderTableBlockDelete($block) .
$this->renderTableBlockInsert($block);
break;
}
$ret .= $this->renderTableRow('rep', SequenceMatcher::OP_REP, $mergedLine);
}
return $ret;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function Row_Rendering() {\n\n\t\t// Enter your code here\t\n\t}",
"function Row_Rendering() {\n\n\t\t// Enter your code here\t\n\t}",
"public function replace($table, $data, $format = \\null)\n {\n }",
"protected function renderTableSeparateBlock(): string\n {\n return\n '<tbody class=\"skipped\">' .\n '<tr>' .\n '<td></td>' .\n '</tr>' .\n '</tbody>';\n }",
"protected function renderTableBlock(array $block): string\n {\n switch ($block['tag']) {\n case SequenceMatcher::OP_EQ:\n $content = $this->renderTableBlockEqual($block);\n break;\n case SequenceMatcher::OP_INS:\n $content = $this->renderTableBlockInsert($block);\n break;\n case SequenceMatcher::OP_DEL:\n $content = $this->renderTableBlockDelete($block);\n break;\n case SequenceMatcher::OP_REP:\n $content = $this->renderTableBlockReplace($block);\n break;\n default:\n $content = '';\n }\n\n return '<tbody class=\"change change-' . self::TAG_CLASS_MAP[$block['tag']] . '\">' . $content . '</tbody>';\n }",
"function replace($table, $data, $format = null){\n\t\treturn $this->_insert_replace_helper($table, $data, $format, 'REPLACE');\n\t}",
"public function renderTableBody() {\n //$models = array_values($this->dataProvider->getModels());\n //$keys = $this->dataProvider->getKeys();\n $rows = [];\n \n foreach ($this->dataProvider as $model) {\n if (is_callable($this->beforeRow)) {\n $row = call_user_func($this->beforeRow, $model, $this);\n if (!empty($row)) {\n $rows[] = $row;\n }\n }\n\n $rows[] = $this->renderTableRow($model);\n\n if ($this->afterRow !== null) {\n $row = call_user_func($this->afterRow, $model, $this);\n if (!empty($row)) {\n $rows[] = $row;\n }\n }\n }\n\n if (empty($rows)) {\n $colspan = count($this->columns);\n\n return \"<tbody>\\n<tr><td colspan=\\\"$colspan\\\">\" . $this->renderEmpty() . \"</td></tr>\\n</tbody>\";\n } else {\n return \"<tbody>\\n\" . implode(\"\\n\", $rows) . \"\\n</tbody>\";\n }\n }",
"public function render()\n\t{\n\t\t// convert json to PHP arrays\n\t\tif(!is_array($this->headers))\n\t\t\t$this->headers = $this->extract_json($this->headers);\n\t\tif(!is_array($this->data))\n\t\t\t$this->data = $this->extract_json($this->data);\n\n\t\t// generate a table of the appropriate type with sub-render method\n\t\t$table_html = $this->{\"render_$this->type\"}();\n\t\t\n\t\t// get the snippets directory if set\n\t\tif($this->snippets_dir && file_exists(\"$this->snippets_dir/table.php\"))\n\t\t\t$snippet = \"$this->snippets_dir/table.php\";\n\t\telse\n\t\t\t$snippet = __DIR__ . \"/snippets/table.php\";\n\t\t\n\t\t// build up the replacements array\n\t\t$replacements = array(\n\t\t\t'body' => $table_html,\n\t\t\t'class' => strlen($this->class)?\"class=\\\"$this->class\\\"\":'',\n\t\t\t'id' => strlen($this->id)?\"id=\\\"$this->id\\\"\":'',\n\t\t\t'caption' => strlen($this->caption)?\"<caption>$this->caption</caption>\":'',\n\t\t);\n\t\t\n\t\t$html = \\helpers\\html\\html::load_snippet($snippet, $replacements);\n\n\t\treturn $html;\n\t}",
"public function render()\n {\n return view('avored::system.components.table.cell');\n }",
"public function render()\n\t{\n\t\t$changes = parent::render();\n\t\t$html = '';\n\t\tif(empty($changes)) {\n\t\t\treturn $html;\n\t\t}\n\n\t\t$html .= '<table class=\"Differences DifferencesInline\">';\n\t\t$html .= '<thead>';\n\t\t$html .= '</thead>';\n\t\tforeach($changes as $i => $blocks) {\n\t\t\t// If this is a separate block, we're condensing code so output ...,\n\t\t\t// indicating a significant portion of the code has been collapsed as\n\t\t\t// it is the same\n\t\t\tif($i > 0) {\n\t\t\t\t$html .= '<tbody class=\"Skipped\">';\n\t\t\t\t$html .= '<th>…</th>';\n\t\t\t\t$html .= '<th>…</th>';\n\t\t\t\t$html .= '<td> </td>';\n\t\t\t\t$html .= '</tbody>';\n\t\t\t}\n\n\t\t\tforeach($blocks as $change) {\n\t\t\t\t$html .= '<tbody class=\"Change'.ucfirst($change['tag']).'\">';\n\t\t\t\t// Added lines only on the right side\n\t\t\t\tif($change['tag'] == 'insert') {\n\t\t\t\t\tforeach($change['changed']['lines'] as $no => $line) {\n\t\t\t\t\t\t$html .= '<tr>';\n\t\t\t\t\t\t$html .= '<td class=\"Right\"><ins>'.$line.'</ins> </td>';\n\t\t\t\t\t\t$html .= '</tr>';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Show deleted lines only on the left side\n\t\t\t\telse if($change['tag'] == 'delete') {\n\t\t\t\t\tforeach($change['base']['lines'] as $no => $line) {\n\t\t\t\t\t\t$html .= '<tr>';\n\t\t\t\t\t\t$html .= '<td class=\"Left\"><del>'.$line.'</del> </td>';\n\t\t\t\t\t\t$html .= '</tr>';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Show modified lines on both sides\n\t\t\t\telse if($change['tag'] == 'replace') {\n\t\t\t\t\tforeach($change['base']['lines'] as $no => $line) {\n\t\t\t\t\t\t$html .= '<tr>';\n\t\t\t\t\t\t$html .= '<td class=\"Left\"><span>'.$line.'</span></td>';\n\t\t\t\t\t\t$html .= '</tr>';\n\t\t\t\t\t}\n\n\t\t\t\t\tforeach($change['changed']['lines'] as $no => $line) {\n\t\t\t\t\t\t$html .= '<tr>';\n\t\t\t\t\t\t$html .= '<td class=\"Right\"><span>'.$line.'</span></td>';\n\t\t\t\t\t\t$html .= '</tr>';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$html .= '</tbody>';\n\t\t\t}\n\t\t}\n\t\t$html .= '</table>';\n\t\treturn $html;\n\t}",
"public function renderTableBody()\n {\n $models = array_values($this->dataProvider->getModels());\n $keys = $this->dataProvider->getKeys();\n $rows = [];\n foreach ($models as $index => $model) {\n $key = $keys[$index];\n if ($this->beforeRow !== null) {\n $row = call_user_func($this->beforeRow, $model, $key, $index, $this);\n if (!empty($row)) {\n $rows[] = $row;\n }\n }\n\n $rows[] = $this->renderTableRow($model, $key, $index);\n\n if ($this->afterRow !== null) {\n $row = call_user_func($this->afterRow, $model, $key, $index, $this);\n if (!empty($row)) {\n $rows[] = $row;\n }\n }\n }\n\n if (empty($rows) && $this->emptyText !== false) {\n $colspan = count($this->columns);\n\n return \"<tbody>\\n<tr><td colspan=\\\"$colspan\\\">\" . $this->renderEmpty() . \"</td></tr>\\n</tbody>\";\n }\n\n return \"<tbody>\\n\" . implode(\"\\n\", $rows) . \"\\n</tbody>\";\n }",
"public function render()\n {\n return view('components.table', [\n 'format' => $this->format,\n 'data' => $this->data,\n ]);\n }",
"public function render()\n {\n return view('components.table.row');\n }",
"public function renderComponentsToTable(): void\n {\n $language = $this->getDefaultLanguage();\n $this->table->setHeaders(['Name', 'Language', 'File']);\n foreach ($this->components as $component) {\n $this->table->addRow([$component->name, $language, $component->filename]);\n }\n\n $this->table->render();\n }",
"public function render()\n {\n return view('components.table-row');\n }",
"public function render()\n\t{\n\n\t\t$table = \"<table\";\n\n\t\t// Add all attributes\n\t\tforeach ($this->attributes as $key => $value) {\n\t\t\t$table .= ' ' . $key . '=\"' . $value .'\"';\n\t\t}\n\n\t\t$table .= \">\"; // Close table\n\n\t\t// Add the head\n\t\tif ($this->showHeadRow) {\n\t\t\t$table .= \"<thead><tr>\";\n\n\t\t\t// Show the number header.\n\t\t\tif ($this->showNumberColumn) {\n\t\t\t\t$table .= \"<th>#</th>\";\n\t\t\t}\n\n\t\t\tforeach ($this->columns as $column) {\n\t\t\t\t$columnHeadTitle = isset($column['headTitle']) ? $column['headTitle'] : $column[0];\n\t\t\t\t$table .= \"<th>\" . $columnHeadTitle . \"</th>\";\n\t\t\t}\n\n\t\t\t$table .= \"</tr></thead>\"; // finish head\n\t\t}\n\n\t\t// Body\n\t\t$table .= \"<tbody>\";\n\n\t\t$row = $this->numberColumnOffset;\n\n\t\tif (count($this->data) == 0) {\n\t\t\t// Show a no data entry\n\t\t\t$colspan = count($this->columns) + ($this->showNumberColumn ? 1 : 0);\n\t\t\t$table .= '<tr><td colspan=\"'.$colspan.'\"><p align=\"center\" style=\"font-weight:bold;\">Keine Einträge</p></td></tr>';\n\t\t}\n\t\telse {\n\t\t\tforeach ($this->data as $dataObject) {\n\n\t\t\t\t// Row attributes\n\t\t\t\t$attributes = $this->rowAttributes;\n\t\t\t\tif (!is_array($attributes)) {\n\t\t\t\t\tif (is_callable($this->rowAttributes)) {\n\t\t\t\t\t\t$callable = $this->rowAttributes;\n\t\t\t\t\t\t$attributes = $callable($dataObject);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t$attributeString = '';\n\t\t\t\tif ($attributes) {\t\t// Add attributes if we have some\n\t\t\t\t\tforeach ($attributes as $attributeName => $attributeValue) {\n\t\t\t\t\t\t$attributeString .= $attributeName . '=\"' . $attributeValue . '\" ' ;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ($this->rowIdDataMethod) {\n\t\t\t\t\t// method name or closure?\n\t\t\t\t\t$id = '';\n\t\t\t\t\tif (is_string($this->rowIdDataMethod)) {\n\t\t\t\t\t\t$id = $dataObject->{$this->rowIdDataMethod}(); // Call the row data method\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t$rf = new \\ReflectionFunction($this->rowIdDataMethod);\n\t\t\t\t\t\tif ($rf->isClosure()) {\n\t\t\t\t\t\t\t// we got a closure\n\t\t\t\t\t\t\t$closure = $this->rowIdDataMethod;\n\t\t\t\t\t\t\t$id = $closure($dataObject);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\n\n\t\t\t\t\t$table .= '<tr id=\"'. $id .'\" ' . $attributeString . '>'; // Start row with id\n\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$table .= \"<tr \". $attributeString .\">\";\t// Start row without id\n\t\t\t\t}\n\n\t\t\t\t// Number?\n\t\t\t\tif ($this->showNumberColumn) {\n\t\t\t\t\t$table .= \"<td>\" . $row . \"</td>\";\n\t\t\t\t}\n\n\t\t\t\tforeach ($this->columns as $column) {\n\t\t\t\t\t$dataMethod = isset($column['dataMethod']) ? $column['dataMethod'] : $column[1];\n\t\t\t\t\tif (is_string($dataMethod)) {\n\t\t\t\t\t\t// Just call the method an insert the return value into the table cell\n\t\t\t\t\t\t$table .= \"<td>\". $dataObject->$dataMethod() .\"</td>\";\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t$rf = new \\ReflectionFunction($dataMethod);\n\t\t\t\t\t\tif ($rf->isClosure()) {\n\n\t\t\t\t\t\t\t// Call the closure and get the result\n\t\t\t\t\t\t\t$value = $dataMethod($dataObject, $this);\n\n\t\t\t\t\t\t\t$table .= \"<td>\". $value .\"</td>\";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t$table .= \"</tr>\";\t// End the table row\n\t\t\t\t$row++;\n\t\t\t}\n\n\t\t\t// Render the footer row\n\t\t\t$table = $this->renderFooter($table);\n\n\t\t}\n\n\t\t$table .= \"</tbody>\";\n\n\t\t$table .= \"</table>\";\n\t\treturn $table;\n\t}",
"function ReplaceContentOneRow( $row, $template_html )\n{\n //replace fields with values in template\n $content = $template_html;\n foreach($row as $field => $value)\n {\n $content = str_replace(\"@@$field@@\", $value, $content);\n }\n\n return $content;\n}",
"function ReplaceContentOneRow( $row, $template_html )\n{\n //replace fields with values in template\n $content = $template_html;\n foreach($row as $field => $value)\n {\n $content = str_replace(\"@@$field@@\", $value, $content);\n }\n\n return $content;\n}",
"function Render()\n\t{\n\t\t$strTableName = $this->_strName;\n\t\t$strVixenTable = \"Vixen.table.{$strTableName}\";\n\n\t\techo \"\n<script type='text/javascript'>\n\t{$strVixenTable} = Object();\n\t{$strVixenTable}.collapseAll = TRUE;\n\t{$strVixenTable}.linked = TRUE;\n\t{$strVixenTable}.totalRows = 0;\n\t{$strVixenTable}.row = Array();\n</script>\";\n\t\t\t\n\t\t\n\t\t$strPageSize = $this->_intPageSize > 0 ? \" page_size='{$this->_intPageSize}' \" : \"\";\n\n\t\techo \"<table border='0' cellpadding='3' cellspacing='0' class='Listing' width='100%' id='$strTableName'$strPageSize>\\n\";\n\t\t\n\t\t// Build headers\n\t\techo \"<tr class='First'>\\n\";\n\t\t$intHeaderCount = 0;\n\t\t$intSortLimit = ($this->_bolSortable && is_array($this->_arrSortFields)) ? count ($this->_arrSortFields) : -1;\n\t\tforeach ($this->_arrHeader AS $objField)\n\t\t{\n\t\t\t$strAlign = $this->_arrAlignments[$intHeaderCount];\n\t\t\t$strSortLabel = \"\";\n\t\t\tif ($intHeaderCount <= $intSortLimit)\n\t\t\t{\n\t\t\t\tif ($this->_arrSortFields[$intHeaderCount] !== NULL)\n\t\t\t\t{\n\t\t\t\t\t$strSortLabel = \" TABLE_SORT='\" . $this->_arrSortFields[$intHeaderCount] . \"' \";\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$strSortLabel = \" NO_TABLE_SORT='1' \";\n\t\t\t\t}\n\t\t\t}\n\t\t\techo \" <th width='{$this->_arrWidths[$intHeaderCount]}' align='$strAlign'$strSortLabel>\". $objField .\"</th>\\n\";\n\t\t\t$intHeaderCount++;\n\t\t}\n\t\techo \"</tr>\\n\";\n\t\t\n\t\t// Build rows\n\t\t$intRow = -1;\n\t\tforeach ($this->_arrRows AS $objRow)\n\t\t{\n\t\t\t$intRow++;\n\t\t\t$strClass = ($intRow % 2) ? 'Odd' : 'Even';\n\t\t\t$strStyle = \"\";\n\t\t\t\n\t\t\tif (isset($objRow['OnClick']))\n\t\t\t{\n\t\t\t\t// Escape special chars\n\t\t\t\t$strOnClick = \"onclick='\". htmlspecialchars($objRow['OnClick'], ENT_QUOTES) .\"'\";\n\t\t\t\t$strStyle .= \"cursor:pointer;\";\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$strOnClick = \"\";\n\t\t\t}\n\t\t\t\n\t\t\techo \"<tr id='\" . $strTableName . \"_\" . $intRow . \"' class='$strClass' $strOnClick style='$strStyle'>\\n\";\n\t\t\t\n\t\t\t$intColCount = 0;\n\t\t\t// Build fields\n\t\t\tforeach ($objRow['Columns'] as $objField)\n\t\t\t{\n\t\t\t\t$strWidth = '';\n\t\t\t\t// Work out which width to use\n\t\t\t\t//TODO! After setting the widths once in the header, you shouldn't have to set them again, but we are anyway.\n\t\t\t\t//This could cut down the size of the html file generated\n\t\t\t\t/*if (isset($objRow['Widths']))\n\t\t\t\t{\n\t\t\t\t\t// Use the width specific to this row and column\n\t\t\t\t\t$strWidth = \"width='\". $objRow['Widths'][$intColCount] .\"'\";\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t// Use the general width of this column\n\t\t\t\t\t$strWidth = \"width='\". $this->_arrWidths[$intColCount] .\"'\";\n\t\t\t\t}\n\t\t\t\t*/\n\n\t\t\t\t// Work out which alignment to use\n\t\t\t\tif (isset($objRow['Alignments']))\n\t\t\t\t{\n\t\t\t\t\t// Use the alignment specific to this row and column\n\t\t\t\t\t$strAlignment = \"align='\". $objRow['Alignments'][$intColCount] .\"'\";\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t// Use the general alignment of this column\n\t\t\t\t\t$strAlignment = \"align='\". $this->_arrAlignments[$intColCount] .\"'\";\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// Work out how many columns, this column spans\n\t\t\t\t$strColSpan = \"\";\n\t\t\t\tif (isset($objRow['ColSpans']))\n\t\t\t\t{\n\t\t\t\t\t// colspan values have been declared for this row\n\t\t\t\t\t$strColSpan = \"colspan='\". $objRow['ColSpans'][$intColCount] .\"'\";\n\t\t\t\t\t\n\t\t\t\t\t// If using ColSpans do not use row widths\n\t\t\t\t\t$strWidth = \"\";\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\techo \"<td $strWidth $strAlignment $strColSpan>\";\n\t\t\t\techo \"$objField\";\n\t\t\t\techo \"</td>\\n\";\n\t\t\t\t$intColCount++;\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t// Build detail\n\t\t\tif ($this->_bolDetails)\n\t\t\t{\n\t\t\t\techo \"</tr>\";\n\t\t\t\techo \"<tr>\";\n\t\t\t\techo \"<td colspan=\". count($this->_arrHeader) .\" style='padding: 0px 1px 1px 1px;'>\";\n\t\t\t\techo \"<div id='\" . $strTableName . \"_\" . $intRow . \"DIV-DETAIL' style='display: block; overflow:hidden;'>\";\n\t\t\t\techo $objRow['Detail'];\n\t\t\t\techo \"</div>\";\n\t\t\t\techo \"</td>\\n\";\n\t\t\t}\n\t\t\t\n\t\t\t// Build tooltip\n\t\t\tif ($this->_bolToolTips)\n\t\t\t{\n\t\t\t\techo \"</tr>\";\n\t\t\t\techo \"<tr>\";\n\t\t\t\techo \"<td colspan=4 style='padding-top: 0px; padding-bottom: 0px'>\";\n\t\t\t\techo \"<div id='\" . $strTableName . \"_\" . $intRow . \"DIV-TOOLTIP' style='display: none;'>\";\n\t\t\t\techo $objRow['ToolTip'];\n\t\t\t\techo \"</div>\\n\";\n\t\t\t\techo \"</td>\";\n\t\t\t}\n\t\t\n\t\t\techo \"\\n<script type='text/javascript'>\";\n\t\t\techo \"objRow = Object();\\n\";\n\t\t\t\n\t\t\techo \"objRow.selected = false;\\n\";\n\t\t\techo \"objRow.up = true;\\n\";\n\n\t\t\tif ($this->_bolLinked)\n\t\t\t{\n\t\t\t\tif (is_array($objRow['Index']))\n\t\t\t\t{\n\t\t\t\t\t// add Indexes to objRow\n\t\t\t\t\techo \"objIndex = Object();\";\n\t\t\t\t\t\n\t\t\t\t\tforeach ($objRow['Index'] as $strIndexName=>$arrValues)\n\t\t\t\t\t{\n\t\t\t\t\t\techo \"objIndex.{$strIndexName} = Array();\";\n\t\t\t\t\t\tforeach ($arrValues as $strValue)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\techo \"objIndex.{$strIndexName}.push('$strValue');\";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\techo \"objRow.index = objIndex;\";\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\techo \"{$strVixenTable}.row.push(objRow);\\n\";\n\t\t\techo \"</script>\\n\";\n\t\t\techo \"</tr>\\n\";\n\t\t}\n\t\t$intRowCount = $intRow + 1;\n\t\techo \"</table>\\n\";\n\t\t\n\t\techo \"<script type='text/javascript'>{$strVixenTable}.totalRows = $intRowCount;</script>\\n\";\t\n\t\t\n\t\tif ($this->_bolRowHighlighting)\n\t\t{\n\t\t\t// The following \"Vixen.AddCommand\" method breaks down when you try dynamicly inserting a VixenTable into\n\t\t\t// the DOM, because AddCommand only triggers the command when the body.onload event is triggered\n\t\t\t//echo \"<script type='text/javascript'>Vixen.AddCommand('Vixen.Highlight.Attach','\\'$strTableName\\'', $intRowCount);</script>\";\n\t\t\techo \"<script type='text/javascript'>Vixen.Highlight.Attach('$strTableName');</script>\";\n\t\t}\n\t\t\n\t\tif ($this->_bolToolTips)\n\t\t{\n\t\t\techo \"<script type='text/javascript'>Vixen.Tooltip.Attach('$strTableName');</script>\";\n\t\t}\n\t\t\n\t\tif ($this->_bolDetails)\n\t\t{\n\t\t\techo \"<script type='text/javascript'>Vixen.Slide.Attach('$strTableName', TRUE);</script>\\n\";\n\t\t}\n\t\t\n\t\tif ($this->_bolLinked)\n\t\t{\n\t\t\techo \"<script type='text/javascript'>\";\n\t\t\techo \"{$strVixenTable}.linked = TRUE;\";\n\t\t\t\n\t\t\techo \"objLink = Object();\\n\";\n\t\t\t\n\t\t\tforeach ($this->_arrLinkedTables AS $strTableName=>$arrIndexes)\n\t\t\t{\n\t\t\t\techo \"objLink.{$strTableName} = Array();\\n\";\n\t\t\t\tforeach ($arrIndexes AS $strIndex)\n\t\t\t\t{\n\t\t\t\t\techo \"objLink.{$strTableName}.push('$strIndex');\\n\";\n\t\t\t\t}\n\t\t\t}\n\t\t\techo \"{$strVixenTable}.link = objLink;\\n\";\n\t\t\t\n\t\t\techo \"</script>\\n\";\n\t\t\t\t/*'link':\n\t\t\t{\n\t\t\t\t'AccountInvoices' :\n\t\t\t\t[\n\t\t\t\t\t'Invoice'\n\t\t\t\t]\n\t\t\t},*/\n\t\t}\n\t\t\n\t\tif ($this->_bolSortable)\n\t\t{\n\t\t\techo \"<script type='text/javascript'>Vixen.TableSort.prepare('$strTableName');</script>\\n\";\n\t\t}\n\t}",
"public function table($element) {\n return render($element);\n }",
"function formatRow(){\n $this->hook('formatRow');\n }",
"protected function outputTableAfterEdit()\n {\n $output = '';\n if (is_array($this->get['where']) && isset($this->get['where']['id']) && $this->get['where']['id']) {\n //existing record\n switch ($this->get['table']) {\n case TAB_PREFIX . 'category':\n // Display related products and content elements labeled by either name\n // or content fragment (up to 100 characters)\n // TODO link content elements to category\n foreach (\n [\n // 'content', // uncomment if some content table rows would be linked to a category\n 'product'\n ] as $i\n ) {\n Assert::scalar($this->get['where']['id']);\n if (\n $tmp = $this->MyCMS->fetchAndReindex(\n 'SELECT id,IF(name_' . $_SESSION['language'] . ' NOT LIKE \"\",name_'\n . $_SESSION['language'] . ', content_' . $_SESSION['language'] . ')'\n . ' FROM `' . TAB_PREFIX . $i . '` WHERE category_id=' . (int) $this->get['where']['id']\n )\n ) {\n $output .= '<hr /><details><summary>' .\n // uncomment 'content' cond. if some content table rows would be linked to a category\n $this->tableAdmin->translate(\n //$i == 'content' ? 'Content linked to this category' :\n 'Products linked to this category'\n )\n . ' <span class=\"badge badge-secondary\">' . count($tmp) . '</span></summary>';\n foreach ($tmp as $key => $value) {\n Assert::nullOrString($value);\n if (empty($value)) { // covers both null and ''\n // if the product or content piece doesn't have a label in admin language\n $value = $this->tableAdmin->translate('Name not set');\n }\n $output .= '<a href=\"?table=' . TAB_PREFIX . $i . '&where[id]=' . $key\n . '\" target=\"_blank\" title=\"'\n . $this->tableAdmin->translate('Link will open in a new window') . '\">'\n . '<i class=\"fas fa-external-link-alt\"></i></a> '\n . substr(Tools::h(strip_tags($value)), 0, 100) . '<br />' . PHP_EOL;\n }\n $output .= '</details>';\n }\n }\n break;\n// case TAB_PREFIX . 'product':\n// // Display related content elements labeled by either name or content fragmet (up to 100 chars)\n// // TODO link content elements to products - otherwise it fails because of `WHERE product_id=`\n// $output .= '<hr /><details class=\"product-linked-content\"><summary>' .\n// $this->tableAdmin->translate('Content linked to this product') .\n// ' <span class=\"badge badge-secondary\">';\n// if ($tmp = $this->MyCMS->fetchAndReindex('SELECT id,name_' . $_SESSION['language'] .\n// ' AS name,content_' . $_SESSION['language'] . ' AS content'\n// . ' FROM `' . TAB_PREFIX . 'content` WHERE product_id=' . (int) $this->get['where']['id'])) {\n// $output .= count($tmp) . '</span></summary>';\n// foreach ($tmp as $key => $row) {\n// $output .= '<a href=\"?table=' . TAB_PREFIX . 'content&where[id]=' . $key\n// . '\" target=\"_blank\" title=\"'\n// . $this->tableAdmin->translate('Link will open in a new window') . '\">'\n// . '<i class=\"fas fa-external-link-alt\"></i> '\n// . Tools::h(mb_substr(strip_tags($row['content']), 0, 100)) . ' '\n// . Tools::h(mb_substr(strip_tags($row['description']), 0, 100))\n// . '…</a><br />' . PHP_EOL;\n// }\n// } else {\n// $output .= '0</span></summary>';\n// }\n// $output .= '<footer>';\n// foreach (['testimonial', 'claim', 'perex'] as $i) {\n// $output .= '<a href=\"?table=' . TAB_PREFIX . 'content&where[]=&prefill[type]=' . $i\n// . '&prefill[product_id]=' . Tools::ifnull($this->get['where']['id'], '') . '\" '\n// . 'title=\"' . $this->tableAdmin->translate('New row')\n// . ' (' . $this->tableAdmin->translate('Link will open in a new window') . ')\" '\n// . 'target=\"_blank\"><i class=\"far fa-plus-square\"></i>'\n// . ' <i class=\"fas fa-external-link-alt\"></i> ' . $i . '</a>';\n// }\n// $output .= '</footer></details>';\n// break;\n }\n }\n return $output;\n }",
"public function render()\n {\n return view('components.table-div-theader');\n }",
"private function render_table($table_header, $table_content)\n\t{\n\t\t$table = new Table($this->output);\n\t\t$table->setHeaders($table_header)\n\t\t\t->setRows($table_content)\n\t\t\t->render();\n\n\t\t$this->output->writeln('');\n\t}",
"protected function renderBrokenLinksTable() {}",
"public function getTableFilterHTML()\n\t{\n\t\treturn $this->render();\n\t}",
"public function renderItems()\n {\n $content = array_filter([\n $this->renderCaption(),\n $this->renderColumnGroup(),\n $this->showHeader ? $this->renderTableHeader() : false,\n $this->showFooter ? $this->renderTableFooter() : false,\n $this->renderTableBody(),\n ]);\n\n $table = Html::tag('table', implode(\"\\n\", $content), $this->tableOptions);\n if ($this->responsive)\n {\n $table = Html::tag('div', $table, ['class' => 'table-responsive']);\n }\n else\n {\n $table = Html::tag('div', $table, ['class' => 'table-scrollable']);\n }\n\n return $table;\n }",
"function RenderRow() {\r\n\t\tglobal $conn, $Security, $Language, $rekeningju;\r\n\r\n\t\t// Initialize URLs\r\n\t\t// Call Row_Rendering event\r\n\r\n\t\t$rekeningju->Row_Rendering();\r\n\r\n\t\t// Common render codes for all row types\r\n\t\t// NoRek\r\n\t\t// Keterangan\r\n\t\t// debet\r\n\t\t// kredit\r\n\t\t// kode_bukti\r\n\t\t// tanggal\r\n\t\t// kode_otomatis_master\r\n\r\n\t\t$rekeningju->kode_otomatis_master->CellCssStyle = \"white-space: nowrap;\";\r\n\r\n\t\t// tanggal_nota\r\n\t\t// kode_otomatis\r\n\r\n\t\t$rekeningju->kode_otomatis->CellCssStyle = \"white-space: nowrap;\";\r\n\r\n\t\t// kode_otomatis_tingkat\r\n\t\t$rekeningju->kode_otomatis_tingkat->CellCssStyle = \"white-space: nowrap;\";\r\n\r\n\t\t// id\r\n\t\t$rekeningju->id->CellCssStyle = \"white-space: nowrap;\";\r\n\r\n\t\t// apakah_original\r\n\t\tif ($rekeningju->RowType == EW_ROWTYPE_VIEW) { // View row\r\n\r\n\t\t\t// NoRek\r\n\t\t\tif (strval($rekeningju->NoRek->CurrentValue) <> \"\") {\r\n\t\t\t\t$sFilterWrk = \"`Norek` = '\" . ew_AdjustSql($rekeningju->NoRek->CurrentValue) . \"'\";\r\n\t\t\t$sSqlWrk = \"SELECT `Norek`, `Keterangan` FROM `rekening2`\";\r\n\t\t\t$sWhereWrk = \"\";\r\n\t\t\tif ($sFilterWrk <> \"\") {\r\n\t\t\t\tif ($sWhereWrk <> \"\") $sWhereWrk .= \" AND \";\r\n\t\t\t\t$sWhereWrk .= \"(\" . $sFilterWrk . \")\";\r\n\t\t\t}\r\n\t\t\tif ($sWhereWrk <> \"\") $sSqlWrk .= \" WHERE \" . $sWhereWrk;\r\n\t\t\t$sSqlWrk .= \" ORDER BY `Norek` Asc\";\r\n\t\t\t\t$rswrk = $conn->Execute($sSqlWrk);\r\n\t\t\t\tif ($rswrk && !$rswrk->EOF) { // Lookup values found\r\n\t\t\t\t\t$rekeningju->NoRek->ViewValue = $rswrk->fields('Norek');\r\n\t\t\t\t\t$rekeningju->NoRek->ViewValue .= ew_ValueSeparator(0,1,$rekeningju->NoRek) . $rswrk->fields('Keterangan');\r\n\t\t\t\t\t$rswrk->Close();\r\n\t\t\t\t} else {\r\n\t\t\t\t\t$rekeningju->NoRek->ViewValue = $rekeningju->NoRek->CurrentValue;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\t$rekeningju->NoRek->ViewValue = NULL;\r\n\t\t\t}\r\n\t\t\t$rekeningju->NoRek->ViewCustomAttributes = \"\";\r\n\r\n\t\t\t// Keterangan\r\n\t\t\t$rekeningju->Keterangan->ViewValue = $rekeningju->Keterangan->CurrentValue;\r\n\t\t\t$rekeningju->Keterangan->ViewCustomAttributes = \"\";\r\n\r\n\t\t\t// debet\r\n\t\t\t$rekeningju->debet->ViewValue = $rekeningju->debet->CurrentValue;\r\n\t\t\t$rekeningju->debet->ViewCustomAttributes = \"\";\r\n\r\n\t\t\t// kredit\r\n\t\t\t$rekeningju->kredit->ViewValue = $rekeningju->kredit->CurrentValue;\r\n\t\t\t$rekeningju->kredit->ViewCustomAttributes = \"\";\r\n\r\n\t\t\t// kode_bukti\r\n\t\t\t$rekeningju->kode_bukti->ViewValue = $rekeningju->kode_bukti->CurrentValue;\r\n\t\t\t$rekeningju->kode_bukti->ViewCustomAttributes = \"\";\r\n\r\n\t\t\t// tanggal\r\n\t\t\t$rekeningju->tanggal->ViewValue = $rekeningju->tanggal->CurrentValue;\r\n\t\t\t$rekeningju->tanggal->ViewValue = ew_FormatDateTime($rekeningju->tanggal->ViewValue, 7);\r\n\t\t\t$rekeningju->tanggal->ViewCustomAttributes = \"\";\r\n\r\n\t\t\t// tanggal_nota\r\n\t\t\t$rekeningju->tanggal_nota->ViewValue = $rekeningju->tanggal_nota->CurrentValue;\r\n\t\t\t$rekeningju->tanggal_nota->ViewValue = ew_FormatDateTime($rekeningju->tanggal_nota->ViewValue, 7);\r\n\t\t\t$rekeningju->tanggal_nota->ViewCustomAttributes = \"\";\r\n\r\n\t\t\t// kode_otomatis\r\n\t\t\t$rekeningju->kode_otomatis->ViewValue = $rekeningju->kode_otomatis->CurrentValue;\r\n\t\t\t$rekeningju->kode_otomatis->ViewCustomAttributes = \"\";\r\n\r\n\t\t\t// kode_otomatis_tingkat\r\n\t\t\t$rekeningju->kode_otomatis_tingkat->ViewValue = $rekeningju->kode_otomatis_tingkat->CurrentValue;\r\n\t\t\t$rekeningju->kode_otomatis_tingkat->ViewCustomAttributes = \"\";\r\n\r\n\t\t\t// apakah_original\r\n\t\t\t$rekeningju->apakah_original->ViewValue = $rekeningju->apakah_original->CurrentValue;\r\n\t\t\t$rekeningju->apakah_original->ViewCustomAttributes = \"\";\r\n\r\n\t\t\t// NoRek\r\n\t\t\t$rekeningju->NoRek->LinkCustomAttributes = \"\";\r\n\t\t\t$rekeningju->NoRek->HrefValue = \"\";\r\n\t\t\t$rekeningju->NoRek->TooltipValue = \"\";\r\n\r\n\t\t\t// Keterangan\r\n\t\t\t$rekeningju->Keterangan->LinkCustomAttributes = \"\";\r\n\t\t\t$rekeningju->Keterangan->HrefValue = \"\";\r\n\t\t\t$rekeningju->Keterangan->TooltipValue = \"\";\r\n\r\n\t\t\t// debet\r\n\t\t\t$rekeningju->debet->LinkCustomAttributes = \"\";\r\n\t\t\t$rekeningju->debet->HrefValue = \"\";\r\n\t\t\t$rekeningju->debet->TooltipValue = \"\";\r\n\r\n\t\t\t// kredit\r\n\t\t\t$rekeningju->kredit->LinkCustomAttributes = \"\";\r\n\t\t\t$rekeningju->kredit->HrefValue = \"\";\r\n\t\t\t$rekeningju->kredit->TooltipValue = \"\";\r\n\r\n\t\t\t// kode_bukti\r\n\t\t\t$rekeningju->kode_bukti->LinkCustomAttributes = \"\";\r\n\t\t\t$rekeningju->kode_bukti->HrefValue = \"\";\r\n\t\t\t$rekeningju->kode_bukti->TooltipValue = \"\";\r\n\r\n\t\t\t// tanggal\r\n\t\t\t$rekeningju->tanggal->LinkCustomAttributes = \"\";\r\n\t\t\t$rekeningju->tanggal->HrefValue = \"\";\r\n\t\t\t$rekeningju->tanggal->TooltipValue = \"\";\r\n\r\n\t\t\t// tanggal_nota\r\n\t\t\t$rekeningju->tanggal_nota->LinkCustomAttributes = \"\";\r\n\t\t\t$rekeningju->tanggal_nota->HrefValue = \"\";\r\n\t\t\t$rekeningju->tanggal_nota->TooltipValue = \"\";\r\n\r\n\t\t\t// kode_otomatis\r\n\t\t\t$rekeningju->kode_otomatis->LinkCustomAttributes = \"\";\r\n\t\t\t$rekeningju->kode_otomatis->HrefValue = \"\";\r\n\t\t\t$rekeningju->kode_otomatis->TooltipValue = \"\";\r\n\r\n\t\t\t// kode_otomatis_tingkat\r\n\t\t\t$rekeningju->kode_otomatis_tingkat->LinkCustomAttributes = \"\";\r\n\t\t\t$rekeningju->kode_otomatis_tingkat->HrefValue = \"\";\r\n\t\t\t$rekeningju->kode_otomatis_tingkat->TooltipValue = \"\";\r\n\r\n\t\t\t// apakah_original\r\n\t\t\t$rekeningju->apakah_original->LinkCustomAttributes = \"\";\r\n\t\t\t$rekeningju->apakah_original->HrefValue = \"\";\r\n\t\t\t$rekeningju->apakah_original->TooltipValue = \"\";\r\n\t\t} elseif ($rekeningju->RowType == EW_ROWTYPE_ADD) { // Add row\r\n\r\n\t\t\t// NoRek\r\n\t\t\t$rekeningju->NoRek->EditCustomAttributes = \"\";\r\n\t\t\t\t$sFilterWrk = \"\";\r\n\t\t\t$sSqlWrk = \"SELECT `Norek`, `Norek` AS `DispFld`, `Keterangan` AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld`, '' AS `SelectFilterFld` FROM `rekening2`\";\r\n\t\t\t$sWhereWrk = \"\";\r\n\t\t\tif ($sFilterWrk <> \"\") {\r\n\t\t\t\tif ($sWhereWrk <> \"\") $sWhereWrk .= \" AND \";\r\n\t\t\t\t$sWhereWrk .= \"(\" . $sFilterWrk . \")\";\r\n\t\t\t}\r\n\t\t\tif ($sWhereWrk <> \"\") $sSqlWrk .= \" WHERE \" . $sWhereWrk;\r\n\t\t\t$sSqlWrk .= \" ORDER BY `Norek` Asc\";\r\n\t\t\t$rswrk = $conn->Execute($sSqlWrk);\r\n\t\t\t$arwrk = ($rswrk) ? $rswrk->GetRows() : array();\r\n\t\t\tif ($rswrk) $rswrk->Close();\r\n\t\t\tarray_unshift($arwrk, array(\"\", $Language->Phrase(\"PleaseSelect\"), \"\"));\r\n\t\t\t$rekeningju->NoRek->EditValue = $arwrk;\r\n\r\n\t\t\t// Keterangan\r\n\t\t\t$rekeningju->Keterangan->EditCustomAttributes = \"\";\r\n\t\t\t$rekeningju->Keterangan->EditValue = ew_HtmlEncode($rekeningju->Keterangan->CurrentValue);\r\n\r\n\t\t\t// debet\r\n\t\t\t$rekeningju->debet->EditCustomAttributes = \"\";\r\n\t\t\t$rekeningju->debet->EditValue = ew_HtmlEncode($rekeningju->debet->CurrentValue);\r\n\r\n\t\t\t// kredit\r\n\t\t\t$rekeningju->kredit->EditCustomAttributes = \"\";\r\n\t\t\t$rekeningju->kredit->EditValue = ew_HtmlEncode($rekeningju->kredit->CurrentValue);\r\n\r\n\t\t\t// kode_bukti\r\n\t\t\t$rekeningju->kode_bukti->EditCustomAttributes = \"\";\r\n\t\t\t$rekeningju->kode_bukti->EditValue = ew_HtmlEncode($rekeningju->kode_bukti->CurrentValue);\r\n\r\n\t\t\t// tanggal\r\n\t\t\t$rekeningju->tanggal->EditCustomAttributes = \"\";\r\n\t\t\t$rekeningju->tanggal->EditValue = ew_HtmlEncode(ew_FormatDateTime($rekeningju->tanggal->CurrentValue, 7));\r\n\r\n\t\t\t// tanggal_nota\r\n\t\t\t$rekeningju->tanggal_nota->EditCustomAttributes = \"\";\r\n\t\t\t$rekeningju->tanggal_nota->EditValue = ew_HtmlEncode(ew_FormatDateTime($rekeningju->tanggal_nota->CurrentValue, 7));\r\n\r\n\t\t\t// kode_otomatis\r\n\t\t\t$rekeningju->kode_otomatis->EditCustomAttributes = \"\";\r\n\t\t\t$rekeningju->kode_otomatis->CurrentValue = unik();\r\n\r\n\t\t\t// kode_otomatis_tingkat\r\n\t\t\t$rekeningju->kode_otomatis_tingkat->EditCustomAttributes = \"\";\r\n\t\t\t$rekeningju->kode_otomatis_tingkat->CurrentValue = $_SESSION[\"kode_otomatis_tingkat\"];\r\n\r\n\t\t\t// apakah_original\r\n\t\t\t$rekeningju->apakah_original->EditCustomAttributes = \"\";\r\n\t\t\t$rekeningju->apakah_original->EditValue = ew_HtmlEncode($rekeningju->apakah_original->CurrentValue);\r\n\r\n\t\t\t// Edit refer script\r\n\t\t\t// NoRek\r\n\r\n\t\t\t$rekeningju->NoRek->HrefValue = \"\";\r\n\r\n\t\t\t// Keterangan\r\n\t\t\t$rekeningju->Keterangan->HrefValue = \"\";\r\n\r\n\t\t\t// debet\r\n\t\t\t$rekeningju->debet->HrefValue = \"\";\r\n\r\n\t\t\t// kredit\r\n\t\t\t$rekeningju->kredit->HrefValue = \"\";\r\n\r\n\t\t\t// kode_bukti\r\n\t\t\t$rekeningju->kode_bukti->HrefValue = \"\";\r\n\r\n\t\t\t// tanggal\r\n\t\t\t$rekeningju->tanggal->HrefValue = \"\";\r\n\r\n\t\t\t// tanggal_nota\r\n\t\t\t$rekeningju->tanggal_nota->HrefValue = \"\";\r\n\r\n\t\t\t// kode_otomatis\r\n\t\t\t$rekeningju->kode_otomatis->HrefValue = \"\";\r\n\r\n\t\t\t// kode_otomatis_tingkat\r\n\t\t\t$rekeningju->kode_otomatis_tingkat->HrefValue = \"\";\r\n\r\n\t\t\t// apakah_original\r\n\t\t\t$rekeningju->apakah_original->HrefValue = \"\";\r\n\t\t} elseif ($rekeningju->RowType == EW_ROWTYPE_EDIT) { // Edit row\r\n\r\n\t\t\t// NoRek\r\n\t\t\t$rekeningju->NoRek->EditCustomAttributes = \"\";\r\n\r\n\t\t\t// Keterangan\r\n\t\t\t$rekeningju->Keterangan->EditCustomAttributes = \"\";\r\n\t\t\t$rekeningju->Keterangan->EditValue = ew_HtmlEncode($rekeningju->Keterangan->CurrentValue);\r\n\r\n\t\t\t// debet\r\n\t\t\t$rekeningju->debet->EditCustomAttributes = \"\";\r\n\t\t\t$rekeningju->debet->EditValue = ew_HtmlEncode($rekeningju->debet->CurrentValue);\r\n\r\n\t\t\t// kredit\r\n\t\t\t$rekeningju->kredit->EditCustomAttributes = \"\";\r\n\t\t\t$rekeningju->kredit->EditValue = ew_HtmlEncode($rekeningju->kredit->CurrentValue);\r\n\r\n\t\t\t// kode_bukti\r\n\t\t\t$rekeningju->kode_bukti->EditCustomAttributes = \"\";\r\n\t\t\t$rekeningju->kode_bukti->EditValue = ew_HtmlEncode($rekeningju->kode_bukti->CurrentValue);\r\n\r\n\t\t\t// tanggal\r\n\t\t\t$rekeningju->tanggal->EditCustomAttributes = \"\";\r\n\t\t\t$rekeningju->tanggal->EditValue = ew_HtmlEncode(ew_FormatDateTime($rekeningju->tanggal->CurrentValue, 7));\r\n\r\n\t\t\t// tanggal_nota\r\n\t\t\t$rekeningju->tanggal_nota->EditCustomAttributes = \"\";\r\n\t\t\t$rekeningju->tanggal_nota->EditValue = ew_HtmlEncode(ew_FormatDateTime($rekeningju->tanggal_nota->CurrentValue, 7));\r\n\r\n\t\t\t// kode_otomatis\r\n\t\t\t$rekeningju->kode_otomatis->EditCustomAttributes = \"\";\r\n\r\n\t\t\t// kode_otomatis_tingkat\r\n\t\t\t$rekeningju->kode_otomatis_tingkat->EditCustomAttributes = \"\";\r\n\r\n\t\t\t// apakah_original\r\n\t\t\t$rekeningju->apakah_original->EditCustomAttributes = \"\";\r\n\t\t\t$rekeningju->apakah_original->EditValue = ew_HtmlEncode($rekeningju->apakah_original->CurrentValue);\r\n\r\n\t\t\t// Edit refer script\r\n\t\t\t// NoRek\r\n\r\n\t\t\t$rekeningju->NoRek->HrefValue = \"\";\r\n\r\n\t\t\t// Keterangan\r\n\t\t\t$rekeningju->Keterangan->HrefValue = \"\";\r\n\r\n\t\t\t// debet\r\n\t\t\t$rekeningju->debet->HrefValue = \"\";\r\n\r\n\t\t\t// kredit\r\n\t\t\t$rekeningju->kredit->HrefValue = \"\";\r\n\r\n\t\t\t// kode_bukti\r\n\t\t\t$rekeningju->kode_bukti->HrefValue = \"\";\r\n\r\n\t\t\t// tanggal\r\n\t\t\t$rekeningju->tanggal->HrefValue = \"\";\r\n\r\n\t\t\t// tanggal_nota\r\n\t\t\t$rekeningju->tanggal_nota->HrefValue = \"\";\r\n\r\n\t\t\t// kode_otomatis\r\n\t\t\t$rekeningju->kode_otomatis->HrefValue = \"\";\r\n\r\n\t\t\t// kode_otomatis_tingkat\r\n\t\t\t$rekeningju->kode_otomatis_tingkat->HrefValue = \"\";\r\n\r\n\t\t\t// apakah_original\r\n\t\t\t$rekeningju->apakah_original->HrefValue = \"\";\r\n\t\t}\r\n\t\tif ($rekeningju->RowType == EW_ROWTYPE_ADD ||\r\n\t\t\t$rekeningju->RowType == EW_ROWTYPE_EDIT ||\r\n\t\t\t$rekeningju->RowType == EW_ROWTYPE_SEARCH) { // Add / Edit / Search row\r\n\t\t\t$rekeningju->SetupFieldTitles();\r\n\t\t}\r\n\r\n\t\t// Call Row Rendered event\r\n\t\tif ($rekeningju->RowType <> EW_ROWTYPE_AGGREGATEINIT)\r\n\t\t\t$rekeningju->Row_Rendered();\r\n\t}",
"function RenderRow() {\n\t\tglobal $Security, $Language, $gsLanguage;\n\n\t\t// Initialize URLs\n\t\t$this->ViewUrl = $this->GetViewUrl();\n\t\t$this->EditUrl = $this->GetEditUrl();\n\t\t$this->InlineEditUrl = $this->GetInlineEditUrl();\n\t\t$this->CopyUrl = $this->GetCopyUrl();\n\t\t$this->InlineCopyUrl = $this->GetInlineCopyUrl();\n\t\t$this->DeleteUrl = $this->GetDeleteUrl();\n\n\t\t// Call Row_Rendering event\n\t\t$this->Row_Rendering();\n\n\t\t// Common render codes for all row types\n\t\t// id\n\n\t\t$this->id->CellCssStyle = \"white-space: nowrap;\";\n\n\t\t// nombre_contacto\n\t\t// name\n\t\t// lastname\n\t\t// email\n\t\t// address\n\t\t// phone\n\t\t// cell\n\t\t// is_active\n\n\t\t$this->is_active->CellCssStyle = \"white-space: nowrap;\";\n\n\t\t// created_at\n\t\t// id_sucursal\n\t\t// documentos\n\n\t\t$this->documentos->CellCssStyle = \"white-space: nowrap;\";\n\n\t\t// DateModified\n\t\t$this->DateModified->CellCssStyle = \"white-space: nowrap;\";\n\n\t\t// DateDeleted\n\t\t$this->DateDeleted->CellCssStyle = \"white-space: nowrap;\";\n\n\t\t// CreatedBy\n\t\t$this->CreatedBy->CellCssStyle = \"white-space: nowrap;\";\n\n\t\t// ModifiedBy\n\t\t$this->ModifiedBy->CellCssStyle = \"white-space: nowrap;\";\n\n\t\t// DeletedBy\n\t\t$this->DeletedBy->CellCssStyle = \"white-space: nowrap;\";\n\n\t\t// latitud\n\t\t$this->latitud->CellCssStyle = \"white-space: nowrap;\";\n\n\t\t// longitud\n\t\t$this->longitud->CellCssStyle = \"white-space: nowrap;\";\n\n\t\t// tipoinmueble\n\t\t// id_ciudad_inmueble\n\t\t// id_provincia_inmueble\n\t\t// imagen_inmueble01\n\n\t\t$this->imagen_inmueble01->CellCssStyle = \"white-space: nowrap;\";\n\n\t\t// imagen_inmueble02\n\t\t// imagen_inmueble03\n\t\t// imagen_inmueble04\n\t\t// imagen_inmueble05\n\t\t// imagen_inmueble06\n\n\t\t$this->imagen_inmueble06->CellCssStyle = \"white-space: nowrap;\";\n\n\t\t// imagen_inmueble07\n\t\t$this->imagen_inmueble07->CellCssStyle = \"white-space: nowrap;\";\n\n\t\t// imagen_inmueble08\n\t\t$this->imagen_inmueble08->CellCssStyle = \"white-space: nowrap;\";\n\n\t\t// tipovehiculo\n\t\t// id_ciudad_vehiculo\n\t\t// id_provincia_vehiculo\n\t\t// imagen_vehiculo01\n\n\t\t$this->imagen_vehiculo01->CellCssStyle = \"white-space: nowrap;\";\n\n\t\t// imagen_vehiculo02\n\t\t// imagen_vehiculo03\n\n\t\t$this->imagen_vehiculo03->CellCssStyle = \"white-space: nowrap;\";\n\n\t\t// imagen_vehiculo04\n\t\t$this->imagen_vehiculo04->CellCssStyle = \"white-space: nowrap;\";\n\n\t\t// imagen_vehiculo05\n\t\t// imagen_vehiculo06\n\t\t// imagen_vehiculo07\n\t\t// imagen_vehiculo08\n\n\t\t$this->imagen_vehiculo08->CellCssStyle = \"white-space: nowrap;\";\n\n\t\t// tipomaquinaria\n\t\t// id_ciudad_maquinaria\n\t\t// id_provincia_maquinaria\n\t\t// imagen_maquinaria01\n\n\t\t$this->imagen_maquinaria01->CellCssStyle = \"white-space: nowrap;\";\n\n\t\t// imagen_maquinaria02\n\t\t// imagen_maquinaria03\n\t\t// imagen_maquinaria04\n\n\t\t$this->imagen_maquinaria04->CellCssStyle = \"white-space: nowrap;\";\n\n\t\t// imagen_maquinaria05\n\t\t// imagen_maquinaria06\n\t\t// imagen_maquinaria07\n\t\t// imagen_maquinaria08\n\n\t\t$this->imagen_maquinaria08->CellCssStyle = \"white-space: nowrap;\";\n\n\t\t// tipomercaderia\n\t\t// imagen_mercaderia01\n\t\t// documento_mercaderia\n\t\t// tipoespecial\n\t\t// imagen_tipoespecial01\n\t\t// email_contacto\n\n\t\tif ($this->RowType == EW_ROWTYPE_VIEW) { // View row\n\n\t\t// nombre_contacto\n\t\t$this->nombre_contacto->ViewValue = $this->nombre_contacto->CurrentValue;\n\t\t$this->nombre_contacto->ViewCustomAttributes = \"\";\n\n\t\t// name\n\t\t$this->name->ViewValue = $this->name->CurrentValue;\n\t\t$this->name->ViewCustomAttributes = \"\";\n\n\t\t// lastname\n\t\t$this->lastname->ViewValue = $this->lastname->CurrentValue;\n\t\t$this->lastname->ViewCustomAttributes = \"\";\n\n\t\t// email\n\t\t$this->_email->ViewValue = $this->_email->CurrentValue;\n\t\t$this->_email->ViewCustomAttributes = \"\";\n\n\t\t// address\n\t\t$this->address->ViewValue = $this->address->CurrentValue;\n\t\t$this->address->ViewCustomAttributes = \"\";\n\n\t\t// phone\n\t\t$this->phone->ViewValue = $this->phone->CurrentValue;\n\t\t$this->phone->ViewCustomAttributes = \"\";\n\n\t\t// cell\n\t\t$this->cell->ViewValue = $this->cell->CurrentValue;\n\t\t$this->cell->ViewCustomAttributes = \"\";\n\n\t\t// created_at\n\t\t$this->created_at->ViewValue = $this->created_at->CurrentValue;\n\t\t$this->created_at->ViewValue = ew_FormatDateTime($this->created_at->ViewValue, 17);\n\t\t$this->created_at->ViewCustomAttributes = \"\";\n\n\t\t// id_sucursal\n\t\tif (strval($this->id_sucursal->CurrentValue) <> \"\") {\n\t\t\t$sFilterWrk = \"`id`\" . ew_SearchString(\"=\", $this->id_sucursal->CurrentValue, EW_DATATYPE_NUMBER, \"\");\n\t\t$sSqlWrk = \"SELECT `id`, `nombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `sucursal`\";\n\t\t$sWhereWrk = \"\";\n\t\t$this->id_sucursal->LookupFilters = array(\"dx1\" => '`nombre`');\n\t\t$lookuptblfilter = \"`id`='\".$_SESSION[\"sucursal\"].\"'\";\n\t\tew_AddFilter($sWhereWrk, $lookuptblfilter);\n\t\tew_AddFilter($sWhereWrk, $sFilterWrk);\n\t\t$this->Lookup_Selecting($this->id_sucursal, $sWhereWrk); // Call Lookup Selecting\n\t\tif ($sWhereWrk <> \"\") $sSqlWrk .= \" WHERE \" . $sWhereWrk;\n\t\t\t$rswrk = Conn()->Execute($sSqlWrk);\n\t\t\tif ($rswrk && !$rswrk->EOF) { // Lookup values found\n\t\t\t\t$arwrk = array();\n\t\t\t\t$arwrk[1] = $rswrk->fields('DispFld');\n\t\t\t\t$this->id_sucursal->ViewValue = $this->id_sucursal->DisplayValue($arwrk);\n\t\t\t\t$rswrk->Close();\n\t\t\t} else {\n\t\t\t\t$this->id_sucursal->ViewValue = $this->id_sucursal->CurrentValue;\n\t\t\t}\n\t\t} else {\n\t\t\t$this->id_sucursal->ViewValue = NULL;\n\t\t}\n\t\t$this->id_sucursal->ViewCustomAttributes = \"\";\n\n\t\t// tipoinmueble\n\t\tif (strval($this->tipoinmueble->CurrentValue) <> \"\") {\n\t\t\t$arwrk = explode(\",\", $this->tipoinmueble->CurrentValue);\n\t\t\t$sFilterWrk = \"\";\n\t\t\tforeach ($arwrk as $wrk) {\n\t\t\t\tif ($sFilterWrk <> \"\") $sFilterWrk .= \" OR \";\n\t\t\t\t$sFilterWrk .= \"`nombre`\" . ew_SearchString(\"=\", trim($wrk), EW_DATATYPE_STRING, \"\");\n\t\t\t}\n\t\t$sSqlWrk = \"SELECT `nombre`, `nombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `tipoinmueble`\";\n\t\t$sWhereWrk = \"\";\n\t\t$this->tipoinmueble->LookupFilters = array(\"dx1\" => '`nombre`');\n\t\t$lookuptblfilter = \"`tipo`='INMUEBLE'\";\n\t\tew_AddFilter($sWhereWrk, $lookuptblfilter);\n\t\tew_AddFilter($sWhereWrk, $sFilterWrk);\n\t\t$this->Lookup_Selecting($this->tipoinmueble, $sWhereWrk); // Call Lookup Selecting\n\t\tif ($sWhereWrk <> \"\") $sSqlWrk .= \" WHERE \" . $sWhereWrk;\n\t\t\t$rswrk = Conn()->Execute($sSqlWrk);\n\t\t\tif ($rswrk && !$rswrk->EOF) { // Lookup values found\n\t\t\t\t$this->tipoinmueble->ViewValue = \"\";\n\t\t\t\t$ari = 0;\n\t\t\t\twhile (!$rswrk->EOF) {\n\t\t\t\t\t$arwrk = array();\n\t\t\t\t\t$arwrk[1] = $rswrk->fields('DispFld');\n\t\t\t\t\t$this->tipoinmueble->ViewValue .= $this->tipoinmueble->DisplayValue($arwrk);\n\t\t\t\t\t$rswrk->MoveNext();\n\t\t\t\t\tif (!$rswrk->EOF) $this->tipoinmueble->ViewValue .= ew_ViewOptionSeparator($ari); // Separate Options\n\t\t\t\t\t$ari++;\n\t\t\t\t}\n\t\t\t\t$rswrk->Close();\n\t\t\t} else {\n\t\t\t\t$this->tipoinmueble->ViewValue = $this->tipoinmueble->CurrentValue;\n\t\t\t}\n\t\t} else {\n\t\t\t$this->tipoinmueble->ViewValue = NULL;\n\t\t}\n\t\t$this->tipoinmueble->ViewCustomAttributes = \"\";\n\n\t\t// id_ciudad_inmueble\n\t\tif (strval($this->id_ciudad_inmueble->CurrentValue) <> \"\") {\n\t\t\t$sFilterWrk = \"`id`\" . ew_SearchString(\"=\", $this->id_ciudad_inmueble->CurrentValue, EW_DATATYPE_NUMBER, \"\");\n\t\t$sSqlWrk = \"SELECT `id`, `nombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `departamento`\";\n\t\t$sWhereWrk = \"\";\n\t\t$this->id_ciudad_inmueble->LookupFilters = array();\n\t\tew_AddFilter($sWhereWrk, $sFilterWrk);\n\t\t$this->Lookup_Selecting($this->id_ciudad_inmueble, $sWhereWrk); // Call Lookup Selecting\n\t\tif ($sWhereWrk <> \"\") $sSqlWrk .= \" WHERE \" . $sWhereWrk;\n\t\t\t$rswrk = Conn()->Execute($sSqlWrk);\n\t\t\tif ($rswrk && !$rswrk->EOF) { // Lookup values found\n\t\t\t\t$arwrk = array();\n\t\t\t\t$arwrk[1] = $rswrk->fields('DispFld');\n\t\t\t\t$this->id_ciudad_inmueble->ViewValue = $this->id_ciudad_inmueble->DisplayValue($arwrk);\n\t\t\t\t$rswrk->Close();\n\t\t\t} else {\n\t\t\t\t$this->id_ciudad_inmueble->ViewValue = $this->id_ciudad_inmueble->CurrentValue;\n\t\t\t}\n\t\t} else {\n\t\t\t$this->id_ciudad_inmueble->ViewValue = NULL;\n\t\t}\n\t\t$this->id_ciudad_inmueble->ViewCustomAttributes = \"\";\n\n\t\t// id_provincia_inmueble\n\t\tif (strval($this->id_provincia_inmueble->CurrentValue) <> \"\") {\n\t\t\t$sFilterWrk = \"`id`\" . ew_SearchString(\"=\", $this->id_provincia_inmueble->CurrentValue, EW_DATATYPE_NUMBER, \"\");\n\t\t$sSqlWrk = \"SELECT `id`, `nombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `provincia`\";\n\t\t$sWhereWrk = \"\";\n\t\t$this->id_provincia_inmueble->LookupFilters = array();\n\t\tew_AddFilter($sWhereWrk, $sFilterWrk);\n\t\t$this->Lookup_Selecting($this->id_provincia_inmueble, $sWhereWrk); // Call Lookup Selecting\n\t\tif ($sWhereWrk <> \"\") $sSqlWrk .= \" WHERE \" . $sWhereWrk;\n\t\t\t$rswrk = Conn()->Execute($sSqlWrk);\n\t\t\tif ($rswrk && !$rswrk->EOF) { // Lookup values found\n\t\t\t\t$arwrk = array();\n\t\t\t\t$arwrk[1] = $rswrk->fields('DispFld');\n\t\t\t\t$this->id_provincia_inmueble->ViewValue = $this->id_provincia_inmueble->DisplayValue($arwrk);\n\t\t\t\t$rswrk->Close();\n\t\t\t} else {\n\t\t\t\t$this->id_provincia_inmueble->ViewValue = $this->id_provincia_inmueble->CurrentValue;\n\t\t\t}\n\t\t} else {\n\t\t\t$this->id_provincia_inmueble->ViewValue = NULL;\n\t\t}\n\t\t$this->id_provincia_inmueble->ViewCustomAttributes = \"\";\n\n\t\t// tipovehiculo\n\t\tif (strval($this->tipovehiculo->CurrentValue) <> \"\") {\n\t\t\t$arwrk = explode(\",\", $this->tipovehiculo->CurrentValue);\n\t\t\t$sFilterWrk = \"\";\n\t\t\tforeach ($arwrk as $wrk) {\n\t\t\t\tif ($sFilterWrk <> \"\") $sFilterWrk .= \" OR \";\n\t\t\t\t$sFilterWrk .= \"`nombre`\" . ew_SearchString(\"=\", trim($wrk), EW_DATATYPE_STRING, \"\");\n\t\t\t}\n\t\t$sSqlWrk = \"SELECT `nombre`, `nombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `tipoinmueble`\";\n\t\t$sWhereWrk = \"\";\n\t\t$this->tipovehiculo->LookupFilters = array(\"dx1\" => '`nombre`');\n\t\t$lookuptblfilter = \"`tipo`='VEHICULO'\";\n\t\tew_AddFilter($sWhereWrk, $lookuptblfilter);\n\t\tew_AddFilter($sWhereWrk, $sFilterWrk);\n\t\t$this->Lookup_Selecting($this->tipovehiculo, $sWhereWrk); // Call Lookup Selecting\n\t\tif ($sWhereWrk <> \"\") $sSqlWrk .= \" WHERE \" . $sWhereWrk;\n\t\t\t$rswrk = Conn()->Execute($sSqlWrk);\n\t\t\tif ($rswrk && !$rswrk->EOF) { // Lookup values found\n\t\t\t\t$this->tipovehiculo->ViewValue = \"\";\n\t\t\t\t$ari = 0;\n\t\t\t\twhile (!$rswrk->EOF) {\n\t\t\t\t\t$arwrk = array();\n\t\t\t\t\t$arwrk[1] = $rswrk->fields('DispFld');\n\t\t\t\t\t$this->tipovehiculo->ViewValue .= $this->tipovehiculo->DisplayValue($arwrk);\n\t\t\t\t\t$rswrk->MoveNext();\n\t\t\t\t\tif (!$rswrk->EOF) $this->tipovehiculo->ViewValue .= ew_ViewOptionSeparator($ari); // Separate Options\n\t\t\t\t\t$ari++;\n\t\t\t\t}\n\t\t\t\t$rswrk->Close();\n\t\t\t} else {\n\t\t\t\t$this->tipovehiculo->ViewValue = $this->tipovehiculo->CurrentValue;\n\t\t\t}\n\t\t} else {\n\t\t\t$this->tipovehiculo->ViewValue = NULL;\n\t\t}\n\t\t$this->tipovehiculo->ViewCustomAttributes = \"\";\n\n\t\t// id_ciudad_vehiculo\n\t\tif (strval($this->id_ciudad_vehiculo->CurrentValue) <> \"\") {\n\t\t\t$sFilterWrk = \"`id`\" . ew_SearchString(\"=\", $this->id_ciudad_vehiculo->CurrentValue, EW_DATATYPE_NUMBER, \"\");\n\t\t$sSqlWrk = \"SELECT `id`, `nombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `departamento`\";\n\t\t$sWhereWrk = \"\";\n\t\t$this->id_ciudad_vehiculo->LookupFilters = array();\n\t\tew_AddFilter($sWhereWrk, $sFilterWrk);\n\t\t$this->Lookup_Selecting($this->id_ciudad_vehiculo, $sWhereWrk); // Call Lookup Selecting\n\t\tif ($sWhereWrk <> \"\") $sSqlWrk .= \" WHERE \" . $sWhereWrk;\n\t\t\t$rswrk = Conn()->Execute($sSqlWrk);\n\t\t\tif ($rswrk && !$rswrk->EOF) { // Lookup values found\n\t\t\t\t$arwrk = array();\n\t\t\t\t$arwrk[1] = $rswrk->fields('DispFld');\n\t\t\t\t$this->id_ciudad_vehiculo->ViewValue = $this->id_ciudad_vehiculo->DisplayValue($arwrk);\n\t\t\t\t$rswrk->Close();\n\t\t\t} else {\n\t\t\t\t$this->id_ciudad_vehiculo->ViewValue = $this->id_ciudad_vehiculo->CurrentValue;\n\t\t\t}\n\t\t} else {\n\t\t\t$this->id_ciudad_vehiculo->ViewValue = NULL;\n\t\t}\n\t\t$this->id_ciudad_vehiculo->ViewCustomAttributes = \"\";\n\n\t\t// id_provincia_vehiculo\n\t\tif (strval($this->id_provincia_vehiculo->CurrentValue) <> \"\") {\n\t\t\t$sFilterWrk = \"`id`\" . ew_SearchString(\"=\", $this->id_provincia_vehiculo->CurrentValue, EW_DATATYPE_NUMBER, \"\");\n\t\t$sSqlWrk = \"SELECT `id`, `nombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `provincia`\";\n\t\t$sWhereWrk = \"\";\n\t\t$this->id_provincia_vehiculo->LookupFilters = array();\n\t\tew_AddFilter($sWhereWrk, $sFilterWrk);\n\t\t$this->Lookup_Selecting($this->id_provincia_vehiculo, $sWhereWrk); // Call Lookup Selecting\n\t\tif ($sWhereWrk <> \"\") $sSqlWrk .= \" WHERE \" . $sWhereWrk;\n\t\t\t$rswrk = Conn()->Execute($sSqlWrk);\n\t\t\tif ($rswrk && !$rswrk->EOF) { // Lookup values found\n\t\t\t\t$arwrk = array();\n\t\t\t\t$arwrk[1] = $rswrk->fields('DispFld');\n\t\t\t\t$this->id_provincia_vehiculo->ViewValue = $this->id_provincia_vehiculo->DisplayValue($arwrk);\n\t\t\t\t$rswrk->Close();\n\t\t\t} else {\n\t\t\t\t$this->id_provincia_vehiculo->ViewValue = $this->id_provincia_vehiculo->CurrentValue;\n\t\t\t}\n\t\t} else {\n\t\t\t$this->id_provincia_vehiculo->ViewValue = NULL;\n\t\t}\n\t\t$this->id_provincia_vehiculo->ViewCustomAttributes = \"\";\n\n\t\t// tipomaquinaria\n\t\tif (strval($this->tipomaquinaria->CurrentValue) <> \"\") {\n\t\t\t$arwrk = explode(\",\", $this->tipomaquinaria->CurrentValue);\n\t\t\t$sFilterWrk = \"\";\n\t\t\tforeach ($arwrk as $wrk) {\n\t\t\t\tif ($sFilterWrk <> \"\") $sFilterWrk .= \" OR \";\n\t\t\t\t$sFilterWrk .= \"`nombre`\" . ew_SearchString(\"=\", trim($wrk), EW_DATATYPE_STRING, \"\");\n\t\t\t}\n\t\t$sSqlWrk = \"SELECT `nombre`, `nombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `tipoinmueble`\";\n\t\t$sWhereWrk = \"\";\n\t\t$this->tipomaquinaria->LookupFilters = array(\"dx1\" => '`nombre`');\n\t\t$lookuptblfilter = \"`tipo`='MAQUINARIA'\";\n\t\tew_AddFilter($sWhereWrk, $lookuptblfilter);\n\t\tew_AddFilter($sWhereWrk, $sFilterWrk);\n\t\t$this->Lookup_Selecting($this->tipomaquinaria, $sWhereWrk); // Call Lookup Selecting\n\t\tif ($sWhereWrk <> \"\") $sSqlWrk .= \" WHERE \" . $sWhereWrk;\n\t\t\t$rswrk = Conn()->Execute($sSqlWrk);\n\t\t\tif ($rswrk && !$rswrk->EOF) { // Lookup values found\n\t\t\t\t$this->tipomaquinaria->ViewValue = \"\";\n\t\t\t\t$ari = 0;\n\t\t\t\twhile (!$rswrk->EOF) {\n\t\t\t\t\t$arwrk = array();\n\t\t\t\t\t$arwrk[1] = $rswrk->fields('DispFld');\n\t\t\t\t\t$this->tipomaquinaria->ViewValue .= $this->tipomaquinaria->DisplayValue($arwrk);\n\t\t\t\t\t$rswrk->MoveNext();\n\t\t\t\t\tif (!$rswrk->EOF) $this->tipomaquinaria->ViewValue .= ew_ViewOptionSeparator($ari); // Separate Options\n\t\t\t\t\t$ari++;\n\t\t\t\t}\n\t\t\t\t$rswrk->Close();\n\t\t\t} else {\n\t\t\t\t$this->tipomaquinaria->ViewValue = $this->tipomaquinaria->CurrentValue;\n\t\t\t}\n\t\t} else {\n\t\t\t$this->tipomaquinaria->ViewValue = NULL;\n\t\t}\n\t\t$this->tipomaquinaria->ViewCustomAttributes = \"\";\n\n\t\t// id_ciudad_maquinaria\n\t\tif (strval($this->id_ciudad_maquinaria->CurrentValue) <> \"\") {\n\t\t\t$sFilterWrk = \"`id`\" . ew_SearchString(\"=\", $this->id_ciudad_maquinaria->CurrentValue, EW_DATATYPE_NUMBER, \"\");\n\t\t$sSqlWrk = \"SELECT `id`, `nombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `departamento`\";\n\t\t$sWhereWrk = \"\";\n\t\t$this->id_ciudad_maquinaria->LookupFilters = array();\n\t\tew_AddFilter($sWhereWrk, $sFilterWrk);\n\t\t$this->Lookup_Selecting($this->id_ciudad_maquinaria, $sWhereWrk); // Call Lookup Selecting\n\t\tif ($sWhereWrk <> \"\") $sSqlWrk .= \" WHERE \" . $sWhereWrk;\n\t\t\t$rswrk = Conn()->Execute($sSqlWrk);\n\t\t\tif ($rswrk && !$rswrk->EOF) { // Lookup values found\n\t\t\t\t$arwrk = array();\n\t\t\t\t$arwrk[1] = $rswrk->fields('DispFld');\n\t\t\t\t$this->id_ciudad_maquinaria->ViewValue = $this->id_ciudad_maquinaria->DisplayValue($arwrk);\n\t\t\t\t$rswrk->Close();\n\t\t\t} else {\n\t\t\t\t$this->id_ciudad_maquinaria->ViewValue = $this->id_ciudad_maquinaria->CurrentValue;\n\t\t\t}\n\t\t} else {\n\t\t\t$this->id_ciudad_maquinaria->ViewValue = NULL;\n\t\t}\n\t\t$this->id_ciudad_maquinaria->ViewCustomAttributes = \"\";\n\n\t\t// id_provincia_maquinaria\n\t\tif (strval($this->id_provincia_maquinaria->CurrentValue) <> \"\") {\n\t\t\t$sFilterWrk = \"`id`\" . ew_SearchString(\"=\", $this->id_provincia_maquinaria->CurrentValue, EW_DATATYPE_NUMBER, \"\");\n\t\t$sSqlWrk = \"SELECT `id`, `nombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `provincia`\";\n\t\t$sWhereWrk = \"\";\n\t\t$this->id_provincia_maquinaria->LookupFilters = array();\n\t\tew_AddFilter($sWhereWrk, $sFilterWrk);\n\t\t$this->Lookup_Selecting($this->id_provincia_maquinaria, $sWhereWrk); // Call Lookup Selecting\n\t\tif ($sWhereWrk <> \"\") $sSqlWrk .= \" WHERE \" . $sWhereWrk;\n\t\t\t$rswrk = Conn()->Execute($sSqlWrk);\n\t\t\tif ($rswrk && !$rswrk->EOF) { // Lookup values found\n\t\t\t\t$arwrk = array();\n\t\t\t\t$arwrk[1] = $rswrk->fields('DispFld');\n\t\t\t\t$this->id_provincia_maquinaria->ViewValue = $this->id_provincia_maquinaria->DisplayValue($arwrk);\n\t\t\t\t$rswrk->Close();\n\t\t\t} else {\n\t\t\t\t$this->id_provincia_maquinaria->ViewValue = $this->id_provincia_maquinaria->CurrentValue;\n\t\t\t}\n\t\t} else {\n\t\t\t$this->id_provincia_maquinaria->ViewValue = NULL;\n\t\t}\n\t\t$this->id_provincia_maquinaria->ViewCustomAttributes = \"\";\n\n\t\t// tipomercaderia\n\t\tif (strval($this->tipomercaderia->CurrentValue) <> \"\") {\n\t\t\t$arwrk = explode(\",\", $this->tipomercaderia->CurrentValue);\n\t\t\t$sFilterWrk = \"\";\n\t\t\tforeach ($arwrk as $wrk) {\n\t\t\t\tif ($sFilterWrk <> \"\") $sFilterWrk .= \" OR \";\n\t\t\t\t$sFilterWrk .= \"`id_tipoinmueble`\" . ew_SearchString(\"=\", trim($wrk), EW_DATATYPE_NUMBER, \"\");\n\t\t\t}\n\t\t$sSqlWrk = \"SELECT `id_tipoinmueble`, `nombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `tipoinmueble`\";\n\t\t$sWhereWrk = \"\";\n\t\t$this->tipomercaderia->LookupFilters = array();\n\t\t$lookuptblfilter = \"`tipo`='MERCADERIA'\";\n\t\tew_AddFilter($sWhereWrk, $lookuptblfilter);\n\t\tew_AddFilter($sWhereWrk, $sFilterWrk);\n\t\t$this->Lookup_Selecting($this->tipomercaderia, $sWhereWrk); // Call Lookup Selecting\n\t\tif ($sWhereWrk <> \"\") $sSqlWrk .= \" WHERE \" . $sWhereWrk;\n\t\t\t$rswrk = Conn()->Execute($sSqlWrk);\n\t\t\tif ($rswrk && !$rswrk->EOF) { // Lookup values found\n\t\t\t\t$this->tipomercaderia->ViewValue = \"\";\n\t\t\t\t$ari = 0;\n\t\t\t\twhile (!$rswrk->EOF) {\n\t\t\t\t\t$arwrk = array();\n\t\t\t\t\t$arwrk[1] = $rswrk->fields('DispFld');\n\t\t\t\t\t$this->tipomercaderia->ViewValue .= $this->tipomercaderia->DisplayValue($arwrk);\n\t\t\t\t\t$rswrk->MoveNext();\n\t\t\t\t\tif (!$rswrk->EOF) $this->tipomercaderia->ViewValue .= ew_ViewOptionSeparator($ari); // Separate Options\n\t\t\t\t\t$ari++;\n\t\t\t\t}\n\t\t\t\t$rswrk->Close();\n\t\t\t} else {\n\t\t\t\t$this->tipomercaderia->ViewValue = $this->tipomercaderia->CurrentValue;\n\t\t\t}\n\t\t} else {\n\t\t\t$this->tipomercaderia->ViewValue = NULL;\n\t\t}\n\t\t$this->tipomercaderia->ViewCustomAttributes = \"\";\n\n\t\t// documento_mercaderia\n\t\t$this->documento_mercaderia->ViewValue = $this->documento_mercaderia->CurrentValue;\n\t\t$this->documento_mercaderia->ViewCustomAttributes = \"\";\n\n\t\t// tipoespecial\n\t\tif (strval($this->tipoespecial->CurrentValue) <> \"\") {\n\t\t\t$arwrk = explode(\",\", $this->tipoespecial->CurrentValue);\n\t\t\t$sFilterWrk = \"\";\n\t\t\tforeach ($arwrk as $wrk) {\n\t\t\t\tif ($sFilterWrk <> \"\") $sFilterWrk .= \" OR \";\n\t\t\t\t$sFilterWrk .= \"`id_tipoinmueble`\" . ew_SearchString(\"=\", trim($wrk), EW_DATATYPE_NUMBER, \"\");\n\t\t\t}\n\t\t$sSqlWrk = \"SELECT `id_tipoinmueble`, `nombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `tipoinmueble`\";\n\t\t$sWhereWrk = \"\";\n\t\t$this->tipoespecial->LookupFilters = array(\"dx1\" => '`nombre`');\n\t\t$lookuptblfilter = \"`tipo`='ESPECIAL'\";\n\t\tew_AddFilter($sWhereWrk, $lookuptblfilter);\n\t\tew_AddFilter($sWhereWrk, $sFilterWrk);\n\t\t$this->Lookup_Selecting($this->tipoespecial, $sWhereWrk); // Call Lookup Selecting\n\t\tif ($sWhereWrk <> \"\") $sSqlWrk .= \" WHERE \" . $sWhereWrk;\n\t\t\t$rswrk = Conn()->Execute($sSqlWrk);\n\t\t\tif ($rswrk && !$rswrk->EOF) { // Lookup values found\n\t\t\t\t$this->tipoespecial->ViewValue = \"\";\n\t\t\t\t$ari = 0;\n\t\t\t\twhile (!$rswrk->EOF) {\n\t\t\t\t\t$arwrk = array();\n\t\t\t\t\t$arwrk[1] = $rswrk->fields('DispFld');\n\t\t\t\t\t$this->tipoespecial->ViewValue .= $this->tipoespecial->DisplayValue($arwrk);\n\t\t\t\t\t$rswrk->MoveNext();\n\t\t\t\t\tif (!$rswrk->EOF) $this->tipoespecial->ViewValue .= ew_ViewOptionSeparator($ari); // Separate Options\n\t\t\t\t\t$ari++;\n\t\t\t\t}\n\t\t\t\t$rswrk->Close();\n\t\t\t} else {\n\t\t\t\t$this->tipoespecial->ViewValue = $this->tipoespecial->CurrentValue;\n\t\t\t}\n\t\t} else {\n\t\t\t$this->tipoespecial->ViewValue = NULL;\n\t\t}\n\t\t$this->tipoespecial->ViewCustomAttributes = \"\";\n\n\t\t// email_contacto\n\t\tif (strval($this->email_contacto->CurrentValue) <> \"\") {\n\t\t\t$sFilterWrk = \"`login`\" . ew_SearchString(\"=\", $this->email_contacto->CurrentValue, EW_DATATYPE_STRING, \"\");\n\t\t$sSqlWrk = \"SELECT `login`, `nombre` AS `DispFld`, `apellido` AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `oficialcredito`\";\n\t\t$sWhereWrk = \"\";\n\t\t$this->email_contacto->LookupFilters = array(\"dx1\" => '`nombre`', \"dx2\" => '`apellido`');\n\t\tew_AddFilter($sWhereWrk, $sFilterWrk);\n\t\t$this->Lookup_Selecting($this->email_contacto, $sWhereWrk); // Call Lookup Selecting\n\t\tif ($sWhereWrk <> \"\") $sSqlWrk .= \" WHERE \" . $sWhereWrk;\n\t\t\t$rswrk = Conn()->Execute($sSqlWrk);\n\t\t\tif ($rswrk && !$rswrk->EOF) { // Lookup values found\n\t\t\t\t$arwrk = array();\n\t\t\t\t$arwrk[1] = $rswrk->fields('DispFld');\n\t\t\t\t$arwrk[2] = $rswrk->fields('Disp2Fld');\n\t\t\t\t$this->email_contacto->ViewValue = $this->email_contacto->DisplayValue($arwrk);\n\t\t\t\t$rswrk->Close();\n\t\t\t} else {\n\t\t\t\t$this->email_contacto->ViewValue = $this->email_contacto->CurrentValue;\n\t\t\t}\n\t\t} else {\n\t\t\t$this->email_contacto->ViewValue = NULL;\n\t\t}\n\t\t$this->email_contacto->ViewCustomAttributes = \"\";\n\n\t\t\t// nombre_contacto\n\t\t\t$this->nombre_contacto->LinkCustomAttributes = \"\";\n\t\t\t$this->nombre_contacto->HrefValue = \"\";\n\t\t\t$this->nombre_contacto->TooltipValue = \"\";\n\n\t\t\t// name\n\t\t\t$this->name->LinkCustomAttributes = \"\";\n\t\t\t$this->name->HrefValue = \"\";\n\t\t\t$this->name->TooltipValue = \"\";\n\n\t\t\t// lastname\n\t\t\t$this->lastname->LinkCustomAttributes = \"\";\n\t\t\t$this->lastname->HrefValue = \"\";\n\t\t\t$this->lastname->TooltipValue = \"\";\n\n\t\t\t// email\n\t\t\t$this->_email->LinkCustomAttributes = \"\";\n\t\t\t$this->_email->HrefValue = \"\";\n\t\t\t$this->_email->TooltipValue = \"\";\n\n\t\t\t// address\n\t\t\t$this->address->LinkCustomAttributes = \"\";\n\t\t\t$this->address->HrefValue = \"\";\n\t\t\t$this->address->TooltipValue = \"\";\n\n\t\t\t// phone\n\t\t\t$this->phone->LinkCustomAttributes = \"\";\n\t\t\t$this->phone->HrefValue = \"\";\n\t\t\t$this->phone->TooltipValue = \"\";\n\n\t\t\t// cell\n\t\t\t$this->cell->LinkCustomAttributes = \"\";\n\t\t\t$this->cell->HrefValue = \"\";\n\t\t\t$this->cell->TooltipValue = \"\";\n\n\t\t\t// created_at\n\t\t\t$this->created_at->LinkCustomAttributes = \"\";\n\t\t\t$this->created_at->HrefValue = \"\";\n\t\t\t$this->created_at->TooltipValue = \"\";\n\n\t\t\t// id_sucursal\n\t\t\t$this->id_sucursal->LinkCustomAttributes = \"\";\n\t\t\t$this->id_sucursal->HrefValue = \"\";\n\t\t\t$this->id_sucursal->TooltipValue = \"\";\n\n\t\t\t// tipoinmueble\n\t\t\t$this->tipoinmueble->LinkCustomAttributes = \"\";\n\t\t\t$this->tipoinmueble->HrefValue = \"\";\n\t\t\t$this->tipoinmueble->TooltipValue = \"\";\n\n\t\t\t// tipovehiculo\n\t\t\t$this->tipovehiculo->LinkCustomAttributes = \"\";\n\t\t\t$this->tipovehiculo->HrefValue = \"\";\n\t\t\t$this->tipovehiculo->TooltipValue = \"\";\n\n\t\t\t// tipomaquinaria\n\t\t\t$this->tipomaquinaria->LinkCustomAttributes = \"\";\n\t\t\t$this->tipomaquinaria->HrefValue = \"\";\n\t\t\t$this->tipomaquinaria->TooltipValue = \"\";\n\n\t\t\t// tipomercaderia\n\t\t\t$this->tipomercaderia->LinkCustomAttributes = \"\";\n\t\t\t$this->tipomercaderia->HrefValue = \"\";\n\t\t\t$this->tipomercaderia->TooltipValue = \"\";\n\n\t\t\t// tipoespecial\n\t\t\t$this->tipoespecial->LinkCustomAttributes = \"\";\n\t\t\t$this->tipoespecial->HrefValue = \"\";\n\t\t\t$this->tipoespecial->TooltipValue = \"\";\n\n\t\t\t// email_contacto\n\t\t\t$this->email_contacto->LinkCustomAttributes = \"\";\n\t\t\t$this->email_contacto->HrefValue = \"\";\n\t\t\t$this->email_contacto->TooltipValue = \"\";\n\t\t} elseif ($this->RowType == EW_ROWTYPE_SEARCH) { // Search row\n\n\t\t\t// nombre_contacto\n\t\t\t$this->nombre_contacto->EditAttrs[\"class\"] = \"form-control\";\n\t\t\t$this->nombre_contacto->EditCustomAttributes = \"\";\n\t\t\t$this->nombre_contacto->EditValue = ew_HtmlEncode($this->nombre_contacto->AdvancedSearch->SearchValue);\n\t\t\t$this->nombre_contacto->PlaceHolder = ew_RemoveHtml($this->nombre_contacto->FldTitle());\n\n\t\t\t// name\n\t\t\t$this->name->EditAttrs[\"class\"] = \"form-control\";\n\t\t\t$this->name->EditCustomAttributes = \"\";\n\t\t\t$this->name->EditValue = ew_HtmlEncode($this->name->AdvancedSearch->SearchValue);\n\t\t\t$this->name->PlaceHolder = ew_RemoveHtml($this->name->FldTitle());\n\n\t\t\t// lastname\n\t\t\t$this->lastname->EditAttrs[\"class\"] = \"form-control\";\n\t\t\t$this->lastname->EditCustomAttributes = \"\";\n\t\t\t$this->lastname->EditValue = ew_HtmlEncode($this->lastname->AdvancedSearch->SearchValue);\n\t\t\t$this->lastname->PlaceHolder = ew_RemoveHtml($this->lastname->FldTitle());\n\n\t\t\t// email\n\t\t\t$this->_email->EditAttrs[\"class\"] = \"form-control\";\n\t\t\t$this->_email->EditCustomAttributes = \"\";\n\t\t\t$this->_email->EditValue = ew_HtmlEncode($this->_email->AdvancedSearch->SearchValue);\n\t\t\t$this->_email->PlaceHolder = ew_RemoveHtml($this->_email->FldTitle());\n\n\t\t\t// address\n\t\t\t$this->address->EditAttrs[\"class\"] = \"form-control\";\n\t\t\t$this->address->EditCustomAttributes = \"\";\n\t\t\t$this->address->EditValue = ew_HtmlEncode($this->address->AdvancedSearch->SearchValue);\n\t\t\t$this->address->PlaceHolder = ew_RemoveHtml($this->address->FldTitle());\n\n\t\t\t// phone\n\t\t\t$this->phone->EditAttrs[\"class\"] = \"form-control\";\n\t\t\t$this->phone->EditCustomAttributes = \"\";\n\t\t\t$this->phone->EditValue = ew_HtmlEncode($this->phone->AdvancedSearch->SearchValue);\n\t\t\t$this->phone->PlaceHolder = ew_RemoveHtml($this->phone->FldTitle());\n\n\t\t\t// cell\n\t\t\t$this->cell->EditAttrs[\"class\"] = \"form-control\";\n\t\t\t$this->cell->EditCustomAttributes = \"\";\n\t\t\t$this->cell->EditValue = ew_HtmlEncode($this->cell->AdvancedSearch->SearchValue);\n\t\t\t$this->cell->PlaceHolder = ew_RemoveHtml($this->cell->FldTitle());\n\n\t\t\t// created_at\n\t\t\t$this->created_at->EditAttrs[\"class\"] = \"form-control\";\n\t\t\t$this->created_at->EditCustomAttributes = \"\";\n\t\t\t$this->created_at->EditValue = ew_HtmlEncode(ew_FormatDateTime(ew_UnFormatDateTime($this->created_at->AdvancedSearch->SearchValue, 17), 17));\n\t\t\t$this->created_at->PlaceHolder = ew_RemoveHtml($this->created_at->FldTitle());\n\n\t\t\t// id_sucursal\n\t\t\t$this->id_sucursal->EditAttrs[\"class\"] = \"form-control\";\n\t\t\t$this->id_sucursal->EditCustomAttributes = \"\";\n\n\t\t\t// tipoinmueble\n\t\t\t$this->tipoinmueble->EditAttrs[\"class\"] = \"form-control\";\n\t\t\t$this->tipoinmueble->EditCustomAttributes = \"\";\n\n\t\t\t// tipovehiculo\n\t\t\t$this->tipovehiculo->EditAttrs[\"class\"] = \"form-control\";\n\t\t\t$this->tipovehiculo->EditCustomAttributes = \"\";\n\n\t\t\t// tipomaquinaria\n\t\t\t$this->tipomaquinaria->EditAttrs[\"class\"] = \"form-control\";\n\t\t\t$this->tipomaquinaria->EditCustomAttributes = \"\";\n\n\t\t\t// tipomercaderia\n\t\t\t$this->tipomercaderia->EditAttrs[\"class\"] = \"form-control\";\n\t\t\t$this->tipomercaderia->EditCustomAttributes = \"\";\n\n\t\t\t// tipoespecial\n\t\t\t$this->tipoespecial->EditAttrs[\"class\"] = \"form-control\";\n\t\t\t$this->tipoespecial->EditCustomAttributes = \"\";\n\n\t\t\t// email_contacto\n\t\t\t$this->email_contacto->EditAttrs[\"class\"] = \"form-control\";\n\t\t\t$this->email_contacto->EditCustomAttributes = \"\";\n\t\t}\n\t\tif ($this->RowType == EW_ROWTYPE_ADD || $this->RowType == EW_ROWTYPE_EDIT || $this->RowType == EW_ROWTYPE_SEARCH) // Add/Edit/Search row\n\t\t\t$this->SetupFieldTitles();\n\n\t\t// Call Row Rendered event\n\t\tif ($this->RowType <> EW_ROWTYPE_AGGREGATEINIT)\n\t\t\t$this->Row_Rendered();\n\t}",
"public function renderLanguagesToTable(): void\n {\n $this->table->setHeaders(['ID', 'Country', 'Language', 'Default']);\n\n foreach ($this->languages as $language) {\n $this->table->addRow([\n $language->id,\n $language->country,\n $language->name,\n $language->default ? 'true' : 'false'\n ]);\n }\n\n $this->table->render();\n }"
] |
[
"0.63361394",
"0.63361394",
"0.63083416",
"0.62598884",
"0.6096139",
"0.60957295",
"0.60363233",
"0.6007658",
"0.5995847",
"0.5913158",
"0.5816767",
"0.5775123",
"0.56843156",
"0.5671429",
"0.563342",
"0.56156003",
"0.56043637",
"0.56043637",
"0.5603904",
"0.559621",
"0.55622464",
"0.55611277",
"0.555159",
"0.553663",
"0.55315006",
"0.55223024",
"0.54837734",
"0.548057",
"0.54732126",
"0.54716593"
] |
0.6684652
|
0
|
Merge two "replace"type lines into a single line. The implementation concept is that if we remove all closure parts from the old and the new, the rest of them (cleaned line) should be the same. And then, we add back those removed closure parts in a correct order.
|
protected function mergeReplaceLines(string $oldLine, string $newLine): ?string
{
$delParts = $this->analyzeClosureParts(
$oldLine,
RendererConstant::HTML_CLOSURES_DEL,
SequenceMatcher::OP_DEL,
);
$insParts = $this->analyzeClosureParts(
$newLine,
RendererConstant::HTML_CLOSURES_INS,
SequenceMatcher::OP_INS,
);
// get the cleaned line by a non-regex way (should be faster)
// i.e., the new line with all "<ins>...</ins>" parts removed
$mergedLine = $newLine;
foreach (ReverseIterator::fromArray($insParts) as $part) {
$mergedLine = substr_replace(
$mergedLine,
'', // deletion
$part['offset'],
\strlen($part['content']),
);
}
// note that $mergedLine is actually a clean line at this point
if (!$this->isLinesMergeable($oldLine, $newLine, $mergedLine)) {
return null;
}
// before building the $mergedParts, we do some adjustments
$this->revisePartsForBoundaryNewlines($delParts, RendererConstant::HTML_CLOSURES_DEL);
$this->revisePartsForBoundaryNewlines($insParts, RendererConstant::HTML_CLOSURES_INS);
// create a sorted merged parts array
$mergedParts = [...$delParts, ...$insParts];
usort(
$mergedParts,
// first sort by "offsetClean", "order" then by "type"
static fn (array $a, array $b): int => (
$a['offsetClean'] <=> $b['offsetClean']
?: $a['order'] <=> $b['order']
?: ($a['type'] === SequenceMatcher::OP_DEL ? -1 : 1)
),
);
// insert merged parts into the cleaned line
foreach (ReverseIterator::fromArray($mergedParts) as $part) {
$mergedLine = substr_replace(
$mergedLine,
$part['content'],
$part['offsetClean'],
0, // insertion
);
}
return str_replace("\n", '<br>', $mergedLine);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function cleanup_reformat($change) {\n\t\tif (!array_key_exists('add_lines', $change) && !array_key_exists('remove_lines', $change))\n\t\t\treturn $change;\n\t\t\n\t\tif (array_key_exists('remove_lines', $change))\n\t\tforeach($change['remove_lines'] as $key => $removed) {\n\t\t\t$removed = cleanup_line_reformat($removed);\n\t\t\t$found = empty($removed);\n\t\t\tif (!$found && array_key_exists('add_lines', $change)) {\n\t\t\t\tforeach($change['add_lines'] as $key2 => $added) {\n\t\t\t\t\t$added = cleanup_line_reformat($added);\n\t\t\t\t\tif (empty($added)) {\n\t\t\t\t\t\tunset($change['add_lines'][$key2]);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tif ($removed == $added) {\n\t\t\t\t\t\tunset($change['add_lines'][$key2]);\n\t\t\t\t\t\t$found = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ($found) unset($change['remove_lines'][$key]);\n\t\t}\n\t\t\n\t\t// Clean empty added lines\n\t\tif (array_key_exists('add_lines', $change))\n\t\tforeach($change['add_lines'] as $key2 => $added) {\n\t\t\t$added = cleanup_line_reformat($added);\n\t\t\tif (empty($added))\n\t\t\t\tunset($change['add_lines'][$key2]);\n\t\t}\n\t\treturn $change;\n\t}",
"function addLines2Caddie($lines){\n $caddie = $this->getCaddie();\n $caddie['lines'] = array_merge($caddie['lines'], $lines);\n $this->consolidateCaddie($caddie);\n }",
"function _shiftBoundaries($lines, &$changed, $other_changed)\n {\n }",
"private function mergeChanges(\n array $baseLines,\n array $changedLines,\n array $deleteColors = [null, null],\n array $insertColors = [null, null]\n ): array {\n $padding = str_repeat(\n ' ',\n max($this->maxLineMarkerWidth - strlen($this->options['equalityMarkers'][1]), 0)\n );\n\n foreach ($baseLines as $lineKey => $line) {\n $iterator = 0;\n $baselineParts = preg_split('/\\x00(.*?)\\x01/', $line, -1, PREG_SPLIT_DELIM_CAPTURE);\n $changedLineParts = preg_split('/\\x00(.*?)\\x01/', $changedLines[$lineKey], -1, PREG_SPLIT_DELIM_CAPTURE);\n\n foreach ($baselineParts as $partKey => &$part) {\n if ($iterator++ % 2) {\n // This part of the line has been changed. Surround it with user defined markers.\n $basePart = $this->options['deleteMarkers'][0] . $part . $this->options['deleteMarkers'][1];\n $changedPart = '';\n if (isset($changedLineParts[$partKey])) {\n $changedPart =\n $this->options['insertMarkers'][0] .\n $changedLineParts[$partKey] .\n $this->options['insertMarkers'][1];\n }\n\n if ($this->options['cliColor']) {\n $colorize = new CliColors();\n $basePart = $colorize->getColoredString($basePart, ...$deleteColors);\n if (!empty($changedPart)) {\n $changedPart = $colorize->getColoredString($changedPart, ...$insertColors);\n }\n }\n $part = $basePart . $changedPart;\n }\n }\n unset($part);\n $baseLines[$lineKey] = $this->options['equalityMarkers'][1] . $padding . '|' . implode('', $baselineParts);\n }\n\n return $baseLines;\n }",
"public function replace( $old, $new );",
"protected function getImportsReplace()\n {\n\n // build up import lines\n $importLines = [\n config('pxlcms.generator.repositories.extend_class')\n ];\n\n // model classname\n $importLines[] = $this->context->makeFqnForModelName( studly_case($this->data->name) );;\n\n\n\n // set them in the right order\n if (config('pxlcms.generator.aesthetics.sort_imports_by_string_length')) {\n\n // sort from shortest to longest\n usort($importLines, function ($a, $b) {\n return strlen($a) - strlen($b);\n });\n\n } else {\n sort($importLines);\n }\n\n\n // build the actual replacement string\n $replace = \"\\n\";\n\n foreach ($importLines as $line) {\n $replace .= \"use \" . $line . \";\\n\";\n }\n\n $replace .= \"\\n\";\n\n return $replace;\n }",
"protected function renderTableBlockReplace(array $block): string\n {\n if ($this->options['detailLevel'] === 'none') {\n return\n $this->renderTableBlockDelete($block) .\n $this->renderTableBlockInsert($block);\n }\n\n $ret = '';\n\n $oldLines = $block['old']['lines'];\n $newLines = $block['new']['lines'];\n\n $oldLinesCount = \\count($oldLines);\n $newLinesCount = \\count($newLines);\n\n // if the line counts changes, we treat the old and the new as\n // \"a line with \\n in it\" and then do one-line-to-one-line diff\n if ($oldLinesCount !== $newLinesCount) {\n [$oldLines, $newLines] = $this->markReplaceBlockDiff($oldLines, $newLines);\n $oldLinesCount = $newLinesCount = 1;\n }\n\n $oldLines = $this->customFormatLines($oldLines, SequenceMatcher::OP_DEL);\n $newLines = $this->customFormatLines($newLines, SequenceMatcher::OP_INS);\n\n // now $oldLines must has the same line counts with $newlines\n for ($no = 0; $no < $newLinesCount; ++$no) {\n $mergedLine = $this->mergeReplaceLines($oldLines[$no], $newLines[$no]);\n\n // not merge-able, we fall back to separated form\n if (!isset($mergedLine)) {\n $ret .=\n $this->renderTableBlockDelete($block) .\n $this->renderTableBlockInsert($block);\n\n break;\n }\n\n $ret .= $this->renderTableRow('rep', SequenceMatcher::OP_REP, $mergedLine);\n }\n\n return $ret;\n }",
"public function get_replace()\n {\n return preg_replace('/^insert/', 'replace', $this->get_insert());\n }",
"protected function revisePartsForBoundaryNewlines(array &$parts, array $closures): void\n {\n [$ld, $rd] = $closures;\n\n $ldRegex = preg_quote($ld, '/');\n $rdRegex = preg_quote($rd, '/');\n\n for ($i = \\count($parts) - 1; $i >= 0; --$i) {\n $part = &$parts[$i];\n\n // deal with leading newlines\n $part['content'] = preg_replace_callback(\n \"/(?P<closure>{$ldRegex})(?P<nl>[\\r\\n]++)/u\",\n static function (array $matches) use (&$parts, $part, $ld, $rd): string {\n // add a new part for the extracted newlines\n $part['order'] = -1;\n $part['content'] = \"{$ld}{$matches['nl']}{$rd}\";\n $parts[] = $part;\n\n return $matches['closure'];\n },\n $part['content'],\n );\n\n // deal with trailing newlines\n $part['content'] = preg_replace_callback(\n \"/(?P<nl>[\\r\\n]++)(?P<closure>{$rdRegex})/u\",\n static function (array $matches) use (&$parts, $part, $ld, $rd): string {\n // add a new part for the extracted newlines\n $part['order'] = 1;\n $part['content'] = \"{$ld}{$matches['nl']}{$rd}\";\n $parts[] = $part;\n\n return $matches['closure'];\n },\n $part['content'],\n );\n }\n }",
"function endLineCharDelete()\n {\n $newArray = [];\n $array = $this->prepMethods;\n for ($i = 0; $i < count($array); $i++) {\n $new_element = str_replace($this->endLinePHP, $this->endLineSwift, $array[$i]);\n array_push($newArray, $new_element);\n }\n $this->prepMethods = $newArray;\n }",
"public function filterByLine($pat, $replacement=\"\") {\r\n $arr = $this->toArray();\r\n $newContents = \"\";\r\n foreach($arr as $line) {\r\n $newContents .= preg_replace($pat, $replacement, $line).\"\\n\";\r\n }\r\n // Following removes extra blank line -- why needed?\r\n $newContents = substr_replace($newContents, \"\", -1);\r\n $this->contents = $newContents;\r\n }",
"protected function isLinesMergeable(string $oldLine, string $newLine, string $cleanLine): bool\n {\n $oldLine = str_replace(RendererConstant::HTML_CLOSURES_DEL, '', $oldLine);\n $newLine = str_replace(RendererConstant::HTML_CLOSURES_INS, '', $newLine);\n\n $sumLength = \\strlen($oldLine) + \\strlen($newLine);\n\n /** @var float the changed ratio, 0 <= value < 1 */\n $changedRatio = ($sumLength - (\\strlen($cleanLine) << 1)) / ($sumLength + 1);\n\n return $changedRatio <= $this->options['mergeThreshold'];\n }",
"protected function makeReplacements($line, array $replaces)\n {\n foreach ($replaces as $key => $value) {\n $line = str_replace(':' .$key, $value, $line);\n }\n\n return $line;\n }",
"function _shift_boundaries ($lines, &$changed, $other_changed) {\r\n\t$i = 0;\r\n\t$j = 0;\r\n\r\n\tUSE_ASSERTS && assert('sizeof($lines) == sizeof($changed)');\r\n\t$len = sizeof($lines);\r\n\t$other_len = sizeof($other_changed);\r\n\r\n\twhile (1) {\r\n\t /*\r\n\t * Scan forwards to find beginning of another run of changes.\r\n\t * Also keep track of the corresponding point in the other file.\r\n\t *\r\n\t * Throughout this code, $i and $j are adjusted together so that\r\n\t * the first $i elements of $changed and the first $j elements\r\n\t * of $other_changed both contain the same number of zeros\r\n\t * (unchanged lines).\r\n\t * Furthermore, $j is always kept so that $j == $other_len or\r\n\t * $other_changed[$j] == false.\r\n\t */\r\n\t while ($j < $other_len && $other_changed[$j])\r\n\t\t$j++;\r\n\t\r\n\t while ($i < $len && ! $changed[$i]) {\r\n\t\tUSE_ASSERTS && assert('$j < $other_len && ! $other_changed[$j]');\r\n\t\t$i++; $j++;\r\n\t\twhile ($j < $other_len && $other_changed[$j])\r\n\t\t $j++;\r\n }\r\n\r\n\t if ($i == $len)\r\n\t\tbreak;\r\n\r\n\t $start = $i;\r\n\r\n\t // Find the end of this run of changes.\r\n\t while (++$i < $len && $changed[$i])\r\n\t\tcontinue;\r\n\r\n\t do {\r\n\t\t/*\r\n\t\t * Record the length of this run of changes, so that\r\n\t\t * we can later determine whether the run has grown.\r\n\t\t */\r\n\t\t$runlength = $i - $start;\r\n\r\n\t\t/*\r\n\t\t * Move the changed region back, so long as the\r\n\t\t * previous unchanged line matches the last changed one.\r\n\t\t * This merges with previous changed regions.\r\n\t\t */\r\n\t\twhile ($start > 0 && $lines[$start - 1] == $lines[$i - 1]) {\r\n\t\t $changed[--$start] = 1;\r\n\t\t $changed[--$i] = false;\r\n\t\t while ($start > 0 && $changed[$start - 1])\r\n\t\t\t$start--;\r\n\t\t USE_ASSERTS && assert('$j > 0');\r\n\t\t while ($other_changed[--$j])\r\n\t\t\tcontinue;\r\n\t\t USE_ASSERTS && assert('$j >= 0 && !$other_changed[$j]');\r\n }\r\n\r\n\t\t/*\r\n\t\t * Set CORRESPONDING to the end of the changed run, at the last\r\n\t\t * point where it corresponds to a changed run in the other file.\r\n\t\t * CORRESPONDING == LEN means no such point has been found.\r\n\t\t */\r\n\t\t$corresponding = $j < $other_len ? $i : $len;\r\n\r\n\t\t/*\r\n\t\t * Move the changed region forward, so long as the\r\n\t\t * first changed line matches the following unchanged one.\r\n\t\t * This merges with following changed regions.\r\n\t\t * Do this second, so that if there are no merges,\r\n\t\t * the changed region is moved forward as far as possible.\r\n\t\t */\r\n\t\twhile ($i < $len && $lines[$start] == $lines[$i]) {\r\n\t\t $changed[$start++] = false;\r\n\t\t $changed[$i++] = 1;\r\n\t\t while ($i < $len && $changed[$i])\r\n\t\t\t$i++;\r\n\r\n\t\t USE_ASSERTS && assert('$j < $other_len && ! $other_changed[$j]');\r\n\t\t $j++;\r\n\t\t if ($j < $other_len && $other_changed[$j]) {\r\n\t\t\t$corresponding = $i;\r\n\t\t\twhile ($j < $other_len && $other_changed[$j])\r\n\t\t\t $j++;\r\n }\r\n }\r\n } while ($runlength != $i - $start);\r\n\r\n\t /*\r\n\t * If possible, move the fully-merged run of changes\r\n\t * back to a corresponding run in the other file.\r\n\t */\r\n\t while ($corresponding < $i) {\r\n\t\t$changed[--$start] = 1;\r\n\t\t$changed[--$i] = 0;\r\n\t\tUSE_ASSERTS && assert('$j > 0');\r\n\t\twhile ($other_changed[--$j])\r\n\t\t continue;\r\n\t\tUSE_ASSERTS && assert('$j >= 0 && !$other_changed[$j]');\r\n }\r\n }\r\n }",
"public function swapLines($line1, $line2) {\r\n\t\tif ($this->exists && $line1 !== null && $line2 !== null) {\r\n\t\t\t$lineData = $this->readByLine ();\r\n\t\t\t\r\n\t\t\t$inodes = new iArrayList ();\r\n\t\t\tfor($y = 0; $y < sizeof ( $lineData ); $y ++) {\r\n\t\t\t\t$inodes->add_iNode ( new iNode ( $lineData [$y], null, null, null ) );\r\n\t\t\t}\r\n\t\t\t$data1 = $inodes->getNode ( $line1 )->Data1;\r\n\t\t\t$data2 = $inodes->getNode ( $line2 )->Data1;\r\n\t\t\t$inodes->getNode ( $line1 )->Data1 = $data2;\r\n\t\t\t$inodes->getNode ( $line2 )->Data1 = $data1;\r\n\t\t\t$this->clearFile ();\r\n\t\t\tfor($y = 0; $y < $inodes->count; $y ++) {\r\n\t\t\t\t$this->writeToFile ( $inodes->getNode ( $y )->Data1 );\r\n\t\t\t}\r\n\t\t\t$inodes->__destruct ();\r\n\t\t\treturn true;\r\n\t\t\r\n\t\t} else {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}",
"private static function cleanEmptyLines($code_lines, $remove_line_code)\n {\n $removed = 0;\n $cleaning = false;\n for($i=2; $i < count($code_lines); $i++) {\n if ($cleaning) {\n if ((trim($code_lines[$i]) == '') || ($code_lines[$i] == $remove_line_code)) {\n $code_lines[$i] = $remove_line_code;\n $removed++;\n }\n else {\n $cleaning = false;\n }\n }\n else if (((trim($code_lines[$i-2]) == '') || ($code_lines[$i-2] == $remove_line_code)) && \n ((trim($code_lines[$i-1]) == '') || ($code_lines[$i-1] == $remove_line_code)) &&\n ((trim($code_lines[$i ]) == '') || ($code_lines[$i ] == $remove_line_code))) {\n $code_lines[$i-1] = $remove_line_code;\n $code_lines[$i ] = $remove_line_code;\n $removed++;\n $removed++;\n $cleaning = true;\n }\n }\n\n return $code_lines;\n }",
"function __replaceWithNewlines() {\n\t\t$args = func_get_args();\n\t\t$numLineBreaks = count(explode(\"\\n\", $args[0][0]));\n\t\treturn str_pad('', $numLineBreaks - 1, \"\\n\");\n\t}",
"abstract function processCode(array $replacePairs, array $fileSpecificReplacePairs, array &$unusedReplacePairs, array&$unusedFileSpecificReplacePairs);",
"public function replaceLines($startOriginalLine, $endOriginalLine, array $newLines)\n {\n $this->assertValidOriginalLine($startOriginalLine);\n $this->assertValidOriginalLine($endOriginalLine);\n\n if ($startOriginalLine > $endOriginalLine) {\n throw new \\InvalidArgumentException(\"Start line number has to be smaller than end original line.\");\n }\n\n for ($i = $startOriginalLine; $i <= $endOriginalLine; $i++) {\n if ($i === $endOriginalLine) {\n $this->changeLines($i, $newLines);\n } else {\n $this->removeLine($i);\n }\n }\n }",
"public function replace() {\n\n\t\t$styles = array();\n\t\t$scripts = array();\n\n\t\t/**\n\t\t * Extract the buffer's contents (from wp_head() or wp_footer())\n\t\t *\n\t\t */\n\t\t$html = ob_get_clean();\n\t\t\n\t\t/**\n\t\t * Match all <link>s that are stylesheets\n\t\t * @TODO: Only match if media=\"all\"\n\t\t *\n\t\t */\n\t\t$css = '/<link.*?stylesheet.*?href=[\\'|\"]([^\\'|\"]+)[\\'|\"][^>]+?>/';\n\t\tpreg_match_all( $css, $html, $styles );\n\t\t\n\t\tif ( !empty( $styles[ 1 ] ) ) {\n\t\t\t/**\n\t\t\t * Styles exist, strip them from the buffer\n\t\t\t *\n\t\t\t */\n\t\t\t$html = preg_replace( $css, '', $html );\n\t\t\t/**\n\t\t\t * Create MD5 hash of all file names in order\n\t\t\t *\n\t\t\t */\n\t\t\t$hash = $this->hash_files( $styles[1] );\n\t\t\t$styles = $this->combine( $hash, $styles[1], 'css' );\n\t\t} else {\n\t\t\t$styles = '';\n\t\t}\n\t\n\t\t/**\n\t\t * Match all <script>s\n\t\t *\n\t\t */\n\t\t$js = '/<script.*src=[\\'|\"]([^\"|\\']+)[\\'|\"].*><\\/script>/';\n\t\tpreg_match_all( $js, $html, $scripts );\n\n\t\tif ( !empty( $scripts[ 1 ] ) ) {\n\t\t\t/**\n\t\t\t * Scripts exist, strip them from the buffer\n\t\t\t *\n\t\t\t */\n\t\t\t$html = preg_replace( $js, '', $html );\n\t\t\t/**\n\t\t\t * Create MD5 hash of all file names in order\n\t\t\t *\n\t\t\t */\n\t\t\t$hash = $this->hash_files( $scripts[1] );\n\t\t\t$scripts = $this->combine( $hash, $scripts[1], 'js' );\n\t\t\t\n\t\t} else {\n\t\t\t$scripts = '';\n\t\t}\n\t\t\n\t\t/* Print the scripts first if in the header, last if in the footer */\n\t\tif( doing_action( 'wp_footer' ) ) {\n\t\t\t$html .= $styles . $scripts;\n\t\t} else {\n\t\t\t$html = $styles . $scripts . $html;\n\t\t}\n\t\t\n\t\techo $html;\n\n\t}",
"public static function mangleClass($classname, $code, $add_methods, $remove_methods = array())\n {\n $default_comment = self::getDefaultComment();\n\n $reflclass = new \\reflectionclass($classname);\n\n $code_lines = explode(\"\\n\", $code);\n $remove_line_code = '// remove this line';\n\n foreach($remove_methods as $method) {\n // @todo do something here\n }\n\n\n // ignore and later remove empty lines in the end of the code\n\n $line = $reflclass->getendline() - 1;\n while (($line > 0) && (trim($code_lines[$line]) == '')) {\n $code_lines[$line] = $remove_line_code;\n $line--;\n }\n\n $new_code = '';\n foreach($add_methods as $method => $code) {\n if (method_exists($classname, $method)) {\n $reflmethod = new \\reflectionmethod($classname, $method);\n\n $start_line = $reflmethod->getstartline() - 1;\n $end_line = $reflmethod->getendline();\n\n $doccomment = $reflmethod->getdoccomment();\n if ($doccomment !== false) {\n $start_line -= count(explode(\"\\n\", $doccomment));\n\n if (strstr($doccomment, '@PivotX\\\\AutoUpdateCode') === false) {\n // we are NOT updating this code\n continue;\n }\n }\n\n for($line=$start_line; $line < $end_line; $line++) {\n $code_lines[$line] = $remove_line_code;\n }\n }\n\n $code = str_replace('%comment%', $default_comment, $code);\n\n if ($new_code != '') {\n $new_code .= \"\\n\";\n }\n $new_code .= $code;\n }\n\n array_splice($code_lines, $reflclass->getendline()-1, 0, array($new_code));\n\n\n\n // remove too many empty lines\n\n $code_lines = self::cleanEmptyLines($code_lines, $remove_line_code);\n\n\n\n // check for the correct namespace 'use' statement\n\n $code_lines = self::fixUseStatement($code_lines);\n\n\n // clean the code\n\n $lines = array();\n foreach($code_lines as $line) {\n if ($line != $remove_line_code) {\n $lines[] = $line;\n }\n }\n\n return implode(\"\\n\", $lines);\n }",
"private function calloutReplace($match) {\n // Match[1] is the \"left\" or \"right\" of the callout\n // alignment. Match[2] is the interior content of the <div>.\n // Extra spacings have been added in various places\n // for visual spacing. Remove them, or they'll throw\n // things off in the new callout component.\n $match[2] = preg_replace('|(<br>)+|is', '<br>', $match[2]);\n\n // Remove anything after the first '<br>',\n // as it is not in the same '<strong>' group\n // as the ones on the first line.\n $headline_match_string = preg_replace('%(<br>|<br \\/>|<br\\/>|<ul>).*%is', '', $match[2]);\n\n // Look for a headline to use in the callout, which are bolded strings\n // at the start of the callout. Also look for any additional\n // line breaks. Like before, here they are unnecessary.\n $headline = '';\n if (preg_match_all(\"|<strong>(.*?)<\\/strong>(<br>)*|is\", $headline_match_string, $headline_matches)) {\n // Build the headline if we found one.\n $headline_classes = implode(' ', [\n 'headline',\n 'block__headline',\n 'headline--serif',\n 'headline--underline',\n 'headline--center',\n ]);\n\n // If there are multiple <strong>'s, then we need to concatenate them.\n $headline_text = '';\n foreach ($headline_matches[1] as $value) {\n $headline_text .= $value;\n // If we're adding the headline separately,\n // remove it from the rest of the text, so we don't duplicate.\n $match[2] = str_replace('<strong>' . $value . '</strong>', '', $match[2]);\n };\n $headline = '<h4 class=\"' . $headline_classes . '\">';\n $headline .= '<span class=\"headline__heading\">';\n $headline .= $headline_text;\n $headline .= '</span></h4>';\n }\n\n // Remove all leading and trailing 'br' tags.\n $match[2] = preg_replace(\"%^(<br>|<br \\/>|<br\\/>\\s)*%is\", '', $match[2], 1);\n $match[2] = preg_replace(\"%(<br>|<br \\/>|<br\\/>$|\\s)*%is\", '', $match[2], 1);\n\n // Build the callout wrapper and return.\n // We're defaulting to medium size, but taking the\n // alignment from the source.\n $wrapper_classes = 'block--word-break callout bg--gray inline--size-small inline--align-' . $match[1];\n return '<div class=\"' . $wrapper_classes . '\">' . $headline . $match[2] . '</div>';\n }",
"function disj($f1, $f2) {\n return function ($x) use ($f1, $f2) {\n return append($f1($x), $f2($x));\n };\n}",
"public function replace($items);",
"function process_nonmatches(&$output, &$text_old, &$text_new)\n\t{\n\t\t$s1 = sizeof($text_old);\n\t\t$s2 = sizeof($text_new);\n\n\t\tif ($s1 > 0 AND $s2 == 0)\n\t\t{\n\t\t\t// lines deleted\n\t\t\tarray_unshift($output, new vB_Text_Diff_Entry(implode(\"\\n\", $text_old), ''));\n\t\t}\n\t\telse if ($s2 > 0 AND $s1 == 0)\n\t\t{\n\t\t\t// lines added\n\t\t\tarray_unshift($output, new vB_Text_Diff_Entry('', implode(\"\\n\", $text_new)));\n\t\t}\n\t\telse if ($s1 > 0 AND $s2 > 0)\n\t\t{\n\t\t\t// substitution\n\t\t\tarray_unshift($output, new vB_Text_Diff_Entry(implode(\"\\n\", $text_old), implode(\"\\n\", $text_new)));\n\t\t}\n\n\t\t$text_old = array();\n\t\t$text_new = array();\n\t}",
"function MergeFile($original, $edited, $cache)\n{\n /*echo \"<table><tr><td VALIGN='top' width='33%'>\" . htmlspecialchars($original) . \"</td><td VALIGN='top' width='33%'>\" . \n htmlspecialchars($edited) . \" </td><td VALIGN='top' width='33%'>\" . htmlspecialchars($cache) . \"</td></tr></table>\";\n echo \"<br><br>-----------------------------------------------------------------------------\";*/\n /* Run the merge */\n require_once 'classMerge.php';\n $merge = new ThreeWayMerge( $original, $edited, $cache, /*'lite'*/ 'full');\n \n $result = $merge->merge();\n\n if ( $result !== FALSE )\n {\n /* Check for conflicts */\n //$conflicts = ( stristr( $result, '<ips:conflict' ) ) ? 1 : 0;\n \n echo htmlspecialchars($result);\n\n $myfile = fopen(\"doclineSQL1.txt\", \"w+\") or die(\"Unable to open file!\");\n fwrite($myfile, $result);\n fclose($myfile);\n } \n else\n echo \"Fail to merge\";\n}",
"function content_processing($contents, $replacements)\n{\n $contents = str_replace($replacements['simple_delete'], '', $contents);\n $contents = preg_replace($replacements['preg_delete'], '', $contents);\n return $contents;\n}",
"function MappedDiff($from_lines, $to_lines,\r\n $mapped_from_lines, $mapped_to_lines) {\r\n\r\n assert(sizeof($from_lines) == sizeof($mapped_from_lines));\r\n assert(sizeof($to_lines) == sizeof($mapped_to_lines));\r\n\r\n $this->Diff($mapped_from_lines, $mapped_to_lines);\r\n\r\n $xi = $yi = 0;\r\n // Optimizing loop invariants:\r\n // http://phplens.com/lens/php-book/optimizing-debugging-php.php\r\n for ($i = 0, $max = sizeof($this->edits); $i < $max; $i++) {\r\n $orig = &$this->edits[$i]->orig;\r\n if (is_array($orig)) {\r\n $orig = array_slice($from_lines, $xi, sizeof($orig));\r\n $xi += sizeof($orig);\r\n }\r\n\r\n $final = &$this->edits[$i]->final;\r\n if (is_array($final)) {\r\n $final = array_slice($to_lines, $yi, sizeof($final));\r\n $yi += sizeof($final);\r\n }\r\n }\r\n }",
"function savePage($pageName, $newPageBody, $originalPageBody)\n{\n $newPageBody = str_replace(\"\\r\", \"\", $newPageBody);\n $originalPageBody = str_replace(\"\\r\", \"\", $originalPageBody);\n\n $sFile = getPagePath($pageName);\n\n if (trim($newPageBody) == \"\") {\n unlink($sFile);\n return;\n }\n\n if (USE_MERGE) {\n $newBodyPath = tempFile($newPageBody);\n $originalBodyPath = tempFile($originalPageBody);\n // Clen up CRLF into LF to allow proper merge\n if (file_exists($sFile)) {\n $tmpFilePath = tempFile(str_replace(\"\\r\", \"\", file_get_contents($sFile)));\n }\n else {\n $tmpFilePath = tempFile(\"\");\n }\n\n system(\"set -x; merge \" . $tmpFilePath . \" \"\n . $originalBodyPath . \" \" . $newBodyPath,\n &$result);\n if ($result > 0) {\n\n # replace conflict markers\n $f = fopen($tmpFilePath, \"rt\");\n $s = fread($f, filesize($tmpFilePath)+1);\n fclose($f);\n\n $s = ereg_replace(\"<<<<<<<[^\\n]*\", '<blink style=\"color: red\">CONFLICT</blink>', $s);\n $s = ereg_replace(\">>>>>>>[^\\n]*\", '<blink style=\"color: red\">END</blink>', $s);\n\n $f = fopen($sFile, \"wt\");\n fwrite($f, $s);\n }\n else {\n copy($tmpFilePath, $sFile);\n }\n\n unlink($originalBodyPath);\n unlink($newBodyPath);\n unlink($tmpFilePath);\n }\n else {\n # just overwrite file, last writer wins\n if($newPageBody != \"\")\n {\n $f = fopen($sFile, \"wt\");\n fwrite($f, $newPageBody);\n fclose($f);\n }\n else\n {\n @unlink($sFile);\n }\n }\n}",
"public function replace($value, $addSemicolon = true)\n {\n if ($addSemicolon) {\n $value = $this->addSemicolon($value);\n }\n $search = [\n // Regular expression to match and remove comments, whitespaces, and new lines.\n '#\\s*(\"(?:[^\"\\\\\\]++|\\\\\\.)*+\"|\\'(?:[^\\'\\\\\\\\]++|\\\\\\.)*+\\')\\s*|\\s*\\/\\*(?!\\!|@cc_on)(?>[\\s\\S]*?\\*\\/)\\s*|\\s*(?<![\\:\\=])\\/\\/.*(?=[\\n\\r]|$)|^\\s*|\\s*$#',\n\n // Regular expression to remove unnecessary whitespaces, semicolons, and comments around code elements.\n '#(\"(?:[^\"\\\\\\]++|\\\\\\.)*+\"|\\'(?:[^\\'\\\\\\\\]++|\\\\\\.)*+\\'|\\/\\*(?>.*?\\*\\/)|\\/(?!\\/)[^\\n\\r]*?\\/(?=[\\s.,;]|[gimuy]|$))|\\s*([!%&*\\(\\)\\-=+\\[\\]\\{\\}|;:,.<>?\\/])\\s*#s',\n\n // Regular expression to remove multiple consecutive semicolons followed by a closing brace.\n '#;+\\}#',\n\n // Regular expression to remove unnecessary quotes from object keys.\n '#([\\{,])([\\'])(\\d+|[a-z_][a-z0-9_]*)\\2(?=\\:)#i',\n\n // Regular expression to convert JavaScript object key access using brackets to dot notation.\n '#([a-z0-9_\\)\\]])\\[([\\'\"])([a-z_][a-z0-9_]*)\\2\\]#i',\n ];\n\n // Replace the matched patterns with corresponding replacements.\n $replace = [\n '$1',\n '$1$2',\n '}',\n '$1$3',\n '$1.$3',\n ];\n\n // Apply the regular expression replacement to the given value and trim the result.\n return trim(preg_replace($search, $replace, $value));\n }"
] |
[
"0.5468695",
"0.53129005",
"0.5164472",
"0.5145433",
"0.5131842",
"0.5022801",
"0.49779546",
"0.49658373",
"0.49396616",
"0.49275368",
"0.48969457",
"0.4874239",
"0.4844567",
"0.48127314",
"0.4781034",
"0.4769772",
"0.4701618",
"0.46611533",
"0.46548432",
"0.46480495",
"0.4556986",
"0.45559108",
"0.45406917",
"0.45202956",
"0.45160913",
"0.4505692",
"0.45042443",
"0.450209",
"0.44412416",
"0.44407046"
] |
0.67733854
|
0
|
Analyze and get the closure parts information of the line. Such as extract informations for "part 1" and "part 2" from "Hello part 1SOME OTHER TEXTpart 2 World"
|
protected function analyzeClosureParts(string $line, array $closures, int $type): array
{
[$ld, $rd] = $closures;
$ldLength = \strlen($ld);
$rdLength = \strlen($rd);
$parts = [];
$partStart = $partEnd = 0;
$partLengthSum = 0;
// find the next left delimiter
while (false !== ($partStart = strpos($line, $ld, $partEnd))) {
// find the corresponding right delimiter
if (false === ($partEnd = strpos($line, $rd, $partStart + $ldLength))) {
break;
}
$partEnd += $rdLength;
$partLength = $partEnd - $partStart;
$parts[] = [
'type' => $type,
// the sorting order used when both "offsetClean" are the same
'order' => 0,
// the offset in the line
'offset' => $partStart,
// the offset in the cleaned line (i.e., the line with closure parts removed)
'offsetClean' => $partStart - $partLengthSum,
// the content of the part
'content' => substr($line, $partStart, $partLength),
];
$partLengthSum += $partLength;
}
return $parts;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function extract_tag_contents($line) {\n if (preg_match(self::REGEX_TEXT, $line)) {\n $text = preg_replace(self::REGEX_TEXT, '\\2', $line);\n return $this->evaluate_variables($text);\n }\n }",
"public function getDetailsFromFileRawItem(string $line)\n {\n // echo '<br>'.$line;\n $vinfo = preg_split('/[\\s]+/', $line, 9);\n $info = [];\n\n if ($vinfo[0] !== \"total\") {\n $info['chmod'] = $vinfo[0];\n $info['num'] = $vinfo[1];\n $info['owner'] = $vinfo[2];\n $info['group'] = $vinfo[3];\n $info['size'] = $vinfo[4];\n $info['month'] = $vinfo[5];\n $info['day'] = $vinfo[6];\n $info['time'] = $vinfo[7];\n $info['name'] = $vinfo[8];\n }\n\n return $info;\n }",
"function origin_parse()\n\t\t{\n\t\t\t$text_data = $this->calendar->get_text_data();\n\t\t\t\n\t\t\t// loop through each text row and parse it into feilds\n\t\t\tforeach($text_data as $single_column)\n\t\t\t{\n\t\t\t\t$location = strpos($single_column->text_column, '\"');\n\t\t\t\t$single_column_part = substr($single_column->text_column, $location+1);\n\t\t\t\t$location_2 = strpos($single_column_part, '\"');\n\t\t\t\t$base_info = substr($single_column->text_column, $location+1, ($location_2 - ($location)));\n\t\t\t\t$single_column->text_column = substr($single_column->text_column, $location_2+2);\n\t\t\t\t\t\t\n\t\t\t\t$location = strpos($single_column->text_column, ',');\n\t\t\t\t$single_column_part = substr($single_column->text_column, $location+1);\n\t\t\t\t$location_2 = strpos($single_column_part, ',');\t\t\n\t\t\t\t$code = substr($single_column->text_column, $location+1, ($location_2 - ($location)));\n\t\t\t\t$single_column->text_column = substr($single_column->text_column, $location_2+1);\n\t\t\t\t\n\t\t\t\t$location = strpos($single_column->text_column, ',');\n\t\t\t\t$single_column_part = substr($single_column->text_column, $location+1);\n\t\t\t\t$location_2 = strpos($single_column_part, ',');\n\t\t\t\t$city = substr($single_column->text_column, $location+1, $location_2 - ($location));\n\t\t\t\t$single_column->text_column = substr($single_column->text_column, $location_2+1);\n\t\t\t\t\n\t\t\t\t$location = strpos($single_column->text_column, ',');\n\t\t\t\t$single_column_part = substr($single_column->text_column, $location+1);\n\t\t\t\t$location_2 = strpos($single_column_part, ',');\n\t\t\t\t$state_code = substr($single_column->text_column, $location+1, $location_2 - ($location));\n\t\t\t\t$single_column->text_column = substr($single_column->text_column, $location_2+1);\n\n\t\t\t\tif(strpos($single_column->text_column, ',y,') !== FALSE)\n\t\t\t\t{\n\t\t\t\t\t$on_site = 1;\n\t\t\t\t\t$single_column->text_column = substr($single_column->text_column, 4);\n\t\t\t\t\t\n\t\t\t\t} else if(strpos($single_column->text_column, ',n') !== FALSE ) {\n\t\t\t\t\t\n\t\t\t\t\t$on_site = 0;\n\t\t\t\t\t$single_column->text_column = substr($single_column->text_column, 3);\n\t\t\t\t} else {\n\t\t\t\t\t$on_site = 1;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t$location = strpos($single_column->text_column, '\"');\n\t\t\t\t$single_column_part = substr($single_column->text_column, $location+1);\n\t\t\t\t$location_2 = strpos($single_column_part, '\"');\n\t\t\t\t$address = substr($single_column->text_column, $location+1, $location_2 - ($location));\n\t\t\t\t$single_column->text_column = substr($single_column->text_column, $location_2+3);\n\t\t\t\t\n\t\t\t\t$location_2 = strpos($single_column->text_column, ',\"');\n\t\t\t\t$phone_number = substr($single_column->text_column, 0, $location_2);\t\t\n\t\t\t\t$single_column->text_column = substr($single_column->text_column, $location_2);\n\t\t\t\t\n\t\t\t\t$location = strpos($single_column->text_column, ',\"');\n\t\t\t\t$single_column_part = substr($single_column->text_column, $location+2);\n\t\t\t\t$location_2 = strpos($single_column_part, '\"');\n\t\t\t\t$proper_data = substr($single_column->text_column, $location+2, $location_2 - ($location));\n\t\t\t\t$single_column->text_column = substr($single_column->text_column, $location_2+3);\n\t\t\t\t\t\t\t\t\n\t\t\t\t$location = strpos($single_column->text_column, ',');\n\t\t\t\t$single_column_part = substr($single_column->text_column, $location+1);\n\t\t\t\t$location_2 = strpos($single_column_part, ',');\n\t\t\t\t$start_time = substr($single_column->text_column, $location+1, $location_2 - ($location));\n\t\t\t\t$single_column->text_column = substr($single_column->text_column, $location_2+1);\n\n\t\t\t\t$location = strpos($single_column->text_column, ',');\n\t\t\t\t$single_column_part = substr($single_column->text_column, $location+1);\n\t\t\t\t$location_2 = strpos($single_column_part, ',');\n\t\t\t\t$end_time = substr($single_column->text_column, $location+1, $location_2 - ($location));\n\t\t\t\t$single_column->text_column = substr($single_column->text_column, $location_2+1);\n\t\t\t\t\n\t\t\t\t$location = strpos($single_column->text_column, ',');\n\t\t\t\t$single_column_part = substr($single_column->text_column, $location+1);\n\t\t\t\t$location_2 = strpos($single_column_part, ',');\n\t\t\t\t$course_code = substr($single_column->text_column, $location+1, $location_2 - ($location));\n\t\t\t\t$single_column->text_column = substr($single_column->text_column, $location_2+1);\n\t\t\t\t\n\t\t\t\t$location = strpos($single_column->text_column, ',');\n\t\t\t\t$single_column_part = substr($single_column->text_column, $location+1);\n\t\t\t\t$location_2 = strpos($single_column_part, ',');\n\t\t\t\t$instructor = substr($single_column->text_column, $location+1, $location_2 - ($location));\n\t\t\t\t$single_column->text_column = substr($single_column->text_column, $location_2+1);\n\t\t\t\t\n\t\t\t\t$location = strpos($single_column->text_column, ',');\n\t\t\t\t$single_column_part = substr($single_column->text_column, $location+1);\n\t\t\t\t$location_2 = strpos($single_column_part, ',');\t\t\t\t\n\t\t\t\t$course_cost = substr($single_column->text_column, $location+1, $location_2 - ($location));\n\t\t\t\t$single_column->text_column = substr($single_column->text_column, $location_2+1);\n\t\t\t\t\n\t\t\t\t$location = strpos($single_column->text_column, ',');\n\t\t\t\t$single_column_part = substr($single_column->text_column, $location+1);\n\t\t\t\t$location_2 = strpos($single_column_part, ',');\n\t\t\t\t$random_zero = substr($single_column->text_column, $location+1, $location_2 - ($location));\n\t\t\t\t$single_column->text_column = substr($single_column->text_column, $location_2+1);\n\t\t\t\t\t\t\t\n\t\t\t\t$description = substr($single_column->text_column, 2, (strlen($single_column->text_column) - 2));\n\t\n\t\t\t\t// setup the structure of a single new event parsed out as columns that have meaning\n\t\t\t\t$constructed_cal_row = array(\n\t\t\t\t\t'base_info' \t\t=> $base_info,\n\t\t\t\t\t'code'\t\t\t\t=> $code,\n\t\t\t\t\t'city' \t\t\t\t=> $city,\n\t\t\t\t\t'state_code'\t\t=> $state_code,\n\t\t\t\t\t'on_site'\t\t\t=> $on_site,\n\t\t\t\t\t'address'\t\t\t=> $address,\n\t\t\t\t\t'phone_number'\t\t=> $phone_number,\n\t\t\t\t\t'proper_data'\t\t=> $proper_data,\n\t\t\t\t\t'start_time'\t\t=> $start_time,\n\t\t\t\t\t'end_time'\t\t\t=> $end_time,\n\t\t\t\t\t'course_code'\t\t=> $course_code,\n\t\t\t\t\t'instructor'\t\t=> $instructor,\n\t\t\t\t\t'course_cost'\t\t=> $course_cost,\n\t\t\t\t\t'random_zero'\t\t=> $random_zero,\n\t\t\t\t\t'decsription'\t\t=> $description\n\t\t\t\t);\n\t\t\t\t\n\t\t\t\t// add that row to something that we can use\n\t\t\t\t$this->calendar->insert_calendar($constructed_cal_row);\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t$this->test('Done!');\n\t\t}",
"private function processline($line)\n {\n\t\t\t\t\t//save data from parsed inputstring to array\n\t\t\t\t\t$productname=$line[1];\n\t\t\t\t\t$object=Fetcher::fetchOne(\"Product\",array('name'=>'\"'.$productname.'\"'));\n\t\t\t\t\t$producttype=$this->main->producttypedata->items[$line[3]][\"object\"];\n\t\t\t\t\t\n\t\t\t\t\t$this->hydrate($productname, $line, $object, $producttype);\n }",
"public function getTextLines();",
"function inline($line){\n \n $line = $this->premark_inline($line);\n \n //echo $line,\"\\n\";\n $line = preg_split('/\\{\\@MARK\\@([a-z0-9]+)_(.+?)_\\@KRAM\\@\\}/', $line, -1, PREG_SPLIT_DELIM_CAPTURE);\n //print_r($line);\n \n foreach($line as $k=>$v){\n switch($k%3){\n case 0:\n $this->part[] = array(DOC_CODE_TEXT,$v);\n break;\n \n case 1:\n $cmd = $v;\n break;\n \n case 2:\n $this->part[] = array(DOC_CODE_INLINE,$cmd,$v);\n break;\n }\n }\n }",
"private function closureFeeding( Line$line )\n\t{\n\t\t$this->checkIndentAndProcess(...[\n\t\t\t$line,\n\t\t\tfunction( Line$line ){\n\t\t\t\tswitch( $line->getChar(0) )\n\t\t\t\t{\n\t\t\t\t\tcase ' ':{\n\t\t\t\t\t\t$this->currentClosure->feed($line->subIndentLine);\n\t\t\t\t\t}break;\n\t\t\t\t\tcase '}':{\n\t\t\t\t\t\tif( $line->content==='}' ){\n\t\t\t\t\t\t\t$this->closeClosure();\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tthrow new Exception('Syntax error');\n\t\t\t\t\t\t}\n\t\t\t\t\t}break;\n\t\t\t\t\tdefault:{\n\t\t\t\t\t\tdd($line->content);\n\t\t\t\t\t\tthrow new Exception('Syntax error');\n\t\t\t\t\t}break;\n\t\t\t\t}\n\t\t\t},\n\t\t\tfunction( Line$line ){\n\t\t\t\t$this->parseLine($line);\n\t\t\t},\n\t\t\tfunction( Line$line ){\n\t\t\t\tthrow new Exception('Indent error');\n\t\t\t},\n\t\t]);\n\t}",
"private function parseLine($line)\n\t{\n\t\t// paragraphs will capture lines that start with decorations\n\t\t$callbacks = array(\n\t\t\t'paragraph' => '^[A-Za-z0-9\\'\\\"].*$',\n\t\t\t'decoration' => '(\\'\\'+)(.+?)\\1',\n\t\t\t'strikethrough' => '(\\~\\~)(.+?)\\1',\n\t\t\t'header' => '^(=+)(.+)\\1$',\n\t\t\t'tag' => '\\[\\[([A-Za-z]+)(\\:([^\\]]*))?\\]\\]',\n\t\t\t'link' => '\\[http:\\/\\/([^\\s\\]]+)([^\\]]+)?\\]',\n\t\t\t'internal_link' => '\\[\\[([\\w|\\#_ ]+)\\]\\]',\n\t\t\t'block_tag' => '^\\<([A-Za-z]+)\\>[ ]*$',\n\t\t);\n\n\t\t\n\t\t// $line = trim($line);\n\t\tif ($line === '') {\n\t\t\t$this->setState(WikiParser::$NO_STATE);\n\t\t\treturn;\n\t\t}\n\n\t\tforeach ($callbacks as $c=>$p) {\n\t\t\t$parsed = true;\n\t\t\t$line = preg_replace_callback(\n\t\t\t\t'/'.$p.'/',\n\t\t\t\tarray($this, 'render_'.$c), rtrim($line));\n\t\t}\n\n\t\t// see if the state changes\n\t\tif ($line{0} == '*') {\n\t\t\t// are we working with a list\n\t\t\t$this->setState(WikiParser::$LIST_STATE);\n\t\t\t$line = '<li>'.substr($line, 1).'</li>';\n\t\t} elseif ($line{0} == ' ') {\n\t\t\t// are we working with a pre block\n\t\t\t$this->setState(WikiParser::$PRE_STATE);\n\t\t} else {\n\t\t\t$this->setState(WikiParser::$NO_STATE);\n\t\t}\n\n\t\t$line = trim($line);\n\t\tif ($line == '') return;\n\n\t\techo $line.\"\\n\";\n\t}",
"private function _extractParts($value) {}",
"function parseLine($line) {\n $document = array();\n\n $document['geonameId'] = (int) $line[0];\n $document['name'] = $line[1];\n $document['asciiName'] = $line[2];\n\n if($line[3] !== NULL && $line[3] !== \"\") {\n $document['alternateNames'] = split(\",\", $line[3]);\n }\n\n $document['location'] = array('lat' => (float)($line[4]), 'lon' => (float)($line[5]));\n\n $document['featureClass'] = $line[6];\n $document['featureCode'] = $line[7];\n $document['countryCode'] = $line[8];\n\n if($line[8] !== NULL && $line[9] !== \"\") {\n $document['cc2'] = split(\",\", $line[9]);\n }\n\n $document['admin1Code'] = $line[10];\n $document['admin2Code'] = $line[11];\n $document['admin3Code'] = $line[12];\n $document['admin4Code'] = $line[13];\n $document['population'] = (int)$line[14];\n $document['elevation'] = (int)$line[15];\n $document['dem'] = (int)$line[16];\n $document['timezone'] = $line[17];\n $document['modificationDate'] = $line[18];\n\n return $document;\n}",
"protected function partHandle($part)\n {\n // Separate content from headers\n $part = ltrim($part, \"\\r\\n\");\n\n [$rawHeaders, $content] = explode(\"\\r\\n\\r\\n\", $part, 2);\n\n $content = substr($content, 0, strlen($content) - 2);\n // Parse the headers list\n $rawHeaders = explode(\"\\r\\n\", $rawHeaders);\n\n return compact('rawHeaders', 'content');\n }",
"private function lineData($line)\n {\n // replace tab\n $lineStr = str_replace(\"\\t\", \"*****\", $line);\n // explode string to array\n $lineData = explode('*****', $lineStr);\n\n // $data = [\n // 0 => \"460\", // mcc 所有的都是460,表示中国\n // 1 => \"0\", // mnc 0表示移动基站,1表示联通基站,\n // // 11表示电信LTE基站10000-20000表示电信CDMA基站,此时此字段的取值并非MNC,实际为电信SID\n // 2 => \"33061\", // lac 电信为nid\n // 3 => \"13256\", // cell id 电信为bid\n // 4 => \"30.573833\", // lat\n // 5 => \"104.292610\", // lon\n // 6 => \"175\", // acc 覆盖范围米\n // 7 => \"20171030\", // date\n // 8 => \"0.66\", // 精度 (正常无此字段)\n // 9 => \"四川省成都市龙泉驿区龙泉街道百工堰村;枇杷沟路与公园路路口南812米\", // addr\n // 10 => \"四川省\", // province\n // 11 => \"成都市\", // city\n // 12 => \"龙泉驿区\", // district\n // 13 => \"龙泉街道\", // township\n // ];\n\n // remove index of 8 if count is 14, sometimes this field is not exists\n if (count($lineData) == 14) {\n unset($lineData[8]);\n }\n\n return array_values($lineData);\n }",
"function extractMessageArray($line)\r\n{\r\n\t$linearray = explode('||', $line);\r\n\r\n\t// Snag the unix timestamp and perform some date calculations\r\n\t$datetime = array_shift($linearray);\r\n\r\n\t// Time elapsed (e.g. 1.5 hours, 4 days, etc.)\r\n\t$age = duration_str(time() - $datetime, false, 2);\r\n\r\n\t// Long format date\r\n $date_full = date(\"l, d F Y\", $datetime);\r\n\r\n // Short format date\r\n $date = date('m/d/Y', $datetime);\r\n\r\n // Time of day\r\n $time = date('H:i', $datetime);\r\n\r\n // Day of week\r\n $day = date('l', $datetime);\r\n\r\n\t// Hour\r\n\t$hour = date('H', $datetime);\r\n\r\n // Next snag the name\r\n $name = array_shift($linearray);\r\n\r\n\t// Check for action or system notice\r\n\t$action = ($name{0} == '*') ? true : false;\r\n\t$notice = ($name{0} == '!') ? true : false;\r\n\r\n\tif ($action || $notice)\r\n\t\t$name = mb_substr($name, 1);\r\n\r\n\t// Now put the post back together\r\n\t$words = trim(implode(' ', $linearray));\r\n\r\n\t// return this mess of info\r\n\treturn array\r\n\t(\r\n\t\t'timestamp' => $datetime,\r\n\t\t'date_full' => $date_full,\r\n\t\t'date' => $date,\r\n\t\t'time' => $time,\r\n\t\t'day' => $day,\r\n\t\t'hour' => $hour,\r\n\t\t'age' => $age,\r\n\t\t'action' => $action,\r\n\t\t'notice' => $notice,\r\n\t\t'name' => $name,\r\n\t\t'text' => $words\r\n\t);\r\n}",
"abstract public function getLinesOfCode();",
"private function process_line($line)\n\t{\n\t\tswitch($this->_state)\n\t\t{\n\t\t\tcase self::START:\n\t\t\t\tif(preg_match('/<h1>Class[ \\t]+(.+?)<\\/h1>/', $line, $matches))\n\t\t\t\t{\n\t\t\t\t\t$this->log(2, \" Class \".$matches[1]);\n\t\t\t\t\t$this->_cur_class = new ClassDef($matches[1]);\n\t\t\t\t\t$this->_state = self::IN_CLASS;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase self::IN_CLASS:\n\t\t\t\tif(preg_match('/Extends:.*<a ext:cls=\\\"(.+?)\\\"/', $line, $matches))\n\t\t\t\t{\n\t\t\t\t\t$this->log(2, \" :: Extends \".$matches[1]);\n\t\t\t\t\t$this->_cur_class->set_parent_class_name($matches[1]);\n\t\t\t\t}\n\t\t\t\telse if(preg_match('/<h2>(Config Options|Public Properties)<\\/h2>/', $line, $matches))\t\t\n\t\t\t\t{\n\t\t\t\t\t$this->_state = self::IN_PROPERTIES;\t\t\t\t\t\n\t\t\t\t}\t\t\n\t\t\t\tbreak;\n\t\t\tcase self::IN_PROPERTIES:\n\t\t\t\t// TODO Differentiate between:\n\t\t\t\t// - Config Options\n\t\t\t\t// - Public Properties\n\t\t\t\tif(preg_match('/<b>(.+)<\\/b>[ \\t]*:[ \\t]*([A-Za-z0-9\\.\\/]+?)[ \\t]*<div class=\\\"mdesc\\\">/', $line, $matches))\n\t\t\t\t{\n\t\t\t\t\t$this->log(3, \" Property: \".$matches[1].\" (\".$matches[2].\")\");\n\t\t\t\t\t// TODO Handle default\n\t\t\t\t\t$class_name_parts = explode('.', $this->_cur_class->get_name());\t\t\t\t\t\n\t\t\t\t\t$property_name = &$matches[1];\n\t\t\t\t\t$static_property = false;\n\t\t\t\t\tif(false !== strpos($property_name, '.'))\n\t\t\t\t\t{\n\t\t\t\t\t\t$property_name_parts = explode('.', $property_name);\n\t\t\t\t\t\t$c_c_n_p = count($class_name_parts);\n\t\t\t\t\t\t$c_p_n_p = count($property_name_parts);\n\t\t\t\t\t\t$offset = ($class_name_parts[0]=='Ext' ? 1 : 0);\n\t\t\t\t\t\tfor($i=0;$i<$c_c_n_p-$offset; $i++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif($class_name_parts[$i+$offset] == $property_name_parts[0])\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$offset += $i;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif($c_c_n_p-$offset < $c_p_n_p)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$static_property = true;\n\t\t\t\t\t\t\tfor($i=0; $i<$c_c_n_p-$offset; $i++)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif($class_name_parts[$i+$offset] != $property_name_parts[$i])\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t$static_property = false;\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t$this->_cur_class->set_property($property_name, '', $static_property, $matches[2]);\n\t\t\t\t}\n\t\t\t\telse if(preg_match('/<h2>Public Methods<\\/h2>/', $line, $matches))\t\t\n\t\t\t\t{\n\t\t\t\t\t$this->_state = self::IN_METHODS;\t\t\t\t\t\n\t\t\t\t}\t\t\n\t\t\t\tbreak;\n\t\t\tcase self::IN_METHODS:\n\t\t\t\tif(preg_match('/<b>(.+)<\\/b>(.+)[ \\t]*<div class=\\\"mdesc\\\">/', $line, $matches))\n\t\t\t\t{\n\t\t\t\t\t// Extract parameters\n\t\t\t\t\t$raw_parameters_array = explode(',', $matches[2]);\n\t\t\t\t\t$method_name = $matches[1];\n\t\t\t\t\t$this->log(3, \" Method: \".$matches[1]);\n\t\t\t\t\t$args = array();\n\t\t\t\t\tforeach($raw_parameters_array as $raw_parameter)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(preg_match(\"/(\\[*)<code>([A-Za-z0-9\\.\\/]+)[ \\t]+(.+)<\\/code>/\", $raw_parameter, $matches))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$this->log(4, \" \".$matches[2].\": \".$matches[1].$matches[3]);\n\t\t\t\t\t\t\tif(false !== strpos($matches[3], 'etc.'))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t// TODO Handle variable number of arguments\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif(!ctype_alnum($matches[3][0]))\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t$arg_type = $this->normalize_arg_type($matches[3]);\n\t\t\t\t\t\t\t\t\t$matches[3] = $matches[2];\n\t\t\t\t\t\t\t\t\t$matches[2] = $arg_type;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif(false !== strpos($matches[3], '.'))\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t// FIXME This assumes that we are only using internal consts...tssk tssk\n\t\t\t\t\t\t\t\t\t// On 2nd thought: ORLY?\n\t\t\t\t\t\t\t\t\tlist(, $arg_name) = explode('.', $matches[3]);\n\t\t\t\t\t\t\t\t\t$matches[3] = 'const_'.$arg_name;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// Reserved keywords\n\t\t\t\t\t\t\t\tif(in_array($matches[3], self::$RESERVED))\n\t\t\t\t\t\t\t\t\t$matches[3] = self::PREFIX.$matches[3];\n\t\t\t\t\t\t\t\t$args[$matches[3]] = new ArgDef($matches[3], $matches[2], ($matches[1]=='['));\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\t$class_name_parts = explode('.', $this->_cur_class->get_name());\n\t\t\t\t\t// Build constructor comparison object and compare\n\t\t\t\t\t$constructor = false;\n\t\t\t\t\t$method_name_parts = explode('.', $method_name);\n\t\t\t\t\t$c_c_n_p = count($class_name_parts);\n\t\t\t\t\t$c_m_n_p = count($method_name_parts);\n\t\t\t\t\tif($c_m_n_p <= $c_c_n_p)\n\t\t\t\t\t{\n\t\t\t\t\t\t$constructor = true;\n\t\t\t\t\t\tfor($i=1; $i<=$c_m_n_p; $i++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif($class_name_parts[$c_c_n_p-$i] != $method_name_parts[$c_m_n_p-$i])\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$constructor = false;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif($constructor)\n\t\t\t\t\t{\n\t\t\t\t\t\t$this->_cur_class->set_constructor_args($args);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t$static_method = false;\n\t\t\t\t\t\t$offset = ($class_name_parts[0]=='Ext' ? 1 : 0);\n\t\t\t\t\t\tfor($i=0;$i<$c_c_n_p-$offset; $i++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif($class_name_parts[$i+$offset] == $method_name_parts[0])\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$offset += $i;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif($c_c_n_p-$offset < $c_m_n_p)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$static_method = true;\n\t\t\t\t\t\t\tfor($i=0; $i<$c_c_n_p-$offset; $i++)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif($class_name_parts[$i+$offset] != $method_name_parts[$i])\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t$static_method = false;\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\t\t\t\t\n\n\t\t\t\t\t\tif($c_m_n_p>1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif($class_name_parts[$c_c_n_p-1] == $method_name_parts[0])\n\t\t\t\t\t\t\t\t$static_method = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(!$static_method) $static_method = $this->is_special_case_static($method_name);\n\t\t\t\t\t\t$this->_cur_class->set_method($method_name, $args, $static_method);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if(preg_match('/<h2>Public Events<\\/h2>/', $line, $matches))\t\t\n\t\t\t\t{\n\t\t\t\t\t// TODO Hmm this is dirty.\n\t\t\t\t\t$this->_classes[$this->_cur_class->get_name()] = $this->_cur_class;\n\t\t\t\t\t$this->_cur_class = null;\n\t\t\t\t\t$this->_state = self::START;\t\t\t\t\t\n\t\t\t\t}\t\t\n\t\t\t\tbreak;\n\t\t}\n\t}",
"public function part1()\n {\n $this->start();\n\n $batches = collect(explode(\"\\n\\n\", $this->getInput()));\n\n $valids = 0;\n\n foreach ($batches as $batch) {\n $batch = str_replace(\"\\n\", ' ', $batch);\n $parts = explode(':', $batch);\n\n foreach ($parts as $k => $part) {\n if ($k + 1 === count($parts)) {\n unset($parts[$k]);\n continue;\n }\n\n $parts[$k] = substr($part, -3, 3);\n }\n\n if (count($parts) < 7) continue;\n\n if (count($parts) === 8) {\n $valids++;\n continue;\n }\n\n if (! in_array('cid', $parts)) {\n $valids++;\n }\n }\n\n $this->finish();\n\n $this->addPart([\n 'table' => [\n 'headings' => ['Part 1: Answer'],\n 'data' => [[$valids]],\n ],\n 'time' => $this->getTime(),\n ]);\n }",
"private function term_info() {\n\n $line = $this->_lines->cur();\n\n // info ::= [regex]\n if (preg_match($this->term['info'], $line, $match) > 0) {\n $this->_lines->move();\n\n $info = (object) array('type' => 'info', 'text' => $line, 'note' => '', 'raw' => $line);\n $info->note = $this->term_note();\n\n return $info;\n } else {\n return false;\n }\n }",
"private static function showCodeLines($file, $line){\n $text=\"\";\n $fileContent = file_get_contents($file);\n $lines = explode(\"\\n\",$fileContent);\n $nLines = Pokelio_Global::getConfig(\"EXCEPTION_SHOW_CODE_LINES\", 'Pokelio');\n $startLine=$line-$nLines;\n if($startLine<1){\n $startLine=1;\n }\n $endLine=$line+$nLines;\n if($endLine>sizeof($lines)){\n $endLine=sizeof($lines);\n }\n $text.= \" Code:\".\"\\n\";\n for($iLine=$startLine;$iLine<=$endLine;$iLine++){\n if($iLine==$line){\n $text.= \" !!!----> \";\n }else{\n $text.= \" \";\n }\n $text.= substr(\" \".$iLine,-4);\n $text.= \" \";\n $text.= str_replace(\"\\n\",\"\",$lines[$iLine-1]).\"\\n\";\n }\n return $text;\n }",
"static function parseLine(string $line): array {\n preg_match('/^#(\\d+) @ (\\d+),(\\d+): (\\d+)x(\\d+)$/', $line, $matches);\n return [\n 'id'=> intval($matches[1]),\n 'x' => intval($matches[2]),\n 'y' => intval($matches[3]),\n 'w' => intval($matches[4]),\n 'h' => intval($matches[5])\n ];\n }",
"private static function parseLine($line){\n\t\t\tif(ereg(\"([-dl][rwxstST-]+).* ([0-9 ]* )([a-zA-Z0-9]+).* ([a-zA-Z0-9]+).* ([0-9]*) ([a-zA-Z]+[0-9: ]*[0-9])[ ]+(([0-9]{2}:[0-9]{2})|[0-9]{4}) (.+)\",$line,$regs))\n\t\t\t\tself::add($regs,$regs[9],$regs[3],$regs[4],self::parseMode($regs[1]),$regs[5],strtotime($regs[6].' '.$regs[7]),self::parseKind($regs[1]));\n\t\t}",
"private function _line( $line='' )\n {\n $output = array();\n\n if( is_string( $line ) )\n {\n $line = preg_replace( '/^Content\\-(Disposition|Type)\\:[\\ ]+/', 'content=', $line );\n $line = preg_replace( '/\\;\\s+/', '&', $line );\n $line = str_replace( '\"', '', $line );\n parse_str( $line, $output );\n }\n return $output;\n }",
"public function getLine($line);",
"function\tfunc_decoupage($line)\n{\n $delimiter = ' ';\n $string = $line;\n return (explode(' ', $string));\n}",
"abstract public function parse( $line );",
"public function testLineIntrospection() {\n\t\t$backup = error_reporting();\n\t\terror_reporting(E_ALL);\n\n\t\t$result = Inspector::lines(__FILE__, [__LINE__ - 4]);\n\t\t$expected = [__LINE__ - 5 => \"\\tpublic function testLineIntrospection() {\"];\n\t\t$this->assertEqual($expected, $result);\n\n\t\t$result = Inspector::lines(__CLASS__, [18]);\n\t\t$expected = [18 => 'class InspectorTest extends \\lithium\\test\\Unit {'];\n\t\t$this->assertEqual($expected, $result);\n\n\t\t$lines = 'This is the first line.' . PHP_EOL . 'And this the second.';\n\t\t$result = Inspector::lines($lines, [2]);\n\t\t$expected = [2 => 'And this the second.'];\n\t\t$this->assertEqual($expected, $result);\n\n\t\t$this->assertException('/(Missing argument 2|Too few arguments.*1 passed.*2 expected)/', function() {\n\t\t\tInspector::lines('lithium\\core\\Foo');\n\t\t});\n\t\t$this->assertNull(Inspector::lines(__CLASS__, []));\n\n\t\terror_reporting($backup);\n\t}",
"public function get_message_part_line() {\n\n\t\t$line=false;\n\t\t$leftOver = $this->message_part_size-$this->message_part_read;\n\t\tif($leftOver>0){\n\n\t\t\t//reading exact length doesn't work if the last char is just one char somehow.\n\t\t\t//we cut the left over later with substr.\n\t\t\t$blockSize = 1024;//$leftOver>1024 ? 1024 : $leftOver;\n\t\t\t$line = fgets($this->handle,$blockSize);\n\t\t\t$this->message_part_read+=strlen($line);\n\t\t}\n\n\t\tif ($this->message_part_size < $this->message_part_read) {\n\n\t\t\t$line = substr($line, 0, ($this->message_part_read-$this->message_part_size)*-1);\n\t\t}\n\n\t\tif($line===false){\n\n\t\t\t//read and check left over response.\n\t\t\t$response=$this->get_response();\n\t\t\t$this->check_response($response);\n\n\t\t}\n\t\treturn $line;\n\t}",
"public function splitLine() {\n $this->words = preg_split('/[\\' \\',\\t]+/', $this->line);\n }",
"protected function _getLines() {}",
"function parse_content($rawcontent){\n $content = explode(\"++++\", $rawcontent);\n //the defintion of the the title\n $metablock = $content[0];\n $rawmeta = explode(\"----\", $metablock);\n $meta = [];\n foreach ($rawmeta as $metaline) {\n //splits key from value\n $metaentry = explode(\":\", $metaline);\n //removes all spaces around the value\n $key = trim($metaentry[0]);\n $value = trim($metaentry[1]);\n $meta[$key] = $value;\n }\n //the splittet version: just the value\n $title = $meta[\"title\"];\n //the splittet text\n $text = $content[1];\n $result = compact(\"title\", \"text\", \"meta\");\n //returns the result\n return $result;\n}",
"public function parseLine ($text) {\n\n $text = trim($text);\n\n if (substr($text, 0, 1) === '@') {\n\n $this->setTag($text);\n return;\n\n }\n\n\n if ($this->lastTagSet !== null) {\n\n $this->appendToLastTagSet($text);\n return;\n\n }\n\n\n if ($text != '' && !$this->hasShortDescription()) {\n\n $this->values['short_description'] = $text;\n $this->lastTagSet = null;\n return;\n\n }\n\n\n $this->setLongDescription($text);\n $this->lastTagSet = null;\n\n\n }"
] |
[
"0.5590874",
"0.53875965",
"0.52151924",
"0.5144797",
"0.51128256",
"0.5100094",
"0.5059147",
"0.50372267",
"0.50185496",
"0.49982738",
"0.49743196",
"0.49467218",
"0.49344906",
"0.4929507",
"0.49145588",
"0.49129772",
"0.48723134",
"0.48684397",
"0.4866124",
"0.48381907",
"0.48373193",
"0.48354268",
"0.48312205",
"0.48009968",
"0.47988245",
"0.47698918",
"0.47598872",
"0.47450545",
"0.47388983",
"0.47321516"
] |
0.5582257
|
1
|
Mark differences between two "replace" blocks. Each of the returned block (lines) is always only one line.
|
protected function markReplaceBlockDiff(array $oldBlock, array $newBlock): array
{
static $mbOld, $mbNew, $lineRenderer;
$mbOld ??= new MbString();
$mbNew ??= new MbString();
$lineRenderer ??= LineRendererFactory::make(
$this->options['detailLevel'],
[], /** @todo is it possible to get the differOptions here? */
$this->options,
);
$mbOld->set(implode("\n", $oldBlock));
$mbNew->set(implode("\n", $newBlock));
$lineRenderer->render($mbOld, $mbNew);
return [
[$mbOld->get()], // one-line block for the old
[$mbNew->get()], // one-line block for the new
];
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function diff($text1, $text2) {\n__autoload('TextDiff');\ninclude_once 'Text/Diff.php';\ninclude_once 'Text/Diff/Renderer.php';\ninclude_once 'Text/Diff/Renderer/unified.php';\n\n\n $vtext1 = chunk_split(strip_tags($text1, '<p><div>'), 1, \"\\n\");\n $vtext2 = chunk_split(strip_tags($text2, '<p><div>'), 1, \"\\n\");\n\n $vlines1 = str_split($vtext1, 2);\n $vlines2 = str_split($vtext2, 2);\n $text1 = str_replace(\"\\n\",\" \\n\",$text1);\n $text2 = str_replace(\"\\n\",\" \\n\",$text2);\n\n $vlines1 = explode(\" \", $text1);\n $vlines2 = explode(\" \", $text2);\n $diff = new Text_Diff($vlines1, $vlines2);\n $renderer = new Text_Diff_Renderer_inline();\n $html = html_entity_decode($renderer->render($diff));\n\n return preg_replace(array('#(<ins>|<del>)(<[^\\>]+>)#i', '#(</[^\\>]+>)(</ins>|</del>)#i'), '$2$1', $html);\n}",
"function process_nonmatches(&$output, &$text_old, &$text_new)\n\t{\n\t\t$s1 = sizeof($text_old);\n\t\t$s2 = sizeof($text_new);\n\n\t\tif ($s1 > 0 AND $s2 == 0)\n\t\t{\n\t\t\t// lines deleted\n\t\t\tarray_unshift($output, new vB_Text_Diff_Entry(implode(\"\\n\", $text_old), ''));\n\t\t}\n\t\telse if ($s2 > 0 AND $s1 == 0)\n\t\t{\n\t\t\t// lines added\n\t\t\tarray_unshift($output, new vB_Text_Diff_Entry('', implode(\"\\n\", $text_new)));\n\t\t}\n\t\telse if ($s1 > 0 AND $s2 > 0)\n\t\t{\n\t\t\t// substitution\n\t\t\tarray_unshift($output, new vB_Text_Diff_Entry(implode(\"\\n\", $text_old), implode(\"\\n\", $text_new)));\n\t\t}\n\n\t\t$text_old = array();\n\t\t$text_new = array();\n\t}",
"private function renderDiff($lines1, $lines2): string\n {\n if (!is_array($lines1)) {\n $lines1 = explode(\"\\n\", $lines1);\n }\n if (!is_array($lines2)) {\n $lines2 = explode(\"\\n\", $lines2);\n }\n foreach ($lines1 as $i => $line) {\n $lines1[$i] = rtrim($line, \"\\r\\n\");\n }\n foreach ($lines2 as $i => $line) {\n $lines2[$i] = rtrim($line, \"\\r\\n\");\n }\n\n $renderer = new DiffRendererHtmlInline();\n $diff = new Diff($lines1, $lines2);\n\n return $diff->render($renderer);\n }",
"function _shift_boundaries ($lines, &$changed, $other_changed) {\r\n\t$i = 0;\r\n\t$j = 0;\r\n\r\n\tUSE_ASSERTS && assert('sizeof($lines) == sizeof($changed)');\r\n\t$len = sizeof($lines);\r\n\t$other_len = sizeof($other_changed);\r\n\r\n\twhile (1) {\r\n\t /*\r\n\t * Scan forwards to find beginning of another run of changes.\r\n\t * Also keep track of the corresponding point in the other file.\r\n\t *\r\n\t * Throughout this code, $i and $j are adjusted together so that\r\n\t * the first $i elements of $changed and the first $j elements\r\n\t * of $other_changed both contain the same number of zeros\r\n\t * (unchanged lines).\r\n\t * Furthermore, $j is always kept so that $j == $other_len or\r\n\t * $other_changed[$j] == false.\r\n\t */\r\n\t while ($j < $other_len && $other_changed[$j])\r\n\t\t$j++;\r\n\t\r\n\t while ($i < $len && ! $changed[$i]) {\r\n\t\tUSE_ASSERTS && assert('$j < $other_len && ! $other_changed[$j]');\r\n\t\t$i++; $j++;\r\n\t\twhile ($j < $other_len && $other_changed[$j])\r\n\t\t $j++;\r\n }\r\n\r\n\t if ($i == $len)\r\n\t\tbreak;\r\n\r\n\t $start = $i;\r\n\r\n\t // Find the end of this run of changes.\r\n\t while (++$i < $len && $changed[$i])\r\n\t\tcontinue;\r\n\r\n\t do {\r\n\t\t/*\r\n\t\t * Record the length of this run of changes, so that\r\n\t\t * we can later determine whether the run has grown.\r\n\t\t */\r\n\t\t$runlength = $i - $start;\r\n\r\n\t\t/*\r\n\t\t * Move the changed region back, so long as the\r\n\t\t * previous unchanged line matches the last changed one.\r\n\t\t * This merges with previous changed regions.\r\n\t\t */\r\n\t\twhile ($start > 0 && $lines[$start - 1] == $lines[$i - 1]) {\r\n\t\t $changed[--$start] = 1;\r\n\t\t $changed[--$i] = false;\r\n\t\t while ($start > 0 && $changed[$start - 1])\r\n\t\t\t$start--;\r\n\t\t USE_ASSERTS && assert('$j > 0');\r\n\t\t while ($other_changed[--$j])\r\n\t\t\tcontinue;\r\n\t\t USE_ASSERTS && assert('$j >= 0 && !$other_changed[$j]');\r\n }\r\n\r\n\t\t/*\r\n\t\t * Set CORRESPONDING to the end of the changed run, at the last\r\n\t\t * point where it corresponds to a changed run in the other file.\r\n\t\t * CORRESPONDING == LEN means no such point has been found.\r\n\t\t */\r\n\t\t$corresponding = $j < $other_len ? $i : $len;\r\n\r\n\t\t/*\r\n\t\t * Move the changed region forward, so long as the\r\n\t\t * first changed line matches the following unchanged one.\r\n\t\t * This merges with following changed regions.\r\n\t\t * Do this second, so that if there are no merges,\r\n\t\t * the changed region is moved forward as far as possible.\r\n\t\t */\r\n\t\twhile ($i < $len && $lines[$start] == $lines[$i]) {\r\n\t\t $changed[$start++] = false;\r\n\t\t $changed[$i++] = 1;\r\n\t\t while ($i < $len && $changed[$i])\r\n\t\t\t$i++;\r\n\r\n\t\t USE_ASSERTS && assert('$j < $other_len && ! $other_changed[$j]');\r\n\t\t $j++;\r\n\t\t if ($j < $other_len && $other_changed[$j]) {\r\n\t\t\t$corresponding = $i;\r\n\t\t\twhile ($j < $other_len && $other_changed[$j])\r\n\t\t\t $j++;\r\n }\r\n }\r\n } while ($runlength != $i - $start);\r\n\r\n\t /*\r\n\t * If possible, move the fully-merged run of changes\r\n\t * back to a corresponding run in the other file.\r\n\t */\r\n\t while ($corresponding < $i) {\r\n\t\t$changed[--$start] = 1;\r\n\t\t$changed[--$i] = 0;\r\n\t\tUSE_ASSERTS && assert('$j > 0');\r\n\t\twhile ($other_changed[--$j])\r\n\t\t continue;\r\n\t\tUSE_ASSERTS && assert('$j >= 0 && !$other_changed[$j]');\r\n }\r\n }\r\n }",
"function diff($from_lines, $to_lines)\n {\n }",
"public function getDiffHtml($a, $b)\n\t{\n\t\tpreg_match_all(\"/(<.*?>\\\\s*|\\\\s+)([^\\\\s<]*)/\", \" \".$a, $matchA);\n\t\tpreg_match_all(\"/(<.*?>\\\\s*|\\\\s+)([^\\\\s<]*)/\", \" \".$b, $matchB);\n\n\t\t$diffScript = $this->getDiffScript($matchA[2], $matchB[2]);\n\t\tif(count($diffScript) == 0)\n\t\t{\n\t\t\t// no difference found\n\t\t\treturn $a;\n\t\t}\n\n\t\t$positionA = 0;\n\n\t\t$result = '';\n\t\tforeach($diffScript as $diffItem)\n\t\t{\n\t\t\twhile($positionA < $diffItem['startA'])\n\t\t\t{\n\t\t\t\t$result .= $matchA[0][$positionA];\n\t\t\t\t$positionA++;\n\t\t\t}\n\n\t\t\t//deleted items\n\t\t\tif($diffItem['deletedA'] > 0)\n\t\t\t{\n\t\t\t\t$result .= $matchA[1][$positionA] . '<s style=\"color:red\">' . $matchA[2][$positionA];\n\t\t\t\tfor($i = 1; $i < $diffItem['deletedA']; $i++)\n\t\t\t\t\t$result .= $matchA[0][$positionA + $i];\n\n\t\t\t\t$result .= '</s>';\n\t\t\t\t$positionA = $positionA + $diffItem['deletedA'];\n\t\t\t}\n\n\t\t\tif($diffItem['insertedB'] > 0)\n\t\t\t{\n\t\t\t\t$result .= $matchB[1][$diffItem['startB']] . '<b style=\"color:green\">' . $matchB[2][$diffItem['startB']];\n\t\t\t\tfor($i = 1; $i < $diffItem['insertedB']; $i++)\n\t\t\t\t\t$result .= $matchB[0][$diffItem['startB'] + $i];\n\n\t\t\t\t$result .= '</b>';\n\t\t\t}\n\t\t}\n\n\t\twhile($positionA < count($matchA[0]))\n\t\t{\n\t\t\t$result .= $matchA[0][$positionA];\n\t\t\t$positionA++;\n\t\t}\n\n\t\treturn $result;\n\t}",
"protected function renderTableBlockReplace(array $block): string\n {\n if ($this->options['detailLevel'] === 'none') {\n return\n $this->renderTableBlockDelete($block) .\n $this->renderTableBlockInsert($block);\n }\n\n $ret = '';\n\n $oldLines = $block['old']['lines'];\n $newLines = $block['new']['lines'];\n\n $oldLinesCount = \\count($oldLines);\n $newLinesCount = \\count($newLines);\n\n // if the line counts changes, we treat the old and the new as\n // \"a line with \\n in it\" and then do one-line-to-one-line diff\n if ($oldLinesCount !== $newLinesCount) {\n [$oldLines, $newLines] = $this->markReplaceBlockDiff($oldLines, $newLines);\n $oldLinesCount = $newLinesCount = 1;\n }\n\n $oldLines = $this->customFormatLines($oldLines, SequenceMatcher::OP_DEL);\n $newLines = $this->customFormatLines($newLines, SequenceMatcher::OP_INS);\n\n // now $oldLines must has the same line counts with $newlines\n for ($no = 0; $no < $newLinesCount; ++$no) {\n $mergedLine = $this->mergeReplaceLines($oldLines[$no], $newLines[$no]);\n\n // not merge-able, we fall back to separated form\n if (!isset($mergedLine)) {\n $ret .=\n $this->renderTableBlockDelete($block) .\n $this->renderTableBlockInsert($block);\n\n break;\n }\n\n $ret .= $this->renderTableRow('rep', SequenceMatcher::OP_REP, $mergedLine);\n }\n\n return $ret;\n }",
"public function render()\n\t{\n\t\t$changes = parent::render();\n\t\t$html = '';\n\t\tif(empty($changes)) {\n\t\t\treturn $html;\n\t\t}\n\n\t\t$html .= '<table class=\"Differences DifferencesInline\">';\n\t\t$html .= '<thead>';\n\t\t$html .= '</thead>';\n\t\tforeach($changes as $i => $blocks) {\n\t\t\t// If this is a separate block, we're condensing code so output ...,\n\t\t\t// indicating a significant portion of the code has been collapsed as\n\t\t\t// it is the same\n\t\t\tif($i > 0) {\n\t\t\t\t$html .= '<tbody class=\"Skipped\">';\n\t\t\t\t$html .= '<th>…</th>';\n\t\t\t\t$html .= '<th>…</th>';\n\t\t\t\t$html .= '<td> </td>';\n\t\t\t\t$html .= '</tbody>';\n\t\t\t}\n\n\t\t\tforeach($blocks as $change) {\n\t\t\t\t$html .= '<tbody class=\"Change'.ucfirst($change['tag']).'\">';\n\t\t\t\t// Added lines only on the right side\n\t\t\t\tif($change['tag'] == 'insert') {\n\t\t\t\t\tforeach($change['changed']['lines'] as $no => $line) {\n\t\t\t\t\t\t$html .= '<tr>';\n\t\t\t\t\t\t$html .= '<td class=\"Right\"><ins>'.$line.'</ins> </td>';\n\t\t\t\t\t\t$html .= '</tr>';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Show deleted lines only on the left side\n\t\t\t\telse if($change['tag'] == 'delete') {\n\t\t\t\t\tforeach($change['base']['lines'] as $no => $line) {\n\t\t\t\t\t\t$html .= '<tr>';\n\t\t\t\t\t\t$html .= '<td class=\"Left\"><del>'.$line.'</del> </td>';\n\t\t\t\t\t\t$html .= '</tr>';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Show modified lines on both sides\n\t\t\t\telse if($change['tag'] == 'replace') {\n\t\t\t\t\tforeach($change['base']['lines'] as $no => $line) {\n\t\t\t\t\t\t$html .= '<tr>';\n\t\t\t\t\t\t$html .= '<td class=\"Left\"><span>'.$line.'</span></td>';\n\t\t\t\t\t\t$html .= '</tr>';\n\t\t\t\t\t}\n\n\t\t\t\t\tforeach($change['changed']['lines'] as $no => $line) {\n\t\t\t\t\t\t$html .= '<tr>';\n\t\t\t\t\t\t$html .= '<td class=\"Right\"><span>'.$line.'</span></td>';\n\t\t\t\t\t\t$html .= '</tr>';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$html .= '</tbody>';\n\t\t\t}\n\t\t}\n\t\t$html .= '</table>';\n\t\treturn $html;\n\t}",
"function cleanup_reformat($change) {\n\t\tif (!array_key_exists('add_lines', $change) && !array_key_exists('remove_lines', $change))\n\t\t\treturn $change;\n\t\t\n\t\tif (array_key_exists('remove_lines', $change))\n\t\tforeach($change['remove_lines'] as $key => $removed) {\n\t\t\t$removed = cleanup_line_reformat($removed);\n\t\t\t$found = empty($removed);\n\t\t\tif (!$found && array_key_exists('add_lines', $change)) {\n\t\t\t\tforeach($change['add_lines'] as $key2 => $added) {\n\t\t\t\t\t$added = cleanup_line_reformat($added);\n\t\t\t\t\tif (empty($added)) {\n\t\t\t\t\t\tunset($change['add_lines'][$key2]);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tif ($removed == $added) {\n\t\t\t\t\t\tunset($change['add_lines'][$key2]);\n\t\t\t\t\t\t$found = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ($found) unset($change['remove_lines'][$key]);\n\t\t}\n\t\t\n\t\t// Clean empty added lines\n\t\tif (array_key_exists('add_lines', $change))\n\t\tforeach($change['add_lines'] as $key2 => $added) {\n\t\t\t$added = cleanup_line_reformat($added);\n\t\t\tif (empty($added))\n\t\t\t\tunset($change['add_lines'][$key2]);\n\t\t}\n\t\treturn $change;\n\t}",
"private function mergeChanges(\n array $baseLines,\n array $changedLines,\n array $deleteColors = [null, null],\n array $insertColors = [null, null]\n ): array {\n $padding = str_repeat(\n ' ',\n max($this->maxLineMarkerWidth - strlen($this->options['equalityMarkers'][1]), 0)\n );\n\n foreach ($baseLines as $lineKey => $line) {\n $iterator = 0;\n $baselineParts = preg_split('/\\x00(.*?)\\x01/', $line, -1, PREG_SPLIT_DELIM_CAPTURE);\n $changedLineParts = preg_split('/\\x00(.*?)\\x01/', $changedLines[$lineKey], -1, PREG_SPLIT_DELIM_CAPTURE);\n\n foreach ($baselineParts as $partKey => &$part) {\n if ($iterator++ % 2) {\n // This part of the line has been changed. Surround it with user defined markers.\n $basePart = $this->options['deleteMarkers'][0] . $part . $this->options['deleteMarkers'][1];\n $changedPart = '';\n if (isset($changedLineParts[$partKey])) {\n $changedPart =\n $this->options['insertMarkers'][0] .\n $changedLineParts[$partKey] .\n $this->options['insertMarkers'][1];\n }\n\n if ($this->options['cliColor']) {\n $colorize = new CliColors();\n $basePart = $colorize->getColoredString($basePart, ...$deleteColors);\n if (!empty($changedPart)) {\n $changedPart = $colorize->getColoredString($changedPart, ...$insertColors);\n }\n }\n $part = $basePart . $changedPart;\n }\n }\n unset($part);\n $baseLines[$lineKey] = $this->options['equalityMarkers'][1] . $padding . '|' . implode('', $baselineParts);\n }\n\n return $baseLines;\n }",
"private function getLineBasedUnifiedDiff( $fromTextLines, $toTextLines ) {\n\t\t$formatter = new LineBasedUnifiedDiffFormatter();\n\t\t$formatter->insClass = ' class=\"mw-twocolconflict-diffchange\"';\n\t\t$formatter->delClass = ' class=\"mw-twocolconflict-diffchange\"';\n\n\t\treturn $formatter->format(\n\t\t\tnew Diff( $fromTextLines, $toTextLines )\n\t\t);\n\t}",
"private function getMarkedUpDiffText( array $unifiedDiff ) {\n\t\t$lastUser = $this->getArticle()->getPage()->getUserText();\n\n\t\t$output = '';\n\t\tforeach ( $unifiedDiff as $key => $currentLine ) {\n\t\t\tforeach ( $currentLine as $changeSet ) {\n\t\t\t\tswitch ( $changeSet['action'] ) {\n\t\t\t\t\tcase 'add':\n\t\t\t\t\t\t$class = 'mw-twocolconflict-diffchange-own';\n\t\t\t\t\t\tif ( $this->hasConflictInLine( $currentLine ) ) {\n\t\t\t\t\t\t\t$class .= ' mw-twocolconflict-diffchange-conflict';\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$output .= '<div class=\"' . $class . '\">' .\n\t\t\t\t\t\t\t'<div class=\"mw-twocolconflict-diffchange-title\">' .\n\t\t\t\t\t\t\t'<span mw-twocolconflict-diffchange-title-pseudo=\"' .\n\t\t\t\t\t\t\t$this->context->msg( 'twoColConflict-diffchange-own-title' )->escaped() .\n\t\t\t\t\t\t\t'\" unselectable=\"on\">' . // used by IE9\n\t\t\t\t\t\t\t'</span>' .\n\t\t\t\t\t\t\t'</div>' .\n\t\t\t\t\t\t\t$changeSet['new'] .\n\t\t\t\t\t\t\t'</div>' . \"\\n\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'delete':\n\t\t\t\t\t\t$class = 'mw-twocolconflict-diffchange-foreign';\n\t\t\t\t\t\tif ( $this->hasConflictInLine( $currentLine ) ) {\n\t\t\t\t\t\t\t$class .= ' mw-twocolconflict-diffchange-conflict';\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$output .= '<div class=\"' . $class . '\">' .\n\t\t\t\t\t\t\t'<div class=\"mw-twocolconflict-diffchange-title\">' .\n\t\t\t\t\t\t\t'<span mw-twocolconflict-diffchange-title-pseudo=\"' .\n\t\t\t\t\t\t\t$this->context->msg(\n\t\t\t\t\t\t\t\t'twoColConflict-diffchange-foreign-title',\n\t\t\t\t\t\t\t\t$lastUser\n\t\t\t\t\t\t\t)->escaped() .\n\t\t\t\t\t\t\t'\" unselectable=\"on\">' . // used by IE9\n\t\t\t\t\t\t\t'</span>' .\n\t\t\t\t\t\t\t'</div>' .\n\t\t\t\t\t\t\t$changeSet['old'] .\n\t\t\t\t\t\t\t'</div>';\n\n\t\t\t\t\t\tif ( !$this->hasConflictInLine( $currentLine ) ) {\n\t\t\t\t\t\t\t$output .= \"\\n\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'copy':\n\t\t\t\t\t\t$output .= '<div class=\"mw-twocolconflict-diffchange-same\">' .\n\t\t\t\t\t\t\t$this->addUnchangedText( $changeSet['copy'] ) .\n\t\t\t\t\t\t\t'</div>' . \"\\n\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn $this->normalizeMarkedUpText( $output );\n\t}",
"function _shiftBoundaries($lines, &$changed, $other_changed)\n {\n }",
"function Diff($from_lines, $to_lines) {\r\n $eng = new _DiffEngine;\r\n $this->edits = $eng->diff($from_lines, $to_lines);\r\n //$this->_check($from_lines, $to_lines);\r\n }",
"protected function createDiff(array $a, array $b)\n\t{\n\t\t$indexA = 0;\n\t\t$indexB = 0;\n\t\t$result = array();\n\t\twhile ($indexA < count($a) || $indexB < count($b))\n\t\t{\n\t\t\tif (($indexA < count($a)) && (!$this->modifiedA[$indexA]) && ($indexB < count($b)) && (!$this->modifiedB[$indexB]))\n\t\t\t{\n\t\t\t\t// equal lines\n\t\t\t\t$indexA++;\n\t\t\t\t$indexB++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t// maybe deleted and/or inserted lines\n\t\t\t\t$startA = $indexA;\n\t\t\t\t$startB = $indexB;\n\n\t\t\t\twhile ($indexA < count($a) && ($indexB >= count($b) || $this->modifiedA[$indexA]))\n\t\t\t\t{\n\t\t\t\t\t$indexA++;\n\t\t\t\t}\n\n\t\t\t\twhile ($indexB < count($b) && ($indexA >= count($a) || $this->modifiedB[$indexB]))\n\t\t\t\t{\n\t\t\t\t\t$indexB++;\n\t\t\t\t}\n\n\t\t\t\tif (($startA < $indexA) || ($startB < $indexB))\n\t\t\t\t{\n\t\t\t\t\t// store a new difference-item\n\t\t\t\t\t$result[] = array(\"startA\" => $startA, \"startB\" => $startB, \"deletedA\" => $indexA - $startA, \"insertedB\" => $indexB - $startB);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $result;\n\t}",
"public function testReplaceResponseLines()\n {\n $translator = new Translator();\n $translator->replaceResponseLines();\n\n $this->assertSame(__('passwords.reset'), 'Your password has been set!');\n $this->assertSame(__('passwords.token'), 'This token is invalid.');\n $this->assertSame(__('passwords.user'), 'We can\\'t find a user with that e-mail address.');\n }",
"private function getUnifiedDiff() {\n\t\t$currentText = $this->toEditText( $this->getCurrentContent() );\n\t\t$yourText = $this->textbox1;\n\n\t\t$currentLines = explode( \"\\n\", $currentText );\n\t\t$yourLines = explode( \"\\n\", str_replace( \"\\r\\n\", \"\\n\", $yourText ) );\n\n\t\treturn $this->getLineBasedUnifiedDiff( $currentLines, $yourLines );\n\t}",
"public static function __remarkFlow($array1, $array2){\r\n return array_diff($array1, $array2);\r\n }",
"function diff2( $page1, $page2 ) {\n\t\t$page1 = split( \"\\n\", $page1 );\n\t\t$page2 = split( \"\\n\", $page2 );\n\t\t$z = new WikiDiff( $page1, $page2 );\n\t\tif( $z->isEmpty() ) {\n\t\t\t$html = '<hr /><br />['.tra(\"Versions are identical\").']<br /><br />';\n\t\t} else {\n\t\t\t//$fmt = new WikiDiffFormatter;\n\t\t\t$fmt = new WikiUnifiedDiffFormatter;\n\t\t\t$html = $fmt->format( $z, $page1 );\n\t\t}\n\t\treturn $html;\n\t}",
"function MappedDiff($from_lines, $to_lines,\r\n $mapped_from_lines, $mapped_to_lines) {\r\n\r\n assert(sizeof($from_lines) == sizeof($mapped_from_lines));\r\n assert(sizeof($to_lines) == sizeof($mapped_to_lines));\r\n\r\n $this->Diff($mapped_from_lines, $mapped_to_lines);\r\n\r\n $xi = $yi = 0;\r\n // Optimizing loop invariants:\r\n // http://phplens.com/lens/php-book/optimizing-debugging-php.php\r\n for ($i = 0, $max = sizeof($this->edits); $i < $max; $i++) {\r\n $orig = &$this->edits[$i]->orig;\r\n if (is_array($orig)) {\r\n $orig = array_slice($from_lines, $xi, sizeof($orig));\r\n $xi += sizeof($orig);\r\n }\r\n\r\n $final = &$this->edits[$i]->final;\r\n if (is_array($final)) {\r\n $final = array_slice($to_lines, $yi, sizeof($final));\r\n $yi += sizeof($final);\r\n }\r\n }\r\n }",
"function vB_Text_Diff($data_old, $data_new)\n\t{\n\t\t$this->data_old = preg_split('#(\\r\\n|\\n|\\r)#', $data_old);\n\t\t$this->data_old_len = sizeof($this->data_old);\n\n\t\t$this->data_new = preg_split('#(\\r\\n|\\n|\\r)#', $data_new);\n\t\t$this->data_new_len = sizeof($this->data_new);\n\t}",
"function phorum_api_diff_unpatch_color($text, $diff)\n{\n $text = str_replace(array(\"\\r\\n\", \"\\r\"), \"\\n\", $text);\n\n if (!is_array($diff))\n {\n $n = 0;\n for ($i=0; $i<strlen($diff); $i++) {\n $c = substr($diff, $i, 1);\n if ($c == \"-\") {\n $n = substr($diff, 0, $i);\n $pre = substr($text, 0, $n);\n $post = substr($text, $n);\n return $pre.\"[phorum removal]\".substr($diff, $i+1).\"[/phorum removal]\".$post;\n } elseif ($c == \"+\") {\n $n = substr($diff, 0, $i);\n $pre = substr($text, 0, $n);\n $post = substr($text, $n);\n $colored_text = substr($diff, $i+1);\n return $pre.\"[phorum addition]\".$colored_text.\"[/phorum addition]\".substr($post, strlen($diff)-$i-1);\n }\n }\n return $text;\n }\n foreach (array_reverse($diff) as $d) {\n $text = phorum_api_diff_unpatch_color($text, $d);\n }\n return $text;\n}",
"protected function mergeReplaceLines(string $oldLine, string $newLine): ?string\n {\n $delParts = $this->analyzeClosureParts(\n $oldLine,\n RendererConstant::HTML_CLOSURES_DEL,\n SequenceMatcher::OP_DEL,\n );\n $insParts = $this->analyzeClosureParts(\n $newLine,\n RendererConstant::HTML_CLOSURES_INS,\n SequenceMatcher::OP_INS,\n );\n\n // get the cleaned line by a non-regex way (should be faster)\n // i.e., the new line with all \"<ins>...</ins>\" parts removed\n $mergedLine = $newLine;\n foreach (ReverseIterator::fromArray($insParts) as $part) {\n $mergedLine = substr_replace(\n $mergedLine,\n '', // deletion\n $part['offset'],\n \\strlen($part['content']),\n );\n }\n\n // note that $mergedLine is actually a clean line at this point\n if (!$this->isLinesMergeable($oldLine, $newLine, $mergedLine)) {\n return null;\n }\n\n // before building the $mergedParts, we do some adjustments\n $this->revisePartsForBoundaryNewlines($delParts, RendererConstant::HTML_CLOSURES_DEL);\n $this->revisePartsForBoundaryNewlines($insParts, RendererConstant::HTML_CLOSURES_INS);\n\n // create a sorted merged parts array\n $mergedParts = [...$delParts, ...$insParts];\n usort(\n $mergedParts,\n // first sort by \"offsetClean\", \"order\" then by \"type\"\n static fn (array $a, array $b): int => (\n $a['offsetClean'] <=> $b['offsetClean']\n ?: $a['order'] <=> $b['order']\n ?: ($a['type'] === SequenceMatcher::OP_DEL ? -1 : 1)\n ),\n );\n\n // insert merged parts into the cleaned line\n foreach (ReverseIterator::fromArray($mergedParts) as $part) {\n $mergedLine = substr_replace(\n $mergedLine,\n $part['content'],\n $part['offsetClean'],\n 0, // insertion\n );\n }\n\n return str_replace(\"\\n\", '<br>', $mergedLine);\n }",
"public function generateUnifiedDiff()\n {\n if ( ! $this->operations) {\n return \"\";\n }\n\n if ($this->lines === null) {\n $hunk = Hunk::forEmptyFile();\n return (string)$this->operations[0]->perform($hunk);\n }\n\n $hunks = array();\n\n foreach ($this->getLineGroups() as $lineGroup) {\n $start = min($lineGroup);\n $end = max($lineGroup);\n\n $hunk = Hunk::forLines($start, $end, $this->lines);\n\n foreach ($this->operations as $line => $operation) {\n if ( ! in_array($line, $lineGroup)) {\n continue;\n }\n\n $hunk = $operation->perform($hunk);\n }\n\n $hunks[] = $hunk;\n }\n\n $output = \"\";\n\n if ($this->path) {\n $output .= \"--- a/\" . $this->path . \"\\n\";\n $output .= \"+++ b/\" . $this->path . \"\\n\";\n }\n\n $output .= implode(\"\\n\", $hunks);\n\n return $output;\n }",
"public function diffProvider()\n {\n return array(\n 'AA' => array( // both sides add but there are no content differences, drops file\n array('AA' => 'add'),\n array('AA' => 'add', \"AANew\" => 'add'), // need to ensure shelves differ for version to be created\n array(\n 'cc' => array('AANew' => array('action' => 'add', 'diffLeft' => null, 'diffRight' => '#1')),\n 'cs' => array('AANew' => array('action' => 'add', 'diffLeft' => null, 'diffRight' => 'v2')),\n 'sc' => array('AANew' => array('action' => 'add', 'diffLeft' => null, 'diffRight' => '#1')),\n 'ss' => array('AANew' => array('action' => 'add', 'diffLeft' => null, 'diffRight' => 'v2')),\n )\n ),\n 'AA2' => array( // both sides add but content differs, change to an edit\n array('AA2' => 'add'),\n array('AA2' => array('action' => 'add', 'content' => 'changed!')),\n array(\n 'cc' => array('AA2' => array('action' => 'edit', 'diffLeft' => '#1', 'diffRight' => '#3')),\n 'cs' => array('AA2' => array('action' => 'edit', 'diffLeft' => '#1', 'diffRight' => 'v2')),\n 'sc' => array('AA2' => array('action' => 'edit', 'diffLeft' => 'v1', 'diffRight' => '#1')),\n 'ss' => array('AA2' => array('action' => 'edit', 'diffLeft' => 'v1', 'diffRight' => 'v2')),\n )\n ),\n 'AE' => array( // add on left, edit of same file on right but content is same, drops file\n array('AE' => array('action' => 'add', 'content' => 'same!')),\n array('AE' => array('action' => 'edit', 'content' => 'same!')),\n array(\n 'cc' => array(),\n 'cs' => array(),\n 'sc' => array(),\n 'ss' => array()\n )\n ),\n 'AE2' => array( // add on left, edit of same file on right and content differs, shows as edit\n array('AE2' => 'add'),\n array('AE2' => 'edit'),\n array(\n 'cc' => array('AE2' => array('action' => 'edit', 'diffLeft' => '#1', 'diffRight' => '#2')),\n 'cs' => array('AE2' => array('action' => 'edit', 'diffLeft' => '#1', 'diffRight' => 'v2')),\n 'sc' => array('AE2' => array('action' => 'edit', 'diffLeft' => 'v1', 'diffRight' => '#2')),\n 'ss' => array('AE2' => array('action' => 'edit', 'diffLeft' => 'v1', 'diffRight' => 'v2')),\n )\n ),\n 'AD' => array( // add on left, delete on right, shows as delete\n array('AD' => 'add'),\n array('AD' => 'delete'),\n array(\n 'cc' => array('AD' => array('action' => 'delete', 'diffLeft' => '#1', 'diffRight' => '#2')),\n 'cs' => array('AD' => array('action' => 'delete', 'diffLeft' => '#1', 'diffRight' => 'v2')),\n 'sc' => array('AD' => array('action' => 'delete', 'diffLeft' => 'v1', 'diffRight' => '#2')),\n 'ss' => array('AD' => array('action' => 'delete', 'diffLeft' => 'v1', 'diffRight' => 'v2')),\n )\n ),\n 'AX' => array( // add on left, file not present on right. shows as delete if left shelved otherwise drops\n array('AXOther' => 'add', 'AX' => 'add'),\n array('AXOther' => 'add'),\n array(\n 'cc' => array(),\n 'cs' => array(),\n 'sc' => array('AX' => array('action' => 'delete', 'diffLeft' => 'v1', 'diffRight' => null)),\n 'ss' => array('AX' => array('action' => 'delete', 'diffLeft' => 'v1', 'diffRight' => null)),\n )\n ),\n 'EA' => array( // edit on left, add on right, shows as edit\n array('EA' => 'edit'),\n array('EA' => 'add'),\n array(\n 'cc' => array('EA' => array('action' => 'edit', 'diffLeft' => '#2', 'diffRight' => '#4')),\n 'cs' => array('EA' => array('action' => 'edit', 'diffLeft' => '#2', 'diffRight' => 'v2')),\n 'sc' => array('EA' => array('action' => 'edit', 'diffLeft' => 'v1', 'diffRight' => '#3')),\n 'ss' => array('EA' => array('action' => 'edit', 'diffLeft' => 'v1', 'diffRight' => 'v2')),\n )\n ),\n 'EE' => array( // edit on both sides but same content, drop file\n array('EE' => 'edit'),\n array('EE' => 'edit', 'EENew' => 'add'),\n array(\n 'cc' => array('EENew' => array('action' => 'add', 'diffLeft' => null, 'diffRight' => '#1')),\n 'cs' => array('EENew' => array('action' => 'add', 'diffLeft' => null, 'diffRight' => 'v2')),\n 'sc' => array('EENew' => array('action' => 'add', 'diffLeft' => null, 'diffRight' => '#1')),\n 'ss' => array('EENew' => array('action' => 'add', 'diffLeft' => null, 'diffRight' => 'v2')),\n )\n ),\n 'EE2' => array( // edit on both sides but different content, shows as edit\n array('EE2' => 'edit'),\n array('EE2' => array('action' => 'edit', 'content' => 'edited!')),\n array(\n 'cc' => array('EE2' => array('action' => 'edit', 'diffLeft' => '#2', 'diffRight' => '#3')),\n 'cs' => array('EE2' => array('action' => 'edit', 'diffLeft' => '#2', 'diffRight' => 'v2')),\n 'sc' => array('EE2' => array('action' => 'edit', 'diffLeft' => 'v1', 'diffRight' => '#2')),\n 'ss' => array('EE2' => array('action' => 'edit', 'diffLeft' => 'v1', 'diffRight' => 'v2')),\n )\n ),\n 'ED' => array( // edit on left, delete on right shows as delete\n array('ED' => 'edit'),\n array('ED' => 'delete'),\n array(\n 'cc' => array('ED' => array('action' => 'delete', 'diffLeft' => '#2', 'diffRight' => '#3')),\n 'cs' => array('ED' => array('action' => 'delete', 'diffLeft' => '#2', 'diffRight' => 'v2')),\n 'sc' => array('ED' => array('action' => 'delete', 'diffLeft' => 'v1', 'diffRight' => '#2')),\n 'ss' => array('ED' => array('action' => 'delete', 'diffLeft' => 'v1', 'diffRight' => 'v2')),\n )\n ),\n 'EX' => array( // edit on left, missing on right, shows as reverse edit if left shelved otherwise drops\n array('EXOther' => 'add', 'EX' => 'edit'),\n array('EXOther' => 'add'),\n array(\n 'cc' => array(),\n 'cs' => array(),\n 'sc' => array('EX' => array('action' => 'edit', 'diffLeft' => 'v1', 'diffRight' => '#1')),\n 'ss' => array('EX' => array('action' => 'edit', 'diffLeft' => 'v1', 'diffRight' => '#1')),\n )\n ),\n 'DA' => array( // delete on left add on right, shows as add\n array('DA' => 'delete'),\n array('DA' => 'add'),\n array(\n 'cc' => array('DA' => array('action' => 'add', 'diffLeft' => '#2', 'diffRight' => '#3')),\n 'cs' => array('DA' => array('action' => 'add', 'diffLeft' => '#2', 'diffRight' => 'v2')),\n 'sc' => array('DA' => array('action' => 'add', 'diffLeft' => 'v1', 'diffRight' => '#3')),\n 'ss' => array('DA' => array('action' => 'add', 'diffLeft' => 'v1', 'diffRight' => 'v2')),\n )\n ),\n 'DE' => array( // delete on left edit on right, shows as add\n array('DE' => 'delete'),\n array('DE' => 'edit'),\n array(\n 'cc' => array('DE' => array('action' => 'add', 'diffLeft' => '#2', 'diffRight' => '#4')),\n 'cs' => array('DE' => array('action' => 'add', 'diffLeft' => '#2', 'diffRight' => 'v2')),\n 'sc' => array('DE' => array('action' => 'add', 'diffLeft' => 'v1', 'diffRight' => '#2')),\n 'ss' => array('DE' => array('action' => 'add', 'diffLeft' => 'v1', 'diffRight' => 'v2')),\n )\n ),\n 'DD' => array( // delete on both sides, file dropped\n array('DD' => 'delete'),\n array('DD' => 'delete', 'DDNew' => 'add'),\n array(\n 'cc' => array('DDNew' => array('action' => 'add', 'diffLeft' => null, 'diffRight' => '#1')),\n 'cs' => array('DDNew' => array('action' => 'add', 'diffLeft' => null, 'diffRight' => 'v2')),\n 'sc' => array('DDNew' => array('action' => 'add', 'diffLeft' => null, 'diffRight' => '#1')),\n 'ss' => array('DDNew' => array('action' => 'add', 'diffLeft' => null, 'diffRight' => 'v2')),\n )\n ),\n 'DX' => array( // delete on left missing on right, shows as add if left shelved otherwise drops\n array('DXOther' => 'add', 'DX' => 'delete'),\n array('DXOther' => 'add'),\n array(\n 'cc' => array(),\n 'cs' => array(),\n 'sc' => array('DX' => array('action' => 'add', 'diffLeft' => null, 'diffRight' => '#1')),\n 'ss' => array('DX' => array('action' => 'add', 'diffLeft' => null, 'diffRight' => '#1')),\n )\n ),\n 'XA' => array( // missing on left, add on right, shows as add\n array('XAOther' => 'add'),\n array('XAOther' => 'add', 'XA' => 'add'),\n array(\n 'cc' => array('XA' => array('action' => 'add', 'diffLeft' => null, 'diffRight' => '#1')),\n 'cs' => array('XA' => array('action' => 'add', 'diffLeft' => null, 'diffRight' => 'v2')),\n 'sc' => array('XA' => array('action' => 'add', 'diffLeft' => null, 'diffRight' => '#1')),\n 'ss' => array('XA' => array('action' => 'add', 'diffLeft' => null, 'diffRight' => 'v2')),\n )\n ),\n 'XE' => array( // missing on left, edit on right, shows as edit\n array('XEOther' => 'add'),\n array('XEOther' => 'add', 'XE' => 'edit'),\n array(\n 'cc' => array('XE' => array('action' => 'edit', 'diffLeft' => '#1', 'diffRight' => '#2')),\n 'cs' => array('XE' => array('action' => 'edit', 'diffLeft' => '#1', 'diffRight' => 'v2')),\n 'sc' => array('XE' => array('action' => 'edit', 'diffLeft' => '#1', 'diffRight' => '#2')),\n 'ss' => array('XE' => array('action' => 'edit', 'diffLeft' => '#1', 'diffRight' => 'v2')),\n )\n ),\n 'XD' => array( // missing on left, delete on right, shows as delete\n array('XDOther' => 'add'),\n array('XDOther' => 'add', 'XD' => 'delete'),\n array(\n 'cc' => array('XD' => array('action' => 'delete', 'diffLeft' => '#1', 'diffRight' => '#2')),\n 'cs' => array('XD' => array('action' => 'delete', 'diffLeft' => '#1', 'diffRight' => 'v2')),\n 'sc' => array('XD' => array('action' => 'delete', 'diffLeft' => '#1', 'diffRight' => '#2')),\n 'ss' => array('XD' => array('action' => 'delete', 'diffLeft' => '#1', 'diffRight' => 'v2')),\n )\n )\n );\n }",
"function phorum_api_diff_unpatch($text, $diff)\n{\n $text = str_replace(array(\"\\r\\n\", \"\\r\"), \"\\n\", $text);\n\n if (!is_array($diff)) {\n $n = 0;\n for ($i=0; $i<strlen($diff); $i++) {\n $c = substr($diff, $i, 1);\n if ($c == \"-\") {\n $n = substr($diff, 0, $i);\n $pre = substr($text, 0, $n);\n $post = substr($text, $n);\n return $pre.substr($diff, $i+1).$post;\n } elseif ($c == \"+\") {\n $n = substr($diff, 0, $i);\n $pre = substr($text, 0, $n);\n $post = substr($text, $n);\n return $pre.substr($post, strlen($diff)-$i-1);\n }\n }\n return $text;\n }\n foreach (array_reverse($diff) as $d) {\n $text = phorum_api_diff_unpatch($text, $d);\n }\n return $text;\n}",
"public function filterByLine($pat, $replacement=\"\") {\r\n $arr = $this->toArray();\r\n $newContents = \"\";\r\n foreach($arr as $line) {\r\n $newContents .= preg_replace($pat, $replacement, $line).\"\\n\";\r\n }\r\n // Following removes extra blank line -- why needed?\r\n $newContents = substr_replace($newContents, \"\", -1);\r\n $this->contents = $newContents;\r\n }",
"public function eliminateMatchingBlocks()\n {\n $this->_serviceEliminateDuplicates()->eliminateMatchingBlocks();\n }",
"public static function lineBreakCorrectlyTransformedOnWayToRteProvider() {}",
"function isLineChanged($v1, $v2) {\r\n $belongTo = new BelongTo();\r\n $lineV1 = $belongTo->getLines($v1);\r\n $lineV2 = $belongTo->getLines($v2);\r\n foreach ($lineV1 as $line1) {\r\n foreach ($lineV2 as $line2) {\r\n if ($line1 == $line2) return false;\r\n }\r\n }\r\n return true;\r\n }"
] |
[
"0.6192138",
"0.6005818",
"0.5728002",
"0.5656723",
"0.5608873",
"0.55699235",
"0.55518556",
"0.5507049",
"0.5495304",
"0.5417537",
"0.541272",
"0.5411777",
"0.54016936",
"0.5332422",
"0.52969855",
"0.52714044",
"0.51649266",
"0.5066587",
"0.5060373",
"0.5051198",
"0.50483537",
"0.4980329",
"0.49582395",
"0.49571443",
"0.49522474",
"0.49064794",
"0.48880833",
"0.4888032",
"0.47815537",
"0.47700396"
] |
0.6032641
|
1
|
Determine whether the "replace"type lines are mergeable or not.
|
protected function isLinesMergeable(string $oldLine, string $newLine, string $cleanLine): bool
{
$oldLine = str_replace(RendererConstant::HTML_CLOSURES_DEL, '', $oldLine);
$newLine = str_replace(RendererConstant::HTML_CLOSURES_INS, '', $newLine);
$sumLength = \strlen($oldLine) + \strlen($newLine);
/** @var float the changed ratio, 0 <= value < 1 */
$changedRatio = ($sumLength - (\strlen($cleanLine) << 1)) / ($sumLength + 1);
return $changedRatio <= $this->options['mergeThreshold'];
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function isMerging(): bool\n {\n foreach (['MERGE_MSG', 'MERGE_HEAD', 'MERGE_MODE'] as $fileName) {\n if (file_exists($this->dotGitDir . DIRECTORY_SEPARATOR . $fileName)) {\n return true;\n }\n }\n return false;\n }",
"private function hasPregReplace() {\n\t\treturn isset($this->replaces);\n\t}",
"public function hasReplacements()\n\t{\n\t\treturn (bool) $this->replacements;\n\t}",
"public static function isSyncronized()\n {\n $db = JFactory::getDbo();\n //#__osrs_tags\n $fields = array_keys($db->getTableColumns('#__osrs_tags'));\n $extraLanguages = self::getLanguages();\n if (count($extraLanguages)) {\n foreach ($extraLanguages as $extraLanguage) {\n $prefix = $extraLanguage->sef;\n if (!in_array('keyword_' . $prefix, $fields)) {\n return false;\n }\n }\n }\n\n //osrs_emails\n $fields = array_keys($db->getTableColumns('#__osrs_emails'));\n $extraLanguages = self::getLanguages();\n if (count($extraLanguages)) {\n foreach ($extraLanguages as $extraLanguage) {\n $prefix = $extraLanguage->sef;\n if (!in_array('email_title_' . $prefix, $fields)) {\n return false;\n }\n }\n }\n\n //osrs_categories\n $fields = array_keys($db->getTableColumns('#__osrs_categories'));\n $extraLanguages = self::getLanguages();\n if (count($extraLanguages)) {\n foreach ($extraLanguages as $extraLanguage) {\n $prefix = $extraLanguage->sef;\n if (!in_array('category_name_' . $prefix, $fields)) {\n return false;\n }\n }\n }\n\n //osrs_amenities\n $fields = array_keys($db->getTableColumns('#__osrs_amenities'));\n $extraLanguages = self::getLanguages();\n if (count($extraLanguages)) {\n foreach ($extraLanguages as $extraLanguage) {\n $prefix = $extraLanguage->sef;\n if (!in_array('amenities_' . $prefix, $fields)) {\n return false;\n }\n }\n }\n\n //osrs_fieldgroups\n $fields = array_keys($db->getTableColumns('#__osrs_fieldgroups'));\n $extraLanguages = self::getLanguages();\n if (count($extraLanguages)) {\n foreach ($extraLanguages as $extraLanguage) {\n $prefix = $extraLanguage->sef;\n if (!in_array('group_name_' . $prefix, $fields)) {\n return false;\n }\n }\n }\n\n\n //osrs_osrs_extra_fields\n $fields = array_keys($db->getTableColumns('#__osrs_extra_fields'));\n $extraLanguages = self::getLanguages();\n if (count($extraLanguages)) {\n foreach ($extraLanguages as $extraLanguage) {\n $prefix = $extraLanguage->sef;\n if (!in_array('field_label_' . $prefix, $fields)) {\n return false;\n }\n }\n }\n\n //osrs_extra_field_options\n $fields = array_keys($db->getTableColumns('#__osrs_extra_field_options'));\n $extraLanguages = self::getLanguages();\n if (count($extraLanguages)) {\n foreach ($extraLanguages as $extraLanguage) {\n $prefix = $extraLanguage->sef;\n if (!in_array('field_option_' . $prefix, $fields)) {\n return false;\n }\n }\n }\n\n //osrs_property_field_value\n $fields = array_keys($db->getTableColumns('#__osrs_property_field_value'));\n $extraLanguages = self::getLanguages();\n if (count($extraLanguages)) {\n foreach ($extraLanguages as $extraLanguage) {\n $prefix = $extraLanguage->sef;\n if (!in_array('value_' . $prefix, $fields)) {\n return false;\n }\n }\n }\n\n\n //osrs_types\n $fields = array_keys($db->getTableColumns('#__osrs_types'));\n $extraLanguages = self::getLanguages();\n if (count($extraLanguages)) {\n foreach ($extraLanguages as $extraLanguage) {\n $prefix = $extraLanguage->sef;\n if (!in_array('type_name_' . $prefix, $fields)) {\n return false;\n }\n }\n }\n\n //osrs_properties\n $fields = array_keys($db->getTableColumns('#__osrs_properties'));\n $extraLanguages = self::getLanguages();\n if (count($extraLanguages)) {\n foreach ($extraLanguages as $extraLanguage) {\n $prefix = $extraLanguage->sef;\n if (!in_array('pro_name_' . $prefix, $fields)) {\n return false;\n }\n\n\t\t\t\tif (!in_array('price_text_' . $prefix, $fields)) {\n return false;\n }\n\n if (!in_array('address_' . $prefix, $fields)) {\n return false;\n }\n if (!in_array('metadesc_' . $prefix, $fields)) {\n return false;\n }\n if (!in_array('metakey_' . $prefix, $fields)) {\n return false;\n }\n\t\t\t\tif (!in_array('pro_browser_title_' . $prefix, $fields)) {\n return false;\n }\n }\n }\n\n //osrs_agents\n $fields = array_keys($db->getTableColumns('#__osrs_agents'));\n $extraLanguages = self::getLanguages();\n if (count($extraLanguages)) {\n foreach ($extraLanguages as $extraLanguage) {\n $prefix = $extraLanguage->sef;\n if (!in_array('bio_' . $prefix, $fields)) {\n return false;\n }\n }\n }\n\n //osrs_companies\n $fields = array_keys($db->getTableColumns('#__osrs_companies'));\n $extraLanguages = self::getLanguages();\n if (count($extraLanguages)) {\n foreach ($extraLanguages as $extraLanguage) {\n $prefix = $extraLanguage->sef;\n if (!in_array('company_description_' . $prefix, $fields)) {\n return false;\n }\n }\n }\n\n //osrs_states\n $fields = array_keys($db->getTableColumns('#__osrs_states'));\n $extraLanguages = self::getLanguages();\n if (count($extraLanguages)) {\n foreach ($extraLanguages as $extraLanguage) {\n $prefix = $extraLanguage->sef;\n if (!in_array('state_name_' . $prefix, $fields)) {\n return false;\n }\n }\n }\n\n\n //osrs_cities\n $fields = array_keys($db->getTableColumns('#__osrs_cities'));\n $extraLanguages = self::getLanguages();\n if (count($extraLanguages)) {\n foreach ($extraLanguages as $extraLanguage) {\n $prefix = $extraLanguage->sef;\n if (!in_array('city_' . $prefix, $fields)) {\n return false;\n }\n }\n }\n\n\t\t//osrs_cities\n $fields = array_keys($db->getTableColumns('#__osrs_countries'));\n $extraLanguages = self::getLanguages();\n if (count($extraLanguages)) {\n foreach ($extraLanguages as $extraLanguage) {\n $prefix = $extraLanguage->sef;\n if (!in_array('country_name_' . $prefix, $fields)) {\n return false;\n }\n }\n }\n\n return true;\n }",
"protected function getMergeConflictRegExps()\n\t{\n\t\treturn $this->getSetting(self::SETTING_LOG_MERGE_CONFLICT_REGEXPS);\n\t}",
"public function hasConflicts() {\n if(!isset($this->hasConflicts)) {\n $repo = Repo::getById($this->repoId);\n $clone = $repo->getCloneRepo();\n $currentBranch = $clone->getActiveBranch();\n $conflicts = false;\n\n // First download the main repository references in the cloned repository\n $clone->fetch();\n\n // First update the two branches on the clone repository\n $clone->checkout($this->to);\n $clone->pull();\n\n $clone->fetch();\n $clone->checkout($this->from);\n $clone->pull();\n\n if($currentBranch !== $this->to) {\n $clone->checkout($this->to);\n }\n\n try {\n $clone->run('merge --no-commit --no-ff ' . $this->from);\n }\n catch(GitException $e) {\n $conflicts = true;\n }\n\n try {\n $clone->run('merge --abort');\n }\n catch(GitException $e) {}\n\n if($currentBranch !== $this->to) {\n $clone->checkout($currentBranch);\n }\n\n\n $this->hasConflicts = $conflicts;\n }\n\n return $this->hasConflicts;\n }",
"private function hasConflictInLine( array $currentLine ) {\n\t\tif ( count( $currentLine ) < 2 ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn $currentLine[0]['action'] === 'delete' &&\n\t\t\t$currentLine[1]['action'] === 'add';\n\t}",
"protected function collateOnly() {\n\t\treturn false;\n\t}",
"public function isReplaceRelationship();",
"public function isReplacementEnabled() {\n\t\treturn (boolean) ((integer) $this->typoScriptConfiguration->getSetting('enabled'));\n\t}",
"public function it_merges_in_combine_mode() {\n self::merge(self::CONFIG_BASIC, self::CONFIG_MERGE, PasswdPolicy::MODE_COMBINE)->shouldReturn(self::CONFIG_MERGED);\n }",
"public function isMultiLine(): bool;",
"public function is_next_a_mergeable_comment() {\n\t\tif (! $this->oBeaut->isNextTokenConstant(T_COMMENT)) {\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t// The beautifer doesn't let me pull the next token with a method\n\t\t$idx = 1;\n\t\t$nextToken = $this->oBeaut->getToken($this->oBeaut->iCount + $idx);\n\t\t\n\t\twhile (is_array($nextToken) && $nextToken[0] == T_WHITESPACE) {\n\t\t\t$idx ++;\n\t\t\t$nextToken = $this->oBeaut->getToken($this->oBeaut->iCount + $idx);\n\t\t}\n\t\t\n\t\tif (! is_array($nextToken)) {\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\tif ($nextToken[0] == 370) {\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\tif (substr($nextToken[1], 0, 2) == '/*') {\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t$prevToken = $this->oBeaut->getToken($this->oBeaut->iCount - 1);\n\t\t\n\t\tif (! is_array($prevToken) || strpos($prevToken[1], \"\\n\") === false) {\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\treturn true;\n\t}",
"public function isMultiline() {}",
"public function getOverwrite() : bool\n {\n return $this->getProperty()->overwrite;\n }",
"public function it_merges_in_minimum_mode() {\n self::merge(self::CONFIG_BASIC, self::CONFIG_MERGE, PasswdPolicy::MODE_MINIMIM)->shouldReturn(self::CONFIG_BASIC);\n }",
"public function isPatch();",
"protected function _detectCompletionBoundaryInOutput($update_buffer=false)\n {\n// do we need to update the buffer?\n if($update_buffer === true)\n {\n $this->getBuffer();\n }\n \n return strpos($this->_buffer, $this->_completion_boundary) !== false;\n }",
"public function hasOverride() : bool\n {\n return $this->override !== null;\n }",
"public function isPatch(): bool {}",
"function isLineChanged($v1, $v2) {\r\n $belongTo = new BelongTo();\r\n $lineV1 = $belongTo->getLines($v1);\r\n $lineV2 = $belongTo->getLines($v2);\r\n foreach ($lineV1 as $line1) {\r\n foreach ($lineV2 as $line2) {\r\n if ($line1 == $line2) return false;\r\n }\r\n }\r\n return true;\r\n }",
"public function getReplaceLineBreaks() {\n\t\treturn $this->replaceLineBreaks;\n\t}",
"public function getConflictsMode(): int;",
"private function getFormatStatusFromContent(){\n\t\t if(EducationalUtil::isRoleTypeTheme($this->roleType, $this->roleNamesObj)){\n\t\t\treturn true;\n\t\t }\n\t\t \n\t\t $contentArray = explode(FieldContentInAgenda::SPLIT_CHARACTER, $this->filedContent);\n\t\t \n\t\t if(EducationalUtil::isRoleTypeCC($this->roleType, $this->roleNamesObj)){\n\t\t\t$NUM_OF_PIECES_FOR_MEMBER_OLD = 5;\n\t\t\t$NUM_OF_PIECES_FOR_NON_MEMBER_OLD = 6;\n\t\t\tif(((count($contentArray) == $NUM_OF_PIECES_FOR_MEMBER_OLD) && ($contentArray[0] == FieldContentInAgenda::MEMBER_TAG)) ||\n\t\t\t ((count($contentArray) == $NUM_OF_PIECES_FOR_NON_MEMBER_OLD) && ($contentArray[0] == FieldContentInAgenda::NONE_MEMBER_TAG))){\n\t\t\t\treturn false;\n\t\t\t} else {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t } else {\n\t\t\t$NUM_OF_PIECES_FOR_MEMBER_OLD = 3;\n\t\t\t$NUM_OF_PIECES_FOR_NON_MEMBER_OLD = 4;\n\t\t\t\n\t\t\tif(((count($contentArray) == $NUM_OF_PIECES_FOR_MEMBER_OLD) && ($contentArray[0] == FieldContentInAgenda::MEMBER_TAG)) ||\n\t\t\t ((count($contentArray) == $NUM_OF_PIECES_FOR_NON_MEMBER_OLD) && ($contentArray[0] == FieldContentInAgenda::NONE_MEMBER_TAG))){\n\t\t\t\treturn false;\n\t\t\t} else {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t }\n\t }",
"public function isSingleLine(): bool;",
"public function hasLines(){\n return $this->_has(38);\n }",
"protected function mergeReplaceLines(string $oldLine, string $newLine): ?string\n {\n $delParts = $this->analyzeClosureParts(\n $oldLine,\n RendererConstant::HTML_CLOSURES_DEL,\n SequenceMatcher::OP_DEL,\n );\n $insParts = $this->analyzeClosureParts(\n $newLine,\n RendererConstant::HTML_CLOSURES_INS,\n SequenceMatcher::OP_INS,\n );\n\n // get the cleaned line by a non-regex way (should be faster)\n // i.e., the new line with all \"<ins>...</ins>\" parts removed\n $mergedLine = $newLine;\n foreach (ReverseIterator::fromArray($insParts) as $part) {\n $mergedLine = substr_replace(\n $mergedLine,\n '', // deletion\n $part['offset'],\n \\strlen($part['content']),\n );\n }\n\n // note that $mergedLine is actually a clean line at this point\n if (!$this->isLinesMergeable($oldLine, $newLine, $mergedLine)) {\n return null;\n }\n\n // before building the $mergedParts, we do some adjustments\n $this->revisePartsForBoundaryNewlines($delParts, RendererConstant::HTML_CLOSURES_DEL);\n $this->revisePartsForBoundaryNewlines($insParts, RendererConstant::HTML_CLOSURES_INS);\n\n // create a sorted merged parts array\n $mergedParts = [...$delParts, ...$insParts];\n usort(\n $mergedParts,\n // first sort by \"offsetClean\", \"order\" then by \"type\"\n static fn (array $a, array $b): int => (\n $a['offsetClean'] <=> $b['offsetClean']\n ?: $a['order'] <=> $b['order']\n ?: ($a['type'] === SequenceMatcher::OP_DEL ? -1 : 1)\n ),\n );\n\n // insert merged parts into the cleaned line\n foreach (ReverseIterator::fromArray($mergedParts) as $part) {\n $mergedLine = substr_replace(\n $mergedLine,\n $part['content'],\n $part['offsetClean'],\n 0, // insertion\n );\n }\n\n return str_replace(\"\\n\", '<br>', $mergedLine);\n }",
"public function isOverwriteAllowed(): bool\n {\n return true;\n }",
"function Row_UpdateConflict(&$rsold, &$rsnew) {\n\n\t\t// Enter your code here\n\t\t// To ignore conflict, set return value to FALSE\n\n\t\treturn TRUE;\n\t}",
"public function merge() {}"
] |
[
"0.6891507",
"0.54124177",
"0.5395187",
"0.5264528",
"0.52417165",
"0.5146036",
"0.51164687",
"0.5096709",
"0.5082205",
"0.5058946",
"0.50405407",
"0.4947558",
"0.4922717",
"0.48890486",
"0.48521146",
"0.48098117",
"0.475315",
"0.47132835",
"0.4701012",
"0.46803057",
"0.4669306",
"0.46650934",
"0.46386504",
"0.46072504",
"0.4602509",
"0.45770803",
"0.45770124",
"0.45638064",
"0.45591563",
"0.45526752"
] |
0.59332037
|
1
|
Extract boundary newlines from parts into new parts.
|
protected function revisePartsForBoundaryNewlines(array &$parts, array $closures): void
{
[$ld, $rd] = $closures;
$ldRegex = preg_quote($ld, '/');
$rdRegex = preg_quote($rd, '/');
for ($i = \count($parts) - 1; $i >= 0; --$i) {
$part = &$parts[$i];
// deal with leading newlines
$part['content'] = preg_replace_callback(
"/(?P<closure>{$ldRegex})(?P<nl>[\r\n]++)/u",
static function (array $matches) use (&$parts, $part, $ld, $rd): string {
// add a new part for the extracted newlines
$part['order'] = -1;
$part['content'] = "{$ld}{$matches['nl']}{$rd}";
$parts[] = $part;
return $matches['closure'];
},
$part['content'],
);
// deal with trailing newlines
$part['content'] = preg_replace_callback(
"/(?P<nl>[\r\n]++)(?P<closure>{$rdRegex})/u",
static function (array $matches) use (&$parts, $part, $ld, $rd): string {
// add a new part for the extracted newlines
$part['order'] = 1;
$part['content'] = "{$ld}{$matches['nl']}{$rd}";
$parts[] = $part;
return $matches['closure'];
},
$part['content'],
);
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function cropHtmlWorksWithLinebreaks() {}",
"private function splitAndCleanBoundaries($boundary_delimiter) {\n $boundaries = array();\n $boundaries_orig = explode($boundary_delimiter, $this->content);\n\n // Nettoyage du boundary\n foreach($boundaries_orig as $boundary_part) { \n $boundary = $boundary_part;\n\n // On met tout le boundary sur une seule ligne\n $boundary = preg_replace('/\\n/m', ' ', $boundary);\n\n // On remplace toutes les tabulations par un espace\n $boundary = preg_replace('/\\t/', ' ', $boundary);\n\n // Suppression des doubles espaces\n $boundary = preg_replace('/\\s{2,}/', ' ', $boundary);\n\n // \"Trim\"\n $boundary = preg_replace('/^\\s*/', '', $boundary);\n $boundary = preg_replace('/\\s*$/', '', $boundary);\n\n // Et on le stocke dans un tableau\n $boundaries[] = $boundary;\n }\n\n return $boundaries;\n }",
"function NbLinesSplit($w,$txt,$lineno)\n{\n $cw=&$this->CurrentFont['cw'];\n if($w==0)\n $w=$this->w-$this->rMargin-$this->x;\n $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;\n $s=str_replace(\"\\r\",'',$txt);\n $nb=strlen($s);\n if($nb>0 and $s[$nb-1]==\"\\n\")\n $nb--;\n $sep=-1;\n $i=0;\n $j=0;\n $l=0;\n $nl=1;\n $cnt=0;\n while($i<$nb)\n {\n $c=$s[$i];\n $cnt+=1;\n \t\t$a[$cnt]= $nl;\n if($nl==$lineno){\n \t$Stringposition=$i;\n \tbreak;\n }\n if($c==\"\\n\")\n {\n $i++;\n $sep=-1;\n $j=$i;\n $l=0;\n $nl++;\n continue;\n }\n if($c==' ')\n $sep=$i;\n $l+=$cw[$c];\n \t \n if($l>$wmax)\n {\n if($sep==-1)\n {\n if($i==$j)\n $i++;\n }\n else\n $i=$sep+1;\n $sep=-1;\n $j=$i;\n $l=0;\n $nl++;\n \n }\n else{\n $i++;\n \n }\n /* if($nl=='12'){\n \t$Stringposition=$i;\n \tbreak;\n }*/\n }\n return $Stringposition;\n}",
"function parse_breaks($txt, $br = true)\n\t{\n\t\t$txt = $txt . \"\\n\"; // just to make things a little easier, pad the end\n\t\t$txt = preg_replace('`<br />\\s*<br />`', \"\\n\\n\", $txt);\n\t\t// Space things out a little\n\t\t$allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|option|form|map|area|blockquote|address|math|style|input|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|details|menu|summary)';\n\t\t$txt = preg_replace('`(<' . $allblocks . '[^>]*>)`', \"\\n$1\", $txt);\n\t\t$txt = preg_replace('`(</' . $allblocks . '>)`', \"$1\\n\\n\", $txt);\n\t\t$txt = str_replace(array(\"\\r\\n\", \"\\r\"), \"\\n\", $txt); // cross-platform newlines\n\t\tif(strpos($txt, '<object') !== false){\n\t\t\t$txt = preg_replace('`\\s*<param([^>]*)>\\s*`', \"<param$1>\", $txt); // no pee inside object/embed\n\t\t\t$txt = preg_replace('`\\s*</embed>\\s*`', '</embed>', $txt);\n\t\t}\n\t\t$txt = preg_replace(\"`\\n\\n+`\", \"\\n\\n\", $txt); // take care of duplicates\n\t\t// make paragraphs, including one at the end\n\t\t$txts = preg_split('`\\n\\s*\\n`', $txt, -1, PREG_SPLIT_NO_EMPTY);\n\t\t$txt = '';\n\t\tforeach($txts as $tinkle){\n\t\t\t$txt .= '<p>' . trim($tinkle, \"\\n\") . \"</p>\\n\";\n\t\t}\n\t\t$txt = preg_replace('`<p>\\s*</p>`', '', $txt); // under certain strange conditions it could create a P of entirely whitespace\n\t\t$txt = preg_replace('`<p>([^<]+)</(div|address|form)>`', \"<p>$1</p></$2>\", $txt);\n\t\t$txt = preg_replace('`<p>\\s*(</?' . $allblocks . '[^>]*>)\\s*</p>`', \"$1\", $txt); // don't pee all over a tag\n\t\t$txt = preg_replace(\"`<p>(<li.+?)</p>`\", \"$1\", $txt); // problem with nested lists\n\t\t$txt = preg_replace('`<p><blockquote([^>]*)>`i', \"<blockquote$1><p>\", $txt);\n\t\t$txt = str_replace('</blockquote></p>', '</p></blockquote>', $txt);\n\t\t$txt = preg_replace('`<p>\\s*(</?' . $allblocks . '[^>]*>)`', \"$1\", $txt);\n\t\t$txt = preg_replace('`(</?' . $allblocks . '[^>]*>)\\s*</p>`', \"$1\", $txt);\n\t\tif($br) {\n\t\t\t$txt = preg_replace_callback('/<(script|style|noparse).*?<\\/\\\\1>/s',\n\t\t\t\tcreate_function('$out','return str_replace(\"\\n\", \"<WPPreserveNewline />\", $out[0]);'),\n\t\t\t\t$txt);\n\t\t\t$txt = preg_replace('|(?<!<br />)\\s*\\n|', \"<br />\\n\", $txt); // optionally make line breaks\n\t\t\t$txt = str_replace('<WPPreserveNewline />', \"\\n\", $txt);\n\t\t}\n\t\t$txt = preg_replace('!(</?' . $allblocks . '[^>]*>)\\s*<br />!', \"$1\", $txt);\n\t\t$txt = preg_replace('!<br />(\\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)!', '$1', $txt);\n\t\tif(strpos($txt, '<pre') !== false)\n\t\t{\n\t\t\t$txt = preg_replace_callback('`<pre[^>]*>.*?</pre>`is',\n\t\t\t\tcreate_function('$out','return str_replace(array(\"<br />\",\"<p>\",\"</p>\"),array(\"\",\"\\n\",\"\"),$out[0]);'),\n\t\t\t\t$txt );\n\t\t}\n\t\t$txt = preg_replace( \"|\\n</p>$|\", '</p>', $txt );\n\n\t\treturn $txt;\n\t}",
"function split_lines( $text ) {\n\t\t$lines = preg_split( \"/(\\r\\n|\\n|\\r)/\", $text );\n\n\t\treturn $lines;\n\t}",
"protected function lineBreaks() {\n\t\t$this->text = $this->removeUnneccesaryLinebreaks($this->text);\n\t\t$this->text = nl2br($this->text);\n\t\tReturn $this;\n\t}",
"public function testNewlines() {\n $this->assertEquals(\"Testing\\rCarriage\\rReturns\", Sanitize::newlines(\"Testing\\rCarriage\\r\\rReturns\"));\n $this->assertEquals(\"Testing\\r\\rCarriage\\rReturns\", Sanitize::newlines(\"Testing\\r\\rCarriage\\r\\r\\rReturns\", array('limit' => 3)));\n $this->assertEquals(\"TestingCarriageReturns\", Sanitize::newlines(\"Testing\\r\\rCarriage\\r\\r\\rReturns\", array('limit' => 0)));\n\n $this->assertEquals(\"Testing\\nLine\\nFeeds\", Sanitize::newlines(\"Testing\\nLine\\n\\nFeeds\"));\n $this->assertEquals(\"Testing\\nLine\\n\\nFeeds\", Sanitize::newlines(\"Testing\\n\\n\\nLine\\n\\nFeeds\", array('limit' => 3)));\n $this->assertEquals(\"TestingLineFeeds\", Sanitize::newlines(\"Testing\\n\\nLine\\n\\nFeeds\", array('limit' => 0)));\n\n $this->assertEquals(\"Testing\\r\\nBoth\\r\\nLineFeeds\\r\\n\\r\\nAnd\\r\\nCarriageReturns\", Sanitize::newlines(\"Testing\\r\\nBoth\\r\\r\\n\\nLineFeeds\\r\\n\\r\\r\\n\\nAnd\\r\\nCarriageReturns\"));\n $this->assertEquals(\"Testing\\r\\nBoth\\r\\nLineFeeds\\r\\nAnd\\r\\nCarriageReturns\", Sanitize::newlines(\"Testing\\r\\nBoth\\r\\n\\r\\nLineFeeds\\r\\n\\r\\n\\r\\nAnd\\r\\nCarriageReturns\"));\n $this->assertEquals(\"Testing\\r\\nBoth\\r\\n\\r\\nLineFeeds\\r\\n\\r\\n\\r\\nAnd\\r\\nCarriageReturns\", Sanitize::newlines(\"Testing\\r\\nBoth\\r\\n\\r\\nLineFeeds\\r\\n\\r\\n\\r\\nAnd\\r\\nCarriageReturns\", array('crlf' => false)));\n }",
"public function getRemoveLineBreaksFromTemplate() {}",
"public function getLinesToArray($multilines){\n $arrayTmp = array();\n $array = array();\n \n $arrayTmp = explode(\"\\n\", $multilines);\n foreach($array AS $item){\n $array[] = ereg_replace(\"[[:cntrl:]]\", \"\", $item);\n }\n return $array;\n }",
"function _autop_newline_preservation_helper( $matches ) {\n\t\t\treturn str_replace(\"\\n\", \"<WPPreserveNewline />\", $matches[0]);\n\t\t}",
"public static function normalizeLineBreaks($text) {}",
"protected function _format_newlines($str)\n\t{\n\t\tif ($str === '' OR (strpos($str, \"\\n\") === FALSE && ! in_array($this->last_block_element, $this->inner_block_required)))\n\t\t{\n\t\t\treturn $str;\n\t\t}\n\n\t\t// Convert two consecutive newlines to paragraphs\n\t\t$str = str_replace(\"\\n\\n\", \"</p>\\n\\n<p>\", $str);\n\n\t\t// Convert single spaces to <br /> tags\n\t\t$str = preg_replace(\"/([^\\n])(\\n)([^\\n])/\", '\\\\1<br />\\\\2\\\\3', $str);\n\n\t\t// Wrap the whole enchilada in enclosing paragraphs\n\t\tif ($str !== \"\\n\")\n\t\t{\n\t\t\t// We trim off the right-side new line so that the closing </p> tag\n\t\t\t// will be positioned immediately following the string, matching\n\t\t\t// the behavior of the opening <p> tag\n\t\t\t$str = '<p>'.rtrim($str).'</p>';\n\t\t}\n\n\t\t// Remove empty paragraphs if they are on the first line, as this\n\t\t// is a potential unintended consequence of the previous code\n\t\treturn preg_replace('/<p><\\/p>(.*)/', '\\\\1', $str, 1);\n\t}",
"function _split($lines) {\r\n if (!preg_match_all('/ ( [^\\S\\n]+ | [[:alnum:]]+ | . ) (?: (?!< \\n) [^\\S\\n])? /xs',\r\n implode(\"\\n\", $lines),\r\n $m)) {\r\n return array(array(''), array(''));\r\n }\r\n return array($m[0], $m[1]);\r\n }",
"function __replaceWithNewlines() {\n\t\t$args = func_get_args();\n\t\t$numLineBreaks = count(explode(\"\\n\", $args[0][0]));\n\t\treturn str_pad('', $numLineBreaks - 1, \"\\n\");\n\t}",
"function _autop_newline_preservation_helper($matches)\n {\n }",
"protected function parseMultipartBody(string $body, string $boundary): array\n {\n // Remove any dashes at the beginning and end so that the following regex will work.\n $boundary = trim($boundary, '-');\n\n // Split based on the boundary and any dashes the client adds\n $split = preg_split(\"/-*\\b{$boundary}\\b-*/\", $body, 0, PREG_SPLIT_NO_EMPTY);\n\n // Trim line breaks and delete empty values\n $dispositions = array_filter(array_map(function ($dis) { return trim($dis);}, $split));\n\n // Parse out the parts into keys and values\n return array_map(function ($item) {\n return new Disposition($item);\n }, array_values($dispositions));\n }",
"public function prepareContent ( $body )\n {\n // Fix the line endings\n $body = preg_replace('/\\r\\n|\\r|\\n/', \"\\r\\n\", $body);\n\n // Wrap the content\n $body = wordwrap($body, self::LINE_LENGTH, self::EOL, TRUE);\n\n // Replace any periods that appear on their own line\n $body = preg_replace( '/^(\\s*)\\.(\\s*)$/m', '\\1..\\2', $body );\n\n return $body;\n }",
"protected function boundrySplit($input, $boundary) {\n $parts = [];\n $bs_possible = Unicode::substr($boundary, 2, -2);\n $bs_check = '\\\"' . $bs_possible . '\\\"';\n\n if ($boundary == $bs_check) {\n $boundary = $bs_possible;\n }\n\n $tmp = explode('--' . $boundary, $input);\n\n for ($i = 1; $i < count($tmp); $i++) {\n if (trim($tmp[$i])) {\n $parts[] = $tmp[$i];\n }\n }\n\n return $parts;\n }",
"function sloodle_strip_new_lines($data) {\n $data=str_replace(\"\\r\",\"\",$data);\n $data=str_replace(\"\\n\",\"\",$data); \n return $data;\n }",
"public function split($raw)\n {\n // real dirty, hrhr but works\n $raw = ' '.$raw;\n\n // clean old tokens\n $this->tokens = [];\n $this->tokens[] = array(1,'');\n\n $regex = '/(' .\n implode(')|(', $this->catchablePatterns) . ')|'.\n implode('|', $this->nonCatchablePatterns) . '/i';\n\n $flags = PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_OFFSET_CAPTURE;\n // PREG_SPLIT_NO_EMPTY|PREG_SPLIT_DELIM_CAPTURE\n\n $this->rawMatches = preg_split($regex, $raw, -1, $flags);\n\n $this->createTokens();\n\n //if (DEBUG)\n // Debug::console('raw input: ' , $raw);\n\n //if (DEBUG)\n // Debug::console('created tokens: ' , $this->tokens);\n\n }",
"public function getLineBreaks($text) {\r\n $mb_encoding = $this->encoding->getEncodingType();\r\n $use_mb = $this->encoding->useMB();\r\n if (!is_string($text)) { \r\n //make sure we have something\r\n if ($use_mb) {\r\n return array (mb_convert_encoding(\"\",$mb_encoding));\r\n }else {\r\n return array(\"\");\r\n }\r\n }\r\n //split up the paragaph along newlines\r\n $paragraphs = $this->getParagraphs($text);\r\n $text_lines = array();\r\n foreach ($paragraphs as $paragraph) {\r\n if ($use_mb) {\r\n $text_lines[] = mb_convert_encoding(\"\", $mb_encoding);\r\n } else {\r\n $text_lines[] = \"\";\r\n }\r\n switch ($this->algorithm) {\r\n case 'Knuth':\r\n $this->Knuth($paragraph,$text_lines);\r\n break;\r\n case 'Greedy':\r\n $this->Greedy($paragraph,$text_lines);\r\n break;\r\n default: //truncate\r\n $this->Truncate($paragraph,$text_lines);\r\n break;\r\n }\r\n }\r\n return $text_lines;\r\n }",
"public static function split_newline( $val ) {\n\t\t$vals = preg_split( '/\\n|\\r|\\r\\n/', $val, -1, PREG_SPLIT_NO_EMPTY );\n\t\treturn array_filter( array_map( 'trim', $vals ) );\n\t}",
"private static function replaceLineBreaksInsideTagsForBr(string $text): string\n {\n $regex = '/<(p|a|strong|b|em|i|li|ins|h2|h3|h4|td)\\b(?:[^>]*)>[^<]*<\\/\\1>/m';\n\n preg_match_all($regex, $text, $matches, PREG_SET_ORDER, 0);\n\n foreach ($matches as $match) {\n $replaced = preg_replace('/\\r\\n|\\r|\\n/', '<br />', $match[0]);\n $text = str_replace($match[0], $replaced, $text);\n }\n\n return $text;\n }",
"function splitBoxes($string) {\n if (preg_match_all('!(?<content>.*?)(?<box>\\[--box\\|(?<boxtype>.*?)--](?<boxcontent>.*?)\\[--endbox--])\\s*(?<trailer></[pP]>)?!s',\n $string,\n $matches)) {\n $output = array();\n foreach($matches['content'] as $content) {\n $trailer = array_shift($matches['trailer']);\n\n $box = new stdClass();\n $box->type = array_shift($matches['boxtype']);\n $box->text = trim(array_shift($matches['boxcontent']));\n\n $output[] = array(\n 'content' => $content . $trailer,\n 'box' => $box\n );\n }\n // work out how much of the string has been consumed\n $matchoffset = 0;\n foreach($matches[0] as $s) {\n $matchoffset += strlen($s);\n }\n $remainder = trim(substr($string, $matchoffset));\n\n // return remaining string as another content segment\n if ($remainder) {\n $output[] = array('content' => $remainder);\n }\n\n return $output;\n } else {\n return array(array('content' => $string));\n }\n }",
"function NbLines($w,$txt)\r\n{\r\n $cw=&$this->CurrentFont['cw'];\r\n if($w==0)\r\n $w=$this->w-$this->rMargin-$this->x;\r\n $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;\r\n $s=str_replace(\"\\r\",'',$txt);\r\n $nb=strlen($s);\r\n if($nb>0 and $s[$nb-1]==\"\\n\")\r\n $nb--;\r\n $sep=-1;\r\n $i=0;\r\n $j=0;\r\n $l=0;\r\n $nl=1;\r\n while($i<$nb)\r\n {\r\n $c=$s[$i];\r\n if($c==\"\\n\")\r\n {\r\n $i++;\r\n $sep=-1;\r\n $j=$i;\r\n $l=0;\r\n $nl++;\r\n continue;\r\n }\r\n if($c==' ')\r\n $sep=$i;\r\n $l+=$cw[$c];\r\n if($l>$wmax)\r\n {\r\n if($sep==-1)\r\n {\r\n if($i==$j)\r\n $i++;\r\n }\r\n else\r\n $i=$sep+1;\r\n $sep=-1;\r\n $j=$i;\r\n $l=0;\r\n $nl++;\r\n }\r\n else\r\n $i++;\r\n }\r\n return $nl;\r\n}",
"function NbLines($w, $txt) {\n $cw = &$this->CurrentFont['cw'];\n if ($w == 0)\n $w = $this->w - $this->rMargin - $this->x;\n $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize;\n $s = str_replace(\"\\r\", '', $txt);\n $nb = strlen($s);\n if ($nb > 0 and $s[$nb - 1] == \"\\n\")\n $nb--;\n $sep = -1;\n $i = 0;\n $j = 0;\n $l = 0;\n $nl = 1;\n while ($i < $nb) {\n $c = $s[$i];\n if ($c == \"\\n\") {\n $i++;\n $sep = -1;\n $j = $i;\n $l = 0;\n $nl++;\n continue;\n }\n if ($c == ' ')\n $sep = $i;\n $l += $cw[$c];\n if ($l > $wmax) {\n if ($sep == -1) {\n if ($i == $j)\n $i++;\n } else\n $i = $sep + 1;\n $sep = -1;\n $j = $i;\n $l = 0;\n $nl++;\n } else\n $i++;\n }\n return $nl;\n }",
"private function findContentBoundary($handle, PartBuilder $partBuilder)\n {\n // last separator before a boundary belongs to the boundary, and is not\n // part of the current part\n while (!feof($handle)) {\n $endPos = ftell($handle) - $this->lastLineSeparatorLength;\n $line = $this->readBoundaryLine($handle, $this->lastLineSeparatorLength);\n if ($line !== '' && $partBuilder->setEndBoundaryFound($line)) {\n $partBuilder->setStreamPartAndContentEndPos($endPos);\n return;\n }\n }\n $partBuilder->setStreamPartAndContentEndPos(ftell($handle));\n $partBuilder->setEof();\n }",
"function lineBreaksDecode($string) {\r\n $tags = array(\"<br>\", \"<p>\", \"</p>\", \"<strong>\", \"</strong>\", \"<em>\", \"</em>\");\r\n $replacement = array(\"LINE_BREAK\", \"P_START\", \"P_END\", \"B_START\", \"B_END\", \"I_START\", \"I_END\");\r\n $newstring = $string;\r\n \r\n for($i=0; $i<7; $i++){\r\n if (strpos($string, $replacement[$i]) !== false) {\r\n $newstring = str_replace($replacement[$i], $tags[$i], $newstring);\r\n }\r\n }\r\n return $newstring;\r\n}",
"public function test_linebreaks_removed() {\n\n\t\t$this->assertStringMatchesFormat(\n\t\t\t'%s'\n\t\t\t, $this->export_data['classes'][0]['doc']['long_description']\n\t\t);\n\t}",
"public function lines()\n {\n $array = preg_split('/[\\r\\n]{1,2}/u', $this->str);\n /** @noinspection CallableInLoopTerminationConditionInspection */\n for ($i = 0; $i < count($array); $i++) {\n $array[$i] = static::create($array[$i], $this->encoding);\n }\n\n return $array;\n }"
] |
[
"0.5775983",
"0.5695946",
"0.54824483",
"0.5247015",
"0.52378315",
"0.5215316",
"0.51589805",
"0.5155238",
"0.5152853",
"0.512245",
"0.5095528",
"0.5074845",
"0.50371426",
"0.50314534",
"0.50243556",
"0.5008757",
"0.50020385",
"0.4998402",
"0.4975285",
"0.4929742",
"0.49213848",
"0.49015242",
"0.48632345",
"0.48607433",
"0.48040432",
"0.4793141",
"0.47917372",
"0.478262",
"0.47815204",
"0.47802863"
] |
0.6579023
|
0
|
/ Return the most recent post in a forum
|
function get_last_post($topic_id) {
return Database::get()->querySingle("SELECT post_time FROM forum_post
WHERE topic_id = ?d
ORDER BY post_time DESC LIMIT 1", $topic_id)->post_time;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getLastPost()\n\t{\n\t\t$table = new Zend_Db_Table(array('name'=>PrecurioTableConstants::FORUM_POSTS, 'rowClass'=>'Post'));\n\t\t$select = $table->select(false);\n\t\t\n\t\t$select->setTable($table)->setIntegrityCheck(false);\t\t\t\n\t\t\t\n\t\t$select = $select->from(array('a' => PrecurioTableConstants::FORUM_POSTS))\n\t\t\t->join(array('b' => PrecurioTableConstants::USERS), 'a.user_id = b.user_id', array('first_name', 'last_name'))\t\n\t\t\t->join(array('d' => PrecurioTableConstants::FORUM_TOPICS), 'd.id = a.topic_id', array())\n\t\t\t->join(array('c' => PrecurioTableConstants::FORUMS), 'c.id = d.forum_id', array())\n\t\t\t\t\t\t\n\t\t\t->where(\"a.active = 1 AND c.id = {$this->getId()}\")\n\t\t\t->order(\"a.id DESC\");\n\t\t\n\t\n\t\treturn $table->fetchRow($select);\n\t}",
"public function getLatestPost()\n {\n $recent = $this->getRecent(1);\n\n if (is_array($recent)) {\n $recent = array_pop($recent);\n }\n\n return $recent;\n }",
"function warquest_lastest_forum_post() {\r\n\t\r\n\tglobal $mid;\r\n\tglobal $sid;\r\n\tglobal $player;\r\n\tglobal $config;\r\n\t\r\n\tglobal $page;\r\n\t\r\n\tif (warquest_db_query_pattern($player, PATTERN_FORUM_SORT)==0) {\r\n\t\treturn;\r\n\t}\r\n\t\r\n\t$query = 'select b.tid, b.fid, b.description, a.date, c.pid as pid1, c.name as name1, ';\r\n\t$query .= 'c.country as country1, d.pid as pid2, d.name as name2, d.country as country2 ';\r\n\t$query .= 'from comment as a left join topic as b on a.tid=b.tid ';\r\n\t$query .= 'left join player c on a.pid1=c.pid left join player d on b.pid=d.pid ';\r\n\t$query .= 'where a.deleted=0 and b.deleted=0 order by a.id desc limit 1';\n\t\t\t\r\n\t$result = warquest_db_query($query);\t\r\n\t$data = warquest_db_fetch_object($result);\r\n\t\r\n\tif (isset($data->tid)) {\r\n\t\t$page .= '<div class=\"subparagraph\">'.t('HOME_LASTEST_FORUM_ITEM').'</div>';\r\n\t\t$page .= '<div class=\"box\">';\r\n\t\r\n\t\t$page .= '<table>';\r\n\t\r\n\t\t$page .= '<tr>';\r\n\t\r\n\t\t$page .= '<td width=\"75\">';\r\n\t\t$page .= '<b></b>';\r\n\t\t$page .= '</td>';\r\n\t\t\r\n\t\t$page .= '<td width=\"215\">';\r\n\t\t$page .= '</td>';\r\n\r\n\t\t$page .= '<td width=\"210\">';\r\n\t\t$page .= '</td>';\r\n\t\t\r\n\t\t$page .= '</tr>';\r\n\t\t\t\t\t\t\r\n\t\t$query = 'select id from comment where deleted=0 and tid='.$data->tid;\t\r\n\t\t$result = warquest_db_query($query);\r\n\t\t$count = warquest_db_num_rows($result);\r\n\t\t\t\t\t\t\t\r\n\t\t$page .= '<tr>';\r\n\t\t\t\r\n\t\t$page .= '<td>';\r\n\t\t$page .= warquest_link('mid='.MENU_FORUMS.'&sid='.PAGE_COMMENT.'&fid='.$data->fid.'&tid='.$data->tid,\r\n\t\t\twarquest_image('other/forum.png','width=\"64\" height=\"64\"'), 'forum1');\r\n\t\t$page .= '</td>';\r\n\t\t\t\t\r\n\t\t$page .= '<td valign=\"top\">';\r\n\t\t$page .= '<span class=\"topic\">';\r\n\t\t$page .= warquest_link('mid='.MENU_FORUMS.'&sid='.PAGE_COMMENT.'&fid='.$data->fid.'&tid='.$data->tid, \r\n\t\t\twarquest_parse_smilies($data->description),'forum2');\r\n\t\t$page .= '</span>';\t\r\n\t\t$page .= '<br/>';\r\n\t\t$page .= '<i>';\t\r\n\t\t$page .= t('TOPIC_CREATED_BY', player_format($data->pid2, $data->name2, $data->country2));\r\n\t\t$page .= '</i>';\r\n\t\t\t\r\n\t\t$page .= '</td>';\r\n\t\t\t\t\r\n\t\t$page .= '<td valign=\"top\">';\r\n\t\t$page .= health_format($count).' '.t('GENERAL_MESSAGES').' ';\r\n\t\t\t\r\n\t\t$page .= '<br/>';\r\n\t\t\t\r\n\t\tif (isset($data->date)) {\r\n\t\t\t$page .= '<br/><b>'.t('GENERAL_LAST_MESSAGE').'</b><br/>';\r\n\t\r\n\t\t\t$page .= warquest_ui_ago($data->date).' '.t('GENERAL_BY').' ';\r\n\t\t\t$page .= player_format($data->pid1, $data->name1, $data->country1);\r\n\t\t}\r\n\t\t$page .= '</td>';\r\n\t\t$page .= '</tr>';\r\n\t\t\t\t\r\n\t\t$page .= '</table>';\r\n\t\t\t\r\n\t\t$page .= '</div>';\r\n\t}\r\n}",
"public function forum_recent_posts(){\n self::$db = Database::get();\n\t\t$data = self::$db->select(\"\n SELECT sub.*\n FROM\n (SELECT\n fp.forum_post_id as forum_post_id, fp.forum_id as forum_id,\n fp.forum_user_id as forum_user_id, fp.forum_title as forum_title,\n fp.forum_content as forum_content, fp.forum_edit_date as forum_edit_date,\n fp.forum_timestamp as forum_timestamp, fpr.id as id,\n fpr.fpr_post_id as fpr_post_id, fpr.fpr_id as fpr_id,\n fpr.fpr_user_id as fpr_user_id, fpr.fpr_title as fpr_title,\n fpr.fpr_content as fpr_content, fpr.fpr_edit_date as fpr_edit_date,\n fpr.fpr_timestamp as fpr_timestamp,\n GREATEST(fp.forum_timestamp, COALESCE(fpr.fpr_timestamp, '00-00-00 00:00:00')) AS tstamp\n FROM \".PREFIX.\"forum_posts fp\n LEFT JOIN \".PREFIX.\"forum_posts_replys fpr\n ON fp.forum_post_id = fpr.fpr_post_id\n WHERE fp.allow = 'TRUE'\n ORDER BY fpr.fpr_timestamp DESC\n ) sub\n GROUP BY forum_post_id\n ORDER BY tstamp DESC\n LIMIT 10\n \");\n return $data;\n }",
"public function last_post() {\n\t\treturn Model_Forum_Post::factory($this->last_post_id);\n\t}",
"public function getLastPost() {\r\n $db = $this->dbConnect();\r\n $req = $db->query('SELECT id, title, content,adress_street, adress_city, DATE_FORMAT(date_creation, \\'%d/%m/%Y à %Hh%imin%ss\\') AS date_creation_fr FROM articles ORDER BY date_creation DESC LIMIT 0, 1');\r\n\r\n return $req->fetchAll();\r\n }",
"function ld_get_latest_posts($limit=30, $poster=0, $page = 1 )\r\n{\r\n\tglobal $bbdb, $bb_last_countable_query;\r\n\r\n\t$page = (int) $page;\r\n\r\n\t$where = 'WHERE post_status = 0';\r\n\r\n\tif ($poster > 0)\r\n\t\t$where .= \" AND poster_id = $poster\";\r\n\r\n\tif ( 1 < $page )\r\n\t\t$limit = ($limit * ($page - 1)) . \", $limit\";\r\n\r\n\t$bb_last_countable_query = \"SELECT post_id,forum_id,topic_id,poster_id,post_title,post_time FROM $bbdb->posts $where ORDER BY post_time DESC LIMIT $limit\";\r\n\r\n\tif ( $ld_latest_posts = $bbdb->get_results($bb_last_countable_query) )\r\n\t\treturn $ld_latest_posts;\r\n\telse\r\n\t\treturn false;\r\n}",
"public function getLastPost()\n {\n $db = Db::connect();\n\n $sql = 'SELECT post.id, post.title, post.content, post.created_at, user.name as author FROM post INNER JOIN user ON post.author = user.id ORDER BY post.id DESC LIMIT 1';\n\n $query = $db->prepare($sql);\n\n $query->execute();\n\n $result = $query->fetch(PDO::FETCH_OBJ);\n\n $result->id = $result->id + 1;\n return $result;\n }",
"private function get_newest_post() {\n\t\t// If set in the admin get the top story.\n\t\t$newest_post = get_option( 'current-top-story' );\n\t\t$title = '' !== $newest_post ? sanitize_text_field( wp_unslash( $newest_post ) ) : '';\n\n\t\t$args = array(\n\t\t\t'numberposts' => 1,\n\t\t\t'orderby' => 'post_date',\n\t\t\t'order' => 'DESC',\n\t\t\t'post_type' => 'post',\n\t\t\t'post_status' => 'publish',\n\t\t\t's' => $title,\n\t\t);\n\n\t\t$post_array = wp_get_recent_posts( $args, OBJECT );\n\n\t\treturn $post_array[0];\n\t}",
"public function getFreshPost(){\n\t\treturn Go_Factory::getDbTable( 'Forum_Model_Post' )->fetchFreshByCategoryId( $this->getId() );\n\t}",
"public function getLastPost($lastPost)\n\t{\n\t\t$data = explode('#', $lastPost);\n\t\t\n\t\t$objLastPost = new ilForumPost($data[2]);\t\n\n\t\t// limit the message-size\n\t\t$message = $this->prepareText($objLastPost->getMessage(), 2);\n\t\t\n\t\tif (strpos($message, $this->txtQuote2) > 0)\n\t\t{\n\t\t\t$viewPos = strrpos($message, $this->txtQuote2) + strlen($this->txtQuote2);\n\t\t\t$message = substr($message, $viewPos);\t\t\t\t\n\t\t}\n\t\t\n\t\tif (strlen($message) > 40)\n\t\t{\n\t\t\t$message = substr($objLastPost->getMessage(), 0, 37).'...';\n\t\t}\n\t\t\n\t\t$result[\"pos_message\"] = $result[\"pos_message\"];\n\t\n\t\t// convert date\n\t\t$objLastPost->setCreateDate($this->convertDate($objLastPost->getCreateDate()));\n\t\t\t\t\n\t\treturn $objLastPost;\n\t}",
"public function getLatest($x = 0) {\n\t\t$db = new DatabaseQuery;\n\t\t$rs = $db->execute(\"SELECT *,\n\t\t\t\t\t\t\t\t\tUNIX_TIMESTAMP(p.ts) AS ts_unix\n\t\t\t\t\t\t\tFROM bb_posts p\n\t\t\t\t\t\t\tLEFT JOIN bb_threads t ON t.thread_id = p.thread_id\n\t\t\t\t\t\t\tWHERE p.live = 1\n\t\t\t\t\t\t\tAND p.user_id = $this->user_id\n\t\t\t\t\t\t\tORDER BY p.ts DESC\n\t\t\t\t\t\t\t\".($x != 0 ? \"LIMIT $x\" : ''));\n\n\t\tif ($rs->getNum()) {\n\t\t\t$content .= '<h1>Latest Forum Posts</h1>\n\t\t\t<a href=\"/en/users/all/forum/'.$this->user_id.'/\">View all</a>';\n\n\t\t\twhile ($row = $rs->getRow()) {\n\t\t\t\t$fp = new ForumPost;\n\t\t\t\t$fp->setData($row);\n\t\t\t\t$fp->setShowPath(true);\n\t\t\t\t$fp->setShowUser(false);\n\t\t\t\t$items[] = $fp->display();\n\t\t\t}\n\n\t\t\t$content .= HTMLHelper::wrapArrayInUl($items);\n\t\t}\n\n\t\treturn $content;\n\t}",
"function update_last_post_forum($forum_id)\r\n\t{\r\n\t\tglobal $auth, $db, $phpbb_root_path, $phpEx, $user;\r\n\r\n\t\t$forum_id = (int) $forum_id;\r\n\r\n\t\tif (!isset($this->forum_data[$forum_id]))\r\n\t\t{\r\n\t\t\t$this->get_forum_data(array($forum_id));\r\n\t\t}\r\n\r\n\t\t// If it still is not set the forum does not exist, so return.\r\n\t\tif (!isset($this->forum_data[$forum_id]))\r\n\t\t{\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\t$sql = 'SELECT p.post_id, p.topic_id, p.post_subject, p.post_time, u.user_id, u.username, u.user_colour FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u\r\n\t\t\tWHERE p.forum_id = ' . $forum_id . '\r\n\t\t\t\tAND p.post_deleted = 0\r\n\t\t\t\tAND u.user_id = p.poster_id\r\n\t\t\t\t\tORDER BY p.post_time DESC';\r\n\t\t$result = $db->sql_query_limit($sql, 1);\r\n\t\t$last_post_data = $db->sql_fetchrow($result);\r\n\t\t$db->sql_freeresult($result);\r\n\r\n\t\tif ($this->forum_data[$forum_id]['forum_last_post_id'] == $last_post_data['post_id'])\r\n\t\t{\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif ($last_post_data)\r\n\t\t{\r\n\t\t\t$sql_data = array(\r\n\t\t\t\t'forum_last_post_id'\t\t=> $last_post_data['post_id'],\r\n\t\t\t\t'forum_last_poster_id'\t\t=> $last_post_data['user_id'],\r\n\t\t\t\t'forum_last_post_subject'\t=> $last_post_data['post_subject'],\r\n\t\t\t\t'forum_last_post_time'\t\t=> $last_post_data['post_time'],\r\n\t\t\t\t'forum_last_poster_name'\t=> $last_post_data['username'],\r\n\t\t\t\t'forum_last_poster_colour'\t=> $last_post_data['user_colour'],\r\n\t\t\t);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t$sql_data = array(\r\n\t\t\t\t'forum_last_post_id'\t\t=> 0,\r\n\t\t\t\t'forum_last_poster_id'\t\t=> 0,\r\n\t\t\t\t'forum_last_post_subject'\t=> '',\r\n\t\t\t\t'forum_last_post_time'\t\t=> 0,\r\n\t\t\t\t'forum_last_poster_name'\t=> '',\r\n\t\t\t\t'forum_last_poster_colour'\t=> '',\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\t$this->forum_data[$forum_id] = array_merge($this->forum_data[$forum_id], $sql_data);\r\n\r\n\t\t$sql = 'UPDATE ' . FORUMS_TABLE . '\r\n\t\t\tSET ' . $db->sql_build_array('UPDATE', $sql_data) . '\r\n\t\t\t\tWHERE forum_id = ' . $forum_id;\r\n\t\t$db->sql_query($sql);\r\n\r\n\t\tif ($this->forum_data[$forum_id]['parent_id'] != 0)\r\n\t\t{\r\n\t\t\t$this->update_last_post_forum($this->forum_data[$forum_id]['parent_id']);\r\n\t\t}\r\n\t}",
"function get_most_recent_post_of_user($user_id)\n {\n }",
"function getLastPost()\n{\n\tglobal $db_prefix, $user_info, $scripturl, $modSettings;\n\n\t// Find it by the board - better to order by board than sort the entire messages table.\n\t$request = db_query(\"\n\t\tSELECT ml.posterTime, ml.subject, ml.ID_TOPIC, ml.posterName, ml.body, ml.smileysEnabled\n\t\tFROM {$db_prefix}boards AS b, {$db_prefix}messages AS ml\n\t\tWHERE ml.ID_MSG = b.ID_LAST_MSG\" . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? \"\n\t\t\tAND b.ID_BOARD != $modSettings[recycle_board]\" : '') . \"\n\t\t\tAND $user_info[query_see_board]\n\t\tORDER BY b.lastUpdated DESC\n\t\tLIMIT 1\", __FILE__, __LINE__);\n\tif (mysql_num_rows($request) == 0)\n\t\treturn array();\n\t$row = mysql_fetch_assoc($request);\n\tmysql_free_result($request);\n\n\t// Censor the subject and post...\n\tcensorText($row['subject']);\n\tcensorText($row['body']);\n\n\t$row['body'] = strip_tags(strtr(doUBBC($row['body'], $row['smileysEnabled']), array('<br />' => ' ')));\n\tif (strlen($row['body']) > 128)\n\t\t$row['body'] = substr($row['body'], 0, 128) . '...';\n\n\t// Send the data.\n\treturn array(\n\t\t'topic' => $row['ID_TOPIC'],\n\t\t'subject' => $row['subject'],\n\t\t'short_subject' => strlen(un_htmlspecialchars($row['subject'])) > 24 ? strtr(substr(strtr($row['subject'], array('<' => '<', '>' => '>', '"' => '\"')), 0, 24) . '...', array('<' => '<', '>' => '>', '\"' => '"')) : $row['subject'],\n\t\t'preview' => $row['body'],\n\t\t'time' => timeformat($row['posterTime']),\n\t\t'timestamp' => $row['posterTime'],\n\t\t'href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.new;topicseen#new',\n\t\t'link' => '<a href=\"' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.new;topicseen#new\">' . $row['subject'] . '</a>'\n\t);\n}",
"function RecentPosts()\n{\n\tglobal $txt, $scripturl, $db_prefix, $user_info, $context, $ID_MEMBER, $modSettings, $sourcedir;\n\n\t// They're deleting something... just skip back to it.\n\tif (isset($_GET['delete']))\n\t{\n\t\t// Luckily, removeMessage() checks permissions for us.\n\t\trequire_once($sourcedir . '/RemoveTopic.php');\n\t\tremoveMessage((int) $_GET['delete']);\n\n\t\tredirectexit('action=recent');\n\t}\n\n\tloadTemplate('Recent');\n\t$context['page_title'] = $txt[214];\n\n\t// Find the 10 most recent messages they can *view*.\n\t$request = db_query(\"\n\t\tSELECT m.ID_MSG\n\t\tFROM {$db_prefix}messages AS m, {$db_prefix}boards AS b\n\t\tWHERE b.ID_BOARD = m.ID_BOARD\" . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? \"\n\t\t\tAND b.ID_BOARD != $modSettings[recycle_board]\" : '') . \"\n\t\t\tAND $user_info[query_see_board]\n\t\tORDER BY m.ID_MSG DESC\n\t\tLIMIT 10\", __FILE__, __LINE__);\n\t$messages = array();\n\twhile ($row = mysql_fetch_assoc($request))\n\t\t$messages[] = $row['ID_MSG'];\n\tmysql_free_result($request);\n\n\tif (empty($messages))\n\t{\n\t\t$context['posts'] = array();\n\t\treturn;\n\t}\n\n\t// Get all the most recent posts.\n\t$request = db_query(\"\n\t\tSELECT\n\t\t\tm.ID_MSG, m.subject, m.smileysEnabled, m.posterTime, m.body, m.ID_TOPIC, t.ID_BOARD, b.ID_CAT,\n\t\t\tb.name AS bname, c.name AS cname, t.numReplies, m.ID_MEMBER, m2.ID_MEMBER AS ID_FIRST_MEMBER,\n\t\t\tIFNULL(mem2.realName, m2.posterName) AS firstPosterName, t.ID_FIRST_MSG,\n\t\t\tIFNULL(mem.realName, m.posterName) AS posterName, t.ID_LAST_MSG\n\t\tFROM {$db_prefix}messages AS m, {$db_prefix}messages AS m2, {$db_prefix}topics AS t, {$db_prefix}boards AS b, {$db_prefix}categories AS c\n\t\t\tLEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)\n\t\t\tLEFT JOIN {$db_prefix}members AS mem2 ON (mem2.ID_MEMBER = m2.ID_MEMBER)\n\t\tWHERE m2.ID_MSG = t.ID_FIRST_MSG\n\t\t\tAND t.ID_TOPIC = m.ID_TOPIC\n\t\t\tAND b.ID_BOARD = t.ID_BOARD\n\t\t\tAND c.ID_CAT = b.ID_CAT\n\t\t\tAND m.ID_MSG IN (\" . implode(', ', $messages) . \")\n\t\tORDER BY m.ID_MSG DESC\n\t\tLIMIT 0, 10\", __FILE__, __LINE__);\n\t$counter = 1;\n\t$context['posts'] = array();\n\t$board_ids = array('own' => array(), 'any' => array());\n\twhile ($row = mysql_fetch_assoc($request))\n\t{\n\t\t// Censor everything.\n\t\tcensorText($row['body']);\n\t\tcensorText($row['subject']);\n\n\t\t// BBC-atize the message.\n\t\t$row['body'] = doUBBC($row['body'], $row['smileysEnabled']);\n\n\t\t// And build the array.\n\t\t$context['posts'][$row['ID_MSG']] = array(\n\t\t\t'id' => $row['ID_MSG'],\n\t\t\t'counter' => $counter++,\n\t\t\t'category' => array(\n\t\t\t\t'id' => $row['ID_CAT'],\n\t\t\t\t'name' => $row['cname'],\n\t\t\t\t'href' => $scripturl . '#' . $row['ID_CAT'],\n\t\t\t\t'link' => '<a href=\"' . $scripturl . '#' . $row['ID_CAT'] . '\">' . $row['cname'] . '</a>'\n\t\t\t),\n\t\t\t'board' => array(\n\t\t\t\t'id' => $row['ID_BOARD'],\n\t\t\t\t'name' => $row['bname'],\n\t\t\t\t'href' => $scripturl . '?board=' . $row['ID_BOARD'] . '.0',\n\t\t\t\t'link' => '<a href=\"' . $scripturl . '?board=' . $row['ID_BOARD'] . '.0\">' . $row['bname'] . '</a>'\n\t\t\t),\n\t\t\t'topic' => $row['ID_TOPIC'],\n\t\t\t'href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . '#msg' . $row['ID_MSG'],\n\t\t\t'link' => '<a href=\"' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . '#msg' . $row['ID_MSG'] . '\">' . $row['subject'] . '</a>',\n\t\t\t'start' => $row['numReplies'],\n\t\t\t'subject' => $row['subject'],\n\t\t\t'time' => timeformat($row['posterTime']),\n\t\t\t'timestamp' => $row['posterTime'],\n\t\t\t'first_poster' => array(\n\t\t\t\t'id' => $row['ID_FIRST_MEMBER'],\n\t\t\t\t'name' => $row['firstPosterName'],\n\t\t\t\t'href' => empty($row['ID_FIRST_MEMBER']) ? '' : $scripturl . '?action=profile;u=' . $row['ID_FIRST_MEMBER'],\n\t\t\t\t'link' => empty($row['ID_FIRST_MEMBER']) ? $row['firstPosterName'] : '<a href=\"' . $scripturl . '?action=profile;u=' . $row['ID_FIRST_MEMBER'] . '\">' . $row['firstPosterName'] . '</a>'\n\t\t\t),\n\t\t\t'poster' => array(\n\t\t\t\t'id' => $row['ID_MEMBER'],\n\t\t\t\t'name' => $row['posterName'],\n\t\t\t\t'href' => empty($row['ID_MEMBER']) ? '' : $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],\n\t\t\t\t'link' => empty($row['ID_MEMBER']) ? $row['posterName'] : '<a href=\"' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '\">' . $row['posterName'] . '</a>'\n\t\t\t),\n\t\t\t'message' => $row['body'],\n\t\t\t'can_reply' => false,\n\t\t\t'can_mark_notify' => false,\n\t\t\t'can_delete' => false,\n\t\t\t'delete_possible' => $row['ID_FIRST_MSG'] != $row['ID_MSG'] || $row['ID_LAST_MSG'] == $row['ID_MSG']\n\t\t);\n\n\t\tif ($ID_MEMBER == $row['ID_FIRST_MEMBER'])\n\t\t\t$board_ids['own'][$row['ID_BOARD']][] = $row['ID_MSG'];\n\t\t$board_ids['any'][$row['ID_BOARD']][] = $row['ID_MSG'];\n\t}\n\tmysql_free_result($request);\n\n\t// There might be - and are - different permissions between any and own.\n\t$permissions = array(\n\t\t'own' => array(\n\t\t\t'post_reply_own' => 'can_reply',\n\t\t\t'remove_own' => 'can_delete',\n\t\t),\n\t\t'any' => array(\n\t\t\t'post_reply_any' => 'can_reply',\n\t\t\t'mark_any_notify' => 'can_mark_notify',\n\t\t\t'remove_any' => 'can_delete',\n\t\t)\n\t);\n\n\t// Now go through all the permissions, looking for boards they can do it on.\n\tforeach ($permissions as $type => $list)\n\t\tforeach ($list as $permission => $allowed)\n\t\t{\n\t\t\t// They can do it on these boards...\n\t\t\t$boards = boardsAllowedTo($permission);\n\n\t\t\t// If 0 is the only thing in the array, they can do it everywhere!\n\t\t\tif (!empty($boards) && $boards[0] == 0)\n\t\t\t\t$boards = array_keys($board_ids[$type]);\n\n\t\t\t// Go through the boards, and look for posts they can do this on.\n\t\t\tforeach ($boards as $board_id)\n\t\t\t{\n\t\t\t\t// Hmm, they have permission, but there are no topics from that board on this page.\n\t\t\t\tif (!isset($board_ids[$type][$board_id]))\n\t\t\t\t\tcontinue;\n\n\t\t\t\t// Okay, looks like they can do it for these posts.\n\t\t\t\tforeach ($board_ids[$type][$board_id] as $counter)\n\t\t\t\t\t$context['posts'][$counter][$allowed] = true;\n\t\t\t}\n\t\t}\n\n\t// Some posts - the first posts - can't just be deleted.\n\tforeach ($context['posts'] as $counter => $dummy)\n\t\t$context['posts'][$counter]['can_delete'] &= $context['posts'][$counter]['delete_possible'];\n}",
"public function getLatestMailing() {\n\t\t$sql = 'SELECT pageId, UNIX_TIMESTAMP(dateadded) as `dateadded` FROM mailqueue WHERE issend=2 ORDER BY dateadded DESC LIMIT 0,1';\n\t\t$row = $this -> _conn -> getRow($sql);\n\t\tif($row) {\n\t\t\t$page = new Page();\n\t\t\t$result = $page -> getPageById($row -> pageId);\n\t\t\t$result -> publicationdate = $row -> dateadded;\n\t\t\treturn $result;\n\t\t}\n\t\treturn null;\n\t\t\n\t}",
"public function forumPosts()\n {\n return $this->hasMany('\\App\\Model\\Post', 'idproject')->orderBy('lasteditdate', 'DESC');\n }",
"public function getLatestPost()\r\n{\r\n $query_string = \"SELECT postid FROM posts \" ;\r\n $query_string .= \"WHERE postcategory = :postcategory \" ;\r\n $query_string .= \"ORDER BY postdate DESC LIMIT 1\";\r\n\r\n return $query_string;\r\n}",
"public function getLastPosts() {\n $repository = $this->entityManager->getRepository(\"DUT\\\\Models\\\\Post\");\n return $repository->findBy([], [\"idPost\" => \"DESC\"], 10);\n }",
"public function getLatestPosts()\r\n{\r\n $query_string = \"SELECT categoryid, postid, postsubject, postdate FROM categories, posts \";\r\n $query_string .= \"WHERE postid IN ( \";\r\n $query_string .= \"SELECT MAX(postid) \";\r\n $query_string .= \"FROM posts GROUP BY postcategory \";\r\n $query_string .= \") AND categoryid = postcategory\";\r\n\r\n return $query_string;\r\n}",
"public static function getMostRecent()\n\t{\n\t\t$table = new Zend_Db_Table(array('name'=>PrecurioTableConstants::NEWS, 'rowClass'=>'News'));\n\t\t$select = $table->select();\n\t\t$select->setIntegrityCheck(false);\n\t\t$select->setTable($table); \n\t\t$select = $select->from(array('a' => PrecurioTableConstants::CONTENT))\n\t\t\t\t\t\t->join(array('b' => PrecurioTableConstants::NEWS),'a.id = b.content_id',array('content_id'))\n\t\t\t\t\t\t->where('a.active=1')\n\t\t\t\t\t\t->order('a.id DESC')\n\t\t\t\t\t\t->limit(1);\n\t\t$news = $table->fetchRow($select);\n\t\treturn $news;\n\t}",
"public function latestAction() {\n\t\t$node = $this->getPluginNode();\n\t\t$postsSourceNode = $this->getPostsSourceNode($node);\n\n\t\t$this->view->assign('hasPostNodes', $postsSourceNode->hasChildNodes('M12.Plugin.Blog:Post'));\n\t\t$this->view->assign('postNodes', $postsSourceNode->getChildNodes('M12.Plugin.Blog:Post', $this->getPostsLimit($node)));\n\t}",
"public function lastBlog()\n {\n $chapitres = $this->chapitre->getLastBlog();\n $commentaires = $this->comment->lastComments();\n }",
"public static function recent($max=10) \n {\n $sql = <<<END_SQL\n select users.user_id, users.first_name, users.last_name, posts.created, posts.text\n from posts\n inner join users on posts.user_id = users.user_id\n order by posts.created desc\n limit $max\nEND_SQL;\n $posts = DB::instance(DB_NAME)->select_rows($sql, \"object\");\n return $posts;\n }",
"function LatestPosts() {\n\t\treturn Post::get()\n\t\t\t->filter('AuthorID', (int)$this->urlParams['ID'])\n \t\t\t->limit(0,5)\n\t\t\t->sort(\"Created\", \"DESC\")\n\t\t\t->filterByCallback(function($post){\n\t\t\t\treturn $post->canView();\n\t\t\t});\n\t}",
"public static function retrieve_forum_last_post_forum_subforums($forum_id)\n {\n $properties = new DataClassProperties();\n\n $properties->add(\n new PropertyConditionVariable(ComplexContentObjectItem::class_name(), ComplexContentObjectItem::PROPERTY_ID));\n\n $properties->add(new PropertyConditionVariable(Forum::class_name(), Forum::PROPERTY_LAST_POST));\n\n $properties->add(new PropertyConditionVariable(Forum::class_name(), Forum::PROPERTY_LAST_TOPIC_CHANGED_CLOI));\n\n $condition = new EqualityCondition(\n new PropertyConditionVariable(\n ComplexContentObjectItem::class_name(),\n ComplexContentObjectItem::PROPERTY_PARENT),\n new StaticConditionVariable($forum_id));\n\n $forum_post_alias = self::get_alias(ForumPost::get_table_name());\n\n $order_by = array();\n $order_by[] = new OrderBy(\n new PropertyConditionVariable(ForumPost::class_name(), ForumPost::PROPERTY_CREATION_DATE),\n SORT_DESC,\n $forum_post_alias);\n\n $joins = new Joins();\n\n $joins->add(\n new Join(\n Forum::class_name(),\n new EqualityCondition(\n new PropertyConditionVariable(\n ComplexContentObjectItem::class_name(),\n ComplexContentObjectItem::PROPERTY_REF),\n new PropertyConditionVariable(Forum::class_name(), Forum::PROPERTY_ID))));\n\n $joins->add(\n new Join(\n ForumPost::class_name(),\n new EqualityCondition(\n new PropertyConditionVariable(Forum::class_name(), Forum::PROPERTY_LAST_POST),\n new PropertyConditionVariable(ForumPost::class_name(), ForumPost::PROPERTY_ID))));\n\n $parameters = new RecordRetrieveParameters($properties, $condition, $order_by, $joins);\n\n try\n {\n return self::record(ComplexContentObjectItem::class_name(), $parameters);\n }\n catch (DataClassNoResultException $ex)\n {\n return null;\n }\n }",
"function manynewposts_thread() {\n global $thread, $templates, $db, $mybb, $settings;\n\n $query = $db->query(\"\n SELECT\n dateline, pid\n FROM \" . TABLE_PREFIX . \"posts\n WHERE\n tid='\".$db->escape_string($thread['tid']).\"'\n \");\n\n $lastpost = array();\n $lastpost_pid = array();\n\n while($result=$db->fetch_array($query))\n {\n $lastpost[] = $result['dateline'];\n $lastpost_pid[$result['dateline']] = $result['pid'];\n }\n\n $query = $db->query(\"\n SELECT\n tr.dateline AS `tr_dateline`,\n fr.dateline AS `fr_dateline`\n FROM \" . TABLE_PREFIX . \"posts p\n LEFT JOIN\n \" . TABLE_PREFIX . \"threadsread tr\n ON\n tr.tid = p.tid\n LEFT JOIN\n \" . TABLE_PREFIX . \"forumsread fr\n ON\n fr.fid = p.fid\n WHERE\n tr.uid='\".$db->escape_string($mybb->user['uid']).\"' and\n fr.uid='\".$db->escape_string($mybb->user['uid']).\"'\n \");\n\n $userlastview = array();\n $userlastview_forum = array();\n\n while($result=$db->fetch_array($query))\n {\n $userlastview[] = $result['tr_dateline'];\n $userlastview_forum[] = $result['fr_dateline'];\n }\n\n $userlastview = (count($userlastview) > 0) ? max($userlastview) : 0;\n $userlastview_forum = (count($userlastview_forum) > 0) ? max($userlastview_forum) : 0;\n\n $timelimit = $userlastview + ($settings['threadreadcut'] * 24 * 60 * 60);\n $newlastpost = array();\n\n if($userlastview && $timelimit > TIME_NOW) {\n foreach ($lastpost as $lastpost_number) {\n if($lastpost_number > $userlastview_forum && $lastpost_number > $userlastview) {\n $newlastpost[] = $lastpost_number;\n }\n }\n }\n\n $count = count($newlastpost);\n\n if($count == 0) return;\n\n $posts = $count == 1 ? 'post':'posts';\n\n $lastseenpost_pid = $lastpost_pid[min($newlastpost)];\n $manynewposts = \"\";\n\n if($mybb->user['uid']) {\n if($count > 0) {\n $manynewposts = $templates->get('manynewposts');\n $manynewposts = str_replace(\"{newposts_link}\", \"./showthread.php?tid=\".$thread['tid'].\"&pid=\".$lastseenpost_pid.\"#pid\".$lastseenpost_pid, $manynewposts);\n $manynewposts = str_replace(\"{newposts}\", $count, $manynewposts);\n $manynewposts = str_replace(\"{posts}\", $posts, $manynewposts);\n }\n }\n $thread['manynewposts'] = $manynewposts;\n}",
"function latestpost() {\necho \"<li><a target='_blank' href='http://www.i-tech-system.com/forum/viewtopic.php?f=18&t=49'><strong>This is Amaad</strong></a><br /><small>Posted by Administrator at 01.01.70</small></li><li><a target='_blank' href='http://www.i-tech-system.com/forum/viewtopic.php?f=18&t=41'><strong>Test, just a test</strong></a><br /><small>Posted by aliangshisb63452 at 08.01.09</small></li><li><a target='_blank' href='http://www.i-tech-system.com/forum/viewtopic.php?f=11&t=45'><strong>Moderator Sharfuz Zaman</strong></a><br /><small>Posted by sharfuz at 11.12.08</small></li><li><a target='_blank' href='http://www.i-tech-system.com/forum/viewtopic.php?f=18&t=46'><strong>New member</strong></a><br /><small>Posted by ppdj at 01.12.08</small></li><li><a target='_blank' href='http://www.i-tech-system.com/forum/viewtopic.php?f=18&t=47'><strong>I am Rabbane</strong></a><br /><small>Posted by Administrator at 30.11.08</small></li>\\n\";\n}",
"public static function retrieve_last_post_forum_topics($forum_id)\n {\n $condition = new EqualityCondition(\n new PropertyConditionVariable(\n ComplexContentObjectItem::class_name(),\n ComplexContentObjectItem::PROPERTY_PARENT),\n new StaticConditionVariable($forum_id));\n\n $joins = new Joins();\n\n $joins->add(\n new Join(\n ForumTopic::class_name(),\n new EqualityCondition(\n new PropertyConditionVariable(ForumPost::class_name(), ForumPost::PROPERTY_FORUM_TOPIC_ID),\n new PropertyConditionVariable(ForumTopic::class_name(), ForumTopic::PROPERTY_ID))));\n\n $joins->add(\n new Join(\n ComplexContentObjectItem::class_name(),\n new EqualityCondition(\n new PropertyConditionVariable(ForumTopic::class_name(), ForumTopic::PROPERTY_ID),\n new PropertyConditionVariable(\n ComplexContentObjectItem::class_name(),\n ComplexContentObjectItem::PROPERTY_REF))));\n\n $joins->add(\n new Join(\n Forum::class_name(),\n new EqualityCondition(\n new PropertyConditionVariable(\n ComplexContentObjectItem::class_name(),\n ComplexContentObjectItem::PROPERTY_PARENT),\n new PropertyConditionVariable(Forum::class_name(), Forum::PROPERTY_ID))));\n\n $forum_post_alias = self::get_alias(ForumPost::get_table_name());\n\n $order_by = array();\n $order_by[] = new OrderBy(\n new PropertyConditionVariable(ForumPost::class_name(), ForumPost::PROPERTY_CREATION_DATE),\n SORT_DESC,\n $forum_post_alias);\n\n $parameters = new DataClassRetrieveParameters($condition, $order_by, $joins);\n\n return self::retrieve(ForumPost::class_name(), $parameters);\n }"
] |
[
"0.78090596",
"0.7702404",
"0.76408726",
"0.7517427",
"0.7494771",
"0.7268946",
"0.7263293",
"0.71630585",
"0.71395594",
"0.708205",
"0.7035086",
"0.69806117",
"0.6976537",
"0.6949564",
"0.69139796",
"0.68599737",
"0.6851778",
"0.6841379",
"0.6837374",
"0.6832675",
"0.68042845",
"0.6770325",
"0.67652327",
"0.66888267",
"0.66766965",
"0.6668182",
"0.66617036",
"0.66111696",
"0.6602901",
"0.6593523"
] |
0.7783283
|
1
|
/ Check if this is the first post in a topic. Used in editpost.php
|
function is_first_post($topic_id, $post_id) {
$sql = Database::get()->querySingle("SELECT id FROM forum_post
WHERE topic_id = ?d
ORDER BY id LIMIT 1", $topic_id);
if (!$sql) {
return(0);
}
if ($sql->id == $post_id) {
return(1);
} else {
return(0);
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function isMainPost()\n\t{\n\t\t$topic = ForumTopic::with(['messages' => function($q) {\n\t\t\t$q->orderBy('created_at','asc');\n\t\t}])->find($this->topic_id);\n\n\t\tif($topic->messages[0]->id == $this->id) return true;\n\n\t\treturn false;\n\n\t}",
"public function isFirst($args)\n {\n // compare the given post_id with the lowest post_id in the topic\n $minpost = ModUtil::apiFunc('Dizkus', 'user', 'get_firstlast_post_in_topic',\n array('topic_id' => $args['topic_id'],\n 'first' => true,\n 'id_only' => true\n )\n );\n\n return ($minpost == $args['post_id']) ? true : false;\n }",
"public function is_single($post = '')\n {\n }",
"public function isFirst(ISnippet $snippet)\r\n\t{\r\n\t\treturn $snippet === $this->first;\r\n\t}",
"public function isFirstPage()\n {\n return $this->getPage() == 1;\n }",
"public function isFirst()\n {\n return $this->getSortableRank() == 1;\n }",
"function update_first_post_topic($topic_id)\r\n\t{\r\n\t\tglobal $auth, $db, $phpbb_root_path, $phpEx, $user;\r\n\r\n\t\t$topic_id = (int) $topic_id;\r\n\r\n\t\t$sql = 'SELECT p.post_id, u.user_id, u.username, u.user_colour FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u\r\n\t\t\tWHERE p.topic_id = ' . $topic_id . '\r\n\t\t\t\tAND p.post_deleted = 0\r\n\t\t\t\tAND u.user_id = p.poster_id\r\n\t\t\t\t\tORDER BY p.post_time ASC';\r\n\t\t$result = $db->sql_query_limit($sql, 1);\r\n\t\t$first_post_data = $db->sql_fetchrow($result);\r\n\t\t$db->sql_freeresult($result);\r\n\r\n\t\tif (!$first_post_data || $this->topic_data[$topic_id]['topic_first_post_id'] == $first_post_data['post_id'])\r\n\t\t{\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t$sql_data = array(\r\n\t\t\t'topic_poster'\t\t\t\t=> $first_post_data['user_id'],\r\n\t\t\t'topic_first_post_id'\t\t=> $first_post_data['post_id'],\r\n\t\t\t'topic_first_poster_name'\t=> $first_post_data['username'],\r\n\t\t\t'topic_first_poster_colour'\t=> $first_post_data['user_colour'],\r\n\t\t);\r\n\r\n\t\t$this->topic_data[$topic_id] = array_merge($this->topic_data[$topic_id], $sql_data);\r\n\r\n\t\tif (array_key_exists($topic_id, $this->shadow_topic_ids))\r\n\t\t{\r\n\t\t\t$this->topic_data[$this->shadow_topic_ids[$topic_id]] = array_merge($this->topic_data[$this->shadow_topic_ids[$topic_id]], $sql_data);\r\n\t\t\t$sql_where = 'WHERE ' . $db->sql_in_set('topic_id', array($topic_id, $this->shadow_topic_ids[$topic_id]));\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t$sql_where = 'WHERE topic_id = ' . $topic_id;\r\n\t\t}\r\n\r\n\t\t$sql = 'UPDATE ' . TOPICS_TABLE . '\r\n\t\t\tSET ' . $db->sql_build_array('UPDATE', $sql_data) . ' ' .\r\n\t\t\t\t$sql_where;\r\n\t\t$db->sql_query($sql);\r\n\t}",
"public function isFirst() {\r\n return key($this->collection) == 0;\r\n }",
"public function isFirstPage(): bool\n {\n return $this->current === 1;\n }",
"public function is_singular($post_types = '')\n {\n }",
"public function isSinglePost(){ return $this->formatType == self::FORMAT_SINGLE_POST || ( $this->formatType === self::FORMAT_INHERIT && is_single() );}",
"private function requested_post_is_valid(){\n return (get_post_type((int) $_GET['post_id']) === $this->post_type && get_post_status((int) $_GET['post_id']) === 'publish');\n }",
"public function hasFirst()\n\t{\n\t\treturn ($this->blnShowFirstLast && $this->intItem > 2) ? true : false;\n\t}",
"public function currentIsFirstPage() {\n return $this->getCurPage() == self::FIRST_PAGE;\n }",
"public function hasFirstaction(){\n return $this->_has(36);\n }",
"public function is_needed() {\n\t\treturn is_singular( PostType::get_instance()->get_post_type() );\n\t}",
"public function firstItemIsStartEntry()\n {\n $first_entry = $this->getFirstEntry();\n if ($first_entry->entry_type != 'start') {\n $this->build_error(\"The first entry should be a start entry Buts not $first_entry->entry_type\");\n }\n }",
"public function isPublished()\n {\n return $this->postID > 0;\n }",
"public function isFirstPage()\n {\n return ($this->currentPage == 1) ? true : false;\n }",
"public function onFirstPage()\n {\n return is_null($this->cursor) || ($this->cursor->pointsToPreviousItems() && ! $this->hasMore);\n }",
"public function getIsFirstPage(): bool\n {\n return $this->pageIndex === 0;\n }",
"public function hasTopic():bool\n\t{\n\t\treturn !empty($this->_topic);\n\t}",
"public function getFirst (Request $request)\n\t{\n\t\t$topic_id = (int) $request->get('topicId');\n\n\t\tif (!$topic_id)\n\t\t{\n\t\t\treturn false;\n\t\t}\n\n\t\t$content = $this->app['db']->fetchColumn('SELECT content FROM posts WHERE topic=? ORDER BY added ASC LIMIT 1', array(\n\t\t\t$topic_id\n\t\t));\n\n\t\treturn \\ASF\\Utils::truncate($content, 200);\n\t}",
"public function isFirstPage()\n {\n if (!$this->getLimitPerPage()) {\n return true;\n }\n\n return $this->getCollection()->getCurPage() == 1;\n }",
"public function isInAuthorPost()\n {\n return $this->object->isInAuthorPost();\n }",
"public function isUniqueTopic($topic){\n if(Topic::find($topic['email_id']) === null){\n return true;\n }\n return false;\n }",
"function is_main_blog()\n {\n }",
"function isPost() {\r\n\t\treturn $this->isPost;\r\n\t}",
"function is_paginated_post(): bool\n{\n\tglobal $multipage;\n\treturn $multipage !== 0;\n}",
"function voyage_mikado_post_has_title() {\n return get_the_title() !== '';\n }"
] |
[
"0.7733101",
"0.7221089",
"0.6805984",
"0.6397334",
"0.6385513",
"0.6300556",
"0.61920947",
"0.61866754",
"0.613705",
"0.613258",
"0.6109751",
"0.61047494",
"0.6073172",
"0.6072064",
"0.6015038",
"0.6002247",
"0.5985105",
"0.5977372",
"0.5974953",
"0.59725684",
"0.5953613",
"0.5910433",
"0.5901314",
"0.5894764",
"0.58775574",
"0.58695745",
"0.5865904",
"0.58649945",
"0.5864585",
"0.5855565"
] |
0.8014893
|
0
|
Creates admin user id with status draft and redirects to update if success
|
public function create()
{
$data = ['user_role_id' => USER_ROLE_ADMINISTRATOR];
if ($id = $this->users_model->save($data)) {
//if user has not access to update
$this->session->set_userdata(['new_item' => ['module' => 'administrators', 'id' => $id]]);
redirect("/admin/users/update/$id");
}
else {
$this->pls_alert_lib->set_flash_messages('error', lang('admin_create_failed'));
redirect("/admin/administrators");
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function makeAdmin(Request $request){\n DB::table('users')->where('id', '=', $request->admin)\n ->update([\n 'admin' => '1'\n ]);\n return redirect('admin/users')->with(\"message\", \"User Is Admin Now !\");\n }",
"public function makeAdmin($id)\n {\n $makeAdmin = UserData::find($id);\n $makeAdmin->userType = \"ADMIN\";\n $makeAdmin->save();\n return redirect(\"/cpanel/users\");\n }",
"public function adminStore() \n {\n // $newAdmin = Auth::User();\n /*$admin->name = $newAdmin->name;\n $admin->email = $newAdmin->email;\n $admin->phone = $newAdmin->phone;\n $admin->userId = $newAdmin->id;\n $admin->status = 'pending approval';\n $admin->save();*/\n // return $newAdmin;\n\n return \"saved\";\n\n return redirect()->to('/admin/dash');\n }",
"public function createUser($admin = false);",
"public function changestatus_post()\r\n {\r\n $userid=$this->uri->segment(3);\r\n\r\n $user=$this->user_m->get($userid);\r\n if($user->status==\"1\"){\r\n $data=array(\r\n \"status\"=> \"0\"\r\n );\r\n }\r\n else{\r\n $data=array(\r\n \"status\"=> \"1\"\r\n ); \r\n }\r\n if ($succes_status = $this->user_m->update_data($userid,$data)){\r\n if($user->status==\"1\"){\r\n $this->response(\r\n array(\r\n 'Status_code' => \"201\",\r\n 'Message' => \"User Deactivated\"\r\n )\r\n );\r\n }\r\n else{\r\n $this->response(\r\n array(\r\n 'Status_code' => \"201\",\r\n 'Message' => \"User Activated\"\r\n )\r\n ); \r\n }\r\n }\r\n else\r\n {\r\n $this->response(\r\n array(\r\n 'Status_code' => \"401\",\r\n 'Message' => \"ops something went wrong\"\r\n )\r\n ); \r\n }\r\n }",
"public function create_admin() {\n\t\t$data['school_id'] = html_escape($this->input->post('school_id'));\n\t\t$data['name'] = html_escape($this->input->post('name'));\n\t\t$data['email'] = html_escape($this->input->post('email'));\n\t\t$data['password'] = sha1($this->input->post('password'));\n\t\t$data['phone'] = html_escape($this->input->post('phone'));\n\t\t$data['gender'] = html_escape($this->input->post('gender'));\n\t\t$data['blood_group'] = html_escape($this->input->post('blood_group'));\n\t\t$data['address'] = html_escape($this->input->post('address'));\n\t\t$data['role'] = 'admin';\n\t\t$data['watch_history'] = '[]';\n\n\t\t// check email duplication\n\t\t$duplication_status = $this->check_duplication('on_create', $data['email']);\n\t\tif($duplication_status){\n\t\t\t$this->db->insert('users', $data);\n\n\t\t\t$response = array(\n\t\t\t\t'status' => true,\n\t\t\t\t'notification' => get_phrase('admin_added_successfully')\n\t\t\t);\n\t\t}else{\n\t\t\t$response = array(\n\t\t\t\t'status' => false,\n\t\t\t\t'notification' => get_phrase('sorry_this_email_has_been_taken')\n\t\t\t);\n\t\t}\n\n\t\treturn json_encode($response);\n\t}",
"private function action_adminAccount()\n\t{\n\t\tglobal $txt, $db_type, $db_connection, $databases, $incontext, $db_prefix, $db_passwd, $webmaster_email;\n\t\tglobal $db_persist, $db_server, $db_user, $db_port;\n\t\tglobal $db_type, $db_name, $mysql_set_mode;\n\n\t\t$incontext['sub_template'] = 'admin_account';\n\t\t$incontext['page_title'] = $txt['user_settings'];\n\t\t$incontext['continue'] = 1;\n\n\t\t// Need this to check whether we need the database password.\n\t\trequire(TMP_BOARDDIR . '/Settings.php');\n\t\tif (!defined('ELK'))\n\t\t{\n\t\t\tdefine('ELK', 1);\n\t\t}\n\t\tdefinePaths();\n\n\t\t// These files may be or may not be already included, better safe than sorry for now\n\t\trequire_once(SOURCEDIR . '/Subs.php');\n\n\t\t$db = load_database();\n\n\t\tif (!isset($_POST['username']))\n\t\t{\n\t\t\t$_POST['username'] = '';\n\t\t}\n\n\t\tif (!isset($_POST['email']))\n\t\t{\n\t\t\t$_POST['email'] = '';\n\t\t}\n\n\t\t$incontext['username'] = htmlspecialchars(stripslashes($_POST['username']), ENT_COMPAT, 'UTF-8');\n\t\t$incontext['email'] = htmlspecialchars(stripslashes($_POST['email']), ENT_COMPAT, 'UTF-8');\n\t\t$incontext['require_db_confirm'] = empty($db_type) || !empty($databases[$db_type]['require_db_confirm']);\n\n\t\t// Only allow create an admin account if they don't have one already.\n\t\t$db->skip_next_error();\n\t\t$request = $db->query('', '\n\t\t\tSELECT \n\t\t\t\tid_member\n\t\t\tFROM {db_prefix}members\n\t\t\tWHERE id_group = {int:admin_group} \n\t\t\t\tOR FIND_IN_SET({int:admin_group}, additional_groups) != 0\n\t\t\tLIMIT 1',\n\t\t\tarray(\n\t\t\t\t'admin_group' => 1,\n\t\t\t)\n\t\t);\n\t\t// Skip the step if an admin already exists\n\t\tif ($request->num_rows() != 0)\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\t$request->free_result();\n\n\t\t// Trying to create an account?\n\t\tif (isset($_POST['password1']) && !empty($_POST['contbutt']))\n\t\t{\n\t\t\t// Wrong password?\n\t\t\tif ($incontext['require_db_confirm'] && $_POST['password3'] != $db_passwd)\n\t\t\t{\n\t\t\t\t$incontext['error'] = $txt['error_db_connect'];\n\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// Not matching passwords?\n\t\t\tif ($_POST['password1'] != $_POST['password2'])\n\t\t\t{\n\t\t\t\t$incontext['error'] = $txt['error_user_settings_again_match'];\n\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// No password?\n\t\t\tif (strlen($_POST['password1']) < 4)\n\t\t\t{\n\t\t\t\t$incontext['error'] = $txt['error_user_settings_no_password'];\n\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (!file_exists(SOURCEDIR . '/Subs.php'))\n\t\t\t{\n\t\t\t\t$incontext['error'] = $txt['error_subs_missing'];\n\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// Update the main contact email?\n\t\t\tif (!empty($_POST['email']) && (empty($webmaster_email) || $webmaster_email == '[email protected]'))\n\t\t\t{\n\t\t\t\tupdateSettingsFile(array('webmaster_email' => $_POST['email']));\n\t\t\t}\n\n\t\t\t// Work out whether we're going to have dodgy characters and remove them.\n\t\t\t$invalid_characters = preg_match('~[<>&\"\\'=\\\\\\]~', $_POST['username']) != 0;\n\t\t\t$_POST['username'] = preg_replace('~[<>&\"\\'=\\\\\\]~', '', $_POST['username']);\n\n\t\t\t$db->skip_next_error();\n\t\t\t$result = $db->query('', '\n\t\t\t\tSELECT \n\t\t\t\t\tid_member, password_salt\n\t\t\t\tFROM {db_prefix}members\n\t\t\t\tWHERE member_name = {string:username} \n\t\t\t\t\tOR email_address = {string:email}\n\t\t\t\tLIMIT 1',\n\t\t\t\tarray(\n\t\t\t\t\t'username' => stripslashes($_POST['username']),\n\t\t\t\t\t'email' => stripslashes($_POST['email']),\n\t\t\t\t)\n\t\t\t);\n\t\t\tif ($result->num_rows() != 0)\n\t\t\t{\n\t\t\t\tlist ($incontext['member_id'], $incontext['member_salt']) = $result->fetch_row();\n\t\t\t\t$result->free_result();\n\n\t\t\t\t$incontext['account_existed'] = $txt['error_user_settings_taken'];\n\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif (trim($_POST['username']) === '' || strlen($_POST['username']) > 25)\n\t\t\t{\n\t\t\t\t// Try the previous step again.\n\t\t\t\t$incontext['error'] = $_POST['username'] == '' ? $txt['error_username_left_empty'] : $txt['error_username_too_long'];\n\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif ($invalid_characters || $_POST['username'] == '_' || $_POST['username'] == '|' || strpos($_POST['username'], '[code') !== false || strpos($_POST['username'], '[/code') !== false)\n\t\t\t{\n\t\t\t\t// Try the previous step again.\n\t\t\t\t$incontext['error'] = $txt['error_invalid_characters_username'];\n\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (empty($_POST['email']) || !filter_var(stripslashes($_POST['email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['email'])) > 255)\n\t\t\t{\n\t\t\t\t// One step back, this time fill out a proper email address.\n\t\t\t\t$incontext['error'] = sprintf($txt['error_valid_email_needed'], $_POST['username']);\n\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// All clear, lets add an admin\n\t\t\trequire_once(SUBSDIR . '/Auth.subs.php');\n\n\t\t\t$incontext['member_salt'] = substr(base64_encode(sha1(mt_rand() . microtime(), true)), 0, 16);\n\n\t\t\t// Format the username properly.\n\t\t\t$_POST['username'] = preg_replace('~[\\t\\n\\r\\x0B\\0\\xA0]+~', ' ', $_POST['username']);\n\t\t\t$ip = isset($_SERVER['REMOTE_ADDR']) ? substr($_SERVER['REMOTE_ADDR'], 0, 255) : '';\n\n\t\t\t// Get a security hash for this combination\n\t\t\t$password = stripslashes($_POST['password1']);\n\t\t\t$incontext['passwd'] = validateLoginPassword($password, '', $_POST['username'], true);\n\n\t\t\t$request = $db->insert('',\n\t\t\t\t$db_prefix . 'members',\n\t\t\t\tarray(\n\t\t\t\t\t'member_name' => 'string-25', 'real_name' => 'string-25', 'passwd' => 'string', 'email_address' => 'string',\n\t\t\t\t\t'id_group' => 'int', 'posts' => 'int', 'date_registered' => 'int', 'hide_email' => 'int',\n\t\t\t\t\t'password_salt' => 'string', 'lngfile' => 'string', 'avatar' => 'string',\n\t\t\t\t\t'member_ip' => 'string', 'member_ip2' => 'string', 'buddy_list' => 'string', 'pm_ignore_list' => 'string',\n\t\t\t\t\t'message_labels' => 'string', 'website_title' => 'string', 'website_url' => 'string',\n\t\t\t\t\t'signature' => 'string', 'usertitle' => 'string', 'secret_question' => 'string',\n\t\t\t\t\t'additional_groups' => 'string', 'ignore_boards' => 'string',\n\t\t\t\t),\n\t\t\t\tarray(\n\t\t\t\t\tstripslashes($_POST['username']), stripslashes($_POST['username']), $incontext['passwd'], stripslashes($_POST['email']),\n\t\t\t\t\t1, 0, time(), 0,\n\t\t\t\t\t$incontext['member_salt'], '', '',\n\t\t\t\t\t$ip, $ip, '', '',\n\t\t\t\t\t'', '', '',\n\t\t\t\t\t'', '', '',\n\t\t\t\t\t'', '',\n\t\t\t\t),\n\t\t\t\tarray('id_member')\n\t\t\t);\n\n\t\t\t// Awww, crud!\n\t\t\tif ($request->hasResults() === false)\n\t\t\t{\n\t\t\t\t$incontext['error'] = $txt['error_user_settings_query'] . '<br />\n\t\t\t\t<div style=\"margin: 2ex;\">' . nl2br(htmlspecialchars($db->last_error($db_connection), ENT_COMPAT, 'UTF-8')) . '</div>';\n\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t$incontext['member_id'] = $db->insert_id(\"{$db_prefix}members\", 'id_member');\n\n\t\t\t// If we're here we're good.\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}",
"function createAdmin(){\n\n if($this->session->has_userdata('userId')){\n\n if(! $this->_isUserAdmin()){\n\n $this->deniedAccess();\n }else{\n\n $this->load->library('form_validation');\n $this->form_validation->set_rules('fullName','','trim|required');\n $this->form_validation->set_rules('displayName','','trim|required');\n $this->form_validation->set_rules('username','','trim|required|is_unique[user.email]');\n\n if($this->form_validation->run() === TRUE){\n\n $this->User_model->createAdminAccount();\n }\n\n redirect(site_url('manage-setting'));\n }\n }\n else{\n\n //redirect to home page\n redirect(site_url());\n }\n\n }",
"public function publishuser(){\n $post = User::where('id', \\request(\"id\"))->first();\n $post->approved = $post->approved==\"pending\"?\"approved\":\"pending\";\n $post->save();\n return redirect(route('voyager.users.index'));\n }",
"public function admin_add() {\n if ($this->isAuthorized()) {\n if ($this->request->is('post')) {\n $this->User->create();\n if ($this->User->save($this->request->data)) {\n $this->Session->setFlash(__('The user has been created'));\n return $this->redirect(array(\n 'action' => 'index',\n ));\n } else {\n $this->Session->setFlash(__('The user could not be created. Please, try again.'));\n }\n }\n } else {\n $this->Session->setFlash(__('You do not have permission to do this'));\n return $this->redirect(array(\n 'action' => 'admin_dashboard',\n ));\n }\n }",
"public function postUpdate($id) {\n $this->_adminUserRepository->addOrUpdateUsers ( $id );\n return redirect ( StringLiterals::ADMIN_USERS )->withSuccess ( trans ( 'user::adminuser.updated' ) );\n }",
"function admin_enable($id = null) {\n\n\t\t$user = $this->User->read(null, $id);\n\n\t\t/**\n\t\t * Read the \"Status\" component for more informations.\n\t\t * Dir : controllers/components/status.php\n\t\t */\n\t\tif (!empty($user)) {\n\n\t\t\t$user['User']['status'] = 0;\n\n\t\t\t/**\n\t\t\t * Change the user status.\n\t\t\t * Redirect the administrator to index page.\n\t\t\t */\n\t\t\tif ($this->User->save($user)) {\n\t\t\t\t$this->Session->setFlash(__d('core', 'The user has been enabled.', true));\n\t\t\t\t$this->redirect(array('action' => 'index'));\n\t\t\t}\n\t\t}\n\n\t}",
"public function add_admin_user(){\n\t\tif(Request::ajax()){\n\n\t\t\ttry{\n\n\t\t\t\t$user = User::first();\n\t\t\t\tif($user){\n\t\t\t\t\treturn Redirect::to('/');\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Exception('We cannot detect any current user. Okay to add new admin');\n\t\t\t\t}\n\n\t\t\t}catch(Exception $e){\n\n\t\t\t\t$admin_username = Input::get('admin_username');\n\t\t\t\t$admin_email = Input::get('admin_email');\n\t\t\t\t$admin_password = Hash::make(Input::get('admin_password'));\n\n\t\t\t\t$user = new User;\n\t\t\t\t$user->username = $admin_username;\n\t\t\t\t$user->email = $admin_email;\n\t\t\t\t$user->password = $admin_password;\n\t\t\t\t$user->admin = 1;\n\n\t\t\t\t$new_user = $user->save();\n\n\t\t\t\t$point = new Point;\n\t\t \t$point->user_id = $user->id;\n\t\t \t$point->points = 200;\n\t\t \t$point->description = Lang::get('lang.registration');\n\t\t \t$point->save();\n\n\t\t\t\tif($new_user){\n\t\t\t\t\tAuth::attempt(array('email' => Input::get('admin_email'), 'password' => Input::get('admin_password')));\n\t\t\t\t\techo true;\n\t\t\t\t} else {\n\t\t\t\t\techo false;\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\t\t\techo false;\n\t\t}\n\t}",
"public function act_edit_user()\n {\n $id = strip_tags($this->input->post('id'));\n $email = strip_tags($this->input->post('email'));\n $pass = strip_tags(hash('sha256',$this->input->post('password')));\n\n\n if (validation_edit_admin()) {\n $update_user = $this->dashboard->update('m_admin', array('id' => $id), array('email' => $email, 'password' => $pass));\n if ($update_user) {\n $response = array('error'=>false,'title'=>'Update Berhasil','pesan'=>'');\n echo json_encode($response);\n }\n\n }else{\n $response = array('error'=>true,'title'=>'Update Gagal!','pesan'=>strip_tags(validation_errors()));\n echo json_encode($response);\n }\n }",
"public function post_edit() {\n //try to edit the user\n if (AuxUser::editUser()) {\n //if the edit process worked, redirect to the profile page\n echo '<script>alert(\"User data edited\");</script>';\n Response::redirect('/profile');\n } else {\n //if not, print the error message\n echo '<script>alert(\"No data was updated, Please confirm that you change at least one field\");</script>';\n Response::redirect('/user/edit', 'refresh');\n }\n }",
"public function createAdmin() {\n if(User::where('email', '[email protected]')->count() == 0) {\n $admin = new User();\n $admin->name = \"Administrador\";\n $admin->email = \"[email protected]\";\n $admin->password = bcrypt(\"admin\");\n $admin->user_type = User::UserTypeAdmin;\n $admin->save();\n }\n }",
"function admin_create_new_user(){ \r\n\t\t\t$id = $this->uri->segment(3);\r\n\t\t\tif($id){\r\n\t\t\t\t$result['update_user_value'] = $this->model->get_edit_record();\r\n\t\t\t}\t \r\n\t\t\t$result['new_user_data'] = $this->model->select_new_user();\r\n\t\t\t$this->load->view('admin-worldsclinicalguide/admin_create_new_user',$result); \r\n\t}",
"public function getPostCreateUserAdmin()\n {\n if (!$this->di->get(\"session\")->has(\"account\")) {\n $this->di->get(\"response\")->redirect(\"user/login\");\n }\n\n $title = \"A create user page\";\n $view = $this->di->get(\"view\");\n $pageRender = $this->di->get(\"pageRender\");\n\n $user = new User();\n $username = $this->di->get(\"session\")->get(\"account\");\n $user->setDb($this->di->get(\"db\"));\n $user->find(\"username\", $username);\n\n if ($user->admin != 1) {\n $this->di->get(\"response\")->redirect(\"user\");\n }\n\n $form = new CreateUserAdminForm($this->di);\n\n $form->check();\n\n $data = [\n \"content\" => $form->getHTML(),\n ];\n\n $view->add(\"default2/article\", $data);\n\n $pageRender->renderPage([\"title\" => $title]);\n }",
"function set_admin($modified_username, $admin_status, $caller_username) {\n\tif ($modified_username == $caller_username) {\n\t\thttp_response_code(400);\n\t\techo \"Cannot change own admin status\";\n\t\texit();\n\t}\n\t$db = get_db();\n\t$stmt = $db->prepare(\"CALL set_user_admin(?, ?)\");\n\t$stmt->bind_param(\"ss\", $modified_username, $admin_status);\n\t$stmt->execute() or trigger_error($db->error);\n\t$db->close();\n}",
"public function AutomaticCreateBasedAdmin(){\n $resp = employees::find(1);\n if(!$resp){\n employees::create([\n 'emp_name'=>'admin',\n 'emp_password'=>'test',\n 'emp_address'=>'abc',\n 'emp_phone'=>'0000000000',\n 'emp_dob'=> new DateTime(),\n 'pos_id'=>1,\n ]);\n }else{\n $resp->pos_id = 1;\n $resp->save();\n }\n }",
"public function activate()\n {\n $activate = new updates;\n $activate->userid =Auth::User()->id;\n $activate->save();\n\n DB::update('update users set userlevel = ? where id = ?',[2,1]);\n \n return redirect('editor')->with('status',' First id changed');\n }",
"public function changeUserStatusAction()\n {\n $id = $this->_getParam('id');\n $guid = $this->_getParam('guid');\n $usersNs = new Zend_Session_Namespace(\"members\");\n if($usersNs->userId==$id)\n {\n $this->_flashMessenger->addMessage(array('error'=>'You cannot change your status!' ));\n $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/security/user')); \n exit;\n } \n $this->view->user_id = $id;\n $model1 = new Security_Model_User();\n $model = $model1->fetchRow(\"id='{$id}' and row_guid='{$guid}'\");\n if(false===$model )\n {\n $this->_flashMessenger->addMessage(array('error'=>'Invalid request! Please try again.'));\n $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/security/user')); \n }\n \n \n if($model->getStatus()==1)\n $model->setStatus (0);\n else\n $model->setStatus (1);\n \n if($model->save())\n {\n $this->_flashMessenger->addMessage(array('success'=>'Status changed for '.$model->getFirstName().' '.$model->getLastName().' [ ID : '.$model->getId().', Status : '.$model->getStatus().']'));\n $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/security/user/index')); \n }\n else\n {\n $this->_flashMessenger->addMessage(array('error'=>'Failed to change the status for '.$model->getFirstName().' '.$model->getLastName().' [ ID : '.$model->getId().', Status : '.$model->getStatus().']'));\n $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/security/user/index')); \n }\n \n }",
"public function adminUser(Request $request)\n {\n if (Auth::user()->role_id == 1) {\n $user = Users::findOrFail($request->input('user_id'));\n //нельзя снять права админа с самого себя и юзера с id = 1\n if (!((Auth::user()->id == $user->id) || ($user->id == 1))) {\n $user->role_id = $request->input('action');\n $user->save();\n $data = array( 'text' => 'success' );\n } else {\n $data = array( 'text' => 'fail' . $request->input('action') );\n }\n } else {\n $data = array( 'text' => 'fail' . $request->input('action') );\n }\n return Response::json($data);\n }",
"public function promoteUser($user_id) {\n $sql = \"UPDATE user SET isAdmin='1' WHERE user.id=?\";\n $sth = $this->db->prepare($sql);\n $sth-> execute(array($user_id)); \n if ($sth->rowCount()==1) {\n $tmp['status'] = 'OK';\n } else {\n $tmp['status'] = 'FAIL';\n }\n return $tmp; \n }",
"public function statusUser($id, $stat)\n {\n \n \n $user = User::find($id);\n $user->status = $stat;\n $user->save();\n \n \n return redirect('users'); \n }",
"function admin_insert_new_user(){\r\n\t\tif(isset($_POST['doctor_create_user'])){\r\n\t\t\t$result['insert_new_user_data'] = $this->model->insert_new_user();\r\n\t\t\tredirect('Doctor_control/admin_create_new_user'); \r\n\t\t}\r\n\t\tif(isset($_POST['doctor_update_user'])){\r\n\t\t\tif($this->model->update_new_user_record()){\r\n\t\t\t\tredirect('Doctor_control/admin_create_new_user'); \r\n\t\t\t} \r\n\t\t} \r\n\t}",
"public function actionAdmin()\n {\n if (User::findOne(['email' => '[email protected]'])) {\n echo \"Руководитель уже существует\\n\";\n\n return ExitCode::USAGE;\n }\n\n $user = new User();\n $user->email = '[email protected]';\n $user->full_name = 'Тестовый Руководитель';\n $user->is_admin = 1;\n $user->password = Yii::$app->security->generatePasswordHash('test');\n $user->save();\n echo \"Руководитель создан\\n\";\n\n return ExitCode::OK;\n }",
"public function postAdd() {\n try {\n $this->_adminUserRepository->addOrUpdateUsers ();\n } catch ( Exception $e ) {\n $this->logger->error ( $e->getMessage () );\n }\n \n return redirect ( StringLiterals::ADMIN_USERS )->withSuccess ( trans ( 'user::adminuser.success' ) );\n }",
"public function create(){\n $user = Auth::user()->admin;\n\n if($user == 0)\n {\n return redirect('home');\n }\n\n}",
"public function set_admin($user_id, $status)\n {\n $val = '0';\n if ($status === true) {\n $val = '1';\n }\n return $this->db\n ->set('user_type', $val)\n ->where('user_id', $user_id)\n ->update('users');\n }"
] |
[
"0.646536",
"0.6463063",
"0.6410444",
"0.63924557",
"0.6365427",
"0.6356498",
"0.6353969",
"0.6352309",
"0.6351359",
"0.6325119",
"0.62947166",
"0.6288167",
"0.62763035",
"0.6256279",
"0.6238101",
"0.6232251",
"0.6212353",
"0.6210803",
"0.6207018",
"0.6187076",
"0.61606133",
"0.6160278",
"0.6159193",
"0.6153579",
"0.6149357",
"0.6133141",
"0.6129699",
"0.6125778",
"0.6112533",
"0.6109132"
] |
0.68687785
|
0
|
Add a test case result.
|
public function addTestResult(Streamwide_PHPUnit_Runner_TestCaseResult $testCaseResult)
{
$this->_results[] = $testCaseResult;
$status = $testCaseResult->getStatus();
$class = $testCaseResult->getTestCase()->getClass();
$index = count($this->_results) - 1;
$this->_statusIndex[$status][$class][] = $testCaseResult;
$this->_classIndex[$class][$status][] = $testCaseResult;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"private function addResult($result) {\n //Adds a result to the results array\n $this->results[] = $result;\n }",
"public function addResult($file, Blerby_TestRunner_Result $result)\r\n {\r\n $this->aResults[$file][] = $result;\r\n }",
"public function testAddResult(): void\n {\n $this->collection->setResult($this->timeResult);\n $this->assertEquals(\n $this->timeResult,\n $this->collection->getResult(TimeResult::class)\n );\n }",
"public function add(ResultInterface $result): void\n {\n $this->results[] = $result;\n }",
"public function addResult(string $string) : void;",
"public function add_result(array $request, $result) {\n $this->__results[] = array('action' => $request['action'],\n 'method' => $request['method'],\n 'tid' => $request['tid'],\n 'type' => $request['type'],\n 'result' => $result);\n return (true);\n }",
"function add_activity_result($result) {\n\t\t$this->_activity_result[] = $result;\n\t}",
"public function setTestResult($result) \n {\n $this->_testResult = $result; \n }",
"public function testAdd()\n {\n $result = $this->calculator->add(1, 2);\n $this->assertEquals(3, $result);\n }",
"public function testAddPoneyFromField($add, $result){\n $this->poneys->addPoneysFromField($add);\n $this->assertEquals($result, $this->poneys->getCount());\n }",
"public function run(TestResult $result = null): TestResult\n {\n // TODO: Implement run() method.\n }",
"function addResult($result_title, $result_description, $result_picture, $memberID){\n\t\trequire('quizrooDB.php');\n\t\t\n\t\t// check if is member\n\t\tif($this->isOwner($memberID)){\n\t\t\t// Insert the result\n\t\t\t$insertSQL = sprintf(\"INSERT INTO q_results(`result_title`, `result_description`, `result_picture`, `fk_quiz_id`) VALUES (%s, %s, %s, %d)\",\n\t\t\t\t\t\t\t htmlentities(GetSQLValueString($result_title, \"text\")),\n\t\t\t\t\t\t\t htmlentities(GetSQLValueString($result_description, \"text\")),\n\t\t\t\t\t\t\t GetSQLValueString($result_picture, \"text\"),\n\t\t\t\t\t\t\t GetSQLValueString($this->quiz_id, \"int\"));\n\t\t\tmysql_query($insertSQL, $quizroo) or die(mysql_error());\n\t\t\t\n\t\t\t// find the result id\n\t\t\t$querySQL = \"SELECT LAST_INSERT_ID() AS insertID\";\n\t\t\t$resultID = mysql_query($querySQL, $quizroo) or die(mysql_error());\n\t\t\t$row_resultID = mysql_fetch_assoc($resultID);\n\t\t\tmysql_free_result($resultID);\n\t\t\t\n\t\t\treturn $row_resultID['insertID'];\n\t\t}else{\n\t\t\treturn false;\n\t\t}\n\t}",
"public function add_test($test)\n {\n array_push($this->tests, $test);\n }",
"public function addResult(SearchResult $result)\n {\n $this->results[] = $result;\n return $this;\n }",
"public function addResult(Result $result): self\n {\n $handler = $result->getHandlerName();\n $this->results[$handler][] = $result;\n\n return $this;\n }",
"protected function addResults($newValues)\n {\n $this->results[] = $newValues;\n }",
"public function addTest($test) {\n array_push($this->tests, $test);\n return $this;\n }",
"protected function addOutput($result, $title, $version) {\n\t\t$this->output[] = array(\n\t\t\t'title' => $title,\n\t\t\t'result' => $result,\n\t\t\t'version' => $version,\n\t\t\t'microtime' => microtime(TRUE),\n\t\t);\n\t}",
"public function run(PHPUnit_Framework_TestResult $result = null)\n {\n }",
"function testResultAdd() {\n \n $result = $this->CI->player->memcacheInstance->flush();\n\n $query = $this->CI->db->query('SET FOREIGN_KEY_CHECKS=0;');\n $query = $this->CI->db->query('TRUNCATE SportGameResults;');\n $query = $this->CI->db->query('SET FOREIGN_KEY_CHECKS=1;');\n\n // check parlay schedule id\n $parlayCard = $this->CI->db->query('SELECT *\n FROM SportParlayCards c\n WHERE\n NOT c.id IS NULL AND\n NOT EXISTS(\n SELECT NULL\n FROM SportGameResults r\n WHERE c.sportScheduleId = r.sportScheduleId\n )\n LIMIT 1')->result();\n\n if( sizeof($parlayCard) > 0 ) {\n\n $data = array(\n 'sportScheduleId' => $parlayCard[0]->sportScheduleId,\n 'parlayCardId' => $parlayCard[0]->parlayCardId,\n 'score1' => 12,\n 'score2' => 20,\n );\n\n // To verify add result is invalid\n // ===============================\n // To verify parlayCardId Invalid\n $idInvalid = array('', null, 0, -1);\n\n foreach ($idInvalid as $value) {\n\n $parlayCardIdInvalid = $data;\n $parlayCardIdInvalid['parlayCardId'] = $value;\n $testResultSecond = $this->parlayresult->add( $parlayCardIdInvalid );\n\n if( is_array($testResultSecond) && isset($testResultSecond['message']) ) {\n\n if( !empty($value) ) {\n\n $this->assertContains( $testResultSecond['message'][0], 'The parlay Card Id field must contain a number greater than 0.', 'To verify parlayCardId is invalid' );\n } else {\n\n $this->assertContains( $testResultSecond['message'][0], 'The parlay Card Id field is required.', 'To verify parlayCardId is invalid' );\n }\n\n }\n }\n // To verify sportScheduleId Invalid\n $idInvalid = array('', null, 0, -1);\n foreach ($idInvalid as $value) {\n\n $sportScheduleIdInvalid = $data;\n $sportScheduleIdInvalid['sportScheduleId'] = $value;\n $testResultThird = $this->parlayresult->add( $sportScheduleIdInvalid );\n\n if( is_array($testResultThird) && isset($testResultThird['message']) ) {\n\n if( !empty($value) ) {\n\n $this->assertContains( $testResultThird['message'][0], 'The sport Schedule Id field must contain a number greater than 0.', 'To verify sportScheduleId is invalid' );\n } else {\n\n $this->assertContains( $testResultThird['message'][0], 'The sport Schedule Id field is required.', 'To verify sportScheduleId is invalid' );\n }\n\n }\n }\n\n // To verify add result is valid\n // ===============================\n $testResult = $this->parlayresult->add( $data );\n\n if ( is_object($testResult) ) {\n\n // To verify parlayCardId return must be equal parlayCardId input\n $this->assertEquals((int)$testResult->parlayCardId, (int)$data['parlayCardId'], 'To verify parlayCardId return must be equal parlayCardId input');\n\n // To verify sportScheduleId return must be equal sportScheduleId input\n $this->assertEquals((int)$testResult->sportScheduleId, (int)$data['sportScheduleId'], 'To verify sportScheduleId return must be equal sportScheduleId input');\n\n // To verify score1 return must be equal score1 input\n $this->assertEquals((int)$testResult->score1, (int)$data['score1'], 'To verify score1 return must be equal score1 input');\n\n // To verify score2 return must be equal score2 input\n $this->assertEquals((int)$testResult->score2, (int)$data['score2'], 'To verify score2 return must be equal score2 input');\n\n } else {\n\n $this->assertTrue( FALSE, \"Can't verify add result dailyshow in case valid.\");\n }\n\n } else {\n\n $this->assertTrue( FALSE, \"Can't verify add result dailyshow. Schedule is'nt exist.\");\n\n }\n\n }",
"public function hookTestHook($result)\n {\n return \"<$result>\";\n }",
"public function append_result($result_append) {\n\t\t$this->_result .= $result_append;\n\t}",
"public function store_result() {}",
"public function testadd()\r\n {\r\n echo \"\\n---Dummy Test:Test Add---\\n\";\r\n $a=2;\r\n $b=2;\r\n $c=add($a, $b);\r\n $this->assertEquals(4,$c);\r\n }",
"function setResult($function, $result)\n {\n $this->m_results[$function] = $result;\n }",
"public function addResult(){\n return view('admin.pages.exam.add_result');\n }",
"public function setResult(string $result): void\n {\n $this->result = $result;\n }",
"public function addResult($command, $status, $message)\n {\n $this->results[] = array('command' => $command, 'status' => $status, 'message' => $message);\n return $this;\n }",
"protected function writeTestResult(array $prevResult, array $result): void\n {\n $testName = strval($result['testMethod']);\n\n /* Gets the test name. */\n if ($this->colors && strval($result['className']) === PhptTestCase::class) {\n $testName = Color::colorizePath(strval($result['testName']), strval($prevResult['testName']), true);\n }\n\n $this->testName = $testName;\n $this->testMessage = strval($result['message']);\n }",
"function AddResultsForActions(){\n $arrResultsAttributes = array('class'=>'results linebreak');\n $this->objCalendar->AddChildNode($this->objCalendar->objHTML,$this->strResults, 'div',$arrResultsAttributes);\n return TRUE;\n }"
] |
[
"0.7610431",
"0.7345003",
"0.7161965",
"0.6923906",
"0.68557024",
"0.6833275",
"0.68203014",
"0.636844",
"0.6264018",
"0.61194503",
"0.6036211",
"0.6020718",
"0.5983659",
"0.59633833",
"0.5940598",
"0.5940105",
"0.59063363",
"0.5870935",
"0.5846462",
"0.5844761",
"0.58291215",
"0.58239317",
"0.5815626",
"0.5804888",
"0.5722675",
"0.57174814",
"0.56863374",
"0.5672995",
"0.5647608",
"0.5642316"
] |
0.73670316
|
1
|
Get all test case results that match selected criteria. If both class and status are null all results are returned. If class name or status is given test results are returned as an associative array indexed by status or class name.
|
public function results($class = null, $status = null)
{
if (!is_null($status) && !in_array($status, Streamwide_PHPUnit_Runner_TestCaseResult::getAllStatusConstants())) {
require_once 'Streamwide/PHPUnit/Runner/Exception.php';
throw new Streamwide_PHPUnit_Runner_Exception('Unknown status ' . $status);
}
if (is_null($class) && is_null($status)) {
return $this->_results;
} else if (!is_null($class) && !is_null($status)) {
return $this->_classIndex[$class][$status];
} else if (!is_null($class)) {
return $this->_classIndex[$class];
} else if (!is_null($status)) {
return $this->_statusIndex[$status];
}
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getTestResultsData()\n {\n $out = [];\n\n // Case #0, sorted in default acceding\n $out[] = [\n [\n 'green',\n 'yellow',\n 'red',\n 'blue',\n ],\n 'sc'\n ];\n\n // Case #1, sorted in descending order by term, blue is prioritized.\n $out[] = [\n [\n 'acme',\n 'bar',\n 'foo',\n ],\n 'sc_zero_choices'\n ];\n\n // Case #2, all items prioritized, so sorting shouldn't matter.\n $out[] = [\n [\n 'blue',\n 'green',\n ],\n 'sc_sort_term_a'\n ];\n\n // Case #3, sort items by count, red prioritized.\n $out[] = [\n [\n 'yellow',\n ],\n 'sc_sort_term_d'\n ];\n\n // Case #4\n $out[] = [\n [\n 'blue',\n 'red',\n 'green',\n 'yellow'\n ],\n 'sc_sort_count'\n ];\n\n // Case #5 with selected man\n $out[] = [\n [\n 'yellow',\n 'red',\n 'blue',\n ],\n 'sc',\n ['manufacturer' => 'a']\n ];\n\n // Case #6 with selected man with zero choices\n $out[] = [\n [\n 'acme',\n 'foo',\n 'bar',\n ],\n 'sc_zero_choices',\n ['manufacturer' => 'a']\n ];\n\n // Case #7 with selected man with zero choices\n $out[] = [\n [\n 'yellow',\n 'red',\n 'blue',\n 'green',\n ],\n 'sc_zero_choices_color',\n ['manufacturer' => 'a']\n ];\n\n return $out;\n }",
"public function retrieve_model_test_list()\n\t{\n\t\n\t\t$this->db->select('a.*,b.class_name');\n\t\t$this->db->from('model_test_settings a');\n\t\t$this->db->join('class_add b','b.class_id = a.class_id');\n\t\t$this->db->where(array('a.status'=>1,'b.status'=>1)); \n\t\t$this->db->order_by('a.model_test_id','desc'); \n\t\t$query = $this->db->get();\n\t\tif ($query->num_rows() > 0) {\n\t\t\treturn $query->result_array();\t\n\t\t}\n\t\treturn false;\n\t}",
"public abstract function getResults();",
"public function get_results()\n {\n return [\n 'skipped' => $this->m_skipped,\n 'migrated' => $this->m_migrated,\n 'missing_classes' => $this->m_missing_classes,\n ];\n }",
"public function getTestResults()\n\t{\n\t\t/*\n\t\t * Wenn die Tests noch nicht ausgeführt wurden, dies nun tun\n\t\t */\n\t\tif ($this->_needRun === true)\n\t\t{\n\t\t\t$this->run();\n\t\t}\n\t\tforeach ($this->_testCases as $key => $testCase)\n\t\t{\n\t\t\t/*\n\t\t\t * Zusicherung nicht erfüllt\n\t\t\t*/\n\t\t\tif ($testCase['assert'] !== $testCase['result'])\n\t\t\t{\n\t\t\t\t$this->_testResults[$key] = $this->_testCases[$key]['functionName'].\": fehlgeschlagen \".\n\t\t\t\t\t$this->boolToString($testCase['assert']).\" != \".$this->boolToString($testCase['result']).\"<br>\";\n\t\t\t\t$this->_failedTests++;\n\t\t\t}\n\t\t\t/*\n\t\t\t * Zusicherung erfüllt\n\t\t\t*/\n\t\t\telse \n\t\t\t{\n\t\t\t\t$this->_testResults[$key] = $this->_testCases[$key]['functionName'].\": erfolgreich \".\n\t\t\t\t\t$this->boolToString($testCase['assert']).\" == \".$this->boolToString($testCase['result']).\"<br>\";\n\t\t\t\t$this->_passedTests++;\n\t\t\t}\n\t\t} \n\t\treturn $this->_testResults;\t\n\t}",
"public function getResults();",
"public function getResults($type)\n {\n return $this->get($type);\n }",
"public function findByStatus($status)\n {\n return $this\n ->createModel()\n ->newQuery()\n ->where('status',$this->getStatusCodeByName($status))\n ->get();\n }",
"public function get_all_tests()\n\t{\n\t\treturn $this->db->get('test')->result();\n\t}",
"public function results($search = null, $roundID = 0, $countyID = 0, $subCountyID = 0, $facilityID = 0)\n {\n $users = $this->users($search);\n\n $enrolments = $users->join('enrolments', 'users.id', '=', 'enrolments.tester_id');\n if($roundID > 0) $enrolments = $enrolments->where('enrolments.round_id', $roundID);\n\n $results = $enrolments->join('pt', 'enrolments.id', '=', 'pt.enrolment_id')\n ->join('facilities', 'enrolments.facility_id', '=', 'facilities.id')\n ->join('sub_counties', 'facilities.sub_county_id', '=', 'sub_counties.id')\n ->join('counties', 'sub_counties.county_id', '=', 'counties.id')\n ->whereNull('pt.deleted_at')\n ->select(['users.*', 'enrolments.*', 'pt.*', 'role_user.*']);\n\n if($countyID > 0) $results = $results->where('counties.id', $countyID);\n if($subCountyID > 0) $results = $results->where('sub_counties.id', $subCountyID);\n if($facilityID > 0) $results = $results->where('facilities.id', $facilityID);\n\n return $results;\n }",
"function getAll(){\n\n\t\t\t$this->db->order_by(\"status\", \"asc\");\n\t\t\t$query = $this->db->get_where($this->table);\n\t\t\treturn $query;\n\t\t}",
"public function dataprovider_differentclasses() {\n // Array for storing our runs.\n $runs = array();\n\n // Run with one enrolment that could be completed for one class, and on that could be completed for another.\n $enrolments = array();\n $enrolments[] = array(\n 'userid' => 103,\n 'classid' => 100,\n 'grade' => 100,\n 'completestatusid' => STUSTATUS_NOTCOMPLETE,\n 'locked' => 0\n );\n $enrolments[] = array(\n 'userid' => 104,\n 'classid' => 100,\n 'grade' => 100,\n 'completestatusid' => STUSTATUS_NOTCOMPLETE,\n 'locked' => 0\n );\n $enrolments[] = array(\n 'userid' => 103,\n 'classid' => 101,\n 'grade' => 100,\n 'completestatusid' => STUSTATUS_NOTCOMPLETE,\n 'locked' => 0\n );\n $enrolments[] = array(\n 'userid' => 104,\n 'classid' => 101,\n 'grade' => 100,\n 'completestatusid' => STUSTATUS_NOTCOMPLETE,\n 'locked' => 0\n );\n $expectedenrolments[] = array(\n 'userid' => 103,\n 'classid' => 100,\n 'grade' => 100,\n 'completestatusid' => STUSTATUS_PASSED,\n 'locked' => 1\n );\n $expectedenrolments[] = array(\n 'userid' => 104,\n 'classid' => 100,\n 'grade' => 100,\n 'completestatusid' => STUSTATUS_PASSED,\n 'locked' => 1\n );\n $expectedenrolments[] = $enrolments[2];\n $expectedenrolments[] = $enrolments[3];\n $runs[] = array($enrolments, $expectedenrolments, 100);\n // Return all data.\n return $runs;\n }",
"public function getCompetitionResults($competition);",
"public function getResults($type='record')\n {\n if ('record' === $type) {\n return $this->results->getRecords();\n }\n\n return $this->results->getStories();\n }",
"public function getAllRequestsByStatus($status)\n {\n try {\n return $this->premium->where('approval', $status)->orderBy('created_at', 'desc')->get();\n } catch (\\Exception $e) {\n self::logErr($e->getMessage());\n return false;\n }\n }",
"public function byClass($class)\n {\n $arr = array();\n foreach ($this->rows as $r)\n $arr[] = $r->_byClass($class);\n\n return $arr;\n }",
"public function getBy(array $criteria);",
"public function getTests();",
"public function getResults($class, EntityFetcher $fetcher)\n {\n return $this->resultRepository->getResults($class, $fetcher);\n }",
"protected function getResultsByType($type)\n {\n $mapper = $this->relatedMapper->getManager()->mapper($type);\n\n $key = $mapper->getEntityMap()->getKeyName();\n\n $query = $mapper->getQuery();\n\n return $query->whereIn($key, array_keys($this->dictionary[$type]))->get();\n }",
"public function expectedStatusCheckResults(): array\n {\n $pass = true;\n $fail = false;\n\n $at = new DateTimeImmutable('2018-01-01T00:00:00Z');\n\n ($fails = $this->createMock(ChecksDependencyStatus::class))\n ->method('dependencyStatus')\n ->willReturn(new BooleanStatus($fail, $at));\n\n ($passes = $this->createMock(ChecksDependencyStatus::class))\n ->method('dependencyStatus')\n ->willReturn(new BooleanStatus($pass, $at));\n\n return [\n 'One dependency, one failure' => [$fail, [$fails]],\n 'Many dependencies, one failure' => [$fail, [$passes, $passes, $fails]],\n 'Many dependencies, many failure' => [$fail, [$passes, $fails, $fails]],\n 'Many dependencies, all failure' => [$fail, [$fails, $fails, $fails]],\n 'One dependency, one pass' => [$pass, [$passes]],\n 'Many dependencies, all pass' => [$pass, [$passes, $passes, $passes]],\n ];\n }",
"public function results()\n\t{\n\t\t// This function return entries\n\t\treturn $this->EE->job_search->results();\n\t}",
"public function getResults()\n {\n return $this->get();\n }",
"public function testArrayResult()\n {\n $result = $this->searchResult->arrayResult();\n\n $this->assertArrayHasKey('results', $result);\n $this->assertArrayHasKey('status', $result);\n }",
"public function getAll(){\n\t\t$url = WEBSERVICE. \"status_robot/getAll\";\n\t\t$this->HTTPRequest->setUrl($url);\n\t\t$this->HTTPRequest->setMethod(\"GET\");\n\t\t$arrayResponse = $this->HTTPRequest->sendHTTPRequest();\n\t\treturn $this->arrayToStatusRobot($arrayResponse, false);\n\t}",
"public function getAllActiveWorks()\n {\n\n // define test data\n $users = [\n ['id' => 1, 'email' => '[email protected]', 'is_active' => 1],\n ['id' => 2, 'email' => '[email protected]', 'is_active' => 0],\n ['id' => 3, 'email' => '[email protected]', 'is_active' => 1]\n ];\n\n // define expected results\n $expected = [\n ['id' => 1, 'email' => '[email protected]'],\n ['id' => 3, 'email' => '[email protected]']\n ];\n\n // Our PDOStatement needs an \"execute\" method that returns true\n // Our PDOStatement needs a \"fetchAll\" method that returns an array $users\n // Our PDO class should expect a \"prepare\" method which returns a PDOStatement\n\n // create an instance of the class to be tested (User)\n\n // collect response from getAllActive()\n\n // assert response matches expected\n\n }",
"abstract public static function getStatuses();",
"private function _getSearchCriteria()\n\t{\n\t\t$fieldTaskNo = trim($this->taskNumber->Text);\n\t\t$clientRefNo = trim($this->clientRefNumber->Text);\n\t\t$serialNo = trim($this->serialNumber->Text);\n\t\t$searchPartTypeId = trim($this->partType->getSelectedValue());\n\t\t$searchAttendedById = trim($this->attendedBy->getSelectedValue());\n\t\t$recipientTechId = trim($this->recipientTech->getSelectedValue());\n\t\t$attendedStatus = $this->frStatus->getSelectedValues();\n\t\t$taskStatus = trim($this->ftStatus->getSelectedValue());\n\t\t$hasReserve = trim($this->hasReserve->getSelectedValue());\n\t\t$sentToWarehouseId = trim($this->sendTo->getSelectedValue());\n\t\t$sentToTechId = Factory::service('Warehouse')->getDefaultMobileWarehouse(trim($this->recipientTech->getSelectedValue()));\n\t\t$workTypeIds = $this->workType->getSelectedValues();\n\t\t$zoneSetIds = $this->zoneSet->getSelectedValues();\n\n\t\t$return = array($fieldTaskNo, $clientRefNo, $searchPartTypeId, $searchAttendedById, $attendedStatus, $taskStatus, $hasReserve, $sentToWarehouseId, $sentToTechId, $workTypeIds, $zoneSetIds, $serialNo,$recipientTechId);\n\t\tforeach($return as $value)\n\t\t{\n\t\t\t$checkingValue = (is_array($value) ? implode(\",\", $value) : $value);\n\n\t\t\tif(trim($checkingValue) !== self::OPTION_FOR_ALL && $checkingValue !== '')\n\t\t\treturn $return;\n\t\t}\n\n\t\tthrow new Exception(\"Please provide at least one search criteria!\");\n\t}",
"function getSeleniumResultsForTestCase($testCaseID, $relationID, $studyID, $subjectID, $clientID) {\n\n global $definitions;\n $stepsItemTypeID = getClientItemTypeID_RelatedWith_byName($definitions['steps'], $clientID);\n\n $stepParentTestCasePropertyID = getClientPropertyID_RelatedWith_byName($definitions['stepsTestCaseParentID'], $clientID);\n $stepOrderPropertyID = getClientPropertyID_RelatedWith_byName($definitions['stepsOrder'], $clientID);\n $stepCheckedStepUnitsPropertyID = getClientPropertyID_RelatedWith_byName($definitions['stepsCheckedStepUnits'], $clientID);\n $stepRoundSubjectTestCasePropertyID = getClientPropertyID_RelatedWith_byName($definitions['stepsRoundSubjectRelationID'], $clientID);\n\n //First, we need the steps for this testCase\n\n //Next, get the results fo the step\n // get checked values\n // build return properties array\n $returnProperties = array();\n $returnProperties[] = array('ID' => $stepOrderPropertyID, 'name' => 'order');\n $returnProperties[] = array('ID' => $stepCheckedStepUnitsPropertyID, 'name' => 'checkedValues');\n\n //build the filter\n $filters = array();\n $filters[] = array('ID' => $stepParentTestCasePropertyID, 'value' => $testCaseID);\n $filters[] = array('ID' => $stepRoundSubjectTestCasePropertyID, 'value' => $relationID);\n\n // get steps\n $orderedSteps = getFilteredItemsIDs($stepsItemTypeID, $clientID, $filters, $returnProperties, 'order');\n\n $totalOK = 0;\n $totalNOK = 0;\n $hasSeleniumResults = False;\n\n for ($i = 0; $i < count($orderedSteps); $i++) {\n\n $markedStepsUnitsIDs = explode(',', $orderedSteps[$i]['checkedValues']);\n\n $params = getParamsAndResultsForAStep($orderedSteps[$i], $studyID, $subjectID, $markedStepsUnitsIDs, $clientID);\n\n //Add every parameter to the results\n foreach ($params as $p) {\n\n //Check if the systemConversion value is a Selenium type\n\n if (base64_decode($p['systemConversionValue']) == 'stepUnit.type.seleniumResult') {\n $hasSeleniumResults = True;\n $theResult = base64_decode($p['executionValue']);\n if ($theResult == 'OK') {\n $totalOK++;\n } elseif ($theResult == 'NOK') {\n $totalNOK++;\n }\n }\n\n }\n }\n if ($hasSeleniumResults == True) {\n if ($totalOK > 0 && $totalNOK == 0) {\n return 'OK';\n } elseif ($totalNOK > 0) {\n return 'NOK';\n } elseif ($totalOK == 0 && $totalNOK == 0) {\n return 'NOT_EXECUTED';\n }\n } else {\n return 'NOSELENIUM';\n }\n\n}",
"public static function all()\n {\n $sql = new Sql();\n\n $results = $sql->select(\"SELECT * FROM tbl_status\");\n\n return $results;\n }"
] |
[
"0.5774507",
"0.548367",
"0.5424701",
"0.5387216",
"0.5350474",
"0.52466846",
"0.5225815",
"0.51316285",
"0.51116455",
"0.5069681",
"0.5031056",
"0.50290185",
"0.5016446",
"0.5004323",
"0.49807605",
"0.49765748",
"0.4976445",
"0.49390647",
"0.49213746",
"0.49118143",
"0.48978856",
"0.48760983",
"0.48555097",
"0.4853911",
"0.48337135",
"0.48212382",
"0.4812903",
"0.48101106",
"0.48089924",
"0.47993878"
] |
0.7384472
|
0
|
Tests the License::__toString method.
|
public function testToString () {
//Asserts a license instance without an URL property is rendered as its name
$license = new License();
$license->name = "Creative Commons Attribution 3.0 Unported License";
$license->code = "CC-BY 3.0";
$this->assertEquals($license, "Creative Commons Attribution 3.0 Unported License");
//Asserts a license instance with an URL property is rendered as an HTML link
$license->URL = "http://creativecommons.org/licenses/by/3.0/";
$this->assertEquals(
$license,
'<a rel="license" href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0 Unported License</a>'
);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function get_licence()\n {\n return 'Licensed on the same terms as Composr';\n }",
"public function get_licence()\n {\n return 'Licensed on the same terms as Composr';\n }",
"public function get_licence()\n {\n return 'Licensed on the same terms as Composr';\n }",
"public function get_licence()\n {\n return 'Licensed on the same terms as Composr';\n }",
"public function get_licence()\n {\n return 'Licensed on the same terms as Composr';\n }",
"public function get_licence()\n {\n return 'Licensed on the same terms as Composr';\n }",
"public function get_licence()\n {\n return 'MIT License';\n }",
"public function get_licence()\n {\n return 'GPL';\n }",
"public function testLicensesSetterGetter($license): void\n {\n $this->component->setLicense($license);\n self::assertSame($license, $this->component->getLicense());\n }",
"function __toString()\n {\n }",
"function __toString()\n {\n }",
"public function test__toString0()\n{\n\n $actual = $this->simplePie_Copyright->__toString();\n $expected = null; // TODO: Expected value here\n $this->assertEquals($expected, $actual);\n}",
"public function toString()\n {\n }",
"final public function __toString(): string {}",
"public function getOrganizationLicense(): string {\n\t\treturn ($this->organizationLicense);\n\t}",
"abstract public function __toString();",
"abstract public function __toString();",
"abstract public function __toString();",
"abstract public function __toString();",
"abstract public function __toString();",
"abstract public function __toString();",
"function __toString() ;",
"abstract public function __toString() ;",
"function __toString() ;",
"public function toString() {}",
"public function toString() {}",
"public function toString() {}",
"public function toString() {}",
"public function toString() {}",
"public function toString() {}"
] |
[
"0.6532631",
"0.6532631",
"0.6532631",
"0.6532631",
"0.6532631",
"0.6532631",
"0.62583905",
"0.6239285",
"0.6197176",
"0.6170597",
"0.6170597",
"0.6023847",
"0.6019718",
"0.5999887",
"0.5986904",
"0.59648365",
"0.59648365",
"0.59648365",
"0.59648365",
"0.59648365",
"0.59648365",
"0.5961717",
"0.59613913",
"0.5959733",
"0.5941314",
"0.59404516",
"0.59404516",
"0.59404516",
"0.5940024",
"0.5940024"
] |
0.7894142
|
0
|
$this>driver = new \Behat\Mink\Driver\GoutteDriver();
|
public function __construct()
{
// $this->session = new \Behat\Mink\Session($this->driver);
// $this->session->start();
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function __construct()\n {\n $this->webDriver = new \\Behat\\Mink\\Driver\\Selenium2Driver();\n $this->session = new \\Behat\\Mink\\Session($this->webDriver);\n\n }",
"protected function setup() {\n $driver = new \\Behat\\Mink\\Driver\\GoutteDriver();\n $this->session = new \\Behat\\Mink\\Session($driver);\n $this->session->start();\n }",
"public function __construct() {\n $this->siteRoot = 'http://127.0.0.1';\n $this->driver = new GoutteDriver();\n $this->session = new Session($this->driver);\n }",
"static function setUpBeforeClass(){\n self::$client = new Goutte\\Client; \n }",
"public function testExample()\n {\n $this->browse(function (Browser $browser) {\n $browser->visit('/login')\n ->assertSee('SIGN IN')\n ->type('email', '[email protected]')\n ->type('password', '123456')\n ->press('LOGIN')\n ->assertPathIs('/home')\n ->visit('/addProduct')\n ->type('nama_product', 'air jordan')\n ->type('harga_product', '100000')\n ->type('stock_product', '100000')\n ->type('deskripsi', 'haip bis parah ngga sih')\n ->select('kategori_product', 'Lainnya')\n ->select('nama_marketplace', 'Shopee')\n ->attach('img_path', __DIR__.'\\test.jpg')\n ->press('Submit');\n });\n }",
"function googleSampleTest(){\n \n $host = 'http://localhost:4444/wd/hub'; // this is the default\n $capabilities = DesiredCapabilities::firefox();\n $driver = RemoteWebDriver::create($host, $capabilities, 5000);\n// navigate to \n$driver->get('http://google.com');\n<<<<<<< HEAD\n$element = $driver->findElement(WebDriverBy::name(\"ei\"));\n=======\n$element = $driver->findElement(WebDriverBy::name(\"q\"));\n>>>>>>> 622027feb1f776e018cabe38a47332026f9307ba\nif($element) {\n $element->sendKeys(\"TestingBot\");\n $element->submit();\n }\n<<<<<<< HEAD\n print $web_driver->getTitle();\n $web_driver->quit();\n}",
"public function driver();",
"public function testExample()\n {\n $this->browse(function (Browser $browser) {\n\n\n $browser->visit(new RegisterTaskPage)\n ->type('email', '[email protected]')\n ->type('password', 'secret')\n ->type('password_confirmation', 'secret')\n ->Click('@element')\n ->pause(5000)\n ->assertPathIs('/home');\n\n });\n }",
"public function initGoutteClient() { \r\n // require Goutte library autoload\r\n require_once Mage::getBaseDir('lib') \r\n . DIRECTORY_SEPARATOR \r\n . 'Goutte'\r\n . DIRECTORY_SEPARATOR \r\n . 'composer'\r\n . DIRECTORY_SEPARATOR \r\n . 'vendor'\r\n . DIRECTORY_SEPARATOR \r\n . 'autoload.php'\r\n ;\r\n $client = new \\Goutte\\Client();\r\n // Create and use a guzzle client instance \r\n // that will time out after 90 seconds\r\n $guzzleClient = new \\GuzzleHttp\\Client(array(\r\n 'timeout' => 90\r\n , 'verify' => false\r\n , 'cookies' => true\r\n ));\r\n $client->setClient($guzzleClient);\r\n return $client;\r\n}",
"public function testExample()\n {\n $this->browse(function (Browser $browser) {\n $browser->loginAs(\"[email protected]\")\n ->visit(\"/home\");\n });\n }",
"public function testExample()\n {\n $this->browse(function (Browser $browser) {\n $browser->visit('/giris-yap')\n ->type('input[name=\"email\"]','[email protected]')\n ->type('input[name=\"pass\"]','123')\n ->check('input[name=\"rememberme\"]')\n ->click('button[name=\"login\"]')\n ->waitForLocation('/')\n ->click('a[href=\"yeni-is-ekle\"]')\n ->pause(1000)\n ->select('select[name=\"project\"]')\n ->type('input[name=\"title\"]','İş Adı')\n ->type('input[name=\"desc\"]','İş Açıklama')\n ->click('button[name=\"create\"]')\n ->waitForDialog()\n ->assertDialogOpened('İş oluşturma işlemi başarı ile tamamlandı.');\n });\n }",
"public function testExample()\n {\n $this->browse(function (Browser $browser) {\n $browser->visit('/giris-yap')\n ->type('input[name=\"email\"]','[email protected]')\n ->type('input[name=\"pass\"]','123')\n ->check('input[name=\"rememberme\"]')\n ->click('button[name=\"login\"]')\n ->waitForLocation('/')\n ->click('a[href=\"yeni-proje-ekle\"]')\n ->type('input[name=\"date\"]','15.01.2021')\n ->type('input[name=\"name\"]','Proje Adı')\n ->type('input[name=\"technician\"]','Teknik Uzman')\n ->type('input[name=\"actualtime\"]','100')\n ->type('textarea[name=\"desc\"]','Açıklama')\n ->type('textarea[name=\"notes\"]','Notlar')\n ->click('button[name=\"create\"]')\n ->waitForDialog()\n ->assertDialogOpened('Proje oluşturma işlemi başarı ile tamamlandı.');\n });\n }",
"public function testExample()\n {\n $this->visit(\"http://localhost/laravel/cdp/public/project/1/visitor\");\n $this->seePageIs('http://localhost/laravel/cdp/public/project/1/visitor');\n }",
"public static function setUpBeforeClass()\n {\n\n\n $yaml = Yaml::parse(file_get_contents('../etc/config.yml'));\n\n self::$cred['username'] = $yaml['username'];\n self::$cred['password'] = $yaml['password'];\n\n $host = 'http://localhost:4444/wd/hub';\n\n $userAgent = 'Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19';\n\n $options = new ChromeOptions();\n $options->addArguments(array(\n '--user-agent=' . $userAgent\n ));\n\n $caps = DesiredCapabilities::chrome();\n $caps->setCapability(ChromeOptions::CAPABILITY, $options);\n\n self::$driver = RemoteWebDriver::create($host, $caps);\n }",
"public function testRegistrarmeSinDatos(){\n $this->browse(function ($browser) {\n $browser->visit('/registrar')\n ->press('Registrarme')\n ->assertPathIs('/registrar'); \n }); \n }",
"public function testExample()\n {\n $this->browse(function ($browser) {\n $browser->clickLink('Homes');\n });\n }",
"public function makeDriver() : AbstractDriver;",
"public function _before(\\AcceptanceTester $I)\n {\n }",
"public function testExample()\n {\n $this->browse(function ($browser , $second) {\n $browser->visit('/')\n //->assertVueContains('name','sina','@editor');\n ->assertVue('name','sina','@editor');\n // ->pause(3000)\n // ->click('.test');\n // ->assertSee('Register')\n // ->value('#name' , 'sina')\n // ->value('#email' , Str::random(10).'@gmail.com')\n // ->value('#password' , '123456789')\n // ->value('#password-confirm' , '123456789')\n // ->click('button[type=\"submit\"]')\n // ->assertPathIs('/home')\n // ->refresh()\n // ->script('alert(\"ok\")');\n });\n }",
"protected function setUp(): void\n {\n $this->driver = RemoteWebDriver::createBySessionID(\n 'session-id',\n 'http://foo.bar:4444',\n null,\n null,\n true,\n new DesiredCapabilities([])\n );\n }",
"public function testExample()\n {\n $this->browse(function (Browser $browser) {\n $browser->visit('/project_bookstore/client')\n ->click('nav > div > div.collapse.navbar-collapse.navbar-ex1-collapse > ul > li:nth-child(5) > a')\n ->type('username', 'client4')\n ->type('password', 123456)\n ->click('a#btn-login')\n ->waitForText('client4')\n ->assertSee('client4')\n ->assertPathIs('/project_bookstore/client');\n });\n }",
"public function testExample()\n {\n $this->browse(function (Browser $browser) {\n $browser->visit('/user/profile')\n ->assertSee('Profile');\n \n });\n }",
"public function testExample()\n {\n $this->browse(function (Browser $browser) {\n $browser->visit('/login')\n ->assertSee('Авторизация');\n });\n\n $user = User::factory()->create([\n 'email' => '[email protected]',\n 'password' => Hash::make('password'),\n ]);\n\n $this->browse(function ($browser) {\n $browser->visit('/login')\n ->type('email', '[email protected]')\n ->type('password', 'password')\n ->press('Авторизоваться')\n ->assertPathIs('/dashboard')\n ->assertSee('Главная');\n });\n\n }",
"public function setUp()\n {\n $this->uri = $this->resolveUri();\n $this->webDriver = new PHPWebDriver_WebDriver(self::WEB_DRIVER_HOST);\n $this->session = $this->webDriver->session('htmlunit');\n }",
"public function testExample()\n {\n $this->browse(function (Browser $browser) {\n $browser->visit('/register')\n ->type('name', 'TestBot1')\n ->type('email', '[email protected]')\n ->type('password', '123')\n ->type('password_confirmation', '123')\n ->press('Register')\n ->assertPathIs('/computers');\n });\n }",
"public function _before(AcceptanceTester $I)\n {\n }",
"public function testBasicExample()\n {\n $this->browse(function (Browser $browser) {\n $browser->visit('/')\n ->assertSee('Login to Airtel Sales Force System');\n });\n }",
"public function testBasicExample()\n {\n $this->browse(function ( Browser $browser) {\n $browser->visit('/')\n ->press('demo')\n ->press('form')\n ->assertTitle('FORM')\n ->type('email', '[email protected]')\n ->type('pwd', '1')\n ->press('submit')\n ->assertPathIs('/')\n ->assertSee('1')\n ->clickLink('Page 1')\n ->assertSee('About')\n ->clickLink('About')\n ->assertTitle('127.0.0.1:8000/about')\n ->resize(1100, 2400)->driver->takeScreenshot();\n\n\n });\n }",
"protected function getDriver() {}",
"public function testBasicExample()\n {\n $this->browse(function (Browser $browser) {\n \n $browser->visit('/')\n ->pause(2000)\n ->assertSee('后台登录');\n \n\n // 页面 url, 是否有All按钮, select 选择框\n // 模板 [\"url\" => \"\", \"select\" => [\"name\" => \"\", \"value\" => \"\"]]\n /*\n $pages = [\n [\"url\" => \"/user_manage/all_users\", \"all\" => true, \"select\" => [\"name\" => \"id_grade\", \"value\" => 102], \"click\" => \".td-info\"],\n [\"url\" => \"human_resource/index_new\", \"select\" => [\"name\" => \"id_teacher_money_type\", \"value\" => 0], \"click\" => \".opt-freeze-list\"],\n [\"url\" => \"/authority/manager_list\", \"select\" =>[\"name\" => \"id_call_phone_type\", \"value\" => \"2\"]]\n ];\n \n foreach($pages as $item) {\n $browser->visit($item[\"url\"])->pause(5000);\n if (isset($item[\"all\"]))\n $browser->press(\"ALL\");\n //$browser->select($item[\"select\"]['name'], $item[\"select\"][\"value\"]);\n if (isset($item[\"click\"]) && $item[\"click\"])\n $browser->click($item[\"click\"]);\n //$browser->pause(5000);\n }*/\n\n /* $browser->visit(\"/user_manage/all_users\")\n ->press(\"ALL\")\n ->select(\"id_grade\", 101)\n ->select(\"id_grade\", 102)\n ->click(\".td-info\")\n ->pause(500);\n /*\n\n //$browser->click(\".bootstrap-dialog-body .opt-user\");\n\n $browser->click(\".bootstrap-dialog-header .close\"); // 关闭模态框\n\n $browser->visit(\"/tea_manage/lesson_list\")\n ->press(\"ALL\")\n ->pause(2000);\n */\n\n });\n }"
] |
[
"0.7695862",
"0.73308945",
"0.6659397",
"0.6629209",
"0.62818694",
"0.62619823",
"0.62258536",
"0.6194255",
"0.61576587",
"0.6147962",
"0.5828477",
"0.57865804",
"0.5770614",
"0.5727865",
"0.5721946",
"0.5720295",
"0.57065696",
"0.56932825",
"0.56753725",
"0.5667987",
"0.566658",
"0.5657133",
"0.5653337",
"0.56474394",
"0.5644251",
"0.56433827",
"0.5640072",
"0.5615653",
"0.5596387",
"0.558788"
] |
0.7486583
|
1
|
TODO: Implement handlerNeedsRequest() method.
|
public function handlerNeedsRequest()
{
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function handleRequest() {}",
"protected abstract function handleRequest();",
"public function handleRequest();",
"public function handleRequest();",
"public function handleRequest();",
"function handleRequest() ;",
"abstract public function handle_request();",
"protected function _request() {}",
"public function setRequestOnHandler($request)\n {\n }",
"public function requestHasBeenHandled()\n {\n $this->requestHandled = true;\n }",
"abstract public function handleRequest($request);",
"public function getHandler() {}",
"public function resolveRequestHandler() {}",
"public function handleRequest(Zend_Controller_Request_Http $request)\n {\n \n }",
"public function processRequest();",
"public function getHandler()\n {\n }",
"abstract public function handleRequest(Request $request);",
"public function canHandleRequest() {}",
"public function canHandleRequest() {}",
"public function canHandleRequest() {}",
"public function canHandleRequest() {}",
"abstract public function processRequest();",
"public function getActualHandler();",
"public function get_handler()\n {\n }",
"public static function usesCustomHandler();",
"public abstract function processRequest();",
"public function process_request() {\n if(!empty($this->POST)) {\n return $this->handlePOST();\n } else {\n return $this->handleGET();\n }\n }",
"protected function handle(Request $request) {}",
"public function canHandleRequest();",
"public function canHandleRequest();"
] |
[
"0.7538037",
"0.74037105",
"0.7371647",
"0.7371647",
"0.7371647",
"0.73347515",
"0.7295493",
"0.70803225",
"0.70725745",
"0.6853433",
"0.684825",
"0.6654085",
"0.66294855",
"0.66161615",
"0.65380085",
"0.65307254",
"0.6512132",
"0.64984614",
"0.64984614",
"0.64984614",
"0.64984614",
"0.643585",
"0.64146787",
"0.63610584",
"0.6357189",
"0.6327656",
"0.6262682",
"0.62616986",
"0.6261221",
"0.6261221"
] |
0.8866101
|
0
|
TODO: Implement setRequestOnHandler() method.
|
public function setRequestOnHandler($request)
{
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function handlerNeedsRequest()\n {\n }",
"function handleRequest() ;",
"public function handleRequest() {}",
"public function handleRequest();",
"public function handleRequest();",
"public function handleRequest();",
"public static function usesCustomHandler();",
"public function getHandler() {}",
"protected abstract function handleRequest();",
"abstract public function handle_request();",
"protected function _request() {}",
"public function getHandler()\n {\n }",
"public function handleRequest(Zend_Controller_Request_Http $request)\n {\n \n }",
"abstract public function handleRequest($request);",
"public function get_handler()\n {\n }",
"public function getHandler();",
"public function getHandler();",
"public function getRequestTarget()\n {\n }",
"public function getRequestTarget() {}",
"public function getActualHandler();",
"public function resolveRequestHandler() {}",
"public function setLastRequest(RequestHandler $request): void\n {\n $this->base->lastApiRequest = $request;\n }",
"public function requestHasBeenHandled()\n {\n $this->requestHandled = true;\n }",
"public function onRequest(StreamServerNodeInterface $client, HttpRequest $request);",
"private function beforeRoutingMiddleWare()\n {\n if (isset($this->before[$_SERVER['REQUEST_METHOD']])) {\n $this->handle($this->before[$_SERVER['REQUEST_METHOD']]);\n }\n }",
"public function process(Request $request, Response $response, RequestHandlerInterface $handler);",
"public function handle($request);",
"function setRequest($request) {\n\t\t$this->m_request = $request;\n\t}",
"public static function onRequest(Request $request,Response $response): void\n {\n }",
"public function DispatchRequest ();"
] |
[
"0.7554208",
"0.7077656",
"0.70392",
"0.6900539",
"0.6900539",
"0.6900539",
"0.6790355",
"0.6683081",
"0.661483",
"0.66009873",
"0.657406",
"0.6526367",
"0.64150995",
"0.6411265",
"0.6358417",
"0.63566446",
"0.63566446",
"0.6308758",
"0.6279346",
"0.6183508",
"0.618286",
"0.6140237",
"0.6122326",
"0.60949874",
"0.60732496",
"0.6036182",
"0.60309213",
"0.6029324",
"0.60213035",
"0.60208064"
] |
0.85828817
|
0
|
Get average month pace
|
static public function getAverageMonthPace() {
if (self::$AverageMonthPace === false) {
$AverageMonthPace = DB::getInstance()->query('SELECT AVG(`s`/60/`distance`) AS `avg` FROM `'.PREFIX.'training` WHERE `time` > '.(time()-30*DAY_IN_S).' AND `sportid`='.CONF_RUNNINGSPORT.' LIMIT 1')->fetch();
self::$AverageMonthPace = $AverageMonthPace['avg'];
}
return self::$AverageMonthPace;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"function _getAverageByMonth($year, $sql, $format=0)\r\n\t{\r\n\t\tglobal $langs;\r\n\r\n\t\t$result=array();\r\n\t\t$res=array();\r\n\r\n\t\tdol_syslog(get_class($this).'::'.__FUNCTION__.\"\", LOG_DEBUG);\r\n\t\t$resql=$this->db->query($sql);\r\n\t\tif ($resql)\r\n\t\t{\r\n\t\t\t$num = $this->db->num_rows($resql);\r\n\t\t\t$i = 0; $j = 0;\r\n\t\t\twhile ($i < $num)\r\n\t\t\t{\r\n\t\t \t\t$row = $this->db->fetch_row($resql);\r\n\t\t \t\t$j = $row[0] * 1;\r\n\t\t \t\t$result[$j] = $row[1];\r\n\t\t \t\t$i++;\r\n\t\t \t}\r\n\t\t \t$this->db->free($resql);\r\n\t\t}\r\n else dol_print_error($this->db);\r\n\r\n\t\tfor ($i = 1 ; $i < 13 ; $i++)\r\n\t\t{\r\n\t\t\t$res[$i] = (isset($result[$i])?$result[$i]:0);\r\n\t\t}\r\n\r\n\t\t$data = array();\r\n\r\n\t\tfor ($i = 1 ; $i < 13 ; $i++)\r\n\t\t{\r\n\t\t\t$month='unknown';\r\n\t\t\tif ($format == 0) $month=$langs->transnoentitiesnoconv('MonthShort'.sprintf(\"%02d\", $i));\r\n\t\t\telseif ($format == 1) $month=$i;\r\n\t\t\telseif ($format == 2) $month=$langs->transnoentitiesnoconv('MonthVeryShort'.sprintf(\"%02d\", $i));\r\n\t\t\t//$month=dol_print_date(dol_mktime(12,0,0,$i,1,$year),($format?\"%m\":\"%b\"));\r\n\t\t\t//$month=dol_substr($month,0,3);\r\n\t\t\t$data[$i-1] = array($month, $res[$i]);\r\n\t\t}\r\n\r\n\t\treturn $data;\r\n\t}",
"public function getEstimateSpreadPerMonth() {\n\n // Do the columns\n $googleVis = new Googlevis();\n $columns = $googleVis->createColumns(\n array(\n 'Month' => 'string', \n 'Size: 1' => 'number', \n 'Size: 2' => 'number', \n 'Size: 3' => 'number', \n 'Size: 5' => 'number', \n 'Size: 8' => 'number', \n 'Size: 13' => 'number', \n 'Size: 20' => 'number'\n )\n );\n \n $estimate_data = $this->getEstimateDataByMonth(\n $this->easybacklogClient->getStoriesFromTheme()\n );\n\n\n $rows = array();\n foreach($estimate_data AS $year => $month) {\n foreach($month AS $month_no => $estimates) {\n foreach (array(1, 2, 3, 5, 8, 13, 20) AS $est) {\n $row_data[] = (isset($estimates[$est]) ? $estimates[$est] : 0);\n }\n\n $rows[] = $googleVis->createDataRow(\n $year .\"/\". $month_no,\n $row_data\n );\n $row = $row_label = $row_data = array();\n }\n \n }\n\n return array('cols' => $columns, 'rows' => $rows);\n }",
"public function get_month_permastruct()\n {\n }",
"public function totalAverageVisitors()\n {\n $query1 = \"SELECT COUNT(recordID) AS totalVisitors FROM ad_stats WHERE (MONTH(date) = MONTH(CURRENT_DATE()) AND YEAR(date) = YEAR(CURRENT_DATE()));\"; \n $result = mysqli_query($GLOBALS['db'], $query1);\n $tempData1 = mysqli_fetch_assoc($result);\n $data['totalVisitors'] = $tempData1['totalVisitors'];\n \n\n //to get the final output\n $query2=\"SELECT AVG(visitors) AS avgVisitors FROM (SELECT date, COUNT(recordID)AS visitors FROM ad_stats GROUP BY date) AS T1;\";\n $result = mysqli_query($GLOBALS['db'], $query2);\n $tempData2 = mysqli_fetch_assoc($result);\n $data['avgVisitors'] = $tempData2['avgVisitors'];\n\n return $data;\n }",
"function getMeanHours($start_year, $end_year, $start_month, $end_month, $start_day, $end_day, $start_hour, $end_hour){\n\t\t//Declaring arrays\t\n\t\t$HOURS_IN_DAY = 24;\n\t\t$hourly_array = accessData($start_year, $end_year, $start_month, $end_month, $start_day, $end_day, $start_hour, $end_hour);\n\t\t$sum_array = array();\n\t\t$divideBy_array = array();\n\t\t$mean_array = array();\n\t\t\n\t\t//Initializing the arrays.\n\t\t//$sum_array will hold the number of people that have crossed in that specific hour, for the entire timeframe specified.\n\t\t//$dividBy_array will holder the number of unique hours that were pulled from for each hour (unique regarding year, month, day) \n\t\tfor($i = 0; $i < $HOURS_IN_DAY; $i++){\n\t\t\t$sum_array[$i] = 0;\n\t\t\t$divideBy_array[$i] = 0;\n\t\t}\n\t\t\n\t\t//This fills the previously described associative arrays, $sum_array and $divideBy_array.\n\t\tforeach($hourly_array as $year => $temp1){\n\t\t\tforeach($hourly_array[$year] as $month => $temp2){\n\t\t\t\tforeach($hourly_array[$year][$month] as $day => $temp3){\n\t\t\t\t\tforeach($hourly_array[$year][$month][$day] as $hour => $value){\n\t\t\t\t\t\t$sum_array[$hour] += $value;\n\t\t\t\t\t\t$divideBy_array[$hour] += 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t//This creates the associative array $mean_array dividing the $sum_array by the $divideBy_array, with the index\n\t\t//decided by the specific hour that has its mean being caluclated. \n\t\tfor($i = 0; $i < $HOURS_IN_DAY; $i++){\n\t\t\t$mean_array[$i] = (int)($sum_array[$i]/$divideBy_array[$i]);\n\t\t}\n\t\t\n\t\t//Any values that are still null will be set to 0.\n\t\tfor($i = 0; $i < $HOURS_IN_DAY; $i++){\n\t\t\tif($mean_array[$i] == NULL)\n\t\t\t\t$mean_array[$i] = 0;\n\t\t}\n\t\t\t\n \t\treturn $mean_array;\n\t}",
"function mean_bpm($con) {\n\t$bpm = array();\n\n\tfor ($i = 0; $i < 6; $i++) {\n\n\t\t$mood_cluster = $i + 1;\n\n\t\t$qry = \"SELECT AVG(BPM) AS MEAN_BPM\n\t\t\t\tFROM SONGS\n\t\t\t\tWHERE MOOD = '$mood_cluster'\";\n\n\t\t$results = mysqli_query($con, $qry);\n\n\t\tif (mysqli_num_rows($results) > 0) {\n\n\t\t\twhile($row = mysqli_fetch_assoc($results)) {\n\n\t\t\t\t$bpm[$i] = round( $row['MEAN_BPM'] );\n\t\t\t\t// echo 'mood: '.$mood_cluster.' - bpm: '.$bpm[$i].\"</br>\";\n\n\t\t\t} // End While.\n\n\t\t\tmysqli_free_result($results);\n\t\t} // End if.\n\n\t// End for.\n\t}\n\t\n\treturn $bpm;\n}",
"public function averageByMonths($request, $model, $column, $dateColumn = null)\n {\n return $this->aggregate($request, $model, Trend::BY_MONTHS, 'avg', $column, $dateColumn);\n }",
"function getAverageByMonthWithPrevYear($endyear,$startyear)\r\n\t{\r\n if ($startyear > $endyear) return -1;\r\n\r\n $datay=array();\r\n\r\n\t\t$year=$startyear;\r\n\t\twhile($year <= $endyear)\r\n\t\t{\r\n\t\t\t$datay[$year] = $this->getAverageByMonth($year);\r\n\t\t\t$year++;\r\n\t\t}\r\n\r\n\t\t$data = array();\r\n\r\n\t\tfor ($i = 0 ; $i < 12 ; $i++)\r\n\t\t{\r\n\t\t\t$data[$i][]=$datay[$endyear][$i][0];\r\n\t\t\t$year=$startyear;\r\n\t\t\twhile($year <= $endyear)\r\n\t\t\t{\r\n\t\t\t\t$data[$i][]=$datay[$year][$i][1];\r\n\t\t\t\t$year++;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn $data;\r\n\t}",
"public function calculateAverage()\n {\n return 0.0;\n }",
"function getMonthTotal(){\n\t\t$total = $this->hhRentAmount;\n\t\tforeach ($this->members as $member){\n\t\t\tforeach ($member->getBills() as $bill){\n\t\t\t\t$total += $bill->getBillAmount();\n\t\t\t}\n\t\t}\n\t\treturn $total;\n\t}",
"public function gettotalStoriesPerMonth() {\n $googleVis = new Googlevis();\n $columns = $googleVis->createColumns(\n array('Year/Month' => 'string', 'No. of Stories' => 'number')\n );\n\n $estimate_data = $this->getEstimateDataByMonth(\n $this->easybacklogClient->getStoriesFromTheme()\n );\n\n $row = $rows = $row_data = $row_label = array();\n\n foreach($estimate_data AS $year => $month) {\n foreach($month AS $month_no => $stories) {\n foreach($stories AS $story) {\n $counter = (!isset($counter) ? 0 : $counter);\n $counter += $story;\n }\n $rows[] = $googleVis->createDataRow(\n $year .\"/\". $month_no,\n $counter\n );\n $counter = 0;\n }\n }\n return array('cols' => $columns, 'rows' => $rows);\n }",
"public function getAveragePageLoadTime(Period $period);",
"function obtain_invested_means_first_period_month($acc_number)\n\t{\n\t return $this->db->select()\n\t\t ->from('pamm_clients_statement') \n\t\t ->where(\"pamm_clients_stat_acc_number\",$acc_number)\n\t\t ->where(\"pamm_clients_stat_date < date_sub(curdate(),INTERVAL 30 DAY)\")\n\t\t ->get()->result();\n\t}",
"function totalHari($month,$year){\n $jumlah = cal_days_in_month(CAL_GREGORIAN,$month,$year);\n return $jumlah;\n}",
"public function takePostBaseOnMonth();",
"public function average()\n {\n return $this->getSum() / count($this->values);\n }",
"public function getCurrentMonthTotalRevenue() : float;",
"public function points_average_duration()\n {\n $points = $this->points;\n\n $duration_array = [];\n\n foreach ($points as $point) {\n $previous_point_obj = Game_Point::where(\n 'created_at',\n '<',\n $point->created_at\n )\n ->orderBy('created_at', 'desc')\n ->first();\n\n $current_point = $point->created_at;\n\n if (!empty($previous_point_obj)) {\n $previous_point = $previous_point_obj->created_at;\n } else {\n $previous_point = $this->created_at;\n }\n\n $duration_in_seconds = $current_point->diffInSeconds(\n $previous_point\n );\n array_push($duration_array, $duration_in_seconds);\n }\n\n $duration_average = array_sum($duration_array) / count($duration_array);\n\n return round($duration_average, 1) . 's';\n }",
"function obtain_month_profitable($acc_number)\n\t{\n\t return $this->db->select('AVG(pamm_tp_profitable) AS ptp,monthname(pamm_tp_timestamp) AS month, year(pamm_tp_timestamp) AS year')\n\t\t ->from('pamm_tp_results') \n\t\t ->where(\"pamm_tp_account\",$acc_number)\n\t\t ->group_by('monthname(pamm_tp_timestamp)')\n\t\t ->order_by('pamm_tp_timestamp','ASC')\n\t\t ->get()->result();\n\t}",
"public function retrieveRevenueAverage()\n {\n $query = \"SELECT AVG(revenue) AS avgRevenue FROM (SELECT CONCAT(YEAR(date), '/', MONTH(date)) AS theMonth, SUM(exlAmount) AS revenue FROM payment GROUP BY theMonth ORDER BY YEAR(DATE) ASC, MONTH(date) ASC) AS T1;\";\n $result = mysqli_query($GLOBALS['db'], $query);\n $row = mysqli_fetch_assoc($result);\n return $row;\n }",
"public function getAverageFinish()\n {\n $total = $this->teams->reduce(function ($position, $team) {\n return $position + $team->position;\n });\n\n return round($total / $this->teams->count());\n }",
"public function average(): float\n {\n return $this->sum() / $this->count();\n }",
"public function calculateLastMonthScore(EntityManager $em)\r\n {\r\n $sum = 0;\r\n \r\n // set datetime before one week and only add scores of what happened last week\r\n $month = new \\DateTime();\r\n $month->sub(new \\DateInterval('P1M'));\r\n \r\n // trophies\r\n foreach ($this->trophies as $trophy)\r\n if (!is_null($trophy->getReceivedTime()) && $trophy->getReceivedTime() > $month)\r\n $sum += $trophy->getScore();\r\n \r\n // participations\r\n $query = $em\r\n ->createQuery('SELECT p\r\n FROM MensaBattleAPIBundle:Participation p\r\n JOIN p.participant u\r\n WHERE u.id = :id')\r\n ->setParameter('id', $this->id); \r\n $participations = $query->getResult();\r\n // - calculate\r\n foreach ($participations as $participation)\r\n if ($participation->getBeganTime() > $month)\r\n $sum += $participation->getBattle()->getParticipationScore();\r\n \r\n // example photos\r\n $query = $em\r\n ->createQuery('SELECT e\r\n FROM MensaBattleAPIBundle:Example e\r\n JOIN e.participant u\r\n WHERE u.id = :id')\r\n ->setParameter('id', $this->id);\r\n $examples = $query->getResult();\r\n // - calculate\r\n foreach ($examples as $example)\r\n if ($example->getBeganTime() > $month)\r\n $sum += Person::$SCORE_EXAMPLE_PHOTO;\r\n \r\n // ratings\r\n $query = $em\r\n ->createQuery('SELECT r\r\n FROM MensaBattleAPIBundle:Rating r\r\n JOIN r.author u\r\n WHERE u.id = :id')\r\n ->setParameter('id', $this->id);\r\n $ratings = $query->getResult();\r\n // - calculate\r\n foreach ($ratings as $rating)\r\n if ($rating->getTime() > $month)\r\n $sum += Person::$SCORE_RATING;\r\n \r\n return $sum;\r\n }",
"public function avg_time($avg_count = 1)\n\t{\n\t\treturn ($this->endTimer-$this->startTimer)/$avg_count;\n\t}",
"function get_avg_days_to_mitigation($conn, $dept = NULL, $date_start = NULL, $date_end = NULL, $type_restriction = NULL) {\n $filter = get_sql_hazard_filter($dept, $date_start, $date_end, $type_restriction);\n\t$query_days = \"SELECT AVG(t.days) \" .\n\t\t \"FROM (SELECT DATEDIFF(date_mitigated, date) as days \" .\n\t\t \"FROM hazard \" .\n\t\t $filter . \" AND date_mitigated IS NOT NULL AND date IS NOT NULL \" .\n\t\t \"LIMIT 100) as t\";\n\treturn exec_query($conn, $query_days)[0][0];\n}",
"function ros_get_grades_average($grads)\n{\n $povprecje = array();\n $cnt = count($grads);\n $povprecje['mistakes'] = 0;\n $povprecje['timeinseconds'] = 0;\n $povprecje['hitsperminute'] = 0;\n $povprecje['precision'] = 0;\n foreach($grads as $grade)\n {\n $povprecje['mistakes'] = $povprecje['mistakes'] + $grade->mistakes; \n $povprecje['timeinseconds'] = $povprecje['timeinseconds'] + $grade->timeinseconds;\n }\n if($cnt != 0){\n $povprecje['mistakes'] = $povprecje['mistakes'] / $cnt;\n $povprecje['timeinseconds'] = $povprecje['timeinseconds'] / $cnt;\n }\n return $povprecje;\n}",
"public function averageWatchedPerWeek()\n {\n// $totals = array_pluck(\\DB::table('films')\n// ->where('watched', true)\n// ->select(\\DB::raw('count(title) AS count, WEEK(watched_on, 2) AS `week`'))\n// ->groupBy('week')\n// ->get(), 'count');\n\n $total = $this->model->watched()->count();\n\n return number_format($total / floor(\\Carbon\\Carbon::now()->dayOfYear / 7 + 1), 1);\n }",
"public function getAverage(): float\n {\n return $this->average;\n }",
"public function average(){\n $i = 0;\n $total = 0;\n for($i = 0; $i < count($this->collection); $i++){\n $total += $this->collection[$i]->amount;\n }\n if($i == 0)\n return 3;\n return (int)round($total/$i);\n }",
"function monthlyStats($month, $conn){\n $query = $conn->query(\"SELECT * FROM viewer_tbl\");\n $counter = 0;\n while ($data = $query->fetch_array()) {\n $dbMonth = $data['visited_date'];\n if($month == date('F' , strtotime($dbMonth))){\n ++$counter;\n }\n }\n return $counter;\n }"
] |
[
"0.60898495",
"0.60419726",
"0.6036731",
"0.5888668",
"0.5821262",
"0.5768566",
"0.5753833",
"0.5710088",
"0.5691186",
"0.5679693",
"0.5670632",
"0.5667073",
"0.5663346",
"0.56205773",
"0.5612766",
"0.55786866",
"0.5567447",
"0.556689",
"0.55248535",
"0.5521102",
"0.5505262",
"0.54438376",
"0.54299074",
"0.54199016",
"0.5415468",
"0.5409725",
"0.5408152",
"0.5407564",
"0.5406241",
"0.53958863"
] |
0.83187675
|
0
|
Get a string for displaying any pulse
|
public static function PulseString($pulse, $time = 0) {
if ($pulse == 0)
return '';
$hf_max = 0;
$hf_rest = 0;
if ($time != 0 && (time() - $time) > 365*DAY_IN_S) {
$HFmax = DB::getInstance()->query('SELECT `time`,`pulse_max`,`pulse_rest` FROM `'.PREFIX.'user` ORDER BY ABS(`time`-'.$time.') ASC LIMIT 1')->fetch();
if ($HFmax !== false && $HFmax['pulse_max'] != 0)
$hf_max = $HFmax['pulse_max'];
if ($HFmax !== false && $HFmax['pulse_rest'] != 0)
$hf_rest = $HFmax['pulse_rest'];
}
$bpm = self::PulseStringInBpm($pulse);
$hf = self::PulseStringInPercent($pulse, $hf_max);
$hfr = self::PulseStringInPercentReserve($pulse, $hf_max, $hf_rest);
if (CONF_PULS_MODE == 'hfmax')
return Ajax::tooltip($hf, $bpm);
if (CONF_PULS_MODE == 'hfres')
return Ajax::tooltip($hfr, $bpm);
return Ajax::tooltip($bpm, $hfr);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public static function PulseStringInBpm($pulse) {\r\n\t\treturn round($pulse).' bpm';\r\n\t}",
"public function graphic()\n {\n return \"die-\" . $this->value;\n }",
"public function getString(){\n return \"Side: \" . $this -> side\n . \"<br> Volume: \" . $this -> getVolume()\n . \"<br> Surface: \" . $this -> getSurface();\n }",
"public static function PulseStringInPercent($pulse, $hf_max = 0) {\r\n\t\tif ($hf_max == 0)\r\n\t\t\t$hf_max = HF_MAX;\r\n\t\t\r\n\t\treturn round(100*$pulse / $hf_max).' %';\r\n\t}",
"public function graphic()\n {\n return \"dice-\" . $this->getLastRoll();\n }",
"public function speak(){\n switch (strtolower($this->type)){\n case Animal::TYPE_DOG:\n return 'Wooof';\n break;\n\n case Animal::TYPE_CAT:\n return 'Miaouu';\n break;\n \n case Animal::TYPE_BIRD:\n echo 'cui-cui';\n break;\n \n case Animal::TYPE_FISH:\n return 'blub';\n break;\n\n case Animal::TYPE_FERRET:\n return 'Les furets.com';\n break;\n \n default:\n return 'Pfffft';\n break;\n }\n }",
"public function getSay()\n {\n return $this->get(self::_SAY);\n }",
"public function displaynow()\n\t{\n\t\treturn $this->CLI->stringQuery($this->SqueezePlyrID.\" displaynow ? ?\");\n\t}",
"public function getLabel()\n\t{\n\t\techo '<div class=\"clr\"></div>';\n\t\tif ((string)$this->element['hr'] == 'true') {\n\t\t\treturn '<hr />';\n\t\t} else {\n\t\t\treturn parent::getLabel();\n\t\t}\n\t\techo '<div class=\"clr\"></div>';\n\t}",
"function flash_lunas() {\n\n\n return '<span class=\"badge badge-success text-light p-2\">LUNAS</span>';\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 }",
"function getNota_txt()\n {\n $nota_txt = 'Hollla';\n $id_situacion = $this->getId_situacion();\n switch ($id_situacion) {\n case '3': // Magna\n $nota_txt = 'Magna cum laude (8,6-9,5/10)';\n break;\n case '4': // Summa\n $nota_txt = 'Summa cum laude (9,6-10/10)';\n break;\n case '10': // Nota numérica\n $num = $this->getNota_num();\n $max = $this->getNota_max();\n $nota_txt = $num . '/' . $max;\n if ($max == 10) {\n if ($num > 9.5) {\n $nota_txt .= ' ' . _(\"Summa cum laude\");\n } elseif ($num > 8.5) {\n $nota_txt .= ' ' . _(\"Magna cum laude\");\n }\n }\n break;\n default:\n $oNota = new Nota($id_situacion);\n $nota_txt = $oNota->getDescripcion();\n break;\n }\n return $nota_txt;\n }",
"public function display(){\n return $this->string;\n }",
"public function toString()\n {\n return \"GUI is display full\";\n }",
"public function message()\n {\n $menus = $this->menus();\n array_walk($menus, function (&$value, $key) {\n $value = \"{$key}. $value\";\n });\n $menus = implode(\"\\r\\n\", $menus);\n\n return \"Welcome to PHP USSD (PhUSSD) \\r\\n\\r\\n{$menus}\";\n }",
"function flash_belum_lunas() {\n\n\n return '<span class=\"badge badge-danger text-light p-2\">BELUM LUNAS</span>';\n}",
"public function __toString() {\r\n\t\t$return = $this->getName () . ' : every ';\r\n\t\tforeach ( $this->getDays () as $d ) {\r\n\t\t\t$return .= $d . ', ';\r\n\t\t}\r\n\t\t$return .= '<br>from ' . $this->getStartTime () . ' to ' . $this->getEndTime ();\r\n\t\t$return .= '<br>during this time slot : ' . $this->getTimeSlot ();\r\n\t\t\r\n\t\treturn $return;\r\n\t}",
"public function getEchoString()\n {\n return $this->formatter->getPattern();\n }",
"public function getMessage() {\n $ret = \"\";\n if ($this->message !== \"\") {\n $ret = <<<EOF\n <p class=\"dice-message\">{$this->message}</p>\nEOF;\n }\n return $ret;\n }",
"public function asText(){\n $id_length = 2;\n $time_length = 8;\n $times = [];\n foreach($this->times as $id => $time){\n $id_length = max($id_length,strlen($id));\n $time_length = max($time_length,strlen($times[$id] = number_format($time,$this->decimals)));\n }\n $text =\n str_pad('ID',$id_length) . ' | ' . str_pad('time [s]',$time_length,' ',STR_PAD_LEFT) . \"\\n\" .\n str_repeat('-',$id_length) . '-+-' . str_repeat('-',$time_length);\n foreach($this->times as $id => $time)\n $text .= \"\\n\" . str_pad($id,$id_length) . ' | ' . str_pad($times[$id],$time_length,' ',STR_PAD_LEFT);\n return $text;\n }",
"function affiche_info($str) { echo '<p>'.$str.'</p>'; }",
"public function __toString() : string\n {\n $color = array_key_exists($this->getSuit(), SuitInterface::SUIT_COLOR)\n ? SuitInterface::SUIT_COLOR[$this->getSuit()]\n : 'black';\n return \"<span style='color: $color'>{$this->figure}{$this->suit}</span>\";\n }",
"public function render() : string\n {\n $res = \"\";\n $playerRenders = [];\n\n if ($this->player->shouldRender()) {\n $playerRenders[] = $this->player->render();\n }\n\n if ($this->cpu->shouldRender()) {\n $playerRenders[] = $this->cpu->render();\n }\n\n // render histogram\n if (!empty($playerRenders)) {\n // Set data to the histogram before rendering\n $this->injectData($this->player, $this->cpu);\n\n // Render the player tosses and stats\n $res .= \"<div class=\\\"players\\\">\";\n foreach ($playerRenders as $str) {\n $res .= $str;\n }\n $res .= \"</div>\";\n\n // Render the histogram\n $res .= \"<div class=\\\"histogram\\\">\";\n $res .= \"<h2>Histogram för rundan</h2>\";\n $res .= $this->renderHistogram();\n $res .= \"</div>\";\n }\n\n return $res;\n }",
"static public function Out(){\r\n\t\tif(func_num_args() == 1) return func_get_arg(0);\r\n\t\t\r\n\t\t$args = func_get_args();\r\n\t\t$str = array_shift($args);\r\n\t\treturn vsprintf($str, $args);\r\n\t}",
"public function toString() {\n if (! $this->_value) {\n return '';\n }\n\n $s = array ();\n\n foreach ( $this->_visibleUnits as $unit ) {\n if (! is_array ( $unit ) || ! is_string ( $unit [0] )) {\n continue;\n }\n\n if ($this->_value / $unit [0] > 1) {\n $t = floor ( $this->_value / $unit [0] );\n $s [] = $t . ' ' . $unit [1];\n $this->_value -= $unit [0] * $t;\n }\n }\n\n return implode ( ' ', $s );\n }",
"public function message()\n {\n return 'This chest is in cool down. Try again later.';\n }",
"public function renderAnimes() {\n\t\t$result = '';\n\t\tforeach ($this->getAnimes() as $anime) {\n\t\t\t$result .= $this->renderAnime($anime);\n\t\t}\t\t\n\t\treturn $result;\n\t}",
"public function __toString():string\n {\n return $this->getParticle();\n }",
"function draw($meter)\r\n{\r\n if(empty($meter))\r\n {\r\n return \"-\";\r\n }\r\n else\r\n {\r\n return $meter; \r\n }\r\n}",
"public function getOutput()\n\t{\n\t\tif( ! IPSLib::appIsInstalled( 'calendar' ) )\n\t\t{\n\t\t\treturn '';\n\t\t}\n\t\t\n\t\t/* Load language */\n\t\t$this->registry->class_localization->loadLanguageFile( array( 'public_calendar' ), 'calendar' );\n\n\t\t/* Load calendar library */\n\t\t$classToLoad = IPSLib::loadActionOverloader( IPSLib::getAppDir( 'calendar' ) .'/modules_public/calendar/view.php', 'public_calendar_calendar_view' );\n\t\t$cal = new $classToLoad();\n\t\t$cal->makeRegistryShortcuts( $this->registry );\n\t\t\n\t\tif( !$cal->initCalendar( true ) )\n\t\t{\n\t\t\treturn '';\n\t\t}\n\n\t\t/* Return calendar */\n\t\treturn \"<div id='hook_calendar' class='calendar_wrap'>\". $cal->getMiniCalendar( date('n'), date('Y') ) . '</div><br />';\n\t}"
] |
[
"0.62972134",
"0.5953339",
"0.5766476",
"0.5679193",
"0.5675206",
"0.5620426",
"0.5619044",
"0.5561946",
"0.55555975",
"0.5548508",
"0.5535936",
"0.5534061",
"0.5475467",
"0.5475327",
"0.5474312",
"0.54663473",
"0.5451991",
"0.54434836",
"0.5429844",
"0.5411738",
"0.5404277",
"0.5395615",
"0.5390979",
"0.53719026",
"0.5358843",
"0.53503114",
"0.53476304",
"0.5316622",
"0.5316248",
"0.53091836"
] |
0.6410562
|
0
|
Get string for pulse [bpm]
|
public static function PulseStringInBpm($pulse) {
return round($pulse).' bpm';
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public static function PulseString($pulse, $time = 0) {\r\n\t\tif ($pulse == 0)\r\n\t\t\treturn '';\r\n\r\n\t\t$hf_max = 0;\r\n\t\t$hf_rest = 0;\r\n\r\n\t\tif ($time != 0 && (time() - $time) > 365*DAY_IN_S) {\r\n\t\t\t$HFmax = DB::getInstance()->query('SELECT `time`,`pulse_max`,`pulse_rest` FROM `'.PREFIX.'user` ORDER BY ABS(`time`-'.$time.') ASC LIMIT 1')->fetch();\r\n\t\t\tif ($HFmax !== false && $HFmax['pulse_max'] != 0)\r\n\t\t\t\t$hf_max = $HFmax['pulse_max'];\r\n\t\t\tif ($HFmax !== false && $HFmax['pulse_rest'] != 0)\r\n\t\t\t\t$hf_rest = $HFmax['pulse_rest'];\r\n\t\t}\r\n\r\n\t\t$bpm = self::PulseStringInBpm($pulse);\r\n\t\t$hf = self::PulseStringInPercent($pulse, $hf_max);\r\n\t\t$hfr = self::PulseStringInPercentReserve($pulse, $hf_max, $hf_rest);\r\n\r\n\t\tif (CONF_PULS_MODE == 'hfmax')\r\n\t\t\treturn Ajax::tooltip($hf, $bpm);\r\n\r\n\t\tif (CONF_PULS_MODE == 'hfres')\r\n\t\t\treturn Ajax::tooltip($hfr, $bpm);\r\n\t\t\t\r\n\t\treturn Ajax::tooltip($bpm, $hfr);\r\n\t}",
"function parseSMSBatteryMT90($text) {\n $matches = array();\n preg_match(\"/BAT=[0-9]+%/\", $text, $matches);\n if (!empty($matches)) {\n return substr($matches[0], 4);\n } else {\n return \"NA\";\n }\n}",
"public static function PulseStringInPercent($pulse, $hf_max = 0) {\r\n\t\tif ($hf_max == 0)\r\n\t\t\t$hf_max = HF_MAX;\r\n\t\t\r\n\t\treturn round(100*$pulse / $hf_max).' %';\r\n\t}",
"public static function PulseStringInPercentReserve($pulse, $hf_max = 0, $hf_rest = 0) {\r\n\t\treturn self::PulseInPercentReserve($pulse, $hf_max, $hf_rest).' %';\r\n\t}",
"protected function get_barometer( ) {\n// Format is Annnn where nnnn represents a real number as nn.nn in inches of Hg,\n// or Qpppp where pppp = hectoPascals.\n// Some other common conversion factors:\n// 1 millibar = 1 hPa\n// 1 in Hg = 0.02953 hPa\n// 1 mm Hg = 25.4 in Hg = 0.750062 hPa\n// 1 lb/sq in = 0.491154 in Hg = 0.014504 hPa\n// 1 atm = 0.33421 in Hg = 0.0009869 hPa\n if (preg_match('#^(A|Q|QNH)([0-9]{4})(INS)?#',$this->current_group_text,$pieces)) {\n $this->wxInfo['ITEMS'][$this->tend]['CODE_BAROMETER'] = $this->current_group_text;\n if ($pieces[1] == 'A' || preg_match('#^(QNH)([0-9]{4})INS$#',$this->current_group_text,$pieces1)) {\n $pressureIN = substr($pieces1[2],0,2) . '.' . substr($pieces1[2],2); // units are inches Hg\n $pressureHPA = round($pressureIN / 0.02953); // convert to hectoPascals\n }\n else {\n $pressureHPA = (integer)$pieces[2]; // units are hectoPascals\n $pressureIN = round(0.02953 * $pressureHPA,2); // convert to inches Hg\n }\n $this->wxInfo['ITEMS'][$this->tend]['BAROMETER_IN'] = $pressureIN;\n $this->wxInfo['ITEMS'][$this->tend]['BAROMETER_HPA'] = $pressureHPA;\n $this->current_ptr++;\n $this->current_group++;\n }\n else {\n $this->current_group++;\n }\n }",
"public static function PulseStringInPercentHRmax($pulse, $hf_max = 0, $hf_rest = 0) {\r\n\t\tif ($hf_max == 0)\r\n\t\t\t$hf_max = HF_MAX;\r\n\t\tif ($hf_rest == 0)\r\n\t\t\t$hf_rest = HF_REST;\r\n\t\t\r\n\t\treturn round(100*($pulse - $hf_rest) / ($hf_max - $hf_rest)).' %';\r\n\t}",
"public function pulse(int $pin = 0, int $on_ms = 120, int $off_ms = 240)\n {\n self::validateInteger($pin, 0, 1, __FUNCTION__);\n self::validateInteger($on_ms, 1, 511, __FUNCTION__);\n self::validateInteger($off_ms, 1, 511, __FUNCTION__);\n $pin_value = $pin + 48; // Character '0' or '1'.\n $on_value = intdiv($on_ms, 2);\n $off_value = intdiv($off_ms, 2);\n $this -> connector -> write(self::ESC . \"p\" . chr($pin_value) . chr($on_value) . chr($off_value));\n }",
"public function getMagneticFieldPeriod()\n {\n $payload = '';\n\n $data = $this->sendRequest(self::FUNCTION_GET_MAGNETIC_FIELD_PERIOD, $payload);\n\n $payload = unpack('V1period', $data);\n\n return IPConnection::fixUnpackedUInt32($payload['period']);\n }",
"function rlip_schedule_period_minutes($period) {\n $period_elems = array('d' => DAYSECS/60,\n 'h' => HOURSECS/60,\n 'm' => 1);\n $parray = str_split($period);\n $num = '';\n $min = 0;\n foreach ($parray as $char) {\n if (ctype_space($char)) {\n continue;\n } else if (ctype_digit($char)) {\n $num .= $char;\n } else {\n if (!array_key_exists($char, $period_elems)) {\n return -1; // error\n }\n $multiplier = $period_elems[$char];\n $min += intval($num) * $multiplier;\n $num = '';\n }\n }\n return $min;\n}",
"public static function getSchedulePattern(): string;",
"public function getDebouncePeriod()\n {\n $payload = '';\n\n $data = $this->sendRequest(self::FUNCTION_GET_DEBOUNCE_PERIOD, $payload);\n\n $payload = unpack('V1debounce', $data);\n\n return IPConnection::fixUnpackedUInt32($payload['debounce']);\n }",
"private function dur($duration) {\r\n $Offset = strpos($duration, 'd');\r\n $x = substr($duration, 0, $Offset);\r\n return ($x*8);\r\n }",
"function getnote($num)\n{\n\tswitch ($num) {\n\t\tcase 1 : return 'Insuffisant';\n\t\tcase 3 : return 'Suffisant';\n\t\tcase 4 : return 'Bon';\n\t\tcase 5 : return 'Tres bon';\n\t}\n}",
"public static function getFormat(): string;",
"public function getQuaternionPeriod()\n {\n $payload = '';\n\n $data = $this->sendRequest(self::FUNCTION_GET_QUATERNION_PERIOD, $payload);\n\n $payload = unpack('V1period', $data);\n\n return IPConnection::fixUnpackedUInt32($payload['period']);\n }",
"protected function getMagicString() {\n $result = $this->callWbs('once', 'get');\n return $result['body']['once'];\n }",
"public function multimedia_anime_highspeed()\n\t{\n\t\tif (preg_match('/.+? \\((360|480|720|1080)p\\|.+? ~bY .+? \\[\\d+\\/\\d+\\] - \"(.+?\\[[A-F0-9]+\\].+?)' .\n\t\t\t\t\t $this->e1,\n\t\t\t\t\t $this->subject,\n\t\t\t\t\t $match)\n\t\t) {\n\t\t\treturn $match[2];\n\t\t}\n\t\treturn array(\n\t\t\t\"cleansubject\" => $this->releaseCleanerHelper($this->subject), \"properlynamed\" => false\n\t\t);\n\t}",
"function msg_get($umd=NULL){\n $keys = is_null($umd)?$this->domain_seq:(array)$umd;\n $res = array();\n foreach($keys as $ck) $res[$ck] = $this->domains[$ck]->msg_get();\n return is_array($umd)?$res:array_shift($res);\n }",
"public function getSay()\n {\n return $this->get(self::_SAY);\n }",
"public function getAngularVelocityPeriod()\n {\n $payload = '';\n\n $data = $this->sendRequest(self::FUNCTION_GET_ANGULAR_VELOCITY_PERIOD, $payload);\n\n $payload = unpack('V1period', $data);\n\n return IPConnection::fixUnpackedUInt32($payload['period']);\n }",
"protected function get_probality( ) {\n// depending on the temperature, Heat Index or Wind Chill Temperature is calculated.\n// Format is tt/dd where tt = temperature and dd = dew point temperature. All units are\n// in Celsius. A 'M' preceeding the tt or dd indicates a negative temperature. Some\n// stations do not report dew point, so the format is tt/ or tt/XX.\n\n if (preg_match('#^PROB([0-9]{2})#',$this->current_group_text,$pieces)) {\n $this->tend++;\n $this->wxInfo['ITEMS'][$this->tend]['CODE_PROBABILITY'] = $this->current_group_text;\n $this->wxInfo['ITEMS'][$this->tend]['PROBABILITY'] = $pieces[1];\n $this->tend--;\n $this->current_ptr++;\n $this->current_group++;\n return;\n }\n\n $this->current_group++;\n\n }",
"public function getDurationAsString() {\n $years = floor($this->months / 12);\n $extraMonths = $this->months % 12;\n if ($years<=0) {\n // code...\n return \"$extraMonths meses\";\n }if($extraMonths==0){\n return \"$years años\";\n }\n else {\n return \"$years años $extraMonths meses\";\n }\n \n }",
"function shGetMosMsg($string)\n{\n\t$matches = array();\n\t$result = preg_match('/(&|\\?)mosmsg=[^&]*/i', $string, $matches);\n\tif (!empty($matches))\n\t\treturn JString::trim($matches[0], '&?');\n\telse\n\t\treturn '';\n}",
"public function getABBR(){\n\t\t\tif($this->genre == 'masculin'){\n\t\t\t\t$abbr = 'MR';\n\t\t\t}else{\n\t\t\t\t$abbr = 'MMS';\n\t\t\t}\n\t\t\treturn $abbr;\n\t\t}",
"public function getPattern(): string;",
"public function getPattern(): string;",
"public function format(): string\n {\n foreach ($this->times as $unit => $value) {\n if ($this->time >= $value) {\n $time = floor($this->time / $value * 100) / 100;\n return \"{$time} {$unit}\";\n }\n }\n\n return round($this->time * 1000) . \" ms\";\n }",
"public function duration()\n\t{\n\t\treturn $this->CLI->stringQuery($this->SqueezePlyrID.\" duration ?\");\n\t}",
"public function getLabel(): string {\n $label = trim($this->brief_journal_title->value ?? '');\n $volume = trim($this->volume->value ?? '');\n $issue = trim($this->issue->value ?? '');\n $pagination = trim($this->pagination->value ?? '');\n $year = trim($this->year->value ?? '');\n if (!empty($issue)) {\n $volume .= '(' . $issue . ')';\n }\n if (!empty($volume)) {\n $label .= \" $volume\";\n }\n if (!empty($pagination)) {\n $label .= \": $pagination\";\n }\n if (!empty($year)) {\n $label .= \", $year\";\n }\n return $label;\n }",
"function skyper($message, $pocsagric) {\n $output = \"\";\n $messageTextArray = str_split($message);\n \n if ($pocsagric == \"0002504\") { // Skyper OTA TimeSync Messages\n\t$output = \"[Skyper OTA Time] \".$message;\n\treturn $output;\n }\n \n if ($pocsagric == \"0004512\") { // Skyper Rubric Index\n\tif (isset($messageTextArray[0])) { // This is hard coded to 1 for rubric index\n\t unset($messageTextArray[0]);\n\t}\n\tif (isset($messageTextArray[1])) { // Rubric Number\n\t $skyperRubric = ord($messageTextArray[1]) - 31;\n\t unset($messageTextArray[1]);\n\t}\n\tif (isset($messageTextArray[2])) { // Message number, hard coded to 10 for Rubric Index\n\t unset($messageTextArray[2]);\n\t}\n\t\n\tif (count($messageTextArray) >= 1) { // Check to see if there is a message to decode\n\t $output = \"[Skyper Index Rubric:$skyperRubric] \".un_rot(implode($messageTextArray));\n\t}\n\telse {\n\t $output = \"[Skyper Index Rubric:$skyperRubric] No Name\";\n\t}\n\treturn $output;\n }\n \n if ($pocsagric == \"0004520\") { // Skyper Message\n\tif (isset($messageTextArray[0])) { // Rubric Number\n\t $skyperRubric = ord($messageTextArray[0]) - 31;\n\t unset($messageTextArray[0]);\n\t}\n\tif (isset($messageTextArray[1])) { // Message number\n\t $skyperMsgNr = ord($messageTextArray[1]) - 32;\n\t unset($messageTextArray[1]);\n\t}\n\t\n\tif (count($messageTextArray) >= 1) { // Check to see if there is a message to decode\n\t $output = \"[Skyper Rubric:$skyperRubric Msg:$skyperMsgNr] \".un_rot(implode($messageTextArray));\n\t}\n\telse {\n\t $output = \"[Skyper Rubric:$skyperRubric] No Message\";\n\t}\n\treturn $output;\n }\n}"
] |
[
"0.6390728",
"0.61920226",
"0.58209085",
"0.51919925",
"0.51807094",
"0.5094948",
"0.5035294",
"0.48548874",
"0.48483163",
"0.4828658",
"0.48189285",
"0.48034194",
"0.4763777",
"0.47488412",
"0.47056884",
"0.46789655",
"0.46767196",
"0.46698028",
"0.4657336",
"0.4651498",
"0.46463826",
"0.4625816",
"0.46240702",
"0.46136588",
"0.46085566",
"0.46085566",
"0.45986792",
"0.4586707",
"0.4582477",
"0.4559444"
] |
0.7604441
|
0
|
Get string for pulse [%HFmax]
|
public static function PulseStringInPercent($pulse, $hf_max = 0) {
if ($hf_max == 0)
$hf_max = HF_MAX;
return round(100*$pulse / $hf_max).' %';
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public static function PulseStringInPercentHRmax($pulse, $hf_max = 0, $hf_rest = 0) {\r\n\t\tif ($hf_max == 0)\r\n\t\t\t$hf_max = HF_MAX;\r\n\t\tif ($hf_rest == 0)\r\n\t\t\t$hf_rest = HF_REST;\r\n\t\t\r\n\t\treturn round(100*($pulse - $hf_rest) / ($hf_max - $hf_rest)).' %';\r\n\t}",
"public static function PulseStringInPercentReserve($pulse, $hf_max = 0, $hf_rest = 0) {\r\n\t\treturn self::PulseInPercentReserve($pulse, $hf_max, $hf_rest).' %';\r\n\t}",
"public static function PulseInPercentHRmax($pulse, $hf_max = 0) {\r\n\t\tif ($hf_max == 0)\r\n\t\t\t$hf_max = HF_MAX;\r\n\r\n\t\treturn round(100*$pulse / $hf_max);\r\n\t}",
"public static function PulseStringInBpm($pulse) {\r\n\t\treturn round($pulse).' bpm';\r\n\t}",
"public static function PulseString($pulse, $time = 0) {\r\n\t\tif ($pulse == 0)\r\n\t\t\treturn '';\r\n\r\n\t\t$hf_max = 0;\r\n\t\t$hf_rest = 0;\r\n\r\n\t\tif ($time != 0 && (time() - $time) > 365*DAY_IN_S) {\r\n\t\t\t$HFmax = DB::getInstance()->query('SELECT `time`,`pulse_max`,`pulse_rest` FROM `'.PREFIX.'user` ORDER BY ABS(`time`-'.$time.') ASC LIMIT 1')->fetch();\r\n\t\t\tif ($HFmax !== false && $HFmax['pulse_max'] != 0)\r\n\t\t\t\t$hf_max = $HFmax['pulse_max'];\r\n\t\t\tif ($HFmax !== false && $HFmax['pulse_rest'] != 0)\r\n\t\t\t\t$hf_rest = $HFmax['pulse_rest'];\r\n\t\t}\r\n\r\n\t\t$bpm = self::PulseStringInBpm($pulse);\r\n\t\t$hf = self::PulseStringInPercent($pulse, $hf_max);\r\n\t\t$hfr = self::PulseStringInPercentReserve($pulse, $hf_max, $hf_rest);\r\n\r\n\t\tif (CONF_PULS_MODE == 'hfmax')\r\n\t\t\treturn Ajax::tooltip($hf, $bpm);\r\n\r\n\t\tif (CONF_PULS_MODE == 'hfres')\r\n\t\t\treturn Ajax::tooltip($hfr, $bpm);\r\n\t\t\t\r\n\t\treturn Ajax::tooltip($bpm, $hfr);\r\n\t}",
"public static function PulseInPercentReserve($pulse, $hf_max = 0, $hf_rest = 0) {\r\n\t\tif ($hf_max == 0)\r\n\t\t\t$hf_max = HF_MAX;\r\n\r\n\t\tif ($hf_rest == 0)\r\n\t\t\t$hf_rest = HF_REST;\r\n\r\n\t\treturn round(100*($pulse - $hf_rest) / ($hf_max - $hf_rest));\r\n\t}",
"function parseSMSBatteryMT90($text) {\n $matches = array();\n preg_match(\"/BAT=[0-9]+%/\", $text, $matches);\n if (!empty($matches)) {\n return substr($matches[0], 4);\n } else {\n return \"NA\";\n }\n}",
"function su($s, $max=0)\n\t\t{\n\t\t\t$ret = self::values($s);\n\t\t\t$r = trim(strip_tags($ret[0]));\n\n\t\t\tif($max && (strlen($r) > $max))\n\t\t\t{\n\t\t\t\tif($max < 4)\n\t\t\t\t\treturn mb_substr($r, $max);\n\t\t\t\telse\n\t\t\t\t\treturn mb_substr($r, $max-3).'...';\n\t\t\t}\n\n\t\t\tif($r == '')\n\t\t\t\t$r = '<i>no value</i>';\n\t\t\n\t\t\treturn $r;\n\t\t}",
"public static function PulseInPercent($pulse, $hf_max = 0, $hf_rest = 0) {\r\n\t\tif (CONF_PULS_MODE == 'hfres')\r\n\t\t\treturn self::PulseInPercentReserve($pulse, $hf_max, $hf_rest);\r\n\r\n\t\treturn self::PulseInPercentHRmax($pulse, $hf_max);\r\n\t}",
"public function message()\n {\n return 'Max Hours must be greater than or equal to Min Hours ';\n }",
"protected function buildValueLabel() : string\n {\n // if min is negative it can be longer than the max value...\n $iLen = (strlen((string)$this->iMin) > strlen((string)$this->iMax)) ? strlen((string)$this->iMin) : strlen((string)$this->iMax);\n\n $strHTML = '<label class=\"slider_label\"';\n $strHTML .= ' for=\"' . $this->strID . '\"';\n $strHTML .= ' style=\"width: ' . $iLen . 'em;';\n if ($this->oFlags->isSet(FormFlags::ALIGN_RIGHT)) {\n $strHTML .= ' text-align: right;';\n }\n $strHTML .= '\">';\n $strHTML .= $this->iValue;\n $strHTML .= '</label>' . PHP_EOL;\n\n return $strHTML;\n }",
"public function message()\n {\n return 'The full limit is maximum '.request('fullLimit');\n }",
"public static function getFormat(): string;",
"function qualificationGest(): string\n{\n $FtPqr = getFtPqr();\n $FtPqrCalificacion = $FtPqr->getLastCalificacion();\n\n return $FtPqrCalificacion ? $FtPqrCalificacion->getFieldValue('experiencia_gestion') : '-';\n}",
"public function getLabel(): string\n {\n return $this->function_fqsen_label;\n }",
"protected function getLastHeartBeat(): string\n {\n $out = '<div class=\"alert alert-danger\" role=\"alert\">No heart beat run yet</div>';\n // SELECT * FROM `cron_log` WHERE 1 AND FIND_IN_SET('heartbeat_pulse', tasks) > 0 ORDER BY run_time DESC LIMIT 1\n /** @var CronLog $last_beat */\n $last_beat = $this->getContainer()->call([CronLog::class, 'select'], ['options' => ['where' => [\"1 AND FIND_IN_SET('heartbeat_pulse', tasks) > 0\"], 'orderBy' => ['run_time DESC'], 'limitCount' => 1]])->fetch();\n\n if ($last_beat != null) {\n $lasbeat_date = new DateTime($last_beat['run_time']);\n $now = new DateTime();\n\n $interval = date_diff($lasbeat_date, $now);\n $differenceFormat = '%y Year %m Month %d Day, %h Hours %i Minutes %s Seconds';\n $out = '<div class=\"alert alert-' . (abs($lasbeat_date->getTimestamp() - $now->getTimestamp()) < self::ATTENTION_SPAN ? 'success' : 'warning') . '\" role=\"alert\">Last Beat on ' . $last_beat['run_time'] . ' (' . $interval->format($differenceFormat) . ' ago)</div>';\n }\n return $out;\n }",
"public function getFullScore() : string\n {\n return sprintf('%d - %d', $this->score->get('home'), $this->score->get('away'));\n }",
"function getFace() :string {\n switch (($this->getNumber() % 8)){\n case 0:\n $face = '7';\n break;\n case 1:\n $face = '8';\n break;\n case 2:\n $face = '9';\n break;\n case 3:\n $face = '10';\n break;\n case 4:\n $face = 'J';\n break;\n case 5:\n $face = 'Q';\n break;\n case 6:\n $face = 'K';\n break;\n case 7:\n $face = 'A';\n break;\n }\n return $face;\n }",
"public function expiryMaxHuman(): ?string\n {\n return static::expiryTimeToHuman($this->expiryMax());\n }",
"public function getHistogramMax();",
"function getNota_txt()\n {\n $nota_txt = 'Hollla';\n $id_situacion = $this->getId_situacion();\n switch ($id_situacion) {\n case '3': // Magna\n $nota_txt = 'Magna cum laude (8,6-9,5/10)';\n break;\n case '4': // Summa\n $nota_txt = 'Summa cum laude (9,6-10/10)';\n break;\n case '10': // Nota numérica\n $num = $this->getNota_num();\n $max = $this->getNota_max();\n $nota_txt = $num . '/' . $max;\n if ($max == 10) {\n if ($num > 9.5) {\n $nota_txt .= ' ' . _(\"Summa cum laude\");\n } elseif ($num > 8.5) {\n $nota_txt .= ' ' . _(\"Magna cum laude\");\n }\n }\n break;\n default:\n $oNota = new Nota($id_situacion);\n $nota_txt = $oNota->getDescripcion();\n break;\n }\n return $nota_txt;\n }",
"public function getFG() {\n\t\t\treturn \"<p>FG Pct: \".$this->fg.\"</p>\";\n\t\t}",
"public function getValue(): string\n {\n return gmp_strval($this->value);\n }",
"public function getStartAtMax(): ?string\n {\n return $this->startAtMax;\n }",
"function getHigh() { return $this->readHigh(); }",
"function HaarMaxPower($data) //input HaarPower result in frames\n {\n\t$max = $data[0]; //принимаем первый фрейм как минимальный\n\t$frames = count($data);\n\tforeach($data as $frame => $subvalue)\n\t foreach($subvalue as $order => $value)\n\t\tif ($max[$order] < $value) $max[$order] = $value;\n\treturn $max;\n }",
"public function getHeure(): string\r\n {\r\n return $this->heure;\r\n }",
"public function getAsText()\n {\n // Do not show histogram before first roll after restoring session.\n // Dice has not been initialized yet. $this->max has no value.\n if (!$this->max) {\n return \"\";\n }\n $histo = [];\n $histo = array_fill($this->min, $this->max - $this->min + 1, 0);\n\n foreach ($this->serie as $value) {\n $histo[$value]++;\n }\n\n // Print out\n $res = \"\";\n foreach ($histo as $key => $value) {\n $res .= $key . \": \" . str_repeat('*', $value) . \"<br>\";\n }\n return $res;\n }",
"public function text($max = '') {\n\t\t\t\n\t\t\t$output = '';\n\n\t\t\t$style = get_theme_option('blog_options', 'post_excerpt');\n\t\t\t$max = isset($max) && $max != '' ? $max : get_theme_option('blog_options', 'post_excerpt_length');\n\n\t\t\tif ($style === '2') {\n\n\t\t\t\t$output = get_the_excerpt();\n\t\t\t}\n\t\t\telse {\n\n\t\t\t\t$output = get_text_excerpt(strip_shortcodes($this->post->post_content), $max);\n\t\t\t}\n\n\t\t\treturn $output;\n\t\t}",
"public function getTituloCorto($max=15){\r\n if($this->titulo)\r\n return substr($this->getTitulo(), 0, $max);\r\n else\r\n return \"Sin titulo\";\r\n }"
] |
[
"0.7385833",
"0.6884543",
"0.6306246",
"0.5665393",
"0.5637104",
"0.55561644",
"0.55329233",
"0.5491132",
"0.53176165",
"0.51797426",
"0.51271296",
"0.5028008",
"0.50100213",
"0.49884233",
"0.49599186",
"0.49563447",
"0.49520534",
"0.49383733",
"0.4928601",
"0.49253798",
"0.4854822",
"0.48507807",
"0.4748609",
"0.47485366",
"0.4743495",
"0.47432008",
"0.47278863",
"0.472096",
"0.4714037",
"0.4712275"
] |
0.7416421
|
0
|
Get string for pulse [%HRmax]
|
public static function PulseStringInPercentHRmax($pulse, $hf_max = 0, $hf_rest = 0) {
if ($hf_max == 0)
$hf_max = HF_MAX;
if ($hf_rest == 0)
$hf_rest = HF_REST;
return round(100*($pulse - $hf_rest) / ($hf_max - $hf_rest)).' %';
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public static function PulseStringInPercent($pulse, $hf_max = 0) {\r\n\t\tif ($hf_max == 0)\r\n\t\t\t$hf_max = HF_MAX;\r\n\t\t\r\n\t\treturn round(100*$pulse / $hf_max).' %';\r\n\t}",
"public static function PulseStringInPercentReserve($pulse, $hf_max = 0, $hf_rest = 0) {\r\n\t\treturn self::PulseInPercentReserve($pulse, $hf_max, $hf_rest).' %';\r\n\t}",
"public static function PulseInPercentHRmax($pulse, $hf_max = 0) {\r\n\t\tif ($hf_max == 0)\r\n\t\t\t$hf_max = HF_MAX;\r\n\r\n\t\treturn round(100*$pulse / $hf_max);\r\n\t}",
"public static function PulseStringInBpm($pulse) {\r\n\t\treturn round($pulse).' bpm';\r\n\t}",
"public static function PulseString($pulse, $time = 0) {\r\n\t\tif ($pulse == 0)\r\n\t\t\treturn '';\r\n\r\n\t\t$hf_max = 0;\r\n\t\t$hf_rest = 0;\r\n\r\n\t\tif ($time != 0 && (time() - $time) > 365*DAY_IN_S) {\r\n\t\t\t$HFmax = DB::getInstance()->query('SELECT `time`,`pulse_max`,`pulse_rest` FROM `'.PREFIX.'user` ORDER BY ABS(`time`-'.$time.') ASC LIMIT 1')->fetch();\r\n\t\t\tif ($HFmax !== false && $HFmax['pulse_max'] != 0)\r\n\t\t\t\t$hf_max = $HFmax['pulse_max'];\r\n\t\t\tif ($HFmax !== false && $HFmax['pulse_rest'] != 0)\r\n\t\t\t\t$hf_rest = $HFmax['pulse_rest'];\r\n\t\t}\r\n\r\n\t\t$bpm = self::PulseStringInBpm($pulse);\r\n\t\t$hf = self::PulseStringInPercent($pulse, $hf_max);\r\n\t\t$hfr = self::PulseStringInPercentReserve($pulse, $hf_max, $hf_rest);\r\n\r\n\t\tif (CONF_PULS_MODE == 'hfmax')\r\n\t\t\treturn Ajax::tooltip($hf, $bpm);\r\n\r\n\t\tif (CONF_PULS_MODE == 'hfres')\r\n\t\t\treturn Ajax::tooltip($hfr, $bpm);\r\n\t\t\t\r\n\t\treturn Ajax::tooltip($bpm, $hfr);\r\n\t}",
"public function message()\n {\n return 'Max Hours must be greater than or equal to Min Hours ';\n }",
"public function expiryMaxHuman(): ?string\n {\n return static::expiryTimeToHuman($this->expiryMax());\n }",
"function su($s, $max=0)\n\t\t{\n\t\t\t$ret = self::values($s);\n\t\t\t$r = trim(strip_tags($ret[0]));\n\n\t\t\tif($max && (strlen($r) > $max))\n\t\t\t{\n\t\t\t\tif($max < 4)\n\t\t\t\t\treturn mb_substr($r, $max);\n\t\t\t\telse\n\t\t\t\t\treturn mb_substr($r, $max-3).'...';\n\t\t\t}\n\n\t\t\tif($r == '')\n\t\t\t\t$r = '<i>no value</i>';\n\t\t\n\t\t\treturn $r;\n\t\t}",
"public function getAsText()\n {\n // Do not show histogram before first roll after restoring session.\n // Dice has not been initialized yet. $this->max has no value.\n if (!$this->max) {\n return \"\";\n }\n $histo = [];\n $histo = array_fill($this->min, $this->max - $this->min + 1, 0);\n\n foreach ($this->serie as $value) {\n $histo[$value]++;\n }\n\n // Print out\n $res = \"\";\n foreach ($histo as $key => $value) {\n $res .= $key . \": \" . str_repeat('*', $value) . \"<br>\";\n }\n return $res;\n }",
"function parseSMSBatteryMT90($text) {\n $matches = array();\n preg_match(\"/BAT=[0-9]+%/\", $text, $matches);\n if (!empty($matches)) {\n return substr($matches[0], 4);\n } else {\n return \"NA\";\n }\n}",
"function getNota_txt()\n {\n $nota_txt = 'Hollla';\n $id_situacion = $this->getId_situacion();\n switch ($id_situacion) {\n case '3': // Magna\n $nota_txt = 'Magna cum laude (8,6-9,5/10)';\n break;\n case '4': // Summa\n $nota_txt = 'Summa cum laude (9,6-10/10)';\n break;\n case '10': // Nota numérica\n $num = $this->getNota_num();\n $max = $this->getNota_max();\n $nota_txt = $num . '/' . $max;\n if ($max == 10) {\n if ($num > 9.5) {\n $nota_txt .= ' ' . _(\"Summa cum laude\");\n } elseif ($num > 8.5) {\n $nota_txt .= ' ' . _(\"Magna cum laude\");\n }\n }\n break;\n default:\n $oNota = new Nota($id_situacion);\n $nota_txt = $oNota->getDescripcion();\n break;\n }\n return $nota_txt;\n }",
"public static function min2str($min)\n {\n if ($min === null)\n return null;\n $m = $min % 60;\n $h = ($min - $m) / 60;\n return substr(100 + $h, 1) . ':' . substr(100 + $m, 1);\n }",
"public function getFullScore() : string\n {\n return sprintf('%d - %d', $this->score->get('home'), $this->score->get('away'));\n }",
"public function getHistogramMax();",
"public static function PulseInPercentReserve($pulse, $hf_max = 0, $hf_rest = 0) {\r\n\t\tif ($hf_max == 0)\r\n\t\t\t$hf_max = HF_MAX;\r\n\r\n\t\tif ($hf_rest == 0)\r\n\t\t\t$hf_rest = HF_REST;\r\n\r\n\t\treturn round(100*($pulse - $hf_rest) / ($hf_max - $hf_rest));\r\n\t}",
"public function getHeure(): string\r\n {\r\n return $this->heure;\r\n }",
"protected function buildValueLabel() : string\n {\n // if min is negative it can be longer than the max value...\n $iLen = (strlen((string)$this->iMin) > strlen((string)$this->iMax)) ? strlen((string)$this->iMin) : strlen((string)$this->iMax);\n\n $strHTML = '<label class=\"slider_label\"';\n $strHTML .= ' for=\"' . $this->strID . '\"';\n $strHTML .= ' style=\"width: ' . $iLen . 'em;';\n if ($this->oFlags->isSet(FormFlags::ALIGN_RIGHT)) {\n $strHTML .= ' text-align: right;';\n }\n $strHTML .= '\">';\n $strHTML .= $this->iValue;\n $strHTML .= '</label>' . PHP_EOL;\n\n return $strHTML;\n }",
"public function render()\n {\n\t\treturn array('max:' . ($this->_validator->getMax() - 1));\n }",
"public function message()\n {\n return 'The age can be 110 years maximum';\n }",
"public function get_stats_string();",
"public function getPressureHpa();",
"public function message()\n {\n if($this->checkDay == 0){\n if($this->type == 0){\n return 'The :attribute of Semester must be after 3 Months.';\n }\n elseif($this->type == 1){\n return 'The :attribute of Semester must be after 90 Days.';\n }\n }\n elseif($this->checkDay == 1){\n return 'The :attribute of Semester must be end by Thursday';\n }\n return null;\n }",
"public function graphic()\n {\n return \"die-\" . $this->value;\n }",
"public static function getFormat(): string;",
"protected function getLastHeartBeat(): string\n {\n $out = '<div class=\"alert alert-danger\" role=\"alert\">No heart beat run yet</div>';\n // SELECT * FROM `cron_log` WHERE 1 AND FIND_IN_SET('heartbeat_pulse', tasks) > 0 ORDER BY run_time DESC LIMIT 1\n /** @var CronLog $last_beat */\n $last_beat = $this->getContainer()->call([CronLog::class, 'select'], ['options' => ['where' => [\"1 AND FIND_IN_SET('heartbeat_pulse', tasks) > 0\"], 'orderBy' => ['run_time DESC'], 'limitCount' => 1]])->fetch();\n\n if ($last_beat != null) {\n $lasbeat_date = new DateTime($last_beat['run_time']);\n $now = new DateTime();\n\n $interval = date_diff($lasbeat_date, $now);\n $differenceFormat = '%y Year %m Month %d Day, %h Hours %i Minutes %s Seconds';\n $out = '<div class=\"alert alert-' . (abs($lasbeat_date->getTimestamp() - $now->getTimestamp()) < self::ATTENTION_SPAN ? 'success' : 'warning') . '\" role=\"alert\">Last Beat on ' . $last_beat['run_time'] . ' (' . $interval->format($differenceFormat) . ' ago)</div>';\n }\n return $out;\n }",
"public function toString()\n {\n return sprintf('is between %s and %s', $this->min, $this->max);\n }",
"public static function PulseInPercent($pulse, $hf_max = 0, $hf_rest = 0) {\r\n\t\tif (CONF_PULS_MODE == 'hfres')\r\n\t\t\treturn self::PulseInPercentReserve($pulse, $hf_max, $hf_rest);\r\n\r\n\t\treturn self::PulseInPercentHRmax($pulse, $hf_max);\r\n\t}",
"static function string_format_time($time){\r\n $h = intval($time / 60);\r\n $min = $time % 60;\r\n $ret = '';\r\n\r\n if($h > 0){\r\n if($h == 1){\r\n $ret .= $h.' heure ';\r\n } else {\r\n $ret .= $h.' heures ';\r\n }\r\n }\r\n\r\n if($min > 0){\r\n $ret .= $min . ' minutes';\r\n }\r\n\r\n if($time == 0){\r\n $ret .= '0 heure';\r\n }\r\n\r\n return $ret;\r\n }",
"public function getStartAtMax(): ?string\n {\n return $this->startAtMax;\n }",
"public function message()\n {\n return 'The full limit is maximum '.request('fullLimit');\n }"
] |
[
"0.681444",
"0.66602415",
"0.62762254",
"0.5988098",
"0.5945628",
"0.5793572",
"0.55384547",
"0.55068886",
"0.53524005",
"0.5294451",
"0.5141364",
"0.5136863",
"0.51209456",
"0.5117299",
"0.51107424",
"0.51084906",
"0.5097561",
"0.5086221",
"0.50782734",
"0.5021053",
"0.4971823",
"0.48999295",
"0.48919204",
"0.48870638",
"0.488582",
"0.48837003",
"0.48804507",
"0.48507446",
"0.48422536",
"0.48416212"
] |
0.7547067
|
0
|
Get pulse in percent of HRmax
|
public static function PulseInPercentHRmax($pulse, $hf_max = 0) {
if ($hf_max == 0)
$hf_max = HF_MAX;
return round(100*$pulse / $hf_max);
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public static function PulseStringInPercentHRmax($pulse, $hf_max = 0, $hf_rest = 0) {\r\n\t\tif ($hf_max == 0)\r\n\t\t\t$hf_max = HF_MAX;\r\n\t\tif ($hf_rest == 0)\r\n\t\t\t$hf_rest = HF_REST;\r\n\t\t\r\n\t\treturn round(100*($pulse - $hf_rest) / ($hf_max - $hf_rest)).' %';\r\n\t}",
"public static function PulseInPercentReserve($pulse, $hf_max = 0, $hf_rest = 0) {\r\n\t\tif ($hf_max == 0)\r\n\t\t\t$hf_max = HF_MAX;\r\n\r\n\t\tif ($hf_rest == 0)\r\n\t\t\t$hf_rest = HF_REST;\r\n\r\n\t\treturn round(100*($pulse - $hf_rest) / ($hf_max - $hf_rest));\r\n\t}",
"public static function PulseInPercent($pulse, $hf_max = 0, $hf_rest = 0) {\r\n\t\tif (CONF_PULS_MODE == 'hfres')\r\n\t\t\treturn self::PulseInPercentReserve($pulse, $hf_max, $hf_rest);\r\n\r\n\t\treturn self::PulseInPercentHRmax($pulse, $hf_max);\r\n\t}",
"public static function PulseStringInPercent($pulse, $hf_max = 0) {\r\n\t\tif ($hf_max == 0)\r\n\t\t\t$hf_max = HF_MAX;\r\n\t\t\r\n\t\treturn round(100*$pulse / $hf_max).' %';\r\n\t}",
"public function getPressureHpa();",
"public static function PulseStringInPercentReserve($pulse, $hf_max = 0, $hf_rest = 0) {\r\n\t\treturn self::PulseInPercentReserve($pulse, $hf_max, $hf_rest).' %';\r\n\t}",
"public function getHistogramMax();",
"public function humidityScore();",
"public function getIptPercent();",
"public function tempHumScore();",
"function hrChance($hr, $ab){\n //protects from divided-by 0\n if($ab > 0)\n $ave = $hr/$ab;\n else\n $ave = 0.0;\n //returns the average \n return \"<span>$ave</span\";\n }",
"public function spread () {\n $low = min($this->values);\n $high = max($this->values);\n return round(((1 - ($low/$high)) * 100), 3);\n }",
"public function getPercentLevel()\n { \n $experience_level = $this->getExperienceShortMax();\n\n $experience_current_level = $this->getExperienceShort();\n\n $percent = ($experience_current_level * 100)/$experience_level;\n\n return $percent;\n }",
"function getGoalPercent(){\n $goal = $GLOBALS['GOAL_STEPS'];\n $cursteps = getCurrentSteps();\n $percent = ( $cursteps[0]['steps'] / $goal ) * 100;\n return round($percent);\n}",
"function hesapla($x){\n return $x + ( $x * ( ($x%10)/100 ) );\n }",
"public function maxHealth()\n {\n return $this->getMaxHealth();\n }",
"public function percentChanged()\n {\n if ($this->value == 0) {\n $value = $this->previous;\n } elseif ($this->previous == 0) {\n $value = $this->value;\n } else {\n $value = ($this->previous - $this->value) / $this->previous;\n }\n\n return round(abs($value) * 100, 2) * ($this->value >= $this->previous ? 1 : -1);\n }",
"public function getMaxHealth()\n {\n return $this->maxHealth;\n }",
"public function getMaxHealth()\n {\n return $this->maxHealth;\n }",
"public function getHigh(): float\n {\n return $this->high;\n }",
"function calculatePercentLow($previousClose, $low)\n{\n\n}",
"private function getSkillPercent($level){\t\n\t\t//echo sprintf('Level %s: %s | ', $level, $value);\t\n\t\treturn 1 + ((5 * $level) / 100);\t\n\t}",
"function percentagizeArray($data,$max_value)\n {\n $new_data = array();\n foreach($data as $point)\n {\n if( $max_value > 0 )\n {\n $new_data[] = $point / $max_value * 100;\n }\n else\n {\n $new_data[] = 0;\n }\n }\n return $new_data;\n }",
"function getTotalFinalHT() {\n if (isset($this->calculmontant) && $this->calculmontant == true) return (sprintf(\"%.2f\", ($this->totalHT+$this->port)));\n else return 0;\n }",
"function HaarMaxPower($data) //input HaarPower result in frames\n {\n\t$max = $data[0]; //принимаем первый фрейм как минимальный\n\t$frames = count($data);\n\tforeach($data as $frame => $subvalue)\n\t foreach($subvalue as $order => $value)\n\t\tif ($max[$order] < $value) $max[$order] = $value;\n\treturn $max;\n }",
"function getTotalHT() {\n if (isset($this->calculmontant) && $this->calculmontant == true) return (sprintf(\"%.2f\", $this->totalHT));\n else return 0;\n }",
"public function getMaxHeartRate(){\n return $this->maxHeartRate;\n }",
"public function getHistogramMax()\n {\n // return $this->sides;\n return $this->getSides();\n }",
"public function fix_percentage() {\n\t\t// Iterate each Antimicrobic\n\t\tfor ($i = 0; $i < $this->antimicrobics->size; $i++) {\n\t\t\t$value = $this->antimicrobics->get($i)->get_value();\n\n\t\t\t// Iterate each value and subtract his previous;\n\t\t\t$ticks = array_keys($value);\n\t\t\tend($ticks);\n\t\t\twhile ($tick = current($ticks)) {\n\t\t\t\t\n\t\t\t\t$prev_tick = prev($ticks);\n\t\t\t\tif ( (false !== $prev_tick) && ($value[$tick] !== 0) )\n\t\t\t\t\t$this->antimicrobics->get($i)->value[$tick] -= $value[$prev_tick];\n\t\t\t}\t\n\t\t}\n\t}",
"public function getNbHAbs(): ?float {\n return $this->nbHAbs;\n }"
] |
[
"0.7320955",
"0.706793",
"0.69072354",
"0.68255115",
"0.5934219",
"0.5845462",
"0.5733453",
"0.56975806",
"0.56789076",
"0.5588057",
"0.5581345",
"0.5428586",
"0.5414487",
"0.54013747",
"0.53894484",
"0.5369945",
"0.53273284",
"0.53178924",
"0.53178924",
"0.5311947",
"0.52964664",
"0.52751034",
"0.5272225",
"0.5264825",
"0.516177",
"0.515199",
"0.5131016",
"0.5114759",
"0.51098317",
"0.5105378"
] |
0.79469323
|
0
|
Get pulse in percent of reserve
|
public static function PulseInPercentReserve($pulse, $hf_max = 0, $hf_rest = 0) {
if ($hf_max == 0)
$hf_max = HF_MAX;
if ($hf_rest == 0)
$hf_rest = HF_REST;
return round(100*($pulse - $hf_rest) / ($hf_max - $hf_rest));
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getIptPercent();",
"public function positivePercent(){\n\t\treturn round($this->positive*100/($this->positive+$this->negative+$this->indeterminate), 2);\n\t}",
"public static function PulseStringInPercentReserve($pulse, $hf_max = 0, $hf_rest = 0) {\r\n\t\treturn self::PulseInPercentReserve($pulse, $hf_max, $hf_rest).' %';\r\n\t}",
"function get_storage_fill_percentage($used, $capacity)\n{\n // Format gigabytes to bytes\n $total = intval(Metric::gigabytes($capacity)->numberOfBytes());\n\n // Count progress\n $progress = ($used * 100) / $total;\n\n // Return in 2 decimal\n return number_format((float)$progress, 2, '.', '');\n}",
"private function getSkillPercent($level){\t\n\t\t//echo sprintf('Level %s: %s | ', $level, $value);\t\n\t\treturn 1 + ((5 * $level) / 100);\t\n\t}",
"public function getPercent() {\n return $this->percent;\n }",
"public function getPercent()\n {\n return $this->helper->getPercent();\n }",
"public function drainPerRound() {\r\n\t\tif ($this->isWeapon()) {\r\n\t\t\t$fullDrain = $this->amount() * $this->drain();\r\n\t\t\treturn ($fullDrain / $this->reload());\r\n\t\t}\r\n\r\n\t\treturn 0;\r\n\t}",
"public static function PulseStringInPercent($pulse, $hf_max = 0) {\r\n\t\tif ($hf_max == 0)\r\n\t\t\t$hf_max = HF_MAX;\r\n\t\t\r\n\t\treturn round(100*$pulse / $hf_max).' %';\r\n\t}",
"public function getPercent()\n {\n return $this->percent;\n }",
"public static function PulseInPercent($pulse, $hf_max = 0, $hf_rest = 0) {\r\n\t\tif (CONF_PULS_MODE == 'hfres')\r\n\t\t\treturn self::PulseInPercentReserve($pulse, $hf_max, $hf_rest);\r\n\r\n\t\treturn self::PulseInPercentHRmax($pulse, $hf_max);\r\n\t}",
"function valore_reale_maggiorazione_percentuale_gas($id_ordine,$id_gas){\r\n \r\n $magg = valore_percentuale_maggiorazione_mio_gas($id_ordine,$id_gas);\r\n return (float)(valore_totale_mio_gas($id_ordine,$id_gas)/100)*$magg;\r\n \r\n}",
"public function getUsagePercent() : float\n\t{\n\t\treturn $this->usagePercent;\n\t}",
"function calculatePercentLow($previousClose, $low)\n{\n\n}",
"function getGoalPercent(){\n $goal = $GLOBALS['GOAL_STEPS'];\n $cursteps = getCurrentSteps();\n $percent = ( $cursteps[0]['steps'] / $goal ) * 100;\n return round($percent);\n}",
"public function getPercent()\n {\n return $this->readOneof(2);\n }",
"public function getPercentage() {\n\t\t$percentage = \"\";\n\t\t\n\t\tif ($this->getIsRace() == true) {\n\t\t\t$placement = $this->_placement;\n\t\t\t$field = $this->_field;\n\t\t\t$percentage = round($placement / $field * 100).\"%\";\n\t\t}\n\t\t\n\t\treturn $percentage;\n\t\t\n\t}",
"public function calcularReservaPorcentaje(){\n if($this->iPresupuestoModificado == 0)\n return 0;\n $porcentajeReserva = ($this->iReserva/$this->iPresupuestoModificado)*100;\n return $porcentajeReserva;\n }",
"public function getPercentage()\n {\n return $this->percentage;\n }",
"public function getPercentaje() {\n return $percentaje;\n }",
"public function percentKnockedOut() : float\n\t{\n\t\treturn $this->percentKnockedOut;\n\t}",
"function usp_ews_get_progess_percentage($events, $attempts) {\n $attemptcount = 0;\n\n\t$count_events = count($events);\n foreach($events as $event) {\n if($attempts[$event['type'].$event['id']] == 1) {\n $attemptcount++;\n }\n }\n\t$progressvalue = ($attemptcount==0 || $count_events==0) ? 0 : $attemptcount / $count_events;\n\n return (int)($progressvalue * 100);\n}",
"public function getFreeInPercent()\n {\n return $this->getPercentageOfMemory($this->getFreeInMb());\n }",
"public function get_percentage_complete() {\n\t\t$percentage = affwp_calculate_percentage( $this->get_current_count(), $this->get_total_count() );\n\n\t\tif ( $percentage > 100 ) {\n\t\t\t$percentage = 100;\n\t\t}\n\n\t\treturn $percentage;\n\t}",
"function getUtilisation(){\n\n $total = $this-> getTotalWeight() ;\n \n return round(($total / $this->capacity) * 100, 2);\n\n }",
"public function getUsagePercentage()\n {\n return $this->usagePercentage;\n }",
"public function getVolumePercentage()\n {\n return $this->volume_percentage;\n }",
"public function getTotalRingDamage(): int {\n return $this->getRingDamage();\n }",
"function getProfitPercentage()\n\t{\n\t\t$firstTrade = $this->data->getFirstCompletedTrade();\n\n\t\tif ($firstTrade)\n\t\t\t$start = $this->data->getT(Time::fromDateTime($firstTrade->getProcessedAt()), \"amount\");\n\n\t\t$start = $firstTrade ? $firstTrade->getSellAmount() : 0;\n\n\t\tif (!$start)\n\t\t\treturn 0;\n\n\t\t$current = $this->getTotalHoldings();\n\n\t\t$percentage = round((($current / $start) - 1) * 10000)/100;\n\n\t\treturn $percentage;\n\t}",
"public function percentChanged()\n {\n if ($this->value == 0) {\n $value = $this->previous;\n } elseif ($this->previous == 0) {\n $value = $this->value;\n } else {\n $value = ($this->previous - $this->value) / $this->previous;\n }\n\n return round(abs($value) * 100, 2) * ($this->value >= $this->previous ? 1 : -1);\n }"
] |
[
"0.62247795",
"0.6200579",
"0.61535877",
"0.60962516",
"0.5940428",
"0.5897722",
"0.5887478",
"0.5880669",
"0.5858405",
"0.5851391",
"0.5770558",
"0.5762849",
"0.57048124",
"0.57017136",
"0.56884074",
"0.568168",
"0.5667855",
"0.5662728",
"0.5661299",
"0.5645571",
"0.5630988",
"0.5588881",
"0.55722976",
"0.55655205",
"0.55549216",
"0.5528547",
"0.5526391",
"0.55258065",
"0.5513719",
"0.54827577"
] |
0.71626383
|
0
|
Creating a RGBcolor for a given stressvalue [0100]
|
public static function Stresscolor($stress) {
if ($stress > 100)
$stress = 100;
if ($stress < 0)
$stress = 0;
$gb = dechex(200 - 2*$stress);
if ((200 - 2*$stress) < 16)
$gb = '0'.$gb;
return 'C8'.$gb.$gb;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"protected function make_rgb()\n {\n $hsl = $this->_hsl;\n $hue = $hsl['hue'];\n $saturation = max(min($hsl['saturation'], 1), 0);\n $luminance = max(min($hsl['luminance'], 1), 0);\n\n $max = ($luminance <= 0.5) ? $luminance * ($saturation + 1) : $luminance + $saturation - $luminance * $saturation;\n $min = $luminance * 2 - $max;\n\n $this->_rgb_dec = array(\n 'red' => (int) ($this->_hue_to_rgb($min, $max, $hue + 0.33333) * self::RGB_MAX),\n 'green' => (int) ($this->_hue_to_rgb($min, $max, $hue) * self::RGB_MAX),\n 'blue' => (int) ($this->_hue_to_rgb($min, $max, $hue - 0.33333) * self::RGB_MAX),\n );\n $this->_rgb_hex = $this->rgb_dec_to_hex($this->_rgb_dec);\n }",
"public static function color($value)\n {\n self::$color = Color::toRGBA($value);\n }",
"public function getColor();",
"public function getColor();",
"public function getColor();",
"public function getColor();",
"function getrandcolor($num) {\n //$color = array('1CF', '3CF', '5CF', '7CF', '9CF', '0CF');\n //$color = array('0066CC', '0066FF', '0099CC', '0099FF', '3366CC', '3366FF', '3399CC', '3399FF', '306EFF', '2B65EC', '1589FF', '157DEC', '1569C7');\n $color = array('0099FF', '2EB135', 'FF5A00', 'DE1C85');\n return '#'.$color[$num];\n }",
"public function colour();",
"function mc_shift_color( $color ) {\n\t$color = str_replace( '#', '', $color );\n\t$rgb = '';\n\t$percent = ( mc_inverse_color( $color ) == '#ffffff' ) ? - 20 : 20;\n\t$per = $percent / 100 * 255;\n\t// Percentage to work with. Change middle figure to control color temperature.\n\tif ( $per < 0 ) {\n\t\t// DARKER.\n\t\t$per = abs( $per ); // Turns Neg Number to Pos Number.\n\t\tfor ( $x = 0; $x < 3; $x ++ ) {\n\t\t\t$c = hexdec( substr( $color, ( 2 * $x ), 2 ) ) - $per;\n\t\t\t$c = ( $c < 0 ) ? 0 : dechex( $c );\n\t\t\t$rgb .= ( strlen( $c ) < 2 ) ? '0' . $c : $c;\n\t\t}\n\t} else {\n\t\t// LIGHTER.\n\t\tfor ( $x = 0; $x < 3; $x ++ ) {\n\t\t\t$c = hexdec( substr( $color, ( 2 * $x ), 2 ) ) + $per;\n\t\t\t$c = ( $c > 255 ) ? 'ff' : dechex( $c );\n\t\t\t$rgb .= ( strlen( $c ) < 2 ) ? '0' . $c : $c;\n\t\t}\n\t}\n\n\treturn '#' . $rgb;\n}",
"function percent2Color($value, $brightness = 255, $max = 100, $min = 0, $thirdColorHex = '00') {\n\t$first = (1-($value/$max))*$brightness;\n\t$second = ($value/$max)*$brightness;\n\n\t// Find the influence of the middle color (yellow if 1st and 2nd are red and green)\n\t$diff = abs($first-$second);\n\t$influence = ($brightness-$diff)/2; \n\t$first = intval($first + $influence);\n\t$second = intval($second + $influence);\n\n\t// Convert to HEX, format and return\n\t$firstHex = str_pad(dechex($first),2,0,STR_PAD_LEFT);\n\t$secondHex = str_pad(dechex($second),2,0,STR_PAD_LEFT);\n\t$thirdColorHex = str_pad(dechex($thirdColorHex),2,0,STR_PAD_LEFT);\n\t\n\tif (($value % 3) == 0) { // three\n\t\treturn '#' . $firstHex . $secondHex . $thirdColorHex;\n\t} else if (($value % 3) == 1) { // two\n\t\treturn '#' . $thirdColorHex . $firstHex . $secondHex;\n\t} else if (($value % 3) == 2) { // one\n\t\treturn '#' . $secondHex . $thirdColorHex . $firstHex;\n\t}\n\n// alternatives:\n// return $thirdColorHex . $firstHex . $secondHex;\n// return $firstHex . $thirdColorHex . $secondHex;\n}",
"function generar_color($rgb){\n $vermell= substr($rgb,1,2); \n $verd = substr($rgb,3,2); \n $blau = substr($rgb,5,2); \n \n //Converteixo de hexadecimal a decimal \n $enter_vermell= hexdec($vermell); \n $enter_verd= hexdec($verd); \n $enter_blau= hexdec($blau); \n \n //Valor que li sumarem o restarem a cada component rgb: \n $valor = hexdec(22); \n \n //Calculo l'umbral del color. \n $umbral = 255/2; //7F en hexadecimal. \n \n //Calculo la foscor del color entrat: \n $foscor= ($enter_vermell + $enter_verd + $enter_blau) /3; \n \n //El color és clar. Per tant tenim que enfosquirlo restant-li el $valor en cada component rgb. \n if($foscor >= $umbral){ \n $enter_vermell = ($enter_vermell-$valor<00) ? 00 : $enter_vermell-$valor; \n $enter_verd = ($enter_verd-$valor<00) ? 00 : $enter_verd-$valor; \n $enter_blau = ($enter_blau-$valor<00) ? 00 : $enter_blau-$valor; \n //if($enter_vermell-$valor<00){ $nou_enter_vermell = 00; } else { $enter_vermell=$enter_vermell-$valor; } \n //if($enter_vermell-$valor<00){ $nou_enter_vermell = 00; } else { $enter_vermell=$enter_vermell-$valor; } \n } \n \n //El color és fosc. Per tant tenim que aclararlo sumant-li el $valor en cada component rgb. \n else{ \n $enter_vermell = ($enter_vermell+$valor>255) ? 255 : $enter_vermell+$valor; \n $enter_verd = ($enter_verd+$valor>255) ? 255 : $enter_verd+$valor; \n $enter_blau = ($enter_blau+$valor>255) ? 255 : $enter_blau+$valor; \n } \n $vermell=dechex($enter_vermell); \n $verd=dechex($enter_verd); \n $blau=dechex($enter_blau); \n \n $rgb=\"#\".$vermell.$verd.$blau; \n return $rgb; \n}",
"public function getColor() {}",
"public function getColor() {}",
"function toColor($n){\n\t\t\treturn(\"#\".substr(\"000000\".dechex($n),-6));\n\t\t}",
"public function getColorComponents() {}",
"public function getColorComponents() {}",
"public function getColorComponents() {}",
"public function getColorComponents() {}",
"public function getColorComponents() {}",
"public function getColorComponents() {}",
"public function getColorComponents() {}",
"function color($a = NULL) {\n\treturn new Color(mt_rand(20, 180), mt_rand(20, 180), mt_rand(20, 180), $a);\n}",
"function setColor($percent, $invert = false)\n{\n //Amount under 100% determines red tint\n $R = min((2.0 * (1.0-$percent)), 1.0) * 255.0;\n //Green by default, 100%\n $G = min((2.0 * $percent), 1.0) * 255.0;\n //No blue here\n $B = 0.0;\n //Return the hexadecimal conversion of the RGB\n return (($invert) ? \nsprintf(\"%02X%02X%02X\",$R,$G,$B) \n: sprintf(\"%02X%02X%02X\",$R,$G,$B)); \n}",
"function carton_hex_lighter( $color, $factor = 30 ) {\n\t\t$base = carton_rgb_from_hex( $color );\n\t\t$color = '#';\n\n\t foreach ($base as $k => $v) :\n\t $amount = 255 - $v;\n\t $amount = $amount / 100;\n\t $amount = round($amount * $factor);\n\t $new_decimal = $v + $amount;\n\n\t $new_hex_component = dechex($new_decimal);\n\t if(strlen($new_hex_component) < 2) :\n\t \t$new_hex_component = \"0\".$new_hex_component;\n\t endif;\n\t $color .= $new_hex_component;\n\t \tendforeach;\n\n\t \treturn $color;\n\t}",
"public function getRed()\n {\n return (0.5 + $this->red) | 0;\n }",
"function random_color_part() {\n\t\treturn str_pad( dechex( mt_rand( 0, 255 ) ), 2, '0', STR_PAD_LEFT);\n\t}",
"function randomColor ($minVal = 0, $maxVal = 255)\n{\n $minVal = $minVal < 0 || $minVal > 255 ? 0 : $minVal;\n $maxVal = $maxVal < 0 || $maxVal > 255 ? 255 : $maxVal;\n\n // Generate 3 values\n $r = mt_rand($minVal, $maxVal);\n $g = mt_rand($minVal, $maxVal);\n $b = mt_rand($minVal, $maxVal);\n\n // Return a hex colour ID string\n return sprintf('%02X%02X%02X', $r, $g, $b);\n\n}",
"function randomColor ($minVal = 0, $maxVal = 255)\n{\n $minVal = $minVal < 0 || $minVal > 255 ? 0 : $minVal;\n $maxVal = $maxVal < 0 || $maxVal > 255 ? 255 : $maxVal;\n\n // Generate 3 values\n $r = mt_rand($minVal, $maxVal);\n $g = mt_rand($minVal, $maxVal);\n $b = mt_rand($minVal, $maxVal);\n\n // Return a hex colour ID string\n return sprintf('#%02X%02X%02X', $r, $g, $b);\n\n}",
"function get_RGB($i,$iMax,$palette){\n $r = 0 ;\n $g = 0 ;\n $b = 0 ;\n $i = $i/$iMax ;\n switch($palette){\n case 2: // Red \n $r = $i*255*1 ; $g = $i*255*0 ; $b = $i*255*0 ;\n break ;\n case 3: // Green \n $r = $i*255*0 ; $g = $i*255*1 ; $b = $i*255*0 ;\n break ;\n case 4: // Blue \n $r = $i*255*0 ; $g = $i*255*0 ; $b = $i*255*1 ;\n break ;\n case 5: // Cyan\n $r = $i*255*0 ; $g = $i*255*1 ; $b = $i*255*1 ;\n break ;\n case 6: // Magenta \n $r = $i*255*1 ; $g = $i*255*0 ; $b = $i*255*1 ;\n break ;\n case 7: // Yellow\n $r = $i*255*1 ; $g = $i*255*1 ; $b = $i*255*0 ;\n break ;\n case 12: // Hot red\n if ($i<1/2) { $r = $i*255*2 ; $g = $i*255*0 ; $b = $i*255*0 ; }\n else if($i<2/2) { $r = 255*1 ; $g = ($i-1/2)*255*2 ; $b = ($i-1/2)*255*2 ; }\n break ;\n case 13: // Hot green\n if ($i<1/2) { $r = $i*255*0 ; $g = $i*255*2 ; $b = $i*255*0 ; }\n else if($i<2/2) { $r = ($i-1/2)*255*2 ; $g = 255*1 ; $b = ($i-1/2)*255*2 ; }\n break ;\n case 14: // Hot blue\n if ($i<1/2) { $r = $i*255*0 ; $g = $i*255*0 ; $b = $i*255*2 ; }\n else if($i<2/2) { $r = ($i-1/2)*255*2 ; $g = ($i-1/2)*255*2 ; $b = 255*1 ; }\n break ;\n case 15: // Hot cyan\n if ($i<1/2) { $r = $i*255*0 ; $g = $i*255*2 ; $b = $i*255*2 ; }\n else if($i<2/2) { $r = ($i-1/2)*255*2 ; $g = 255*1 ; $b = 255*1 ; }\n break ;\n case 16: // Hot magenta\n if ($i<1/2) { $r = $i*255*2 ; $g = $i*255*0 ; $b = $i*255*2 ; }\n else if($i<2/2) { $r = 255*1 ; $g = ($i-1/2)*255*2 ; $b = 255*1 ; }\n break ;\n case 17: // Hot yellow\n if ($i<1/2) { $r = $i*255*2 ; $g = $i*255*2 ; $b = $i*255*0 ; }\n else if($i<2/2) { $r = 255*1 ; $g = 255*1 ; $b = ($i-1/2)*255*2 ; }\n break ;\n case 22: // Very hot red\n $r = 255*1 ; $g = $i*255*1 ; $b = $i*255*1 ;\n break ;\n case 23: // Very hot green\n $r = $i*255*1 ; $g = 255*1 ; $b = $i*255*1 ;\n break ;\n case 24: // Very hot blue\n $r = $i*255*1 ; $g = $i*255*1 ; $b = 255*1 ;\n break ;\n case 25: // Very hot cyan\n $r = $i*255*1 ; $g = 255*1 ; $b = 255*1 ;\n break ;\n case 26: // Very hot magenta\n $r = 255*1 ; $g = $i*255*1 ; $b = 255*1 ;\n break ;\n case 27: // Very hot yellow\n $r = 255*1 ; $g = 255*1 ; $b = $i*255*1 ;\n break ;\n case 8: // Grey\n $r = $i*255*1 ; $g = $i*255*1 ; $b = $i*255*1 ;\n break ;\n case 9: $r = $i*255*0 ; $g = 255*abs(sin($i*pi()*8)) ; $b = 255*abs(sin($i*pi()*8)) ; break ; // Wave\n case 10: $r = 255*abs(sin($i*pi()*3)) ; $g = $i*255*0 ; $b = $i*255*0 ; break ; // Pulse\n case 11: // Flame\n if ($i>=0/3 AND $i<1/3) { $r=(3*$i-0)*255 ; $g=(3*$i-0)*255 ; $b=(3*$i-0)*255 ; } // Black to white 0/0-1/3\n else if($i>=1/3 AND $i<2/3) { $r=255 ; $g=255 ; $b=(1-(3*$i-1))*255 ; } // White to Yellow 1/3-2/3\n else if($i>=2/3 AND $i<3/3) { $r=255 ; $g=(1-(3*$i-2))*255 ; $b=0 ; } // Yellow to red 2/3-3/3\n else { $r=0 ; $g=0 ; $b=0 ; } // Black\n break ;\n case 12: // Log\n $i = log(1+$i) ;\n $r = $i*255*0 ; $g = $i*255*1 ; $b = $i*255*0 ;\n break ;\n case 20: // Aqua\n $r = $i*255*0 ; $g = 255*1 ; $b = (1-$i)*255*1 ;\n break ;\n case 21: // Cheese and onion\n $r = $i*255*1 ; $g = 255*1 ; $b = 255*0 ;\n break ;\n case 102: // Red to blue\n if ($i>=0/2 AND $i<1/2) { $r=255 ; $g=(2*$i-0)*255 ; $b=(2*$i-0)*255 ; } // Red to white 0/0-1/2\n else { $r=(1-(2*$i-1))*255 ; $g=(1-(2*$i-1))*255 ; $b=255 ; } // White to Blue 1/2-2/2\n break ;\n case 103: // Fireworks\n $r=0 ; $g=0 ; $b=0 ;\n if($i>0.12 AND $i<0.13 ) { $r=205+10*abs($i-0.125) ; $g=0 ; $b=0 ; }\n if($i>0.245 AND $i<0.255) { $r=0 ; $g=205+10*abs($i-0.25) ; $b=0 ; }\n if($i>0.37 AND $i<0.38 ) { $r=0 ; $g=0 ; $b=205+10*abs($i-0.375) ; }\n if($i>0.495 AND $i<0.505) { $r=205+10*abs($i-0.5) ; $g=205+10*abs($i-0.5) ; $b=0 ; }\n if($i>0.62 AND $i<0.63 ) { $r=205+10*abs($i-0.625) ; $g=0 ; $b=205+10*abs($i-0.625) ; }\n if($i>0.745 AND $i<0.755) { $r=0 ; $g=205+10*abs($i-0.75) ; $b=205+10*abs($i-0.75) ; }\n if($i>0.87 AND $i<0.88 ) { $r=205+10*abs($i-0.875) ; $g=205+10*abs($i-0.875) ; $b=205+10*abs($i-0.875) ; }\n break ;\n case 104: // Roulette\n if ($i>=0/10 AND $i<1/10) { $r=0 ; $g=0 ; $b=0 ; }\n\telse if($i>=1/10 AND $i<2/10) { $r=255 ; $g=0 ; $b=0 ; }\n\telse if($i>=2/10 AND $i<3/10) { $r=0 ; $g=0 ; $b=0 ; }\n\telse if($i>=3/10 AND $i<4/10) { $r=255 ; $g=0 ; $b=0 ; }\n\telse if($i>=4/10 AND $i<5/10) { $r=0 ; $g=0 ; $b=0 ; }\n\telse if($i>=5/10 AND $i<6/10) { $r=255 ; $g=0 ; $b=0 ; }\n\telse if($i>=6/10 AND $i<7/10) { $r=0 ; $g=0 ; $b=0 ; }\n\telse if($i>=7/10 AND $i<8/10) { $r=255 ; $g=0 ; $b=0 ; }\n\telse if($i>=8/10 AND $i<9/10) { $r=0 ; $g=0 ; $b=0 ; }\n\telse if($i>=9/10 AND $i<10/10) { $r=255 ; $g=0 ; $b=0 ; }\n\telse { $r=0 ; $g=0 ; $b=0 ; }\n\tbreak ;\n case 105: // Contours\n $r=255 ; $g=255 ; $b=255 ;\n if($i>0.095 AND $i<0.105) { $r=0 ; $g=0 ; $b=0 ;}\n if($i>0.195 AND $i<0.205) { $r=0 ; $g=0 ; $b=0 ;}\n if($i>0.295 AND $i<0.305) { $r=0 ; $g=0 ; $b=0 ;}\n if($i>0.395 AND $i<0.405) { $r=0 ; $g=0 ; $b=0 ;}\n if($i>0.495 AND $i<0.505) { $r=0 ; $g=0 ; $b=0 ;}\n if($i>0.595 AND $i<0.605) { $r=0 ; $g=0 ; $b=0 ;}\n if($i>0.695 AND $i<0.705) { $r=0 ; $g=0 ; $b=0 ;}\n if($i>0.795 AND $i<0.805) { $r=0 ; $g=0 ; $b=0 ;}\n if($i>0.895 AND $i<0.905) { $r=0 ; $g=0 ; $b=0 ;}\n if($i>0.995 AND $i<1.005) { $r=0 ; $g=0 ; $b=0 ;}\n break ;\n default:\n if($palette>=1000){\n $r=0 ; $g=0 ; $b=0 ;\n if($iIn==$palette-1000) $r=255 ;\n break ;\n }\n if($palette==100){ // Low\n $i = pow($i,1/5) ;\n }\n if($palette==101){ // High\n $i = pow($i,5) ;\n }\n if ($i>=0/7 AND $i<1/7) { $r= (7*$i-0)*255 ; $g=0 ; $b=(7*$i-0)*255 ; } // Black to magenta 0/0-1/7\n else if($i>=1/7 AND $i<2/7) { $r=(1-(7*$i-1))*255 ; $g=0 ; $b=255 ; } // Magenta to blue 1/7-2/7\n else if($i>=2/7 AND $i<3/7) { $r=0 ; $g=(7*$i-2)*255 ; $b=255 ; } // Blue to cyan 2/7-3/7\n else if($i>=3/7 AND $i<4/7) { $r=0 ; $g=255 ; $b=(1-(7*$i-3))*255 ; } // Cyan to green 3/7-4/7\n else if($i>=4/7 AND $i<5/7) { $r=(7*$i-4)*255 ; $g=255 ; $b=0 ; } // Green to yellow 4/7-5/7\n else if($i>=5/7 AND $i<6/7) { $r=255 ; $g=(1-(7*$i-5))*255 ; $b=0 ; } // Yellow to red 5/7-6/7\n else if($i>=6/7 AND $i<7/7) { $r=255 ; $g=(7*$i-6)*255 ; $b=(7*$i-6)*255 ; } // Red to white 6/7-7/7\n else{\n if($palette==1){ $r=255 ; $g=255 ; $b=255 ; } // Pure as driven snow\n else { $r=0 ; $g=0 ; $b=0 ; } // Black, like my soul\n }\n }\n $rgb[0] = floor($r) ;\n $rgb[1] = floor($g) ;\n $rgb[2] = floor($b) ;\n return $rgb ;\n}",
"public function __construct($value)\n {\n do {\n if ($hex = $this->getHexFromColorName($value)) {\n $rgba = $this->parseHex($hex);\n $alpha = 1;\n break;\n }\n\n if (preg_match(self::SHORT_RGB, $value)) {\n $rgba = $this->parseHex($value.$value);\n $alpha = 1;\n break;\n }\n\n if (preg_match(self::SHORT_ARGB, $value)) {\n $rgba = $this->parseHex(substr($value, 1).substr($value, 1));\n $alpha = (float) substr($value, 0, 1) / 10;\n break;\n }\n\n if (preg_match(self::LONG_RGB, $value)) {\n $rgba = $this->parseHex($value);\n $alpha = 1;\n break;\n }\n\n if (preg_match(self::LONG_ARGB, $value)) {\n $rgba = $this->parseHex(substr($value, 2));\n $alpha = (float) substr($value, 0, 2) / 100;\n break;\n }\n\n $rgba = [255, 255, 255];\n $alpha = 0;\n } while (false);\n\n $this->red = $rgba[0];\n $this->green = $rgba[1];\n $this->blue = $rgba[2];\n $this->alpha = $alpha;\n }"
] |
[
"0.66537195",
"0.64617443",
"0.63863766",
"0.63863766",
"0.63863766",
"0.63863766",
"0.63179445",
"0.6200656",
"0.6188311",
"0.61396474",
"0.61351144",
"0.6085873",
"0.6085873",
"0.60797894",
"0.6075413",
"0.6075413",
"0.6075413",
"0.6075413",
"0.6075413",
"0.6075413",
"0.6075376",
"0.60522664",
"0.6025389",
"0.60210675",
"0.6004303",
"0.5987723",
"0.59721226",
"0.5971245",
"0.5957489",
"0.595257"
] |
0.72860575
|
0
|
Get the demanded pace if set in description (e.g. "... in 3:05 ...")
|
public static function DescriptionToDemandedPace($description) {
$array = explode("in ", $description);
if (count($array) != 2)
return 0;
$array = explode(",", $array[1]);
$array = explode(":", $array[0]);
return sizeof($array) == 2 ? 60*$array[0]+$array[1] : 0;
}
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"public function getPace() {\n\t\t$distance = $this->_distance;\n\t\t$time = $this->_time;\n\n\t\t$segments = explode(':',$time);\n\t\t$length = count($segments);\n\t\tswitch ($length) {\n\t\t\tcase 3:\n\t\t\t\t$seconds = $segments[0] * 3600 + $segments[1] * 60 + $segments[2];\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\t$seconds = $segments[0] * 60 + $segments[1];\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t$seconds = 0;\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif ($seconds != 0) {\n\t\t\t$minutes = floor($seconds / $distance / 60);\n\t\t\t$seconds = sprintf('%02d',round(($seconds / $distance / 60 - $minutes) * 60));\n\t\t\t$pace = $minutes.\":\".$seconds;\n\t\t} else {\n\t\t\t$pace = \"--\";\n\t\t}\t\t\n\t\t\n\t\treturn $pace;\n\t}",
"public function get_duration();",
"public function get_duration() {\n\t\t$a = explode (' ',microtime()); \n \t$this->stop_time = (double) $a[0] + $a[1];\n \t$this->duration = number_format(($this->stop_time - $this->start_time),2);\n\n\t\treturn sprintf('<h2>%s</h2><div class=\"summarize-posts-errors\">%s</div>'\n\t\t\t, __('Execution Time', CCTM_TXTDOMAIN)\n\t\t\t, sprintf(__('%s seconds', CCTM_TXTDOMAIN), $this->duration));\n\t}",
"public function getDuration() {}",
"public function getDuration();",
"function sloodle_describe_approx_time($secs, $ago = false)\n {\n // Make sure the time is a positive integer\n $secs = (int)$secs;\n if ($secs < 0) $secs *= -1;\n \n // Less than a minute\n if ($secs < 60) {\n // If we are describing a past time, then approximate to 'now'\n if ($ago) return ucwords(get_string('now', 'sloodle'));\n // Give the number of seconds\n if ($secs == 1) return '1 '. get_string('second', 'sloodle');\n return $secs.' '. get_string('seconds', 'sloodle');\n }\n \n // This variable will hold the time description\n $desc = '';\n \n // Roughly 1 minute\n if ($secs < 120) $desc = '1 '. get_string('minute', 'sloodle');\n // Several minutes (up to 1 hour)\n else if ($secs < 3600) $desc = ((string)(int)($secs / 60)).' '. get_string('minutes', 'sloodle');\n // Roughly 1 hour\n else if ($secs < 7200) $desc = '1 '. get_string('hour', 'sloodle');\n // Several hours (up to 1 day)\n else if ($secs < 86400) $desc = ((string)(int)($secs / 3600)).' '. get_string('hours', 'sloodle');\n // Roughly 1 day\n else if ($secs < 172800) $desc = '1 '. get_string('day', 'sloodle');\n // Several days (up to 1 week)\n else if ($secs < 604800) $desc = ((string)(int)($secs / 86400)).' '. get_string('days', 'sloodle');\n // Roughly 1 week\n else if ($secs < 1209600) $desc = '1 '. get_string('week', 'sloodle');\n // Several weeks (up to 2 months)\n else if ($secs < 5184000) $desc = ((string)(int)($secs / 604800)).' '. get_string('weeks', 'sloodle');\n // Several months (up to 11 months)\n else if ($secs < 29462400) $desc = ((string)(int)($secs / 2592000)).' '. get_string('months', 'sloodle');\n // 1 year\n else if ($secs < 63072000) $desc = '1 '. get_string('year', 'sloodle');\n // Several years\n else $desc = ((string)(int)($secs / 31536000)).' '. get_string('years', 'sloodle');\n \n // Add 'ago' if necessary\n if ($ago) return get_string('timeago', 'sloodle', $desc);\n return $desc;\n }",
"function getTimeDuration();",
"function gallo_reading_time() {\n\t$content = get_post_field( 'post_content', $post->ID );\n\t$word_count = str_word_count( strip_tags( $content ) );\n\t$readingtime = ceil($word_count / 200);\n\t\n\tif ($readingtime == 1) {\n\t\t$timer = \" min\"; // singular\n\t} else {\n\t\t$timer = \" min\"; // plural\n\t}\n\t\n\t$totalreadingtime = $readingtime . $timer;\n\treturn $totalreadingtime;\n\t\n}",
"public function get_duration()\n {\n $previous_point_obj = Game_Point::where(\n 'created_at',\n '<',\n $this->created_at\n )\n ->orderBy('created_at', 'desc')\n ->first();\n\n $current_point = $this->created_at;\n\n if (!empty($previous_point_obj)) {\n $previous_point = $previous_point_obj->created_at;\n } else {\n $previous_point = $this->game()->created_at;\n }\n\n $duration_obj = $current_point->diff($previous_point);\n\n $duration = '';\n\n $duration .= (int) $duration_obj->h > 0 ? $duration_obj->h . 'h' : '';\n $duration .= (int) $duration_obj->m > 0 ? $duration_obj->m . 'm' : '';\n $duration .= !empty($duration) && !empty($duration_obj->s) ? ':' : '';\n $duration .= (int) $duration_obj->s > 0 ? $duration_obj->s . 's' : '';\n\n return $duration;\n }",
"public function duration()\n\t{\n\t\treturn $this->CLI->stringQuery($this->SqueezePlyrID.\" duration ?\");\n\t}",
"public function getDuration(): float;",
"public function getDelayTime() {}",
"public function getDuration(): string|null;",
"public function getDuration() {\n $seconds = $this->getSeconds();\n $this->duration = sprintf('%s %02d:%02d:%02d', ((($seconds/86400%60) !== 0) ? ($seconds/86400%60) . 'd' : ''), ($seconds/3600%24),($seconds/60%60), $seconds%60);\n return $this->duration;\n }",
"function calcReadTime($str) {\n $words = str_word_count(strip_tags($str));\n // the blogging site medium uses 275 words per min to calculate,\n // minus 12 seconds for images.. this doesn't have images mid article soo..\n // i removed the 75 and made it 200 words per min..\n $minutes = floor($words / 200);\n $est = $minutes . ' min read time.';\n if ($est <= 0){\n return 'Less than a minute to read.';\n }\n return $est;\n}",
"public function perimetre()\n {\n // section -64--88--103-1-2c9bd139:16deeff2ef5:-8000:000000000000099C begin\n // section -64--88--103-1-2c9bd139:16deeff2ef5:-8000:000000000000099C end\n }",
"function getDuration(){\r\n\t$bytes = 30;\r\n\r\n\t$fp = fopen('./out', 'r');\r\n\tfseek($fp, $bytes * -1, SEEK_END); \r\n\t$data = fgets($fp, $bytes);\r\n\t\r\n\t\t\r\n\t$matches = [];\r\n\t$regex = '/-[0-9]{2}:.*$/';\r\n\t$result = preg_match($regex, $data, $matches);\r\n\t\r\n\tif($result === 1){\r\n\t\t$matches[0];\r\n\t\tlist($remaining, $total) = explode('/', $matches[0], 2);\r\n\t\t$remaining = ltrim ($remaining, '-');\r\n\t\t\r\n\t\tlist($remMins, $remSecs) = explode(':', $remaining, 2);\r\n\t\t$thing[] = intval($remMins) * 60 + $remSecs;\r\n\t\t\r\n\t\tlist($totMins, $totSecs) = explode(':', $total, 2);\r\n\t\t$thing[] = intval($totMins) * 60 + $totSecs;\r\n\t\t\r\n\t\treturn $thing;\r\n\t}else{\r\n\t\treturn [0, 0];\r\n\t}\r\n\t\r\n}",
"function getLifeTime();",
"public function getDelay(): int;",
"public static function showDetailDuration($second){\r\n\t\t\t$hour = floor($second / 3600);\r\n\t\t\t$minute = floor(($second / 60) % 60);\r\n\t\t\t$duration = (isset($day) ? $day.' day ' : '').(($hour) ? $hour.' hour ' : '').(($minute) ? $minute.' minute ' : '');\r\n\t\t\treturn ($duration) ? : '-';\r\n\t\t\t// return str_pad($hour, 2, '0', STR_PAD_LEFT).':'.str_pad($minute, 2, '0', STR_PAD_LEFT);\r\n\t\t}",
"public function getDuration()\n {\n $this->initialRequest();\n if (isset($this->item['contentDetails']['duration'])) {\n\n $date = new \\DateInterval($this->item['contentDetails']['duration']);\n $ret = 0;\n $ret += (int)$date->format('%d') * 86400;\n $ret += (int)$date->format('%h') * 3600;\n $ret += (int)$date->format('%i') * 60;\n $ret += (int)$date->format('%s');\n return $ret;\n }\n else {\n $this->onApiBadInterpretation(\"contentDetails.duration not found\");\n }\n }",
"protected function _getDuration($leg){\n \n if(!isset($leg['legDuration']) || !is_numeric($leg['legDuration'])) return;\n \n $m = $leg['legDuration'];\n $h = floor($m / 60);\n $d = floor($h / 24);\n \n if($h > 0) $m = $m - $h * 60;\n \n $result = '';\n \n if($h > 0) $result .= $h . 'h';\n if(($m > 0) || ($h <= 0 && $d <= 0)) $result .= (strlen($result) > 0 ? ' ' : '') . $m . 'm';\n \n return $result;\n \n }",
"public function get_field_resolver_duration()\n {\n }",
"public function duration()\n {\n if ($this->minDuration == 0 && $this->maxDuration == 0) return '1+ days';\n if ($this->minDuration == 1 && $this->maxDuration == 30) return '1+ days';\n if ($this->minDuration == 1 && $this->maxDuration == 1) return '1 day';\n if ($this->minDuration == $this->maxDuration) return $this->maxDuration.' days';\n if ($this->maxDuration == 30) return $this->minDuration.' days and more';\n\n return $this->minDuration.' - '.$this->maxDuration.' days';\n\n }",
"public function duration()\n\t{\n\t\t$dif = $this->runEnd->difference( $this->runStart );\n\n\t\t$minutes = (int) $dif->getMinutes( true );\n\t\t$seconds = $dif->getSeconds( true );\n\n\t\t// Since $seconds includes the minutes, calc the extra\n\t\t$seconds = $seconds - ( $minutes * 60 );\n\n\t\treturn str_pad( (string) $minutes, 2, '0', STR_PAD_LEFT ) . ':' . str_pad( (string) $seconds, 2, '0', STR_PAD_LEFT );\n\t}",
"function pmpro_fpost_get_featured_duration() {\r\n\treturn intval( pmpro_getOption( 'fpostduration' ) );\r\n}",
"function getErrorReason() {\n\t\t$days = $this->getService()->getDuration();\n\n\t\treturn sprintf( __( \"Your current login duration is the default %d days.\", \"defender-security\" ), $days );\n\t}",
"public function getDefaultDuration(): string|null;",
"function humanTiming ($time){\n $time = (time()- 2*60*60)- $time; // to get the time since that moment\n $time = ($time<1)? 1 : $time;\n $tokens = array (\n 31536000 => 'year',\n 2592000 => 'month',\n 604800 => 'week',\n 86400 => 'day',\n 3600 => 'hour',\n 60 => 'minute',\n 1 => 'second'\n );\n\n foreach ($tokens as $unit => $text) {\n if ($time < $unit) continue;\n $numberOfUnits = floor($time / $unit);\n return $numberOfUnits.' '.$text.(($numberOfUnits>1)?'s':'');\n }\n }",
"public function getDurationTime()\n {\n return $this->duration * 60 * 60;\n }"
] |
[
"0.6967752",
"0.63611",
"0.6206354",
"0.61865234",
"0.60293937",
"0.6021907",
"0.6008417",
"0.5956991",
"0.5931534",
"0.5893105",
"0.58858645",
"0.58798194",
"0.58165604",
"0.5774837",
"0.5700692",
"0.5700089",
"0.56954086",
"0.5680125",
"0.56767917",
"0.55821764",
"0.5571704",
"0.55253804",
"0.5486672",
"0.5486391",
"0.5481879",
"0.54623187",
"0.5443087",
"0.5433483",
"0.54065645",
"0.5406279"
] |
0.74396336
|
0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.