query
stringlengths 10
8.11k
| document
stringlengths 17
398k
| negatives
sequencelengths 19
20
| metadata
dict |
---|---|---|---|
/ matches all the integers in a given text | public static function findNumbers($text,$minLength = 1,$maxLength = '') {
if($minLength > $maxLength) $maxLength = '';
$regex = '/\d{' . $minLength . ',' . $maxLength . '}/u';
preg_match_all($regex,$text,$matches);
return $matches;
} | [
"public function numbers($text) {\r\n return preg_replace(array_keys($this->numbers_match), array_values($this->numbers_match), $text);\r\n }",
"function number_range ($text){\n\t\t$number_list = [];\n\n\t\t#look for \\d - \\d\n\t\tif (preg_match_all('/(\\d+)\\s*\\-\\s*(\\d+)/',$text,$m)){#number range\n\t\t\t#print_r($m);\n\t\t\t#count instances of n - m\n\t\t\t$jc = count($m[0]); #echo \"ranges = $jc\\n\";\n\t\t\t\tfor ($j = 0; $j < $jc; ++$j){\n\t\t\t\t\tfor ($i=$m[1][$j];$i<=$m[2][$j];++$i){\n\t\t\t\t\t\t $number_list[] = $i;\n\t\t\t\t\t}\n\t\t\t\t\t#now remove the pair from the string\n\t\t\t\t $text = str_replace ($m[0][$j],' ',$text);\n\t\t\t }\n\t\t}\n\n\t\t#npw add in the rest of the numbers in the string\n\t\tif (preg_match_all('/(\\d+)/',$text,$m)){\n\t\t\t$jc = count($m[0]); #echo \"numbers = $jc\\n\";\n\t\t\tfor ($j = 0; $j < $jc; ++$j){\n\t\t\t\t$number_list[] = $m[1][$j];\n\t\t\t}\n\n\t\t }\n\n\t\treturn $number_list;\n}",
"function retrieve_integer($file_contents) {\n$words = preg_split('/[\\s]+/', $file_contents, -1, PREG_SPLIT_NO_EMPTY);\n\nforeach ($words as $value) {\nif (ctype_digit($value)) {\necho $value.\"\\n\";\n}\n}\n}",
"function _extractNumber()\n {\n $fragment = \"\";\n\n while ($this->_canLookAhead() && !$this->_isNotNeeded()) {\n $fragment .= strtolower($this->text[$this->position++]);\n }\n\n\n $result = $this->_identifyNumber($fragment);\n return $result == false ? 0 : $result;\n }",
"function findall($text) {\n $r = preg_match_all($this->_re, strval($text), $ms, PREG_SET_ORDER);\n if(!$r) {\n return lst();\n }\n $a = lst();\n foreach($ms as $m) {\n $a []= (count($m) <= 2) ? str(end($m)) : _strlist(array_slice($m, 1));\n }\n return $a;\n }",
"function wordsToNumber($data) {\n $data = strtr(\n $data, array(\n 'zero' => '0',\n 'a' => '1',\n 'one' => '1',\n 'two' => '2',\n 'three' => '3',\n 'four' => '4',\n 'five' => '5',\n 'six' => '6',\n 'seven' => '7',\n 'eight' => '8',\n 'nine' => '9',\n 'ten' => '10',\n 'eleven' => '11',\n 'twelve' => '12',\n 'thirteen' => '13',\n 'fourteen' => '14',\n 'fifteen' => '15',\n 'sixteen' => '16',\n 'seventeen' => '17',\n 'eighteen' => '18',\n 'nineteen' => '19',\n 'twenty' => '20',\n 'thirty' => '30',\n 'forty' => '40',\n 'fourty' => '40', // common misspelling\n 'fifty' => '50',\n 'sixty' => '60',\n 'seventy' => '70',\n 'eighty' => '80',\n 'ninety' => '90',\n 'hundred' => '100',\n 'thousand' => '1000',\n 'million' => '1000000',\n 'billion' => '1000000000',\n 'and' => '',\n )\n );\n\n // Coerce all tokens to numbers\n $parts = array_map(\n function ($val) {\n return floatval($val);\n }, preg_split('/[\\s-]+/', $data)\n );\n\n $stack = new \\SplStack(); //Current work stack\n $sum = 0; // Running total\n $last = null;\n\n foreach ($parts as $part) {\n if (!$stack->isEmpty()) {\n // We're part way through a phrase\n if ($stack->top() > $part) {\n // Decreasing step, e.g. from hundreds to ones\n if ($last >= 1000) {\n // If we drop from more than 1000 then we've finished the phrase\n $sum += $stack->pop();\n // This is the first element of a new phrase\n $stack->push($part);\n } else {\n // Drop down from less than 1000, just addition\n // e.g. \"seventy one\" -> \"70 1\" -> \"70 + 1\"\n $stack->push($stack->pop() + $part);\n }\n } else {\n // Increasing step, e.g ones to hundreds\n $stack->push($stack->pop() * $part);\n }\n } else {\n // This is the first element of a new phrase\n $stack->push($part);\n }\n\n // Store the last processed part\n $last = $part;\n }\n\n return $sum + $stack->pop();\n }",
"function strip_numbers ($text){\n\t\t$Stripped = eregi_replace(\"([0-9]+)\", \"\", $text);\n\t\treturn ($Stripped);\n\t}",
"function mINT(){\n try {\n $_type = t042astLexer::T_INT;\n $_channel = t042astLexer::DEFAULT_TOKEN_CHANNEL;\n // runtime/Php/test/Antlr/Tests/grammers/t042ast.g\n // runtime/Php/test/Antlr/Tests/grammers/t042ast.g\n {\n // runtime/Php/test/Antlr/Tests/grammers/t042ast.g\n $cnt2=0;\n //loop2:\n do {\n $alt2=2;\n $LA2_0 = $this->input->LA(1);\n\n if ( (($LA2_0>=$this->getToken('48') && $LA2_0<=$this->getToken('57'))) ) {\n $alt2=1;\n }\n\n\n switch ($alt2) {\n \tcase 1 :\n \t // runtime/Php/test/Antlr/Tests/grammers/t042ast.g\n \t {\n \t $this->matchRange(48,57); \n\n \t }\n \t break;\n\n \tdefault :\n \t if ( $cnt2 >= 1 ) break 2;//loop2;\n $eee =\n new EarlyExitException(2, $this->input);\n throw $eee;\n }\n $cnt2++;\n } while (true);\n\n\n }\n\n $this->state->type = $_type;\n $this->state->channel = $_channel;\n }\n catch(Exception $e){\n throw $e;\n }\n }",
"function mINT(){\r\n try {\r\n $_type = PolyLexer::$INT;\r\n $_channel = PolyLexer::$DEFAULT_TOKEN_CHANNEL;\r\n // Poly.g:23:5: ( ( '0' .. '9' )+ ) \r\n // Poly.g:23:7: ( '0' .. '9' )+ \r\n {\r\n // Poly.g:23:7: ( '0' .. '9' )+ \r\n $cnt2=0;\r\n //loop2:\r\n do {\r\n $alt2=2;\r\n $LA2_0 = $this->input->LA(1);\r\n\r\n if ( (($LA2_0>=$this->getToken('48') && $LA2_0<=$this->getToken('57'))) ) {\r\n $alt2=1;\r\n }\r\n\r\n\r\n switch ($alt2) {\r\n \tcase 1 :\r\n \t // Poly.g:23:7: '0' .. '9' \r\n \t {\r\n \t $this->matchRange(48,57); \r\n\r\n \t }\r\n \t break;\r\n\r\n \tdefault :\r\n \t if ( $cnt2 >= 1 ) break 2;//loop2;\r\n $eee =\r\n new EarlyExitException(2, $this->input);\r\n throw $eee;\r\n }\r\n $cnt2++;\r\n } while (true);\r\n\r\n\r\n }\r\n\r\n $this->state->type = $_type;\r\n $this->state->channel = $_channel;\r\n }\r\n catch(Exception $e){\r\n throw $e;\r\n }\r\n }",
"function cp_str_isInt($str){\r\n return preg_match('/^[[:digit:]]+$/',$str);\r\n}",
"private function count_numbers($str)\n {\n return $this->count_occurrences($str, '/[0-9]/');\n }",
"function mINTEGER(){\n try {\n $_type = Erfurt_Sparql_Parser_Sparql10_Sparql10_Tokenizer::$INTEGER;\n $_channel = Erfurt_Sparql_Parser_Sparql10_Sparql10_Tokenizer::$DEFAULT_TOKEN_CHANNEL;\n // Tokenizer.g:277:3: ( ( '0' .. '9' )+ ) \n // Tokenizer.g:278:3: ( '0' .. '9' )+ \n {\n // Tokenizer.g:278:3: ( '0' .. '9' )+ \n $cnt6=0;\n //loop6:\n do {\n $alt6=2;\n $LA6_0 = $this->input->LA(1);\n\n if ( (($LA6_0>=$this->getToken('48') && $LA6_0<=$this->getToken('57'))) ) {\n $alt6=1;\n }\n\n\n switch ($alt6) {\n \tcase 1 :\n \t // Tokenizer.g:278:4: '0' .. '9' \n \t {\n \t $this->matchRange(48,57); \n\n \t }\n \t break;\n\n \tdefault :\n \t if ( $cnt6 >= 1 ) break 2;//loop6;\n $eee =\n new EarlyExitException(6, $this->input);\n throw $eee;\n }\n $cnt6++;\n } while (true);\n\n\n }\n\n $this->state->type = $_type;\n $this->state->channel = $_channel;\n }\n catch(Exception $e){\n throw $e;\n }\n }",
"private function _parseIds($raw) {\n $ids = array();\n $matches = array();\n $re = '/\\s*([0-9]+)/m';\n preg_match_all($re, $raw, $matches, PREG_SET_ORDER, 0);\n foreach ($matches as $match)\n array_push($ids, $match[1]);\n return $ids;\n }",
"function parse($data) {\n $i=0;\n $result=[];\n /*$data = preg_replace('/[^idso]/', '', $data)*/; // Regular expression.\n $data = str_split($data) ;\n $data = array_filter($data,function($char){\n return (in_array($char,array('i','d','s','o')) ? $char : null);\n });\n foreach( $data as $val){\n switch($val){\n case 'i' : $i++; break;\n case 'd' : $i--;break;\n case 's' : $i = $i*$i; break;\n case 'o' : $result[] = $i;break;\n } \n }\n\tprint_r($result);\n}",
"public function provider_matchnumericrange() {\n return array(\n array('/^#001187-003658#$/', 1187, 3658, \"%06d\", 1, 4000),\n array('/^#001187-002658#$/', 1187, 2658, \"%06d\", 1, 3000),\n array('/^#001187-001195#$/', 1187, 1195, \"%06d\", 1, 3000),\n array('/^#000001-000100#$/', 1, 100, \"%06d\", 0, 300),\n array('/^#000010-000100#$/', 10, 100, \"%06d\", 0, 300),\n array('/^#001187-001199#$/', 1187, 1199, \"%06d\", 1, 2500),\n array('/^#001187-001188#$/', 1187, 1188, \"%06d\", 1, 2500),\n array('/^#000001-000009#$/', 1, 9, \"%06d\", 0, 25),\n array('/^#000005-000010#$/', 5, 10, \"%06d\", 0, 25),\n array('/^#003260-003300#$/', 3260, 3300, \"%06d\", 0, 4000),\n );\n }",
"function isInt($data){\n return (preg_match(\"/^-?\\d+$/\",$data));\n }",
"function mINTEGER(){\n try {\n $_type = Erfurt_Sparql_Parser_Sparql11_Update_Tokenizer11::$INTEGER;\n $_channel = Erfurt_Sparql_Parser_Sparql11_Update_Tokenizer11::$DEFAULT_TOKEN_CHANNEL;\n // Tokenizer11.g:347:3: ( ( '0' .. '9' )+ ) \n // Tokenizer11.g:348:3: ( '0' .. '9' )+ \n {\n // Tokenizer11.g:348:3: ( '0' .. '9' )+ \n $cnt6=0;\n //loop6:\n do {\n $alt6=2;\n $LA6_0 = $this->input->LA(1);\n\n if ( (($LA6_0>=$this->getToken('48') && $LA6_0<=$this->getToken('57'))) ) {\n $alt6=1;\n }\n\n\n switch ($alt6) {\n \tcase 1 :\n \t // Tokenizer11.g:348:4: '0' .. '9' \n \t {\n \t $this->matchRange(48,57); \n\n \t }\n \t break;\n\n \tdefault :\n \t if ( $cnt6 >= 1 ) break 2;//loop6;\n $eee =\n new EarlyExitException(6, $this->input);\n throw $eee;\n }\n $cnt6++;\n } while (true);\n\n\n }\n\n $this->state->type = $_type;\n $this->state->channel = $_channel;\n }\n catch(Exception $e){\n throw $e;\n }\n }",
"public static function validateInteger(TextBase $control)\n\t{\n\t\tforeach ($control->getValue() as $tag) {\n\t\t\tif (!Strings::match($tag, '/^-?[0-9]+$/')) {\n\t\t\t\treturn FALSE;\n\t\t\t}\n\t\t}\n\t\treturn TRUE;\n\t}",
"public static function validateInteger(TextBase $control)\r\n\t{\r\n\t\tforeach ($control->getValue() as $tag) {\r\n\t\t\tif (!Strings::match($tag, '/^-?[0-9]+$/')) {\r\n\t\t\t\treturn FALSE;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn TRUE;\r\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds two classes to the array of body classes. The first is if the site has only had one author with published posts. The second is if a singular post being displayed | function ucle_body_classes( $classes ) {
if ( function_exists( 'is_multi_author' ) && ! is_multi_author() )
$classes[] = 'single-author';
if ( is_singular() && ! is_home() )
$classes[] = 'singular';
return $classes;
} | [
"function twentyeleven_body_classes( $classes ) {\r\n\r\n if ( ! is_multi_author() ) {\r\n $classes[] = 'single-author';\r\n }\r\n\r\n if ( is_singular() && ! is_home() && ! is_page_template( 'showcase.php' ) && ! is_page_template( 'sidebar-page.php' ) )\r\n $classes[] = 'singular';\r\n\r\n return $classes;\r\n}",
"function chp_body_classes( $classes ) {\n\n \tif ( ! is_multi_author() ) {\n \t\t$classes[] = 'single-author';\n \t}\n\n \tif ( is_singular() && ! is_home() && ! is_page_template( 'showcase.php' ) && ! is_page_template( 'sidebar-page.php' ) )\n \t\t$classes[] = 'singular';\n\n \treturn $classes;\n }",
"function theme_body_class($classes) {\n if (!is_multi_author())\n $classes[] = 'single-author';\n\n if (is_active_sidebar('sidebar-2') && !is_attachment() && !is_404())\n $classes[] = 'sidebar';\n\n if (!get_option('show_avatars'))\n $classes[] = 'no-avatars';\n\n return $classes;\n}",
"function ristorantipiceni_body_classes( $classes ) {\n\n\tif ( function_exists( 'is_multi_author' ) && ! is_multi_author() )\n\t\t$classes[] = 'single-author';\n\n\tif ( is_singular() && ! is_home() && ! is_page_template( 'showcase.php' ) && ! is_page_template( 'sidebar-page.php' ) )\n\t\t$classes[] = 'singular';\n\n\treturn $classes;\n}",
"function twentythirteen_body_class( $classes ) {\r\n\tif ( ! is_multi_author() )\r\n\t\t$classes[] = 'single-author';\r\n\r\n\tif ( is_active_sidebar( 'sidebar-2' ) && ! is_attachment() && ! is_404() )\r\n\t\t$classes[] = 'sidebar';\r\n\r\n\tif ( ! get_option( 'show_avatars' ) )\r\n\t\t$classes[] = 'no-avatars';\r\n\r\n\treturn $classes;\r\n}",
"function classiera_body_class( $classes ) {\r\n\tif ( ! is_multi_author() )\r\n\t\t$classes[] = 'single-author';\r\n\r\n\tif ( is_active_sidebar( 'sidebar-2' ) && ! is_attachment() && ! is_404() )\r\n\t\t$classes[] = 'sidebar';\r\n\r\n\tif ( ! get_option( 'show_avatars' ) )\r\n\t\t$classes[] = 'no-avatars';\r\n\r\n\treturn $classes;\r\n}",
"function warriortheme_body_classes( $classes ) {\n\tif ( is_multi_author() ) {\n\t\t$classes[] = 'group-blog';\n\t}\n\n\tif ( get_header_image() ) {\n\t\t$classes[] = 'header-image';\n\t} elseif ( ! in_array( $GLOBALS['pagenow'], array( 'wp-activate.php', 'wp-signup.php' ) ) ) {\n\t\t$classes[] = 'masthead-fixed';\n\t}\n\n\tif ( is_archive() || is_search() || is_home() ) {\n\t\t$classes[] = 'list-view';\n\t}\n\n\tif ( is_singular() && ! is_front_page() ) {\n\t\t$classes[] = 'singular';\n\t}\n\n\treturn $classes;\n}",
"function add_slug_to_body_class( $classes ) {\n global $post;\n if (is_home()) {\n $key = array_search( 'blog', $classes );\n if ( $key > -1 ) {\n unset( $classes[ $key ] );\n }\n } elseif ( is_page() ) {\n $classes[] = sanitize_html_class( $post->post_name );\n } elseif ( is_singular() ) {\n $classes[] = sanitize_html_class( $post->post_name );\n }\n return $classes;\n}",
"function add_slug_to_body_class($classes)\n{\n global $post;\n if (is_home()) {\n $key = array_search('blog', $classes);\n if ($key > -1) {\n unset($classes[$key]);\n }\n } elseif (is_page()) {\n $classes[] = sanitize_html_class($post->post_name);\n } elseif (is_singular()) {\n $classes[] = sanitize_html_class($post->post_name);\n }\n return $classes;\n}",
"function do_filter_body_class( $classes ) {\n global $post;\n if ( isset( $post ) ) {\n $classes[] = $post->post_type . '-' . $post->post_name;\n }\n return $classes;\n}",
"function inhabitent_body_class_for_pages( $classes ) {\n if ( is_singular( 'page' ) ) {\n global $post;\n $classes[] = 'page-' . $post->post_name;\n }\n return $classes;\n}",
"function add_slug_to_body_class($classes)\r\n{\r\n global $post;\r\n if (is_home()) {\r\n $key = array_search('blog', $classes);\r\n if ($key > -1) {\r\n unset($classes[$key]);\r\n }\r\n } elseif (is_page()) {\r\n $classes[] = sanitize_html_class($post->post_name);\r\n } elseif (is_singular()) {\r\n $classes[] = sanitize_html_class($post->post_name);\r\n }\r\n\r\n return $classes;\r\n}",
"function add_slug_to_body_class($classes)\n{\n global $post;\n if (is_home()) {\n $key = array_search('blog', $classes);\n if ($key > -1) {\n unset($classes[$key]);\n }\n } elseif (is_page()) {\n $classes[] = sanitize_html_class($post->post_name);\n } elseif (is_singular()) {\n $classes[] = sanitize_html_class($post->post_name);\n }\n\n return $classes;\n}",
"function add_slug_to_body_class($classes)\n{\n global $post;\n if (is_home()) {\n $key = array_search('blog', $classes, true);\n if ($key > -1) {\n unset($classes[$key]);\n }\n } elseif (is_page()) {\n $classes[] = sanitize_html_class($post->post_name);\n } elseif (is_singular()) {\n $classes[] = sanitize_html_class($post->post_name);\n }\n return $classes;\n}",
"function add_slug_to_body_class($classes)\r\n{\r\n global $post;\r\n if (is_front_page()) {\r\n $key = array_search('blog', $classes);\r\n if ($key > -1) {\r\n unset($classes[$key]);\r\n }\r\n } elseif (is_page()) {\r\n $classes[] = sanitize_html_class($post->post_name);\r\n } elseif (is_singular()) {\r\n $classes[] = sanitize_html_class($post->post_name);\r\n }\r\n\r\n return $classes;\r\n}",
"function add_slug_to_body_class($classes)\n\n{\n\n global $post;\n\n if (is_home()) {\n\n $key = array_search('blog', $classes);\n\n if ($key > -1) {\n\n unset($classes[$key]);\n\n }\n\n } elseif (is_page()) {\n\n $classes[] = sanitize_html_class($post->post_name);\n\n } elseif (is_singular()) {\n\n $classes[] = sanitize_html_class($post->post_name);\n\n }\n\n\n\n return $classes;\n\n}",
"function add_slug_body_class( $classes ) {\nglobal $post;\nif ( isset( $post ) ) {\n$classes[] = $post->post_type . '-' . $post->post_name;\n}\nreturn $classes;\n}",
"function magview_body_classes( $classes ) {\n\tif ( is_multi_author() ) {\n\t\t$classes[] = 'group-blog';\n\t}\n\n\tif ( get_header_image() ) {\n\t\t$classes[] = 'header-image';\n\t} elseif ( ! in_array( $GLOBALS['pagenow'], array( 'wp-activate.php', 'wp-signup.php' ) ) ) {\n\t\t$classes[] = 'masthead-fixed';\n\t}\n\n\tif ( is_archive() || is_search() || is_home() ) {\n\t\t$classes[] = 'list-view';\n\t}\n\n\tif ( ( ! is_active_sidebar( 'sidebar-2' ) )\n\t\t|| is_page_template( 'page-templates/full-width.php' )\n\t\t|| is_page_template( 'page-templates/contributors.php' )\n\t\t|| is_attachment() ) {\n\t\t$classes[] = 'full-width';\n\t}\n\n\tif ( is_active_sidebar( 'sidebar-3' ) ) {\n\t\t$classes[] = 'footer-widgets';\n\t}\n\n\tif ( is_singular() && ! is_front_page() ) {\n\t\t$classes[] = 'singular';\n\t}\n\n\tif ( is_front_page() && 'slider' == get_theme_mod( 'featured_content_layout' ) ) {\n\t\t$classes[] = 'slider';\n\t} elseif ( is_front_page() ) {\n\t\t$classes[] = 'grid';\n\t}\n\n\treturn $classes;\n}",
"function ura_body_classes_check(){\r\n\tif ( has_filter( 'body_class', 'twentyfifteen_body_classes' ) ) {\r\n\t\t//add_filter( 'body_class', 'twentyfifteen_body_classes' );\r\n\t}\r\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
[testCreateTicketSuccess test create it ticket where success or not] | public function testCreateTicketSuccess(){
$response = $this->post('/api/ticket',
[
'title' => 'Sally',
'description'=>'aaa'
]
)
->seeJson([
'status' => 1,
]);
$this->ticketId = $response->id;
} | [
"public function testOpenTicket()\n {\n }",
"public function testGetTicketStatuseByStatuTicket()\n {\n }",
"public function testGetTicketByTicketFollowUp()\n {\n }",
"public function testGetTicketProblemByIdTicket()\n {\n }",
"public function testTicketSubmitsSuccessfully()\n {\n $ticketPost = factory(TicketPost::class)->make();\n $ticket = $ticketPost->ticket;\n\n $this->actingAs($this->user);\n $this->get(route('tickets.create'));\n $response = $this->post(route('tickets.store'), [\n 'department_id' => $ticket->department_id,\n 'summary' => $ticket->summary,\n 'content' => $ticketPost->content,\n ]);\n\n $response->assertRedirect(route('tickets.show', $ticket->id + 1));\n $this->assertDatabaseHas($ticket->getTable(), [\n 'user_id' => $this->user->id,\n 'summary' => $ticket->summary,\n ]);\n $this->assertDatabaseHas($ticketPost->getTable(), [\n 'user_id' => $this->user->id,\n 'content' => $ticketPost->content,\n ]);\n }",
"public function testGetTicketProblems()\n {\n }",
"public function testGetTicketWorkflows()\n {\n }",
"public function testGetTicketWorkflowById()\n {\n }",
"public function createTicket()\n {\n Zendesk::tickets()->create([\n 'subject' => 'Subject',\n 'comment' => [\n 'body' => 'Ticket content.'\n ],\n 'priority' => 'normal'\n ]);\n return \"success\";\n }",
"public function testGetTicketMacros()\n {\n }",
"public function testGetTicketProblemCount()\n {\n }",
"public function testGetTicketByTicketFollowUpCount()\n {\n }",
"public function testGetTicketByTicketLink()\n {\n }",
"public function testInvitationTicketsIdExistsGet()\n {\n\n }",
"public function testGetTicketMacroById()\n {\n }",
"public function test_guest_access_to_ticket_create_page()\n {\n $response = $this->call('GET', '/tickets/create');\n $this->assertEquals(302, $response->status());\n $response->assertRedirect('login');\n }",
"public function test_ticket_status_new() {\n echo \"\\nTest Ticket Status: new \";\n $this->assertEquals(1, $this->ticket1->status()->id);\n }",
"public function testCreatePost() {\n $this->json('POST', '/ticket/create', [\n 'name' => 'phpUnitTicket',\n 'description' => 'phpUnitDescription',\n 'project' => $this->project->name\n ])->assertStatus(401);\n\n $this->actingAs($this->user)\n ->json('POST', '/ticket/create', [\n 'name' => 'phpUnitTicket',\n 'description' => 'phpUnitDescription',\n 'project' => $this->project->name\n ])->assertRedirect('/create');\n\n $this->actingAs($this->user)\n ->json('POST', '/ticket/create', [\n 'name' => 'phpUnitTicket1',\n 'description' => 'phpUnitDescription',\n 'project' => 'firstProjectsPhpUnit'\n ])->assertRedirect('/ticket/create');\n\n Ticket::where('name', 'phpUnitTicket')->first()->delete();\n }",
"function createTicket()\n {\n include '../config/Database.php';\n define('ENVIADO', '1');//Defecto num 1: Activo por Estado de TICKET\n\n $sql_insert = \"INSERT INTO 'ticket'\n ('descrip_incidencia',\n 'archivo_evidencia',\n 'cod_categoria',\n 'cod_estado_ticket',\n 'cod_usuario',\n 'cod_equipo')\n VALUES\n ('\".$this->getDescrip_incidencia().\"',\n '\".$this->getArchivo_evidencia().\"',\n '\".$this->getCod_categoria().\"',\n '\".$this->getCod_estado_ticket().\"',\n '\".$this->getCod_usuario().\"',\n '\".$this->get_Cod_equipo().\"',\n '\".ENVIADO.\"');\";\n\n $insertadoTicketDb = $db->query($sql_insert)or die (infoErrorCreatedTicket($db));\n $db->close();\n return ($insertadoTicketDb) ? true : false;\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns the search params object | public function getSearchParams() {
if ($this->searchParams == null) {
$this->searchParams = $this->createSearchParams();
}
return $this->searchParams;
} | [
"public function getSearchParams() {\n return $this->getParameter('search_params');\n }",
"public function getSearchParameters()\n {\n\n return $this->parameters;\n }",
"static public function getSearchParams()\n {\n return parent::getSearchParams() +\n array(\n 'searchWithin' => 'searchWithin',\n );\n }",
"protected function extractSearchParams()\r\n\t{\r\n\t\tif ( $this->search_fields_regex != \"\" )\r\n\t\t{\r\n\t\t\treturn $this->request->getProperties($this->search_fields_regex);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\treturn array();\r\n\t\t}\r\n\t}",
"protected function getHandlingSearchParams()\n {\n return array(\n static::SEARCH_ORDER,\n static::SEARCH_PUBLIC_ID,\n static::SEARCH_DATE,\n static::SEARCH_STATUS,\n static::SEARCH_VALUE,\n static::SEARCH_ORDERBY,\n static::SEARCH_LIMIT,\n );\n }",
"protected function searchRedirectParams()\r\n\t{\r\n\t\t$params = $this->currentParams();\r\n\t\t$params[\"action\"] = \"results\";\r\n\t\t\r\n\t\treturn $params;\r\n\t}",
"public function getSearchVars() {\n\t\t\t$search = parent::getSearchVars();\n\t\t\t$search['tags'] = array();\n\t\t\t$search['tags']['value'] = getRequest('tags');\n\t\t\t$search['content'] = array();\n\t\t\t$search['content']['value'] = getRequest('content');\n\t\t\treturn $search;\n\t\t}",
"private function setPIVars_searchParams() {\n\t\t$params = $this->piVars['search'];\n\n\t\t$this->sword = '';\n\t\tif ($this->piVars['btn_sword'])\n\t\t\t$this->sword = $params['sword'];\n\n\t\t$this->FormFilter = array();\n\t\tif ($this->piVars['btn_hotelType']) {\n\t\t\t$this->FormFilter['hotelType'] = $params['hotelType'];\n\t\t\t// Fetches types\n\t\t\t$types = $params['hotelType'];\n\t\t\tif (in_array(tx_icssitlorquery_NomenclatureUtils::RESIDENCE, $types)) {\n\t\t\t\t$types = array_diff($types, array(tx_icssitlorquery_NomenclatureUtils::RESIDENCE));\n\t\t\t\t$types[] = tx_icssitlorquery_NomenclatureUtils::TOURIST_RESIDENCE;\n\t\t\t\t$types[] = tx_icssitlorquery_NomenclatureUtils::HOTEL_RESIDENCE;\n\t\t\t}\n\t\t\t$hotelTypes = implode(',', $types);\n\t\t\t$this->conf['filter.']['hotelTypes'] = $hotelTypes;\n\t\t}\n\t\tif ($this->piVars['btn_hotelEquipment']) {\n\t\t\t$this->FormFilter['hotelEquipment'] = $params['hotelEquipment'];\n\t\t\t$this->conf['filter.']['hotelEquipments'] = implode(',', $params['hotelEquipment']);\n\t\t}\n\t\tif ($this->piVars['btn_restaurantCategory']) {\n\t\t\t$this->FormFilter['restaurantCategory'] = $params['restaurantCategory'];\n\t\t\t$this->conf['filter.']['restaurantCategories'] = implode(',', $params['restaurantCategory']);\n\t\t}\n\t\tif ($this->piVars['btn_restaurantSpeciality']) {\n\t\t\t$this->FormFilter['culinarySpeciality'] = $params['culinarySpeciality'];\n\t\t\t$this->conf['filter.']['foreignFoods'] = implode(',', $params['culinarySpeciality']);\n\t\t}\n\t\tif ($this->piVars['btn_eventDate'] || $this->piVars['btn_noFee']) {\n\t\t\t$this->FormFilter['startDate'] = $params['startDate'];\n\t\t\t$this->FormFilter['endDate'] = $params['endDate'];\n\t\t\tif ($params['startDate'])\n\t\t\t\t$this->conf['filter.']['startDate'] = $params['startDate'];\n\t\t\tif ($params['endDate'])\n\t\t\t\t$this->conf['filter.']['endDate'] = $params['endDate'];\n\t\t\t$this->FormFilter['noFee'] = $params['noFee'];\n\t\t\t$this->conf['filter.']['noFeeEvent'] = $params['noFee'];\n\t\t}\n\n\t\tif ($this->piVars['btn_subDataGroup']) {\n\t\t\t$this->FormFilter['subDataGroups'] = $params['subDataGroups'];\n\t\t\tif (is_array($params['subDataGroups']) && !empty($params['subDataGroups'])) {\n\t\t\t\t$this->conf['filter.']['subDataGroups'] = implode(',', $params['subDataGroups']);\n\t\t\t}\n\t\t}\n\n\t\tif ($this->piVars['btn_subscriber_type']) {\n\t\t\t$this->FormFilter['subscriber_type'] = $params['subscriber_type'];\n\t\t\t$subscriberDataArray = t3lib_div::trimExplode(',', $this->piVars['search']['subscriber_type'], true);\n\t\t\t$subscriber_type = $this->getSubscriberFilter($subscriberDataArray);\n\t\t\t$this->conf['filter.']['subscriber_type.']['category'] = $subscriber_type[0];\n\t\t\t$this->conf['filter.']['subscriber_type.']['value'] = $subscriber_type[1];\n\t\t}\n\n\t}",
"private function _searchParamsFromString()\n\t{\n\t\t$this->_search_params = array();\n\n\t\tif (isset($this->_req->query->params) || isset($this->_req->post->params))\n\t\t{\n\t\t\t// Feed it\n\t\t\t$temp_params = $this->_req->query->params ?? $this->_req->post->params;\n\n\t\t\t// Decode and replace the uri safe characters we added\n\t\t\t$temp_params = base64_decode(str_replace(array('-', '_', '.'), array('+', '/', '='), $temp_params));\n\n\t\t\t$temp_params = explode('|\"|', $temp_params);\n\t\t\tforeach ($temp_params as $i => $data)\n\t\t\t{\n\t\t\t\tlist ($k, $v) = array_pad(explode('|\\'|', $data), 2, '');\n\t\t\t\t$this->_search_params[$k] = $v;\n\t\t\t}\n\t\t}\n\n\t\treturn $this->_search_params;\n\t}",
"protected function getHandlingSearchParams()\n {\n return array(\n self::P_SUBSTRING,\n self::P_HAS_STATES,\n self::P_ORDER_BY,\n self::P_LIMIT,\n );\n }",
"protected function _prepare_search_params()\n {\n $params = array();\n\n foreach ($this->_search_params as $alias => $value)\n {\n if ( ! array_key_exists($alias, $this->_default_search_params))\n {\n throw new Fotolia_Exception(\n 'Parameter :alias not handled.',\n array(':alias', $alias)\n );\n }\n\n if ($value != $this->_default_search_params[$alias]\n and ! is_null($value))\n {\n $params[$alias] = $value;\n }\n }\n\n return $params;\n }",
"public function getSearchQuery()\n {\n return $this->getRequestHandler()->getRequest()->requestVar('Search');\n }",
"public function buildSearchParams()\n {\n $request = $this->getRequest();\n $action = $request->getActionName();\n $this->_processParamsByRequestType($request->getParams());\n if ($request->isPost()) {\n $this->_processParamsByRequestType($request->getPost());\n\n // Redirect with parameters for search\n $params = array();\n foreach ($this->_searchParams as $name => $value) {\n $search = array_keys($this->_specialChars);\n $replace = array_values($this->_specialChars);\n $value = str_replace($search, $replace, $value);\n\n \tif ('' != trim($value)) {\n \t $params[$name] = $value;\n \t}\n }\n $redirector = $this->_actionController->redirector;\n /* @var $redirector Zend_Controller_Action_Helper_Redirector */\n $redirector->setGotoSimple($action, null, null, $params);\n $url = $redirector->getRedirectUrl() . (('' !== $this->_anchor) ? '#' : '') . $this->_anchor;\n $redirector->gotoUrlAndExit($url, array('prependBase' => false));\n }\n return $this;\n }",
"public function getSearchParameter()\n {\n return $this->SearchParameter;\n }",
"public function getSearchQuery()\n {\n return $this->searchQuery;\n }",
"public function getSearchData() {\r\n return $this->search;\r\n }",
"public function getFindParams(){\n\t\t$findParams = GO::session()->values[$this->queryKey]['findParams'];\n\t\t$findParams->limit(0); // Let the export handle all found records without a limit\n\t\t$findParams->getCriteria()->recreateTemporaryTables();\n\t\t$findParams->selectAllFromTable('t');\n\t\t\n\t\treturn $findParams;\n\t}",
"public function getSearchQuery() {\n\t\t$params = array('start', 'swrnum', 'epoch');\n\t\t\n\t\treturn $this->getQueryWithoutParams($params, true);\n\t}",
"public function msearch($params);"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Replace image path if it doesn't exist and replace with the new ids | private static function replace_ids_image_path($shortcode, $post_id = false) {
preg_match('/\[gallery.*path.*?=.*?[\'"](.+?)[\'"].*?\]/i', $shortcode, $path);
if (!empty($path[1])) {
$path = trim($path[1], '\\');
$path = trim($path, '"');
$image_path = explode(',', $path);
if (!empty($image_path)) {
$attachment_id = array();
$wp_upload_dir = themify_upload_dir();
require_once( ABSPATH . 'wp-admin/includes/image.php' );
foreach ($image_path as $img) {
$img_id = self::get_attachment_id_by_url($img);
if (!$img_id) {
// extract the file name and extension from the url
$file_name = basename($img);
// get placeholder file in the upload dir with a unique, sanitized filename
$upload = wp_upload_bits($file_name, NULL, '');
if ($upload['error']) {
continue;
}
// fetch the remote url and write it to the placeholder file
$request = new WP_Http;
$response = $request->request($img, array('sslverify' => false));
// request failed and make sure the fetch was successful
if (!$response || is_wp_error($response) || wp_remote_retrieve_response_code($response) != '200') {
continue;
}
$access_type = get_filesystem_method();
if ($access_type === 'direct') {
$creds = request_filesystem_credentials(site_url() . '/wp-admin/', '', false, false, array());
if (!WP_Filesystem($creds)) {
continue;
}
global $wp_filesystem;
$wp_filesystem->put_contents($upload['file'], wp_remote_retrieve_body($response));
} else {
continue;
}
clearstatcache();
$filetype = wp_check_filetype($file_name, null);
$attachment = array(
'guid' => $wp_upload_dir['url'] . '/' . $file_name,
'post_mime_type' => $filetype['type'],
'post_title' => preg_replace('/\.[^.]+$/', '', $file_name),
'post_content' => '',
'post_status' => 'inherit'
);
$img_id = wp_insert_attachment($attachment, $upload['file'], 369);
if ($img_id) {
$attach_data = wp_generate_attachment_metadata($img_id, $upload['file']);
wp_update_attachment_metadata($img_id, $attach_data);
}
}
if ($img_id) {
$attachment_id[] = $img_id;
}
}
}
$shortcode = str_replace('path="' . $path . '"', '', $shortcode);
if (!empty($attachment_id)) {
$attachment_id = implode(',', $attachment_id);
preg_match('/\[gallery.*ids.*?=.*?[\'"](.+?)[\'"].*?\]/i', $shortcode, $ids);
$ids = trim($ids[1], '\\');
$ids = trim($ids, '"');
$shortcode = str_replace('ids="' . $ids . '"', 'ids="' . $attachment_id . '"', $shortcode);
}
}
return $shortcode;
} | [
"private static function replaceImages()\n\t{\n\t\t$pathArr = [];\n $imageFolder = Settings::get('imageFolder');\n\t\tif ($handle = opendir($imageFolder)) {\n\t\t\twhile (false !== ($entry = readdir($handle))) {\n\t\t\t\tif ($entry != \".\" && $entry != \"..\") {\n\t\t\t\t\t$pathArr[] = '\"' . $entry . '\"';\n\t\t\t\t}\n\t\t\t}\n\t\t\tclosedir($handle);\n\t\t}\n\n\t\tif (count($pathArr) > 0) {\n\t\t\t$q = mysql_query('SELECT * FROM cscart_images WHERE image_path in (' . implode(',', $pathArr) . ')');\n\t\t\twhile ($r = mysql_fetch_array($q)) {\n\t\t\t\t$folderName = floor($r['image_id'] / 1000);\n\t\t\t\tif (!is_dir($imageFolder . $folderName)) {\n\t\t\t\t\tmkdir($imageFolder . $folderName);\n\t\t\t\t}\n\t\t\t\trename($imageFolder . $r['image_path'], $imageFolder . $folderName . '/' .$r['image_path']);\n\t\t\t}\n\t\t}\n\n\t\t// remove not replaced images\n self::rmNotReplaceImages();\n\n\t\treturn true;\n\t}",
"public function replaceMainImages()\n {\n $dir = public_path() . '/1500';\n $files = glob($dir . '/*.{jpg}', GLOB_BRACE);\n foreach ($files as $file) {\n $filname = basename($file);\n $file = explode('.', $filname);\n $product = Product::where('unique_id', 'LIKE', '%' . $file[0])->first();\n if (!$product) {\n return response()->json(['message' => 'cant find this product ' . $file[0]]);\n }\n $old_path = $dir;\n $new_path = public_path() . '/shop_images/products';\n $main_image = uniqid() . rand(0, 100) . '.' . $file[1];\n $new_name = $new_path . '/' . $main_image;\n rename($old_path . '/' . $filname, $new_name);\n $product->update([\n 'main_image' => $main_image,\n ]);\n }\n return response()->json(['message' => __('translations.images_have_been_replaced')]);\n }",
"public static function maybe_regenerate_images()\n {\n }",
"function associateImage($userID, $path = null)\n{\n\n //also F5ing after this will throw a bunch of errors.\n global $db;\n $image = getUsers($_SESSION['login_user'])[1][0]['DisplayPicture'];\n\n if($path == null && isset($image))\n {\n foreach (glob($_SERVER['SERVER_PATH'] . substr($image, 22, -11) . \"*\") as $filename) \n {\n //echo \"$filename size \" . filesize($filename) . \"\\n\";\n unlink($filename);\n }\n }\n $query = \"UPDATE Users SET DisplayPicture = :dp WHERE UID = :id\";\n $statement = $db->prepare($query);\n $statement->bindValue(':dp', $path);\n $statement->bindValue(':id', $userID, PDO::PARAM_INT);\n $statement -> execute();\n}",
"function toImageId($id) {\n return \"pendeltileid$id\";\n}",
"protected function setImageId()\n {\n $this->imageId = sha1($this->imageData);\n }",
"private function set_img_path()\n {\n $file_name = sprintf('%03d',$this->img_count);\n $this->img_path = L_TEMP_IMAGE_PATH.$file_name.\".png\";\n $this->img_count++;\n }",
"private function modifyImgs() {\n\t\t$imgs = $this->pageDOM->find('img');\n\n\t\tfor($i = 0, $is = count($imgs); $i < $is; $i++) {\n\t\t\tif($imgs[$i]->src) {\n\t\t\t\t$url = $imgs[$i]->src;\n\t\t\t\t$imgs[$i]->src = Application::getPublicImgDir() . $this->pageData['sitedir'] . '/' . $url;\n\t\t\t}\n\t\t}\n\t}",
"private function reorderImages() {\n $this->db->query('SELECT id, file_name\n FROM property_images\n WHERE image_hash IS NOT NULL \n AND order_id = 0\n ');\n\n $sql = 'UPDATE `property_images` SET order_id = CASE';\n\n $found = false;\n\n $ids = array();\n\n while ( $temp = $this->db->fetchassoc() ) {\n $number = $this->extractNumber($temp['file_name']);\n if ( $number ) {\n $ids[] = $temp['id'];\n $sql.= ' WHEN id = ' . $temp['id'] . ' THEN ' . $number . PHP_EOL;\n $found = true;\n }\n }\n\n $sql.= '\n\n ELSE order_id END\n\n WHERE image_hash IS NOT NULL AND id IN ( ' . implode(',', $ids) . ');';\n\n // only execute if theres an actual row to update\n if ( $found ) {\n $this->db->query($sql);\n }\n\n }",
"private function cleanImages(): void\n {\n if (!is_array($this->object->images)) {\n return;\n }\n foreach ($this->object->images as $index => $shopifyImage) {\n //====================================================================//\n // If Image has no ID => NEW Image => Skip\n // If Image Already Found, Skip\n if (!isset($shopifyImage['id']) || in_array($shopifyImage['id'], $this->imgFound, true)) {\n continue;\n }\n //====================================================================//\n // Remove Image from Product\n unset($this->object->images[$index]);\n $this->needUpdate();\n }\n }",
"function CopyImagesToNewId($id_prop_from, $id_prop_to)\n {\n\n $q = \"SELECT `\".TblModCatalogPropImg.\"`.*, `\".TblModCatalogPropImgTxt.\"`.`lang_id`, `\".TblModCatalogPropImgTxt.\"`.`name`, `\".TblModCatalogPropImgTxt.\"`.`text`\n FROM `\".TblModCatalogPropImg.\"` LEFT JOIN `\".TblModCatalogPropImgTxt.\"` ON (`\".TblModCatalogPropImg.\"`.`id`=`\".TblModCatalogPropImgTxt.\"`.`cod`)\n WHERE `\".TblModCatalogPropImg.\"`.`id_prop`='\".$id_prop_from.\"'\n \";\n $res = $this->Right->Query($q, $this->user_id, $this->module);\n $rows = $this->Right->db_GetNumRows();\n //echo '<br />$q='.$q.' $res='.$res.' $rows='.$rows;\n for($i=0;$i<$rows;$i++){\n $row_arr[$i] = $this->Right->db_FetchAssoc();\n }\n $path_old='';\n for($i=0;$i<$rows;$i++){\n $row = $row_arr[$i];\n //echo '<br />$row[path]='.$row['path'].' $path_old='.$path_old;\n if( !empty($row['path']) AND $row['path']!=$path_old ){\n $source = SITE_PATH.$this->settings['img_path'].'/'.$id_prop_from.'/'.$row['path'];\n //$ext = substr($row['path'],1 + strrpos($row['path'], \".\"));\n $uploaddir = SITE_PATH.$this->settings['img_path'].'/'.$id_prop_to;\n $uploaddir_0 = $uploaddir;\n if ( !file_exists ($uploaddir) ) mkdir($uploaddir,0777);\n else @chmod($uploaddir,0777);\n //$uploaddir2 = time().$i.'.'.$ext;\n $uploaddir2 = $row['path'];\n $uploaddir = $uploaddir.\"/\".$uploaddir2;\n //echo '<br />$source='.$source.' <br />$uploaddir='.$uploaddir;\n $res = copy($source, $uploaddir);\n @chmod($uploaddir_0,0755);\n //echo '<br>$res='.$res;\n if(!$res) return false;\n $q = \"INSERT INTO `\".TblModCatalogPropImg.\"` SET\n `id_prop` = '\".$id_prop_to.\"',\n `path` = '\".$uploaddir2.\"',\n `show` = '\".$row['show'].\"',\n `move` = '\".$row['move'].\"',\n `colid` = '\".$row['colid'].\"'\n \";\n $res = $this->Right->Query($q, $this->user_id, $this->module);\n //echo '<br />$q='.$q.' $res='.$res;\n if(!$res OR !$this->Right->result) return false;\n $id_new = $this->Right->db_GetInsertID();\n $path_old = $row['path'];\n }\n //echo '<br />$row[lang_id]'.$row['lang_id'].' empty($row[name]='.$row['name'].' $row[text]='.$row['text'];\n if( !empty($row['lang_id']) OR !empty($row['name']) OR !empty($row['text']) ){\n $q = \"INSERT INTO `\".TblModCatalogPropImgTxt.\"` SET\n `cod` = '\".$id_new.\"',\n `lang_id` = '\".$row['lang_id'].\"',\n `name` = '\".$row['name'].\"',\n `text` = '\".$row['text'].\"'\n \";\n $res = $this->Right->Query($q, $this->user_id, $this->module);\n //echo '<br />$q='.$q.' $res='.$res;\n if(!$res OR !$this->Right->result) return false;\n }\n }\n return true;\n }",
"public function remove_image_ids(){\n\t\tif($this->get_val($this->slider_params, array('troubleshooting', 'alternateURLId'), false) !== false){\n\t\t\tunset($this->slider_params['troubleshooting']['alternateURLId']);\n\t\t}\n\t\t\n\t\tif(!empty($this->export_slides)){\n\t\t\tforeach($this->export_slides as $k => $s){\n\t\t\t\tif($this->get_val($this->export_slides[$k], array('params', 'bg', 'imageId'), false) !== false){\n\t\t\t\t\tunset($this->export_slides[$k]['params']['bg']['imageId']);\n\t\t\t\t}\n\t\t\t\t/*if($this->get_val($this->export_slides[$k], array('params', 'bg', 'videoId'), false) !== false){ //TODO maybe not delete, depending on if this is a wordpress media library id (then yes) or not\n\t\t\t\t\tunset($this->export_slides[$k]['params']['bg']['videoId']);\n\t\t\t\t}*/\n\t\t\t\tif($this->get_val($this->export_slides[$k], array('params', 'thumb', 'customThumbSrcId'), false) !== false){\n\t\t\t\t\tunset($this->export_slides[$k]['params']['thumb']['customThumbSrcId']);\n\t\t\t\t}\n\t\t\t\tif($this->get_val($this->export_slides[$k], array('params', 'thumb', 'customAdminThumbSrcId'), false) !== false){\n\t\t\t\t\tunset($this->export_slides[$k]['params']['thumb']['customAdminThumbSrcId']);\n\t\t\t\t}\n\t\t\t\tif($this->get_val($this->export_slides[$k], array('params', 'bg', 'lastLoadedImage'), false) !== false){\n\t\t\t\t\tunset($this->export_slides[$k]['params']['bg']['lastLoadedImage']);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(!empty($this->static_slide)){\n\t\t\tforeach($this->static_slide as $k => $s){\n\t\t\t\tif($this->get_val($this->static_slide[$k], array('params', 'bg', 'imageId'), false) !== false){\n\t\t\t\t\tunset($this->static_slide[$k]['params']['bg']['imageId']);\n\t\t\t\t}\n\t\t\t\t/*if($this->get_val($this->static_slide[$k], array('params', 'bg', 'videoId'), false) !== false){ //TODO maybe not delete, depending on if this is a wordpress media library id (then yes) or not\n\t\t\t\t\tunset($this->static_slide[$k]['params']['bg']['videoId']);\n\t\t\t\t}*/\n\t\t\t\tif($this->get_val($this->static_slide[$k], array('params', 'thumb', 'customThumbSrcId'), false) !== false){\n\t\t\t\t\tunset($this->static_slide[$k]['params']['thumb']['customThumbSrcId']);\n\t\t\t\t}\n\t\t\t\tif($this->get_val($this->static_slide[$k], array('params', 'thumb', 'customAdminThumbSrcId'), false) !== false){\n\t\t\t\t\tunset($this->static_slide[$k]['params']['thumb']['customAdminThumbSrcId']);\n\t\t\t\t}\n\t\t\t\tif($this->get_val($this->static_slide[$k], array('params', 'bg', 'lastLoadedImage'), false) !== false){\n\t\t\t\t\tunset($this->static_slide[$k]['params']['bg']['lastLoadedImage']);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}",
"function storeImageAndReplacePath($description)\n {\n preg_match_all('@src=\"([^\"]+)\"@', $description, $images);\n if (count($images) > 1) {\n $images = $images[1];\n foreach ($images as $image_url) {\n $contents = file_get_contents($image_url);\n $extension = pathinfo(parse_url($image_url, PHP_URL_PATH), PATHINFO_EXTENSION);\n if ($extension) {\n $name = time() . '.' . $extension;\n } else {\n $name = time() . substr($image_url, strrpos($image_url, '/') + 1);\n }\n $description = str_replace($image_url, url('feed_images/' . $name), $description);\n Storage::disk('feed_images')->put($name, $contents);\n }\n return $description;\n }\n\n }",
"protected function _fixImages()\r\n {\r\n $updatedProductIds = $this->getUpdatedProductIds();\r\n $productAction = $this->getProductAction();\r\n $collection = $this->getProductCollection();\r\n $this->_splitCollection();\r\n\r\n foreach ($collection as $product) {\r\n Mage::helper('progos_catalog')->resetDefaultMediaGalleryImage($product, $productAction);\r\n\r\n $updatedProductIds[] = $product->getId();\r\n $this->_showProgress(count(array_diff($updatedProductIds, $this->_updatedProductIds)));\r\n\r\n $product->clearInstance();\r\n }\r\n\r\n $this->saveUpdatedProductIds($updatedProductIds);\r\n }",
"function put_image($path) {\n\t\t$sum = md5_file($path);\n\t\t\n\t\t$r = $this->db->prepare(\"SELECT img_id FROM images WHERE img_path=:path\");\n\t\t$r->bindValue(\":path\",$path); $r->execute();\n\t\t$ret = $r->fetchObject(); $r = null;\n\t\t\n\t\tif(is_object($ret) && $ret->img_id) {\n\t\t\t$this->db->query(sprintf(\"DELETE FROM images WHERE img_id='%d'\",$ret->img_id));\n\t\t\t$this->db->query(sprintf(\"DELETE FROM thumbnails WHERE img_id='%d'\",$ret->img_id));\n\t\t\t$this->db->query(sprintf(\"DELETE FROM info WHERE img_id='%d'\",$ret->img_id));\n\t\t\t$this->db->query(sprintf(\"DELETE FROM tag_link WHERE img_id='%d'\",$ret->img_id));\n\t\t}\n\t\t\n\t\t$r = $this->db->prepare(\"INSERT INTO images (img_path, img_sum) VALUES (:path, :sum)\");\n\t\t$r->bindValue(':path',$path); $r->bindValue(':sum',$sum);\n\t\t$r->execute(); $iid = $this->db->lastInsertId(); $r = null;\n\t\t\n\t\t$this->db->query(sprintf(\n\t\t\t\"INSERT INTO info (img_id,i_name,i_date) VALUES ('%d','%s','%d');\",\n\t\t\t$iid,\n\t\t\tpreg_replace(\"/\\.(.+)$/\",\"\",basename($path)),\n\t\t\ttime()\n\t\t));\n\t\t\n\t\treturn $iid;\n\t}",
"public function loadImages()\n {\n foreach ($this->images as $oldPath => $newPath){\n $p = base_path($newPath);\n\n if(!file_exists($p)) {\n \\File::copy(__DIR__ . '/../views/' . $oldPath, $p);\n }\n }\n }",
"function remap_featured_images() {\n // cycle through posts that have a featured image\n if (isset($this->featured_images)) {\n foreach ((array) $this->featured_images as $post_id => $value) {\n if (isset($this->processed_posts[$value])) {\n $new_id = $this->processed_posts[$value];\n // only update if there's a difference\n if ($new_id != $value)\n update_post_meta($post_id, '_thumbnail_id', $new_id);\n }\n }\n }\n }",
"private function fixImageReferencesInFiles()\n {\n $xhtmlFiles = $this->getXhtmlFiles();\n foreach($xhtmlFiles as $entry){\n if($entry=='cover.xhtml'){\n continue;\n }\n $xhtml = $this->zip->getFromName($entry);\n $dom = str_get_html($xhtml);\n foreach($dom->find('img') as $element){\n $uri = $element->src;\n if(strpos($uri,' ')!==FALSE || strpos($uri,'%20')!==FALSE){\n $element->src = str_replace(' ','_', $uri);\n $element->src = str_replace('%20','_', $uri);\n }\n }\n $this->backToEpub($entry, $dom->innertext);\n }\n\n }",
"function update_data_img () {\n $DBC=DBC::getInstance();\n $query = \"select * from \".DB_PREFIX.\"_data where id > 3704\";\n $stmt=$DBC->query($query);\n if($stmt){\n \twhile($ar=$DBC->fetch($stmt)){\n \t\t$ra[$ar['id']] = $ar;\n \t}\n }\n\n\n //insert records into _image\n foreach ( $ra as $id => $item_array ) {\n for ( $i = 1; $i <= 5; $i++ ) {\n if ( $item_array['img'.$i] != '' ) {\n $query = \"insert into \".DB_PREFIX.\"_image (normal, preview) values ('{$item_array['img'.$i]}', '{$item_array['img'.$i.'_preview']}')\";\n $stmt=$DBC->query($query);\n $image_id = $DBC->lastInsertId();\n\n //link in table _data_image\n $query = \"insert into \".DB_PREFIX.\"_data_image (id, image_id, sort_order) values ($id, $image_id, $image_id)\";\n $stmt=$DBC->query($query);\n }\n }\n }\n\n\n\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Lead conversion by sources report / chart | public function leads_sources_report()
{
$this->load->model('leads_model');
$sources = $this->leads_model->get_source();
$chart = array(
'labels' => array(),
'datasets' => array(
array(
'label' => _l('report_leads_sources_conversions'),
'backgroundColor' => 'rgba(124, 179, 66, 0.5)',
'borderColor' => '#7cb342',
'data' => array()
)
)
);
foreach ($sources as $source) {
array_push($chart['labels'], $source['name']);
array_push($chart['datasets'][0]['data'], total_rows('tblleads', array(
'source' => $source['id'],
'status' => 1,
'lost' => 0
)));
}
return $chart;
} | [
"function _conversionsBySource($parameters) {\n\n $timerange = $this->_whereTimerange(\n $parameters['start'],\n $parameters['end']\n );\n\n switch ($parameters['result_format']) {\n case 'xml':\n case 'xml_object': {\n $tree = new XML_Tree;\n $root = &$tree->addRoot('visitorsonline');\n $children = array();\n }\n break;\n\n default: {\n $result = array();\n }\n }\n\n $accesslogIDs = array();\n\n // get a list of all accesslogIDs where there was a conversion\n $this->db->query(\n sprintf(\n \"SELECT DISTINCT(accesslog.accesslog_id) AS accesslog_id\n FROM %s accesslog,\n %s conversions\n WHERE conversions.client_id = '%d'\n AND conversions.accesslog_id = accesslog.accesslog_id\n %s\",\n\n $this->config['accesslog_table'],\n $this->config['plugins']['conversions']['table'],\n $parameters['client_id'],\n $timerange\n )\n );\n\n while ($row = $this->db->fetchRow()) {\n $accesslogIDs[] = $row['accesslog_id'];\n }\n\n // for each conversion, get details\n for ($i = 0, $max = sizeof($accesslogIDs); $i < $max; $i++) {\n unset($source);\n // to determine source, first look for a record of\n // the use of a search engine on the first visit,\n // then a referrer on the first visit, then\n // the use of a search engine on the most recent visit,\n // then a referrer on the most recent visit\n\n // get visitor_id and number of visits\n $this->db->query(\n sprintf(\n \"SELECT visitors.visitor_id AS visitor_id\n FROM %s visitors\n WHERE visitors.accesslog_id = '%d'\",\n\n $this->config['visitors_table'],\n $accesslogIDs[$i]\n )\n );\n\n if ($row = $this->db->fetchRow()) {\n $visitor_id = intval($row['visitor_id']);\n } else {\n $visitor_id = 0;\n }\n\n $this->db->query(\n sprintf(\n \"SELECT COUNT(visitors.visitor_id) AS num_visits\n FROM %s visitors\n WHERE visitors.visitor_id = '%d'\",\n\n $this->config['visitors_table'],\n $visitor_id\n )\n );\n\n if ($row = $this->db->fetchRow()) {\n $num_visits = intval($row['num_visits']);\n } else {\n $num_visits = 0;\n } // end query for visitor_id and number of visits\n\n // get accesslog_id of first visit\n $this->db->query(\n sprintf(\n \"SELECT visitors.accesslog_id AS first_access\n FROM %s visitors\n WHERE visitors.visitor_id = '%d'\n ORDER BY visitors.timestamp\",\n\n $this->config['visitors_table'],\n $visitor_id\n )\n );\n if ($row = $this->db->fetchRow()) {\n $first_access = $row['first_access'];\n } // end query for accesslog_id of first visit\n\n\n // get first search engine and search engine keywords\n if ($num_visits > 1) {\n $this->db->query(\n sprintf(\n \"SELECT search_engines.search_engine AS search_engine,\n search_engines.keywords AS keywords\n FROM %s search_engines\n WHERE search_engines.accesslog_id = '%d'\",\n $this->config['plugins']['search_engines']['table'],\n $first_access\n )\n );\n if ($row = $this->db->fetchRow()) {\n $source = $row['search_engine'].': \"'.$row['keywords'].'\"';\n }\n\n } // end query for first search engine and search engine keywords\n\n // get first referrer\n if (!isset($source)) {\n if ($num_visits > 1) {\n $this->db->query(\n sprintf(\n \"SELECT referers.string AS first_referer\n FROM %s visitors,\n %s referers\n WHERE visitors.accesslog_id = '%d'\n AND visitors.referer_id = referers.data_id\n ORDER BY visitors.timestamp\",\n\n $this->config['visitors_table'],\n $this->config['referers_table'],\n $first_access\n )\n );\n\n if ($row = $this->db->fetchRow()) {\n $source = $row['first_referer'];\n }\n }\n } // end query for first referrer\n\n // get most recent search engine and search engine keywords\n if (!isset($source)) {\n $this->db->query(\n sprintf(\n \"SELECT search_engines.search_engine AS search_engine,\n search_engines.keywords AS keywords\n FROM %s search_engines,\n %s visitors\n WHERE visitors.visitor_id = '%d'\n AND visitors.accesslog_id = search_engines.accesslog_id\n ORDER BY visitors.timestamp\",\n\n $this->config['plugins']['search_engines']['table'],\n $this->config['visitors_table'],\n $visitor_id\n )\n );\n if ($row = $this->db->fetchRow()) {\n $source = $row['search_engine'].': \"'.$row['keywords'].'\"';\n }\n } // end query for most recent search engines and search engine keywords\n\n // get most recent referrer\n if (!isset($source)) {\n $this->db->query(\n sprintf(\n \"SELECT referers.string AS referer\n FROM %s visitors,\n %s referers\n WHERE visitors.accesslog_id = '%d'\n AND visitors.referer_id = referers.data_id\",\n\n $this->config['visitors_table'],\n $this->config['referers_table'],\n $accesslogIDs[$i]\n )\n );\n if ($row = $this->db->fetchRow()) {\n $source = $row['referer'];\n } else {\n $source = 'unknown';\n }\n } // end query for most recent referrer\n\n // store source as a result\n switch ($parameters['result_format']) {\n case 'xml':\n case 'xml_object': {\n // ??\n }\n break;\n\n default: {\n $result[$source]['source'] = $source;\n }\n } // done storing source\n\n\n // query for conversions type, amount, and details\n $this->db->query(\n sprintf(\n \"SELECT conversions.sale AS sale,\n conversions.inquiry AS inquiry,\n conversions.signup AS signup\n FROM %s conversions,\n %s visitors\n WHERE visitors.accesslog_id = '%d'\n AND visitors.accesslog_id = conversions.accesslog_id\",\n\n $this->config['plugins']['conversions']['table'],\n $this->config['visitors_table'],\n $accesslogIDs[$i]\n )\n );\n\n if ($row = $this->db->fetchRow()) {\n $sale = $row['sale'];\n $inquiry = $row['inquiry'];\n $signup = $row['signup'];\n } else {\n $sale = '';\n $inquiry = '';\n $signup = '';\n }\n\n\n switch ($parameters['result_format']) {\n case 'xml':\n case 'xml_object': {\n // ??\n }\n break;\n\n default: {\n $result[$source]['sale'] = $result[$source]['sale'] + $sale;\n $result[$source]['inquiry'] = $result[$source]['inquiry'] + $inquiry;\n $result[$source]['signup'] = $result[$source]['signup'] + $signup;\n }\n }\n // end query for conversions type, amount, etc.\n\n } // end loop\n\n // return results\n switch ($parameters['result_format']) {\n case 'xml': {\n return $root->get();\n }\n break;\n\n case 'xml_object': {\n return $root;\n }\n break;\n\n default: {\n return $result;\n }\n }\n }",
"function pipeline_by_lead_source($legends=array('foo','bar'), $user_id=array('1'), $cache_file_name='a_file', $refresh=true) {\n\t\tglobal $app_strings, $current_module_strings, $log, $charset, $lang, $pieChartColors;\n\n\n\t\tif (!file_exists($cache_file_name) || $refresh == true) {\n\t\t\t$log =& LoggerManager::getLogger('opportunity charts');\n\t\t\t$log->debug(\"starting pipeline chart\");\n\t\t\t$log->debug(\"legends is:\");\n\t\t\t$log->debug($legends);\n\t\t\t$log->debug(\"user_id is: \");\n\t\t\t$log->debug($user_id);\n\t\t\t$log->debug(\"cache_file_name is: $cache_file_name\");\n\n\t\t\t$opp = new Opportunity;\n\t\t\t//Now do the db queries\n\t\t\t//query for opportunity data that matches $legends and $user\n\t\t\t$where=\"\";\n\t\t\t//build the where clause for the query that matches $user\n\t\t\t$count = count($user_id);\n\t\t\t$id = array();\n\t\t\tif ($count>0) {\n\t\t\t\tforeach ($user_id as $the_id) {\n\t\t\t\t\t$id[] = \"'\".$the_id.\"'\";\n\t\t\t\t}\n\t\t\t\t$ids = join(\",\",$id);\n\t\t\t\t$where .= \"opportunities.assigned_user_id IN ($ids) \";\n\n\t\t\t}\n\n\t\t\t//build the where clause for the query that matches $datax\n\t\t\t$count = count($legends);\n\t\t\t$legendItem = array();\n\t\t\tif ($count>0) {\n\n\t\t\t\tforeach ($legends as $key=>$value) {\n\t\t\t\t\t$legendItem[] = \"'\".$key.\"'\";\n\t\t\t\t}\n\t\t\t\t$legendItems = join(\",\",$legendItem);\n\t\t\t\t$where .= \"AND opportunities.lead_source IN\t($legendItems) \";\n\t\t\t}\n\t\t\t$query = \"SELECT lead_source,sum(amount/1000) as total,count(*) as opp_count FROM opportunities \";\n\n\n\n\t\t\t$query .= \"WHERE \".$where.\" AND opportunities.deleted=0 \";\n\t\t\t$query .= \"GROUP BY lead_source ORDER BY opportunities.amount_usdollar DESC, opportunities.date_closed DESC\";\n\t\t\t\n\t\t\t//build pipeline by lead source data\n\t\t\t$total = 0;\n\t\t\t$div = 1;\n\t\t\t$symbol = translate('LBL_CURRENCY_SYMBOL');\n\t\t\tglobal $current_user;\n\t\t\tif($current_user->getPreference('currency') ) {\n\t\t\t\trequire_once('modules/Currencies/Currency.php');\n\t\t\t\t$currency = new Currency();\n\t\t\t\t$currency->retrieve($current_user->getPreference('currency'));\n\t\t\t\t$div = $currency->conversion_rate;\n\t\t\t\t$symbol = $currency->symbol;\n\t\t\t}\n\t\t\t$subtitle = $current_module_strings['LBL_OPP_SIZE'].' '.$symbol.'1'.$current_module_strings['LBL_OPP_THOUSANDS'];\n\t\t\t$fileContents = '';\n\t\t\t$fileContents .= ' <pie defaultAltText=\"'.$current_module_strings['LBL_ROLLOVER_WEDGE_DETAILS'].'\">'.\"\\n\";\n\t\t\t$result = $opp->db->query($query)\n\t\t\tor sugar_die(\"Error selecting sugarbean: \".mysqli_error($varconnect));\n\t\t\t$leadSourceArr = array();\n\t\t\twhile($row = $opp->db->fetchByAssoc($result, -1, false))\n\t\t\t{\n\t\t\t\tif($row['lead_source'] == ''){\n\t\t\t\t\t$leadSource = $current_module_strings['NTC_NO_LEGENDS'];\n\t\t\t\t} else {\n\t\t\t\t\t$leadSource = $row['lead_source'];\n\t\t\t\t}\n\t\t\t\tif($row['total']*$div<=100){\n\t\t\t\t\t$sum = round($row['total']*$div, 2);\n\t\t\t\t} else {\n\t\t\t\t\t$sum = round($row['total']*$div);\n\t\t\t\t}\n\n\t\t\t\t$leadSourceArr[$leadSource]['opp_count'] = $row['opp_count'];\n\t\t\t\t$leadSourceArr[$leadSource]['sum'] = $sum;\n\t\t\t}\n\t\t\t$i=0;\n\t\t\tforeach ($legends as $lead_source_key=>$translation) {\n\t\t\t\tif ($lead_source_key == '') {\n\t\t\t\t\t$lead_source_key = $current_module_strings['NTC_NO_LEGENDS'];\n\t\t\t\t\t$translation = $current_module_strings['NTC_NO_LEGENDS'];\n\t\t\t\t}\n\t\t\t\tif(!isset($leadSourceArr[$lead_source_key])) {\n\t\t\t\t\t$leadSourceArr[$lead_source_key] = $lead_source_key;\n\t\t\t\t\t$leadSourceArr[$lead_source_key]['sum'] = 0;\n\t\t\t\t}\n\t\t\t\t$color = generate_graphcolor($lead_source_key,$i);\n\t\t\t\t$fileContents .= ' <wedge title=\"'.$translation.'\" value=\"'.$leadSourceArr[$lead_source_key]['sum'].'\" color=\"'.$color.'\" labelText=\"'.$symbol.$leadSourceArr[$lead_source_key]['sum'].'\" url=\"index.php?module=Opportunities&action=index&lead_source='.urlencode($lead_source_key).'&query=true\" altText=\"'.$leadSourceArr[$lead_source_key]['opp_count'].' '.$current_module_strings['LBL_OPPS_IN_LEAD_SOURCE'].' '.$translation.'\"/>'.\"\\n\";\n\t\t\t\tif(isset($leadSourceArr[$lead_source_key])){$total += $leadSourceArr[$lead_source_key]['sum'];}\n\t\t\t\t$i++;\n\t\t\t}\n\n\t\t\t$fileContents .= ' </pie>'.\"\\n\";\n\t\t\t$fileContents .= ' <graphInfo>'.\"\\n\";\n\t\t\t$fileContents .= ' <![CDATA[]]>'.\"\\n\";\n\t\t\t$fileContents .= ' </graphInfo>'.\"\\n\";\n\t\t\t$fileContents .= ' <chartColors ';\n\t\t\tforeach ($pieChartColors as $key => $value) {\n\t\t\t\t$fileContents .= ' '.$key.'='.'\"'.$value.'\" ';\n\t\t\t}\n\t\t\t$fileContents .= ' />'.\"\\n\";\n\t\t\t$fileContents .= '</graphData>'.\"\\n\";\n\t\t\t$total = round($total, 2);\n\t\t\t$title = $current_module_strings['LBL_TOTAL_PIPELINE'].$symbol.$total.$app_strings['LBL_THOUSANDS_SYMBOL'];\n\t\t\t$fileContents = '<graphData title=\"'.$title.'\" subtitle=\"'.$subtitle.'\">'.\"\\n\" . $fileContents;\n\t\t\t$log->debug(\"total is: $total\");\n\t\t\tif ($total == 0) {\n\t\t\t\treturn ($current_module_strings['ERR_NO_OPPS']);\n\t\t\t}\n\n\t\t\tsave_xml_file($cache_file_name, $fileContents);\n\t\t}\n\n\t\t$return = create_chart('pieF',$cache_file_name);\n\t\treturn $return;\n\n\t}",
"public function lead_source_conversion(Request $request)\n {\n $response = $request->all();\n $ann_start_dt = str_replace(\"/\",\"-\",$response['ann_start_date']);\n $ann_end_dt = str_replace(\"/\",\"-\",$response['ann_end_date']);\n $ann_start_dt = date(\"Y-m-d\", strtotime($ann_start_dt)).' 00:00:00';;\n $ann_end_dt = date('Y-m-d',strtotime($ann_end_dt)).' 23:59:59';\n $cmpny_id = $response['cmpny_id'];\n $lead_source_data = array();\n\n $lead_source_array = LeadSources::select('id','name')->where('cmpny_id',$cmpny_id)->where('status',config('constant.ACTIVE'))->pluck('name','id')->all();\n $lead_source_array = [0 => 'Not Specified'] + $lead_source_array;\n $lead_source_data['lead_source_names'] = array_values($lead_source_array);\n $lead_source_ids = array_keys($lead_source_array);\n $profile_status_array = config('constant.profile_status');\n $profile_status_array = [0 => 'Not Specified'] + $profile_status_array;\n $lead_source_data['profile_status_names'] = array_values($profile_status_array);\n $query_status_ids = array_keys($profile_status_array);\n\n $customer_counts = CustomerProfile::select('source', 'profile_status', DB::raw(\"COUNT(*) AS 'lead_count'\"))\n ->where('ori_customer_profiles.cmpny_id', $cmpny_id)\n ->whereBetween('ori_customer_profiles.created_at', [$ann_start_dt, $ann_end_dt])\n ->groupBy('source')\n ->groupBy('profile_status')\n ->orderBy('source')\n ->orderBy('profile_status')\n ->get();\n\n foreach ($customer_counts as $customer_count)\n {\n $source = (int)$customer_count->source;\n $profile_status = (int)$customer_count->profile_status;\n $lead_source_counts_data[$lead_source_array[$source]][$profile_status_array[$profile_status]] = $customer_count->lead_count;\n }\n\n $i = 0;\n $j = 0;\n\n $lead_source_status_array = array();\n\n foreach ($lead_source_array as $lead_source_id => $lead_source_name)\n {\n $j = 0;\n foreach ($profile_status_array as $profile_status_id => $profile_status_name)\n {\n if (isset($lead_source_counts_data[$lead_source_name]))\n {\n if (isset($lead_source_counts_data[$lead_source_name][$profile_status_name]))\n {\n $query_count = $lead_source_counts_data[$lead_source_name][$profile_status_name];\n $lead_source_status_array[] = [$i,$j,$query_count];\n }\n else\n {\n $lead_source_status_array[] = [$i,$j,0];\n }\n }\n else\n {\n $lead_source_status_array[] = [$i,$j,0];\n }\n $j++;\n }\n $i++;\n }\n $lead_source_data['value'] = $lead_source_status_array;\n return json_encode($lead_source_data);\n\n }",
"private function extensionSummaryReport($fromdate, $todate) {\r\n \r\n $chartReportImages = array();\r\n $extensionByMonth = $this->reportclass->getExtensionByMonth($this->data['loggeduser']->customerid, $fromdate, $todate);\r\n \r\n foreach($extensionByMonth as $key=>$value) {\r\n $chartXAxis = array();\r\n $chartSeries = array(\r\n array(\r\n 'name' => 'Extended',\r\n 'data' => array()\r\n ),\r\n array(\r\n 'name' => 'Not Extended',\r\n 'data' => array()\r\n )\r\n );\r\n $chartSeriesPercentage = array(\r\n array(\r\n 'name' => 'Extended',\r\n 'data' => array()\r\n ),\r\n array(\r\n 'name' => 'Not Extended',\r\n 'data' => array()\r\n )\r\n );\r\n foreach($value as $key1=>$value1) {\r\n array_push($chartXAxis, date('M', mktime(0, 0, 0, $value1['m'], 10)));\r\n array_push($chartSeries[0]['data'], (int)$value1['extended']);\r\n array_push($chartSeries[1]['data'], (int)$value1['notextended']);\r\n\r\n //for percentage\r\n array_push($chartSeriesPercentage[0]['data'], $value1['extended']/$value1['totaljobs']*100);\r\n array_push($chartSeriesPercentage[1]['data'], $value1['notextended']/$value1['totaljobs']*100);\r\n }\r\n\r\n $optionStr = array(\r\n 'chart' => array(\r\n 'style' => array(\r\n 'fontFamily' => 'Helvetica', \r\n 'fontSize' => '10px',\r\n 'fontWeight' => 'bold'\r\n )\r\n ),\r\n 'xAxis' => array(\r\n 'categories' => $chartXAxis\r\n ),\r\n 'title' => array(\r\n 'text' => '<b style=\"font-family:Helvetica;font-size:10px;\">No. of Job Extended</b>',\r\n 'useHTML' => true\r\n ),\r\n 'credits' => array(\r\n 'enabled' => FALSE\r\n ),\r\n 'legend' => array(\r\n 'layout' => 'vertical',\r\n 'align' => 'left',\r\n 'itemStyle' => array(\r\n 'fontSize'=> '10px;'\r\n ),\r\n 'floating' => TRUE,\r\n 'x' => 70,\r\n 'y' =>30,\r\n 'verticalAlign' => 'top',\r\n 'borderWidth' => 0,\r\n ),\r\n 'series' => $chartSeries\r\n );\r\n\r\n $chartOptions = array();\r\n $chartOptions[] = $optionStr;\r\n\r\n // % report\r\n $optionStr['title']['text'] = \"<b style='font-family:Helvetica;font-size:10px;'>Job Extended Percentage</b>\";\r\n $optionStr['series'] = $chartSeriesPercentage;\r\n $chartOptions[] = $optionStr;\r\n\r\n array_push($chartReportImages, array('key' => $key, 'values' => array()));\r\n foreach($chartOptions as $chartOpt) {\r\n $chartOpt = json_encode($chartOpt);\r\n $dataString = 'async=true&type=jpeg&width=640&options=' . $chartOpt;\r\n $url = 'http://export.highcharts.com/';\r\n\r\n $response = $this->curlPost($url, $dataString);\r\n\r\n if($response['curlError']) {\r\n echo $response['message'];\r\n } else {\r\n $file = $response['message'];\r\n $path_parts = pathinfo($file);\r\n $filename = $path_parts['basename'];\r\n\r\n $dir = \"./temp\";\r\n if (!is_dir($dir))\r\n {\r\n mkdir($dir, 0755, TRUE);\r\n }\r\n\r\n file_put_contents($dir.'/'.$filename, file_get_contents($url.$file));\r\n array_push($chartReportImages[$key]['values'], array('file' => $path_parts['basename'], 'ext' =>$path_parts['extension'])); \r\n }\r\n sleep(1);\r\n }\r\n }\r\n return $chartReportImages;\r\n }",
"function pipeline_by_lead_source ($legends=array('foo', 'bar'), $data=array(1,2), $title='the title', $subtitle='the subtitle') {\n\t\tinclude (\"jpgraph/src/jpgraph.php\");\n\t\tinclude (\"jpgraph/src/jpgraph_pie.php\");\n\t\tinclude (\"jpgraph/src/jpgraph_pie3d.php\");\n\t\t\n\t\t// Create the Pie Graph.\n\t\t$graph = new PieGraph(440,200,\"auto\");\n\t\t$graph->SetShadow();\n\t\n\t\t// Setup title\n\t\t$graph->title->Set($title);\n\t\t$graph->title->SetFont(FF_FONT1,FS_BOLD,11);\n\t\n\t\t// No frame around the image\n\t\t$graph->SetFrame(false);\n\t\n\t\t$graph->legend->Pos(0.03,0.13);\n\t\t$graph->legend->SetFont(FF_FONT0,FS_NORMAL,12);\n\t\t\n\t\t$graph->footer->left->Set($subtitle); \n\t\n\t\t// Create pie plot\n\t\t$p1 = new PiePlot3d($data);\n\t\t$p1->SetSize(0.40);\n\t\t$p1->SetTheme(\"sand\");\n\t\t$p1->SetCenter(0.30);\n\t\t$p1->SetAngle(30);\n\t\t$p1->value->SetFont(FF_FONT1,FS_NORMAL,12);\n\t\t$p1->SetLegends($legends);\n\t\t$p1->SetLabelType(PIE_VALUE_ABS);\n\t\t$p1->value->SetFormat('$%d'); \n\t\t\n\t\t$graph->Add($p1);\n\t\t$graph->Stroke();\n\t\n\t}",
"function GetCampaignsData_through_AdHoc_ReportsEx(AdWordsUser &$user, $CurClientID, $ReportType, $ReportName, $ReportFields, $StartDate, $EndDate, $Predicates = null, $filePath = null){ \n\n $OldClientID = $user->GetClientCustomerId();\n\n if($CurClientID == -1)\n\n $CurClientID = \"7650647282\"; \n\n $user->SetClientCustomerId($CurClientID); \n\n $user->LoadService('ReportDefinitionService', ADWORDS_VERSION); \n\n $selector = new Selector(); \n\n $selector->fields = $ReportFields; \n\n if($Predicates != null) \n\n if(count($Predicates > 0)) \n\n $selector->predicates = $Predicates; \n\n $reportDefinition = new ReportDefinition(); \n\n $reportDefinition->selector = $selector; \n $reportDefinition->reportName = $ReportName.'#' . uniqid();\n\n if($EndDate == null) {\n\n $reportDefinition->dateRangeType = $StartDate; \n //$selector->dateRange = $StartDate;\n }\n else{ \n\n $reportDefinition->dateRangeType = 'CUSTOM_DATE'; \n $selector->dateRange = new DateRange($StartDate, $EndDate); \n }\n \n\n $reportDefinition->reportType = $ReportType; \n\n $reportDefinition->downloadFormat = 'CSV'; \n\n \n\n //$reportDefinition->includeZeroImpressions = true; \n\n \n\n $options = array('version' => ADWORDS_VERSION/*, 'returnMoneyInMicros' => FALSE*/); \n $options['skipReportHeader'] = true;\n \n $CSVDataFromReport = ReportUtils::DownloadReport($reportDefinition, $filePath, $user, $options); \n\n //$ReportAsStr2DArray = ParseReportFromOneStrCSVToStr2DArrayEx($CSVDataFromReport); \n\n \n\n $user->SetClientCustomerId($OldClientID); \n\n return $CSVDataFromReport;\n\n}",
"public function generate_report()\n { \n $query = \"\";\n $artikel = array(); \n if( isset($this->request->data) ){\n $sql_fields = array();\n $data = $this->request->data; \n\n foreach($data['fields'] as $key => $value){\n $sql_fields[] = $key;\n }\n\n if( isset($data['filter-leads-report']) ){\n $query_builder = array();\n $or_query_builder = array(); \n foreach( $data['search'] as $key => $value ){\n $operator = trim($value['operator']);\n $query_value = trim($value['value']);\n if($operator != '' && $query_value != ''){ \n switch ($key) {\n case 'source': \n if( $operator == 'LIKE' ){ \n $query_builder[] = ['Source.name ' . $operator . \" '%\" . $query_value . \"%'\"];\n }else{\n $query_builder[] = ['Leads.source_id ' . $operator => $query_value];\n } \n break; \n default:\n if( $operator == 'LIKE' ){ \n $query_builder[] = ['Leads.' . $key . \" \" . $operator . \" '%\" . $query_value . \"%'\"];\n }else{\n $query_builder[] = ['Leads.' . $key . \" \" . $operator => $query_value];\n } \n break; \n }\n }\n }\n\n $leads = $this->Leads->find('all') \n ->contain(['Statuses', 'Sources'])\n ->where($query_builder) \n ->order(['Leads.firstname' => 'ASC']) \n ;\n }else{\n //Select all\n $leads = $this->Leads->find('all') \n ->contain(['Statuses', 'Sources']) \n ->order(['Leads.firstname' => 'ASC']) \n ;\n }\n\n //Fields \n $fields = $data['fields'];\n $total_fields = count($fields) + 2;\n $eColumns = [1 => 'A', 2 => 'B', 3 => 'C', 4 => 'D', 5 => 'E', 6 => 'F', 7 => 'G', 8 => 'H', 9 => 'I', 10 => 'J'];\n\n $excel_cell_values = array(); \n foreach( $leads as $l ){ \n $excelFields = array();\n foreach( $fields as $key => $value ){ \n if( $key == 'source_id' ){\n $excelFields[] = $l->source->name;\n }else{ \n $excelFields[] = $l->{$key};\n } \n }\n $excel_cell_values[] = $excelFields; \n }\n\n //generate excel file for attachment\n define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');\n\n $objPHPExcel = new PHPExcel();\n $objPHPExcel->getProperties()->setCreator(\"Holistic Admin\")\n ->setLastModifiedBy(\"Holistic Admin\")\n ->setTitle(\"Leads Report\")\n ->setSubject(\"Leads Report\")\n ->setDescription(\"Excel file generated for Leads Report\")\n ->setKeywords(\"Leads Report\")\n ->setCategory(\"Lists\");\n $objPHPExcel->setActiveSheetIndex(0);\n\n $borderArray = array(\n 'borders' => array(\n 'allborders' => array(\n 'style' => 'thick',\n 'color' => array('argb' => 'C3232D')\n )\n )\n );\n $objPHPExcel->getDefaultStyle()->applyFromArray($borderArray);\n\n for($col = 'A'; $col !== 'I'; $col++) {\n $objPHPExcel->getActiveSheet()\n ->getColumnDimension($col)\n ->setAutoSize(true);\n }\n\n $ews = $objPHPExcel->getSheet(0);\n $ews->setTitle('Sheet 1');\n //header\n $ews->setCellValue('A1', 'Date');\n $ews->setCellValue('B1', date(\"Y-m-d\"));\n\n $ews->setCellValue('A2', '');\n $ews->setCellValue('B2', 'Leads Report');\n\n $start = 1;\n $end_column; \n foreach( $fields as $key => $value ){\n //echo $eColumns[1] . ($start+3) . \"<br />\";\n $ews->setCellValue($eColumns[$start] . 4, $value);\n $end_column = $eColumns[$start] . 4;\n $start++;\n } \n\n $ews->getStyle($eColumns[1] . '4' . ':' . $end_column)->applyFromArray(\n array(\n 'fill' => array(\n 'type' => 'solid',\n 'color' => array('rgb' => 'CDD6DF')\n )\n )\n );\n\n //debug($leads);exit;\n $ews->fromArray($excel_cell_values,'','A5');\n\n $fileName = time() . \"_\" . rand(000000, 999999) . \".xlsx\";\n $objWriter = \\PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');\n $objWriter->save('excel\\leads\\\\' . $fileName); \n\n $file_path = WWW_ROOT.'excel\\leads\\\\' . $fileName;\n $this->response->file($file_path, array(\n 'download' => true,\n 'name' => $fileName,\n ));\n return $this->response;\n exit;\n }\n\n exit;\n }",
"protected abstract function getTravelReport();",
"function pipeline_by_sales_stage($datax=array('foo','bar'), $date_start='2071-10-15', $date_end='2071-10-15', $user_id=array('1'), $cache_file_name='a_file', $refresh=false,$chart_size='hBarF') {\n\t\tglobal $app_strings, $current_module_strings, $log, $charset, $lang, $barChartColors;\n\n\t\t$log =& LoggerManager::getLogger('opportunity charts');\n\n\t\tif (!file_exists($cache_file_name) || $refresh == true) {\n\n\t\t\t$log->debug(\"starting pipeline chart\");\n\t\t\t$log->debug(\"datax is:\");\n\t\t\t$log->debug($datax);\n\t\t\t$log->debug(\"user_id is: \");\n\t\t\t$log->debug($user_id);\n\t\t\t$log->debug(\"cache_file_name is: $cache_file_name\");\n\t\t\t$opp = new Opportunity;\n\t\t\t$where=\"\";\n\t\t\t//build the where clause for the query that matches $user\n\t\t\t$count = count($user_id);\n\t\t\t$id = array();\n\t\t\t$user_list = get_user_array(false);\n\t\t\tforeach ($user_id as $key) {\n\t\t\t\t$new_ids[$key] = $user_list[$key];\n\t\t\t}\n\t\t\tif ($count>0) {\n\t\t\t\tforeach ($new_ids as $the_id=>$the_name) {\n\t\t\t\t\t$id[] = \"'\".$the_id.\"'\";\n\t\t\t\t}\n\t\t\t\t$ids = join(\",\",$id);\n\t\t\t\t$where .= \"opportunities.assigned_user_id IN ($ids) \";\n\n\t\t\t}\n\t\t\t//build the where clause for the query that matches $datax\n\t\t\t$count = count($datax);\n\t\t\t$dataxArr = array();\n\t\t\tif ($count>0) {\n\n\t\t\t\tforeach ($datax as $key=>$value) {\n\t\t\t\t\t$dataxArr[] = \"'\".$key.\"'\";\n\t\t\t\t}\n\t\t\t\t$dataxArr = join(\",\",$dataxArr);\n\t\t\t\t$where .= \"AND opportunities.sales_stage IN\t($dataxArr) \";\n\t\t\t}\n\n\t\t\t//build the where clause for the query that matches $date_start and $date_end\n\t\t\t$where .= \"AND opportunities.date_closed >= '$date_start' AND opportunities.date_closed <= '$date_end' \";\n\t\t\t$where .= \"AND opportunities.assigned_user_id = users.id AND opportunities.deleted=0 \";\n\n\t\t\t//Now do the db queries\n\t\t\t//query for opportunity data that matches $datax and $user\n\t\t\t$query = \"SELECT opportunities.sales_stage,users.user_name,opportunities.assigned_user_id,count( * ) AS opp_count, sum(amount/1000) as total FROM opportunities,users \";\n\n\n\n\t\t\t$query .= \"WHERE \" .$where;\n\t\t\t$query .= \" GROUP BY opportunities.sales_stage,users.user_name,opportunities.assigned_user_id\";\n\t\t\t\n\t\t\t$result = $opp->db->query($query)\n\t\t\tor sugar_die(\"Error selecting sugarbean: \".mysqli_error($varconnect));\n\t\t\t//build pipeline by sales stage data\n\t\t\t$total = 0;\n\t\t\t$div = 1;\n\t\t\t$symbol = translate('LBL_CURRENCY_SYMBOL');\n\t\t\tglobal $current_user;\n\t\t\tif($current_user->getPreference('currency') ){\n\t\t\t\trequire_once('modules/Currencies/Currency.php');\n\t\t\t\t$currency = new Currency();\n\t\t\t\t$currency->retrieve($current_user->getPreference('currency'));\n\t\t\t\t$div = $currency->conversion_rate;\n\t\t\t\t$symbol = $currency->symbol;\n\t\t\t}\n\t\t\t$fileContents = ' <yData defaultAltText=\"'.$current_module_strings['LBL_ROLLOVER_DETAILS'].'\">'.\"\\n\";\n\t\t\t$stageArr = array();\n\t\t\t$usernameArr = array();\n\t\t\t$rowTotalArr = array();\n\t\t\t$rowTotalArr[] = 0;\n\t\t\twhile($row = $opp->db->fetchByAssoc($result, -1, false))\n\t\t\t{\n\t\t\t\tif($row['total']*$div<=100){\n\t\t\t\t\t$sum = round($row['total']*$div, 2);\n\t\t\t\t} else {\n\t\t\t\t\t$sum = round($row['total']*$div);\n\t\t\t\t}\n\t\t\t\tif(!isset($stageArr[$row['sales_stage']]['row_total'])) {$stageArr[$row['sales_stage']]['row_total']=0;}\n\t\t\t\t$stageArr[$row['sales_stage']][$row['assigned_user_id']]['opp_count'] = $row['opp_count'];\n\t\t\t\t$stageArr[$row['sales_stage']][$row['assigned_user_id']]['total'] = $sum;\n\t\t\t\t$stageArr[$row['sales_stage']]['people'][$row['assigned_user_id']] = $row['user_name'];\n\t\t\t\t$stageArr[$row['sales_stage']]['row_total'] += $sum;\n\n\t\t\t\t$usernameArr[$row['assigned_user_id']] = $row['user_name'];\n\t\t\t\t$total += $sum;\n\t\t\t}\n\t\t\tforeach ($datax as $key=>$translation) {\n\t\t\t\tif(isset($stageArr[$key]['row_total'])){$rowTotalArr[]=$stageArr[$key]['row_total'];}\n\t\t\t\tif(isset($stageArr[$key]['row_total']) && $stageArr[$key]['row_total']>100) {\n\t\t\t\t\t$stageArr[$key]['row_total'] = round($stageArr[$key]['row_total']);\n\t\t\t\t}\n\t\t\t\t$fileContents .= ' <dataRow title=\"'.$translation.'\" endLabel=\"';\n\t\t\t\tif(isset($stageArr[$key]['row_total'])){$fileContents .= $stageArr[$key]['row_total'];}\n\t\t\t\t$fileContents .= '\">'.\"\\n\";\n\t\t\t\tif(isset($stageArr[$key]['people'])){\n\t\t\t\t\tasort($stageArr[$key]['people']);\n\t\t\t\t\treset($stageArr[$key]['people']);\n\t\t\t\t\tforeach ($stageArr[$key]['people'] as $nameKey=>$nameValue) {\n\t\t\t\t\t\t$fileContents .= ' <bar id=\"'.$nameKey.'\" totalSize=\"'.$stageArr[$key][$nameKey]['total'].'\" altText=\"'.$nameValue.': '.$stageArr[$key][$nameKey]['opp_count'].' '.$current_module_strings['LBL_OPPS_WORTH'].' '.$stageArr[$key][$nameKey]['total'].$current_module_strings['LBL_OPP_THOUSANDS'].' '.$current_module_strings['LBL_OPPS_IN_STAGE'].' '.$translation.'\" url=\"index.php?module=Opportunities&action=index&assigned_user_id[]='.$nameKey.'&sales_stage='.urlencode($key).'&date_start='.$date_start.'&date_closed='.$date_end.'&query=true\"/>'.\"\\n\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$fileContents .= ' </dataRow>'.\"\\n\";\n\t\t\t}\n\t\t\t$fileContents .= ' </yData>'.\"\\n\";\n\t\t\t$max = get_max($rowTotalArr);\n\t\t\tif($chart_size=='hBarF'){\n\t\t\t\t$length = \"10\";\n\t\t\t}else{\n\t\t\t\t$length = \"4\";\n\t\t\t}\n\t\t\t$fileContents .= ' <xData min=\"0\" max=\"'.$max.'\" length=\"'.$length.'\" prefix=\"'.$symbol.'\" suffix=\"\"/>'.\"\\n\";\n\t\t\t$fileContents .= ' <colorLegend>'.\"\\n\";\n\t\t\t$i=0;\n\t\t\tasort($new_ids);\n\t\t\tforeach ($new_ids as $key=>$value) {\n\t\t\t$color = generate_graphcolor($key,$i);\n\t\t\t$fileContents .= ' <mapping id=\"'.$key.'\" name=\"'.$value.'\" color=\"'.$color.'\"/>'.\"\\n\";\n\t\t\t$i++;\n\t\t\t}\n\t\t\t$fileContents .= ' </colorLegend>'.\"\\n\";\n\t\t\t$fileContents .= ' <graphInfo>'.\"\\n\";\n\t\t\t$fileContents .= ' <![CDATA['.$current_module_strings['LBL_DATE_RANGE'].' '.$date_start.' '.$current_module_strings['LBL_DATE_RANGE_TO'].' '.$date_end.'<BR/>'.$current_module_strings['LBL_OPP_SIZE'].' '.$symbol.'1'.$current_module_strings['LBL_OPP_THOUSANDS'].']]>'.\"\\n\";\n\t\t\t$fileContents .= ' </graphInfo>'.\"\\n\";\n\t\t\t$fileContents .= ' <chartColors ';\n\t\t\tforeach ($barChartColors as $key => $value) {\n\t\t\t\t$fileContents .= ' '.$key.'='.'\"'.$value.'\" ';\n\t\t\t}\n\t\t\t$fileContents .= ' />'.\"\\n\";\n\t\t\t$fileContents .= '</graphData>'.\"\\n\";\n\t\t\t$total = $total;\n\t\t\t$title = '<graphData title=\"'.$current_module_strings['LBL_TOTAL_PIPELINE'].$symbol.$total.$app_strings['LBL_THOUSANDS_SYMBOL'].'\">'.\"\\n\";\n\t\t\t$fileContents = $title.$fileContents;\n\n\t\t\tsave_xml_file($cache_file_name, $fileContents);\n\t\t}\n\n\t\tif($chart_size=='hBarF'){\n\t\t\t$width = \"800\";\n\t\t\t$height = \"400\";\n\t\t} else {\n\t\t\t$width = \"350\";\n\t\t\t$height = \"400\";\n\t\t}\n\t\t$return = create_chart($chart_size,$cache_file_name,$width,$height);\n\t\treturn $return;\n\t}",
"private function workCompletionReport($fromdate, $todate) {\r\n \r\n $chartReportImages = array();\r\n $workCompletion = $this->reportclass->getWorkCompletion($this->data['loggeduser']->contactid, $fromdate, $todate);\r\n\r\n $chartSeries = array(\r\n array(\r\n 'data' => array(\r\n array(\r\n 'name' => 'q',\r\n 'y' => 10\r\n ),\r\n array(\r\n 'name' => 'w',\r\n 'y' => 20\r\n ),\r\n array(\r\n 'name' => 'e',\r\n 'y' => 30\r\n ),\r\n array(\r\n 'name' => 'r',\r\n 'y' => 40\r\n ),\r\n array(\r\n 'name' => 't',\r\n 'y' => 50\r\n ),\r\n array(\r\n 'name' => 'y',\r\n 'y' => 60\r\n ),\r\n array(\r\n 'name' => 'u',\r\n 'y' => 70\r\n ),\r\n array(\r\n 'name' => 'i',\r\n 'y' => 70\r\n ),\r\n array(\r\n 'name' => 'd',\r\n 'y' => 80\r\n ),\r\n array(\r\n 'name' => 'r',\r\n 'y' => 90\r\n )\r\n )\r\n ) \r\n );\r\n \r\n if(count($workCompletion) > 0) {\r\n \r\n $chartSeries[0]['data'][0]['name'] = 'Completed Before Target Date ('.$workCompletion['early'].')';\r\n $chartSeries[0]['data'][0]['y'] = (int)$workCompletion['early'];\r\n \r\n $chartSeries[0]['data'][1]['name'] = 'Completed On Time '.$workCompletion['ontime'].'';\r\n $chartSeries[0]['data'][1]['y'] = (int)$workCompletion['ontime'];\r\n \r\n $chartSeries[0]['data'][2]['name'] = 'Completed > 1 Day ('.$workCompletion['1day'].')';\r\n $chartSeries[0]['data'][2]['y'] = (int)$workCompletion['1day'];\r\n \r\n $chartSeries[0]['data'][3]['name'] = 'Completed > 2 Days ('.$workCompletion['2days'].')';\r\n $chartSeries[0]['data'][3]['y'] = (int)$workCompletion['2days'];\r\n \r\n $chartSeries[0]['data'][4]['name'] = 'Completed > 3 Days ('.$workCompletion['3days'].')';\r\n $chartSeries[0]['data'][4]['y'] = (int)$workCompletion['3days'];\r\n \r\n $chartSeries[0]['data'][5]['name'] = 'Completed 4-7 Days ('.$workCompletion['4_7days'].')';\r\n $chartSeries[0]['data'][5]['y'] = (int)$workCompletion['4_7days'];\r\n \r\n $chartSeries[0]['data'][6]['name'] = 'Completed 8-14 Days ('.$workCompletion['8_14days'].')';\r\n $chartSeries[0]['data'][6]['y'] = (int)$workCompletion['8_14days'];\r\n \r\n $chartSeries[0]['data'][7]['name'] = 'Completed 15-30 Days ('.$workCompletion['15_30days'].')';\r\n $chartSeries[0]['data'][7]['y'] = (int)$workCompletion['15_30days'];\r\n \r\n $chartSeries[0]['data'][8]['name'] = 'Completed 31-60 Days ('.$workCompletion['31_60days'].')';\r\n $chartSeries[0]['data'][8]['y'] = (int)$workCompletion['31_60days'];\r\n \r\n $chartSeries[0]['data'][9]['name'] = 'Completed > 60 Days ('.$workCompletion['g60days'].')';\r\n $chartSeries[0]['data'][9]['y'] = (int)$workCompletion['g60days'];\r\n\r\n array_push($chartReportImages, array('key' => 0, 'values' => array()));\r\n \r\n $optionStr = array(\r\n 'chart'=> array(\r\n 'type'=> 'pie'\r\n ),\r\n 'title'=> array(\r\n 'text'=> ''\r\n ),\r\n 'credits' => array(\r\n 'enabled' => FALSE\r\n ),\r\n 'plotOptions' => array(\r\n 'pie' => array(\r\n 'allowPointSelect' => TRUE,\r\n 'cursor' => 'pointer',\r\n 'dataLabels' => array(\r\n 'enabled' => FALSE,\r\n 'distance'=> -30,\r\n 'color'=>'white'\r\n ),\r\n 'showInLegend' => TRUE\r\n )\r\n ),\r\n 'legend' => array(\r\n 'layout' => 'vertical',\r\n 'align' => 'right',\r\n 'itemStyle' => array(\r\n 'fontSize'=> '10px;'\r\n ),\r\n 'floating' => FALSE,\r\n //'x' => 70,\r\n //'y' =>30,\r\n 'verticalAlign' => 'middle',\r\n 'borderWidth' => 0,\r\n ),\r\n 'series' => $chartSeries\r\n );\r\n\r\n $optionStr = json_encode($optionStr);\r\n $dataString = 'async=true&type=jpeg&width=540&options=' . $optionStr;\r\n $url = 'http://export.highcharts.com/';\r\n\r\n $response = $this->curlPost($url, $dataString);\r\n\r\n if($response['curlError']) {\r\n echo $response['message'];\r\n } else {\r\n $file = $response['message'];\r\n $path_parts = pathinfo($file);\r\n $filename = $path_parts['basename'];\r\n\r\n $dir = \"./temp\";\r\n if (!is_dir($dir))\r\n {\r\n mkdir($dir, 0755, TRUE);\r\n }\r\n\r\n file_put_contents($dir.'/'.$filename, file_get_contents($url.$file));\r\n array_push($chartReportImages[0]['values'], array('file' => $path_parts['basename'], 'ext' =>$path_parts['extension'])); \r\n }\r\n }\r\n return $chartReportImages;\r\n }",
"private function onTimeCompletionReport($fromdate, $todate) {\r\n \r\n $chartReportImages = array();\r\n $onTimeCompletion = $this->reportclass->getOnTimeCompletion($this->data['loggeduser']->contactid, $fromdate, $todate);\r\n \r\n $chartXAxis = array();\r\n for($i = 1;$i <= 12;$i++) {\r\n array_push($chartXAxis, date('M', mktime(0, 0, 0, $i, 10)));\r\n }\r\n $chartSeries = array();\r\n foreach($onTimeCompletion as $key=>$value) {\r\n \r\n array_push($chartSeries, array(\r\n 'name' => '',\r\n 'data' => array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)\r\n ));\r\n \r\n foreach($value as $key1=>$value1) {\r\n $chartSeries[$key]['name'] = $value1['y'];\r\n $index = (int)$value1['m']-1;\r\n $chartSeries[$key]['data'][$index] = (int)$value1['otp'];\r\n }\r\n }\r\n \r\n if(count($onTimeCompletion) > 0) {\r\n array_push($chartReportImages, array('key' => 0, 'values' => array()));\r\n \r\n $optionStr = array(\r\n 'chart' => array(\r\n 'style' => array(\r\n 'fontFamily' => 'Helvetica', \r\n 'fontSize' => '10px',\r\n 'fontWeight' => 'bold'\r\n )\r\n ),\r\n 'xAxis' => array(\r\n 'categories' => $chartXAxis\r\n ),\r\n 'title' => array(\r\n 'text' => '<b style=\"font-family:Helvetica;font-size:10px;\">Percentage On Time</b>',\r\n 'useHTML' => true\r\n ),\r\n 'credits' => array(\r\n 'enabled' => FALSE\r\n ),\r\n 'legend' => array(\r\n 'layout' => 'vertical',\r\n 'align' => 'left',\r\n 'itemStyle' => array(\r\n 'fontSize'=> '10px;'\r\n ),\r\n 'floating' => TRUE,\r\n 'x' => 70,\r\n 'y' =>30,\r\n 'verticalAlign' => 'top',\r\n 'borderWidth' => 0,\r\n ),\r\n 'series' => $chartSeries\r\n );\r\n\r\n $optionStr = json_encode($optionStr);\r\n $dataString = 'async=true&type=jpeg&width=640&options=' . $optionStr;\r\n $url = 'http://export.highcharts.com/';\r\n\r\n $response = $this->curlPost($url, $dataString);\r\n\r\n if($response['curlError']) {\r\n echo $response['message'];\r\n } else {\r\n $file = $response['message'];\r\n $path_parts = pathinfo($file);\r\n $filename = $path_parts['basename'];\r\n\r\n $dir = \"./temp\";\r\n if (!is_dir($dir))\r\n {\r\n mkdir($dir, 0755, TRUE);\r\n }\r\n\r\n file_put_contents($dir.'/'.$filename, file_get_contents($url.$file));\r\n array_push($chartReportImages[0]['values'], array('file' => $path_parts['basename'], 'ext' =>$path_parts['extension'])); \r\n }\r\n }\r\n \r\n \r\n return $chartReportImages;\r\n }",
"function makeRules($report) {\n\t\t$xml = array();\n\t\t$xml['NAME'] = 'report';\n\t\t$xml['ATTRS']['NAME']=str_replace(\"'\",\"'\",$report['save_as']);\n\t\t$xml['ATTRS']['PUBLISH']=$report['publish_report'];\n\t\t$xml['ATTRS']['REPORT_TYPE']='table';\n\t\t$xml['CHILDREN'] = array();\n\t\t$temp['NAME']='linkto';\n\t\t$temp['TAGDATA']=$report['linkTo'];\n\t\tarray_push($xml['CHILDREN'], $temp);\n\t\tforeach ($report as $i => $data) {\n\t\t\tif ($i == \"save_as\" || $i == \"start_date\" || $i == \"end_date\" || $i == \"interval\" || $i == \"linkTo\") {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$keys = explode(\"__\", $i);\n\t\t\tif (count($keys) == 2) {\n\t\t\t\t$table[$keys[1]][$keys[0]] = $data;\n\t\t\t}\n\t\t\tif (count($keys) == 3) {\n\t\t\t\t$constraints[$keys[1]][$keys[2]][$keys[0]] = $data;\n\t\t\t}\n\t\t}\n\t\tforeach ($table as $axis => $axisdata) {\n\t\t\t$node['NAME']='axis';\n\t\t\t$node['ATTRS']['NAME']=$axis;\n\t\t\t$node['CHILDREN'] = array();\n\t\t\t\n\t\t\tif ($axisdata['sqlquery']) {\n\t\t\t\t$node['CHILDREN'][0]['NAME']='label';\n\t\t\t\t$node['CHILDREN'][0]['TAGDATA']=$axisdata['label'];\n\t\t\t\t$node['CHILDREN'][1]['NAME']='sql';\n\t\t\t\t$node['CHILDREN'][1]['TAGDATA']=stripslashes($axisdata['sqlquery']);\n\t\t\t} else {\n\t\t\t\tforeach ($axisdata as $tag => $data) {\n\t\t\t\t\t$temp = array();\n\t\t\t\t\t$temp['NAME']=$tag;\n\t\t\t\t\t$temp['TAGDATA']=$data;\n\t\t\t\t\tarray_push($node['CHILDREN'], $temp);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tforeach ($constraints[$axis] as $constraint => $cons_items) {\n\t\t\t\t\t$cons = array();\n\t\t\t\t\t$cons['NAME'] = 'constraint';\n\t\t\t\t\t$cons['ATTRS']['NAME']=$constraint;\n\t\t\t\t\t$cons['CHILDREN'] = array();\n\t\t\t\t\t\n\t\t\t\t\tforeach ($cons_items as $tag => $value) {\n\t\t\t\t\t\t$temp = array();\n\t\t\t\t\t\t$temp['NAME'] = $tag;\n\t\t\t\t\t\t$temp['TAGDATA'] = $value;\n\t\t\t\t\t\tarray_push($cons['CHILDREN'], $temp);\n\t\t\t\t\t}\n\t\t\t\t\tarray_push($node['CHILDREN'], $cons);\n\t\t\t\t}\n\t\t\t}\n\t\t\tarray_push($xml['CHILDREN'], $node);\n\t\t}\n\t\treturn $xml;\n\t}",
"public function generate_cumulative_report()\n {\n define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');\n\n $session = $this->request->session(); \n $report_data = $session->read('CumulativeReport.data'); \n\n if ($this->request->is('post')) { \n $data = $this->request->data; \n \n $report_data['s3'] = $data; \n $session->write('CumulativeReport.data', $report_data); \n\n //Generate report\n $information = $report_data['s2']['information'];\n $sources = array();\n foreach( $report_data['s1']['sources'] as $key => $value ){\n $sources[$key] = $key;\n } \n\n $chart_data = array(); \n $chart_labels = array();\n $date_from = $report_data['s3']['date_from'];\n $date_to = $report_data['s3']['date_to'];\n switch ($information) {\n case 1: //Number of leads per month with chart \n $leads = $this->Leads->find('all')\n ->contain(['Statuses', 'Sources', 'InterestTypes', 'LeadTypes'])\n ->where(['Leads.source_id IN' => $sources, 'Leads.allocation_date >=' => $date_from, 'Leads.allocation_date <=' => $date_to, 'Leads.is_archive' => 'No'])\n ; \n \n //Get months covered between 2 dates\n $start = (new \\DateTime($date_from))->modify('first day of this month');\n $end = (new \\DateTime($date_to))->modify('first day of next month');\n $interval = \\DateInterval::createFromDateString('1 month');\n $period = new \\DatePeriod($start, $interval, $end);\n \n foreach ($period as $dt) {\n $start_day = $dt->format(\"Y-m-01\"); \n $last_day = date(\"Y-m-t\", strtotime($dt->format(\"Y-m-01\"))); \n $leads = $this->Leads->find('all')\n ->select(['id', 'source_id', 'allocation_date']) \n ->where(['Leads.source_id IN' => $sources, 'Leads.allocation_date >=' => $start_day, 'Leads.allocation_date <=' => $last_day, 'Leads.is_archive' => 'No'])\n ; \n $chart_labels[] = '\"' . $dt->format(\"Y-M\") . '\"';\n $chart_data[] = $leads->count(); \n } \n break;\n case 2: //Number of leads per week with chart\n $begin = new \\DateTime($date_from);\n $end = new \\DateTime($date_to);\n $week = '';\n for($i = $begin; $i <= $end; $i->modify('+1 day')){\n if( $week != $i->format(\"W\") ){\n $chart_labels[] = '\"' . \"Week #\" . $i->format(\"W\") . '\"';\n $week = $i->format(\"W\");\n }\n $leads = $this->Leads->find('all')\n ->select(['id', 'source_id', 'allocation_date']) \n ->where(['Leads.source_id IN' => $sources, 'Leads.allocation_date =' => $i->format(\"Y-m-d\"), 'Leads.is_archive' => 'No'])\n ; \n $chart_data[$week] = $chart_data[$week] + $leads->count();\n } \n break;\n case 3: //Number of leads per day with chart\n $begin = new \\DateTime($date_from);\n $end = new \\DateTime($date_to);\n\n for($i = $begin; $i <= $end; $i->modify('+1 day')){\n $leads = $this->Leads->find('all')\n ->select(['id', 'source_id', 'allocation_date']) \n ->where(['Leads.source_id IN' => $sources, 'Leads.allocation_date =' => $i->format(\"Y-m-d\"), 'Leads.is_archive' => 'No'])\n ;\n $chart_labels[] = '\"' . $i->format(\"Y-M-d\") . '\"';\n $chart_data[] = $leads->count();\n }\n break;\n default: \n break;\n } \n if( $report_data['s3']['report-type'] == 'Excel' ){\n $excel_data = array(); \n $excel_data[0] = [\"\", \"Leads\"];\n $start = 0;\n foreach( $chart_data as $key => $c ){\n if( isset($chart_labels[$start]) ){\n $date = str_replace('\"',\"\",$chart_labels[$start]);\n $excel_data[$start+1] = [$date, $c];\n } \n $start++;\n }\n\n $total_rows = 1;\n foreach( $chart_data as $d ){ \n $total_rows++;\n } \n \n $objPHPExcel = new PHPExcel();\n $objWorksheet = $objPHPExcel->getActiveSheet();\n $objWorksheet->fromArray($excel_data); \n $excel_labels = array();\n $columns = [1 => 'A', 2 => 'B', 3 => 'C', 4 => 'D', 5 => 'E', 6 => 'F', 7 => 'G', 8 => 'H', 9 => 'I', 10 => 'J', 11 => 'K', 12 => 'L']; \n \n // Set the Labels for each data series we want to plot\n // Datatype\n // Cell reference for data\n // Format Code\n // Number of datapoints in series\n // Data values\n // Data Marker\n $dataseriesLabels = array(\n new \\PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$B$1', null, 1)// 2010\n //new \\PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011 \n ); \n // Set the X-Axis Labels\n // Datatype\n // Cell reference for data\n // Format Code\n // Number of datapoints in series\n // Data values\n // Data Marker \n \n $xAxisTickValues = array(\n new \\PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$A$2:$A$' . (count($chart_labels) + 1), null, 5), // Q1 to Q4\n ); \n \n // Set the Data values for each data series we want to plot\n // Datatype\n // Cell reference for data\n // Format Code\n // Number of datapoints in series\n // Data values\n // Data Marker\n $excel_data_series_values = array();\n for( $x = 1; $x < $total_rows; $x++ ){\n $worksheet = \"Worksheet!$\" . $columns[$x + 1] . \"$2:$\" . $columns[$x + 1] . \"$\" . count($chart_labels); \n $excel_data_series_values[] = new \\PHPExcel_Chart_DataSeriesValues('Number', $worksheet, null, 5);\n } \n $dataSeriesValues = array(\n new \\PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$B$2:$B$' . (count($chart_labels) + 1), null, 1) \n ); \n\n //debug($dataSeriesValues);exit; \n \n // Build the dataseries\n $series = new \\PHPExcel_Chart_DataSeries(\n \\PHPExcel_Chart_DataSeries::TYPE_LINECHART, // plotType\n \\PHPExcel_Chart_DataSeries::GROUPING_STACKED, // plotGrouping\n range(0, count($dataSeriesValues)-1), // plotOrder\n $dataseriesLabels, // plotLabel\n $xAxisTickValues, // plotCategory\n $dataSeriesValues // plotValues\n );\n // Set the series in the plot area\n $plotarea = new \\PHPExcel_Chart_PlotArea(null, array($series));\n // Set the chart legend\n $legend = new \\PHPExcel_Chart_Legend(\\PHPExcel_Chart_Legend::POSITION_TOPRIGHT, null, false);\n $title = new \\PHPExcel_Chart_Title('Accumulated Leads Chart');\n $yAxisLabel = new \\PHPExcel_Chart_Title('Value ($k)');\n // Create the chart\n $chart = new \\PHPExcel_Chart(\n 'chart1', // name\n $title, // title\n $legend, // legend\n $plotarea, // plotArea\n true, // plotVisibleOnly\n 0, // displayBlanksAs\n null, // xAxisLabel\n $yAxisLabel // yAxisLabel\n );\n // Set the position where the chart should appear in the worksheet\n $chart->setTopLeftPosition('A7');\n $chart->setBottomRightPosition('H20'); \n $objWorksheet->addChart($chart);\n \n $fileName = time() . \"_\" . rand(000000, 999999) . \".xlsx\";\n $objWriter = \\PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');\n $objWriter->setIncludeCharts(TRUE);\n $objWriter->save('excel\\leads\\\\' . $fileName); \n $file_path = WWW_ROOT.'excel\\leads\\\\' . $fileName;\n $this->response->file($file_path, array(\n 'download' => true,\n 'name' => $fileName,\n ));\n return $this->response; \n exit;\n }else{ \n $this->set([\n 'chart_labels' => $chart_labels,\n 'chart_data' => $chart_data,\n 'load_chart_js' => true\n ]);\n }\n }else{\n $this->Flash->error(__('Cannot generate report'));\n return $this->redirect(['action' => 'cumulative_step3']);\n }\n }",
"function makeRules($report) {\n\t\t$xml = array();\n\t\t$xml['NAME'] = 'REPORT';\n\t\t$xml['ATTRS']['NAME']=str_replace(\"'\",\"'\",$report['save_as']);\n\t\t$xml['ATTRS']['PUBLISH']=$report['publish_report'];\n\t\t$xml['ATTRS']['REPORT_TYPE']='trend';\n\t\t$xml['ATTRS']['START_DATE']=$report['start_date'];\n\t\t$xml['ATTRS']['END_DATE']=$report['end_date'];\n\t\t$xml['ATTRS']['INTERVAL']=$report['interval'];\n\t\t$xml['ATTRS']['GRAPHTYPE']=$report['graphtype'];\n\t\t$xml['ATTRS']['SHOWVALUE']=$report['showValue'];\n\t\t$xml['ATTRS']['AGGREGATE']=$report['aggregate'];\n\t\t$xml['ATTRS']['ABSOLUTE']=$report['absolute'];\n\t\t$xml['CHILDREN'] = array();\n\t\t$xml['CHILDREN'][0]['NAME']='linkto';\n\t\t$xml['CHILDREN'][0]['TAGDATA']=$report['linkTo'];\n\t\t\n\t\tforeach ($report as $i => $data) {\n\t\t\tif ($i == \"save_as\" || $i == \"start_date\" || $i == \"end_date\" || $i == \"interval\" || $i == \"linkTo\") {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$keys = explode(\"__\", $i);\n\t\t\tif (count($keys) == 2) {\n\t\t\t\t$trend[$keys[1]][$keys[0]] = $data;\n\t\t\t}\n\t\t\tif (count($keys) == 3) {\n\t\t\t\t$constraints[$keys[1]][$keys[2]][$keys[0]] = $data;\n\t\t\t}\n\t\t}\n\t\tforeach ($trend as $i => $data) {\n\t\t\t$trend = array();\n\t\t\t$trend['NAME'] = 'trend';\n\t\t\t$trend['ATTRS']['NAME']=$i;\n\t\t\tif ($data['sqlquery']) {\n\t\t\t\t$trend['CHILDREN'][0]['NAME']='title';\n\t\t\t\t$trend['CHILDREN'][0]['TAGDATA']=$data['title'];\n\t\t\t\t$trend['CHILDREN'][1]['NAME']='sql';\n\t\t\t\t$trend['CHILDREN'][1]['TAGDATA']=stripslashes($data['sqlquery']);\n\t\t\t\t$trend['CHILDREN'][2]['NAME']='colour';\n\t\t\t\t$trend['CHILDREN'][2]['TAGDATA']=$data['icolour'];\n\t\t\t} else {\n\t\t\t\t$trend['CHILDREN'][0]['NAME']='title';\n\t\t\t\t$trend['CHILDREN'][0]['TAGDATA']=$data['title'];\n\t\t\t\t$trend['CHILDREN'][1]['NAME']='table';\n\t\t\t\t$trend['CHILDREN'][1]['TAGDATA']=$data['table'];\n\t\t\t\t$trend['CHILDREN'][2]['NAME']='columns';\n\t\t\t\t$trend['CHILDREN'][2]['TAGDATA']=$data['columns'];\n\t\t\t\t$trend['CHILDREN'][4]['NAME']='colour';\n\t\t\t\t$trend['CHILDREN'][4]['TAGDATA']=$data['icolour'];\n\t\t\t}\n\t\t\t\n\t\t\tif (is_array($constraints[$i])) {\n\t\t\t\tforeach ($constraints[$i] as $j => $condata) {\n\t\t\t\t\t$cons = array();\n\t\t\t\t\t$cons['NAME']='constraint';\n\t\t\t\t\t$cons['ATTRS']['NAME']=$j;\n\t\t\t\t\t$cons['CHILDREN'][0]['NAME']='constraint_table';\n\t\t\t\t\t$cons['CHILDREN'][0]['TAGDATA']=$condata['constraint_table'];\n\t\t\t\t\t$cons['CHILDREN'][1]['NAME']='constraint_columns';\n\t\t\t\t\t$cons['CHILDREN'][1]['TAGDATA']=$condata['constraint_columns'];\n\t\t\t\t\t$cons['CHILDREN'][2]['NAME']='constraint_type';\n\t\t\t\t\t$cons['CHILDREN'][2]['TAGDATA']=$condata['constraint_type'];\n\t\t\t\t\t$cons['CHILDREN'][3]['NAME']='constraint_value';\n\t\t\t\t\t$cons['CHILDREN'][3]['TAGDATA']=$condata['constraint_value'];\n\t\t\t\t\tarray_push($trend['CHILDREN'], $cons);\n\t\t\t\t}\n\t\t\t}\n\t\t\tarray_push($xml['CHILDREN'], $trend);\n\t\t}\n\t\t#Global Constraints\n\t\tif (is_array($constraints[\"G\"])) {\n\t\t\t$trend = array();\n\t\t\t$trend['NAME'] = 'global_constraint';\n\t\t\t$trend['ATTRS']['NAME']='global_constraint';\n\t\t\t$trend['CHILDREN'] = array();\n\t\t\tforeach ($constraints[\"G\"] as $j => $condata) {\n\t\t\t\t$cons = array();\n\t\t\t\t$cons['NAME']='constraint';\n\t\t\t\t$cons['ATTRS']['NAME']=$j;\n\t\t\t\t$cons['CHILDREN'][0]['NAME']='constraint_table';\n\t\t\t\t$cons['CHILDREN'][0]['TAGDATA']=$condata['constraint_table'];\n\t\t\t\t$cons['CHILDREN'][1]['NAME']='constraint_columns';\n\t\t\t\t$cons['CHILDREN'][1]['TAGDATA']=$condata['constraint_columns'];\n\t\t\t\t$cons['CHILDREN'][2]['NAME']='constraint_type';\n\t\t\t\t$cons['CHILDREN'][2]['TAGDATA']=$condata['constraint_type'];\n\t\t\t\t$cons['CHILDREN'][3]['NAME']='constraint_value';\n\t\t\t\t$cons['CHILDREN'][3]['TAGDATA']=$condata['constraint_value'];\n\t\t\t\t$cons['CHILDREN'][4]['NAME']='constraint_auto';\n\t\t\t\t$cons['CHILDREN'][4]['TAGDATA']=$condata['constraint_auto'];\n\t\t\t\tarray_push($trend['CHILDREN'], $cons);\n\t\t\t}\n\t\t\tarray_push($xml['CHILDREN'], $trend);\n\t\t}\n\t\treturn $xml;\n\t}",
"public function format_traffic_sources($report)\n {\n return $this->format_simple($report, 'ga:medium=');\n }",
"public function aggregateDayReport()\n {\n $this->aggregateByPlugin();\n }",
"private function get_sales_report_data()\n {\n }",
"protected function get_report_cb_src(){\n\t\t$q = \"SELECT\n\t\t\t\t\tIF(ISNULL(lead_source),'TOTAL',lead_source) AS lead_source,\n\t\t\t\t\tcount(lead_source) AS _count\n\t\t\t\tFROM (\n\t\t\t\t\tSELECT\n\t\t\t\t\t\tdirectbuy_id,\n\t\t\t\t\t\tbionic_id,\n\t\t\t\t\t\tlead_source,\n\t\t\t\t\t\tlead_status,\n\t\t\t\t\t\tdls.name\n\t\t\t\t\tFROM `client_db_directbuy`.`directbuy` db\n\t\t\t\t\tLEFT JOIN `client_db_directbuy`.`directbuy_lead_status` dls ON dls.id = db.lead_status\n\t\t\t\t\tWHERE lead_status IN (5,13,14,15,16,17,38,39) \n\t\t\t\t\t\tAND DATE(creation_date) BETWEEN '2014-02-15'\n\t\t\t\t\t\tAND CURDATE() \n\t\t\t\t\t\tAND (lead_source LIKE '%WP%' OR lead_source LIKE '%WPROMOTE%' OR lead_source LIKE '%QUANT%')\n\t\t\t\t\t\tGROUP BY directbuy_id\n\t\t\t\t\t) AS tbla\n\t\t\t\tGROUP BY lead_source WITH ROLLUP\";\n\t\treturn db::select($q,'ASSOC');\n\t}",
"private function composedReportMarkupSlack($reportData) {\n\n $attachments = [];\n\n foreach ($reportData as $source => $data) {\n\n $reportRange = $data['userImportCSV']['startDate'] . ' - ' . $data['userImportCSV']['endDate'];\n\n if ($source == 'niche') {\n\n $reportData = [\n 'color' => $data['budgetBackgroundColor'],\n 'fallback' => 'User Import Daily Report: Niche.com',\n 'author_name' => 'Niche.com',\n 'author_icon' => 'http://static.tumblr.com/25dcac672bf20a1223baed360c75c453/mrlvgra/Jxhmu09gi/tumblr_static_niche-tumblr-logo.png',\n 'title' => date('F', strtotime($data['userImportCSV']['startDate'])) . ' User Imports: ' . $reportRange,\n 'title_link' => 'https://www.stathat.com/v/stats/576l/tf/1M1h',\n 'text' => $data['budgetProjectedCompletion']\n ];\n }\n elseif ($source == 'afterschool') {\n\n $reportData = [\n 'color' => $data['budgetBackgroundColor'],\n 'fallback' => 'User Import Daily Report: After School',\n 'author_name' => 'After School',\n 'author_icon' => 'http://a4.mzstatic.com/us/r30/Purple69/v4/f7/43/fc/f743fc64-0cc6-171d-2f86-8649b5d3a8e1/icon175x175.jpeg',\n 'title' => self::AFTERSCHOOL_CAMPAIGN . ' User Imports: ' . $reportRange,\n 'title_link' => 'https://www.stathat.com/v/stats/7CNJ/tf/1M1h'\n ];\n }\n\n // Common between all sources - the numbers\n $reportData['fields'] = [\n 0 => [\n 'title' => 'Users Processed',\n 'value' => $data['userImportCSV']['usersProcessed'] ,\n 'short' => true\n ],\n 1 => [\n 'title' => 'Existing Users',\n 'value' => $data['existingUsers']['total'],\n 'short' => true\n ],\n 2 => [\n 'title' => 'New Users',\n 'value' => $data['newUsers'] . ' (' . $data['percentNewUsers'] .'% new)',\n 'short' => true\n ],\n 3 => [\n 'title' => 'Budget',\n 'value' => $data['budgetPercentage'],\n 'short' => true\n ]\n ];\n\n // $attachments[] = $reportData;\n $attachments = $reportData;\n }\n\n return $attachments;\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return delivery spec object for the current project. | public function getDeliverySpec() {
if (!ClientDetectorComponent::getInstance()->isNetflix()) {
$deliverySpec = DeliverySpec::model()->findByAttributes(array(
'product_id' => $this->product_id,
'client_id' => $this->client_id,
'owner_id' => $this->owner_id,
'distributor_id' => $this->distributor_id,
));
} else {
$deliverySpec = DeliverySpec::model()->find();
}
return $deliverySpec;
} | [
"public function getDelivery()\n {\n if (is_null($this->delivery)) {\n /** @psalm-var stdClass|array<string, mixed>|null $data */\n $data = $this->raw(self::FIELD_DELIVERY);\n if (is_null($data)) {\n return null;\n }\n\n $this->delivery = DeliveryModel::of($data);\n }\n\n return $this->delivery;\n }",
"public function getDelivery()\n {\n return $this->delivery;\n }",
"public function buildDelivery()\n {\n $address = $this->_shippingAddress;\n\n $this->_delivery = new stdClass();\n\n $this->_delivery->email = $address->getEmail();\n \t// @todo: Street line?\n $this->_delivery->address_line = $address->getStreet(1);\n\n // $this->_delivery->city = $address->getCity();\n $this->_delivery->postal_code = $address->getPostcode();\n $this->_delivery->country_code = strtolower($address->getCountryId());\n $this->_delivery->phone_number = $address->getTelephone();\n\n $this->_delivery->name = $address->getFirstname().' '.$address->getLastname();\n\n if ($address->getCompany()) {\n $this->_delivery->name = $address->getCompany().' / '.$this->_delivery->name;\n }\n\n $this->_delivery->after = $this->_timeWindow->getDeliveryFrom();\n $this->_delivery->before = $this->_timeWindow->getDeliveryTo();\n\n return $this->_delivery;\n }",
"public function fillDeliverySpec()\n {\n $existing = PartnerDeliverySpec::model()->byPartnerDeliverySpec($this->delivery_spec)->find();\n if ($existing instanceof PartnerDeliverySpec)\n return $existing->id;\n else\n {\n $new = PartnerDeliverySpec::create($this->partner_system_id, $this->delivery_spec);\n return $new->id;\n }\n }",
"public function getDeliveryParty()\n {\n return $this->deliveryParty;\n }",
"public function getDeliveryType()\n {\n return $this->deliveryType;\n }",
"public function getDeliverySpecs() {\n $types = self::model()->findAll(array(\n 'order' => 't.name',\n ));\n\n $data = array();\n foreach ($types as $type) {\n if (!$type instanceof DeliverySpec) continue;\n $data[$type->id] = $type->name;\n }\n\n return $data;\n }",
"public function getEstimateDelivery()\n {\n return isset($this->estimateDelivery) ? $this->estimateDelivery : null;\n }",
"public function delivery(){\n return $this->hasOne('App\\Models\\Delivery');\n }",
"public function getDeliveryStatus()\n {\n $status = $this->entity->getDeliveryStatus();\n if ($status !== null) {\n return new DeliveryStatus($status, $this->locale);\n }\n\n return null;\n }",
"public function getStatusDelivery()\n {\n return $this->hasOne(StatusDelivery::className(), ['id' => 'status_delivery_id']);\n }",
"public function byPartnerDeliverySpec($partner_delivery_spec) {\n\t\t$this->getDbCriteria()->compare('partner_delivery_spec', $partner_delivery_spec);\n\t\treturn $this;\n\t}",
"public function getProductionSpecification() {\n return $this->productionSpecification;\n }",
"public function getDeliveryMode()\n {\n }",
"public function getDeliveryService() \n {\n return array(\n 'delivery_id' => $this->getDeliveryId(),\n 'price' => $this->getDeliveryPrice(),\n 'title' => $this->getDeliveryTitle(),\n 'method_title' => $this->getDeliveryMethodTitle(),\n 'tax' => $this->getDeliveryTax(),\n 'tax_type_id' => $this->getDeliveryTaxTypeId(),\n 'tax_title' => $this->getDeliveryTaxTitle(),\n 'currency_id' => $this->getCurrencyId(),\n );\n }",
"public function deliveryDriver()\n {\n return $this->state(function (array $attributes) {\n return [\n 'role' => 'delivery_driver'\n ];\n });\n }",
"public function getDeliveryMode() {\n return $this->delivery_mode;\n }",
"public function getDeliveryUnit()\n {\n return $this->deliveryUnit;\n }",
"public function getDeliveryDetail()\n {\n return isset($this->deliveryDetail) ? $this->deliveryDetail : null;\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Obtain the ID of the CO or COU approvers group. | public function approverCoGroupId($coId, $couId=null) {
$args = array();
$args['conditions']['CoGroup.co_id'] = $coId;
// For the CO Approvers group, $couId must be null
$args['conditions']['CoGroup.cou_id'] = $couId;
$args['conditions']['CoGroup.group_type'] = GroupEnum::Approvers;
$args['conditions']['CoGroup.status'] = SuspendableStatusEnum::Active;
$args['contain'] = false;
$coApproverGroup = $this->Co->CoGroup->find('first', $args);
if(!empty($coApproverGroup['CoGroup']['id'])) {
return $coApproverGroup['CoGroup']['id'];
}
throw new InvalidArgumentException(_txt('er.gr.nf', array('approvers')));
} | [
"function get_customer_group_id() {\n if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') {\n $_cg_id = $_SESSION['sppc_customer_group_id'];\n } else {\n $_cg_id = 0;\n }\n return $_cg_id;\n }",
"function get_group_id()\r\n {\r\n return $this->get_default_property(self :: PROPERTY_GROUP_ID);\r\n }",
"public function getGruposervicioId() {\n return $this->gruposervicio_id;\n }",
"public function getGrupoAdicionalid()\n {\n return $this->grupo_adicionalId;\n }",
"public function getOrgId()\n {\n $value = $this->get(self::ORGID);\n return $value === null ? (string)$value : $value;\n }",
"public function getGradoOcupacionalId()\n\t{\n\t\treturn $this->gradoOcupacionalId;\n\t}",
"public function getIdCurrentApprover()\n {\n return $this->idCurrentApprover;\n }",
"public function getConsistencyGroupPolicyId()\n {\n return isset($this->consistency_group_policy_id) ? $this->consistency_group_policy_id : '';\n }",
"public function getGrupo_investigacion_id(){\n return $this->grupo_investigacion_id;\n }",
"public function get_mailchimp_group_id() {\n $group = $this->get_mailchimp_group();\n if ( is_object( $group ) && isset( $group->id ) ) {\n return $group->id;\n }\n return false;\n }",
"function getApproverID() {\n\t\treturn $this->_ApproverID;\n\t}",
"public function getId() : VersionGroupId\n\t{\n\t\treturn $this->id;\n\t}",
"public function getGrupoId()\n {\n return $this->grupo_id;\n }",
"public function getOrganizerId()\n {\n return $this->organizer_id;\n }",
"public function getCustomerGroupID()\n {\n if (!$this->owner->CustomerGroup()->ID && $this->getDBstatus()) {\n $group = \\SilverStripe\\Security\\Group::get()->filter('Title', 'general');\n if ($group->count() > 0) {\n return $group->first()->ID;\n } else {\n return;\n }\n } elseif ($this->getDBstatus()) {\n return $this->owner->CustomerGroup()->ID;\n }\n return;\n }",
"public function getCurrentCustomerGroupId()\n {\n $groupId = $this->httpContext->getValue(\\Magento\\Customer\\Model\\Context::CONTEXT_GROUP);\n if ($groupId !== null) {\n return $groupId;\n }\n\n $groupId = $this->httpContext->getValue(\\Magento\\Customer\\Model\\Context::CONTEXT_AUTH);\n if ($groupId !== null) {\n return $groupId;\n }\n\n if ($this->customerSession->isLoggedIn()) {\n $groupId = $this->customerSession->getCustomer()->getGroupId();\n }\n if ($groupId !== null) {\n return $groupId;\n }\n\n return $this->groupManagement->getNotLoggedInGroup()->getId();\n }",
"public function getCustomerGroupId(){\n if($this->_customerSession->isLoggedIn()):\n return $customerGroup=$this->_customerSession->getCustomer()->getGroupId();\n endif;\n return 0;\n }",
"public function getCurrentOrgID()\n\t{\n\t\t$theOrg = static::getCurrentOrg($this);\n\t\tif ( !empty($theOrg) ) {\n\t\t\treturn $theOrg->org_id;\n\t\t}\n\t\telse {\n\t\t\treturn null;\n\t\t}\n\t}",
"public function getOrgId()\n\t{\n\t\treturn $this->org_id;\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the amount. If it is a cash or credit card payment then the amount must be greater than zero. If it is a refund then the amount must be less than zero. | public function setAmount($amount){
if ( (($this->type === Payment::CASH) || ($this->type === Payment::CREDIT_CARD)) && ($amount > 0) ){
$this->amount = $amount;
}
else if ( ($this->type === Payment::REFUND) && ($amount < 0) ){
$this->amount = $amount;
}
else {
throw new Exception("Amount is invalid");
}
} | [
"function setAmount($amount);",
"function amount($amount) {\n\t\t\t$this->amount = $amount;\n\t\t}",
"public function setRefundAmount($value) \n {\n $this->_fields['RefundAmount']['FieldValue'] = $value;\n return;\n }",
"protected function setAmount($value){\r\n }",
"public function setAmount($amount)\n {\n $this->currentAmount = $amount;\n }",
"public function setAmount()\n {\n $exact = $this->getOriginalPurgeValue('amount_exact');\n $percentage = $this->getOriginalPurgeValue('amount_percentage');\n\n $this->amount = $this->is_percentage\n ? $percentage\n : $exact;\n }",
"public function setTransactionAmount($value) \n {\n $this->_fields['TransactionAmount']['FieldValue'] = $value;\n return;\n }",
"public function setMaxAmount(int $amount) : void {\n $this->max_amount = $amount;\n }",
"public function setBaseTotalRefunded($amount);",
"private function validateAmount() {\n\t\tValidate::int($this->amount, $this->errorPrefix.'amount');\n\t}",
"public function setRealAmount(float $amount);",
"function set_ChargeAmount($amount)\r\n{\r\n\t$this->ChargeAmount = $amount;\r\n}",
"public function setUpdatedAmount($amount){\n $this->response[\"result\"][\"payload\"][\"amount\"] = strval($amount * 100);\n }",
"public function setGiftcardAmount($value);",
"public function setAmount($value){\n return $this->setParameter('amount', $value);\n }",
"public function setAmount($var)\n {\n GPBUtil::checkMessage($var, \\Hipstershop\\Money::class);\n $this->amount = $var;\n\n return $this;\n }",
"public function setBaseGiftCardsAmount($amount);",
"private function checkAmount(&$amount)\n {\n if (!isset($amount)) {\n throw new \\InvalidArgumentException('Amount must be set');\n }\n if (is_numeric($amount)) {\n $this->fixValue($amount);\n }\n if (is_numeric($amount) && !is_int($amount)) {\n $amount = intval($amount);\n }\n if (!is_numeric($amount) || !is_int($amount)) {\n throw new \\InvalidArgumentException(\"amount must be an integer: {$amount}\");\n }\n }",
"public function setBaseDiscountAmount($amount);"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
setter method for form definition. | function _setFormDef()
{
return parent::_setFormDef();
} | [
"public function setForm()\n {\n }",
"abstract public function setForm(Form $form);",
"function set_description_form($form){\n $this->description->form->fieldtype = $form;\n }",
"public function set_form($value)\r\n\t{\r\n\t\treturn $this->set_attr('form', $value);\r\n\t}",
"abstract protected function _setNewForm();",
"public function setForm($form) {\n\t\t$this->form = $form;\n\t}",
"public function form()\n {\n $this->_setMetaData();\n }",
"function setForm(Form $form) {\n $this->form = $form;\n }",
"public function getFormDefinition() : FormDefinition {}",
"protected function _setFormType($val){\n\t\t$this->_formType = $val;\n\t}",
"protected function setFields() {\n $this->form_fields = array(\n 'Put' => 'Your',\n 'New' => 'Input',\n 'Fields' => 'Here'\n );\n }",
"public function getFormDefinition();",
"public function set_details_form ($form){\n $this->form_values = $form;\n }",
"function form_set_value($form, $value) {\n global $form_values;\n _form_set_value($form_values, $form, $form['#parents'], $value);\n}",
"public function setFormElements()\n {\n $fieldinfos = $this->getFieldsForInput();\n foreach ($fieldinfos as $fieldinfo) {\n $input = base_form_element_Factory::createElement($fieldinfo);\n $value = '';\n $defaultValue = $fieldinfo->getDefaultValue();\n if (!empty($defaultValue)) {\n $value = $defaultValue;\n }\n if (isset($this->obj[$fieldinfo->getFieldName()])) {\n $value = $this->obj->getField($fieldinfo->getFieldName());\n }\n $input->setValue($value);\n $input->setDisplayedLength($fieldinfo->getDisplayedLength());\n $input->setName($fieldinfo->getFieldName());\n $dClName = 'base_displayclass_' . ucfirst($fieldinfo->getDisplayClass());\n /** @var DisplayClass $dCl */\n $dCl = new $dClName($this->obj);\n $displaymode = $dCl->getDisplayMode($this->getDisplayMode());\n $input->setDisplayMode($displaymode);\n $this->_addFormElement($input, $fieldinfo->getFieldLabel());\n }\n }",
"public function setForm($name,$form) {\n $this->forms[$name] = $form;\n }",
"public function buildForm()\n {\n $this\n ->add('value', 'text', ['label' => trans('elementForm.value')])\n ->addCollection('location', 'Activity\\TargetLocation', 'target_location', [], trans('elementForm.location'))\n ->addAddMoreButton('add_target_location', 'target_location')\n ->addCollection('dimension', 'Activity\\TargetDimension', 'target_dimension', [], trans('elementForm.dimension'))\n ->addAddMoreButton('add_target_dimension', 'target_dimension')\n ->addComments();\n }",
"protected function _setAttribsForm()\n {\n $this->_attribs_form = array_merge(\n (array) $this->_default_attribs,\n (array) $this->_config['attribs'],\n (array) $this->_attribs_auto,\n (array) $this->_attribs_view\n );\n }",
"function set_recipe_instructions_form($form){\n $this->recipeInstructions->form->fieldtype = $form;\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method to set the value of field voucher_end_date | public function setVoucherEndDate($voucher_end_date)
{
$this->voucher_end_date = $voucher_end_date;
return $this;
} | [
"function set_end_date($value = null) {\r\n\t\tif(!empty($value))\r\n\t\t$this->end_date = $value;\r\n\t}",
"public function setEndDate(string $date);",
"public function setEndDate(DrupalDateTime $end_date = NULL);",
"public function setDateEnd($DateEnd){\n $this->DateEnd = $DateEnd;\n }",
"public function set_end_date($end_date)\n\t{\n\t\tif (is_null($end_date)) {\n\t\t\tthrow new InvalidArgumentException(\"Project End Date Invalid!\");\n\t\t}\n\t\t$this->end_date = $end_date;\n\t}",
"public function setEnd_date($end_date = null)\n {\n // validation for constraint: string\n if (!is_null($end_date) && !is_string($end_date)) {\n throw new \\InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($end_date, true), gettype($end_date)), __LINE__);\n }\n if (is_null($end_date) || (is_array($end_date) && empty($end_date))) {\n unset($this->end_date);\n } else {\n $this->end_date = $end_date;\n }\n return $this;\n }",
"public function setFacetDateEnd($value, $field_override) {}",
"public function setCalendarHolidayEnd ($v)\n {\n if ( $v !== null && !is_int ($v) )\n {\n $ts = strtotime ($v);\n //Date/time accepts null values\n if ( $v == '' )\n {\n $ts = null;\n }\n if ( $ts === -1 || $ts === false )\n {\n throw new PropelException (\"Unable to parse date/time value for [calendar_holiday_end] from input: \" .\n var_export ($v, true));\n }\n }\n else\n {\n $ts = $v;\n }\n if ( $this->calendar_holiday_end !== $ts )\n {\n $this->calendar_holiday_end = date (\"Y-m-d\", $ts);\n }\n }",
"public function setEndDate( \\DateTime $end ){\n $this->endDTO = $end;\n return $this;\n }",
"public function setEndDate(string $endDate)\n {\n $this->endDate = $endDate;\n }",
"public function updateDueDateBasedOnEndDate()\n {\n // due date set to 8 weeks (56 days) after the end date unless lay reports where end date is beyond\n // 13/11/19. Then it is 21 days (DDPB-2996)\n $this->dueDate = clone $this->endDate;\n if ($this->isLayReport() && $this->getEndDate()->format('Ymd') >= '20191113') {\n $this->dueDate->add(new \\DateInterval('P21D'));\n } else {\n $this->dueDate->add(new \\DateInterval('P56D'));\n }\n }",
"public function getEndInvoiceDate()\n {\n return $this->end_invoice_date;\n }",
"public function get_calculated_end_date();",
"public function setEnd_date_day($end_date_day)\n\t {\n\t $this->end_date_day = $end_date_day;\n\n\t return $this;\n\t }",
"public function set_last_billed_date( $value ) {\n\t\t$this->set_prop( 'last_billed_date', $value ) ;\n\t}",
"public function getEndDate() {\r\n return $this->end_date;\r\n }",
"public function getEndDate()\n {\n return $this->end_date;\n }",
"function setEndDate($inEnddate) {\n\t\tif ( $inEnddate !== $this->_Enddate ) {\n\t\t\t$this->_Enddate = $inEnddate;\n\t\t\t$this->setModified();\n\t\t}\n\t\treturn $this;\n\t}",
"public function get_end_date()\n\t{\n\t\treturn $this->end_date;\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the page queue. | public function getPageQueue()
{
if ($this->pageQueue === null) {
$this->pageQueue = new SplQueue();
}
return $this->pageQueue;
} | [
"public function getQueue()\r\n\t{\t \r\n\t\t$methodToUse=\"Report.GetQueue\";\r\n\t\treturn self::apiDataless($methodToUse);\r\n\t}",
"public static function queue()\n\t{\n\t\t// Store the queue locally\n\t\t$queue = JS::$queue;\n\t\t\n\t\t// Reset the queue\n\t\tJS::$queue = NULL;\n\t\t\n\t\treturn $queue;\n\t}",
"function getQueue()\n\t{\n\t\t$lookup = new PushDispatch();\n\t\t$queueList = $lookup->GetList();\n\t\t$queue;\n\t\tif (count($queueList) == 0)\n\t\t{\n\t\t\t$queue = new PushDispatch();\n\t\t\t$queue->Save();\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$queue = $queueList[0];\n\t\t}\n\t\treturn $queue;\n\t}",
"public function getQueue()\r\n {\r\n \t$queue = $this->registrations->slice($this->getSize());\r\n \treturn $queue;\r\n }",
"public function getQueue()\n {\n return Mage::registry('current_queue');\n }",
"public function getNextQueuedPage()\n {\n $queue = new Queued(array('scans_id'=>$this->id));\n\n if (!$queue->count()) {\n return false;\n }\n\n $queue->rewind();\n return $queue->current();\n }",
"public function processQueue()\n {\n while (!empty($this->queue)) {\n $page = array_shift($this->queue);\n $this->generatePage($page);\n }\n }",
"public function getAppQueue()\n {\n return $this->get(self::_APP_QUEUE);\n }",
"public function getRequestQueue()\n {\n return $this->requestQueue;\n }",
"public function getMessageQueue()\n {\n \n return $this->_messageQueue;\n }",
"public function getQueue()\n {\n return $this->providerQueue;\n }",
"public function getQueue()\n {\n return $this->queues->current();\n }",
"public function getQueue() : QueueInterface;",
"public function getMessageQueue();",
"public function getItems() {\n\t\treturn $this->queue;\n\t}",
"public function getQueue()\n {\n return isset($this->Queue) ? $this->Queue : null;\n }",
"abstract public function getQueues();",
"public function get_queue()\n\t{\n\t\t$sql = 'SELECT * FROM ' . TITANIA_QUEUE_TABLE . '\n\t\t\tWHERE contrib_id = ' . $this->contrib_id . '\n\t\t\t\tAND revision_id = ' . $this->revision_id;\n\t\t$result = phpbb::$db->sql_query($sql);\n\t\t$row = phpbb::$db->sql_fetchrow($result);\n\t\tphpbb::$db->sql_freeresult($result);\n\n\t\tif ($row)\n\t\t{\n\t\t\t$queue = new titania_queue;\n\t\t\t$queue->__set_array($row);\n\t\t\treturn $queue;\n\t\t}\n\n\t\treturn false;\n\t}",
"function get_song_queue()\n {\n $endpoint = 'queue?_recursive=true';\n\n $api = new API_Thingy($this->credentials);\n return $api->get($endpoint);\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
translate the participant list to XML and append it to the DOM | private function participantstoxml() {
// Create main participantlist element.
global $DB;
if ($courselms = $DB->get_record('course', array ('id' => 1))) {
$lmssource = $courselms->fullname;
}
$guid = strtoupper(md5(uniqid()));
$root = $this->dom->createElement('participantlist');
$dttim = date("m/j/Y g:i:s a");
$coursename = $this->getactivecourse();
$topitems = $this->dom->createDocumentFragment();
$headerxml = <<<EOF
<ttxmlversion>2012</ttxmlversion>
<guid>$guid</guid>
<lmssource>$lmssource</lmssource>
<name>$coursename->fullname</name>
<created>$dttim</created>
<modified>$dttim</modified>
EOF;
$topitems->appendXML($headerxml);
$root->appendChild($topitems);
// Create participantlist header element
// as this is static text, let's do it the easy way.
$headeritems = $this->dom->createDocumentFragment();
$headerxml = <<<EOF
<headers>
<deviceid />
<firstname />
<lastname />
<userid />
</headers>
EOF;
$headeritems->appendXML($headerxml);
$root->appendChild($headeritems);
$plist = $this->dom->createElement('participants');
foreach ($this->participants as $id => $participant) {
$plist->appendChild($this->generateparticipantdom($participant));
}
$root->appendChild($plist);
return $root;
} | [
"function array_to_xml($playerlist, &$xml_playerlist) {\n\tforeach($playerlist as $key => $value) {\n\t\tif(is_array($value)) {\n\t\t\tif(!is_numeric($key)){\n\t\t\t\t$subnode = $xml_playerlist->addChild(\"$key\");\n\t\t\t\tarray_to_xml($value, $subnode);\n\t\t\t}\n\t\t\telse{\n\t\t\t\t$subnode = $xml_playerlist->addChild(\"item$key\");\n\t\t\t\tarray_to_xml($value, $subnode);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t$xml_playerlist->addChild(\"$key\",htmlspecialchars(\"$value\"));\n\t\t}\n\t}\n}",
"function get_participants($attribution){\n \n $retour = \"\"; \n \n $participants = $attribution->getElementsByTagName(\"participant\");\n \n foreach ( $participants as $participant ) \n \t$retour .= \"<tr class='mh_tdtitre'><td align='center'>\" .utf8_decode(stripslashes($participant->nodeValue)). \"</td><td align='center'>\" .$participant->getAttribute(\"chance\"). \"</td></tr>\"; \n \n return \"<table class='mh_tdborder' align='center' border='2' frame='void'><tr class='mh_tdtitre' align='center' style='color:white;'><th> Pseudo </th><th> Nombre de Chance </th></tr>\" .$retour. \"</table>\";\n \n }",
"function createListOfStudentChoices($projectPreferencesMdb2,$studentList,$studentChoices)\n {\n $dom=new DOMDocument();\n $dom->load($studentList);\n $studentXpath = new DOMXPath($dom);\n $queryStudents = \"//student\";\n $students=$studentXpath->query($queryStudents);\n\n $dom2 = new DOMDocument('1.0','UTF-8');\n $dom2->formatOutput = true;\n $root = $dom2->createElement (\"studentPreferences\");\n $root = $dom2->appendChild ($root);\n \n foreach($students as $stTag)\n {\n $uid=$stTag->getAttribute('uid');\n $studentChoice = $dom2->createElement (\"studentChoice\");\n $studentChoice = $root->appendChild ($studentChoice);\n $attr_uid = $dom2->createAttribute ('uid');\n $attr_uid = $studentChoice->appendChild ($attr_uid);\n $studentChoice->setAttribute('uid',$uid);\n $types = array(\"text\");\n $statement = $projectPreferencesMdb2->prepare(\"SELECT * FROM projectPreferences WHERE uid =? ORDER BY pref\", $types, MDB2_PREPARE_RESULT);\n $data = array($uid);\n $projectPrefQuery = $statement->execute($data);\n \n while ($prefs = $projectPrefQuery->fetchRow(MDB2_FETCHMODE_ORDERED))\n {\n $projid=$prefs[2];\n $rank=$prefs[1];\n \n $pref = $dom2->createElement (\"pref\");\n $pref = $studentChoice->appendChild ($pref);\n $attr_rank = $dom2->createAttribute ('rank');\n $attr_rank = $pref->appendChild ($attr_rank);\n $pref->setAttribute('rank', $rank);\n \n $attr_projid = $dom2->createAttribute ('projid');\n $attr_projid = $pref->appendChild ($attr_projid);\n $pref->setAttribute('projid', $projid);\n \n \n }\n \n } \n $dom2->save($studentChoices);\n }",
"function fetch_choices($conn, $question_id)\n{\n $choices_data = $conn->query(\"SELECT answer_id,choice_vi,choice \n FROM choices\n WHERE question_id = \" . $question_id);\n $choices_data = $choices_data->fetchAll();\n\n shuffle($choices_data);\n $dom = new DOMDocument();\n\n $choices = $dom->createElement(\"choices\");\n foreach ($choices_data as $choice_data) {\n $choice = $dom->createElement(\"choice\");\n list($answer_id, $choice_vi, $choice_en) = $choice_data;\n\n $combine = \"<span class=\\\"show_vi hide_words\\\">\" .\n $choice_vi . \"</span><span class=\\\"show_en\\\">\" . $choice_en . \"</span>\";\n // create English tag\n //create_child_for_choice($dom, \"en\", $choice_en, $choice);\n //create_child_for_choice($dom, \"vi\", $choice_vi, $choice);\n create_child_for_choice($dom, \"vi_en\", $combine, $choice);\n create_child_for_choice($dom, \"answer_id\", $answer_id, $choice);\n\n $choices->appendChild($choice);\n }\n\n $dom->appendChild($choices);\n\n header(\"Content-type: text/xml\");\n\n print($dom->saveXML());\n}",
"public function getSerielistXML() {\r\n\r\n\t\t$this->view->videolist = $this->getSerieList ();\r\n\t\t$xml = $this->view->render ( \"videolist.phtml\" );\r\n\t\treturn $xml;\r\n\t}",
"public function toXML();",
"function getUniversityDAL ()\n{\n $conn = openDB();\n\n $query = \"Select * From University\";\n $result = mysql_query($query);\n\n\n $doc = new DOMDocument('1.0');\n\n $style = $doc->createProcessingInstruction('xml-stylesheet', 'type=\"text/xsl\" href=\"test.xsl\"');\n $doc->appendChild($style);\n $list = $doc->createElement('universityList');\n $doc->appendChild($list);\n\n while($row = mysql_fetch_assoc($result)) {\n\n $university = $doc->createElement('University');\n $list->appendChild($university);\n\n $id_attr = $doc->createAttribute('Id');\n $university->appendChild($id_attr);\n\n $id_text = $doc->createTextNode($row['ID']);\n $id_attr->appendChild($id_text);\n\n $univ_name = $doc->createTextNode($row['NAME']);\n $university->appendChild($univ_name);\n }\n\n $out = $doc->saveXML();\n\n closeDB ($result, $conn);\n\n return $out;\n}",
"public function toXml();",
"function constructSubjectsXMLtree($data)\n{ \n\n $xw = new xmlWriter();\n $xw->openMemory();\n\n $xw->startDocument('1.0','UTF-8');\n $xw->startElement('data'); // <subjects>\nif (is_array($data)) {\n foreach($data as $personNumber=>$personData)\n {\n $xw->text(\"\\n\\t\\t\");\n $xw->startElement('Subject'); // <Subject>\n $xw->text(\"\\n\\t\\t\\t\");\n $xw->startElement('ID'); // <ID>\n $xw->text($personData[\"ID\"]);\n $xw->endElement(); // </ID>\n $xw->text(\"\\n\\t\\t\\t\");\n $xw->startElement('Description'); // <Description>\n $xw->text($personData[\"Description\"]);\n $xw->endElement(); // </Description>\n $xw->text(\"\\n\\t\\t\\t\");\n $xw->startElement('Name'); // <Name>\n $xw->text($personData[\"Name\"]);\n $xw->endElement(); // </Name>\n $xw->text(\"\\n\\t\\t\");\n $xw->endElement(); // </Subject>\n $xw->text(\"\\n\");\n\n }\n\n $xw->endElement(); // </subjects>\n $xw->endDtd();\n\n print $xw->outputMemory(true);\n}\n\n}",
"function xmllist() {\n\t\tglobal $mysql;\n\t\t$result[$this->class_name()] = $mysql->select(\"SELECT * FROM \".$this->class_name, true);\n\t\t$output = XML::get($result);\n\t\treturn xml($output);\n\t}",
"function listeProfs() {\n $filename = 'professeurs.xml';\n if(!file_exists($filename)) {\n fopen(\"professeurs.xml\",\"w+\");\n echo \"création fichier professeurs.xml\".PHP_EOL;\n }\n file_put_contents('professeurs.xml', '');\n $sql ='SELECT distinct shortname FROM teacher JOIN planning on teacher.id=planning.teacher_id JOIN course on planning.course_id=course.id WHERE teacher.dept =\"INFO\" and course.semester=? ';\n $stmt=$this->bdd->prepare($sql);\n $stmt ->bindParam(1,$this->semestre);\n $stmt->execute();\n $xml = '<Teachers_List>'.PHP_EOL;\n while($ligne = $stmt->fetch(PDO :: FETCH_ASSOC)){\n $xml.=\"<Teacher>\".PHP_EOL.\" <Name>\".$ligne['shortname'].\"</Name>\".PHP_EOL.\"</Teacher>\".PHP_EOL;\n }\n $xml.=\"</Teachers_List>\".PHP_EOL;\n file_put_contents(\"professeurs.xml\",$xml);\n echo \"Generation du fichiers professeurs.xml réussi ...\".PHP_EOL;\n }",
"abstract public function toXML();",
"function append_applicant(& $xml, $applicant) {\n $xml .= \"\\t<winner>\\n\";\n $xml .= \"\\t\\t<id>\" . $applicant['ID'] . \"</id>\\n\";\n $xml .= \"\\t\\t<status>\" . $applicant['STATUS'] . \"</status>\\n\";\n $xml .= \"\\t\\t<cgpa>\" . $applicant['CUM_GPA'] . \"</cgpa>\\n\";\n $xml .= \"\\t\\t<gender>\" . $applicant['GENDER'] . \"</gender>\\n\";\n $xml .= \"\\t\\t<fname>\" . $applicant['FNAME'] . \"</fname>\\n\";\n $xml .= \"\\t\\t<lname>\" . $applicant['LNAME'] . \"</lname>\\n\";\n $xml .= \"\\t\\t<phoneNum>\" . $applicant['PHONE_NUM'] . \"</phoneNum>\\n\";\n $xml .= \"\\t\\t<email>\" . $applicant['EMAIL'] . \"</email>\\n\";\n $xml .= \"\\t\\t<dob>\" . $applicant['DOB'] . \"</dob>\\n\";\n $xml .= \"\\t\\t<creditHours>\" . $applicant['CREDIT_HOURS'] . \"</creditHours>\\n\";\n $xml .= \"\\t</winner>\\n\";\n }",
"public function generateCollectionXml(\\SimpleXMLElement $pmtInf);",
"function constructSubsubjectsXMLtree($data)\n{ \n\n $xw = new xmlWriter();\n $xw->openMemory();\n\n $xw->startDocument('1.0','UTF-8');\n $xw->startElement('data'); // <subjects>\nif (is_array($data)) {\n foreach($data as $personNumber=>$personData)\n {\n $xw->text(\"\\n\\t\\t\");\n $xw->startElement('SubSubject'); // <SubSubject>\n $xw->text(\"\\n\\t\\t\\t\");\n\t\t$xw->startElement('SubjectName'); // <SubjectName>\n $xw->text($personData[\"SubjectName\"]);\n $xw->endElement(); // </SubjectName>\n $xw->text(\"\\n\\t\\t\\t\");\n\t\t$xw->startElement('SubjectID'); // <SubjectID>\n $xw->text($personData[\"SubjectID\"]);\n $xw->endElement(); // </SubjectID>\n $xw->text(\"\\n\\t\\t\\t\");\n $xw->startElement('ID'); // <ID>\n $xw->text($personData[\"ID\"]);\n $xw->endElement(); // </ID>\n $xw->text(\"\\n\\t\\t\\t\");\n $xw->startElement('Description'); // <Description>\n $xw->text($personData[\"Description\"]);\n $xw->endElement(); // </Description>\n $xw->text(\"\\n\\t\\t\\t\");\n $xw->startElement('Name'); // <Name>\n $xw->text($personData[\"Name\"]);\n $xw->endElement(); // </Name>\n $xw->text(\"\\n\\t\\t\");\n $xw->endElement(); // </Subject>\n $xw->text(\"\\n\");\n\n }\n\n $xw->endElement(); // </subjects>\n $xw->endDtd();\n\n print $xw->outputMemory(true);\n}\n\n}",
"public function prepare_getVillaRoomList($params)\n\t{\n\t\t$xml_string = \"strVillaID=\".$params['strVillaID'].\"\";\n\t\treturn $xml_string;\n\t}",
"public function toXml()\n {\n $xml = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <collection>\n <totalRecords>'.$this->_totalRecords.'</totalRecords>\n <items>';\n\n foreach ($this as $item) {\n $xml.=$item->toXml();\n }\n $xml.= '</items>\n </collection>';\n return $xml;\n }",
"function constructPersonXMLtree($data,$data2)\n{ \n\n $xw = new xmlWriter();\n $xw->openMemory();\n\n $xw->startDocument('1.0','UTF-8');\n $xw->startElement('data'); // <persons>\nif (is_array($data)) {\n foreach($data as $personNumber=>$personData)\n {\n \n $xw->text(\"\\n\\t\\t\");\n $xw->startElement('person'); // <person>\n $xw->text(\"\\n\\t\\t\\t\");\n $xw->startElement('id'); // <id>\n $xw->text($personData[\"id\"]);\n $xw->endElement(); // </id>\n $xw->text(\"\\n\\t\\t\\t\");\n $xw->startElement('name'); // <firstname>\n $xw->text($personData[\"name\"]);\n $xw->endElement(); // </firstname>\n $xw->text(\"\\n\\t\\t\\t\");\n $xw->startElement('surname'); // <surname>\n $xw->text($personData[\"surname\"]);\n $xw->endElement(); // </surname>\n $xw->text(\"\\n\\t\\t\\t\");\n $xw->startElement('email'); // <email>\n $xw->text($personData[\"email\"]);\n $xw->endElement(); // </email>\n $xw->text(\"\\n\\t\\t\\t\");\n $xw->startElement('password'); // <password>\n $xw->text($personData[\"password\"]);\n $xw->endElement(); // </password>\n $xw->text(\"\\n\\t\\t\\t\");\n $xw->startElement('dateOfBirth'); // <dateOfBirth>\n $xw->text($personData[\"dateOfBirth\"]);\n $xw->endElement(); // </dateOfBirth>\n $xw->text(\"\\n\\t\\t\\t\");\n $xw->startElement('AuthorID'); // <AuthorID>\n $xw->text($personData[\"AuthorID\"]);\n $xw->endElement(); // </AuthorID>\n $xw->text(\"\\n\\t\\t\\t\");\n $xw->startElement('UserTypeID'); // <UserTypeID>\n $xw->text($personData[\"UserTypeID\"]);\n $xw->endElement(); // </UserTypeID>\n $xw->text(\"\\n\\t\\t\");\n $xw->endElement(); // </person>\n $xw->text(\"\\n\");\n\n }\n\n\n}\n\nif (is_array($data2)) {\n\t\t\t$xw->text(\"\\n\\t\\t\");\n\t\t\t$xw->startElement('Privileges'); // <Privileges>\n\n\t\tforeach($data2 as $personNumber2=>$personData2)\n\t\t{\n\t\t $xw->text(\"\\n\\t\\t\");\n\t\t\t\t$xw->startElement('Privilege'); // <Privilege>\n\t\t\t\t$xw->text(\"\\n\\t\\t\\t\");\n\n\t\t\t\t$xw->text(\"\\n\\t\\t\\t\");\n $xw->startElement('PrivilegeID'); // <PrivilegeID>\n $xw->text($personData2[\"PrivilegeID\"]);\n $xw->endElement(); // </PrivilegeID>\n $xw->text(\"\\n\\t\\t\\t\");\n $xw->startElement('PrivilegeName'); // <PrivilegeName>\n $xw->text($personData2[\"PrivilegeName\"]);\n $xw->endElement(); // </PrivilegeName>\n $xw->text(\"\\n\\t\\t\");\n\n\t\t\t\t$xw->endElement(); // </Privilege>\n\t\t\t\t$xw->text(\"\\n\");\n\t\t}\n\t\t\t$xw->endElement(); // </Privileges>\n\t\t\t$xw->text(\"\\n\");\n\n\t}\n\t\n\t $xw->endElement(); // </persons>\n $xw->endDtd();\n\n print $xw->outputMemory(true);\n\n}",
"function getUserGroupListXML() {\n $result = '';\n if (isset($this->groups) && is_array($this->groups) &&\n isset($this->user) && is_array($this->user)) {\n $result .= sprintf(\n '<listview title=\"%s\">'.LF,\n papaya_strings::escapeHTMLChars($this->_gt('Groups'))\n );\n $result .= sprintf(\n '<cols><col>%s</col><col align=\"center\">%s</col></cols>',\n papaya_strings::escapeHTMLChars($this->_gt('Group')),\n papaya_strings::escapeHTMLChars($this->_gt('Member'))\n );\n $result .= '<items>'.LF;\n foreach ($this->groups as $groupId => $group) {\n $result .= sprintf(\n '<listitem title=\"%s\" image=\"%s\">'.LF,\n papaya_strings::escapeHTMLChars($group['grouptitle']),\n papaya_strings::escapeHTMLChars($this->images['items-user-group'])\n );\n $result .= '<subitem align=\"center\">';\n if (($this->authUser->isAdmin() || $this->authUser->inGroup($groupId)) &&\n $groupId != $this->user['group_id']) {\n if ($this->inGroup($groupId)) {\n $href = $this->getLink(\n array(\n 'cmd' => 'group_out',\n 'gid' => $groupId,\n 'uid' => $this->userId\n )\n );\n $idx = 'status-node-checked';\n } else {\n $href = $this->getLink(\n array(\n 'cmd' => 'group_in',\n 'gid' => $groupId,\n 'uid' => $this->userId\n )\n );\n $idx = 'status-node-empty';\n }\n $result .= sprintf(\n '<a href=\"%s\"><glyph src=\"%s\"/></a>',\n papaya_strings::escapeHTMLChars($href),\n papaya_strings::escapeHTMLChars($this->images[$idx])\n );\n } else {\n $idx = ($this->inGroup($groupId))\n ? 'status-node-checked-disabled' : 'status-node-empty-disabled';\n $result .= sprintf(\n '<glyph src=\"%s\"/>',\n papaya_strings::escapeHTMLChars($this->images[$idx])\n );\n }\n $result .= '</subitem>'.LF;\n $result .= '</listitem>'.LF;\n }\n $result .= '</items>'.LF;\n $result .= '</listview>'.LF;\n }\n $this->layout->addRight($result);\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds action to the field Creates a link for each action you define | public function add_action($action, $valuefield, $label, $link = '')
{
$this->action[$action] = $valuefield;
$this->text[$action] = $label;
$this->url[$action] = $link;
return $this;
} | [
"abstract protected function getLinkAction();",
"function ActionLink($args)\r\n\t{\r\n\t\t//Errors cheking\r\n\t\tif (!isset($args['action_link'])) {\r\n\t\t\treturn \"<font color=\".'red'.\">Error: action_link isn't set</font>\";\r\n\t\t}\r\n\t\tif (!isset($args['action_type'])) {\r\n\t\t\treturn \"<font color=\".'red'.\">Error: action_type isn't set</font>\";\t\r\n\t\t}\r\n\t\tif (!isset($args['obj_type'])) {\r\n\t\t\treturn \"<font color=\".'red'.\">Error: obj_type isn't set</font>\";\r\n\t\t}\r\n\t\tif (!isset($args['id'])) {\r\n\t\t\treturn \"<font color=\".'red'.\">Error: id isn't set</font>\";\r\n\t\t}\r\n\r\n\t\t//Add other fields\r\n\t\tif (!isset($args['lnk_text'])) {\r\n\t\t\tglobal $act_type_to_text;\r\n\t\t\t$args['lnk_text'] = $act_type_to_text[$args['action_type']];\r\n\t\t}\r\n\t\tif (!isset($args['prev_page'])) {\r\n\t\t\t$args['prev_page'] = $_SERVER['REQUEST_URI'];\r\n\t\t}\r\n\t\t$method = 'post';\r\n\t\tif (isset($args['method'])) {\r\n\t\t\t$method = $args['method'];\r\n\t\t}\r\n\t\t$style = '';\r\n\t\tif (isset($args['style'])) {\r\n\t\t\t$style = 'style=\"'.$args['style'].'\"';\r\n\t\t}\r\n\r\n\t\tglobal $act_type_to_css_class;\r\n\r\n\t\t$res = '';\r\n\t\tif ($method === 'post') {\r\n\t\t\t$res .= '<form class=\"form-inline\" action=\"'.$args['action_link'].'\" method=\"post\" style=\"display: inline !important;\">';\r\n\t\t\t$res .= '\t<input class=\"btn btn-link '.$args['lnk_size'].'\" style=\"margin: 0; padding: 0; white-space: normal !important;\" name=\"'.$args['action_type'].'\" type=\"submit\" value=\"'.$args['lnk_text'].'\">';\r\n\t\t\t$res .= \tWrapToHiddenInputs(array('type' => $args['obj_type'], 'id' => $args['id'], 'prev_page' => $args['prev_page']));\t\t\r\n\t\t\tif (isset($args['info']))\r\n\t\t\t\t$res .= '<input type=\"hidden\" name=\"info\" value=\"'.$args['info'].'\">';\r\n\t\t\t$res .= '</form>';\r\n\t\t} else if ($method === 'get') {\r\n\t\t\tif (isset($args['mod_rewrite']) && ($args['mod_rewrite'] === 1)) {\r\n\t\t\t\t$res .= '<a '.$style.' href=\"'.Link::Get($args['obj_type']).'/'.$args['id'].'\" class=\"btn btn-link '.($args['lnk_size']).'\">'.$args['lnk_text'].'</a>';\r\n\t\t\t} else {\r\n\t\t\t\t$res .= '<a '.$style.' href=\"'.$args['action_link'].'?'.WrapToGetVariables(array('type' => $args['obj_type'], 'id' => $args['id'], $args['action_type'] => '1')).'\" class=\"btn btn-link '.($args['lnk_size']).'\">'.$args['lnk_text'].'</a>';\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn $res;\r\n\t}",
"function manage_action_links($action) {\n\tglobal $conf,$mod,$page,$smarty;\n\t\n\tif ($mod['actions'][$action]['action_links']) {\n\t\tif ($mod['actions'][$action]['action_links'] == 'none') {\n\t\t\tunset($page['action_links']);\n\t\t} else {\n\t\t\t$page['action_links'] = $mod['actions'][$action]['action_links'];\n\t\t}\n\t} else if ($mod['action_links']) {\n\t\t$page['action_links'] = $mod['action_links'];\n\t} else {\n\t\treturn;\n\t}\n\t\n\t$links = $smarty->fetch(\"file:{$conf['ffw']}mod_crud/views/crud_action_links.html\");\n\t$page['content'] = $links . $page['content'] . $links;\n}",
"protected function _addActionsLink($label, $action) {\n\t\t//add a link to actions menu\n\t\t$formOBJ=ClassRegistry::init('Form');\n\t\t$ret=false;\n\t\tif(isset($action['action'])) {\n\t\t\t//action must be set\n\t\t\tif(!isset($action['controller'])) $action['controller']=$this->params['controller'];\n\t\t\t//look for controller/action combo in forms table\n\t\t\t$form=$formOBJ->find('first',array(\n\t\t\t\t'conditions'=>array('controller'=>$action['controller'],'action'=>$action['action']),\n\t\t\t\t'fields'=>array('Form.id'),\n\t\t\t\t'recursive'=>0\n\t\t\t\t));\n\t\t\tif($form) {\n\t\t\t\t//form has been visited before, check permissions\n\t\t\t\tif($this->ComputareUser->authenticate($form['Form']['id'],$this->Auth->user('id'),'view')) {\n\t\t\t\t\t//user has permission\n\t\t\t\t\t$ret=true;\n\t\t\t\t}//endif\n\t\t\t} else {\n\t\t\t\t//form is not in table, show link\n\t\t\t\t$ret=true;\n\t\t\t}//endif\n\t\t\tif($ret ){\n\t\t\t\t//add link to form\n\t\t\t\t$this->actionsArray[]=array($label, $action);\n\t\t\t\t$this->set('actions',$this->actionsArray);\n\t\t\t}//endif\n//debug($form);exit;\n\t\t}//endif action is set\n\t}",
"function formActions()\n {\n $this->out->submit('initial-bookmark-submit', _m('BUTTON', 'Add'), 'submit', 'submit');\n }",
"public function addLink($field, $value, $action, $title='' ) {\n $aux = array (\n 'value' => $value ,\n 'action' => $action ,\n 'title' => $title\n );\n $this->_links[$field] = $aux;\n }",
"function add_actions()\n {\n }",
"public function generate_addlink() {\n\t\t\t$bootstrap = new HTMLWriter();\n\t\t\t$href = $this->generate_addactionurl();\n\t\t\t$icon = $bootstrap->icon('material-icons md-18', '');\n\t\t\tif (DplusWire::wire('config')->cptechcustomer == 'stempf') {\n\t\t\t\t$ajaxclass = $this->inmodal ? 'modal-load' : 'load-into-modal';\n\t\t\t\treturn $bootstrap->a(\"href=$href|class=btn btn-info btn-xs $ajaxclass pull-right hidden-print|data-modal=$this->modal|role=button|title=Add Action\", $icon);\n\t\t\t}\n\t\t\treturn $bootstrap->a(\"href=$href|class=btn btn-info btn-xs add-action pull-right hidden-print|data-modal=$this->modal|role=button|title=Add Action\", $icon);\n\t\t}",
"public function EditFieldLink($field) {\n switch ($field) {\n case \"author\":\n case \"keywords\":\n case \"degree\":\n case \"language\":\n $action = \"record\"; break;\n \n case \"chair\":\n case \"committee members\":\n $action = \"faculty\"; break;\n \n case \"researchfields\": $action = \"researchfield\"; break;\n case \"partnering agencies\": $action = \"partneringagency\"; break; \n case \"table of contents\": $action = \"contents\"; break;\n \n case \"send to ProQuest\":\n case \"copyright\":\n case \"embargo request\":\n case \"submission agreement\":\n $action = \"rights\"; break;\n \n case \"title\":\n case \"program\":\n case \"abstract\":\n default:\n $action = $field;\n }\n \n return $this->view->url(array('controller' => 'edit', 'action' => $action));\n }",
"public function agregarAction(){\n\t\t\t\t\t\n }",
"private function actions() {\n\t\t\t/**\n\t\t\t * Setup actions\n\t\t\t */\n\t\t\t\\WPGraphQL\\Extensions\\QL_Events\\Type_Registry::add_actions();\n\t\t}",
"function action_link( $links ) {\r\n $action_link = '<a href=\"' . admin_url( 'admin.php?page=bp-courseware' ) . '\">' . __( 'Settings', 'bpsp' ) .'</a>';\r\n array_unshift( $links, $action_link );\r\n return $links;\r\n }",
"public function addLink()\n\t{\n\t\t$this->checkPermission('write');\n\t\t$this->activateTabs('content','id_content_view');\n\t\n\t\t$this->initFormLink(self::LINK_MOD_ADD);\n\t\t$this->tpl->setContent($this->form->getHTML());\n\t}",
"function hopform_form_page_actions_action_add($form, $action) {\n $actions_info = hopform_actions();\n if (empty($actions_info[$action])) {\n return MENU_NOT_FOUND;\n }\n\n $action_object = hopform_form_action_create($form, array('type' => $action));\n return drupal_get_form('hopform_form_action_form', $action_object);\n}",
"public function generate_viewactionlink(UserAction $action) {\n $bootstrap = new HTMLWriter();\n $href = $this->generate_viewactionurl($action);\n $icon = $bootstrap->icon('material-icons md-18', '');\n return $bootstrap->a(\"href=$href|role=button|class=btn btn-xs btn-primary modal-load|data-modal=$this->modal|title=View Action\", $icon);\n }",
"protected function addActions() {\n\n\t\t}",
"function formActions()\n {\n // TRANS: Button text for action to register.\n $this->out->submit('submit', _m('BUTTON', 'Register'));\n }",
"function add_annotate_link( $plugin_actions, $plugin_file ) {\r\n \r\n $new_actions = array();\r\n\t$new_actions['cl_settings'] = '<a href=\"javascript: void(0);\" onClick=\"edit_annotation(\\''.$plugin_file.'\\');\">Annotate</a>';\r\n\t\r\n\t// places new link after others\r\n return array_merge( $plugin_actions, $new_actions );\r\n\t\r\n}",
"public function setAdd()\n\t{\n\t\t$each_action = [];\n\t\t$each_action['label'] \t= __('admin_label.Add');\n\t\t$each_action['class'] \t= 'btn btn-success add_button';\n\t\t$each_action['icon'] \t= 'add_circle_outline';\n\t\t$each_action['link'] \t= $this->add_link == false ? route($this->route_slug.'add') : $this->add_link;\n\t\t$this->add_button = $each_action;\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Filter the query by a related \Hotspot\AccessPointBundle\Model\AccesspointI18n object | public function filterByAccesspointI18n($accesspointI18n, $comparison = null)
{
if ($accesspointI18n instanceof \Hotspot\AccessPointBundle\Model\AccesspointI18n) {
return $this
->addUsingAlias(AccesspointTableMap::COL_ID, $accesspointI18n->getId(), $comparison);
} elseif ($accesspointI18n instanceof ObjectCollection) {
return $this
->useAccesspointI18nQuery()
->filterByPrimaryKeys($accesspointI18n->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByAccesspointI18n() only accepts arguments of type \Hotspot\AccessPointBundle\Model\AccesspointI18n or Collection');
}
} | [
"abstract protected function findTranslations(MessageTranslationFilter $filter);",
"protected function applyTranslationFilter()\n {\n if (!array_key_exists($lang = request()->get('lang'), $this->languages())) {\n return;\n }\n\n return $this->query->whereLanguage($lang);\n }",
"public function filterI18NColumn()\n {\n $overrideData = array_only($this->attributes, $this->i18n_fillable);\n if (!empty($overrideData)) {\n $this->i18n_data[$this->i18n_default_locale] = $overrideData;\n foreach ($this->i18n_fillable as $key) {\n unset($this->$key);\n }\n }\n\n if (isset($this->attributes[$this->i18n_attribute_name])) {\n $this->i18n_data = $this->attributes[$this->i18n_attribute_name];\n unset($this->attributes[$this->i18n_attribute_name]);\n }\n }",
"public function testFilterUntranslated(): void\n {\n $table = $this->getTableLocator()->get('Articles');\n /** @var \\Cake\\ORM\\Table|\\Cake\\ORM\\Behavior\\TranslateBehavior $table */\n $table->addBehavior('Translate', [\n 'fields' => ['title', 'body'],\n 'onlyTranslated' => true,\n ]);\n $table->setLocale('eng');\n $results = $table->find()->where(['Articles.id' => 1])->all();\n $this->assertCount(1, $results);\n\n $table->setLocale('fr');\n $results = $table->find()->where(['Articles.id' => 1])->all();\n $this->assertCount(0, $results);\n }",
"public function get_gategories_associated_with_salons($lang='en') {\n if($lang=='ar'){\n $this->db->select(\"service.category_id as id, category.name_ar as name\");\n } else {\n $this->db->select(\"service.category_id as id, category.name\");\n }\n $this->db->distinct('service.category_id');\n $this->db->from('salon_service,service,category');\n // $this->db->join('service', 'salon_service.service_id= service.id');\n $this->db->where('salon_service.service_id= service.id AND service.category_id=category.id');\n $this->db->order_by(\"name\", \"asc\"); \n $query = $this->db->get();\n if ($query == TRUE) {\n return $query->result();\n } else {\n return FALSE;\n }\n }",
"function templatic_posts_where_filter($join) {\r\n global $wpdb, $pagenow, $wp_taxonomies;\r\n $language_where = '';\r\n if (is_plugin_active('sitepress-multilingual-cms/sitepress.php')) {\r\n $language = ICL_LANGUAGE_CODE;\r\n $join .= \" AND t.language_code='\" . $language . \"'\";\r\n }\r\n return $join;\r\n}",
"public function getInternati()\n {\n return $this->hasMany(Internato::class, ['id' => 'internato_id'])->viaTable('documento_internato', ['documento_id' => 'id']);\n }",
"function testWhereInText1()\n {\n // $this->clearSandbox();\n \n $hq = $this->CI->hydrate->start(\n \"campaigns\"\n , Array(\"reklama\")\n );\n $hq->where(\"reklama.ID IN ({$this->clip1[\"ID\"]}, {$this->clip2[\"ID\"]})\");\n \n $result = db_decode($hq->resultArray());\n \n $this->_testWhereInResult($result);\n }",
"public function i18nQuery()\n {\n $query = $this->getModel()->newQueryWithoutScopes()->getQuery();\n\n $query->from($this->model->getI18nTable());\n\n return $query;\n }",
"public function useiceModelAttributeI18nQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)\n {\n return $this\n ->joiniceModelAttributeI18n($relationAlias, $joinType)\n ->useQuery($relationAlias ? $relationAlias : 'iceModelAttributeI18n', 'iceModelAttributeI18nQuery');\n }",
"public function filterBySectionI18n($sectionI18n, $comparison = null)\n {\n if ($sectionI18n instanceof \\Common\\DbBundle\\Model\\SectionI18n) {\n return $this\n ->addUsingAlias(SectionTableMap::COL_ID, $sectionI18n->getId(), $comparison);\n } elseif ($sectionI18n instanceof ObjectCollection) {\n return $this\n ->useSectionI18nQuery()\n ->filterByPrimaryKeys($sectionI18n->getPrimaryKeys())\n ->endUse();\n } else {\n throw new PropelException('filterBySectionI18n() only accepts arguments of type \\Common\\DbBundle\\Model\\SectionI18n or Collection');\n }\n }",
"public function filterByBonPlanI18n($bonPlanI18n, $comparison = null)\n {\n if ($bonPlanI18n instanceof BonPlanI18n) {\n return $this\n ->addUsingAlias(BonPlanPeer::ID, $bonPlanI18n->getId(), $comparison);\n } elseif ($bonPlanI18n instanceof PropelObjectCollection) {\n return $this\n ->useBonPlanI18nQuery()\n ->filterByPrimaryKeys($bonPlanI18n->getPrimaryKeys())\n ->endUse();\n } else {\n throw new PropelException('filterByBonPlanI18n() only accepts arguments of type BonPlanI18n or PropelCollection');\n }\n }",
"public function getInternatos()\n {\n return $this->hasMany(Internato::class, ['provenienza_da_id' => 'id']);\n }",
"function string_details($filter_query, $lng, $alternative_langs = array()) {\n // Get the IDs of the strings that are returned by the filter query.\n $assoc_arr_sguid = $filter_query->execute()->fetchAllAssoc('sguid');\n if (empty($assoc_arr_sguid)) return array();\n $arr_sguid = array_keys($assoc_arr_sguid);\n\n // Get strings.\n $arr_strings = btr::db_query(\n 'SELECT sguid, string FROM {btr_strings} WHERE sguid IN (:arr_sguid)',\n array(':arr_sguid' => $arr_sguid)\n )->fetchAllAssoc('sguid');\n\n // Get translations.\n $arr_translations = btr::db_query(\n 'SELECT s.sguid, t.tguid, t.lng, t.translation,\n t.time, u.name AS author, u.umail, u.ulng, u.uid, t.count\n FROM {btr_strings} s\n JOIN {btr_translations} t ON (s.sguid = t.sguid)\n LEFT JOIN {btr_users} u ON (u.umail = t.umail AND u.ulng = t.ulng)\n WHERE (t.lng = :lng) AND s.sguid IN (:arr_sguid)\n ORDER BY t.count DESC',\n array(':lng' => $lng, ':arr_sguid' => $arr_sguid)\n )->fetchAllAssoc('tguid');\n\n // Get votes.\n $arr_tguid = array_keys($arr_translations);\n if (empty($arr_tguid)) {\n $arr_votes = array();\n }\n else {\n $arr_votes = btr::db_query(\n 'SELECT t.tguid, v.vid, u.name, u.umail, u.ulng, u.uid, v.time\n FROM {btr_translations} t\n JOIN {btr_votes} v ON (v.tguid = t.tguid)\n JOIN {btr_users} u ON (u.umail = v.umail AND u.ulng = v.ulng)\n WHERE t.tguid IN (:arr_tguid)\n ORDER BY v.time DESC',\n array(':arr_tguid' => $arr_tguid)\n )->fetchAllAssoc('vid');\n }\n\n // Get alternatives (from other languages). They are the best\n // translations (max count) from the alternative languages.\n if (empty($alternative_langs)) {\n $arr_alternatives = array();\n }\n else {\n $arr_alternatives = btr::db_query(\n 'SELECT DISTINCT t.sguid, t.tguid, t.lng, t.translation, t.count\n FROM (SELECT sguid, lng, MAX(count) AS max_count\n\t FROM {btr_translations}\n\t WHERE lng IN (:arr_lng) AND sguid IN (:arr_sguid)\n\t GROUP BY sguid, lng\n\t ) AS m\n INNER JOIN {btr_translations} AS t\n\t ON (m.sguid = t.sguid AND m.lng = t.lng AND m.max_count = t.count)\n GROUP BY t.sguid, t.lng, t.count',\n array(\n ':arr_lng' => $alternative_langs,\n ':arr_sguid' => $arr_sguid,\n )\n )->fetchAllAssoc('tguid');\n }\n\n // Put alternatives as nested array under strings.\n foreach ($arr_alternatives as $tguid => $alternative) {\n $sguid = $alternative->sguid;\n $lng = $alternative->lng;\n $arr_strings[$sguid]->alternatives[$lng] = $alternative->translation;\n }\n\n // Put votes as nested arrays inside translations.\n // Votes are already ordered by time (desc).\n foreach ($arr_votes as $vid => $vote) {\n $tguid = $vote->tguid;\n $name = $vote->name;\n $arr_translations[$tguid]->votes[$name] = $vote;\n }\n\n // Put translations as nested arrays inside strings.\n // Translations are already ordered by count (desc).\n // Make sure that each translation has an array of votes\n // (even though it may be empty).\n foreach ($arr_translations as $tguid => $translation) {\n if (!isset($translation->votes)) $translation->votes = array();\n $sguid = $translation->sguid;\n $arr_strings[$sguid]->translations[$tguid] = $translation;\n }\n\n // Put strings in the same order as $arr_sguid.\n // Make sure as well that each string has an array of translations\n // (even though it may be empty).\n $strings = array();\n foreach ($arr_sguid as $sguid) {\n $string = $arr_strings[$sguid];\n if (!isset($string->alternatives)) $string->alternatives = array();\n if (!isset($string->translations)) $string->translations = array();\n $string->translations = array_values($string->translations);\n $strings[] = $string;\n }\n\n return $strings;\n}",
"function localisationFields_where($table)\n {\n ////////////////////////////////////////////////////////////////////////////////\n //\n // Load the TCA, if we don't have an table.columns array\n\n $this->pObj->objZz->loadTCA($table);\n // Load the TCA, if we don't have an table.columns array\n\n\n\n ////////////////////////////////////////////////////////////////////////////////\n //\n // Get the field names for sys_language_content and for l10n_parent\n\n $arr_localise['id_field'] = $GLOBALS['TCA'][$table]['ctrl']['languageField'];\n $arr_localise['pid_field'] = $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'];\n // Get the field names for sys_language_content and for l10n_parent\n\n\n ////////////////////////////////////////////////////////////////////////////////\n //\n // Clean up the array\n\n $arr_localise = $this->propper_locArray($arr_localise, $table);\n // Clean up the array\n\n\n ////////////////////////////////////////////////////////////////////////////////\n //\n // Get the localisation configuration\n\n $this->int_localisation_mode = $this->localisationConfig();\n // Get the localisation configuration\n\n\n ////////////////////////////////////////////////////////////////////////////////\n //\n // Return, if we don't have localisation fields\n\n if (!$arr_localise)\n {\n if ($this->pObj->b_drs_localisation)\n {\n t3lib_div::devlog('[INFO/LOCALISATION] There isn\\'t any localised field.', $this->pObj->extKey, 0);\n t3lib_div::devlog('[INFO/LOCALISATION] A localised AND WHERE isn\\'t needed.', $this->pObj->extKey, 0);\n }\n return false;\n }\n // Return, if we don't have localisation fields\n\n\n ////////////////////////////////////////////////////////////////////////////////\n //\n // Building AND WHERE\n\n // DRS :TODO:\n if( $this->pObj->b_drs_devTodo )\n {\n $prompt = '$this->int_localisation_mode == PI1_SELECTED_OR_DEFAULT_LANGUAGE';\n t3lib_div::devlog( '[INFO/TODO] ' . $prompt, $this->pObj->extKey, 0 );\n }\n // DRS :TODO:\n if ($this->int_localisation_mode == PI1_DEFAULT_LANGUAGE)\n {\n $str_andWhere = $arr_localise['id_field'].\" <= 0 \";\n }\n if ($this->int_localisation_mode == PI1_SELECTED_OR_DEFAULT_LANGUAGE)\n {\n $str_andWhere = \"( \".$arr_localise['id_field'].\" <= 0 OR \".$arr_localise['id_field'].\" = \".intval($this->lang_id).\" ) \";\n // These andWhere needs a consolidation\n// // DEVELOPMENT: Browser engine 4.x\n// if( $this->pObj->dev_browserEngine == 4 )\n// {\n// // DRS\n// if( $this->pObj->b_drs_filter || $this->pObj->b_drs_sql )\n// {\n// $prompt = '+++ Browser engine 4.x ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++';\n// t3lib_div::devlog( $prompt, $this->pObj->extKey, 2 );\n// $prompt = 'Browser engine 4.x: andWhere for localised fields is modified. ' .\n// 'Only records of the default language will selected.';\n// t3lib_div::devlog( '[WARN/FILTER+SQL] ' . $prompt, $this->pObj->extKey, 2 );\n// $prompt = 'Browser engine 4.x: If you are using this with the Browser engine 3.x, you will get trouble.';\n// t3lib_div::devlog( '[WARN/FILTER+SQL] ' . $prompt, $this->pObj->extKey, 2 );\n// }\n// // DRS\n// $str_andWhere = $arr_localise['id_field'].\" <= 0 \";\n// }\n }\n if ($this->int_localisation_mode == PI1_SELECTED_LANGUAGE_ONLY)\n {\n $str_andWhere = $arr_localise['id_field'].\" = \".intval($this->lang_id).\" \";\n }\n // Building AND WHERE\n\n\n return $str_andWhere;\n }",
"public function filterByObservationPhotoI18n($observationPhotoI18n, $comparison = null)\n\t{\n\t\treturn $this\n\t\t\t->addUsingAlias(ObservationPhotoPeer::ID, $observationPhotoI18n->getId(), $comparison);\n\t}",
"public function getCategoryQuery($idCategory, LocaleTransfer $localeTransfer);",
"public function getI18nMessages()\n {\n return $this->hasMany(I18nMessage::className(), ['id' => 'id']);\n }",
"public function getTranslationsObjectByID($id,$lang)\n\t{\n\t\treturn CategoriesTranslations::find()->where(['cat_id' => $id, 'lang' => $lang])->one();\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
setAttachmentpoint() Set the value of [grosspremiuminusd] column. | public function setGrosspremiuminusd($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->grosspremiuminusd !== $v) {
$this->grosspremiuminusd = $v;
$this->modifiedColumns[] = QcSearchPeer::GROSSPREMIUMINUSD;
}
return $this;
} | [
"public function setAttachmentpointinusd($v)\n\t{\n\t\tif ($v !== null) {\n\t\t\t$v = (string) $v;\n\t\t}\n\n\t\tif ($this->attachmentpointinusd !== $v) {\n\t\t\t$this->attachmentpointinusd = $v;\n\t\t\t$this->modifiedColumns[] = AmendmentsubmissionqcSearchPeer::ATTACHMENTPOINTINUSD;\n\t\t}\n\n\t\treturn $this;\n\t}",
"public function setPrix(float $_prix)\n {\n if(is_float($_prix)){\n $this->_prix = $_prix; \n }\n }",
"protected function setOfferValue ()\n {\n $this->request->coupon_benefits[ $this->offerNature ] = $this->offer->rate;\n }",
"public function setPremium(\\Mu4ddi3\\Compensa\\Webservice\\StructType\\MoneyAmountStorage $premium = null)\n {\n if (is_null($premium) || (is_array($premium) && empty($premium))) {\n unset($this->Premium);\n } else {\n $this->Premium = $premium;\n }\n return $this;\n }",
"public function setCredit(float $credit) \n\t{\n\t\t$this->session->setValue('credit', $credit);\n\t}",
"public function testSetPourcentActivite() {\n\n $obj = new Bulletins();\n\n $obj->setPourcentActivite(10.092018);\n $this->assertEquals(10.092018, $obj->getPourcentActivite());\n }",
"public function testSetDureePointee() {\n\n $obj = new BonTravPrev();\n\n $obj->setDureePointee(10.092018);\n $this->assertEquals(10.092018, $obj->getDureePointee());\n }",
"protected function setScalePriceData() {\n \n $defaultPriceDataArr = tx_ptgsashop_articleAccessor::getInstance()->selectRetailPricingData($this->articleUid, $this->quantity);\n \n if (!is_array($defaultPriceDataArr)) {\n throw new tx_pttools_exception('No valid article pricing data found', 3,\n 'tx_ptgsashop_articleAccessor::getInstance()->selectRetailPricingData('.$this->articleUid.', '.$this->quantity.') did not return any data.');\n }\n \n if (!is_null($defaultPriceDataArr['PR01'])) $this->basicRetailPriceCategory1 = (double)$defaultPriceDataArr['PR01'];\n if (!is_null($defaultPriceDataArr['PR02'])) $this->basicRetailPriceCategory2 = (double)$defaultPriceDataArr['PR02'];\n if (!is_null($defaultPriceDataArr['PR03'])) $this->basicRetailPriceCategory3 = (double)$defaultPriceDataArr['PR03'];\n if (!is_null($defaultPriceDataArr['PR04'])) $this->basicRetailPriceCategory4 = (double)$defaultPriceDataArr['PR04'];\n if (!is_null($defaultPriceDataArr['PR05'])) $this->basicRetailPriceCategory5 = (double)$defaultPriceDataArr['PR05'];\n if (!is_null($defaultPriceDataArr['AKTION'])) $this->specialOfferFlag = (bool)$defaultPriceDataArr['AKTION'];\n if (!is_null($defaultPriceDataArr['PR99'])) $this->specialOfferRetailPrice = (double)$defaultPriceDataArr['PR99'];\n if (!is_null($defaultPriceDataArr['DATUMVON'])) $this->specialOfferStartDate = (string)$defaultPriceDataArr['DATUMVON'];\n if (!is_null($defaultPriceDataArr['DATUMBIS'])) $this->specialOfferEndDate = (string)$defaultPriceDataArr['DATUMBIS'];\n \n }",
"public function setPrix_prov_matin_enfant($iv_prix_prov_matin_enfant) {\n\t\t\t/* Database attributes control */\n\t\t\t$lv_datatype = 'decimal(10,2)';\n\t\t\ttry {\n\t\t\t\t$this->prix_prov_matin_enfant = Securite::checkDataFormat($iv_prix_prov_matin_enfant, $lv_datatype);\n\t\t\t} catch (Message $lo_message) {\n\t\t\t\t$this->addMessage($lo_message);\n\t\t\t\t$this->v_has_error = true;\n\t\t\t}\n\t\t}",
"public function testCanSetAndGetDeliveryPoint()\n {\n $mockDeliveryPoint = '6300 Ocean Dr';\n\n $this->nationalDataCenter->setDeliveryPoint($mockDeliveryPoint);\n\n $this->assertEquals($mockDeliveryPoint, $this->nationalDataCenter->getDeliveryPoint());\n }",
"public function setIsPremium(?bool $value): void {\n $this->getBackingStore()->set('isPremium', $value);\n }",
"function addCreditPoints($username, $creditpoints)\t{\n\t\t$uid_voucher = '';\n\t // get the \"old\" creditpoints for the user\n\t $res1 = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid, tt_products_creditpoints', 'fe_users', 'username=\"'.$username.'\"');\n\t if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res1)) {\n\t $ttproductscreditpoints = $row['tt_products_creditpoints'];\n\t $uid_voucher = $row['uid'];\n\t }\n\t $fieldsArrayFeUserCredit = array();\n\t $fieldsArrayFeUserCredit['tt_products_creditpoints'] = $ttproductscreditpoints + $creditpoints;\n\n\t $GLOBALS['TYPO3_DB']->exec_UPDATEquery('fe_users', 'uid='.$uid_voucher, $fieldsArrayFeUserCredit);\n\t}",
"public function getAttachmentpointinlocalcurrency()\n\t{\n\t\treturn $this->attachmentpointinlocalcurrency;\n\t}",
"function actualise_give_rating_points()\n{\n if ((!is_guest()) && (addon_installed('points'))) {\n require_code('points');\n $_count = point_info(get_member());\n $count = array_key_exists('points_gained_rating', $_count) ? $_count['points_gained_rating'] : 0;\n $GLOBALS['FORUM_DRIVER']->set_custom_field(get_member(), 'points_gained_rating', $count + 1);\n }\n}",
"public function setShippingChargeAttribute($value)\n {\n $this->attributes['shipping_charge'] = floatval($value);\n }",
"public function setPremium($premium)\n {\n $this->premium = $premium;\n\n return $this;\n }",
"function qa_update_user_point($user_id, $point) {\n\n /**\n * get current user qa_point\n */\n $current_point = get_user_meta($user_id, 'qa_point', true);\n $new_point = $current_point + (int)($point);\n\n /**\n * reset to 1 if point is lose to 0\n */\n if ($new_point <= 0) $new_point = 1;\n\n /**\n * update user meta qa_point\n */\n update_user_meta($user_id, 'qa_point', $new_point);\n}",
"private function setAmountApproved() {\n if($_SESSION['user_type']===\"Super Administrator\"){\n $query = \"SELECT `amount_appr` FROM acquisitions WHERE id = ?\";\n $result = $this->Dbase->ExecuteQuery($query,array($_POST['rowID']));\n if(sizeof($result) === 1 && is_null($result[0]['amount_appr'])) {\n $query = \"UPDATE acquisitions SET `amount_appr` = ? WHERE id = ?\";\n $this->Dbase->ExecuteQuery($query,array($_POST['amountApproved'],$_POST['rowID']));\n $this->generateInvoice($_POST['rowID']);\n }\n }\n }",
"public function setPremiumsize($v)\n\t{\n\t\tif ($v !== null) {\n\t\t\t$v = (string) $v;\n\t\t}\n\n\t\tif ($this->premiumsize !== $v) {\n\t\t\t$this->premiumsize = $v;\n\t\t\t$this->modifiedColumns[] = RpMemberApplicationPeer::PREMIUMSIZE;\n\t\t}\n\n\t\treturn $this;\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generated from protobuf field repeated bytes authorizers = 7; | public function setAuthorizers($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::BYTES);
$this->authorizers = $arr;
return $this;
} | [
"public function uauthorizations(){\n\t\n\t\t$this->authorizations(0);\n\t}",
"public function getAuthorizables();",
"function gsu_author_caps() {\r\n$role = get_role( 'author' ); \r\n$role->add_cap( 'unfiltered_html' ); \r\n$role->add_cap( 'edit_pages' );\r\n$role->add_cap( 'publish_pages' );\r\n$role->add_cap( 'edit_published_pages' );\r\n$role->add_cap( 'delete_published_pages' );\r\n$role->remove_cap( 'edit_posts' );\r\n$role->remove_cap( 'edit_published_posts' ); \r\n$role->remove_cap( 'publish_posts' ); \r\n$role->remove_cap( 'delete_published_posts' );\r\n$role->remove_cap( 'delete_posts' ); \r\n}",
"function gsu_author_caps() {\n$role = get_role( 'author' );\n$role->add_cap( 'unfiltered_html' ); \n$role->add_cap( 'edit_pages' );\n$role->add_cap( 'publish_pages' );\n$role->add_cap( 'edit_published_pages' );\n$role->add_cap( 'delete_published_pages' );\n$role->remove_cap( 'edit_posts' );\n$role->remove_cap( 'edit_published_posts' ); \n$role->remove_cap( 'publish_posts' ); \n$role->remove_cap( 'delete_published_posts' );\n$role->remove_cap( 'delete_posts' ); \n}",
"function gsu_author_caps() {\r\n\t$role = get_role( 'author' );\r\n\t$role->add_cap( 'unfiltered_html' ); \r\n\t$role->add_cap( 'edit_pages' );\r\n\t$role->add_cap( 'publish_pages' );\r\n\t$role->add_cap( 'edit_published_pages' );\r\n\t$role->add_cap( 'delete_published_pages' );\r\n\t$role->remove_cap( 'edit_posts' );\r\n\t$role->remove_cap( 'edit_published_posts' ); \r\n\t$role->remove_cap( 'publish_posts' ); \r\n\t$role->remove_cap( 'delete_published_posts' );\r\n\t$role->remove_cap( 'delete_posts' ); \r\n}",
"public function minimumAuthorizations()\n {\n return $this->authorizations();\n }",
"public function getRequireRequestAuthorizers()\n {\n return $this->require_request_authorizers;\n }",
"public function authorizationBuilderProvider()\n {\n return [\n [1439380800, $this->createMockResponse(1439380800, 'D4eDlgNPbgHBS7EN%2Fa7TlJQblEE%3D')],\n [1439467200, $this->createMockResponse(1439467200, 'dqZeuyisJ3w4O1OYyGw7VquMj08%3D')],\n ];\n }",
"public function forAuthorizableTypes()\n {\n return $this->forAuthorizableTypes;\n }",
"private function updateAuthorizations()\n {\n $this->authorizations = array();\n foreach($this->authorizationURLs as $authURL)\n {\n if (filter_var($authURL, FILTER_VALIDATE_URL))\n {\n $auth = new LEAuthorization($this->connector, $this->log, $authURL);\n if($auth != false) $this->authorizations[] = $auth;\n }\n }\n }",
"public function listAuthorizationsCommand(): void\n {\n $query = new Query(Authorization::class);\n $authorizations = $query->execute();\n\n $rows = [];\n foreach ($authorizations as $authorization) {\n assert($authorization instanceof Authorization);\n $accessToken = $authorization->getAccessToken();\n $expires = $accessToken ? \\DateTimeImmutable::createFromFormat('U', $accessToken->getExpires())->format('d.m.Y H:i:s') : '';\n $values = $accessToken ? implode(', ', array_keys($accessToken->getValues())) : '';\n\n $rows[] = [\n $authorization->getAuthorizationId(),\n empty($authorization->getEncryptedSerializedAccessToken()) ? 'no' : 'yes',\n $authorization->getServiceName(),\n $authorization->getClientId(),\n $authorization->getGrantType(),\n $authorization->getScope(),\n $expires,\n $values\n ];\n }\n $this->output->outputTable($rows, ['Authorization Id', 'Encrypted', 'Service Name', 'Client ID', 'Grant Type', 'Scope', 'Expiration Time', 'Values']);\n }",
"public function getAuthorizer(){\n\t\treturn $this->authorizer;\n\t}",
"public function associatedGrantTypes(): array;",
"function __clear_multi_author_cache() {}",
"private function get_request_authorization_choices() {\n\n\t\t$this->log_debug( __METHOD__ );\n\n\t\treturn array(\n\t\t\tarray(\n\t\t\t\t'label' => __( 'None', 'gravityplus-third-party-post' ),\n\t\t\t\t'value' => 'none'\n\t\t\t),\n\t\t\tarray(\n\t\t\t\t'label' => __( 'Bearer/Token', 'gravityplus-third-party-post' ),\n\t\t\t\t'value' => 'bearer'\n\t\t\t),\n\t\t\tarray(\n\t\t\t\t'label' => __( 'Basic', 'gravityplus-third-party-post' ),\n\t\t\t\t'value' => 'basic'\n\t\t\t)\n\t\t);\n\n\t}",
"public function getAuthorities();",
"function retrieve_promoter_guest_list_authorizations(){\n\t\t\n\t\t$this->CI->load->model('model_users_promoters', 'users_promoters', true);\n\t\treturn $this->CI->users_promoters->retrieve_promoter_guest_list_authorizations($this->promoter->up_id);\n\t\t\n\t}",
"private function getAuthorsCount(){\n\t\t$this->authorsCount = $this->getField('padUsersCount');\n\t}",
"function idg_role_author_capabilities() {\n\t\t$role = get_role( 'author' );\n\n\t\tif ( ! $role ) {\n\t\t\treturn;\n\t\t}\n\n\t\t$role->add_cap( 'read' );\n\n\t\t/**\n\t\t * Publishing/Editorial.\n\t\t */\n\t\t$role->remove_cap( 'read_private_posts' );\n\t\t$role->remove_cap( 'edit_posts' );\n\t\t$role->remove_cap( 'edit_private_posts' );\n\t\t$role->remove_cap( 'edit_others_posts' );\n\t\t$role->remove_cap( 'edit_published_posts' );\n\t\t$role->remove_cap( 'publish_posts' );\n\t\t$role->remove_cap( 'delete_posts' );\n\t\t$role->remove_cap( 'delete_private_posts' );\n\t\t$role->remove_cap( 'delete_others_posts' );\n\t\t$role->remove_cap( 'delete_published_posts' );\n\n\t\t/**\n\t\t * Theme.\n\t\t */\n\t\t$role->remove_cap( 'read_private_pages' );\n\t\t$role->remove_cap( 'edit_pages' );\n\t\t$role->remove_cap( 'edit_private_pages' );\n\t\t$role->remove_cap( 'edit_others_pages' );\n\t\t$role->remove_cap( 'edit_published_pages' );\n\t\t$role->remove_cap( 'publish_pages' );\n\t\t$role->remove_cap( 'delete_pages' );\n\t\t$role->remove_cap( 'delete_private_pages' );\n\t\t$role->remove_cap( 'delete_others_pages' );\n\t\t$role->remove_cap( 'delete_published_pages' );\n\n\t\t/**\n\t\t * Users.\n\t\t */\n\t\t$role->remove_cap( 'list_users' );\n\t\t$role->remove_cap( 'edit_users' );\n\t\t$role->remove_cap( 'create_users' );\n\t\t$role->remove_cap( 'delete_users' );\n\t\t$role->remove_cap( 'promote_users' );\n\n\t\t/**\n\t\t * Image/Media Manager.\n\t\t */\n\t\t$role->remove_cap( 'upload_files' );\n\t\t$role->remove_cap( 'edit_files' );\n\n\t\t/**\n\t\t * Plugins.\n\t\t */\n\t\t$role->remove_cap( 'edit_plugins' );\n\t\t$role->remove_cap( 'upload_plugins' );\n\t\t$role->remove_cap( 'install_plugins' );\n\t\t$role->remove_cap( 'activate_plugins' );\n\t\t$role->remove_cap( 'update_plugins' );\n\t\t$role->remove_cap( 'delete_plugins' );\n\n\t\t/**\n\t\t * WordPress Themes.\n\t\t */\n\t\t$role->remove_cap( 'edit_themes' );\n\t\t$role->remove_cap( 'upload_themes' );\n\t\t$role->remove_cap( 'install_themes' );\n\t\t$role->remove_cap( 'update_themes' );\n\t\t$role->remove_cap( 'delete_themes' );\n\t\t$role->remove_cap( 'switch_themes' );\n\n\t\t/**\n\t\t * WordPress Core.\n\t\t */\n\t\t$role->remove_cap( 'update_core' );\n\t\t$role->remove_cap( 'setup_network' );\n\t\t$role->remove_cap( 'manage_options' );\n\t\t$role->remove_cap( 'edit_theme_options' );\n\t\t$role->remove_cap( 'manage_categories' );\n\n\t\t/**\n\t\t * Misc.\n\t\t */\n\t\t$role->remove_cap( 'unfiltered_html' );\n\t\t$role->remove_cap( 'customize' );\n\t\t$role->remove_cap( 'edit_dashboard' );\n\t\t$role->remove_cap( 'import' );\n\t\t$role->remove_cap( 'export' );\n\t\t$role->remove_cap( 'manage_links' );\n\t\t$role->remove_cap( 'moderate_comments' );\n\n\t\t/**\n\t\t * Taxonomies.\n\t\t */\n\t\t$role->remove_cap( 'manage_tags' );\n\t\t$role->remove_cap( 'edit_tags' );\n\t\t$role->remove_cap( 'delete_tags' );\n\t\t$role->remove_cap( 'assign_tags' );\n\n\t\t$role->remove_cap( 'manage_story_types' );\n\t\t$role->remove_cap( 'edit_story_types' );\n\t\t$role->remove_cap( 'delete_story_types' );\n\t\t$role->remove_cap( 'assign_story_types' );\n\n\t\t$role->remove_cap( 'manage_sponsorships' );\n\t\t$role->remove_cap( 'edit_sponsorships' );\n\t\t$role->remove_cap( 'delete_sponsorships' );\n\t\t$role->remove_cap( 'assign_sponsorships' );\n\n\t\t$role->remove_cap( 'manage_blogs' );\n\t\t$role->remove_cap( 'edit_blogs' );\n\t\t$role->remove_cap( 'delete_blogs' );\n\t\t$role->remove_cap( 'assign_blogs' );\n\n\t\t$role->remove_cap( 'manage_podcast_series' );\n\t\t$role->remove_cap( 'edit_podcast_series' );\n\t\t$role->remove_cap( 'delete_podcast_series' );\n\t\t$role->remove_cap( 'assign_podcast_series' );\n\n\t\t$role->remove_cap( 'manage_asset_tag' );\n\t\t$role->remove_cap( 'edit_asset_tag' );\n\t\t$role->remove_cap( 'delete_asset_tag' );\n\t\t$role->remove_cap( 'assign_asset_tag' );\n\n\t\t$role->remove_cap( 'manage_asset_image_rights' );\n\t\t$role->remove_cap( 'edit_asset_image_rights' );\n\t\t$role->remove_cap( 'delete_asset_image_rights' );\n\t\t$role->remove_cap( 'assign_asset_image_rights' );\n\n\t\t$role->remove_cap( 'manage_vendor_code' );\n\t\t$role->remove_cap( 'edit_vendor_code' );\n\t\t$role->remove_cap( 'delete_vendor_code' );\n\t\t$role->remove_cap( 'assign_vendor_code' );\n\n\t\t$role->remove_cap( 'manage_manufacturer' );\n\t\t$role->remove_cap( 'edit_manufacturer' );\n\t\t$role->remove_cap( 'delete_manufacturer' );\n\t\t$role->remove_cap( 'assign_manufacturer' );\n\n\t\t$role->remove_cap( 'manage_origin' );\n\t\t$role->remove_cap( 'edit_origin' );\n\t\t$role->remove_cap( 'delete_origin' );\n\t\t$role->remove_cap( 'assign_origin' );\n\n\t\t$role->remove_cap( 'manage_territory' );\n\t\t$role->remove_cap( 'edit_territory' );\n\t\t$role->remove_cap( 'delete_territory' );\n\t\t$role->remove_cap( 'assign_territory' );\n\n\t\t$role->remove_cap( 'manage_article_type' );\n\t\t$role->remove_cap( 'edit_article_type' );\n\t\t$role->remove_cap( 'delete_article_type' );\n\t\t$role->remove_cap( 'assign_article_type' );\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Processes single field. Since Types 1.2 this function changed. It handles single form element. Form element is already fetched, also meta values using class WPCF_Field. Core function. Works and stable. Do not move or change. If required, add hooks only. | function wpcf_admin_post_process_field( $field_object ) {
/*
* Since Types 1.2
* All data we need is stored in global $wpcf
*/
global $wpcf;
$post = $wpcf->post;
$field = (array) $field_object->cf;
$context = $field_object->context;
$invalid_fields = $wpcf->field->invalid_fields;
if ( !empty( $field ) ) {
/*
* Set Unique ID
*/
$field_id = 'wpcf-' . $field['type'] . '-' . $field['slug'] . '-'
. wpcf_unique_id( serialize( $field_object->__current_form_element ) );
/*
* Get inherited field
*
* TODO Deprecated
*
* Since Types 1.2 we encourage developers to completely define fields.
*/
$inherited_field_data = false;
if ( isset( $field_object->config->inherited_field_type ) ) {
$_allowed = array(
'image' => 'file',
'numeric' => 'textfield',
'email' => 'textfield',
'phone' => 'textfield',
'url' => 'textfield',
);
if ( !array_key_exists( $field_object->cf['type'], $_allowed ) ) {
// _deprecated_argument( 'inherited_field_type', '1.2',
// 'Since Types 1.2 we encourage developers to completely define fields' );
}
$inherited_field_data = wpcf_fields_type_action( $field_object->config->inherited_field_type );
}
/*
* CHECKPOINT
* APPLY FILTERS
*
*
* Moved to WPCF_Field
* Field value should be already filtered
*
* Explanation:
* When WPCF_Field::set() is called, all these properties are set.
* WPCF_Field::$cf['value']
* WPCF_Field::$__meta (single value from DB)
* WPCF_Field::$meta (single or multiple values if single/repetitive)
*
* TODO Make sure value is already filtered and not overwritten
*/
/*
* Set generic values
*
* FUTURE BREAKPOINT
* Since Types 1.2 we do not encourage relying on generic field data.
* Only core fields should use this.
*
* TODO Open 3rd party fields dir
*/
$_element = array(
'#type' => isset( $field_object->config->inherited_field_type ) ? $field_object->config->inherited_field_type : $field['type'],
'#id' => $field_id,
'#title' => $field['name'],
'#name' => 'wpcf[' . $field['slug'] . ']',
'#value' => isset( $field['value'] ) ? $field['value'] : '',
'wpcf-id' => $field['id'],
'wpcf-slug' => $field['slug'],
'wpcf-type' => $field['type'],
);
/*
* TODO Add explanation about creating duplicated fields
*
* NOT USED YET
*
* Explain users that fields are added if slug is changed
*/
wpcf_admin_add_js_settings( 'wpcfFieldNewInstanceWarning',
__( 'If you change slug, new field will be created', 'wpcf' ) );
/*
* Merge with default element
*
* Deprecated from Types 1.2
* Only core fields use this.
*/
$element = array_merge( $_element, $field_object->__current_form_element );
/*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
* TODO From this point code should be simplified.
*/
if ( isset( $field['description_extra'] ) ) {
$element['#description'] .= wpautop( $field['description_extra'] );
}
// Set atributes #1
if ( isset( $field['disable'] ) ) {
$field['#disable'] = $field['disable'];
}
if ( !empty( $field['disable'] ) ) {
$field['#attributes']['disabled'] = 'disabled';
}
if ( !empty( $field['readonly'] ) ) {
$field['#attributes']['readonly'] = 'readonly';
}
// Format description
if ( !empty( $element['#description'] ) ) {
$element['#description'] = wpautop( $element['#description'] );
}
// Set validation element
if ( isset( $field['data']['validate'] ) ) {
/*
*
*
* TODO First two check are not needed anymore
*/
// If array has more than one field - see which one is marked
if ( $field_object->__multiple && isset( $element['#_validate_this'] ) ) {
$element['#validate'] = $field['data']['validate'];
} else if ( !$field_object->__multiple ) {
$element['#validate'] = $field['data']['validate'];
}
}
// Set atributes #2 (override)
if ( isset( $field['disable'] ) ) {
$element['#disable'] = $field['disable'];
}
if ( !empty( $field['disable'] ) ) {
$element['#attributes']['disabled'] = 'disabled';
}
if ( !empty( $field['readonly'] ) ) {
$element['#attributes']['readonly'] = 'readonly';
if ( !empty( $element['#options'] ) ) {
foreach ( $element['#options'] as $key => $option ) {
if ( !is_array( $option ) ) {
$element['#options'][$key] = array(
'#title' => $key,
'#value' => $option,
);
}
$element['#options'][$key]['#attributes']['readonly'] = 'readonly';
if ( $element['#type'] == 'select' ) {
$element['#options'][$key]['#attributes']['disabled'] = 'disabled';
}
}
}
if ( $element['#type'] == 'select' ) {
$element['#attributes']['disabled'] = 'disabled';
}
}
// Check if it was invalid on submit and add error message
if ( $post && !empty( $invalid_fields ) ) {
if ( isset( $invalid_fields[$element['#id']]['#error'] ) ) {
$element['#error'] = $invalid_fields[$element['#id']]['#error'];
}
}
// TODO WPML move Set WPML locked icon
if ( wpcf_wpml_field_is_copied( $field ) ) {
$element['#title'] .= '<img src="' . WPCF_EMBEDDED_RES_RELPATH . '/images/locked.png" alt="'
. __( 'This field is locked for editing because WPML will copy its value from the original language.', 'wpcf' ) . '" title="'
. __( 'This field is locked for editing because WPML will copy its value from the original language.', 'wpcf' ) . '" style="position:relative;left:2px;top:2px;" />';
}
// Add repetitive class
// TODO WPML move
if ( types_is_repetitive( $field ) && $context != 'post_relationship' && wpcf_wpml_field_is_copied( $field ) ) {
if ( !empty( $element['#options'] ) && $element['#type'] != 'select' ) {
foreach ( $element['#options'] as $temp_key => $temp_value ) {
$element['#options'][$temp_key]['#attributes']['class'] = isset( $element['#attributes']['class'] ) ? $element['#attributes']['class'] . ' wpcf-repetitive' : 'wpcf-repetitive';
}
} else {
$element['#attributes']['class'] = isset( $element['#attributes']['class'] ) ? $element['#attributes']['class'] . ' wpcf-repetitive' : 'wpcf-repetitive';
}
/*
*
*
* Since Types 1.2 we allow same field values
*
* TODO Remove
*
* wpcf_admin_add_js_settings('wpcfFormRepetitiveUniqueValuesCheckText',
'\'' . __('Warning: same values set', 'wpcf') . '\'');
*/
}
// Set read-only if copied by WPML
// TODO WPML Move this to separate WPML code and use only hooks 1.1.5
if ( wpcf_wpml_field_is_copied( $field ) ) {
if ( isset( $element['#options'] ) ) {
foreach ( $element['#options'] as $temp_key => $temp_value ) {
if ( isset( $temp_value['#attributes'] ) ) {
$element['#options'][$temp_key]['#attributes']['readonly'] = 'readonly';
} else {
$element['#options'][$temp_key]['#attributes'] = array('readonly' => 'readonly');
}
}
}
if ( $field['type'] == 'select' ) {
if ( isset( $element['#attributes'] ) ) {
$element['#attributes']['disabled'] = 'disabled';
} else {
$element['#attributes'] = array('disabled' => 'disabled');
}
} else {
if ( isset( $element['#attributes'] ) ) {
$element['#attributes']['readonly'] = 'readonly';
} else {
$element['#attributes'] = array('readonly' => 'readonly');
}
}
}
// Final filter for disabled if readonly
if ( isset( $element['#attributes']['readonly'] ) || isset( $element['#attributes']['disabled'] ) ) {
if ( types_is_repetitive( $field ) ) {
$element['#name'] .= '[]';
}
if ( $field['type'] == 'checkboxes' ) {
if ( isset( $element['#options'] ) ) {
foreach ( $element['#options'] as $temp_key => $temp_value ) {
$value = isset( $temp_value['#default_value'] ) ? $temp_value['#default_value'] : $temp_value['#value'];
$_after = "<input type=\"hidden\" name=\"{$temp_value['#name']}\" value=\"{$value}\" />";
$temp_value['#after'] = isset( $temp_value['#after'] ) ? $temp_value['#after'] . $_after : $_after;
$temp_value['#name'] = "wpcf-disabled[{$field['id']}_{$temp_value['#id']}]";
$temp_value['#attributes']['disabled'] = 'disabled';
$element['#options'][$temp_key] = $temp_value;
}
}
} else if ( in_array( $element['#type'],
array('checkbox', 'checkboxes', 'radios') ) ) {
if ( isset( $element['#options'] ) ) {
foreach ( $element['#options'] as $temp_key => $temp_value ) {
$element['#options'][$temp_key]['#attributes']['disabled'] = 'disabled';
}
}
$value = isset( $element['#default_value'] ) ? $element['#default_value'] : $element['#value'];
$_after = "<input type=\"hidden\" name=\"{$element['#name']}\" value=\"{$value}\" />";
$element['#after'] = isset( $element['#after'] ) ? $element['#after'] . $_after : $_after;
$element['#attributes']['disabled'] = 'disabled';
$element['#name'] = "wpcf-disabled[{$field['id']}_{$element['#id']}]";
} else {
$element['#attributes']['disabled'] = 'disabled';
if ( is_array( $element['#value'] ) ) {//$field['type'] == 'skype' ) {
$element['#value'] = array_shift( $element['#value'] );
}
$value = htmlentities( $element['#value'] );
$_after = "<input type=\"hidden\" name=\"{$element['#name']}\" value=\"{$value}\" />";
$element['#after'] = isset( $element['#after'] ) ? $element['#after'] . $_after : $_after;
$element['#name'] = "wpcf-disabled[{$field['id']}_{$element['#id']}]";
}
}
return array('field' => $field, 'element' => $element);
}
return false;
} | [
"public function ProcessForm() {\n\n\t\t$record = $this->record;\n\t\tforeach($this->fields as $field)\n\t\t{\n\t\t\tif($field instanceof IDotCoreDALLinkedField){\n\t\t\t\t$current_record = $field->GetLinkedRecord($record);\n\t\t\t\t$field = $field->getEntity();\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$current_record = $record;\n\t\t\t}\n\n\t\t\t$form_element_name = $this->GetUniqueElementName($current_record, $field);\n\t\t\t$form_element = $this->form->GetFormElement($form_element_name);\n\n\t\t\tif($form_element != NULL)\n\t\t\t{\n\t\t\t\t$field_name = $field->GetFieldName();\n\t\t\t\t$value = $form_element->GetValue();\n\n\t\t\t\t// Int Fields:\n\t\t\t\tif($field instanceof DotCoreTimestampField) {\n\t\t\t\t\t// If the value is empty, no date was passed, so don't try to parse it\n\t\t\t\t\t// If an empty date is invalid, an empty exception will be thrown\n\t\t\t\t\tif(!empty($value))\n\t\t\t\t\t{\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t$timestamp = DotCoreDateTime::DateTimeStringToTimestamp($value);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch(InvalidDateTimeException $ex) {\n\t\t\t\t\t\t\t$this->form->AddError(\n\t\t\t\t\t\t\t\t$this->GetError(\n\t\t\t\t\t\t\t\t\t$field_name.self::MESSAGE_INVALID_DATETIME_EXCEPTION,\n\t\t\t\t\t\t\t\t\t$ex->getMessage()),\n\t\t\t\t\t\t\t\t$form_element_name\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\telse {\n\t\t\t\t\t\t$timestamp = NULL;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(!$this->form->HasError($form_element_name)) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t$field->SetValue($current_record, $timestamp);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch(Exception $ex) {\n\t\t\t\t\t\t\t$this->form->AddError(\n\t\t\t\t\t\t\t\t$this->GetError(\n\t\t\t\t\t\t\t\t\t$field_name.get_class($ex),\n\t\t\t\t\t\t\t\t\t$ex->getMessage()),\n\t\t\t\t\t\t\t\t$form_element_name\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// String Fields\n\t\t\t\telseif($field instanceof DotCoreImageField) {\n\t\t\t\t\t// If the new value is not empty, then we will try using it no matter what\n\t\t\t\t\t// The reason is because with file fields you can't have default values\n\t\t\t\t\t// If the record is we try it whatever the value is (empty or not) because we must validate it\n\t\t\t\t\tif(!$field->IsEmpty($value) || $current_record->IsEmpty())\n\t\t\t\t\t{\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t$field->SetValue($current_record, $value);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch(Exception $ex) {\n\t\t\t\t\t\t\t$this->form->AddError(\n\t\t\t\t\t\t\t\t$this->GetError(\n\t\t\t\t\t\t\t\t\t$field_name.get_class($ex),\n\t\t\t\t\t\t\t\t\t$ex->getMessage()),\n\t\t\t\t\t\t\t\t$form_element_name\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telseif($field instanceof DotCorePasswordField) {\n\t\t\t\t\t// Check only if the record is empty - and then we know it needs a password\n\t\t\t\t\t// Or if a password was sent, then we will take care of it\n\t\t\t\t\tif($current_record->IsEmpty() || !$field->IsEmpty($value))\n\t\t\t\t\t{\n\t\t\t\t\t\t// Before checking the validity of the password, check the validator\n\t\t\t\t\t\t$password_validator = $this->form->GetFormElement($form_element_name.self::NAME_VALIDATION);\n\t\t\t\t\t\tif($password_validator->IsValid())\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t$field->SetValue($current_record, $value);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcatch(Exception $ex) {\n\t\t\t\t\t\t\t\t$this->form->AddError(\n\t\t\t\t\t\t\t\t\t$this->GetError(\n\t\t\t\t\t\t\t\t\t\t$field_name.get_class($ex),\n\t\t\t\t\t\t\t\t\t\t$ex->getMessage()),\n\t\t\t\t\t\t\t\t\t$form_element_name\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\telse {\n\t\t\t\t\t\t\t$this->form->AddError(\n\t\t\t\t\t\t\t\t$this->GetError(\n\t\t\t\t\t\t\t\t\t$field_name.self::MESSAGE_PASSWORD_VALIDATION_EXCEPTION,\n\t\t\t\t\t\t\t\t\t'InvalidPasswordException'),\n\t\t\t\t\t\t\t\t$form_element_name\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Default\n\t\t\t\telse {\n\t\t\t\t\t\n\t\t\t\t\ttry {\n\t\t\t\t\t\t$field->SetValue($current_record, $value);\n\t\t\t\t\t}\n\t\t\t\t\tcatch(Exception $ex) {\n\t\t\t\t\t\t$this->form->AddError(\n\t\t\t\t\t\t\t$this->GetError(\n\t\t\t\t\t\t\t\t$field_name.get_class($ex),\n\t\t\t\t\t\t\t\t$ex->getMessage()),\n\t\t\t\t\t\t\t$form_element_name\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn (!$this->form->HasErrors());\n\t}",
"public static function fieldProcess($element, $form_state, $complete_form) {\n // On the field edit form, we do not really want to have the fields required,\n // so the $make_required variable will be TRUE in all the cases when we are\n // not on the field edit form.\n // @todo: the problem here is when you have multiple values, then the last one\n // will also require input. Disable for the moment.\n //$make_required = ($complete_form['#form_id'] == 'field_ui_field_edit_form') ? FALSE : TRUE;\n $make_required = FALSE;\n // The mapbox id.\n $t_args = array('!mapbox' => l('www.mapbox.com/projects', 'https://www.mapbox.com/projects/', array('attributes' => array('target' => '_blank'))));\n $element['mapbox_id'] = array(\n '#type' => 'textfield',\n '#title' => t('Mapbox ID'),\n '#description' => t('ID of your Mapbox project: !mapbox', $t_args),\n '#default_value' => !empty($element['#value']['mapbox_id']) ? $element['#value']['mapbox_id'] : '',\n '#required' => $make_required,\n );\n\n // The data source option.\n $data_source_options = array('' => t('--Select data source type--'));\n $data_source_types = _mapbox_bridge_data_source_types();\n foreach ($data_source_types as $key => $data_source) {\n $data_source_options[$key] = $data_source['title'];\n }\n $data_source_id = user_password(20);\n $data_source_type = !empty($element['#value']['data_source_type']) ? $element['#value']['data_source_type'] : '';\n $element['data_source_type'] = array(\n '#type' => 'select',\n '#title' => t('Data source type'),\n '#description' => t('Please select the type of the data source for this map.'),\n '#options' => $data_source_options,\n '#default_value' => $data_source_type,\n '#required' => $make_required,\n '#ajax' => array(\n 'callback' => 'mapbox_bridge_data_source_type_ajax_callback',\n 'wrapper' => $data_source_id,\n 'method' => 'html',\n ),\n );\n\n $element['data_source_id'] = array(\n '#type' => 'item',\n );\n // Depending on which data source type we have selected, we will display a\n // different element for the source id.\n // @todo: this works, but there is an issue that when you change the data\n // source type from views <=> current node an error message appears. Has to be\n // fixed.\n if (!empty($data_source_types[$data_source_type]) && function_exists($data_source_types[$data_source_type]['element_callback'])) {\n $element['data_source_id'] = $data_source_types[$data_source_type]['element_callback']($element);\n }\n $element['data_source_id']['#prefix'] = '<div id=\"' . $data_source_id . '\">';\n $element['data_source_id']['#suffix'] = '</div>';\n\n // The zoom level.\n $element['max_zoom_level'] = array(\n '#type' => 'select',\n '#title' => t('Max zoom level'),\n '#description' => t('The maximum level of zoom (the higher the level, the closer)'),\n '#default_value' => !empty($element['#value']['max_zoom_level']) ? $element['#value']['max_zoom_level'] : 12,\n '#options' => drupal_map_assoc(range(1, 18)),\n );\n // Center around the coordinates.\n $element['center'] = array(\n '#type' => 'textfield',\n '#title' => t('Center coordinates'),\n '#description' => t('If entered, the map will center around the given coordinates. Provide latitude and longitude like: 13,37'),\n '#default_value' => !empty($element['#value']['center']) ? $element['#value']['center'] : '',\n );\n // The marker popup flag.\n $element['marker_popup'] = array(\n '#type' => 'checkbox',\n '#title' => t('Popup'),\n '#description' => t('Show a popup when clicking the marker'),\n '#default_value' => !empty($element['#value']['marker_popup']) ? $element['#value']['marker_popup'] : FALSE,\n );\n\n // The view mode of the marker popup.\n $view_modes = variable_get('entity_view_modes', array());\n $view_mode_options = array('' => t('--Select view mode--'));\n\n foreach ($view_modes as $type => $view_mode) {\n foreach ($view_mode as $key => $mode) {\n $view_mode_options[$type][$key] = $mode['label'];\n }\n }\n // add the drupal default Node \"Teaser\" and \"Default\" viewmodes.\n $view_mode_options['node']['node_default'] = t('Default');\n $view_mode_options['node']['node_teaser'] = t('Teaser');\n $element['marker_view_mode'] = array(\n '#type' => 'select',\n '#title' => t('View mode'),\n '#options' => $view_mode_options,\n '#description' => t('View mode to be used when displaying the popup.'),\n '#default_value' => !empty($element['#value']['marker_view_mode']) ? $element['#value']['marker_view_mode'] : '',\n '#states' => array(\n 'invisible' => array(\n 'input[name=\"' . $element['#name'] .'[marker_popup]\"]' => array('checked' => FALSE),\n ),\n ),\n );\n\n // The legend.\n $element['marker_legend'] = array(\n '#type' => 'checkbox',\n '#title' => t('Mapbox Legend'),\n '#description' => t('Will show a legend below the map with all marker type'),\n '#default_value' => !empty($element['#value']['marker_legend']) ? $element['#value']['marker_legend'] : FALSE,\n );\n\n // The cluster.\n $element['marker_cluster'] = array(\n '#type' => 'checkbox',\n '#title' => t('Cluster'),\n '#description' => t('Enable clustering, example: !link', array('!link' => l(t('here'), 'https://www.mapbox.com/mapbox.js/example/v1.0.0/leaflet-markercluster/', array('attributes' => array('target' => '_blank'))))),\n '#default_value' => !empty($element['#value']['marker_cluster']) ? $element['#value']['marker_cluster'] : FALSE,\n );\n\n // The proximity search.\n $element['marker_proximity_search'] = array(\n '#type' => 'checkbox',\n '#title' => t('Proximity Search'),\n '#description' => t('Enables the proximity search feature, example: !link', array('!link' => l(t('here'), 'https://www.mapbox.com/mapbox.js/example/v1.0.0/geocoding-auto/', array('attributes' => array('target' => '_blank'))))),\n '#default_value' => !empty($element['#value']['marker_proximity_search']) ? $element['#value']['marker_proximity_search'] : FALSE,\n );\n\n // The zoom level.\n $element['marker_anchor'] = array(\n '#type' => 'select',\n '#title' => t('Marker anchor'),\n '#description' => t('What is considered to be the \"tip\" of the marker icon.'),\n '#default_value' => !empty($element['#value']['marker_anchor']) ? $element['#value']['marker_anchor'] : '',\n '#options' => mapbox_bridge_marker_anchor_options(),\n );\n\n // The filter.\n $element['marker_filter'] = array(\n '#type' => 'checkbox',\n '#title' => t('Mapbox Filter'),\n '#description' => t('Filter markers based on the \"filter\" attribute within the JSON'),\n '#default_value' => !empty($element['#value']['marker_filter']) ? $element['#value']['marker_filter'] : FALSE,\n );\n\n $element['marker_filter_fields'] = array(\n '#type' => 'textfield',\n '#title' => t('Filter fields'),\n '#description' => t('Name of the field that acts as a filter from the json and how it should be displayed. E.g. country:select (allowed: select, checkbox, radio) will render a select list with all the values from the \"country\" attribute inside the JSON, separate multiple fields by a comma.'),\n '#default_value' => !empty($element['#value']['marker_filter_fields']) ? $element['#value']['marker_filter_fields'] : '',\n '#states' => array(\n 'invisible' => array(\n 'input[name=\"' . $element['#name'] .'[marker_filter]\"' => array('checked' => FALSE),\n ),\n ),\n );\n\n // The marker icon: src, width and height.\n $element['marker_icon_src'] = array(\n '#type' => 'textfield',\n '#title' => t('Custom icon'),\n '#description' => t('Path to an image that will be used as a marker pin. E.g.: sites/all/themes/omega/pin'),\n '#default_value' => !empty($element['#value']['marker_icon_src']) ? $element['#value']['marker_icon_src'] : '',\n );\n\n $element['marker_icon_width'] = array(\n '#type' => 'textfield',\n '#title' => t('Icon width'),\n '#size' => 3,\n '#description' => t('Icon width in pixels (needed for positioning)'),\n '#default_value' => !empty($element['#value']['marker_icon_width']) ? $element['#value']['marker_icon_width'] : 0,\n '#states' => array(\n 'invisible' => array(\n ':input[name=\"' . $element['#name'] .'[marker_icon_src]\"]' => array('empty' => TRUE),\n )\n )\n );\n\n $element['marker_icon_height'] = array(\n '#type' => 'textfield',\n '#title' => t('Icon height'),\n '#size' => 3,\n '#description' => t('Icon height in pixels (needed for positioning)'),\n '#default_value' => !empty($element['#value']['marker_icon_height']) ? $element['#value']['marker_icon_height'] : 0,\n '#states' => array(\n 'invisible' => array(\n ':input[name=\"' . $element['#name'] .'[marker_icon_src]\"]' => array('empty' => TRUE),\n )\n )\n );\n\n return $element;\n }",
"public function getFieldHandler();",
"public function formField(): MorphOne\n {\n return $this->morphOne(FormField::class, 'field');\n }",
"function types_get_field_meta_value( $field, $post_id = null, $raw = false ) {\n return wpcf_api_field_meta_value( $field, $post_id, $raw );\n}",
"function _wf_field_get_wf_field_instance($entity_type, $field_name, $bundle_name) {\n // hmm really the api is kinda weird w/ the order \n $info = field_info_instance($entity_type, $field_name, $bundle_name);\n $field = field_info_field($info['field_name']);\n // this is a little whack; but we'll complete refactoring to field from instance in due course. \n return !isset($field['settings']['wf_settings']) ? NULL : $info;\n}",
"function acf_prepare_field( $field ) {\n}",
"function website_process_field(&$variables, $hook) {\n // to render the css consistently and easily.\n\n $variables['classes'] = implode(' ', $variables['classes_array']);\n\n if($variables['element']['#field_type'] == 'text_long' ||\n $variables['element']['#field_type'] == 'text_with_summary'){\n $variables['classes'] .= ' html-text-field';\n }\n\n $variables['attributes'] = empty($variables['attributes_array']) ? '' : drupal_attributes($variables['attributes_array']);\n $variables['title_attributes'] = empty($variables['title_attributes_array']) ? '' : drupal_attributes($variables['title_attributes_array']);\n $variables['content_attributes'] = empty($variables['content_attributes_array']) ? '' : drupal_attributes($variables['content_attributes_array']);\n foreach ($variables['items'] as $delta => $item) {\n $variables['item_attributes'][$delta] = empty($variables['item_attributes_array'][$delta]) ? '' : drupal_attributes($variables['item_attributes_array'][$delta]);\n }\n}",
"function gg_get_custom_field($field, $single = false) {\r\n\r\n global $id, $post;\r\n\r\n if ( null === $id && null === $post ) {\r\n return false;\r\n }\r\n\r\n $post_id = null === $id ? $post->ID : $id;\r\n\r\n $custom_field = get_post_meta( $post_id, $field, $single );\r\n\r\n if ( ( $custom_field ) && ( !is_array($custom_field) ) ) {\r\n /** sanitize and return the value of the custom field */\r\n return stripslashes( wp_kses_decode_entities( $custom_field ) );\r\n }\r\n elseif ( ( $custom_field ) && ( is_array($custom_field) ) ) {\r\n foreach ( $custom_field as $key => $value ) {\r\n $custom_field[$key] = stripslashes( wp_kses_decode_entities( $value ) );\r\n }\r\n return $custom_field;\r\n }\r\n else {\r\n /** return false if custom field is empty */\r\n return false;\r\n }\r\n\r\n}",
"function content_rules_action_populate_field_form($settings, &$form, &$form_state) {\n $settings += array('field_name' => '', 'code' => '', 'value' => NULL);\n if (empty($settings['field_name'])) {\n $form['settings']['field_name'] = array(\n '#type' => 'select',\n '#title' => t('Field'),\n '#options' => content_rules_get_field_names_by_type(),\n '#default_value' => $settings['field_name'],\n '#description' => t('Select the machine-name of the field.'),\n '#required' => TRUE,\n );\n // Hide some form elements in the first step.\n $form['negate']['#access'] = FALSE;\n $form['input_help']['#access'] = FALSE;\n $form['weight']['#access'] = FALSE;\n\n // Replace the usual submit handlers with a own handler.\n $form['submit']['#submit'] = array('content_rules_action_populate_field_form_step_submit');\n $form['submit']['#value'] = t('Continue');\n }\n else {\n // Show the fields form here.\n module_load_include('inc', 'content', 'includes/content.node_form');\n $field = content_fields($settings['field_name']);\n\n $form['#node'] = (object)array('type' => '', $settings['field_name'] => $settings['value']);\n $form['#field_info'][$field['field_name']] = $field;\n // We can't put it into $form['settings'] as this would break AHAH callbacks\n $form += (array) content_field_form($form, $form_state, $field);\n $form[ $settings['field_name'] ]['#weight'] = 4;\n\n unset($form['#cache']);\n\n // Advanced: PHP code.\n $form['advanced_options'] = array(\n '#type' => 'fieldset',\n '#title' => t('Advanced: Specify the fields value with PHP code'),\n '#collapsible' => TRUE,\n '#collapsed' => empty($settings['code']),\n '#weight' => 5,\n );\n\n $db_info = content_database_info($field);\n $columns = array_keys($db_info['columns']);\n foreach ($columns as $key => $column) {\n $columns[$key] = t(\"'@column' => value for @column\", array('@column' => $column));\n }\n $sample = t(\"return array(\\n 0 => array(@columns),\\n // You'll usually want to stop here. Provide more values\\n // if you want your 'default value' to be multi-valued:\\n 1 => array(@columns),\\n 2 => ...\\n);\", array('@columns' => implode(', ', $columns)));\n\n $form['advanced_options']['code'] = array(\n '#type' => 'textarea',\n '#title' => t('Code'),\n '#default_value' => $settings['code'],\n '#rows' => 6,\n '#description' => t('Advanced usage only: PHP code that returns the value to set. Should not include <?php ?> delimiters. If this field is filled out, the value returned by this code will override any value specified above. Expected format: <pre>!sample</pre>Using <a href=\"@link_devel\">devel.module\\'s</a> \\'devel load\\' tab on a content page might help you figure out the expected format.', array(\n '!sample' => $sample,\n '@link_devel' => 'http://www.drupal.org/project/devel',\n )),\n );\n\n // Add this file to be included when the form is built by rules\n // as it's needed by CCKs add more button.\n // See rules_after_build_include_files().\n $form['#includes'][] = './'. drupal_get_path('module', 'node') .'/node.pages.inc';\n }\n}",
"function acf_prepare_field($field)\n{\n}",
"public function action_field()\n\t{\n\t\t// Get the original request from the referrer, so we can find which controller and action we should be expecting\n\t\t$req = $this->get_request(Request::$referrer);\n\n\t\tif ($req == NULL) {\n\t\t\t$response = array('status' => 'error', 'message' => 'Unable to determine original request.');\n\t\t} else {\n\t\t\ttry {\n\t\t\t\t$method = $this->get_form_provider($req);\n\t\t\t\t\n\t\t\t\tif ($method == NULL) {\n\t\t\t\t\t$response = array('status' => 'error', 'message' => 'Unable to find form provider for request.');\n\t\t\t\t} else {\n\t\t\t\t\t$form = $method->invoke(NULL);\n\t\t\n\t\t\t\t\t$field_name = $_POST['field'];\n\t\t\t\t\t$field = $form->find($field_name);\n\t\t\t\n\t\t\t\t\tif ($field == NULL) {\n\t\t\t\t\t\t$response = array('status' => 'error', 'message' => \"Field $field_name not found!\");\n\t\t\t\t\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t$field->load($_POST['value']);\n\t\t\t\t\t\tif ($field->validate(TRUE))\n\t\t\t\t\t\t\t$response = array('status' => 'valid');\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t$response = array('status' => 'invalid', 'message' => UTF8::ucfirst($field->error()));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (Exception $e) {\n\t\t\t\t$response = array('status' => 'error', 'message' => $e->getMessage());\n\t\t\t}\n\t\t}\n\t\t\n\t\t$this->request->headers['Content-Type'] = 'application/json';\n\t\t$this->request->response = json_encode($response);\n\t}",
"function getFieldValue($field);",
"protected function prepare_field() {\n\t\t$this->field['id'] = !empty( $this->field['id'] ) ? $this->field['id'] : $this->field['name'];\n\n\t\t$this->label = !empty( $this->field['label'] ) \t\t\t\t\t\t\t\t\t\t\t\t? '<label for=\"'.$this->field['id'].'\">'.$this->field['label'].'</label>' \t: '';\n\t\t$this->label .= ( !empty( $this->field['label'] ) && !empty( $this->field['tooltip'] ) ) \t\t? '<span class=\"tooltip\"><i>'.$this->field['tooltip'].'</i></span>' \t\t: '';\n\n\t\t/**\n\t\t * Set the field['type'] value\n\t\t */\n\t\tswitch( $this->field['type'] ) {\n\t\t\tcase 'select':\n\t\t\tcase 'wp_dropdown_pages':\n\t\t\t\t$this->wrapper = 'select';\n\t\t\t\tbreak;\n\n\n\t\t\tcase 'datepicker':\n\t\t\t\t$this->field['type'] = 'text';\n\t\t\t\t$this->field_class = 'premise-date-field';\n\t\t\t\tbreak;\n\n\t\t\tcase 'color':\n\t\t\tcase 'minicolors':\n\t\t\t\t$this->wrapper = 'color';\n\t\t\t\t$this->field['type'] = 'text';\n\t\t\t\t$this->field_class = 'premise-minicolors';\n\t\t\t\t$this->field['template'] = 'default';\n\t\t\t\tbreak;\n\n\t\t\tcase 'file':\n\t\t\t\t$this->wrapper = 'file';\n\t\t\t\t$this->field['type'] = 'text';\n\t\t\t\t$this->field_class = 'premise-file-url';\n\t\t\t\t$this->btn_upload_file = '';/*'<a class=\"premise-btn-upload\" href=\"javascript:void(0);\" onclick=\"premiseUploadFile(\\'#'.$this->field['id'].'\\')\"><i class=\"fa fa-fw fa-upload\"></i></a>'*/;\n\t\t\t\t$this->btn_remove_file = '';/*'<a class=\"premise-btn-remove\" href=\"javascript:void(0);\" onclick=\"premiseRemoveFile(this)\"><i class=\"fa fa-fw fa-times\"></i></a>'*/;\n\t\t\t\tbreak;\n\n\t\t\tcase 'fa-icon':\n\t\t\t\t$this->wrapper = 'fa-icon';\n\t\t\t\t$this->field['type'] = 'text';\n\t\t\t\t$this->field_class = 'premise-insert-icon';\n\t\t\t\t$this->btn_choose_icon = '<a href=\"javascript:;\" class=\"premise-choose-icon\" onclick=\"premiseChooseIcon(this);\"><i class=\"fa fa-fw fa-th\"></i></a>';\n\t\t\t\t$this->btn_remove_icon = '<a href=\"javascript:;\" class=\"premise-remove-icon\" onclick=\"premiseRemoveIcon(this);\"><i class=\"fa fa-fw fa-times\"></i></a>';\n\t\t\t\tbreak;\n\n\t\t\tcase 'checkbox':\n\t\t\tcase 'radio':\n\t\t\t\t$this->wrapper = ( 'radio' == $this->field['type'] ) \t\t\t\t\t\t\t\t\t\t\t? 'radio'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: 'checkbox';\n\t\t\t\t$this->label = !empty( $this->field['label'] ) \t\t\t\t\t\t\t\t\t\t\t\t? '<p class=\"label\">'.$this->field['label'].'</p>' \t\t\t\t\t\t\t: '';\n\t\t\t\t$this->label .= ( !empty( $this->field['label'] ) && !empty( $this->field['tooltip'] ) ) \t\t? '<span class=\"tooltip\"><i>'.$this->field['tooltip'].'</i></span>' \t\t: '';\n\t\t\t\tbreak;\n\n\t\t\tdefault :\n\t\t\t\t$this->label = !empty( $this->field['label'] ) \t\t\t\t\t\t\t\t\t\t\t\t? '<label for=\"'.$this->field['id'].'\">'.$this->field['label'].'</label>' \t: '';\n\t\t\t\t$this->label .= ( !empty( $this->field['label'] ) && !empty( $this->field['tooltip'] ) ) \t\t? '<span class=\"tooltip\"><i>'.$this->field['tooltip'].'</i></span>' \t\t: '';\n\t\t\t\tbreak;\n\t\t}\n\n\t}",
"function get_alps_field( $field, $id = NULL ) {\n global $post;\n if ( empty( $id ) ) {\n $id = get_queried_object_id();\n }\n $cf = get_option( 'alps_cf_converted' );\n if ( !empty( $cf ) ) {\n $field_data = carbon_get_post_meta( $id, $field );\n if ( !empty( $field_data ) ) {\n if ( is_array( $field_data ) ) {\n if ( count( $field_data ) === 1 ) {\n return $field_data[0];\n } else {\n // RETURN COMPLETE ARRAY\n return $field_data;\n }\n }\n }\n else {\n return $field_data;\n }\n } else { // PIKLIST\n return get_post_meta( $id, $field, true );\n }\n}",
"public function formField($element) {\n /**\n * Ser for input hidden nao gera as divs\n */\n if ($element instanceof \\Zend\\Form\\Element\\Hidden ||\n $element instanceof \\Zend\\Form\\Element\\Csrf) {\n\n return $this->getView()->formInput($element);\n } elseif ($element instanceof \\Zend\\Form\\Element\\Image) {\n $html = '<div class=\"form-group\">';\n $html .= $this->getView()->formImage($element);\n $html .= '</div>';\n return $html;\n return $this->getView()->formImage($element);\n } elseif ($element instanceof \\MySDK\\Form\\Element\\Code) {\n return $element->getValue();\n } elseif ($element instanceof \\Zend\\Form\\Element\\Submit) {\n return $this->getView()->formSubmit($element);\n } else {\n $classError = $this->getView()->formElementErrors($element) ? \"has-error\" : '';\n $cols = $element->getOption('cols') ? $element->getOption('cols') : array('col-sm-3', 'col-sm-3');\n $mask = $element->getOption('mask') ? $element->getOption('mask') : false;\n// $classRequired = $form->getInputFilter()->get($id)->isRequired() ? $form->getInputFilter()->get($id)->isRequired() : false;\n// if($classRequired){\n// $classRequired = 'required';\n// }\n\n\n\n\n $html = '<div class=\"form-group ' . $classError . '\">';\n if ($element->getLabel() && !($element instanceof \\Zend\\Form\\Element\\Button)) {\n $html .= '<label class=\"control-label ' . $cols[0] . '\">' . $element->getLabel() . '</label>';\n }\n $html .= \"<div class='controls \" . $cols[1] . \"'>\";\n $html .= $this->getView()->formElement($element);\n $html .= $this->getView()->formElementErrors()\n ->setMessageOpenFormat('<span class=\"help-block\">')\n ->setMessageSeparatorString('<br/>')\n ->setMessageCloseString('</span>')\n ->render($element);\n $html .= \"</div>\";\n $html .= \"\t</div>\";\n\n if (false != $mask) {\n $html .= \"<script>\";\n $html .= \"$(document).ready(function(){ $('input[name=\\\"\" . $element->getName() . \"\\\"]').mask('\" . $mask . \"') });\";\n $html .= \"</script>\";\n }\n return $html;\n }\n }",
"abstract function process_form();",
"function prso_theme_gform_get_website_field( $field, $value, $lead_id, $form_id ) {\n\t\n\t//Init vars\n\t$output = NULL;\n\t\n\t//Cache css id\n\t$input_id = str_replace('.', '_', $field['id']);\n\t\n\tob_start();\n\t?>\n\t<div id=\"input_<?php esc_attr_e( $input_id ); ?>_container\" class=\"<?php echo apply_filters( 'prso_theme_gforms_website_class', 'row collapse', $field, $form_id ); ?>\">\n\t\t<div class=\"<?php echo apply_filters( 'prso_theme_gforms_website_prepend_col_size', 'small-3 large-2', $field, $form_id ); ?> columns\">\n\t\t\t<span class=\"prefix\"><?php echo apply_filters( 'prso_theme_gforms_website_prepend', 'http://', $field, $form_id ); ?></span>\n\t\t</div>\n\t\t<div class=\"<?php echo apply_filters( 'prso_theme_gforms_website_col_size', 'small-9 large-10', $field, $form_id ); ?> columns\">\n\t\t\t<input id=\"input_<?php esc_attr_e( $input_id ); ?>\" type=\"text\" placeholder=\"<?php echo apply_filters( 'prso_theme_gforms_website_placeholder', 'Enter your URL', $field, $form_id ); ?>\" tabindex=\"\" name=\"input_<?php esc_attr_e($input_id); ?>\" class=\"<?php echo apply_filters( 'prso_theme_gforms_website_field_class', 'placeholder', $field, $form_id ); ?>\" value=\"<?php echo $value; ?>\">\n\t\t</div>\n\t</div>\n\t<?php\n\t$output = ob_get_contents();\n\tob_end_clean();\n\t\n\treturn $output;\n\t\n}",
"private function determine_field_value($_meta, $_id = 0) {\r\n\t $mval = false;\r\n\t /**\r\n\t * We are assuming that here the user will use whatever the Admin Fields that is placed for the product page\r\n\t * not on the Product Taxonomies page or Admin Fields for variable sections. because it doesn't make any sense.\r\n\t * and if they do then we have a problem here\r\n\t */\r\n\t if (metadata_exists(\"post\", $_id, \"wccaf_\". $_meta[\"name\"])) {\r\n\t $mval = get_post_meta($_id, \"wccaf_\". $_meta[\"name\"], true);\r\n\t /* Incase of checkbox - the values has to be deserialzed as Array */\r\n\t if ($_meta[\"type\"] == \"checkbox\") {\r\n\t $mval = explode(',', $mval);\r\n\t }\r\n\t } else {\r\n\t /* This will make sure the following section fill with default value instead */\r\n\t $mval = false;\r\n\t }\r\n\t /* We can trust this since we never use boolean value for any meta\r\n\t * instead we use 'yes' or 'no' values */\r\n\t if (!$mval) {\r\n\t /* Value is not there - probably this field is not yet saved */\r\n\t if ($_meta[\"type\"] == \"checkbox\") {\r\n\t $d_choices = array();\r\n\t if ($_meta[\"default_value\"] != \"\") {\r\n\t $choices = explode(\";\", $_meta[\"default_value\"]);\r\n\t if (is_array($choices)) {\r\n\t foreach ($choices as $choice) {\r\n\t $d_value = explode(\"|\", $choice);\r\n\t $d_choices[] = $d_value[0];\r\n\t }\r\n\t }\r\n\t }\r\n\t $mval = $d_choices;\r\n\t } else if ($_meta[\"type\"] == \"radio\" || $_meta[\"type\"] == \"select\") {\r\n\t $mval = \"\";\r\n\t if ($_meta[\"default_value\"] != \"\") {\r\n\t $d_value = explode(\"|\", $_meta[\"default_value\"]);\r\n\t $mval = $d_value[0];\r\n\t }\r\n\t } else {\r\n\t /* For rest of the fields - no problem */\r\n\t $mval = isset($_meta[\"default_value\"]) ? $_meta[\"default_value\"] : \"\";\r\n\t }\r\n\t }\r\n\t return $mval;\r\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add the rate for user profile album. | private function addUserProfileAlbumRate($item_type, $item_id, $rate, $user_id) {
$data = array();
$dm = $this->get('doctrine.odm.mongodb.document_manager'); //getting doctrine mongo odm object.
$album_res = $dm->getRepository('MediaMediaBundle:UserAlbum')
->find($item_id);
if (!$album_res) {
$res_data = array('code' => 302, 'message' => 'RECORD_DOES_NOT_EXISTS', 'data' => $data);
echo json_encode($res_data);
exit;
}
$album_rating = $album_res->getRate();
//check if a user already rate on album.
foreach ($album_rating as $album_rate) {
if ($album_rate->getUserId() == $user_id) {
$res_data = array('code' => 78, 'message' => 'YOU_HAVE_ALREADY_VOTE', 'data' => $data);
$this->returnResponse($res_data);
}
}
$user_album_rating = new UserAlbumRating();
$time = new \DateTime("now");
//calculate the total, average rate.
$total_user_count = $album_res->getVoteCount();
$total_rate = $album_res->getVoteSum();
$album_user_id = $album_res->getUserId(); //get post owner id
$updated_rate_result = $this->updateAddRate($total_user_count, $total_rate, $rate); //calculate the new rate, total user count
$new_user_count = $updated_rate_result['new_user_count'];
$new_total_rate = $updated_rate_result['new_total_rate'];
$avg_rate = $updated_rate_result['avg_rate'];
//set the object.
$album_res->setVoteCount($new_user_count);
$album_res->setVoteSum($new_total_rate);
$album_res->setAvgRating($avg_rate);
//set object for dashboard post rating
$user_album_rating->setUserId($user_id);
$user_album_rating->setRate($rate);
$user_album_rating->setItemId($item_id);
$user_album_rating->setType('album');
$user_album_rating->setCreatedAt($time);
$user_album_rating->setUpdatedAt($time);
$album_res->addRate($user_album_rating);
try {
$dm->persist($album_res); //storing the post data.
$dm->flush();
if ($user_id != $album_user_id) {
//prepare the mail template for dashboard post rating.
$email_template_service = $this->container->get('email_template.service'); //email template service.
$to_id = $album_user_id;
$from_id = $user_id;
$album_id = $item_id;
$album_name = $album_res->getAlbumName();
$postService = $this->container->get('post_detail.service');
$receiver = $postService->getUserData($to_id, true);
//get locale
$locale = !empty($receiver[$to_id]['current_language']) ? $receiver[$to_id]['current_language'] : $this->container->getParameter('locale');
$lang_array = $this->container->getParameter($locale);
$sender = $postService->getUserData($from_id);
$sender_name = trim(ucfirst($sender['first_name']).' '.ucfirst($sender['last_name']));
//send social notification
$msgtype = $this->user_album_rating;
$notification_id = $this->saveUserNotification($user_id, $album_user_id, $item_id, $msgtype, $rate);
$postService->sendUserNotifications($user_id, $album_user_id, $msgtype, 'rate', $item_id, false, true, $sender_name);
//end to send social notification
$href = $email_template_service->getDashboardAlbumUrl(array('friendId'=>$album_user_id, 'albumId'=> $album_id, 'albumName'=> $album_name));
$link = $email_template_service->getLinkForMail($href,$locale); //making the link html from service
$mail_sub = sprintf($lang_array['USER_ALBUM_RATE_SUBJECT'], $sender_name);
$mail_body = sprintf($lang_array['USER_ALBUM_RATE_BODY'], $sender_name);
$mail_text = sprintf($lang_array['USER_ALBUM_RATE_TEXT'], $sender_name, $rate);
$bodyData = $mail_text."<br><br>".$link;
// HOTFIX NO NOTIFY MAIL
//$emailResponse = $email_template_service->sendMail($receiver, $bodyData, $mail_body, $mail_sub, $sender['profile_image_thumb'], 'RATING_NOTIFICATION');
}
$data = array('avg_rate'=>$this->roundNumber($avg_rate), 'current_user_rate'=>$rate, 'no_of_votes'=>$new_user_count);
} catch (\Doctrine\DBAL\DBALException $e) {
$response_data = array('code' => 100, 'message' => 'ERROR_OCCURED', 'data' => $data);
echo json_encode($response_data);
exit;
}
$response_data = array('code' => 101, 'message' => 'SUCCESS', 'data' => $data);
echo json_encode($response_data);
exit;
} | [
"private function addUserAlbumCommentRate($item_type, $item_id, $rate, $user_id) {\n $data = array();\n $dm = $this->get('doctrine.odm.mongodb.document_manager'); //getting doctrine mongo odm object.\n $comment_res = $dm->getRepository('MediaMediaBundle:AlbumComment')\n ->find($item_id);\n if (!$comment_res) {\n $res_data = array('code' => 302, 'message' => 'RECORD_DOES_NOT_EXISTS', 'data' => $data);\n echo json_encode($res_data);\n exit;\n }\n $comment_rating = $comment_res->getRate();\n //check if a user already rate on post comment.\n foreach ($comment_rating as $comment_rate) {\n if ($comment_rate->getUserId() == $user_id) {\n $res_data = array('code' => 78, 'message' => 'YOU_HAVE_ALREADY_VOTE', 'data' => $data);\n $this->returnResponse($res_data);\n }\n }\n\n // $dashboard_comment_rating = new DashboardCommentRating();\n $useralbum_comment_rating = new AlbumCommentRating();\n $time = new \\DateTime(\"now\");\n $_albumId = $comment_res->getAlbumId();\n //calculate the total, average rate.\n $total_user_count = $comment_res->getVoteCount();\n $total_rate = $comment_res->getVoteSum();\n\n $user_album_comment_user_id = $comment_owner_id = $comment_res->getCommentAuthor(); //get comment owner id\n $updated_rate_result = $this->updateAddRate($total_user_count, $total_rate, $rate); //calculate the new rate, total user count\n\n $new_user_count = $updated_rate_result['new_user_count'];\n $new_total_rate = $updated_rate_result['new_total_rate'];\n $avg_rate = $updated_rate_result['avg_rate'];\n\n //set the object.\n $comment_res->setVoteCount($new_user_count);\n $comment_res->setVoteSum($new_total_rate);\n $comment_res->setAvgRating($avg_rate);\n\n //set object for dashboard post rating\n $useralbum_comment_rating->setUserId($user_id);\n $useralbum_comment_rating->setRate($rate);\n $useralbum_comment_rating->setItemId($item_id);\n $useralbum_comment_rating->setType('user_album_comment');\n $useralbum_comment_rating->setCreatedAt($time);\n $useralbum_comment_rating->setUpdatedAt($time);\n\n $comment_res->addRate($useralbum_comment_rating);\n try {\n $dm->persist($comment_res); //storing the rating data.\n $dm->flush();\n\n if ($user_id != $comment_owner_id) {\n $msgtype = $this->useralbum_comment_rating;\n //end to send social notification\n $album_res = $dm->getRepository('MediaMediaBundle:UserAlbum')\n ->find($_albumId);\n //prepare the mail template for dashboard post rating.\n $email_template_service = $this->container->get('email_template.service'); //email template service.\n $angular_app_hostname = $this->container->getParameter('angular_app_hostname'); //angular app host\n $useralbum_url = $this->container->getParameter('user_album_url');\n $to_id = $user_album_comment_user_id;\n $from_id = $user_id;\n $post_id = $item_id;\n //get the local parameters in parameters file.\n\n $postService = $this->container->get('post_detail.service');\n $receiver = $postService->getUserData($to_id, true);\n $sender = $postService->getUserData($from_id);\n $locale = !empty($receiver[$to_id]['current_language']) ? $receiver[$to_id]['current_language'] : $this->container->getParameter('locale');\n $language_const_array = $this->container->getParameter($locale);\n $sender_name = trim(ucfirst($sender['first_name']).' '.ucfirst($sender['last_name']));\n $albumName = $album_res->getAlbumName();\n $postService->sendUserNotifications($user_id, $comment_owner_id, $msgtype, $rate, $_albumId, true, true, array($sender_name, ucwords($albumName)), 'CITIZEN', array('msg_code'=>'rate'), 'U', array('comment_id'=>$item_id));\n $href = $angular_app_hostname . $useralbum_url . '/' . $_albumId.'/'.$albumName;\n $link = $email_template_service->getLinkForMail($href); //making the link html from service\n $mail_sub = sprintf($language_const_array['USER_ALBUM_COMMENT_RATE_SUBJECT'], $sender_name, ucwords($albumName));\n $mail_body = sprintf($language_const_array['USER_ALBUM_COMMENT_RATE_BODY'], ucwords($sender_name), ucwords($albumName));\n $mail_text = sprintf($language_const_array['USER_ALBUM_COMMENT_RATE_TEXT'], $sender_name, ucwords($albumName), $rate);\n $bodyData = $mail_text.\"<br><br>\".$link;\n\n // HOTFIX NO NOTIFY MAIL\n //$emailResponse = $email_template_service->sendMail($receiver, $bodyData, $mail_body, $mail_sub, $sender['profile_image_thumb'], 'RATING_NOTIFICATION');\n }\n\n $data = array('avg_rate'=>$this->roundNumber($avg_rate), 'current_user_rate'=>$rate, 'no_of_votes'=>$new_user_count);\n } catch (\\Doctrine\\DBAL\\DBALException $e) {\n $response_data = array('code' => 100, 'message' => 'ERROR_OCCURED', 'data' => $data);\n echo json_encode($response_data);\n exit;\n }\n $response_data = array('code' => 101, 'message' => 'SUCCESS', 'data' => $data);\n echo json_encode($response_data);\n exit;\n }",
"public function addClubAlbumRate($item_type, $item_id, $rate, $user_id) {\n $data = array();\n $dm = $this->get('doctrine.odm.mongodb.document_manager'); //getting doctrine mongo odm object.\n $album_res = $dm->getRepository('UserManagerSonataUserBundle:GroupAlbum')\n ->find($item_id);\n if (!$album_res) {\n $res_data = array('code' => 302, 'message' => 'RECORD_DOES_NOT_EXISTS', 'data' => $data);\n echo json_encode($res_data);\n exit;\n }\n $album_rating = $album_res->getRate();\n //check if a user already rate on album.\n foreach ($album_rating as $album_rate) {\n if ($album_rate->getUserId() == $user_id) {\n $res_data = array('code' => 78, 'message' => 'YOU_HAVE_ALREADY_VOTE', 'data' => $data);\n $this->returnResponse($res_data);\n }\n }\n\n $club_album_rating = new GroupAlbumRating();\n $time = new \\DateTime(\"now\");\n\n //calculate the total, average rate.\n $total_user_count = $album_res->getVoteCount();\n $total_rate = $album_res->getVoteSum();\n\n //get album owner Id\n $club_id = $album_res->getGroupId();\n $club_details = $dm->getRepository('UserManagerSonataUserBundle:Group')\n ->find($club_id);\n if(!$club_details){\n $response_data = array('code' => 100, 'message' => 'ERROR_OCCURED', 'data' => $data);\n echo json_encode($response_data);\n exit;\n } else {\n $album_user_id = $club_details->getOwnerId(); //get post owner id\n $club_id = $club_details->getId(); //get club id\n $clubStatus = $club_details->getGroupStatus();\n }\n\n $updated_rate_result = $this->updateAddRate($total_user_count, $total_rate, $rate); //calculate the new rate, total user count\n\n $new_user_count = $updated_rate_result['new_user_count'];\n $new_total_rate = $updated_rate_result['new_total_rate'];\n $avg_rate = $updated_rate_result['avg_rate'];\n\n //set the object.\n $album_res->setVoteCount($new_user_count);\n $album_res->setVoteSum($new_total_rate);\n $album_res->setAvgRating($avg_rate);\n\n //set object for dashboard post rating\n $club_album_rating->setUserId($user_id);\n $club_album_rating->setRate($rate);\n $club_album_rating->setItemId($item_id);\n $club_album_rating->setType('club_album');\n $club_album_rating->setCreatedAt($time);\n $club_album_rating->setUpdatedAt($time);\n\n $album_res->addRate($club_album_rating);\n try {\n $dm->persist($album_res); //storing the post data.\n $dm->flush();\n\n if ($user_id != $album_user_id) {\n //prepare the mail template for dashboard post rating.\n $email_template_service = $this->container->get('email_template.service'); //email template service.\n $angular_app_hostname = $this->container->getParameter('angular_app_hostname'); //angular app host\n $club_album_url = $this->container->getParameter('club_album_url'); //dashboard post url\n $to_id = $album_user_id;\n $from_id = $user_id;\n $album_id = $item_id;\n $album_name = $album_res->getAlbumName();\n\n $postService = $this->get('post_detail.service');\n $sender = $postService->getUserData($from_id);\n $sender_name = trim(ucfirst($sender['first_name']).' '.ucfirst($sender['last_name']));\n\n //send social notification\n $msgtype = $this->club_album_rating;\n $postService->sendUserNotifications($user_id, $album_user_id, $msgtype, $rate, $item_id, true, true, $sender_name, 'CITIZEN', array(\"club_id\"=>$club_id, \"msg_code\"=>'rate'), 'U', array(\"club_id\"=>$club_id));\n //end to send social notification\n\n $receiver = $postService->getUserData($to_id, true);\n //get locale\n $locale = !empty($receiver[$to_id]['current_language']) ? $receiver[$to_id]['current_language'] : $this->container->getParameter('locale');\n $lang_array = $this->container->getParameter($locale);\n\n $href = $angular_app_hostname . $club_album_url . '/' . $club_id. '/'.$album_id. '/'.$clubStatus.'/'.$album_name;\n $link = $email_template_service->getLinkForMail($href,$locale); //making the link html from service\n $mail_sub = sprintf($lang_array['CLUB_ALBUM_RATE_SUBJECT'], $sender_name);\n $mail_body = sprintf($lang_array['CLUB_ALBUM_RATE_BODY'], ucwords($sender_name));\n $mail_text = sprintf($lang_array['CLUB_ALBUM_RATE_TEXT'], $sender_name, $rate);\n $bodyData = $mail_text.\"<br><br>\".$link;\n\n // HOTFIX NO NOTIFY MAIL\n //$emailResponse = $email_template_service->sendMail($receiver, $bodyData, $mail_body, $mail_sub, $sender['profile_image_thumb'], 'RATING_NOTIFICATION');\n }\n\n $data = array('avg_rate'=>$this->roundNumber($avg_rate), 'current_user_rate'=>$rate, 'no_of_votes'=>$new_user_count);\n } catch (\\Doctrine\\DBAL\\DBALException $e) {\n $response_data = array('code' => 100, 'message' => 'ERROR_OCCURED', 'data' => $data);\n echo json_encode($response_data);\n exit;\n }\n $response_data = array('code' => 101, 'message' => 'SUCCESS', 'data' => $data);\n echo json_encode($response_data);\n exit;\n }",
"public function editUserProfileAlbumRate($item_type, $item_id, $rate, $user_id)\n {\n $arrayAlbumRate = array();\n $data = array();\n $dm = $this->get('doctrine.odm.mongodb.document_manager'); //getting doctrine mongo odm object.\n\n //get rating object\n $album = $dm->getRepository('MediaMediaBundle:UserAlbum')\n ->find($item_id);\n\n //if post not exist\n if(!$album){\n $res_data = array('code' => 302, 'message' => 'RECORD_DOES_NOT_EXISTS', 'data' => $data);\n $this->returnResponse($res_data);\n }\n\n $votes = $album->getRate();\n $total_user_count = $album->getVoteCount();\n $total_rate = $album->getVoteSum();//old total rate\n\n //get current time\n $time = new \\DateTime(\"now\");\n foreach ($votes as $vote) {\n $voter_id = $vote->getUserId();\n //check if current user is voter of post\n if($user_id == $voter_id){\n $rate_id = $vote->getId(); //get rate id\n $current_user_rate = $vote->getRate();\n //preapre the object\n $arrayAlbumRate = array(\n \"_id\" => new \\MongoId($rate_id),\n \"user_id\" => $vote->getUserId(),\n \"rate\" => (int)$rate,\n \"item_id\" => $vote->getItemId(),\n \"type\" => $vote->getType(),\n \"created_at\" =>$vote->getCreatedAt(),\n \"updated_at\" =>$time,\n );\n }\n }\n $rating_response = array();\n //edit rating object\n if(count($arrayAlbumRate)>0){\n $rating_response = $dm->getRepository('MediaMediaBundle:UserAlbum')\n ->editAlbumRate($rate_id, $arrayAlbumRate, $item_id);\n\n }\n if(!$rating_response){\n $res_data = array('code' => 100, 'message' => 'ERROR_OCCURED', 'data' => $data);\n $this->returnResponse($res_data);\n }\n\n //Update the rate count\n $resp = $this->updateEditRateCount($total_user_count, $total_rate, $item_id, $current_user_rate, $rate);\n $new_total_rate = $resp['total_rate'];\n $avg_rate = $resp['avg_rate'];\n\n $album->setVoteSum($new_total_rate);\n $album->setAvgRating($avg_rate);\n\n try {\n $dm->persist($album); //storing the post data.\n $dm->flush();\n //set response parameter\n $avg_rate_round = $this->roundNumber($avg_rate);\n $data = array('avg_rate'=>$avg_rate_round, 'current_user_rate'=>$rate, 'no_of_votes'=>$total_user_count);\n } catch (\\Doctrine\\DBAL\\DBALException $e) {\n $response_data = array('code' => 100, 'message' => 'ERROR_OCCURED', 'data' => $data);\n $this->returnResponse($response_data);\n }\n\n $res_data = array('code' => 101, 'message' => 'SUCCESS', 'data' => $data);\n $this->returnResponse($res_data);\n\n }",
"public function updateAddRate($total_user_count, $total_rate, $rate) {\n $new_total_user_count = $total_user_count + 1;\n $new_total_rate = $total_rate + $rate;\n $avg_rate = $new_total_rate / $new_total_user_count;\n return array('new_user_count' => $new_total_user_count, 'new_total_rate' => $new_total_rate, 'avg_rate' => $avg_rate);\n }",
"public function editClubAlbumRate($item_type, $item_id, $rate, $user_id)\n {\n $arrayAlbumRate = array();\n $data = array();\n $dm = $this->get('doctrine.odm.mongodb.document_manager'); //getting doctrine mongo odm object.\n\n //get rating object\n $album = $dm->getRepository('UserManagerSonataUserBundle:GroupAlbum')\n ->find($item_id);\n\n //if post not exist\n if(!$album){\n $res_data = array('code' => 302, 'message' => 'RECORD_DOES_NOT_EXISTS', 'data' => $data);\n $this->returnResponse($res_data);\n }\n\n $votes = $album->getRate();\n $total_user_count = $album->getVoteCount();\n $total_rate = $album->getVoteSum();//old total rate\n\n //get current time\n $time = new \\DateTime(\"now\");\n foreach ($votes as $vote) {\n $voter_id = $vote->getUserId();\n //check if current user is voter of post\n if($user_id == $voter_id){\n $rate_id = $vote->getId(); //get rate id\n $current_user_rate = $vote->getRate();\n //preapre the object\n $arrayAlbumRate = array(\n \"_id\" => new \\MongoId($rate_id),\n \"user_id\" => $vote->getUserId(),\n \"rate\" => (int)$rate,\n \"item_id\" => $vote->getItemId(),\n \"type\" => $vote->getType(),\n \"created_at\" =>$vote->getCreatedAt(),\n \"updated_at\" =>$time,\n );\n }\n }\n $rating_response = array();\n //edit rating object\n if(count($arrayAlbumRate)>0){\n $rating_response = $dm->getRepository('UserManagerSonataUserBundle:GroupAlbum')\n ->editAlbumRate($rate_id, $arrayAlbumRate, $item_id);\n\n }\n if(!$rating_response){\n $res_data = array('code' => 100, 'message' => 'ERROR_OCCURED', 'data' => $data);\n $this->returnResponse($res_data);\n }\n\n //Update the rate count\n $resp = $this->updateEditRateCount($total_user_count, $total_rate, $item_id, $current_user_rate, $rate);\n $new_total_rate = $resp['total_rate'];\n $avg_rate = $resp['avg_rate'];\n\n $album->setVoteSum($new_total_rate);\n $album->setAvgRating($avg_rate);\n\n try {\n $dm->persist($album); //storing the post data.\n $dm->flush();\n //set response parameter\n $avg_rate_round = $this->roundNumber($avg_rate);\n $data = array('avg_rate'=>$avg_rate_round, 'current_user_rate'=>$rate, 'no_of_votes'=>$total_user_count);\n } catch (\\Doctrine\\DBAL\\DBALException $e) {\n $response_data = array('code' => 100, 'message' => 'ERROR_OCCURED', 'data' => $data);\n $this->returnResponse($response_data);\n }\n\n $res_data = array('code' => 101, 'message' => 'SUCCESS', 'data' => $data);\n $this->returnResponse($res_data);\n\n }",
"public function addUserRating($userId, $params);",
"public function addUserRate(UserRate $l)\n\t{\n\t\tif ($this->collUserRates === null) {\n\t\t\t$this->initUserRates();\n\t\t}\n\t\tif (!in_array($l, $this->collUserRates, true)) { // only add it if the **same** object is not already associated\n\t\t\tarray_push($this->collUserRates, $l);\n\t\t\t$l->setUser($this);\n\t\t}\n\t}",
"public function incRate(){\n $this->update(['rate' => $this->rate + 1]);\n }",
"function add_rating( $user_id ) {\n\t\tadd_user_meta( $user_id, 'rating', $_POST['rating'], false );\n\t}",
"public function editUserProfileAlbumImageRate($item_type, $item_id, $rate, $user_id)\n {\n $arrayImageRate = array();\n $data = array();\n $dm = $this->get('doctrine.odm.mongodb.document_manager'); //getting doctrine mongo odm object.\n\n //get rating object\n $image = $dm->getRepository('MediaMediaBundle:UserMedia')\n ->find($item_id);\n\n //if post not exist\n if(!$image){\n $res_data = array('code' => 302, 'message' => 'RECORD_DOES_NOT_EXISTS', 'data' => $data);\n $this->returnResponse($res_data);\n }\n\n $votes = $image->getRate();\n $total_user_count = $image->getVoteCount();\n $total_rate = $image->getVoteSum();//old total rate\n\n //get current time\n $time = new \\DateTime(\"now\");\n foreach ($votes as $vote) {\n $voter_id = $vote->getUserId();\n //check if current user is voter of post\n if($user_id == $voter_id){\n $rate_id = $vote->getId(); //get rate id\n $current_user_rate = $vote->getRate();\n //preapre the object\n $arrayImageRate = array(\n \"_id\" => new \\MongoId($rate_id),\n \"user_id\" => $vote->getUserId(),\n \"rate\" => (int)$rate,\n \"item_id\" => $vote->getItemId(),\n \"type\" => $vote->getType(),\n \"created_at\" =>$vote->getCreatedAt(),\n \"updated_at\" =>$time,\n );\n }\n }\n $rating_response = array();\n //edit rating object\n if(count($arrayImageRate)>0){\n $rating_response = $dm->getRepository('MediaMediaBundle:UserMedia')\n ->editMediaRate($rate_id, $arrayImageRate, $item_id);\n\n }\n if(!$rating_response){\n $res_data = array('code' => 100, 'message' => 'ERROR_OCCURED', 'data' => $data);\n $this->returnResponse($res_data);\n }\n\n //Update the rate count\n $resp = $this->updateEditRateCount($total_user_count, $total_rate, $item_id, $current_user_rate, $rate);\n $new_total_rate = $resp['total_rate'];\n $avg_rate = $resp['avg_rate'];\n\n $image->setVoteSum($new_total_rate);\n $image->setAvgRating($avg_rate);\n\n try {\n $dm->persist($image); //storing the post data.\n $dm->flush();\n //set response parameter\n $avg_rate_round = $this->roundNumber($avg_rate);\n $data = array('avg_rate'=>$avg_rate_round, 'current_user_rate'=>$rate, 'no_of_votes'=>$total_user_count);\n } catch (\\Doctrine\\DBAL\\DBALException $e) {\n $response_data = array('code' => 100, 'message' => 'ERROR_OCCURED', 'data' => $data);\n $this->returnResponse($response_data);\n }\n\n $res_data = array('code' => 101, 'message' => 'SUCCESS', 'data' => $data);\n $this->returnResponse($res_data);\n\n }",
"public function store(UserProfile $userprofile)\n {\n request()->validate([\n 'rating' => ['required', 'in:1,2,3,4,5']\n ]);\n $userprofile->rate(request('rating'));\n }",
"function didRate($idAlbum, $idUsuario){\n\t\t$this->db->select($this->camposConcatenados);\t\n \t$this->db->from($this->nombreTabla);\n\t\t$this->db->where($this->nombreCamposBD['id_album'], $idAlbum);\n\t\t$this->db->where($this->nombreCamposBD['id_usuario'], $idUsuario);\n\t $this->db->limit(1);\n\t\t\n\t //$ratings = $this->db->get()->result();\n\t\t$ratings = $this->db->get();\n\t\treturn $ratings->num_rows() >= 1;\n\t}",
"public function editUserAlbumCommentRate($item_type, $comment_id, $rate, $user_id)\n {\n $arrayCommentRate = array();\n $data = array();\n $dm = $this->get('doctrine.odm.mongodb.document_manager'); //getting doctrine mongo odm object.\n\n //get rating object\n $comment = $dm->getRepository('MediaMediaBundle:AlbumComment')\n ->findOneBy(array('id'=>$comment_id));\n\n\n //if post not exist\n if(!$comment){\n $res_data = array('code' => 302, 'message' => 'RECORD_DOES_NOT_EXISTS', 'data' => $data);\n $this->returnResponse($res_data);\n }\n\n $votes = $comment->getRate();\n $total_user_count = $comment->getVoteCount();\n $total_rate = $comment->getVoteSum();//old total rate\n\n //get current time\n $time = new \\DateTime(\"now\");\n foreach ($votes as $vote) {\n\n $voter_id = $vote->getUserId();\n //check if current user is voter of post\n if($user_id == $voter_id){\n $rate_id = $vote->getId(); //get rate id\n $current_user_rate = $vote->getRate();\n //preapre the object\n $arrayCommentRate = array(\n \"_id\" => new \\MongoId($rate_id),\n \"user_id\" => $vote->getUserId(),\n \"rate\" => (int)$rate,\n \"item_id\" => $vote->getItemId(),\n \"type\" => $vote->getType(),\n \"created_at\" =>$vote->getCreatedAt(),\n \"updated_at\" =>$time,\n );\n }\n }\n $rating_response = array();\n //edit rating object\n if(count($arrayCommentRate)>0){\n $rating_response = $dm->getRepository('MediaMediaBundle:AlbumComment')\n ->editCommentRate($rate_id, $arrayCommentRate, $comment_id);\n\n }\n if(!$rating_response){\n $res_data = array('code' => 100, 'message' => 'ERROR_OCCURED', 'data' => $data);\n $this->returnResponse($res_data);\n }\n\n //Update the rate count\n $resp = $this->updateEditRateCount($total_user_count, $total_rate, $comment_id, $current_user_rate, $rate);\n $new_total_rate = $resp['total_rate'];\n $avg_rate = $resp['avg_rate'];\n\n $comment->setVoteSum($new_total_rate);\n $comment->setAvgRating($avg_rate);\n\n try {\n $dm->persist($comment); //storing the post data.\n $dm->flush();\n //set response parameter\n $avg_rate_round = $this->roundNumber($avg_rate);\n $data = array('avg_rate'=>$avg_rate_round, 'current_user_rate'=>$rate, 'no_of_votes'=>$total_user_count);\n } catch (\\Doctrine\\DBAL\\DBALException $e) {\n $response_data = array('code' => 100, 'message' => 'ERROR_OCCURED', 'data' => $data);\n $this->returnResponse($response_data);\n }\n\n $res_data = array('code' => 101, 'message' => 'SUCCESS', 'data' => $data);\n $this->returnResponse($res_data);\n\n }",
"protected function _fcpoCheckAndAddRatePayProfile() \n {\n if ($this->_oFcpoHelper->fcpoGetRequestParameter('addRatePayProfile')) {\n $this->_oFcpoRatePay->fcpoAddRatePayProfile();\n $this->_aAdminMessages[\"blRatePayProfileAdded\"] = true;\n }\n }",
"public function addClubPostCommentRate($item_type, $item_id, $rate, $user_id) {\n $data = array();\n $dm = $this->get('doctrine.odm.mongodb.document_manager'); //getting doctrine mongo odm object.\n $comment_res = $dm->getRepository('PostPostBundle:Comments')\n ->find($item_id);\n if (!$comment_res) {\n $res_data = array('code' => 302, 'message' => 'RECORD_DOES_NOT_EXISTS', 'data' => $data);\n echo json_encode($res_data);\n exit;\n }\n $comment_rating = $comment_res->getRate();\n //check if a user already rate on post comment.\n foreach ($comment_rating as $comment_rate) {\n if ($comment_rate->getUserId() == $user_id) {\n $res_data = array('code' => 78, 'message' => 'YOU_HAVE_ALREADY_VOTE', 'data' => $data);\n $this->returnResponse($res_data);\n }\n }\n\n $club_comment_rating = new CommentRating();\n $time = new \\DateTime(\"now\");\n\n //calculate the total, average rate.\n $total_user_count = $comment_res->getVoteCount();\n $total_rate = $comment_res->getVoteSum();\n\n $club_post_comment_user_id = $comment_owner_id = $comment_res->getCommentAuthor(); //get post owner id\n $postId = $comment_res->getPostId();\n $updated_rate_result = $this->updateAddRate($total_user_count, $total_rate, $rate); //calculate the new rate, total user count\n\n $new_user_count = $updated_rate_result['new_user_count'];\n $new_total_rate = $updated_rate_result['new_total_rate'];\n $avg_rate = $updated_rate_result['avg_rate'];\n\n //set the object.\n $comment_res->setVoteCount($new_user_count);\n $comment_res->setVoteSum($new_total_rate);\n $comment_res->setAvgRating($avg_rate);\n\n //set object for dashboard post rating\n $club_comment_rating->setUserId($user_id);\n $club_comment_rating->setRate($rate);\n $club_comment_rating->setItemId($item_id);\n $club_comment_rating->setType('club_post_comment');\n $club_comment_rating->setCreatedAt($time);\n $club_comment_rating->setUpdatedAt($time);\n\n $comment_res->addRate($club_comment_rating);\n try {\n $dm->persist($comment_res); //storing the post data.\n $dm->flush();\n\n if ($user_id != $comment_owner_id) {\n //prepare the mail template for dashboard post rating.\n $email_template_service = $this->container->get('email_template.service'); //email template service.\n $angular_app_hostname = $this->container->getParameter('angular_app_hostname'); //angular app host\n //$club_post_url = $this->container->getParameter('club_profile_url'); //dashboard post url\n $to_id = $club_post_comment_user_id;\n $from_id = $user_id;\n $post_id = $item_id;\n $_postData = $dm->getRepository('PostPostBundle:Post')\n ->find($postId);\n $postService = $this->get('post_detail.service');\n $sender = $postService->getUserData($from_id);\n $sender_name = trim(ucfirst($sender['first_name']).' '.ucfirst($sender['last_name']));\n\n //send social notification\n $msgtype = $this->club_post_comment_rating;\n $notification_id = $this->saveUserNotification($user_id, $comment_owner_id, $item_id, $msgtype, $rate);\n $postService->sendUserNotifications($user_id, $comment_owner_id, $msgtype, 'rate', $item_id, false, true, $sender_name, 'CITIZEN', array('ref_id'=>$postId));\n //end to send social notification\n\n $receiver = $postService->getUserData($to_id, true);\n //get locale\n $locale = !empty($receiver[$to_id]['current_language']) ? $receiver[$to_id]['current_language'] : $this->container->getParameter('locale');\n $lang_array = $this->container->getParameter($locale);\n\n $href = $postService->getStoreClubUrl(array('clubId'=>$_postData->getPostGid(), 'postId'=>$_postData->getId()), 'club');\n $link = $email_template_service->getLinkForMail($href,$locale); //making the link html from service\n $mail_sub = sprintf($lang_array['CLUB_POST_COMMENT_RATE_SUBJECT'], $sender_name);\n $mail_body = sprintf($lang_array['CLUB_POST_COMMENT_RATE_BODY'], ucwords($sender_name));\n $mail_text = sprintf($lang_array['CLUB_POST_COMMENT_RATE_TEXT'], $sender_name, $rate);\n $bodyData = $mail_text.\"<br><br>\".$link;\n\n // HOTFIX NO NOTIFY MAIL\n //$emailResponse = $email_template_service->sendMail($receiver, $bodyData, $mail_body, $mail_sub, $sender['profile_image_thumb'], 'RATING_NOTIFICATION');\n }\n\n $data = array('avg_rate'=>$this->roundNumber($avg_rate), 'current_user_rate'=>$rate, 'no_of_votes'=>$new_user_count);\n } catch (\\Doctrine\\DBAL\\DBALException $e) {\n $response_data = array('code' => 100, 'message' => 'ERROR_OCCURED', 'data' => $data);\n echo json_encode($response_data);\n exit;\n }\n $response_data = array('code' => 101, 'message' => 'SUCCESS', 'data' => $data);\n echo json_encode($response_data);\n exit;\n }",
"function update_user_ratings_rate( $user_id ) {\n\n\t\tglobal $wpdb, $Yz_reviews_table;\n\n\t\t// Get Count\n\t\t$count = $wpdb->get_var( \"SELECT AVG(rating) FROM $Yz_reviews_table WHERE reviewed = $user_id\" );\n\n\t\t$ratings_rate = apply_filters( 'yz_get_user_ratings_rate', $count, $user_id );\n\n\t\t// Update User Ratings Rate.\n\t\tupdate_user_meta( $user_id, 'yz_user_ratings_rate', $ratings_rate );\n\t\n\t\treturn $ratings_rate;\t\n\t}",
"function updateAvgRating()\n\t{\n\t\t$result1 =array();\n\t\t$sql = \"SELECT `callerId` , (SUM( `onTime` ) + SUM( `clearReception` )), ROUND( (SUM( `onTime` ) + SUM(`clearReception` ) ) / ( count( `callerId` ) *2 )) as `avgRate` FROM `feedback` GROUP BY `callerId` order by `callerId` ASC \";\n\t\t$qry = $this->db->query($sql);\n\t\tif ($qry->num_rows() > 0){\n\t\t\t$result = $qry->result_array();\n\t\t\tforeach($result as $data)\n\t\t\t{\n\t\t\t\t$sqlPro = \"Update `profile` SET `avgRate` = '\".$data['avgRate'].\"' WHERE `uid` = '\".$data['callerId'].\"'\";\n\t\t\t\t$qryPro = $this->db->query($sqlPro);\n\t\t\t}\n\t\t}\n\t}",
"public function addRatings()\n {\n }",
"public function update() {\n\t\t\n\t\tif ( ($this->user_id == 0) || ($this->package_id == 0) ) { return false; }\n\t\t\n\t\t$rate_action = get_query_var( 'rate', '');\n\t\t\n\t\tswitch ( $rate_action ) {\n\t\t\tcase 'coolfoto':\n\t\t\t\t$this->add_rating('coolfoto');\n\t\t\t\tbreak;\n\t\t\tcase 'no_coolfoto':\n\t\t\t\t$this->remove_rating('coolfoto');\n\t\t\t\tbreak;\n\t\t\tcase 'goodwork':\n\t\t\t\t$this->add_rating('goodwork');\n\t\t\t\tbreak;\n\t\t\tcase 'no_goodwork':\n\t\t\t\t$this->remove_rating('goodwork');\n\t\t\t\tbreak;\n\t\t\tcase 'nicetext':\n\t\t\t\t$this->add_rating('nicetext');\n\t\t\t\tbreak;\n\t\t\tcase 'no_nicetext':\n\t\t\t\t$this->remove_rating('nicetext');\n\t\t\t\tbreak;\n\t\t\tcase 'mething':\n\t\t\t\t$this->add_rating('mething');\n\t\t\t\tbreak;\n\t\t\tcase 'no_mething':\n\t\t\t\t$this->remove_rating('mething');\n\t\t\t\tbreak;\n\t\t}\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
OPERATIONS Short description of method getRelatedColumn | public function getRelatedColumn()
{
// section -122-48--89-8--1e6caf83:13aa9af80f4:-8000:00000000000009F2 begin
// section -122-48--89-8--1e6caf83:13aa9af80f4:-8000:00000000000009F2 end
} | [
"public function getReferencedColumn();",
"function getRelatedTable()\n {\n }",
"public function localColumn()\n {\n switch ($this->type()) {\n case 'BelongsTo':\n $column = $this->instance()->getForeignKey();\n break;\n case 'BelongsToMany':\n $column = $this->instance()->getParent()->getKeyName();\n break;\n case 'HasOne':\n $column = $this->instance()->getQualifiedParentKeyName();\n break;\n case 'HasMany':\n $column = $this->instance()->getQualifiedParentKeyName();\n break;\n default:\n throw new MezzoException('Relationship ' . $this->qualifiedName() . ' is not supported. ');\n }\n\n return $this->disqualifyColumn($column);\n }",
"public abstract function getRelationColumn($first_table, $second_table);",
"public function getRelationship();",
"abstract public static function getRelatedEntityName(): string;",
"public function getOrderableColumn();",
"public function get_foreign_table_column_name();",
"public function getRelationshipName();",
"protected function _getRelatedRecords(){ }",
"public function getRelated()\n {\n return $this->related;\n }",
"public function referenceColumnName();",
"public function getQualifiedModeratedByColumn()\n {\n return $this->getTable() . '.' . $this->getModeratedByColumn();\n }",
"public function referenceColumnName()\n {\n }",
"public function getRelatedEntity() : Property\n {\n return $this->related_entity;\n }",
"abstract public function getReverseRelatedName();",
"public function getValueRelation();",
"public function getRelated($key);",
"protected function fetchRelated(): ResultSet\n\t{\n\t\treturn $this->all();\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Used to create the page that list all the selected plans for the view and modify actions. Returns a partial view | public function listplansAction()
{
// get the session variables
$namespace = new Container('user');
$userID = $namespace->userID;
$role = $namespace->role;
// form for listing the plans
$form = new Plan('listplans');
// get the data from the request using json
$action = $_POST['action'];
$unit = $_POST['unit'];
$programs = $_POST['programs'];
$year = $_POST['year'];
$planId = $_POST['planId'];
// listPlansAction is also called if user chooses to delete a plan
// if there is a plan id present then it needs to be deleted from the database otherwise just list all the plans
if($planId > 0 ){
// update the active flag on the plans table to inactive or if draft, delete plan
// this will change the active flag on the reports table to inactive if a report exists for the plan
$this->getDatabaseData()->updatePlanActiveByPlanId($planId, $userID);
}
// create a partial view to send back to the caller
$partialView = new ViewModel(array(
'action' => $action,
'unit' => $unit,
'programs' => $programs,
'year' => $year,
'outcomes' => $this->getDatabaseData()->getOutcomes($unit, $programs, $year, $action),
'plans1' => $this->getDatabaseData()->getPlansWithOutcomes($unit, $programs, $year, $action),
'plans2' => $this->getDatabaseData()->getPlansWithMeta($unit, $programs, $year, $action),
'role'=> $role,
'form'=>$form,
));
$partialView->setTerminal(true);
return $partialView;
} | [
"public function plansAction()\n {\n $this->view('admin/plans', [], 'admin');\n }",
"public function viewplans() {\n //ensure admin is loggedin\n $admin = $this->Admins->find('all')->where(['user_id' => $this->Auth->user('id')])->first();\n\n if (!$admin) {\n $this->Flash->error('Please login to continue.');\n return $this->redirect(['controller' => 'Users', 'action' => 'login']);\n }\n $this->set('admin', $admin);\n $plans_table = TableRegistry::get('Plans');\n $all_plans = $plans_table->find();\n\n $this->set('all_plans', $all_plans);\n $this->viewBuilder()->layout('adminbackend');\n }",
"public function plans()\n {\n $plans = Plan::all();\n return view('frontend.pages.plans')->with(compact('plans'));\n }",
"public function index() {\n $plans = API::get('admin/plans');\n\n return View::make('admin/plan/index', array(\n 'plans' => $plans,\n 'title' => 'Plans',\n 'description' => 'Plans are standard templates for deploying virtual servers.'\n ));\n }",
"public function index()\n {\n $plans=App\\Plan::paginate(15);//pasamos todoos ls planes a la vista de admin\n return view ('admin.plan.index', compact('plans'));\n }",
"public function plan()\n {\n return view('menu.plan')->with('location', 'plan');\n }",
"public function view()\n {\n $repositories = Auth::user()->organization->repositories();\n $repositories->load('deploymentPlans');\n\n return view('pages.deployment_plans.view', compact('repositories'));\n }",
"public function view_plans(){\n\t\tif ($this->checkLogin('A') == ''){\n\t\t\tredirect(ADMIN_PATH);\n\t\t}else {\n\t\t\t$plan_id = $this->uri->segment(4,0);\n\t\t\t$condition = array('id' => $plan_id);\n\t\t\t$this->data['plans_details'] = $this->plans_model->get_all_details(PLANS,$condition);\n\t\t\tif ($this->data['plans_details']->num_rows() <=0){\n\t\t\t\tredirect(ADMIN_PATH);\n\t\t\t}\n\t\t\t\n\t\t\t$this->data['heading'] = 'View Plans';\n\t\t\t$this->load->view(ADMIN_PATH.'/plans/view_plans',$this->data);\n\t\t}\n\t}",
"public function actionIndex()\n {\n $session = Yii::app()->session;\n $session->remove('payment_gateway');\n $session->remove('plan_uid');\n $session->remove('currency_code');\n $session->remove('promo_code');\n \n $criteria = new CDbCriteria();\n $criteria->compare('status', PricePlan::STATUS_ACTIVE);\n $criteria->compare('visible', PricePlan::TEXT_YES);\n $criteria->order = 'sort_order ASC, plan_id DESC';\n $pricePlans = PricePlan::model()->findAll($criteria);\n \n $customer = Yii::app()->customer->getModel();\n $paymentMethods = array('' => Yii::t('app', 'Choose'));\n $paymentMethods = (array)Yii::app()->hooks->applyFilters('customer_price_plans_payment_methods_dropdown', $paymentMethods);\n \n $this->setData(array(\n 'pageMetaTitle' => $this->data->pageMetaTitle . ' | '. Yii::t('price_plans', 'View price plans'),\n 'pageHeading' => Yii::t('price_plans', 'View price plans'),\n 'pageBreadcrumbs' => array(\n Yii::t('price_plans', 'Price plans') => $this->createUrl('price_plans/index'),\n Yii::t('app', 'View all')\n )\n ));\n\n $this->render('list', compact('pricePlans', 'customer', 'paymentMethods'));\n }",
"public function create()\n {\n return view('pages.deployment_plans.create');\n }",
"public function planForm()\n {\n return view('super-admin.stripe.create-plan')->with('user', Auth::user());\n }",
"function view_disposal_plan()\n {\n $urldata = $this->uri->uri_to_assoc(3, array('m', 'i'));\n $data = assign_to_data($urldata); \n $data = add_msg_if_any($this, $data);\n \n # Pick all assigned data\n $searchstring2 = '';\n $pde = $this->session->userdata('pdeid');\n $userid = $this->session->userdata('userid');\n $isadmin = $this->session->userdata('isadmin');\n\n \n $searchstring = \" 1=1 \"; \n \n if($isadmin == 'N')\n {\n $searchstring .= \" AND b.userid=\".$userid.\" and b.pde=\".$pde.\" \";\n }\n $searchstring .= \" AND a.isactive='Y' order by a.dateadded DESC \";\n\n \n $data['disposal_plans'] = $this -> disposal -> fetch_disposal_plans($data,$searchstring);\n\n #exit($this->db->last_query());\n\n \n $data['page_title'] = 'View Disposal Plans ';\n $data['current_menu'] = 'view_disposal_plans';\n $data['view_to_load'] = 'disposal/view_disposal_plans_v';\n $data['view_data']['form_title'] = $data['page_title'];\n $data['search_url'] = 'disposal/search_disposal_plans';\n $this->load->view('dashboard_v', $data);\n }",
"public function edit_plan()\n\t{\n\t\t//Get the payment if from url\n\t\t$plan_id = $this->uri->segment(3);\n\t\t\n\t\t$data['title']= 'Edit Plan';\n\t\t\n\t\t//get data from table tbl_plan\n\t\t$fetchedData=$this->planModel->getPlanById($plan_id);\n\t\t$data['confData']=$fetchedData;\n\t\t\n\t\t$data['pageSource']= 'edit';\n\t\t$this->load->helper('form');\n\t\t$this->load->view('templates/admin_header',$data);\n\t\t$this->load->view('templates/navigation',$data);\n\t\t$this->load->view('templates/plan',$data);\n\t\t$this->load->view('templates/admin_footer',$data);\n\n\t}",
"public function planParty()\n { \n $this->layout->content = View::make('coordinator.plan');\n }",
"public function create() {\n return View::make('admin/plan/create', array(\n 'title' => 'Create Plan',\n ));\n }",
"protected function buildPage($plans) {\n $build = [\n '#theme' => 'container__pricing_and_plans',\n '#children' => [],\n '#attributes' => ['class' => ['pricing-and-plans']],\n '#cache' => [\n 'contexts' => [\n 'user',\n 'url.developer',\n ],\n 'tags' => [],\n 'max-age' => 300,\n ],\n '#attached' => ['library' => ['apigee_m10n/rate_plan.entity_list']],\n ];\n\n // Get the view mode from product bundle config.\n $view_mode = ($view_mode = $this->config(RatePlanConfigForm::CONFIG_NAME)->get('catalog_view_mode')) ? $view_mode : 'default';\n $view_builder = $this->entityTypeManager()->getViewBuilder('rate_plan');\n\n foreach ($plans as $id => $plan) {\n // TODO: Add a test for render cache.\n $build['#cache']['tags'] = Cache::mergeTags($build['#cache']['tags'], $plan->getCacheTags());\n // Generate a build array using the view builder.\n $build['#children'][$id] = $view_builder->view($plan, $view_mode);\n $build['#children'][$id]['#theme_wrappers'] = ['container__pricing_and_plans__item' => ['#attributes' => ['class' => ['pricing-and-plans__item']]]];\n }\n\n return $build;\n }",
"public function create()\n {\n \n \n return view('membership-plans.create');\n }",
"public function actionIndex()\n {\n $searchModel = new PlanSearch();\n $dataProvider = $searchModel->search(Yii::$app->request->queryParams);\n\n return $this->render('index', [\n 'searchModel' => $searchModel,\n 'dataProvider' => $dataProvider,\n ]);\n }",
"public function dietPlanList()\n\t{\n\t\t$this->load->view('plan/dietPlanList');\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ Editing a cameramaster | function edit($camera_id)
{
// check if the cameramaster exists before trying to edit it
$data['cameramaster'] = $this->Cameramaster_model->get_cameramaster($camera_id);
if(isset($data['cameramaster']['camera_id']))
{
if(isset($_POST) && count($_POST) > 0)
{
$params = array(
'camera_name' => $this->input->post('camera_name'),
'camera_startTime' => $this->input->post('camera_startTime'),
'camera_stopTime' => $this->input->post('camera_stopTime'),
'camera_inc' => $this->input->post('camera_inc'),
);
$this->Cameramaster_model->update_cameramaster($camera_id,$params);
redirect('cameramaster/index');
}
else
{
$data['_view'] = 'cameramaster/edit';
$this->load->view('layouts/main',$data);
}
}
else
show_error('The cameramaster you are trying to edit does not exist.');
} | [
"function updateCameras() {\n global $cameras, $dbh;\n //echo \"Fetching new Station Data\\n\";\n\n if ($result = $dbh->query('SELECT * FROM `webcams`')) {\n while ($row = $result->fetch(PDO::FETCH_BOTH)) {\n // cameras[id] = array('name' => name, 'dir' => data_fullpath)\n $cameras[$row['id']] = array('name' => $row['name'], 'from_dir' => $row['from_dir'],\n 'to_dir' => $row['to_dir'], 'to_url' => $row['to_url'], 'delay' => $row['delay'],\n 'last_sent' => $row['last_sent'], 'top_crop' => $row['top_crop'], 'bottom_crop' => $row['bottom_crop'],\n 'left_crop' => $row['left_crop'], 'right_crop' => $row['right_crop']);\n }\n }\n // keep track of when we last updated so we can refresh every so often\n $cameras['lastUpdate'] = time();\n\n initInotifyWatches();\n}",
"public function testUpdateDeviceCameraVideoSettings()\n {\n }",
"public function update(){\n if($this->deleted){\n throw new Exception('This camera has been deleted');\n return FALSE;\n }\n if(! $this->have_details){\n throw new Exception('You must call details() on a camera object before calling update()');\n return FALSE;\n }\n self::chomp($this->label);\n self::chomp($this->public_label);\n self::chomp($this->description, 512);\n self::chomp($this->address1);\n self::chomp($this->address2);\n self::chomp($this->address3);\n self::chomp($this->county, 50);\n self::chomp($this->postcode, 20);\n self::chomp($this->country, 50);\n $this->latitude=(float) $this->latitude;\n $this->longitude=(float) $this->longitude;\n $data=array('camera_id'=>$this->id,\n 'label'=>$this->label,\n 'description'=>$this->description,\n 'address1'=>$this->address1,\n 'address2'=>$this->address2,\n 'address3'=>$this->address3,\n 'county'=>$this->county,\n 'postcode'=>$this->postcode,\n 'country'=>$this->country,\n 'longitude'=>$this->longitude,\n 'latitude'=>$this->latitude,\n 'alerts'=>self::bool2str($this->alerts),\n 'record_video'=>self::bool2str($this->record_video),\n 'is_hidden'=>self::bool2str($this->is_hidden)\n );\n\n if($this->responseCode($this->call('update', $data, TRUE))==12000){\n return TRUE;\n }\n return FALSE;\n }",
"public function & SetCapture ($capture = 'camera');",
"public function Update()\n {\n // check config\n if (!$this->CheckConfig()) {\n return false;\n }\n\n // read cameras\n foreach ($this->Netatmo->_cameras AS $camera) {\n $local_snapshot_url = $this->_getLocalSnapshotUrl($camera['snapshot']);\n\n $this->data[$camera['id']] = [\n 'name' => $camera['name'],\n 'type' => $camera['type'],\n 'status' => $camera['status'],\n 'sd_status' => $camera['sd_status'],\n 'alim_status' => $camera['alim_status'],\n 'light_mode_status' => $camera['light_mode_status'],\n 'is_local' => $camera['is_local'],\n 'snapshot_local' => $local_snapshot_url,\n 'snapshot_vpn' => $camera['snapshot']\n ];\n }\n\n // save data\n $this->SaveData();\n }",
"public function setimagescene($scene)\n {\n }",
"function add()\n { \n if(isset($_POST) && count($_POST) > 0) \n { \n $params = array(\n\t\t\t\t'camera_name' => $this->input->post('camera_name'),\n\t\t\t\t'camera_startTime' => $this->input->post('camera_startTime'),\n\t\t\t\t'camera_stopTime' => $this->input->post('camera_stopTime'),\n\t\t\t\t'camera_inc' => $this->input->post('camera_inc'),\n );\n \n $cameramaster_id = $this->Cameramaster_model->add_cameramaster($params);\n redirect('cameramaster/index');\n }\n else\n { \n $data['_view'] = 'cameramaster/add';\n $this->load->view('layouts/main',$data);\n }\n }",
"function Camion() {// metodo constructor\n $this->ruedas=8;\n $this->color=\"gris\";\n $this->motor=2600;\n \n }",
"public function edit($id)\n {\n $camera = $this->cameraRepository->find($id);\n\n if (empty($camera)) {\n Flash::error(__('camera.notFoundErrorMessage'));\n\n return redirect(route('cameras.index'));\n }\n\n return view('cameras.edit')->with('camera', $camera);\n }",
"function ModifyCar() {\n $this->windowColor = \"red\"; \n $this->wheels = \"turbo\"; \n echo \"<hr><h4>Car Modified!</h4><hr>\";\n }",
"function help_edit_lens() {\n?>\n<h4>Edit lens</h4>\n<ul>\n<li>Edit the registered information as appropriate and save it</li>\n<li>The <b>Set lens' status</b> link is for removing the lens from the active lenses list. It is a kind of delete function though it will not be removed completely and can be listed later if there is need</li>\n</ul>\n<div class='text'></div>\n<?php\n}",
"function modify_media($attr)\n\t{\t\n\t\t$this->query->modify_media($attr['media_id'], $this->session->userdata('user_id'), $attr['genre'], \n\t\t\t\t\t $attr['title'], $attr['author'], $attr['publisher'], \n\t\t\t\t\t $attr['ISBN'], $attr['artist'], $attr['writer'],\n\t\t\t \t\t $attr['director']);\n\t}",
"function change_gd_img()\n\t{\n\t\t$img = trim( $this->ipsclass->txt_alphanumerical_clean( $this->ipsclass->input['img'] ) );\n\t\t\n\t\t$antispam = $this->ipsclass->DB->build_and_exec_query( array( 'select' => '*', 'from' => 'reg_antispam', 'where' => \"regid='\" . $this->ipsclass->DB->add_slashes( $img ) . \"'\" ) );\n\t\t\n\t\tif ( ! $antispam['regcode'] )\n\t\t{\n\t\t\t$this->class_ajax->print_nocache_headers();\n\t\t\t$this->class_ajax->return_string( '' );\n\t\t}\n\t\t\n\t\t$regid = md5( uniqid(microtime()) );\n\t\t\n\t\tif( $this->ipsclass->vars['bot_antispam'] == 'gd' )\n\t\t{\n\t\t\t//-----------------------------------------\n\t\t\t// Get 6 random chars\n\t\t\t//-----------------------------------------\n\t\t\t\t\t\t\t\n\t\t\t$reg_code = strtoupper( substr( $regid, 0, 6 ) );\n\t\t}\n\t\telse\n\t\t{\n\t\t\t//-----------------------------------------\n\t\t\t// Set a new 6 character numerical string\n\t\t\t//-----------------------------------------\n\n\t\t\t$reg_code = mt_rand(100000,999999);\n\t\t}\n\t\t\n\t\t// Clear old record first\n\t\t\n\t\t$this->ipsclass->DB->do_delete( 'reg_antispam', \"regid='\" . $this->ipsclass->DB->add_slashes( $antispam['regid'] ) . \"'\" );\n\t\t\n\t\t// Insert into the DB\n\t\t\n\t\t$this->ipsclass->DB->do_insert( 'reg_antispam', array (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'regid' => $regid,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'regcode' => $reg_code,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'ip_address' => $this->ipsclass->input['IP_ADDRESS'],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'ctime' => time(),\n\t\t\t\t\t\t\t\t\t\t\t\t\t) );\n\n\t\t$this->class_ajax->return_string( $regid );\n\t}",
"public function editCoverphotoAction(){\r\n\t\t$chanel_id = $this->_getParam('chanel_id', '0');\r\n\t\tif ($chanel_id == 0)\r\n\t\t\treturn;\r\n\t\t$chanel = Engine_Api::_()->getItem('sesvideo_chanel', $chanel_id);\r\n\t\tif(!$chanel)\r\n\t\t\treturn;\r\n\t\t$art_cover = $chanel->cover_id;\r\n\t\tif(isset($_FILES['Filedata']))\r\n\t\t\t$data = $_FILES['Filedata'];\r\n\t\telse if(isset($_FILES['webcam']))\r\n\t\t\t$data = $_FILES['webcam'];\r\n\t\t$chanel->setCoverPhoto($data);\r\n\t\tif($art_cover != 0){\r\n\t\t\t$im = Engine_Api::_()->getItem('storage_file', $art_cover);\r\n\t\t\t$im->delete();\r\n\t\t}\r\n\t\techo json_encode(array('status'=>\"true\",'src'=>Engine_Api::_()->storage()->get($chanel->cover_id)->getPhotoUrl()));die;\r\n\t}",
"public function setInfraredCamera(?Enablement $value): void {\n $this->getBackingStore()->set('infraredCamera', $value);\n }",
"public function setImageScene ($scene) {}",
"public function setImage($replace) {\n\t}",
"function update_campeonato($id_camp,$params)\n {\n $this->db->where('id_camp',$id_camp);\n return $this->db->update('campeonato',$params);\n }",
"public function editMovie ($request) {\n\n if ($request['miniImg'] == '') {\n\n $array = array(\n\n 'short' => $request['short'],\n 'title' => $request['title'],\n 'trailer' => $request['trailer'],\n 'full' => $request['full'],\n 'actors' => $request['actors'],\n 'funny' => $request['funny'],\n 'ostList' => $request['ostList'],\n 'status' => $request['status'],\n 'author' => $request['author'],\n\n );\n\n $where = $this->getAdapter()->quoteInto('id = ?', $request['id']);\n\n $this->update($array, $where);\n\n } else {\n\n $where = array(\n\n $this->getAdapter()->quoteInto('id = ?', $request['id'])\n\n );\n\n $this->update($request, $where);\n\n }\n\n return $this->getAdapter()->lastInsertId();\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the [id_club] column value. | public function getIdClub()
{
return $this->id_club;
} | [
"public function get_id_club()\n {\n return $this->id_club;\n }",
"public function getClubId()\n {\n return $this->clubId;\n }",
"public static function clubIdColumn()\n\t{\n\t\treturn 'club_id';\n\t}",
"public function getClubId() {\n $homeClubId = esc_attr( get_option('gw_tennis_home_club', 0) );\n return $homeClubId;\n // $clubs = $this->getEvent()->getClubs();\n // $found = false;\n // foreach( $clubs as $club ) {\n // if( $homeClubId === $club->getID()) {\n // $found = true;\n // }\n // }\n // return $found ? $homeClubId : 0;\n }",
"public function getClub()\n {\n return $this->club;\n }",
"function getClubById($myClubId){ \n $row = $this->wpdb->get_row(\"\n SELECT * \n FROM \n {$this->t1} \n WHERE \n club_id=$myClubId AND\n club_season='{$this->season}'\");\n return new Entities\\Club(\n $row ? $row->club_id : 0, \n $row ? $row->club_name : null, \n $row ? $row->club_string : null, \n $row ? $row->club_address : null, \n $row ? $row->club_img : null,\n $row ? $row->club_season : null\n );\n }",
"function get_goalsscorer_clubid($iid)\n{\n\t$result = mysql_query(\"SELECT scorer_clubid FROM goals WHERE idgoals=\" .$iid)or die(mysql_error());\n\t$num=mysql_numrows($result);\n\t$r = mysql_fetch_array($result);\n\t\n\t// Get info\n\t$scorer_clubid=$r[\"scorer_clubid\"];\n\t\n\t// return value\n\treturn $scorer_clubid;\n}",
"function get_playerclubid($iid)\n{\n\t$result = mysql_query(\"SELECT clubid FROM players WHERE idplayers=\" .$iid)or die(mysql_error());\n\t$num=mysql_numrows($result);\n\t$r = mysql_fetch_array($result);\n\t\n\t// Get player's clubid\n\t$clubid=$r[\"clubid\"];\n\t\n\t// return\n\treturn $clubid;\n}",
"public function get_team_id($club_id, $league_id)\n {\n global $wpdb;\n return $wpdb->get_var($wpdb->prepare(\"SELECT t.id\n FROM $wpdb->team t\n WHERE t.id_league = %d AND t.id_club = %d\", array($league_id, $club_id))\n );\n }",
"public function getClubName()\n {\n return $this->clubName;\n }",
"function getInfosByClubId($idClub){ \n return $this->wpdb->get_row(\"\n SELECT \n a.club_id, \n count(b.team_id) as teamsNbr \n FROM \n {$this->t1} a \n LEFT JOIN \n {$this->t3} b \n ON \n a.club_id = b.team_clubId \n WHERE \n b.team_clubId=$idClub;\");\n }",
"function getCampusID()\n {\n return $this->getValueByFieldName('campus_id');\n }",
"public function getClubname()\n\t{\n\t\treturn $this->clubname;\n\t}",
"public static function setNewClub($club)\n {\n $sth = DB::getInstance()->prepare('INSERT INTO `buh_clubs`(`club_name`) VALUES (:new_club)');\n $sth->execute(array('new_club' => $club));\n return DB::getInstance()->lastInsertId();\n }",
"function getIdCanastaAdicionalesClube($clubId, $producto){\n\t$clubesCanastaBase = get_option('clubes_usan_canasta_base');\n\n\tif (isset($clubesCanastaBase[$clubId])) {\n\t\treturn '11';\n\t}\n\n\treturn $clubId.'1';\n}",
"function get_goalhome_clubid($iid)\n{\n\t$result = mysql_query(\"SELECT home_clubid FROM goals WHERE idgoals=\" .$iid)or die(mysql_error());\n\t$num=mysql_numrows($result);\n\t$r = mysql_fetch_array($result);\n\t\n\t// Get info\n\t$home_clubid=$r[\"home_clubid\"];\n\t\n\t// return value\n\treturn $home_clubid;\n}",
"public function getVilleForClub($club) {\n $queryBuilder = new QueryBuilder($this->db);\n $queryBuilder\n ->select('c.villeClub')\n ->from('club', 'c')\n ->where('c.nomClub = :club')\n ->setParameter('club', $club);\n return $queryBuilder->execute()->fetch();\n }",
"public function club()\n {\n return $this->hasOne(self::APP_CLUB, 'id', 'club_id');\n }",
"protected function getConferenceIdAttribute()\n {\n return data_get($this->conference, 'id');\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Is this a student dealing with their own attempt/teacher previewing, or someone with 'mod/quiz:viewreports' reviewing someone elses attempt. | public function is_own_attempt() {
global $USER;
return $this->attempt->userid == $USER->id &&
(!$this->is_preview_user() || $this->attempt->preview);
} | [
"public function isReviewed();",
"public function isReviewed(): bool\n {\n return true;\n }",
"function display_results_allowed($user_id, $attempt_id)\n {\n // van_achter needs all scores for the attempt to be given\n if ($this->root_content_object->get_scale() == 'van_achter')\n {\n if (is_null($this->attempt_is_allowed))\n {\n $this->attempt_is_allowed = $this->get_root_content_object()->get_result_processor()->retrieve_scores(\n $this, \n $user_id, \n $attempt_id);\n }\n return $this->attempt_is_allowed;\n }\n return true;\n }",
"public function checkIfUserReviewd()\n {\n $this->objectReviewrsIds = $this->objectToBeReviewd->reviews()->pluck('user_id')->toArray();\n if (in_array($this->userId, $this->objectReviewrsIds)) {\n $this->userReviewdThisObject = true;\n }else{\n $this->userReviewdThisObject = false;\n };\n }",
"public function validateReviewer(): bool\n {\n $review = self::find()\n ->select(['shop_feedback.id', 'shop_feedback.shop_id', 'shop_feedback.created_by'])\n ->where(['shop_feedback.shop_id' => $this->shop_id, 'shop_feedback.created_by' => $this->created_by])\n ->asArray()\n ->one();\n if(!empty($review)){\n $this->addError('created_by',\n Yii::t('app', 'Вы уже добавляли отзыв об этом магазине, но Вы можете его изменить'));\n return false;\n } else {\n return true;\n }\n }",
"function isFinalQuizAllowed()\n{\n $currentUserId = auth()->user()->id;\n\n // Get the last chapter id from training chapter table\n $lastChapter = TrainingChapter::latest()->first();\n\n // Get the quiz report of current user and compare chapter id from last entry with $lastChapter->id\n $studyLog = QuizReport::mine()->completed()->regular()->passed()->latest()->first(); //dd($studyLog->toArray());\n\n if ( ! $studyLog ) {\n return false;\n } elseif ( $lastChapter->id !== $studyLog->chapter_id ) {\n return false;\n } else {\n return true;\n }\n\n /* // Check if user has already given the final quiz and passed\n $isGiven = QuizReport::mine()->completed()->final()->passed()->latest()->first(); dd($isGiven->toArray());\n if ( $isGiven ) {\n return false;\n } */\n\n}",
"public function canSeeExams(){\n if($this->isAdministrator() ||\n $this->isSUManagement() ||\n $this->isModerator() ||\n $this->roles()->where('role', 'Ověřený učitel')->exists() ||\n $this->roles()->where('role', 'Ověřený doktorand')->exists() ||\n $this->roles()->where('role', 'Student')->exists()\n ) {\n return true;\n } else return false;\n }",
"public function canReview()\n {\n if (!$this->reviewsAllowed()) return false;\n $user = Auth::user();\n return $user && ($user->id != $this->user_id && permission('VaultCreate'));\n }",
"public function getIsReviewer()\n {\n return $this->hasRole(Role::GROUP_REVIEWER);\n }",
"function learndash_can_attempt_again( $user_id, $quiz_id ) {\n\t$quizmeta = get_post_meta( $quiz_id, '_sfwd-quiz', true );\n\n\tif ( isset( $quizmeta['sfwd-quiz_repeats'] ) ) {\n\t\t$repeats = $quizmeta['sfwd-quiz_repeats'];\n\t} else {\n\t\t$repeats = '';\n\t}\n\n\t/**\n\t * Number of repeats for quiz\n\t *\n\t * @param int $repeats\n\t */\n\t$repeats = apply_filters( 'learndash_allowed_repeats', $repeats, $user_id, $quiz_id );\n\n\tif ( $repeats == '' ) {\n\t\treturn true;\n\t}\n\n\t$quiz_results = get_user_meta( $user_id, '_sfwd-quizzes', true );\n\n\t$count = 0;\n\n\tif ( ! empty( $quiz_results ) ) {\n\t\tforeach ( $quiz_results as $quiz ) {\n\t\t\tif ( $quiz['quiz'] == $quiz_id ) {\n\t\t\t\t$count++;\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( $repeats > $count - 1 ) {\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n}",
"public function is_faculty_advisor() {\n if($this->username == sge::config('facadv')){\n return true;\n }\n return false;\n }",
"public function isAllowedToReview() {\n return $this->isTranscribeJob() ||\n $this->isConformJob() ||\n $this->isTimingJob() ||\n $this->isStandaloneQa() ||\n $this->isStandaloneAcceptance();\n }",
"public function isReviewRequired(): bool;",
"public function isProposition()\n {\n $u = $this->user()->first();\n\n return auth()->user()->id != $u->id;\n }",
"public function isLecturer(){\n\n if(!$this->isStudent()){\n return true;\n }\n return false;\n }",
"public function is_review_poster() {\n\t\t$comment = $GLOBALS['comment'];\n\n\t\t$user = wp_get_current_user();\n\t\t$user_email = ( isset( $user->user_email ) ? $user->user_email : null );\n\n\t\tif ( $comment->comment_author_email == $user_email ) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}",
"public function isForReview()\n {\n return $this->for_review;\n }",
"public function is_student() {\n return $this->session->get(\"niveau_acces\") >= 0;\n }",
"function _hasAccess()\n {\n // create user object\n $user =& User::singleton();\n\n $timePoint =& TimePoint::singleton($_REQUEST['sessionID']);\n $candID = $timePoint->getCandID();\n\n $candidate =& Candidate::singleton($candID);\n\n // check user permissions\n return ($user->hasPermission('access_all_profiles') || $user->getData('CenterID') == $candidate->getData('CenterID') || $user->getData('CenterID') == $timePoint->getData('CenterID'));\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculates a resize dimension box that allows for outbound resize. The scaled image will be bigger than the requested dimensions in one dimension and then cropped. | protected function calculateOutboundScalingDimensions(BoxInterface $imageSize, BoxInterface $requestedDimensions)
{
$ratios = array(
$requestedDimensions->getWidth() / $imageSize->getWidth(),
$requestedDimensions->getHeight() / $imageSize->getHeight()
);
return $imageSize->scale(max($ratios));
} | [
"protected function calculateOutboundScalingDimensions(BoxInterface $imageSize, BoxInterface $requestedDimensions): BoxInterface\n {\n $ratios = [\n $requestedDimensions->getWidth() / $imageSize->getWidth(),\n $requestedDimensions->getHeight() / $imageSize->getHeight()\n ];\n\n return $imageSize->scale(max($ratios));\n }",
"function calcSize($image, $boxSize)\r\n{\r\n\tif ($image['width'] < $boxSize)\r\n\t{\r\n\t\t// Formula: desiredHeight = desiredWidth * (height/width)\r\n\t\t$image['height'] = $boxSize * ($image['height'] / $image['width']);\r\n\t\t$image['width'] = $boxSize;\r\n\t}\r\n\tif ($image['height'] < $boxSize)\r\n\t{\r\n\t\t// Formula: desiredWidth = desiredHeight * (width/height)\r\n\t\t$image['width'] = $boxSize * ($image['width'] / $image['height']);\r\n\t\t$image['height'] = $boxSize;\r\n\t}\r\n\tif ($image['width'] > $boxSize && $image['height'] > $boxSize)\r\n\t{\r\n\t\t// Wide image.\r\n\t\tif ($image['width'] > $image['height'])\r\n\t\t{\r\n\t\t\t// Bring height to $boxSize.\r\n\t\t\t$image['width'] = $boxSize * ($image['width'] / $image['height']);\r\n\t\t\t$image['height'] = $boxSize;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t// Bring width to $boxSize.\r\n\t\t\t$image['height'] = $boxSize * ($image['height'] / $image['width']);\r\n\t\t\t$image['width'] = $boxSize;\r\n\t\t}\r\n\t}\r\n\t$image['width'] = round($image['width']);\r\n\t$image['height'] = round($image['height']);\r\n\treturn $image;\r\n}",
"protected function calculateOutboundScalingDimensions(BoxInterface $imageSize, BoxInterface $requestedDimensions) {\n\t\t$ratios = array(\n\t\t\t$requestedDimensions->getWidth() / $imageSize->getWidth(),\n\t\t\t$requestedDimensions->getHeight() / $imageSize->getHeight()\n\t\t);\n\n\t\treturn $imageSize->scale(max($ratios));\n\t}",
"protected function calculateOutboundBox(BoxInterface $originalDimensions, $requestedWidth, $requestedHeight) {\n\t\t$newDimensions = new Box($requestedWidth, $requestedHeight);\n\n\t\tif ($this->getAllowUpScaling() === TRUE || $originalDimensions->contains($newDimensions) === TRUE) {\n\t\t\treturn $newDimensions;\n\t\t}\n\n\t\t// We need to make sure that the new dimensions are such that no upscaling is needed.\n\t\t$ratios = array(\n\t\t\t$originalDimensions->getWidth() / $requestedWidth,\n\t\t\t$originalDimensions->getHeight() / $requestedHeight\n\t\t);\n\n\t\t$ratio = min($ratios);\n\t\t$newDimensions = $newDimensions->scale($ratio);\n\n\t\treturn $newDimensions;\n\t}",
"public function get_optimal_dimension($orig_width, $orig_height, $new_width, $new_height, $resize_option='auto') {\r\n\r\n\t\tif($resize_option == self::RESIZE_EXACT){\r\n\t\t\t\r\n\t\t\t$optimal_width = $new_width;\r\n\t\t\t$optimal_height = $new_height;\r\n\t\t\t\r\n\t\t} else if($resize_option== self::RESIZE_PORTRAIT ){ // Prefer height, compute width\r\n\r\n\t\t\t$ratio = $orig_width / $orig_height;\r\n\t\t\t\r\n\t\t\t$optimal_width = $new_height * $ratio;\r\n\t\t\t$optimal_height= $new_height;\r\n\t\t\t\r\n\t\t} else if($resize_option== self::RESIZE_LANDSCAPE){ // Prefer width\r\n\t\t\t\r\n\t\t\t$ratio = $orig_height / $orig_width;\r\n\t\t\t\r\n\t\t\t$optimal_width = $new_width;\r\n\t\t\t$optimal_height = $new_width * $ratio;\r\n\r\n\t\t} else if($resize_option== self::RESIZE_CROP){ // Crop\r\n\t\t\t\r\n\t\t\t$height_ratio = $orig_height / $new_height;\r\n\t\t\t$width_ratio = $orig_width / $new_width;\r\n\r\n\t\t\tif ($height_ratio < $width_ratio) {\r\n\t\t\t\t$optimal_ratio = $height_ratio;\r\n\t\t\t} else {\r\n\t\t\t\t$optimal_ratio = $width_ratio;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t$optimal_width = $orig_width / $optimal_ratio;\r\n\t\t\t$optimal_height = $orig_height / $optimal_ratio;\r\n\t\t\t\r\n\r\n\t\t} else { // Auto\r\n\t\t\tif ($orig_height < $orig_width) { // Image to be resized is wider (landscape)\r\n\t\t\t\t\r\n\t\t\t\tlist($optimal_width, $optimal_height) = $this->get_optimal_dimension($orig_width, $orig_height, $new_width, $new_height, 'landscape');\r\n\t\t\t\t\r\n\t\t\t} elseif ($orig_height > $orig_width) { // Image to be resized is taller (portrait)\r\n\t\t\t\t\r\n\t\t\t\tlist($optimal_width, $optimal_height) = $this->get_optimal_dimension($orig_width, $orig_height, $new_width, $new_height, 'portrait');\r\n\t\t\t\t\r\n\t\t\t} else { // Image to be resized as a square\r\n\t\t\t\tif ($new_height < $new_width) { // Image to be resized is wider (landscape)\r\n\t\t\t\t\t\r\n\t\t\t\t\tlist($optimal_width, $optimal_height) = $this->get_optimal_dimension($orig_width, $orig_height, $new_width, $new_height, 'landscape');\r\n\r\n\t\t\t\t} else if ($new_height > $new_width) {\r\n\t\t\t\t\t\r\n\t\t\t\t\tlist($optimal_width, $optimal_height) = $this->get_optimal_dimension($orig_width, $orig_height, $new_width, $new_height, 'portrait');\r\n\r\n\t\t\t\t} else { // Square being resized to a square\r\n\t\t\t\t\t$optimal_width = $new_width;\r\n\t\t\t\t\t$optimal_height= $new_height;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn array( $optimal_width, $optimal_height );\r\n\t}",
"function half_image_resize_dimensions( $payload, $orig_w, $orig_h, $dest_w, $dest_h, $crop ){\r\n if($dest_w === 101){ //if half image size\r\n $width = $orig_w/2;\r\n $height = $orig_h/2;\r\n return array( 0, 0, 0, 0, $width, $height, $orig_w, $orig_h );\r\n } else { //do not use the filter\r\n return $payload;\r\n }\r\n}",
"private function sizeIntoBox(float|int $inWidth = 1, float|int $inHeight = 1, float|int $boxWidth = 1, float|int $boxHeight = 1, string $mode = '', bool|int $rounding = false): bool|array\n {\n //scale using $boxWidth\n $outWidthUsingBoxWidth = $boxWidth;\n $outHeightUsingBoxWidth = ($boxWidth / $inWidth) * $inHeight;\n $outAreaUsingBoxWidth = $outWidthUsingBoxWidth * $outHeightUsingBoxWidth;\n if ($rounding) {\n if (is_int($rounding)) {\n $roundToDigits = $rounding;\n } else {\n $roundToDigits = 0;\n }\n $outHeightUsingBoxWidth = round($outHeightUsingBoxWidth, $roundToDigits);\n }\n\n //scale using $boxHeight\n $outWidthUsingBoxHeight = ($boxHeight / $inHeight) * $inWidth;\n $outHeightUsingBoxHeight = $boxHeight;\n $outAreaUsingBoxHeight = $outWidthUsingBoxHeight * $outHeightUsingBoxHeight;\n if ($rounding) {\n if (is_int($rounding)) {\n $roundToDigits = $rounding;\n } else {\n $roundToDigits = 0;\n }\n $outWidthUsingBoxHeight = round($outWidthUsingBoxHeight, $roundToDigits);\n }\n\n if (strtolower($mode) == 'fit') {\n //select based on min area\n if ($outAreaUsingBoxWidth <= $outAreaUsingBoxHeight) {\n return ['width' => $outWidthUsingBoxWidth, 'height' => $outHeightUsingBoxWidth];\n } else {\n return ['width' => $outWidthUsingBoxHeight, 'height' => $outHeightUsingBoxHeight];\n }\n } elseif (strtolower($mode) == 'fill') {\n //select based on max area\n if ($outAreaUsingBoxWidth >= $outAreaUsingBoxHeight) {\n return ['width' => $outWidthUsingBoxWidth, 'height' => $outHeightUsingBoxWidth];\n } else {\n return ['width' => $outWidthUsingBoxHeight, 'height' => $outHeightUsingBoxHeight];\n }\n } elseif (strtolower($mode) == 'stretch') {\n return ['width' => $boxWidth, 'height' => $boxHeight];\n } else {\n return false;\n }\n }",
"private function getResizeDimensions(\n array $originalSize,\n array $targetSize\n ) {\n list ($originalWidth, $originalHeight) = array_values($originalSize);\n list ($targetWidth, $targetHeight) = array_values($targetSize);\n // Calculate the aspect ratios of original and target sizes.\n $originalAspect = round($originalWidth / $originalHeight,\n $this->aspectPrecision);\n if (!$targetHeight) {\n $targetHeight = round($targetWidth / $originalAspect);\n } elseif (!$targetWidth) {\n $targetWidth = round($targetHeight * $originalAspect);\n }\n $targetAspect = round($targetWidth / $targetHeight,\n $this->aspectPrecision);\n // Store default values which will be used by default.\n $resizeBox = new Box($targetWidth, $targetHeight);\n $finalImageSize = clone $resizeBox;\n $cropPoint = new Point(0, 0);\n // If the aspect ratios do not match, means that\n // the image must be adjusted to maintain adequate proportions.\n if ($originalAspect != $targetAspect) {\n // Get the smallest side of the image.\n // This is required to calculate target resize of the\n // image to crop from, so at least one side fits.\n $_x = $originalWidth / $targetWidth;\n $_y = $originalHeight / $targetHeight;\n $min = min($_x, $_y);\n $box_width = (int)round($originalWidth / $min);\n $box_height = (int)round($originalHeight / $min);\n $resizeBox = new Box($box_width, $box_height);\n // Get the coordinates where from to crop the final portion.\n // This one crops from the center of the resized image.\n $crop_x = $box_width / 2 - $targetWidth / 2;\n $crop_y = 0; // $box_height / 2 - $targetHeight / 2;\n $cropPoint = new Point($crop_x, $crop_y);\n }\n\n return [\n 'resize' => $resizeBox,\n 'crop' => $cropPoint,\n 'final_size' => $finalImageSize,\n ];\n }",
"function compute($in_size, $coi, &$crop_rect, &$scale_size)\n {\n $destCrop = new ImageRect($in_size);\n\n if ($this->max_crop > 0)\n {\n $ratio_w = $destCrop->width() / $this->ideal_size[0];\n $ratio_h = $destCrop->height() / $this->ideal_size[1];\n if ($ratio_w>1 || $ratio_h>1)\n {\n if ($ratio_w > $ratio_h)\n {\n $h = $destCrop->height() / $ratio_w;\n if ($h < $this->min_size[1])\n {\n $idealCropPx = $destCrop->width() - floor($destCrop->height() * $this->ideal_size[0] / $this->min_size[1]);\n $maxCropPx = round($this->max_crop * $destCrop->width());\n $destCrop->crop_h( min($idealCropPx, $maxCropPx), $coi);\n }\n }\n else\n {\n $w = $destCrop->width() / $ratio_h;\n if ($w < $this->min_size[0])\n {\n $idealCropPx = $destCrop->height() - floor($destCrop->width() * $this->ideal_size[1] / $this->min_size[0]);\n $maxCropPx = round($this->max_crop * $destCrop->height());\n $destCrop->crop_v( min($idealCropPx, $maxCropPx), $coi);\n }\n }\n }\n }\n\n $scale_size = array($destCrop->width(), $destCrop->height());\n\n $ratio_w = $destCrop->width() / $this->ideal_size[0];\n $ratio_h = $destCrop->height() / $this->ideal_size[1];\n if ($ratio_w>1 || $ratio_h>1)\n {\n if ($ratio_w > $ratio_h)\n {\n $scale_size[0] = $this->ideal_size[0];\n $scale_size[1] = floor(1e-6 + $scale_size[1] / $ratio_w);\n }\n else\n {\n $scale_size[0] = floor(1e-6 + $scale_size[0] / $ratio_h);\n $scale_size[1] = $this->ideal_size[1];\n }\n }\n else\n {\n $scale_size = null;\n }\n\n $crop_rect = null;\n if ($destCrop->width()!=$in_size[0] || $destCrop->height()!=$in_size[1] )\n {\n $crop_rect = $destCrop;\n }\n }",
"private function _getResizeSize() {\n\t\t$width = $height = 0;\n\n\t\tif (Configure::check('GalleryOptions.Pictures.resize_to.0')) {\n\t\t\t$width = Configure::read('GalleryOptions.Pictures.resize_to.0');\n\t\t}\n\n\t\tif (Configure::check('GalleryOptions.Pictures.resize_to.1')) {\n\t\t\t$height = Configure::read('GalleryOptions.Pictures.resize_to.1');\n\t\t}\n\n\t\t$crop = Configure::read('GalleryOptions.Pictures.resize_to.2');\n\t\t$action = $crop ? \"crop\" : \"\";\n\n\t\treturn array(\n\t\t\t'width' => $width,\n\t\t\t'height' => $height,\n\t\t\t'action' => $action\n\t\t);\n\t}",
"protected function getDimensions()\n {\n\n list($originalWidth, $originalHeight) = getimagesize($this->originalFile);\n\n //get original sizes to create the function\n $this->oldHeight = $originalHeight;\n $this->oldWidth = $originalWidth;\n\n\n $scaleRatio = $originalWidth / $originalHeight;\n if (($this->newWidth/$this->newHeight) > $scaleRatio){\n $this->newWidth = $this->newHeight * $scaleRatio;\n } else {\n $this->newHeight = $this->newWidth/$scaleRatio;\n }\n }",
"private function calculateNewDimensions() {\n $aspectRatio = $this->width / $this->height;\n\n if ($this->cropToFit && $this->newWidth && $this->newHeight) {\n $targetRatio = $this->newWidth / $this->newHeight;\n $this->cropWidth = $targetRatio > $aspectRatio ? $this->width : round($this->height * $targetRatio);\n $this->cropHeight = $targetRatio > $aspectRatio ? round($this->width / $targetRatio) : $this->height;\n if ($this->verbose) { \n $this->verbose(\"Crop to fit into box of {$this->newWidth}x{$this->newHeight}. Cropping dimensions: {$this->cropWidth}x{$this->cropHeight}.\"); \n }\n }\n else if ($this->newWidth && !$this->newHeight) {\n $this->newHeight = round($this->newWidth / $aspectRatio);\n if ($this->verbose) { \n $this->verbose(\"New width is known {$this->newWidth}, height is calculated to {$this->newHeight}.\"); \n }\n }\n else if (!$this->newWidth && $this->newHeight) {\n $this->newWidth = round($this->newHeight * $aspectRatio);\n if ($this->verbose) { \n $this->verbose(\"New height is known {$this->newHeight}, width is calculated to {$this->newWidth}.\"); \n }\n }\n else if ($this->newWidth && $this->newHeight) {\n $ratioWidth = $this->width / $this->newWidth;\n $ratioHeight = $this->height / $this->newHeight;\n $ratio = ($ratioWidth > $ratioHeight) ? $ratioWidth : $ratioHeight;\n $this->newWidth = round($this->width / $ratio);\n $this->newHeight = round($this->height / $ratio);\n if ($this->verbose) { \n $this->verbose(\"New width & height is requested, keeping aspect ratio results in {$this->newWidth}x{$this->newHeight}.\"); \n }\n }\n else {\n $this->newWidth = $this->width;\n $this->newHeight = $this->height;\n if ($this->verbose) { \n $this->verbose(\"Keeping original width & heigth.\"); \n }\n }\n }",
"public function CalcWidthHeight()\n {\n list($this->width, $this->height) = $this->imgInfo;\n\n $aspectRatio = $this->width / $this->height;\n\n if($this->cropToFit && $this->newWidth && $this->newHeight) {\n $targetRatio = $this->newWidth / $this->newHeight;\n $this->cropWidth = $targetRatio > $aspectRatio ? $this->width : round($this->height * $targetRatio);\n $this->cropHeight = $targetRatio > $aspectRatio ? round($this->width / $targetRatio) : $this->height;\n if($this->verbose) { self::verbose(\"Crop to fit into box of {$this->newWidth}x{$this->newHeight}. Cropping dimensions: {$this->cropWidth}x{$this->cropHeight}.\"); }\n }\n else if($this->newWidth && !$this->newHeight) {\n $this->newHeight = round($this->newWidth / $aspectRatio);\n if($this->verbose) { self::verbose(\"New width is known {$this->newWidth}, height is calculated to {$this->newHeight}.\"); }\n }\n else if(!$this->newWidth && $this->newHeight) {\n $this->newWidth = round($this->newHeight * $aspectRatio);\n if($this->verbose) { self::verbose(\"New height is known {$this->newHeight}, width is calculated to {$this->newWidth}.\"); }\n }\n else if($this->newWidth && $this->newHeight) {\n $ratioWidth = $this->width / $this->newWidth;\n $ratioHeight = $this->height / $this->newHeight;\n $ratio = ($ratioWidth > $ratioHeight) ? $ratioWidth : $ratioHeight;\n $this->newWidth = round($this->width / $ratio);\n $this->newHeight = round($this->height / $ratio);\n if($this->verbose) { self::verbose(\"New width & height is requested, keeping aspect ratio results in {$this->newWidth}x{$this->newHeight}.\"); }\n }\n else {\n $this->newWidth = $this->width;\n $this->newHeight = $this->height;\n if($this->verbose) { self::verbose(\"Keeping original width & heigth.\"); }\n }\n }",
"private function calculateDimensionsHeightFixed()\n {\n $this->_height = $this->getRenderOptions()->getHeight();\n $newWidth = $this->getSourceImage()->getWidth() / $this->getSourceImage()->getHeight() * $this->_height;\n if($this->getRenderOptions()->getMin() !== PixlieRenderOptions::AUTO AND $newWidth < $this->getRenderOptions()->getMin()){\n $newWidth = $this->getRenderOptions()->getMin();\n }\n if($this->getRenderOptions()->getMax() !== PixlieRenderOptions::AUTO AND $newWidth > $this->getRenderOptions()->getMax()){\n $newWidth = $this->getRenderOptions()->getMax();\n }\n $this->_width = (int) round($newWidth,0);\n }",
"public function imageCalcNewSize(&$img)\n {\n // clear old calculations\n $this->output_width = $this->output_height = null;\n // find image dimensions and derive portrait/landscape\n // @todo @refactor ; use $this->entry->getMetadata()->getOrientation()\n $width = imagesx($img);\n $height = imagesy($img);\n $portrait = false;\n if ($height > $width) {\n $portrait = true;\n }\n // resize based on longest edge and args\n // exactly 1 restriction is always set\n if ($portrait) {\n // use either max(width|height) as determinant, but don't set both (hence else if)\n if (isset($this->args->{'maxheight'})) {\n $this->output_height = $this->args->{'maxheight'};\n } else if (isset($this->args->{'maxlongest'})) {\n // set the height to be maxlongest\n // allow newwidth to be derived\n $this->output_height = $this->args->{'maxlongest'};\n } else if (isset($this->args->{'maxshortest'})) {\n // set the width to be maxshortest\n // allow newheight to be derived\n $this->output_width = $this->args->{'maxshortest'};\n } else if (isset($this->args->{'maxwidth'})) {\n // cover odd portrait case where only width is restricted (maxwidth defined, but maxheight unset)\n $this->output_width = $this->args->{'maxwidth'};\n }\n } else {\n if (isset($this->args->{'maxwidth'})) {\n $this->output_width = $this->args->{'maxwidth'};\n } else if (isset($this->args->{'maxlongest'})) {\n // set the width to be maxlongest\n // allow newheight to be derived\n $this->output_width = $this->args->{'maxlongest'};\n } else if (isset($this->args->{'maxshortest'})) {\n // set the height to be maxshortest\n // allow newwidth to be derived\n $this->output_height = $this->args->{'maxshortest'};\n } else if (isset($this->args->{'maxheight'})) {\n // cover odd landscape case where only height is restricted (maxheight defined, but maxwidth unset)\n $this->output_height = $this->args->{'maxheight'};\n }\n }\n // don't allow image to exceed original at 200%\n $argsactor = 2;\n if (isset($this->output_width) && $this->output_width > $argsactor * $width) {\n $this->output_width = round($argsactor * $height, 1);\n }\n if (isset($this->output_height) && $this->output_height > $argsactor * $width) {\n $this->output_height = round($argsactor * $height, 1);\n }\n // catch case where we haven't restricted either dimension\n if (!isset($this->output_width) && !isset($this->output_height)) {\n $this->output_width = $width;\n $this->output_height = $height;\n } else {\n // derive unset dimension using restricted one\n if (!isset($this->output_width)) {\n $this->output_width = round($this->output_height * $width / $height, 1);\n }\n if (!isset($this->output_height)) {\n $this->output_height = round($this->output_width * $height / $width, 1);\n }\n }\n }",
"private function calculateSize()\n\t{\n\t\tif ($this->maxWidth > 0)\n {\n $ratioWidth = $this->maxWidth / $this->sourceWidth;\n }\n if ($this->maxHeight > 0)\n {\n $ratioHeight = $this->maxHeight / $this->sourceHeight;\n }\n\n if ($this->scale)\n {\n if ($this->maxWidth && $this->maxHeight)\n {\n $ratio = ($ratioWidth < $ratioHeight) ? $ratioWidth : $ratioHeight;\n }\n if ($this->maxWidth xor $this->maxHeight)\n {\n $ratio = (isset($ratioWidth)) ? $ratioWidth : $ratioHeight;\n }\n if ((!$this->maxWidth && !$this->maxHeight) || (!$this->inflate && $ratio > 1))\n {\n $ratio = 1;\n }\n\n $this->thumbWidth = floor($ratio * $this->sourceWidth);\n $this->thumbHeight = floor($ratio * $this->sourceHeight);\n }\n else\n {\n if (!$ratioWidth || (!$this->inflate && $ratioWidth > 1))\n {\n $ratioWidth = 1;\n }\n if (!$ratioHeight || (!$this->inflate && $ratioHeight > 1))\n {\n $ratioHeight = 1;\n }\n $this->thumbWidth = floor($ratioWidth * $this->sourceWidth);\n $this->thumbHeight = floor($ratioHeight * $this->sourceHeight);\n }\n\t}",
"private function getDimensions()\n\t{\n\t\t$box = imagettfbbox($this->getFontSize(), 0, $this->getFontFile(), $this->getWord());\n\t\t$box['width'] = $box[2] - $box[0];\n\t\t$box['height'] = $box[3] - $box[5];\n\n\t\tif ($this->getImageWidth() === 0) {\n\t\t\t$this->setImageWidth($box['width'] + $this->getTextMargin());\n\t\t}\n\t\tif ($this->getImageHeight() === 0) {\n\t\t\t$this->setImageHeight($box['height'] + $this->getTextMargin());\n\t\t}\n\n\t\treturn $box;\n\t}",
"function getScaledSize($image_id, $size, &$width, &$height)\r\n\t{\r\n\t\t$this->getSize($image_id, $width, $height);\r\n\t\t\r\n\t\tif ($width > $height)\r\n\t\t{\r\n\t\t\t$height = $height * $size / $width;\r\n\t\t\t$width = $size;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t$width = $width * $size / $height;\r\n\t\t\t$height = $size;\r\n\t\t}\r\n\t}",
"protected function getDimensions()\n {\n list($originalWidth, $originalHeight) = getimagesize($this->originalFilePath);\n //get original sizes to create the function\n $this->oldHeight = $originalHeight;\n $this->oldWidth = $originalWidth;\n\n $scaleRatio = $originalWidth / $originalHeight;\n if (($this->newWidth/$this->newHeight) > $scaleRatio){\n $this->newWidth = $this->newHeight * $scaleRatio;\n } else {\n $this->newHeight = $this->newWidth/$scaleRatio;\n }\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
updateServer() should update a server record. | public function testUpdateServer()
{
// Create server.
$server = $this->__server();
// Mock post.
$post = array(
'name' => 'New Title',
'url' => 'http://www.new.org/fedora'
);
// Pass in new data, re-get.
$this->serversTable->updateServer($server, $post);
$newServer = $this->serversTable->find($server->id);
// Check for updated values.
$this->assertEquals($newServer->name, 'New Title');
$this->assertEquals($newServer->url, 'http://www.new.org/fedora');
} | [
"public function testUpdateServer()\n {\n\n // Create server.\n $server = $this->_server();\n\n // Mock post.\n $post = array(\n 'name' => 'New Title',\n 'url' => 'http://www.new.org/fedora'\n );\n\n // Pass in new data, re-get.\n $this->serversTable->updateServer($server, $post);\n $newServer = $this->serversTable->find($server->id);\n\n // Check for updated values.\n $this->assertEquals($newServer->name, 'New Title');\n $this->assertEquals($newServer->url, 'http://www.new.org/fedora');\n\n }",
"public function updateServer(array $server)\n\t{\n\t}",
"public function updated(Server $server)\n {\n //\n }",
"public function updateSingleServer($server){\n GetUsersFromServer::dispatch($server);\n }",
"public function updating(Server $server)\n {\n event(new Events\\Server\\Updating($server));\n }",
"public function testUpdateLdapServer()\n {\n }",
"function server_update($paramers){\n\t\t\t\n\t\t\t$server_id = $_POST['server_id'];\n\t\t\tif($paramers['type'] == 'mail'){\n\t\t\t\t$paramers['host'] = 'localhost';\n\t\t\t}\n\t\t\tif(!empty($paramers['password'])){\n\t\t\t\t$paramers['password'] = $this->authcode($paramers['password'],'ENCODE');\n\t\t\t}\n\t\t\t\n\t\t\tif(!empty($server_id) && is_numeric($server_id)){\n\t\t\t\t//UPDATE\n\t\t\t\t$this->db->update($this->pre.'mailmaga_x_servers',\n\t\t\t\t$paramers,\n\t\t\t\tarray('server_id' => $server_id));\n\t\t\t\t$location = 'admin.php?page=mailmaga_x_page_servers&message=2';\n\t\t\t}else{\n\t\t\t\t$this->db->insert($this->pre.'mailmaga_x_servers', $paramers);\n\t\t\t\t$location = 'admin.php?page=mailmaga_x_page_servers&message=1';\n\t\t\t}\n\t\t\t$this->redirect($location);\n\t\t}",
"private function _updateServer($form) {\n // XXX some -> models/FedoraConnector/Server.php\n $data = $form->getValues();\n\n $version = $this->_getServerVersion($data['url']);\n if ($version !== null) {\n $data = array(\n 'name' => $data['name'],\n 'url' => $data['url'],\n 'is_default' => $data['is_default'],\n 'version' => $version\n );\n if ($data['method'] == 'update') {\n $data['id'] = $data['id'];\n }\n\n try {\n $db = get_db();\n\n // If the new server is the default, clear is_default\n // for the existing ones.\n if ($data['is_default'] == '1') {\n $this->_resetIsDefault();\n }\n\n $db->insert('fedora_connector_servers', $data);\n\n $this->flashSuccess('Server updated.');\n $this->redirect->goto('index');\n\n } catch (Exception $e) {\n $this->flashError($e->getMessage());\n }\n\n } else {\n $this->flashError(\n 'Server URL cannot be validated. '\n . 'Not receiving Fedora repositoryVersion response.'\n );\n $this->view->form = $form;\n }\n }",
"public static function update_new_sever($table_id,$server){\n\t\tif(is_gt_zero_num($table_id) && is_gt_zero_num($server)){\t\t\n\t\t$sess_id = \ttbl_table_customer_session::getActiveTblSession($table_id); \n\t\t if(is_gt_zero_num($sess_id)){ \n\t\t return\tDB::ExecNonQry('UPDATE '.TBL_TABLE_STATUS_LINK.' SET '.TBL_STS_LNK_EMP_ID.' = '.$server.' WHERE '.TBL_STS_LNK_TABLE_ID.' = '.$table_id.' AND '.TBL_STS_LNK_SESSION_ID.' = '.$sess_id.';'); \n\t\t } \n\t\t} \n\t\treturn OPERATION_FAIL;\n\t}",
"public function updateServerListInDb() {\n $api = $this->api;\n $remoteServers = $api->getServerList();\n\n $servers = $this->storage->getServerList();\n\n $processedIds = [];\n\n foreach ($remoteServers as $remoteServer) {\n $found = false;\n foreach ($servers as $server) {\n if ($server['hostid'] == $remoteServer['hostid']) {\n $found = true;\n break;\n }\n }\n\n if ($found) {\n $this->storage->updateServerInfo($remoteServer);\n\n } else {\n $this->storage->addServerInfo($remoteServer);\n }\n $processedIds[] = $remoteServer['hostid'];\n\n }\n $this->storage->deleteServersNotInList($processedIds);\n }",
"function save_server($server) {\n\ttry {\n\t\t# Get connected\n\t\t$dbh = get_dbh();\n\n\t\t# Create the server if necessary\n\t\t$stmt = $dbh->prepare('SELECT name FROM servers WHERE username = ? AND name = ?');\n\t\t$stmt->execute(array($server['username'], $server['name']));\n\t\tif (! is_array($stmt->fetch())) {\n\t\t\t$stmt = $dbh->prepare('INSERT INTO servers (username, name, id) VALUES (?, ?, ?)');\n\t\t\t$stmt->execute(array($server['username'], $server['name']));\n\t\t}\n\n\t\t# Update the DB from our local array\n\t\t$stmt = $dbh->prepare('UPDATE servers SET address = ?, port = ?, id = ? WHERE username = ? AND name = ?');\n\t\t$stmt->execute(array($server['address'], $server['port'], $server['id'], $server['username'], $server['name']));\n\t} catch (PDOException $e) {\n\t\terror(0, 'DB error in save_server: ' . $e->getMessage());\n\t}\n\n\treturn TRUE;\n}",
"public function testUpdateClient()\n {\n }",
"public function edit(Server $server)\n {\n //\n }",
"public function updateAllServerInfo() {\n // getting server list from DB\n $connection = $this->getSqlConnection();\n $sql = 'SELECT * FROM `game_servers` WHERE `no_response_counter` < 3';\n $statement = $connection->prepare($sql);\n $statement->execute();\n\n // init\n $noResponseServerList = array();\n $sql = \"UPDATE `game_servers` SET `server_name` = :server_name, `game_port` = :game_port, `map_name` = :map_name, `game_dir` = :game_dir, `game_desc` = :game_desc, `max_players` = :max_players, `number_of_players` = :number_of_players, `no_response_counter` = :no_response_counter, `game_server_update` = :game_server_update WHERE `game_server_id` = :game_server_id\";\n $updateServerStatement = $connection->prepare($sql);\n $updateTime = time();\n\n // update each server info\n while ($gameServerRecord = $statement->fetch(PDO::FETCH_ASSOC)) {\n $ipAddress = $gameServerRecord['ip'];\n $queryPort = $gameServerRecord['query_port'];\n //$country = $gameServerRecord['country'];\n\n $players = null;\n $serverInfo = null;\n $srcServer = null;\n\n try {\n $srcServer = new GoldSrcServer($ipAddress, $queryPort);\n //$srcServer->initialize();\n //$players = $srcServer->getPlayers();\n $serverInfo = $srcServer->getServerInfo();\n } catch (Exception $e) {\n $noResponseServerList[] = $gameServerRecord;\n continue;\n }\n\n /*\n if ($gameServerRecord['no_response_counter'] == 0 &&\n $gameServerRecord['server_name'] == $serverInfo['serverName'] &&\n $gameServerRecord['game_port'] == $serverInfo['serverPort'] &&\n $gameServerRecord['map_name'] == $serverInfo['manName'] &&\n $gameServerRecord['game_dir'] == $serverInfo['gameDir'] &&\n $gameServerRecord['game_desc'] == $serverInfo['gameDesc'] &&\n $gameServerRecord['max_Players'] == $serverInfo['maxPlayers'] &&\n $gameServerRecord['number_of_players'] == $serverInfo['numberOfPlayers']\n ) {\n continue;\n }\n */\n\n $updateServerStatement->bindParam(':server_name', $serverInfo['serverName']);\n $updateServerStatement->bindParam(':game_port', $serverInfo['serverPort']);\n $updateServerStatement->bindParam(':map_name', $serverInfo['mapName']);\n $updateServerStatement->bindParam(':game_dir', $serverInfo['gameDir']);\n $updateServerStatement->bindParam(':game_desc', $serverInfo['gameDesc']);\n $updateServerStatement->bindParam(':max_players', $serverInfo['maxPlayers']);\n $updateServerStatement->bindParam(':number_of_players', $serverInfo['numberOfPlayers']);\n $updateServerStatement->bindValue(':no_response_counter', 0);\n $updateServerStatement->bindParam(':game_server_update', $updateTime);\n $updateServerStatement->bindParam(':game_server_id', $gameServerRecord['game_server_id']);\n $updateServerStatement->execute();\n }\n\n // update the servers did not respond\n $sql = \"UPDATE `game_servers` SET `no_response_counter` = :no_response_counter, `game_server_update` = :game_server_update WHERE `game_server_id` = :game_server_id\";\n $updateServerStatement = $connection->prepare($sql);\n foreach ($noResponseServerList as $gameServerRecord) {\n $noResponseCounter = $gameServerRecord['no_response_counter'] + 1;\n $updateServerStatement->bindParam(':no_response_counter', $noResponseCounter);\n $updateServerStatement->bindParam(':game_server_update', $updateTime);\n $updateServerStatement->bindParam(':game_server_id', $gameServerRecord['game_server_id']);\n $updateServerStatement->execute();\n }\n }",
"public function testReplaceServer()\n {\n }",
"public function update(Request $request, GraphQLServer $server)\n {\n\t\t$server->fill($request->all())->save();\n\t\t$request->session()->flash('status', 'Server Updated!');\n\t\treturn $this->index();\n }",
"public function onSetServer(\\swoole_server $server)\r\n {\r\n $this->server = $server;\r\n }",
"public function setServer(array $server)\n\t{\n\t\t$this->_server = $server;\n\t}",
"function updateClientVersion() {\n\t\tglobal $fmdb, $__FM_CONFIG;\n\t\t\n\t\tif (array_key_exists('server_client_version', $_POST)) {\n\t\t\t$query = \"UPDATE `fm_{$__FM_CONFIG[$_POST['module_name']]['prefix']}servers` SET `server_client_version`='\" . $_POST['server_client_version'] . \"' WHERE `server_serial_no`='\" . $_POST['SERIALNO'] . \"' AND `account_id`=\n\t\t\t\t(SELECT account_id FROM `fm_accounts` WHERE `account_key`='\" . $_POST['AUTHKEY'] . \"')\";\n\t\t\t$fmdb->query($query);\n\t\t}\n\t\t\n\t\tif (array_key_exists('server_os_distro', $_POST)) {\n\t\t\t$query = \"UPDATE `fm_{$__FM_CONFIG[$_POST['module_name']]['prefix']}servers` SET `server_os_distro`='\" . $_POST['server_os_distro'] . \"' WHERE `server_serial_no`='\" . $_POST['SERIALNO'] . \"' AND `account_id`=\n\t\t\t\t(SELECT account_id FROM `fm_accounts` WHERE `account_key`='\" . $_POST['AUTHKEY'] . \"')\";\n\t\t\t$fmdb->query($query);\n\t\t}\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check user payment with GET data | protected function userPayment()
{
$this->authority = @$_GET['Authority'];
$status = @$_GET['Status'];
if ($status == 'OK') {
return true;
}
$this->transactionFailed();
$this->newLog("Error", "NOK");
throw new ZarinpalException("Error");
} | [
"protected function userPayment()\n {\n $token = @$_GET['token'];\n $paymentStatus = @$_GET['payment_status'];\n\n if ($paymentStatus == 'OK') {\n return true;\n }\n\n\t $this->transactionFailed();\n $this->newLog(0, $paymentStatus);\n\t throw new VandarException($paymentStatus, 0);\n }",
"protected function userPayment()\n {\n $status = @$_GET['status'];\n\n if ($status == 'PURCHASE_BY_USER') {\n return true;\n }\n\n\t $this->transactionFailed();\n $this->newLog($status, @JiBitException::$paymentErrors[$status]);\n\t throw new JiBitException($status.@JiBitException::$paymentErrors[$status]);\n }",
"public function paymentCheck(){\n\t\treturn true;\n\t}",
"function hasPayment(): bool;",
"protected function userPayment()\n\t{\n\t\t$this->refIf = Request::input('id_get');\n\t\t$trackingCode = Request::input('trans_id');\n\n\t\tif (is_numeric($trackingCode) && $trackingCode > 0) {\n\t\t\t$this->trackingCode = $trackingCode;\n\t\t\treturn true;\n\t\t}\n\n\t\t$this->transactionFailed();\n\t\t$this->newLog(-4, PaylineReceiveException::$errors[-4]);\n\t\tthrow new PaylineReceiveException(-4);\n\t}",
"public function isPayment();",
"public function payment_response()\r\n\t{\r\n\t\t$this->checkout_model->process_payment_status_in_general($_POST, $_GET);\r\n\t}",
"public function hasPayments();",
"public function success_payment() {\n // Check if the current user is admin and if session exists\n $this->check_session($this->user_role, 0);\n $this->_check_unconfirmed_account();\n // Load PayPal Helper\n $this->load->helper('paypal_helper');\n if(get_instance()->input->get('tx', TRUE)) {\n $check_payment = check_payment();\n if ($check_payment) {\n if ($this->plans->check_payment($check_payment['value'], $check_payment['code'], $check_payment['plan_id'], $check_payment['tx'], $this->user_id, 'PayPal')) {\n $this->session->set_flashdata('upgrade', display_mess(105));\n } else {\n $this->session->set_flashdata('upgrade', display_mess(106));\n }\n redirect('user/plans');\n } else {\n $this->session->set_flashdata('upgrade', display_mess(106));\n redirect('user/plans');\n }\n } else if(get_instance()->input->get('ip_country', TRUE)) {\n $sid = get_instance()->input->get('sid', TRUE);\n $currency_code = get_instance()->input->get('currency_code', TRUE);\n $total = get_instance()->input->get('total', TRUE);\n $plan_id = get_instance()->input->get('plan_id', TRUE);\n $order_number = get_instance()->input->get('order_number', TRUE);\n $key = get_instance()->input->get('key', TRUE);\n $price = $this->plans->get_plan_price($plan_id);\n if($price) {\n $hashSecretWord = get_option('2co-secret-word'); //2Checkout Secret Word\n $hashSid = $sid; //2Checkout account number\n $hashTotal = $total; //Sale total to validate against\n $hashOrder = $order_number; //2Checkout Order Number\n $StringToHash = strtoupper(md5($hashSecretWord . $hashSid . $hashOrder . $hashTotal));\n if ($StringToHash == $key) {\n if(($price[0]->plan_price == $total) && ($price[0]->currency_code == $currency_code)) {\n if($this->plans->check_payment($total, $currency_code, $plan_id, $order_number, $this->user_id, '2checkout')) {\n $this->session->set_flashdata('upgrade', display_mess(105));\n } else {\n $this->session->set_flashdata('upgrade', display_mess(106));\n }\n redirect('user/plans');\n }\n }\n }\n } else {\n $request = $this->security->xss_clean($_REQUEST);\n if(@$request['transaction_id']) {\n vogue_success($request,$this->user_id);\n if($this->plans->check_transaction($request['transaction_id'])) {\n if($this->plans->payment_done($this->user_id, 'voguepay')) {\n $this->session->set_flashdata('upgrade', display_mess(105));\n } else {\n $this->session->set_flashdata('upgrade', display_mess(106));\n }\n redirect('user/plans');\n } else {\n $this->session->set_flashdata('upgrade', display_mess(106));\n redirect('user/plans');\n }\n } else {\n $this->session->set_flashdata('upgrade', display_mess(106));\n redirect('user/plans');\n }\n }\n }",
"public function verify()\n {\n $req = Request::getInstance();\n $data = json_decode($req->getContent());\n $client = Paypal::client();\n $response = $client->execute(new OrdersGetRequest($data->orderID));\n /**\n *Enable the following line to print complete response as JSON.\n */\n //print json_encode($response->result);\n //print \"Status Code: {$response->statusCode}\\n\";\n //print \"Status: {$response->result->status}\\n\";\n //print \"Order ID: {$response->result->id}\\n\";\n //print \"Intent: {$response->result->intent}\\n\";\n //print \"Links:\\n\";\n //foreach($response->result->links as $link)\n {\n //print \"\\t{$link->rel}: {$link->href}\\tCall Type: {$link->method}\\n\";\n }\n if ($response->result->status == 'COMPLETED') {\n // 4. Save the transaction in your database. Implement logic to save transaction to your database for future reference.\n $paymentHandle = explode('-', base64_decode($response->result->purchase_units[0]->custom_id))[0];\n $userID = explode('-', base64_decode($response->result->purchase_units[0]->custom_id))[1];\n\n if ($paymentHandle == 'tgc_balance') {\n $this->updateBalance(User::getByUserID($userID), $response->result->purchase_units[0]->amount->value);\n } else {\n $this->setEventPaid(User::getByUserID($userID), $paymentHandle);\n }\n $success = t('Paypal: Payment verification successful').' - status:'.$response->result->status.' - paymentHandle:'.$paymentHandle.' - UserID:'.$userID.' - orderID:'.$response->result->id;\n Log::addNotice($success);\n echo json_encode($success);\n } else {\n $error = t('Paypal: Payment Verification Failed - ').' - status:'.$response->result->status.' - orderID:'.$response->result->id;\n Log::addError($error);\n echo json_encode($error);\n }\n die;\n }",
"public function confirmPayment(): bool;",
"public function isPaid();",
"public function verifyPayment()\n\t{\n\t\t$jinput = JFactory::getApplication()->input;\n\t\tif ($jinput->get('ep') == 'execute')\n\t\t{\n\t\t\t$this->executePayment($jinput);\n\t\t}\n\t\telse\n\t\t{\n\n\t\t\t$ret = $this->validate();\n\t\t\tif ($ret)\n\t\t\t{\n\t\t\t\t$row = JTable::getInstance('OsMembership', 'Subscriber');\n\t\t\t\t$id = $this->notificationData['custom'];\n\t\t\t\t$transactionId = $this->notificationData['txn_id'];\n\t\t\t\tif ($transactionId && OSMembershipHelper::isTransactionProcessed($transactionId))\n\t\t\t\t{\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\t$amount = $this->notificationData['mc_gross'];\n\t\t\t\tif ($amount < 0)\n\t\t\t\t{\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\t$row->load($id);\n\t\t\t\tif ($row->published)\n\t\t\t\t{\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif ($row->gross_amount > $amount)\n\t\t\t\t{\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\t$this->onPaymentSuccess($row, $transactionId);\n\t\t\t}\n\t\t}\n\t}",
"abstract public function processPayment();",
"public function canExecutePayment();",
"public function paymentSuccess() {\n if (Configure::read('debug')) {\n \\Stripe\\Stripe::setApiKey(TEST_PRIVATE_KEY); \n } else {\n \\Stripe\\Stripe::setApiKey(LIVE_PRIVATE_KEY);\n }\n\n // You can find your endpoint's secret in your webhook settings\n $endpoint_secret = Configure::read('debug') ? TEST_ENDPOINT_SECRET : LIVE_ENDPOINT_SECRET;\n\n $payload = @file_get_contents(\"php://input\");\n $sig_header = $_SERVER[\"HTTP_STRIPE_SIGNATURE\"];\n $event = null;\n\n try {\n $event = \\Stripe\\Webhook::constructEvent(\n $payload, $sig_header, $endpoint_secret\n );\n } catch(\\UnexpectedValueException $e) {\n // Invalid payload\n http_response_code(400);\n exit();\n } catch(\\Stripe\\Error\\SignatureVerification $e) {\n // Invalid signature\n http_response_code(400); // PHP 5.4 or greater\n exit();\n }\n\n // Do something with $event\n if ($event->type == 'customer.subscription.deleted') {\n $customer_id = $event->data->object->customer;\n $user = $this->Users->findByCustomerId($customer_id)->first();\n if (!empty($user)) {\n //$user->expired = date('Y-m-d H:i:s');\n $user->account_level = 22;\n $user->plan_switched = NULL;\n $user->customer_id = NULL;\n $this->Users->save($user);\n }\n }\n\n // If payment success\n if (($event->type == 'invoice.payment_succeeded') && empty($event->request)) {\n $amount = $event->data->object->amount_due;\n $customer_id = $event->data->object->customer;\n if (($amount == '2900') || ($amount == '4900')) {\n $user = $this->Users->findByCustomerId($customer_id)->first();\n if (!empty($user)) {\n $user->expired = date('Y-m-d H:i:s', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 1));\n $this->Users->save($user);\n }\n }\n } \n\n http_response_code(200); // PHP 5.4 or greater\n exit();\n }",
"function payment() {\n\t\t$url = 'https://www.instawallet.org/api/v1/w/' . $wallet_id . '/payment';\n\t\t$json = file_get_contents($url);\n\t\treturn json_decode($json);\n\t}",
"function verify_purchase()\n\t{\n\t\tini_set('user_agent', 'Mozilla/5.0');\n\t\t$buyer\t\t\t\t=\t$this->input->post('buyer');\n\t\t$purchase_code\t\t=\t$this->input->post('purchase_code');\n\t\t\n\t\t$url = \"http://marketplace.envato.com/api/v3/Creativeitem/t3593ia0r3xbxcx85b4zve2j53y7zzrr/verify-purchase:\".$purchase_code.\".json\";\n\t\t$purchase_data = json_decode(file_get_contents($url), true);\n\t\tif ( isset($purchase_data['verify-purchase']['buyer']) && $purchase_data['verify-purchase']['buyer'] == $buyer)\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t}",
"public function checkWithDrawCoinpayment()\n {\n $fecha = Carbon::now();\n $liquidaciones = Liquidaction::whereDate('created_at', '>=', $fecha->subDays(1))->where('status', 1)->orderBy('id', 'desc')->get();\n $cmd = 'get_withdrawal_info';\n foreach ($liquidaciones as $liquidacion) {\n if (!empty($liquidacion->hash) && strlen($liquidacion->hash) <= 32) {\n $data = ['id' => $liquidacion->hash];\n // Log::info('Liquidacion: '.$liquidacion->id);\n $resultado = $this->coinpayments_api_call($cmd, $data);\n // dump($resultado);\n if (!empty($resultado['result'])) {\n if ($resultado['result']['status'] == -1) {\n $this->reversarLiquidacion($liquidacion->id, 'Cancelado por coinpayment');\n Log::info('Liquidacion: '.$liquidacion->id.' Fue Cancelada por coinpayment');\n }\n }\n }\n }\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Quick shortcut to get mastery information by $masteryId | public function getMastery($masteryId)
{
if (isset($this->info['data'][$masteryId]))
{
return $this->info['data'][$masteryId];
}
return null;
} | [
"public function GETPublisherBy_masheryid( $publisher_masheryid) {\n $params = array();\n $params['publisher_masheryid'] = $publisher_masheryid;\n return CentralIndex::doCurl(\"GET\",\"/publisher/by_masheryid\",$params);\n }",
"public function championMastery($summonerId,$region){\n\t\tglobal $servers;\n\t\t$dbPath = 'summoner/mastery';\n\t\t$dbFile = $summonerId.'_'.$region; \n\t\t$dbTime = 1800;\n\t\t$call = $summonerId.'/champions';\n\t\t$call = str_replace('{platform}',$servers[$region],self::API_URL_MASTERY) . $call;\n\t\treturn $this->request($call,$dbPath,$dbFile,$dbTime,$region);\n\t}",
"public static function FindById($id){\n\t\t$query = new Query();\n\t\t$query->createSelect(array('*'), 'machineries', array(), 'id = \"'.$id.'\"');\n\t\t$machineryArray = $query->execute();\n\t\t$machinery = false;\n\t\tif(!empty($machineryArray)){\n\t\t\t$machinery = self::CreateObjectFromArray($machineryArray);\n\t\t}\n\t\treturn $machinery;\n\t}",
"public function museumAction(){\n $this->view->museum = $this->_accredited->fetchRow('id = ' . $this->_getParam('id'));\n }",
"public function getBrewery($breweryId = 1, $metadata = true)\n {\n\n $args = array(\n 'metadata' => $metadata\n );\n\n return $this->_request('brewery/' . $breweryId, $args);\n }",
"function get_movieinfo_byid($tmdb_id) {\n global $APIKEY;\n global $API_BASE_URL;\n global $LANGUAGE;\n $path = \"movie/$tmdb_id?&api_key=$APIKEY&language=$LANGUAGE&append_to_response=trailers\";\n return json_decode(file_get_contents($API_BASE_URL.$path));\n\n}",
"public function get($hero_id);",
"static public function find_by_id_mshm($id) {\n $sql = \"SELECT * FROM \" . static::$table_name . \" \";\n $sql .= \"WHERE id_mshm=\" . self::$database->quote($id);\n $object_array = static::find_by_sql($sql);\n if(!empty($object_array)) {\n return array_shift($object_array);\n } else {\n return false;\n }\n }",
"public function muscleGroup($id)\n\t{\n\t\t$muscleGroup = MuscleGroup::findOrFail($id);\n\n\t\t$workouts = $muscleGroup->workouts;\n\n\t\treturn view('muscle-groups')->with(compact('workouts', 'muscleGroup'));\n\t}",
"public function getlistMinistry($id){\n $obj = DB::table('mef_ministry')\n ->select(\n 'Id AS value',\n 'Name AS text')\n ->where('Id','=',$id)\n ->orderBy('Id','ASC')\n ->get();\n return $obj;\n }",
"public function find($id)\n {\n foreach ($this->all() as $milestone) {\n if ($milestone->id == $id) {\n return $milestone;\n }\n }\n }",
"public function getMovieInfo($imdbId)\n\t{\n\t\treturn $this->pdo->queryOneRow(sprintf(\"SELECT * FROM movieinfo WHERE imdbid = %d\", $imdbId));\n\t}",
"public function getMediaItem($mediaId);",
"public function show($id)\n {\n return RestHelper::show(Marques::class,$id);\n }",
"public function index_get($id) {\n\t\tself::validate_access($id);\n\t\treturn Workitem::find($id);\n\t}",
"function get_mom($id)\n {\n return $this->db->get_where('mom',array('id'=>$id))->row_array();\n }",
"public function show($id)\n {\n $dato = Workplace::where( 'wplace_id', '=', $id)\n ->first();\n return $this->showOne($dato,200);\n }",
"public function get($id)\n\t{\n\t\treturn $this->ci->db\n\t\t\t->where('id', $id)\n\t\t\t->get('metadata')\n\t\t\t->row();\n\t}",
"public function getMasteries()\n {\n return $this->get('masteries', array());\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the decimal preferences from company settings | function getDecimalPreference()
{
global $db;
$companyInfoQry="select decimal_pref from company_info";
$companyInfoRes=mysql_query($companyInfoQry,$db);
$companyInfoRow=mysql_fetch_row($companyInfoRes);
$precision = (!empty($companyInfoRow[0])) ? $companyInfoRow[0] : 2;
return $precision;
} | [
"public function getCurrencyDecimalPlaces();",
"public function getPriceConfig();",
"function acadp_get_payment_currency_settings() {\n\n\t$gateway_settings = get_option( 'acadp_gateway_settings' );\n\n\tif( ! empty( $gateway_settings[ 'currency' ] ) ) {\n\n\t\t$currency_settings = array(\n\t\t\t'currency' => $gateway_settings[ 'currency' ],\n\t\t\t'thousands_separator' => ! empty( $gateway_settings[ 'thousands_separator' ] ) ? $gateway_settings[ 'thousands_separator' ] : ',',\n\t\t\t'decimal_separator' => ! empty( $gateway_settings[ 'decimal_separator' ] ) ? $gateway_settings[ 'decimal_separator' ] : '.',\n\t\t\t'position' => $gateway_settings[ 'position' ]\n\t\t);\n\n\t} else {\n\n\t\t$currency_settings = get_option( 'acadp_currency_settings' );\n\n\t}\n\n\treturn $currency_settings;\n\n}",
"private function getAPICurrency()\n {\n return $this->container->getParameter('modules')['hotels']['vendors']['hrs']['default_currency'];\n }",
"function decimal_places_options() {\n\t\treturn array(\n\t\t\t'2' => '2',\n\t\t\t'3' => '3',\n\t\t);\n\t}",
"protected function getNumberSettings()\n\t{\n\t\tglobal $locale_info;\n\t\t\n\t\t$numberSettings = array();\n\t\t$numberSettings['LOCALE_SPOSITIVESIGN'] = $locale_info[\"LOCALE_SPOSITIVESIGN\"];\n\t\t$numberSettings['LOCALE_INEGNUMBER'] = $locale_info[\"LOCALE_INEGNUMBER\"];\n\t\t\n\t\treturn $numberSettings;\n\t}",
"public function showDecimal()\n {\n return $this->scopeConfig->isSetFlag(\n self::XML_PATH_UDEYTECH_PRICEDECIMAL_SHOW_DECIMAL,\n \\Magento\\Store\\Model\\ScopeInterface::SCOPE_STORE\n );\n }",
"public function getCommissionPercent() {\n return Mage::getStoreConfig('marketplace/marketplace/percentperproduct');\n }",
"function get_company_prefs($tbpref = TB_PREF)\n{\n\t$sql = \"SELECT * FROM \".TB_PREF.\"company WHERE coy_code=1\";\n\t\n\t$result = db_query($sql, \"The company preferences could not be retrieved\");\n\n\tif (db_num_rows($result) == 0)\n\t\tdisplay_db_error(\"FATAL : Could not find company prefs\", $sql);\n\n\treturn db_fetch($result);\n}",
"public function get_shop_setting()\n\t{\n\t\t$results = array();\n\t\t$this->CI->load->model('settings/settings_m');\n\t\t\n\t\t$results['country_id'] = $this->CI->settings->get('ss_distribution_loc');\n\t\t$results['shop_name'] = $this->CI->settings->get('ss_name');\n\t\t$results['currency_code'] = $this->CI->settings->get('ss_currency_code');\n\t\t\n\t\t$shopset = $this->CI->settings_m->get_by(array('slug' => 'ss_currency_symbol'));\n\t\t$currency_symbol = \"\";\n\t\t$symbol_opt = explode('|', $shopset->options);\n\n\t\tif(!empty($symbol_opt) && !empty($shopset->value))\n\t\t{\n\t\t\t$symval = explode(\"=\", $symbol_opt[$shopset->value]);\n\t\t\t$currency_symbol = trim($symval[1]);\n\t\t}\n\t\t\n\t\t$results['currency_symbol'] = $currency_symbol;\n\t\t$results['currency_layout'] = $this->CI->settings->get('ss_currency_layout');\n\t\t$separator = array(\",\", \".\", \" \");\n\t\t$results['thousand_sep'] = $separator[$this->CI->settings->get('ss_currency_thousand_sep')];\n\t\t$results['decimal_sep'] = $separator[$this->CI->settings->get('ss_currency_decimal_sep')];\n\t\treturn $results;\n\t}",
"public function getLogDecimalFactor() {\n return number_format(Mage::getStoreConfig(self::XML_PATH_DECIMAL_FACTOR), 2, '.', '');\n }",
"public function getCostPriceAtt() {\n return Mage::getStoreConfig('pricemotion_options/default/cost_price_att');\n }",
"public function getDecimal();",
"function getCustomCurrencies() {\n\trequire APP . 'Config' . DS . 'currencies.php';\n\n\treturn $customCurrencies;\n}",
"public static function getTaxesConfigurations() {\n $configs = Kohana::$config->load('config'); \n \n return floatval($configs->taxes['default'])/100;\n }",
"public function getPriceDiffAtt() {\n return Mage::getStoreConfig('pricemotion_options/default/pricediff_att');\n }",
"protected function _getCutOffFrequency()\n {\n return (float) Mage::getStoreConfig(self::RELEVANCY_SETTINGS_BASE_PATH . 'cutoff_frequency');\n }",
"private function GetCalculatorOptions() {\n\t\t//\n\t\t$this->iBasePercentage = get_field('calc_base_perc', 'options');\n\t\t$this->iProfilePercentages = array(\n\t\t\t'rood' => get_field('calc_rood_perc', 'options'),\n\t\t\t'oranje' => get_field('calc_oranje_perc', 'options'),\n\t\t\t'geel' => get_field('calc_geel_perc', 'options'),\n\t\t\t'groen' => get_field('calc_groen_perc', 'options'),\n\t\t\t'blauw' => get_field('calc_blauw_perc', 'options')\n\t\t);\n\t}",
"public function adjust_decimal_places() {\n\n\t\t\t// Main point type = allow db adjustment\n\t\t\tif ( $this->is_main_type ) {\n\n?>\n<div><input type=\"number\" min=\"0\" max=\"20\" id=\"mycred-adjust-decimal-places\" class=\"form-control\" value=\"<?php echo esc_attr( $this->core->format['decimals'] ); ?>\" data-org=\"<?php echo $this->core->format['decimals']; ?>\" size=\"8\" /> <input type=\"button\" style=\"display:none;\" id=\"mycred-update-log-decimals\" class=\"button button-primary button-large\" value=\"<?php _e( 'Update Database', 'twodayssss' ); ?>\" /></div>\n<?php\n\n\t\t\t}\n\t\t\t// Other point type.\n\t\t\telse {\n\n\t\t\t\t$default = mycred();\n\t\t\t\tif ( $default->format['decimals'] == 0 ) {\n\n?>\n<div><?php _e( 'No decimals', 'twodayssss' ); ?></div>\n<?php\n\n\t\t\t\t}\n\t\t\t\telse {\n\n?>\n<select name=\"<?php echo $this->field_name( array( 'format' => 'decimals' ) ); ?>\" id=\"<?php echo $this->field_id( array( 'format' => 'decimals' ) ); ?>\" class=\"form-control\">\n<?php\n\n\t\t\t\t\techo '<option value=\"0\"';\n\t\t\t\t\tif ( $this->core->format['decimals'] == 0 ) echo ' selected=\"selected\"';\n\t\t\t\t\techo '>' . __( 'No decimals', 'twodayssss' ) . '</option>';\n\n\t\t\t\t\tfor ( $i = 1 ; $i <= $default->format['decimals'] ; $i ++ ) {\n\t\t\t\t\t\techo '<option value=\"' . $i . '\"';\n\t\t\t\t\t\tif ( $this->core->format['decimals'] == $i ) echo ' selected=\"selected\"';\n\t\t\t\t\t\techo '>' . $i . ' - 0.' . str_pad( '0', $i, '0' ) . '</option>';\n\t\t\t\t\t}\n\n\t\t\t\t\t$url = add_query_arg( array( 'page' => MYCRED_SLUG . '-settings', 'open-tab' => 0 ), admin_url( 'admin.php' ) );\n\n?>\n</select>\n<p><span class=\"description\"><?php printf( __( '<a href=\"%s\">Click here</a> to change your default point types setup.', 'twodayssss' ), esc_url( $url ) ); ?></span></p>\n<?php\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Switch the navbar style to the inverted style | public function inverted()
{
$this->navbar_class = 'navbar-inverse';
return $this;
} | [
"function setInverseNavBar($inverseNavBar) {\n\t$pathToMainJs = joinPaths(BASE_DIR, '_dist/main.js');\n\t$content = file_get_contents($pathToMainJs);\n\t$replacement = 'navbar-inverse:'.($inverseNavBar ? 'true': 'false');\n\t$content = str_replace('navbar-inverse:true', $replacement, $content);\n\t$content = str_replace('navbar-inverse:false', $replacement, $content);\n\tif (!is_null($content)) {\n\t\tfile_put_contents($pathToMainJs, $content);\n\t}\n}",
"function changeNavClass(){\r\n\t\treturn 'mainnav--overlay';\r\n\t}",
"protected function create_navbar() {\n global $PAGE;\n\n parent::create_navbar();\n $PAGE->navbar->add(get_string('versions', 'socialwiki'));\n }",
"public function navbar() {\r\n $items = $this->page->navbar->get_items();\r\n if (empty($items)) {\r\n return '';\r\n }\r\n\r\n $breadcrumbs = array();\r\n foreach ($items as $item) {\r\n $item->hideicon = true;\r\n $breadcrumbs[] = $this->render($item);\r\n }\r\n $divider = '<span class=\"divider\">'.get_separator().'</span>';\r\n $list_items = '<li>'.join(\" $divider</li><li>\", $breadcrumbs).'</li>';\r\n $title = '<span class=\"accesshide\" id=\"navbar-label\">'.get_string('pagepath').'</span>';\r\n return $title . '<nav aria-labelledby=\"navbar-label\"><ul class=\"breadcrumb\">' .\r\n $list_items . '</ul></nav>';\r\n }",
"public function navbar() {\n $items = $this->page->navbar->get_items();\n $breadcrumbs = array();\n foreach ($items as $item) {\n $item->hideicon = true;\n $breadcrumbs[] = $this->render($item);\n }\n $divider = '<span class=\"divider\">►</span>';\n $list_items = '<li>'.join(\"$divider</li><li>\", $breadcrumbs).'</li>';\n $title = '<span class=\"accesshide\">'.get_string('pagepath').'</span>';\n return $title . \"<ul class=\\\"breadcrumb\\\">$list_items</ul>\";\n }",
"function secondary_navbar() {\n\t\t\tglobal $ss_settings, $ss_framework;\n\n\t\t\tif ( has_nav_menu( 'secondary_navigation' ) ) : ?>\n\n\t\t\t\t<?php echo $ss_framework->open_container( 'div' ); ?>\n\t\t\t\t\t<header class=\"secondary navbar navbar-default <?php echo self::navbar_class( 'secondary' ); ?>\" role=\"banner\">\n\t\t\t\t\t\t<button data-target=\".nav-secondary\" data-toggle=\"collapse\" type=\"button\" class=\"navbar-toggle\">\n\t\t\t\t\t\t\t<span class=\"icon-bar\"></span>\n\t\t\t\t\t\t\t<span class=\"icon-bar\"></span>\n\t\t\t\t\t\t\t<span class=\"icon-bar\"></span>\n\t\t\t\t\t\t</button>\n\t\t\t\t\t\t<?php\n\t\t\t\t\t\tif ( $ss_settings['navbar_secondary_social'] != 0 ) {\n\t\t\t\t\t\t\tSS_Framework_Bootstrap::navbar_social_links();\n\t\t\t\t\t\t} ?>\n\t\t\t\t\t\t<nav class=\"nav-secondary navbar-collapse collapse\" role=\"navigation\">\n\t\t\t\t\t\t\t<?php wp_nav_menu( array( 'theme_location' => 'secondary_navigation', 'menu_class' => apply_filters( 'shoestrap_nav_class', 'navbar-nav nav' ) ) ); ?>\n\t\t\t\t\t\t</nav>\n\t\t\t\t\t</header>\n\t\t\t\t<?php echo $ss_framework->close_container( 'div' ); ?>\n\n\t\t\t<?php endif;\n\t\t}",
"public function navbarColor()\n {\n $output = Framework::instance()->getThemeOption('navbar_color');\n\n return apply_filters('novusopress_view_navbar_color_output', $output);\n }",
"public function OverrideNavbar($menu=null) {\n if(isset($menu['reqRoleAdmin']) && !$menu['reqRoleAdmin']) { return;\n } else {\n $this->config['theme']['menu_to_region'] = array($menu=>'navbar');\n }\n }",
"public function navbar() {\n \n $menu = $this->buildNavBar($_SESSION[\"login\"]);\n return $menu;\n }",
"public function navbar() {\n return $this->render_from_template('core/navbar', $this->page->navbar);\n }",
"private function generateNavBarElement()\n {\n\t return $this->generateNavBar('white');\n }",
"private function prependNavBar(){\n\t\t$this->navBarDefault();\n\t}",
"protected function create_navbar() {\n global $PAGE;\n parent::create_navbar();\n $PAGE->navbar->add(get_string('deletecommentcheck', 'socialwiki'));\n }",
"protected function adminNavBar(){\n view()->composer('admins.layouts.navbar',function(){\n \n \n });\n \n }",
"private function generateNavBar()\n\t\t{\n\t\t\tglobal $logged_user, $config;\n\t\t\t$url = $config['home_url'] . '/homepage.php';\n\t\t\t$nav = \"<nav id='mainNav' class='navbar navbar-default navbar-fixed-top'>\n\t\t\t\t<div class='container-fluid'>\n\t\t\t\t<div class='navbar-header'>\";\n\t\t\t//Handles altered menus for smaller windows\n\t\t\t$nav .= \"<button type='button' class='navbar-toggle collapsed' data-toggle='collapse' data-target='#bs-example-navbar-collapse-1'>\n\t\t\t\t<span class='sr-only'>Toggle navigation</span>\n\t\t\t\t<span class='icon-bar'></span>\n\t\t\t\t<span class='icon-bar'></span>\n\t\t\t\t<span class='icon-bar'></span></button>\";\n\t\t\t$nav .= \"<a id='cmiMadison' class='navbar-brand page-scroll' href='{$url}'>CMI-Madison</a></div>\";\n\t\t\t//Handles the list of links(Needs to be changed to links of other pages\n\t\t\t$nav .= \"<div class='collapse navbar-collapse' id='bs-example-navbar-collapse-1'>\n\t\t\t\t<ul class='nav navbar-nav navbar-right'>\n\t\t\t\t\t<li><a class='page-scroll' href='{$url}#about'>About</a></li>\n\t\t\t\t\t<li><a class='page-scroll' href='{$url}#services'>Goals</a></li>\n\t\t\t\t\t<li><a class='page-scroll' href='{$url}#portfolio'>Events</a></li>\n\t\t\t\t\t<li><a class='page-scroll' href='{$url}#contact'>Contact</a></li>\";\n\t\t\t//if($logged_user->admin)\n\t\t\t//{\n\t\t\t//\t$nav .= \"<li><a class='page-scroll' href='page-top'>Admin</a></li>\";\n\t\t\t//}\n\t\t\t$nav .= \"</ul></div></nav>\";\n\t\t\treturn $nav;\n\t\t}",
"function dirindex_path_navbar() {\n\nglobal $dirindex_fugue;\n\n$path = explode('/', $dirindex_fugue::current_url());\n$path_navbar_icon = $dirindex_fugue::path_navbar_icon_url();\n$current_url = '/';\n\n?>\n<!-- Path Navbar -->\n<div id=\"path_navbar\">\n<h1 id=\"path\">\n<img id=\"navicon\" src=\"<?php echo $path_navbar_icon; ?>\" />\n<span class=\"navsep\">/</span>\n<?php\nforeach ($path as $dirname)\n{\n\tif ($dirname)\n\t{\n\t\t$current_url .= $dirname . '/';\n?>\n<a class=\"navlink\" title=\"<?php echo $dirname; ?>\" href=\"<?php echo $current_url; ?>\"><?php echo $dirname; ?></a>\n<span class=\"navsep\">/</span>\n<?php\n\t}\n}\n?>\n</h1>\n</div>\n<!-- END Path Navbar -->\n<?php }",
"function addNavBar() {\n global $activeClass;\n include \"includes/templates/navbar.inc\";\n }",
"function sp_render_navbar_menu()\n{\n $menu = new NavbarGenerator(MenuStorage::getNavbarMenus());\n return $menu->renderHtml();\n}",
"public function generateNavs(){\n\n $navs = Config::get('backend::navs');\n $activeClass = Config::get('backend::active_nav_class');\n\n $navHTML = '<ul class=\"_fwfl _db _m0 vertical-nav\">';\n foreach($navs as $order => $nav){\n if($order == 0){\n $navHTML .= '<li class=\"vertical-nav-top\">';\n }else{\n $navHTML .= '<li>';\n }\n $navHTML .= '<a href=\"' . url($nav['url']) . '\" class =\"' . $this->showActiveClass($activeClass, $nav['nav_name']) . '\">'\n . '<i class=\"' . $nav['icon'] . ' left-nav-icon\"></i>'\n . '<span class=\"left-nav-txt\"> ' . $nav['txt'] . '</span>'\n . '<i class=\"fa fa-angle-left left-nav-arrow\"></i>'\n . '</a></li>';\n }\n\n $navHTML .= '</ul>';\n\n return $navHTML;\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Filter the query on the discussion_id column Example usage: $query>filterByDiscussionId(1234); // WHERE discussion_id = 1234 $query>filterByDiscussionId(array(12, 34)); // WHERE discussion_id IN (12, 34) $query>filterByDiscussionId(array('min' => 12)); // WHERE discussion_id > 12 | public function filterByDiscussionId($discussionId = null, $comparison = null)
{
if (is_array($discussionId)) {
$useMinMax = false;
if (isset($discussionId['min'])) {
$this->addUsingAlias(DiscussionUserAssociationTableMap::COL_DISCUSSION_ID, $discussionId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($discussionId['max'])) {
$this->addUsingAlias(DiscussionUserAssociationTableMap::COL_DISCUSSION_ID, $discussionId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(DiscussionUserAssociationTableMap::COL_DISCUSSION_ID, $discussionId, $comparison);
} | [
"public function testFilterById()\n {\n // find by single id\n $book = PropelQuery::from('Book b')\n ->where('b.Title like ?', 'Don%')\n ->orderBy('b.ISBN', 'desc')\n ->findOne();\n\n $c = BookQuery::create()->filterById($book->getId());\n\n $book2 = $c->findOne();\n\n $this->assertTrue($book2 instanceof Book);\n $this->assertEquals('Don Juan', $book2->getTitle());\n\n //find range\n $booksAll = PropelQuery::from('Book b')\n ->orderBy('b.ID', 'asc')\n ->find();\n\n $booksIn = BookQuery::create()\n ->filterById(array($booksAll[1]->getId(), $booksAll[2]->getId()))\n ->find();\n\n $this->assertTrue($booksIn[0] == $booksAll[1]);\n $this->assertTrue($booksIn[1] == $booksAll[2]);\n\n // filter by min value with greater equal\n $booksIn = null;\n\n $booksIn = BookQuery::create()\n ->filterById(\n array('min' => $booksAll[2]->getId()))\n ->find();\n\n $this->assertTrue($booksIn[1] == $booksAll[3]);\n\n // filter by max value with less equal\n $booksIn = null;\n\n $booksIn = BookQuery::create()\n ->filterById(\n array('max' => $booksAll[1]->getId()) )\n ->find();\n\n $this->assertTrue($booksIn[1] == $booksAll[1]);\n\n // check backwards compatibility:\n // SELECT FROM `book` WHERE book.id IN (:p1,:p2)\n // must be the same as\n // SELECT FROM `book` WHERE (book.id>=:p1 AND book.id<=:p2)\n\n $minMax = BookQuery::create()\n ->filterById(\n array('min' => $booksAll[1]->getId(),\n 'max' => $booksAll[2]->getId())\n )\n ->find();\n\n $In = BookQuery::create()\n ->filterById(\n array($booksAll[1]->getId(),\n $booksAll[2]->getId())\n )\n ->find();\n\n $this->assertTrue($minMax[0] === $In[0]);\n $this->assertTrue(count($minMax->getData()) === count($In->getData()));\n }",
"public function filterByDisciplineId($disciplineId = null, $comparison = null)\n {\n if (is_array($disciplineId)) {\n $useMinMax = false;\n if (isset($disciplineId['min'])) {\n $this->addUsingAlias(CoursePeer::DISCIPLINE_ID, $disciplineId['min'], Criteria::GREATER_EQUAL);\n $useMinMax = true;\n }\n if (isset($disciplineId['max'])) {\n $this->addUsingAlias(CoursePeer::DISCIPLINE_ID, $disciplineId['max'], Criteria::LESS_EQUAL);\n $useMinMax = true;\n }\n if ($useMinMax) {\n return $this;\n }\n if (null === $comparison) {\n $comparison = Criteria::IN;\n }\n }\n\n return $this->addUsingAlias(CoursePeer::DISCIPLINE_ID, $disciplineId, $comparison);\n }",
"public function filterByDisqusId($disqusId = null, $comparison = null)\n {\n if (null === $comparison)\n {\n if (is_array($disqusId))\n {\n $comparison = Criteria::IN;\n }\n elseif (preg_match('/[\\%\\*]/', $disqusId))\n {\n $disqusId = str_replace('*', '%', $disqusId);\n $comparison = Criteria::LIKE;\n }\n }\n return $this->addUsingAlias(CommentPeer::DISQUS_ID, $disqusId, $comparison);\n }",
"function test_unique_oldest_filter_on_entry_id() {\n\t\t\n\t\t$dynamic_view = self::get_view_by_key( 'dynamic-view' );\n\n\t\t$filter_args = array(\n\t\t\tarray( 'type' => 'col',\n\t\t\t\t'col' => 'id',\n\t\t\t\t'op' => 'group_by',\n\t\t\t\t'val' => '',\n\t\t\t),\n\t\t);\n\t\tself::add_filter_to_view( $dynamic_view, $filter_args );\n\n\t\t$d = self::get_default_args( $dynamic_view, array( 'Jamie', 'Steph', 'Steve' ), array() );\n\n\t\tself::run_get_display_data_tests( $d, 'unique filter with entry ID' );\n\t}",
"public function filterByCommentId($commentId = null, $comparison = null)\n {\n if (is_array($commentId))\n {\n $useMinMax = false;\n if (isset($commentId['min']))\n {\n $this->addUsingAlias(wpCommentMetaPeer::COMMENT_ID, $commentId['min'], Criteria::GREATER_EQUAL);\n $useMinMax = true;\n }\n if (isset($commentId['max']))\n {\n $this->addUsingAlias(wpCommentMetaPeer::COMMENT_ID, $commentId['max'], Criteria::LESS_EQUAL);\n $useMinMax = true;\n }\n if ($useMinMax)\n {\n return $this;\n }\n if (null === $comparison)\n {\n $comparison = Criteria::IN;\n }\n }\n return $this->addUsingAlias(wpCommentMetaPeer::COMMENT_ID, $commentId, $comparison);\n }",
"function filterForumList(&$results, $idKey='')\n \t{\n \t\t\n \t}",
"public function filterByAuthorId($authorId = null, $comparison = null)\n {\n if (is_array($authorId)) {\n $useMinMax = false;\n if (isset($authorId['min'])) {\n $this->addUsingAlias(ForumMessagePeer::AUTHOR_ID, $authorId['min'], Criteria::GREATER_EQUAL);\n $useMinMax = true;\n }\n if (isset($authorId['max'])) {\n $this->addUsingAlias(ForumMessagePeer::AUTHOR_ID, $authorId['max'], Criteria::LESS_EQUAL);\n $useMinMax = true;\n }\n if ($useMinMax) {\n return $this;\n }\n if (null === $comparison) {\n $comparison = Criteria::IN;\n }\n }\n\n return $this->addUsingAlias(ForumMessagePeer::AUTHOR_ID, $authorId, $comparison);\n }",
"public function getDiscussionsSend($id_user=null){\n // $id_user correspon à l'id de l'utilisateur\n // retourne un tableau de liste de messages envoyes\n $discussions = array();\n $inst_user = new Model_DbTable_User();\n $inst_list = new Model_DbTable_List();\n \n if($id_user > 0){\n $current_user = $this->find($id_user)->current();\n $id_user = $current_user->idUser;\n }else{\n $current_user = $inst_user->getUser();\n $id_user = $current_user->idUser;\n } \n \n $select = $inst_list->select()->where('categorie_idcategories = ?',$this->Category_id);\n $lists = $current_user->findModel_DbTable_ListViaModel_DbTable_UserHasListByUserAndList($select);\n foreach($lists as $list){\n $discussions[$list->idList] = array(\"user\"=>$current_user->idUser,\"count\"=>count($inst_list->getCountItem($list->idList)));\n }\n krsort($discussions);\n return $discussions; \n }",
"private function getApplicableEntryIds()\n {\n $filters = $this->filtersFromInputService->get()['standard'];\n\n $query = $this->queryBuilder->select('CT.entry_id')\n ->from('channel_titles as CT')\n ->group_by('CT.entry_id');\n\n foreach ($filters as $filter) {\n $fieldName = $filter['type'];\n $subFieldName = null;\n\n if (strpos($fieldName, '.') !== false) {\n $fieldArr = explode('.', $fieldName);\n $fieldName = $fieldArr[0];\n $subFieldName = $fieldArr[1];\n }\n\n\n $fieldType = $this->fieldService->getFieldTypeByName($fieldName);\n $fieldId = $this->fieldService->getFieldIdByName($fieldName);\n $op = $filter['operator'];\n\n if (! $fieldType) {\n continue;\n }\n\n if ($fieldType === 'grid') {\n if (! $subFieldName) {\n continue;\n }\n\n $query->join(\n \"channel_grid_field_{$fieldId} as {$fieldName}_{$subFieldName}\",\n \"CT.entry_id = {$fieldName}_{$subFieldName}.entry_id AND {$fieldName}_{$subFieldName}.field_id = $fieldId\",\n 'LEFT'\n );\n\n $gridColId = $this->fieldService->getGridColId(\n $fieldId,\n $subFieldName\n );\n\n if (empty($filter['value'])) {\n $query->start_group();\n\n $query->where(\n \"{$fieldName}_{$subFieldName}.col_id_{$gridColId}\",\n ''\n );\n\n $query->or_where(\n \"{$fieldName}_{$subFieldName}.col_id_{$gridColId}\",\n null\n );\n\n $query->end_group();\n\n continue;\n }\n\n if ($op === 'contains') {\n $query->like(\n \"{$fieldName}_{$subFieldName}.col_id_{$gridColId}\",\n $filter['value']\n );\n\n continue;\n }\n\n $query->where(\n \"{$fieldName}_{$subFieldName}.col_id_{$gridColId}\",\n $filter['value']\n );\n\n continue;\n }\n\n if ($fieldType === 'matrix') {\n if (! $subFieldName) {\n continue;\n }\n\n $query->join(\n \"matrix_data as {$fieldName}_{$subFieldName}\",\n \"CT.entry_id = {$fieldName}_{$subFieldName}.entry_id AND {$fieldName}_{$subFieldName}.field_id = $fieldId\",\n 'LEFT'\n );\n\n $matrixColId = $this->fieldService->getMatrixColId(\n $fieldId,\n $subFieldName\n );\n\n if (empty($filter['value'])) {\n $query->start_group();\n\n $query->where(\n \"{$fieldName}_{$subFieldName}.col_id_{$matrixColId}\",\n ''\n );\n\n $query->or_where(\n \"{$fieldName}_{$subFieldName}.col_id_{$matrixColId}\",\n null\n );\n\n $query->end_group();\n\n continue;\n }\n\n if ($op === 'contains') {\n $query->like(\n \"{$fieldName}_{$subFieldName}.col_id_{$matrixColId}\",\n $filter['value']\n );\n\n continue;\n }\n\n $query->where(\n \"{$fieldName}_{$subFieldName}.col_id_{$matrixColId}\",\n $filter['value']\n );\n\n continue;\n }\n\n // if ($op === 'contains') {\n // $query->like(\"CD.field_id_{$fieldId}\", $filter['value']);\n //\n // continue;\n // }\n //\n // $query->where(\"CD.field_id_{$fieldId}\", $filter['value']);\n }\n\n $entryIds = [];\n\n foreach ($query->get()->result() as $item) {\n $entryIds[] = $item->entry_id;\n }\n\n return $entryIds;\n }",
"public function actionFilter_thread(){\n $id = $_GET['id'];\n $emptyMessage = '';\n $data = Thread::find()->where(['kategori_event'=>$id])->orderBy(['id_event'=>SORT_DESC])->all();\n \t$kategori = Kategori::find()->where(['id_kategori'=>$id])->one();\n\n if(count($data) == 0){\n $emptyMessage = 'Belum ada event untuk kategori ini';\n }\n return $this->render('filter_thread',[\n 'emptyMessage' => $emptyMessage,\n 'data'=>$data,\n 'kategori'=>$kategori,\n ]);\n }",
"public function FilterAsk_By($CategoryID , $perPage=null);",
"function getFilteredMessages($filter, $num_messages=10, $start_from=0){\n \n $where = ['1=1'];\n foreach ($filter as $f => $v){\n $where[] = \"$f=$v\";\n }\n\n $sql_where = implode(\" AND \", $where);\n \n $sql = \"select r.id, r.description, i.name \" .\n \"from request r join document_meta d on r.id=d.request_id \" .\n \"join inststution i on r.institution_id=i.id \" .\n $sql_where .\n \" order by d.own.date desc limit $num_messages\"; \n $res = $DB->execute($sql);\n\n while (!$res->EOF) {\n $r_id = $res->FetchField(1);\n $r_descr = $res->FetchField(2);\n $i_name = $res->FetchField(3);\n \n $rs->MoveNext();\n } \n}",
"function filterInt($field, $value) {\n if (($value = ltrim($value, '=')) !== '') {\n switch ($value[0]) {\n case '>': $this->where($field, '>', (int) substr($value, 1)); break;\n case '<': $this->where($field, '<', (int) substr($value, 1)); break;\n case '!': $this->where($field, '<>', (int) substr($value, 1)); break;\n default: $this->where($field, '=', (int) $value); break;\n }\n }\n }",
"public function filterUser(int|UniqueId $id): self;",
"public function categoryFilterCommented($id, $action, $time) {\n\t\tif ($time == 'all') {\n\t\t\t$fist = 0;\n\t\t\t$end = 7200;\n\t\t\t$time =\"\";\n\t\t\t$time_name_lg = \"All Durations\";\n\t\t\t$time_name_xs= \"All\";\n\t\t}\n\t\tif ($time== \"1-3\") {\n\t\t\t$fist = 1;\n\t\t\t$end = 180;\n\t\t\t$time =\"1-3\";\n\t\t\t$time_name_lg = \"Short videos (1-3min)\";\n\t\t\t$time_name_xs= \"Short(1-3min)\";\n\t\t}\n\t\tif ($time== \"3-10\") {\n\t\t\t$fist = 181;\n\t\t\t$end = 600;\n\t\t\t$time =\"3-10\";\n\t\t\t$time_name_lg = \"Medium videos (3-10min)\";\n\t\t\t$time_name_xs= \"Medium(3-10min)\";\n\t\t}\n\t\tif ($time== \"10+\") {\n\t\t\t$fist = 601;\n\t\t\t$end = 7200;\n\t\t\t$time =\"10+\";\n\t\t\t$time_name_lg = \"Long videos (+10min)\";\n\t\t\t$time_name_xs= \"Long(+10min)\";\n\t\t}\n\t\t$categories = CategoriesModel::where('status', '=', 1)\n\t\t\t->orderby('title_name','ASC')\n\t\t\t->get();\n\n\t\t$onecategoriesdetail = CategoriesModel::where('ID', '=', $id)->first();\n\n $get_comment= VideoCommentModel::Groupby('video_Id')->get();\n $list_comment_array= array();\n for($i = 0; $i < count($get_comment); $i++) { \n array_push($list_comment_array, $get_comment[$i]->video_Id);\n }\n \n $video_id = array();\n $get_video_id = VideoCatModel::where('cat_id', '=', $id)->get();\n\t for($i = 0; $i < count($get_video_id); $i++) { \n\t array_push($video_id, $get_video_id[$i]->video_id);\n\t }\n\t\t$videoin = VideoModel::where('status', '=', 1)\n\t\t\t->whereRaw(\"duration BETWEEN \".$fist.\" and \".$end.\"\")\n\t\t\t->whereIn('string_Id', $video_id)\n\t\t\t->whereIn('string_Id', $list_comment_array)\n\t\t\t->Orderby('title_name', 'DESC')\n\t\t\t->paginate(20);\n\n\t\tif(count($videoin) > 0) {\n\t\t\treturn view('categories.one_category')\n\t\t\t\t->with('categories', $categories)\n\t\t\t\t->with('videoin', $videoin)\n\t\t\t\t->with('channel_popular', $this->getChannelPopular())\n\t\t\t\t->with('filter_title_lg', 'Most commented videos')\n\t\t\t\t->with('filter_title_xs', 'Commented')\n\t\t\t\t->with('filter_time_lg', $time_name_lg)\n\t\t\t\t->with('filter_time_xs', $time_name_xs)\n\t\t\t\t->with('hidden_action', $action)\n\t\t\t\t->with('country_category', $this->getCountryCategory())\n\t\t\t\t->with('onecategoriesdetail', $onecategoriesdetail);\n\t\t} else {\n\t\t\treturn view('categories.one_category')\n\t\t\t\t->with('categories', $categories)\n\t\t\t\t->with('onecategoriesdetail', $onecategoriesdetail)\n\t\t\t\t->with('channel_popular', $this->getChannelPopular())\n\t\t\t\t->with('filter_title_lg', 'Most commented video')\n\t \t\t\t->with('filter_title_xs', 'Commented')\n\t \t\t\t->with('filter_time_lg', $time_name_lg)\n\t ->with('filter_time_xs', $time_name_xs)\n\t \t\t\t->with('hidden_action', $action)\n\t \t\t\t->with('country_category', $this->getCountryCategory());\n\t\t}\n\t}",
"public function getFilter($id);",
"public function restrictByContentId()\n {\n if (CommentRepository::$availableContentId) {\n $this->where('content_id', CommentRepository::$availableContentId);\n }\n\n return $this;\n }",
"public function filterByProblemId($problemId = null, $comparison = null)\n {\n if (is_array($problemId)) {\n $useMinMax = false;\n if (isset($problemId['min'])) {\n $this->addUsingAlias(SolutionPeer::PROBLEM_ID, $problemId['min'], Criteria::GREATER_EQUAL);\n $useMinMax = true;\n }\n if (isset($problemId['max'])) {\n $this->addUsingAlias(SolutionPeer::PROBLEM_ID, $problemId['max'], Criteria::LESS_EQUAL);\n $useMinMax = true;\n }\n if ($useMinMax) {\n return $this;\n }\n if (null === $comparison) {\n $comparison = Criteria::IN;\n }\n }\n\n return $this->addUsingAlias(SolutionPeer::PROBLEM_ID, $problemId, $comparison);\n }",
"public function filterByWallId($wallId = null, $comparison = null)\n\t{\n\t\tif (is_array($wallId)) {\n\t\t\t$useMinMax = false;\n\t\t\tif (isset($wallId['min'])) {\n\t\t\t\t$this->addUsingAlias(ShoppingLogPeer::WALL_ID, $wallId['min'], Criteria::GREATER_EQUAL);\n\t\t\t\t$useMinMax = true;\n\t\t\t}\n\t\t\tif (isset($wallId['max'])) {\n\t\t\t\t$this->addUsingAlias(ShoppingLogPeer::WALL_ID, $wallId['max'], Criteria::LESS_EQUAL);\n\t\t\t\t$useMinMax = true;\n\t\t\t}\n\t\t\tif ($useMinMax) {\n\t\t\t\treturn $this;\n\t\t\t}\n\t\t\tif (null === $comparison) {\n\t\t\t\t$comparison = Criteria::IN;\n\t\t\t}\n\t\t}\n\t\treturn $this->addUsingAlias(ShoppingLogPeer::WALL_ID, $wallId, $comparison);\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts Alternate Login settings array to an Interger value that is stored in the $config array. | function set_al_settings($settings)
{
$al_settings = implode($settings);
$al_settings = strrev($al_settings);
$al_settings = bindec($al_settings);
return $al_settings;
} | [
"protected function _getAllowedAttemptsForSameLogin()\n {\n return (int)$this->_getHelper()->getConfigNode('failed_attempts_login');\n }",
"protected function formatAlipayConfig(array $config)\n\t{\n\t\treturn $config;\n\t}",
"private function _convertIniToInteger($setting)\n {\n if (!is_numeric($setting)) {\n $type = strtoupper(substr($setting, -1));\n $setting = (integer) substr($setting, 0, -1);\n\n switch ($type) {\n case 'K' :\n $setting *= 1024;\n break;\n\n case 'M' :\n $setting *= 1024 * 1024;\n break;\n\n case 'G' :\n $setting *= 1024 * 1024 * 1024;\n break;\n\n default :\n break;\n }\n }\n\n return (integer) $setting;\n }",
"protected static function configurationValueMassage($configs)\n {\n $types = array(\n 'PS_REDIS_STATUS' => 'int',\n 'PS_REDIS_SERIALIZER' => 'int',\n 'PS_REDIS_PERSISTENT' => 'int',\n 'PS_REDIS_FPC' => 'int',\n 'PS_REDIS_CACHE_OBJECT_INDEX' => 'int',\n 'PS_REDIS_CACHE_OBJECT_PRODUCTS' => 'int',\n 'PS_REDIS_CACHE_OBJECT_CATEGORIES' => 'int',\n 'PS_REDIS_CACHE_OBJECT_CMS' => 'int',\n 'PS_REDIS_CACHE_OBJECT_CONTACT' => 'int',\n 'PS_REDIS_CACHE_OBJECT_STORES' => 'int',\n 'PS_REDIS_CACHE_OBJECT_SITEMAP' => 'int',\n 'PS_REDIS_CACHE_OBJECT_DB_QUERIES' => 'int',\n 'PS_REDIS_SESSION_CACHE_STATUS' => 'int',\n 'PS_REDIS_DB' => 'int',\n );\n\n $config = array();\n\n foreach ($configs as $conf) {\n $key = $conf['key'];\n $value = $conf['value'];\n if (isset($types[$key]) && $types[$key] == 'int') {\n $config[$key] = (int)$value;\n } elseif (isset($types[$key]) && $types[$key] == 'bool') {\n $config[$key] = (bool)$value;\n } else {\n $config[$key] = trim($value);\n }\n }\n return $config;\n }",
"public function getEncodeOptions(): int\n {\n $options = $this->getConfig('encode_options');\n if (!is_int($options)) {\n if (is_string($options)) {\n $list = preg_split('/[\\s,|]+/', $options);\n $options = 0;\n if ($list) {\n foreach ($list as $option) {\n if (isset($this->encodeOptions[$option])) {\n $options += $this->encodeOptions[$option];\n }\n }\n }\n } else {\n $options = 0;\n }\n }\n\n return $options;\n }",
"public function setConfigSettingsArray($count,$config_array){\r\n $this->startTimer();\r\n $url = $this->server_url . \"/admin/index.php\";\r\n $postdata = 'op=setconfigsetting&count='. $count;\r\n $i = 0;\r\n foreach ($config_array as $key => $value) {\r\n $postdata .='¶m'.$i.\"=\" . $key . '&value'.$i . \"=\".$value;\r\n $i++;\r\n }\r\n //echo $postdata;\r\n $buffer = $this->doPOST($url, $postdata);\r\n $collection = new Collection($buffer, \"command\", \"CommandRecord\");\r\n $this->stopTimer();\r\n if ($collection->getNumberOfRecords() > 0)\r\n {\r\n \r\n \t$arr= $collection->getRecords();\r\n\t\t\treturn $arr[0];\r\n }\r\n else\r\n {\r\n return NULL;\r\n }\r\n }",
"public function getNotificationConfig()\n {\n return (int)$this->getConfigValue(self::XML_PATH_SUBACCOUNT_GENERAL_NOTIFICATION);\n }",
"protected function maxLoginAttempts()\n {\n return config('throttling.max_login_attempts');\n }",
"function getIntValue($name) {\n $name_with_colon = $name.':';\n $len = strlen($name_with_colon);\n\n if ($this->config_array) {\n foreach ($this->config_array as $unparsed_value) {\n if (substr($unparsed_value, 0, $len) === $name_with_colon) {\n // Found value.\n $unparsed_len = strlen($unparsed_value);\n $int_value = (int) substr($unparsed_value, -($unparsed_len - $len));\n return $int_value;\n }\n }\n }\n return false;\n }",
"protected function arrayToIni(array $array)\n {\n $ini = '';\n $lastWasArray = false;\n\n foreach ($array as $key => $value) {\n if (is_array($value)) {\n if (!$lastWasArray) {\n $ini .= PHP_EOL;\n }\n $ini .= '[' . $key . ']' . PHP_EOL;\n foreach ($value as $k => $v) {\n if (!is_array($v)) {\n $ini .= $key .\n '[' . ((!is_numeric($k)) ? $k : null) . '] = ' .\n ((!is_numeric($v)) ? '\"' . $v . '\"' : $v) . PHP_EOL;\n }\n }\n $ini .= PHP_EOL;\n $lastWasArray = true;\n } else {\n $ini .= $key . \" = \" . ((!is_numeric($value)) ? '\"' . $value . '\"' : $value) . PHP_EOL;\n $lastWasArray = false;\n }\n }\n\n return $ini;\n }",
"public function get_account_id()\n {\n $options = get_option('transact-settings');\n return $options['account_id'];\n }",
"private function getCounter(string $config):int\n {\n $appSettings = config('appsettings.' . $config);\n if (!$appSettings) {\n throw new AppSettingsNotFound($config);\n }\n\n $counter = AppSettings::getConfig($appSettings['counter']);\n\n return empty($counter) ? 1 : (int) $counter;\n }",
"private function getVerifyingDaysInterval(): int\n {\n return config('import.transaction.synchronisationDaysInterval') ?? 0;\n }",
"function cot_config_type_int_filter($new_value, $cfg_var, $min = '', $max = '', $skip_warnings = false)\n{\n\t$not_filtered = $new_value;\n\t$var_name = $cfg_var['config_name'];\n\tlist($title, $hint) = cot_config_titles($var_name, $cfg_var['config_text']);\n\n $fix_msg = '';\n $not_num = false;\n\n\tif (!is_numeric($new_value)) {\n\t\t$not_num = true;\n\t} else {\n\t\t$new_value = floor($new_value);\n\t\tif (!empty($min) && $new_value < $min) {\n\t\t\t$new_value = $min;\n\t\t\t$fix_msg = '. '.cot_rc('adm_set') . cot_rc('adm_int_min', array('value' => $min));\n\t\t}\n\t\tif (!empty($max) && $new_value > $max) {\n\t\t\t$new_value = $max;\n\t\t\t$fix_msg = '. ' . cot_rc('adm_set') . cot_rc('adm_int_max', array('value' => $max));\n\t\t}\n\t}\n\t// user friendly notification\n\t$invalid_value_msg = cot_rc('adm_invalid_input', array('value' => $not_filtered, 'field_name' => $title ));\n\tif (!$skip_warnings && ($fix_msg || $not_num)) {\n cot_message($invalid_value_msg . $fix_msg, $not_num ? 'error' : 'warning', $var_name);\n }\n\n\treturn $not_num ? null : (int) $new_value;\n}",
"public function _fetchLoginType()\n\t{\n\t\t$loginType = 'username';\n\n\t\t$this->DB->build( array( 'select' => '*', 'from' => 'conf_settings', 'where' => \"conf_key IN('ipbli_usertype','converge_login_method')\", 'order' => 'conf_key ASC' ) );\n\t\t$this->DB->execute();\n\n\t\twhile( $r = $this->DB->fetch() )\n\t\t{\n\t\t\t$r['conf_value'] = $r['conf_value'] ? $r['conf_value'] : $r['conf_default'];\n\n\t\t\tif ( $r['conf_value'] )\n\t\t\t{\n\t\t\t\t$loginType = $r['conf_value'];\n\t\t\t}\n\t\t}\n\n\t\treturn $loginType;\n\t}",
"function getLoginConfig() {\r\n\t\treturn $this->oLoginConfig;\r\n\t}",
"public function importSettings(): int\n {\n $importations = 0;\n $imported = $this->filterByHavingEntity()->filterByImportSettings();\n\n /** @var CalculationVariableContainer $container */\n foreach ($imported as $container) {\n $target = $this->get($container->getName());\n $source = $this->get($container->getInstanceOfContents()->getSourceOfImport());\n\n if ($target && $source) {\n $instanceOfTargetEntity = $target->getInstanceOfEntity();\n $sourceOfTargetEntity = $source->getInstanceOfEntity();\n $instanceOfTargetEntity->fillFromArray($sourceOfTargetEntity->toArray());\n $importations++;\n }\n }\n\n return $importations;\n }",
"public function getBaseConfig() {\n return $this->wallType->getCurVal() . $this->stories->getCurVal();\n }",
"public function getINIValue($string)\n {\n //readINIconfig returns array, find value\n $read = $this->readINIConfig();\n $result = $read[$string];\n\n if ($result == '' || $result == null) {\n return false;\n }\n\n return $result;\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get an array of all deployment storage descriptions $deployment = new deployment(); $arr = $deployment>get_storagedescription_list(); // $arr[0]['value'] // $arr[0]['label'] | function get_storagedescription_list() {
$query = "select deployment_id, deployment_storagedescription from $this->_db_table";
$deployment_name_array = array();
$deployment_name_array = openqrm_db_get_result_double ($query);
return $deployment_name_array;
} | [
"function get_description_list() {\n\t\t$query = \"select deployment_id, deployment_description from $this->_db_table\";\n\t\t$deployment_name_array = array();\n\t\t$deployment_name_array = openqrm_db_get_result_double ($query);\n\t\treturn $deployment_name_array;\n\t}",
"public function listStorage()\n {\n $request = new Request('GET',\n $this->baseUrl.'/storage/list/',\n [],\n $this->options\n );\n return $request->send();\n }",
"function libvirt_storagepool_get_info($res) : array\n{\n}",
"public function getFieldStorageDefinition();",
"public function getStorage();",
"public function getDescriptions(): array {\n return $this->configVars['site']['descriptions'];\n }",
"public function getAllStorages() {\n\t\treturn $this->readConfig();\n\t}",
"function libvirt_storagevolume_get_info($res) : array\n{\n}",
"public function getStorage() {}",
"public function getStorageUnitList()\n {\n return $this->sus;\n }",
"public function listDescribes(){\n\t $describes = Describe::lists('name','id');\n\t\treturn $describes;\n\t}",
"public function getDescriptions();",
"function storeDescriptions()\n {\n }",
"public function getDeploymentDescription($deployment)\n {\n $desc = array();\n $desc['tag'] = '';\n if ($deployment->type == 'staging') {\n $branches = implode(',', $deployment->branchesToDeploy);\n $desc['text'] = \"Deployment to {$deployment->currentRemoteBranch} from branches {$branches} was done.\";\n } else {\n // production\n $desc['tag'] = $deployment->newTagName;\n $desc['text'] = \"Deployment for version {$deployment->newTagName} was done. Version was commented with {$deployment->newTagComment}.\";\n }\n\n return (object)$desc;\n }",
"public function listBucket()\n {\n $contents = array();\n $storage = new StorageClient();\n $bucket = $storage->bucket( $this->bucketName );\n foreach ($bucket->objects() as $object) {\n printf( 'Object: %s' . PHP_EOL, $object->name() );\n $contents[] = $object->name();\n }\n return $contents;\n }",
"public function node_descriptions_list() {\r\n global $DB;\r\n if ($this->descriptions === null) {\r\n $istablefilledincorrect = !is_string($this->tablename) || core_text::strlen($this->tablename) == 0;\r\n if (!is_numeric($this->tableid) || $istablefilledincorrect) {\r\n return array();\r\n //throw new coding_exception('Trying to extract descriptions from unknown sources for string');\r\n }\r\n $conditions = array(\" tableid='{$this->tableid}' \", \"tablename = '{$this->tablename}' \");\r\n $records = $DB->get_records_select('block_formal_langs_node_dscr', implode(' AND ', $conditions));\r\n foreach($records as $record) {\r\n $this->descriptions[$record->number] = $record->description;\r\n }\r\n }\r\n return $this->descriptions;\r\n }",
"public function getStorageName() {\n $options = Mage::helper('uaudio_storage')->getStorageOptions();\n return $options[$this::STORAGE_MEDIA_ID]['label'];\n }",
"public function listDescriptions()\n {\n // Cache the list from pear.horde.org for one day\n if ($descriptions = $this->_cache->get(__CLASS__ . '::descriptions2', 86400)) {\n return unserialize($descriptions);\n }\n $components = $this->_getComponents();\n $descriptions = array();\n foreach ($components as $component) {\n $descriptions[$component->name] = $component->description;\n }\n ksort($descriptions);\n $this->_cache->set(__CLASS__ . '::descriptions2', serialize($descriptions));\n return $descriptions;\n }",
"public function getItemMetadata() {\n\t\t$listEntries = Temboo_Results::getSubItemByKey($this->base, \"contents\");\n\t\t$resultArray = array();\n\t\tif(!is_null($listEntries)) {\n\t\t\tforeach ($listEntries as $entry) {\n\t\t \tarray_push($resultArray, new Dropbox_ItemMetadata_output($entry));\n\t\t\t}\n\t\t}\n\t\treturn $resultArray;\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Operation getServerLogFilesConfig Retrieves the list of server log files. | public function getServerLogFilesConfig($serverName, $order = null)
{
list($response) = $this->getServerLogFilesConfigWithHttpInfo($serverName, $order);
return $response;
} | [
"public function getServerLogFilesConfigWithHttpInfo($serverName, $order = null)\n {\n \n // verify the required parameter 'serverName' is set\n if ($serverName === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $serverName when calling getServerLogFilesConfig');\n }\n\n // parse inputs\n $resourcePath = \"/v2/servers/{serverName}/logfiles\";\n $httpBody = '';\n $queryParams = array();\n $headerParams = array();\n $formParams = array();\n $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'text/xml', 'application/json'));\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/xml','text/xml','application/json'));\n\n // query params\n if ($order !== null) {\n $queryParams['order'] = $this->apiClient->getSerializer()->toQueryValue($order);\n }\n \n // path params\n if ($serverName !== null) {\n $resourcePath = str_replace(\n \"{\" . \"serverName\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($serverName),\n $resourcePath\n );\n }\n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n \n\n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath,\n 'GET',\n $queryParams,\n $httpBody,\n $headerParams,\n ServerLogFilesConfig::class\n );\n if (!$response) {\n return array(null, $statusCode, $httpHeader);\n }\n\n return array($this->apiClient->getSerializer()->deserialize($response, ServerLogFilesConfig::class, $httpHeader), $statusCode, $httpHeader);\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), ServerLogFilesConfig::class, $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n\n throw $e;\n }\n }",
"public function getServerLogFileDownloadConfig($serverName, $logName)\n {\n list($response) = $this->getServerLogFileDownloadConfigWithHttpInfo($serverName, $logName);\n return $response;\n }",
"public static function getLogfiles() {\n\t\t\t$logfiles = glob(Config::get('iis_log_path') . \"*.log\");\n\t\t\tLogger::log(\"Info: Found a total of \" . count($logfiles) . \" logfiles.\");\n\t\t\treturn $logfiles;\n\t\t}",
"protected function getServerLogFilesConfigRequest($server_name, $order = 'newestFirst')\n {\n // verify the required parameter 'server_name' is set\n if ($server_name === null || (is_array($server_name) && count($server_name) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $server_name when calling getServerLogFilesConfig'\n );\n }\n\n $resourcePath = '/v2/servers/{serverName}/logfiles';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n // query params\n if ($order !== null) {\n $queryParams['order'] = ObjectSerializer::toQueryValue($order);\n }\n\n // path params\n if ($server_name !== null) {\n $resourcePath = str_replace(\n '{' . 'serverName' . '}',\n ObjectSerializer::toPathValue($server_name),\n $resourcePath\n );\n }\n\n // body params\n $_tempBody = null;\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n ['application/xml', 'text/xml', 'application/json']\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n ['application/xml', 'text/xml', 'application/json'],\n ['application/xml', 'text/xml', 'application/json']\n );\n }\n\n // for model (json/xml)\n if (isset($_tempBody)) {\n // $_tempBody is the method argument, if present\n $httpBody = $_tempBody;\n \n if($headers['Content-Type'] === 'application/json') {\n // \\stdClass has no __toString(), so we should encode it manually\n if ($httpBody instanceof \\stdClass) {\n $httpBody = \\GuzzleHttp\\json_encode($httpBody);\n }\n // array has no __toString(), so we should encode it manually\n if(is_array($httpBody)) {\n $httpBody = \\GuzzleHttp\\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));\n }\n }\n } elseif (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValue\n ];\n }\n // for HTTP post (form)\n $httpBody = new MultipartStream($multipartContents);\n\n } elseif ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($formParams);\n\n } else {\n // for HTTP post (form)\n $httpBody = \\GuzzleHttp\\Psr7\\build_query($formParams);\n }\n }\n\n\n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['User-Agent'] = $this->config->getUserAgent();\n }\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n\n $query = \\GuzzleHttp\\Psr7\\build_query($queryParams);\n return new Request(\n 'GET',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }",
"protected function getConfigurationFiles()\n\t{\n\t\t$files = [];\n\t\t\n\t\t/** @noinspection PhpUndefinedMethodInspection */\n\t\t$configPath = realpath($this->app->configPath());\n\t\t\n\t\tforeach (Finder::create()->files()->name('*.php')->in($configPath) as $file) {\n\t\t\t$nesting = $this->getConfigurationNesting($file, $configPath);\n\t\t\t\n\t\t\t$files[ $nesting . basename($file->getRealPath(), '.php') ] = $file->getRealPath();\n\t\t}\n\t\t\n\t\treturn $files;\n\t}",
"public function getLogFiles()\n {\n // Check if path exists\n $path = Mage::getBaseDir('var') . DS . 'log' . DS;\n if (!file_exists($path)) {\n return array();\n }\n\n // Return file list\n $io = new Varien_Io_File();\n $io->open(\n array(\n 'path' => $path\n )\n );\n return $io->ls(Varien_Io_File::GREP_FILES);\n }",
"protected function getConfigurationFiles(): array\n {\n $configPath = $this->rootPath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR;\n\n $files = [];\n foreach (scandir($configPath) as $file) {\n if (fnmatch('*.php', $file)) {\n $files[basename($file, '.php')] = $configPath . $file;\n }\n }\n\n return $files;\n }",
"public function getSMILFilesConfigAsync($server_name, $vhost_name)\n {\n return $this->getSMILFilesConfigAsyncWithHttpInfo($server_name, $vhost_name)\n ->then(\n function ($response) {\n return $response[0];\n }\n );\n }",
"public function getServerLogTypesConfigWithHttpInfo($server_name)\n {\n $returnType = '\\Swagger\\Client\\Model\\ServerLogTypesConfig';\n $request = $this->getServerLogTypesConfigRequest($server_name);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n if ($returnType !== 'string') {\n $content = json_decode($content);\n }\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\Swagger\\Client\\Model\\ServerLogTypesConfig',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n }\n throw $e;\n }\n }",
"public function getLogfiles()\n {\n $url = sprintf(\n 'http://%s/fog/status/getfiles.php?path=%s',\n $this->get('ip'),\n '%s'\n );\n $paths = array(\n '/var/log/nginx',\n '/var/log/httpd',\n '/var/log/apache2',\n '/var/log/fog',\n '/var/log/php7.0-fpm',\n '/var/log/php-fpm',\n '/var/log/php5-fpm',\n '/var/log/php5.6-fpm',\n );\n $url = sprintf(\n $url,\n urlencode(implode(':', $paths))\n );\n $paths = self::$FOGURLRequests->process($url);\n foreach ((array) $paths as $index => &$response) {\n $tmppath = self::fastmerge(\n (array) $tmppath,\n (array) json_decode($response, true)\n );\n unset($response);\n }\n $paths = array_filter($tmppath);\n $paths = array_values($paths);\n natcasesort($paths);\n $this->set('logfiles', $paths);\n }",
"public function getConfigFiles()\n {\n return Finder::create()\n ->files()\n ->in(ASSELY_FRAMEWORK_DIR.'config')\n ->name('*.php');\n }",
"protected function getConfigurationFiles()\n {\n $files = [];\n $path = $this->laravel->configPath();\n $found = Finder::create()->files()->name('*.php')->depth('== 0')->in($path);\n\n foreach ($found as $file) {\n $files[] = basename($file->getRealPath(), '.php');\n }\n\n return $files;\n }",
"private function loadLogFiles()\n {\n $files = [];\n if ($handle = opendir($this->logPath)) {\n while (false !== ($entry = readdir($handle))) {\n if ($entry != \".\" && $entry != \"..\") {\n $filename = explode('.', $entry);\n if ($filename[count($filename) - 1] == 'log') {\n $files[] = $entry;\n }\n }\n }\n closedir($handle);\n }\n return $files;\n }",
"public static function getLogFilesForServerID($server_id, $specific_services = \"\"){\n $monit_id = self::getMonitIDFromServerID($server_id); // Retrieve the Monit ID\n if(!$monit_id) return false;\n\n /* Check the directory for the Monit instance ID */\n $files = array();\n foreach(glob(\"data/\".$monit_id.\"/\".$specific_services.\"*.xml\") as $file){\n $files[] = $file;\n }\n return $files;\n }",
"function get_remote_log_list($server) {\n\n\t\t$html = @file_get_contents(get_remote_log_url($server));\n\t\tif ($html === false) {\n\t\t\tthrow new \\Exception(\"Failed to get dictory list from '$server'\");\n\t\t}\n\n\t\t$matches = [];\n\t\t$matched = preg_match_all('#<a href=\"([0-9-]+\\.html)\">#im', $html, $matches);\n\n\t\tif (!$matched) {\n\t\t\tthrow new \\Exception(\"No log links found in '$server' directory list (???). Is your configuration correct?\");\n\t\t}\n\n\t\t$logs = [];\n\t\tforeach ($matches[1] as $matchtext) {\n\t\t\t$logs[]\t= $matchtext;\n\t\t}\n\n\t\trsort($logs);\n\t\treturn $logs;\n\t}",
"public static function get_log_files()\n\t{\n\t\t$files = array();\n\n\t\t$logs = Kohana::list_files('logs');\n\n\t\tforeach($logs as $year => $months)\n\t\t{\n\t\t\tforeach($months as $month => $day)\n\t\t\t{\n\t\t\t\tforeach($day as $log)\n\t\t\t\t{\n\t\t\t\t\t$files[] = $log;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn $files;\n\t}",
"function getServerConfigs($serverId)\n\t{\n\t\tglobal $cb_multiserver;\n\t\t$server = $this->get_server($serverId);\n\t\tif($server)\n\t\t{\n\t\t\t$dir = PLUG_DIR.'/'.$cb_multiserver;\n\t\t\t$fileData = file_get_contents($dir.'/server_configs/'.$serverId.'.json');\n\t\t\t$configs = json_decode($fileData,true);\n\t\t\t$configs = array_merge($configs,$server);\n\t\t\treturn $configs;\n\t\t}\n\t\treturn false;\n\t}",
"public function getPathsToConfigFiles()\n {\n return $this->_attributes['pathsToConfigFiles'];\n }",
"private function getLogFileList()\n {\n if ($this->filesystem->isDirectory($this->path)) {\n $logPath = sprintf('%s%s*.log', $this->path, DIRECTORY_SEPARATOR);\n\n if ($this->getDate() != 'none') {\n $logPath = sprintf('%s%slaravel-%s.log', $this->path, DIRECTORY_SEPARATOR, $this->getDate());\n }\n\n return $this->filesystem->glob($logPath);\n }\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get College Id method | private function getCollegeId($name = null, $id = null)
{
$name = trim($name);
if ($id == 0) {
$data = $this->Educations->Colleges->find('all', [
'conditions' => [
'Colleges.name' => $name,
'Colleges.active' => 1
]
]);
} else {
$data = $this->Educations->Colleges->find('all', [
'conditions' => [
'Colleges.id' => $id,
'Colleges.name' => $name,
'Colleges.active' => 1
]
]);
}
if ($data->count() < 1)
{
$newData = $this->Educations->Colleges->newEntity();
$newData->name = $name;
$newData->active = 1;
if ($this->Educations->Colleges->save($newData)) {
$data_id = $newData->id;
}
} else {
$data_id = $id;
}
return $data_id;
} | [
"public function getRITCollegeId()\n {\n return $this->getProperty('rit_college_id');\n }",
"function collegeId()\n\t{\n\t\t$login_id = getCurrentUser();\n\t\t$query = mysql_query(\"SELECT `college_id` FROM `login` WHERE `login_id` = '$login_id'\");\n\t\t$rows = mysql_num_rows($query);\n\t\t\n\t\t//if there is no college, return false, else return the college_id\n\t\tif ($rows == 0)\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn(mysql_result($query, 0, 'college_id'));\n\t\t}\n\t}",
"public function getCollege(){\n\t\t\treturn $this->college;\n\t\t}",
"function getCollegeById($id){\n $query = \"select * from college where id = $id\";\n $result = mysql_query($query);\n if($result){ \n $row = mysql_fetch_assoc($result);\n $row['course_id'] = $this->getCoursesUnderCollege($row['id'],\"details\");\n return $row;\n }\n }",
"public function getCollabPersonId()\n {\n return $this->_collabPersonId;\n }",
"function get_course_id()\n {\n return (int)$this->sloodle_instance->course;\n }",
"public function getCollege()\n {\n \t// hasOne(RelatedModel, foreignKeyOnRelatedModel = details_id, localKey = id)\n \treturn $this->hasOne(College::class,'id','college');\n }",
"function get_college( $offset=0 )\n {\n return $this->get('isupersoncollege');\n }",
"function getCampusID()\n {\n return $this->getValueByFieldName('campus_id');\n }",
"public function getUniversityId()\n {\n return $this->firstOfType('UNIV_ID');\n }",
"public function getCourseId ()\n {\n return $this->course_id;\n }",
"public function getCourseId() {\n \t$val = $this->cacheGetObj('course_id');\n \tif (is_null($val))\n \t\treturn $this->cacheSetObj('course_id', $this->getOffering()->getCourseId());\n \telse\n \t\treturn $val;\n\t}",
"abstract public function getContactId();",
"public function getDistrictId();",
"public function getCourseId()\n {\n return $this->course_id;\n }",
"public function getUniversityId()\r\n {\r\n return $this->university_id;\r\n }",
"public function _getschool_id() {\n\t\treturn $this->_schoolId;\n\t}",
"public function getCodeCollegePrud() {\n return $this->codeCollegePrud;\n }",
"function getCollegeDetail($loginId){\n\t\t$query = $this->db->get_where('teamdetail', array('loginId' => $loginId));\n\t\t\n\t\tif($query->result()){\t\t\t\n\t\t\treturn $query->row_array();\n\t\t}\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the node_event_registrations build array. | public function registrations(NodeInterface $node) {
$build = [
'#theme' => 'node_event_registrations',
'#content' => [],
];
$content = &$build['#content'];
if ($node->hasField('field_event_user_reg_max')) {
$content['max_registrations_per_user'] = [
'#type' => 'item',
'#title' => 'Maximum registrations per user:',
'#markup' => $node->field_event_user_reg_max->value ?: "No maximum",
];
}
$content['add'] = [
'#title' => 'Add event registration',
'#type' => 'link',
'#url' => Url::fromRoute('entity.event_registration.event_form', [
'node' => $node->id(),
'destination' => Url::fromRoute('<current>')->toString(),
]),
'#attributes' => [
'class' => ['button button-action'],
],
];
$properties = $node->registration->getItemDefinition()->getSetting('properties');
$field = $node->registration;
foreach ($properties as $name => $property) {
// This property doesn't need to be seen by staff
// when viewing Registrations tab.
if ($name == 'status_user' || $name == 'status') {
continue;
}
$content['details'][$name] = [
'#type' => 'item',
'#title' => $property->getLabel(),
'#markup' => $field->{$name},
];
}
$content['list'] = $this->getListBuilder('event_registration', $node)->render();
return $build;
} | [
"public function getEventRegistrations()\n\t{\n\t\t$db = $this->getDbo();\n\t\t$query = $db->getQuery(true);\n\n\t\t$query->from($db->quoteName('#__swa_event_registration') . ' AS event_registration');\n\t\t$query->select('event_registration.*');\n\n\t\tforeach ($this->getItems() as $member)\n\t\t{\n\t\t\t$query->where('event_registration.member_id = ' . $member->id, 'OR');\n\t\t}\n\n\t\t$db->setQuery($query);\n\t\t$result = $db->execute();\n\n\t\tif (!$result)\n\t\t{\n\t\t\tJLog::add(\n\t\t\t\t'SwaModelUniversityMembers::getEventRegistrations failed to do db query',\n\t\t\t\tJLog::ERROR,\n\t\t\t\t'com_swa'\n\t\t\t);\n\n\t\t\treturn array();\n\t\t}\n\n\t\treturn $db->loadObjectList('id');\n\t}",
"public function getRegistrations()\n {\n $result = [];\n foreach ($this->_twofactor->config['settings']['registrations'] as $index => $data) {\n $reg = new \\StdClass;\n $reg->keyHandle = $data['keyHandle'];\n $reg->publicKey = $data['publicKey'];\n $reg->certificate = $data['certificate'];\n $reg->counter = $data['counter'];\n $reg->index = $index;\n $result[] = $reg;\n }\n return $result;\n }",
"public function getRegistryArray() {\n return $this->_registryArray;\n }",
"public function getRegisteredEvents()\n {\n return $this->registeredEvents;\n }",
"public static function getRegisteredEvents(): array\n {\n return static::$events;\n }",
"public function getRegistrationFiles()\n {\n return $this->files[ self::FILE_REGISTRATIONS ];\n }",
"public static function getRegisteredNodes()\n {\n return self::$_registered;\n }",
"public function getRegisterElements() {\n return $this->registerElements;\n }",
"public function toArray()\n {\n return $this->registry;\n }",
"public function getEventActiveRegistrants(NodeInterface $node);",
"public function getStoreRegistrations()\n {\n return $this->storeRegistrations;\n }",
"public function findAllRegistrationsForEvent(Event $event)\n {\n }",
"protected function events()\n {\n $events = [];\n\n if ($this->count > 0) {\n $faker = Faker\\Factory::create();\n\n for ($i=0; $i<$this->count; $i++) {\n $address = $this->addresses(true);\n\n array_push($events, [\n 'name' => $faker->sentence(7),\n 'description' => $faker->paragraphs(rand(5,8), true),\n 'date' => $faker->dateTimeBetween('now', '+4 years')->format('Y-m-d'),\n 'time' => $faker->time(),\n 'public' => 1,\n 'address' => array_get($address, 'address'),\n 'address_2' => array_get($address, 'address_2'),\n 'city' => array_get($address, 'city'),\n 'state_id' => array_get($address, 'state_id'),\n 'postal_code' => array_get($address, 'postal_code')\n ]);\n }\n }\n\n return $events;\n }",
"protected function getChildSubscribedEvents() {\n return array();\n }",
"public function getNewRegistrationIds()\n {\n if ($this->getNewRegistrationIdsCount() == 0) {\n return array();\n }\n $filteredResults = array_filter($this->results, function($result) {\n return isset($result['registration_id']);\n });\n\n $data = array_map(function($result) {\n return $result['registration_id'];\n }, $filteredResults);\n\n return $data;\n }",
"public static function listRegistry(): array {}",
"public function getElements(): array\n {\n return array_unique($this->registry);\n }",
"public function getNewRegistrationIds()\n {\n if ($this->getNewRegistrationIdsCount() == 0) {\n return array();\n }\n $filteredResults = array_filter(\n $this->results,\n function ($result) {\n return isset($result['registration_id']);\n }\n );\n\n $data = array_map(\n function ($result) {\n return $result['registration_id'];\n },\n $filteredResults\n );\n\n return $data;\n }",
"public function getRegencies()\n\t{\n\t\treturn $this->regencies;\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
109 Parsing the web videos without a clear link. | function external_video( $link, $search )
{
$page = file_get_contents (str_replace( ' ', '+', $link) );
$ini = strpos( $page, '<' . $search );
$last = strpos( $page, $search . '>' );
if ( $search == 'object'){ $last++ ; };
$video_data = substr( $page, $ini, ( ($last+6)-$ini) );
return $video_data;
} | [
"protected function fetchVideo(): void\n {\n $matches = [];\n preg_match('~[\\'\"]([^\\'\"]+?\\.mp4(?:\\?[^\\'\"]+)?)[\\'\"]~', $this->getPageContent(), $matches);\n $videoUrl = $matches[1] ?? null;\n // if mp4 found\n if (!is_null($videoUrl) && strstr($videoUrl, 'ripsave.com') === false) {\n $this->saveVideo($videoUrl);\n return;\n }\n // try to find reddit gif mp4\n $matches = [];\n preg_match('~[\\'\"]([^\\'\"]+?\\.gif\\?format=mp4(?:\\&[^\\'\"]+)?)[\\'\"]~', $this->getPageContent(), $matches);\n $videoUrl = $matches[1] ?? null;\n // if mp4 found\n if (!is_null($videoUrl)) {\n $videoUrl = htmlspecialchars_decode($videoUrl);\n $this->saveVideo($videoUrl);\n return;\n }\n // if mp4 not found, try to find m3u8 playlist\n $videoUrl = Reddit::getTsUrl($this->getPageContent());\n if ($videoUrl) {\n $this->saveVideo($videoUrl);\n }\n }",
"function catch_that_video() {\n\t\t\tglobal $post, $posts, $more;\n\t\t\t$more = 0;\n\t\t\tob_start();\n\t\t\tob_end_clean();\n\t\t\tif(preg_match_all('/<a.+href=[\\'\"]([^\\'\"]+)[\\'\"].*>/i', $post->post_content, $matches)) {\n\t\t\t\treturn $matches[1][0];\n\t\t\t} else {\n\t\t\t\treturn \"\";\n\t\t\t}\n\t\t}",
"function parseVideos($videoString = null)\n{\n // return data\n $videos = array();\n\n if (!empty($videoString)) {\n\n // split on line breaks\n $videoString = stripslashes(trim($videoString));\n $videoString = explode(\"\\n\", $videoString);\n $videoString = array_filter($videoString, 'trim');\n\n // check each video for proper formatting\n foreach ($videoString as $video) {\n\n // check for iframe to get the video url\n if (strpos($video, 'iframe') !== FALSE) {\n // retrieve the video url\n $anchorRegex = '/src=\"(.*)?\"/isU';\n $results = array();\n if (preg_match($anchorRegex, $video, $results)) {\n $link = trim($results[1]);\n }\n } else {\n // we already have a url\n $link = $video;\n }\n\n // if we have a URL, parse it down\n if (!empty($link)) {\n\n // initial values\n $video_id = NULL;\n $videoIdRegex = NULL;\n $video_source = NULL;\n $results = array();\n\n // check for type of youtube link\n if (strpos($link, 'youtu') !== FALSE) {\n\n\t\t\t\t\t\t $url_string = parse_url($link, PHP_URL_QUERY);\n\t\t\t\t\t\t parse_str($url_string, $args);\n\t\t\t\t\t\t $video_source = 'youtube';\n\t\t\t\t\t\t $video_id = isset($args['v']) ? $args['v'] : false;\n }\n // handle vimeo videos\n else if (strpos($video, 'vimeo') !== FALSE) {\n $video_source = 'vimeo';\n if (strpos($video, 'player.vimeo.com') !== FALSE) {\n // works on:\n // http://player.vimeo.com/video/37985580?title=0&byline=0&portrait=0\n $videoIdRegex = '/player.vimeo.com\\/video\\/([0-9]+)\\??/i';\n } else {\n // works on:\n // http://vimeo.com/37985580\n $videoIdRegex = '/vimeo.com\\/([0-9]+)\\??/i';\n }\n\n if ($videoIdRegex !== NULL) {\n if (preg_match($videoIdRegex, $link, $results)) {\n $video_id = $results[1];\n\n // get the thumbnail\n /* try {\n $hash = unserialize(file_get_contents(\"http://vimeo.com/api/v2/video/$video_id.php\"));\n if (!empty($hash) && is_array($hash)) {\n $video_str = 'http://vimeo.com/moogaloop.swf?clip_id=%s';\n $thumbnail_str = $hash[0]['thumbnail_small'];\n $fullsize_str = $hash[0]['thumbnail_large'];\n } else {\n // don't use, couldn't find what we need\n unset($video_id);\n }\n } catch (Exception $e) {\n unset($video_id);\n }*/\n }\n }\n }\n\n // check if we have a video id, if so, add the video metadata\n if (!empty($video_id)) {\n // add to return\n $videos = array(\n \t'video_id' => $video_id,\n 'source' => $video_source\n );\n /* $videos[] = array(\n \t'video_id' => $video_id,\n 'url' => sprintf($video_str, $video_id),\n 'thumbnail' => sprintf($thumbnail_str, $video_id),\n 'fullsize' => sprintf($fullsize_str, $video_id)\n );*/\n }\n }\n\n }\n\n }\n\n // return array of parsed videos\n return $videos;\n}",
"function parse_video_uri( $url ) {\r\n\r\n $parse = parse_url( $url );\r\n\r\n $video_type = '';\r\n $video_id = '';\r\n\r\n if ( $parse['host'] == 'youtu.be' ) {\r\n $video_type = 'youtube';\r\n $video_id = ltrim( $parse['path'], '/' );\r\n }\r\n\r\n if ( ( $parse['host'] == 'youtube.com' ) || ( $parse['host'] == 'www.youtube.com' ) ) {\r\n\r\n $video_type = 'youtube';\r\n parse_str( $parse['query'] );\r\n $video_id = $v;\r\n\r\n if ( !empty( $feature ) ){\r\n $video_id = end( explode( 'v=', $parse['query'] ) );\r\n }\r\n\r\n if ( strpos( $parse['path'], 'embed' ) == 1 ) {\r\n $video_id = end( explode( '/', $parse['path'] ) );\r\n }\r\n }\r\n\r\n // Url is http://www.vimeo.com\r\n if ( ( $parse['host'] == 'vimeo.com' ) || ( $parse['host'] == 'www.vimeo.com' ) ) {\r\n $video_type = 'vimeo';\r\n $video_id = ltrim( $parse['path'],'/' );\r\n }\r\n\r\n $host_names = explode(\".\", $parse['host'] );\r\n $rebuild = ( ! empty( $host_names[1] ) ? $host_names[1] : '') . '.' . ( ! empty($host_names[2] ) ? $host_names[2] : '');\r\n\r\n // Url is an oembed url wistia.com\r\n if ( ( $rebuild == 'wistia.com' ) || ( $rebuild == 'wi.st.com' ) ) {\r\n $video_type = 'wistia';\r\n if ( strpos( $parse['path'], 'medias' ) == 1 || strpos( $parse['path'], 'embed' ) == 1 ) {\r\n $video_id = end( explode( '/', $parse['path'] ) );\r\n }\r\n }\r\n\r\n // If recognised type return video array\r\n if ( !empty( $video_type ) ) {\r\n $video_array = array(\r\n 'type' => $video_type,\r\n 'id' => $video_id\r\n );\r\n\r\n return $video_array;\r\n } else {\r\n return false;\r\n }\r\n}",
"public function parseOembed()\n {\n $matches = ProsemirrorRichText::scanLinkExtension($this->text, 'oembed');\n foreach ($matches as $match) {\n if(isset($match[3])) {\n UrlOembed::preload($match[3]);\n }\n }\n }",
"public function video()\n {\n $data = array(\n 'judul_halaman' => 'Sibejoo - Video',\n 'judul_header' => 'Layanan Video',\n );\n\n $konten = 'modules/layanan/views/r-layanan-video.php';\n\n $data['files'] = array(\n APPPATH . 'modules/homepage/views/r-header-detail.php',\n APPPATH . $konten,\n APPPATH . 'modules/homepage/views/r-footer.php',\n );\n\n $this->parser->parse('r-index-layanan', $data);\n }",
"function get_url_video_search($url) {\n//-- the system to search for videos on YouTube does not use the API, it only uses the plugin --> simple_html_dom.inc.php\t\t\n\t\t$count = preg_match_all('/v=([^&]+)/',$url,$matches);\n\t\tif ($count > 0) {\n\t\t\tfor($i = 0; $i < $count; $i++) {\n\t\t\t\t$meta = get_tags('https://www.youtube.com/watch?v='.$matches[1][$i]);\t\n\t\t\t\t$output = '\t\t\n\t\t\t\t\t<div class=\"video_info_content\">\n\t\t\t\t\t<img class=\"img_thumbnails\" src=\"'.$meta['image'].'\" alt=\"\"></img>\n\t\t\t\t\t\t<div class=\"video_description\">\n\t\t\t\t\t\t\t<p class=\"text_video_titule_search\">'.utf8_decode($meta['title']).'</p>\n\t\t\t\t\t\t\t<p class=\"text_video_description\">'.utf8_decode($meta['description']).'</p>\n\t\t\t\t\t\t\t<a class=\"button_video_more\" data-toggle=\"modal\" data-target=\"#view-modal-media\" data-id=\"'.$matches[1][$i].'\" id=\"getMedia\" href=\"#\">Download</a>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>';\t\n\t\t\t\treturn $output;\t\n\t\t\t}\n\t\t} else {\n\t\t\t//return 'There was a problem loading this information';\n\t\t}\n\t}",
"function printYoutubeInfo($youtubeVideoLink) \n\t {\n\t\t\t\t\t\t\t //$youtubeVideoLink = ‘http://tutsbucket.com/2010/11/css3-drop-down-menu/’;\n\t\t\t\t\t\t\t $videoId = getYoutubeId($youtubeVideoLink);\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t if($videoId == '0')\n\t\t\t\t\t\t\t {\n\t\t\t\t\t\t\t echo \"This is not a valid youtube video url. Please, give a valid url…\";\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t else\n\t\t\t\t\t\t\t {\n\t\t\t\t\t\t\t $videoInfo = parseVideoEntry($videoId);\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t // display main video record\n\t\t\t\t\t\t\t /*echo \"<br><br><table>\\n\";\n\t\t\t\t\t\t\t echo \"<tr>\\n\";\n\t\t\t\t\t\t\t echo \"<td><a href=\\\"{$videoInfo->watchURL}\\\">\n\t\t\t\t\t\t\t <img src=\\\"$videoInfo->thumbnailURL\\\"/></a></td>\\n\";\n\t\t\t\t\t\t\t echo \"<td><a href=\\\"{$videoInfo->watchURL}\\\">{$videoInfo->title}</a>\n\t\t\t\t\t\t\t <br/>\\n\";\n\t\t\t\t\t\t\t echo sprintf(\"%0.2f\", $videoInfo->length/60) . \" min. | {$videoInfo->rating}\n\t\t\t\t\t\t\t user rating | {$videoInfo->viewCount} views<br/>\\n\";\n\t\t\t\t\t\t\t echo $videoInfo->description . \"</td>\\n\";\n\t\t\t\t\t\t\t echo \"</tr>\\n\";*/\n\t\t\t\t\t\t\t //echo \"</table>\";\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t //echo ‘<br><br>’;\n\t\t\t\t\t\t\t // read ‘video comments’ feed into SimpleXML object\n\t\t\t\t\t\t\t // parse and display each comment\n\t\t\t\t\t\t\t if ($videoInfo->commentsURL && $videoInfo->commentsCount > 0)\n\t\t\t\t\t\t\t {\n\t\t\t\t\t\t\t $commentsFeed = simplexml_load_file($videoInfo->commentsURL);\n\t\t\t\t\t\t\t /*echo \"<tr><td colspan=\\\"2\\\"><h3>\" . $commentsFeed->title .\n\t\t\t\t\t\t\t \"</h3></td></tr>\\n\";\n\t\t\t\t\t\t\t echo \"<tr><td colspan=\\\"2\\\"><ol>\\n\";*/\n\t\t\t\t\t\t\t foreach ($commentsFeed->entry as $comment)\n\t\t\t\t\t\t\t {\n\t\t\t\t\t\t\t echo \"<li>\" . $comment->content . \"</li>\\n\";\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t //echo \"</ol></td></tr>\\n\";\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t //echo \"</table>\";\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t /*echo \"<h2>Basic Video Information</h2>\";\n\t\t\t\t\t\t\t echo \"<br>\";*/\n\t\t\t\t\t\t\t echo \"<div class=\\\"video_t\\\"><h4>\".$videoInfo->title.\"</h4></div>\";\t\t\t\t\t\n\t\t\t\t\t\t\t /*echo \"<b>Thumbnail link of video:</b> \".$videoInfo->thumbnailURL;\n\t\t\t\t\t\t\t echo \"<br><br>\";\n\t\t\t\t\t\t\t echo \"<b>Youtube video link:</b> \".$videoInfo->watchURL;\n\t\t\t\t\t\t\t echo \"<br><br>\";*/\n\t\t\t\t\t\t\t echo \"<div class=\\\"description\\\"><b>\".$videoInfo->description.\"</b></div>\";\n\t\t\t\t\t\t\t echo \"<br><br>\";\n\t\t\t\t\t\t\t /*echo \"<b>How many times video have seen:</b> \".$videoInfo->viewCount;\n\t\t\t\t\t\t\t echo \"<br><br>\";\n\t\t\t\t\t\t\t echo \"<b>Video length(in seconds):</b> \".$videoInfo->length;\n\t\t\t\t\t\t\t echo \"<br><br>\";\n\t\t\t\t\t\t\t echo \"<b>Video rating:</b> \".$videoInfo->rating;*/\n\t\t\t\t\t\t\t }\n\t }",
"function video_search()\r\n\t{\r\n\t\t$SERVICE_URL = \"http://www.searchmash.com/results/video:\";\r\n\t\t\r\n\t\t//elaborar el url adecuado para este servicio\r\n\t\t\r\n\t\t$peticion_url = $this->elaborar_url($SERVICE_URL);\r\n\t\t\r\n\t\t//conectarse y obtener la respuesta en formato nativo\r\n\t\t\r\n\t\t$this->respuesta_raw = $this->buscar($peticion_url);\t\t//TODO: validar una respuesta exitosa\r\n\t\t\r\n\t\t//transformar la respuesta raw a finjira\r\n\t\t\r\n\t\t$this->respuesta_findjira = $this->video_parse();\t\t\t\t//web_parse utiliza respuesta_raw para transformarla\r\n\t\t\r\n\t}",
"public static function getsearchvideo()\n\t{\n\t}",
"public function testVideo() {\n\t\t// iframe\n\t\t$this->assertEquals('<iframe src=\"http://www.youtube.com/embed/c0dE\" width=\"640\" height=\"360\" frameborder=\"0\"></iframe>', $this->object->reset('[video=\"youtube\"]c0dE[/video]')->parse());\n\t\t$this->assertEquals('<iframe src=\"http://www.youtube.com/embed/c0dE\" width=\"853\" height=\"480\" frameborder=\"0\"></iframe>', $this->object->reset('[video=\"youtube\" size=\"large\"]c0dE[/video]')->parse());\n\n\t\t// embed\n\t\t$this->assertEquals('<embed src=\"http://liveleak.com/e/c0dE\" width=\"600\" height=\"493\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\"></embed>', $this->object->reset('[video=\"liveleak\"]c0dE[/video]')->parse());\n\t\t$this->assertEquals('<embed src=\"http://liveleak.com/e/c0dE\" width=\"750\" height=\"617\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\"></embed>', $this->object->reset('[video=\"liveleak\" size=\"large\"]c0dE[/video]')->parse());\n\n\t\t// invalid\n\t\t$this->assertEquals('(Invalid video)', $this->object->reset('[video=\"youtube\"]fake..w123c0code[/video]')->parse());\n\t\t$this->assertEquals('(Invalid someVideoService video code)', $this->object->reset('[video=\"someVideoService\"]c0dE[/video]')->parse());\n\t}",
"private function zingtv(){\r\n\t\t$item = array();\r\n\t\t$mp4link['link'] = [];\r\n\t\t\r\n\t\t$idVideo = $this->getIdZing($this->url);\r\n\t\t\r\n\t\t$linkEmbed = 'http://tv.zing.vn/embed/video/'.$idVideo;\r\n\t\t$data = $this->getContent($linkEmbed, true);\r\n\t\t//$data = @file_get_contents('compress.zlib://'.$linkEmbed);\r\n\t\t\r\n\t\tpreg_match('/http\\:\\/\\/tv\\.zing\\.vn\\/tv\\/xml\\/media\\-embed\\/(.*)\"/', $data, $arr_preg);\r\n\t\t$xmlURL = str_replace('\"','',$arr_preg[0]);\t\t\t\t\t\t\r\n\t\t\r\n\t\t/*$xml_data = $this->getContent($xmlURL);\r\n\t\t$xml_data = @file_get_contents('compress.zlib://'.$xmlURL);\r\n\t\t\r\n\t\t$xml_string = str_replace(\"]]>\", \"\", str_replace(\"<![CDATA[\",\"\",$xml_data));\r\n\t\t$xml_string = preg_replace('/&(?!#?[a-z0-9]+;)/', '&', $xml_string);\t\t\t\r\n\t\t$xml_arr = json_decode(json_encode((array) simplexml_load_string($xml_string)), 1);\r\n\t\t\r\n\t\tif($xml_arr['item']){\r\n\t\t\t$item = $xml_arr['item'];\r\n\t\t\t$return['360p'] = trim($this->decodeCryptZTV($item['source']));\r\n\t\t\t$return['480p'] = trim($this->decodeCryptZTV($item['f480']));\r\n\t\t\t$return['720p'] = trim($this->decodeCryptZTV($item['f720']));\r\n\t\t}*/\r\n\t\t\r\n\t\t$xml = simplexml_load_file(\"compress.zlib://\".$xmlURL, 'SimpleXMLElement', LIBXML_NOCDATA);\r\n\t\tif ($xml->item->f1080) {\r\n\t\t\t$item['url'] = trim($this->decodeCryptZTV($xml->item->f1080));\r\n\t\t\t$item['quan'] = '1080p';\r\n\t\t\tif(strpos($item['url'], 'http:') !== false)\r\n\t\t\t\tarray_push($mp4link['link'], $item);\r\n\t\t\t\r\n\t\t}\r\n\t\tif($xml->item->f720){\r\n\t\t\t$item['url'] = trim($this->decodeCryptZTV($xml->item->f720));\r\n\t\t\t$item['quan'] = '720p';\r\n\t\t\tif(strpos($item['url'], 'http:') !== false)\r\n\t\t\t\tarray_push($mp4link['link'], $item);\r\n\t\t}\r\n\t\tif($xml->item->f480){\r\n\t\t\t$item['url'] = trim($this->decodeCryptZTV($xml->item->f480));\r\n\t\t\t$item['quan'] = '480p';\r\n\t\t\tif(strpos($item['url'], 'http:') !== false)\r\n\t\t\t\tarray_push($mp4link['link'], $item);\r\n\t\t}\r\n\t\tif($xml->item->source){\r\n\t\t\t$item['url'] = trim($this->decodeCryptZTV($xml->item->source));\r\n\t\t\t$item['quan'] = '360p';\r\n\t\t\tif(strpos($item['url'], 'http:') !== false)\r\n\t\t\t\tarray_push($mp4link['link'], $item);\r\n\t\t}\t\t\r\n\t\t\r\n\t\t//var_dump($mp4link);\r\n\t\t\r\n\t\t$mp4link['thumb'] = '';\r\n\t\t$this->directLinks($mp4link);\r\n\t}",
"function getVideos($url, $width, $height, $config) {\r\n \t$video = '';\r\n\r\n\t\t$url = trim($url);\r\n\t\t$url = str_replace('http://', '', $url);\r\n\r\n // youtube\r\n if (strpos($url,'outube.com')) {\r\n $found = 1;\r\n $split = explode('=',$url);\r\n $video = 'new SWFObject(\"http://www.youtube.com/v/'.$split[1].'\", \"sfwvideo\", \"'.$width.'\",\"'.$height.'\", \"9\", \"#'.$config['backgroundColor'].'\", \"wmode\", \"transparent\");';\r\n // Dailymotion\r\n } elseif (strpos($url,'ailymotion.co')) {\r\n $found = 1;\r\n $video = 'new SWFObject(\"http://'.$url.'\", \"sfwvideo\", \"'.$width.'\",\"'.$height.'\", \"9\", \"#'.$config['backgroundColor'].'\", \"wmode\", \"transparent\");';\r\n // video.google.com/.de\r\n } elseif (strpos($url,'ideo.google.')) {\r\n $found = 1; \r\n $split = explode('=',$url);\r\n $video = 'new SWFObject(\"http://video.google.com/googleplayer.swf?docId='.$split[1].'&hl='.$GLOBALS['TSFE']->lang.'\", \"sfwvideo\", \"'.$width.'\",\"'.$height.'\", \"9\", \"#'.$config['backgroundColor'].'\", \"wmode\", \"transparent\");'; \r\n // Metacafe\r\n } elseif (strpos($url,'metacafe.')) {\r\n $found = 1;\r\n $split = explode('/',$url);\r\n $video = 'new SWFObject(\"http://www.metacafe.com/fplayer/'.$split[2].'/.swf\", \"sfwvideo\", \"'.$width.'\",\"'.$height.'\", \"9\", \"#'.$config['backgroundColor'].'\", \"wmode\", \"transparent\");'; \r\n // MyVideo.de\r\n } elseif (strpos($url,'yvideo.de')) {\r\n $found = 1;\r\n $split = explode('/',$url);\r\n $video = 'new SWFObject(\"http://www.myvideo.de/movie/'.$split[2].'\", \"sfwvideo\", \"'.$width.'\",\"'.$height.'\", \"9\", \"#'.$config['backgroundColor'].'\", \"wmode\", \"transparent\");'; \r\n // clipfish.de\r\n\t\t} elseif (strpos($url,'lipfish.de')) {\r\n $found = 1;\r\n $split = explode('=',$url);\r\n $video = 'new SWFObject(\"http://www.clipfish.de/videoplayer.swf?as=0&videoid='.$split[1].'\", \"sfwvideo\", \"'.$width.'\",\"'.$height.'\", \"9\", \"#'.$config['backgroundColor'].'\", \"wmode\", \"transparent\");'; \r\n\t\t// sevenload\r\n\t\t} elseif (strpos($url,'sevenload.com')) {\r\n $found = 1;\r\n $split = explode('/',$url);\r\n $video = 'new SWFObject(\"http://de.sevenload.com/pl/'.$split[2].'/'.$width.'x'.$height.'/swf\", \"sfwvideo\", \"'.$width.'\",\"'.$height.'\", \"9\", \"#'.$config['backgroundColor'].'\", \"wmode\", \"transparent\");'; \r\n } \r\n\r\n\t\treturn $video;\r\n\t}",
"protected function get_videos()\n {\n //Authenticate\n $this->authenticate();\n \n //Set some starting variables\n $current = 0;\n $end = false;\n $xml = null;\n \n //Find the max pages\n $page = ($this->page == 1) ? 0 : $this->page;\n $max = floor(($this->max_per / $this->per_page) + $page);\n \n //Loop thru all videos to find every public and domain restricted video\n for ($this->page; $this->page <= $max; $this->page++) {\n \n //Get your videos, 100 at a time\n $videos = parent::viddler_videos_getByUser(array(\n 'sessionid' => $this->sessionid,\n 'page' => $this->page,\n 'per_page' => $this->per_page,\n 'visibility' => 'public,embed',\n ));\n \n //Log any errors\n if (isset($videos['error'])) {\n $this->log_error($videos);\n }\n \n /**\n :: Start putting videos in xml variable\n :: Documentation: http://support.google.com/webmasters/bin/answer.py?hl=en&answer=80472\n **/\n $videos = (isset($videos['list_result']['video_list'])) ? $videos['list_result']['video_list'] : array();\n foreach ($videos as $k => $video) {\n $embed = (isset($video['permissions']['embed']) && $video['permissions']['embed'] != 'private') ? 'yes' : 'no';\n $download = (isset($video['permissions']['download']) && $video['permissions']['download'] != 'private') ? true : false;\n \n $xml .= '<url>';\n $xml .= '<loc>' . $video['permalink'] . '</loc>';\n $xml .= '<video:video>';\n $xml .= '<video:thumbnail_loc>http://www.viddler.com/thumbnail/' . $video['id'] . '</video:thumbnail_loc>';\n $xml .= '<video:title>' . htmlspecialchars($video['title'], ENT_QUOTES, 'UTF-8') . '</video:title>';\n $xml .= '<video:description>' . htmlspecialchars($video['description'], ENT_QUOTES, 'UTF-8') . '</video:description>';\n \n //If downloads for this content are not private, allow this param\n if ($download === true) {\n $xml .= '<video:content_loc>' . $video['files'][1]['url'] . '</video:content_loc>';\n }\n \n $xml .= '<video:player_loc allow_embed=\"' . $embed . '\">http://www.viddler.com/embed/' . $video['id'] . '</video:player_loc>';\n $xml .= '<video:duration>' . $video['length'] . '</video:duration>';\n $xml .= '<video:view_count>' . $video['view_count'] . '</video:view_count>';\n $xml .= '<video:publication_date>' . date('Y-m-d', $video['upload_time']) . '</video:publication_date>';\n $xml .= '<video:family_friendly>yes</video:family_friendly>';\n $xml .= '<video:live>no</video:live>';\n $xml .= '</video:video>';\n $xml .= '</url>';\n $current += 1;\n $this->stats['total_videos_indexed'] = (isset($this->stats['total_videos_indexed'])) ? $this->stats['total_videos_indexed'] + 1 : 1;\n \n if ($current >= $this->max_per) {\n break;\n }\n }\n \n //Figure if we should kill the loop (no more videos)\n if (count($videos) < $this->per_page || $current >= $this->max_per) {\n break;\n }\n \n }\n \n //Write the current sitemap file\n $this->write_sitemap($xml);\n \n //If broke out because we hit the 50,000 video max, start again at next interval and increment sitemap filename\n if ($current >= $this->max_per) { \n $this->total_per += 1;\n $find = ($this->total_per > 1) ? '-' . ($this->total_per - 1) . '.xml' : '.xml';\n $current = 0;\n $this->create($this->sitemap_path, str_replace($find, '-' . $this->total_per . '.xml', $this->filename), $this->page + 1);\n }\n }",
"public function __construct() {\n\t$this->parseQuery = new ParseQuery('Video');\n }",
"function removeVideo($html, $data, $url) {\n return '';\n}",
"function vChannel( $url , $quality){\r\n $info = explode( 'Uploads' , file_get_contents($url) )[1];\r\n $dom = new DOMDocument;\r\n $dom->loadHTML($info);\r\n $links = array();\r\n $flag = False;\r\n foreach( $dom->getElementsByTagName('a') as $link )\r\n {\r\n if($flag)\r\n {\r\n $flag = False;\r\n continue;\r\n }\r\n $flag = True;\r\n if( preg_match('/watch\\?v=/', $link->getAttribute('href')) ) //getting only video links\r\n {\r\n array_push( $links , $link->getAttribute('href') );\r\n }\r\n }\r\n\r\n //sending links to video()\r\n foreach ($links as $link) {\r\n $this->getVideoUrl('http://www.youtube.com'.$link , $quality);\r\n }\r\n }",
"public function loadVideo(){\n if($this->sources === null) {\n $videoInfo = CurlUtil::fetch(\"http://youtube.com/get_video_info?video_id=$this->videoId\");\n $videoData = array();\n parse_str($videoInfo, $videoData);\n\n // echo json_encode($videoData);die();\n\n $this->videoTitle = $videoData['title'];\n $this->sources = array();\n $ref = explode(',', $videoData['url_encoded_fmt_stream_map']);\n\n foreach ($ref as $source) {\n $stream = array();\n parse_str($source, $stream);\n $type = explode(';', $stream['type'])[0];\n $quality = explode(',', $stream['quality'])[0];\n\n if (!array_key_exists($type, $this->sources) || !is_array($this->sources[$type])) {\n $this->sources[$type] = array();\n }\n $this->sources[$type][$quality] = $stream;\n }\n }\n }",
"static function getArregloVideos($text) {\n $videoArray = explode('http://www.youtube.com/watch?v=', $text);\n\n //Se realiza este proceso para descartar posiciones del arreglo sin contenido\n foreach ($videoArray as $video) {\n if ($video) {\n $video = explode('&', $video); //Elimina cualquier parametro adicional en la URL\n $videos[] = '<iframe width=\"560\" height=\"349\" src=\"http://www.youtube.com/embed/' . $video[0] . '?rel=0\" frameborder=\"0\" allowfullscreen></iframe>';\n }\n }\n return $videos;\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if blog section content type is recent. | function magpaper_is_blog_section_content_recent_enable( $control ) {
$content_type = $control->manager->get_setting( 'magpaper_theme_options[blog_content_type]' )->value();
return magpaper_is_blog_section_enable( $control ) && ( 'recent' == $content_type );
} | [
"function isBlogPage(){\n if ( is_page_template('page_blog.php') || is_post_type_archive('post') || is_singular('post') || is_category() || (is_date() && get_post_type() == 'post')) {\n return true; \n } \n \n return false;\n \n }",
"public function hasLatestPost() {\n return !is_null($this->latestPost);\n }",
"private static function is_viewing_liveblog_post() {\n\t\treturn (bool) ( is_single() && self::is_liveblog_post() );\n\t}",
"public function recentlyPublished()\n {\n return $this->created_at <= Carbon::now() && $this->created_at >= Carbon::now()->addDays(-2);\n }",
"public function is_current_blog_previewed()\n {\n }",
"function magpaper_is_latest_posts() {\n\treturn ( is_front_page() && is_home() );\n}",
"function auxin_is_blog(){\n // get the slug of page template\n $page_template_slug = is_page_template() ? get_page_template_slug( get_queried_object_id() ) : '';\n // whether the current page is a blog page template or not\n $is_blog_template = ! empty( $page_template_slug ) && false !== strpos( $page_template_slug, 'blog-type' );\n\n if( ( $is_blog_template || ( is_home() && !is_paged() ) || ( is_home() && !is_front_page() ) || ( !is_category() && !is_paged() && !is_tag() && !is_author() && is_archive() && !is_date() ) ) ) {\n return true;\n }\n return false;\n}",
"public function is_blog () {\n return defined('ADD_BLOG_FORM');\n }",
"function bpb_extended_is_blog_activity() {\n\treturn (bool) ( bpb_extended_is_single_item() && bp_is_current_action( 'activity' ) );\n}",
"function is_blog () {\n return ( is_home() || is_archive() || is_author() || is_category() || is_single() || is_tag()) && 'post' == get_post_type();\n}",
"function have_prev_blog(){\n\tglobal $blog;\n\treturn $blog->have_prev_blog();\n}",
"function is_last_post() {\n\treturn get_post_count()==(get_the_post_number()+1);\n}",
"public function isBlogPost()\n {\n $skips = ['404.md', 'front-page.md'];\n if ($this->getExtension() != 'md') {\n return false;\n }\n if (in_array($this->getFilename(), $skips)) {\n return false;\n }\n return true;\n }",
"public function isPublishedEntry($date = null);",
"private function _checkPublished() {\n\t\tif($this->_content !== null) {\n\t\t\tif(!$this->_content->getPublished()) {\n\t\t\t\tif($this->_content->getPublishingDate()) {\n\t\t\t\t\t$zDate = new Zend_Date();\n\t\t\t\t\t$result = $zDate->compare(strtotime($this->_content->getPublishingDate()));\n\t\t\t\t\tif($result == 0 || $result == 1) {\n\t\t\t\t\t\t$this->_content->setPublishingDate('');\n\t\t\t\t\t\t$this->_content->setPublished(true);\n\t\t\t\t\t\tApplication_Model_Mappers_ContainerMapper::getInstance()->save($this->_content);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn $this->_content->getPublished();\n\t\t}\n\t\treturn true;\n\t}",
"public function isLatestRevision(): bool\n {\n return boolval($this->{$this->getRevisionLeadingName()});\n }",
"function has_content() {\r\n return (!empty($this->issuu_url)) or ( !empty($this->archiveorg_url)) or ( $this->has_posts());\r\n }",
"public function have_next_blog(){\n\t\treturn !empty($this->next_blog);\n\t}",
"public function is_main_blog() {\n\t\t\treturn ( get_current_blog_id() === $this->get_main_blog_id() );\n\t\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
KEYS: SEE: get_document() Returns array of documents owned by $cust_id | function get_documents($cust_id){
global $connection;
$query = "SELECT id FROM documents WHERE FK_cust_id = $cust_id";
$result = mysqli_query($connection, $query);
confirmQResult($result);
$list = array();
while($row = mysqli_fetch_assoc($result)){
$doc_id = $row['id'];
$doc = get_document($doc_id);
array_push($list, $doc);
}
return $list;
} | [
"function getdocuments($ClientID){\n $table = TableRegistry::get(\"documents\");\n return $table->find('all', array('conditions' => array('client_id'=>$ClientID)));\n }",
"public function getDocuments();",
"function getDocumentsByID($user_id){\n $sql = \"SELECT * FROM documents WHERE userid = \" .$user_id. \"\";\n //echo \"SQL:\".$sql;\n //Execute query on db and get result\n $query = $this->db->query($sql)->result();\n //print_r($query);\n if(!empty($query)){\n return $query;\n }else{\n return false;\n }\n }",
"function getAllDetailsByID($document_id = 0);",
"public function getChildDocuments(): array {}",
"public function userDocuments();",
"public function getDocuments($accountId)\n\t{\n\t\treturn $this->send($this->getHttp()->get(static::URL.'account/'.$accountId.'/documents'));\t\n\t}",
"function GET_FIELDBOOK_CREWS_BY_DOCUMENT_ID($collection,$iDocID)\n {\n //get appropriate db\n $dbname = $this->SP_GET_COLLECTION_CONFIG(htmlspecialchars($collection))['DbName'];\n $this->getConn()->exec('USE ' . $dbname);\n if ($dbname != null && $dbname != \"\")\n {\n //prepares a select statement to select crew names from documentcrew (matches crew names from crew to the documentid's of document_\n $sth = $this->getConn()->prepare(\"SELECT c.`crewname` FROM `documentcrew` AS dc LEFT JOIN `crew` AS c ON dc.`crewID` = c.`crewID` WHERE dc.`docID` = ? \");\n //binds the variables to the prepares sql statement above\n $sth->bindParam(1, $iDocID, PDO::PARAM_INT, 11);\n $sth->execute();\n // return all matches\n $result = $sth->fetchAll(PDO::FETCH_NUM);\n return $result;\n } else return false;\n }",
"function fre_get_bulk_document( $document_type, $order_ids, $payer) {\n\treturn new \\WPO\\WC\\PDF_Invoices\\Documents\\Fre_Document( $document_type, $order_ids, $payer );\n\n}",
"function getDocuments($condition_array = array()) {\n\t\t\n\t\treturn $this->collection->find($condition_array);\n\t}",
"public function read($customerId);",
"function getDocument($id) {\n \treturn $this->connection->get($id);\n }",
"public function getChildDocuments() {}",
"public function getDocuments() {\n\t\t$user = $this->auth->user();\n\n\t\tif(!$user) {\n\t\t\treturn CustomResponsesHandler::response([\n\t\t\t\t\"code\" => 401,\n\t\t\t\t\"message\" => \"Permisos denegados para el cliente\",\n\t\t\t\t\"response\" => null\n\t\t\t]);\n\t\t} else {\n\t\t\t$documents = Documents::where('id_user', $user->id)->where('status', '1')->get(['id', 'folio', 'location', 'type', 'alias', 'notes', 'subtype', 'picture_path', 'expedition', 'expiration', 'created_at']);\n\n\t\t\tif($documents->count()) {\n\t\t\t\treturn CustomResponsesHandler::response([\n\t\t\t\t\t\"code\" => 200,\n\t\t\t\t\t\"message\" => \"Listado de documentos\",\n\t\t\t\t\t\"response\" => array(\"documents\" => $documents)\n\t\t\t\t]);\n\t\t\t} else {\n\t\t\t\treturn CustomResponsesHandler::response([\n\t\t\t\t\t\"code\" => 202,\n\t\t\t\t\t\"message\" => \"No se encontraron documentos\",\n\t\t\t\t\t\"response\" => null\n\t\t\t\t]);\n\t\t\t}\n\t\t}\n\t}",
"public function listMyDocuments(){\n\n $allDocuments = Document::all();\n $myDocuments = [];\n\n $id = Auth::user()->id;\n\n foreach ($allDocuments as $document){\n if($document->company_id == $id ){\n array_push($myDocuments,$document);\n }\n }\n\n return view('company.documents.submits',['myDocuments'=>$allDocuments]);\n }",
"public function getDocuments($accountId)\n\t{\n\t\treturn $this->send($this->getHttp()->get($this->url.'account/'.$accountId.'/documents'));\n\t}",
"public function getOfficialDocuments() {}",
"function getall_docs_ident(){\r\n return $this->db->query(\r\n \"SELECT cdi.* \r\n FROM cod_doc_identidad cdi where estado_id = 1\"\r\n )->result_array();\r\n }",
"public function getDocuments()\n {\n # GET /accounts/{accountId}/envelopes/{envelopeId}/documents\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validate if the generated result string matches the length. | public function validateLength()
{
$resultLength = strlen($this->generate());
if ($resultLength > $this->length) {
throw new RegistryTooLongException($resultLength);
}
if ($resultLength < $this->length) {
throw new RegistryTooShortException($resultLength);
}
return true;
} | [
"public function hasLength();",
"public function testHasLengthTrue()\n {\n $string = \"azertyuiop\";\n $length = mb_strlen($string);\n\n $result = StringValidator::hasLength($string, $length);\n\n $this->assertTrue($result);\n }",
"public function testGenerateStringIsNotEqual()\n {\n $string = str_shuffle(\"4azdaazdqsdqéqsd78cdfpliok\");\n $length = mb_strlen($string);\n\n $bool = StringValidator::lengthEqual($string, $length - 10);\n\n $this->assertFalse($bool);\n }",
"function validateFieldLength($str, $length) {\n return (strlen($str) <= $length);\n}",
"public function hasLength() : bool;",
"public function hasLength(): bool;",
"public function testGenerateLengthIsEqual()\n {\n $int = mt_rand(0, 10);\n\n $bool = IntValidator::equal($int, $int);\n\n $this->assertTrue($bool);\n }",
"public function test_exact_length()\n\t{\n\t\t$name = 'test';\n\t\t$label = 'Test field';\n\t\t$num = 5;\n\t\t$params = array('label' => $label, 'param:1' => $num);\n\n\t\tself::$inst\n\t\t\t-> add($name, $label)\n\t\t\t-> add_rule('exact_length', $num);\n\n\t\t$this->assertFalse( self::$inst->run(array($name => 'aaaaaaaaa')) );\n\n\t\t$expected = array( $name => \\Lang::get('validation.exact_length', $params, null, 'ja') );\n\t\t$actual = array_map(function($v){ return (string)$v; }, self::$inst->error());\n\t\t$this->assertEquals($expected, $actual);\n\t}",
"public function testValidationCaseForNonPositiveOutputLength()\n {\n $generator = $this->getTokenGeneratorForTesting();\n\n // Backward compatible for different versions of PHPUnit\n if (method_exists($this, 'expectException')) {\n $this->expectException(\\LengthException::class);\n\n $generator->getTokenString(0);\n } else {\n $hasThrown = null;\n\n try {\n $generator->getTokenString(0);\n } catch (\\LengthException $exception) {\n $hasThrown = !empty($exception->getMessage());\n } catch (\\Exception $exception) {\n $hasThrown = $exception->getMessage();\n }\n\n $this->assertTrue($hasThrown);\n\n return;\n }\n }",
"public function testGeneratePasswordMinimumLength(): void\n {\n $str = \\AWonderPHP\\PluggableUnplugged\\UnpluggedStatic::generatePassword(12);\n $actual = strlen($str);\n $expected = 12;\n $this->assertEquals($expected, $actual);\n }",
"function validate_problem($string)\n{\n\t$length = strlen($string);\n\tif ($length > 15)\n\t{\n\treturn true;\n\t}\n}",
"private function validateLengthMax()\n {\n if (strlen($this->configuration->checkString()) <= $this->configuration->rules()->get(Plexity::RULE_LENGTH_MAX)) {\n return true;\n }\n return false;\n }",
"protected function validateLength()\n {\n $value = $this->getValue();\n \n $minlength = $this->getAttr('minlength');\n if (isset($minlength) && $minlength !== false && strlen($value) > $minlength) {\n $this->setError($this->getOption('error:minlength'));\n return false;\n }\n \n $maxlength = $this->getAttr('maxlength');\n if (isset($maxlength) && $maxlength !== false && strlen($value) > $maxlength) {\n $this->setError($this->getOption('error:maxlength'));\n return false;\n }\n \n return true;\n }",
"public function testNotString(): void\n {\n $validator = new LengthValidator();\n $result = $validator->validate(9);\n\n $this->assertFalse($result->isValid());\n }",
"public function testTooShort(): void\n {\n $validator = new LengthValidator(5);\n $result = $validator->validate('foo');\n\n $this->assertFalse($result->isValid());\n }",
"public function testValidationCaseInvalidLengthInCharacterMapForCustomString()\n {\n $randomness = $this->getRandomnessSourceForTesting();\n\n // Backward compatible for different versions of PHPUnit\n if (method_exists($this, 'expectException')) {\n $this->expectException(\\LengthException::class);\n\n $randomness->getString(10, ['1', 'S', 'xx']);\n } else {\n $hasThrown = null;\n\n try {\n $randomness->getString(10, ['1', 'S', 'xx']);\n } catch (\\LengthException $exception) {\n $hasThrown = !empty($exception->getMessage());\n } catch (\\Exception $exception) {\n $hasThrown = $exception->getMessage();\n }\n\n $this->assertTrue($hasThrown);\n\n return;\n }\n }",
"function val_length($data,$length)\n\t{\n\t\t$data = filter_var($data, FILTER_SANITIZE_STRING);\n\t\treturn (strlen($data) < $length) ? FALSE : TRUE;\n\t}",
"public function testMessageLength() {\n\t\tif ($this->countChars($this->message . $this->signature) > $this->maxLength) {\n\t\t\treturn FALSE;\n\t\t} else {\n\t\t\treturn TRUE;\n\t\t}\n\t}",
"function is_random_string($data, $length) {\n return (preg_match(\"/^[0-9a-zA-Z]{{$length}}$/\", $data) > 0);\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Supprime un argument de balise | static function supprimer_argument_balise($pos, $p) {
if (!isset($p->param[0])) {
return null;
}
if (!isset($p->param[0][$pos])) {
return null;
}
if ($pos == 0) {
array_shift($p->param[0]);
} else {
$debut = array_slice($p->param[0], 0, $pos);
$fin = array_slice($p->param[0], $pos+1);
$p->param[0] = array_merge($debut, $fin);
}
return $p;
} | [
"public function args_clear(){\n\t\t\t$this->args[$switch]=array();\n\t\t}",
"public function cleanParameter(){\n unset($this->command_param);\n $this->command_param = Array();\n }",
"public function popArgument();",
"public function & RemoveParam ($name = '');",
"function supprimerSalle(){\n $tableSalles=new Zoraux_Modeles_Salle();\n if(isset($_GET['id'])){\n //Si l'id n'est pas transmis par la methode GET, on considere qu'une erreur est survenue\n //Alors on ne fait rien\n $salle=$tableSalles->get($_GET['id']);\n $salle->supprimer();\n }\n }",
"public function removeArgument(string $name): self;",
"public function removeArgument(IArgument $arg): self;",
"public function __unset($name)\n {\n unset($this->_params['args'][$name]);\n }",
"function remove_params() {\n\t\tif ($thisargs = func_get_args ()) {\n\t\t\tforeach ( $thisargs as $arg ) {\n\t\t\t\tif (isset ( $this->params [$arg] )) {\n\t\t\t\t\tunset ( $this->params [$arg] );\n\t\t\t\t}\n\t\t\t}\n\t\t} else { // no args\n\t\t\t$this->params = array ();\n\t\t}\n\t}",
"function baz_suppression($idfiche) {\n\tif ($idfiche != '') {\n\t\t$valeur = baz_valeurs_fiche($idfiche);\n\t\tif ( baz_a_le_droit( 'saisie_fiche', $valeur['bf_ce_utilisateur'] ) ) {\n\t\t\t\n\t\t\t/*//suppression des valeurs des champs texte, checkbox et liste\n\t\t\t$requete = 'DELETE FROM '.BAZ_PREFIXE.'fiche_valeur_texte WHERE bfvt_ce_fiche = \"'.$idfiche.'\"';\n\t\t\t$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;\n\t\t\tif (DB::isError($resultat)) {\n\t\t\t\treturn ('Echec de la requete<br />'.$resultat->getMessage().'<br />'.$resultat->getDebugInfo().'<br />'.\"\\n\") ;\n\t\t\t}\n\t\n\t\t\t//suppression des valeurs des champs texte long\n\t\t\t$requete = 'DELETE FROM '.$GLOBALS['wiki']->config[\"table_prefix\"].'triples WHERE resource = \"'.$idfiche.'\"';\n\t\t\t$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;\n\t\t\tif (DB::isError($resultat)) {\n\t\t\t\treturn ('Echec de la requete<br />'.$resultat->getMessage().'<br />'.$resultat->getDebugInfo().'<br />'.\"\\n\") ;\n\t\t\t}\n\t\t\t\n\t\t\t//TODO:suppression des fichiers et images associées\n\t\n\t\t\t//suppression de la fiche dans '.BAZ_PREFIXE.'fiche\n\t\t\t$requete = 'DELETE FROM '.BAZ_PREFIXE.'fiche WHERE bf_id_fiche = \"'.$idfiche.'\"';\n\t\t\t$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;\n\t\t\tif (DB::isError($resultat)) {\n\t\t\t\techo ('Echec de la requete<br />'.$resultat->getMessage().'<br />'.$resultat->getDebugInfo().'<br />'.\"\\n\") ;\n\t\t\t}*/\n\t\t\t\n\t\t\t//on supprime l'utilisateur associe\n\t\t\tif (isset($valeur[\"nomwiki\"])) {\n\t\t\t\t$requete = 'DELETE FROM `'.BAZ_PREFIXE.'users` WHERE `name` = \"'.$valeur[\"nomwiki\"].'\"';\n\t\t\t\t$GLOBALS['_BAZAR_']['db']->query($requete) ;\n\t\t\t}\n\t\t\t\n\t\t\t//on supprime les pages wiki crées\n\t\t\t$GLOBALS['wiki']->DeleteOrphanedPage($idfiche);\t\n\t\t\t$GLOBALS[\"wiki\"]->DeleteTriple($GLOBALS['_BAZAR_']['id_fiche'], 'http://outils-reseaux.org/_vocabulary/type', NULL, '', '');\n\t\n\t\n\t\t\t//on nettoie l'url, on retourne à la consultation des fiches\n\t\t\t$GLOBALS['_BAZAR_']['url']->addQueryString ('message', 'delete_ok') ;\n\t\t\t$GLOBALS['_BAZAR_']['url']->addQueryString(BAZ_VARIABLE_VOIR, BAZ_VOIR_CONSULTER);\n\t\t\t$GLOBALS['_BAZAR_']['url']->removeQueryString (BAZ_VARIABLE_VOIR) ;\n\t\t\t$GLOBALS['_BAZAR_']['url']->removeQueryString ('id_fiche') ;\n\t\t\theader ('Location: '.$GLOBALS['_BAZAR_']['url']->getURL()) ;\n\t\t\texit;\n\t\t}\n\t\telse {\n\t\t\techo '<div class=\"BAZ_error\">'.BAZ_PAS_DROIT_SUPPRIMER.'</div>'.\"\\n\";\n\t\t}\n\t}\n\treturn ;\n}",
"function action_supprimer_formulaire_dist($arg=null) {\n\tif (is_null($arg)){\n\t\t$securiser_action = charger_fonction('securiser_action', 'inc');\n\t\t$arg = $securiser_action();\n\t}\n\n\t// si id_formulaire n'est pas un nombre, on ne fait rien\n\tif ($id_formulaire = intval($arg)) {\n\t\t// On supprime le formulaire lui-même\n\t\t$ok = sql_delete(\n\t\t\t'spip_formulaires',\n\t\t\t'id_formulaire = '.$id_formulaire\n\t\t);\n\t\t\n\t\tif ($ok){\n\t\t\t// Si c'est bon, on récupère les réponses pour les supprimer\n\t\t\t$reponses = sql_allfetsel(\n\t\t\t\t'id_formulaires_reponse',\n\t\t\t\t'spip_formulaires_reponses',\n\t\t\t\t'id_formulaire = '.$id_formulaire\n\t\t\t);\n\t\t\t$reponses = $reponses ? array_map('reset', $reponses) : false;\n\t\t\n\t\t\t// On supprime les réponses s'il y en a\n\t\t\tif ($reponses){\n\t\t\t\t$ok = sql_delete(\n\t\t\t\t\t'spip_formulaires_reponses',\n\t\t\t\t\tsql_in('id_formulaires_reponse', $reponses)\n\t\t\t\t);\n\t\t\t\n\t\t\t\t// Si c'est bon, on supprime les champs des réponses\n\t\t\t\tif ($ok){\n\t\t\t\t\t$ok = sql_delete(\n\t\t\t\t\t\t'spip_formulaires_reponses_champs',\n\t\t\t\t\t\tsql_in('id_formulaires_reponse', $reponses)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t\n\tif ($ok){\n\t\tif (!$redirect = _request('redirect'))\n\t\t\t$redirect = generer_url_ecrire('formulaires_tous');\n\t\t\n\t\tinclude_spip('inc/headers');\n\t\tredirige_par_entete(str_replace(\"&\",\"&\",urldecode($redirect)));\n\t}\n}",
"public function unsetArg($key)\n {\n unset($this->args[$key]);\n }",
"protected abstract function applyNoArg();",
"public function removeArgument(string $argument, bool $all = false): int\n {\n $r = 0;\n do {\n $i = array_search($argument, $this->_arguments, true);\n if ($i !== false && $i !== null) {\n $r++;\n unset($this->_arguments[$i]);\n }\n if (!$all) {\n break;\n }\n } while ($i !== false && $i !== null);\n return $r;\n }",
"function elimina_parm($param) {\r\n // retorna uma string\r\n // útil para gerar string em barra de navegação\r\n global $_SERVER;\r\n\r\n $linha='';\r\n\t$linha.=$_SERVER['QUERY_STRING'];\r\n \r\n\r\n $arg2=explode(\"&\",$linha );\r\n for($i=0;$i<count($arg2);$i++) {\r\n \tif(ereg(\"^$param\",$arg2[$i])) {\r\n \t\tarray_splice($arg2, $i ,1);\r\n \t\t$i=0;\r\n \t}\r\n }\r\n return implode(\"&\",$arg2);\r\n\r\n }",
"public function supprimer() {\n $idProduitCommande = $this->requete->getParametre(\"id\");\n $produitCommandeObj = $this->produitCommandeObj->getProduitCommande($idProduitCommande);\n \n $this->genererVue(array('produitCommande' => $produitCommandeObj));\n }",
"public function removeArgument($argument, $all = false)\n {\n $r = 0;\n do {\n $i = array_search($argument, $this->_arguments, true);\n if ($i !== false && $i !== null) {\n $r++;\n unset($this->_arguments[$i]);\n }\n if (!$all) {\n break;\n }\n } while ($i !== false && $i !== null);\n return $r;\n }",
"public static function clearArgs()\n {\n self::$_args = array();\n }",
"public static function deleteArgument($name)\n\t{\n\t\tunset(self::$currentArguments);\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A list of objects to be uploaded to Cloud Storage upon successful completion of all build steps. Files in the workspace matching specified paths globs will be uploaded to the specified Cloud Storage location using the builder service account's credentials. The location and generation of the uploaded objects will be stored in the Build resource's results field. If any objects fail to be pushed, the build is marked FAILURE. Generated from protobuf field .google.devtools.cloudbuild.v1.Artifacts.ArtifactObjects objects = 2; | public function setObjects($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Build\V1\Artifacts\ArtifactObjects::class);
$this->objects = $var;
return $this;
} | [
"public function uploadObjectsToContainer($container, array $objects = array()) {\n // TODO: Implement uploadObjectsToContainer() method.\n }",
"public function listObjects()\n {\n $listBlobOption = new ListBlobsOptions();\n\n $listBlobOption->setPrefix($this->container);\n\n return $this->client->listBlob($this->container, $listBlobOption)->getBlobs();\n }",
"public function executeMultiple(array $objects);",
"public function setObjects($var)\n {\n $arr = GPBUtil::checkRepeatedField($var, \\Google\\Protobuf\\Internal\\GPBType::MESSAGE, \\Graphqlc\\ObjectTypeDefinitionDescriptorProto::class);\n $this->objects = $arr;\n\n return $this;\n }",
"public function listObjects(){\n\t\t\t\n\t\t\t$url = 'https://developer.api.autodesk.com/oss/v2/buckets/' . $this->bucketKey . '/objects';\n\n\t\t\t$headers = [\n\t\t\t\t'Accept: application/json',\n\t\t\t\t'Content-Type: application/json',\n\t\t\t\t'Authorization: Bearer ' . $this->AccessToken\n\t\t\t];\n\t\t\t\n\t\t\t$ch = curl_init();\n\t\t\tcurl_setopt($ch,CURLOPT_URL, $url);\n\t\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n\t\t\tcurl_setopt($ch, CURLOPT_URL, $url);\n\t\t\tcurl_setopt($ch, CURLOPT_HTTPHEADER, $headers);\n\t\t\tcurl_setopt($ch, CURLOPT_ENCODING, '');\n\t\t\t\n\t\t\t$result = curl_exec($ch);\n\t\t\t\n\t\t\tcurl_close($ch);\n\t\t\t\n\t\t\t$decodedResult = json_decode($result);\n\t\t\t\n\t\t\t/**\n\t\t\t * Catch errors\n\t\t\t **/\n\t\t\tif((!$result && $decodedResult == null) || !empty($decodedResult->developerMessage) || empty($decodedResult->items)){\n\t\t\t\treturn false;\t\n\t\t\t}\n\t\t\t\n\t\t\treturn $decodedResult->items;\t\t\t\t\t\n\t\t\t \n\t\t\t\n\t\t}",
"public static function saveAll($objects) {\n if (empty($objects)) { return; }\n // Unsaved children (objects and files) are saved before saving\n // top level objects.\n $unsavedChildren = array();\n forEach($objects as $obj) {\n $unsavedChildren = array_merge($unsavedChildren,\n $obj->findUnsavedChildren());\n }\n\n $children = array(); // Array of unsaved objects excluding files\n forEach($unsavedChildren as $obj) {\n if ($obj instanceof File) {\n $obj->save();\n } else if ($obj instanceof LeanObject) {\n if (!in_array($obj, $children)) {\n $children[] = $obj;\n }\n }\n }\n\n static::batchSave($children);\n static::batchSave($objects);\n }",
"function delete_s3_objects( $region, $bucket, $objects, $log_error = false, $return_on_error = false, $force_new_s3_client = false ) {\n\t\t$chunks = array_chunk( $objects, 1000 );\n\n\t\ttry {\n\t\t\tforeach ( $chunks as $chunk ) {\n\t\t\t\t$this->get_s3client( $region, $force_new_s3_client )->deleteObjects( array(\n\t\t\t\t\t'Bucket' => $bucket,\n\t\t\t\t\t'Objects' => $chunk,\n\t\t\t\t) );\n\t\t\t}\n\t\t} catch ( Exception $e ) {\n\t\t\tif ( $log_error ) {\n\t\t\t\tAS3CF_Error::log( 'Error removing files from S3: ' . $e->getMessage() );\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}",
"public function deleteObjects($bucket,$filenames) {\n\t\tif (is_array($filenames)) {\n\t\t\t$result = $this->client->deleteObjects(array(\n\t\t\t\t'Bucket'=>$bucket,\n\t\t\t\t'Objects'=>array_map(function($filename) {\n\t\t\t\t\treturn array(\n\t\t\t\t\t\t'Key' => $filename\n\t\t\t\t\t);\n\t\t\t\t}, $filenames)\n\t\t\t));\n\t\t\t\treturn $result;\n\t\t} else {\n\t\t\treturn $this->_deleteObject($bucket,$filenames);\n\t\t}\n\t}",
"public function deleteObjects($bucket, $objects);",
"public function DetectObjectsImageFromStorage()\n {\n echo \"Detect objects on an image from a cloud storage\" . PHP_EOL;\n\n $this->UploadSampleImageToCloud();\n $method = \"ssd\";\n $threshold = 50;\n $includeLabel = true;\n $includeScore = true;\n $allowedLabels = \"cat\";\n $blockedLabels = \"dog\";\n $folder = $this->CloudPath; // Input file is saved at the Examples folder in the storage\n $storage = null; // We are using default Cloud Storage\n\n $request = new GetObjectBoundsRequest($this->GetSampleImageFileName(), $method, $threshold, $includeLabel,\n $includeScore, $allowedLabels, $blockedLabels, $folder, $storage);\n\n echo \"Call ObjectBoundsRequest with params: method: ${method}, threshold: ${threshold}, includeLabel: ${includeLabel},includeScore: ${$includeScore},\" . PHP_EOL;\n\n try {\n $detectedObjectsList = self::$imagingApi->getObjectBounds($request);\n $count = count($detectedObjectsList->getDetectedObjects());\n echo \"objects detected: $count\";\n } catch (Exception $ex) {\n echo $ex->getMessage() . PHP_EOL;\n }\n\n\n echo PHP_EOL;\n }",
"static function get_objects($types) {\n $result = array();\n\n $conditions = array();\n $conditions[] = new EqualityCondition(ContentObject :: PROPERTY_OWNER_ID, Session :: get_user_id());\n\n $types_condition = array();\n foreach ($types as $type) {\n $types_condition[] = new EqualityCondition(ContentObject :: PROPERTY_TYPE, $type);\n }\n $conditions[] = new OrCondition($types_condition);\n $condition = new AndCondition($conditions);\n\n $rdm = RepositoryDataManager :: get_instance();\n $objects = $rdm->retrieve_content_objects($condition);\n\n if ($objects->size() == 0) {\n $result[0] = Translation :: get('CreateObjectFirst');\n } else {\n while ($object = $objects->next_result()) {\n $result[$object->get_id()] = $object->get_title();\n }\n }\n\n return $result;\n }",
"private function getFileList(){\n // Using the high-level iterators returns ALL the objects in your bucket, low level returns truncated result of about 1000 files\n $objects = $this->AmazonClient->getIterator('ListObjects', array('Bucket' => $this->getDataFromBucket));\n return $objects;\n }",
"public function uploads()\n {\n return $this->object->uploads();\n }",
"function getObjects() {\n\t\t\t$response = $this->call(\"sobjects/\");\n\t\t\tif (!isset($response->sobjects)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t$objects = array();\n\t\t\tforeach ($response->sobjects as $object) {\n\t\t\t\t$objects[] = new BigTreeSalesforceObject($object,$this);\n\t\t\t}\n\t\t\treturn $objects;\n\t\t}",
"function getObjects()\n {\n return $this->_storage->getObjects();\n }",
"public function queue_objects(/**\n * Fires after objects are added to the metadata lazy-load queue.\n *\n * @since 4.5.0\n *\n * @param array $object_ids Array of object IDs.\n * @param string $object_type Type of object being queued.\n * @param WP_Metadata_Lazyloader $lazyloader The lazy-loader object.\n */\n$object_type, /**\n * Fires after objects are added to the metadata lazy-load queue.\n *\n * @since 4.5.0\n *\n * @param array $object_ids Array of object IDs.\n * @param string $object_type Type of object being queued.\n * @param WP_Metadata_Lazyloader $lazyloader The lazy-loader object.\n */\n$object_ids) {}",
"function get_static_objects() {\n $result = array();\n\n $conditions = array();\n $conditions[] = new EqualityCondition(ContentObject :: PROPERTY_OWNER_ID, Session :: get_user_id());\n\n $types = HomeStatic::get_supported_types();\n $types_condition = array();\n foreach($types as $type){\n $types_condition[] = new EqualityCondition(ContentObject :: PROPERTY_TYPE, $type);\n }\n $conditions[] = new OrCondition($types_condition);\n $condition = new AndCondition($conditions);\n\n $rdm = RepositoryDataManager :: get_instance();\n $objects = $rdm->retrieve_content_objects($condition);\n\n if ($objects->size() == 0) {\n $result[0] = Translation :: get('CreateObjectFirst');\n } else {\n while ($object = $objects->next_result()) {\n $result[$object->get_id()] = $object->get_title();\n }\n }\n\n return $result;\n }",
"public function setInputObjects($var)\n {\n $arr = GPBUtil::checkRepeatedField($var, \\Google\\Protobuf\\Internal\\GPBType::MESSAGE, \\Graphqlc\\InputObjectTypeDefinitionDescriptorProto::class);\n $this->input_objects = $arr;\n\n return $this;\n }",
"public static function object(...$objects)\n {\n return new ObjectGravity(...$objects);\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Apply transformations of the Image_URL instance on a file and save it | public function save()
{
$image = $this->transformImage(\Image::forge(null, $this->_image->file()));
$destination = APPPATH.$this->url(false);
$dir = dirname($destination);
if (!is_dir($dir)) {
if (!@mkdir($dir, 0755, true)) {
error_log("Can't create dir ".$dir);
exit("Can't create dir ".$dir);
}
}
$image->save($destination);
return $destination;
} | [
"private function _getTransformedImage($imageFilename, $sourcePath, $targetPath, $targetUrl, $transform) {\n // break up the image filename to get extension and actual filename \n $pathParts = pathinfo($imageFilename);\n $targetExtension = $pathParts['extension'];\n $filename = $pathParts['filename'];\n \n // do we want to output in a certain format?\n if (isset($transform['format'])) {\n $targetExtension = $transform['format'];\n } \n \n // normalize the transform before doing anything more \n $transform = $this->_normalizeTransform($transform);\n \n // create target filename, path and url\n $targetFilename = $this->_createTargetFilename($filename, $targetExtension, $transform);\n $targetFilePath = $targetPath . $targetFilename;\n $targetFileUrl = $targetUrl . $targetFilename;\n \n /**\n * Check if the image already exists, if caching is turned on or if the cache has expired.\n */\n if (!$this->getSetting('cacheEnabled', $transform) || !IOHelper::fileExists($targetFilePath) || (IOHelper::getLastTimeModified($targetFilePath)->format('U') + $this->getSetting('cacheDuration') < time())) { \n // create the imageInstance. only once if reuse is enabled, or always\n if (!$this->getSetting('instanceReuseEnabled', $transform) || $this->imageInstance==null) {\n $this->imageInstance = $this->imagineInstance->open($sourcePath . $imageFilename);\n }\n \n // Apply any pre resize filters\n if (isset($transform['preEffects'])) {\n $this->_applyImageEffects($this->imageInstance, $transform['preEffects']);\n }\n \n $originalSize = $this->imageInstance->getSize();\n $cropSize = $this->_getCropSize($originalSize, $transform); \n $resizeSize = $this->_getResizeSize($originalSize, $transform);\n $saveOptions = $this->_getSaveOptions($targetExtension, $transform);\n $filterMethod = $this->_getFilterMethod($transform);\n \n if (!isset($transform['mode']) || mb_strtolower($transform['mode'])=='crop' || mb_strtolower($transform['mode'])=='croponly') {\n $cropPoint = $this->_getCropPoint($resizeSize, $cropSize, $transform);\n $this->imageInstance->resize($resizeSize, $filterMethod)->crop($cropPoint, $cropSize);\n } else {\n $this->imageInstance->resize($resizeSize, $filterMethod);\n }\n \n // Apply post resize filters\n if (isset($transform['effects'])) {\n $this->_applyImageEffects($this->imageInstance, $transform['effects']);\n }\n \n $this->imageInstance->save($targetFilePath, $saveOptions);\n \n // if file was created, check if optimization should be done\n if (IOHelper::fileExists($targetFilePath)) {\n if (($targetExtension=='jpg' || $targetExtension=='jpeg') && $this->getSetting('jpegoptimEnabled', $transform)) {\n $this->runJpegoptim($targetFilePath, $transform);\n }\n if (($targetExtension=='jpg' || $targetExtension=='jpeg') && $this->getSetting('jpegtranEnabled', $transform)) {\n $this->runJpegtran($targetFilePath, $transform);\n }\n if ($targetExtension=='png' && $this->getSetting('optipngEnabled', $transform)) {\n $this->runOptipng($targetFilePath, $transform);\n }\n if ($this->getSetting('tinyPngEnabled', $transform)) {\n $this->runTinyPng($targetFilePath, $transform);\n }\n }\n }\n \n $imageInfo = @getimagesize($targetFilePath);\n \n $imagerImage = new Imager_ImageModel();\n $imagerImage->url = $targetFileUrl;\n $imagerImage->width = $imageInfo[0];\n $imagerImage->height = $imageInfo[1];\n\n return $imagerImage;\n }",
"public function saveImage() {\n $fp = fopen($this->imageFile, \"wb\");\n fwrite($fp, $this->content);\n fclose($fp);\n }",
"public function transform()\r\n {\r\n // get file signatures and cache path / uri\r\n $fileName = TB_Util::crcFile($this->getPath()) . '.' . pathinfo($this->getPath(), PATHINFO_EXTENSION);\r\n $signature = TB_Util::crc(serialize($this->transformations));\r\n $cachePath = TB_Util::getCachePath('media-images/' . $signature . '/' . $fileName);\r\n $cacheUrl = TB_Util::getCacheUri('media-images/' . $signature . '/' . $fileName);\r\n\r\n // todo remove\r\n TB_Util_Filesystem::delete($cachePath);\r\n\r\n // if cache file already exists, bail early\r\n if(TB_Util_Filesystem::isFile($cachePath)) {\r\n return $cacheUrl;\r\n }\r\n\r\n // prepare the cache dir\r\n TB_Util_Filesystem::createDirectoryRecursive(dirname($cachePath));\r\n\r\n // init the editor\r\n $this->setEditor(wp_get_image_editor($this->getPath()));\r\n\r\n // apply transformations\r\n /** @var TB_Image_Transformation $transformation */\r\n foreach($this->transformations as $transformation) {\r\n $transformation->apply($this);\r\n }\r\n\r\n $result = $this->getEditor()->save($cachePath);\r\n if(is_wp_error($result)) {\r\n throw new Exception($result->get_error_message());\r\n }\r\n\r\n // cleanup & result\r\n $this->setEditor(null);\r\n return $cacheUrl;\r\n }",
"public function save()\n {\n $this->getHolder()->setImageCompressionQuality($this->getQuality());\n\n return $this->getHolder()->writeImage($this->getFilename());\n }",
"private function _renderWithImagick() {\n $im = new \\Imagick($this->_srcFile);\n $im->thumbnailImage($this->_dstX, $this->_dstY);\n $im->writeimage($this->_dstFile);\n }",
"protected function doActualConvert()\n {\n/*\n $im = \\Jcupitt\\Vips\\Image::newFromFile($this->source);\n //$im->writeToFile(__DIR__ . '/images/small-vips.webp', [\"Q\" => 10]);\n\n $im->webpsave($this->destination, [\n \"Q\" => 80,\n //'near_lossless' => true\n ]);\n return;*/\n\n $im = $this->createImageResource();\n $options = $this->createParamsForVipsWebPSave();\n $this->webpsave($im, $options);\n }",
"public function saveImage()\n {\n $imageType = $this->bitmapFormat->getFormatFromMimeType($this->getMimeType(), BitmapFormat::FORMAT_PNG);\n $imageOptions = $this->bitmapFormat->getFormatImagineSaveOptions($imageType);\n if ($imageType === BitmapFormat::FORMAT_GIF && $this->image->layers()->count() > 1) {\n $imageOptions['animated'] = true;\n }\n $this->image->save($this->getLocalFilename(), $imageOptions);\n }",
"abstract protected function writeImage($theImage, $theFile);",
"final public function saveImage($filename, mapObj $oMap) {}",
"function convertUrlToFile($url, $file_path) {\n if (!($file_path != null && $file_path !== ''))\n throw new Error(create_invalid_value_message($file_path, \"file_path\", \"html-to-image\", \"The string must not be empty.\", \"convert_url_to_file\"), 470);\n \n $output_file = fopen($file_path, \"wb\");\n if (!$output_file)\n throw new \\Exception(error_get_last()['message']);\n try\n {\n $this->convertUrlToStream($url, $output_file);\n fclose($output_file);\n }\n catch(Error $why)\n {\n fclose($output_file);\n unlink($file_path);\n throw $why;\n }\n }",
"abstract public function apply($image);",
"public function imageAction(){\n $this->_validarImagen();\n $this->_setearRutas();\n $file = $this->_recibeArchivo();\n $this->_covertImage($file);\n $this->_saveImage($file);\n }",
"private function resizeFromUrl() {\r\n\t\t\t$this->xOffset = 0;\r\n\t\t\t$this->yOffset = 0;\r\n\t\t\t$this->tmpName = file_get_contents($this->imageData);\r\n\t\t\t$this->getImageInfo($this->type);\r\n\t\t\t$this->imageRes = imagecreatefromstring(file_get_contents($this->imageData));\r\n\t\t\t$this->fileName = substr(md5(uniqid(rand().md5(rand()))), 0, 16).$this->getImageExtension();\r\n\t\t\t$this->resizeImage(0);\r\n\t\t\tif($this->generateThumbnail) {\r\n\t\t\t\tif($this->originalWidth > $this->originalHeight) {\r\n\t\t\t\t\t$this->xOffset = ($this->originalWidth - $this->originalHeight) / 2;\r\n\t\t\t\t\t$this->originalWidth = $this->originalHeight = $this->originalWidth - ($this->xOffset * 2);\r\n\t\t\t\t} else {\r\n\t\t\t\t\t$this->yOffset = ($this->originalHeight - $this->originalWidth) / 2;\r\n\t\t\t\t\t$this->originalWidth = $this->originalHeight = $this->originalHeight - ($this->yOffset * 2);\r\n\t\t\t\t}\r\n\t\t\t\t$this->generateThumbnail(0);\r\n\t\t\t}\r\n\t\t\treturn $this->response;\r\n\t\t}",
"public function enhanceImage () {}",
"private function saveImageFromUrl($url)\n\t{\n\t $ch = curl_init($url);\n\t $fp = fopen($this->image, 'wb');\n\t curl_setopt($ch, CURLOPT_FILE, $fp);\n\t curl_setopt($ch, CURLOPT_HEADER, 0);\n\t curl_exec($ch);\n\t curl_close($ch);\n\t fclose($fp);\n\t}",
"public function persist_image(){\n\t\tif(empty($this->Controller->request->data['Image']['img']['name']) && !empty($this->Controller->request->data['Image']['image_storage'])){\n\t\t\t// No new file was uploaded so lets persist the old one.\n\t\t\t// If they made transformations, we will catch that too.\n\t\t\t$file = str_replace('http://'.$_SERVER['SERVER_NAME'], '', $this->Controller->request->data['Image']['image_storage']);\n\t\t\t// We replace because without it the system would continuously attache -1appened to the file names making them super long.\n\t\t\t$name = str_replace('-1appended', '', basename($this->Controller->request->data['Image']['image_storage']));\n\t\t\tcopy(APP.'webroot/'.$file, TMP.$name);\n\t\t\t$this->Controller->request->data['Image']['img'] = TMP.$name;\n\t\t}\n\t}",
"public function saveImageFile() {\n move_uploaded_file($_FILES[$this->uploadedFileKey]['tmp_name'], $this->filePath);\n }",
"public function writeImageFile ($filehandle) {}",
"public function convertToImage($imageId);"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle the Catalog "deleted" event. | public function deleted(Catalog $catalog)
{
//
} | [
"public function deleted()\n {\n // do something after delete\n }",
"public function deleted(Event $event)\n {\n //\n }",
"public function deleting(Catalog $catalog)\n {\n //\n }",
"public function handleTermDeleted(TermDeleted $event)\n {\n $this->addEntry(\"Deleted term '\".$event->term->title().\"' (id: '\".$event->term->id().\"') in taxonomy '\".$event->term->taxonomy()->title().\"'\");\n }",
"public\n function deleted(Event $event)\n {\n //\n }",
"public function handleAssetDeleted(AssetDeleted $event)\n {\n $this->addEntry(\"Deleted asset '\".$event->asset->url().\"'\");\n }",
"abstract public function handleDelete($event);",
"public function forceDeleted(Catalog $catalog)\n {\n //\n }",
"public function deleted($tag)\n {\n parent::deleted($tag);\n\n Log::Info(\"Deleted tag\", ['tag' => $tag->id]);\n }",
"protected function afterDeletion() {}",
"public function deleted()\n {\n // Delete related images when model is deleted\n $this->deleteImages();\n }",
"public static function deleted($callback)\n {\n static::registerModelEvent('deleted', $callback);\n }",
"public function deleted()\n {\n }",
"public function deleted($artist)\n {\n parent::deleted($artist);\n\n Log::Info(\"Deleted artist\", ['artist' => $artist->id]);\n }",
"protected function afterDelete () {}",
"public function on_delete() {}",
"protected function afterDelete()\n {\n }",
"public static function deleted($event)\r\n {\r\n // vars\r\n $app = self::app();\r\n $item = $event->getSubject();\r\n $itemType = $item->getType()->id;\r\n\r\n // check index table\r\n $tableName = $app->jbtables->getIndexTable($itemType);\r\n if (!$app->jbtables->isTableExists($tableName)) {\r\n $app->jbtables->createIndexTable($itemType);\r\n }\r\n\r\n // update index data\r\n JBModelSku::model()->removeByItem($item);\r\n JBModelSearchindex::model()->removeById($item);\r\n\r\n // execute item trigger\r\n $jbimageElements = $item->getElements();\r\n foreach ($jbimageElements as $element) {\r\n if (method_exists($element, 'triggerItemDeleted')) {\r\n $element->triggerItemDeleted();\r\n }\r\n }\r\n }",
"public function deleted(Record $record)\n {\n //\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load the given user's shopping cart. | public function loadUserCart(Authenticatable $user): self
{
// If the user doesn't yet have a saved cart, we'll
// just attach the current one to the user and exit.
if (! $cart = CartModel::whereUserId($user->getAuthIdentifier())->with('items')->first()) {
return $this->attachTo($user);
}
// If the current cart is empty, we'll load the saved one.
if ($this->items()->isEmpty()) {
return $this->refreshCart($cart);
}
// Otherwise, we'll overwrite the saved cart with the current one.
// TODO add a strategy to be able to merge with the saved cart
return $this->overwrite($user);
} | [
"protected function getUserShoppingCart() {\n $user = $this->get('userManager')->getCurrentUser();\n \n $shoppingCart = NULL;\n if ($this->get('userManager')->isDBUser($user)) {\n $shoppingCart = $user->getShoppingCart();\n if ($shoppingCart == NULL) {\n $shoppingCart = new ShoppingCart();\n $user->setShoppingCart($shoppingCart);\n }\n } \n \n return $shoppingCart;\n }",
"public function getCartOfCurrentUser();",
"public function retrieveShoppingCartAction()\n {\n $isLoggedIn = $this->isLoggedInFromSession();\n //get currently logged in user\n $username = $this->usernameFromSession();\n //get userid for this username\n\n $user = User::getIdforUsername($username);\n $userid=$user->id;\n $cssStyleRule = $this->buildStyleRule();\n // retrieve cart from database\n $retrievedCartItem=Product::getSavedCart($userid);\n foreach ($retrievedCartItem as $item){\n $cartItem = new CartItem($item->id);\n $cartItem->setQuantity($item->quantity);\n }\n $_SESSION['shoppingCart'] = $cartItem;\n }",
"public function get(User $user): Cart\n {\n $cart = $this->getCartRepository()->findActiveForUser($user);\n\n if (null === $cart) {\n $cart = $this->cartFactory->create(\n owner: $user,\n );\n\n $this->entityManager->persist($cart);\n $this->entityManager->flush();\n }\n\n return $cart;\n }",
"public function getUserCart();",
"function loadCart() {\r\n if (!isset($_SESSION['cart']) && isset($_COOKIE['cart'])) {\r\n $_SESSION['cart'] = $_COOKIE['cart'];\r\n }\r\n }",
"private function _load_cart( )\n\t{\n\t\t$this->_cart_data = $this->php_session->get( 'shopping_cart' );\n\t\tif( is_null($this->_cart_data ) )\n\t\t{\n\t\t\t$this->clear();\n\t\t}\n\t}",
"function getCart( $user )\n\t{\n\t\tif( !checkId($user) )\n\t\t{\n\t\t\treturn '';\n\t\t}\n\t\t\n\t\t$userId = intVal($user);\n\t\n\t\t$query = \"SELECT cart.id, products.name, products.description, \n\t\t\tproducts.price, products.salePrice, cart.quantCart\n\t\t\tFROM `cart` LEFT JOIN `products` \n\t\t\tON products.id = cart.id WHERE cart.user = :user\";\n\t\t$params = array('user' => $userId);\n\t\t$data = $this -> query($query, $params, \"Item\");\n\t\t\n\t\tif( count($data) > 0 )\n\t\t{\n\t\t\treturn prodTable($data);\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn \"\";\n\t\t}\n\t}",
"private function load()\n\t{\n\t\t$data = Request::get( 'ShoppingCartData', array(), 'SESSION' );\n\t\t$this->items\t= isset( $data['items'] ) ? $data['items'] : array();\n\t\t$this->shipping\t= isset( $data['shipping'] ) ? $data['shipping'] : null;\n\t}",
"private function _load_cart() {\n $cart = array();\n $cookie = get_cookie($this->options['cookie_name']);\n if ($cookie) {\n $cart = ManagerHolder::get($this->options['cart_entity_name'])->getOneWhere(array('id' => $cookie, 'siteorder_id' => null));\n if (empty($cart)) {\n // Delete cookie if no record for it exists\n delete_cookie($this->options['cookie_name']);\n }\n }\n if (!empty($cart)) {\n $this->cart = $cart;\n }\n }",
"private function load()\r\n\t{\r\n\t\tif (!isset($_SESSION[$this->name])) {\r\n\t\t\t$_SESSION[$this->name] = array();\r\n\t\t} else {\r\n\t\t\t$this->cart = $_SESSION[$this->name];\r\n\t\t}\r\n\r\n\t\t$this->calcTotalPrice();\r\n\t}",
"function retrieveCart() {\n global $db;\n\n /**\n * If the user is not logged in, the guest session variable is assigned a MongoDB variable.\n */\n $isLoggedIn = isset($_SESSION['userID']);\n $id = ($isLoggedIn) ? $_SESSION['userID'] : $_SESSION['guestID'];\n\n $cart = null;\n\n /**\n * The cart for the user is fetched. If the cart is not found, a new cart is created with the user's id.\n */\n ($db->fetchCart(['userID' => $id], false) === null) ? $db->addCart([\n 'userID' => $id,\n 'dateCreated' => new MongoDB\\BSON\\UTCDateTime(),\n 'type' => ($isLoggedIn) ? 'user' : 'guest',\n 'items' => []\n ]) : $cart = $db->fetchCart(['userID' => $id], false);\n\n /**\n * The cart is returned.\n */\n return json_encode($cart['items']);\n}",
"public static function load()\n {\n $cartHash = Cookie::get('shopping_cart');\n if ($cartHash) {\n $cart = Cart::whereHash($cartHash)->first();\n if (!$cart) {\n $cart = new Cart();\n $cart->hash = $cartHash;\n $cart->save();\n Cookie::queue(self::COOKIE_NAME, $cartHash, self::COOKIE_TIME);\n }\n } else {\n $cart = new Cart();\n $cart->hash = sha1(microtime() . Str::random());\n $cart->save();\n Cookie::queue(self::COOKIE_NAME, $cart->hash, self::COOKIE_TIME);\n }\n\n self::$instance = $cart;\n }",
"public function findCartByUserId($id)\n {\n \t$cart = $this->model->whereUserId($id)->first();\n \n \treturn $cart;\n }",
"function get_shopping_cart($conn, $username) {\n $username = sanitize($conn, $username);\n\n $sql = \"SELECT Carts.ID FROM Carts JOIN Users ON\n UserID = Users.ID WHERE Username = '$username';\";\n $result = mysqli_query($conn, $sql);\n $cart = mysqli_fetch_row($result);\n\n // make a new cart if one does not exist already\n if (empty($cart)) {\n insert_into_table($conn, 'Carts', 'UserID', \n [[get_user_id($conn, $username)]]);\n $result = mysqli_query($conn, $sql);\n $cart = mysqli_fetch_row($result);\n }\n\n return $cart[0];\n}",
"public function getUserCart($user_id, $item_id)\n\t{\n\t\treturn $this->cart->where('user_id', $user_id)->where('item_id', $item_id)->first();\n\t}",
"public function getUserCart($user_id){\n $conn = new Dsn;\n $sql = \"SELECT user_cart FROM tbl_user_info WHERE user_id = ?\";\n try{\n $stmt = $conn->connect()->prepare($sql);\n $stmt->execute(array($user_id));\n if($stmt->rowCount() > 0){\n return $stmt->fetch(PDO::FETCH_ASSOC);\n }else{\n return [];\n }\n }catch(PDOException $e){\n echo 'Error getting user Cart: '.$e->getMessage();\n }\n }",
"public function getShoppingcart(){\n \treturn Database::start()->get('*', 'shoppingcart', array(\n array('user_id', '=', $_SESSION['_user']['id'])\n ))->results();\n }",
"public function setCartOfCurrentUser( $p4m_cart );"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets as ruleStatus This enumeration value will indicate whether the access rule is on or off, or if the application is currently being blocked due to exceeding a hard call limit. | public function getRuleStatus()
{
return $this->ruleStatus;
} | [
"public function getRuleCurrentStatus()\n {\n return $this->ruleCurrentStatus;\n }",
"public function getAccessRules()\r\n\t{\r\n\t\treturn $this->accessRules;\r\n\t}",
"public function getAccessRules()\n\t{\n\t\treturn $this->accessRules;\n\t}",
"function getAccessStatus() {\n\t\treturn $this->getData('accessStatus');\n\t}",
"public function getAccessRules();",
"public function getRestrictionStatus()\n {\n return $this->restrictionStatus;\n }",
"public static function get_active_rules()\n\t{\n\t\treturn URL::instance()->rules;\n\t}",
"public function getAllowAccessState()\n {\n return $this->allow_access_state;\n }",
"public function getCallStatus()\n {\n return $this->callStatus;\n }",
"public function getAclRules()\n {\n if (null === ($content = $this->_getResponse(self::URI_TYPE_ACL_RULES))) {\n $ch = curl_init();\n curl_setopt($ch, CURLOPT_URL, $this->_compileAclRulesUri()); \n curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n curl_setopt($ch, CURLOPT_TIMEOUT, $this->getRequestTimeout());\n $content = trim(curl_exec($ch));\n $statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);\n curl_close($ch);\n \n if (200 != $statusCode) {\n return false;\n }\n\n $this->_stashResponse($content, self::URI_TYPE_ACL_RULES);\n }\n\n return json_decode($content, true);\n }",
"public function getReadStatus();",
"public function canAccuse() {\n return $this->accuse;\n }",
"public function getRuleVisibility()\n {\n return isset($this->rule_visibility) ? $this->rule_visibility : '';\n }",
"public function getAccessRequestMode()\n {\n return $this->getProperty(\"AccessRequestMode\");\n }",
"public function ratelimit_status() {\n $request = 'http://twitter.com/account/rate_limit_status.' . $this->type;\n $out = $this->process($request);\n return $this->objectify($out);\n }",
"public function getAccessRulesInfo();",
"public function allowed_status_change() {\n return Survey_entity::$statuses_matrix[$this->status];\n }",
"public static function get_status()\n\t{\n\t\t// Base the status on directory writability\n\t\t$status = self::get_folder_status();\n\t\t$ret = $status['temporary'] && $status['output'];\n\n\t\t// Scan for high severity quirks\n\t\t$quirks = self::get_quirks();\n\t\tif(!empty($quirks))\n\t\t{\n\t\t\tforeach($quirks as $quirk)\n\t\t\t{\n\t\t\t\tif($quirk['severity'] == 'critical') $ret = false;\n\t\t\t}\n\t\t}\n\n\t\t// Return status\n\t\treturn $ret;\n\t}",
"public function getAisStatus()\n {\n return $this->ais_status;\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Lists all proposed nurls for all users. | public function proposedAction()
{
$em = $this->getDoctrine()->getManager();
$nurls = $em->getRepository('AppBundle:Nurl')->findAll();
return $this->render('nurl/proposed.html.twig', array(
'nurls' => $nurls,
));
} | [
"public function allAction()\n {\n $this->denyAccessUnlessGranted('ROLE_MODERATOR', null, 'Unable to access this page!');\n\n $em = $this->getDoctrine()->getManager();\n\n $nurls = $em->getRepository('AppBundle:Nurl')->findAll();\n\n return $this->render('nurl/all.html.twig', array(\n 'nurls' => $nurls,\n ));\n }",
"public function getAllPublicites()\n {\n }",
"public function getUrls();",
"public function getAllUnvisitedUrls();",
"public function actionIndex()\n {\n $searchModel = new UserUrlSearch();\n $dataProvider = $searchModel->search(Yii::$app->request->queryParams);\n\n return $this->render('index', [\n 'searchModel' => $searchModel,\n 'dataProvider' => $dataProvider,\n ]);\n }",
"function findPageUrls();",
"public function userlist()\n {\n $filter = Param::get('filter');\n\n $current_page = max(Param::get('page'), SimplePagination::MIN_PAGE_NUM);\n $pagination = new SimplePagination($current_page, MAX_ITEM_DISPLAY);\n $users = User::filter($filter);\n $other_users = array_slice($users, $pagination->start_index + SimplePagination::MIN_PAGE_NUM);\n $pagination->checkLastPage($other_users);\n $page_links = createPageLinks(count($users), $current_page, $pagination->count, 'filter=' . $filter);\n $users = array_slice($users, $pagination->start_index -1, $pagination->count);\n \n $this->set(get_defined_vars());\n }",
"function recommend_urls($valid_user, $popularity = 1)\r\n\t{\r\n\t $conn = db_connect();\r\n\t\r\n\t $query = \"select bm_URL\r\n\t\t\tfrom bookmark\r\n\t\t\twhere username in\r\n\t\t\t (select distinct(b2.username)\r\n\t\t\t\t\t from bookmark b1, bookmark b2\r\n\t\t\t where b1.username='$valid_user'\r\n\t\t\t\t\t and b1.username != b2.username\r\n\t\t\t\t\t and b1.bm_URL = b2.bm_URL)\r\n\t\t\tand bm_URL not in\r\n\t\t\t\t\t (select bm_URL\r\n\t\t\t\t\t from bookmark\r\n\t\t\t\t\t where username='$valid_user')\r\n\t\t\t\tgroup by bm_url\r\n\t\t\t\thaving count(bm_url)>$popularity\";\r\n\t \r\n\t if (!($result = $conn->query($query)))\r\n\t\t throw new Exception('Could not find any bookmarks to recommend.');\r\n\t if ($result->num_rows==0)\r\n\t\t throw new Exception('Could not find any bookmarks to recommend.');\r\n\r\n\t $urls = array();\r\n\t // build an array of the relevant urls\r\n\t for ($count=0; $row = $result->fetch_object(); $count++)\r\n\t {\r\n\t\t $urls[$count] = $row->bm_URL; \r\n\t }\r\n\t\t\t\t\t\t\t\t \r\n\t return $urls; \r\n\t}",
"public function topPoolContributors(int $n): array {\n self::$db->prepared_query(\"\n SELECT user_id,\n sum(amount_sent) AS total\n FROM bonus_pool_contrib\n GROUP BY user_id\n ORDER BY total DESC\n LIMIT ?\n \", $n\n );\n return self::$db->to_array(false, MYSQLI_ASSOC, false);\n }",
"public function index()\n {\n if (! Auth::check()) {\n abort(403);\n }\n $user_id = Auth::user()->id;\n\n return Url::where('user_id', $user_id)\n ->select(['created_at', 'updated_at', 'long_url', 'short_url', 'private', 'hide_stats'])\n ->paginate(25);\n }",
"public function getNextUrls();",
"private function getListOfNeighbors($userID, $nNeighbors){\n\t\t$neighbors = array();\n\t\tforeach ($this->listOfSimilarityUsers as $keyEx => $valueEx) {\n\t\t\tif($keyEx == $userID){\n\t\t\t\t$neighbors += $valueEx;\n\t\t\t}else \n\t\t\t\tforeach ($valueEx as $key => $value) {\n\t\t\t\t\tif($key == $userID)\n\t\t\t\t\t\t$neighbors += array($keyEx => $value);\n\t\t\t\t}\n\t\t}\n\t\tasort($neighbors);\n\t\t$neighbors = array_reverse($neighbors, true);\n\t\tif(count($neighbors) < $nNeighbors)\n\t\t\treturn $neighbors;\n\t\telse\n\t\t\treturn array_slice($neighbors, 0, $nNeighbors, true);\n\t}",
"public function getUrls()\r\n {\r\n }",
"public function getListOfAllUrls()\n {\n return $this->urlDal->findAll();\n }",
"function recommend_urls($valid_user, $popularity = 1){\n\t\t// with other peoples, they may like other urls that these people like\n\t\t$conn = db_connection();\n\t\t\n\t\t//find other matching users with an url the same as you as a simple way of excluding people's\n\t\t//private pages, and increasing the chance of recommending appealing URLs, we specify a minimum\n\t\t//popularity level, if $popularity = 1, then more than one person must have an URL \n\t\t//before we will recommend it\n\t\t\n\t\t$query = \"select bm_url from bookmark where username in (select distinct(b2.username) from\"\n\t\t\t.\" bookmark b1, bookmark b2 where b1.username='\".$valid_user.\"' and b1.username != b2.username\"\n\t\t\t.\" and b1.bm_url = b2.bm_url) and bm_url not in (select bm_url from bookmark where username='\"\n\t\t\t.$valid_user.\"') group by bm_url having count(bm_url) > \".$popularity;\n\t\t\t\n\t\tif(!($result = $conn->query($query))){\n\t\t\tthrow new Exception(\"Could not find any bookmarks to recommend.\");\n\t\t}\n\t\t\n\t\tif($result->num_rows == 0){\n\t\t\tthrow new Exception(\"Could not find any bookmarks to recommend.\");\n\t\t}\n\t\t\n\t\t$urls = array();\n\t\t//build an array of the relevant urls\n\t\tfor($count = 0; $row = $result->fetch_object(); $count++){\n\t\t\t$urls[$count] = $row->bm_url;\n\t\t}\n\t\t\n\t\treturn $urls;\n\t}",
"public function actionIndex()\n {\n $searchModel = new PrizeUserSearch();\n $dataProvider = $searchModel->search(Yii::$app->request->queryParams);\n\n return $this->render('index', [\n 'searchModel' => $searchModel,\n 'dataProvider' => $dataProvider,\n ]);\n }",
"public static function listPublicWebsiteUsers()\n {\n return self::listUsers(\n NULL, // group name\n 'enabled', // enabled status\n NULL, // created on date\n NULL, // created before date\n NULL, // created after date\n ['public-website'], // permissions\n FALSE, //sendback as JSON\n FALSE // condensed\n );\n }",
"public function getAllUrls(){\n\t\t$query = 'SELECT * FROM short_urls';\n\t\t$results = $this->conn_obj->dbQuery($query);\n\t\treturn $results;\n\t}",
"public function getUserPubKeyUrls() {\n return array(\n 'Imbo 1.x compatible fallback' => array('http://imbo/users/christer.json', 'christer', 'christer'),\n 'Imbo 2.x specified public key' => array('http://imbo/users/christer.json?publicKey=foo', 'christer', 'foo'),\n 'URL without user' => array('http://imbo/stats.json?publicKey=foo', null, 'foo'),\n );\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
if($this>rfp>modify($record,\Input::all())) return 'RFP Updated!'; | public function update($record){
// else return 'Update Failed!';
$record = $this->rfp->modify($record,\Input::all());
if($record['saved'] > 0)
return \Response::json(array('status' => 'success', 'message' => 'Record update completed'));
else if($record['saved'] == 0)
return \Response::json(array('status' => 'success_error', 'message' => $record['object']));
else return \Response::json(array('status' => 'success_failed', 'message' => $record['object']));
} | [
"public function updatePR(){\n\t\tif(isset($_POST['action'])){\n\t\t\t$record = $this->model('personal_record');\n\t\t\t$record->record_id = $_POST['record_id'];\n\t\t\t$record->record = $_POST['record'];\n\t\t\t$result = $record->get();\n\t\t\t$record->user_id = $result[0]->user_id;\n\t\t\t$record->exercise_id = $result[0]->exercise_id;\n\t\t\t$record->update();\n\t\t\t$exercise = $this->model('personal_record');\n\t\t\t$exercise->where('user_id', '=', $_SESSION['userID']);\n\t\t\t$results = $exercise->get();\n\t\t\t$this->view('Users/personal_record', ['records'=>$results]);\n\t\t}\n\t\telse{\n\t\t\t$this->view('Users/personal_record', ['record_id'=>$_POST['record_id']]);\n\t\t}\n\t}",
"public function editIrRemout(){\n }",
"public function update(){\n\n if(!empty($_POST)){\n $record_id = $_POST['record_id']; \n unset($_POST['record_id']);\n\n $this->record_obj\n ->ready()\n ->update($_POST)\n ->where([\n 'record_id' => $record_id\n ])\n ->go();\n }\n }",
"function _edit_recruiter_details ($recruiterid){\n \n\t\t\t$recrarray\t=\tarray(\n 'recruiter_name' =>\tucfirst($this->firstname),\n 'recruiter_last_name' =>\tucfirst($this->lastname),\n 'recruiter_mail'\t\t=>\t$this->email,\n 'recruiter_copy_mail'\t=>\t$this->copy_email,\n 'recruiter_brokerage'\t=>\t$this->brokerage,\n 'updated_by' => $this->session->userdata('USERID'),\n 'updated_date' => convert_UTC_to_PST_datetime(date('Y-m-d H:i:s')),\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t);\n\t\t\treturn $this->admin_recruiter_model->update_recruiter_details($recruiterid,$recrarray);\n\t\t}",
"public function saveAction()\n {\n\n if (!$this->request->isPost()) {\n $this->dispatcher->forward(array(\n 'controller' => \"rewidth_field_mrs\",\n 'action' => 'index'\n ));\n\n return;\n }\n\n $id = $this->request->getPost(\"id\");\n $rewidth_field_mr = RewidthFieldMrs::findFirstByid($id);\n\n if (!$rewidth_field_mr) {\n $this->flash->error(\"項目幅制御が見つからなくなりました。\" . $id);\n\n $this->dispatcher->forward(array(\n 'controller' => \"rewidth_field_mrs\",\n 'action' => 'index'\n ));\n\n return;\n }\n\n if ($rewidth_field_mr->updated !== $this->request->getPost(\"updated\")) {\n $this->flash->error(\"他のプロセスから項目幅制御が変更されたため更新を中止しました。\"\n . $id . \",uid=\" . $rewidth_field_mr->kousin_user_id . \" tb=\" . $rewidth_field_mr->updated .\" pt=\" . $this->request->getPost(\"updated\"));\n\n $this->dispatcher->forward(array(\n 'controller' => \"rewidth_field_mrs\",\n 'action' => 'edit',\n 'params' => array($id)\n ));\n\n return;\n }\n\n $post_flds = [];\n $post_flds = [\"cd\",\n \"name\",\n \"controller_cd\",\n \"gamen_cd\",\n \"riyou_user_id\",\n \"field_cd\",\n \"haba\",\n \"updated\",\n ];\n \n\n $thisPost=[]; // カンマ編集を消すとか日付編集0000-00-00を入れるとか$thisPost[]で行う\n $chg_flg = 0;\n foreach ($post_flds as $post_fld) {\n if ((array_key_exists($post_fld, $thisPost)?$thisPost[$post_fld]:$this->request->getPost($post_fld)) !== $rewidth_field_mr->$post_fld) {\n $chg_flg = 1;\n break;\n }\n }\n if ($chg_flg === 0) {\n $this->flash->error(\"変更がありません。\" . $id);\n\n $this->dispatcher->forward(array(\n \"controller\" => \"rewidth_field_mrs\",\n \"action\" => \"edit\",\n \"params\" => array($rewidth_field_mr->id)\n ));\n\n return;\n }\n\n $this->_bakOut($rewidth_field_mr);\n\n foreach ($post_flds as $post_fld) {\n $rewidth_field_mr->$post_fld = array_key_exists($post_fld, $thisPost)?$thisPost[$post_fld]:$this->request->getPost($post_fld);\n }\n\n if (!$rewidth_field_mr->save()) {\n\n foreach ($rewidth_field_mr->getMessages() as $message) {\n $this->flash->error($message);\n }\n\n $this->dispatcher->forward(array(\n 'controller' => \"rewidth_field_mrs\",\n 'action' => 'edit',\n 'params' => array($id)\n ));\n\n return;\n }\n\n $this->flash->success(\"項目幅制御の情報を更新しました。\");\n\n $this->dispatcher->forward(array(\n 'controller' => \"rewidth_field_mrs\",\n 'action' => 'edit',\n 'params' => array($rewidth_field_mr->id)\n ));\n }",
"public function updateRecord()\n {\n #$response = $request->execute();\n }",
"public function testUpdateSingleSuccess();",
"public function EditRecord()\n {\n $rec = $this->GetActiveRecord();\n if (!$rec) return;\n $this->UpdateActiveRecord($rec);\n $this->SetDisplayMode(MODE_E);\n return $this->ReRender(true,false);\n }",
"function updateRecord()\n\t{\n\t\t$data['lastName'] \t= $this->lastName;\n\t\t$data['firstName'] \t= $this->firstName;\n\t\t$data['middleName'] = $this->middleName;\n\t\t$data['groupID'] \t= $this->groupID;\n\t\t$data['isAdmin'] \t= $this->isAdmin;\n\t\t$data['preferences'] = $this->preferences;\n\t\t$data['theme'] \t\t= $this->theme;\n\t\t$data['rstatus']\t= $this->rstatus;\n\t\t\n\t $this->db->where('userID', $this->userID);\n\t\t$this->db->update('users', $data); \n\t\t\n\t\t//$this->updateRoles();\n\t\t\n\t\tif ($this->db->_error_message())\n\t\t\treturn false;\n\t\telse\n\t\t\treturn true;\n\t}",
"function record_update()\n\t{\n\t\tlog_write(\"debug\", \"ldap_query\", \"Executing record_update()\");\n\n\t\tif (ldap_modify($this->ldapcon, $this->record_dn .\",\". $this->srvcfg[\"base_dn\"], $this->data))\n\t\t{\n\t\t\treturn 1;\n\t\t}\n\n\t\treturn 0;\n\n\t}",
"public function reviewPass(){\n $id = Input::has('modify')?(int)Input::get('modify'):0;\n if($id){\n $ok = Review::where('id',$id)->where('enable',0)->update(['enable'=>1]);\n if(!$ok)Review::where('id',$id)->where('enable',1)->update(['enable'=>0]);\n }\n return back();\n }",
"public function update($record);",
"public function executeEdit_field()\n {\n }",
"public function putUpdateData()\n\t{\n\t\t$sDate = str_replace(\"/\",\"-\", Input::get('saved_date'));\n\t\t$sDate = date('Y-m-d', strtotime($sDate));\n\n\t\t$date = date('Y-m-d');\n\n\t\t$timezone = 'Europe/Oslo';\n\t\tdate_default_timezone_set($timezone);\n\t\t$time = strftime('%H:%M:%S');\n\n\t\t$chlog = new ChangeLog;\n\t\t$chlog->routine_id = Input::get('id');\n\t\t$chlog->title = Input::get('title');\n\t\t$chlog->value_old = Input::get('value_old');\n\t\t$chlog->value_new = Input::get('value');\n\t\t$chlog->action = 'Redigert';\n\t\t$chlog->changed_at = $date;\n\t\t$chlog->date = $sDate;\n\t\t$chlog->time = $time;\n\t\t$chlog->changed_by = Input::get('changed_by');\n\t\t$chlog->save();\n\n\t\tRoutine::find(Input::get('id'))->update(array(\n\t\t\t'value' => Input::get('value'),\n\t\t\t'date' => date('Y-m-d', strtotime(str_replace('/','-', Input::get('date')))),\n\t\t\t'time' => Input::get('time'),\n\t\t\t'emp_id' => Input::get('emp')\n\t\t));\n\n\t\treturn Redirect::route('sok')\n\t\t->with('message', 'Endringer er lagret!');\n\t}",
"public function testUpdateLead()\n {\n\n }",
"public function updateRecord($formData)\n {\n }",
"function action_update_record()\n\t{\n\t\tlog_debug(\"domain_record\", \"Executing action_update_record()\");\n\n\n\t\t/*\n\t\t\tStart Transaction\n\t\t*/\n\t\t$this->sql_obj->trans_begin();\n\n\n\t\t/*\n\t\t\tIf no ID supplied, create a new domain record\n\t\t*/\n\t\tif (!$this->id_record)\n\t\t{\n\t\t\t$mode = \"create\";\n\n\t\t\tif (!$this->action_create_record())\n\t\t\t{\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$mode = \"update\";\n\t\t}\n\n\n\t\t\n\t\t/*\n\t\t\tSeed key values when unspecified\n\t\t*/\n\t\tif (!isset($this->data_record[\"name\"]))\n\t\t{\n\t\t\t$this->data_record[\"name\"]\t= $this->data[\"name\"];\n\t\t}\n\n\t\tif (empty($this->data_record[\"prio\"]))\n\t\t{\n\t\t\t$this->data_record[\"prio\"] = 0;\n\t\t}\n\n\t\tif (empty($this->data_record[\"ttl\"]))\n\t\t{\n\t\t\t// can't have an empty TTL, but zero is a valid TTL. Note that\n\t\t\t// some systems will enforce mimimum TTLs like 60 seconds anyway.\n\t\t\t$this->data_record[\"ttl\"] = 0;\n\t\t}\n\n\n\n\n\t\t/*\n\t\t\tUpdate record\n\t\t*/\n\n\t\t$this->sql_obj->string\t= \"UPDATE `dns_records` SET \"\n\t\t\t\t\t\t.\"name='\". $this->data_record[\"name\"] .\"', \"\n\t\t\t\t\t\t.\"type='\". $this->data_record[\"type\"] .\"', \"\n\t\t\t\t\t\t.\"content='\". $this->data_record[\"content\"] .\"', \"\n\t\t\t\t\t\t.\"ttl='\". $this->data_record[\"ttl\"] .\"', \"\n\t\t\t\t\t\t.\"prio='\". $this->data_record[\"prio\"] .\"' \"\n\t\t\t\t\t\t.\"WHERE id='\". $this->id_record .\"' LIMIT 1\";\n\t\t$this->sql_obj->execute();\n\n\n\n\t\t/*\n\t\t\tCommit\n\t\t*/\n\n\t\tif (error_check())\n\t\t{\n\t\t\t$this->sql_obj->trans_rollback();\n\n\t\t\tlog_write(\"error\", \"domain_records\", \"An error occured when updating the domain record.\");\n\n\t\t\treturn 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->sql_obj->trans_commit();\n\n\t\t\tif ($mode == \"update\")\n\t\t\t{\n\t\t\t\tlog_write(\"notification\", \"domain_records\", \"Domain record has been successfully updated.\");\n\n\t\t\t\t$log \t\t\t= New changelog;\n\t\t\t\t$log->id_domain\t\t= $this->id;\n\n\t\t\t\t$log->log_post(\"audit\", \"Updated domain record type \". $this->data_record[\"type\"] .\" \". $this->data_record[\"name\"] .\"/\". $this->data_record[\"content\"] .\" for domain \". $this->data[\"domain_name\"] .\"\");\n\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tlog_write(\"notification\", \"domain_records\", \"Domain record successfully created.\");\n\n\t\t\t\t$log \t\t\t= New changelog;\n\t\t\t\t$log->id_domain\t\t= $this->id;\n\n\t\t\t\t$log->log_post(\"audit\", \"Updated domain record type \". $this->data_record[\"type\"] .\" \". $this->data_record[\"name\"] .\"/\". $this->data_record[\"content\"] .\" for domain \". $this->data[\"domain_name\"] .\"\");\n\n\n\t\t\t}\n\t\t\t\n\t\t\treturn $this->id_record;\n\t\t}\n\n\t}",
"public function testUpdatePayrun()\n {\n }",
"public function update_custom_field_post()\n {\n //field id\n $id = $this->input->post('id', true);\n if ($this->field_model->update_field($id)) {\n //update field name\n $this->field_model->update_field_name($id);\n $this->session->set_flashdata('success', trans(\"msg_updated\"));\n redirect($this->agent->referrer());\n } else {\n $this->session->set_flashdata('error', trans(\"msg_error\"));\n redirect($this->agent->referrer());\n }\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set filterassociations of entity | public function setFilterAssociations($filterAssociations)
{
$this->filterAssociations = $filterAssociations;
} | [
"public function getFilterAssociations()\n {\n return $this->filterAssociations;\n }",
"public function setassociations($associations)\n {\n $this->associations = $associations;\n }",
"private function configureFilters(EntityManagerInterface $em): void\n {\n $config = $em->getConfiguration();\n $config->addFilter('locale', '\\Doctrine\\Tests\\ORM\\Functional\\MyLocaleFilter');\n $config->addFilter('soft_delete', '\\Doctrine\\Tests\\ORM\\Functional\\MySoftDeleteFilter');\n }",
"public function setFilters($filters){ }",
"public function filterByEntity($entity)\n {\n $this->filter[] = $this->field('entity').' = '.$this->quote($entity);\n return $this;\n }",
"protected function setRelations(&$entity)\n {\n }",
"public function setFilter($filter){}",
"public function setRelationshipFilter($array = []){\n $this->relationshipFilter = $array;\n }",
"public function _setSavedFilters()\n\t{\n\t\t$model = $this->_model()->alias;\n\n\t\t$cacheKey = 'toolbar_data_' . $this->getSubject()->model->alias . '_user_' . AuthComponent::user('id');\n\n\t\tif (($filters = Cache::read($cacheKey, 'advanced_filters_settings')) === false) {\n\t\t\t$filters = $this->Instance->find('list', array(\n\t\t\t\t'conditions' => $this->_getConditions($model),\n\t\t\t\t'order' => [\n\t\t\t\t\t'AdvancedFilter.name' => 'ASC'\n\t\t\t\t],\n\t\t\t\t'recursive' => -1\n\t\t\t));\n\n\t\t\tCache::write($cacheKey, $filters, 'advanced_filters_settings');\n\t\t}\n\n\t\t$this->_savedFilters[$model] = $filters;\n\t}",
"function filterDiscountByEntity() {\n $this->setEntityDiscounts();\n }",
"public function SetFilters($filters) {$this->filters = $filters;}",
"public function setFilters($filters);",
"public function modifyDatabaseCriteriaAccordingToValuesFromFilterForm()\n {\n foreach($this->modificationOfCriteriaAccordingToValuesFromFilterForm as $key => $field)\n {\n if(isset($field['config']))\n {\n $this->criteria = FilterProfileModifierFactory::init($this, $field['type'], $key)->modifyCriteria($field['config']);\n }\n else\n {\n $this->criteria = FilterProfileModifierFactory::init($this, $field['type'], $key)->modifyCriteria();\n }\n }\n }",
"private function setSearchFilters()\n\t{\n\t\tif(sizeof($this->searchFilters) > 0)\n\t\t{\n\t\t\t$this->taskSearchHelperDA->setSearchFilters($this->searchFilters);\n\t\t}\n\t}",
"protected function setFilters() {\n\n $filters = null;\n\n if ($this->form->isBound()) {\n foreach ($this->form->getClientData() as $key => $value) {\n $filters[$key] = $this->form[$key]->getClientData();\n }//foreach\n }\n $this->session->set($this->getNs().'filters', $filters);\n }",
"public function setEntityTypeFilter( $type ) {\n\t\t$this->entityType = $type;\n\t}",
"private function setFilters($filter = [])\n {\n\n if (!empty($filter)) {\n $join = (isset($filter['join']) ? $filter['join'] : FALSE);\n $where = (isset($filter['where']) ? $filter['where'] : FALSE);\n $wherein = (isset($filter['whereIn']) ? $filter['whereIn'] : FALSE);\n $orwherein = (isset($filter['orWhereIn']) ? $filter['orWhereIn'] : FALSE);\n $orwhere = (isset($filter['orWhere']) ? $filter['orWhere'] : FALSE);\n $wherenotin = (isset($filter['whereNotIn']) ? $filter['whereNotIn'] : FALSE);\n $like = (isset($filter['like']) ? $filter['like'] : FALSE);\n $orlike = (isset($filter['orLike']) ? $filter['orLike'] : FALSE);\n $notlike = (isset($filter['notLike']) ? $filter['notLike'] : FALSE);\n $ornotlike = (isset($filter['orNotLike']) ? $filter['orNotLike'] : FALSE);\n $order = (isset($filter['order']) ? $filter['order'] : FALSE);\n $limit = (isset($filter['limit']) ? $filter['limit'] : FALSE);\n $group = (isset($filter['group']) ? $filter['group'] : FALSE);\n\n if ($join) {\n foreach ($join as $key => $vv) {\n foreach ($vv as $v) {\n $type = \"\";\n if (isset($v['type'])) {\n $type = $v['type'];\n }\n $this->builder->join($key, $v['key'], $type);\n }\n }\n }\n if ($where)\n $this->builder->where($where);\n\n if ($orwhere)\n $this->builder->orWhere($orwhere);\n\n if ($wherein) {\n foreach ($wherein as $key => $v) {\n if (!empty($v))\n $this->builder->whereIn($key, $v);\n }\n }\n\n if ($orwherein) {\n foreach ($orwherein as $key => $v) {\n if (!empty($v))\n $this->builder->orWhereIn($key, $v);\n }\n }\n\n if ($wherenotin) {\n foreach ($wherenotin as $key => $v) {\n if (!empty($v))\n $this->builder->whereNotIn($key, $v);\n }\n }\n\n\n if ($like)\n $this->builder->like($like);\n\n if ($orlike)\n $this->builder->orLike($orlike);\n\n if ($orlike) {\n foreach ($orlike as $key => $v) {\n if (!empty($v))\n $this->builder->orLike($key, $v);\n }\n }\n\n if ($notlike) {\n foreach ($notlike as $key => $v) {\n if (!empty($v))\n $this->builder->notLike($key, $v);\n }\n }\n\n if ($ornotlike) {\n foreach ($ornotlike as $key => $v) {\n if (!empty($v))\n $this->builder->orNotLike($key, $v);\n }\n }\n\n if ($group) {\n $this->builder->groupStart();\n foreach ($group as $key => $v) {\n if ($key == 'orLike') {\n foreach ($v as $orLikeKey => $orLikeValue) {\n $this->builder->orLike($orLikeKey, $orLikeValue);\n }\n }\n if ($key == 'and') {\n foreach ($v as $andKey => $andValue) {\n $this->builder->where([$andKey => $andValue]);\n }\n }\n }\n $this->builder->groupEnd();\n }\n\n if ($order) {\n foreach ($order as $key => $v) {\n if (!empty($v))\n $this->builder->orderBy($key, $v);\n }\n }\n\n if ($limit)\n $this->builder->limit($limit['size'], ($limit['page'] - 1) * $limit['size']);\n }\n }",
"public function enableAssociations()\n {\n $this->useAssociations = true;\n }",
"private function setTaxonomyFilters()\n\t{\n\t\t$taxonomies = array_merge($this->h_taxonomies, $this->f_taxonomies);\n\t\t$tax_query = [];\n\t\tforeach ( $taxonomies as $tax ) :\n\t\t\tif ( $this->post_type_repo->sortOptionEnabled($this->post_type->name, $tax->name, true) && isset($_GET[$tax->name]) ) :\n\t\t\t\t$tax_query[] = [\n\t\t\t\t\t'taxonomy' => $tax->name,\n\t\t\t\t\t'fields' => 'term_id',\n\t\t\t\t\t'terms' => sanitize_text_field($_GET[$tax->name])\n\t\t\t\t];\n\t\t\tendif;\n\t\tendforeach;\n\t\t$this->sort_options->tax_query = ( !empty($tax_query) ) ? $tax_query : false;\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
5 Determina si una palabra existe en el arreglo de palabras | function existePalabra($coleccionPalabras,$palabra){
$i=0;
$cantPal = count($coleccionPalabras);
$existe = false;
while($i<$cantPal && !$existe){
$existe = $coleccionPalabras[$i]["palabra"] == $palabra;
$i++;
}
return $existe;
} | [
"function existePalabra($coleccionPalabras,$palabra){\n $i=0;\n $cantPal = count($coleccionPalabras);\n $existe = false;\n \n while($i<$cantPal && !$existe){\n $existe = $coleccionPalabras[$i][\"palabra\"] == $palabra;\n $i++;\n }\n \n return $existe;\n}",
"function existePalabra($coleccionPalabras,$palabra){\n $i=0;\n $cantPal = count($coleccionPalabras);\n $existe = false;\n while($i<$cantPal && !$existe){\n $existe = $coleccionPalabras[$i][\"palabra\"] == $palabra;\n $i++;\n }\n return $existe;\n}",
"function palindrom($palindrom)\n{\n $palindrom = strtolower($palindrom);\n $palindromChecker ='';\n\n for ($i = strlen($palindrom)-1; $i >= 0; $i--)\n {\n $palindromChecker .= $palindrom[$i];\n\n }\n\n if($palindrom === $palindromChecker)\n {\n echo \"słowo <b>$palindrom</b> jest palindromem\";\n }\n else\n {\n echo \"słowo <b>$palindrom</b> nie jest palindromem, jest nim np kajak\";\n }\n\n return $palindromChecker;\n}",
"function isPalidromic ($n) {\n $string = strval($n);\n return $string == strrev($string);\n}",
"function palabra ($array = 'glosario', $campos_palabra = 'id, nome', $campos_textos = 'texto', $campos_fungallas = 'id, nome') {\n\t\t$resultado = array();\n\t\t\n\t\t\n\t\t//Seleccionar a palabra\n\t\t$this->seleccionar($this->taboa_palabras, $campos_palabra, \"id = $this->palabra\");\n\t\t$resultado['palabra'] = $this->resultado();\n\t\t\n\t\t\n\t\t//Seleccionar as definicións da palabra\n\t\t$this->seleccionar(\"$this->taboa_descricion | $this->taboa_relacions\", \"$campos_textos | $this->taboa_descricion, $this->taboa_seccions\", \"$this->taboa_relacions.$this->taboa_palabras = $this->palabra AND $this->taboa_relacions.$this->taboa_descricion = $this->taboa_descricion.id\", '', '');\n\t\t$resultado['definicions'] = $this->resultado('', '', $this->taboa_descricion);\n\t\t\n\t\t\n\t\t//Seleccionar sinónimos de cada definición\n\t\t$definicions = $this->query_in($resultado['definicions']);\n\t\tif ($definicions) {\n\t\t\t$this->seleccionar(\"$this->taboa_palabras | $this->taboa_relacions\", \"$campos_palabra | $this->taboa_descricion\", \"$this->taboa_relacions.$this->taboa_descricion IN ($definicions) AND $this->taboa_relacions.$this->taboa_palabras != $this->palabra AND $this->taboa_relacions.$this->taboa_palabras = $this->taboa_palabras.id\", '', '');\n\t\t}\n\t\t\n\t\tforeach ($this->resultado('', '', $this->taboa_descricion) as $clave => $valor) {\n\t\t\t$resultado['definicions'][$clave]['sinonimos'][] = $valor;\n\t\t}\n\t\t\n\t\t\n\t\t//Seleccionar menu fungallas de cada definición\n\t\tforeach ($resultado['definicions'] as $clave => $valor) {\n\t\t\t$resultado['definicions'][$clave]['fungallas'] = $this->menu_fungallas('', $campos_fungallas, $valor[$this->taboa_seccions]);\n\t\t}\n\t\t\n\t\t\n\t\t//Gardar array ou devolver resultado\n\t\tif ($array) {\n\t\t\t$this->datos[$array] = $resultado;\n\t\t} else {\n\t\t\treturn $resultado;\n\t\t}\n\t}",
"function boring($array) {\n $c1 = \"Nick Barrow\"; $c2 = \"Laney Nulph\";\n $c3 = \"\"; $c4 = \"\";\n foreach ($array as $santa => $bitch)\n if (($santa == $c1 && $bitch == $c2) || ($santa == $c2 && $bitch == $c1) ||\n ($santa == $c3 && $bitch == $c4) || ($santa == $c4 && $bitch == $c3)) {\n echo \"Couple detected!\\nReshuffling hat...\\n\";\n return 1;\n }\n return 0;\n }",
"function existe ($aulas, $aula){\n $existe=FALSE;\n \n if(count($aulas) != 0){\n $indice=0;\n $longitud=count($aulas);\n while(($indice < $longitud) && !$existe){\n //strcmp($aulas[$indice]['id_aula'], $aula['id_aula'])==0\n $existe=($aulas[$indice]['id_aula'] == $aula['id_aula']) ? TRUE : FALSE;\n $indice += 1;\n }\n }\n return $existe;\n }",
"function checkSolved() {\n\n $result = true;\n for ($c = 0; $c < 8; $c++)\n if ($this->corners[$c]->place != $c*3) {\n // echo \"corner \".$c.\": \".$this->corners[$c]->place.\"<br>\";\n $result = false;\n }\n for ($e = 0; $e < 12; $e++)\n if ($this->edges[$e]->place != $e*2) {\n // echo \"edge \".$e.\": \".$this->edges[$e]->place.\"<br>\";\n $result = false;\n }\n\n // no errors \n return $result;\n }",
"public function match($token)\n {\n //verifica que existan palabras\n if ($this->indice < $this->tamano) {\n $palabra = $this->frase[$this->indice];\n $this->indice++;\n //verifica que la palabra no sea un espacio\n if ('T_ESPACIO' == $palabra[1]) {\n return $this->match($token);\n }else{\n if ($token == $palabra[1]) {\n return true;\n }else{\n return false;\n }\n }\n }else{\n //si no hay mas palabras\n //verifica si se espera final de palabra\n if ('T_EOF' == $token) {\n return true;\n }\n return false; //fin de palabra\n }\n }",
"function palabraDescubierta($coleccionLetras){//punto 10 revisar\n /*>>> Completar el cuerpo de la función, respetando lo indicado en la documentacion <<<*/\n //int $i, $num1, $num2\n //boolean $val\n $val=false;\n $num1 = count($coleccionLetras);\n $num2 = 0;\n foreach ($coleccionLetras as $indice => $valor) {\n if ($valor[\"descubierta\"] == !($val)) {\n $num2=$num2+1;//incrementamos el valor del contador en caso de que \"descubierta sea true \"\n }\n } \n if ($num2==$num1) {//al iniciar aignamos a $num1 el valor de la funcion count en el arreglo $coleccionLetras\n //si son iguales se descubrio la palabra.\n $val=true; \n }\n return $val;\n}",
"function findAllSquarePalindromes($number) {\n for ($i = 0; $i < $number; $i++) {\n if ( isPalindrome($i) ) {\n if ( isPalindrome($i * $i) ) {\n echo \"$i is pal and \" . $i* $i. \" is pal <br>\";\n }\n }\n }\n}",
"function isVacia($palabra)\n{\n\t$palabrasVacias = array(\"&\",\"^^\",\"www\", \"http\",\"com\",\"\",\"-\",\"I\",\"a\",\"about\",\"above\",\"after\",\"again\",\"against\",\"all\",\"am\",\"an\",\"and\",\"any\",\"are\",\"aren't\",\"as\",\"at\",\"be\",\"because\",\"been\",\"before\",\"being\",\"below\",\"between\",\"both\",\"but\",\"by\",\"can't\",\"cannot\",\"could\",\"couldn't\",\"did\",\"didn't\",\"do\",\"does\",\"doesn't\",\"doing\",\"don't\",\"down\",\"during\",\"each\",\"few\",\"for\",\"from\",\"further\",\"had\",\"hadn't\",\"has\",\"hasn't\",\"have\",\"haven't\",\"having\",\"he\",\"he'd\",\"he'll\",\"he's\",\"her\",\"here\",\"here's\",\"hers\",\"herself\",\"him\",\"himself\",\"his\",\"how\",\"how's\",\"i\",\"i'd\",\"i'll\",\"i'm\",\"i've\",\"if\",\"in\",\"into\",\"is\",\"isn't\",\"it\",\"it's\",\"its\",\"itself\",\"let's\",\"me\",\"more\",\"most\",\"mustn't\",\"my\",\"myself\",\"no\",\"nor\",\"not\",\"of\",\"off\",\"on\",\"once\",\"only\",\"or\",\"other\",\"ought\",\"our\",\"ours\",\"ourselves\",\"out\",\"over\",\"own\",\"same\",\"shan't\",\"she\",\"she'd\",\"she'll\",\"she's\",\"should\",\"shouldn't\",\"so\",\"some\",\"such\",\"than\",\"that\",\"that's\",\"the\",\"their\",\"theirs\",\"them\",\"themselves\",\"then\",\"there\",\"there's\",\"these\",\"they\",\"they'd\",\"they'll\",\"they're\",\"they've\",\"this\",\"those\",\"through\",\"to\",\"too\",\"under\",\"until\",\"up\",\"very\",\"was\",\"wasn't\",\"we\",\"we'd\",\"we'll\",\"we're\",\"we've\",\"were\",\"weren't\",\"what\",\"what's\",\"when\",\"when's\",\"where\",\"where's\",\"which\",\"while\",\"who\",\"who's\",\"whom\",\"why\",\"why's\",\"with\",\"won't\",\"would\",\"wouldn't\",\"you\",\"you'd\",\"you'll\",\"you're\",\"you've\",\"your\",\"yours\",\"yourself\",\"yourselves\");\n\tforeach ($palabrasVacias as $vacia){\n\t\tif($palabra==$vacia){\n\t\t\treturn true;\n\t\t}\n\t}\n return false;\n}",
"function palabraRelevanteGrupo($vect){\n $k=0;\n //Buscar palabras con mayor peso\n for($i=0;$i<count($vect);$i++){\n $query = \"SELECT termino FROM vectCarac WHERE id_noticia = \".$vect[$i].\" AND peso_termino > 0.9\";\n $tabla = mysql_query($query);\n \n while($datos = mysql_fetch_assoc($tabla)){\n if($datos['termino'] != \" \" && $datos['termino'] != ' ' && $datos['termino'] != \"Â\"){\n $arrayPal[$k] = $datos['termino']; \n }\n $k++; \n }\n }\n //$arrayPalAux = array_unique($arrayPal); //Arreglo con palabras sin repetir\n $arrayCuenta = array_count_values($arrayPal); //Arreglo con cantidad de apareciones de palabras\n arsort($arrayCuenta);\n $array = array_keys($arrayCuenta);\n /*$k = 0;\n //Eliminando espacios en blanco de arreglo de palabras\n for($i=0;$i<count($arrayPal);$i++){\n if($arrayPalAux[$i] != \"\"){\n $nuevoArray[$k] = $arrayPalAux[$i];\n $k++;\n }\n }\n //Determinando la palabra con mayor numero de apariciones\n $mayor = -999;\n for($i=0;$i<count($nuevoArray);$i++){\n if($mayor < $arrayCuenta[$nuevoArray[$i]]){\n $mayor = $arrayCuenta[$nuevoArray[$i]];\n $pos = $i;\n }\n }*/\n //echo \"el mayor esta en la pos: \".$pos.\" y es el termino: \".$nuevoArray[$pos];\n \n return current($array).\" \".next($array).\" \". next($array);/*implode(\" \", $arrayPal);*/ \n }",
"public function verifierPerdre(){\r\n //Double boucle qui verifie toutes les cases du plateau\r\n for ($i=0; $i < 7; $i++) {\r\n for ($j=0; $j < 7; $j++) {\r\n //Si un deplacement est possible, que ce soit a gauche, a droit, en haut ou en bas retourne false (car la partie n'est pas encore perdue)\r\n if ($this->verifierDeplacement($i, $j, $i+2, $j) || $this->verifierDeplacement($i, $j, $i-2, $j) || $this->verifierDeplacement($i, $j, $i, $j+2) || $this->verifierDeplacement($i, $j, $i, $j-2)) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n }",
"function existeElProblema($p_marcas, $problema)\r\n {\r\n /**\r\n *** Se crea un vector con las marcas de asignación del curso.\r\n ***/\r\n $marcas_curso = explode(',', $p_marcas);\r\n\r\n /**\r\n *** Se recorren las marcas del curso para verificar si el curso\r\n *** tienen marca enviada como parametro $problema\r\n ***/\r\n for ($i = 0; $i < count($marcas_curso); $i++) {\r\n if ((strcmp(trim($marcas_curso[$i]), \"\" . $problema . \"\") == 0)) {\r\n //El curso es la retrasada única\r\n return TRUE;\r\n }\r\n }\r\n return FALSE;\r\n }",
"public function existeregistromaestrocajachica() {\n \n }",
"function existeLetra($coleccionLetras,$letra){\n //$cuentaLetras, $i INT \n //$descubierta BOOLEAN\n $cuentaLetra = count($coleccionLetras);\n $i =0;\n $descubierta = false;\n echo $letra.\" Verificando \\n\";\n while($i < $cuentaLetra && !$descubierta){//Recorrido Parcial\n if (($coleccionLetras[$i][\"letra\"] == $letra)){//Condicion que valida si la letra coincide con una del arreglo\n $descubierta=true;\n }\n $i++;\n }\n return $descubierta; \n}",
"function palindrome($param)\n{\n for ($c = 0; isset($param[$c]); $c++);\n for ($o = --$c, $z = 0; $z < $c / 2; $o--, $z++)\n {\n while (!($param[$o] >= 'a' && $param[$o] <= 'z' || $param[$o] >= 'A' && $param[$o] <= 'Z'))\n\t$o--;\n while (!($param[$z] >= 'a' && $param[$z] <= 'z' || $param[$z] >= 'A' && $param[$z] <= 'Z'))\n\t$z++;\n $fin = ord($param[$o]);\n $ascii = ord($param[$z]);\n if ($param[$z] < 'a')\n\t$ascii = ord($param[$z]) +32;\n if ($param[$o] < 'a')\n\t$fin = ord($param[$o]) +32;\n if ($ascii != $fin)\n\t{\n\t echo \"False\\n\";\n\t return;\n\t}\n }\n echo \"True\\n\";\n}",
"function verification_caractere_majuscule($chaine){\n $taille=taille_chaine($chaine);\n $resultat=0;\n for ($j=0; $j < $taille; $j++) { \n $i = 1;\n for( $x = \"A\"; $i <= 26; $x++ ) {\n if ($chaine[$j]==$x) {\n $resultat=1;\n }\n $i++;\n }\n }\n return $resultat;\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add item to AdditionalCharge value | public function addToAdditionalCharge(\Devlabs91\GenericOtaHotelApiService\StructType\AdditionalCharge $item)
{
// validation for constraint: itemType
if (!$item instanceof \Devlabs91\GenericOtaHotelApiService\StructType\AdditionalCharge) {
throw new \InvalidArgumentException(sprintf('The AdditionalCharge property can only contain items of \Devlabs91\GenericOtaHotelApiService\StructType\AdditionalCharge, "%s" given', is_object($item) ? get_class($item) : gettype($item)), __LINE__);
}
$this->AdditionalCharge[] = $item;
return $this;
} | [
"public function chargeItemAdd($charge)\n {\n // RBC11 Charge(AccountID SerialNo StoreID RBCID ... ItemInfo+(...)) : RRC-0065 Charge(RBCID ItemInfo+)\n return $this->action('RBC11', array(\n 'Charge' => $charge,\n ), 'RRC-0065', 'Charge');\n }",
"public function getAdditionalCharge(){\n return $this->AdditionalCharge;\n }",
"public function setAdditionalCharge($AdditionalCharge){\n $this->AdditionalCharge = $AdditionalCharge;\n }",
"public function addToVehicleChargeAmount($item)\n {\n // validation for constraint: itemType\n if (!is_string($item)) {\n throw new \\InvalidArgumentException(sprintf('The VehicleChargeAmount property can only contain items of string, \"%s\" given', is_object($item) ? get_class($item) : gettype($item)), __LINE__);\n }\n $this->VehicleChargeAmount[] = $item;\n return $this;\n }",
"public function addToSupplementCharges($item)\n {\n // validation for constraint: itemType\n if (!false) {\n throw new \\InvalidArgumentException(sprintf('The SupplementCharges property can only contain items of anyType, \"%s\" given', is_object($item) ? get_class($item) : gettype($item)), __LINE__);\n }\n $this->SupplementCharges[] = $item;\n return $this;\n }",
"function add_itemized_charge($invoice_id, $name, $amount, $tax) {\r\n\r\n $post_id = wpi_invoice_id_to_post_id($invoice_id);\r\n $charge_items = get_post_meta($post_id, 'itemized_charges', true);\r\n\r\n $new_item = array(\r\n 'name' => $name,\r\n 'amount' => $amount,\r\n 'tax' => $tax,\r\n 'before_tax' => $amount,\r\n 'after_tax' => $amount + ($amount / 100 * $tax)\r\n );\r\n\r\n if (!empty($charge_items)) {\r\n $charge_items[] = $new_item;\r\n } else {\r\n $charge_items[0] = $new_item;\r\n }\r\n\r\n update_post_meta($post_id, 'itemized_charges', $charge_items);\r\n\r\n return end($charge_items);\r\n }",
"public function testUpdateAdditionalCost()\n {\n }",
"public function getChargeItem()\n {\n return $this->ChargeItem;\n }",
"public function setAdditionalCharge(array $additionalCharge)\n {\n $this->additionalCharge = $additionalCharge;\n return $this;\n }",
"public function getChargeItem()\n {\n return $this->chargeItem;\n }",
"private function sellTrasactionAddsMoney(){\n\n }",
"function Inscription_Payment_Register(&$item,$newvalue)\n {\n $updatedatas=array();\n $lot=$this->Inscription_Payment_Lot($item);\n\n if (!empty($lot) && $item[ \"Lot\" ]!=$lot)\n {\n $lot=$lot[ \"ID\" ];\n \n $item[ \"Lot\" ]=$lot;\n array_push($updatedatas,\"Lot\");\n }\n\n \n if ($item[ \"Type\" ]==3)\n {\n $item[ \"Lot\" ]=0;\n array_push($updatedatas,\"Lot\");\n }\n \n \n if ($item[ \"Has_Paid\" ]!=$newvalue)\n {\n $item[ \"Has_Paid\" ]=$newvalue;\n array_push($updatedatas,\"Has_Paid\");\n }\n \n $datepaid=$this->Inscription_Payment_Register_CGI2Date($item);\n if ($item[ \"Date_Paid\" ]!=$datepaid)\n {\n $item[ \"Date_Paid\" ]=$datepaid;\n array_push($updatedatas,\"Date_Paid\");\n }\n\n \n $valuepaid=$this->Inscription_Payment_Register_CGI2Value($item);\n if ($item[ \"Value_Paid\" ]!=$valuepaid)\n {\n $item[ \"Value_Paid\" ]=$valuepaid;\n array_push($updatedatas,\"Value_Paid\");\n }\n \n if (count($updatedatas)>0)\n {\n $this->Sql_Update_Item_Values_Set($updatedatas,$item);\n }\n }",
"public function Propertyadditionalcharge($clean_charge, $guest_charge,$security_charge, $propId){\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$res = $this->host_model->insert_ExtraPrice($clean_charge, $guest_charge, $security_charge, $propId);\n\t\t\t\t\t\t\t//$res = $this->hostproperty_model->insert_ExtraPrice('user_property', $records, $propId);\n\t\t\t\t\t\t\tif($res){\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t$data= array();\n\t\t\t\t\t\t\t\t$data[\"error\"]= false;\n\t\t\t\t\t\t\t\t$data[\"status\"] = 200;\n\t\t\t\t\t\t\t\t$data[\"message\"] = \"Inserted, Proceed to next Step\";\n\t\t\t\t\t\t\t\techo json_encode($data);\n\t\t\t\t\t\t\t\t//$this->HostPropertyListing_get();\n\t\t\t\t\t\t\t\t//$this->response($data, 200);\t\t\t\t\t\n\t\t\t\t\t\t\t\t}\t\t\t\t\t\t\n\t}",
"function addItemFixed($refCode,$q,$t,$f1,$f2,$c)\n {\n $cnt = (int) count($this->rateReq['ItemList']);\n $this->rateReq['ItemList'][$cnt] = array();\n $this->rateReq['ItemList'][$cnt]['CalcMethod'] = 'F';\n $this->rateReq['ItemList'][$cnt]['RefCode'] = $refCode;\n $this->rateReq['ItemList'][$cnt]['Quantity'] = (float) abs($q);\n $this->rateReq['ItemList'][$cnt]['FeeType'] = (!strcasecmp('F',$t) ? 'F' : 'C');\n $this->rateReq['ItemList'][$cnt]['Fee1'] = (float) abs($f1);\n if (isset($f2)) $this->rateReq['ItemList'][$cnt]['Fee2'] = (float) abs($f2);\n $this->rateReq['ItemList'][$cnt]['FeeCode'] = $c;\n }",
"function addAdditionalSubItemInformation(&$a_item_data)\n\t{\n\t\tinclude_once './Services/Object/classes/class.ilObjectActivation.php';\n\t\tilObjectActivation::addAdditionalSubItemInformation($a_item_data);\n\t}",
"function addAdditionalSubItemInformation(&$a_item_data)\n\t{\t\t\n\t\tinclude_once './Services/Object/classes/class.ilObjectActivation.php';\n\t\tilObjectActivation::addAdditionalSubItemInformation($a_item_data);\n\t}",
"function set_ChargeAmount($amount)\r\n{\r\n\t$this->ChargeAmount = $amount;\r\n}",
"public function templateItemAdd($chargeTemplate)\n {\n // CTL11 ChargeTemplate(TemplateID ItemInfo+(...)) : CTL-0065 -\n return $this->action('CTL11', array(\n 'ChargeTemplate' => $chargeTemplate,\n ), 'CTL-0065', 'ReturnCode');\n }",
"function _acecrew_add_invoice_item($description, $quantity, $unit_cost, $uid, $weight = 0){\n $vat = variable_get('invoice_vat', 0);\n $query = \"INSERT INTO {invoice_items}\n (description, quantity, unitcost, vat, weight, invoice_id, uid, created) VALUES\n ('%s','%d','%f','%f','%d','%d','%d', NOW())\";\n $query_result = db_query($query, $description, $quantity, $unit_cost, $vat, $weight, 0, $uid);\n\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Invites a friend to join a group via a POST request. | function bp_dtheme_ajax_invite_user() {
// Bail if not a POST action
if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
return;
check_ajax_referer( 'groups_invite_uninvite_user' );
if ( ! $_POST['friend_id'] || ! $_POST['friend_action'] || ! $_POST['group_id'] )
return;
if ( ! bp_groups_user_can_send_invites( $_POST['group_id'] ) )
return;
if ( ! friends_check_friendship( bp_loggedin_user_id(), $_POST['friend_id'] ) )
return;
$group_id = (int) $_POST['group_id'];
$friend_id = (int) $_POST['friend_id'];
if ( 'invite' == $_POST['friend_action'] ) {
$group = groups_get_group( $group_id );
// Users who have previously requested membership do not need
// another invitation created for them
if ( BP_Groups_Member::check_for_membership_request( $friend_id, $group_id ) ) {
$user_status = 'is_pending';
// Create the user invitation
} else if ( groups_invite_user( array( 'user_id' => $friend_id, 'group_id' => $group_id ) ) ) {
$user_status = 'is_invited';
// Miscellaneous failure
} else {
return;
}
$user = new BP_Core_User( $_POST['friend_id'] );
echo '<li id="uid-' . $user->id . '">';
echo $user->avatar_thumb;
echo '<h4>' . $user->user_link . '</h4>';
echo '<span class="activity">' . esc_attr( $user->last_active ) . '</span>';
echo '<div class="action">
<a class="button remove" href="' . wp_nonce_url( bp_loggedin_user_domain() . bp_get_groups_slug() . '/' . $_POST['group_id'] . '/invites/remove/' . $user->id, 'groups_invite_uninvite_user' ) . '" id="uid-' . esc_attr( $user->id ) . '">' . __( 'Remove Invite', 'buddypress' ) . '</a>
</div>';
if ( 'is_pending' == $user_status ) {
echo '<p class="description">' . sprintf( __( '%s has previously requested to join this group. Sending an invitation will automatically add the member to the group.', 'buddypress' ), $user->user_link ) . '</p>';
}
echo '</li>';
exit;
} elseif ( 'uninvite' == $_POST['friend_action'] ) {
// Users who have previously requested membership should not
// have their requests deleted on the "uninvite" action
if ( BP_Groups_Member::check_for_membership_request( $friend_id, $group_id ) ) {
return;
}
// Remove the unsent invitation
if ( ! groups_uninvite_user( $friend_id, $group_id ) ) {
return;
}
exit;
} else {
return;
}
} | [
"public function requestgroupmembershipAction() {\n if ($this->getRequest()->isPost()) {\n $userId = $_SESSION['Incite']['USER_DATA']['id'];\n $groupId = $_POST['groupId'];\n $privilege = -1;\n\n $groupsUsers = new InciteGroupsUsers;\n $groupsUsers->group_id = $groupId;\n $groupsUsers->user_id = $userId;\n $groupsUsers->group_privilege = $privilege;\n $groupsUsers->seen_instruction = 0;\n $groupsUsers->save();\n\n echo json_encode('true');\n }\n }",
"public function sendRequest(){\n\n\t\tuser_login_required();\n\n\t\t//Get the ID of the target group\n\t\t$groupID = getPostGroupIdWithAccess(\"id\", GroupInfo::LIMITED_ACCESS);\n\n\t\t//Check if the user is currently only a visitor of the website\n\t\tif(components()->groups->getMembershipLevel(userID, $groupID) != GroupMember::VISITOR)\n\t\t\tRest_fatal_error(401, \"You are not currently a visitor of the group!\");\n\n\t\t//Check if the user can register a new membership to the group\n\t\t//Get information about the group\n\t\t$info = components()->groups->get_info($groupID);\n\n\t\tif($info->get_registration_level() == GroupInfo::CLOSED_REGISTRATION)\n\t\t\tRest_fatal_error(401, \"You are not authorized to send a registration request for this group!\");\n\t\t\n\t\t//Create and insert membership\n\t\t$member = new GroupMember();\n\t\t$member->set_userID(userID);\n\t\t$member->set_time_sent(time());\n\t\t$member->set_group_id($groupID);\n\t\t$member->set_level(\n\t\t\t$info->get_registration_level() == GroupInfo::MODERATED_REGISTRATION ? \n\t\t\tGroupMember::PENDING : GroupMember::MEMBER);\n\t\tif(!components()->groups->insertMember($member))\n\t\t\tRest_fatal_error(500, \"Could not register membership!\");\n\t\t\n\t\t//Push notification\n\t\tif($info->get_registration_level() == GroupInfo::MODERATED_REGISTRATION)\n\t\t\tcreate_group_membership_notification(userID, 0, $groupID, \n\t\t\t\tNotification::SENT_GROUP_MEMBERSHIP_REQUEST);\n\n\t\t//Success\n\t\treturn array(\"success\" => \"The membership has been successfully saved!\");\n\t}",
"public function joinGroup(ServerRequestInterface $request, ResponseInterface $response) {\n $db = HelperController::getConnection();\n \n $user_id = $_POST[\"user_id\"];\n $inv_id = $_POST[\"inv_id\"];\n $accepted = $_POST[\"accepted\"];\n $email = $_POST[\"user_email\"];\n $group_id = $_POST[\"group_id\"];\n \n \n if ($accepted === \"accept=yes\"){\n //insert user into group\n $sql = \"INSERT INTO `user_has_group`(`user_id`, `group_id`) VALUES (:user_id, :group_id)\";\n\n $stmt = $db->prepare($sql);\n $stmt->bindParam(':user_id', $user_id);\n $stmt->bindParam(':group_id', $group_id);\n $stmt->execute();\n }\n \n $sql = \"DELETE FROM mydb.invitation WHERE invitation.id = :id\";\n\n $stmt = $db->prepare($sql);\n $stmt->bindParam(':id', $inv_id);\n $stmt->execute();\n \n }",
"function bp_next_ajax_joinleave_group() {\n\t$response = array(\n\t\t'feedback' => sprintf(\n\t\t\t'<div class=\"feedback error bp-ajax-message\"><p>%s</p></div>',\n\t\t\tesc_html__( 'There was a problem performing this action. Please try again.', 'bp-next' )\n\t\t)\n\t);\n\n\t// Bail if not a POST action.\n\tif ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) || empty( $_POST['action'] ) ) {\n\t\twp_send_json_error( $response );\n\t}\n\n\tif ( empty( $_POST['nonce'] ) || empty( $_POST['item_id'] ) || ! bp_is_active( 'groups' ) ) {\n\t\twp_send_json_error( $response );\n\t}\n\n\t// Use default nonce\n\t$nonce = $_POST['nonce'];\n\t$check = 'bp_next_groups';\n\n\t// Use a specific one for actions needed it\n\tif ( ! empty( $_POST['_wpnonce'] ) && ! empty( $_POST['action'] ) ) {\n\t\t$nonce = $_POST['_wpnonce'];\n\t\t$check = $_POST['action'];\n\t}\n\n\t// Nonce check!\n\tif ( empty( $nonce ) || ! wp_verify_nonce( $nonce, $check ) ) {\n\t\twp_send_json_error( $response );\n\t}\n\n\t// Cast gid as integer.\n\t$group_id = (int) $_POST['item_id'];\n\n\tif ( groups_is_user_banned( bp_loggedin_user_id(), $group_id ) ) {\n\t\t$response['feedback'] = sprintf(\n\t\t\t'<div class=\"bp-feedback error\"><p>%s</p></div>',\n\t\t\tesc_html__( 'You cannot join this group.', 'bp-next' )\n\t\t);\n\n\t\twp_send_json_error( $response );\n\t}\n\n\t// Validate and get the group\n\t$group = groups_get_group( array( 'group_id' => $group_id ) );\n\n\tif ( empty( $group->id ) ) {\n\t\twp_send_json_error( $response );\n\t}\n\n\t/**\n\t *\n\n\t Every action should be handled here\n\n\t */\n\tswitch ( $_POST['action'] ) {\n\n\t\tcase 'groups_accept_invite' :\n\t\t\tif ( ! groups_accept_invite( bp_loggedin_user_id(), $group_id ) ) {\n\t\t\t\t$response = array(\n\t\t\t\t\t'feedback' => sprintf(\n\t\t\t\t\t\t'<div class=\"bp-feedback error\">%s</div>',\n\t\t\t\t\t\tesc_html__( 'Group invite could not be accepted', 'bp-next' )\n\t\t\t\t\t),\n\t\t\t\t\t'type' => 'error'\n\t\t\t\t);\n\n\t\t\t} else {\n\t\t\t\tgroups_record_activity( array(\n\t\t\t\t\t'type' => 'joined_group',\n\t\t\t\t\t'item_id' => $group->id\n\t\t\t\t) );\n\n\t\t\t\t$response = array(\n\t\t\t\t\t'feedback' => sprintf(\n\t\t\t\t\t\t'<div class=\"bp-feedback success\">%s</div>',\n\t\t\t\t\t\tesc_html__( 'Group invite accepted', 'bp-next' )\n\t\t\t\t\t),\n\t\t\t\t\t'type' => 'success',\n\t\t\t\t\t'is_user' => bp_is_user(),\n\t\t\t\t);\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase 'groups_reject_invite' :\n\t\t\tif ( ! groups_reject_invite( bp_loggedin_user_id(), $group_id ) ) {\n\t\t\t\t$response = array(\n\t\t\t\t\t'feedback' => sprintf(\n\t\t\t\t\t\t'<div class=\"bp-feedback error\">%s</div>',\n\t\t\t\t\t\tesc_html__( 'Group invite could not be rejected', 'bp-next' )\n\t\t\t\t\t),\n\t\t\t\t\t'type' => 'error'\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\t$response = array(\n\t\t\t\t\t'feedback' => sprintf(\n\t\t\t\t\t\t'<div class=\"bp-feedback success\">%s</div>',\n\t\t\t\t\t\tesc_html__( 'Group invite rejected', 'bp-next' )\n\t\t\t\t\t),\n\t\t\t\t\t'type' => 'success',\n\t\t\t\t\t'is_user' => bp_is_user(),\n\t\t\t\t);\n\t\t\t}\n\t\t\tbreak;\n\t}\n\n\tif ( 'error' === $response['type'] ) {\n\t\twp_send_json_error( $response );\n\t} else {\n\t\twp_send_json_success( $response );\n\t}\n\n\tif ( ! groups_is_user_member( bp_loggedin_user_id(), $group->id ) ) {\n\t\tif ( 'public' == $group->status ) {\n\n\t\t\tif ( ! groups_join_group( $group->id ) ) {\n\t\t\t\t$response['feedback'] = sprintf(\n\t\t\t\t\t'<div class=\"feedback error bp-ajax-message\"><p>%s</p></div>',\n\t\t\t\t\tesc_html__( 'Error joining group', 'bp-next' )\n\t\t\t\t);\n\n\t\t\t\twp_send_json_error( $response );\n\t\t\t} else {\n\t\t\t\t// User is now a member of the group\n\t\t\t\t$group->is_member = '1';\n\n\t\t\t\twp_send_json_success( array(\n\t\t\t\t\t'contents' => bp_get_group_join_button( $group ),\n\t\t\t\t\t'is_group' => bp_is_group()\n\t\t\t\t) );\n\t\t\t}\n\n\t\t} elseif ( 'private' == $group->status ) {\n\n\t\t\t// If the user has already been invited, then this is\n\t\t\t// an Accept Invitation button.\n\t\t\tif ( groups_check_user_has_invite( bp_loggedin_user_id(), $group->id ) ) {\n\n\t\t\t\tif ( ! groups_accept_invite( bp_loggedin_user_id(), $group->id ) ) {\n\t\t\t\t\t$response['feedback'] = sprintf(\n\t\t\t\t\t\t'<div class=\"feedback error bp-ajax-message\"><p>%s</p></div>',\n\t\t\t\t\t\tesc_html__( 'Error requesting membership', 'bp-next' )\n\t\t\t\t\t);\n\n\t\t\t\t\twp_send_json_error( $response );\n\t\t\t\t} else {\n\t\t\t\t\t// User is now a member of the group\n\t\t\t\t\t$group->is_member = '1';\n\n\t\t\t\t\twp_send_json_success( array(\n\t\t\t\t\t\t'contents' => bp_get_group_join_button( $group ),\n\t\t\t\t\t\t'is_group' => bp_is_group()\n\t\t\t\t\t) );\n\t\t\t\t}\n\n\t\t\t// Otherwise, it's a Request Membership button.\n\t\t\t} else {\n\n\t\t\t\tif ( ! groups_send_membership_request( bp_loggedin_user_id(), $group->id ) ) {\n\t\t\t\t\t$response['feedback'] = sprintf(\n\t\t\t\t\t\t'<div class=\"feedback error bp-ajax-message\"><p>%s</p></div>',\n\t\t\t\t\t\tesc_html__( 'Error requesting membership', 'bp-next' )\n\t\t\t\t\t);\n\n\t\t\t\t\twp_send_json_error( $response );\n\t\t\t\t} else {\n\t\t\t\t\t// Request is pending\n\t\t\t\t\t$group->is_pending = '1';\n\n\t\t\t\t\twp_send_json_success( array(\n\t\t\t\t\t\t'contents' => bp_get_group_join_button( $group ),\n\t\t\t\t\t\t'is_group' => bp_is_group()\n\t\t\t\t\t) );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t} else {\n\n\t\tif ( ! groups_leave_group( $group->id ) ) {\n\t\t\t$response['feedback'] = sprintf(\n\t\t\t\t'<div class=\"feedback error bp-ajax-message\"><p>%s</p></div>',\n\t\t\t\tesc_html__( 'Error leaving group', 'bp-next' )\n\t\t\t);\n\n\t\t\twp_send_json_error( $response );\n\t\t} else {\n\t\t\t// User is no more a member of the group\n\t\t\t$group->is_member = '0';\n\n\t\t\twp_send_json_success( array(\n\t\t\t\t'contents' => bp_get_group_join_button( $group ),\n\t\t\t\t'is_group' => bp_is_group()\n\t\t\t) );\n\t\t}\n\t}\n}",
"public function inviteMember(Request $request, Group $group)\n {\n // Flags to tackle errors\n $errors = '';\n\n // Iterate over all invitees\n $usernames = explode(\",\", $request->get('usernames'));\n foreach ($usernames as $username) {\n // Get user\n $user = User::where(Constants::FLD_USERS_USERNAME, '=', $username)->first();\n\n // If user doesn't exist\n if (!$user) {\n $errors .= \"$username doesn't exist!\\n\";\n continue;\n }\n // Check if already member or owner\n if (\\Gate::forUser($user)->allows(\"owner-or-member-group\", [$group])) {\n $errors .= \"$username is already member exist!\\n\";\n continue;\n }\n\n // Create new notification if user isn't already invited\n try {\n Notification::make(Auth::user(), $user, $group, Constants::NOTIFICATION_TYPE_GROUP, false);\n\n // Check if user has already requested to join (if so, add him)\n if ($user->seekingJoinGroups()->find($group[Constants::FLD_GROUPS_ID])) {\n // Remove user join request\n $group->membershipSeekers()->detach($user);\n\n // Save user to members\n $group->members()->save($user);\n }\n } // If the user is already invited the make function throws this exception\n catch (InvitationException $e) {\n $errors .= \"$username is already invited\\n\";\n continue;\n }\n }\n\n // Handle response errors/messages\n if ($errors != '') {\n return back()->withErrors($errors);\n }\n return back()->with('messages', ['Users are invited successfully!']);\n }",
"function invite(){\n //params : group_id, emailid\n //save data into \"group_invitations\"\n //trigger email with secret\n try{\n\n }\n catch(Exception $ex){\n \n }\n }",
"public function acceptFriendRequest(){\n //Gets the connection Id to allow the model to delete the record\n $friendConnectionId = $_POST[\"friendConnectionId\"];\n //Gets the sender id for creating the friend connection\n $senderId = $_POST[\"senderId\"];\n //Gets the other users name to add for the friend connection record creation\n $otherUsersName = $this->friendsListModel->getOtherUsersName($senderId);\n //Creates the connection between the users\n $this->friendsListModel->requestAccepted($otherUsersName, $senderId);\n //deletes the request connection\n $returnData = $this->friendsListModel->cancelRequest($friendConnectionId);\n //redirect\n redirect('FriendsListController/friendsList');\n }",
"public function requestAction() {\n\n //CHECK AUTH\n if( !$this->_helper->requireUser()->isValid() ) return;\n\n //SOMMTHBOX\n $this->_helper->layout->setLayout('default-simple');\n \n //MAKE FORM\n $this->view->form = $form = new Sitegroupmember_Form_Member();\n $form->setTitle('Request Group Membership');\n $form->setDescription('Would you like to request membership in this group?');\n $form->submit->setLabel('Send Request');\n \n\t\t//GET THE VIEWER ID.\n\t\t$viewer = Engine_Api::_()->user()->getViewer();\n\t\t$viewer_id = $viewer->getIdentity();\n\n\t\t//GET THE GROUP ID.\n\t\t$group_id = $this->_getParam('group_id');\n\t\t$sitegroup = Engine_Api::_()->getItem('sitegroup_group', $group_id);\n\t\t\n\t\t$grouptitle = $sitegroup->title;\n\t\t$group_url = Engine_Api::_()->sitegroup()->getGroupUrl($group_id);\n\t\t\n\t\t$group_baseurl = ((!empty($_ENV[\"HTTPS\"]) && 'on' == strtolower($_ENV[\"HTTPS\"])) ? \"https://\":\"http://\") . $_SERVER['HTTP_HOST'] . Zend_Controller_Front::getInstance()->getRouter()->assemble(array('group_url' => $group_url), 'sitegroup_entry_view', true);\t\t\n\t\t$group_title_link = '<a href=\"' . $group_baseurl . '\" >' . $grouptitle . ' </a>';\n\t\t\t\n $hasMembers = Engine_Api::_()->getDbTable('membership', 'sitegroup')->hasMembers($viewer_id, $group_id);\n\n //IF MEMBER IS ALREADY PART OF THE GROUP\n if(!empty($hasMembers)) {\n return $this->_forwardCustom('success', 'utility', 'core', array(\n 'messages' => array(Zend_Registry::get('Zend_Translate')->_('You have already sent a membership request.')),\n 'layout' => 'default-simple',\n 'parentRefresh' => true,\n ));\n }\n\n //PROCESS FORM\n if( $this->getRequest()->isPost() && $form->isValid($this->getRequest()->getPost()) ) {\n\n\t\t\t$sitegroupmember = Engine_Api::_()->getDbTable('membership', 'sitegroup')->hasMembers($viewer_id);\n\n //GET MANAGE ADMIN AND SEND NOTIFICATIONS TO ALL MANAGE ADMINS.\n\t\t\t$manageadmins = Engine_Api::_()->getDbtable('manageadmins', 'sitegroup')->getManageAdmin($group_id);\n\t\t\n\t\t\t$values = $this->getRequest()->getPost();\n\n\t\t\t$membersTable = Engine_Api::_()->getDbtable('membership', 'sitegroup');\n\n\t\t\t$row = $membersTable->createRow();\n\t\t\t$row->resource_id = $group_id;\n\t\t\t$row->group_id = $group_id;\n\t\t\t$row->user_id = $viewer_id;\n\t\t\t$row->active = 0;\n\t\t\t$row->resource_approved = 0;\n\t\t\t$row->user_approved = 0;\n\n\t\t\tif (!empty($sitegroupmember->featured) && $sitegroupmember->featured == 1) {\n\t\t\t\t$row->featured = 1;\n\t\t\t}\n\n\t\t\t$row->save();\n \n \n\t\t\tforeach($manageadmins as $manageadmin) {\n\n\t\t\t\t$user_subject = Engine_Api::_()->user()->getUser($manageadmin['user_id']);\n\n\t\t\t\tEngine_Api::_()->getDbtable('notifications', 'activity')->addNotification($user_subject, $viewer, $sitegroup, 'sitegroupmember_approve', array('member_id' => $row->member_id));\n\n\t\t\t\t//Email to all group admins.\n\t\t\t\tEngine_Api::_()->getApi('mail', 'core')->sendSystem($user_subject->email, 'SITEGROUPMEMBER_REQUEST_EMAIL', array(\n\t\t\t\t\t\t'group_title' => $grouptitle,\n\t\t\t\t\t\t'group_title_with_link' => $group_title_link,\n\t\t\t\t\t\t'object_link' => $group_baseurl,\n\t\t\t\t\t\t//'email' => $email,\n\t\t\t\t\t\t'queue' => true\n\t\t\t\t));\n\t\t\t}\n \n \n\t\t\treturn $this->_forwardCustom('success', 'utility', 'core', array(\n\t\t\t\t'messages' => array(Zend_Registry::get('Zend_Translate')->_('Your group membership request has been sent successfully.')),\n\t\t\t\t'layout' => 'default-simple',\n\t\t\t\t'parentRefresh' => true,\n\t\t\t));\n }\n }",
"public function invite()\n {\n try {\n $postdata = $this->input->post();\n $user = $this->user;\n $medical_group_id = $postdata['medical_group_id'];\n $mgroup = MedicalGroup::find_by_id($medical_group_id);\n //valid user &&&& valid medical group &&&& valid user for given group\n\n $errors = array(\n 'mgroup' => $mgroup,\n 'group_user' => $mgroup->checkForGroupUser($user->id, 0),\n );\n if (!empty($user) && !empty($mgroup) && ($mgroup->checkOwner($user->id) == true || $mgroup->checkForGroupUser($user->id, 0) == true)) {\n $invited_emailids = explode(',', $postdata['invited_emailid']);\n $count = 0;\n foreach ($invited_emailids as $emailid) {\n $ginv = new MedicalGroupInvitation();\n $ginv->email = $emailid;\n $ginv->medical_group_id = $medical_group_id;\n\n $save = $ginv->saveInvitation();\n if ($save) {\n ++$count;\n }\n }\n echo json_encode(array('status' => true, 'message' => $count.' Invitation(s) Sent.'));\n } else {\n echo json_encode(array('status' => false, 'message' => 'Something went wrong. Please try again later.', 'errors' => $errors));\n }\n } catch (Exception $ex) {\n echo json_encode(array('status' => false, 'message' => 'Invalid Data submitted.'.$ex->getMessage()));\n }\n }",
"public function friend(Request $request)\n {\n DB::beginTransaction();\n try {\n $member = auth()->guard('api')->user();\n $request->merge(['member_id' => $member->id]);\n\n $this->memberValidator->with($request->all())->passesOrFail(BaseValidatorInterface::RULE_MEMBER_ADD_FRIEND);\n\n $member->friends()->attach($request->get('friend_id'));\n\n DB::commit();\n return $this->jsonResponse(STATUS_CREATED, __('Add friend success'));\n } catch (ValidatorException $exception) {\n DB::rollback();\n throw $exception;\n }\n }",
"public function actionAddFriends()\n\t{\n\t\tif(isset($_GET['friend']))\n\t\t{\n\t\t\t$friend_id = $_GET['friend'];\n\t\t\t$model = $this->loadFriendModel(Yii::app()->user->id, $friend_id);\n\t\t\tif(isset($_POST['Friends']))\n\t\t\t{\n\t\t\t\t$model->groups = array_merge($model->groups, array_values($_POST['Friends']['Groups']));\n\t\t\t\t$model->save();\n\t\t\t}\n\t\t}\n\t\t\n\t\t$this->redirect(array('friends/myFriends'));\n\t}",
"function acceptUserIntoGroup(Request $request)\n\t{\n\t\tif(Auth::user())\n\t\t{\n\t\t\tDB::update('exec StudyApp_AcceptRequestToJoinUserFromGroup ?,?,?', array(Auth::user()->id, $request['uid'], $request['postid']));\n\t\t\treturn 1;\n\t\t}\n\t\treturn 0;\n\t}",
"public function joinPrivateGroup()\n\t{\n\t\ttry\n\t\t{\n\t\t\t$group_jid = Request::get('group_jid');\n\t\t\t$member_id = Request::get('member_id');\n\n\t\t\tif( empty( $group_jid ) )\n\t\t\t\tthrow new Exception(\"Group jid is required.\", 1);\t\t\t\t\n\n\t\t\t$group = Group::where('group_jid', $group_jid)->first();\n\n\t\t\tif( !$group )\n\t\t\t\tthrow new Exception(\"Group does not exist.\", 1);\n\n\t\t\t$user = User::find($member_id);\n\n\t\t\tif( !$user )\n\t\t\t\tthrow new Exception(\"User does not exist.\", 1);\n\n\t\t\t$TotalCount = GroupMembers::where(['member_id' => $member_id,'status' => 'Joined'] )->get()->count();\n\t\t\t\n\t\t\tif( $TotalCount < Config::get('constants.private_group_limit') ){\n\t\t\t\t\t$group_members = GroupMembers::where(['group_id' => $group->id, 'member_id' => $member_id])->count();\n\t\t\t\t\t$GroupCount = GroupMembers::where(['group_id' => $group->id, 'member_id' => $member_id,'status' => 'Pending'])->count();\n\n\t\t\t\tif( $group_members > 0 && $GroupCount ){\n\t\t\t\t\t// Broadcast message\n\t //$members = GroupMembers::where(['group_id' => $group->id])->get();\n\t $members = GroupMembers::leftJoin('users', 'members.member_id', '=', 'users.id')->where(['members.group_id' => $group->id,'members.status' => 'Joined'])->pluck('xmpp_username');\n\n\t $status = GroupMembers::where(['group_id' => $group->id, 'member_id' => $member_id])\n\t\t\t\t\t\t\t\t\t\t\t\t\t->update(['status' => 'Joined']);\n\t \t\n\t $name = $user->first_name.' '.$user->last_name;\n\t $message = json_encode( array( 'type' => 'hint', 'action'=>'join', 'sender_jid' => $user->xmpp_username,'xmpp_userid' => $user->xmpp_username,'user_id' => $user->id, 'user_image' => $user->picture, 'user_name'=>$name, 'message' => $name.' joined the group') );\n\t foreach($members as $memberxmpp) {\n\t Converse::broadcastchatroom($group->group_jid, $name, $memberxmpp, $user->xmpp_username, $message);\n\t };\n\n\t\t\t\t\tif( $status ){\n\t\t\t\t\t\t$this->data = $status;\n\t\t\t\t\t\t$this->message = 'Joined private group successfully.' ;\n\t\t\t\t\t\t$this->status = 'success';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$this->message = 'only '.Config::get('constants.private_group_limit').' group join.' ;\n\t\t\t\t$this->status = 'Failed';\n\t\t\t\t$this->data = '';\n\t\t\t}\n\n\t\t}catch(Exception $e){\n\t\t\t$this->message = $e->getMessage();\n\t\t}\n\n\t\treturn $this->output();\n\n\t}",
"function bp_dtheme_ajax_invite_user() {\r\n\tglobal $bp;\r\n\r\n\tcheck_ajax_referer( 'groups_invite_uninvite_user' );\r\n\r\n\tif ( !$_POST['friend_id'] || !$_POST['friend_action'] || !$_POST['group_id'] )\r\n\t\treturn false;\r\n\r\n\tif ( !groups_is_user_admin( $bp->loggedin_user->id, $_POST['group_id'] ) )\r\n\t\treturn false;\r\n\r\n\tif ( !friends_check_friendship( $bp->loggedin_user->id, $_POST['friend_id'] ) )\r\n\t\treturn false;\r\n\r\n\tif ( 'invite' == $_POST['friend_action'] ) {\r\n\r\n\t\tif ( !groups_invite_user( array( 'user_id' => $_POST['friend_id'], 'group_id' => $_POST['group_id'] ) ) )\r\n\t\t\treturn false;\r\n\r\n\t\t$user = new BP_Core_User( $_POST['friend_id'] );\r\n\r\n\t\techo '<li id=\"uid-' . $user->id . '\">';\r\n\t\techo $user->avatar_thumb;\r\n\t\techo '<h4>' . $user->user_link . '</h4>';\r\n\t\techo '<span class=\"activity\">' . esc_attr( $user->last_active ) . '</span>';\r\n\t\techo '<div class=\"action\">\r\n\t\t\t\t<a class=\"remove\" href=\"' . wp_nonce_url( $bp->loggedin_user->domain . $bp->groups->slug . '/' . $_POST['group_id'] . '/invites/remove/' . $user->id, 'groups_invite_uninvite_user' ) . '\" id=\"uid-' . esc_attr( $user->id ) . '\">' . __( 'Remove Invite', 'buddypress' ) . '</a>\r\n\t\t\t </div>';\r\n\t\techo '</li>';\r\n\r\n\t} else if ( 'uninvite' == $_POST['friend_action'] ) {\r\n\r\n\t\tif ( !groups_uninvite_user( $_POST['friend_id'], $_POST['group_id'] ) )\r\n\t\t\treturn false;\r\n\r\n\t\treturn true;\r\n\r\n\t} else {\r\n\t\treturn false;\r\n\t}\r\n}",
"function sendFriendRequest(){\n\tif(isset($_POST['formData'])){\n\t\t//run the api request\n\t\t//setup the request data\n\t\t$rData = array(\n\t\t\t'propertyId'=>$this->currentRef,\n\t\t\t'createdDate'=>$requestDate,\n\t\t\t'sendFriend'=>true,\n\t\t\t'message'=>$_POST['message'],\n\t\t\t'friendData'=>array(\n\t\t\t\t'name'=>$_POST['friendsName'],\n\t\t\t\t'email'=>$_POST['friendsName'],\n\t\t\t),\n\t\t\t'contactData'=>array(\n\t\t\t\t'firstName'=>$_POST['firstName'],\n\t\t\t\t'lastName'=>$_POST['lastName'],\n\t\t\t\t'tel1'=>$_POST['tel'],\n\t\t\t\t'email'=>$_POST['email'],\n\t\t\t)\n\t\t);\n\t\t\n\t\t//run the api request\n\t\t$this->api->newRequest($rData);\n\t\t\n\t\t$modalOutput = $this->processTpl('','thanks.html',array());\n\t\t//send a success message to the user\n\t\t$this->jsonEcho($modalOutput);\n\t}\n}",
"function _add_friends_to_group( $friends = array(), $prefs = array(), $owner_id = '', $group_id = '' )\r\n\t{\r\n\t\t$this->group_id\t= ( $group_id != '' ) ? $group_id: $this->group_id;\r\n\r\n\t\t//\t----------------------------------------\r\n\t\t//\tGroup id valid?\r\n\t\t//\t----------------------------------------\r\n\r\n\t\tif ( $this->group_id == 0 OR\r\n\t\t\t ( $group_data = $this->data->get_group_data_from_group_id(\r\n\t\t\t\tee()->config->item('site_id'),\r\n\t\t\t\t$this->group_id )\r\n\t\t\t ) === FALSE )\r\n\t\t{\r\n\t\t\t$this->message[]\t= lang('group_id_required');\r\n\t\t\treturn FALSE;\r\n\t\t}\r\n\r\n\t\t//\t----------------------------------------\r\n\t\t//\tNo friends?\r\n\t\t//\t----------------------------------------\r\n\r\n\t\tif ( count( $friends ) == 0 )\r\n\t\t{\r\n\t\t\t$this->message[]\t= lang('friends_required');\r\n\t\t\treturn FALSE;\r\n\t\t}\r\n\r\n\t\t//\t----------------------------------------\r\n\t\t//\tClarify array\r\n\t\t//\t----------------------------------------\r\n\r\n\t\t$arr\t= array();\r\n\r\n\t\tforeach ( $friends as $friend )\r\n\t\t{\r\n\t\t\t$temp\t= explode( \"|\", $friend );\r\n\r\n\t\t\t$arr\t= array_merge( $arr, $temp );\r\n\t\t}\r\n\r\n\t\t$friends\t= $arr;\r\n\r\n\t\t//\t----------------------------------------\r\n\t\t//\tSet owner id\r\n\t\t//\t----------------------------------------\r\n\t\t// We call this method inside $Friends::referral_check\r\n\t\t// and the member id can change so we allow the owner\r\n\t\t// id to be sent through the method as an argument.\r\n\t\t// Otherwise we want to assume the person viewing\r\n\t\t// the page is the owner.\r\n\t\t//\t----------------------------------------\r\n\r\n\t\t$owner_id\t= ( $owner_id == '' ) ? ee()->session->userdata('member_id'): $owner_id;\r\n\r\n\t\t//\t----------------------------------------\r\n\t\t//\tIs the inviter the owner of the group?\r\n\t\t//\t----------------------------------------\r\n\r\n\t\tif ( $this->data->get_member_id_from_group_id(\r\n\t\t\t\tee()->config->item('site_id'), $this->group_id ) != $owner_id )\r\n\t\t{\r\n\t\t\t$this->message[]\t= lang('not_group_owner');\r\n\t\t\treturn FALSE;\r\n\t\t}\r\n\r\n\t\t//\t----------------------------------------\r\n\t\t//\tGet list of members already in group_posts\r\n\t\t//\t----------------------------------------\r\n\r\n\t\t$sql\t\t= \"SELECT \tmember_id, accepted, declined,\r\n\t\t\t\t\t\t\t\trequest_accepted, request_declined, invite_or_request\r\n\t\t\t\t\t FROM \texp_friends_group_posts\r\n\t\t\t\t\t WHERE \tsite_id = \" . ee()->db->escape_str( ee()->config->item('site_id') ) . \"\r\n\t\t\t\t\t AND \t\tgroup_id = \".ee()->db->escape_str( $this->group_id ) . \"\r\n\t\t\t\t\t AND \t\tmember_id\r\n\t\t\t\t\t IN \t\t( \" . implode( ',', $friends ) . \" )\";\r\n\r\n\t\t$query\t\t= ee()->db->query( $sql );\r\n\r\n\t\t$members\t= array();\r\n\r\n\t\tforeach ( $query->result_array() as $row )\r\n\t\t{\r\n\t\t\t$members[ $row['member_id'] ]\t= $row;\r\n\t\t}\r\n\r\n\t\t//\t----------------------------------------\r\n\t\t//\tGet valid user list from DB\r\n\t\t//\t----------------------------------------\r\n\r\n\t\t$sql\t= \"SELECT \tmember_id, email, username, screen_name,\r\n\t\t\t\t\t\t\t\" . implode( \",\", array_flip( $this->group_prefs ) ) . \"\r\n\t\t\t\t FROM \texp_members\r\n\t\t\t\t WHERE \tfriends_opt_out = 'n'\r\n\t\t\t\t AND \t\tmember_id\r\n\t\t\t\t NOT IN \t( \tSELECT \tmember_id\r\n\t\t\t\t\t\t\t\tFROM \texp_friends_group_posts\r\n\t\t\t\t\t\t\t\tWHERE ( declined = 'y' OR request_accepted = 'y' )\r\n\t\t\t\t\t\t\t\tAND \tgroup_id = '\" . ee()->db->escape_str( $this->group_id ) . \"'\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t AND \t\tmember_id\r\n\t\t\t\t IN \t\t('\" . implode( \"','\", $friends ) . \"')\";\r\n\r\n\t\t$query\t= ee()->db->query( $sql );\r\n\r\n\t\t//\t----------------------------------------\r\n\t\t//\tEmpty\r\n\t\t//\t----------------------------------------\r\n\r\n\t\tif ( $query->num_rows() == 0 )\r\n\t\t{\r\n\t\t\t$this->message[]\t= lang('no_valid_members');\r\n\t\t\treturn FALSE;\r\n\t\t}\r\n\r\n\t\t//\t----------------------------------------\r\n\t\t//\tLoop and invite or confirm\r\n\t\t//\t----------------------------------------\r\n\r\n\t\t$invited\t= 0;\r\n\t\t$confirmed\t= 0;\r\n\r\n\t\tforeach ( $query->result_array() as $row )\r\n\t\t{\r\n\t\t\t//\t----------------------------------------\r\n\t\t\t//\tConfirm?\r\n\t\t\t//\t----------------------------------------\r\n\t\t\t// If they are in our members array, we are confirming them.\r\n\t\t\t//\t----------------------------------------\r\n\r\n\t\t\tif ( isset( $members[ $row['member_id'] ] ) === TRUE )\r\n\t\t\t{\r\n\t\t\t\t//\t----------------------------------------\r\n\t\t\t\t//\tAre they already members of the group?\r\n\t\t\t\t//\t----------------------------------------\r\n\r\n\t\t\t\tif ( $members[ $row['member_id'] ][ 'accepted' ] == 'y' AND\r\n\t\t\t\t\t $members[ $row['member_id'] ][ 'request_accepted' ] == 'y' ) continue;\r\n\r\n\t\t\t\t//\t----------------------------------------\r\n\t\t\t\t//\tNot yet a member, but ready to join?\r\n\t\t\t\t//\t----------------------------------------\r\n\r\n\t\t\t\tif ( $members[ $row['member_id'] ][ 'accepted' ] == 'y' AND\r\n\t\t\t\t\t $members[ $row['member_id'] ][ 'request_accepted' ] == 'n' )\r\n\t\t\t\t{\r\n\t\t\t\t\t$confirmed++;\r\n\r\n\t\t\t\t\t//\t----------------------------------------\r\n\t\t\t\t\t//\tPrep update\r\n\t\t\t\t\t//\t----------------------------------------\r\n\r\n\t\t\t\t\t$sql\t= ee()->db->update_string(\r\n\t\t\t\t\t\t'exp_friends_group_posts',\r\n\t\t\t\t\t\tarray(\r\n\t\t\t\t\t\t\t'request_accepted'\t=> 'y',\r\n\t\t\t\t\t\t\t'request_declined'\t=> 'n',\r\n\t\t\t\t\t\t\t'entry_date'\t\t=> ee()->localize->now\r\n\t\t\t\t\t\t),\r\n\t\t\t\t\t\tarray(\r\n\t\t\t\t\t\t\t'group_id'\t=> $this->group_id,\r\n\t\t\t\t\t\t\t'site_id'\t=> ee()->config->item('site_id'),\r\n\t\t\t\t\t\t\t'member_id'\t=> $row['member_id']\r\n\t\t\t\t\t\t)\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t\tee()->db->query( $sql );\r\n\r\n\t\t\t\t\t//\t----------------------------------------\r\n\t\t\t\t\t//\tNotify\r\n\t\t\t\t\t//\t----------------------------------------\r\n\r\n\t\t\t\t\tif ( $this->notify === TRUE AND\r\n\t\t\t\t\t\t ! empty( $prefs['notification_approve'] ) AND\r\n\t\t\t\t\t\t $prefs['notification_approve'] != '' )\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tunset( $email );\r\n\t\t\t\t\t\t$email['notification_template']\t\t\t\t\t= $prefs['notification_approve'];\r\n\t\t\t\t\t\t$email['email']\t\t\t\t\t\t\t\t\t= $row['email'];\r\n\t\t\t\t\t\t$email['member_id']\t\t\t\t\t\t\t\t= $row['member_id'];\r\n\t\t\t\t\t\t$email['from_email']\t\t\t\t\t\t\t= ee()->session->userdata['email'];\r\n\t\t\t\t\t\t$email['from_name']\t\t\t\t\t\t\t\t= ee()->session->userdata['screen_name'];\r\n\t\t\t\t\t\t$email['subject']\t\t\t\t\t\t\t\t= ( ! empty( $prefs['subject_approve'] ) ) ?\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$prefs['subject_approve'] :\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlang('subject_approve_email');\r\n\t\t\t\t\t\t$email['extra']['friends_group_id']\t\t\t\t= $this->group_id;\r\n\t\t\t\t\t\t$email['extra']['friends_group_name']\t\t\t= $group_data['name'];\r\n\t\t\t\t\t\t$email['extra']['friends_group_title']\t\t\t= $group_data['title'];\r\n\t\t\t\t\t\t$email['extra']['friends_group_description']\t= $group_data['description'];\r\n\t\t\t\t\t\t$email['extra']['friends_owner_screen_name']\t= $group_data['owner_screen_name'];\r\n\t\t\t\t\t\t$email['extra']['friends_owner_username']\t\t= $group_data['owner_username'];\r\n\t\t\t\t\t\t$email['extra']['friends_owner_member_id']\t\t= $group_data['owner_member_id'];\r\n\t\t\t\t\t\t$email['extra']['friends_user_screen_name']\t\t= $row['screen_name'];\r\n\t\t\t\t\t\t$email['extra']['friends_user_username']\t\t= $row['username'];\r\n\t\t\t\t\t\t$email['extra']['friends_user_member_id']\t\t= $row['member_id'];\r\n\r\n\t\t\t\t\t\t// ----------------------------------------\r\n\t\t\t\t\t\t// Let's quickly parse some vars just for sanity\r\n\t\t\t\t\t\t// ----------------------------------------\r\n\r\n\t\t\t\t\t\tforeach ( $email['extra'] as $key => $val )\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$email['subject']\t= str_replace(\r\n\t\t\t\t\t\t\t\tarray( '%' . $key . '%', LD . $key . RD ),\r\n\t\t\t\t\t\t\t\tarray( $val, $val ),\r\n\t\t\t\t\t\t\t\t$email['subject']\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t$this->_notify( $email );\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t//\t----------------------------------------\r\n\t\t\t//\tInvite?\r\n\t\t\t//\t----------------------------------------\r\n\t\t\t// \tIf they are not in our members array, we are inviting them.\r\n\t\t\t//\t----------------------------------------\r\n\r\n\t\t\tif ( isset( $members[ $row['member_id'] ] ) === FALSE )\r\n\t\t\t{\r\n\t\t\t\t$invited++;\r\n\r\n\t\t\t\t//\t----------------------------------------\r\n\t\t\t\t//\tRespect per member prefs\r\n\t\t\t\t//\t----------------------------------------\r\n\r\n\t\t\t\t$arr\t= array(\r\n\t\t\t\t\t'group_id'\t\t\t=> $this->group_id,\r\n\t\t\t\t\t'entry_date'\t\t=> ee()->localize->now,\r\n\t\t\t\t\t'member_id'\t\t\t=> $row['member_id'],\r\n\t\t\t\t\t'invite_or_request'\t=> 'invite'\r\n\t\t\t\t);\r\n\r\n\t\t\t\tforeach ( $this->group_prefs as $key => $val )\r\n\t\t\t\t{\r\n\t\t\t\t\tif ( isset( $row[$key] ) === FALSE ) continue;\r\n\r\n\t\t\t\t\t$arr[$val]\t= $row[$key];\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( ! isset($arr['site_id']) )\r\n\t\t\t\t{\r\n\t\t\t\t\t$arr['site_id'] = $this->clean_site_id;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tee()->db->query( ee()->db->insert_string( 'exp_friends_group_posts', $arr ) );\r\n\r\n\t\t\t\t//\t----------------------------------------\r\n\t\t\t\t//\tNotify?\r\n\t\t\t\t//\t----------------------------------------\r\n\r\n\t\t\t\tif ( $this->notify === TRUE AND\r\n\t\t\t\t\t ! empty( $prefs['notification_invite'] ) AND\r\n\t\t\t\t\t $prefs['notification_invite'] != '' )\r\n\t\t\t\t{\r\n\t\t\t\t\tunset( $email );\r\n\t\t\t\t\t$email['notification_template']\t= $prefs['notification_invite'];\r\n\t\t\t\t\t$email['email']\t\t\t\t\t\t\t\t\t= $row['email'];\r\n\t\t\t\t\t$email['member_id']\t\t\t\t\t\t\t\t= $row['member_id'];\r\n\t\t\t\t\t$email['from_email']\t\t\t\t\t\t\t= ee()->session->userdata['email'];\r\n\t\t\t\t\t$email['from_name']\t\t\t\t\t\t\t\t= ee()->session->userdata['screen_name'];\r\n\t\t\t\t\t$email['subject']\t\t\t\t\t\t\t\t= ( ! empty( $prefs['subject_invite'] ) ) ?\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$prefs['subject_invite'] :\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlang('subject_invite_email');\r\n\t\t\t\t\t$email['extra']['friends_group_id']\t\t\t\t= $this->group_id;\r\n\t\t\t\t\t$email['extra']['friends_group_name']\t\t\t= $group_data['name'];\r\n\t\t\t\t\t$email['extra']['friends_group_title']\t\t\t= $group_data['title'];\r\n\t\t\t\t\t$email['extra']['friends_group_description']\t= $group_data['description'];\r\n\t\t\t\t\t$email['extra']['friends_owner_screen_name']\t= $group_data['owner_screen_name'];\r\n\t\t\t\t\t$email['extra']['friends_owner_username']\t\t= $group_data['owner_username'];\r\n\t\t\t\t\t$email['extra']['friends_owner_member_id']\t\t= $group_data['owner_member_id'];\r\n\t\t\t\t\t$email['extra']['friends_user_screen_name']\t\t= $row['screen_name'];\r\n\t\t\t\t\t$email['extra']['friends_user_username']\t\t= $row['username'];\r\n\t\t\t\t\t$email['extra']['friends_user_member_id']\t\t= $row['member_id'];\r\n\r\n\t\t\t\t\t//\t----------------------------------------\r\n\t\t\t\t\t//\tLet's quickly parse some vars just for sanity\r\n\t\t\t\t\t//\t----------------------------------------\r\n\r\n\t\t\t\t\tforeach ( $email['extra'] as $key => $val )\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$email['subject']\t= str_replace(\r\n\t\t\t\t\t\t\tarray( '%' . $key . '%', LD . $key . RD ),\r\n\t\t\t\t\t\t\tarray( $val, $val ),\r\n\t\t\t\t\t\t\t$email['subject']\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t$this->_notify( $email );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//\t----------------------------------------\r\n\t\t//\tPrepare messages\r\n\t\t//\t----------------------------------------\r\n\r\n\t\tif ( ! empty( $invited ) AND $invited > 0 )\r\n\t\t{\r\n\t\t\t$line\t= ( $invited == 1 ) ?\r\n\t\t\t\t\t\tlang( 'friend_invited' ) :\r\n\t\t\t\t\t\tstr_replace( '%count%', $invited, lang( 'friends_invited' ) );\r\n\r\n\t\t\t$this->message[]\t= $line;\r\n\t\t}\r\n\r\n\t\tif ( ! empty( $confirmed ) AND $confirmed > 0 )\r\n\t\t{\r\n\t\t\t$line\t= ( $confirmed == 1 ) ?\r\n\t\t\t\t\t\tlang( 'friend_confirmed' ) :\r\n\t\t\t\t\t\tstr_replace( '%count%', $confirmed, lang( 'friends_confirmed' ) );\r\n\r\n\t\t\t$this->message[]\t= $line;\r\n\t\t}\r\n\r\n\t\t//\t----------------------------------------\r\n\t\t//\tReturn\r\n\t\t//\t----------------------------------------\r\n\r\n\t\treturn TRUE;\r\n\t}",
"public function invite()\n {\n $this->validateRequest()\n ->createToken()\n ->send();\n }",
"public function ajaxJoin()\n\t{\n\t\t$success = Group::joinGroup(\n\t\t\tAuth::user()->id,\n\t\t\t(int) Input::get('id')\n\t\t);\n\n\t\treturn array('error' => (int) !$success);\n\t}",
"public function start_join_group($group) {\n\t\t\t$join_c = new join_group_model($group);\n\t\t\t$data = $join_c->join_group();\n\t\t\tif(@$group['action']===2) {\n\t\t\t\techo json_encode($data);\n\t\t\t}\n\t\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Filter the query on the subscription_lockout column Example usage: $query>filterBySubscriptionLockout(true); // WHERE subscription_lockout = true $query>filterBySubscriptionLockout('yes'); // WHERE subscription_lockout = true | public function filterBySubscriptionLockout($subscriptionLockout = null, $comparison = null)
{
if (is_string($subscriptionLockout)) {
$subscriptionLockout = in_array(strtolower($subscriptionLockout), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(LicensePeer::SUBSCRIPTION_LOCKOUT, $subscriptionLockout, $comparison);
} | [
"static function outletOfferFilter($params) \n{\n\t return \" AND of.`active`='1' AND ( NOW() < of.`end_datetime`) AND of.`start_datetime` IS NOT NULL AND of.`end_datetime` IS NOT NULL\";\n}",
"public function whereDisabled(): static\n {\n return $this->rawFilter('(pwdAccountLockedTime=*)');\n }",
"public function filterByLocked($locked = null, $comparison = null)\n {\n if (is_string($locked)) {\n $locked = in_array(strtolower($locked), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;\n }\n\n return $this->addUsingAlias(UserPeer::LOCKED, $locked, $comparison);\n }",
"public function filterByLockedOut($lockedOut = null, $comparison = null)\n {\n if (is_array($lockedOut)) {\n $useMinMax = false;\n if (isset($lockedOut['min'])) {\n $this->addUsingAlias(MessagesTableMap::COL_LOCKED_OUT, $lockedOut['min'], Criteria::GREATER_EQUAL);\n $useMinMax = true;\n }\n if (isset($lockedOut['max'])) {\n $this->addUsingAlias(MessagesTableMap::COL_LOCKED_OUT, $lockedOut['max'], Criteria::LESS_EQUAL);\n $useMinMax = true;\n }\n if ($useMinMax) {\n return $this;\n }\n if (null === $comparison) {\n $comparison = Criteria::IN;\n }\n }\n\n return $this->addUsingAlias(MessagesTableMap::COL_LOCKED_OUT, $lockedOut, $comparison);\n }",
"public static function add_subscriptions_table_column_filter(){\n\t\tadd_filter( 'manage_' . self::$admin_screen_id . '_columns', __CLASS__ . '::get_subscription_table_columns' );\n\t}",
"public function filterPaymentMethods($query);",
"public function getAllUnlockedQuery()\n\t{\n\t\t$qb = $this->createQueryBuilder('u')->where('u.lockout = :lockout')->orderBy('u.username', 'ASC')->setParameter('lockout', User::LOCKOUT_UNLOCKED);\n\t\t$query = $qb->getQuery();\n\n\t\treturn $query;\n\t}",
"public function filterByLocked($locked = null, $comparison = null)\n {\n if (is_string($locked)) {\n $locked = in_array(strtolower($locked), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;\n }\n\n return $this->addUsingAlias(MenuTableMap::COL_LOCKED, $locked, $comparison);\n }",
"private function filteredMeetingRoom() {\n\t\treturn $this->center\n\t\t ->where('active_flag', 'Y')\n\t\t ->where('city_id', '!=', 0)\n\t\t ->where(function ($q) {\n\t\t\t\t$q->whereHas('center_filter', function ($q) {\n\t\t\t\t\t\t$q->where('meeting_room', 1);})->orWhere(function ($q) {\n\t\t\t\t\t\t$q->has('center_filter', '<', 1);\n\t\t\t\t\t});\n\t\t\t});\n\t}",
"public function filterByExpiredOrEmptyLockout(DateTime $expiry)\n {\n $this->andWhere($this->expr()->orX($this->expr()->isNull('handle'),$this->expr()->lte('lock_timeout',':lock_timeout_exp')))->setParameter('lock_timeout_exp',$expiry,$this->getGateway()->getMetaData()->getColumn('lock_timeout')->getType());\n return $this; \n }",
"public function onUserLockout($event) {}",
"public function filterByIpLock($ipLock = null, $comparison = null)\n {\n if (is_string($ipLock)) {\n $ipLock = in_array(strtolower($ipLock), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;\n }\n\n return $this->addUsingAlias(LicensePeer::IP_LOCK, $ipLock, $comparison);\n }",
"public function testUpdateDashboardFilter()\n {\n }",
"public function whereDisabled()\n {\n return $this->rawFilter($this->schema->filterDisabled());\n }",
"public function whereDisabled()\n {\n return $this->rawFilter(\n (new AccountControl())->accountIsDisabled()->filter()\n );\n }",
"public function filterByInactive()\n {\n return $this->filterByResignationId(null, \\Criteria::ISNOTNULL);\n }",
"public function purge_lockouts() {\n\t\tglobal $wpdb;\n\n\t\t$wpdb->query( \"DELETE FROM `{$wpdb->base_prefix}itsec_lockouts` WHERE `lockout_expire_gmt` < '\" . date( 'Y-m-d H:i:s', ITSEC_Core::get_current_time_gmt() - ( ( ITSEC_Modules::get_setting( 'global', 'blacklist_period' ) + 1 ) * DAY_IN_SECONDS ) ) . \"';\" );\n\t\t$wpdb->query( \"DELETE FROM `{$wpdb->base_prefix}itsec_temp` WHERE `temp_date_gmt` < '\" . date( 'Y-m-d H:i:s', ITSEC_Core::get_current_time_gmt() - DAY_IN_SECONDS ) . \"';\" );\n\t}",
"function SqlKeyFilter() {\r\n\t\treturn \"`id_profile` = @id_profile@ AND `stat_date` = '@stat_date@'\";\r\n\t}",
"public function BlockoutDatesList($filter)\n\t{\n\t\t\n\n\t\ttry{\n \t\t\t$query = $this->entityManager->createQueryBuilder()\n\t\t\t->select('p.type as title','p.value as start')\n\t\t\t->from('App\\Entities\\ProductBlockOutDates', 'p');\n\t\t\t\n\t\t\tif(isset($filter->product_id))\n\t\t\t$query->andWhere('p.product_id =:product_id')->setParameter('product_id', $filter->product_id);\n\t\t\t$query->andWhere('p.status=:status')->setParameter('status', STATUS_ACTIVE);\n \n\t\t\t$query = $query->getQuery();\n\t\t\t \n\t\t\t$blockout_date_list = $query->getArrayResult();\n\t\t\t\n\t\t\treturn array('result'=>'success','blockout_date_list' => $blockout_date_list);\n\t\t}catch(Exception $e) {\n\t\t\treturn array('result'=>'fail','errorDescription'=>$e->getMessage());\n\t\t}\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the list of all the keys in the carrier. | public function keys($carrier): array; | [
"public function getKeys()\n {\n return $this->keys;\n }",
"static function getAllRedisKeys(){\n\n $base_key = static::getBaseKey();\n\n $keys = Redis::keys($base_key.\"*\");\n\n $length = strlen( config('database.redis.options.prefix') );\n\n foreach($keys as $i => $key){\n $keys[$i] = substr($key,$length);\n }\n\n return $keys;\n }",
"public function getAllKey();",
"public function getkeys() {\n return $this->redis->executeCommand('keys', array('*'));\n }",
"private function getAllCacheKeys(){\n $keys = array();\n foreach ($this->storages as $name => $storage){\n $keys[] = $this->getCacheKey($name);\n }\n return $keys;\n }",
"function keys() {\n global $db;\n\n $results = $db->Execute(\"select configuration_key from \" . TABLE_CONFIGURATION . \"\n where configuration_key like 'MODULE_PAYMENT_GETFINANCING_%' \" . \"\n order by sort_order\");\n $keys = array();\n while (!$results->EOF) {\n array_push($keys, $results->fields['configuration_key']);\n $results->MoveNext();\n }\n\n return $keys;\n }",
"public function getKeys() {\n\t\treturn $this->config->getKeys();\n\t}",
"public function getKeys() {\r\n\t\t\treturn array_keys($this->items);\r\n\t\t}",
"public function keys();",
"public static function getKeys()\n {\n return self::getCollection()->getKeys();\n }",
"public static function getKeys()\n {\n return array_keys(static::toDictionary());\n }",
"public static function keys(): array\n {\n return static::redis()->keys();\n }",
"public function getKeys(): array;",
"public function getKeys() {\n $obj=$this->fetchBucketProperties(array('props' => 'false', 'keys' => 'true'));\n return array_map('urldecode', $obj->data['keys']);\n }",
"public function getKeys()\n {\n $private_key = $this->config->getAppValue($this->appName, \"privatekey\");\n $public_key = $this->config->getAppValue($this->appName, \"publickey\");\n\n return [$private_key, $public_key];\n }",
"function KeyNameList ( ) { return $this->_KeyNameList; }",
"public static function getAclKeys()\n {\n return self::$ACL_KEYS;\n }",
"protected function _getCacheKeys()\r\n {\r\n return $this->_rediska->getKeysByPattern('*');\r\n }",
"public function getRegistryKeys()\n\t{\n\t\treturn $this->keys;\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Inline SVG helper Outputs the contents of an svg file | function inline_svg($src)
{
return Stringy::collapseWhitespace(
File::get(statamic_path("resources/dist/svg/{$src}.svg"))
);
} | [
"public function inlineSvg()\n\t{\n\t\techo $this->getInlineSvg();\n\t}",
"private function OutputSVG()\n {\n\t$filename = $this->model->filename;\n\n\theader(\"Content-Disposition: attachment; filename=$filename.svg\");\n\theader(\"Content-Type: \" . $this->model->type);\n\techo $this->model->svg;\n\n\tYii::app()->end();\n }",
"function full_stack_entrepreneurship_output_inline_svg( $html ) {\n\t$logo_id = get_theme_mod( 'custom_logo' ); //made by wp with add_theme_support\n\n\tif ( get_post_mime_type( $logo_id ) == 'image/svg+xml' ) {\n\t\t$image = get_attached_file( $logo_id );\n\t\t$html = preg_replace( \"/<img[^>]+\\>/i\", file_get_contents( $image ), $html );\n\t}\n\n\treturn $html;\n}",
"function inline_svg( $svg ) {\n\tdo_action( 'inline_svg', $svg );\n}",
"function print_svg($file){\n $iconfile = new \\DOMDocument();\n $iconfile->load($file);\n $tag = $iconfile->saveHTML($iconfile->getElementsByTagName('svg')[0]);\n return $tag;\n}",
"function esc_svg( $inline_svg, $echo = false ) {\n\n\t\t$kses_defaults = wp_kses_allowed_html( 'post' );\n\n\t\t$svg_args = array(\n\t\t\t'svg' => array(\n\t\t\t\t'class' => true,\n\t\t\t\t'aria-hidden' => true,\n\t\t\t\t'aria-labelledby' => true,\n\t\t\t\t'role' => true,\n\t\t\t\t'xmlns' => true,\n\t\t\t\t'width' => true,\n\t\t\t\t'height' => true,\n\t\t\t\t'viewbox' => true,\n\t\t\t),\n\t\t\t'g' => array( 'fill' => true ),\n\t\t\t'title' => array( 'title' => true ),\n\t\t\t'path' => array(\n\t\t\t\t'd' => true,\n\t\t\t\t'fill' => true,\n\t\t\t),\n\t\t);\n\n\t\t$allowed_tags = array_merge( $kses_defaults, $svg_args );\n\t\tif ( $echo ) {\n\t\t\techo wp_kses( $inline_svg, $allowed_tags );\n\t\t} else {\n\t\t\treturn wp_kses( $inline_svg, $allowed_tags );\n\t\t}\n\n\t}",
"function inline_svg($name) {\n $file = get_template_directory();\n $file .= \"/images/svg/\" . $name . \".svg\";\n include($file);\n}",
"function inline_svg($name) {\n\t$file = get_template_directory();\n\t$file .= \"/assets/svg/\" . $name . \".svg\";\n\tinclude($file);\n}",
"public function getInlineSvg(): string\n\t{\n\t\treturn $this->getSanitizer()->sanitize(parent::getInlineSvg());\n\t}",
"private static function svg_style() {\n if (WP_DEBUG) {\n $style = file_get_contents ( self::$_plugin_dir. 'css/manage-svg.css' );\n } else {\n $style = file_get_contents ( self::$_plugin_dir. 'dist/manage-svg.css' );\n }\n return '<style><![CDATA[' . $style . ']]</style>';\n }",
"abstract public function renderSvg(array $options = array());",
"function drawSVG($icon) { // echo html\n $svg = getSVG($icon);\n extract($svg);\n\n echo '\n<!--[if lt IE 9 ]><img class=\"icon '.$icon.'\" src=\"'.get_template_directory_uri().'/images/icon-'.$icon.'.png\" /><![endif]-->\n<!--[if (gt IE 8)]><!-->\n<svg class=\"icon svg '.$icon.'\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\" width=\"'.$w.'px\" height=\"'.$h.'px\" viewBox=\"0 0 '.$w.' '.$h.'\" enable-background=\"new 0 0 '.$w.' '.$h.'\" xml:space=\"preserve\">\n <g>\n <path '.$rules.' fill=\"'.$fill.'\" d=\"'.$path.'\"/>\n </g>\n</svg>\n<!--<![endif]-->\n ';\n}",
"function svg($icon_name, $height, $width)\n{\n $dir_name = get_stylesheet_directory();\n $url = \"{$dir_name}/dist/icons/svg/icon-{$icon_name}.svg\";\n $url_png = \"{$dir_name}/dist/icons/png/icon-{$icon_name}.png\";\n $svg = file_get_contents($url);\n echo \"<div class='svg-icon {$icon_name}' style='height:{$height}; width:{$width};'>{$svg}</div>\";\n}",
"function x_display_hosting_icon()\n{\n?>\n\n<div class=\"svg-icon hosting\">\n <img src=\"skins/admin/images/icon-hosting.svg\" />\n</div>\n\n<?php\n}",
"public function svg_icon($filename) {\n if (!isset($filename)) {\n $filename = 'drupal.svg';\n }\n $icon_path = DRUPAL_ROOT . '/libraries/simple-icons/icons/' . $filename;\n\n // Get the icon's file contents.\n $icon = file_get_contents($icon_path);\n\n // Return the icon as a markup object (@todo determine XSS risk)\n return Markup::create($icon);\n }",
"function svg($filename, $return = false, $content = true, $dir = 'assets/dist/svg')\n{\n $dir = mb_substr($dir, 0, 1) == '/' ? mb_substr($dir, 1, mb_strlen($dir)) : $dir;\n $dir = mb_substr($dir, -1, 1) == '/' ? mb_substr($dir, 0, mb_strlen($dir) - 1) : $dir;\n $path = get_template_directory() . '/' . $dir . '/' . $filename . '.svg';\n if ($return == false) {\n @require $path;\n } else {\n if ($content = true) {\n return file_get_contents($path);\n } else {\n return $path;\n }\n }\n}",
"public function asSVG()\n {\n $output = $this->_svg();\n\n return $output;\n }",
"function svg_map_shortcode($atts) {\n\n ob_start();\n\n include(STYLESHEETPATH.'/map.svg');\n\n $content = ob_get_clean();\n return $content;\n}",
"function renderSVG($image) {\n\t\t// In essence, we don't have to embed the svg image ourselves, but it is\n\t\t// imperative that we know the size of the object, otherwise it will clip.\n\t\t$fp = fopen($image['file'],'r');\n\t\t$data = fread($fp, 200);\n\t\tfclose($fp);\n\t\t$parts = explode('><', $data);\n\t\t$dimensions = preg_replace('/.*style=\"width:(\\d+);height:(\\d+);\".*/', 'width=${1} height=${2}', $parts[1]);\n\n\t\t#\t'width=\"'.$width.'\"'.' height=\"'.$height.'\">'.\n\t\treturn '<object class=\"plantuml\" type=\"image/svg+xml\" data=\"'.$image['src'].'\" '.\n\t\t\t $dimensions.\n\t\t\t '>Your browser has no SVG support. '.\n\t\t\t 'Please install <a href=\"http://www.adobe.com/svg/viewer/install/\">Adobe '.\n\t\t\t 'SVG Viewer</a> plugin (for Internet Explorer) or use <a href=\"'.\n\t\t\t 'http://www.getfirefox.com/\">Firefox</a>, <a href=\"http://www.opera.com/\">'.\n\t\t\t 'Opera</a> or <a href=\"http://www.apple.com/safari/download/\">Safari</a> '.\n\t\t\t 'instead.'.\n\t\t\t '</object>';\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Allow guest posts and threads only if he agreed to the terms of use | function agreement_guest_post(&$dh)
{
global $mybb, $lang;
// Function enabled?
if (isset($mybb->settings['ag_guest_post']) && $mybb->settings['ag_guest_post'] == 1) {
// Check if we have a guest
if ($mybb->user['uid'] == 0 && $dh->method == "insert") {
$terms_agreed = $mybb->get_input('guestterms', MyBB::INPUT_INT);
// Box was not checked, display error
if ($terms_agreed != 1) {
if (!isset($lang->ag_guestterms_notaccepted)) {
$lang->load('agreement');
}
$dh->set_error($lang->ag_guestterms_notaccepted);
}
}
}
} | [
"function acceptTerms() {\r\n global $USER;\r\n if($USER->ID == $this->ID) {\r\n $this->AcceptedTerms = time();\r\n }\r\n }",
"function cot_blockguests()\n{\n\tglobal $env, $usr, $sys;\n\n\tif ($usr['id'] < 1)\n\t{\n\t\t$env['status'] = '403 Forbidden';\n\t\tcot_redirect(cot_url('message', \"msg=930&\".$sys['url_redirect'], '', true));\n\t}\n\treturn FALSE;\n}",
"protected function check_assign_terms_permission($request)\n {\n }",
"function block_non_author(){\n\t$active_on_post_types = ['post'];//array of post types you want to protect\n\t$active_on_user_roles = ['editor'];//array of user roles you want to block\n\tglobal $post;\n\t$screen = get_current_screen();\n\t$user = wp_get_current_user();\n\tif($screen->parent_base == 'edit' && in_array($screen->post_type,$active_on_post_types ) && in_array($user->roles[0],$active_on_user_roles ) && $post->post_author != $user->ID){\n\t\tdie('you are not the author of this post');//block with a massage\n\t\t// wp_redirect(home_url( '/wp-admin' ));//redirect to dashboard\n\t}\n}",
"public function user_can_post() {\n\t\treturn rcp_is_active() && ! $this->is_at_jobs_limit();\n\t}",
"public function postTerms()\n {\n Auth::user()->acceptTerms();\n return redirect()->to('/admin');\n }",
"protected function getUserCanPublishPostsAndPagesConditionalService()\n {\n }",
"function user_restrict_to_guests() : void\n{\n // Fetch the user's language\n $lang = user_get_language();\n\n // Prepare the error message that will be displayed\n $error_message = ($lang === 'EN') ? \"This page cannot be used while logged into an account.\" : \"Cette page n'est pas utilisable lorsque vous êtes connecté à un compte.\";\n\n // If the user is logged in, throw the error\n if(user_is_logged_in())\n error_page($error_message);\n}",
"public function check_read_terms_permission_for_post($post, $request)\n {\n }",
"public function cf_privacy_checkbox() {\n\t\t\t// First, we get the contact form ID's from the posts table.\n\t\t\t$forms = $this->get_forms();\n\n\t\t\t// Next, we add the acceptance tag to the CF template.\n\t\t\t$this->update_template( $forms );\n\t\t}",
"function resume_manager_user_can_post_resume() {\n\t$can_post = true;\n\n\tif ( ! is_user_logged_in() ) {\n\t\tif ( resume_manager_user_requires_account() && ! resume_manager_enable_registration() ) {\n\t\t\t$can_post = false;\n\t\t}\n\t}\n\n\treturn apply_filters( 'resume_manager_user_can_post_resume', $can_post );\n}",
"public function maybe_restrict_form() {\n\t\tglobal $post;\n\n\t\tif ( $this->is_review_status( 'closed' ) || $this->is_review_status( 'disabled' ) ) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif ( $this->is_guest_reviews_enabled() ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t$user = wp_get_current_user();\n\t\t$user_id = ( isset( $user->ID ) ? (int) $user->ID : 0 );\n\n\t\tif ( ( edd_get_option( 'edd_reviews_only_allow_reviews_by_buyer', false ) && edd_has_user_purchased( $user_id, $post->ID ) ) || ( ! edd_get_option( 'edd_reviews_only_allow_reviews_by_buyer', false ) ) ) {\n\t\t\treturn false;\n\t\t} else {\n\t\t\treturn true;\n\t\t}\n\t}",
"public function guestsMayNotCreateThreads()\n {\n $this->withExceptionHandling();\n\n $this->get(route('threads.create'))\n ->assertRedirect(route('login'));\n\n $this->post(route('threads.store'))\n ->assertRedirect(route('login'));\n\n }",
"public function authorizePatch()\n {\n return $this->user()->can('terms.update');\n }",
"function mgm_bbp_content_protection($have_posts){\r\n\t//bbp forum id\r\n\t$forum_id = bbp_get_forum_id();\t\r\n\t//check - issue #1743\r\n\tif($forum_id){\r\n\t\t//check user access\r\n\t\tif(is_super_admin() || mgm_user_has_access($forum_id,false)) {\r\n\t\t\t//return\r\n\t\t\treturn $have_posts;\r\n\t\t}else {\t\r\n\t\t\t$have_posts = null;\r\n\t\t\t//no access for create topics/replies\r\n\t\t\tadd_filter( 'bbp_current_user_can_access_create_topic_form','mgm_bbp_user_no_access');\r\n\t\t\tadd_filter( 'bbp_current_user_can_publish_replies','mgm_bbp_user_no_access');\r\n\t \t}\r\n\t} \r\n \treturn $have_posts;\r\n}",
"public function isGuestAllowed()\n {\n return Mage::getStoreConfigFlag('productreviews/general/guest_allowed');\n }",
"function is_ticket_post_staff_only($post)\n{\n\tif (get_forum_type()!='ocf')\n\t\treturn false;\n\treturn ((!is_null($post['p_intended_solely_for'])) && (is_guest($post['p_intended_solely_for'])));\n}",
"public function markTermsAsAccepted();",
"function invit0r_restrict_admin()\r\n{\r\n\tif ( !current_user_can('manage_options') ) {\r\n\t\twp_die( __('You are not allowed to access this part of the site.') );\r\n\t}\r\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a new relation in the "field_analyte_location" table based on the passed task_id, location_id | public static function CreateFALocationRelationForFT($caller, $task_id, $location_id) {
//Get the Field data for this task id
//FIELD Analyte
$tfaDAO = new \Applications\PMTool\Models\Dao\Task_field_analyte();
$tfaDAO->setTask_id($task_id);
$dal = $caller->managers()->getManagerOf("TaskFieldAnalyte");
$relation_data = $dal->selectMany($tfaDAO, "task_id");
//Loop on the above and start preparing data for "field_analyte_location"
if(count($relation_data) > 0) {
$manager = $caller->managers()->getManagerOf('FieldAnalyteLocation');
foreach($relation_data as $fa_rec) {
//Check if the relationship is not already existing
if(!$manager->ifMatrixDataExistsFor($task_id, $location_id, $fa_rec->field_analyte_id())) {
//Add to the "field_analyte_location" table
$data = array(
'task_id' => $task_id,
'location_id' => $location_id,
'field_analyte_id' => $fa_rec->field_analyte_id(),
'field_analyte_location_result' => ''
);
//Init PDO
$field_analyte_location = \Applications\PMTool\Helpers\CommonHelper::PrepareUserObject($data, new \Applications\PMTool\Models\Dao\Field_analyte_location());
$result_save_relation = $manager->add($field_analyte_location);
}
}
}
} | [
"public function createLocationGroup();",
"protected function migrateLocationsIntoLocationTable(): bool\n {\n /** @var ConnectionPool $connectionPool */\n $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);\n $connectionJoblocations = $connectionPool->getConnectionForTable('tx_googleforjobs_domain_model_joblocation');\n $connectionJoblocationsMM = $connectionPool->getConnectionForTable('tx_googleforjobs_domain_model_job_joblocation_mm');\n\n $jobs = $this->getJobData();\n\n foreach ($jobs as $job) {\n // get location data for database insertion \n $identifiers = [\n 'street_address' => $job['job_location_street_address'],\n 'city' => $job['job_location_city'],\n 'postal_code' => $job['job_location_postal_code'],\n 'region' => $job['job_location_region'],\n 'country' => $job['job_location_country']\n ];\n $joblocation = $identifiers;\n $joblocation['pid'] = $job['pid'];\n \n // check if location doesn't already exist and write it into location table\n $locationExists = false;\n $locationExists = $connectionJoblocations->select(['uid'], 'tx_googleforjobs_domain_model_joblocation', $identifiers)->fetchAll();\n if (!$locationExists) {\n $connectionJoblocations->insert('tx_googleforjobs_domain_model_joblocation', $joblocation);\n }\n\n // set mn relation\n $locationUid = $connectionJoblocations->select(['uid'], 'tx_googleforjobs_domain_model_joblocation', $identifiers)->fetch();\n $connectionJoblocationsMM->insert(\n 'tx_googleforjobs_domain_model_job_joblocation_mm',\n ['uid_local' => $locationUid['uid'], 'uid_foreign' => $job['uid'],\n 'sorting_foreign' => 1]\n );\n }\n \n return true;\n }",
"private function _insert_new_permission($module, $location_id, $location_name) {\n $permission_id = $module . '_' . $location_name;\n $permission_data = array('permission_id' => $permission_id, 'module_id' => $module, 'location_id' => $location_id);\n $this->db->insert('permissions', $permission_data);\n\n// insert grants for new permission\n $employees = $this->Employee->get_all();\n foreach ($employees->result_array() as $employee) {\n $grants_data = array('permission_id' => $permission_id, 'person_id' => $employee['person_id']);\n $this->db->insert('grants', $grants_data);\n }\n }",
"public function addLocation($location);",
"private function createRelation()\n {\n $this->actingAs($this->company, 'api')\n ->withHeaders(['Accept' => 'Application/json'])\n ->json('POST', 'api/addFidelityPoint', ['scanned_user_id' => $this->user->id])\n ->assertStatus(201)\n ->assertJson([\n \"status\" => \"The relation between user and company is created.\",\n \"number_of_points\" => 1\n ]);\n }",
"function couponxl_process_locations( $location, $offer_id ){\r\n\t\t$locations = explode( ',', $location );\r\n\t\t$last_parent = 0;\r\n\t\t$location_hierarchicy = array();\r\n\t\tforeach( $locations as $location ){\t\t\t\t\r\n\t\t\t$term = term_exists( $location, 'location');\r\n\t\t\tif ( !$term ) {\r\n\t\t\t\t$term = wp_insert_term(\r\n\t\t\t\t\t$location,\r\n\t\t\t\t\t'location',\r\n\t\t\t\t\tarray(\r\n\t\t\t\t\t\t'parent' => $last_parent\r\n\t\t\t\t\t)\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t\t$last_parent = $term['term_id'];\r\n\t\t\t$location_hierarchicy[] = $term['term_id'];\t\t\t\r\n\t\t}\r\n\r\n\t\twp_set_post_terms( $offer_id, $location_hierarchicy, 'location', true );\r\n\t}",
"public function createLocationGroup()\n\t{\n if (!$this->permissionResolver->canUser('locating', 'create', 'location')) \n {\n throw new UnauthorizedException(\n 'Locating',\n 'create',\n array(\n \t'locating_type' => 'location'\n )\n );\n }\n \n try\n {\n\t\t\t$locationGroup = $this->relatingService->createRelation(\n\t\t\t\t'group', \n\t\t\t $this->typeMeaningHelper->locatingIsLocation->getType()\n\t\t\t);\n\t\t}\n\t\tcatch(Exception $e)\n\t\t{\n\t\t\tthrow $e;\n\t\t}\n\t\t\n\t\treturn $locationGroup;\n\t}",
"public function created(Location $location)\n {\n $location->setWeatherLocation();\n }",
"public function createRoute()\n {\n if ($this->mapType !== 'country' && $this->mapType !== 'hotel') {\n $this->endPos=trim($this->destination->longtiude).','.trim($this->destination->latitude);\n // dd($this->endPos);\n }\n if ($this->currentUserLocation) {\n $this->emit('createRoute',['startPos'=> $this->currentUserLocation , 'endPos'=>$this->endPos]);\n return;\n }\n // \\dd($this->hotelLocation);\n $this->emit('createRoute',['startPos'=> $this->hotelLocation , 'endPos'=>$this->endPos]);\n }",
"private function persistAddress($location)\n {\n $location->address()->create([\n\n 'address' => $this->generateAddress($location),\n 'agent_id' => $this->agent_id\n\n ]);\n }",
"public function saveApartmentLocation($apartmentId, $location)\n {\n \t// let's save it step by step\n\n \t// common condition\n \t$where = ['apartment_id' => $apartmentId];\n $apartmentGeneralDao = $this->getApartmentGeneralDao();\n \t$generalData = [\n \t\t'province_id' => $location['province_id'],\n \t\t'city_id' => $location['city_id'],\n \t\t'address' => $location['address'],\n \t\t'postal_code' => $location['postal_code'],\n \t\t'block' => $location['block'],\n \t\t'floor' => $location['floor'],\n \t\t'unit_number' => $location['unit_number'],\n \t];\n\n if(isset($location['country_id'])) {\n $locationData = $apartmentGeneralDao->fetchOne(['id' => $apartmentId]);\n\n if($locationData && $locationData['country_id'] == null) { // null - value set then create new apartment\n $generalData['country_id'] = $location['country_id'];\n $countryDao = $this->getServiceLocator()->get('dao_geolocation_countries');\n $countryData = $countryDao->fetchOne(['id' => (int)$location['country_id']]);\n if($countryData && $countryData->getCurrencyId()) {\n $generalData['currency_id'] = $countryData->getCurrencyId();\n }\n }\n\n }\n \t$geoLocationData = [\n \t\t'x_pos' => $location['longitude'],\n \t\t'y_pos' => $location['latitude'],\n \t];\n\n $apartmentLocationDao = $this->getApartmentLocationDao();\n $currentState = $apartmentLocationDao->getApartmentLocation($apartmentId);\n\n /* @var $apartmentGroupItemsDao ApartmentGroupItems */\n $apartmentGroupItemsDao = $this->getServiceLocator()->get('dao_apartment_group_apartment_group_items');\n $apartments = $apartmentGroupItemsDao->getApartmentGroupItems($currentState->getBuildingID(), true);\n\n /* @var $apartmentsGeneralDao ApartmentGeneral */\n $apartmentsGeneralDao = $this->getServiceLocator()->get('dao_apartment_general');\n\n if (!$currentState->getBuildingID()) {\n\n $apartmentGroupItemsDao->insert([\n 'apartment_group_id' => $location['building'],\n 'apartment_id' => $apartmentId\n ]);\n\n $apartmentsGeneralDao->update(\n [\n 'building_id' => $location['building'],\n 'building_section_id' => $location['building_section']\n ],\n ['id' => $apartmentId]\n );\n } elseif ($currentState->getBuildingID() != $location['building']) {\n foreach ($apartments as $apartment) {\n if ($apartmentId == $apartment->getApartmentId()) {\n // move to other building\n $apartmentGroupItemsDao->delete(['id' => $apartment->getId()]);\n $apartmentGroupItemsDao->insert([\n 'apartment_group_id' => $location['building'],\n 'apartment_id' => $apartmentId\n ]);\n\n $apartmentsGeneralDao->update(\n [\n 'building_id' => $location['building'],\n 'building_section_id' => $location['building_section']\n ],\n ['id' => $apartmentId]\n );\n }\n }\n } elseif ($currentState->getBuildingID() == $location['building'] && $currentState->getBuildingSectionId() != $location['building_section']) {\n $apartmentsGeneralDao->update(\n [\n 'building_id' => $location['building'],\n 'building_section_id' => $location['building_section']\n ],\n ['id' => $apartmentId]\n );\n\n // Remove unused spots if change section\n /* @var \\DDD\\Dao\\Apartment\\Spots $apartmentSpotsDao */\n $apartmentSpotsDao = $this->getServiceLocator()->get('dao_apartment_spots');\n $apartmentSpotsDao->removeUnusedSpots($apartmentId, $location['building_section']);\n }\n\n \t$resultGeneral = $apartmentGeneralDao->save($generalData, ['id' => $apartmentId]);\n \t$resultGeoLocation = $apartmentLocationDao->save($geoLocationData, $where);\n\n \treturn $resultGeneral && $resultGeoLocation;\n }",
"public function addLocationNode(LocationInterface $node);",
"public function createPlace($id);",
"private function seed_locations()\n {\n $location1 = Location::create([\n 'name' => 'Owl Books, New York',\n 'address' => '1 Broadway, New York, NY, United States'\n ]);\n $location2 = Location::create([\n 'name' => 'Owl Books, San Francisco',\n 'address' => '1 2nd St, San Francisco, CA, United States'\n ]);\n $location3 = Location::create([\n 'name' => 'Owl Books, Chicago',\n 'address' => '1 Main Street, Chicago, IL, United Statess'\n ]);\n }",
"public function setDepartureLocation($location);",
"public function addLocation(string $location): void;",
"public function addLocation(Recipe $r, Location $l);",
"public function addLocation(string $location);",
"function create_location($organization_id , $primary , $address , $city , $state , $zip , $latitude , $longitude , $email1 = \"\", $email2 = \"\", $phone1 = \"\", $phone2 = \"\")\n {\n \t$sql = \"insert into organization_location set organization_id ={$organization_id}, is_primary ={$primary}, address ='{$address}', city ='{$city}', state ='{$state}', zip ='{$zip}', latitude = {$latitude}, longitude = {$longitude}, modified_time = now()\";\n \tif($email1 != \"\")\n \t\t$sql = $sql.\", email1 = '{$email1}'\";\n \tif($email2 != \"\")\n \t\t$sql = $sql.\", email2 = '{$email2}'\";\n \tif($phone1 != \"\")\n \t\t$sql = $sql.\", phone1 = '{$phone1}'\";\n \tif($phone2 != \"\")\n \t\t$sql = $sql.\", phone2 = '{$phone2}'\";\n \t\n \t$this->db->query($sql);\n \t\n \t// TODO this could return a different id than expected (two created almost simultaneously)\n \t$sql = \"select location_id from organization_location order by location_id DESC limit 1\";\n return $this->db->query($sql);\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method to set the value of field dlyp_area_3 | public function setDlypArea3($dlyp_area_3)
{
$this->dlyp_area_3 = $dlyp_area_3;
return $this;
} | [
"public function setArea(int $area);",
"public function getDlypArea3()\n {\n return $this->dlyp_area_3;\n }",
"public function setArea()\n {\n $this->area = $this->sides->getArea();\n }",
"public function setArea()\n {\n $this->area = pi() * pow($this->radius, 2);\n }",
"public function setArea(Area $area)\n {\n $this->area = $area;\n }",
"public function setBlockVarActivitiesarea($value)\n {\n $this->setVar(\"area\",$value);\n }",
"public function setAreaId3($area_id_3)\n {\n $this->area_id_3 = $area_id_3;\n\n return $this;\n }",
"public function setArea($area)\n {\n $this->area = $area;\n return $this;\n }",
"public function getDlypArea1()\n {\n return $this->dlyp_area_1;\n }",
"public function setAreaID($value) {\n return $this->set(self::AREAID, $value);\n }",
"private function setAreaCode($areaCode)\n {\n $this->areaCode = $areaCode;\n }",
"public function get_area_id() {\n return $this->areaid;\n }",
"public function setAreaId($value)\n {\n return $this->set(self::area_id, $value);\n }",
"public function getArea_id(){\n return $this->area_id;\n }",
"public function assignArea(Area $area)\n {\n $this->area()->associate($area->id)->save();\n }",
"function set($content_area, $value)\n\t{\n\t\t$this->template_data[$content_area] = $value;\n\t}",
"public function setAreaUnit(?string $areaUnit): void\n {\n $this->areaUnit = $areaUnit;\n }",
"public function setGeomArea($var)\n {\n GPBUtil::checkString($var, True);\n $this->geom_area = $var;\n\n return $this;\n }",
"public function setAreaCode($areaCode)\n {\n $this->areaCode = $areaCode;\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse the HTTP version | protected function http_version()
{
} | [
"public function http_version()\n\t{\n\t\treturn $this->_version;\n\t}",
"public function testHttpVersion() {\n $parser = new Parser();\n $request = new Request();\n\n $parser->request($request);\n\n $this->assertNull($parser->httpVersion());\n $this->assertEquals('first', $parser->httpVersion('first'));\n $this->assertEquals('first', $parser->httpVersion());\n $this->assertEquals('second', $parser->httpVersion('second'));\n $this->assertEquals('second', $parser->httpVersion());\n }",
"public function getHTTPVersion() {\n\n $protocol = $this->getRawServerValue('SERVER_PROTOCOL');\n if ($protocol==='HTTP/1.0') {\n return '1.0';\n } else {\n return '1.1';\n }\n\n }",
"protected function http_version()\n {\n }",
"public function getHttpVersion()\n\t{\n\t\tif($this->_httpVersion===null)\n\t\t{\n\t\t\tif(isset($_SERVER['SERVER_PROTOCOL']) && $_SERVER['SERVER_PROTOCOL']==='HTTP/1.0')\n\t\t\t\t$this->_httpVersion='1.0';\n\t\t\telse\n\t\t\t\t$this->_httpVersion='1.1';\n\t\t}\n\t\treturn $this->_httpVersion;\n\t}",
"function getHttpVersion() {\r\n return $this->_http_version;\r\n }",
"public function getHttpVersion() {\r\n\t\treturn $this->_httpVersion;\r\n\t}",
"public function getHttpVersion()\n {\n return $this->_httpVersion;\n }",
"public function getHttpVersion()\n {\n return $this->httpVersion;\n }",
"function apache_get_version(){}",
"public function parse($versionString);",
"public static function extractVersion($response_str)\n {\n preg_match(\"|^HTTP/([\\d\\.x]+) \\d+|\", $response_str, $m);\n\n if (isset($m[1])) {\n return $m[1];\n } else {\n return false;\n }\n }",
"public function getResponseVersion();",
"protected function getHttpVersion(): int\n {\n\t$http_version = CURL_HTTP_VERSION_1_1;\n\t$curlopt = getenv('CURLOPT_HTTP_VERSION');\n\tswitch ($curlopt) {\n\t case false:\n break;\n case 'CURL_HTTP_VERSION_1_0':\n $http_version = constant($curlopt);\n break;\n case 'CURL_HTTP_VERSION_1_1':\n $http_version = constant($curlopt);\n break;\n case 'CURL_HTTP_VERSION_2':\n $http_version = constant($curlopt);\n break;\n case 'CURL_HTTP_VERSION_2_0':\n $http_version = constant($curlopt);\n break;\n default:\n\t\techo \"Unknown HTTP version $curlopt, continuing anyway\";\n\t\t$http_version = 0;\n }\n\treturn $http_version;\n }",
"public function getRequestVersion();",
"public function setHttpVersion($version) {}",
"public function get_api_version_header();",
"public function getHttpVersion() {\n\n return $this->inner->getHttpVersion();\n\n }",
"public static function getVersion() {\n exec('apache2 -v', $ary, $ret);\n $line = $ary[0];\n $ary = explode(':', $line);\n $ary[1];\n $ary = explode('/', $ary[1]);\n preg_match(\"/\\d+(\\.\\d+)+/\", $ary[1], $matches);\n return $matches[0];\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the active password clients | public function clientList()
{
return $this->client()->latest()
->where('password_client', true)
->where('revoked', false)->get()
->makeVisible('secret');
} | [
"public static function get_clients_password($params = array()) {\n $params['action'] = 'getclientpassword';\n return self::send_request($params);\n }",
"public function getClients();",
"private function getClientList()\n {\n return Client::get()\n ->filter(['active' => true])\n ->sort('LastFetch')\n ;\n }",
"public function getPasswordGrantClient()\n {\n return $this->clients->where('password_client', true)->first();\n }",
"public function getClients()\n {\n return $this->clients;\n }",
"public function getClients()\n {\n return $this->clients;\n }",
"function get_all()\n {\n $clients = $this->query(\"SELECT * FROM clients WHERE admin_id='\" .$_SESSION['auth_id']. \"'\");\n\t\t\n return $clients;\n }",
"public function getClients(){\n return $this->clients;\n }",
"public function obtainAllClients()\n {\n return $this->performRequest('GET', 'clients');\n }",
"public function getClients() {\n\n return $this->clients;\n\n }",
"public function getTunnelClients()\n {\n return $this->tunnelClients;\n }",
"protected function getClients()\n {\n /* @var $collection \\yii\\authclient\\Collection */\n $collection = Yii::$app->get($this->clientCollection);\n\n return $collection->getClients();\n }",
"public function getActivatedAccounts()\n {\n return $this->db->select('SELECT * FROM '.PREFIX.'users WHERE isactive = true');\n }",
"public function get_Clients() \n\t{\n\t\t$query = '';\n\t\t$result = '';\n\t\t$clients = array();\n\n\t\tswitch( $this->db_link->getDriver() )\n\t\t{\n\t\t\tcase 'sqlite':\n\t\t\tcase 'mysql':\n\t\t\tcase 'pgsql':\n\t\t\t\t$query = \"SELECT Client.ClientId, Client.Name FROM Client \";\n\t\t\t\tif( $this->bwcfg->get_Param( 'show_inactive_clients' ) )\n\t\t\t\t\t$query .= \"WHERE FileRetention > '0' AND JobRetention > '0' \"; \n\t\t\t\t$query .= \"ORDER BY Client.Name;\";\n\t\t\tbreak;\n\t\t}\n\n\t\t$result = $this->db_link->runQuery($query);\n\t\t\t\n\t\tforeach( $result->fetchAll() as $client )\n\t\t\t$clients[ $client['clientid'] ] = $client['name'];\n\t\t\t\t\n\t\treturn $clients;\t\t\n\t}",
"public function getClients(){\n\t\treturn $this->get(\"/client\");\n\t}",
"private function getClient()\n {\n return app(Environment::class)->tenant()?\n PassportClient::firstWhere('password_client', PassportGrantTypes::PASSWORD_GRANT):\n Client::firstWhere('password_client', PassportGrantTypes::PASSWORD_GRANT);\n }",
"public function getConnectionsCredentials()\n {\n $connectionName = null;\n if ($this->connections) {\n $this->command->writeln('Here are the current connections defined:');\n $this->command->table(['Name', 'Server', 'Username', 'Password'], $this->connections);\n if ($this->command->confirm('Do you want to add a connection to this?')) {\n $connectionName = $this->command->ask('What do you want to name it?');\n }\n } else {\n $connectionName = $this->command->ask('No connections have been set, let\\'s create one, what do you want to name it?', 'production');\n }\n\n // If the user does not want to add any more connection\n // then we can quit\n if (!$connectionName) {\n return $this->connections;\n }\n\n $this->getConnectionCredentials($connectionName);\n\n return $this->getConnectionsCredentials();\n }",
"public function get_members(){\n return $this->connected_clients;\n }",
"public function getAll()\n {\n return self::$isp->getAllClients();\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Public: Get all available campaigns $name Optional, the exact name of the campaign to get You would usually use this to figure out what campaigns are available when calling add_to_campaign Returns an object containing all the campaigns that are available from the API | public function get_campaigns($name = NULL)
{
$params = new stdClass;
$params->source = 'MKTOWS';
if ($name)
{
$params->name = '';
$params->exactName = TRUE;
}
return $this->request('getCampaignsForSource', $params);
} | [
"Public Function GetCampaignByNameAPI($Name)\n\t{\n\t\t$Output = $this->GetAPI()->getCampaignUsingNameAll($Name);\n\t\treturn $Output;\n\t}",
"public function ListCampaigns() {\n\t\treturn $this->doQuery(\"campaigns\", \"GET\");\n\t}",
"public function getCampaigns()\n {\n $resource = 'campaigns.json';\n $client = new Client($this->getServiceUrl($resource));\n $request = $client->createRequest('GET');\n $request->setProtocolVersion('1.1');\n $request->setHeader('Authorization', $this->getOauthData());\n $request->setHeader('Host', $this->getServiceDomain());\n $request->setHeader('Accept', '*/*');\n $response = $this->sendRequest($request)->json();\n return $response['campaigns'];\n }",
"public function fetch_campaigns() {\r\n\t\treturn $this->get_data(\"campaigns\");\r\n\t}",
"public function fetch_campaigns()\n {\n return $this->get_data(\"campaigns\");\n }",
"public function getCampaignByName($name)\n\t{\n\t\t$response = $this->execute('get_campaigns', array('name' => array('EQUALS' => $name)));\n\n\t\treturn key($response);\n\t}",
"public function listCampaigns()\n\t{\n\t\t$url = $this->config['Config']['US']['BETA_API_URL'] . 'campaigns';\n\n\t\t$header = array(\n\t\t\t'Authorization: Bearer ' . $this->config['Config']['BETA_API_KEY']\n\t\t);\n\n\t\t$request = json_decode($this->cURLGet($url, $header));\n\t\treturn $request;\n\t}",
"function getAllCampaign()\n\t{\t\t\n\t\t$params = array(\n\t\t\t\t\t'Target' => 'AdManager'\t,\t\t\t\t\n\t\t\t\t\t'Method' => 'findAllCampaigns'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t);\n\t\t$result = $this->makeRequest($params);\n\t\t$result = $this->object_to_array($result);\t\t\t\t \t\t\n\t\treturn $result;\t\n\t}",
"public function getCampaigns()\n {\n return MyRadio_BannerCampaign::resultSetToObjArray($this->campaigns);\n }",
"static function getByCampaignName($campaign_name)\n {\n $query = EmailmarketingCampaignTemplate::\n join('email_marketing_campaign', 'email_marketing_campaign.id', 'email_marketing_campaign_templates.campaign_id');\n $query->join('template_emails', 'template_emails.id', 'email_marketing_campaign_templates.template_id');\n $query->where('email_marketing_campaign.name', $campaign_name);\n $result = $query->get()->toArray();\n if (count($result) > 0) return $result;\n return array();\n }",
"public function getAll()\n {\n return Context::get()->campaigns()->with('groups')->get();\n }",
"protected function get_available_campaigns() {\n\n\t\t/**\n\t\t * cache the campaigns during the current request\n\t\t */\n\t\tif ( ! empty( $this->campaigns ) ) {\n\t\t\treturn $this->campaigns;\n\t\t}\n\n\t\t$filtered = array();\n\n\t\t$all_campaigns = tve_ult_get_campaigns( array(\n\t\t\t'get_designs' => true,\n\t\t\t'get_events' => false,\n\t\t\t'get_settings' => false,\n\t\t\t'get_logs' => false,\n\t\t\t'only_running' => true,\n\t\t) );;\n\n\t\tforeach ( $all_campaigns as $campaign ) {\n\n\t\t\t/**\n\t\t\t * if the schedule for the campaign applies (e.g. the current time is in the required interval, or a cookie exists)\n\t\t\t * we continue checking if the display settings apply\n\t\t\t *\n\t\t\t */\n\t\t\tif ( ! isset( $manager ) ) {\n\t\t\t\trequire_once TVE_Ult_Const::plugin_path( 'inc/classes/display_settings/class-thrive-display-settings-manager.php' );\n\t\t\t\t$manager = new Thrive_Ult_Display_Settings_Manager();\n\t\t\t\t$manager->load_dependencies();\n\t\t\t}\n\n\t\t\t$saved_ptions = new Thrive_Ult_Campaign_Options( $campaign->ID );\n\t\t\t$saved_ptions->initOptions();\n\n\t\t\t$available = $saved_ptions->displayCampaign();\n\n\t\t\t/**\n\t\t\t * a campaign is available if it has display settings and also has designs other than shortcodes\n\t\t\t */\n\t\t\tif ( $available && count( $campaign->designs ) ) {\n\t\t\t\t$other_than_shortcode = false;\n\t\t\t\tforeach ( $campaign->designs as $design ) {\n\t\t\t\t\tif ( $design['post_type'] !== TVE_Ult_Const::DESIGN_TYPE_SHORTCODE ) {\n\t\t\t\t\t\t$other_than_shortcode = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$available = $other_than_shortcode;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * TODO: why do we check here for shortcodes if the shortcodes campaigns are loaded separately ? see line 193: $shortcode_campaigns = TU_Shortcodes::get_campaigns();\n\t\t\t *\n\t\t\t * the campaign has no display settings and has no other designs than shortcode\n\t\t\t * but a shortcode design of campaign was used\n\t\t\t *\n\t\t\t * not sure why this check is made here\n\t\t\t */\n\t\t\tif ( ! $available && in_array( $campaign->ID, array_values( TU_Shortcodes::get_campaigns() ) ) ) {\n//\t\t\t\t$available = true;\n\t\t\t}\n\n\t\t\tif ( $available ) {\n\t\t\t\t$filtered [] = $campaign;\n\t\t\t}\n\t\t}\n\n\t\t$this->campaigns = $filtered;\n\n\t\treturn $filtered;\n\t}",
"public function campaigns()\n {\n return $this->hasMany(Campaign::class);\n }",
"private function fetchCampaigns() {\n $hash = $this->uri->segment(2);\n\n if( !$hash ) {\n show_error('Unknown campaign id');\n return;\n }\n\n $campaign = $this->Campaign_model\n ->where('campaigns.campaign_token', $hash)\n ->find();\n\n $opportunity = false;\n\n if( !count($campaign) || $campaign[0]->campaign_id ) {\n $opportunity = $this->Opportunity_model\n ->where('campaigns.campaign_token', $hash)\n ->find();\n }\n\n if( $opportunity && count($opportunity) ) {\n $opportunity = $opportunity[0];\n $campaign = $opportunity->campaign;\n } else {\n $campaign = $campaign[0];\n $opportunity = false;\n }\n\n return array(\n 'campaign' => $campaign,\n 'opportunity' => $opportunity\n );\n }",
"static function findByName($name) {\n $query = EmailmarketingCampaign::where('name', 'like', $name);\n $result = $query->get()->toArray();\n if (count($result) > 0) return $result;\n return array();\n }",
"public function getMailChimpCampaigns() {\n $result = $this->campaign->getCampaigns($this->default['campaign_fields']);\n if($result) {\n $count = $result['total_items'];\n if($count > 0) {\n return $result['campaigns'];\n }\n }\n return false;\n }",
"public function actionAllcampaigns()\n {\n $params = \\Yii::$app->request->getQueryParams();\n $defaultParams = array(\n 'status' => Campaign::STATUS_ACTIVE,\n 'offset' => 0,\n 'limit' => 0,\n 'sort' => '-id'\n );\n $user = $this->getUser();\n $params = array_merge($defaultParams, $params);\n /**\n * check params\n */\n // check status\n if (in_array($params['status'], array(Campaign::STATUS_ACTIVE, Campaign::STATUS_PENDING, Campaign::STATUS_DELETED)) == false) {\n $this->throwError(\"407\", \"status param is wrong\");\n }\n //check sort\n if (substr($params['sort'], 0, 1) == '-') {\n $params['sort'] = substr($params['sort'], 1);\n $orderAttr = 'DESC';\n } else {\n $orderAttr = 'ASC';\n }\n if (in_array($params['sort'], array('id', 'name', 'amountRaised', 'goalAmount')) == false) {\n $this->throwError(\"407\", \"sort prama is wrong\");\n }\n\n $sql = $user->getCampaigns($params['status'], false)->orderBy(sprintf('%s %s', $params['sort'], $orderAttr));\n if ($params['limit'] != 0) {\n $sql->offset($params['offset'])->limit($params['limit']);\n }\n $data = array();\n if ($sql->count() > 0) {\n foreach ($sql->all() as $capaign) {\n $data[] = array(\n 'id' => $capaign['id'],\n 'name' => $capaign['name'],\n 'description' => $capaign['description'],\n 'alias' => $capaign['alias'],\n 'amountRaised' => $capaign['amountRaised'],\n 'goalAmount' => $capaign['goalAmount'],\n 'type' => $capaign['type'],\n 'startDate' => $capaign['startDate'],\n 'endDate' => $capaign['endDate'],\n 'status' => $capaign['status'],\n 'numberOfDonations' => $capaign['numberOfDonations'],\n 'numberOfUniqueDonors' => $capaign['numberOfUniqueDonors'],\n 'date' => $capaign['date']\n );\n }\n }\n return $data;\n }",
"function get_campaigns( $args = array() ) {\n\t\t$campaigns = false;\n\t\tif ( $response = $this->get_response( 'campaign', $args ) ) {\n\t\t\t$campaigns = array();\n if ( $response->result->total_results >= 200 ) {\n $limit = 200;\n } else {\n $limit = $response->result->total_results;\n\n }\n\n for( $i = 0; $i < $limit; $i++ ) {\n $campaign = (object)$response->result->campaign[$i];\n if ( isset($campaign->id) ) {\n $campaigns[(int)$campaign->id] = $this->SimpleXMLElement_to_stdClass( $campaign );\n }\n }\n\n if ( $limit >= 200 ) {\n\t $numpag = round($response->result->total_results/200)+1;\n\t for( $j = 2; $j <= ($numpag); $j++ ) {\n\t if ( $response = $this->get_response( 'campaign', $args, 'result', $j ) ) {\n\t for( $i = 0; $i < ($response->result->total_results-200); $i++ ) {\n\t $campaign = (object)$response->result->campaign[$i];\n\t if ( isset($campaign->id) ) {\n\t $campaigns[(int)$campaign->id] = $this->SimpleXMLElement_to_stdClass( $campaign );\n\t }\n\t }\n\t }\n\t }\n }\n\n\t\t}\n\t\treturn $campaigns;\n\t}",
"public static function get_all_campaigns()\r\n { \r\n // create and check connection\r\n $link = CheckrouteDatabase::connect();\r\n\r\n // query all available measurement campaigns\r\n $stmt = mysqli_prepare($link, \"SELECT x.id, x.name, x.description, COUNT(y.id_measurement) AS 'number_of_measurements' FROM MeasurementCampaign AS x, Campaign_has_Measurement AS y WHERE x.id = y.id_campaign GROUP BY x.id\");\r\n if ($stmt) {\r\n mysqli_stmt_execute($stmt);\r\n //mysqli_stmt_bind_result($stmt, $result_sql);\r\n\r\n $result = array();\r\n while (mysqli_stmt_fetch($stmt)) {\r\n $result[] = $result_sql;\r\n }\r\n mysqli_stmt_close($stmt);\r\n }\t\t\r\n\r\n // close database connection\r\n mysqli_close($link);\r\n \r\n return $result;\r\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
End oembed_video_output() Find the source of the video based on URL | public function get_embedded_video_source ( $url ) {
$video_id = parse_url($url, PHP_URL_QUERY);
$video_host = parse_url($url, PHP_URL_HOST);
$video_source='';
if($video_host === ("youtu.be") || $video_host === ("www.youtube.com")) {
$video_source = 'youtube';
} else if($video_host === ("vimeo.com")) {
$video_source = 'vimeo';
} else if (fnmatch('*.wistia.com', $video_host) ) {
$video_source = 'wistia';
}
return $video_source;
} | [
"public function get_video_from_url()\n {\n $url = $this->input->post('url', true);\n\n $this->load->library('video_url_parser');\n echo $this->video_url_parser->get_url_embed($url);\n\n }",
"function get_url_video_search($url) {\n//-- the system to search for videos on YouTube does not use the API, it only uses the plugin --> simple_html_dom.inc.php\t\t\n\t\t$count = preg_match_all('/v=([^&]+)/',$url,$matches);\n\t\tif ($count > 0) {\n\t\t\tfor($i = 0; $i < $count; $i++) {\n\t\t\t\t$meta = get_tags('https://www.youtube.com/watch?v='.$matches[1][$i]);\t\n\t\t\t\t$output = '\t\t\n\t\t\t\t\t<div class=\"video_info_content\">\n\t\t\t\t\t<img class=\"img_thumbnails\" src=\"'.$meta['image'].'\" alt=\"\"></img>\n\t\t\t\t\t\t<div class=\"video_description\">\n\t\t\t\t\t\t\t<p class=\"text_video_titule_search\">'.utf8_decode($meta['title']).'</p>\n\t\t\t\t\t\t\t<p class=\"text_video_description\">'.utf8_decode($meta['description']).'</p>\n\t\t\t\t\t\t\t<a class=\"button_video_more\" data-toggle=\"modal\" data-target=\"#view-modal-media\" data-id=\"'.$matches[1][$i].'\" id=\"getMedia\" href=\"#\">Download</a>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>';\t\n\t\t\t\treturn $output;\t\n\t\t\t}\n\t\t} else {\n\t\t\t//return 'There was a problem loading this information';\n\t\t}\n\t}",
"function get_header_video_url()\n {\n }",
"function external_video( $link, $search )\n\t{\n\t\t$page = file_get_contents (str_replace( ' ', '+', $link) );\n\t\t$ini = strpos( $page, '<' . $search );\n\t\t$last = strpos( $page, $search . '>' );\n\t\tif ( $search == 'object'){ $last++ ; };\n\t\t$video_data = substr( $page, $ini, ( ($last+6)-$ini) );\n\t\t\n\t\treturn $video_data;\n\t}",
"function mainViewVideo()\n{\n ?>\n <embed type=\"application/x-mplayer2\" \n src=\"<?php echo TOP_DIR.\"/actions/file_download.php?imgid=\".$_GET['imgid'].\"&ignore=true\"; ?>\"\n width=\"<?php echo $this->stage_width; ?>\"\n height=\"<?php echo ($this->stage_height + 45); ?>\"\n transparentatstart=\"true\"\n autostart=\"true\"\n animationatstart=\"true\"\n showcontrols=\"true\"\n showaudiocontrols=\"true\"\n showpositioncontrols=\"true\"\n autosize=\"false\"\n showstatusbar=\"true\"\n displaysize=\"true\"\n hspace=\"4\">\n </embed>\n <br />\n <?php\n $this->printDownloadLink();\n}",
"function the_header_video_url() {}",
"protected function fetchVideo(): void\n {\n $matches = [];\n preg_match('~[\\'\"]([^\\'\"]+?\\.mp4(?:\\?[^\\'\"]+)?)[\\'\"]~', $this->getPageContent(), $matches);\n $videoUrl = $matches[1] ?? null;\n // if mp4 found\n if (!is_null($videoUrl) && strstr($videoUrl, 'ripsave.com') === false) {\n $this->saveVideo($videoUrl);\n return;\n }\n // try to find reddit gif mp4\n $matches = [];\n preg_match('~[\\'\"]([^\\'\"]+?\\.gif\\?format=mp4(?:\\&[^\\'\"]+)?)[\\'\"]~', $this->getPageContent(), $matches);\n $videoUrl = $matches[1] ?? null;\n // if mp4 found\n if (!is_null($videoUrl)) {\n $videoUrl = htmlspecialchars_decode($videoUrl);\n $this->saveVideo($videoUrl);\n return;\n }\n // if mp4 not found, try to find m3u8 playlist\n $videoUrl = Reddit::getTsUrl($this->getPageContent());\n if ($videoUrl) {\n $this->saveVideo($videoUrl);\n }\n }",
"function videoembed_veoh_parse_embed($url) {\n\tif (!preg_match('/(src=\"http:\\/\\/)(www\\.)?(veoh\\.com\\/static\\/swf\\/webplayer\\/WebPlayer\\.swf\\?version=)([0-9a-zA-Z.]*)&permalinkId=([a-zA-Z0-9]*)&(.*)/', $url, $matches)) {\n\t\t//echo \"malformed embed veoh url\";\n\t\treturn;\n\t}\n\n\t$hash = $matches[5];\n\t//echo $hash;\n\n\treturn $hash;\n}",
"function getVideos($url, $width, $height, $config) {\r\n \t$video = '';\r\n\r\n\t\t$url = trim($url);\r\n\t\t$url = str_replace('http://', '', $url);\r\n\r\n // youtube\r\n if (strpos($url,'outube.com')) {\r\n $found = 1;\r\n $split = explode('=',$url);\r\n $video = 'new SWFObject(\"http://www.youtube.com/v/'.$split[1].'\", \"sfwvideo\", \"'.$width.'\",\"'.$height.'\", \"9\", \"#'.$config['backgroundColor'].'\", \"wmode\", \"transparent\");';\r\n // Dailymotion\r\n } elseif (strpos($url,'ailymotion.co')) {\r\n $found = 1;\r\n $video = 'new SWFObject(\"http://'.$url.'\", \"sfwvideo\", \"'.$width.'\",\"'.$height.'\", \"9\", \"#'.$config['backgroundColor'].'\", \"wmode\", \"transparent\");';\r\n // video.google.com/.de\r\n } elseif (strpos($url,'ideo.google.')) {\r\n $found = 1; \r\n $split = explode('=',$url);\r\n $video = 'new SWFObject(\"http://video.google.com/googleplayer.swf?docId='.$split[1].'&hl='.$GLOBALS['TSFE']->lang.'\", \"sfwvideo\", \"'.$width.'\",\"'.$height.'\", \"9\", \"#'.$config['backgroundColor'].'\", \"wmode\", \"transparent\");'; \r\n // Metacafe\r\n } elseif (strpos($url,'metacafe.')) {\r\n $found = 1;\r\n $split = explode('/',$url);\r\n $video = 'new SWFObject(\"http://www.metacafe.com/fplayer/'.$split[2].'/.swf\", \"sfwvideo\", \"'.$width.'\",\"'.$height.'\", \"9\", \"#'.$config['backgroundColor'].'\", \"wmode\", \"transparent\");'; \r\n // MyVideo.de\r\n } elseif (strpos($url,'yvideo.de')) {\r\n $found = 1;\r\n $split = explode('/',$url);\r\n $video = 'new SWFObject(\"http://www.myvideo.de/movie/'.$split[2].'\", \"sfwvideo\", \"'.$width.'\",\"'.$height.'\", \"9\", \"#'.$config['backgroundColor'].'\", \"wmode\", \"transparent\");'; \r\n // clipfish.de\r\n\t\t} elseif (strpos($url,'lipfish.de')) {\r\n $found = 1;\r\n $split = explode('=',$url);\r\n $video = 'new SWFObject(\"http://www.clipfish.de/videoplayer.swf?as=0&videoid='.$split[1].'\", \"sfwvideo\", \"'.$width.'\",\"'.$height.'\", \"9\", \"#'.$config['backgroundColor'].'\", \"wmode\", \"transparent\");'; \r\n\t\t// sevenload\r\n\t\t} elseif (strpos($url,'sevenload.com')) {\r\n $found = 1;\r\n $split = explode('/',$url);\r\n $video = 'new SWFObject(\"http://de.sevenload.com/pl/'.$split[2].'/'.$width.'x'.$height.'/swf\", \"sfwvideo\", \"'.$width.'\",\"'.$height.'\", \"9\", \"#'.$config['backgroundColor'].'\", \"wmode\", \"transparent\");'; \r\n } \r\n\r\n\t\treturn $video;\r\n\t}",
"function oembed_process($url) {\n\t$j = oembed_fetch_url($url);\n\tlogger('oembed_process: ' . print_r($j,true));\n\tif($j && $j->type !== 'error')\n\t\treturn '[embed]' . $url . '[/embed]';\n\treturn false;\n}",
"function get_embed_video_src( $video_embed_code ) {\n\tpreg_match( '/src=\"(.+?)\"/', $video_embed_code, $matches );\n\n\treturn $matches[1];\n}",
"function video_url_from_cdn($video_id){\n\nreturn $GLOBALS['cdn']['videos_standard'].\"/\".$video_id.\".\".$GLOBALS['format_convert_videos'];\n\n}",
"function retornarEmbed($url){\r\n $urlEmbed = str_replace(\"watch?v=\", \"embed/\", $url);\r\n $urlEmbed = str_replace(\"&feature=youtu.be\", \"\", $urlEmbed);\r\n return $urlEmbed; \r\n}",
"function solr_the_video($type = 'html', $echo = true) {\n\n\t\t$raw_video = $this->solr_get_the_video();\n\t\t$video = '';\n\n\t\tif ( ! $raw_video)\n\t\t\treturn false;\n\n\t\tif ( 'php' == $type )\n\t\t\treturn $raw_video;\n\n\t\t$video = $raw_video[0];\n\n\t\tif ( 'img' == $type ) {\n\t\t\tif (preg_match('%(\\.be/|/embed/|/v/|/watch\\?v=)([A-Za-z0-9_-]{5,11})%', $video, $regs)) {\n\t\t\t\t$video = 'http://i.ytimg.com/vi/' . $regs[2] . '/0.jpg';\n\t\t\t\t# Successful match\n\t\t\t} else {\n\t\t\t\treturn '';\n\t\t\t}\n\t\t}\n\n\t\tif ( $echo )\n\t\t\techo $video;\n else\n return $video;\n\n\t}",
"public function get_video_contents(){ \r\n return file_get_contents(\"https://www.youtube.com/get_video_info?video_id=\". $this->video_id); \r\n }",
"public function loadVideo(){\n if($this->sources === null) {\n $videoInfo = CurlUtil::fetch(\"http://youtube.com/get_video_info?video_id=$this->videoId\");\n $videoData = array();\n parse_str($videoInfo, $videoData);\n\n // echo json_encode($videoData);die();\n\n $this->videoTitle = $videoData['title'];\n $this->sources = array();\n $ref = explode(',', $videoData['url_encoded_fmt_stream_map']);\n\n foreach ($ref as $source) {\n $stream = array();\n parse_str($source, $stream);\n $type = explode(';', $stream['type'])[0];\n $quality = explode(',', $stream['quality'])[0];\n\n if (!array_key_exists($type, $this->sources) || !is_array($this->sources[$type])) {\n $this->sources[$type] = array();\n }\n $this->sources[$type][$quality] = $stream;\n }\n }\n }",
"public function get_mp4_url() {\n\n // let's check that the video object has been loaded already. This function\n // is useless without it.\n if (!isset($this->video_url) && $this->video_url==\"\") {\n $this->tattle(\"coreapi object must be populated before calling get_mp4_url\");\n return false;\n }\n\n // replace video_url RTMP location with HTTP location.\n $mp4_url = str_replace('rtmp://fms', 'http://wpc', $this->video_url);\n\n return $mp4_url;\n\n }",
"public function get_video_embed_url()\n {\n if(!SELF::verifyValidID()) { return FALSE; }\n $id = SELF::get_video_id();\n if($this->_video_type == 'youtube') {\n return 'http://www.youtube.com/embed/' . $id . '/';\n } else if($this->_video_type == 'vimeo') {\n return 'http://player.vimeo.com/video/' . $id . '?color=ffffff';\n }\n }",
"public function getVideoLocation($url)\n{\n if (false !== ($id = $this->getDailyMotionId($url))) {\n return 'http://www.dailymotion.com/embed/video/' . $id;\n }\n elseif (false !== ($id = $this->getVimeoId($url))) {\n return 'http://player.vimeo.com/video/' . $id;\n }\n elseif (false !== ($id = $this->getYoutubeId($url))) {\n return 'http://www.youtube.com/embed/' . $id;\n }\n return false;\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ adds comm_item if not in report file otherwise starts new report file sets up starter report_file, so this is called before cache commissions payments | public function link_comm_item($report_file, $item_id, $employee, $date)
{
$doc = new DOMDocument('1.0');
$doc->formatOutput = true;
if(file_exists($report_file))
{
$doc->load($report_file);
} else {
// setup document root 'commissions_items'
$doc = $this->start_commissions_report_document($doc, $employee, $date);
$this->save_xmlfile($report_file, $doc);
return;
}
$xpath = new DOMXPath($doc);
// We starts from the root element
// look for commissions items with id = id
$query = "/commissions_report/commissions_items[commissions_item=".$item_id."]";
$items_found = $xpath->query($query);
if($items_found->length == 0)
{
$itemNode = $doc->createElement('commissions_item');
$text = $doc->createTextNode((string)$item_id);
$itemNode->appendChild($text);
$query = "/commissions_report/commissions_items";
$items_node = $xpath->query($query);
$items_node->item(0)->appendChild($itemNode);
$this->save_xmlfile($report_file, $doc);
}
} | [
"public function prepareReport()\n {\n $this->prepareFolder();\n $prefix = date('Y_m_d');\n $filePath = $this->directoryList->getPath(DirectoryList::VAR_DIR)\n . '/' . self::REPORT_FOLDER . \"/\" . $prefix . '_' . self::FINANCE_REPORT_FILENAME;\n\n $this->csvProcessor\n ->setDelimiter(',')\n ->setEnclosure('\"')\n ->saveData(\n $filePath,\n $this->getFinanceReportData()\n );\n\n $this->notification->sendReport(file_get_contents($filePath));\n }",
"private function processReport()\n {\n $db = JFactory::getDBO();\n $tp_method = $_REQUEST['tp_method'];\n switch ($tp_method) {\n case 'PYP':\n $trxid = $_REQUEST['acquirerID'];\n break;\n case 'AFP':\n $trxid = $_REQUEST['invoiceID'];\n break;\n case 'EPS':\n case 'GIP':\n $trxid = $_REQUEST['transactionID'];\n break;\n case 'IDE':\n case 'MRC':\n case 'DEB':\n case 'CC':\n case 'WAL':\n case 'BW':\n default:\n $trxid = $_REQUEST['trxid'];\n }\n $digiwalletInfo = $this->__retrieveDigiwalletInformation(\"transaction_id = '\" . $trxid. \"'\");\n $row = JTable::getInstance('jdonation', 'Table');\n $row->load($digiwalletInfo->cart_id);\n \n if (! $digiwalletInfo)\n die('Transaction is not found');\n \n if ($row->published)\n die(\"Donation $digiwalletInfo->cart_id had been done\");\n \n $this->checkPayment($digiwalletInfo, $row);\n die('Done');\n }",
"function dw_campaigns_pp_fundraising_total() {\n global $dw_campaign_module_path;\n\n $report_rows = array();\n $campaigns = dw_campaigns_get_active_campaigns('nodeid');\n\n// $campaigns_by_contribution_page_id = dw_campaigns_get_active_campaigns(TRUE);\n\n $i = 0;\n\n $headers = array(\n array(\n 'data' => t('Name'),\n ),\n array(\n 'data' => t('Location'),\n ),\n array(\n 'data' => t('Email'),\n ),\n array(\n 'data' => t('Phone'),\n ),\n array(\n 'data' => t('Tags'),\n ),\n array(\n 'data' => t('Total Raised'),\n ),\n array(\n 'data' => t('Confirmed Donations'),\n ),\n );\n\n $headers_values = array();\n foreach($headers as $row) {\n $headers_values[] = $row['data'];\n }\n\n $basename = \"report-pp-fundraising-total-\" . time() . \".csv\";\n $file = $dw_campaign_module_path . \"/civi_cache/\" . $basename;\n $fp = fopen($file, \"w\");\n\n fputcsv($fp, array_values($headers_values));\n\n foreach($campaigns as $campaign_id => $campaign) {\n $res = _dw_campaigns_get_pcps_for_campaign($campaign);\n\n foreach($res as $pcp) {\n $i++;\n $pcp_count += 1;\n $params = array(\n 'contact_id' => $pcp->contact_id,\n 'returnFirst' => 1\n );\n $contact = _dw_civicrm_contact_get($params);\n\n $dummy = new stdClass;\n $dummy->id = $pcp->id;\n $totals = dw_campaigns_get_contribution_total_for_pcp($dummy);\n\n $donations_count = $totals['count'];\n //$online_total = $totals['online'];\n $online_total = $totals['online'] - $totals['offline_already_imported'];\n $offline_pending_total = $totals['offline'];\n $offline_total = $totals['offline'] + $totals['offline_already_imported'];\n $offline_pending_count = $totals['offline_pending_count'];\n $total_total = $totals['total'];\n //$confirmed_total = $totals['online'] + $totals['offline_already_imported'];\n $confirmed_total = $totals['online'];\n\n $res = _dw_civicrm_tag_entity_display(array('entity_id' => $pcp->contact_id));\n $tags = isset($res->Result->result) ? $res->Result->result : '';\n if($tags == '0') {\n $tags = '';\n }\n\n $row = array(\n 'name' => $contact->display_name,\n 'location' => $campaign->title,\n 'email' => $contact->email,\n 'phone' => $contact->phone,\n 'tags' => $tags,\n 'total_total' => sprintf(\"%.02f\", $total_total),\n 'confirmed_total' => sprintf(\"%.02f\", $confirmed_total)\n );\n\n $values = array_values($row);\n fputcsv($fp, $values);\n\n $report_rows[] = $row;\n }\n\n }\n\n if($mode == 'CSV') {\n\n $date = date(\"Y-m-d_His\");\n $fsize = filesize($file);\n\n header(\"Pragma: public\"); // required\n header(\"Expires: 0\");\n header(\"Cache-Control: must-revalidate, post-check=0, pre-check=0\");\n header(\"Cache-Control: private\",false); // required for certain browsers\n header(\"Content-Type: application/force-download\"); \n header(\"Content-Disposition: attachment; filename=\\\"$outfile\\\"\");\n header(\"Content-Transfer-Encoding: binary\");\n header(\"Content-Length: $fsize\");\n header(\"Content-type: text/csv\");\n\n echo file_get_contents($file);\n\n die;\n } else {\n\n return theme('dw_campaigns_reports_pp_fundraising_total', array('headers' => $headers, 'rows' => $report_rows, 'filename' => $file));\n }\n}",
"public function updateReport()\n {\n $this->data['current_report'] = $this->xhprof->getReport();\n }",
"public function addNewReportToFile()\n {\n\n //$pid = trim($_POST['PID']);\n //$pgroup = trim($_POST['PGROUP']);\n $FILENAME = AIREPORTS;\n\n if (file_exists($FILENAME)) {\n $airfile = fopen($FILENAME, 'r+') or die(\"cant open file\");\n $NAI = '<Aireport>' . PHP_EOL;\n $NAI .= \"<ID>\" . $_POST['ID'] . \"</ID>\" . PHP_EOL;\n $NAI .= \"<OWNER>\" . $_POST['OWNER'] . \"</OWNER>\" . PHP_EOL;\n $NAI .= \"<DATE>\" . $_POST['DATE'] . \"</DATE>\" . PHP_EOL;\n $NAI .= \"<REPORT>\" . $_POST['REPORT'] . \"</REPORT>\" . PHP_EOL;\n $NAI .= \"<NDESCRIPTION>\" . $_POST['NDESCRIPTION'] . \"</NDESCRIPTION>\" . PHP_EOL;\n $NAI .= \"<NDEADLINE>\" . $_POST['NDEADLINE'] . \"</NDEADLINE>\" . PHP_EOL;\n $NAI .= \"<NRESPONSIBLE>\" . $_POST['NRESPONSIBLE'] . \"</NRESPONSIBLE>\" . PHP_EOL;\n $NAI .= \"<STATUS>\" . $_POST['STATUS'] . \"</STATUS>\" . PHP_EOL;\n $NAI .= \"</Aireport>\" . PHP_EOL;\n $NAI .= \"</AIREPORTS>\";\n\n fseek($airfile, -14, SEEK_END);\n fwrite($airfile, $NAI);\n fclose($airfile);\n\n echo \"Report added!<br/><br/>\";\n echo '<a href=?pid=' . $_SESSION['pid'] . '&pgroup=' . $_SESSION['pgroup'] . '>Back To List Area</a>';\n }\n }",
"public function stock_report_single_item()\n {\n $CI =& get_instance();\n $CI->load->model('Reports');\n $data['title'] = 'stock';\n $company_info = $CI->Reports->retrieve_company();\n $currency_details = $CI->Web_settings->retrieve_setting_editdata();\n $data['currency'] = $currency_details[0]['currency'];\n $data['totalnumber'] = $CI->Reports->totalnumberof_product();\n $data['company_info'] = $company_info;\n $reportList = $CI->parser->parse('report/stock_report', $data, true);\n return $reportList;\n }",
"public function my_job_reports()\n\t{\n\t\trequire_once(APP_DIR.'controllers/contractor/my_job_reports.php');\n\t}",
"function IsReportDue()\n\t{\n\t\t$file=$this->dir.$this->report_file;\n\t\tclearstatcache();\t// need this to make sure file info is not gotten from a cache\n\t\tif (!file_exists($file)) {\n\t\t\t$this->AddFile($file);\n\t\t\treturn true;\n\t\t} else if ((time()-filemtime($file))>$this->report_time) {\n\t\t\ttouch($file);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}",
"function commission_report($report_hash) {\r\n\t\t$reports = new reports($this->current_hash);\r\n\r\n\t\t$_POST['report_hash'] = $report_hash;\r\n\t\t$_POST['doit_print'] = 1;\r\n\r\n\t\t// Populate data for reports object.\r\n\t\t$reports->doit_commission_report();\r\n\t\t//TODO Implement Commission Report\r\n\t\techo \"<pre> commission report data is \".print_r($reports->results,1).\"</pre>\";\r\n\t\tdie();\r\n\r\n\t}",
"public function pmix_report($month, $year){\n \n\n $getTotalTC = $this->servicedesk_model->getTotalTC($month, $year);\n\n $getProductItems = $this->servicedesk_model->getProductItems($year, $month);\n\n \n $getProductItems_temp_arr = array();\n\n foreach($getProductItems as $result){\n $res_arr[$result['child_item_poscode']] = array(\n 'child_item_poscode' => $result['child_item_poscode'],\n 'net_sales' => $result['net_sales'],\n 'quantity' => $result['quantity']\n );\n }\n array_push($getProductItems_temp_arr , $res_arr);\n\n\n\n $getProductList_temp_arr = array();\n\n\n $getProductList = $this->servicedesk_model->getProductList();\n\n foreach($getProductList as $result1){\n $res_arr1[$result1['pos_code']] = array(\n 'pos_code' => $result1['pos_code'],\n 'category' => $result1['category'],\n 'name' => $result1['name']\n );\n }\n array_push($getProductList_temp_arr , $res_arr1);\n\n $com_result = $this->arr_merge($getProductList_temp_arr,$getProductItems_temp_arr,$getTotalTC);\n // return $getProductItems_temp_arr;\n // return array_merge_recursive($getProductItems_temp_arr[0],$getProductList_temp_arr[0]);\n\n $this->get_csv_pmix_report($com_result,$month, $year);\n\n return $com_result;\n // $getProductItem = $this->servicedesk_model->\n }",
"public static function sendInstallReportIfNew()\n {\n\n }",
"private function AdminDoCharge() {\n\t$out = '<h3>Adding charges...</h3>';\n\t\n\t$out .= $this->DoCharges();\n\n\t/* 2016-09-11 old version\n\t$objLines = $this->LineRecords();\n\tif ($objLines->HasRows()) {\t// package lines\n\t $dlrSaleTot = 0;\n\t $dlrItmShTot = 0;\n\t $dlrPkgShTot = 0;\n\n\t $txtLog = 'charging for package '.$this->Number().' (ID='.$this->ID.')';\n\t $out .= $txtLog;\n\n\t $arEvent = array(\n\t 'descr'\t=> $txtLog,\n\t 'where'\t=> __METHOD__,\n\t 'code'\t=> '+PCH');\n\t $this->StartEvent($arEvent);\n\n\t $cntLines = 0;\t// for logging only\n\t $cntQty = 0;\t// for logging only\n\t while ($objLines->NextRow()) {\n\t\t$idRow = $objLines->KeyValue();\n\t\t$objItem = $objLines->ItemRecord();\t// item data\n\t\t// prices in package line data override catalog prices\n\t\t//$dlrSale = $objItem->PriceSell;\t// sale price\n\t\t//$objShCo = $objItem->ShipCostObj();\t// shipping cost data\n\t\t//$dlrItmSh = $objShCo->PerItem;\n\t\t//$dlrPkgSh = $objShCo->PerPkg;\n\t\t$dlrSale = $objLines->PriceSell();\t// sale price\n\t\t$dlrItmSh = $objLines->ShPerItm();\n\t\t$dlrPkgSh = $objLines->ShPerPkg();\n\t\t$qtyShp = $objLines->QtyShipped();\n\n\t\t$dlrSaleLine = $dlrSale * $qtyShp;\n\t\t$dlrItmShLine = $dlrItmSh * $qtyShp;\n\n\t\t$dlrSaleTot += $dlrSaleLine;\n\t\t$dlrItmShTot += $dlrItmShLine;\n\t\tif ($dlrPkgShTot < $dlrPkgSh) {\n\t\t $dlrPkgShTot = $dlrPkgSh;\n\t\t}\n\t\t// record the charges applied for this line:\n\t\t$arUpd = array(\n\t\t 'CostSale' => $dlrSale,\n\t\t 'CostShItm' => $dlrItmSh);\n\t\t$objLines->Update($arUpd);\n\n\t\t// stats for logging\n\t\t$cntLines++;\n\t\t$cntQty += $qtyShp;\n\t }\n\t // create transaction records:\n\t if ($cntQty == 1) {\n\t\t$txtItemShp = 'cost of item being shipped';\n\t } else {\n\t\t$txtItemShp = 'total cost of items being shipped';\n\t }\n\t $this->AddTrx(KI_ORD_TXTYPE_ITEM_SOLD,$txtItemShp,$dlrSaleTot);\n\t $this->AddTrx(KI_ORD_TXTYPE_PERITM_SH,'per-item shipping total',$dlrItmShTot);\n\t $this->AddTrx(KI_ORD_TXTYPE_PERPKG_SH,'per-package shipping',$dlrPkgShTot);\n\n\t // update package record:\n\t $arUpd = array(\n\t 'ChgShipItm'\t=> $dlrItmShTot,\n\t 'ChgShipPkg'\t=> $dlrPkgShTot,\n\t 'WhenFinished' => 'NOW()');\n\t $this->Update($arUpd);\n\n\t // log completion of event:\n\t $txtLog = 'sold: '\n\t\t.$cntLines.Pluralize($cntLines,' line').', '\n\t\t.$cntQty.Pluralize($cntQty,' item').': '\n\t\t.'$'.$dlrItmShTot.' itm s/h, $'.$dlrPkgShTot.' pkg s/h';\n\t $out .= '<br>'.$txtLog;\n\t $arUpd = array('descrfin' => $txtLog);\n\t $this->FinishEvent($arUpd);\n\t} else {\n\t $out = 'No items to charge!';\n\t}\n\t*/\n\treturn $out;\n }",
"public function stock_report_single_item()\n\t{ \n\t\t$CI =& get_instance();\n\t\t$CI->load->model('Reports');\n\t\t$data['title'] = 'stock';\n\t\t$currency_details = $CI->Web_settings->retrieve_setting_editdata();\n\t $data['totalnumber'] = $CI->Reports->totalnumberof_product();\n\t $data['currency'] = $currency_details[0]['currency'];\n\t\t$reportList = $CI->parser->parse('report/stock_report',$data,true);\n\t\treturn $reportList;\n\t}",
"function affp_addCommissionFromOrder($_orderID){\r\n\t\r\n\t$Commission = affp_getCommissionByOrder($_orderID);\r\n\tif($Commission['cID'])return 0;\r\n\r\n\t$Order \t\t\t= ordGetOrder( $_orderID );\r\n\t\r\n\tif($Order['customerID'])\r\n\t\t$RefererID \t\t= affp_getReferer($Order['customerID']);\r\n\telse \r\n\t\t$RefererID \t\t= $Order['affiliateID'];\t\r\n\t\t\r\n\tif(!$RefererID)return 0;\r\n\t\r\n\t$CustomerLogin = regGetLoginById($Order['customerID']);\r\n\tif(!$CustomerLogin)\r\n\t\t$CustomerLogin = $Order['customer_email'];\r\n\t\r\n\t$Commission \t= array(\r\n\t\t'Amount' \t\t\t=> sprintf(\"%.2f\", ($Order['currency_value']*$Order['order_amount']*CONF_AFFILIATE_AMOUNT_PERCENT)/100),\r\n\t\t'CurrencyISO3' \t=> $Order['currency_code'],\r\n\t\t'xDateTime' \t\t=> date(\"Y-m-d H:i:s\"),\r\n\t\t'OrderID' \t\t\t=> $_orderID,\r\n\t\t'CustomerID' \t\t=> $RefererID,\r\n\t\t'Description' \t\t=> str_replace(array('{ORDERID}', '{USERLOGIN}'), array($Order['orderID_view'], $CustomerLogin), translate(\"affp_commission_description\")),\r\n\t);\r\n\t\r\n\tdo{\r\n\tif(CONF_AFFILIATE_EMAIL_NEW_COMMISSION){\r\n\t\t\r\n\t\t$Settings = affp_getSettings($RefererID);\r\n\t\tif(!$Settings['EmailOrders'])break;\r\n\t\t\r\n\t\t$t \t\t\t\t= '';\r\n\t\t$Email \t\t\t= '';\r\n\t\t$FirstName \t\t= '';\r\n\t\tregGetContactInfo(regGetLoginById($RefererID), $t, $Email, $FirstName, $t, $t, $t);\r\n\t\txMailTxt($Email, translate(\"affp_new_commission\"), 'customer.affiliate.commission_notifi.txt', \r\n\t\t\tarray(\r\n\t\t\t\t'customer_firstname' => $FirstName,\r\n\t\t\t\t'_AFFP_MAIL_NEW_COMMISSION' => str_replace('{MONEY}', $Commission['Amount'].' '.$Commission['CurrencyISO3'],translate(\"affp_mail_new_commission\"))\r\n\t\t\t\t), true);\r\n\t}\r\n\t}while (0);\r\n\t\r\n\taffp_addCommission($Commission);\r\n}",
"public function addCreditEntry()\n\t{\n\t\t$model = $this->getModel('payout');\n\t\t$results = $model->addCreditEntry();\n\t}",
"public function forceDownload() {\n\n ob_end_clean();\n\n if($_SERVER['REQUEST_METHOD'] == 'POST' && SimpleEcommCartCommon::postVal('simpleecommcart-action') == 'export_csv') {\n require_once(SIMPLEECOMMCART_PATH . \"/models/SimpleEcommCartExporter.php\");\n $start = str_replace(';', '', $_POST['start_date']);\n $end = str_replace(';', '', $_POST['end_date']);\n SimpleEcommCartCommon::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . \"] Date parameters for report: START $start and END $end\");\n $report = SimpleEcommCartExporter::exportOrders($start, $end);\n\n header('Content-Type: application/csv'); \n header('Content-Disposition: inline; filename=\"SimpleEcommCartReport.csv\"');\n echo $report;\n die();\n }\n elseif($_SERVER['REQUEST_METHOD'] == 'POST' && SimpleEcommCartCommon::postVal('simpleecommcart-action') == 'download log file') {\n\n $logFilePath = SimpleEcommCartLog::getLogFilePath();\n if(file_exists($logFilePath)) {\n $logData = file_get_contents($logFilePath);\n $cartSettings = SimpleEcommCartLog::getCartSettings();\n\n header('Content-Description: File Transfer');\n header('Content-Type: text/plain');\n header('Content-Disposition: attachment; filename=SimpleEcommCartLogFile.txt');\n header('Expires: 0');\n header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n header('Pragma: public');\n echo $cartSettings . \"\\n\\n\";\n echo $logData;\n die();\n }\n }\n \n }",
"public static function reportComment(){ include_once 'Admin/Management/ReportComment.php'; }",
"protected function _initCmrreport()\n {\n $cmrreportId = (int) $this->getRequest()->getParam('id');\n $cmrreport = Mage::getModel('bs_cmrreport/cmrreport');\n if ($cmrreportId) {\n $cmrreport->load($cmrreportId);\n }\n Mage::register('current_cmrreport', $cmrreport);\n return $cmrreport;\n }",
"private function _setItemAsPaid() {\n \n $this->_master->setAttr('cycle', self::ITEM_CYCLE_OFF);\n $this->_master->setAttr('status', self::ITEM_STATUS_CLOSED);\n $this->_storeMaster($this->_master);\n exit('The items has been correctly set as <b>PAID</b>.');\n \n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ ABSTRACT METHODS abstract methods counter approved and unapproved | abstract public static function counter_approved(); | [
"function approveCount () {\n $count = 0;\n foreach ($this->ids as $i) {\n if ($this->link[$i]->approved == \"no\") {\n\t$count++;\n }\n }\n return $count;\n }",
"private function approve() {\n\n }",
"public function approved(): bool;",
"public function approve() \n\t{\n\t\t$this->updateStatus(self::STATUS_APPROVED);\n\t}",
"function reapprove() {\n $comment = \"Set to In Progress status for re-approval.\";\n foreach ($this->approvals_required() as $ap_type_id => $ap_type_desc) {\n $this->approve($ap_type_id, \"\", $comment);\n } // foreach\n }",
"public function approve()\n {\n $this->approveNoRankUp();\n if ($this->user) {\n $this->user->increaseCrank();\n }\n }",
"public function countUnapproved()\r\n {\r\n return (int) $this->orderInfoMapper->countUnapproved();\r\n }",
"public function approve()\n {\n $now = Carbon::now();\n\n Observation::whereIn('id', $this->getObservationIds())->update([\n 'approved_at' => $now,\n 'updated_at' => $now,\n ]);\n\n FieldObservation::whereIn('id', $this->getIds())->update([\n 'unidentifiable' => false,\n 'updated_at' => $now,\n ]);\n }",
"static function approve__() {\n $post = $_SESSION['formvalues'][$_POST['formvalues']];\n self::auth('/show?' . http_build_query($post), g::$config['approveusers'], false);\n\n unset($_SESSION['formvalues'][$_POST['formvalues']]);\n $entityID = $post['entityID'];\n $fed = g::$config['feeds'][$post['fed']];\n $approvedfile = g::$config['destinations'][$fed]['approvedpath'] . \"approved-$fed.xml\";\n\n $xp2 = file_exists($approvedfile) ? xp::xpFromFile($approvedfile) : xp::xpe();\n $doc2 = $xp2->document;\n\n $entityxpath = '/md:EntitiesDescriptor/md:EntityDescriptor[@entityID=\"' . $entityID . '\"]';\n\n $attrs = array();\n if (isset($_POST['attrs']) && $_POST['attrs']) { $attrs = explode(',', $_POST['attrs']); }\n\n // make sure that only supported attributes is used\n $attrs = array_intersect($attrs, g::$config['attributesupport']['attributes']);\n sort($attrs);\n\n $ent2 = softquery::query($xp2, $doc2, $entityxpath);\n $requestedattributesquery = 'md:SPSSODescriptor/md:AttributeConsumingService/md:RequestedAttribute';\n $requestedattributes = $xp2->query($requestedattributesquery, $ent2);\n\n $approvedattributes = array();\n\n foreach($requestedattributes as $ra) {\n if ($ra->getAttribute('NameFormat') === \"urn:oasis:names:tc:SAML:2.0:attrname-format:uri\"\n && isset(basic2oid::$oid2basic[$ra->getAttribute('Name')])) {\n $approvedattributes[] = basic2oid::$oid2basic[$ra->getAttribute('Name')];\n }\n }\n\n sort($approvedattributes);\n\n $approved = $xp2->query('md:Extensions/wayf:log[1][@approved=\"true\"]', $ent2)->length === 1;\n\n // no change in status or approved attributes - just show the entity\n if ((empty($_POST['approve']) && empty($_POST['unapprove']))\n || (isset($_POST['unapprove']) && !$approved)\n || (isset($_POST['approve']) && $approved && $approvedattributes == $attrs)) {\n header('Location: /show?a=b&' . http_build_query($post) . \"&error=\" . rawurlencode(\"No changes made!\"));\n exit;\n }\n\n //var_dump($approved); exit;\n\n // Lock the approvefile exclusively - otherwise we might get a race condition ...\n $fp = fopen($approvedfile, \"c+\");\n if (!flock($fp, LOCK_EX)) { die(\"could not lock $approvedfile\"); }\n\n // always remove the currently approved attributes\n\n $acs = $xp2->query('md:SPSSODescriptor/md:AttributeConsumingService', $ent2);\n if ($acs->length) { $acs->item(0)->parentNode->removeChild($acs->item(0)); }\n\n $approvedxpath = '/md:Extensions/wayf:log[1]/@approved';\n if (isset($_POST['unapprove'])) {\n softquery::query($xp2, $ent2, $approvedxpath, 'false');\n } elseif (isset($_POST['approve'])) { // do not bother if the list of attributes has not changed\n // make sure that the entity is present in the approved.xml file even if no attributes are approved\n softquery::query($xp2, $ent2, $approvedxpath, 'true');\n // first remove the acs element\n if ($attrs) {\n $acs = softquery::query($xp2, $ent2, '/md:SPSSODescriptor/md:AttributeConsumingService');\n $attrno = 1;\n foreach( $attrs as $attr) {\n $xp = \"/md:RequestedAttribute[$attrno]/\";\n softquery::query($xp2, $acs, $xp . '@FriendlyName', $attr);\n softquery::query($xp2, $acs, $xp . '@Name', basic2oid::$basic2oid[$attr] );\n softquery::query($xp2, $acs, $xp . '@NameFormat', 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri');\n softquery::query($xp2, $acs, $xp . '@isRequired', 'true');\n $attrno++;\n }\n }\n if ($post['role'] === 'IDP') {\n softquery::query($xp2, $ent2, '/md:IDPSSODescriptor');\n }\n }\n\n $loginfo = array(\n 'ref' => $_POST['ticket'],\n 'date' => gmdate('Y-m-d\\TH:i:s'). 'Z',\n 'user' => $_SESSION['SAML']['attributes']['eduPersonPrincipalName'][0],\n 'action' => isset($_POST['approve']) ? 'approve' : 'unapprove',\n 'attributes' => join(',', $attrs),\n );\n\n g::log(LOG_INFO, $loginfo);\n\n $logentryno = $xp2->query('md:Extensions/wayf:log/wayf:logentry', $ent2)->length + 1;\n $sq = \"/md:Extensions/wayf:log[1]/wayf:logentry[$logentryno]/\";\n foreach( $loginfo as $k => $v) {\n softquery::query($xp2, $ent2, $sq . '@' . $k, $v);\n }\n\n $doc2->formatOutput = true;\n\n sfpc::file_put_contents($approvedfile, $doc2->saveXML());\n chmod($approvedfile, 0777);\n fclose($fp);\n\n header('Location: /show?' . http_build_query($post));\n }",
"public function initializeApproved()\n {\n if(empty($this->approved))\n {\n $this->approved = false;\n }\n }",
"public function countUnapproved()\r\n {\r\n $db = $this->db->select()\r\n ->count('id', 'count')\r\n ->from(self::getTableName())\r\n ->whereEquals('approved', '0');\r\n\r\n return $db->query('count');\r\n }",
"function isApproved(){\n\t\treturn $this->getStatus() == 1 ? true : false;\n\t}",
"function getTotalApproved() {\n\t\treturn $this->getOption(self::STAT_TOTAL_APPROVED, 0);\n\t}",
"public function getOutstandingApprovals() {\n if ($this->outstandingApprovals === null) {\n $this->outstandingApprovals = WCF::getSession()->getVar('outstandingApprovals');\n if ($this->outstandingApprovals === null) {\n $this->outstandingApprovals = 0;\n require_once(SLS_DIR . 'lib/data/library/Library.class.php');\n\n // disabled stories\n $libraryIDs = Library::getModeratedLibraries('canEnableStory');\n if (!empty($libraryIDs)) {\n $sql = \"SELECT\tCOUNT(*) AS count\n\t\t\t\t\t\tFROM\tsls\" . SLS_N . \"_story\n\t\t\t\t\t\tWHERE\tisDisabled = 1\n\t\t\t\t\t\t\tAND libraryID IN (\" . $libraryIDs . \")\";\n $row = WCF::getDB()->getFirstRow($sql);\n $this->outstandingApprovals += $row['count'];\n }\n\n // disabled chapters\n $libraryIDs = Library::getModeratedLibraries('canEnableChapter');\n if (!empty($libraryIDs)) {\n $sql = \"SELECT\t\tCOUNT(*) AS count\n\t\t\t\t\t\tFROM\t\tsls\" . SLS_N . \"_chapter chapter\n\t\t\t\t\t\tLEFT JOIN\tsls\" . SLS_N . \"_story story\n\t\t\t\t\t\tON\t\t(story.storyID = chapter.storyID)\n\t\t\t\t\t\tWHERE\t\tchapter.isDisabled = 1\n\t\t\t\t\t\t\t\tAND story.libraryID IN (\" . $libraryIDs . \")\";\n $row = WCF::getDB()->getFirstRow($sql);\n $this->outstandingApprovals += $row['count'];\n }\n\n // reported chapters\n $libraryIDs = Library::getModeratedLibraries('canModeratChapter');\n $libraryIDs2 = Library::getModeratedLibraries('canReadDeletedChapter');\n if (!empty($libraryIDs)) {\n $sql = \"SELECT\t\tCOUNT(*) AS count\n\t\t\t\t\t\tFROM\t\tsls\" . SLS_N . \"_chapter_report report\n\t\t\t\t\t\tLEFT JOIN\tsls\" . SLS_N . \"_chapter chapter\n\t\t\t\t\t\tON\t\t(chapter.chapterID = report.chapterID)\n\t\t\t\t\t\tLEFT JOIN\tsls\" . SLS_N . \"_story story\n\t\t\t\t\t\tON\t\t(story.storyID = chapter.storyID)\n\t\t\t\t\t\tWHERE\t\tstory.libraryID IN (\" . $libraryIDs . \")\n\t\t\t\t\t\t\t\tAND (chapter.isDeleted = 0\" . (!empty($libraryIDs2) ? \" OR story.libraryID IN (\" . $libraryIDs2 . \")\" : '') . \")\";\n $row = WCF::getDB()->getFirstRow($sql);\n $this->outstandingApprovals += $row['count'];\n }\n\n WCF::getSession()->register('outstandingApprovals', $this->outstandingApprovals);\n }\n }\n\n return $this->outstandingApprovals;\n }",
"public function approvedeniedAction() {\n\t\t\n\t\t$initialized = $this->initialize();\n\t\tif ($initialized !== true) return $initialized;\n \t\n \tif (!$this->auth->hasIdentity()):\n \t\treturn $this->redirect()->toRoute('login');\n\t\telseif (!$this->is_admin):\n\t\t\treturn $this->redirect()->toRoute('publisher');\n\t\tendif;\n \t\n \t$success = false;\n \t$msg = \"\";\n \t\n \t$PublisherWebsite = new \\model\\PublisherWebsite();\n \t$PublisherWebsiteFactory = \\_factory\\PublisherWebsite::get_instance();\n \t$PublisherInfoFactory = \\_factory\\PublisherInfo::get_instance();\n\n \t$request = $this->getRequest();\n \tif ($request->isPost()):\n\t $q = $request->getPost('q');\n\t \t$website_ids = $request->getPost('website_ids');\n\t \t$denied_desciption = $request->getPost('description');\n\t \t$website_arry = explode(\",\", $website_ids);\n\t \t\n\t \tforeach($website_arry as $website_id):\n\t \t\tif($website_id == \"d\"):\n\t \t\t\tcontinue;\n\t \t\tendif;\n\t \t\t\n\t \t\t$website_id = intval($website_id);\n\t \t\t\n\t \t\t$params = array();\n\t \t\t$params[\"PublisherWebsiteID\"] = $website_id;\n\t \t\t$PublisherWebsite = $PublisherWebsiteFactory->get_row_object($params);\n\t \t\t$params = array();\n\t \t\t$params[\"PublisherInfoID\"] = $PublisherWebsite->DomainOwnerID;\n\t \t\t$publisher_obj = $PublisherInfoFactory->get_row_object($params);\n\t \t\t$PublisherWebsite->DateUpdated = date(\"Y-m-d H:i:s\");\n\t \t\tif($q == 0):\n\t \t\t\t$PublisherWebsite->AutoApprove = 0;\n\t \t\t\t$PublisherWebsite->ApprovalFlag = 2;\n\t \t\t\t$PublisherWebsite->Description = $denied_desciption;\n\t \t\t\t$PublisherWebsiteFactory->save_domain($PublisherWebsite);\n\t \t\t\t\n\t \t\t\t$PublisherAdZoneFactory = \\_factory\\PublisherAdZone::get_instance();\n\t \t\t\t\n\t \t\t\t$params = array();\n\t \t\t\t$params[\"PublisherWebsiteID\"] = $website_id;\n\t \t\t\t$PublisherAdZoneList = $PublisherAdZoneFactory->get($params);\n\n\t \t\t\tforeach ($PublisherAdZoneList as $PublisherAdZone):\n\t \t\t\t\n\t \t\t\t\t$PublisherAdZoneFactory->updatePublisherAdZonePublisherAdZoneStatus($PublisherAdZone->PublisherAdZoneID, 2);\n\t\t \t\t\t \n\t \t\t\tendforeach;\n\n\t \t\t\t$subject = \"Website Denied \".$PublisherWebsite->WebDomain;\n\t \t\t\t$message = '<b>Website Denied</b> : ';\n\t \t\t$message = $message.\" \".$PublisherWebsite->WebDomain;\n\t \t\t$message = $message.\"<p>\".$denied_desciption.\"</p>\";\n\t \t\t\t$this->batchmailAction($publisher_obj->Email, $subject, $message);\n\t \t\t\t$msg = \"Websites denied successfully. And batch mails goes to publisher.\";\n\t \t\telseif($q == 1):\n\t \t\t\t$PublisherWebsite->ApprovalFlag = 1;\n\t \t\t\t$PublisherWebsiteFactory->save_domain($PublisherWebsite);\n\t \t\t\t$subject = \"Website Approved \".$PublisherWebsite->WebDomain;\n\t \t\t\t$message = '<b>Website Approved</b> : ';\n\t \t\t$message = $message.\" \".$PublisherWebsite->WebDomain;\n\t \t\t$this->batchmailAction($publisher_obj->Email, $subject, $message);\n\t \t\t\t$msg = \"Websites approved successfully. And batch mails goes to publisher.\";\n\t \t\tendif;\n\t \tendforeach;\n\t \t$success = true;\n\t \t\n\t endif;\t\n\t \n\t\t$data = array(\n\t\t 'success' => $success,\n\t\t 'data' => array('msg' => $msg)\n\t \t\t );\n\n return $this->getResponse()->setContent(json_encode($data));\n\t}",
"public function setIsApproved($is_approved);",
"function countApproved()\r\n {\r\n //define query\r\n $query = \"SELECT COUNT(app_status) AS Approved\r\n FROM applicants\r\n WHERE app_status = 2\r\n AND category = 1\";\r\n\r\n //prepare statement\r\n $statement = $this->_dbh->prepare($query);\r\n\r\n $statement->execute();\r\n\r\n return $statement->fetch(PDO::FETCH_ASSOC);\r\n }",
"function approveAllUnapproved()\n{\n\t$db = database();\n\n\t// Start with messages and topics.\n\t$msgs = array();\n\t$db->fetchQuery('\n\t\tSELECT \n\t\t\tid_msg\n\t\tFROM {db_prefix}messages\n\t\tWHERE approved = {int:not_approved}',\n\t\tarray(\n\t\t\t'not_approved' => 0,\n\t\t)\n\t)->fetch_callback(\n\t\tfunction ($row) use (&$msgs) {\n\t\t\t$msgs[] = $row['id_msg'];\n\t\t}\n\t);\n\n\tif (!empty($msgs))\n\t{\n\t\trequire_once(SUBSDIR . '/Post.subs.php');\n\t\tapprovePosts($msgs);\n\t\tCache::instance()->remove('num_menu_errors');\n\t}\n\n\t// Now do attachments\n\t$attaches = array();\n\t$db->fetchQuery('\n\t\tSELECT \n\t\t\tid_attach\n\t\tFROM {db_prefix}attachments\n\t\tWHERE approved = {int:not_approved}',\n\t\tarray(\n\t\t\t'not_approved' => 0,\n\t\t)\n\t)->fetch_callback(\n\t\tfunction ($row) use (&$attaches) {\n\t\t\t$attaches[] = $row['id_attach'];\n\t\t}\n\t);\n\n\tif (!empty($attaches))\n\t{\n\t\trequire_once(SUBSDIR . '/ManageAttachments.subs.php');\n\t\tapproveAttachments($attaches);\n\t\tCache::instance()->remove('num_menu_errors');\n\t}\n}",
"abstract public function getStatus();"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fetch email details $id, primary key | public function fetchEmail($id){
try{
$select = new \Zend\Db\Sql\Select();
$resultSetPrototype = new HydratingResultSet();
$tableGateway = new TableGateway('de_invoice_email', $this->tableGateway->getAdapter(), null, $resultSetPrototype);
$customer_name = new \Zend\Db\Sql\Expression(
'CONCAT(c.first_name, \' \', c.last_name)'
);
$select->from(array('ie' => 'de_invoice_email'))
->columns(array('*'))
->join(array('c' => 'de_customers'), new \Zend\Db\Sql\Expression('c.id = ie.cust_id'), array('customer_name' => $customer_name, 'customer_email' => 'email'), 'left')
->where(array('ie.id = ?' => $id));
$statement = $this->tableGateway->getAdapter()->createStatement();
$select->prepareStatement($this->tableGateway->getAdapter(), $statement);
$resultSet = new \Zend\Db\ResultSet\ResultSet();
$resultSet->initialize($statement->execute());
return $resultSet->current();
} catch (Exception $e) {
\De\Log::logApplicationInfo ( "Caught Exception: " . $e->getMessage() . ' -- File: ' . __FILE__ . ' Line: ' . __LINE__ );
}
} | [
"public function getEmail($id,$email);",
"private function userEmailGet($id) {\r\n return eUserEmail::model()->findByAttributes(array('user_id' => $id, 'type' => 'primary'));\r\n }",
"function get_email($id = 0) {\n\t\tglobal $wpdb;\n\n\t\tif ( !$id ) {\n\t\t\treturn false;\n\t\t}\n\t\treturn $wpdb->get_var($wpdb->prepare(\"SELECT email FROM $this->public WHERE id=%d\", $id));\n\t}",
"function readByEmail()\n {\n\n // query to read single record\n $query = \"SELECT * FROM \" . $this->table_name . \" r \n WHERE r.email = ? LIMIT 0,1\";\n\n // prepare query statement\n $stmt = $this->conn->prepare($query);\n\n // sanitize\n $this->email = htmlspecialchars(strip_tags($this->email));\n\n // bind id of restaurant to be updated\n $stmt->bindParam(1, $this->email);\n\n // execute query\n $stmt->execute();\n\n // get retrieved row\n $row = $stmt->fetch(PDO::FETCH_ASSOC);\n\n // set values to object properties\n $this->id = $row['id'];\n $this->name = $row['name'];\n $this->email = $row['email'];\n $this->urlName = $row['urlName'];\n $this->address = $row['address'];\n $this->admin = $row['admin'];\n $this->token = $row['token'];\n }",
"public function getEmail($id){\n\n $query = \"SELECT email\n FROM \" . _T_ACCOUNT . \"\n WHERE id = ? \";\n\n if ($stmt = $this->db->prepare($query)) {\n\n $stmt->bind_param('i', $id);\n $stmt->execute();\n $result = $stmt->get_result();\n\n if ($result && $result->num_rows == 1) {\n\n $email = $result->fetch_assoc()['email'];\n\n }\n\n $stmt->close();\n\n }\n\n return $email;\n\n }",
"private function getEmailFromDB() {\n $query = new SelectQuery(\"reviews\", \"email\");\n $query->where(Where::whereEqualValue(\"review_id\", DBValue::nonStringValue($this->id)));\n $result = DBQuerrier::queryUniqueValue($query);\n $row = @ mysqli_fetch_array($result);\n return $row['email'];\n }",
"function get_email_by_order_id($order_id){\r\t\t$query = \"SELECT email\";\r\t\t$query .= \" FROM \" . $this->config->item('ems_payment_history','dbtables');\r\t\t$query .= \" WHERE order_id = $order_id\";\r\t\t$res = $this->db->query($query);\r\t\t$resArr = $res->result_array();\r\r\t\tif(!empty($resArr)){\r\t\t\treturn $resArr['0']['email'];\r\t\t}else{\r\t\t\t$data = array();\r\t\t\treturn $data;\r\t\t}\r\t}",
"public function getIdEmailByEmail($email){\n $row = $this->db->run(\"SELECT id, username, email FROM users WHERE email=? LIMIT 1\", [$email])->fetch();\n return $row;\n }",
"function get ($id) {\n return $this->core->fetch(\n sprintf(\"SELECT * FROM `users` WHERE `user_%s`=?\", is_numeric($id)?\"id\":\"email\"),\n [$id]\n );\n }",
"function getUserBasicInfoByEmail($emailId = null){\n \n $UsersModel = TableRegistry::get('Users'); \n $getUserData = $UsersModel->find('all')->select(['id','role_id','firstname','lastname','email','phone_number'])->where(['Users.email' => $emailId])->hydrate('false')->first();\n return $getUserData;\n }",
"public function get_email_address($id) {\n $this->db->select(\"email_address\");\n $this->db->where(\"id\", $id);\n $this->db->from(\"emails\");\n\n $query = $this->db->get();\n $row = $query->row();\n\n if ( is_object($row) ) {\n return $row->email_address;\n } else {\n return \"Does not exist\";\n }\n }",
"function getuserbyemailid($emailid) {\n $sql = \"SELECT * FROM `users` WHERE isdelete IS NULL AND emailid = '$emailid' \";\n return $this->retrievemysql($sql)['data'];\n }",
"protected function selectOnIdUser_m($email){\n $sql = \"SELECT `id` FROM `tbl_user` WHERE `email`=:email\";\n $result = $this->pdo->prepare($sql);\n $result->bindParam(\":email\", $email);\n $result->execute();\n return $result->fetch(PDO::FETCH_ASSOC);\n }",
"function get_useremail_by_id($i_user_id = NULL)\n{\n\ttry\n\t{\n\t\t$o_ci = get_instance();\n\t\t$o_ci->db->select(\"s_email\");\n\t\t$o_ci->db->where('id', $i_user_id); \n\t\t$arr_qry = $o_ci->db->get('users');\n\t\t$ret_ = $arr_qry->row_array();\t\n\t\treturn $ret_[\"s_email\"];\n\t} \n\tcatch(Exception $err_obj)\n\t{\n\t\tshow_error($err_obj->getMessage());\n\t} \n\t\n}",
"public function getUserEmails($id) {\r\n\t\t\r\n\t\t$this->load(array('toid=?',$id));\r\n\t\treturn $this->query;\r\n\t\t\r\n\t}",
"public function user_email_as_per_id($id)\n {\n $this->db->select('*');\n $this->db->where('id', $id);\n $r = $this->db->get('contact_us');\n return $r->result_array();\n }",
"public function infoPorEmail($email){ \r\n $consulta = $this->conexion->prepare(\"select idUsuario,nombre,apellido1,apellido2,email,telefono,contrasena,foto FROM \".$this->table.\" WHERE email= :email \" );\r\n $consulta->execute(array('email'=>$email));\r\n $usuario= $consulta->fetchAll();\r\n $this->conexion=null;\r\n return $usuario;\r\n }",
"public function infoFromAuthId($emailId) {\n\n try {\n\n $dbh = new \\PDO($this->settings['database.dsn'], $this->settings['database.username'], $this->settings['database.password'], $this->settings['database.options']);\n\n $dbh->setAttribute(\\PDO::ATTR_ERRMODE, \\PDO::ERRMODE_EXCEPTION);\n\n $sql = 'SELECT * FROM ' . $this->settings['table'] . ' WHERE ' . $this->settings['column.emailId'] . ' = :emailId';\n\n $sth = $dbh->prepare($sql);\n\n $sth->bindParam(':emailId', $emailId);\n\n $sth->execute();\n\n $info = $sth->fetch(\\PDO::FETCH_ASSOC);\n\n $dbh = null;\n\n return $info;\n\n } catch (\\PDOException $e) {\n\n $this->app->error($e);\n\n }\n\n }",
"function get_id_from_email($email) {\r\n // a partir do email\r\n global $xoopsDB;\r\n $sql='select * from '.$xoopsDB->prefix('xmail_newsletter'). \" where user_email='$email'\";\r\n $result=$xoopsDB->queryf($sql);\r\n\r\n if($result) {\r\n $cat_data = $xoopsDB->fetcharray($result);\r\n return $cat_data['user_id'] ;\r\n }\r\n else {\r\n echo 'erro na query ',$sql;\r\n return 0;\r\n }\r\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Runs query where there are multiple values provided from a commaseparated list. e.g. `filter[tag]=goodquote,hideingallery,goodsubmission`. | function multipleValueQuery($query, $queryString, $filter)
{
$values = explode(',', $queryString);
/**
* Because we may be joining tables, specify the base query table name
* to avoid integrity constraint violations for ambiguous clauses.
*/
$filter = $query->getModel()->getTable() . '.' . $filter;
if (count($values) > 1) {
// For the first `where` query, we want to limit results... from then on,
// we want to append (e.g. `SELECT * (WHERE _ OR WHERE _ OR WHERE _)` and (WHERE _ OR WHERE _))
$query->where(function ($query) use ($values, $filter) {
foreach ($values as $value) {
$query->orWhere($filter, $value);
}
});
} else {
$query->where($filter, $values[0], 'and');
}
} | [
"function get_by_multiple($where) {\n \n }",
"function filterMulti($con, $filterArr, $filterType)\r\n{\r\n // Add name to filter type\r\n $filterType = $filterType . 'Name';\r\n $sql =\r\n \"\r\n SELECT * FROM PV_ASSET_REPORTS\r\n WHERE\r\n \";\r\n\r\n // Prepare sql based on how many elements are in the filter array\r\n foreach($filterArr as $item)\r\n {\r\n $sql .= $filterType . ' = ? OR ';\r\n }\r\n\r\n // Remove the last OR from sql\r\n $sql = substr_replace($sql, \"\", -3);\r\n $sql = trim($sql);\r\n\r\n // Prepare sql statement\r\n $query = $con->prepare($sql);\r\n $query->execute($filterArr);\r\n\r\n // Return result\r\n return $query->fetchAll(PDO::FETCH_ASSOC);\r\n}",
"function applyFilterSet($conn, $dbkey, $postkey, $filterlist) {\n if (isset($_POST[$postkey])) {\n if ($_POST[$postkey] == \"\") {\n return $filterlist;\n }\n $fragment = generateFilterQueryFragmentSet($conn, $dbkey, explode(\",\", $_POST[$postkey]));\n if ($fragment != \"\") {\n array_push($filterlist, $fragment);\n }\n }\n return $filterlist;\n}",
"function ew_GetMultiSearchSql(&$Fld, $FldVal) {\n\t$sWrk = \"\";\n\t$arVal = explode(\",\", $FldVal);\n\tforeach ($arVal as $sVal) {\n\t\t$sVal = trim($sVal);\n\t\tif (EW_IS_MYSQL) {\n\t\t\t$sSql = \"FIND_IN_SET('\" . ew_AdjustSql($sVal) . \"', \" . $Fld->FldExpression . \")\";\n\t\t} else {\n\t\t\tif (count($arVal) == 1 || EW_SEARCH_MULTI_VALUE_OPTION == 3) {\n\t\t\t\t$sSql = $Fld->FldExpression . \" = '\" . ew_AdjustSql($sVal) . \"' OR \" . ew_GetMultiSearchSqlPart($Fld, $sVal);\n\t\t\t} else {\n\t\t\t\t$sSql = ew_GetMultiSearchSqlPart($Fld, $sVal);\n\t\t\t}\n\t\t}\n\t\tif ($sWrk <> \"\") {\n\t\t\tif (EW_SEARCH_MULTI_VALUE_OPTION == 2) {\n\t\t\t\t$sWrk .= \" AND \";\n\t\t\t} elseif (EW_SEARCH_MULTI_VALUE_OPTION == 3) {\n\t\t\t\t$sWrk .= \" OR \";\n\t\t\t}\n\t\t}\n\t\t$sWrk .= \"($sSql)\";\n\t}\n\treturn $sWrk;\n}",
"public function testTagFilterMultiple()\n {\n list($req, $uid) = $this->getAuthRequest('?tag=tag1+tag2');\n $this->addBookmark(\n $uid, 'http://example.org/tag-1', 0,\n array('unittest', 'tag1')\n );\n $this->addBookmark(\n $uid, 'http://example.org/tag-2', 0,\n array('unittest', 'tag2')\n );\n $this->addBookmark(\n $uid, 'http://example.org/tag-3', 0,\n array('unittest', 'tag1', 'tag2')\n );\n\n $body = $req->send()->getBody();\n $csv = $this->getCsvArray($body);\n\n $this->assertEquals(2, count($csv));\n $this->assertCsvHeader($csv);\n\n $this->assertEquals('http://example.org/tag-3', $csv[1][0]);\n }",
"function selectMultiple($tableName, $filter, $idList, $orderBy, $orderDir) {\n\t$query = '';\n\tif ($idList != '') {\n\t\t$filter['_id'] = $idList;\n\t}\n\tforeach($filter as $field => $value) {\n\t\tif (!preg_match(\"/^\\w+$/\", $field)) continue;\n\t\tif ($query == '') {\n\t\t\t$query = 'WHERE ';\n\t\t} else {\n\t\t\t$query .= ' AND ';\n\t\t}\n\n\t\t$query .= $field;\n\t\t\n\t\t// <1, >10 are special cases, accepted as filter values\n\t\tif (preg_match(\"/^[<>]\\d+/\", $value)) {\n\t\t\t$query .= $value;\n\t\t// !23, !abc are special cases, accepted as filter values\n\t\t} elseif (preg_match(\"/^!\\w+/\", $value)) {\n\t\t\t$value = substr($value, 1);\n\t\t\t\n\t\t\tif (preg_match(\"/^\\d+$/\", $value)) {\n\t\t\t\t$query .= '!=' . $value;\n\t\t\t} else {\n\t\t\t\t$query .= \"!='\" . addslashes($value) . \"'\";\n\t\t\t}\n\t\t// ~abc is a special case, accepted. It means contains.\n\t\t} elseif (strrchr($value, '~')) {\n\t\t\t$query .= \" LIKE '%\" . addslashes(substr($value, 1)) . \"%'\";\n\t\t// integer\n\t\t} elseif (preg_match(\"/^\\d+$/\", $value)) {\n\t\t\t$query .= '=' . $value;\n\t\t// in (1,2,3)\n\t\t} elseif ($field == '_id') {\n\t\t\t$query .= \" IN ($value)\";\n\t\t// just a string\n\t\t} else {\n\t\t\t$query .= \"='\" . addslashes($value) . \"'\";\n\t\t}\n\t}\n\n\t$query = \"SELECT * FROM $tableName $query ORDER BY $orderBy $orderDir\";\n\t\n\t$result = mysql_query($query);\n\tif (!$result) return false;\n\t\n\t$return = array();\n\twhile($row=mysql_fetch_assoc($result)) { \n\t\t$return[]=$row;\n\t}\n\n\treturn $return;\n}",
"function check_filter_multiple() {\n\tglobal $wpdb;\n\tforeach($this->table_config[\"filter_columns\"] as $col){\n\t\tif($col[\"filter_type\"]==\"multiple\"){\n\t\t\t$wpdb->query($wpdb->prepare(\"UPDATE `%s` SET `%s` = CASE WHEN SUBSTRING( `%s` , -1 ) != ';' THEN CONCAT( `%s` , ';' ) ELSE `%s` END\", $this->turl(), $col, $col, $col, $col));\n\t\t}\n\t}\n}",
"function cat_to_query($input,$multi=TRUE)\r\n\t{\r\n\t\tif(!empty($input))\r\n\t\t{\r\n\t\t\tif(!is_array($input))\r\n\t\t\t\t$cats = explode(\",\",$input);\r\n\t\t\telse\r\n\t\t\t\t$cats = $input;\r\n\t\t\t\t\r\n\t\t\t$query = \"\";\r\n\t\t\tforeach($cats as $cat)\r\n\t\t\t{\r\n\t\t\t\tif(!empty($query))\r\n\t\t\t\t\t$query .=\" OR \";\r\n\t\t\t\t\r\n\t\t\t\tif($multi)\r\n\t\t\t\t\t$query .=\" \".tbl($this->db_tbl).\".category LIKE '%#$cat#%' \";\r\n\t\t\t\telse\r\n\t\t\t\t\t$query .=\" \".tbl($this->db_tbl).\".category = '$cat' \";\r\n\t\t\t}\r\n\t\r\n\t\t\tif(count($this->query_conds)>0)\r\n\t\t\t\t$op = \"AND\";\r\n\t\t\telse\r\n\t\t\t\t$op = '';\r\n\t\t\t$this->query_conds[] = $op.\" (\".$query.\") \"; \r\n\t\t}\r\n\t}",
"function setFilter($params,$values,$delimiter=\" && \")\n\t{\n\t\t$filter = \" WHERE \";\n\t\tif(is_array($values))\n\t\t{\n\t\t\tfor($i=0;$i<count($values);$i++)\n\t\t\t{\n\t\t\t\tif((!empty($params[$i])) && (!empty($values[$i])) && (strlen($values[$i]) > 3))\n\t\t\t\t{\n\t\t\t\t\tif(strlen($filter) <= 7)\n\t\t\t\t\t{\n\t\t\t\t\t$filter .= $params[$i].$values[$i];\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t$filter .= $delimiter.$params[$i].$values[$i];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif((!empty($params)) && (!empty($values)) && (strlen($values) > 3))\n\t\t\t{\n\t\t\t\t$filter .= $params.$values;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(strlen($filter) <= 8)\n\t\t{\n\t\t\t$filter = \"\";\n\t\t}\n\t\t\n\t\treturn $filter;\n\t}",
"protected function filterValues()\n {\n if (! $this->request->value) {\n return;\n }\n\n $this->query->whereIn($this->select[0], Arr::wrap($this->request->value));\n }",
"function filter_posts( $params ) {\n global $wpdb;\n\n $output = array();\n $facet = $params['facet'];\n $selected_values = $params['selected_values'];\n\n $sql = $wpdb->prepare( \"SELECT DISTINCT post_id\n FROM {$wpdb->prefix}facetwp_index\n WHERE facet_name = %s\",\n $facet['name']\n );\n\n foreach ( $selected_values as $key => $value ) {\n $selected_values = implode( \"','\", $selected_values );\n $output = facetwp_sql( $sql . \" AND facet_value IN ('$selected_values')\", $facet );\n }\n\n return $output;\n }",
"function query() {\n $this->ensure_table;\n \n if ($this->options['multiple']) {\n // Remove any if it's there\n unset($this->value['All']);\n \n if (sizeof($this->value)) {\n $holders = array();\n foreach ($this->value as $v) {\n if (preg_match('/^[\\d\\.]+$/',$v)) {\n $holders[] = '%d';\n } else {\n $holders[] = \"'%s'\";\n }\n }\n $where = \"cvterm.cvterm_id IN (\".implode(\", \",$holders).\")\";\n }\n } else {\n if (preg_match('/^\\d+$/', $this->value)) {\n $where = 'cvterm.cvterm_id=%d';\n } else {\n $where = \"cvterm.name\" . $this->operator . \"'%s'\";\n }\n }\n \n if ($where) {\n $this->query->add_where($this->options['group'], $where, $this->value);\n }\n }",
"function applyFilter($field, $value, $list) {\n\t\t$rc = array();\n\t\tsettype($value, 'string');\n\t\tforeach ($list AS $record) {\n\t\t\t$v = $record[$field];\n\t\t\tsettype($v, 'string');\n\t\t\tif ($value === $v) $rc[] = $record;\n\t\t}\n\t\treturn $rc;\n\t}",
"protected function applyValuesToQuery()\n {\n if (empty($this->parameterValuesSelected))\n return;\n $values = [];\n foreach ($this->parameterValuesSelected as $parameterId => $parameterValues) {\n// var_dump($parameterValuesAsString);die();\n// $parameterValues = explode(',', $parameterValuesAsString);\n if (empty($parameterValues))\n continue;\n foreach ($parameterValues as $parameterValue) {\n if (!empty($parameterValue))\n $values[] = $parameterValue;\n }\n }\n \n if ($values)\n $this->query\n ->leftJoin('ec_parameter_value_product_variation', 'ec_parameter_value_product_variation.product_variation_id = ec_product_variation.id')\n ->andWhere(['IN', 'ec_parameter_value_product_variation.parameter_value_id', $values]);\n }",
"function dynamo_support_topics_filter($query_vars) { \n if(!is_array($query_vars)) return false;\n foreach($query_vars as $array) {\n if($array['key'] == 'ticket_topic') {\n $topics = $array;\n break;\n }\n }\n if(is_array($topics) && !empty($topics)) {\n foreach($topics['value'] as $k => $t) {\n $tops .= \"'$t',\";\n }\n $tops = substr($tops,0,-1);\n $sql =\" AND meta2.meta_key = 'ticket_topic' AND meta2.meta_value IN ($tops)\";\n } else {\n $sql = '';\n }\n return $sql;\n }",
"function filterTuples(&$finalRes) {\r\n\r\n foreach ($this->parsedQuery['filters'] as $filter) {\r\n\r\n foreach ($finalRes as $n => $fRes) {\r\n $evalFilterStr = $filter['evalFilterStr'];\r\n\r\n // evaluate regex equality expressions of each filter\r\n foreach ($filter['regexEqExprs'] as $i => $expr) {\r\n\r\n preg_match($expr['regex'], $fRes[$expr['var']]->getLabel(), $match);\r\n $op = substr($expr['operator'], 0,1);\r\n if (($op != '!' && !isset($match[0])) || ($op == '!' && isset($match[0])))\r\n $evalFilterStr = str_replace(\"##RegEx_$i##\", 'FALSE', $evalFilterStr);\r\n else\r\n $evalFilterStr = str_replace(\"##RegEx_$i##\", 'TRUE', $evalFilterStr);\r\n\r\n }\r\n\r\n // evaluate string equality expressions\r\n foreach ($filter['strEqExprs'] as $i => $expr) {\r\n\r\n $exprBoolVal = 'FALSE';\r\n \r\n switch ($expr['value_type']) {\r\n\r\n case 'variable':\r\n if (($fRes[$expr['var']] == $fRes[$expr['value']] && $expr['operator'] == 'eq') ||\r\n ($fRes[$expr['var']] != $fRes[$expr['value']] && $expr['operator'] == 'ne'))\r\n $exprBoolVal = 'TRUE';\r\n break;\r\n \r\n case 'URI':\r\n\r\n if (is_a($fRes[$expr['var']], 'Literal')) {\r\n if ($expr['operator'] == 'ne')\r\n $exprBoolVal = 'TRUE';\r\n break;\r\n }\r\n\r\n if (($fRes[$expr['var']]->getLabel() == $expr['value'] && $expr['operator'] == 'eq') ||\r\n ($fRes[$expr['var']]->getLabel() != $expr['value'] && $expr['operator'] == 'ne'))\r\n $exprBoolVal = 'TRUE';\r\n break;\r\n \r\n case 'Literal':\r\n\r\n if (!is_a($fRes[$expr['var']], 'Literal')) {\r\n if ($expr['operator'] == 'ne')\r\n $exprBoolVal = 'TRUE';\r\n break;\r\n }\r\n\r\n $filterLiteral= new Literal($expr['value'],$expr['value_lang']);\r\n $filterLiteral->setDatatype($expr['value_dtype']);\r\n \r\n $equal=$fRes[$expr['var']]->equals($filterLiteral);\r\n/* if ($fRes[$expr['var']]->getLabel() == $expr['value'] &&\r\n $fRes[$expr['var']]->getDatatype() == $expr['value_dtype']) {\r\n \r\n $equal = TRUE;\r\n \r\n // Lang tags only differentiate literals in rdf:XMLLiterals and plain literals.\r\n // Therefore if a literal is datatyped ignore the language tag.\r\n if ((($expr['value_dtype'] == NULL) ||\r\n ($expr['value_dtype'] == 'http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral') ||\r\n ($expr['value_dtype'] == 'http://www.w3.org/2001/XMLSchema#string')) &&\r\n (($fRes[$expr['var']]->getLanguage() != $expr['value_lang'])))\r\n \r\n $equal = FALSE;\r\n }else\r\n $equal = FALSE;\r\n */ \r\n if (($equal && $expr['operator'] == 'eq') ||\r\n (!$equal && $expr['operator'] == 'ne'))\r\n $exprBoolVal = 'TRUE';\r\n else\r\n $exprBoolVal = 'FALSE';\r\n\r\n }\r\n $evalFilterStr = str_replace(\"##strEqExpr_$i##\", $exprBoolVal, $evalFilterStr);\r\n }\r\n\r\n // evaluate numerical expressions\r\n foreach ($filter['numExprVars'] as $varName) {\r\n $varValue = \"'\" .$fRes[$varName]->getLabel() .\"'\";\r\n $evalFilterStr = str_replace($varName, $varValue, $evalFilterStr);\r\n }\r\n\r\n eval(\"\\$filterBoolVal = $evalFilterStr; \\$eval_filter_ok = TRUE;\");\r\n if (!isset($eval_filter_ok))\r\n trigger_error(RDQL_AND_ERR .\"'\" .htmlspecialchars($filter['string']) .\"'\", E_USER_ERROR);\r\n\r\n if (!$filterBoolVal)\r\n unset($finalRes[$n]);\r\n }\r\n }\r\n\r\n return $finalRes;\r\n }",
"function appthemes_wp_list_filter( $list, $args = array(), $operator = 'AND', $match = false ) {\n\tif ( ! is_array( $list ) ) {\n\t\treturn array();\n\t}\n\n\tif ( empty( $args ) ) {\n\t\treturn $list;\n\t}\n\n\t$operator = strtoupper( $operator );\n\t$count = count( $args );\n\t$filtered = array();\n\n\tforeach ( $list as $key => $obj ) {\n\t\t$to_match = (array) $obj;\n\t\t$matched = 0;\n\t\tforeach ( $args as $m_key => $m_value ) {\n\t\t\tif ( array_key_exists( $m_key, $to_match ) && ( ( ! $match && in_array( $m_value, (array) $to_match[ $m_key ] ) ) || ( $match && preg_match( \"#{$m_value}#i\", $to_match[ $m_key ] ) ) ) ) {\n\t\t\t\t$matched++;\n\t\t\t}\n\t\t}\n\n\t\tif ( ( 'AND' === $operator && $matched === $count )\n\t\t || ( 'OR' === $operator && $matched > 0 )\n\t\t || ( 'NOT' === $operator && 0 === $matched ) ) {\n\t\t\t$filtered[ $key ] = $obj;\n\t\t}\n\t}\n\n\treturn $filtered;\n}",
"function textquery($k, $v, $objectlist, $speclist, $photolist) {\n\n // Add the appropriate prefix for each table\n // object is t1, spectra is t2, photometry is t3\n if (in_array ($k, $objectlist)) {\n $k = \"t1.\" . $k;}\n elseif (in_array($k, $speclist)) {\n $k = \"t2.\" . $k;}\n elseif (in_array($k, $photolist)) {\n $k = \"t3.\" . $k;}\n\n \n // Check to see if the value was empty\n if (trim($v) == '') {\n $segment = $k . \" IS NULL AND \";\n } else {\n \n // Break up by commas unless it's a reference field\n if ($k == \"t1.LCReference\" || $k == \"t2.Reference\") {\n // For everything else,\n $segment = \"(\" . $k . \" LIKE '\" . $v . \"') AND \";\n } else {\n\n $segment = \"(\";\n $pieces = explode(',',$v);\n // For each item\n for($i=0;$i<count($pieces);$i++) {\n\t\n\t// Strip off any whitespace between items\n\t$v = trim($pieces[$i]);\n\n\t// If the person has a host name of \"Anon\" instead of \"Anon.\"\n\tif ($k == \"t1.HostName\" && $v == 'Anon' OR $v== 'anon') {\n\t $v = 'Anon.';\n\t}\n\n\t$segment = $segment . \"(\" . $k . \" LIKE '\" . $v . \"') OR \";\n }\n \n // Strip off last 'OR'\n $segment = substr($segment, 0, -4) . \") AND \"; \n }\n }\n\n return($segment);\n}",
"function build_query_in ($values)\n\t{\n\t\t$values_formatted = '';\n\t\tforeach ($values as $v)\n\t\t{\n\t\t\t$values_formatted .= ($values_formatted ? ',' : '') . $this->build_safe_value($v);\n\t\t}\n\t\treturn ' IN (' . $values_formatted . ') ';\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the value of customerMessage | public function setCustomerMessage($customerMessage)
{
$this->customerMessage = $customerMessage;
return $this;
} | [
"public function setMessage($value);",
"public function setMessage( $message );",
"public function setMessage($value)\n {\n $this->message = $value;\n }",
"public function setMessage($message);",
"public function _setMessage($message) {\n\t\t$this->_message = $message;\n\t}",
"public function setMessage($value)\n {\n $this->validateString('Message', $value);\n $this->validateNotNull('Message', $value);\n\n if ($this->data['message'] === $value) {\n return;\n }\n\n $this->data['message'] = $value;\n $this->setModified('message');\n }",
"function setCustomerEmail($value)\n {\n $this->setAttribute(\"Customer::Email\", $value);\n }",
"public function setCustomerSenderName($customerSenderName);",
"public function setMessage($strMessage)\n {\n $this->message = $strMessage;\n }",
"abstract public function setter($message);",
"public function setMessageNum($messageNo);",
"public function testSetCustomerError()\n {\n $user = new User();\n $this->cimService->setCustomer($user);\n }",
"public function getCustomerMessage(): ?string\n {\n return $this->_customer_message;\n }",
"public function set_customer_code($value) {\r\n $this->customer_code = $value;\r\n data::add(\"customer_code\", $this->customer_code !== \"\" ? $this->customer_code : NODATA, $this->table_fields);\r\n }",
"public function setMessages($value) \n {\n $this->_fields['Messages']['FieldValue'] = $value;\n return;\n }",
"public function setMessage($message, $reassign = false);",
"public function set_customer_data( $data ) {\n $this->customer_data = $data;\n }",
"public function setMessage($value) {\n $this->html = str_replace('setMessage()',$value,$this->html);\n }",
"public function setCustomerId(?string $customerId): void\n {\n $this->customerId = $customerId;\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Callback for getting comment related node properties. | function entity_metadata_comment_get_node_properties($node, array $options, $name, $entity_type) {
switch ($name) {
case 'comment_count':
return isset($node->comment_count) ? $node->comment_count : 0;
case 'comment_count_new':
return comment_num_new($node->nid);
case 'comments':
$select = db_select('comment', 'c')
->fields('c', array('cid'))
->condition('c.nid', $node->nid);
return array_keys($select->execute()->fetchAllKeyed(0, 0));
}
} | [
"function entity_metadata_comment_get_properties($comment, array $options, $name) {\n switch ($name) {\n case 'name':\n return $comment->name;\n\n case 'mail':\n if ($comment->uid != 0) {\n $account = user_load($comment->uid);\n return $account->mail;\n }\n return $comment->mail;\n\n case 'edit_url':\n return url('comment/edit/' . $comment->cid, $options);\n\n case 'parent':\n if (!empty($comment->pid)) {\n return $comment->pid;\n }\n // There is no parent comment.\n return NULL;\n }\n}",
"public function getComments(Node $node) {\n\n }",
"public function getCommentVars();",
"function get_comment() {\n\t\treturn $this->comment;\n\t}",
"public function get_comment() { return $this->_comment; }",
"function COMMENT()\r\n\t{\r\n\t\treturn new ResProperty(RDF_SCHEMA_URI.RDFS_COMMENT);\t\r\n\t}",
"protected function parse_comment_node( $node ) {\n\t\t$data = array(\n\t\t\t'commentmeta' => array(),\n\t\t);\n\n\t\tforeach ( $node->childNodes as $child ) {\n\t\t\t// We only care about child elements\n\t\t\tif ( $child->nodeType !== XML_ELEMENT_NODE ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tswitch ( $child->tagName ) {\n\t\t\t\tcase 'wp:comment_id':\n\t\t\t\t\t$data['comment_id'] = $child->textContent;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'wp:comment_author':\n\t\t\t\t\t$data['comment_author'] = $child->textContent;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'wp:comment_author_email':\n\t\t\t\t\t$data['comment_author_email'] = $child->textContent;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'wp:comment_author_IP':\n\t\t\t\t\t$data['comment_author_IP'] = $child->textContent;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'wp:comment_author_url':\n\t\t\t\t\t$data['comment_author_url'] = $child->textContent;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'wp:comment_user_id':\n\t\t\t\t\t$data['comment_user_id'] = $child->textContent;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'wp:comment_date':\n\t\t\t\t\t$data['comment_date'] = $child->textContent;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'wp:comment_date_gmt':\n\t\t\t\t\t$data['comment_date_gmt'] = $child->textContent;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'wp:comment_content':\n\t\t\t\t\t$data['comment_content'] = $child->textContent;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'wp:comment_approved':\n\t\t\t\t\t$data['comment_approved'] = $child->textContent;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'wp:comment_type':\n\t\t\t\t\t$data['comment_type'] = $child->textContent;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'wp:comment_parent':\n\t\t\t\t\t$data['comment_parent'] = $child->textContent;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'wp:commentmeta':\n\t\t\t\t\t$meta_item = $this->parse_meta_node( $child );\n\t\t\t\t\tif ( ! empty( $meta_item ) ) {\n\t\t\t\t\t\t$data['commentmeta'][] = $meta_item;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn $data;\n\t}",
"public function get_comment_feed_permastruct()\n {\n }",
"public function getComment()\n {\n return $this->fields['comment'];\n }",
"public function getComments()\n {\n return $this->comments;\n }",
"public function getCommentText()\n {\n return $this->commenttext;\n }",
"public function getComments()\n {\n return $this->_comments;\n }",
"public function getComment() {\n return $this->getValue(self::FIELD_COMMENT);\n }",
"public function getCommentContent()\n {\n return $this->commentContent;\n }",
"public function getCommentContent()\r\n {\r\n return $this->comment_content;\r\n }",
"public function getComment(): string\n {\n return $this->comment;\n }",
"protected function getCommentAttributes()\n {\n $this->url = app('veer')->siteUrl;\n\n $this->subject = Lang::get('veeradmin.emails.comment.subject',\n array('url' => $this->url));\n }",
"public function getComment()\n {\n return $this->image['comment'];\n }",
"public function getCommentContent() {\n\t\treturn $this->commentContent;\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Operation putQualityConversationEvaluationAsync Update an evaluation | public function putQualityConversationEvaluationAsync($conversationId, $evaluationId, $body, $expand = null)
{
return $this->putQualityConversationEvaluationAsyncWithHttpInfo($conversationId, $evaluationId, $body, $expand)
->then(
function ($response) {
return $response[0];
}
);
} | [
"public function putQualityConversationEvaluation($conversationId, $evaluationId, $body, $expand = null)\n {\n list($response) = $this->putQualityConversationEvaluationWithHttpInfo($conversationId, $evaluationId, $body, $expand);\n return $response;\n }",
"protected function putQualityConversationEvaluationRequest($conversationId, $evaluationId, $body, $expand = null)\n {\n // verify the required parameter 'conversationId' is set\n if ($conversationId === null || (is_array($conversationId) && count($conversationId) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $conversationId when calling putQualityConversationEvaluation'\n );\n }\n // verify the required parameter 'evaluationId' is set\n if ($evaluationId === null || (is_array($evaluationId) && count($evaluationId) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $evaluationId when calling putQualityConversationEvaluation'\n );\n }\n // verify the required parameter 'body' is set\n if ($body === null || (is_array($body) && count($body) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $body when calling putQualityConversationEvaluation'\n );\n }\n\n $resourcePath = '/api/v2/quality/conversations/{conversationId}/evaluations/{evaluationId}';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n // query params\n if ($expand !== null) {\n $queryParams['expand'] = ObjectSerializer::toQueryValue($expand);\n }\n\n // path params\n if ($conversationId !== null) {\n $resourcePath = str_replace(\n '{' . 'conversationId' . '}',\n ObjectSerializer::toPathValue($conversationId),\n $resourcePath\n );\n }\n // path params\n if ($evaluationId !== null) {\n $resourcePath = str_replace(\n '{' . 'evaluationId' . '}',\n ObjectSerializer::toPathValue($evaluationId),\n $resourcePath\n );\n }\n\n // body params\n $_tempBody = null;\n if (isset($body)) {\n $_tempBody = $body;\n }\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n ['application/json']\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n ['application/json'],\n ['application/json']\n );\n }\n\n // for model (json/xml)\n if (isset($_tempBody)) {\n // $_tempBody is the method argument, if present\n $httpBody = $_tempBody;\n \n if($headers['Content-Type'] === 'application/json') {\n // \\stdClass has no __toString(), so we should encode it manually\n if ($httpBody instanceof \\stdClass) {\n $httpBody = \\GuzzleHttp\\json_encode($httpBody);\n }\n // array has no __toString(), so we should encode it manually\n if(is_array($httpBody)) {\n $httpBody = \\GuzzleHttp\\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));\n }\n }\n } elseif (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValue\n ];\n }\n // for HTTP post (form)\n $httpBody = new MultipartStream($multipartContents);\n\n } elseif ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($formParams);\n\n } else {\n // for HTTP post (form)\n $httpBody = \\GuzzleHttp\\Psr7\\build_query($formParams);\n }\n }\n\n // this endpoint requires OAuth (access token)\n if ($this->config->getAccessToken() !== null) {\n $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();\n }\n\n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['User-Agent'] = $this->config->getUserAgent();\n }\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n\n $query = \\GuzzleHttp\\Psr7\\build_query($queryParams);\n return new Request(\n 'PUT',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }",
"public function updating(Evaluation $evaluation)\n {\n //\n }",
"public function update(Request $putReq, evaluation $evaluation)\n {\n $this->authorize('update', $evaluation);\n\n $evaluation->date = $putReq->input('date');\n $evaluation->evaluation = $putReq->input('evaluation');\n\n $evaluation->save();\n }",
"public function set_evaluation($evaluation)\n {\n clearos_profile(__METHOD__, __LINE__);\n\n $this->item[$this->id]['evaluation'] = $evaluation;\n }",
"public function supervisor_can_update_evaluation()\n {\n \n // $response = $this->json('POST','/api/update/evaluation', [ \n // 'id' => 3, \n // 'key_result_area' => \"update key result area test\",\n // 'month_of_evaluation' => date('Y-d-m',strtotime('2021-04-12'))\n // ]);\n \n // $response->assertStatus(200);\n }",
"public function postQualityConversationEvaluations($conversationId, $body, $expand = null)\n {\n list($response) = $this->postQualityConversationEvaluationsWithHttpInfo($conversationId, $body, $expand);\n return $response;\n }",
"protected function postQualityConversationEvaluationsRequest($conversationId, $body, $expand = null)\n {\n // verify the required parameter 'conversationId' is set\n if ($conversationId === null || (is_array($conversationId) && count($conversationId) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $conversationId when calling postQualityConversationEvaluations'\n );\n }\n // verify the required parameter 'body' is set\n if ($body === null || (is_array($body) && count($body) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $body when calling postQualityConversationEvaluations'\n );\n }\n\n $resourcePath = '/api/v2/quality/conversations/{conversationId}/evaluations';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n // query params\n if ($expand !== null) {\n $queryParams['expand'] = ObjectSerializer::toQueryValue($expand);\n }\n\n // path params\n if ($conversationId !== null) {\n $resourcePath = str_replace(\n '{' . 'conversationId' . '}',\n ObjectSerializer::toPathValue($conversationId),\n $resourcePath\n );\n }\n\n // body params\n $_tempBody = null;\n if (isset($body)) {\n $_tempBody = $body;\n }\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n ['application/json']\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n ['application/json'],\n ['application/json']\n );\n }\n\n // for model (json/xml)\n if (isset($_tempBody)) {\n // $_tempBody is the method argument, if present\n $httpBody = $_tempBody;\n \n if($headers['Content-Type'] === 'application/json') {\n // \\stdClass has no __toString(), so we should encode it manually\n if ($httpBody instanceof \\stdClass) {\n $httpBody = \\GuzzleHttp\\json_encode($httpBody);\n }\n // array has no __toString(), so we should encode it manually\n if(is_array($httpBody)) {\n $httpBody = \\GuzzleHttp\\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));\n }\n }\n } elseif (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValue\n ];\n }\n // for HTTP post (form)\n $httpBody = new MultipartStream($multipartContents);\n\n } elseif ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($formParams);\n\n } else {\n // for HTTP post (form)\n $httpBody = \\GuzzleHttp\\Psr7\\build_query($formParams);\n }\n }\n\n // this endpoint requires OAuth (access token)\n if ($this->config->getAccessToken() !== null) {\n $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();\n }\n\n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['User-Agent'] = $this->config->getUserAgent();\n }\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n\n $query = \\GuzzleHttp\\Psr7\\build_query($queryParams);\n return new Request(\n 'POST',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }",
"public function setEvaluation($var)\n {\n GPBUtil::checkString($var, True);\n $this->evaluation = $var;\n\n return $this;\n }",
"public function getQualityConversationEvaluationAsyncWithHttpInfo($conversationId, $evaluationId, $expand = null)\n {\n $returnType = '\\PureCloudPlatform\\Client\\V2\\Model\\Evaluation';\n $request = $this->getQualityConversationEvaluationRequest($conversationId, $evaluationId, $expand);\n\n return $this->client\n ->sendAsync($request, $this->createHttpClientOption())\n ->then(\n function ($response) use ($returnType) {\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n if ($returnType !== 'string') {\n $content = json_decode($content);\n }\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n },\n function ($exception) {\n $response = $exception->getResponse();\n $statusCode = $response->getStatusCode();\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $exception->getRequest()->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n );\n }",
"public function getQualityConversationEvaluationWithHttpInfo($conversationId, $evaluationId, $expand = null)\n {\n $returnType = '\\PureCloudPlatform\\Client\\V2\\Model\\Evaluation';\n $request = $this->getQualityConversationEvaluationRequest($conversationId, $evaluationId, $expand);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n if ($returnType !== 'string') {\n $content = json_decode($content);\n }\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\PureCloudPlatform\\Client\\V2\\Model\\Evaluation',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 400:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\PureCloudPlatform\\Client\\V2\\Model\\ErrorBody',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 401:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\PureCloudPlatform\\Client\\V2\\Model\\ErrorBody',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 403:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\PureCloudPlatform\\Client\\V2\\Model\\ErrorBody',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 404:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\PureCloudPlatform\\Client\\V2\\Model\\ErrorBody',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 413:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\PureCloudPlatform\\Client\\V2\\Model\\ErrorBody',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 415:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\PureCloudPlatform\\Client\\V2\\Model\\ErrorBody',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 429:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\PureCloudPlatform\\Client\\V2\\Model\\ErrorBody',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 500:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\PureCloudPlatform\\Client\\V2\\Model\\ErrorBody',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 503:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\PureCloudPlatform\\Client\\V2\\Model\\ErrorBody',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 504:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\PureCloudPlatform\\Client\\V2\\Model\\ErrorBody',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n }\n throw $e;\n }\n }",
"public function addVideoAssessment($evalData = null){\n\t\tif(!$evalData)\n\t\t\treturn false;\n\n\t\t$result = 0;\n\t\t$responseId = $evalData->responseId;\n\n\t\t//Ensure that this user can evaluate this response\n\t\tif(!$this->_responseNotEvaluatedByUser($responseId) || !$this->_responseRatingCountBelowThreshold($responseId))\n\t\t\treturn $result;\n\n\n\t\t$this->conn->_startTransaction();\n\n\t\t//Insert the evaluation data\n\t\t$sql = \"INSERT INTO evaluation (fk_response_id, fk_user_id, score_overall, score_intonation, score_fluency, score_rhythm, score_spontaneity, comment, adding_date) VALUES (\";\n\t\t$sql = $sql . \"'%d', \";\n\t\t$sql = $sql . \"'%d', \";\n\t\t$sql = $sql . \"'%d', \";\n\t\t$sql = $sql . \"'%d', \";\n\t\t$sql = $sql . \"'%d', \";\n\t\t$sql = $sql . \"'%d', \";\n\t\t$sql = $sql . \"'%d', \";\n\t\t$sql = $sql . \"'%s', NOW() )\";\n\n\t\t$evaluationId = $this->conn->_insert ( $sql, $evalData->responseId, $_SESSION['uid'], $evalData->overallScore,\n\t\t\t\t\t\t $evalData->intonationScore, $evalData->fluencyScore, $evalData->rhythmScore,\n\t\t\t\t\t\t $evalData->spontaneityScore, $evalData->comment );\n\n\t\tif(!$evaluationId){\n\t\t\t$this->conn->_failedTransaction();\n\t\t\tthrow new Exception(\"Evaluation save failed\");\n\t\t}\n\n\t\t//Insert video evaluation data\n\t\t$this->_getResourceDirectories();\n\n\t\ttry{\n\t\t\t$videoPath = $this->red5Path .'/'. $this->evaluationFolder .'/'. $evalData->evaluationVideoFileIdentifier . '.flv';\n\t\t\t$mediaData = $this->mediaHelper->retrieveMediaInfo($videoPath);\n\t\t\t$duration = $mediaData->duration;\n\t\t\t$thumbnail = 'nothumb.png';\n\t\t\tif($mediaData->hasVideo){\n\t\t\t\t$snapshot_output = $this->mediaHelper->takeFolderedRandomSnapshots($videoPath, $this->imagePath, $this->posterPath);\n\t\t\t\t$thumbnail = 'default.jpg';\n\t\t\t}\n\t\t} catch (Exception $e){\n\t\t\tthrow new Exception($e->getMessage());\n\t\t}\n\n\n\n\t\t$sql = \"INSERT INTO evaluation_video (fk_evaluation_id, video_identifier, source, thumbnail_uri) VALUES (\";\n\t\t$sql = $sql . \"'%d', \";\n\t\t$sql = $sql . \"'%s', \";\n\t\t$sql = $sql . \"'Red5', \";\n\t\t$sql = $sql . \"'%s')\";\n\t\t\n\t\t$evaluationVideoId = $this->conn->_insert ( $sql, $evaluationId, $evalData->evaluationVideoFileIdentifier, $thumbnail );\n\t\tif(!$evaluationVideoId){\n\t\t\t$this->conn->_failedTransaction();\n\t\t\tthrow new Exception(\"Evaluation save failed\");\n\t\t}\n\n\t\t//Update the rating count for this response\n\n\t\t$update = $this->_updateResponseRatingAmount($responseId);\n\t\tif(!$update){\n\t\t\t$this->conn->_failedTransaction();\n\t\t\tthrow new Exception(\"Evaluation save failed\");\n\t\t}\n\n\t\t//Update the user's credit count\n\t\t$creditUpdate = $this->_addCreditsForEvaluating();\n\t\tif(!$creditUpdate){\n\t\t\t$this->conn->_failedTransaction();\n\t\t\tthrow new Exception(\"Credit addition failed\");\n\t\t}\n\n\t\t//Update the credit history\n\t\t$creditHistoryInsert = $this->_addEvaluatingToCreditHistory($responseId, $evaluationId);\n\t\tif(!$creditHistoryInsert){\n\t\t\t$this->conn->_failedTransaction();\n\t\t\tthrow new Exception(\"Credit history update failed\");\n\t\t}\n\n\t\tif($evaluationId && $update && $creditUpdate && $creditHistoryInsert){\n\t\t\t$this->conn->_endTransaction();\n\t\t\t$result = $this->_getUserInfo();\n\t\t\t$this->_notifyUserAboutResponseBeingAssessed($evalData);\n\t\t}\n\n\t\treturn $result;\n\n\t}",
"public function deleteQualityConversationEvaluation($conversationId, $evaluationId, $expand = null)\n {\n list($response) = $this->deleteQualityConversationEvaluationWithHttpInfo($conversationId, $evaluationId, $expand);\n return $response;\n }",
"public function deleteQualityConversationEvaluationWithHttpInfo($conversationId, $evaluationId, $expand = null)\n {\n $returnType = '\\PureCloudPlatform\\Client\\V2\\Model\\Evaluation';\n $request = $this->deleteQualityConversationEvaluationRequest($conversationId, $evaluationId, $expand);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n if ($returnType !== 'string') {\n $content = json_decode($content);\n }\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\PureCloudPlatform\\Client\\V2\\Model\\Evaluation',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 400:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\PureCloudPlatform\\Client\\V2\\Model\\ErrorBody',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 401:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\PureCloudPlatform\\Client\\V2\\Model\\ErrorBody',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 403:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\PureCloudPlatform\\Client\\V2\\Model\\ErrorBody',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 404:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\PureCloudPlatform\\Client\\V2\\Model\\ErrorBody',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 413:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\PureCloudPlatform\\Client\\V2\\Model\\ErrorBody',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 415:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\PureCloudPlatform\\Client\\V2\\Model\\ErrorBody',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 429:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\PureCloudPlatform\\Client\\V2\\Model\\ErrorBody',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 500:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\PureCloudPlatform\\Client\\V2\\Model\\ErrorBody',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 503:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\PureCloudPlatform\\Client\\V2\\Model\\ErrorBody',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 504:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\PureCloudPlatform\\Client\\V2\\Model\\ErrorBody',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n }\n throw $e;\n }\n }",
"public function addEval(Request $request)\n {\n \n // INPUT PRE-REQ VALUES\n $assesseeEmployee = employee_data::find($request->input('assesseeEmployeeID'));\n $assessorEmployee = employee_data::find($request->input('assessorEmployeeID'));\n $assessmentType = assessmentType::find($request->input('assessmentTypeID'));\n \n $givenLevelID = level::find($request->input('givenLevelID'));\n $modelItem = listOfCompetenciesPerRole::where('id',$request->input('modelCompetencyID'))->first();\n \n $assessmentResult = assessment::where('employeeID',$assesseeEmployee->id)->where('assessmentTypeID',$assessmentType->id)->whereNull('deleted_at')->first();\n if($assessmentResult){\n $initAssessment = assessment::where('employeeID',$assesseeEmployee->id)->where('assessmentTypeID',$assessmentType->id)->whereNull('deleted_at')->first();\n }else{\n \n $assessmentNew = new assessment;\n $assessmentNew->employeeID = $assesseeEmployee->id;\n $assessmentNew->evaluationVersionID = 0;\n $assessmentNew->assessmentTypeID = $assessmentType->id;\n $assessmentNew->save();\n\n $initAssessment = assessment::where('employeeID',$assesseeEmployee->employeeID)->where('evaluationVersionID',0)->where('assessmentTypeID',$assessmentType->id)->whereNull('deleted_at')->first();\n }\n\n if($initAssessment->evaluationVersionID == 0){\n $evaluationNew = new evaluation;\n $evaluationNew->assessmentID = $initAssessment->id;\n $evaluationNew->assesseeEmployeeID = $assesseeEmployee->id;\n $evaluationNew->assessorEmployeeID = $assessorEmployee->id;\n $evaluationNew->assesseeRoleID = $assesseeEmployee->roleID;\n $evaluationNew->assessorRoleID = $assessorEmployee->roleID;\n $evaluationNew->save();\n\n $initEvaluation = evaluation::where('assessmentID',$initAssessment->id)\n ->where('assesseeEmployeeID',$assesseeEmployee->id)\n ->where('assessorEmployeeID',$assessorEmployee->id)\n ->where('assesseeRoleID',$assesseeEmployee->roleID)\n ->orderBy('created_at','desc')\n ->whereNull('deleted_at')\n ->first();\n \n $assessmentUpdate = assessment::find($initAssessment->id);\n $assessmentUpdate->evaluationVersionID = $initEvaluation->id;\n $assessmentUpdate->save();\n $sample = 'updated';\n }else{\n $initEvaluation = evaluation::where('assessmentID',$initAssessment->id)\n ->where('assesseeEmployeeID',$assesseeEmployee->id)\n ->where('assessorEmployeeID',$assessorEmployee->id)\n ->where('assesseeRoleID',$assesseeEmployee->roleID)\n ->where('id',$initAssessment->evaluationVersionID)\n ->whereNull('deleted_at')\n ->first();\n $sample = 'no change';\n\n if ($initEvaluation) {\n //success\n } else {\n $evaluationNewRole = new evaluation;\n $evaluationNewRole->assessmentID = $initAssessment->id;\n $evaluationNewRole->assesseeEmployeeID = $assesseeEmployee->id;\n $evaluationNewRole->assessorEmployeeID = $assessorEmployee->id;\n $evaluationNewRole->assesseeRoleID = $assesseeEmployee->roleID;\n $evaluationNewRole->assessorRoleID = $assessorEmployee->roleID;\n $evaluationNewRole->save();\n\n $initEvaluation = evaluation::where('assessmentID',$initAssessment->id)\n ->where('assesseeEmployeeID',$assesseeEmployee->id)\n ->where('assessorEmployeeID',$assessorEmployee->id)\n ->where('assesseeRoleID',$assesseeEmployee->roleID)\n ->orderBy('created_at','desc')\n ->whereNull('deleted_at')\n ->first();\n \n $assessmentUpdate = assessment::find($initAssessment->id);\n $assessmentUpdate->evaluationVersionID = $initEvaluation->id;\n $assessmentUpdate->save();\n }\n \n }\n\n\n $evaluationCompetencyItem = evaluationCompetency::where('evaluationID',$initEvaluation->id)\n ->where('competencyID',$modelItem->competencyID)\n ->where('competencyTypeID',$modelItem->competencyTypeID)\n ->where('targetLevelID',$modelItem->targetLevelID)\n ->whereNull('deleted_at')\n ->first();\n\n if($evaluationCompetencyItem){\n $updateEvaluationCompetency = evaluationCompetency::find($evaluationCompetencyItem->id);\n $updateEvaluationCompetency->givenLevelID = $givenLevelID->id;\n $updateEvaluationCompetency->weightedScore = $givenLevelID->weight;\n $updateEvaluationCompetency->save();\n \n $text = 'Assessment Updated';\n }else {\n $evaluationCompetencyNew = new evaluationCompetency;\n $evaluationCompetencyNew->evaluationID = $initEvaluation->id;\n $evaluationCompetencyNew->competencyID = $modelItem->competencyID;\n $evaluationCompetencyNew->givenLevelID = $givenLevelID->id;\n $evaluationCompetencyNew->targetLevelID = $modelItem->targetLevelID;\n $evaluationCompetencyNew->weightedScore = $givenLevelID->weight;\n $evaluationCompetencyNew->competencyTypeID = $modelItem->competencyTypeID;\n $evaluationCompetencyNew->verbatim = \"N/A\";\n $evaluationCompetencyNew->additional_file = \"N/A\";\n $evaluationCompetencyNew->save();\n $text = 'Assessment Answered';\n }\n\n $test = $request->input('givenLevelID');\n return response()->json(['message'=>$text]);\n }",
"public function updateEvalBriefs($assignmentUuid, $activityUuid, $evalDetails)\n {\n $assignment = $this->findByPK($assignmentUuid);\n if (empty($assignment->state_itemEvalBriefs)) {\n $assignment->state_itemEvalBriefs = [];\n }\n\n /*\n * state_itemEvalBriefs {{\n * {\n * activityId: activityId,\n * attemptNum: attemptNum,\n * secondsSpent: secondsSpent,\n * aggregateResult: aggregateResult\n * }\n * }}\n *\n */\n $length = count($assignment->state_itemEvalBriefs);\n for($i=0; $i < $length; $i++ ) {\n $evalBrief = new stdClass();\n $evalBrief->attemptNum = $evalDetails->evalResult->attemptNum;\n $evalBrief->secondsSpent = $evalDetails->submission->secondsSpent;\n $evalBrief->aggregateResult = $evalDetails->evalResult->aggregate;\n if ($assignment->state_itemEvalBriefs[$i]->activityId == $activityUuid) {\n $assignment->state_itemEvalBriefs[$i] = $evalBrief;\n } else {\n array_push($assignment->state_itemEvalBriefs, $evalBrief);\n }\n }\n $assignment->save();\n }",
"private function _addEvaluatingToCreditHistory($responseId, $evaluationId){\n\t\t$sql = \"SELECT prefValue FROM preferences WHERE ( prefName= 'evaluatedWithVideoCredits' )\";\n\t\t$row = $this->conn->_singleSelect ( $sql );\n\t\tif($row){\n\t\t\t$changeAmount = $row->prefValue;\n\t\t\t$sql = \"SELECT fk_exercise_id FROM response WHERE (id='%d')\";\n\t\t\t$row = $this->conn->_singleSelect($sql, $responseId);\n\t\t\tif($row){\n\t\t\t\t$exerciseId = $row->fk_exercise_id;\n\t\t\t\t$sql = \"INSERT INTO credithistory (fk_user_id, fk_exercise_id, fk_response_id, fk_eval_id, changeDate, changeType, changeAmount) \";\n\t\t\t\t$sql = $sql . \"VALUES ('%d', '%d', '%d', '%d', NOW(), '%s', '%d') \";\n\t\t\t\treturn $this->conn->_insert($sql, $_SESSION['uid'], $exerciseId, $responseId, $evaluationId, 'evaluation', $changeAmount);\n\t\t\t} else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}",
"public function deleteQualityConversationEvaluationAsync($conversationId, $evaluationId, $expand = null)\n {\n return $this->deleteQualityConversationEvaluationAsyncWithHttpInfo($conversationId, $evaluationId, $expand)\n ->then(\n function ($response) {\n return $response[0];\n }\n );\n }",
"public function updateQuality(): void\n {\n $this->getItem()->quality = $this->getNewQuality();\n\n if ($this->isQualityOverHighestValue()) {\n $this->setToHighestQuality();\n }\n if ($this->isQualityUnderLowestValue()) {\n $this->setToLowestQuality();\n }\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the Environment Tier for this environment. | function get_environment_tier() : string {
if ( defined( 'ALTIS_ENVIRONMENT_TIER' ) ) {
return ALTIS_ENVIRONMENT_TIER;
}
return 'legacy';
} | [
"public function tier() {\n return array_key_exists($this->envKeyName, $this->env) ? $this->env[$this->envKeyName] : $this->defaultTier;\n }",
"public function getTier()\n {\n return $this->tier;\n }",
"public function getTier()\n {\n return $this->tier instanceof PriceTierBuilder ? $this->tier->build() : $this->tier;\n }",
"public function getTiersMode()\n {\n return $this->getParameter('tiers_mode');\n }",
"public static function get_environment() {\n\t\tif (Config::inst()->get('PaymentGateway', 'environment')) {\n\t\t\treturn Config::inst()->get('PaymentGateway', 'environment');\n\t\t} else {\n\t\t\treturn Director::get_environment_type();\n\t\t}\n\t}",
"public function getEnvironment()\n {\n return $this->getItemContainer()->getEnvironment();\n }",
"public function getEnvironment() {\n return $this->env;\n }",
"public function getNetworkTier()\n {\n return isset($this->network_tier) ? $this->network_tier : 0;\n }",
"public function getFreeTier()\n {\n return $this->free_tier;\n }",
"public function getEnvironment();",
"public function getEnvironmentExterior() {\n return $this->get(self::ENVIRONMENT_EXTERIOR);\n }",
"public function getNetworkTier()\n {\n return isset($this->network_tier) ? $this->network_tier : '';\n }",
"public function getLoyaltyTier()\n {\n return isset($this->loyalty_tier) ? $this->loyalty_tier : '';\n }",
"public function environment()\n {\n return $this->_environment;\n }",
"function getEnvironmentClass()\n {\n return $this->conventionHelper->getEnvironmentClass( $this );\n }",
"protected function deriveEnvironment()\n {\n $confDir = $this->getAppConfigDir();\n\n if (file_exists($confDir . 'development.php')) {\n return 'development';\n } elseif (file_exists($confDir . 'testing.php')) {\n return 'testing';\n } elseif (file_exists($confDir . 'production.php')) {\n return 'production';\n } else {\n throw new \\RuntimeException(\n 'Environment Not Specified And Unable To Derive',\n 500\n );\n }\n }",
"function getPaidTier() {\n\t\treturn $this->paidTier;\n\t}",
"public function getTierAttribute()\n {\n return $this->nomination->tier_label;\n }",
"public function getTypeEnv()\n {\n return $this->type_env;\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Singleton access to EbizmartsSagePaySuiteGuestServerManagementV1 controller | public function getEbizmartsSagePaySuiteGuestServerManagementV1()
{
return Controllers\EbizmartsSagePaySuiteGuestServerManagementV1Controller::getInstance();
} | [
"public function getEbizmartsSagePaySuiteServerManagementV1()\n {\n return Controllers\\EbizmartsSagePaySuiteServerManagementV1Controller::getInstance();\n }",
"public function getEbizmartsSagePaySuiteGuestPiManagementV1()\n {\n return Controllers\\EbizmartsSagePaySuiteGuestPiManagementV1Controller::getInstance();\n }",
"public function getEbizmartsSagePaySuiteGuestPayPalManagementV1()\n {\n return Controllers\\EbizmartsSagePaySuiteGuestPayPalManagementV1Controller::getInstance();\n }",
"public function getEbizmartsSagePaySuiteGuestFormManagementV1()\n {\n return Controllers\\EbizmartsSagePaySuiteGuestFormManagementV1Controller::getInstance();\n }",
"public function getEbizmartsSagePaySuitePayPalManagementV1()\n {\n return Controllers\\EbizmartsSagePaySuitePayPalManagementV1Controller::getInstance();\n }",
"function getInstance() {\n return XP_Controller::get_instance();\n}",
"public function getCheckoutGuestPaymentInformationManagementV1()\n {\n return Controllers\\CheckoutGuestPaymentInformationManagementV1Controller::getInstance();\n }",
"public function getEbizmartsSagePaySuiteFormManagementV1()\n {\n return Controllers\\EbizmartsSagePaySuiteFormManagementV1Controller::getInstance();\n }",
"protected function getFrontendController() {}",
"function getInstance(){\n\treturn MVC_controller::getInstance();\n}",
"public function getCheckoutGuestShippingInformationManagementV1()\n {\n return Controllers\\CheckoutGuestShippingInformationManagementV1Controller::getInstance();\n }",
"static function managementApiAuth(){\n $token = EditpressPaywall::generateAuth0Token();\n return new Management( $token, getenv('AUTH0_DOMAIN') );\n }",
"public function __construct()\n {\n \t\t$this->controller = new AdminManage;\n \t}",
"public function __construct(){\n\t\tself::$server = $_SERVER;\n\t}",
"protected function _initFrontController() {\n $slug_plural = Engine_Api::_()->getApi('settings', 'core')->getSetting('siteevent.slugplural', 'event-items');\n if (strstr($_SERVER['REQUEST_URI'], \"/\".$slug_plural.\"/payment\") &&\n isset($_GET['token']) &&\n !empty($_GET['token']) &&\n Engine_Api::_()->getDbtable('modules', 'core')->isModuleEnabled('siteeventpaid')\n ) {\n $packagePaymentSession = new Zend_Session_Namespace();\n if (!isset($packagePaymentSession->eventUserToken)) {\n if (($event_id = $_GET['event_id']) &&\n !isset($packagePaymentSession->event_id)\n ) {\n $packagePaymentSession->event_id = $event_id;\n }\n $packagePaymentSession->eventUserToken = $_GET['token'];\n }\n }\n\n // Check if webview opened for payment set token and subscription id\n if (strstr($_SERVER['REQUEST_URI'], \"/payment/subscription\") &&\n isset($_GET['token']) &&\n !empty($_GET['token']) &&\n Engine_Api::_()->hasModuleBootstrap('payment')\n ) {\n $apiSubscriptionSession = new Zend_Session_Namespace();\n if (!isset($apiSubscriptionSession->token)) {\n if (($subscription_id = $_GET['subscription_id']) &&\n $subscription = Engine_Api::_()->getItem('payment_subscription', $subscription_id) &&\n !isset($apiSubscriptionSession->subscription_id)\n ) {\n $apiSubscriptionSession->subscription_id = $subscription_id;\n }\n $apiSubscriptionSession->token = $_GET['token'];\n }\n }\n // Check if webview opened for sitereview package payment set token and listing id\n if (strstr($_SERVER['REQUEST_URI'], \"listings/payment\") &&\n isset($_GET['token']) &&\n !empty($_GET['token']) &&\n Engine_Api::_()->getDbtable('modules', 'core')->isModuleEnabled('sitereviewpaidlisting')\n ) {\n $sitereviewPaymentSession = new Zend_Session_Namespace();\n if (!isset($sitereviewPaymentSession->sitereviewToken)) {\n if (($listing_id = $_GET['listing_id']) &&\n !isset($sitereviewPaymentSession->listing_id)\n ) {\n $sitereviewPaymentSession->listing_id = $listing_id;\n }\n if (($listingtype_id = $_GET['listingtype_id']) &&\n !isset($sitereviewPaymentSession->listingtype_id)\n ) {\n $sitereviewPaymentSession->listingtype_id = $listingtype_id;\n }\n $sitereviewPaymentSession->sitereviewToken = $_GET['token'];\n }\n }\n // Check if webview opened for package payment set token and page id\n if (strstr($_SERVER['REQUEST_URI'], \"/pageitems/payment\") &&\n isset($_GET['token']) &&\n !empty($_GET['token']) &&\n Engine_Api::_()->getApi('settings', 'core')->getSetting('sitepage.package.enable', 1)\n ) {\n $packagePaymentSession = new Zend_Session_Namespace();\n $packagePaymentSession->maintain = false;\n\n if (!isset($packagePaymentSession->pagetUserToken)) {\n if (($page_id = $_GET['page_id']) &&\n !isset($packagePaymentSession->page_id)\n ) {\n $packagePaymentSession->page_id = $page_id;\n }\n $packagePaymentSession->pagetUserToken = $_GET['token'];\n }\n }\n \n if( strstr($_SERVER['REQUEST_URI'], \"/groupitems/payment\") &&\n isset($_GET['token']) &&\n !empty($_GET['token']) &&\n Engine_Api::_()->getApi('settings', 'core')->getSetting('sitegroup.package.enable', 1)\n ) {\n \n $packagePaymentSession = new Zend_Session_Namespace();\n $packagePaymentSession->maintain=false;\n if( !isset($packagePaymentSession->groupUserToken) ) {\n if( ($group_id = $_GET['group_id']) &&\n !isset($packagePaymentSession->group_id)\n ) { \n $packagePaymentSession->group_id = $group_id;\n }\n $packagePaymentSession->groupUserToken = $_GET['token'];\n }\n elseif($_GET['group_id']){\n $packagePaymentSession->group_id= $_GET['group_id'];\n \n\n }\n }\n \n //store package payment work\n $routeStartP = Engine_Api::_()->getApi('settings', 'core')->getSetting('sitestore.manifestUrlP', \"storeitems\");\n if( strstr($_SERVER['REQUEST_URI'], \"/\".$routeStartP.\"/payment\") &&\n isset($_GET['token']) &&\n !empty($_GET['token']) &&\n Engine_Api::_()->getApi('settings', 'core')->getSetting('sitestore.package.enable', 1)\n ) {\n \n $packagePaymentSession = new Zend_Session_Namespace();\n $packagePaymentSession->maintain=false;\n if( !isset($packagePaymentSession->storeUserToken) ) {\n if( ($store_id= $_GET['store_id']) &&\n !isset($packagePaymentSession->store_id)\n ) { \n $packagePaymentSession->store_id = $store_id;\n }\n $packagePaymentSession->storeUserToken = $_GET['token'];\n }\n elseif($_GET['store_id']){\n $packagePaymentSession->store_id= $_GET['store_id'];\n \n\n }\n }\n\n $this->initActionHelperPath();\n // Initialize FriendPopups helper\n Zend_Controller_Action_HelperBroker::addHelper(new Siteapi_Controller_Action_Helper_Dispatch());\n\n include APPLICATION_PATH . '/application/modules/Siteapi/controllers/license/license.php';\n }",
"protected function getSEMrushLoginActionService()\n {\n }",
"public function getServer()\n {\n $this->server\n ->setApiPath('/tus') // tus server endpoint.\n ->setUploadDir($this->params->get('kernel.project_dir') . '/var/uploads'); // uploads dir.\n\n return $this->server;\n }",
"public function getQuoteGuestPaymentMethodManagementV1()\n {\n return Controllers\\QuoteGuestPaymentMethodManagementV1Controller::getInstance();\n }",
"public function getSalesShipmentManagementV1()\n {\n return Controllers\\SalesShipmentManagementV1Controller::getInstance();\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the value of productCategory | public function getProductCategory()
{
return $this->productCategory;
} | [
"public function getProduct_category () {\n\t$preValue = $this->preGetValue(\"product_category\"); \n\tif($preValue !== null && !\\Pimcore::inAdmin()) { \n\t\treturn $preValue;\n\t}\n\t$data = $this->getClass()->getFieldDefinition(\"product_category\")->preGetData($this);\n\treturn $data;\n}",
"public function getProductCategory()\n {\n return $this->_fields['ProductCategory']['FieldValue'];\n }",
"public function getProductCategory()\n {\n return $this->product_category;\n }",
"public function getCategory()\r\n {\r\n return $this->category;\r\n }",
"public function getValueCategory()\n {\n return $this->valueCategory;\n }",
"public function getCategory(): string\n {\n return $this->category;\n }",
"public function getProductCategoryName() \n {\n return $this->_fields['ProductCategoryName']['FieldValue'];\n }",
"public function getCategory()\n {\n return $this->getOptionValue(self::CATEGORY);\n }",
"public function getProductCategoryName()\n {\n return $this->ProductCategoryName;\n }",
"public function getCategory()\n {\n return Mage::registry('current_category');\n }",
"public function getCategory()\n\t{\n\t\t$Category = new Product_Category();\n\t\treturn $Category->findItem( array( 'Id = '.$this->CategoryId ) );\n\t}",
"function get_recipe_category(){\n return $this->recipeCategory->value;\n }",
"public function getCategory()\n\t{\n\t\t$Category = new Product_Category();\n\t\treturn $Category->findItem( array( 'Layout = '.get_class( $this ) ) );\n\t}",
"public function getCategory()\n\t{\n\t\t$arrTrailFull = Category::GetTrailByProductId($this->id);\n\t\t$objCat = Category::model()->findbyPk($arrTrailFull[0]['key']);\n\t\treturn $objCat;\n\t}",
"private function getCategoryAttribute($product){\n \t\t$cats = $product->getCategoryIds();\n \t\t$categoryId=array();\n \t\t$category=array();\n\t\t$content = \"\";\n\t\tforeach ($cats as $category_id) {\n\t\t\t\n \t\t\t$_cat = $this->getCategory($category_id);\n \t\t\t$categoryId[]=$category_id;\n \t\t\t$category[]=$_cat->getName();\n\t\t} \n\t\t\n\t\t$content=$content.$this->getArrayAttributesInXML(\"categoryIds\",$categoryId);\n\t\t$content=$content.$this->getArrayAttributesInXML(\"unbxdTaxonomyId\",$categoryId);\n\t\t$content=$content.$this->getArrayAttributesInXML(\"category\",$category);\n\t\treturn $content;\n \t}",
"function get_Category()\n {\n try {\n return $this->mCategory;\n }catch(Exception $e){\n $this->error->throwException('303', 'No s`ha pogut retornar la informació', $e);\n }\n }",
"public function getSub_cat_prod()\n {\n return $this->sub_cat_prod;\n }",
"public function getSelectedCategory()\n {\n return $this->selectedCategory;\n }",
"public function getProductCategoryId()\n {\n return $this->_fields['ProductCategoryId']['FieldValue'];\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This method is used to store user token details. | public function saveToken($user, $token); | [
"function saveUserToken(UserAbstract $user);",
"protected function createToken()\n {\n $this->tokenData = [\n 'value' => $this->generateHash(),\n 'time' => time()\n ];\n $this->session->set($this->tokenName, $this->tokenData);\n }",
"function saveToken($tokenData);",
"private function setToken() {\n\n /* valid register */\n $request = $this->post('/v1/register', [\n 'firstname' => 'John',\n 'lastname' => 'Doe',\n 'email' => 'john.doe@email.com',\n 'password' => 'secret',\n ]);\n\n /* valid login */\n $this->post('/v1/login', [\n 'email' => 'john.doe@email.com',\n 'password' => 'secret',\n ]);\n\n }",
"private function setAuthUserToken()\n {\n $authUser = factory(App\\User::class)->create();\n\n $this->authUser = $authUser;\n $this->authUserToken = JWTAuth::fromUser($authUser);\n }",
"protected function storeNewToken(){\r\n $newToken = $this->Facebook->getToken();\r\n $this->params->set('auth_token', $newToken);\r\n StileroAFBPluginparamshelper::storeParams($this->params, 'autofbook');\r\n }",
"public function storeToken($token);",
"private function saveToken()\n\t{\n\t\t$fd = fopen($this->cacheFolder.\"/token.txt\", 'w');\n\t\tfwrite($fd, $this->token);\n\t\tfclose($fd);\n\t}",
"public function saveToken(Token $token);",
"private function getUserToken()\n {\n if (!$this->token) {\n $this->token = $this->updateUserToken();\n }\n return $this->token;\n }",
"public function store(Request $request, Token $token, User $user);",
"private function _saveToken($token){\n if($this->_user instanceof User){\n $this->_user->setGoogleCalendarToken(!empty($token)?json_encode($token):$token);\n $this->_em->persist($this->_user);\n $this->_em->flush();\n }\n }",
"public function getAndStoreToken()\n {\n $token = $this->generateToken(6);\n\n $this->setAttribute('secure_token', sha1($token));\n $this->setAttribute('secure_token_timestamp', time());\n $this->update(false);\n\n return $token;\n }",
"public function storeSessionTokenInRegistry() {}",
"public function tokenAction()\n {\n $token = md5(time()) . '_' . mt_rand(1000000, 9999999);\n $userId = $this->getUser()->getId();\n $data = ['token' => $token, 'user' => $userId];\n $userIdHash = md5($userId);\n \\PimcoreNotifications\\Cache::save($userIdHash, $data);\n $this->_helper->json(['token' => $token, 'user' => $userIdHash]);\n }",
"protected function saveToken()\n {\n if (isset($this->token) && $this->token) {\n return;\n }\n\n if ($this->token = $this->getCookie($this->getCookieName())) {\n return;\n }\n\n // If cookie token doesn't exist, we need to create it with unique token...\n $this->token = base_convert(md5(uniqid(rand(), true)), 16, 36);\n setcookie($this->getCookieName(), $this->token, time() + 60 * 60 * 12, '/');\n\n // ... and attach it to broker session in SSO server.\n $this->attach();\n }",
"private function update_token() {\n $update = array(\n \"token\" => $this->generate_token(),\n \"token_expire\" => date(\"Y-m-d H:i:s\",strtotime(date(\"Y-m-d H:i:s\") . \"+2 days\"))\n );\n $this->init($this->db->update(\"user\", $this->id, $update)[\"result\"]);\n }",
"public function save()\n {\n if ($this->loaded === false) {\n // Set the created time, token, and hash of the user agent\n $this->created = $this->now;\n $this->user_agent = sha1(Kohana::$user_agent);\n }\n\n // Create a new token each time the token is saved\n $this->token = $this->create_token();\n\n return parent::save();\n }",
"public function storeAccessToken(JK_UserAuthorisation $token);"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
BH_custom_total_tag_validation_filter This function validates the total custom tag | function BH_custom_total_tag_validation_filter( $result, $tag ) {
/**
* Variables
*/
global $custom_payment;
$name = $tag->name;
$total = $_POST[ $name ];
if ( ! isset( $total ) || empty( $total ) && '0' !== $total ) {
$result->invalidate( $tag, wpcf7_get_message( 'invalid_required' ) );
}
elseif ( ! $custom_payment || $custom_payment->data[ 'total' ] !== $total ) {
$result->invalidate( $tag, get_total_error() );
}
// return
return $result;
} | [
"function BH_custom_event_tag_validation_filter( $result, $tag ) {\r\n\r\n\t/**\r\n\t * Variables\r\n\t */\r\n\t$name\t= $tag->name;\r\n\r\n\tif ( ! isset( $_POST[ $name ] ) || empty( $_POST[ $name ] ) && '0' !== $_POST[ $name ] ) {\r\n\r\n\t\t$result->invalidate( $tag, wpcf7_get_message( 'invalid_required' ) );\r\n\r\n\t}\r\n\r\n\t// return\r\n\treturn $result;\r\n\r\n}",
"function culturefeed_entry_ui_edit_tag_objects_form_submit_validate($form, &$form_state) {\n\n $tags = $form_state['values']['tags'];\n $custom_tags = variable_get('culturefeed_entry_ui_custom_tags', array());\n\n foreach (array_keys($tags) as $key => $tag) {\n if (in_array($tag, array_keys($custom_tags))) {\n form_set_error('tags][keywords][' . $key, t(\"Tag @tag is not permitted because it's already a custom tag.\", array('@tag' => $tag)));\n }\n }\n\n}",
"function filter_tags($var) {\n\treturn elgg_trigger_plugin_hook('validate', 'input', null, $var);\n}",
"function wpcf7dtx_dynamictext_validation_filter( $result, $tag ) {\n\t$tag = new WPCF7_FormTag( $tag );\n\n\t$name = $tag->name;\n\n\t$value = isset( $_POST[$name] )\n\t\t? trim( wp_unslash( strtr( (string) $_POST[$name], \"\\n\", \" \" ) ) )\n\t\t: '';\n\n\tif ( 'dynamictext' == $tag->basetype ) {\n\t\tif ( $tag->is_required() && '' == $value ) {\n\t\t\t$result->invalidate( $tag, wpcf7_get_message( 'invalid_required' ) );\n\t\t}\n\t}\n\n\tif ( ! empty( $value ) ) {\n\t\t$maxlength = $tag->get_maxlength_option();\n\t\t$minlength = $tag->get_minlength_option();\n\n\t\tif ( $maxlength && $minlength && $maxlength < $minlength ) {\n\t\t\t$maxlength = $minlength = null;\n\t\t}\n\n\t\t$code_units = wpcf7_count_code_units( $value );\n\n\t\tif ( false !== $code_units ) {\n\t\t\tif ( $maxlength && $maxlength < $code_units ) {\n\t\t\t\t$result->invalidate( $tag, wpcf7_get_message( 'invalid_too_long' ) );\n\t\t\t} elseif ( $minlength && $code_units < $minlength ) {\n\t\t\t\t$result->invalidate( $tag, wpcf7_get_message( 'invalid_too_short' ) );\n\t\t\t}\n\t\t}\n\t}\n\n\treturn $result;\n}",
"public function isValidTag($tag);",
"function validate_tag($tag){\r\n\t\t$validation = True;\r\n\r\n\t\tif(preg_match('~[^a-zA-Z ]~', $tag)){\r\n\t\t\t$validation = False;\r\n\t\t\techo \"Error: Please enter tags without numbers.\";\r\n\t\t}\r\n\r\n\t\treturn $validation;\r\n\t}",
"public function get_tag_total(){\r\n\t\t$query = $this->db->get('tags');\r\n\t\t$num_rows = $query->num_rows();\r\n\t\treturn $num_rows;\r\n\t}",
"public static function validateTags()\n {\n return [\n new LengthValidator(null, 255),\n ];\n }",
"static function get_subtotal_merge_tag_string($form, $current_field, $filter_tags = false) {\r\n\t\t$pricing_fields = self::get_pricing_fields ( $form );\r\n\t\t$product_tag_groups = array ();\r\n\t\tforeach ( $pricing_fields ['products'] as $product ) {\r\n\t\t\t\r\n\t\t\t$product_field = rgar ( $product, 'product' );\r\n\t\t\t$option_fields = rgar ( $product, 'options' );\r\n\t\t\t$quantity_field = rgar ( $product, 'quantity' );\r\n\t\t\t\r\n\t\t\t// do not include current field in subtotal\r\n\t\t\tif ($product_field ['id'] == $current_field ['id'])\r\n\t\t\t\tcontinue;\r\n\t\t\t\r\n\t\t\t$product_tags = GFCommon::get_field_merge_tags ( $product_field );\r\n\t\t\t$quantity_tag = 1;\r\n\t\t\t\r\n\t\t\t// if a single product type, only get the \"price\" merge tag\r\n\t\t\tif (in_array ( GFFormsModel::get_input_type ( $product_field ), array (\r\n\t\t\t\t\t'singleproduct',\r\n\t\t\t\t\t'calculation',\r\n\t\t\t\t\t'hiddenproduct' \r\n\t\t\t) )) {\r\n\t\t\t\t\r\n\t\t\t\t// single products provide quantity merge tag\r\n\t\t\t\tif (empty ( $quantity_field ) && ! rgar ( $product_field, 'disableQuantity' ))\r\n\t\t\t\t\t$quantity_tag = $product_tags [2] ['tag'];\r\n\t\t\t\t\r\n\t\t\t\t$product_tags = array (\r\n\t\t\t\t\t\t$product_tags [1] \r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// if quantity field is provided for product, get merge tag\r\n\t\t\tif (! empty ( $quantity_field )) {\r\n\t\t\t\t$quantity_tag = GFCommon::get_field_merge_tags ( $quantity_field );\r\n\t\t\t\t$quantity_tag = $quantity_tag [0] ['tag'];\r\n\t\t\t}\r\n\t\t\tif ($filter_tags && ! self::has_valid_quantity ( $quantity_tag ))\r\n\t\t\t\tcontinue;\r\n\t\t\t$product_tags = wp_list_pluck ( $product_tags, 'tag' );\r\n\t\t\t$option_tags = array ();\r\n\t\t\tforeach ( $option_fields as $option_field ) {\r\n\t\t\t\t\r\n\t\t\t\tif (is_array ( $option_field ['inputs'] )) {\r\n\t\t\t\t\t\r\n\t\t\t\t\t$choice_number = 1;\r\n\t\t\t\t\t\r\n\t\t\t\t\tforeach ( $option_field ['inputs'] as &$input ) {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// hack to skip numbers ending in 0. so that 5.1 doesn't conflict with 5.10\r\n\t\t\t\t\t\tif ($choice_number % 10 == 0)\r\n\t\t\t\t\t\t\t$choice_number ++;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t$input ['id'] = $option_field ['id'] . '.' . $choice_number ++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t$new_options_tags = GFCommon::get_field_merge_tags ( $option_field );\r\n\t\t\t\tif (! is_array ( $new_options_tags ))\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t\r\n\t\t\t\tif (GFFormsModel::get_input_type ( $option_field ) == 'checkbox')\r\n\t\t\t\t\tarray_shift ( $new_options_tags );\r\n\t\t\t\t\r\n\t\t\t\t$option_tags = array_merge ( $option_tags, $new_options_tags );\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t$option_tags = wp_list_pluck ( $option_tags, 'tag' );\r\n\t\t\t\r\n\t\t\t$product_tag_groups [] = '( ( ' . implode ( ' + ', array_merge ( $product_tags, $option_tags ) ) . ' ) * ' . $quantity_tag . ' )';\r\n\t\t}\r\n\t\t\r\n\t\t$shipping_tag = 0;\r\n\t\t/*\r\n\t\t * Shipping should not be included in subtotal, correct?\r\n\t\t * if( rgar( $pricing_fields, 'shipping' ) ) {\r\n\t\t * $shipping_tag = GFCommon::get_field_merge_tags( rgars( $pricing_fields, 'shipping/0' ) );\r\n\t\t * $shipping_tag = $shipping_tag[0]['tag'];\r\n\t\t * }\r\n\t\t */\r\n\t\t\r\n\t\t$pricing_tag_string = '( ( ' . implode ( ' + ', $product_tag_groups ) . ' ) + ' . $shipping_tag . ' )';\r\n\t\t\r\n\t\treturn $pricing_tag_string;\r\n\t}",
"private function checkTagCount(): bool\n {\n $count = count($this->searchTags) + count($this->searchTagsAspect) + count($this->searchTagsAuthor)\n + count($this->searchTagsCharacter) + count($this->searchTagsColour)\n + count($this->searchTagsMajorColour) + count($this->searchTagsPlatform);\n return $count < 8;\n }",
"public function _validate_investment_sum() {\n $investments = $this->input->post('investment');\n $max = $this->config->item('credits');\n if (array_sum($investments) > $max) {\n $this->form_validation->set_message('_validate_investment_sum', i18n('investment_over_max'));\n return false;\n }\n return true;\n\n }",
"public function tag_in_test()\n\t{\n\t\treturn $this->terms_test( 'post_tag', TRUE, FALSE );\n\t}",
"protected static function getTagsRule()\n {\n return ['required', 'array', 'min:1', 'in:'.Tag::getSelectData()->keys()->implode(',')];\n }",
"static function checkTags($tagStr){\n\t\t//tags can be empty(no tags)\n\t\t$tagStr = trim($tagStr);\n\t\tif(empty($tagStr)){\n\t\t\treturn;\n\t\t}\n\t\n\t\t$tags = explode(',', $tagStr);\n\t\n\t\tforeach($tags as $k=>$v){\n\t\t\t$tags[$k] = strip_tags(trim($v));\n\t\t\tif(empty($tags[$k])){\n\t\t\t\treturn 'Invalid tags!';\n\t\t\t}\n\t\t}\n\t\n\t\tif(sizeof($tags)>10)\n\t\t\treturn 'You can only have max 10 tags!';\n\t\n\t\tself::$tags = $tags;\n\t}",
"function privatemsg_tags_form_validate($form, &$form_state) {\n $tag_id = isset($form_state['values']['tag_id']) ? $form_state['values']['tag_id'] : 0;\n if ($tag_id) {\n // We are editing an existing tag, exclude the current tag from the search.\n $exists = db_result(db_query(\"SELECT 1 FROM {pm_tags} WHERE tag = '%s' AND tag_id <> %d\", $form_state['values']['tag'], $tag_id));\n }\n else {\n $exists = db_result(db_query(\"SELECT 1 FROM {pm_tags} WHERE tag = '%s'\", $form_state['values']['tag']));\n }\n if ($exists) {\n form_set_error('tag', t('Tag already exists, choose a different name.'));\n }\n}",
"function checkTagAvailInQuestion($tagID) {\r\n global $DBCONFIG;\r\n //$tagID = implode(',',(array)$this->removeBlankElements($tagID));\r\n $query_check_existance = \"SELECT COUNT(*) AS cnt FROM Classification WHERE ClassificationID IN ($tagID) AND ClassificationType='Tag' AND isEnabled='1'\";\r\n $resultset = $this->db->getSingleRow($query_check_existance);\r\n return $resultset['cnt'];\r\n }",
"protected function _validate()\n {\n if (trim($this->name) == '') {\n $this->addError('name', __('Tags must be given a name.'));\n }\n\n if (!$this->fieldIsUnique('name')) {\n $this->addError('name', __('That name is already taken for this tag.'));\n }\n }",
"function checkTags(&$errorMessage) {\n unset($tags);\n $tags = [];\n if ((isset($_POST['tag1']) && $_POST['tag1'] != 'Optional')) {\n $tags[0] = $_POST['tag1'];\n }\n\n if (isset($_POST['tag2']) && $_POST['tag2'] != 'Optional') {\n if (in_array($_POST['tag2'],$tags)) {\n // Cannot have 2 of the same tag!\n $errorMessage = \"You cannot have more than one of each tag!\";\n return false;\n } else {\n $tags[1] = $_POST['tag2'];\n }\n }\n\n if (isset($_POST['tag3']) && $_POST['tag3'] != 'Optional') {\n if (in_array($_POST['tag3'],$tags)) {\n // Cannot have 2 of the same tag!\n $errorMessage = \"You cannot have more than one of each tag!\";\n return false;\n } else {\n $tags[2] = $_POST['tag3'];\n }\n }\n\n if (isset($_POST['tag4']) && $_POST['tag4'] != 'Optional') {\n if (in_array($_POST['tag4'],$tags)) {\n // Cannot have 2 of the same tag!\n $errorMessage = \"You cannot have more than one of each tag!\";\n return false;\n } else {\n $tags[3] = $_POST['tag4'];\n }\n }\n\n if (isset($_POST['tag5']) && $_POST['tag5'] != 'Optional') {\n if (in_array($_POST['tag5'],$tags)) {\n // Cannot have 2 of the same tag!\n $errorMessage = \"You cannot have more than one of each tag!\";\n return false;\n } else {\n $tags[4] = $_POST['tag5'];\n }\n }\n\n return $tags;\n }",
"protected function doClean($value)\n {\n parent::doClean($value);\n\n $pattern = \"[^A-Za-zäöüÄÖÜß0-9,-. ]\";\n $string = preg_replace( $pattern ,'', $value );\n $string = preg_replace('/[ ]+/', ' ', $string); # Replace more then one space\n\n $tags = explode(\",\", $string );\n $tags = array_unique($tags);\n $singletag = \"/[\\p{Ll}\\p{Lu}\\p{Nd}][ \\p{Ll}\\p{Lu}\\p{Nd}.-]{0,30}[\\p{Ll}\\p{Lu}\\p{Nd}]/\";\n foreach($tags as $key => $tag)\n {\n if(0 === preg_match($singletag, $tag))\n {\n unset($tags[$key]);\n }\n }\n\n\n // Check to make sure each tag is under the limit.\n if(is_array($tags) && count($tags > 0))\n {\n foreach( $tags as $tag )\n {\n $tag = trim($tag);\n $length = mb_strlen($tag,'UTF-8');\n if( $length > 128 )\n {\n throw new sfValidatorError($this, 'too_long', array('value' => strip_tags(trim( substr($tag,0,20). \"... \")), ENT_NOQUOTES, 'UTF-8'));\n }\n\n if(count(explode(\" \", $tag)) > 6) # Check if a single tag contains more then 3 tokens\n {\n throw new sfValidatorError($this, 'to_many_tokens_per_tag');\n }\n }\n\n $tags = yiggTools::removeStopWords($tags);\n\n if( count($tags) > 0 )\n {\n $tag_collection = Tag::createTagsFromArray( $tags );\n if( count($tag_collection) > 0 )\n {\n return $tag_collection;\n }\n }\n }\n\n throw new sfValidatorError($this, 'no_tags', array('value' => $value) );\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Register an image handler. | static function AddHandler(wxImageHandler &$handler){} | [
"abstract public function registerHandler(mixed $handler): void;",
"public function addHandler(HandlerInterface $handler);",
"public function register_assets_handler() {\n\t\t$this->assets_handler->register();\n\t}",
"protected function registerImage()\n\t{\n\t\t$this->app->bindShared('coreimage', function($app)\n\t\t{\n\t\t\treturn new CoreImage();\n\t\t});\n\t}",
"public function register_jpg($handlers) {\n $handlers['ImageOptimizeJpgHandler'] = sprintf('%s/classes/image-optimize-jpg.php', dirname(__FILE__));\n return $handlers;\n }",
"private function registerThumbnail()\n {\n $this->app->bind(\n 'htmlelements::thumbnail',\n function () {\n return new Thumbnail;\n }\n );\n\n }",
"protected function registerInterventionService()\n {\n $this->app->bind(ImageManager::class, function () {\n return new ImageManager(['driver' => 'gd']);\n });\n }",
"abstract public function addHandler($name, $handler, array $opts = []);",
"protected function registerHandler()\n {\n $this->app->singleton('ductible.client.handler', function ($app) {\n $handler = $app->make('config')->get('ductible.handler');\n\n return (in_array($handler, ['default', 'single', 'multi']))\n ? ClientBuilder::{$handler.'Handler'}()\n : $app->make($handler);\n });\n }",
"function RegisterImage($type, wxBitmap $bmp){}",
"public function addHandler(AnnotationsHandlerInterface $handler)\n {\n $this->handlers[] = $handler;\n }",
"public function registerHandler(IPkgCmsCoreAutoClassHandler $handler);",
"public function addPhoto(int $id, Request $request, ImageHandler $imageHandler): void\n {\n $this->validate($request, [\n 'file' => 'required|mimes:jpg,jpeg,png,gif',\n ]);\n\n // attach to series\n if ($series = Series::find($id)) {\n // make the photo object from the file in the request\n $photo = $imageHandler->makePhoto($request->file('file'));\n\n // count existing photos, and if zero, make this primary\n if (isset($series->photos) && 0 === count($series->photos)) {\n $photo->is_primary = 1;\n }\n\n $photo->save();\n\n // attach to series\n $series->addPhoto($photo);\n }\n }",
"public function registerHandlersFromConfig();",
"function onPreRegister (callable $handler);",
"private function addHandler(): void\n {\n set_exception_handler($this->container['exceptionHandler']);\n set_error_handler($this->container['errorHandler']);\n }",
"public function addImage (Imagick $source) {}",
"abstract public function getImageHandle($fileName);",
"protected function registerDriver()\n {\n $app = $this->app;\n\n $config = $app['config'];\n\n $storage = $config->get('jitimage::cache.path');\n\n $driver = sprintf(\n '\\Thapp\\JitImage\\Driver\\%sDriver',\n $driverName = ucfirst($config->get('jitimage::driver', 'gd'))\n );\n\n $app->bind(\n 'Thapp\\JitImage\\Cache\\CacheInterface',\n function () use ($storage) {\n $cache = new \\Thapp\\JitImage\\Cache\\ImageCache(\n new CachedImage,\n //$this->app['Thapp\\JitImage\\ImageInterface'],\n new Filesystem,\n $storage . '/jit'\n );\n return $cache;\n }\n );\n\n\n $app->bind('Thapp\\JitImage\\Driver\\SourceLoaderInterface', 'Thapp\\JitImage\\Driver\\ImageSourceLoader');\n\n $app->bind('Thapp\\JitImage\\Driver\\BinLocatorInterface', function () use ($config) {\n $locator = new \\Thapp\\JitImage\\Driver\\ImBinLocator;\n extract($config->get('jitimage::imagemagick', ['path' => '/usr/local/bin', 'bin' => 'convert']));\n\n $locator->setConverterPath(\n sprintf('%s%s%s', rtrim($path, DIRECTORY_SEPARATOR), DIRECTORY_SEPARATOR, $bin)\n );\n\n return $locator;\n });\n\n\n $this->app->bind('Thapp\\JitImage\\Driver\\DriverInterface', function () use ($driver) {\n return $this->app->make($driver);\n });\n \n $this->app->bind('Thapp\\JitImage\\ImageInterface', function () use ($app) {\n return new ProxyImage(function () use ($app) {\n $image = new Image($app->make('Thapp\\JitImage\\Driver\\DriverInterface'));\n $image->setQuality($app['config']->get('jitimage::quality', 80));\n return $image;\n });\n });\n\n //$this->app->extend(\n // 'Thapp\\JitImage\\ImageInterface',\n // function ($image) {\n // $image->setQuality($this->app['config']->get('jitimage::quality', 80));\n // return $image;\n // }\n //);\n\n $this->app['jitimage'] = $this->app->share(\n function () use ($app) {\n $resolver = $app->make('Thapp\\JitImage\\ResolverInterface');\n $image = new JitImage($resolver, \\URL::to('/'));\n return $image;\n }\n );\n\n $this->app['jitimage.cache'] = $this->app->share(\n function () {\n return $this->app->make('Thapp\\JitImage\\Cache\\CacheInterface');\n }\n );\n\n $this->registerFilter($driverName, $this->getFilters());\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns TRUE if express checkout is enabled. Does payment amount or user country/group check. | public function isExpressCheckoutEnabled()
{
} | [
"public function isExpressCheckout(): bool\n {\n return false;\n }",
"function gateway_available_and_enabled()\n {\n $is_available = false;\n $user_currency = get_option('woocommerce_currency');\n\n $is_available_currency = in_array($user_currency, $this->available_currencies);\n\n if (\n $is_available_currency && $this->enabled == 'yes' && $this->settings['merchant_account_id'] != '' &&\n $this->settings['device_id'] != '' && $this->settings['pin'] != ''\n ) {\n $is_available = true;\n }\n\n return $is_available;\n }",
"public function canCheckout()\n\t{\n\t\tif($this->params->get('extra_security', 0))\n\t\t{\n\t\t\treturn JFactory::getApplication()->getUserState('proopc.cancheckout', false);\n\t\t}\n\t\treturn true;\n\t}",
"public function isActivatedOnCheckout()\n {\n $values = explode(',', $this->scopeConfig->getValue(\n 'transiteo_settings/duties/enabled_on',\n \\Magento\\Store\\Model\\ScopeInterface::SCOPE_STORE\n ));\n foreach ($values as $value) {\n if ($value === 'checkout') {\n return true;\n }\n }\n return false;\n }",
"public function isExpressCheckoutEnabledInDetails()\n {\n $blExpressCheckoutEnabledInDetails = false;\n if ($this->isExpressCheckoutEnabled() && $this->_getPayPalConfig()->isExpressCheckoutInDetailsPage()) {\n $blExpressCheckoutEnabledInDetails = true;\n }\n\n return $blExpressCheckoutEnabledInDetails;\n }",
"public function doExpressCheckoutPayment()\n {\n $blSuccess = false;\n $oOrder = $this->_getPayPalOrder();\n\n try {\n // updating order state\n if ($oOrder) {\n\n $oOrder->oePayPalUpdateOrderNumber();\n $oSession = $this->getSession();\n $oBasket = $oSession->getBasket();\n\n $sTransactionMode = $this->_getTransactionMode($oBasket);\n\n $oBuilder = oxNew('oePayPalDoExpressCheckoutPaymentRequestBuilder');\n $oBuilder->setPayPalConfig($this->getPayPalConfig());\n $oBuilder->setSession($oSession);\n $oBuilder->setBasket($oBasket);\n $oBuilder->setTransactionMode($sTransactionMode);\n $oBuilder->setUser($this->_getPayPalUser());\n $oBuilder->setOrder($oOrder);\n\n $oRequest = $oBuilder->buildRequest();\n\n $oPayPalService = $this->getPayPalCheckoutService();\n $oResult = $oPayPalService->doExpressCheckoutPayment($oRequest);\n\n $oOrder->finalizePayPalOrder(\n $oResult,\n $oSession->getBasket(),\n $sTransactionMode\n );\n\n $blSuccess = true;\n } else {\n /**\n * @var $oEx oxException\n */\n $oEx = oxNew('oxException');\n $oEx->setMessage('OEPAYPAL_ORDER_ERROR');\n throw $oEx;\n }\n } catch (oxException $oException) {\n\n // deleting order on error\n if ($oOrder) {\n $oOrder->deletePayPalOrder();\n }\n\n $this->_iLastErrorNo = oxOrder::ORDER_STATE_PAYMENTERROR;\n oxRegistry::get('oxUtilsView')->addErrorToDisplay($oException);\n }\n\n return $blSuccess;\n }",
"private function isCheckout()\n {\n return is_checkout() || is_checkout_pay_page();\n }",
"public function CurrentUserCanExpress()\n\t{\n\t\t$can = 0;\n\t\t$message = 'Not set';\n\n\t\t$this->load->helper('nitrocart/nitrocart');\n\t\tif( nc_can_express_checkout() )\n\t\t{\n\t\t\t$can = 1;\n\t\t\t$message = 'User can checkout the express way';\n\t\t}\n\t\t$response['status'] = JSONStatus::Success;\n\t\t$response['action'] = 'CurrentUserCanExpressCO';\t\t\n\t\t$response['value'] = $can;\n\t\t$response['message'] = $message;\n\n\t\techo json_encode($response);die;\n\t}",
"public function paymentCheck(){\n\t\treturn true;\n\t}",
"function cp_payments_is_enabled() {\n\tglobal $cp_options;\n\n\tif ( ! current_theme_supports( 'app-payments' ) || ! current_theme_supports( 'app-price-format' ) )\n\t\treturn false;\n\n\tif ( ! $cp_options->charge_ads )\n\t\treturn false;\n\n\tif ( $cp_options->price_scheme == 'featured' && ! is_numeric( $cp_options->sys_feat_price ) )\n\t\treturn false;\n\n\treturn true;\n}",
"public static function shouldSendPaymentAmount()\n {\n return static::getSendPaymentAmount() === 'Y';\n }",
"public function isExpressEnabled($handle)\n {\n $assetRequiredFunctions = Mage::getConfig()->getNode('global/payment/assets_required/' . $handle);\n if ($assetRequiredFunctions) {\n $checkFunctions = $assetRequiredFunctions->asArray();\n if (is_array($checkFunctions) && count($checkFunctions) > 0) {\n foreach ($checkFunctions as $check) {\n if (isset($check['class']) && isset($check['method'])) {\n $model = Mage::getModel($check['class']);\n if ($model) {\n // If the method returns true, express is enabled for this handle\n if (method_exists($model, $check['method']) && $model->{$check['method']}()) {\n return true;\n }\n }\n }\n }\n }\n }\n\n return false;\n }",
"public function is_enabled() {\n\n\t\treturn 'yes' === get_option( 'sv_wc_apple_pay_enabled' );\n\t}",
"public function doCustomerRegisterInLoyalty()\n {\n /** @var Mage_Core_Controller_Request_Http $request */\n $request = Mage::app()->getRequest();\n\n /** @var string $module */\n $module = $request->getModuleName();\n\n return ($module == 'checkout' && $this->getRegisterInLoyalty());\n }",
"public function getIsOneStepCheckoutEnabled()\n {\n return $this->getStoreConfig(\n 'payment/monetivo_payment/onestepcheckoutenabled'\n );\n }",
"public function countryManagementIsEnabled()\n {\n return (bool) Mage::getStoreConfig(self::XML_PATH_COUNTRY_MANAGEMENT_ENABLED);\n }",
"public static function checkExpressRequirements()\n\t{\n\t\tif(empty(self::$trackingExpress) || !is_string(self::$trackingExpress)) return false;\n\t\treturn preg_match(self::$patternExpress,self::$trackingExpress);\n\t}",
"private function _expressCheckoutPayment()\r\n\t{\r\n\t\t/* Verifying the Payer ID and Checkout tokens (stored in the customer cookie during step 2) */\r\n\t\tif (isset($this->context->cookie->paypal_express_checkout_token) && !empty($this->context->cookie->paypal_express_checkout_token))\r\n\t\t{\r\n\t\t\t/* Confirm the payment to PayPal */\r\n\t\t\t$currency = new Currency((int)$this->context->cart->id_currency);\r\n\t\t\t$result = $this->paypal_usa->postToPayPal('DoExpressCheckoutPayment', '&TOKEN='.urlencode($this->context->cookie->paypal_express_checkout_token).'&PAYERID='.urlencode($this->context->cookie->paypal_express_checkout_payer_id).'&PAYMENTREQUEST_0_PAYMENTACTION=Sale&PAYMENTREQUEST_0_AMT='.$this->context->cart->getOrderTotal(true).'&PAYMENTREQUEST_0_CURRENCYCODE='.urlencode($currency->iso_code).'&IPADDRESS='.urlencode($_SERVER['SERVER_NAME']));\r\n\r\n\t\t\tif (strtoupper($result['ACK']) == 'SUCCESS' || strtoupper($result['ACK']) == 'SUCCESSWITHWARNING')\r\n\t\t\t{\r\n\t\t\t\t/* Prepare the order status, in accordance with the response from PayPal */\r\n\t\t\t\tif (strtoupper($result['PAYMENTINFO_0_PAYMENTSTATUS']) == 'COMPLETED')\r\n\t\t\t\t\t$order_status = (int)Configuration::get('PS_OS_PAYMENT');\r\n\t\t\t\telseif (strtoupper($result['PAYMENTINFO_0_PAYMENTSTATUS']) == 'PENDING')\r\n\t\t\t\t\t$order_status = (int)Configuration::get('PS_OS_PAYPAL');\r\n\t\t\t\telse\r\n\t\t\t\t\t$order_status = (int)Configuration::get('PS_OS_ERROR');\r\n\r\n\t\t\t\t/* Prepare the transaction details that will appear in the Back-office on the order details page */\r\n\t\t\t\t$message =\r\n\t\t\t\t\t\t'Transaction ID: '.$result['PAYMENTINFO_0_TRANSACTIONID'].'\r\n\t\t\t\tTransaction type: '.$result['PAYMENTINFO_0_TRANSACTIONTYPE'].'\r\n\t\t\t\tPayment type: '.$result['PAYMENTINFO_0_PAYMENTTYPE'].'\r\n\t\t\t\tOrder time: '.$result['PAYMENTINFO_0_ORDERTIME'].'\r\n\t\t\t\tFinal amount charged: '.$result['PAYMENTINFO_0_AMT'].'\r\n\t\t\t\tCurrency code: '.$result['PAYMENTINFO_0_CURRENCYCODE'].'\r\n\t\t\t\tPayPal fees: '.$result['PAYMENTINFO_0_FEEAMT'];\r\n\r\n\t\t\t\tif (isset($result['PAYMENTINFO_0_EXCHANGERATE']) && !empty($result['PAYMENTINFO_0_EXCHANGERATE']))\r\n\t\t\t\t\t$message .= 'Exchange rate: '.$result['PAYMENTINFO_0_EXCHANGERATE'].'\r\n\t\t\t\tSettled amount (after conversion): '.$result['PAYMENTINFO_0_SETTLEAMT'];\r\n\r\n\t\t\t\t$pending_reasons = array(\r\n\t\t\t\t\t'address' => 'Customer did not include a confirmed shipping address and your Payment Receiving Preferences is set such that you want to manually accept or deny each of these payments.',\r\n\t\t\t\t\t'echeck' => 'The payment is pending because it was made by an eCheck that has not yet cleared.',\r\n\t\t\t\t\t'intl' => 'You hold a non-U.S. account and do not have a withdrawal mechanism. You must manually accept or deny this payment from your Account Overview.',\r\n\t\t\t\t\t'multi-currency' => 'You do not have a balance in the currency sent, and you do not have your Payment Receiving Preferences set to automatically convert and accept this payment. You must manually accept or deny this payment.',\r\n\t\t\t\t\t'verify' => 'You are not yet verified, you have to verify your account before you can accept this payment.',\r\n\t\t\t\t\t'other' => 'Unknown, for more information, please contact PayPal customer service.');\r\n\r\n\t\t\t\tif (isset($result['PAYMENTINFO_0_PENDINGREASON']) && !empty($result['PAYMENTINFO_0_PENDINGREASON']) && isset($pending_reasons[$result['PAYMENTINFO_0_PENDINGREASON']]))\r\n\t\t\t\t\t$message .= \"\\n\".'Pending reason: '.$pending_reasons[$result['PAYMENTINFO_0_PENDINGREASON']];\r\n\r\n\t\t\t\t/* Creating the order */\r\n\t\t\t\t$customer = new Customer((int)$this->context->cart->id_customer);\r\n\t\t\t\tif ($this->paypal_usa->validateOrder((int)$this->context->cart->id, (int)$order_status, (float)$result['PAYMENTINFO_0_AMT'], $this->paypal_usa->displayName, $message, array(), null, false, $customer->secure_key))\r\n\t\t\t\t{\r\n\t\t\t\t\t/* Store transaction ID and details */\r\n\t\t\t\t\t$this->paypal_usa->addTransactionId((int)$this->paypal_usa->currentOrder, $result['PAYMENTINFO_0_TRANSACTIONID']);\r\n\t\t\t\t\t$this->paypal_usa->addTransaction('payment', array('source' => 'express', 'id_shop' => (int)$this->context->cart->id_shop, 'id_customer' => (int)$this->context->cart->id_customer, 'id_cart' => (int)$this->context->cart->id,\r\n\t\t\t\t\t\t'id_order' => (int)$this->paypal_usa->currentOrder, 'id_transaction' => $result['PAYMENTINFO_0_TRANSACTIONID'], 'amount' => $result['PAYMENTINFO_0_AMT'],\r\n\t\t\t\t\t\t'currency' => $result['PAYMENTINFO_0_CURRENCYCODE'], 'cc_type' => '', 'cc_exp' => '', 'cc_last_digits' => '', 'cvc_check' => 0,\r\n\t\t\t\t\t\t'fee' => $result['PAYMENTINFO_0_FEEAMT']));\r\n\r\n\t\t\t\t\t/* Reset the PayPal's token so the customer will be able to place a new order in the future */\r\n\t\t\t\t\tunset($this->context->cookie->paypal_express_checkout_token, $this->context->cookie->paypal_express_checkout_payer_id);\r\n\t\t\t\t}\r\n\r\n\t\t\t\t/* Redirect the customer to the Order confirmation page */\r\n\t\t\t\tif (_PS_VERSION_ < 1.4)\r\n\t\t\t\t\tTools::redirect('order-confirmation.php?id_cart='.(int)$this->context->cart->id.'&id_module='.(int)$this->paypal_usa->id.'&id_order='.(int)$this->paypal_usa->currentOrder.'&key='.$customer->secure_key);\r\n\t\t\t\telse\r\n\t\t\t\t\tTools::redirect('index.php?controller=order-confirmation&id_cart='.(int)$this->context->cart->id.'&id_module='.(int)$this->paypal_usa->id.'&id_order='.(int)$this->paypal_usa->currentOrder.'&key='.$customer->secure_key);\r\n\t\t\t\texit;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tforeach ($result as $key => $val)\r\n\t\t\t\t\t$result[$key] = urldecode($val);\r\n\r\n\t\t\t\t/* If PayPal is returning an error code equal to 10486, it means either that:\r\n\t\t\t\t *\r\n\t\t\t\t * - Billing address could not be confirmed\r\n\t\t\t\t * - Transaction exceeds the card limit\r\n\t\t\t\t * - Transaction denied by the card issuer\r\n\t\t\t\t * - The funding source has no funds remaining\r\n\t\t\t\t *\r\n\t\t\t\t * Therefore, we are displaying a new PayPal Express Checkout button and a warning message to the customer\r\n\t\t\t\t * He/she will have to go back to PayPal to select another funding source or resolve the payment error\r\n\t\t\t\t */\r\n\t\t\t\tif (isset($result['L_ERRORCODE0']) && (int)$result['L_ERRORCODE0'] == 10486)\r\n\t\t\t\t{\r\n\t\t\t\t\tunset($this->context->cookie->paypal_express_checkout_token, $this->context->cookie->paypal_express_checkout_payer_id);\r\n\t\t\t\t\t$this->context->smarty->assign('paypal_usa_action', $this->context->link->getModuleLink('paypalusa', 'expresscheckout', array('pp_exp_initial' => 1)));\r\n\t\t\t\t}\r\n\r\n\t\t\t\t$this->context->smarty->assign('paypal_usa_errors', $result);\r\n\t\t\t\t$this->setTemplate('express-checkout-messages.tpl');\r\n\t\t\t}\r\n\t\t}\r\n\t}",
"public function canCheckout() {\n return commerce_checkout_access($this->getEntity());\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prepare and save quote item with simple product. | private function saveItemSimpleData($entityId, $index, $itemId, array $quote)
{
$itemData = [
'%productId%' => $this->getStubProductId($entityId, $index, Type::TYPE_SIMPLE),
'%sku%' => $this->getStubProductSku($entityId, $index, Type::TYPE_SIMPLE),
'%name%' => $this->getStubProductName($entityId, $index, Type::TYPE_SIMPLE),
'%itemId%' => $itemId,
'%productType%' => Type::TYPE_SIMPLE,
'%productOptions%' => $this->getStubProductBuyRequest($entityId, $index, Type::TYPE_SIMPLE),
'%parentItemId%' => 'null',
];
$this->query('quote_item', $quote, $itemData);
$this->query('quote_item_option', $quote, $itemData, [
'%code%' => 'info_buyRequest',
'%value%' => $this->serializer->serialize([
'product' => $this->getStubProductId($entityId, $index, Type::TYPE_SIMPLE),
'qty' => "1",
'uenc' => 'aHR0cDovL21hZ2UyLmNvbS9jYXRlZ29yeS0xLmh0bWw'
])
]);
} | [
"private function prepareSimpleProduct() {\n if ($this->getSaverData()->isFirstPage()) {\n $this->setPrice();\n $this->setDownloadOptions();\n $this->setSKU();\n $this->setStockOptions();\n $this->setSoldIndividually();\n $this->setShippingOptions();\n $this->setPurchaseNote();\n $this->setEnableReviews();\n $this->setMenuOrder();\n }\n\n $this->setTags();\n $this->setAttributes();\n }",
"public function saveQuote();",
"public function _initQuote(){\n\t\t\ttry {\n\t\t\t\tif (isset($_POST['uniqueid'])) {\n\t\t\t\t\t$this->startpricing->uniqueid = $_POST['uniqueid'];\n\t\t\t\t\t$this->startpricing->_getStartPrice();\n\t\t\t\t\t\n\t\t\t\t\t$this->uniqueid = Plugin_Utilities::getUniqueKey(10);\n\t\t\t\t\t$this->isActive = 2;\n\t\t\t\t\t$this->__setDbData();\n\t\t\t\t\t$this->_save();\n\t\t\t\t\techo json_encode($this);\n\t\t\t\t\texit;\n\t\t\t\t}exit;\n\t\t\t} catch (Exception $e) {\n\t\t\t\t$errorlogger = new ErrorLogger();\n\t\t\t\t$errorlogger->add_message($e->getMessage());\n\t\t\t\texit;\n\t\t\t}\n\t\t}",
"public function save(NegotiableQuoteItemInterface $quoteItem);",
"public function setItem()\n {\n //conditional checks by taking advantage of polymorphism\n $this->setAllBasics();\n $this->setParams();\n\n $addQuery = 'INSERT INTO items(sku, name, price, type, size) VALUES (:sku,:name,:price, :type,:size)';\n $query = $this->pdo->prepare($addQuery);\n $query->bindValue(':sku', $this->getSKU());\n $query->bindValue(':name', $this->getName());\n $query->bindValue(':price', $this->getPrice());\n $query->bindValue(':type', $this->getType());\n $query->bindValue(':size', $this->getSize());\n\n $query->execute();\n }",
"public function save(){\r\n\t\tif (is_null($this->_id)){\r\n\t\t\tgetDb()->insert('product', [\r\n\t\t 'name' => $this->_name,\r\n\t\t 'price' => $this->_price,\r\n\t\t 'description' => $this->_description,\r\n\t\t 'picture' => $this->_picture,\r\n\t\t \t'isEdited' => $this->_isEdited\r\n\t\t ]);\r\n\t\t}else{\r\n\t\t\tgetDb()->update('product', [\r\n\t\t\t 'name' => $this->_name,\r\n\t\t\t 'price' => $this->_price,\r\n\t\t\t 'description' => $this->_description,\r\n\t\t\t 'picture' => $this->_picture,\r\n\t\t\t 'isEdited' => $this->_isEdited\r\n\t\t\t], ['id' => $this->_id]);\r\n\t\t}\r\n\r\n\t}",
"public function installQuoteData()\n {\n $quoteInstaller = $this->quoteSetupFactory->create(\n [\n 'resourceName' => 'quote_setup',\n 'setup' => $this->setup\n ]\n );\n $quoteInstaller\n ->addAttribute(\n 'quote',\n CustomFieldsInterface::CHECKOUT_PURPOSE,\n ['type' => Table::TYPE_TEXT, 'length' => '255', 'nullable' => true]\n );\n }",
"abstract protected function doSaveQuote(QuoteInterface $quote);",
"public function saveLineItems(){\n\t\t// Insert/update new/existing items:\n\t\tif(isset($this->_lineItems)){\n\t\t\tforeach($this->_lineItems as $item){\n\t\t\t\t$item->quoteId = $this->id;\n $product = X2Model::model('Products')->findByAttributes(array(\n 'name'=>$item->name\n ));\n if (isset($product))\n $item->productId = $product->id;\n\t\t\t\t$item->save();\n\t\t\t}\n\t\t}\n\t\tif(isset($this->_deleteLineItems)) {\n\t\t\t// Delete all deleted items:\n\t\t\tforeach($this->_deleteLineItems as $item)\n\t\t\t\t$item->delete();\n\t\t\t$this->_deleteLineItems = null;\n\t\t}\n\t}",
"private function _prepareNewCustomerQuote()\n {\n $quote = $this->_quote;\n $billing = $quote->getBillingAddress();\n $shipping = $quote->isVirtual() ? null : $quote->getShippingAddress();\n\n $customer = $quote->getCustomer();\n $customerBillingData = $billing->exportCustomerAddress();\n $dataArray = $this->_objectCopyService->getDataFromFieldset('checkout_onepage_quote', 'to_customer', $quote);\n $this->_dataObjectHelper->populateWithArray(\n $customer,\n $dataArray,\n '\\Magento\\Customer\\Api\\Data\\CustomerInterface'\n );\n $quote->setCustomer($customer);\n $quote->setCustomerId(true);\n\n $customerBillingData->setIsDefaultBilling(true);\n\n if ($shipping) {\n if (!$shipping->getSameAsBilling()) {\n $customerShippingData = $shipping->exportCustomerAddress();\n $customerShippingData->setIsDefaultShipping(true);\n $shipping->setCustomerAddressData($customerShippingData);\n // Add shipping address to quote since customer Data Object does not hold address information\n $quote->addCustomerAddress($customerShippingData);\n } else {\n $shipping->setCustomerAddressData($customerBillingData);\n $customerBillingData->setIsDefaultShipping(true);\n }\n } else {\n $customerBillingData->setIsDefaultShipping(true);\n }\n $billing->setCustomerAddressData($customerBillingData);\n\n // Add billing address to quote since customer Data Object does not hold address information\n $quote->addCustomerAddress($customerBillingData);\n }",
"protected function _prepareNewCustomerQuote()\n {\n $quote = $this->getQuote();\n $billing = $quote->getBillingAddress();\n $shipping = $quote->isVirtual() ? null : $quote->getShippingAddress();\n\n //$customer = Mage::getModel('customer/customer');\n $customer = $quote->getCustomer();\n /* @var $customer Mage_Customer_Model_Customer */\n $customerBilling = $billing->exportCustomerAddress();\n $customer->addAddress($customerBilling);\n $billing->setCustomerAddress($customerBilling);\n $customerBilling->setIsDefaultBilling(true);\n if ($shipping && !$shipping->getSameAsBilling()) {\n $customerShipping = $shipping->exportCustomerAddress();\n $customer->addAddress($customerShipping);\n $shipping->setCustomerAddress($customerShipping);\n $customerShipping->setIsDefaultShipping(true);\n } else {\n $customerBilling->setIsDefaultShipping(true);\n }\n\n Mage::helper('core')->copyFieldset('checkout_onepage_quote', 'to_customer', $quote, $customer);\n $customer->setPassword($customer->decryptPassword($quote->getPasswordHash()));\n $customer->setPasswordHash($customer->hashPassword($customer->getPassword()));\n/**\n * The magic line changes\n */\n $customer->save();\n $quote->setCustomer($customer);\n // ->setCustomerId(true);\n/**\n * End the magic line changes\n */\n }",
"public function populateQuote()\n {\n $this->_createAddresses();\n $this->getQuote()->collectTotals();\n Mage::getSingleton('checkout/type_onepage')->savePayment(array(\n \"method\" => self::PAYMENT_METHOD_CODE\n ));\n $this->getQuote()->save();\n }",
"public function save() {\n\t\tif ($this->getProductId() !== null && ($this->_data[\"product_id\"] !== $this->_origData[\"product_id\"] || $this->_data[\"store_id\"] !== $this->_origData[\"store_id\"])) {\n\t\t\n\t\t\t//get url\n\t\t\t$this->setUrl(\"\");\n\t\t\tif ($this->getProductId() !== null) {\n\t\t\t\n\t\t\t\t//load product and update url\n\t\t\t\t$this->setUrl(Mage::getModel('catalog/product')\n\t\t\t\t\t->setStoreId($this->getStoreId())\n\t\t\t\t\t->load($this->getProductId())\n\t\t\t\t\t->getProductUrl());\n\t\t\t}\n\t\t}\n\n\t\t//save entity\n\t\tparent::save();\t\t\t\t\n\t}",
"public static function add_item($quotetext) {\n /**\n * Fetch the globally used variables\n * @see\n */\n global $USER, $PAGE;\n\n /**\n * The context is validated\n * @todo provide more information\n */\n $context = context_user::instance($USER->id);\n self::validate_context($context);\n\n /**\n * Is the current user allowed to do this action\n */\n require_capability('block/quote:add', $context);\n\n /**\n * Remove HTML and PHP Tags\n */\n $quotetext = strip_tags($quotetext);\n\n /**\n * The validate_parameters function checks if the provided data has the right format\n */\n $params = self::validate_parameters(self::add_item_parameters(), compact('quotetext'));\n\n /**\n * Create a new quote item\n */\n $item = new item(null, (object) $params);\n $item->create();\n\n /**\n * Log that the user has created an new entry\n */\n self::log($item,$context);\n\n /**\n * Brings the item in the correct format to return to the browser\n */\n $itemexporter = new item_exporter($item, ['context' => $context]);\n return $itemexporter->export($PAGE->get_renderer('core'));\n }",
"abstract public function save_item();",
"protected function _prepareNewCustomerQuote()\n {\n $quote = $this->getQuote();\n $billing = $quote->getBillingAddress();\n $shipping = $quote->isVirtual() ? null : $quote->getShippingAddress();\n\n $customer = $quote->getCustomer();\n $customerBillingData = $billing->exportCustomerAddress();\n $dataArray = $this->_objectCopyService->getDataFromFieldset('checkout_onepage_quote', 'to_customer', $quote);\n $this->dataObjectHelper->populateWithArray(\n $customer,\n $dataArray,\n \\Magento\\Customer\\Api\\Data\\CustomerInterface::class\n );\n $quote->setCustomer($customer)->setCustomerId(true);\n\n $customerBillingData->setIsDefaultBilling(true);\n\n if ($shipping) {\n if (!$shipping->getSameAsBilling()) {\n $customerShippingData = $shipping->exportCustomerAddress();\n $customerShippingData->setIsDefaultShipping(true);\n $shipping->setCustomerAddressData($customerShippingData);\n // Add shipping address to quote since customer Data Object does not hold address information\n $quote->addCustomerAddress($customerShippingData);\n } else {\n $shipping->setCustomerAddressData($customerBillingData);\n $customerBillingData->setIsDefaultShipping(true);\n }\n } else {\n $customerBillingData->setIsDefaultShipping(true);\n }\n $billing->setCustomerAddressData($customerBillingData);\n // TODO : Eventually need to remove this legacy hack\n // Add billing address to quote since customer Data Object does not hold address information\n $quote->addCustomerAddress($customerBillingData);\n }",
"function add_delivery_to_quote() {\n \n if (class_exists('YITH_Request_Quote')) {\n\n if ( ! is_admin() ) {\n$product_id = 402;\n$raq = YITH_Request_Quote::get_instance();\n if ( ! $raq->is_empty() ) {\n$raq->add_item( array( 'product_id' => $product_id) );\n}\n}\n}\n}",
"protected function _prepareNewCustomerQuote()\n {\n $quote = $this->getQuote();\n $billing = $quote->getBillingAddress();\n $shipping = $quote->isVirtual() ? null : $quote->getShippingAddress();\n\n $customer = $quote->getCustomer();\n /* @var $customer Mage_Customer_Model_Customer */\n $customerBilling = $billing->exportCustomerAddress();\n $customer->addAddress($customerBilling);\n $billing->setCustomerAddress($customerBilling);\n $customerBilling->setIsDefaultBilling(true);\n if ($shipping && !$shipping->getSameAsBilling()) {\n $customerShipping = $shipping->exportCustomerAddress();\n $customer->addAddress($customerShipping);\n $shipping->setCustomerAddress($customerShipping);\n $customerShipping->setIsDefaultShipping(true);\n } elseif ($shipping) {\n $customerBilling->setIsDefaultShipping(true);\n }\n\n if ($quote->getCustomerTaxnumber() && !$billing->getCustomerTaxnumber()) {\n $billing->setCustomerTaxnumber($quote->getCustomerTaxnumber());\n }\n\n Mage::helper('core')->copyFieldset('checkout_onepage_quote', 'to_customer', $quote, $customer);\n $customer->setPassword($customer->decryptPassword($quote->getPasswordHash()));\n $customer->setPasswordHash($customer->hashPassword($customer->getPassword()));\n $quote->setCustomer($customer)\n ->setCustomerId(true);\n }",
"protected function _assignProducts()\n {\n Varien_Profiler::start('QUOTE:' . __METHOD__);\n $productIds = array();\n foreach ($this as $item) {\n $productIds[] = (int)$item->getProductId();\n }\n $this->_productIds = array_merge($this->_productIds, $productIds);\n\n $productCollection = Mage::getModel('catalog/product')->getCollection()\n ->setStoreId($this->getStoreId())\n ->addIdFilter($this->_productIds)\n ->addAttributeToSelect(Mage::getSingleton('sales/quote_config')->getProductAttributes())\n ->addOptionsToResult()\n ->addStoreFilter()\n ->addUrlRewrite()\n ->addTierPriceData()\n ->setFlag('require_stock_items', true);\n\n Mage::dispatchEvent(\n 'prepare_catalog_product_collection_prices', array(\n 'collection' => $productCollection,\n 'store_id' => $this->getStoreId(),\n )\n );\n Mage::dispatchEvent(\n 'sales_quote_item_collection_products_after_load', array(\n 'product_collection' => $productCollection\n )\n );\n\n $recollectQuote = false;\n foreach ($this as $item) {\n $product = $productCollection->getItemById($item->getProductId());\n if ($product) {\n // check if this product appears in the basket multiple times\n // if so, reload the poduct to fix the type\n $repeated = $this->countProductsRepeated();\n if ($repeated[$item->getProductId()] > 1) {\n $product = Mage::getModel('catalog/product')->load($product->getId());\n }\n $product->setCustomOptions(array());\n $qtyOptions = array();\n $optionProductIds = array();\n foreach ($item->getOptions() as $option) {\n /**\n * Call type specified logic for product associated with quote item\n */\n $product->getTypeInstance(true)->assignProductToOption(\n $productCollection->getItemById($option->getProductId()), $option, $product\n );\n\n if (is_object($option->getProduct()) && $option->getProductId() != $product->getId()) {\n $optionProductIds[$option->getProductId()] = $option->getProductId();\n }\n }\n\n if ($optionProductIds) {\n foreach ($optionProductIds as $optionProductId) {\n $qtyOption = $item->getOptionByCode('product_qty_' . $optionProductId);\n if ($qtyOption) {\n $qtyOptions[$optionProductId] = $qtyOption;\n }\n }\n }\n $item->setQtyOptions($qtyOptions);\n\n $item->setProduct($product);\n } else {\n $item->isDeleted(true);\n $recollectQuote = true;\n }\n $item->checkData();\n }\n\n if ($recollectQuote && $this->_quote) {\n $this->_quote->collectTotals();\n }\n Varien_Profiler::stop('QUOTE:' . __METHOD__);\n\n return $this;\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if the period range is valid in the first place | public function checkIfPeriodRangeIsValid($date){
if (is_string($date)) {
$date = new \DateTime($date);
} else {
$date = clone $date; // defensive copy
}
$date->setTime(0, 0, 0);
if ($this->dateIsTooEarly($date)) {
return false;
} else if ($this->dateIsTooLate($date)) {
return false;
} else {
return true;
}
} | [
"public function testIsValidPeriodFormatWithInValidPeriod()\n {\n $period = '1ss';\n\n $result = $this->isValidPeriodFormat($period);\n\n $this->assertFalse($result);\n\n }",
"public function testIsValidPeriodFormatWithValidPeriod()\n {\n $period = '1d';\n\n $result = $this->isValidPeriodFormat($period);\n\n $this->assertTrue($result);\n\n }",
"function test_valid_date() {\n\n return (!empty($this->fields[\"begin\"])\n && !empty($this->fields[\"end\"])\n && (strtotime($this->fields[\"begin\"]) < strtotime($this->fields[\"end\"])));\n }",
"public function abuts(PeriodLib $period)\n {\n return in_array(0, [\n self::compareDate($this->startDate, $period->endDate),\n self::compareDate($this->endDate, $period->startDate)\n ]);\n }",
"public function canRejectBadPeriodCount() {\n\t\t$this->sut->getResultsForPreviousPeriods(0);\n\t}",
"public function check_valid(){ \n\t\tif(!empty($this->data['Event']['end'])){\n\t\t\t$start = explode(' ', $this->data['Event']['start']);\n\t\t\t$end = explode(' ', $this->data['Event']['end']);\n\t\t\t$from = strtotime($this->format_date_save($start[0]));\n\t\t\t$to = strtotime($this->format_date_save($end[0]));\t\n\t\t\tif($from > $to){\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\treturn true;\n\t\t}\n\t\t\n\t}",
"public function check_period_data( $data ) {\n\t\t$from = !empty( $data['from'] ) ? $this->toTime( $data['from'] ) : null;\n\t\t$to = !empty( $data['to'] ) ? $this->toTime( $data['to'] ) : null;\n\n\t\t$errors = array();\n\n\t\t$keys = array( 'from', 'to', 'limit', 'days' );\n\t\tforeach ( $keys as $field_key ) {\n\t\t\t$field_errors = array();\n\t\t\t$value = isset( $data[ $field_key ] ) ? $data[ $field_key ] : null;\n\n\t\t\tif ( empty( $value ) ) {\n\t\t\t\tif ( 'days' == $field_key ) {\n\t\t\t\t\t$field_errors[] = esc_html__( 'Please select at least one day.', 'adventure-tours' );\n\t\t\t\t} else {\n\t\t\t\t\t$field_errors[] = esc_html__( 'The field is required.', 'adventure-tours' );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tswitch( $field_key ) {\n\t\t\t\tcase 'limit':\n\t\t\t\t\tif ( $value < 1 ) {\n\t\t\t\t\t\t$field_errors[] = esc_html__( 'Minimum allowed value is 1.', 'adventure-tours' );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'from':\n\t\t\t\t\tif ( ! $from ) {\n\t\t\t\t\t\t$field_errors[] = esc_html__( 'Please check the date format.', 'adventure-tours' );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'to':\n\t\t\t\t\tif ( ! $to ) {\n\t\t\t\t\t\t$field_errors[] = esc_html__( 'Please check the date format.', 'adventure-tours' );\n\t\t\t\t\t} elseif ( $from && $to < $from ) {\n\t\t\t\t\t\t$field_errors[] = sprintf( esc_html__( 'The date should be grater than %s.', 'adventure-tours' ), $data['from'] );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( $field_errors ) {\n\t\t\t\t$errors[ $field_key ] = $field_errors;\n\t\t\t}\n\t\t}\n\n\t\treturn $errors;\n\t}",
"public function canRejectBadSamplePeriod() {\n\t\t$this->sut->setSamplePeriod('foo');\n\t}",
"public function valid(): bool\n {\n return isset($this->intervals[$this->position]);\n }",
"function validRangeDate($strDateFrom,$strDateTo){\r\n\t//if ()\r\n}",
"public function abuts(Period $period)\n {\n return $this->startDate == $period->getEndDate() || $this->endDate == $period->getStartDate();\n }",
"function culturefeed_search_ui_date_facet_form_validate($form, &$form_state) {\n\n if (!empty($form_state['values']['date_range'])) {\n\n $form_state['values']['date_range'] = str_replace(t('till'), '-', $form_state['values']['date_range']);\n $dates = explode('-', $form_state['values']['date_range']);\n $startDate = DateTime::createFromFormat('d/m/Y', trim($dates[0]));\n if (!$startDate) {\n form_set_error('date_range', t('Please enter a valid date'));\n }\n elseif (isset($dates[1])) {\n $endDate = DateTime::createFromFormat('d/m/Y', trim($dates[1]));\n if (!$endDate) {\n form_set_error('date_range', t('Please enter a valid date'));\n }\n }\n }\n}",
"protected function isCorrectRangeFormat(): bool\n {\n return ($this->operation === 'between' || $this->operation === 'not between')\n && count($this->value) === 2;\n }",
"public function validateByGracePeriod() : void\n {\n if (!is_null($this->grace_period_ends)) {\n if (($this->charge_date == $this->grace_period_ends) && !$this->paid) {\n $this->is_active = 0;\n $this->grace_period_ends = Carbon::now()->addDays(Subscription::DEFAULT_GRACE_PERIOD_DAYS)->toDateTimeString();\n }\n } else {\n $this->grace_period_ends = Carbon::now()->addDays(Subscription::DEFAULT_GRACE_PERIOD_DAYS)->toDateTimeString();\n }\n }",
"function isValid()\n {\n if ($this->year < 0 || $this->year > 9999) {\n return false;\n }\n return checkdate($this->month, $this->mday, $this->year);\n }",
"protected function _checkPriceRange()\n {\n $blIsValid = true;\n\n $oPayPalPayment = $this->getPayment();\n\n if ($oPayPalPayment->oxpayments__oxfromamount->value != 0 ||\n $oPayPalPayment->oxpayments__oxtoamount->value != 0\n ) {\n\n $oCur = $this->getConfig()->getActShopCurrencyObject();\n $dPrice = $this->getPrice() / $oCur->rate;\n\n $blIsValid = (($dPrice >= $oPayPalPayment->oxpayments__oxfromamount->value) &&\n ($dPrice <= $oPayPalPayment->oxpayments__oxtoamount->value));\n }\n\n return $blIsValid;\n }",
"function isValidRange($begin, $end) {\n if ($end < $begin) {\n return FALSE;\n } else if ($end < 0 || $begin < 0) {\n return FALSE;\n } else {\n return TRUE;\n }\n}",
"public function testIncorrectRanges()\n {\n $rangeService = new RangeService($this->pdo);\n\n $exceptionRaised = false;\n try {\n $rangeService->createRange(0, -100);\n } catch (Exception $exception) {\n $exceptionRaised = true;\n }\n $this->assertTrue($exceptionRaised, 'Created range with max_value more than min_value');\n }",
"function _is_in_range_nep($yy, $mm, $dd)\n{\n if ($yy < 2000 || $yy > 2089) {\n return 'Supported only between 2000-2089';\n }\n if ($mm < 1 || $mm > 12) {\n return 'Error! month value can be between 1-12 only';\n }\n if ($dd < 1 || $dd > 32) {\n return 'Error! day value can be between 1-31 only';\n }\n return true;\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Render the given script. Filename must be fully qualified. | public function renderScript($filename)
{
$view = clone $this->view;
$view->addScriptPath(dirname($filename));
return $view->render(basename($filename));
} | [
"protected function render_script() {\n }",
"private static function render_script($script) {\n\t\techo \"<script src='$script' async></script>\";\n\t}",
"public function renderScripts();",
"public function render(){\n\t\tforeach($this->scripts as $script){\n\t\t\t$this->show($this->view->url->asset($script));\n\t\t}\n\t}",
"function render() {\n\t $html = array();\n\t\n\t\tforeach ($this->_scripts as $path => $attributes) {\n\t\t\t$attribs = array();\n\t\t\n\t\t\tforeach ($attributes as $key => $value) {\n\t\t\t\t$attribs[] = sprintf('%s=\"%s\"', $key, $value);\n\t\t\t}\n\n\t\t\t$html[] = sprintf('<script src=\"%s\" %s></script>', $path, implode(' ', $attribs));\n\t\t}\n\n\t\tforeach ($this->_script as $type => $content) {\n\t\t\t$html[] = sprintf('<script type=\"%s\">', $type);\n\t\t\t$html[] = $content;\n\t\t\t$html[] = '</script>';\n\t\t}\n\n\t return implode(\"\\n\", $html);\n\t}",
"public function render(){\n\t\t\n\t\t// Render script files.\n\t\tforeach($this->scripts as $script){\n\t\t\t$this->show($this->view->url->asset($script));\n\t\t}\n\t\tif ($this->jsRoutes){\n\t\t\t$this->show($this->view->url->reverse('/reks/JSController.routes'));\n\t\t}\n\t\t\n\t\t// Render <script> tags.\n\t\tforeach($this->jsScripts as $content){\n\t\t\techo $content;\n\t\t}\n\t\t\n\t}",
"public function render() {\n include('templates/' . $this->templateStyle . '/' . $this->fileName . '.php');\n }",
"public function renderScript($script, $name = null)\n {\n if (null === $name) {\n $name = $this->getResponseSegment();\n }\n\n $this->getResponse()->appendBody(\n $this->view->render($script),\n $name\n );\n\n $this->setNoRender();\n }",
"public function render()\n {\n include $this->path;\n }",
"public function _run()\n {\n // paths to exist, whereas Zend_View_Abstract does not. Before passing paths\n // to Twig loader filter out non-existent directories.\n $script = func_get_arg(0);\n if (!$this->_pathSet && method_exists($this->_zwig->getLoader(), 'setPaths')) {\n $this->_zwig->getLoader()->setPaths(array_filter($this->getScriptPaths(), 'file_exists'));\n $this->_pathSet = true;\n }\n $template = $this->_zwig->loadTemplate($script);\n $template->display(get_object_vars($this));\n }",
"public function renderJavascript();",
"public function render() {\n\t\t// Can we use a cached snippet?\n\t\tif ($this->cachedFileAvailable()) {\n\t\t\t// We can use a cached copy, much quick\n\t\t\treturn $this->getCachedFile();\n\t\t}\n\n\t\t// Start object buffering\n\t\tob_start();\n\n\t\t// Extract variables\n\t\textract($this->_variable);\n\n\t\t// Include the snippet\n\t\tinclude PATH_SNIPPET . $this->_file;\n\n\t\t// Place the buffer contents into a string\n\t\t$content = ob_get_contents();\n\t\tob_end_clean();\n\n\t\t// Do we want to save this to the cache\n\t\tif ($this->_enableCache) {\n\t\t\t$this->saveFileToCache($content);\t\n\t\t}\n\n\t\t// Rendering complete\n\t\treturn $content;\n\t}",
"protected function renderAsJavascript() {}",
"public function render()\n {\n extract($this->data);\n require $this->viewPathRoot . '/' . $this->path;\n }",
"public function render()\n {\n if ($this->data != null && is_array($this->data)) {\n extract($this->data);\n }\n\n $pathInfo = pathinfo($this->file);\n $ext = $pathInfo['extension'];\n\n if ($ext == 'php') {\n $file = $this->path . $this->file;\n } else {\n $file = $this->path . $this->file . '.php';\n }\n\n $contents = null;\n\n if (file_exists($file)) {\n if ($this->return) {\n ob_start();\n include($file);\n $contents = ob_get_contents();\n ob_end_clean();\n return $contents;\n } else {\n include($file);\n }\n } else {\n throw new FileNotFoundException($file);\n }\n }",
"function RenderJS()\n\t{\n\t\tif (!array_key_exists('*arrJavaScript', $GLOBALS) || !is_array($GLOBALS['*arrJavaScript']))\n\t\t{\n\t\t\t// There is no javascript to include\n\t\t\treturn;\n\t\t}\n\n\t\t// Remove any duplicates from the list\n\t\t$arrJsFiles = array_unique($GLOBALS['*arrJavaScript']);\n\n\t\tforeach($arrJsFiles as $strJsFile)\n\t\t{\n\t\t\t$strJsFileRelativePath = $this->_GetJsFileRelativePath($strJsFile .\".js\");\n\t\t\techo \"\\t\\t<script type='text/javascript' src='$strJsFileRelativePath' ></script>\\n\";\n\t\t\t//echo \"\\t\\t<script type='text/javascript' src='javascript/$strJsFile.js' ></script>\\n\";\n\t\t}\n\t}",
"public function render($file, array $data = array());",
"public function renderScriptElements()\n\t{\n\t\tglobal $ff_context;\n\n\t\t?>\n\t\t<script src=\"<?= ff_esc($this->clientAPI) ?>?hl=<?= ff_esc($ff_context->getLanguage()->languageCode()) ?>\" async defer></script>\n\t\t<?php\n\t}",
"private function affiche_script() {\n foreach ($this->script as $s) {\n echo \"<script type='text/javascript' src='Script/\".$s.\".js'></script>\\n\";\n }\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load the image configuration collection | public function getImageConfiguration()
{
return $this->config->getImages();
} | [
"abstract protected function load_config();",
"private function loadConfigurationFiles()\n {\n $finder = new Finder();\n\n $iterator = $finder\n ->files()\n ->name('*.yml')\n ->in(CONFIG_DIR);\n\n $config = array();\n\n foreach ($iterator as $file) {\n $content = file_get_contents($file->getRealPath());\n\n if (!empty($content)) {\n $array = Yaml::parse($content);\n $config[$file->getBasename('.'.$file->getExtension())] = $array;\n }\n }\n\n $this['config'] = $config;\n }",
"protected function loadConfigs()\n {\n $this->configs = $this->file->parse();\n }",
"protected function load_config() {\n if ($this->config == null && (isset($this->instance->configdata) && !is_null($this->instance->configdata))) {\n $this->config = unserialize(base64_decode($this->instance->configdata));\n foreach ($this->config as $key => $value) {\n $newkey = preg_replace('/^'.self::get_name().'_/', '', $key);\n if ($newkey != $key) {\n $this->config[$newkey] = $value;\n unset($this->config[$key]);\n }\n }\n }\n }",
"protected function load()\n {\n $this->config = array();\n\n if (file_exists($this->filePath)) {\n $this->config = Yaml::parse($this->filePath);\n }\n }",
"function loadCoreImages(){\n\t\tConfigure::load('images');\n\t}",
"protected function loadEach()\n { \n foreach ($this->config as $config) {\n $this->run(new ConfigNoFile($config));\n }\n }",
"protected function initialize()\n {\n if (false === $this->initialized) {\n $this->collection = new ConfigCollection();\n\n foreach ($this->loaders as $loader) {\n /* @var SettingsLoaderInterface $loader */\n $this->collection->startSection(get_class($loader));\n\n $settings = $loader->getSettings();\n\n $this->collection->add($settings);\n\n $this->settings = array_merge_recursive($this->settings, $settings);\n\n $this->collection->endSection();\n }\n\n $this->initialized = true;\n }\n }",
"public function loadScaffoldSourceConfigurations() {\n return Utils::getConfigFiles($this->scaffolder->getConfigDir() . '/picture');\n }",
"protected function addImageSizeConfigs()\n {\n // TODO: add image size configs\n }",
"public function loadConfigs()\n {\n $filesList = new \\FilesystemIterator($this->basePath, \\FilesystemIterator::SKIP_DOTS);\n foreach ($filesList as $fileInfo):\n if ($fileInfo->isFile()) {\n $this->loadConfig($fileInfo);\n }\n endforeach;\n }",
"protected function loadConfigurations()\n {\n\n $files = feather_dir_files(static::$configPath);\n\n foreach ($files as $file) {\n\n if (is_file(static::$configPath . \"/$file\") && stripos($file, '.php') === strlen($file) - 4) {\n $filename = substr($file, 0, strripos($file, '.php'));\n static::$config[strtolower($filename)] = include static::$configPath . '/' . $file;\n }\n }\n }",
"protected function loadImage()\n\t{\n\t\t// Determine and set what image library we will use\n\t\ttry\n\t\t{\n\t\t\t$this->setManipulator();\n\t\t}\n\t\tcatch (\\Exception $e)\n\t\t{\n\t\t\t// Nothing to do\n\t\t}\n\n\t\tif ($this->isWebAddress())\n\t\t{\n\t\t\t$success = $this->_manipulator->createImageFromWeb();\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$success = $this->_manipulator->createImageFromFile();\n\t\t}\n\n\t\tif ($success === true)\n\t\t{\n\t\t\t$this->_image_loaded = true;\n\t\t}\n\t}",
"private static function _load() {\n\t\t\t\t\n\t\t\tstatic::$_items = require path('application').'config.php';\n\t\t}",
"public static function loadAll()\n\t{\n\n\t\tforeach (self::$config_files as $key => $file_name) {\n\t\t\t\n\t\t\tself::loadFile($file_name);\n\t\t}\n\n\t}",
"protected function loadConfigs() {\n foreach ($this->configPaths as $path) {\n $this->config->load($path);\n }\n }",
"public function load() {\n\t\tif (!file_exists($this->_configFile)) { \n\t\t\ttrigger_error('Error: Could not load config ' . $this->_configFile . '!');\n\t\t}\n\t\t\n\t\t$ypConfig = array();\n\t\trequire_once($this->_configFile);\n\t\t$this->_data = array_merge($this->_data, $ypConfig);\n \t}",
"public function load_config() {\n\t\t$query = $this->db->make_query(\"config\");\n\t\t$query->set_fields(\"config_key,config_value\");\n\t\t$result = $query->execute();\n\n\t\t//Populate configuration variables\n\t\twhile ($row = $result->fetch_assoc()) {\n\t\t\t$key = $row['config_key'];\n\t\t\t$value = $row['config_value'];\n\t\t\t$this->config[$key] = $value;\n\t\t}\n\t\t$result->close();\n\t}",
"public static function load_image_sizes(){\n\t\t$tpl = ARI_Plugin::get_template( 'image-sizes' );\n\t\tif ( empty( $tpl ) ) {\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t$file_content = file_get_contents( $tpl );\n\t\t$result = json_decode( $file_content );\n\t\tif( is_array( $result ) && !empty( $result ) ){\n\t\t\tself::$image_sizes = $result;\n\t\t}\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Flattens thread structure and instantiates threads | protected function flattenThreads($threads, $board, $useSSL)
{
$threadList = [];
foreach ($threads as $thread) {
foreach ($thread['threads'] as $realThread) {
$inList = new Thread($realThread['no'], $board, $useSSL);
array_push($threadList, $inList);
}
}
return $threadList;
} | [
"public static function decorateThreads(&$threads) {\n\t\tif (is_null($threads) || count($threads) == 0) {\n\t\t\treturn $threads;\n\t\t}\n\n\t\t$threadids = \"\";\n\t\t$first = true;\n\t\tforeach ($threads as $thread) {\n\t\t\tif ($first) {\n\t\t\t\t$first = false;\n\t\t\t} else {\n\t\t\t\t$threadids .= \", \";\n\t\t\t}\n\t\t\t$threadids .= $thread['id'];\n\t\t}\n\t\t\n\n\t\t// Can't pass the threadids in a prepared statement because of the following issue:\n\t\t// http://stackoverflow.com/questions/1586587/pdo-binding-values-for-mysql-in-statement\n\t\t// $values = array(':threadids' => $threadids);\n\t\t$values = array();\n\n\t $db = Database::getInstance();\n\t\t$extendedThreadInfo = $db->query(\n\t\t\t(\"SELECT threadid as id, locale, groupid, referer, useragent \" .\n\t\t\t \"FROM {thread} \" .\n\t\t\t \"WHERE threadid IN ($threadids) \"),\n \t\t$values,\n\t\t\tarray('return_rows' => Database::RETURN_ALL_ROWS)\n\t\t);\n\n\n\t\t// If the GeoIP address plugin is installed (and enabled)\n\t\t// we will use it to get geo information\n\t\t$geoIPPlugin = null;\n\t\t$pluginManager = PluginManager::getInstance();\n\t\tif ($pluginManager->hasPlugin('Mibew:GeoIp')) {\n\t\t\t$geoIPPlugin = $pluginManager->getPlugin('Mibew:GeoIp');\n\t\t\t// We could also do version checks if necessary\n\t\t}\n\n\t\tforeach ($threads as &$anotherThread) {\n\t\t\tforeach ($extendedThreadInfo as $key => $oneExtendedInfo) {\n\t\t\t\tif ($anotherThread['id'] == $oneExtendedInfo['id']) {\n\t\t\t\t\t$anotherThread['locale'] = $oneExtendedInfo['locale'];\n\t\t\t\t\t$anotherThread['groupid'] = (int)$oneExtendedInfo['groupid'];\n\t\t\t\t\t$anotherThread['referrer'] = $oneExtendedInfo['referer'];\n\t\t\t\t\t$anotherThread['fullUserAgent'] = $oneExtendedInfo['useragent'];\n\n\t\t\t\t\tif ($geoIPPlugin != null) {\n\t\t\t\t\t\t// An IP string can contain more than one IP adress. For example it\n\t\t\t\t\t\t// can be something like this: \"x.x.x.x (x.x.x.x)\". Thus we need to\n\t\t\t\t\t\t// extract all IPS from the string and use the last one.\n\n\t\t\t\t\t\t// Question (EN 2017-01-03): Can this handle IPv6 addresses? The better question to ask\n\t\t\t\t\t\t// is whether the MaxMind library can handle IPv6 addresses.\n\t\t\t\t\t\t$count = preg_match_all(\n\t\t\t\t\t\t\t\"/(?:(?:[0-9]{1,3}\\.){3}[0-9]{1,3})/\",\n\t\t\t\t\t\t\t$anotherThread['remote'],\n\t\t\t\t\t\t\t$matches\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif ($count > 0) {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t$ip = end($matches[0]);\n\t\t\t\t\t\t\t\t$info = $geoIPPlugin->getGeoInfo($ip, get_current_locale());\n\t\t\t\t\t\t\t\t$anotherThread['countryName'] = $info['country_name'] ?: '';\n\t\t\t\t\t\t\t\t$anotherThread['countryCode'] = $info['country_code'] ? strtolower($info['country_code']) : '';\n\t\t\t\t\t\t\t\t$anotherThread['city'] = $info['city'] ?: '';\n\t\t\t\t\t\t\t\t$anotherThread['latitude'] = $info['latitude'];\n\t\t\t\t\t\t\t\t$anotherThread['longitude'] = $info['longitude'];\n\n\t\t\t\t\t\t\t\tif (strlen($anotherThread['countryCode']) > 0) {\n\t\t\t\t\t\t\t\t\t$urlGenerator = UrlGeneratorUtil::getInstance();\n\t\t\t\t\t\t\t\t\tif ($urlGenerator != null) {\n\t\t\t\t\t\t\t\t\t\t$anotherThread['flagUrl'] = UrlGeneratorUtil::getInstance()->fullURL('index.php/wurrd/clientinterface/assets/images/flags/' . $anotherThread['countryCode'] . '.png');\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} catch (\\InvalidArgumentException $exception) {\n\t\t\t\t\t\t\t\t// Do nothing\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t\tunset($extendedThreadInfo[$key]);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $threads;\n\t}",
"function flatten_threads($items) {\n $result = array();\n foreach ($items as $item) {\n array_push($result, $item);\n if ($item['replies']) {\n foreach ($item['replies'] as $reply)\n array_push($result, $reply);\n }\n $result[count($result)-1]['thread_end'] = true;\n }\n return $result;\n}",
"public function __construct($rows) {\n $threads = array();\n foreach ($rows as &$row) {\n $threads[] = new JInboxThread($row);\n }\n }",
"public function __construct($threads = array()) {\r\n $this->threads = $threads;\r\n }",
"protected function createAllThreads()\n\t{\n\t\t$count = &$this->threadsCount;\n\t\t$tMax = $this->maxThreads;\n\t\tif ($count < $tMax) {\n\t\t\t$tName = $this->threadClassName;\n\t\t\t$pName = $this->threadProcessName;\n\t\t\t$debug = $this->debug;\n\t\t\tdo {\n\t\t\t\t/** @var $thread Thread */\n\t\t\t\t$thread = new $tName($pName, $this, $debug);\n\t\t\t\t$count++;\n\n\t\t\t\t// @codeCoverageIgnoreStart\n\t\t\t\t$debug && $this->debug(\n\t\t\t\t\t\"Thread #{$thread->getId()} created\"\n\t\t\t\t);\n\t\t\t\t// @codeCoverageIgnoreEnd\n\t\t\t} while ($count < $tMax);\n\t\t}\n\t}",
"public function from(\\Closure $run, \\Closure $construct = NULL, array $args = NULL): \\Threaded {}",
"private function generateThreads()\n\t{\n\t\tXfAddOns_Sitemap_Logger::debug('Generating threads...');\n\n\t\t$threads = new XfAddOns_Sitemap_Helper_Thread();\n\t\twhile (!$threads->isFinished)\n\t\t{\n\t\t\tXfAddOns_Sitemap_Logger::debug('-- Starting at ' . $threads->lastId . ' and generating ' . $this->maxUrls .' urls...');\n\t\t\t$threads->generate($this->maxUrls);\n\t\t\tif (!$threads->isEmpty)\n\t\t\t{\n\t\t\t\t$this->sitemaps[] = $threads->save($this->getSitemapName('threads'));\n\t\t\t}\n\t\t}\n\t}",
"protected function readThreads() {\n\t\t// accessible boards\n\t\t$accessibleBoardIDArray = Board::getAccessibleBoardIDArray(array('canViewBoard', 'canEnterBoard', 'canReadThread'));\n\t\t\n\t\t// get threads\n\t\tif (count($accessibleBoardIDArray)) {\n\t\t\t$sql = \"SELECT\t\tpost.*, thread.*\n\t\t\t\tFROM\t\twbb\".WBB_N.\"_thread_subscription subscription\n\t\t\t\tLEFT JOIN\twbb\".WBB_N.\"_thread thread\n\t\t\t\tON\t\t(thread.threadID = subscription.threadID)\n\t\t\t\tLEFT JOIN\twbb\".WBB_N.\"_post post\n\t\t\t\tON\t\t(post.postID = thread.firstPostID)\n\t\t\t\tWHERE\t\tsubscription.userID = \".WCF::getUser()->userID.\"\n\t\t\t\t\t\tAND thread.boardID IN (\".implode(',', $accessibleBoardIDArray).\")\n\t\t\t\t\t\tAND thread.isDeleted = 0\n\t\t\t\t\t\tAND thread.isDisabled = 0\n\t\t\t\t\t\tAND thread.movedThreadID = 0\n\t\t\t\t\t\tAND thread.time > \".($this->hours ? (TIME_NOW - $this->hours * 3600) : (TIME_NOW - 30 * 86400)).\"\n\t\t\t\tORDER BY\tthread.time DESC\";\n\t\t\t$result = WCF::getDB()->sendQuery($sql, $this->limit);\n\t\t\twhile ($row = WCF::getDB()->fetchArray($result)) {\n\t\t\t\t$this->threads[] = new FeedThread($row);\n\t\t\t}\n\t\t}\n\t}",
"private function updateRegisteredThreads() : Thread\n\t{\n\t\tforeach( $this->getRunningThreads() as $thread )\n\t\t{\n\t\t\t$this->registered_threads[ $thread[ 'hash' ] ][ 'pid' ] = $thread[ 'pid' ];\n\t\t\t$this->registered_threads[ $thread[ 'hash' ] ][ 'status' ] = self::STATUS_RUNNING;\n\t\t\t$this->registered_threads[ $thread[ 'hash' ] ][ 'elapsed' ] = $this->getElapsedTimeFrom( $thread[ 'elapsed' ] );\n\t\t}\n\n\t\treturn $this;\n\t}",
"public function make(string $type, array $data): Thread\n {\n /** @var Thread $thread */\n $thread = array_key_exists($type, self::$classMap)\n ? new self::$classMap[$type]()\n : new self::$classMap['_default']();\n\n $thread->hydrate($data);\n\n return $thread;\n }",
"function plugin_forumml_build_flattened_thread($topic) {\n $thread = array();\n $sql = 'SELECT m.*, mh_d.value as date, mh_f.value as sender, mh_s.value as subject, mh_ct.value as content_type, mh_cc.value as cc, a.id_attachment, a.file_name, a.file_type, a.file_size, a.file_path, a.content_id'.\n ' FROM plugin_forumml_message m'.\n ' LEFT JOIN plugin_forumml_messageheader mh_d ON (mh_d.id_message = m.id_message AND mh_d.id_header = '.FORUMML_DATE.')'.\n ' LEFT JOIN plugin_forumml_messageheader mh_f ON (mh_f.id_message = m.id_message AND mh_f.id_header = '.FORUMML_FROM.')'.\n ' LEFT JOIN plugin_forumml_messageheader mh_s ON (mh_s.id_message = m.id_message AND mh_s.id_header = '.FORUMML_SUBJECT.')'.\n ' LEFT JOIN plugin_forumml_messageheader mh_ct ON (mh_ct.id_message = m.id_message AND mh_ct.id_header = '.FORUMML_CONTENT_TYPE.')'.\n ' LEFT JOIN plugin_forumml_messageheader mh_cc ON (mh_cc.id_message = m.id_message AND mh_cc.id_header = '.FORUMML_CC.')'.\n ' LEFT JOIN plugin_forumml_attachment a ON (a.id_message = m.id_message AND a.content_id = \"\")'.\n ' WHERE m.id_message = '.db_ei($topic);\n //echo $sql.'<br>';\n $result = db_query($sql);\n if ($result && !db_error($result)) {\n $p = plugin_forumml_insert_msg_attach($thread, $result);\n plugin_forumml_build_flattened_thread_children($thread, $p);\n }\n ksort($thread, SORT_NUMERIC);\n return $thread;\n}",
"function _wordbb_get_threads_posts($tids)\r\n{\r\n\tglobal $wpdb, $wordbb;\r\n\r\n\t$in='';\r\n\tforeach($tids as $tid)\r\n\t{\r\n\t\t$in.=$tid.',';\r\n\t}\r\n\t$in=rtrim($in,',');\r\n\r\n\t// get posts\r\n\t$results=$wordbb->mybbdb->get_results(\"SELECT pid,tid,replyto,fid,subject,uid,username,\".\r\n\t\t\"dateline,message,ipaddress FROM {$wordbb->table_posts} WHERE tid IN({$in}) AND visible=1 ORDER BY dateline ASC LIMIT 1,18446744073709551615\");\r\n\r\n\t$threads=array();\r\n\tforeach($results as $result)\r\n\t{\r\n\t\t$thread=&$threads[$result->tid];\r\n\t\t$thread[]=$result;\r\n\t}\r\n\treturn $threads;\r\n}",
"protected function build_thread_data($data, &$depth, &$children, $level = 0)\n {\n foreach ((array)$data as $key => $val) {\n $empty = empty($val) || !is_array($val);\n $children[$key] = !$empty;\n $depth[$key] = $level;\n if (!$empty) {\n $this->build_thread_data($val, $depth, $children, $level + 1);\n }\n }\n }",
"private function fetchThreads() {\n\t\t\t$query = '';\n\t\t\t$boards = listBoards(true);\n\n\t\t\tforeach ($boards as $b) {\n\t\t\t\tif (in_array($b, $this->settings['exclude']))\n\t\t\t\t\tcontinue;\n\t\t\t\t// Threads are those posts that have no parent thread\n\t\t\t\t$query .= \"SELECT *, '$b' AS `board` FROM ``posts_$b`` \" .\n\t\t\t\t\t\"WHERE `thread` IS NULL UNION ALL \";\n\t\t\t}\n\n\t\t\t$query = preg_replace('/UNION ALL $/', 'ORDER BY `bump` DESC', $query);\n\t\t\t$result = query($query) or error(db_error());\n\n\t\t\treturn $result->fetchAll(PDO::FETCH_ASSOC);\n\t\t}",
"public function stack(Threaded &$work) {}",
"private function createThreadActiveParticipantArrays(array &$thread)\n {\n $activeParticipants = array();\n $activeRecipients = array();\n $activeSenders = array();\n\n foreach ($thread['participants'] as $participantRef) {\n foreach ($thread['metadata'] as $metadata) {\n if ($metadata['isDeleted'] && $participantRef['$id'] === $metadata['participant']['$id']) {\n continue 2;\n }\n }\n\n $participantIsActiveRecipient = $participantIsActiveSender = false;\n\n foreach ($thread['messages'] as $messageRef) {\n $message = $this->threadCollection->getDBRef($messageRef);\n\n if (null === $message) {\n throw new \\UnexpectedValueException(sprintf('Message \"%s\" not found for thread \"%s\"', $messageRef['$id'], $thread['_id']));\n }\n\n if (!isset($message['sender']['$id'])) {\n throw new \\UnexpectedValueException(sprintf('Sender reference not found for message \"%s\"', $messageRef['$id']));\n }\n\n if ($participantRef['$id'] == $message['sender']['$id']) {\n $participantIsActiveSender = true;\n } elseif (!$thread['isSpam']) {\n $participantIsActiveRecipient = true;\n }\n\n if ($participantIsActiveRecipient && $participantIsActiveSender) {\n break;\n }\n }\n\n if ($participantIsActiveSender) {\n $activeSenders[] = (string) $participantRef['$id'];\n }\n\n if ($participantIsActiveRecipient) {\n $activeRecipients[] = (string) $participantRef['$id'];\n }\n\n if ($participantIsActiveSender || $participantIsActiveRecipient) {\n $activeParticipants[] = (string) $participantRef['$id'];\n }\n }\n\n $thread['activeParticipants'] = $activeParticipants;\n $thread['activeRecipients'] = $activeRecipients;\n $thread['activeSenders'] = $activeSenders;\n }",
"private function setThreadData() {\n\t\t$this->maxThreadNoType = $this->maxThread - array_sum ( $this->maxThreadType );\n\t\tif ($this->maxThreadNoType < 0) {\n\t\t\t$this->maxThreadNoType = 0;\n\t\t}\n\t\t// unset none exitst type num\n\t\tforeach ( $this->info ['all'] ['taskRunningNumType'] as $k => $v ) {\n\t\t\tif ($v == 0 && ! array_key_exists ( $k, $this->maxThreadType )) {\n\t\t\t\tprint_r ( $this->maxThreadType );\n\t\t\t\texit ();\n\t\t\t\tunset ( $this->info ['all'] ['taskRunningNumType'] [$k] );\n\t\t\t}\n\t\t}\n\t\t// init type num\n\t\tforeach ( $this->maxThreadType as $k => $v ) {\n\t\t\tif ($v == 0) {\n\t\t\t\tuser_error ( 'maxThreadType[' . $k . '] is 0, task of this type will never be added!', E_USER_WARNING );\n\t\t\t}\n\t\t\tif (! array_key_exists ( $k, $this->info ['all'] ['taskRunningNumType'] )) {\n\t\t\t\t$this->info ['all'] ['taskRunningNumType'] [$k] = 0;\n\t\t\t}\n\t\t}\n\t}",
"function multiple_threads_request($nodes)\n{\n\n $mh = curl_multi_init();\n $curl_array = array();\n foreach ($nodes as $i => $url) {\n $curl_array[$i] = curl_init($url);\n curl_setopt($curl_array[$i], CURLOPT_RETURNTRANSFER, true);\n curl_setopt($curl_array[$i], CURLOPT_FOLLOWLOCATION, true);\n curl_setopt($curl_array[$i], CURLOPT_SSL_VERIFYHOST, false);\n curl_setopt($curl_array[$i], CURLOPT_SSL_VERIFYPEER, false);\n curl_setopt($curl_array[$i], CURLOPT_COOKIEFILE, \"/tmp/cookie.txt\");\n curl_setopt($curl_array[$i], CURLOPT_COOKIEJAR, \"/tmp/cookie.txt\");\n curl_multi_add_handle($mh, $curl_array[$i]);\n }\n $running = null;\n do {\n usleep(10000);\n curl_multi_exec($mh, $running);\n } while ($running > 0);\n\n $res = array();\n foreach ($nodes as $i => $url) {\n $res[$url] = curl_multi_getcontent($curl_array[$i]);\n }\n\n foreach ($nodes as $i => $url) {\n curl_multi_remove_handle($mh, $curl_array[$i]);\n }\n curl_multi_close($mh);\n return $res;\n}",
"public function createThread()\r\n {\r\n $req_result = $this->thread->createThread();\r\n print(json_encode($req_result));\r\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Description This function accepts a packet that was recieved via TNC and checks if it is an aprs packet. Arguments q: tnid: args: The arguments for the hook | function qruqsp_aprs_hooks_packetReceived(&$ciniki, $tnid, $args) {
//
// If no packet in args, then perhaps a packet we don't understand
//
if( !isset($args['packet']['data']) ) {
return array('stat'=>'ok');
}
//
// Check the control and protocol are correct
//
if( !isset($args['packet']['control']) || $args['packet']['control'] != 0x03
|| !isset($args['packet']['protocol']) || $args['packet']['protocol'] != 0xf0
) {
return array('stat'=>'ok');
}
//
// Try to parse the data
//
ciniki_core_loadMethod($ciniki, 'qruqsp', 'aprs', 'private', 'packetParse');
$rc = qruqsp_aprs_packetParse($ciniki, $tnid, $args['packet']);
if( $rc['stat'] != 'ok' && $rc['stat'] != 'noaprs' ) {
return $rc;
}
//
// If the packet was parsed, or no aprs data was found, success is returned
//
return array('stat'=>'ok');
} | [
"function qruqsp_sams_hooks_packetReceived(&$ciniki, $tnid, $args) {\n //\n // If no packet in args, then perhaps a packet we don't understand\n //\n if( !isset($args['packet']['data']) ) {\n error_log('no data');\n return array('stat'=>'ok');\n }\n\n //\n // Check the control and protocol are correct\n //\n if( !isset($args['packet']['control']) || $args['packet']['control'] != 0x03 \n || !isset($args['packet']['protocol']) || $args['packet']['protocol'] != 0xf0 \n ) {\n error_log('wrong control/protocol');\n return array('stat'=>'ok');\n }\n\n //\n // Check for a message packet\n //\n if( isset($args['packet']['data'][0]) && $args['packet']['data'][0] == ':'\n && preg_match(\"/^:([a-zA-Z0-9\\- ]{9}):(.*)$/\", $args['packet']['data'], $matches) \n ) {\n $to_callsign = $matches[1];\n $content = $matches[2];\n\n if( isset($args['packet']['addrs'][1]) ) {\n $from_callsign = $args['packet']['addrs'][1]['callsign'];\n } else {\n $from_callsign = '??';\n }\n error_log('Received: (' . $to_callsign . ') ' . $content);\n\n //\n // Get a UUID for use in permalink\n //\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbUUID');\n $rc = ciniki_core_dbUUID($ciniki, 'qruqsp.sams');\n if( $rc['stat'] != 'ok' ) {\n return array('stat'=>'fail', 'err'=>array('code'=>'qruqsp.sams.15', 'msg'=>'Unable to get a new UUID', 'err'=>$rc['err']));\n }\n $uuid = $rc['uuid'];\n $msg_id = $uuid;\n\n //\n // FIXME: Check for a message ID\n //\n\n\n $rc = ciniki_core_objectAdd($ciniki, $tnid, 'qruqsp.sams.message', array(\n 'msg_id' => $msg_id,\n 'status' => 70,\n 'from_callsign' => $from_callsign,\n 'to_callsign' => $to_callsign,\n 'path' => '',\n 'content' => $content,\n ), 0x04);\n if( $rc['stat'] != 'ok' ) {\n return array('stat'=>'fail', 'err'=>array('code'=>'qruqsp.sams.14', 'msg'=>'Unable to store aprs message', 'err'=>$rc['err']));\n }\n }\n\n //\n // If the packet was parsed, or no aprs data was found, success is returned\n //\n return array('stat'=>'ok');\n}",
"abstract public function parse($packet);",
"public function isInstalled($packet);",
"function checkReply()\n {\n }",
"protected function parseRcptTo($response, &$data)\n {\n if (strpos(trim($response), '25') !== 0)\n {\n $this->last_error = $response;\n return false;\n }\n return true;\n }",
"function nntp_cmd($conn, $command, $expected) {\n if (strlen($command) > 510){\n die(\"command too long: $command\");\n }\n\n fputs($conn, \"$command\\r\\n\");\n list($code,$extra) = explode(' ', fgets($conn, 1024), 2);\n\n return $code == $expected ? $extra : false;\n}",
"function convert_dns_reply_log($mode, $fields) {\n\tglobal $pfb, $config, $local_hosts, $filterfieldsarray, $clists, $counter, $pfbentries, $skipcount, $dnsfilterlimit, $dnsfilterlimitentries;\n\n\tif ($dnsfilterlimit) {\n\t\treturn TRUE;\n\t}\n\n\t$pfbalertreply\t\t= array();\n\t$pfbalertreply[81]\t= $fields[2];\t// DNS Reply Type\n\t$pfbalertreply[82]\t= $fields[3];\t// DNS Reply Orig Type \n\t$pfbalertreply[83]\t= $fields[4];\t// DNS Reply Final Type \n\t$pfbalertreply[84]\t= $fields[5];\t// DNS Reply TTL \n\t$pfbalertreply[85]\t= $fields[6];\t// DNS Reply Domain\n\t$pfbalertreply[86]\t= $fields[7];\t// DNS Reply SRC IP\n\t$pfbalertreply[87]\t= $fields[8];\t// DNS Reply DST IP\n\t$pfbalertreply[88]\t= $fields[9];\t// DNS Reply GeoIP\n\t$pfbalertreply[89]\t= $fields[1]; // DNS Reply Timestamp\n\n\t// If alerts filtering is selected, process filters as required.\n\tif ($pfb['filterlogentries']) {\n\t\tif (empty($filterfieldsarray[2])) {\n\t\t\treturn TRUE;\n\t\t}\n\t\tif (!pfb_match_filter_field($pfbalertreply, $filterfieldsarray[2])) {\n\t\t\treturn FALSE;\n\t\t}\n\t\tif ($dnsfilterlimitentries != 0 && $counter[$mode == 'Unified' && !$pfb['filterlogentries'] ? 'Unified' : 'DNS'] >= $dnsfilterlimitentries) {\n\t\t\t$dnsfilterlimit = TRUE;\n\t\t\treturn TRUE;\n\t\t}\n\t} else {\n\t\tif ($counter[$mode == 'Unified' && !$pfb['filterlogentries'] ? 'Unified' : 'DNS'] >= $pfbentries) {\n\t\t\t$dnsfilterlimit = TRUE;\n\t\t\treturn TRUE;\n\t\t}\n\t}\n\t$counter[$mode == 'Unified' && !$pfb['filterlogentries'] ? 'Unified' : 'DNS']++;\n\n\t$hostname = $local_hosts[$fields[7]] ?: '';\n\tif (!empty($hostname) && strlen($hostname) >= 25) {\n\t\t$title_hostname = $hostname;\n\t\t$hostname\t= substr($hostname, 0, 24) . \"<small>...</small>\";\n\t}\n\n\t// Determine if Domain is a TLD Exclusion\n\t$isExclusion = FALSE;\n\tif (isset($clists['tldexclusion']['data'][$fields[7]])) {\n\t\t$isExclusion = TRUE;\n\t}\n\n\t// Python_control command\n\tif (strpos($fields[6], 'python_control') !== FALSE) {\n\t\t$cc_color = 'blue';\n\t\tif (strpos($fields[8], 'not authorized') !== FALSE) {\n\t\t\t$cc_color = 'red';\n\t\t}\n\t\t$icons = \"<i class=\\\"fa fa-cog\\\" title=\\\"Python_control command\\\" style=\\\"color: {$cc_color}\\\"></i>\";\n\t}\n\n\t// Determine Whitelist type\n\telse {\n\n\t\t$dns_fields = array ('2' => $fields[6], '6' => 'Unknown');\n\t\tlist($supp_dom, $ex_dom, $isWhitelist_found) = dnsbl_whitelist_type($dns_fields, $clists, $isExclusion, FALSE, $fields[6]);\n\n\t\t// Threat Lookup Icon\n\t\t$icons = '<a class=\"fa fa-info icon-pointer icon-primary\" title=\"Click for Threat Domain Lookup.\" target=\"_blank\" ' .\n\t\t\t\t'href=\"/pfblockerng/pfblockerng_threats.php?domain=' . $fields[6] . '\"></a>';\n\n\t\tif (!empty($supp_dom)) {\n\t\t\t$icons .= \" {$supp_dom}\";\n\t\t}\n\n\t\t// Default - Add to Blacklist\n\t\telse {\n\t\t\t$icons .= ' <i class=\"fa fa-plus icon-pointer icon-primary\" id=\"DNSBLWT|' . 'dnsbl_add|'\n\t\t\t\t. $fields[6] . '|' . implode('|', $clists['dnsbl']['options']) . '\" title=\"'\n\t\t\t\t. \"Add Domain [ {$fields[6]} ] to DNSBL\" . '\"></i>';\n\t\t}\n\n\t\tif (!empty($ex_dom)) {\n\t\t\t$icons .= \" {$ex_dom}\";\n\t\t}\n\t}\n\n\t// Truncate long TTLs\n\t$pfb_title5 = '';\n\tif (strlen($fields[5]) >= 6) {\n\t\t$pfb_title5\t= $fields[5];\n\t\t$fields[5]\t= substr($fields[5], 0, 5) . \"<small>...</small>\";\n\t}\n\n\t// Truncate long Domain names\n\t$pfb_title6 = '';\n\tif (strlen($fields[6]) >= ($mode != 'unified' ? 45 : 30)) {\n\t\t$pfb_title6\t= $fields[6];\n\t\t$fields[6]\t= substr($fields[6], 0, ($mode != 'unified' ? 44 : 29)) . \"<small>...</small>\";\n\t}\n\n\t// Truncate long Resolved names\n\t$pfb_title8 = '';\n\tif (strlen($fields[8]) >= 17) {\n\t\t$pfb_title8\t= $fields[8];\n\t\t$fields[8]\t= substr($fields[8], 0, 16) . \"<small>...</small>\";\n\t}\n\n\tif ($mode != 'Unified') {\n\t\tprint (\"<tr>\n\t\t\t<td>{$fields[1]}</td>\n\t\t\t<td title=\\\"{$title_hostname}\\\">{$fields[7]}<br /><small>{$hostname}</small></td>\n\t\t\t<td style=\\\"text-align: center\\\">{$fields[2]}</td>\n\t\t\t<td style=\\\"text-align: center\\\">{$fields[3]}</td>\n\t\t\t<td style=\\\"text-align: center\\\">{$fields[4]}</td>\n\t\t\t<td style=\\\"white-space: nowrap;\\\">{$icons}</td>\n\t\t\t<td title=\\\"{$pfb_title6}\\\">{$fields[6]}</td>\n\t\t\t<td title=\\\"{$pfb_title5}\\\">{$fields[5]}</td>\n\t\t\t<td title=\\\"{$pfb_title8}\\\">{$fields[8]}</td>\n\t\t\t<td>{$fields[9]}</td>\n\t\t\t</tr>\");\n\t}\n\telse {\n\t\t$style_bg = '';\n\t\t$title = 'DNS Reply Event';\n\t\tif ($fields[7] == '127.0.0.1') {\n\t\t\t$bg = strpos($config['system']['webgui']['webguicss'], 'dark') ? $pfb['unireply2'] : $pfb['unireply'];\n\t\t\tif ($bg != 'none') {\n\t\t\t\t$style_bg = \"style=\\\"background-color:{$bg}\\\"\";\n\t\t\t}\n\t\t\t$title = 'DNS Reply (Resolver) Event';\n\t\t}\n\n\t\tprint (\"<tr title=\\\"{$title}\\\" {$style_bg}>\n\t\t\t<td style=\\\"white-space: nowrap;\\\">{$fields[1]}</td>\n\t\t\t<td></td>\n\t\t\t<td title=\\\"{$title_hostname}\\\">{$fields[7]}<br /><small>{$hostname}</small></td>\n\t\t\t<td>{$fields[2]}<br /><small>{$fields[3]} | {$fields[4]}</small></td>\n\t\t\t<td title=\\\"{$pfb_title5}\\\"><small>{$fields[5]}</small></td>\n\t\t\t<td style=\\\"text-align: center; white-space: nowrap;\\\">{$icons}</td>\n\t\t\t<td title=\\\"{$pfb_title6}\\\">{$fields[6]}</td>\n\t\t\t<td title=\\\"{$pfb_title8}\\\">{$fields[8]}</td>\n\t\t\t<td>{$fields[9]}</td>\n\t\t\t</tr>\");\n\t}\n\treturn FALSE;\n}",
"function check_ipn_response() {\n\t\t\tif ( !empty($_POST['id_transacao']) && !empty($_POST['cod_moip']) ) {\n\t\t\t\t$_POST = stripslashes_deep($_POST);\n\t\t\t\tif ($this->debug=='yes') $this->log->add($this->id, 'Analisando POST...');\n\t\t\t\tif ($this->check_ipn_request_is_valid()){\n\t\t\t\t\tif ($this->debug=='yes') $this->log->add($this->id, 'POST OK. Atualizando Pedido...');\n\t\t\t\t\tdo_action(\"valid-moip-standard-ipn-request\", $_POST);\n\t\t\t\t} else {\n\t\t\t\t\tif ($this->debug=='yes') $this->log->add($this->id, 'Validação do POST Falhou.');\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"private function responseParser( $packet ) {\r\n $i = 12;\r\n $this->datagram = $packet;\r\n $this->labels = array();\r\n $header = $this->Header_processor( $packet );\r\n $res_info = array( \r\n \"Header\" => $header,\r\n \"Records\" => array()\r\n );\r\n if ( $header['RCODE'] == 0\r\n && ( $header['ANCOUNT'] > 0 || $header['ARCOUNT'] > 0 || $header['NSCOUNT'] > 0 ) ) {\r\n $res_info[\"Request\"] = $this->readQuestion( $i );\r\n $len = strlen( $packet );\r\n for ( ; $i < $len; $i += 10 ) {\r\n $domain = $this->GetLable( $i );\r\n $type = $this->bit8to16( substr( $packet, $i , 2 ) );\r\n $class = $this->bit8to16( substr( $packet, $i + 2 , 2 ) );\r\n $ttl = $this->bit16to32( substr( $packet, $i + 4 , 4 ) );\r\n $rdlength = $this->bit8to16( substr( $packet, $i + 8 , 2 ) );\r\n $rdata = substr( $packet, $i + 10, $rdlength );\r\n $record = array( \r\n \"Domain\" => implode( \".\", $domain ),\r\n \"Type\" => array_search( $type , $this->qtypes ),\r\n \"Class\" => array_search( $class, $this->qclass ),\r\n \"Ttl\" => $ttl,\r\n \"Record\" => $this->RData( $type, $i + 10, $i + 10 + $rdlength )\r\n );\r\n $i += strlen( $rdata );\r\n $res_info[\"Records\"][] = $record;\r\n }\r\n return $res_info;\r\n }else {\r\n $this->t_log[] = \"There might be a problum in the request data, or the server had\".\r\n \t\t\t\t \" responded with zero records as response.\";\r\n \t}\r\n \treturn false;\r\n\t}",
"function parselog_postfix(&$r) {\n\tglobal $logins;\n\tglobal $emailaddrs;\n\tglobal $ipaddrs;\n\tglobal $follow_msgids;\n\tstatic $sessions = array();\t// smtpd sessions\n\tstatic $messages = array();\t// postfix queued messages\n\tstatic $messageids = array();\t// tracked message-ids\n\n\t# smtpd\n\tstatic $smtpd_connect = '/connect from ([^[]*)\\[((\\d{1,3}\\.){3}\\d{1,3})\\]/';\n\tstatic $smtpd_queuemsg = '/^([[:xdigit:]]+): client=([^[]*)\\[((\\d{1,3}\\.){3}\\d{1,3})\\]/';\n\tstatic $smtpd_disconnect = '/disconnect from ([^[]*)\\[((\\d{1,3}\\.){3}\\d{1,3})\\]/';\n\tstatic $smtpd_sasl_client = '/^([[:xdigit:]]+): client=([^[]*)\\[((\\d{1,3}\\.){3}\\d{1,3})\\], sasl_method=[^, ]*, sasl_username=([^, ]+)/';\n\n\t# qmgr\n\tstatic $qmgr_removed = '/^([[:xdigit:]]+): removed/';\n\n\t# lmtp\n\t# potential bug: this also matches delivery to remote postfix servers,\n\t# so we'll try to track their queueid - harmless?\n\tstatic $lmtp_secondary_qid = '/^([[:xdigit:]]+): (to|from)=<([^>]+)>.+status=sent.+ queued as ([[:xdigit:]]+)/';\n\n\t# bounce\n\tstatic $bounce_secondary_qid = '/^([[:xdigit:]]+): sender .*notification: ([[:xdigit:]]+)/';\n\n\t# various\n\tstatic $match_to_from = '/^([[:xdigit:]]+): (to|from)=<([^>]+)>/';\n\tstatic $match_msgid = '/^([[:xdigit:]]+): message-id=(.+)/';\n\tstatic $qmsg_record = '/^([[:xdigit:]]+): (.*)/';\n\n\t$daemon = substr($r['service'],strlen(\"postfix/\"));\n\t$pid = $r['pid'];\n\t$log = $r['log'];\n\t$qid = $r['qid'];\n\n\tif ($qid) {\n\t\tif (! isset($messages[$qid])) {\n\t\t\t$messages[$qid] = array();\n\t\t\t$messages[$qid]['records'] = array();\n\t\t}\n\t\t$msg =& $messages[$qid];\n\t} else {\n\t\t$msg = null;\n\t}\n\n\tswitch($daemon)\n\t{\n\t case 'smtpd':\n\n\tif (! isset($sessions[$pid])) {\n\t\t$sessions[$pid] = array();\n\t\t$sessions[$pid]['records'] = array();\n\t}\n\n\t$sess =& $sessions[$pid];\n\n\tif (count($sess) == 0) {\n\t\tif (preg_match($smtpd_connect, $log, $m)) {\n\t\t\t# Connect\n\t\t\t$sess['connectip'] = $m[2];\n\t\t\t$sess['records'][] = $r['record'];\n\t\t\t$sess['connect_record'] = $r['record'];\n\t\t} else if (preg_match($smtpd_queuemsg, $log, $m)) {\n\t\t\t$sess['records'][] = $r['record'];\n\n\t\t\t# Message is queued, save id and info\n\t\t\t$sess['qid'] = $qid;\n\t\t\t$sess['qids'][$qid] = $qid;\n\t\t\t$sess['clientip'] = $m[3];\n\t\t\t$msg['clientip'] = $m[3];\n\t\t\tif (isset($sess['connect_record']))\n\t\t\t\t$msg['records'][] = $sess['connect_record'];\n\t\t\t$msg['records'][] = $r['record'];\n\n\t\t\tif (preg_match($smtpd_sasl_client, $log, $m)) {\n\t\t\t\t$sess['sasl_username'] = strtolower($m[5]);\n\t\t\t\t$msg['sasl_username'] = strtolower($m[5]);\n\t\t\t}\n\t\t}\n\t} else if (preg_match($smtpd_queuemsg, $log, $m)) {\n\t\t$sess['records'][] = $r['record'];\n\n\t\t# Message is queued, save id and info\n//\t\tif (isset($sess['qid'])) {\n//\t\t\t// got new message in ongoing session\n//\t\t}\n\t\t$sess['qid'] = $qid;\n\t\t$sess['qids'][$qid] = $qid;\n\t\t$sess['clientip'] = $m[3];\n\t\t$msg['clientip'] = $m[3];\n\t\t$msg['records'][] = $r['record'];\n\n\t\tif (preg_match($smtpd_sasl_client, $log, $m)) {\n\t\t\t$sess['sasl_username'] = strtolower($m[5]);\n\t\t\t$msg['sasl_username'] = strtolower($m[5]);\n\t\t}\n\t} else if (isset($sess['connectip'])) {\n\t\t$sess['records'][] = $r['record'];\n\n\t\tif (preg_match($smtpd_disconnect, $log, $m)) {\n\t\t\t# Disconnect\n\t\t\tif (isset($sess['qid'])) {\n\t\t\t\tforeach ($sess['qids'] as $qid)\n\t\t\t\t\t$msg['records'][] = $r['record'];\n\t\t\t} else if (in_array($sess['connectip'], $ipaddrs)) {\n\t\t\t\t# Note if qid is set, the session records will print later\n\t\t\t\tforeach ($sess['records'] as $rec)\n\t\t\t\t\techo $rec;\n\t\t\t}\n\t\t\tunset($sessions[$qid]);\n\t\t}\n\t}\n\n\n\t\tbreak;\n\t case 'qmgr':\n\n\tif (preg_match($qmgr_removed, $log, $m)) {\n\t\tif ($msg != null) {\n\t\t\t$msg['records'][] = $r['record'];\n\n\t\t\t# potential bug:\n\t\t\t# if a child qid is removed before the parent's log\n\t\t\t# entry ties them together, we would miss the child.\n\t\t\t# in practice, I don't see that in our logs.\n\n\t\t\t$print_records=0;\n\n\t\t\tif (isset($msg['clientip'])\n\t\t\t && in_array($msg['clientip'], $ipaddrs))\n\t\t\t{\n\t\t\t\t$print_records++;\n\t\t\t} else if (isset($msg['sasl_username'])\n\t\t\t && in_array($msg['sasl_username'], $logins))\n\t\t\t{\n\t\t\t\t$print_records++;\n\t\t\t} else if (isset($msg['addrs'])\n\t\t\t && (count($emailaddrs) > 0))\n\t\t\t{\n\t\t\t\tforeach ($msg['addrs'] as $addr)\n\t\t\t \t\tif (in_array($addr, $emailaddrs))\n\t\t\t\t\t\t$print_records++;\n\t\t\t}\n\n\t\t\t$msgid = (isset($msg['message-id']) ? $msg['message-id'] : null);\n\n\t\t\tif ($msgid && isset($messageids[$msgid])\n\t\t\t\t&& isset($messageids[$msgid]['tracked'])\n\t\t\t\t&& $messageids[$msgid]['tracked'])\n\t\t\t{\n\t\t\t\t\t$follow_msgid = true;\n\t\t\t} else {\n\t\t\t\t\t$follow_msgid = false;\n\t\t\t}\n\n\t\t\tif ($print_records || isset($msg['me_too']) || $follow_msgid) {\n\t\t\t\tif ($msgid) {\n\t\t\t\t\t$messageids[$msgid]['tracked'] = true;\n\t\t\t\t\t$follow_msgid = true;\n\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\tforeach ($msg['records'] as $rec)\n\t\t\t\t\techo $rec;\n\t\t\t}\n\n\t\t\t# flag parent to print (if needed) and remove linkage\n\t\t\tif (isset($msg['parent_qid'])\n\t\t\t && isset($messages[$msg['parent_qid']]))\n\t\t\t{\n\t\t\t\tif ($print_records)\n\t\t\t\t\t$messages[$msg['parent_qid']]['me_too']=1;\n\t\t\t\tunset($messages[$msg['parent_qid']]['child_qids'][$qid]);\n\t\t\t}\n\n\t\t\t# flag child(s) to print (if needed) and remove linkage(s)\n\t\t\tif (isset($msg['child_qids'])) {\n\t\t\t\tforeach ($msg['child_qids'] as $child_qid) {\n\t\t\t\t\tif ($print_records)\n\t\t\t\t\t\t$messages[$child_qid]['me_too']=1;\n\t\t\t\t\tunset($messages[$child_qid]['parent_qid']);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ($msgid && ! $follow_msgid) {\n\t\t\t\tunset($messageids[$msgid]);\n\t\t\t}\n\t\t\tunset($messages[$qid]);\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t\t// no break, fallthrough to next case\n\t case 'smtp':\n\t case 'cleanup':\n\t case 'lmtp':\n\t case 'local':\n\t case 'pipe':\n\t case 'bounce':\n\t case 'error':\n\n\tif (preg_match($lmtp_secondary_qid, $log, $m)) {\n\t\t$qid2 = $m[4];\n\t\t$msg['child_qids'][$qid2] = $qid2;\n\t\t$messages[$qid2]['parent_qid'] = $qid;\n\t\t$msg['addrs'][] = strtolower($m[3]);\n\t\t$msg['records'][] = $r['record'];\n\t} else if (preg_match($bounce_secondary_qid, $log, $m)) {\n\t\t$qid2 = $m[2];\n\t\t$msg['child_qids'][$qid2] = $qid2;\n\t\t$messages[$qid2]['parent_qid'] = $qid;\n\t\t$msg['records'][] = $r['record'];\n\t} else if (preg_match($match_to_from, $log, $m)) {\n\t\t$msg['addrs'][] = strtolower($m[3]);\n\t\t$msg['records'][] = $r['record'];\n\t} else if ($follow_msgids\n\t\t\t&& preg_match($match_msgid, $log, $m)) {\n\t\t$msg['message-id'] = $m[2];\n\t\t$msg['records'][] = $r['record'];\n\t} else if ($qid) {\n\t\t$msg['records'][] = $r['record'];\n\t}\n\n\n\t\tbreak;\n\t case 'anvil':\n\t case 'master':\n\t case 'pickup':\n\t case 'postfix-script':\n\t case 'postsuper':\n\t case 'scache':\n\t case 'sendmail':\n\t case 'trivial-rewrite':\n\t\tbreak;\n\t default:\n\t\t\t\tdie (\"ERROR: Don't know what to do with postfix service '$daemon'\\n\");\n\t\tbreak;\n\t}\n}",
"public function log_check()\n {\n if(@socket_recvfrom($this->socket, $buffer, 2048, 0, $from, $port))\n {\n //echo(\"got one from $from, $port -->$buffer\\n\");\n // parse buffer int [type] [filename] [timestamp] [data]\n $packet=explode(\" \",$buffer,3);\n \n if(\"F\"===$packet[0])\n {\n // Flush\n if(defined('LOGGERVERBOSE')) echo(\"Flush Request for $packet[1]\\n\");\n flush($packet[1]);\n }\n else if(\"L\"===$packet[0])\n {\n // Got a log entry, queue it up if all data is there.\n if( isset($packet[1]) && isset($packet[2]) )\n {\n // Call Insert to insert this entry\n $this->log_insert($packet[1],$packet[2]);\n }\n }\n }\n }",
"function drush_backend_parse_packets(&$string, &$remainder, $backend_options) {\n $remainder = '';\n $packet_regex = strtr(sprintf(DRUSH_BACKEND_PACKET_PATTERN, \"([^\\0]*)\"), [\"\\0\" => \"\\\\0\"]);\n $packet_regex = str_replace(\"\\n\", \"\", $packet_regex);\n if (preg_match_all(\"/$packet_regex/s\", $string, $match, PREG_PATTERN_ORDER)) {\n drush_set_context('DRUSH_RECEIVED_BACKEND_PACKETS', TRUE);\n foreach ($match[1] as $packet_data) {\n $entry = (array) json_decode($packet_data);\n // Ensure $entry['_style'] isn't set to avoid type mismatch errors.\n unset($entry['_style']);\n if (is_array($entry) && isset($entry['packet'])) {\n $function = 'drush_backend_packet_' . $entry['packet'];\n if (function_exists($function)) {\n $function($entry, $backend_options);\n }\n else {\n drush_log(dt(\"Unknown backend packet @packet\", ['@packet' => $entry['packet']]), LogLevel::INFO);\n }\n }\n else {\n drush_log(dt(\"Malformed backend packet\"), LogLevel::ERROR);\n drush_log(dt(\"Bad packet: @packet\", ['@packet' => print_r($entry, TRUE)]), LogLevel::DEBUG);\n drush_log(dt(\"String is: @str\", ['@str' => $packet_data]), LogLevel::DEBUG);\n }\n }\n $string = preg_replace(\"/$packet_regex/s\", '', $string);\n }\n // Check to see if there is potentially a partial packet remaining.\n // We only care about the last null; if there are any nulls prior\n // to the last one, they would have been removed above if they were\n // valid drush packets.\n $embedded_null = strrpos($string, \"\\0\");\n if ($embedded_null !== FALSE) {\n // We will consider everything after $embedded_null to be part of\n // the $remainder string if:\n // - the embedded null is less than strlen(DRUSH_BACKEND_OUTPUT_START)\n // from the end of $string (that is, there might be a truncated\n // backend packet header, or the truncated backend output start\n // after the null)\n // OR\n // - the embedded null is followed by DRUSH_BACKEND_PACKET_START\n // (that is, the terminating null for that packet has not been\n // read into our buffer yet)\n if (($embedded_null + strlen(DRUSH_BACKEND_OUTPUT_START) >= strlen($string)) || (substr($string, $embedded_null + 1, strlen(DRUSH_BACKEND_PACKET_START)) == DRUSH_BACKEND_PACKET_START)) {\n $remainder = substr($string, $embedded_null);\n $string = substr($string, 0, $embedded_null);\n }\n }\n}",
"function serendipity_pingback_is_success($resp) {\n // This is very rudimentary, but the fault is printed later, so what..\n if (preg_match('@<fault>@', $resp, $matches)) {\n return false;\n }\n return true;\n}",
"function process_packet($packet)\n{\n //IP Header\n $ip_header_fmt = 'Cip_ver_len/'\n .'Ctos/'\n .'ntot_len/'\n .'nidentification/'\n .'nfrag_off/'\n .'Cttl/'\n .'Cprotocol/nheader_checksum/Nsource_add/Ndest_add/';\n\n //Unpack the IP header\n $ip_header = unpack($ip_header_fmt , $packet);\n\n if($ip_header['protocol'] == '6')\n {\n print_tcp_packet($packet);\n }\n}",
"Function ParseReplyLine($s)\n {\n $s = trim($s);\n $result[Line] = $s;\n $result[Code] = (int)substr($s,0,3);\n $result[More] = (strlen($s) > 3) && ($s[3] == '-');\n $result[Text] = substr($s,4);\n return $result;\n }",
"protected function basic_qos_ok($args)\n {\n }",
"protected function basic_qos_ok($args)\r\n {\r\n }",
"function decode804A( $dest, $payload, $ln, $qos, $dummy)\n {\n // Source address est le dernier champ, voir page https://zigate.fr/documentation/commandes-zigate/\n \n // app_general_events_handler.c\n // E_SL_MSG_MANAGEMENT_NETWORK_UPDATE_RESPONSE\n $this->deamonlog('debug', 'Type; 804A: (Management Network Update response)(Not Processed)'\n . '; (Not processed*************************************************************)'\n . '; dest: '.$dest\n . '; Level: 0x'.substr($payload, 0, 2)\n . '; Message: '.$this->hex2str(substr($payload, 2, strlen($payload) - 2)) );\n }",
"function is_message($packet)\n {\n if(!is_array($packet))\n return false;\n if($packet[0] != $this->MRIM_CS_MESSAGE_ACK)\n return false;\n list(,$seq) = unpack('L1',$packet[1]);\n $packet[1] = substr($packet[1],4);\n list(,$flag) = unpack('L1',$packet[1]);\n $packet[1] = substr($packet[1],4);\n list(,$len) = unpack('L1',$packet[1]);\n $packet[1] = substr($packet[1],4);\n $ret['from'] = substr($packet[1],0,$len);\n $packet[1] = substr($packet[1],$len);\n list(,$len) = unpack('L1',$packet[1]);\n $packet[1] = substr($packet[1],4);\n $text = substr($packet[1],0,$len);\n if($this->status != 'invisible') {\n $data = pack('L1',strlen($ret['from'])).$ret['from'].pack('L1',$seq);\n fwrite($this->sock,$this->make_packet($this->MRIM_CS_MESSAGE_RECV,$data));\n }\n if($flag & $this->MESSAGE_FLAG_ALARM)\n $ret['type'] = 'alarm';\n elseif($flag & $this->MESSAGE_FLAG_AUTHORIZE)\n $ret['type'] = 'auth';\n elseif($flag & $this->MESSAGE_FLAG_CONTACT)\n $ret['type'] = 'contact';\n elseif($flag & $this->MESSAGE_FLAG_MULTICAST)\n $ret['type'] = 'multi';\n elseif($flag & $this->MESSAGE_FLAG_NOTIFY)\n $ret['type'] = 'typing';\n elseif($flag & $this->MESSAGE_FLAG_SYSTEM)\n $ret['type'] = 'system';\n else\n $ret['type'] = 'message';\n if($flag & $this->MESSAGE_FLAG_SPAM)\n $ret['spam'] = true;\n if($flag & $this->MESSAGE_FLAG_SMS_NOTIFY || $flag & $this->MESSAGE_FLAG_SMS)\n $ret['type'] = 'sms';\n $nickname = false;\n if($ret['type'] == 'auth') {\n $text = base64_decode($text);\n $text = substr($text,4);\n list(,$len) = unpack('L1',$text);\n $text = substr($text,4);\n $ret['nickname'] = substr($text,0,$len);\n $text = substr($text,$len);\n list(,$len) = unpack('L1',$text);\n $text = substr($text,4);\n $text = substr($text,0,$len);\n }\n if($flag & $this->MESSAGE_FLAG_OLD)\n $text = iconv('CP1251','UTF-8//IGNORE',$text);\n else\n $text = iconv('UTF-16LE','UTF-8//IGNORE',$text);\n $ret['text'] = $text;\n return $ret;\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets a new transactionIdentifier A unique identifier to relate all messages within a transaction (e.g. this would be sent in all request and response messages that are part of an ongoing transaction). | public function setTransactionIdentifier($transactionIdentifier)
{
$this->transactionIdentifier = $transactionIdentifier;
return $this;
} | [
"public function setTransactionId(?string $transactionId): void\n {\n $this->transactionId = $transactionId;\n }",
"public function setTransactionId(string $transaction_id): void\n {\n $this->_transaction_id = $transaction_id;\n }",
"public function set_transaction_id( $transaction_id ) {\n\t\t$this->transaction_id = $transaction_id;\n\t}",
"public final function setIdentifier($identifier)\n {\n $this->_identifier = $identifier;\n }",
"public function setIdentifier($identifier)\n {\n $this->setIdentifierToken($identifier);\n }",
"public function setIdentifier($identifier)\n {\n $this->setToken($identifier);\n }",
"public function setIdentifier($identifier);",
"public function setTransactionUid ($transUid)\n {\n $this->transactionId = $transUid;\n }",
"public function setMessageIdentifier($messageIdentifier)\n {\n $this->messageIdentifier = $messageIdentifier;\n return $this;\n }",
"public function setTransactionUid ($transUid);",
"public function setIdentifier()\n {\n $this->session->put($this->sessionKeyCartIdentifier,$this->generateIdentifier());\n }",
"public function setTransactionUid ($transUid) {\n $this->getGatewayObj()->setTransactionUid($transUid);\n }",
"public function setTxnID($value)\n\t{\n\t\treturn $this->set('TxnID', $value);\n\t}",
"protected function setTransactionID($contribution_id) {\n if ($contribution_id) {\n $this->transaction_id = $contribution_id;\n }\n else {\n $this->transaction_id = rand(0, 1000);\n }\n }",
"public function setTransactionUid ($transUid)\n {\n $this->getGatewayObj()->setTransactionUid($transUid);\n }",
"public function setItemTransactionID(array $itemTransactionID)\n {\n $this->itemTransactionID = $itemTransactionID;\n return $this;\n }",
"public function setTransactionId($transaction_id)\r\n{\r\n$this->post_data['transactionId'] = $transaction_id;\r\n}",
"public function setItemTransactionIDArray(array $itemTransactionIDArray)\n {\n $this->itemTransactionIDArray = $itemTransactionIDArray;\n return $this;\n }",
"public function setTxId($var)\n {\n GPBUtil::checkString($var, True);\n $this->tx_id = $var;\n\n return $this;\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Processes a string query into a SearchGroup. | private function parseQuery()
{
if ($this->raw_query === null) {
return;
}
$matches = $this->patternMatchQueryString();
[$this->root_group] = $this->constructGroup(
$matches,
0,
new SearchGroup
);
$this->resolveTags();
} | [
"public function addGroupQuery(string $value): \\SolrQuery {}",
"protected function extractSearchGroupings()\r\n\t{\r\n\t\t$arrFinal = array();\r\n\t\t\r\n\t\tforeach ( $this->request->getParams() as $key => $value )\r\n\t\t{\r\n\t\t\t$key = urldecode($key);\r\n\t\t\t\r\n\t\t\t// if we see 'query' as the start of a param, check if there are corresponding\r\n\t\t\t// entries for field and boolean; these will have a number after them\r\n\t\t\t// if coming from an advanced search form\r\n\t\t\t\t\r\n\t\t\tif ( preg_match(\"/^query/\", $key) )\r\n\t\t\t{\r\n\t\t\t\tif ( $value == \"\" )\r\n\t\t\t\t{\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\t\t\t\r\n\r\n\t\t\t\t$id = str_replace(\"query\", \"\", $key);\r\n\t\t\t\t\r\n\t\t\t\t$arrTerm = array();\r\n\t\t\t\t\r\n\t\t\t\t$arrTerm[\"id\"] = $id;\r\n\t\t\t\t$arrTerm[\"query\"] = $value;\r\n\t\t\t\t$arrTerm[\"relation\"] = $this->request->getParam(\"relation$id\");\t\t\t\r\n\t\t\t\t$arrTerm[\"field\"] = $this->request->getParam(\"field$id\");\r\n\t\t\t\t\r\n\t\t\t\t// boolean only counts if this is not the first query term\r\n\t\t\t\t\r\n\t\t\t\tif ( count($arrFinal) > 0 )\r\n\t\t\t\t{\r\n\t\t\t\t\t$arrTerm[\"boolean\"] = $this->request->getParam(\"boolean$id\");\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\t$arrTerm[\"boolean\"] = \"\";\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tarray_push($arrFinal, $arrTerm);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\treturn $arrFinal;\r\n\t}",
"function &__parseQueryString()\n\t{\n\t\tinclude_once 'Services/Search/classes/class.ilQueryParser.php';\n\n\t\t$query_parser = new ilQueryParser(ilUtil::stripSlashes($this->getString()));\n\t\t$query_parser->setCombination($this->getCombination());\n\t\t$query_parser->parse();\n\n\t\tif(!$query_parser->validate())\n\t\t{\n\t\t\treturn $query_parser->getMessage();\n\t\t}\n\t\treturn $query_parser;\n\t}",
"function _parse_search()\n\t{\n // -------------------------------------\n\t\t//\tHardcoded query\n\t\t// -------------------------------------\n\t\t\n\t\tif ( ee()->TMPL->fetch_param('search') !== FALSE AND ee()->TMPL->fetch_param('search') != '' )\n\t\t{\n\t\t\t$str\t= ( strpos( ee()->TMPL->fetch_param('search'), 'search&' ) === FALSE ) ? 'search&' . ee()->TMPL->fetch_param('search'): ee()->TMPL->fetch_param('search');\n \n\t\t\t// -------------------------------------\n\t\t\t//\tHandle special case of start param for pagination. When users say they want pagination but they are using the 'search' param, we need to reach into the URI and try to find the 'start' param and work from there. Kind of duct tape like.\n\t\t\t// -------------------------------------\n\t\t\t\n\t\t\tif ( ee()->TMPL->fetch_param( 'paginate' ) !== FALSE AND ee()->TMPL->fetch_param( 'paginate' ) != '' )\n\t\t\t{\n\t\t\t\tif ( preg_match( '/' . $this->parser . 'offset' . $this->separator . '(\\d+)' . '/s', ee()->uri->uri_string, $match ) )\n\t\t\t\t{\n\t\t\t\t\tif ( preg_match( '/' . $this->parser . 'offset' . $this->separator . '(\\d+)' . '/s', $str, $secondmatch ) )\n\t\t\t\t\t{\n\t\t\t\t\t\t$str\t= str_replace( $secondmatch[0], $match[0], $str );\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$str\t= str_replace( 'search' . $this->parser, 'search' . $this->parser . trim( $match[0], $this->parser ) . $this->parser, $str );\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//\tHandle the special case where users have given the inclusive_keywords param\n\t\t\t// -------------------------------------\n\t\t\t\n\t\t\tif ( ee()->TMPL->fetch_param( 'inclusive_keywords' ) !== FALSE AND $this->check_no( ee()->TMPL->fetch_param('inclusive_keywords') ) )\n\t\t\t{\n\t\t\t\t$str\t= str_replace( 'search' . $this->parser, 'search' . $this->parser . 'inclusive_keywords' . $this->separator . 'no' . $this->parser, $str );\n\t\t\t}\n\t\t\t\n\t\t\t// -------------------------------------\n\t\t\t//\tHandle the special case where users have given the inclusive_categories param\n\t\t\t// -------------------------------------\n\t\t\t\n\t\t\tif ( ee()->TMPL->fetch_param( 'inclusive_categories' ) !== FALSE AND $this->check_yes( ee()->TMPL->fetch_param('inclusive_categories') ) )\n\t\t\t{\n\t\t\t\t$str\t= str_replace( 'search' . $this->parser, 'search' . $this->parser . 'inclusive_categories' . $this->separator . 'yes' . $this->parser, $str );\n\t\t\t}\n\t\t\t\n\t\t\tif ( ( $q = $this->_parse_uri( $str.'/' ) ) === FALSE )\n\t\t\t{\n\t\t\t\treturn FALSE;\n\t\t\t}\n\t\t}\n \n // -------------------------------------\n\t\t//\tOtherwise we accept search queries\n\t\t//\tfrom either\tURI or POST. See if either\n\t\t//\tis present, defaulting to POST.\n\t\t// -------------------------------------\n\t\t\n\t\telse\n\t\t{\n\t\t\tif ( ( $q = $this->_parse_post() ) === FALSE )\n\t\t\t{\n\t\t\t\tif ( ( $q = $this->_parse_uri() ) === FALSE )\n\t\t\t\t{\n\t\t\t\t\tif ( ( $q = $this->_parse_from_tmpl_params() ) === FALSE )\n\t\t\t\t\t{\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 \n // -------------------------------------\n\t\t//\tGood job get out\n\t\t// -------------------------------------\n\t\t\n\t\tif ( empty( $q ) ) return FALSE;\n\t\t\n\t\treturn $q;\n\t}",
"function parse_query($q)\n{\n\t// Parse query to extract special parts\n\t$query = array();\n\t$query['q'] = $q;\n\t\n\t$matched = false;\n\t\n\tif (!$matched)\n\t{\n\t\tif (preg_match('/(?<q>.*)\\s+AND\\s+author:\"(?<author>.*)\"\\s+AND\\s+year:\"(?<year>[0-9]{4})\"/u', $q, $m))\n\t\t{\n\t\t\t$query['q'] = $m['q'];\n\t\t\t$query['author'] = urldecode($m['author']);\n\t\t\t$query['year'] = $m['year'];\n\t\t\t$matched = true;\n\t\t}\n\t}\n\t\n\t// filter by author\n\tif (!$matched)\n\t{\n\t\tif (preg_match('/(?<q>.*)\\s+AND\\s+author:\"(?<author>.*)\"/u', $q, $m))\n\t\t{\n\t\t\t$query['q'] = $m['q'];\n\t\t\t$query['author'] = urldecode($m['author']);\n\t\t\t$matched = true;\n\t\t}\n\t}\n\t\n\t// filering on year\t\n\tif (!$matched)\n\t{\n\t\tif (preg_match('/(?<q>.*)\\s+AND\\s+year:\"(?<year>[0-9]{4})\"/u', $q, $m))\n\t\t{\n\t\t\t$query['q'] = $m['q'];\n\t\t\t$query['year'] = $m['year'];\n\t\t\t$matched = true;\n\t\t}\n\t}\n\t\n\t// query for just author\n\tif (!$matched)\n\t{\n\t\tif (preg_match('/(?<q>author:\"(?<author>.*)\")/u', $q, $m))\n\t\t{\n\t\t\t$query['q'] = $m['q'];\n\t\t\t$query['author'] = urldecode($m['author']);\n\t\t\t$matched = true;\n\t\t}\n\t}\n\t\n\t// clean the remaining string of characters that may break the search\n\t$query['q'] = preg_replace('/[:|\\(|\\)]/u', '', $query['q']);\n\t\n\t// create complete string we send to search engine\n\t$query['string'] = $query['q'];\n\t\n\tif (isset($query['author']))\n\t{\n\t\t$query['string'] .= ' AND author:\"' . $query['author'] . '\"';\n\t}\n\tif (isset($query['year']))\n\t{\n\t\t$query['string'] .= ' AND year:\"' . $query['year'] . '\"';\n\t}\t\n\t\n\t\n\treturn $query;\n\t\t\n\t\n}",
"public function addGroupFunction(string $value): \\SolrQuery {}",
"public static function groupAndSort($queryStr) {\n\t\tglobal $wtcDB;\n\t\t\n\t\t// get\n\t\t$get = new Query($queryStr);\n\t\t$groups = Array();\n\t\t\n\t\tif($wtcDB->numRows($get)) {\n\t\t\twhile($group = $wtcDB->fetchArray($get)) {\n\t\t\t\t$groups[$group['title']] = $group;\n\t\t\t}\n\t\t\n\t\t\tksort($groups);\n\t\t}\n\t\t\n\t\treturn $groups;\n\t}",
"public function setSearchGroup($searchGroup) {\n \n //\n // throw exception if syntax is out of order.\n //\n $searchQuery = $this->getPropertyValue(SalesforceSoapApi_Sosl_StatementInterface::SEARCH_QUERY);\n if (!isset($searchQuery)) {\n throw new AblePolecat_QueryLanguage_Exception(sprintf(\"SOSL syntax error. %s. SOSL syntax is %s.\",\n 'IN clause must be preceded by FIND',\n SalesforceSoapApi_Sosl_StatementInterface::SOSL_SYNTAX\n ));\n }\n \n if (is_string($searchGroup)) {\n $searchGroupErrorMessage = \"Search group must be \\\n ALL FIELDS | NAME FIELDS | EMAIL FIELDS | PHONE FIELDS | SIDEBAR FIELDS.\";\n switch($searchGroup) {\n default:\n throw new AblePolecat_QueryLanguage_Exception($searchGroupErrorMessage, AblePolecat_Error::INVALID_SYNTAX);\n break;\n case SalesforceSoapApi_Sosl_StatementInterface::SEARCH_GROUP_ALL:\n case SalesforceSoapApi_Sosl_StatementInterface::SEARCH_GROUP_NAME:\n case SalesforceSoapApi_Sosl_StatementInterface::SEARCH_GROUP_EMAIL:\n case SalesforceSoapApi_Sosl_StatementInterface::SEARCH_GROUP_PHONE:\n case SalesforceSoapApi_Sosl_StatementInterface::SEARCH_GROUP_SIDEBAR:\n parent::__set(SalesforceSoapApi_Sosl_StatementInterface::SEARCH_GROUP, $searchGroup);\n break;\n }\n }\n else {\n throw new AblePolecat_QueryLanguage_Exception($searchGroupErrorMessage, AblePolecat_Error::INVALID_SYNTAX);\n }\n }",
"public function createSearch($query);",
"public function posts_groupby($groupby) {\n if($this->_search_distance && $this->_search_latitude && $this->_search_longitude){\n $groupby .= ' HAVING distance <= '.$this->_search_distance;\n }\n\n return $groupby;\n }",
"public function searchGroup(){\n\t\t\n\t\t\t$searchName = $_POST['group_name'];\t\n\t\t\t$groupList = array();\n\t\t\t$isMember = '0';\n\t\t\t$regexObj = new \\MongoRegex(\"/^$searchName/i\");\t\t\t\t\n\t\t\t$groups = Groups::getGroups('all',array('conditions' => array('group_name' => $regexObj,'visibility' => 'public')));\n\t\t\tforeach($groups as $group)\n\t\t\t{\t\t\tforeach($group['users'] as $user){\n\t\t\t\t\t\t\tif($user['id'] == $_SESSION['loggedInUserId']){\n\t\t\t\t\t\t\t\t$isMember = '1';\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\t\n\t\t\t\t\t\tarray_push($groupList, array('group_name' => $group['group_name'], 'id' => $group['_id'],'users' => $group['users'],'isMember' => $isMember));\n\t\t\t\t\t\t$isMember = '0';\n\t\t\t}\n\t\t\treturn json_encode($groupList);\t\t\n\t\t}",
"public function preprocessSearchQuery(SearchApiQuery $query);",
"public static function search_to_get( $search_string )\n\t{\n\t\t$keywords = array( 'author' => 1, 'status' => 1, 'type' => 1 );\n\t\t// Comments::list_comment_statuses and list_comment_types return associative arrays with key/values\n\t\t// in the opposite order of the equivalent functions in Posts. Maybe we should change this?\n\t\t// In any case, we need to flip them for our purposes\n\t\t$statuses = array_flip( Comment::list_comment_statuses() );\n\t\t$types = array_flip( Comment::list_comment_types() );\n\t\t$arguments = array(\n\t\t\t\t\t\t'name' => array(),\n\t\t\t\t\t\t'status' => array(),\n\t\t\t\t\t\t'type' => array()\n\t\t\t\t\t\t);\n\t\t$criteria = '';\n\n\t\t$tokens = explode( ' ', $search_string );\n\n\t\tforeach ( $tokens as $token ) {\n\t\t\t// check for a keyword:value pair\n\t\t\tif ( preg_match( '/^\\w+:\\S+$/u', $token ) ) {\n\t\t\t\tlist( $keyword, $value ) = explode( ':', $token );\n\n\t\t\t\t$keyword = strtolower( $keyword );\n\t\t\t\t$value = MultiByte::strtolower( $value );\n\t\t\t\tswitch ( $keyword ) {\n\t\t\t\t\tcase 'author':\n\t\t\t\t\t\t$arguments['name'][] = $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'status':\n\t\t\t\t\t\tif ( isset( $statuses[$value] ) ) {\n\t\t\t\t\t\t\t$arguments['status'][] = (int) $statuses[$value];\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'type':\n\t\t\t\t\t\tif ( isset( $types[$value] ) ) {\n\t\t\t\t\t\t\t$arguments['type'][] = (int) $types[$value];\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$criteria .= $token . ' ';\n\t\t\t}\n\t\t}\n\t\t// flatten keys that have single-element or no-element arrays\n\t\tforeach ( $arguments as $key => $arg ) {\n\t\t\tswitch ( count( $arg ) ) {\n\t\t\t\tcase 0:\n\t\t\t\t\tunset( $arguments[$key] );\n\t\t\t\t\tbreak;\n\t\t\t\tcase 1:\n\t\t\t\t\t$arguments[$key] = $arg[0];\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif ( $criteria != '' ) {\n\t\t\t$arguments['criteria'] = $criteria;\n\t\t}\n\n\t\treturn $arguments;\n\n\t}",
"public function new_search_query();",
"public function setGroupFormat(string $value): \\SolrQuery {}",
"function slt_cf_manage_query_string( $query ) {\n\tglobal $wp, $slt_custom_fields;\n\n\t// Front-end and flag set?\n\tif ( ! is_admin() && $query->get( 'dcf_use_query_string' ) ) {\n\n\t\t// Get custom taxonomies in case we need to deal with them\n\t\t$custom_taxonomies = get_taxonomies( array( '_builtin' => false ) );\n\n\t\t// Init matching type for multiple values\n\t\t$matching = $query->get( 'dcf_query_string_matching' );\n\t\t$matching = ( $matching == 'exclusive' ) ? 'exclusive' : 'inclusive';\n\n\t\t// Go through the query vars already parsed by the main request, and add in\n\t\tforeach ( $wp->query_vars as $key => $value ) {\n\n\t\t\t// Ignore vars without a value\n\t\t\tif ( ! empty( $value ) ) {\n\n\t\t\t\t// Check if it's a custom field query var\n\t\t\t\tif ( in_array( $key, $slt_custom_fields['query_vars'] ) ) {\n\n\t\t\t\t\t// Get current meta query\n\t\t\t\t\t$current_meta_query = is_array( $query->get( 'meta_query' ) ) ? $query->get( 'meta_query' ) : array();\n\t\t\t\t\t$new_clauses = array();\n\n\t\t\t\t\t// Set up if this is the Simple Events date field\n\t\t\t\t\tif ( defined( 'SLT_SE_EVENT_DATE_FIELD' ) && $key == SLT_SE_EVENT_DATE_FIELD && defined( 'SLT_SE_EVENT_DATE_QUERY_VAR_FORMAT' ) && SLT_SE_EVENT_DATE_QUERY_VAR_FORMAT ) {\n\n\t\t\t\t\t\t// Decide on the from / to boundaries of the range being filtered for\n\t\t\t\t\t\tswitch ( SLT_SE_EVENT_DATE_QUERY_VAR_FORMAT ) {\n\t\t\t\t\t\t\tcase 'Y': {\n\t\t\t\t\t\t\t\t$from_date = $value . '/01/01';\n\t\t\t\t\t\t\t\t$to_date = $value . '/12/31';\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase 'mY': {\n\t\t\t\t\t\t\t\t$month = ( strlen( $value ) > 1 ) ? substr( $value, 0, 2 ) : '01';\n\t\t\t\t\t\t\t\t$year = ( strlen( $value ) > 5 ) ? substr( $value, 2, 4 ) : date( 'Y' );\n\t\t\t\t\t\t\t\t$from_date = $year . '/' . $month . '/01';\n\t\t\t\t\t\t\t\t$to_date = $year . '/' . $month . '/' . str_pad( cal_days_in_month( CAL_GREGORIAN, $month, $year ), 2, '0', STR_PAD_LEFT );\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\n\t\t\t\t\t\t// If Simple Events version doesn't have end date, or we don't have WP 4.1+, simple test\n\t\t\t\t\t\tif ( ! defined( 'SLT_SE_EVENT_END_DATE_FIELD' ) || version_compare( get_bloginfo( 'version' ), '4.1', '<' ) ) {\n\n\t\t\t\t\t\t\t$new_clauses[] = array(\n\t\t\t\t\t\t\t\t'key'\t\t=> slt_cf_field_key( $key ),\n\t\t\t\t\t\t\t\t'value'\t\t=> array(\n\t\t\t\t\t\t\t\t\t$from_date . ' 00:00',\n\t\t\t\t\t\t\t\t\t$to_date . ' 23:59'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t'compare'\t=> 'BETWEEN',\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t// With end date involved, more complex tests\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t// Start date is in range\n\t\t\t\t\t\t\t// OR end date is in range\n\t\t\t\t\t\t\t// OR start date is before range AND end date is after range\n\t\t\t\t\t\t\t$new_clauses[] = array(\n\t\t\t\t\t\t\t\t'relation'\t\t=> 'OR',\n\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\t'key'\t\t=> slt_cf_field_key( SLT_SE_EVENT_DATE_FIELD ),\n\t\t\t\t\t\t\t\t\t'value'\t\t=> array(\n\t\t\t\t\t\t\t\t\t\t$from_date . ' 00:00',\n\t\t\t\t\t\t\t\t\t\t$to_date . ' 23:59'\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t'compare'\t=> 'BETWEEN',\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\t'key'\t\t=> slt_cf_field_key( SLT_SE_EVENT_END_DATE_FIELD ),\n\t\t\t\t\t\t\t\t\t'value'\t\t=> array(\n\t\t\t\t\t\t\t\t\t\t$from_date . ' 00:00',\n\t\t\t\t\t\t\t\t\t\t$to_date . ' 23:59'\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t'compare'\t=> 'BETWEEN',\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\t'relation'\t\t=> 'AND',\n\t\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\t\t'key'\t\t=> slt_cf_field_key( SLT_SE_EVENT_DATE_FIELD ),\n\t\t\t\t\t\t\t\t\t\t'value'\t\t=> $from_date . ' 00:00',\n\t\t\t\t\t\t\t\t\t\t'compare'\t=> '<',\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\t\t'key'\t\t=> slt_cf_field_key( SLT_SE_EVENT_END_DATE_FIELD ),\n\t\t\t\t\t\t\t\t\t\t'value'\t\t=> $to_date . ' 23:59',\n\t\t\t\t\t\t\t\t\t\t'compare'\t=> '>',\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t}\n\n\n\t\t\t\t\t} else if ( is_array( $value ) ) {\n\n\t\t\t\t\t\t// Add each item in array separately if exclusive matching\n\t\t\t\t\t\tif ( $matching == 'exclusive' ) {\n\n\t\t\t\t\t\t\tforeach ( $value as $value_item ) {\n\t\t\t\t\t\t\t\t$new_clauses[] = array(\n\t\t\t\t\t\t\t\t\t'key'\t\t=> slt_cf_field_key( $key ),\n\t\t\t\t\t\t\t\t\t'value'\t\t=> $value_item,\n\t\t\t\t\t\t\t\t\t'compare'\t=> '=',\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Or add item in with 'IN' comparison for inclusive matching\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t$new_clauses[] = array(\n\t\t\t\t\t\t\t\t'key'\t\t=> slt_cf_field_key( $key ),\n\t\t\t\t\t\t\t\t'value'\t\t=> $value,\n\t\t\t\t\t\t\t\t'compare'\t=> 'IN',\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// Simple pass-through\n\t\t\t\t\t\t$new_clauses[] = array(\n\t\t\t\t\t\t\t'key'\t\t=> slt_cf_field_key( $key ),\n\t\t\t\t\t\t\t'value'\t\t=> $value,\n\t\t\t\t\t\t\t'compare'\t=> '=',\n\t\t\t\t\t\t);\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// Add clauses to meta_query\n\t\t\t\t\t$query->set( 'meta_query', array_merge( $current_meta_query, $new_clauses ) );\n\n\t\t\t\t// Handle taxonomies?\n\t\t\t\t} else if ( ! $query->get( 'dcf_custom_field_query_vars_only' ) ) {\n\n\t\t\t\t\t// Also deal with non-custom field query vars\n\t\t\t\t\tif ( in_array( $key, $custom_taxonomies ) ) {\n\n\t\t\t\t\t\t// Add to tax_query\n\t\t\t\t\t\t$query->set( 'tax_query', array_merge( $query->get( 'tax_query' ), array( array(\n\t\t\t\t\t\t\t'taxonomy'\t=> $key,\n\t\t\t\t\t\t\t'terms'\t\t=> $value,\n\t\t\t\t\t\t\t'operator'\t=> ( $matching == 'exclusive' ) ? 'AND' : 'IN'\n\t\t\t\t\t\t))));\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}",
"private static function __buildFilterString($str)\n {\n // Define some RegEx patterns\n $andPattern = '/\\)\\s(and)\\s\\(/i';\n $orPattern = '/\\)\\s(or)\\s\\(/i';\n $andOrPattern = '/(?<=\\)\\s)(and|or)(?=\\s\\()/i';\n\n // Clean the input string\n $result = $str = trim(preg_replace(\n array(\n// '/\\s*([\\(|\\)])\\s*/',\n// '/\\!\\((\\w+)\\s?=\\s?(\\w+)\\)/',\n// '/(\\S)(and|or|not)/i',\n// '/(and|or|not)(\\S)/i',\n ),\n array(\n// '$1',\n// '!$1=$2',\n// '$1 $2',\n// '$1 $2',\n ),\n $str));\n\n // Break down sub-groupings\n for($i=0,$n=0,$captureGroup=''; $i<strlen($str); $i++){\n if($n) $captureGroup.=$str[$i];\n if($str[$i] == '(') $n++;\n if($str[$i] == ')'){\n $n--;\n if(!$n){\n $captureGroup = substr($captureGroup,0,-1);\n $result=str_replace($captureGroup, self::__buildFilterString($captureGroup), $result);\n $captureGroup='';\n }\n }\n }\n\n // Okay, complete the processing of this grouping\n\n // Convert key=value to (key=value)\n// $result = preg_replace('/(\\s|^)(!?)(\\w+)=(\\w+)(\\s|$)/i', '$1($2$3=$4)$5', $result);\n $result = preg_replace('/(\\s|^)(!?)([\\w\\-\\.\\:]+)=([\\w\\-\\.\\:]+)(\\s|$)/i', '$1($2$3=$4)$5', $result);\n// $result = preg_replace('/(\\s|^)(!?)([\\(\\S]+)=([\\)\\S]+)(\\s|$)/i', '$1($2$3=$4)$5', $result);\n\n // Check for malformed and / or usage\n if(preg_match($andPattern, $result) and preg_match($orPattern, $result)){\n // Error - You can't have AND and OR in the same grouping (one must be a sub-group)\n die(\"Error - You can't have AND and OR in the same grouping (one must be a sub-group)!\");\n }\n\n $searchParts = array_map('trim', preg_split($andOrPattern, $result));\n\n preg_match($andOrPattern, $result, $m);\n $bool = (isset($m[1]) and $m[1]=='and') ? '&' : '|';\n\n return sprintf('%s%s', $bool, implode('',$searchParts));\n }",
"function pre_groups_shortcode_query_list( $args ) {\n\n\t$search = get_query_var( 'groups_search' );\n\t$cat = get_query_var( 'cat' );\n\t$tags = get_query_var( 'tags' );\n\t$filter = get_query_var( 'filter' );\n\n\tif( 1 == $args[ 'show_search_form' ] ) {\n\n\t\tif( !empty( $search ) ) {\n\t\t\t$args[ 's' ] = $search;\n\t\t}\n\n\t\tif( !empty( $cat ) ) {\n\t\t\t$args[ 'cat' ] = $cat;\n\t\t}\n\n\t\tif( !empty( $tags ) ) {\n\t\t\t$args[ 'tags' ] = $tags;\n\t\t}\n\t}\n\n\tif( 'own' == $filter ) {\n\t\t$array_groups = array(\n\t\t\t\t0 );\n\t\t$groups = UM()->Groups()->member()->get_groups_joined();\n\t\tforeach( $groups as $data ) {\n\t\t\t$array_groups[] = $data->group_id;\n\t\t}\n\t\t$args[ '_um_groups_filter' ] = $filter;\n\t\t$args[ 'post__in' ] = $array_groups;\n\t}\n\n\tUM()->Groups()->api()->results = UM()->Groups()->api()->get_groups( $args );\n}",
"function parse_query ($query) {\n\t\tif ( !empty($query) || !isset($this->query) ) {\n\t\t\t$this->init();\n\t\t\tparse_str($query, $qv);\n\t\t\t$this->query = $query;\n\t\t\t$this->query_vars = $qv;\n\t\t}\n\n\t\tif ('404' == $qv['error']) {\n\t\t\t$this->is_404 = true;\n\t\t\tif ( !empty($query) ) {\n\t\t\t\tdo_action('parse_query', array(&$this));\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t$qv['m'] = (int) $qv['m'];\n\t\t$qv['p'] = (int) $qv['p'];\n\n\t\t// Compat. Map subpost to attachment.\n\t\tif ( '' != $qv['subpost'] )\n\t\t\t$qv['attachment'] = $qv['subpost'];\n\t\tif ( '' != $qv['subpost_id'] )\n\t\t\t$qv['attachment_id'] = $qv['subpost_id'];\n\n\t\tif ( ('' != $qv['attachment']) || (int) $qv['attachment_id'] ) {\n\t\t\t$this->is_single = true;\n\t\t\t$this->is_attachment = true;\n\t\t} elseif ('' != $qv['name']) {\n\t\t\t$this->is_single = true;\n\t\t} elseif ( $qv['p'] ) {\n\t\t\t$this->is_single = true;\n\t\t} elseif (('' != $qv['hour']) && ('' != $qv['minute']) &&('' != $qv['second']) && ('' != $qv['year']) && ('' != $qv['monthnum']) && ('' != $qv['day'])) {\n\t\t\t// If year, month, day, hour, minute, and second are set, a single\n\t\t\t// post is being queried.\n\t\t\t$this->is_single = true;\n\t\t} elseif ('' != $qv['static'] || '' != $qv['pagename'] || '' != $qv['page_id']) {\n\t\t\t$this->is_page = true;\n\t\t\t$this->is_single = false;\n\t\t} elseif (!empty($qv['s'])) {\n\t\t\t$this->is_search = true;\n\t\t} else {\n\t\t// Look for archive queries. Dates, categories, authors.\n\n\t\t\tif ( (int) $qv['second']) {\n\t\t\t\t$this->is_time = true;\n\t\t\t\t$this->is_date = true;\n\t\t\t}\n\n\t\t\tif ( (int) $qv['minute']) {\n\t\t\t\t$this->is_time = true;\n\t\t\t\t$this->is_date = true;\n\t\t\t}\n\n\t\t\tif ( (int) $qv['hour']) {\n\t\t\t\t$this->is_time = true;\n\t\t\t\t$this->is_date = true;\n\t\t\t}\n\n\t\t\tif ( (int) $qv['day']) {\n\t\t\t\tif (! $this->is_date) {\n\t\t\t\t\t$this->is_day = true;\n\t\t\t\t\t$this->is_date = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( (int) $qv['monthnum']) {\n\t\t\t\tif (! $this->is_date) {\n\t\t\t\t\t$this->is_month = true;\n\t\t\t\t\t$this->is_date = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( (int) $qv['year']) {\n\t\t\t\tif (! $this->is_date) {\n\t\t\t\t\t$this->is_year = true;\n\t\t\t\t\t$this->is_date = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( (int) $qv['m']) {\n\t\t\t\t$this->is_date = true;\n\t\t\t\tif (strlen($qv['m']) > 9) {\n\t\t\t\t\t$this->is_time = true;\n\t\t\t\t} else if (strlen($qv['m']) > 7) {\n\t\t\t\t\t$this->is_day = true;\n\t\t\t\t} else if (strlen($qv['m']) > 5) {\n\t\t\t\t\t$this->is_month = true;\n\t\t\t\t} else {\n\t\t\t\t\t$this->is_year = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ('' != $qv['w']) {\n\t\t\t\t$this->is_date = true;\n\t\t\t}\n\n\t\t\tif (empty($qv['cat']) || ($qv['cat'] == '0')) {\n\t\t\t\t$this->is_category = false;\n\t\t\t} else {\n\t\t\t\tif (stristr($qv['cat'],'-')) {\n\t\t\t\t\t$this->is_category = false;\n\t\t\t\t} else {\n\t\t\t\t\t$this->is_category = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ('' != $qv['category_name']) {\n\t\t\t\t$this->is_category = true;\n\t\t\t}\n\n\t\t\tif ((empty($qv['author'])) || ($qv['author'] == '0')) {\n\t\t\t\t$this->is_author = false;\n\t\t\t} else {\n\t\t\t\t$this->is_author = true;\n\t\t\t}\n\n\t\t\tif ('' != $qv['author_name']) {\n\t\t\t\t$this->is_author = true;\n\t\t\t}\n\n\t\t\tif ( ($this->is_date || $this->is_author || $this->is_category)) {\n\t\t\t\t$this->is_archive = true;\n\t\t\t}\n\t\t}\n\n\t\tif ('' != $qv['feed']) {\n\t\t\t$this->is_feed = true;\n\t\t}\n\n\t\tif ('' != $qv['tb']) {\n\t\t\t$this->is_trackback = true;\n\t\t}\n\n\t\tif ('' != $qv['paged']) {\n\t\t\t$this->is_paged = true;\n\t\t}\n\n\t\tif ('' != $qv['comments_popup']) {\n\t\t\t$this->is_comments_popup = true;\n\t\t}\n\n\t\t//if we're previewing inside the write screen\n\t\tif ('' != $qv['preview']) {\n\t\t\t$this->is_preview = true;\n\t\t}\n\n\t\tif (strstr($_SERVER['PHP_SELF'], 'wp-admin/')) {\n\t\t\t$this->is_admin = true;\n\t\t}\n\n\t\tif ( ! ($this->is_attachment || $this->is_archive || $this->is_single || $this->is_page || $this->is_search || $this->is_feed || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_comments_popup)) {\n\t\t\t$this->is_home = true;\n\t\t}\n\n\t\tif ( !empty($query) ) {\n\t\t\tdo_action('parse_query', array(&$this));\n\t\t}\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Format a message to show error when a function expect a valid EdmPrimitiveType enum value, but it is not | public static function commonNotValidPrimitiveEDMType($argumentName, $functionName)
{
return "The argument '$argumentName' to $functionName is not a valid EdmPrimitiveType Enum value";
} | [
"public function message()\n {\n return trans('ticketing::validation.status_enum');\n }",
"public function testUnitsOfMeasureMustBeValidEnumValue() {\n\t\t\n\t\t$errorMessage = '';\n\t\ttry {\n\t\t\t$ingredient = new Ingredient('test', 10, 'jiffy');\n\t\t} catch (Exception $e) {\n\t\t\t$errorMessage = $e->getMessage();\n\t\t}\n\t\treturn assert('$errorMessage == \\'Units of measure jiffy is not supported.\\'');\n\t}",
"private function createGenericErrorMessage(): string\n {\n return (string)__('Something went wrong while processing your order. Please try again later.');\n }",
"protected static function getEnumError()\n {\n if (GnUtility::isVersion12Plus()) {\n return \\TYPO3\\CMS\\Core\\Type\\ContextualFeedbackSeverity::ERROR;\n }\n return \\TYPO3\\CMS\\Core\\Messaging\\FlashMessage::ERROR;\n }",
"public static function metadataWriterExpectingEntityOrComplexResourceType()\n {\n return 'Unexpected resource type found, expecting either ResourceTypeKind::ENTITY or ResourceTypeKind::COMPLEX';\n }",
"public function testAllDifferentApiErrorDescriptions()\n {\n $reflection = new ReflectionClass(static::ERROR_NAMESPACE . \"ApiError\");\n $messages = [];\n //add default error description\n $messages[str_replace((string)(-1), \"\", ApiError::toString(-1))] = true;\n //code must be in default error description\n static::assertContains(\"-1\", ApiError::toString(-1));\n foreach ($reflection->getConstants() as $constant) {\n $message = ApiError::toString($constant);\n $message = str_replace((string)$constant, \"\", $message);\n static::assertFalse(key_exists($message, $messages), \"not specified for \" . $constant);\n $tableNames[$message] = true;\n }\n }",
"function error_message ($a, $b) {\n\tif (!(is_numeric($a) && is_numeric($b))) {\n\t\treturn false;\n\t\t} else { \n\t\t\techo \"Error: both {$a} and {$b} should be numbers\";\n\t\t\treturn true;\n\t}\n\techo PHP_EOL;\n}",
"public static function FAIL_MSG()\r\n {\r\n return new EventType(4);\r\n }",
"public function testAllDifferentFrontendErrorDescriptions()\n {\n $reflection = new ReflectionClass(static::ERROR_NAMESPACE . \"FrontendError\");\n $messages = [];\n //add default error description\n $messages[str_replace((string)(-1), \"\", FrontendError::toString(-1))] = true;\n //code must be in default error description\n static::assertContains(\"-1\", FrontendError::toString(-1));\n foreach ($reflection->getConstants() as $constant) {\n $message = FrontendError::toString($constant);\n $message = str_replace((string)$constant, \"\", $message);\n static::assertFalse(key_exists($message, $messages), \"not specified for \" . $constant);\n $tableNames[$message] = true;\n }\n }",
"function numfmt_get_error_code($fmt){}",
"function core_errtype($errtype){\n return Core::errtype($errtype);\n }",
"public function getMessageFormat(): string;",
"function FormatErrorMsg($ContextMsg)\n {\n switch ($this->ErrMsgFmt)\n {\n case \"HTML\":\n $function_ret=\"<p class=dberror id=dbError>Error! \" . $this->db->ErrorMsg() .\"</p>\".\n \"<p class=dberror id=dbErrorDetail><u>Operation that caused the error:</u><br>\".$ContextMsg.\"</p>\";\n break;\n case \"MULTILINE\":\n $function_ret=\"Error! \" . $this->db->ErrorMsg() .\"\\n\\nOperation that caused the error:\\n\".$ContextMsg;\n break;\n case \"1LINE\":\n $function_ret=\"Error! \" . $this->db->ErrorMsg() .\" (\".$ContextMsg.\")\";\n break;\n }\n return $function_ret;\n }",
"function Message( $Type = \"Error\", $Msg = '' )\n{\n\techo '{\"type\":\"' . $Type . '\", \"message\":\"' . $Msg . '\"}';\n\texit; \n}",
"public function testCreateInvalidPriceFormat()\n {\n $this->_markTestAsRestOnly(\"In case of SOAP type casting is handled by PHP SoapServer, no need to test it\");\n $expectedMessage = 'Error occurred during \"price\" processing. '\n . 'The \"invalid_format\" value\\'s type is invalid. The \"float\" type was expected. Verify and try again.';\n\n try {\n $this->saveProduct(['name' => 'simple', 'price' => 'invalid_format', 'sku' => 'simple']);\n $this->fail(\"Expected exception was not raised\");\n } catch (\\Exception $e) {\n $errorObj = $this->processRestExceptionResult($e);\n $this->assertEquals($expectedMessage, $errorObj['message']);\n $this->assertEquals(HTTPExceptionCodes::HTTP_BAD_REQUEST, $e->getCode());\n }\n }",
"function outputApiErrorMsg($error_msg)\r\n{\t\r\n\tglobal $returnFormat; // Need to set this as global for RestUtility\r\n\t// Render message in format set in API request\r\n\t$format = \"xml\";\r\n\t$returnFormat = \"xml\";\r\n\t// First, get the format specified\r\n\t$format = $_POST['format'];\r\n\tswitch ($format)\r\n\t{\r\n\t\tcase 'json':\r\n\t\t\tbreak;\r\n\t\tcase 'csv':\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\t$format = \"xml\";\r\n\t}\r\n\t// Second, if returnFormat is specified, it'll override format\r\n\t$tempFormat = ($_POST['returnFormat'] != \"\") ? strtolower($_POST['returnFormat']) : strtolower($format);\r\n\tswitch ($tempFormat)\r\n\t{\r\n\t\tcase 'json':\r\n\t\t\t$returnFormat = \"json\";\r\n\t\t\tbreak;\r\n\t\tcase 'csv':\r\n\t\t\t$returnFormat = \"csv\";\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\t$returnFormat = \"xml\";\r\n\t}\r\n\t// Output offline message in specified format\r\n\texit(RestUtility::sendResponse(400, trim(strip_tags($error_msg))));\r\n}",
"protected function _getErrorNumber()\n {\n return '';\n }",
"public function notValidMessage()\n\t{\n\t\treturn self::MESSAGE;\n\t}",
"#[Pure]\nfunction intl_error_name(int $errorCode): string {}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Builds a unique file name based on various data about the given collection of assets. | protected function buildCombinedFileName(array $assets, $prefix) {
$name = $prefix ? $prefix .'_' : '';
$filesInfo = array();
foreach($assets as $asset) {
$filesInfo[] = $asset->getPath() .'@'. filemtime($asset->getPath());
}
$name .= md5(implode('::::', $filesInfo)) .'.'. $this->fileExtension;
return $name;
} | [
"protected function calculateAggregateFilename($js_assets) {\n $data = '';\n foreach ($js_assets as $js_asset) {\n $data .= file_get_contents($js_asset['data']) . \";\\n\";\n }\n return file_create_url('public://js/js_' . Crypt::hashBase64($data) . '.js');\n }",
"private function generateUniqueFileName()\n {\n // which is based on timestamps\n return md5(uniqid());\n }",
"protected function generateFileName()\n\t{\n\t\t# Set the cache extension name to a local variable.\n\t\t$ext=$this->getExt();\n\t\t# Set the unique portion of the cache name to a local variable.\n\t\t$unique_name=$this->getUniqueName();\n\t\t# Add the cache life time to the current time to get the actual expry date.\n\t\t$date=$this->getTimeNow()+$this->getCacheTime();\n\t\t# Concatonate the elements together and set the chache name to the data member.\n\t\t$this->setCacheName($date.'.'.$unique_name.'.'.$ext);\n\t}",
"protected function generateFilename()\n {\n $format = $this->determineFormat();\n $name = '';\n for ($i = 0; $i < 7; $i++)\n $name .= chr(rand(97, 122));\n return \"image-data-$name-\" . time() . \".$format\";\n }",
"private function generateUniqueFileName() {\r\n \r\n return md5(uniqid());\r\n }",
"protected final function calculate_file_name()\n {\n // Parameter imploding\n $file_name = implode('-', $this->uri->parameters()) . STATIC_EXT;\n \n // If no parameters, file will be named default\n if(preg_match(\"/^\\..*$/\", $file_name))\n $file_name = 'default' . STATIC_EXT;\n\n return $file_name;\n }",
"protected function generateImageName(){\n return $this->employee_id.'_'.$this->doc_type_id.'_'.$this->id.'_'.mt_rand();\n }",
"public function getMakeFilenameUnique();",
"protected function makeFileName()\n {\n\n $name = time() . '_' . $this->file->getClientOriginalname();\n\n return \"{$name}\";\n\n }",
"protected function getUniqueFileName()\n\t{\n\t\t$counter = 0;\n\t\t\n\t\tdo {\n\t\t\t$filename = Inflector::slug($this->activeRecord->file->baseName) . $counter++ \n\t\t\t\t. '.' . $this->activeRecord->file->extension;\n\t\t} while ($this->fileExists($filename));\n\t\t\n\t\treturn $filename;\n\t}",
"public function getCacheFileName() {\n\n\t\tif ( $this->getArg( 'output_file' ) )\n\t\t\treturn basename( $this->getArg( 'output_file' ) );\n\n\t\t$path = $this->getFilePath();\n\n\t\tif ( ! $path )\n\t\t\treturn '';\n\n\t\t// Generate a short unique filename\n\t\t$serialize = crc32( serialize( array_merge( $this->getArgs(), array( $this->getFilePath() ) ) ) );\n\n\t\t// Gifs are converted to pngs\n\t\tif ( $this->getFileExtension() == 'gif' )\n\t\t\treturn $serialize . '.png';\n\n\t\treturn $serialize . '.' . $this->getFileExtension();\n\n\t}",
"private function generateFileName()\n {\n return md5(time().rand(1000, 9999));\n }",
"private function generateImageName() {\n $filename = mt_rand( 10000001, 99999999 ); // better than rand()\n // call the same function if the $filename exists already\n if ( VoucherImage::where( 'name', $filename )->exists() ) {\n return $this->generateImageName();\n }\n if ( strlen( $filename ) != 8 ) {\n return $this->generateImageName();\n }\n return $filename;\n }",
"function getUniqueFilename($filename)\n {\n global $application;\n $dir = $application->getAppIni(\"PRODUCT_FILES_DIR\");\n for ($i=0; $i < 10; $i++)\n {\n $base64 = base64_encode($filename.microtime());\n $base64 = str_replace(\"=\", '', $base64);\n\n if (!file_exists($dir.$base64))\n break;\n// else\n //\n }\n return $base64.'.csv';\n }",
"function _BuildFileName( $file_name ) {\n\t\t$this->_CacheFilePath = $this->_CacheDirPath . ($this->HashFileNames ? md5($file_name) : $file_name);\n\t}",
"private function constructPystylOutputFileNames() {\n $imploded_collection_name_data = implode('', $this->collection_name_data);\n $year_month_day = date('Ymd');\n $hours_minutes_seconds = date('his');\n\n $file_name1 = $imploded_collection_name_data . $year_month_day . $hours_minutes_seconds . '.svg';\n $file_name2 = $imploded_collection_name_data . $year_month_day . $hours_minutes_seconds . 2 . '.svg';\n\n return array($file_name1, $file_name2);\n }",
"private function _filename() {\r\n\t\treturn $this->path . $this->id . '_' . $this->dimentions . '.jpg';\r\n\t}",
"protected function generateFileName()\r\n {\r\n $name = md5(uniqid()) . '.pdf';\r\n\r\n return $name;\r\n }",
"public function generate_filename(){\n\t\t\t$md5 = md5(microtime() * time());\n\n\t\t\t$filename = $md5 . \".jpg\";\n\n\t\t\treturn $filename;\n\t\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Replaces the prefix with the passed view | public function setPrefix($view) {
$this->prefix = $view;
return $this;
} | [
"public function setViewPrefix($prefix)\n {\n $this->_prefix = $prefix;\n }",
"function _advil_perform_view_preprocess($preprocess_prefix, &$vars) {\n $view = $vars['view'];\n \n $function = implode('__', array($preprocess_prefix, $view->name, $view->current_display));\n \n if (function_exists($function)) {\n $function($vars);\n }\n}",
"public function applyTheme(string $view): string\n\t{\n\t\tif ($this->view_prefix) {\n\t\t\t$view = \"{$this->view_prefix}.{$view}\";\n\t\t}\n\t\t\n\t\tif ($this->view_namespace) {\n\t\t\t$view = \"{$this->view_namespace}::{$view}\";\n\t\t}\n\t\t\n\t\treturn $view;\n\t}",
"function getViewPrefix() {\r\r\n\t\treturn $this->viewprefix;\r\r\n\t}",
"protected function getViewPrefix()\n {\n if (!is_null($this->viewPrefix)) {\n return $this->viewPrefix;\n }\n\n return str_plural(snake_case($this->getControllerName()));\n }",
"protected function getViewPrefix()\n {\n if ($this->viewPrefix !== null) {\n return $this->viewPrefix;\n }\n\n return str_plural(snake_case($this->getControllerName()));\n }",
"public function setTemplatePrefix( $prefix );",
"protected function resolveViewPath($view){\n return $view . parent::getAppendValue();\n\t}",
"public function getDomainViewPrefix();",
"public function buildViewName($view = \"\"){\n\t\tif($view != \"\"){\n\t\t\t$view = $view.\"View\";\n\t\t}\n\t\treturn $view;\n\t}",
"protected function replaceRoutePrefix(&$stub, $prefix)\n {\n $stub = str_replace('{{prefix}}', $prefix, $stub);\n\n return $this;\n }",
"private function replacePrefix($sql, $prefix = '#__'){\n\t\treturn str_replace('#__', $this->_table_prefix, $sql);\n\t}",
"public function setSwiftPrefix($var) {}",
"public static function viewPrefix(string $prefix)\n {\n static::loginView($prefix.'login');\n static::twoFactorChallengeView($prefix.'two-factor-challenge');\n static::registerView($prefix.'register');\n static::requestPasswordResetLinkView($prefix.'forgot-password');\n static::resetPasswordView($prefix.'reset-password');\n static::verifyEmailView($prefix.'verify-email');\n static::confirmPasswordView($prefix.'confirm-password');\n }",
"public function prefixName($prefix);",
"private function get_prefix($replacement_variable)\n {\n }",
"public static function replacePrefix($table)\n { \n if(substr($table,0,3) == '#__')\n {\n $tablePrefix = JFactory::getDBO()->getPrefix();\n $table = $tablePrefix.substr($table,3);\n }\n return $table;\n }",
"public function prefix( $prefix )\n {\n $this->pattern = $prefix . $this->pattern;\n }",
"function module_route_prefix ($append = '')\n {\n return module_config ('route.prefix') . $append;\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
reset is the collPedidoProveedors collection loaded partially | public function resetPartialPedidoProveedors($v = true)
{
$this->collPedidoProveedorsPartial = $v;
} | [
"public function clearEmpleadosRelatedByIdProv()\n\t{\n\t\t$this->collEmpleadosRelatedByIdProv = null; // important to set this to NULL since that means it is uninitialized\n\t}",
"public function clearMensajesRelatedByIdrespuesta()\n {\n $this->collMensajesRelatedByIdrespuesta = null; // important to set this to NULL since that means it is uninitialized\n }",
"public function clearViajes()\n {\n $this->collViajes = null; // important to set this to NULL since that means it is uninitialized\n }",
"public function clearViajeMensajess()\n {\n $this->collViajeMensajess = null; // important to set this to NULL since that means it is uninitialized\n }",
"public function clearPesquisas()\n\t{\n\t\t$this->collPesquisas = null; // important to set this to NULL since that means it is uninitialized\n\t}",
"public function clearEstados()\n\t{\n\t\t$this->collEstados = null; // important to set this to NULL since that means it is uninitialized\n\t}",
"public function clearMROSocietes()\n {\n $this->collMROSocietes = null; // important to set this to NULL since that means it is uninitialized\n }",
"public function resetPartialTblproductoprecios($v = true)\n {\n $this->collTblproductopreciosPartial = $v;\n }",
"public function clearResultados()\n\t{\n\t\t$this->collResultados = null; // important to set this to NULL since that means it is uninitialized\n\t}",
"public function clearComentarios()\n {\n $this->collComentarios = null; // important to set this to NULL since that means it is uninitialized\n }",
"public function clearProspectAtendimentos()\n\t{\n\t\t$this->collProspectAtendimentos = null; // important to set this to NULL since that means it is uninitialized\n\t}",
"public function clearprUsers()\n\t{\n\t\t$this->collprUsers = null; // important to set this to NULL since that means it is uninitialized\n\t}",
"public function clearMensajeRespuestasRelatedByIdrespuesta()\n {\n $this->collMensajeRespuestasRelatedByIdrespuesta = null; // important to set this to NULL since that means it is uninitialized\n }",
"public function clearProductotallajes()\n {\n $this->collProductotallajes = null; // important to set this to null since that means it is uninitialized\n $this->collProductotallajesPartial = null;\n\n return $this;\n }",
"public function clearContratos()\n\t{\n\t\t$this->collContratos = null; // important to set this to NULL since that means it is uninitialized\n\t}",
"public function clearProducts()\n {\n $this->collProducts = null; // important to set this to NULL since that means it is uninitialized\n }",
"public function resetOrderArticles(){\n $this->ORDERARTICLES = [];\n }",
"public function clearProdutoRepresentadas()\n {\n $this->collProdutoRepresentadas = null; // important to set this to null since that means it is uninitialized\n $this->collProdutoRepresentadasPartial = null;\n\n return $this;\n }",
"public function initItemPedidos()\n\t{\n\t\t$this->collItemPedidos = array();\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
builds a join query for all foreign keys in a given table | public function buildJoinQuery($sourceTable, $tablesToJoin = array()){
$sql = "";
$columnNames = array();
$result = $this->_mysqli->query("SELECT `COLUMN_NAME`
FROM `INFORMATION_SCHEMA`.`COLUMNS`
WHERE `TABLE_SCHEMA`='website'
AND `TABLE_NAME`='$sourceTable'");
while($row = $result->fetch_row()){
$columnNames[] = $row[0];
}
//die(var_dump($columnNames));
foreach($columnNames as $columnName){
if(array_key_exists($columnName, $this->foreignKeys) ){
$foreignTable = $this->foreignKeys[$columnName];
if (in_array($foreignTable, $tablesToJoin)){
$sql .= " LEFT JOIN `$foreignTable` ON `$foreignTable`.ID = `$sourceTable`.$columnName";
}
}
}
return $sql;
} | [
"public function getTablesToJoin();",
"public function getTableForeignKeys( $table );",
"function getForeignKeys($table);",
"public function fullOuterJoin($table);",
"public function fullJoin($table, array $on);",
"public function get_database_table_joins ($table) {\n\n $this->test_config_initialized();\n\n $list = [];\n\n if ( isset($this->database_config['data_schema'][$table]['table_joins'])) {\n\n foreach ($this->database_config['data_schema'][$table]['table_joins'] as $field => $table) {\n\n $sly_table = $this->table_prefix.$this->verify_table_name($table);\n $list[$sly_table] = $this->get_db_key_from_field($field, $table);\n }\n }\n\n return $list;\n }",
"public function get_database_table_joins ($table) {\n\n $this->__test_config_initialized();\n\n $list = [];\n\n if ( isset($this->database_config['data_schema'][$table]['table_joins'])) {\n\n foreach ($this->database_config['data_schema'][$table]['table_joins'] as $field => $table) {\n\n $sly_table = $this->table_prefix.$this->__verify_table_name($table);\n $list [$sly_table] = $this->__get_db_key_from_field($field, $table);\n }\n }\n\n return $list;\n }",
"protected function _autojoin()\n\t{\n\t\t$tables = $this->_autojoin_tables();\n\t\tforeach ($tables as $table)\n\t\t{\n\t\t\t$entity = entity($table);\n\t\t\t$this->db->join($table, \"$this->table.{$entity}_id = $table.id\", 'LEFT');\n\t\t}\n\t}",
"private function join()\n {\n $a = $this->prefix($this->pk(), $this->table());\n $b = $this->prefix($this->pk(), $this->ee_table);\n\n ee()->db->join($this->ee_table, $a . ' = ' . $b, 'inner');\n }",
"private function getJoinClause() : string\n {\n $sql = '';\n foreach ($this->join as $j) {\n $sql .= sprintf(' %s %s %s', $j['type'], $j['table'], $j['alias']);\n if ($j['keyCol'] && $j['refCol']) {\n $sql .= sprintf(' ON %s=%s.%s', $j['keyCol'], $j['alias'], $j['refCol']);\n }\n }\n\n return $sql;\n }",
"public function queryJoin($tableAll, $tableJoin, $fore, $cols, $cuscol=null)\n {\n $cols = implode(\",tb2.\", $cols);\n if($cuscol==null) $cuscol=\"\";\n else $cuscol=','.$cuscol;\n $sql = \"SELECT tb1.*,tb2.\".$cols.$cuscol.\" \n FROM {$tableAll} as tb1 \n JOIN {$tableJoin} as tb2 \n ON tb1.id = tb2.{$fore} \";\n // var_dump($sql);\n // die();\n return $sql;\n }",
"private function buildJoin()\n {\n if (empty($this->join)) {\n return;\n }\n\n foreach ($this->join as $data) {\n list ($joinType, $joinTable, $joinCondition) = $data;\n\n if (is_object($joinTable)) {\n $joinStr = $this->buildPair(\"\", $joinTable);\n } else {\n $joinStr = $joinTable;\n }\n\n $this->query .= \" \".$joinType.\" JOIN \".$joinStr.\n (false !== stripos($joinCondition, 'using') ? \" \" : \" ON \")\n .$joinCondition;\n }\n }",
"public function findForeignKeysInTable($tableName) {\n\t\t$escapedTableName = $this->escapeName($tableName);\n\n\t\t$rows = $this->executeDialectQuery('List FK',\n\t\t\t[\n\t\t\t'sqlite' => \"PRAGMA foreign_key_list({$escapedTableName})\",\n\t\t\t'mysql' => \"SELECT\\n `column_name`,\\n `constraint_name`,\\n `referenced_table_name`,\\n `referenced_column_name`\\nFROM `information_schema`.`key_column_usage`\\nWHERE `table_name` = ?\\n AND `referenced_table_name` IS NOT NULL;\"\n\t\t\t],\n\t\t\t[\n\t\t\t\t'mysql' => array($tableName)\n\t\t\t]);\n\n\t\t#echo \"<pre>\";print_r($rows);#exit;\n\n\t\treturn array_map( array($this, 'mapForeignKeyInfo'), $rows);\n\t}",
"public function innerJoin(string $table, string $on) : SqlQueryable;",
"private function sql_join() {\n $sql = '';\n foreach ($this->query['join'] as $value) {\n $sql .= $value['type'] . ' JOIN ' . $value['table'] . ' ON ' . $value['condition'] . ' ';\n }\n return $sql;\n }",
"public function defineForeignKeys(Table $table);",
"protected function _buildJoin () {\r\n if (empty ($this->_join))\r\n return;\r\n\r\n foreach ($this->_join as $data) {\r\n list ($joinType, $joinTable, $joinCondition) = $data;\r\n\r\n if (is_object ($joinTable))\r\n $joinStr = $this->_buildPair (\"\", $joinTable);\r\n else\r\n $joinStr = $joinTable;\r\n\r\n $this->_query .= \" \" . $joinType. \" JOIN \" . $joinStr .\" on \" . $joinCondition;\r\n\r\n // Add join and query\r\n if (!empty($this->_joinAnd) && isset($this->_joinAnd[$joinStr])) {\r\n foreach($this->_joinAnd[$joinStr] as $join_and_cond) {\r\n list ($concat, $varName, $operator, $val) = $join_and_cond;\r\n $this->_query .= \" \" . $concat .\" \" . $varName;\r\n $this->conditionToSql($operator, $val);\r\n }\r\n }\r\n }\r\n }",
"public function getAllQuery() : string {\n $query = 'SELECT * FROM ' . $this->_table_name;\n\n // Belongs to relationship\n if(isset($this->belongs_to)){\n $this->belongs_to = is_array($this->belongs_to) ? $this->belongs_to : array($this->belongs_to);\n foreach ($this->belongs_to as $key => $model_name){\n // Instantiate foreign model\n $model = $this->getModel($model_name);\n $foreign_key = $model->_parsed_classname['short_lower'] . '_id';\n $query .= \" LEFT JOIN $model->_table_name ON $this->_table_name.$foreign_key = $model->_table_name.$foreign_key\";\n }\n }\n return $query;\n }",
"private function getJoinQuery(): string {\n $sql = [];\n foreach ($this->join as $joinCondition) {\n foreach ($joinCondition as $type => $joinCond) {\n foreach ($joinCond as $table => $join) {\n $sql[] = \"{$type} JOIN {$table} ON \" . $this->formatJoin($join);\n }\n }\n }\n $sql = implode(' ', $sql);\n return $sql;\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
acf_maybe_idval Checks value for potential id value. | function acf_maybe_idval($value)
{
} | [
"function hasIdValue() {\n return false;\n }",
"function acf_idval($value)\n{\n}",
"public static function clean_id($val) {\n return filter_var($val, FILTER_VALIDATE_INT, [\n 'options' => ['min_range' => 0]\n ]);\n }",
"function valcheck($id)\r\n { \r\n global $rightdata3;\r\n if(in_array($id,$rightdata3))\r\n return 0;\r\n else\r\n\treturn 1;\t \r\n }",
"function acf_get_valid_post_id( $post_id = 0 ) {\n}",
"function acf_get_valid_post_id( $post_id = 0 ) {\n\n\t// allow filter to short-circuit load_value logic\n\t$preload = apply_filters( 'acf/pre_load_post_id', null, $post_id );\n\tif ( $preload !== null ) {\n\t\treturn $preload;\n\t}\n\n\t// vars\n\t$_post_id = $post_id;\n\n\t// if not $post_id, load queried object\n\tif ( ! $post_id ) {\n\n\t\t// try for global post (needed for setup_postdata)\n\t\t$post_id = (int) get_the_ID();\n\n\t\t// try for current screen\n\t\tif ( ! $post_id ) {\n\n\t\t\t$post_id = get_queried_object();\n\n\t\t}\n\t}\n\n\t// $post_id may be an object.\n\t// todo: Compare class types instead.\n\tif ( is_object( $post_id ) ) {\n\n\t\t// post\n\t\tif ( isset( $post_id->post_type, $post_id->ID ) ) {\n\n\t\t\t$post_id = $post_id->ID;\n\n\t\t\t// user\n\t\t} elseif ( isset( $post_id->roles, $post_id->ID ) ) {\n\n\t\t\t$post_id = 'user_' . $post_id->ID;\n\n\t\t\t// term\n\t\t} elseif ( isset( $post_id->taxonomy, $post_id->term_id ) ) {\n\n\t\t\t$post_id = 'term_' . $post_id->term_id;\n\n\t\t\t// comment\n\t\t} elseif ( isset( $post_id->comment_ID ) ) {\n\n\t\t\t$post_id = 'comment_' . $post_id->comment_ID;\n\n\t\t\t// default\n\t\t} else {\n\n\t\t\t$post_id = 0;\n\n\t\t}\n\t}\n\n\t// allow for option == options\n\tif ( $post_id === 'option' ) {\n\n\t\t$post_id = 'options';\n\n\t}\n\n\t// append language code\n\tif ( $post_id == 'options' ) {\n\n\t\t$dl = acf_get_setting( 'default_language' );\n\t\t$cl = acf_get_setting( 'current_language' );\n\n\t\tif ( $cl && $cl !== $dl ) {\n\n\t\t\t$post_id .= '_' . $cl;\n\n\t\t}\n\t}\n\n\t// filter for 3rd party\n\t$post_id = apply_filters( 'acf/validate_post_id', $post_id, $_post_id );\n\n\t// return\n\treturn $post_id;\n\n}",
"function invalid_id($id)\n{\n\treturn isset($id) && $id < 0;\n}",
"abstract protected function idValue($data);",
"public function validate_eshop_id_field($key, $value) {\n\t\t$value = $this->validate_text_field($key, $value);\n\n\t\tif (!$value || !preg_match(\"/^[0-9]{1,10}$/\", $value)) {\n\t\t\t$this->add_error( __(\"Invalid <b>Eshop ID</b> value\", Plugin24Pay::ID) . ' <i>' . $value . '</i>' );\n\t\t}\n\n\t\treturn $value;\n\t}",
"private function __validate_id() {\n if (isset($this->initial_data[\"id\"])) {\n # Loop through each alias and check for a match\n foreach ($this->config[\"aliases\"][\"alias\"] as $id=>$alias) {\n # First check if the ID matches the index value or the alias name\n if ($this->initial_data[\"id\"] === $id or $this->initial_data[\"id\"] === $alias[\"name\"]) {\n $this->id = $id;\n $this->validated_data = $alias;\n $this->original_name = $alias[\"name\"];\n break;\n }\n }\n # If we did not find an ID in the loop, return a not found error\n if (is_null($this->id)) {\n $this->errors[] = APIResponse\\get(4055);\n }\n } else {\n $this->errors[] = APIResponse\\get(4050);\n }\n }",
"function getIdValue()\n {\n }",
"public function validateId(){\n \n return preg_match(Config::$id_format, $this->id);\n }",
"public function setId_Validator($nValue){\n\t\t//security on null guy !!!\n\t\tif($nValue == null)\n\t\t\treturn false;\n\t\t//security on type guy !!!\n\t\tif(getType($nValue) == 'integer'){\n\t\t\t $this->members[\"nId_Validator\"] = $nValue;\n\t\t\t//Happy end\n\t\t\treturn true;\n\t\t}\n\t\t//Don't fool me next Time !!!\n\t\treturn false;\n\t}",
"public function isValidWorkflowId($val)\n {\n return is_string($val) && preg_match(self::PATTERN_ID, $val) != 0;\n }",
"public function is_user_id( $value );",
"public function check_fed_id() {\n\n $company = Companies::model()->find('Company_Fed_ID=:Fed_ID',\n array(':Fed_ID'=>$this->Fed_ID));\n if($company != null) {\n $this->addError('Fed_ID','Company with this Fed ID already exists');\n } else if (!preg_match('/^(\\d{2}\\-\\d{7})|(\\d{3}\\-\\d{2}\\-\\d{4})$/', $this->Fed_ID)) {\n $this->addError('Fed_ID','Invalid Fed ID, correct formatting: xx-xxxxxxx');\n }\n }",
"public function isValidWorkflowId($val)\n\t{\n\t\treturn is_string($val) && preg_match(self::PATTERN_ID, $val) != 0;\n\t}",
"private function __validate_id() {\n if ($this->validate_id === false) {\n } elseif (isset($this->initial_data[\"id\"])) {\n if (array_key_exists($this->initial_data[\"id\"], $this->config[\"unbound\"][\"hosts\"])) {\n $this->id = $this->initial_data[\"id\"];\n } else {\n $this->errors[] = APIResponse\\get(2016);\n }\n } else {\n $this->errors[] = APIResponse\\get(2015);\n }\n }",
"private function determine_field_value($_meta, $_id = 0) {\r\n\t $mval = false;\r\n\t /**\r\n\t * We are assuming that here the user will use whatever the Admin Fields that is placed for the product page\r\n\t * not on the Product Taxonomies page or Admin Fields for variable sections. because it doesn't make any sense.\r\n\t * and if they do then we have a problem here\r\n\t */\r\n\t if (metadata_exists(\"post\", $_id, \"wccaf_\". $_meta[\"name\"])) {\r\n\t $mval = get_post_meta($_id, \"wccaf_\". $_meta[\"name\"], true);\r\n\t /* Incase of checkbox - the values has to be deserialzed as Array */\r\n\t if ($_meta[\"type\"] == \"checkbox\") {\r\n\t $mval = explode(',', $mval);\r\n\t }\r\n\t } else {\r\n\t /* This will make sure the following section fill with default value instead */\r\n\t $mval = false;\r\n\t }\r\n\t /* We can trust this since we never use boolean value for any meta\r\n\t * instead we use 'yes' or 'no' values */\r\n\t if (!$mval) {\r\n\t /* Value is not there - probably this field is not yet saved */\r\n\t if ($_meta[\"type\"] == \"checkbox\") {\r\n\t $d_choices = array();\r\n\t if ($_meta[\"default_value\"] != \"\") {\r\n\t $choices = explode(\";\", $_meta[\"default_value\"]);\r\n\t if (is_array($choices)) {\r\n\t foreach ($choices as $choice) {\r\n\t $d_value = explode(\"|\", $choice);\r\n\t $d_choices[] = $d_value[0];\r\n\t }\r\n\t }\r\n\t }\r\n\t $mval = $d_choices;\r\n\t } else if ($_meta[\"type\"] == \"radio\" || $_meta[\"type\"] == \"select\") {\r\n\t $mval = \"\";\r\n\t if ($_meta[\"default_value\"] != \"\") {\r\n\t $d_value = explode(\"|\", $_meta[\"default_value\"]);\r\n\t $mval = $d_value[0];\r\n\t }\r\n\t } else {\r\n\t /* For rest of the fields - no problem */\r\n\t $mval = isset($_meta[\"default_value\"]) ? $_meta[\"default_value\"] : \"\";\r\n\t }\r\n\t }\r\n\t return $mval;\r\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Lists all Tutorias entities. | public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$entities = $em->getRepository('IntranetBundle:Tutorias')->findAll();
return $this->render('IntranetBundle:Tutorias:index.html.twig', array(
'entities' => $entities,
));
} | [
"public function tutorielsAction() {\n $em = $this->getDoctrine()->getManager();\n $liste_page = $em->getRepository('WebMetaCommonBundle:Page')\n ->findAllPageByNomCategorie(\"Tutoriels\");\n \n return $this->render('WebMetaCommonBundle:Default:tutoriels.html.twig', array (\"liste_page\" => $liste_page));\n }",
"public function tutorados()\n {\n return $this->hasMany('App\\Tutorizado', 'tutorado');\n }",
"public function searchAllTutor()\n\t{\n\t\t$criteria = new CDbCriteria();\n\t\t$criteria->condition = 'role = ?';\n\t\t$criteria->params = array(Account::TUTOR);\n\t\t$criteria->order = 'created desc';\n\t\t\n\t\treturn new CActiveDataProvider($this, array('criteria'=>$criteria, 'pagination'=>array('pagesize'=>20)));\n\t}",
"private function getAllTutorUser()\n {\n //Get all the users in the database\n $users = User::all();\n $tutorUsers = array();\n foreach ($users as $user) {\n if ($user->hasRole('tutor')) {\n array_push($tutorUsers, $user);\n }\n }\n\n return $tutorUsers;\n }",
"function getTutors()\n {\n $tutorList = $this->find('all', array(\n 'conditions' => array('Role.id' => $this->USER_TYPE_TA)));\n return Set::combine($tutorList, '{n}.User.id', '{n}.User.'.$this->displayField);\n }",
"public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $autoridads = $em->getRepository('AppBundle:Autoridad')->findAll();\n\n return $this->render('autoridad/index.html.twig', array(\n 'autoridads' => $autoridads,\n ));\n }",
"public function findAllTeacher()\n {\n \treturn $this->createQueryBuilder('u')\n \t->where('u.role = 1')\n \t->getQuery()\n \t->getResult();\n \t;\n }",
"function get_all_persona_tutor()\n {\n $this->db->order_by('id_persona', 'desc');\n return $this->db->get('persona_tutor')->result_array();\n }",
"public function getAllAction() {\n $em = $this->getDoctrine()->getManager();\n $entities = $em->getRepository('MiwClubPadelBundle:Users')->findAll();\n return $entities;\n }",
"public function indexAction()\n {\n $this->get('session')->getFlashBag()->clear();\n \n $em = $this->getDoctrine()->getManager();\n\n $entities = $em->getRepository('UsuarioBundle:Rol')->findAll();\n\n return $this->render('UsuarioBundle:Rol:index.html.twig', array(\n 'entities' => $entities\n ));\n }",
"public static function getAllEntrenadores(){\r\n\t\tif(!isset($_SESSION)) session_start();\r\n\t\t$entrenador = new Usuario();\r\n\t\treturn $entrenador->getAllEntrenadores();\r\n\t}",
"public function getAuthorsAction() {\n\n $user = $this->getUser();\n\n $authors = $this->getDoctrine()->getRepository(Author::class)\n ->findBy(['owner' => $user->getId()]);\n\n $view = $this->view($authors, 200);\n return $this->handleView($view);\n }",
"public function getAll()\n {\n return User::with('roles')->get();\n }",
"public function ListarOrdenados() {\n $consulta = $this->createQueryBuilder('r')\n ->orderBy('r.nombre', \"ASC\");\n\n\n $lista = $consulta->getQuery()->getResult();\n return $lista;\n }",
"function get_all_tutores($params = array())\n {\n $this->db->order_by('id', 'desc');\n if(isset($params) && !empty($params))\n {\n $this->db->limit($params['limit'], $params['offset']);\n }\n return $this->db->get('tutor')->result_array();\n }",
"public function lists()\n {\n // на локалхосте загрузка пользователей кладёт систему\n if (app()->environment('local')) {\n return [];\n }\n return Tutor::selectRaw(\"CONCAT_WS(' ', last_name, first_name, middle_name) as name, id\")\n ->pluck('name', 'id');\n }",
"public function findAllMainTeacher()\n {\n return $this->createQueryBuilder('u')\n ->where('u.role = 4')\n ->getQuery()\n ->getResult();\n ;\n }",
"public function indexAction()\n {\n $entity = new PersonaTratamiento();\n $form = $this->createCreateForm($entity);\n $em = $this->getDoctrine()->getManager();\n\n $entities = $em->getRepository('DGPlusbelleBundle:PersonaTratamiento')->findAll();\n\n return array(\n 'entities' => $entities,\n 'form' => $form->createView(),\n );\n }",
"public function roles_all()\n {\n $roles = Rol::get();\n return $this->sendResponse($roles->toArray(), 'Roles devueltos con éxito');\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test query throws rdbms.SQLStateException when not connected to the database | #[@test, @expect('rdbms.SQLStateException')]
public function noQueryWhenNotConnected() {
$this->conn->query('select 1');
} | [
"public function testQueryError() {\n\t\t$this->setExpectedException('\\YapepBase\\Exception\\DatabaseException');\n\n\t\t$sql = '\n\t\t\tSLECT\n\t\t\t\t*\n\t\t\tFROM\n\t\t\t\ttest\n\t\t';\n\n\t\t$this->connection->query($sql);\n\t}",
"#[@test, @expect('rdbms.SQLStateException')]\n public function noQueryWhenDisConnected() {\n $this->conn->connect();\n $this->conn->close();\n $this->conn->query('select 1');\n }",
"public function testQueryWithError()\n {\n $db = \\db::getSingleton();\n \n $res = $db->query(\"x=1\");\n\n $this->assertFalse($res);\n }",
"public function testRunASqlQuery(){\r\n $sql = \"Select * from orders;\";\r\n $db = new database;\r\n $db->connectToDatabase();\r\n $success = $db->runASqlQuery($sql);\r\n $this->assertEquals(true,$success);\r\n }",
"public function test_db_error() {\n\t\t\n\t\t$q = \"SELECT * FROM posts\";\n\t\techo DB::instance(DB_NAME)->select_rows($q);\n\t}",
"public function testDatabaseQueryBadStatement() {\n try {\n $db = new \\snac\\server\\database\\DatabaseConnector();\n $db->query(\"NOT A POSTGRES STATEMENT;\", array());\n $this->fail(\"Allowed query a statement that was garbage.\");\n } catch (\\snac\\exceptions\\SNACDatabaseException $e) {\n $message = $e->getMessage();\n $this->assertEquals(\"pg_prepare(): Query failed: ERROR: syntax error at or near \\\"NOT\\\"\\nLINE 1: NOT A POSTGRES STATEMENT;\\n ^\", substr($message, 0));\n }\n\n }",
"public function testQueryWithEmptySql()\n {\n $db = \\db::getSingleton();\n \n $res = $db->query(0);\n\n $this->assertFalse($res);\n }",
"public function testDbQuery() {\n $this->assertInstanceOf(StatementInterface::class, db_query('SELECT name FROM {test} WHERE name = :name', [':name' => \"John\"]));\n }",
"public function testDatabaseQuerySimpleStatement() {\n try {\n $db = new \\snac\\server\\database\\DatabaseConnector();\n $db->query(\"SELECT NULL;\", array());\n } catch (Exception $e) {\n $this->fail(\"Could not query (prepare and execute) no-op. \" . $e->getMessage());\n }\n }",
"public function testQueryThrowsExceptionWhenNotConnected(): void\n {\n $this->expectException('Lunr\\Gravity\\Database\\Exceptions\\ConnectionException');\n $this->expectExceptionMessage('Could not establish connection to the database!');\n\n $this->class->query('query');\n }",
"public function testErrornousSingleResultSqlQuery() {\r\n $this->setExpectedException('Exception', 'Error in query: errornous sql query');\r\n $this->getPersistenceAdapter()->executeSingleResultQuery('errornous sql query');\r\n }",
"public function testQuery()\n {\n // Test query\n $sql = \"SELECT * FROM products\";\n $this->assertTrue($this->db->query($sql));\n }",
"public function testHandleQueryExceptionDeprecation(): void {\n $this->expectDeprecation('Passing a StatementInterface object as a $query argument to Drupal\\Core\\Database\\Connection::query is deprecated in drupal:9.2.0 and is removed in drupal:10.0.0. Call the execute method from the StatementInterface object directly instead. See https://www.drupal.org/node/3154439');\n $this->expectDeprecation('Connection::handleQueryException() is deprecated in drupal:9.2.0 and is removed in drupal:10.0.0. Get a handler through $this->exceptionHandler() instead, and use one of its methods. See https://www.drupal.org/node/3187222');\n $this->expectException(DatabaseExceptionWrapper::class);\n $stmt = Database::getConnection()->prepareStatement('SELECT * FROM {does_not_exist}', []);\n Database::getConnection()->query($stmt);\n }",
"public function testRunStatementDryrun(){\n $stmt = \"SELECT * FROM test_table where uid = 1\";\n $db = new DB($this->databaseConfig, $this->logger);\n $db->runStatement($stmt,true);\n }",
"public function testCanExecuteSqlQueryRepeatedlyUntilItSucceeds()\n\t {\n\t\t$this->assertInstanceOf(\"\\Logics\\Foundation\\SQL\\PostgreSQLresult\", $this->object->execUntilSuccessful(\"SELECT * FROM PostgreSQLdatabase\"));\n\n\t\tset_error_handler(array($this, \"errorHandler\"));\n\t\tpcntl_signal(SIGALRM, array($this, \"timeoutCallback\"), true);\n\n\t\tpcntl_alarm(540);\n\n\t\ttry\n\t\t {\n\t\t\t$this->object->execUntilSuccessful(\"SELECT * FROM nonexistenttable\");\n\t\t }\n\t\tcatch (Exception $e)\n\t\t {\n\t\t\t$this->assertEquals(true, (($e->getMessage() === \"Timeout\") && strpos($GLOBALS[\"stuckerror\"], \"Stuck executing SQL\") !== false));\n\t\t }\n\n\t\tpcntl_alarm(5);\n\n\t\ttry\n\t\t {\n\t\t\t$this->assertFalse(\n\t\t\t $this->object->execUntilSuccessful(\"SELECT * FROM nonexistenttable\", array(\"ERROR: relation \\\"nonexistenttable\\\" does not exist\"))\n\t\t\t);\n\t\t\tpcntl_alarm(0);\n\t\t }\n\t\tcatch (Exception $e)\n\t\t {\n\t\t\t$this->assertEquals(false, ($e->getMessage() === \"Timeout\"));\n\t\t }\n\n\t\trestore_error_handler();\n\n\t\t$blob = \"blob\";\n\t\t$this->assertEquals(true, $this->object->execBinaryBlobUntilSuccessful(\"INSERT INTO PostgreSQLdatabase (testblob) VALUES ($1)\", $blob));\n\t }",
"public function test_query_exception(): void\n {\n $this->expectException(ClientSaveQueryGraphQLException::class);\n\n GraphQLExceptions::wrap(function () {\n DB::select('select * from foo_table where bar = \"baz\"');\n });\n }",
"#[@test, @expect('rdbms.SQLStatementFailedException')]\n public function malformedStatement() {\n $this->db()->query('select insert into delete.');\n }",
"public function testStatementQueryDeprecation(): void {\n $this->expectDeprecation('Passing a StatementInterface object as a $query argument to Drupal\\Core\\Database\\Connection::query is deprecated in drupal:9.2.0 and is removed in drupal:10.0.0. Call the execute method from the StatementInterface object directly instead. See https://www.drupal.org/node/3154439');\n $db = Database::getConnection();\n $stmt = $db->prepareStatement('SELECT * FROM {test}', []);\n $this->assertNotNull($db->query($stmt));\n }",
"public function testMultipleStatementsQuery() {\n $this->expectException(\\InvalidArgumentException::class);\n Database::getConnection('default', 'default')->query('SELECT * FROM {test}; SELECT * FROM {test_people}');\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Operation gETPaypalGatewayIdPaymentMethodsAsyncWithHttpInfo Retrieve the payment methods associated to the paypal gateway | public function gETPaypalGatewayIdPaymentMethodsAsyncWithHttpInfo($paypal_gateway_id)
{
$returnType = '';
$request = $this->gETPaypalGatewayIdPaymentMethodsRequest($paypal_gateway_id);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
} | [
"public function gETCheckoutComGatewayIdPaymentMethodsAsyncWithHttpInfo($checkout_com_gateway_id)\n {\n $returnType = '';\n $request = $this->gETCheckoutComGatewayIdPaymentMethodsRequest($checkout_com_gateway_id);\n\n return $this->client\n ->sendAsync($request, $this->createHttpClientOption())\n ->then(\n function ($response) use ($returnType) {\n return [null, $response->getStatusCode(), $response->getHeaders()];\n },\n function ($exception) {\n $response = $exception->getResponse();\n $statusCode = $response->getStatusCode();\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $exception->getRequest()->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n (string) $response->getBody()\n );\n }\n );\n }",
"public function gETStripeGatewayIdPaymentMethodsAsyncWithHttpInfo($stripe_gateway_id)\n {\n $returnType = '';\n $request = $this->gETStripeGatewayIdPaymentMethodsRequest($stripe_gateway_id);\n\n return $this->client\n ->sendAsync($request, $this->createHttpClientOption())\n ->then(\n function ($response) use ($returnType) {\n return [null, $response->getStatusCode(), $response->getHeaders()];\n },\n function ($exception) {\n $response = $exception->getResponse();\n $statusCode = $response->getStatusCode();\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $exception->getRequest()->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n (string) $response->getBody()\n );\n }\n );\n }",
"public function restPaymentsMethodsPostAsyncWithHttpInfo($_rest_payments_methods = null)\n {\n $returnType = '\\OpenAPI\\Client\\Model\\PaymentMethod';\n $request = $this->restPaymentsMethodsPostRequest($_rest_payments_methods);\n\n return $this->client\n ->sendAsync($request, $this->createHttpClientOption())\n ->then(\n function ($response) use ($returnType) {\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = (string) $responseBody;\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n },\n function ($exception) {\n $response = $exception->getResponse();\n $statusCode = $response->getStatusCode();\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $exception->getRequest()->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n );\n }",
"public function gETAdyenGatewayIdPaymentMethodsAsync($adyen_gateway_id)\n {\n return $this->gETAdyenGatewayIdPaymentMethodsAsyncWithHttpInfo($adyen_gateway_id)\n ->then(\n function ($response) {\n return $response[0];\n }\n );\n }",
"public function testGETPaypalGatewayIdPaymentMethods()\n {\n // TODO: implement\n $this->markTestIncomplete('Not implemented');\n }",
"public function gETAdyenGatewayIdPaymentMethods($adyen_gateway_id)\n {\n $this->gETAdyenGatewayIdPaymentMethodsWithHttpInfo($adyen_gateway_id);\n }",
"public function gETAdyenGatewayIdPaymentMethodsWithHttpInfo($adyen_gateway_id)\n {\n $request = $this->gETAdyenGatewayIdPaymentMethodsRequest($adyen_gateway_id);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n (int) $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? (string) $e->getResponse()->getBody() : null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n (string) $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n (string) $response->getBody()\n );\n }\n\n return [null, $statusCode, $response->getHeaders()];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n }\n throw $e;\n }\n }",
"public function testGETPaymentGatewayIdPaymentMethods()\n {\n // TODO: implement\n $this->markTestIncomplete('Not implemented');\n }",
"public function gETStripeGatewayIdPaymentMethodsRequest($stripe_gateway_id)\n {\n // verify the required parameter 'stripe_gateway_id' is set\n if ($stripe_gateway_id === null || (is_array($stripe_gateway_id) && count($stripe_gateway_id) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $stripe_gateway_id when calling gETStripeGatewayIdPaymentMethods'\n );\n }\n\n $resourcePath = '/stripe_gateways/{stripeGatewayId}/payment_methods';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n\n\n // path params\n if ($stripe_gateway_id !== null) {\n $resourcePath = str_replace(\n '{' . 'stripeGatewayId' . '}',\n ObjectSerializer::toPathValue($stripe_gateway_id),\n $resourcePath\n );\n }\n\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n []\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n [],\n []\n );\n }\n\n // for model (json/xml)\n if (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];\n foreach ($formParamValueItems as $formParamValueItem) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValueItem\n ];\n }\n }\n // for HTTP post (form)\n $httpBody = new MultipartStream($multipartContents);\n\n } elseif ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($formParams);\n\n } else {\n // for HTTP post (form)\n $httpBody = \\GuzzleHttp\\Psr7\\build_query($formParams);\n }\n }\n\n\n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['User-Agent'] = $this->config->getUserAgent();\n }\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n\n $query = \\GuzzleHttp\\Psr7\\build_query($queryParams);\n return new Request(\n 'GET',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }",
"public function gETPaypalPaymentsAsyncWithHttpInfo()\n {\n $returnType = '';\n $request = $this->gETPaypalPaymentsRequest();\n\n return $this->client\n ->sendAsync($request, $this->createHttpClientOption())\n ->then(\n function ($response) use ($returnType) {\n return [null, $response->getStatusCode(), $response->getHeaders()];\n },\n function ($exception) {\n $response = $exception->getResponse();\n $statusCode = $response->getStatusCode();\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $exception->getRequest()->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n (string) $response->getBody()\n );\n }\n );\n }",
"public function testGETCheckoutComGatewayIdPaymentMethods()\n {\n // TODO: implement\n $this->markTestIncomplete('Not implemented');\n }",
"public function restPaymentsMethodsHbciGetAsyncWithHttpInfo()\n {\n $returnType = '';\n $request = $this->restPaymentsMethodsHbciGetRequest();\n\n return $this->client\n ->sendAsync($request, $this->createHttpClientOption())\n ->then(\n function ($response) use ($returnType) {\n return [null, $response->getStatusCode(), $response->getHeaders()];\n },\n function ($exception) {\n $response = $exception->getResponse();\n $statusCode = $response->getStatusCode();\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $exception->getRequest()->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n );\n }",
"public function getPaymentMethods()\n {\n /** @var oxPayment $oxPayment */\n $oxPayment = oxNew('oxPayment');\n $sql = \"SELECT `OXID` FROM {$oxPayment->getViewName()} WHERE {$oxPayment->getSqlActiveSnippet()}\";\n $methods = marm_shopgate::dbGetAll($sql);\n\n $result = array();\n foreach ($methods as $oxidMethod) {\n $result[] = array(\n 'id' => $oxidMethod['OXID'],\n );\n }\n\n return $result;\n }",
"public function activatePaymentMethodV2AsyncWithHttpInfo($id)\n {\n $returnType = '\\Reepay\\Model\\PaymentMethodV2';\n $request = $this->activatePaymentMethodV2Request($id);\n\n return $this->client\n ->sendAsync($request, $this->createHttpClientOption())\n ->then(\n function ($response) use ($returnType) {\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n if ($returnType !== 'string') {\n $content = json_decode($content);\n }\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n },\n function ($exception) {\n $response = $exception->getResponse();\n $statusCode = $response->getStatusCode();\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $exception->getRequest()->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n );\n }",
"public function gETBraintreeGatewayIdPaymentMethodsRequest($braintree_gateway_id)\n {\n // verify the required parameter 'braintree_gateway_id' is set\n if ($braintree_gateway_id === null || (is_array($braintree_gateway_id) && count($braintree_gateway_id) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $braintree_gateway_id when calling gETBraintreeGatewayIdPaymentMethods'\n );\n }\n\n $resourcePath = '/braintree_gateways/{braintreeGatewayId}/payment_methods';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n\n\n // path params\n if ($braintree_gateway_id !== null) {\n $resourcePath = str_replace(\n '{' . 'braintreeGatewayId' . '}',\n ObjectSerializer::toPathValue($braintree_gateway_id),\n $resourcePath\n );\n }\n\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n []\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n [],\n []\n );\n }\n\n // for model (json/xml)\n if (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];\n foreach ($formParamValueItems as $formParamValueItem) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValueItem\n ];\n }\n }\n // for HTTP post (form)\n $httpBody = new MultipartStream($multipartContents);\n\n } elseif ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($formParams);\n\n } else {\n // for HTTP post (form)\n $httpBody = \\GuzzleHttp\\Psr7\\build_query($formParams);\n }\n }\n\n\n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['User-Agent'] = $this->config->getUserAgent();\n }\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n\n $query = \\GuzzleHttp\\Psr7\\build_query($queryParams);\n return new Request(\n 'GET',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }",
"public function deletePaymentMethodV2AsyncWithHttpInfo($id)\n {\n $returnType = '\\Reepay\\Model\\PaymentMethodV2';\n $request = $this->deletePaymentMethodV2Request($id);\n\n return $this->client\n ->sendAsync($request, $this->createHttpClientOption())\n ->then(\n function ($response) use ($returnType) {\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n if ($returnType !== 'string') {\n $content = json_decode($content);\n }\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n },\n function ($exception) {\n $response = $exception->getResponse();\n $statusCode = $response->getStatusCode();\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $exception->getRequest()->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n );\n }",
"public function getSupportedPaymentMethods()\n {\n $url = \"supported-payment-methods\";\n $headers = array_merge($this->headers, [\n 'app-id' => $this->app_id,\n 'idempotency-key' => $this->_idemPotencyKey(),\n 'private-key' => $this->private_key,\n ]);\n $timeout = $this->timeout;\n try {\n $response = $this->http->get($url, compact('headers', 'timeout'));\n return $this->_format($response);\n } catch (RequestException $e) {\n $response = $e->getResponse();\n return $this->_format($response, $e);\n }\n }",
"public function deleteAllPaymentsAsyncWithHttpInfo()\n {\n $returnType = '\\Lnd\\Rest\\Model\\LnrpcDeleteAllPaymentsResponse';\n $request = $this->deleteAllPaymentsRequest();\n\n return $this->client\n ->sendAsync($request, $this->createHttpClientOption())\n ->then(\n function ($response) use ($returnType) {\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n if ($returnType !== 'string') {\n $content = json_decode($content);\n }\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n },\n function ($exception) {\n $response = $exception->getResponse();\n $statusCode = $response->getStatusCode();\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $exception->getRequest()->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n );\n }",
"public function getMethods()\n {\n switch ($this->id) {\n case 1:\n return [GatewayType::CREDIT_CARD => ['refund' => true, 'token_billing' => true]];//Authorize.net\n break;\n case 15:\n return [GatewayType::PAYPAL => ['refund' => true, 'token_billing' => false]]; //Paypal\n break;\n case 20:\n case 56:\n return [GatewayType::CREDIT_CARD => ['refund' => true, 'token_billing' => true],\n GatewayType::BANK_TRANSFER => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable']],\n GatewayType::ALIPAY => ['refund' => false, 'token_billing' => false],\n GatewayType::APPLE_PAY => ['refund' => false, 'token_billing' => false],\n GatewayType::SOFORT => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable']]]; //Stripe\n break;\n case 39:\n return [GatewayType::CREDIT_CARD => ['refund' => true, 'token_billing' => true]]; //Checkout\n break;\n case 50:\n return [\n GatewayType::CREDIT_CARD => ['refund' => true, 'token_billing' => true],\n GatewayType::PAYPAL => ['refund' => true, 'token_billing' => true]\n ];\n break;\n default:\n return [];\n break;\n }\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ Sets up the view to add a new set | public function Add()
{
//guests cannot add new sets
$role = $this->session->userdata('userrole');
if ($role == ROLE_GUEST) {
redirect($_SERVER['HTTP_REFERER']); // back where we came from
return;
}
$proteins = array();
$grains = array();
$toppings = array();
$veggies = array();
$sauces = array();
$items = $this->Accessories->all();
//sort accessories into categories
for ($x = 1; $x <= sizeof($items); $x++) {
$temp = $this->Accessories->get($x);
$currItem = array('item' => '<option value="' . $temp->id . '">' . $temp->name . '</option>');
if ($temp->category == "Protein") {
$proteins[] = $currItem;
}
if ($temp->category == "Grain") {
$grains[] = $currItem;
}
if ($temp->category == "Topping") {
$toppings[] = $currItem;
}
if ($temp->category == "Veggie") {
$veggies[] = $currItem;
}
if ($temp->category == "Sauce") {
$sauces[] = $currItem;
}
}
//pass accessories sorted by categories into view
$this->data['proteins'] = $proteins;
$this->data['grains'] = $grains;
$this->data['toppings'] = $toppings;
$this->data['veggies'] = $veggies;
$this->data['sauces'] = $sauces;
$this->data['setNum'] = sizeof($items = $this->Set->all()) + 1;
$this->data['pagetitle'] = 'Create';
$this->data['pagebody'] = 'setAdd';
$this->render();
} | [
"public function addAction()\n {\n $setTable = $this->_tblViewingSeq->getSetTableForAdding();\n\n // Let the view renderer know the table, buttons, and data form to use.\n $this->_initViewTableInfo($setTable);\n $this->view->buttonList = array(self::SAVE, self::RESET_BUTTON,\n self::CANCEL, self::SEARCH);\n $this->view->form = $form =\n new Application_Form_TableRecordEntry($setTable, 0, self::ADD);\n\n // Is this the initial display or the callback with fields provided?\n if ( $this->_thisIsInitialDisplay() )\n {\n // If \"starter\" fields have been provided, fill them in.\n if ( ! empty($this->_fieldsToMatch) )\n {\n $form->populate($this->_fieldsToMatch);\n }\n }\n elseif ( $this->_buttonAction == self::SAVE )\n {\n // Process the filled-out form that has been posted:\n // if the changes are valid, update the database.\n $formData = $this->getRequest()->getPost();\n if ($form->isValid($formData))\n {\n // If some fields should be initialized from existing values, \n // fill them in. Remove null fields.\n $addValues = $this->_fillInitValues($setTable,\n $form->getValues());\n $nonNullData = $this->_filledFields($addValues);\n\n // Update the database and redisplay the record.\n $setTable->addTableEntry($nonNullData);\n $this->_executeSearch($setTable, $nonNullData,\n self::DISPLAY_ALL);\n }\n else\n {\n // Invalid entries: show them for editing.\n $this->view->errMsgs[] =\n \"Invalid data values. Please correct.\";\n $form->populate($formData);\n }\n }\n elseif ( $this->_buttonAction == self::CANCEL )\n {\n $this->_goTo('index');\n }\n else\n {\n $this->_goTo($this->_getUsualAction($this->_buttonAction));\n }\n \n }",
"public function add_set ($set_name)\n {\n $this->sets [] = $set_name;\n $this->privileges [] = Privilege_view_hidden;\n }",
"public function create()\n\t{\n\t\treturn View::make('holdingssets.create');\n\t}",
"public function create() {\r\n\t\t\r\n\t\t// Anulamos la vista\r\n\t\tView::select(null,null);\r\n\t\t\r\n\t\t// Parametros\r\n\t\t$error = false;\r\n\r\n\t\t// Modelos\r\n\t\t$this->content = Load::model('content');\r\n\t\t$this->attributes = Load::model('contentAttributes');\r\n\t\t\r\n\t\t// Datos principales\t\t\r\n\t\t$contentData = array('content_type'=>'set', 'content_language_id'=> 1, 'content_slug'=>'nuevo_set','content_status'=>'private','content_sort_order'=>'0');\r\n\t\tif ($this->content->create($contentData)) {\r\n\t\t\r\n\t\t\t// Atributos\r\n\t\t\t$attributesData = array('id'=>'','content_id'=>$this->content->id, 'content_attribute_key'=>'TITLE','content_attribute_value'=>'Nuevo Set');\t\t\r\n\t\t\tif (!$this->attributes->create($attributesData)) {\r\n\t\t\t\t$error = true;\r\n\t\t\t}\t\r\n\t\t\r\n\t\t} else {\r\n\t\t\t$error = false;\r\n\t\t}\r\n\t\t\t\r\n\t\t// Comprobamos errores\r\n\t\tif ($error) {\r\n\t\t\t// Devolvemos AJAX\r\n\t\t\tdie ( Input::request('jsoncallback') . \"({'jResult':'failed','jMessage':\" . json_encode('No se ha podido crear un set') . \"})\" );\r\n\t\t\t\r\n\t\t} else {\r\n\t\t\tRouter::toAction('index');\r\n\t\t}\r\n\r\n\t}",
"public function actionCreate()\n {\n $this->layout = 'layout_admin2';\n $model = new Setor();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id_setor]);\n }\n\n return $this->render('create', [\n 'model' => $model,\n ]);\n }",
"public function create()\n {\n // Get board dropdown list\n $boards = $this->booksetRepository->getBoardDropdown();\n $boards->prepend('', '');\n return view('admin.booksets.add',compact('boards'));\n }",
"public function add() { \n // Set meta data\n $metaData = array();\n $metaData['title'] = \"Manage quiz - Add quiz\"; \n $this->view->meta = $metaData; \n $this->view->datatableAssets = false;\n $this->view->formAssets = true; \n $this->view->dropzoneAssets = false;\n $this->view->LoadView('topic_add', 'quiz');\n }",
"public function addView() {\n\t\t$this->set(static::COLUMN_VIEWS, $this->get(static::COLUMN_VIEWS)+1);\n\t}",
"public function actionCreate()\n {\n $model = new HanziSet();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }",
"protected function Add(){\n\t\t$viewmodel = new BookModel();\n\t\t$this->return_view($viewmodel->Add(), true); \n\t}",
"public function addAction() {\n\t $this->node = null;\n\n $form = $this->getForm();\n\n $view = $this->getFormView($form);\n $this->response->setView($view);\n\t}",
"public function showSetsAction()\r\n {\r\n $libraryModel = new LibraryModel();\r\n\r\n // ~\r\n\r\n $list = $libraryModel->findByParentAndType(LibraryEntity::TYPE_DOCUMENTS, LibraryEntity::TYPE_DOCUMENTS);\r\n\r\n // ~\r\n\r\n $renderData = array(\r\n 'pluginAction' => true,\r\n 'list' => $list,\r\n );\r\n\r\n // ~\r\n\r\n View::returnView('manage/documents/sets-list', $renderData);\r\n }",
"public function create()\n {\n return view('email.mailtemplates_sets.create');\n }",
"public function add(){\n\t\treturn view('tests.edit');\n }",
"public function addAction() {\n $baseAction = $this->request->getBasePath();\n $saveAction = $baseAction . '/put/';\n\n $widgetModel = WidgetModel::getInstance();\n $widgets = $widgetModel->getWidgets();\n\n $view = new WidgetAddView($widgets, $baseAction, $saveAction);\n $this->response->setView($view);\n }",
"public function testOverviewContainsSet()\n {\n $this->actingAs(self::$user)\n ->visit('/sets_runs')\n ->seePageIs('/sets_runs')\n ->see('New set name');\n }",
"public function setNewModel();",
"public function add(){\n\n\t $data = array(\n\t \t 'laptops' =>$this->Laptop_model->getLaptops() ,\n\n\t \t );\n\n\t $this->load->view('layouts/header');\n\t\t$this->load->view('layouts/aside');\n\t\t$this->load->view('admin/prestamos/add',$data); // se envia a la vista admin/laptops/add\n\t\t$this->load->view('layouts/footer');\n}",
"public function addItemView()\n {\n return view('items.items-add');\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Filter the query on the recipient_count column Example usage: $query>filterByRecipientCount(1234); // WHERE recipient_count = 1234 $query>filterByRecipientCount(array(12, 34)); // WHERE recipient_count IN (12, 34) $query>filterByRecipientCount(array('min' => 12)); // WHERE recipient_count >= 12 $query>filterByRecipientCount(array('max' => 12)); // WHERE recipient_count | public function filterByRecipientCount($recipientCount = null, $comparison = null)
{
if (is_array($recipientCount)) {
$useMinMax = false;
if (isset($recipientCount['min'])) {
$this->addUsingAlias(NewsletterMailingPeer::RECIPIENT_COUNT, $recipientCount['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($recipientCount['max'])) {
$this->addUsingAlias(NewsletterMailingPeer::RECIPIENT_COUNT, $recipientCount['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(NewsletterMailingPeer::RECIPIENT_COUNT, $recipientCount, $comparison);
} | [
"public function filteredCount();",
"abstract public function prepareFilteredCount();",
"public function recipientsCount();",
"public function getCount($filter=null, $range)\r\n {\r\n $fromTo = explode('-', $range);\r\n $from = $fromTo[0];\r\n $to = $fromTo[1];\r\n $select = $this->_getSelect($filter);\r\n $currentProducsId = Mage::registry('current_products_id');\r\n $currentAttributeId = Mage::registry('current_attribute_id');\r\n $state = $filter->getLayer()->getState()->getFilters();\r\n \r\n $stateCount = count($state);\r\n foreach ($state as $item) {\r\n $value = explode(',', $item->getValue());\r\n if (count($value) == 2) {\r\n if (($value[0] == $from) && ($value[1] == $to)) {\r\n return 0;\r\n }\r\n }\r\n }\r\n \r\n $attribute = $filter->getAttributeModel();\r\n $query = Mage::registry('query_request');\r\n $code = $attribute->getAttributeCode();\r\n $plus = false;\r\n if (array_key_exists($code, $query)) {\r\n $plus = true;\r\n }\r\n $attributeId = $attribute->getAttributeId();\r\n \r\n $connection = $this->_getReadAdapter();\r\n $response = $this->_dispatchPreparePriceEvent($filter, $select);\r\n\r\n $table = $this->_getIndexTableAlias();\r\n\r\n $additional = join('', $response->getAdditionalCalculations());\r\n $rate = $filter->getCurrencyRate();\r\n $priceExpr = new Zend_Db_Expr(\"(({$table}.min_price {$additional}) * {$rate})\");\r\n $select->columns(array($priceExpr));\r\n \r\n if ($stateCount == 0) {\r\n $select\r\n ->where($priceExpr . ' >= ?', $from)\r\n ->where($priceExpr . ' < ?', $to);\r\n \r\n $newId = $connection->fetchAll($select);\r\n $result = count($connection->fetchAll($select));\r\n } else {\r\n $lastCount = count($connection->fetchAll($select));\r\n $where = $this->_getReadAdapter()->quoteInto(\"{$priceExpr} >= ?\", $from)\r\n . ' AND '\r\n . $this->_getReadAdapter()->quoteInto(\"{$priceExpr} <= ?\", $to);\r\n\r\n $select->orWhere($where);\r\n $newId = $connection->fetchAll($select);\r\n if (null === $filter->getData('request')) {\r\n $result = count($connection->fetchAll($select));\r\n } else {\r\n $result = count($connection->fetchAll($select)) - $lastCount;\r\n }\r\n \r\n }\r\n if (count($currentProducsId) == count($result)) {\r\n $result = 0;\r\n }\r\n return $result;\r\n }",
"public function getModelCount($filter = '');",
"public function filterBySender($sender = null, $comparison = null)\n {\n if (is_array($sender))\n {\n $useMinMax = false;\n if (isset($sender['min']))\n {\n $this->addUsingAlias(PrivateMessagePeer::SENDER, $sender['min'], Criteria::GREATER_EQUAL);\n $useMinMax = true;\n }\n if (isset($sender['max']))\n {\n $this->addUsingAlias(PrivateMessagePeer::SENDER, $sender['max'], Criteria::LESS_EQUAL);\n $useMinMax = true;\n }\n if ($useMinMax)\n {\n return $this;\n }\n if (null === $comparison)\n {\n $comparison = Criteria::IN;\n }\n }\n return $this->addUsingAlias(PrivateMessagePeer::SENDER, $sender, $comparison);\n }",
"public function count(array $filter = array(), array $options = array());",
"public static function filterCount()\n {\n return self::filter(request(['q']))->count();\n }",
"public function searchCount(Tinebase_Model_Filter_FilterGroup $_filter);",
"public function applyFilter(Collection $models, $filter)\n {\n return $models->where('transaction_amount_max', '<=', $filter);\n }",
"function getFilteredMessages($filter, $num_messages=10, $start_from=0){\n \n $where = ['1=1'];\n foreach ($filter as $f => $v){\n $where[] = \"$f=$v\";\n }\n\n $sql_where = implode(\" AND \", $where);\n \n $sql = \"select r.id, r.description, i.name \" .\n \"from request r join document_meta d on r.id=d.request_id \" .\n \"join inststution i on r.institution_id=i.id \" .\n $sql_where .\n \" order by d.own.date desc limit $num_messages\"; \n $res = $DB->execute($sql);\n\n while (!$res->EOF) {\n $r_id = $res->FetchField(1);\n $r_descr = $res->FetchField(2);\n $i_name = $res->FetchField(3);\n \n $rs->MoveNext();\n } \n}",
"public function get_counts() {\n\n\t\t$this->counts = [];\n\n\t\t// Base params with applied filters.\n\t\t$base_params = $this->get_filters_query_params();\n\n\t\t$total_params = $base_params;\n\t\tunset( $total_params['status'] );\n\t\t$this->counts['total'] = ( new EmailsCollection( $total_params ) )->get_count();\n\n\t\tforeach ( $this->get_statuses() as $status => $name ) {\n\t\t\t$collection = new EmailsCollection( array_merge( $base_params, [ 'status' => $status ] ) );\n\n\t\t\t$this->counts[ 'status_' . $status ] = $collection->get_count();\n\t\t}\n\n\t\t/**\n\t\t * Filters items counts by various statuses of email log.\n\t\t *\n\t\t * @since 2.7.0\n\t\t *\n\t\t * @param array $counts {\n\t\t * Items counts by statuses.\n\t\t *\n\t\t * @type integer $total Total items count.\n\t\t * @type integer $status_{$status_key} Items count by status.\n\t\t * }\n\t\t */\n\t\t$this->counts = apply_filters( 'wp_mail_smtp_pro_emails_logs_admin_table_get_counts', $this->counts );\n\t}",
"public function filterByResentCount($resentCount = null, $comparison = null)\n {\n if (is_array($resentCount)) {\n $useMinMax = false;\n if (isset($resentCount['min'])) {\n $this->addUsingAlias(EmailPeer::RESENT_COUNT, $resentCount['min'], Criteria::GREATER_EQUAL);\n $useMinMax = true;\n }\n if (isset($resentCount['max'])) {\n $this->addUsingAlias(EmailPeer::RESENT_COUNT, $resentCount['max'], Criteria::LESS_EQUAL);\n $useMinMax = true;\n }\n if ($useMinMax) {\n return $this;\n }\n if (null === $comparison) {\n $comparison = Criteria::IN;\n }\n }\n\n return $this->addUsingAlias(EmailPeer::RESENT_COUNT, $resentCount, $comparison);\n }",
"public function prepareFilteredCount()\n\t{\n\t\t$this->filteredCount = (int) $this->data->count();\n\t}",
"function _sms_panel_bulk_count_recipients($values) {\n $values['sms_pquaanel_bulk_recipients_numbers'] = array_map('trim', explode(\n ',',\n $values['sms_panel_bulk_recipients_numbers']\n ));\n\n // Calculate recipient selection count, not the exact number quantity.\n return count($values['sms_panel_bulk_recipients_numbers']) +\n _sms_panel_bulk_checkboxes_selections($values['sms_panel_bulk_recipients_roles']) +\n _sms_panel_bulk_checkboxes_selections($values['sms_panel_bulk_recipients_users']) +\n _sms_panel_bulk_checkboxes_selections($values['sms_panel_bulk_recipients_queues']);\n}",
"private function recipients()\n {\n if (request('type') === 'bulk') {\n return $recipients = count(Contact::active()->where('group_id', request('recipients'))->pluck('mobile'));\n } elseif (request('type') === 'single') {\n return $recipients = 1;\n }\n }",
"function filterFolowersCount($activeFollowUsersFollowersList , $filter) {\n $isGreaterThen = $filter->isGreaterThen;\n $followersCount = $filter->followersCount;\n if($followersCount == \"\" || $followersCount == null) {\n return $activeFollowUsersFollowersList;\n }\n $newContainUsersFollowersList = [];\n $newNotContainUsersFollowersList = [];\n foreach($activeFollowUsersFollowersList as $user) {\n if(isset($user->followers_count) && ($user->followers_count > $followersCount) && $isGreaterThen) {\n $newContainUsersFollowersList[] = $user;\n }\n if(isset($user->followers_count) && ($user->followers_count < $followersCount) && !$isGreaterThen) {\n $newNotContainUsersFollowersList[] = $user;\n }\n \n \n } \n if($isGreaterThen) {\n return $newContainUsersFollowersList;\n } else {\n return $newNotContainUsersFollowersList;\n }\n}",
"public function getColumnRangeFilter()\n {\n return $this->readOneof(7);\n }",
"public function countByFilterParam(FilterManager $fm, $filterparam, $limitcount = null);"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a loan offer for a given currency. | public function createLoanOffer($currency, $amount, $duration, $lendingRate, $autoRenew=false) {
return $this->trading([
'command' => 'createLoanOffer',
'currency' => $currency,
'amount' => $amount,
'duration' => $duration,
'lendingRate' => $lendingRate,
'autoRenew' => (int) ((bool) $autoRenew),
]);
} | [
"public function createLoanOffer($currency, $amount, $duration, $autoRenew, $lendingRate) {\n return $this->request->exec([\n 'command' => 'createLoanOffer',\n 'currency' => strtoupper($currency),\n 'amount' => $amount,\n 'duration' => $duration,\n 'autoRenew' => $autoRenew,\n 'lendingRate' => $lendingRate\n ]);\n }",
"public function createLoanOffer(CreateLoanOfferRequest $request): CreateLoanOffer\n {\n foreach (get_object_vars($request) as $property => $value) {\n $this->throwExceptionIf(\n $value === null,\n sprintf('Unable to send \"moveOrder\" request. Field \"%s\" should be set.', $property)\n );\n }\n\n /* @var $createLoanOffer CreateLoanOffer */\n $createLoanOffer = $this->factory(\n CreateLoanOffer::class,\n $this->request('createLoanOffer', get_object_vars($request))\n );\n\n return $createLoanOffer;\n }",
"public function offerLoan(OfferLoanRequest $request)\n { \n $request->request->add(['admin_id'=> Auth::id()]);\n\n $new_loan = $this->loanRepo->createLoan($request->all());\n\n if($new_loan){\n $new_repayment_plan = $this->repayRepo->createRepaymentPlan($new_loan->id);\n }\n \n $details_loans = $this->loanRepo->details($new_loan->id);\n return $details_loans;\n }",
"public function createMoney($amount/*, $currency = null*/);",
"public function createOffer()\n {\n $entityClass = 'MU\\\\YourCityModule\\\\Entity\\\\OfferEntity';\n\n $entity = new $entityClass();\n\n $this->entityInitialiser->initOffer($entity);\n\n return $entity;\n }",
"private function _createOffer($response)\n {\n $model = new Models\\Offer();\n $model->setId($response['id']);\n $model->setName($response['name']);\n $model->setAmount($response['amount']);\n $model->setCurrency($response['currency']);\n $model->setInterval($response['interval']);\n $model->setTrialPeriodDays($response['trial_period_days']);\n $model->setCreatedAt($response['created_at']);\n $model->setUpdatedAt($response['updated_at']);\n $model->setSubscriptionCount($response['subscription_count']['active'], $response['subscription_count']['inactive']);\n $model->setAppId($response['app_id']);\n return $model;\n }",
"public function created(Currency $currency);",
"public function create_credit_card_charge() {\n\n\t\t$this->create_transaction( self::TRANSACTION_TYPE_SALE );\n\t}",
"public function actionCreate()\n {\n $model = new Loan();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }",
"function create_plan($product_id, $interval, $currency, $amount, $nickname=''){\n try{\n $plan = \\Stripe\\Plan::create([\n 'product' => $product_id,\n 'nickname' => $nickname,\n 'interval' => $interval,\n 'currency' => $currency,\n 'amount' => $amount, //amount in cents, for $1 it should be 100 cents\n ]);\n \n if(empty($plan))\n return array('status'=>false,'message'=>'Something went wrong');\n \n return array('status'=>true,'message'=>'Plan created successfully', 'data'=>$plan); //success\n \n }catch(Exception $e){\n $message = $e->getMessage();\n return array('status'=>false,'message'=>$message);\n }\n }",
"public function create_credit_card_charge() {\n\n\t\t$this->create_transaction( self::TRANSACTION_TYPE_PURCHASE );\n\t}",
"public function newBooking(Model $customer, float $paid, string $currency): TicketableBooking\n {\n return $this->bookings()->create([\n 'ticketable_id' => static::getKey(),\n 'ticketable_type' => static::getMorphClass(),\n 'customer_id' => $customer->getKey(),\n 'customer_type' => $customer->getMorphClass(),\n 'paid' => $paid,\n 'currency' => $currency,\n ]);\n }",
"public static function create() : PaymentMoneyHolder\n {\n $moneyHolder = new PaymentMoneyHolder();\n\n return $moneyHolder;\n }",
"function newSubscription($client, $offer, $payment) //payment??\n\t{\n\t\n\t\t// request object\n\t\t$request = $this->authentication();\n\t\t\n\t\t// new subscription object\n\t\t$subscription = new Paymill\\Models\\Request\\Subscription();\n\t\t\n\t\t// set params\n\t\t$subscription->setClient($client)\n\t\t ->setOffer($offer)\n\t\t ->setPayment($payment);\n\t\t\n\t\treturn $request->create($subscription);\n\t \n\t}",
"public function create()\n {\n if (! Gate::allows('currency_create')) {\n return abort(401);\n }\n return view('admin.currencies.create');\n }",
"public function created(Currency $currency)\n {\n $job = new CreateWalletsForCurrencyJob($currency);\n\n dispatch_now($job);\n }",
"private function createAccountWithBalance()\n {\n if ($this->managedAccount === null) {\n self::authorizeFromEnv();\n $account = self::createTestManagedAccount();\n\n $charge = \\Stripe\\Charge::create(array(\n 'currency' => 'usd',\n 'amount' => '10000',\n 'source' => 'tok_bypassPending',\n 'destination' => array(\n 'account' => $account->id\n )\n ));\n\n $this->managedAccount = $account;\n }\n\n return $this->managedAccount;\n }",
"public function createWallet($curr){\n if($curr === 'XRP' || $curr === 'BTC' || $curr === 'ETH'){\n $arr = [\n \"wallet_type\" => $curr\n ];\n return $this->runWithBody(\"/api/v1/wallet/create\", $arr, 'POST');\n }else{\n return 'Currency Not available';\n }\n }",
"private function createWallet(Currency $currency)\n {\n $wallet = new Wallet([\n 'shown' => true,\n 'order' => $this->owner->wallets()->count() + 1\n ]);\n\n $wallet->currency_code = $currency->getCode();\n $wallet->balance = '0';\n\n $this->owner->wallets()->save($wallet);\n\n return $wallet;\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds verified class to comment. | function wp_review_wc_comment_class( $classes, $class, $comment_id ) {
if ( intval( get_comment_meta( $comment_id, 'verified', true ) ) ) {
$classes[] = 'verified';
}
return $classes;
} | [
"public abstract function writeClassComment();",
"function prism_add_comment_class($classes) {\n global $comment, $post;\n\n // Add time and date based classes\n prism_date_classes( mysql2date( 'U', $comment->comment_date ), $classes, 'thm-c-' );\n\n // Do not duplicate values\n return array_unique( $classes );\n}",
"function cacsp_ic_add_comment_class( $retval ) {\n\tif ( false === cacsp_is_page() ) {\n\t\treturn $retval;\n\t}\n\n\t// add back the 'comment' CSS class\n\t$retval[] = 'comment';\n\treturn $retval;\n}",
"public function markAccountAsVerified();",
"function plugin_commentsupport_classifieds()\n{\n return true;\n}",
"public function markEmailAsVerified()\n {\n // TODO: Implement markEmailAsVerified() method.\n }",
"public function add_class($class_name)\n {\n }",
"function codium_extend_comment_class( $print = true ) {\n\tglobal $comment, $post, $codium_extend_comment_alt;\n\n\t// Collects the comment type (comment, trackback),\n\t$c = array( get_comment_type() );\n\n\t// Counts trackbacks (t[n]) or comments (c[n])\n\tif ( $comment->comment_type == 'comment' ) {\n\t\t$c[] = \"c$codium_extend_comment_alt\";\n\t} else {\n\t\t$c[] = \"t$codium_extend_comment_alt\";\n\t}\n\n\t// If the comment author has an id (registered), then print the log in name\n\tif ( $comment->user_id > 0 ) {\n\t\t$user = get_userdata($comment->user_id);\n\t\t// For all registered users, 'byuser'; to specificy the registered user, 'commentauthor+[log in name]'\n\t\t$c[] = 'byuser comment-author-' . sanitize_title_with_dashes(strtolower( $user->user_login ));\n\t\t// For comment authors who are the author of the post\n\t\tif ( $comment->user_id === $post->post_author )\n\t\t\t$c[] = 'bypostauthor';\n\t}\n\n\t// If it's the other to the every, then add 'alt' class; collects time- and date-based classes\n\tcodium_extend_date_classes( mysql2date( 'U', $comment->comment_date ), $c, 'c-' );\n\tif ( ++$codium_extend_comment_alt % 2 )\n\t\t$c[] = 'alt';\n\n\t// Separates classes with a single space, collates classes for comment LI\n\t$c = join( ' ', apply_filters( 'comment_class', $c ) ); // Available filter: comment_class\n\t\n\t// Tada again!\n\treturn $print ? print($c) : $c;\n}",
"private function getClassComment()\n {\n $comments = array();\n array_push($comments, 'This class stands for ' . $this->getPackagedName() . ' originally named ' . $this->getName());\n if ($this->getDocumentation() != '')\n array_push($comments, 'Documentation : ' . $this->getDocumentation());\n $this->addMetaComment($comments, false, true);\n if ($this->getInheritance() != '') {\n $inheritedModel = self::getModelByName($this->getInheritance());\n /**\n * A virtual struct exists only to store meta informations about itself\n * So don't add meta informations about a valid struct\n */\n if ($inheritedModel && !$inheritedModel->getIsStruct()) {\n $inheritedModel->addMetaComment($comments, false, false);\n }\n }\n array_push($comments, '@package ' . Generator::getPackageName());\n if (count($this->getDocSubPackages())) {\n array_push($comments, '@subpackage ' . implode(',', $this->getDocSubPackages()));\n }\n if (count(Generator::instance()->getOptionAddComments())) {\n foreach (Generator::instance()->getOptionAddComments() as $tagName => $tagValue) {\n array_push($comments, \"@$tagName $tagValue\");\n }\n }\n return $comments;\n }",
"function addComment(AddedComment $comment);",
"public function writeClassComment() {\n $t = $this->getTable();\n\n if ($t === null) {\n return;\n }\n $this->append([\n \"/**\",\n \" * A class which is used to perform operations on the table '\".$t->getNormalName().\"'\",\n \" */\"\n ]);\n }",
"public function setVerified($status);",
"protected function report_comment_success_message(){\r\n\t\treturn 'The comment has been reported.';\r\n\t}",
"public function setVerified($var)\n {\n GPBUtil::checkEnum($var, \\ChargeHive\\Chtype\\VerificationStatus::class);\n $this->verified = $var;\n\n return $this;\n }",
"function hybrid_get_comment_class( $class = '' ) {\n\tglobal $comment;\n\n\t/* Gets default WP comment classes. */\n\t$classes = get_comment_class( $class );\n\n\t/* Get the comment type. */\n\t$comment_type = get_comment_type();\n\n\t/* If the comment type is 'pingback' or 'trackback', add the 'ping' comment class. */\n\tif ( 'pingback' == $comment_type || 'trackback' == $comment_type )\n\t\t$classes[] = 'ping';\n\n\t/* User classes to match user role and user. */\n\tif ( $comment->user_id > 0 ) {\n\n\t\t/* Create new user object. */\n\t\t$user = new WP_User( $comment->user_id );\n\n\t\t/* Set a class with the user's role(s). */\n\t\tif ( is_array( $user->roles ) ) {\n\t\t\tforeach ( $user->roles as $role )\n\t\t\t\t$classes[] = sanitize_html_class( \"role-{$role}\" );\n\t\t}\n\n\t\t/* Set a class with the user's name. */\n\t\t$classes[] = sanitize_html_class( \"user-{$user->user_nicename}\", \"user-{$user->ID}\" );\n\t}\n\n\t/* If not a registered user */\n\telse {\n\t\t$classes[] = 'reader';\n\t}\n\n\t/* Comment by the entry/post author. */\n\tif ( $post = get_post( get_the_ID() ) ) {\n\t\tif ( $comment->user_id == $post->post_author )\n\t\t\t$classes[] = 'entry-author';\n\t}\n\n\t/* Get comment types that are allowed to have an avatar. */\n\t$avatar_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) );\n\n\t/* If avatars are enabled and the comment types can display avatars, add the 'has-avatar' class. */\n\tif ( get_option( 'show_avatars' ) && in_array( $comment->comment_type, $avatar_comment_types ) )\n\t\t$classes[] = 'has-avatar';\n\n\t/* Make sure comment classes doesn't have any duplicates. */\n\treturn array_unique( $classes );\n}",
"public function add_comment() {\n $this->comments++;\n }",
"public function verified()\n {\n $this->verified = 1;\n $this->email_token = null;\n $this->save();\n }",
"public function addAsVerified($phoneNumber)\n {\n\n\n }",
"public function verified()\n {\n $this->verified = 1;\n $this->email_token = null;\n $this->save();\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ Function to get department wise service list in drop down By: Chinmayee On: 23092019 | public function getDeptWiseService()
{
include_once(CLASS_PATH."clsService.php");
$obj = new clsService;
$deptId = $_REQUEST['deptId'];
$selVal = $_REQUEST['selVal'];
$dataArr = array();
$opt = '<option value="0">---Select Service---</option>';
$dataArr['intDepartmentId'] =$deptId;
$result = $obj->viewService('FAS',$dataArr);
if($result->num_rows>0){
$x=0;
while($row=$result->fetch_array()){
if($row["intServiceRegistrationId"]==$selVal){
$selected='selected="selected"';
}else{
$selected='';
}
$opt.='<option value="'.$row["intServiceRegistrationId"].'" '.$selected.' >'.$row["vchServiceName"].'</option>';
}
}else{
// Nothing to do
}
echo json_encode(array('opt' => $opt));
} | [
"public function getDepartmentToCombobox() {\n /*\n print \"<pre>\";\n print_r($ctypel);\n print \"</pre>\";\n exit(); */\n return $this->db->selectObjList('SELECT department_id, shortname, longname FROM department ORDER BY shortname;', $array = array(), \"Department\");\n }",
"public static function get_department()\n\t{\n\t\t$departments = FaqCategories::whereNull('parent_category_id')->where('cmpny_id',Auth::user()->cmpny_id)->where('status',config('constant.ACTIVE'))->orderBy('sort_order')->select('category_name', 'id','type')->get();\n\t\t$dept = '';\n\t\tif(count($departments)>0)\n\t\t{\n\t\t\t$dept .= '<option value=\"\">Select Department</option>';\n\t\t\tforeach($departments as $data)\n\t\t\t{\n\t\t\t\tif(!empty($data->category_name))\n\t\t\t\t{\n\t\t\t\t\t$category_name = preg_replace('/[^a-zA-Z0-9_ -]/s','',$data->category_name);\n\t\t\t\t\t$dept .= '<option value=\"'.$data->id.'\">'.$category_name.'</option>';\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\techo $dept;\n\t\t}\n\t}",
"private function services_dropdown()\n {\n\n //services list\n //needs to be pulled from a db in a future update\n $servicesList = array(\n \"Engine oil\",\n \"Transmission\",\n \"Front diff\",\n \"Lube\",\n \"Carb\",\n \"Battery\",\n \"Valve adjustment\",\n \"Shocks\",\n \"Radiator\",\n \"Thermostat\",\n \"Belt\",\n \"Primary clutch\",\n \"Secondary clutch\",\n \"Brakes\",\n \"Tires\",\n \"Other\",\n );\n\n\n echo \"<td><select name='service'>\";\n //loop over all the serves in the list\n foreach ($servicesList as $serviceItem) {\n echo \"<option value='\".$serviceItem.\"'>\".$serviceItem.\"</option>\";\n }\n\n echo \"</select></td>\";\n\n }",
"public function getDeptWiseInstitution()\n {\n include_once(CLASS_PATH.\"clsService.php\");\n $obj = new clsService;\n $deptId = $_REQUEST['deptId'];\n $selVal = $_REQUEST['selVal'];\n $dataArr = array();\n $opt = '<option value=\"0\">---Select Institution---</option>';\n if(!empty($deptId)){\n $dataArr['intDepartmentId'] =$deptId;\n $result = $obj->viewService('FAI',$dataArr);\n if($result->num_rows>0){\n $x=0;\n while($row=$result->fetch_array()){\n if($row[\"intInstitutionId\"]==$selVal){\n $selected='selected=\"selected\"';\n }else{\n $selected='';\n }\n $opt.='<option value=\"'.$row[\"intInstitutionId\"].'\" '.$selected.' >'.$row[\"vchInstitutionName\"].'</option>';\n\n }\n }else{\n // Nothing to do\n }\n }\n echo json_encode(array('opt' => $opt));\n }",
"public function get_department_dropdown_items() {\n $this->db->query('SELECT id, name FROM departments WHERE id > 0');\n\n // Fetching id and name of all department(s)\n return $this->db->resultSet();\n\n }",
"function displaySelectOptionsDepartments()\n {\n\t\t$strDisplay = \"\";\n\t\t$stmtQuery = \"SELECT department_id, name FROM icaict515a_departments\";\n $stmtQuery .= \" ORDER BY name DESC\";\n\n\t\tif( $resultQuery = $this->getDBConnection()->query( $stmtQuery ) )\n {\n\t\t while ($row = $resultQuery->fetch_array( MYSQL_ASSOC ) ) \n\t\t {\n $strSelected = ($this->deptID == $row['department_id'])? 'selected=selected' : '';\n $strDisplay .= \"<option value='{$row['department_id']}' {$strSelected}>{$row['name']}</option>\\n\";\n\n\t\t } // while\n \t\n\t\t $resultQuery->close(); \t// Free resultset \n }\n\n\t\techo $strDisplay;\n\n }",
"function erp_hr_get_departments_dropdown( $selected = '' ) {\n $departments = erp_hr_get_departments_dropdown_raw();\n $dropdown = '';\n if ( $departments ) {\n foreach ($departments as $key => $title) {\n $dropdown .= sprintf( \"<option value='%s'%s>%s</option>\\n\", $key, selected( $selected, $key, false ), $title );\n }\n }\n\n return $dropdown;\n}",
"public function getdepartments(){\n $this->autoRender = false;\n if($this->request->is('ajax')){\n $business_unit = $this->request->data('business_unit_id');\n $department_table = TableRegistry::get('Departments');\n $department = $department_table->find('all', array('fields' => array('id','title'),\n 'conditions' => array('Departments.status' => 1, 'business_unit_id' => $business_unit,\n 'sub_department_id' => 0)))->toArray();\n $html = '';\n $html .= '<select class=\"form-control\" name=\"department\" id=\"department\">';\n $html .= '<option selected=\"\" value=\"All\">All</option>';\n foreach ($department as $value_department):\n $html .= '<option value=\"'.$value_department['id'].'\">'.$value_department['title'].'</option>';\n endforeach;\n $html .= '</select>';\n echo $html;\n }\n }",
"public function getServicesList($org_user,$branch_id)\n {\n //Query To Get Service ID's List Of Specific Branch\n $sqlGetServiceID=\"SELECT * FROM service s INNER JOIN service_branch sb ON s.service_id=sb.service_id WHERE branch_id=?\";\n $values=array($branch_id);\n $serviceID=$this->getInfo($sqlGetServiceID,$values);\n //To Fill Out The Selection Box By Services List Of Specific Branch\n ?>\n <?php\n ?> \n <option>---</option>\n <?php\n foreach($serviceID as $i)\n {\n $id=$i['service_id'];\n ?> \n <option value=\"<?php echo $id; ?>\"><?php echo $i['service_name']; ?></option>\n <?php\n }\n ?>\n <?php\n }",
"function ShowDepartmentInSelect($arr_categs, $arr_props, $default_val, $select_name = 'arr_prop[]', $value=NULL, $params='')\n {\n ?><select name=\"<?=$select_name;?>\" class=\"<?=$params;?> slct0\"><?\n if( $value=='' ){?><option value=\"\" selected disabled=\"disabled\"><?=$default_val;?></option><?}\n else {?><option value=\"\" disabled=\"disabled\"><?=$default_val;?></option><?}\n $rows = count($arr_categs);\n for($i=0;$i<$rows;$i++){\n $id_cat = $arr_categs[$i]['id'];\n ?><option value=\"<?='categ='.$id_cat;?>\" <?=$arr_categs[$i]['disable'];?>><?=stripslashes($arr_categs[$i]['name']);?></option><?\n if(isset($arr_props[$id_cat])){\n $arr = array_keys($arr_props[$id_cat]);\n $rows2 = count($arr);\n for($j=0;$j<$rows2;$j++){\n $row = $arr_props[$id_cat][$arr[$j]];\n if($value!='' and $value == $row['id']) {\n ?><option value=\"<?=$row['id'];?>\"selected <?=$row['disable'];?>><?=$arr_categs[$i]['spacer'].' '.stripslashes($row['name']);?></option><?\n }\n else {\n ?><option value=\"<?=$row['id'];?>\"<?=$row['disable'];?>><?=$arr_categs[$i]['spacer'].' '.stripslashes($row['name']);?></option><?\n }\n \n }\n }\n }\n ?></select><?\n }",
"private function selectDepartments () {\n\t\t$arFilter = array('IBLOCK_ID'=>self::depBlockID, 'GLOBAL_ACTIVE'=>'Y');\n\t\t$rsSect = CIBlockSection::GetList(array($by=>$order), $arFilter, false);\n\n\t\twhile($arSect = $rsSect->Fetch()) {\n\t\t\tif (strlen(trim($arSect['XML_ID'])) > 0) {\n\t\t\t\t$this->arDepartments[trim($arSect['XML_ID'])] = $arSect['ID'];\n\t\t\t}\n\t\t}\n\t}",
"function getDepartmentSelectionList($company_id, $checked_array = array(), $dept_parent = 0, $spaces = 0) {\n\tglobal $departments_count, $AppUI;\n\t$parsed = '';\n\t\n\tif ($AppUI->isActiveModule ( 'departments' ) && canView ( 'departments' )) {\n\t\t$department = new CDepartment ();\n\t\t$depts_list = $department->departments ( $company_id, $dept_parent );\n\t\t\n\t\tforeach ( $depts_list as $dept_id => $dept_info ) {\n\t\t\t$selected = in_array ( $dept_id, $checked_array ) ? ' selected=\"selected\"' : '';\n\t\t\t\n\t\t\t$parsed .= '<option value=\"' . $dept_id . '\"' . $selected . '>' . str_repeat ( ' ', $spaces ) . $dept_info ['dept_name'] . '</option>';\n\t\t\t$parsed .= getDepartmentSelectionList ( $company_id, $checked_array, $dept_id, $spaces + 5 );\n\t\t}\n\t}\n\t\n\treturn $parsed;\n}",
"public function getSectionByDepartment(Request $request)\n {\n $dept = trim($request->dept);\n $result = DB::table('section')->where('dept_id',$dept)->get();\n echo '<option value=\"\">Select Section</option>';\n foreach ($result as $value) {\n echo '<option value='.$value->id.'>'.$value->section_name.'</option>';\n }\n }",
"protected function getDepartmentOptions()\n {\n $repository = $this->entityManager->getRepository('Vacancy\\Entity\\Department');\n $result = array();\n /**\n * @var Department $department\n */\n foreach ($repository->findAll() as $department) {\n $result[$department->getId()] = $department->getName();\n }\n\n return $result;\n }",
"public static function get_department_list() {\n\n\t\t$departments = array(\n\n\t\t\t'arts' => array(\n\t\t\t\t'philosophy' => 'Philosophy',\n\t\t\t\t'drama' => 'Drama',\n\t\t\t),\n\n\t\t\t'medicine' => array(\n\t\t\t\t'nursing' => 'Nursing',\n\t\t\t\t'midwifery' => 'Midwifery',\n\t\t\t),\n\n\t\t\t'sauder' => array(\n\t\t\t\t'sauder' => 'Sauder',\n\t\t\t),\n\n\t\t);\n\n\t\treturn apply_filters( 'ubc_press_departments_list', $departments );\n\n\t}",
"private function get_dept()\r\n {\r\n\t /** \r\n\t * variable streek staat in selectbox streek\r\n * twee varianten bijv. d2 en s2: resp dept_id = 2, streek_id = 2\r\n\t */\t\r\n if (isset($this->streek_id))\r\n { \r\n $sql = \"SELECT dept_id FROM tblDept_streek_dev WHERE streek_id = '$this->streek_id'\";\r\n $stmt = $this->db->query($sql);\r\n while($row = $stmt->fetch(PDO::FETCH_ASSOC)){\r\n extract($row);\r\n $this->deptID[] = $dept_id;\r\n } \r\n $stmt->closeCursor(); \r\n }\t\r\n else\r\n {\r\n $this->deptID[] = $this->dept_id;\r\n }\r\n \r\n /** huisID opslaan in array */\r\n $sql = \"SELECT hz.huis_id FROM tblHuizen_dev hz \";\r\n \r\n /** checkboxen sidebar */\r\n if ($this->count_checkbox != 0)\r\n {\r\n $sql .= \" INNER JOIN sidebar_huis sb ON hz.huis_id = sb.huis_id \";\r\n } \r\n \r\n $sql .= \"WHERE hz.dept_id IN (\";\r\n $z = count($this->deptID);\r\n for ($x = 0; $x < $z; $x++)\r\n {\r\n $sql .= $this->deptID[$x]. ',';\r\n }\r\n $sql = substr($sql, 0, strlen($sql) - 1);\r\n $sql .= \") AND hz.archief = '0' AND hz.zichtbaar = '0' \";\r\n \r\n /** checkboxen sidebar */\r\n if ($this->count_checkbox != 0)\r\n {\r\n for ($x = 0; $x < $this->count_checkbox; $x++)\r\n {\r\n $fieldname = $this->arrcheckbox[$x];\r\n $sql .= \" AND sb.$fieldname = '1'\";\r\n }\r\n }\r\n\t \r\n /** selectboxen m.u.v. prijs en beschikbaarheid */\r\n if ($this->sql_select_box != '')\r\n {\r\n $sql .= $this->sql_select_box. ' ';\r\n }\r\n \r\n $stmt = $this->db->query($sql);\r\n \r\n while ($row = $stmt->fetch(PDO::FETCH_ASSOC))\r\n {\r\n extract($row);\r\n array_push($this->huisID, $huis_id);\r\n }\t\r\n $stmt->closeCursor(); \r\n }",
"public function getDepartmentList() {\n $deptListQuery = \"select es_departmentsid,es_deptname from dlvry_departments\";\n $deptListData = $this->db->query($deptListQuery);\n $deptListResult = $deptListData->result_array();\n\n return $deptListResult;\n }",
"public function getDepartmentListByAreaID(Request $request)\n {\n $list = \"<option value=\\\"\\\">Select Department Name </option>\";\n if (!empty($request->area_id))\n {\n $lineList = Department::where('hr_department_area_id', $request->area_id)\n ->where('hr_department_status', '1')\n ->pluck('hr_department_name', 'hr_department_id');\n\n foreach ($lineList as $key => $value)\n {\n $list .= \"<option value=\\\"$key\\\">$value</option>\";\n }\n }\n return $list;\n }",
"private function print_department_options()\n\t{\n\t\tif (count($this->departments) == 1)\n\t\t{\n\t\t\treturn;\n\t\t}\n\t\telse\n\t\t{\n\t\t\techo '\n\t\t\t\t<tr>\n\t\t\t\t\t<td>Department</td>\n\t\t\t\t\t<td>'.cgi::html_checkboxes('department', $this->departments, $this->department, array('separator' => ' ')).'</td>\n\t\t\t\t</tr>\n\t\t\t';\n\t\t}\n\t}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test searchs based only on rooms. | public function testRoomSearch()
{
//#1 Search for room only with numbers
self::$helper->createRoomAttribute("Beamer");
self::$helper->createRoom('123', 1, 20, "TEST", " - Keine Zuordnung - ", array('Beamer' => 3));
self::$helper->searchForRoomByName("123");
$this->assertEquals("1", self::$helper->getNoOfResults());
$this->assertEquals("123", self::$helper->getFirstResult());
//#2 Search for room with letter
self::$helper->createRoom('032a', 1, 20, "TEST", " - Keine Zuordnung - ", array('Beamer' => 1));
self::$helper->searchForRoomByName("032a");
$this->assertEquals("1", self::$helper->getNoOfResults());
$this->assertEquals("032a", self::$helper->getFirstResult());
//#3 Search for 123a to trigger intelligent search
self::$helper->searchForRoomByName("123a");
$this->assertEquals("1", self::$helper->getNoOfResults());
$this->assertEquals("123", self::$helper->getFirstResult());
try
{
self::$webDriver->findElement(WebDriverBy::className('ilInfoMessage'));
}
catch (Exception $ex)
{
$this->fail("#3 Intelligent Search did not give a message" . $ex);
}
//#4 Search for empty room
self::$helper->searchForRoomByName("");
$this->assertEquals("2", self::$helper->getNoOfResults());
try
{
self::$webDriver->findElement(WebDriverBy::linkText('123'));
self::$webDriver->findElement(WebDriverBy::linkText('032a'));
}
catch (Exception $ex)
{
$this->fail("#4 Searching for all rooms did not find all rooms");
}
//#5 Search for only letter room
self::$helper->searchForRoomByName("IA");
$this->assertEquals("0", self::$helper->getNoOfResults());
self::$helper->createRoom('IA', 1, 20, "TEST", " - Keine Zuordnung - ", array('Beamer' => 1));
self::$helper->searchForRoomByName("IA");
$this->assertEquals("1", self::$helper->getNoOfResults());
$this->assertEquals("IA", self::$helper->getFirstResult());
//#6 (intelligent) search for room with - signed numbers
self::$helper->searchForRoomByName("-123");
$this->assertEquals("1", self::$helper->getNoOfResults());
//#7 (intelligent) search for room with + signed numbers
self::$helper->searchForRoomByName("+123");
$this->assertEquals("1", self::$helper->getNoOfResults());
//#8 Test SQL Injection
self::$helper->searchForRoomByName("\';SELECT * FROM usr;--");
$this->assertEquals("0", self::$helper->getNoOfResults());
//#9 Search for multiple rooms
self::$helper->searchForRoomByName("2");
$this->assertEquals("2", self::$helper->getNoOfResults());
try
{
self::$webDriver->findElement(WebDriverBy::linkText('123'));
self::$webDriver->findElement(WebDriverBy::linkText('032a'));
}
catch (Exception $ex)
{
$this->fail("#9 Searching for rooms containing 2 did not find all rooms");
}
self::$helper->deleteAllRooms();
} | [
"public function testAttributeSearch()\r\n\t{\r\n\t\tself::$helper->createRoomAttribute(\"Beamer\");\r\n\t\tself::$helper->createRoom('123', 1, 20, \"TEST\", \" - Keine Zuordnung - \", array('Beamer' => 3));\r\n\r\n\t\t//#1 Search for rooms with minimum 1 beamer\r\n\t\tself::$helper->searchForRoomByAll(\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", array('Beamer' => 1));\r\n\t\t$this->assertEquals(\"1\", self::$helper->getNoOfResults());\r\n\t\t$this->assertEquals(\"123\", self::$helper->getFirstResult());\r\n\r\n\t\t//#2 Search for rooms with minimum 0 beamer\r\n\t\tself::$helper->searchForRoomByAll(\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", array('Beamer' => 0));\r\n\t\t$this->assertEquals(\"1\", self::$helper->getNoOfResults());\r\n\t\t$this->assertEquals(\"123\", self::$helper->getFirstResult());\r\n\r\n\t\t//#3 Search for rooms with more than 3 beamer\r\n\t\tself::$helper->searchForRoomByAll(\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", array('Beamer' => 4));\r\n\t\t$this->assertEquals(\"0\", self::$helper->getNoOfResults());\r\n\r\n\t\t//#4 Search for rooms with 3 beamer\r\n\t\tself::$helper->searchForRoomByAll(\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", array('Beamer' => 3));\r\n\t\t$this->assertEquals(\"1\", self::$helper->getNoOfResults());\r\n\t\t$this->assertEquals(\"123\", self::$helper->getFirstResult());\r\n\r\n\t\t//#5 Search for rooms with negative beamer\r\n\t\tself::$helper->searchForRoomByAll(\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", array('Beamer' => -1));\r\n\t\t$this->assertEquals(\"0\", self::$helper->getNoOfResults());\r\n\r\n\t\tself::$helper->createRoom('123a', 1, 20, \"TEST\", \" - Keine Zuordnung - \", array('Beamer' => 1));\r\n\r\n\t\t//#6 Search for two rooms with enough beamers\r\n\t\tself::$helper->searchForRoomByAll(\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", array('Beamer' => 1));\r\n\t\t$this->assertEquals(\"2\", self::$helper->getNoOfResults());\r\n\r\n\t\t//#7 Search for one room while one is filtered out\r\n\t\tself::$helper->searchForRoomByAll(\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", array('Beamer' => 2));\r\n\t\t$this->assertEquals(\"1\", self::$helper->getNoOfResults());\r\n\t\t$this->assertEquals(\"123\", self::$helper->getFirstResult());\r\n\r\n\t\tself::$helper->deleteAllRooms();\r\n\t}",
"public function testRoomName()\r\n\t{\r\n\t\tself::$helper->createRoomAttribute('TEST_A');\r\n\t\tself::$helper->createRoom('123', 1, 20, \"\", \" - Keine Zuordnung - \", array('TEST_A' => 2));\r\n\t\tself::$helper->createRoom('123a', 1, 20, \"\", \" - Keine Zuordnung - \", array('TEST_A' => 3));\r\n\r\n\t\t//#1 Filter for 123\r\n\t\tself::$helper->applyRoomFilter('123', '', array('TEST_A' => 1));\r\n\t\t$this->assertEquals(2, self::$helper->getNoOfResults(), '#1 Filtering for 123 does not work');\r\n\r\n\t\t//#2 Filter for 123a\r\n\t\tself::$helper->applyRoomFilter('123a', '', array('TEST_A' => 1));\r\n\t\t$this->assertEquals(1, self::$helper->getNoOfResults(), '#2 Filtering for 123a does not work');\r\n\t\t$this->assertEquals('123a', self::$helper->getFirstResult(), '#2 Filtering for 123a does not work');\r\n\r\n\t\t//#3 Filter for 123b, triggers intelligent search\r\n\t\tself::$helper->applyRoomFilter('123b', '', array('TEST_A' => 1));\r\n\t\t$this->assertEquals(2, self::$helper->getNoOfResults(), '#3 Filtering for 123b does not work');\r\n\r\n\t\t//#4 Filter for I123, triggers intelligent search\r\n\t\tself::$helper->applyRoomFilter('I123', '', array('TEST_A' => 1));\r\n\t\t$this->assertEquals(2, self::$helper->getNoOfResults(), '#4 Filtering for I123 does not work');\r\n\r\n\t\t//#5 Filter for IA, should not trigger intelligent search\r\n\t\tself::$helper->applyRoomFilter('IA', '', array('TEST_A' => 1));\r\n\t\t$this->assertEquals(0, self::$helper->getNoOfResults(), '#5 Filtering for IA does not work');\r\n\r\n\t\t//#6 SQL evilness\r\n\t\tself::$helper->applyRoomFilter(\"0';SELECT * FROM bla;--\", '', array('TEST_A' => 1));\r\n\t\t$this->assertEquals(0, self::$helper->getNoOfResults(), '#6 SQL Injection works');\r\n\r\n\t\tself::$helper->deleteAllRooms();\r\n\t\tself::$helper->deleteRoomAttribute('TEST_A');\r\n\t}",
"public function testRoomParameter() {\n $roomTypes = RoomType::factory()->count( 5 )->create();\n $rooms = Room::factory()->count( 20 )->create();\n $roomType = $roomTypes->random();\n\n $response = $this->get( '/rooms/' . $roomType->id );\n\n $response->assertStatus( 200 )\n ->assertSeeText( 'Type' )\n ->assertViewIs( 'rooms.index' )\n ->assertViewHas( 'rooms' )\n ->assertSeeText( $roomType->name );\n\n }",
"public function testRoomServiceList()\n {\n $response = self::$av->roomList(self::$accessToken);\n $this->assertFalse($response->hasError);\n $this->assertGreaterThan(0, count($response->reply->getRooms()));\n }",
"public function get_about_rooms(){\r\n \t\tglobal $wpdb;\r\n \t\t$query = \"SELECT * FROM \".$wpdb->prefix.\"FNDRY_bookroom;\";\r\n \t\t$res = $wpdb->get_results($query);\r\n \t\tif ( isset( $res[0])){\r\n \t\t\treturn $res;\r\n \t\t}\r\n \t\treturn false;\r\n \t}",
"public function testDateTimeSearchWithBookings()\r\n\t{\r\n\t\tself::$helper->createRoomAttribute(\"Beamer\");\r\n\t\tself::$helper->createRoom('123', 1, 20, \"TEST\", \" - Keine Zuordnung - \", array('Beamer' => 3));\r\n\t\tself::$helper->createRoom('123a', 1, 15, \"TEST\", \" - Keine Zuordnung - \", array('Beamer' => 1));\r\n\r\n\t\tself::$helper->searchForRoomByAll(\"123\", \"\", \"\", \"\", \"\", \"23\", \"35\", \"23\", \"40\", array());\r\n\t\tself::$webDriver->findElement(WebDriverBy::linkText('Buchen'))->click();\r\n\t\tself::$helper->doABooking(\"TEST\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", false);\r\n\r\n\t\tself::$helper->searchForRoomByAll(\"123\", \"\", \"\", \"\", \"\", \"23\", \"45\", \"23\", \"50\", array());\r\n\t\tself::$webDriver->findElement(WebDriverBy::linkText('Buchen'))->click();\r\n\t\tself::$helper->doABooking(\"TEST\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", false);\r\n\r\n\t\t//#1 Search rooms before the two bookings\r\n\t\tself::$helper->searchForRoomByAll(\"\", \"\", \"\", \"\", \"\", \"23\", \"30\", \"23\", \"35\", array());\r\n\t\t$this->assertEquals(\"2\", self::$helper->getNoOfResults());\r\n\r\n\t\t//#2 Search rooms before and while one of the two bookings\r\n\t\tself::$helper->searchForRoomByAll(\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"23\", \"40\", array());\r\n\t\t$this->assertEquals(\"1\", self::$helper->getNoOfResults());\r\n\t\t$this->assertEquals(\"123a\", self::$helper->getFirstResult());\r\n\r\n\t\t//#3 Search rooms before, while and after one of the two bookings\r\n\t\tself::$helper->searchForRoomByAll(\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"23\", \"45\", array());\r\n\t\t$this->assertEquals(\"1\", self::$helper->getNoOfResults());\r\n\t\t$this->assertEquals(\"123a\", self::$helper->getFirstResult());\r\n\r\n\t\t//#4 Search rooms between the two bookings\r\n\t\tself::$helper->searchForRoomByAll(\"\", \"\", \"\", \"\", \"\", \"23\", \"40\", \"\", \"\", array());\r\n\t\t$this->assertEquals(\"2\", self::$helper->getNoOfResults());\r\n\r\n\t\t//#5 Search rooms while both bookings with free space inside\r\n\t\tself::$helper->searchForRoomByAll(\"\", \"\", \"\", \"\", \"\", \"23\", \"35\", \"23\", \"50\", array());\r\n\t\t$this->assertEquals(\"1\", self::$helper->getNoOfResults());\r\n\t\t$this->assertEquals(\"123a\", self::$helper->getFirstResult());\r\n\r\n\t\t//#6 Search rooms after both bookings\r\n\t\tself::$helper->searchForRoomByAll(\"\", \"\", \"\", \"\", \"\", \"23\", \"50\", \"23\", \"55\", array());\r\n\t\t$this->assertEquals(\"2\", self::$helper->getNoOfResults());\r\n\r\n\t\tself::$helper->deleteAllRooms();\r\n\t}",
"public static function getRoomsBySearchCriteria($searchCriteria) {\n \t$ret = array();\n \t$table = new Room();\n \t$select = $table->select(Zend_Db_Table::SELECT_WITH_FROM_PART)\n ->setIntegrityCheck(false)\n ->from(array(\"r\"=>\"room\"), array(\"roomId\"=>\"r.id\", \"rateId\"=>\"rate.id\", \"price\"=>\"rate.price\", \"adults\"=>\"r.max_adults\", \"children\"=>\"r.max_children\"))\n ->join(array(\"h\"=>\"hotel\"), \"r.hotel_id=h.id\")\n ->joinLeft(array(\"rate\"=>\"rate\"), \"r.id=rate.room_id\");\n if (!empty($searchCriteria[Hotel::CITY_PART])) {\n \t$select = $select->where(\"h.city_part=?\", $searchCriteria[Hotel::CITY_PART]);\n }\n if (!empty($searchCriteria[\"excludedHotels\"])) {\n\t $select = $select->where(\"h.id NOT IN (?)\", $searchCriteria[\"excludedHotels\"]);\n }\n if (!empty($searchCriteria[Room::MAX_ADULTS])) {\n \t\t$select = $select->where(\"r.max_adults >= ?\", $searchCriteria[Room::MAX_ADULTS]);\n }\n if (!empty($searchCriteria[Room::MAX_CHILDREN])) {\n \t$select = $select->where(\"r.max_children >= ?\", $searchCriteria[Room::MAX_CHILDREN]);\n }\n $select = $select->group(array(\"roomId\", \"rateId\", \"price\"));\n $select = $select->order(\"rate.price\")->order(\"r.max_adults DESC\")->order(\"r.max_children DESC\");\n return $table->fetchAll($select);\n \n// \t$table = new Room();\n// \tif (!empty($roomId) && $roomId != 0) {\n// \t\t$ret[0] = $table->findById($roomId);\n// \t} else if (!empty($hotelId) && $hotelId != 0) {\n// \t\t$table = new Hotel();\n// \t\t$hotel = $table->findById($hotelId);\n// \t\t$ret = Hotel::getRooms($hotel);\n// \t} else {\n// \t\t$excludeHotelsStr = \"\";\n// \t\tif (isset($excludeHotel)) {\n// \t\t\t$excludeHotelsStr = array(\n// \t\t\t\t$excludeHotel->id => $excludeHotel->id\n// \t\t\t);\n// \t\t}\n// \t\t$rooms = Room::getRoomsByCityPart($cityPart, $excludeHotelsStr);\n// \t\tforeach ($rooms as $room) {\n// \t\t\t$ret[$room->rid] = $room;\n// \t\t}\n// \t}\n \treturn $ret;\n }",
"public function searchRoom($roomID): Room\n {\n }",
"public function getRooms();",
"public function search_rooms(Request $request)\n { \n session()->forget('city_or_hotel');\n session()->forget('guest_type');\n \n\n $input = $request->all();\n if(!isset($request->page)){\n session()->forget('hotel_names');\n session()->forget('hotel_amenities');\n session()->forget('room_amenities');\n session()->forget('price');\n session()->put($input); \n }\n\n $rooms = $this->room->getRoomList();\n if(count($rooms->get()) > 0){ // to know rooms(Builder) has or not\n $rooms = $rooms->paginate(10);\n }\n else{\n return Redirect::back()->withErrors(['There is no hotel or room equal with your searching! Your previous search-list is below!']);\n }\n\n $rooms_list = $this->room->getRoomList()->get();\n\n $hotels = Hotel::all();\n $hotels_id = $rooms_list->pluck('hotel_id');\n $old_hotels = Hotel::whereIn('id', $hotels_id)->pluck('id')->toArray();\n\n $amenities = Amenity::all();\n $hotel_amenities = HotelAmenity::all();\n $hotel_amenities_id = $this->amenity_transform($hotel_amenities);\n $old_hotel_amenities = $request->hotel_amenities;\n\n\n $room_amenities = RoomAmenity::all();\n $room_amenities_id = $this->amenity_transform($room_amenities);\n $old_room_amenities = $request->room_amenities;\n\n return view('frontend.rooms', compact('hotels', 'rooms', 'amenities', 'hotel_amenities_id', 'room_amenities_id', 'old_hotels', 'old_hotel_amenities', 'old_room_amenities'));\n }",
"public function testGetRoomById()\n {\n }",
"function searchForChatrooms($search)\r\n\t{\r\n\t\t\t\t\r\n\t\t/***** Get the chatroom names that fit search ****/\r\n\t\t\t$sql = \"SELECT Chatroom_Name FROM Chatrooms WHERE Chatroom_Name LIKE '%$search%';\";\r\n\t\t\t$matchedChatrooms = $_SESSION['db']->select($sql);\r\n\t\t\t\r\n\t\t\t/**** If there is a count, we know there are chatrooms that match the search ***/\r\n\t\t\tif (count($matchedChatrooms) > 0)\r\n\t\t\t{\r\n\t\t\t\t//echo count($matchedChatrooms);\r\n\t\t\t\tfor ($i = 0; $i < count($matchedChatrooms); ++$i) {\r\n \t\t\t//echo $matchedChatrooms[$i]['Chatroom_Id'];\r\n\t\t\t\t\techo $matchedChatrooms[$i]['Chatroom_Name'];\r\n \t\t\t\r\n \t\t\t}\r\n\t\t\t\t\r\n\t\t\t}\t\t\t\r\n\t\t\telse \r\n\t\t\t{\r\n\t\t\t\techo \"No chatrooms for the following search: $search\";\r\n\t\t\t}\t\t\t\r\n\t\t\r\n\t\r\n\t}",
"function searchEBR($camp, $bldg, $room) {\n $events = DBHandler::searchEventsByRoom($camp, $bldg, $room);\n return $events;\n}",
"public function testNoRoomHasBeenCreated()\n {\n $crawler = $this->player->request('GET', '/rooms');\n $this->assertEquals(0, $crawler->filter('a:contains(\"Watch\")')->count());\n $this->assertEquals(0, $crawler->filter('a:contains(\"Join\")')->count());\n $this->assertEquals(1, $crawler->filter('a:contains(\"Create room\")')->count());\n $this->assertEquals(0, $crawler->filter('a:contains(\"Go to your room\")')->count());\n $this->assertEquals(0, $crawler->filter('a:contains(\"Leave room\")')->count());\n }",
"public function get_rooms() {\n\t\t\n\t\treturn $this->make_request( 'rooms', array(), 'GET', 'rooms' );\n\t\t\n\t}",
"public function searchRooms( Request $request, $keyword ){\n return ChatRoom::\n where('name', 'LIKE', '%' . $request->keyword . '%')\n ->orWhere('description', 'LIKE', '%' . $request->keyword . '%')\n ->with('users')\n ->with('activeUsers')\n ->with('owner')\n ->get();\n }",
"public function all_rooms()\n\t{\n\t\t$this->db->where('room_status = 1');\n\t\t$query = $this->db->get('room');\n\t\t\n\t\treturn $query;\n\t}",
"public function checkRoomAvailability($roomID);",
"function searchAvailable(Request $req){\n $searchType = request(\"searchType\");\n // 0=All Record, 1=Available Beds, 2=Occupied Beds\n\n $roomCount = Room::count(); // Room Count\n $bedCount = Bed::count(); // Bed Count\n\n $availableBed = 0;\n $beds = Bed::all();\n forEach($beds as $b){\n if($b->available == 1){\n $availableBed++;\n }\n }\n\n $rooms = Room::all();\n $room_nums = array(); // total rooms\n forEach($rooms as $data){\n array_push($room_nums,$data->room_number); // Add all rooms to array\n }\n\n if($searchType=='1'){ //Available Beds\n // joining room and bed table using room id where available is 1\n $room_data = Room::join('beds', 'beds.room_id', '=', 'rooms.room_id')->where('beds.available', '1')->get(['rooms.*', 'beds.*']);\n $allRooms = array(); //Empty Rooms array\n forEach($room_nums as $num){\n $allRooms[$num]=array();\n forEach($room_data as $data){\n if($data[\"room_number\"] == $num ){\n array_push($allRooms[$num],$data['bed_number']);\n }\n }\n }\n return view('admin.roomManagement', ['roomCount'=>$roomCount, 'bedCount'=>$bedCount, 'availableBed'=>$availableBed, 'room_data'=>$room_data, 'roomNumbers'=>$rooms]);\n }\n elseif($searchType=='2'){ //Occupied Beds\n // joining room and bed table using room id where available is 0\n $room_data = Room::join('beds', 'beds.room_id', '=', 'rooms.room_id')->where('beds.available', '0')->get(['rooms.*', 'beds.*']);\n $allRooms = array(); //Empty Rooms array\n forEach($room_nums as $num){\n $allRooms[$num]=array();\n forEach($room_data as $data){\n if($data[\"room_number\"] == $num ){\n array_push($allRooms[$num],$data['bed_number']);\n }\n }\n }\n return view('admin.roomManagement', ['roomCount'=>$roomCount, 'bedCount'=>$bedCount, 'availableBed'=>$availableBed, 'room_data'=>$room_data, 'roomNumbers'=>$rooms]);\n }\n else{ //All Record\n return redirect(\"/admin/room-management/\");\n }\n }"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get unique available day of month. Reset unavailable days if no available days in current month have left. | private static function getUniqueDay(string $date)
{
// Reset unavailable days, if all days in month already have been set as unavailable
if (count(self::$unavailable_days) === (self::getLastDayOfMonth($date) - 1)) {
self::$unavailable_days = [];
}
$day = rand(1, self::getLastDayOfMonth($date));
// Reset day if it is in unavailable days array
while (in_array($day, self::$unavailable_days)) {
$day = rand(1, self::getLastDayOfMonth($date));
}
// Set day as unavailable
array_push(self::$unavailable_days, $day);
return $day ?? 'error';
} | [
"private function _setMonthDay()\n {\n if ($this->isMonthDay()) {\n $monthDays = explode(',', $this->rruleProperties['BYMONTHDAY']);\n $this->monthDay = $monthDays;\n } else {\n $this->monthDay = array();\n }\n return $this->monthDay;\n }",
"public function getRepeatDayOfMonth()\n {\n return $this->_RepeatDayOfMonth;\n }",
"public static function dayOfMonth() : int {\n return self::get()->timestamp['month-day'];\n }",
"public abstract function getDayOfMonth(DateTime $time);",
"public function getDaysInCurrentMonth(){\n $firstDayThisMonth = date('Y-m-01');\n $lastDayThisMonth = date(\"Y-m-t\");\n $period = CarbonPeriod::between($firstDayThisMonth, $lastDayThisMonth);\n foreach ($period as $date) {\n $days[] = $date->format('Y-m-d');\n }\n \n return $days;\n }",
"public function getDisabledDaysForPickadate()\n {\n $result = array();\n $date = new \\DateTime( $this->selected_date ? $this->selected_date : $this->userData->get( 'date_from' ) );\n $date->modify( 'first day of this month' );\n $end_date = clone $date;\n $end_date->modify( 'first day of next month' );\n $Y = (int) $date->format( 'Y' );\n $n = (int) $date->format( 'n' ) - 1;\n while ( $date < $end_date ) {\n if ( ! array_key_exists( $date->format( 'Y-m-d' ), $this->slots ) ) {\n $result[] = array( $Y, $n, (int) $date->format( 'j' ) );\n }\n $date->add( $this->one_day );\n }\n\n return $result;\n }",
"public function getDayOfMonth() : string;",
"protected function getGregorianDayOfMonth()\r\n\t{\r\n\t\treturn $this->fGregorianDayOfMonth;\r\n\t}",
"public function enableNonMonthDays() {\n\t\t$this->displayNonMonthDays = true;\n\t}",
"public function getDayOfMonth()\n {\n $subscriptionDetailsget = $this->_subscribeNowDetails;\n\n return $subscriptionDetailsget['day_of_month'];\n }",
"public function getDays(){\n\t\t//$default[0] = 'Day';\n\t\t//$new = $default + $days;\n\t\tforeach (range(1, 31) as $number) {\n\t\t\t$days[$number] = $number;\n\t\t}\t\t\n\t\treturn $days;\n\t}",
"public function matchDayOfMonth()\n {\n $days = $this->getDataValue('days');\n return in_array(Carbon::now($this->automation->customer->getTimezone())->day, $days, false);\n }",
"function _erpal_employee_get_general_working_days($year, $month) {\n $monthNull = str_pad($month, 2 ,'0', STR_PAD_LEFT);\n\t$ldom = erpal_lib_date_ldom($month, $year); //last day of month\n\t$range_from = \"$year-$monthNull-01 00:00:00\";\n\t$range_till = \"$ldom 23:59:59\";\n $date_till_unix = strtotime($range_till);\n \n //now count every day from start to till and check if this is a working day\n $general_working_days = _erpal_employee_helper_general_working_days();\n \n $days = array();\n if (!$year || !$month)\n return $working_days;\n \n $day_count = 0;\n $date_current = strtotime($range_from.' +'.$day_count.' days'); //initalised get day \n while ($date_current <= $date_till_unix) { \n \n $current_week_day = date('w', $date_current);\n if (in_array($current_week_day, $general_working_days)) {\n //this is a general working day, add it to the result\n $days[] = strtotime(date('Y-m-d 00:00:00', $date_current));\n }\n \n $day_count++; //next day\n //get the day\n $date_current = strtotime($range_from.' +'.$day_count.' days');\n }\n \n return array_unique($days);\n}",
"public function getRuleRepeatDayOfMonth()\n {\n return $this->sRepeatDayofmonth;\n }",
"public function getApplicableDay()\n {\n return $this->applicableDay;\n }",
"public function prepareDaysPerMonth()\n {\n // Reset and copy\n $days_per_month = $this->days_per_month;\n $this->days_per_month = array();\n $index = 0;\n\n // Head\n foreach ($this->days_labels as $num_day => $label) {\n if ($num_day == 0) continue 1;\n $this->days_per_month['head'][] = $num_day;\n }\n\n // Get the day number of the first day\n $timestamp = $days_per_month[0];\n $first_day_number = date('w', $timestamp);\n $first_day_number = ($first_day_number == 0 ? 7 : $first_day_number);\n\n // Add possible days of previous month\n for ($added_day = $first_day_number; $added_day > 1; $added_day --) {\n $this->days_per_month['body'][$index][] = strtotime('-' . ($added_day - 1) . ' days', $timestamp);\n }\n\n // Add days of month\n foreach ($days_per_month as $timestamp) {\n $this->days_per_month['body'][$index][] = $timestamp;\n\n if (date('w', $timestamp) == 0) {\n $index += 1;\n }\n }\n\n // Add possible days of next month\n $added_day_number = 7 - count($this->days_per_month['body'][$index]);\n for ($added_day = 1; $added_day <= $added_day_number; $added_day ++) {\n $this->days_per_month['body'][$index][] = strtotime('+' . $added_day . ' days', $timestamp);\n }\n\n return $this;\n }",
"public function daysInMonth(): int;",
"public static function getDays();",
"function get_calendar_days_in_month_html($date) {\n\n $date_format = \"Y-m-d\"; \n \n $days_count = $date->format('t'); //Get number of days in this month\n \n $weeks_count = ceil($days_count / 7); //How many weeks in this month?\n\n $total_cells = $weeks_count * 7; \n \n //clone is used or we literally are modifying the $date variable\n $first_date_of_month = clone $date->modify('first day of this month');\n\n $first_day_of_month = $first_date_of_month->format(\"N\"); //returns 1-7 EG Mon-Fri\n\n $first_date_of_grid = $first_date_of_month ->modify('-' . $first_day_of_month . ' days');\n\n $todays_date = new DateTime();\n\n $todays_date_str = $todays_date->format($date_format);\n\n $selected_date_str = $date->format($date_format);\n\n $day_of_week = 1; //FIXME: allow starting with Sunday or whatever\n\n $ht = '<tr>';\n\n for ($cell=1; $cell <= $total_cells ; $cell++) { \n\n $classes = []; //CSS classes\n\n $current_date = $first_date_of_grid->modify(\"+1 day\");\n\n $current_date_str = $current_date->format($date_format);\n\n if($current_date_str == $todays_date_str) $classes[] = \"today\";\n\n if($selected_date_str == $todays_date_str) $classes[] = \"selected-date\";\n\n /* if current date is not from this month (EG previous or next month) then give \n it a special class, you might want to grey it out or whatever */\n if($date->format(\"m\") !== $current_date->format(\"m\")) $classes[] = \"grid-filler\";\n\n $ht .= '\n <td date=\"' . $current_date_str . '\" class=\"' . implode(\" \", $classes) . '\">' . $current_date->format(\"j\") . '</td>';\n\n $day_of_week ++;\n\n if($day_of_week == 8) {\n\n $ht .= '</tr>';\n if($cell < $total_cells) $ht .= '<tr>';\n $day_of_week = 1;\n\n }\n\n }\n\n return $ht;\n}"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.